diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8c04f7339a25..cafd01fcd3b6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -758,7 +758,6 @@ ################ /eng/ @hallipr @weshaggard @benbp @JimSuplizio /eng/code-quality-reports/ @mssfang @JonathanGiles -/eng/jacoco-test-coverage/ @srnagar @JonathanGiles /eng/spotbugs-aggregate-report/ @srnagar @JonathanGiles /eng/mgmt/ @weidongxu-microsoft @haolingdong-msft @XiaofeiCao @arthurma1978 @hallipr @weshaggard @benbp @JimSuplizio /eng/versioning/ @alzimmermsft @samvaity @g2vinay @JimSuplizio diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 800eaef4b22c..6f802b861ef1 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -127,6 +127,7 @@ "sdk/core/azure-xml/**", "sdk/cosmos/azure-cosmos-dotnet-benchmark/**", "sdk/core/azure-core-tracing-opentelemetry/**", + "sdk/core/azure-core-tracing-opentelemetry-samples/**", "sdk/cosmos/azure-cosmos-benchmark/**", "sdk/core/azure-json-gson/**", "sdk/cosmos/azure-cosmos-spark_3-1_2-12/**", @@ -330,6 +331,7 @@ "Mockito", "Mordor", "mosca", + "mpga", "msal", "msix", "MSRC", @@ -338,6 +340,7 @@ "odata", "ODBC", "okhttp", + "OTLP", "OLTP", "onboarded", "Onco", @@ -1038,6 +1041,12 @@ "Pdev" ] }, + { + "filename": "sdk/spring/spring-cloud-azure-starter-monitor/**.md", + "words": [ + "Djava" + ] + }, { "filename": "sdk/purview/azure-analytics-purview-sharing/**", "words": [ diff --git a/common/smoke-tests/pom.xml b/common/smoke-tests/pom.xml index e5c314fae19a..7955e381fbe8 100644 --- a/common/smoke-tests/pom.xml +++ b/common/smoke-tests/pom.xml @@ -118,7 +118,7 @@ com.azure azure-cosmos - 4.49.0 + 4.50.0 @@ -130,25 +130,25 @@ com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.16.9 + 1.17.0 com.azure azure-storage-blob - 12.23.1 + 12.24.0 diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/StepVerifierCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/StepVerifierCheck.java new file mode 100644 index 000000000000..a92bf04f6f11 --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/StepVerifierCheck.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.FullIdent; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; + +/** + * Ensures that test code doesn't use {@code StepVerifier.setDefaultTimeout}. + *

+ * This configures a default timeout used by all {@code StepVerifier} calls, which can lead to flaky tests as this may + * affect other tests. + */ +public class StepVerifierCheck extends AbstractCheck { + private static final String SET_DEFAULT_TIMEOUT = "setDefaultTimeout"; + private static final String FULLY_QUALIFIED = "reactor.test.StepVerifier.setDefaultTimeout"; + private static final String METHOD_CALL = "StepVerifier.setDefaultTimeout"; + + static final String ERROR_MESSAGE = "Do not use StepVerifier.setDefaultTimeout as it can affect other tests. " + + "Instead use expect* methods on StepVerifier and use verify(Duration) to " + + "set timeouts on a test-by-test basis."; + + private boolean hasStaticImport; + + @Override + public int[] getDefaultTokens() { + return new int[]{ + TokenTypes.METHOD_CALL, + TokenTypes.STATIC_IMPORT + }; + } + + @Override + public int[] getAcceptableTokens() { + return getDefaultTokens(); + } + + @Override + public int[] getRequiredTokens() { + return getDefaultTokens(); + } + + @Override + public void init() { + super.init(); + hasStaticImport = false; + } + + @Override + public void destroy() { + super.destroy(); + hasStaticImport = false; + } + + @Override + public void visitToken(DetailAST ast) { + if (ast.getType() == TokenTypes.STATIC_IMPORT) { + // Compare if the static import is for StepVerifier.setDefaultTimeout + hasStaticImport = FULLY_QUALIFIED.equals( + FullIdent.createFullIdent(ast.getFirstChild().getNextSibling()).getText()); + } else { + // Compare the method call against StepVerifier.setDefaultTimeout or setDefaultTimeout if there is a static + // import for StepVerifier.setDefaultTimeout + FullIdent fullIdent = FullIdent.createFullIdentBelow(ast); + if (hasStaticImport && SET_DEFAULT_TIMEOUT.equals(fullIdent.getText())) { + log(ast.getLineNo(), fullIdent.getColumnNo(), ERROR_MESSAGE); + } else if (METHOD_CALL.equals(fullIdent.getText())) { + log(ast.getLineNo(), fullIdent.getColumnNo(), ERROR_MESSAGE); + } else if (FULLY_QUALIFIED.equals(fullIdent.getText())) { + log(ast.getLineNo(), fullIdent.getColumnNo(), ERROR_MESSAGE); + } + } + } +} diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index 3b6602fc88a0..e4dfe75efa70 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -113,7 +113,10 @@ + files="com.azure.monitor.applicationinsights.spring.AzureSpringMonitorAutoConfig.java"/> + + @@ -434,6 +437,7 @@ the main ServiceBusClientBuilder. --> + diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml index d235b73b44f6..9d76af0f18f2 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml @@ -408,5 +408,7 @@ page at http://checkstyle.sourceforge.net/config.html --> + + diff --git a/eng/code-quality-reports/src/main/resources/revapi/revapi.json b/eng/code-quality-reports/src/main/resources/revapi/revapi.json index 639feca01fd7..9162d7b5e17e 100644 --- a/eng/code-quality-reports/src/main/resources/revapi/revapi.json +++ b/eng/code-quality-reports/src/main/resources/revapi/revapi.json @@ -299,6 +299,19 @@ "code": "java.annotation.added", "new": "class com.azure.cosmos.models.ChangeFeedProcessorItem", "justification": "Modifies the type of changeFeedMetaData from ChangeFeedMetaData to JsonNode." + }, + { + "ignore": true, + "code": "java.field.addedStaticField", + "new": "field com.azure.data.schemaregistry.SchemaRegistryVersion.V2022_10", + "justification": "Another version of Schema Registry API released." + }, + { + "regex": true, + "ignore": true, + "code": "java.field.addedStaticField", + "new": "field com\\.azure\\.data\\.schemaregistry\\.models\\.SchemaFormat\\.(CUSTOM|JSON)", + "justification": "Additional schema formats are supported by Schema Registry." } ] } diff --git a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml index 4fd5b0cf37d3..7dddfc325231 100644 --- a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml +++ b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml @@ -462,8 +462,9 @@ + + - @@ -2697,4 +2698,18 @@ + + + + + + + + + + + + + + diff --git a/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/StepVerifierCheckTest.java b/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/StepVerifierCheckTest.java new file mode 100644 index 000000000000..d9cc94f9c413 --- /dev/null +++ b/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/StepVerifierCheckTest.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; +import com.puppycrawl.tools.checkstyle.Checker; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.Arrays; + +public class StepVerifierCheckTest extends AbstractModuleTestSupport { + private Checker checker; + + @BeforeEach + public void prepare() throws Exception { + checker = createChecker(createModuleConfig(StepVerifierCheck.class)); + } + + @AfterEach + public void cleanup() { + checker.destroy(); + } + + @Override + protected String getPackageLocation() { + return "com/azure/tools/checkstyle/checks/StepVerifierCheck"; + } + + @Test + public void noStepVerifierSetDefaultTimeout() throws Exception { + File file = TestUtils.createCheckFile("publicClassImplementsPublicApi", Arrays.asList( + "package com.azure;", + "public class MyTestClass {", + "}" + )); + + verify(checker, new File[]{file}, file.getAbsolutePath()); + } + + @Test + public void stepVerifierSetDefaultTimeout() throws Exception { + File file = TestUtils.createCheckFile("publicClassImplementsPublicApi", Arrays.asList( + "package com.azure;", + "public class MyTestClass {", + " public void test() {", + " StepVerifier.setDefaultTimeout(Duration.ofSeconds(10));", // line 4, column 9 + " }", + "}" + )); + + String[] expected = new String[] { + String.format("%d:%d: %s", 4, 9, StepVerifierCheck.ERROR_MESSAGE) + }; + verify(checker, new File[]{file}, file.getAbsolutePath(), expected); + } + + @Test + public void stepVerifierStaticImportSetDefaultTimeout() throws Exception { + File file = TestUtils.createCheckFile("publicClassImplementsPublicApi", Arrays.asList( + "package com.azure;", + "import static reactor.test.StepVerifier.setDefaultTimeout;", + "public class MyTestClass {", + " public void test() {", + " setDefaultTimeout(Duration.ofSeconds(10));", // line 5, column 9 + " }", + "}" + )); + + String[] expected = new String[] { + String.format("%d:%d: %s", 5, 9, StepVerifierCheck.ERROR_MESSAGE) + }; + verify(checker, new File[]{file}, file.getAbsolutePath(), expected); + } + + @Test + public void stepVerifierFullyQualifierSetDefaultTimeout() throws Exception { + File file = TestUtils.createCheckFile("publicClassImplementsPublicApi", Arrays.asList( + "package com.azure;", + "public class MyTestClass {", + " public void test() {", + " reactor.test.StepVerifier.setDefaultTimeout(Duration.ofSeconds(10));", // line 4, column 9 + " }", + "}" + )); + + String[] expected = new String[] { + String.format("%d:%d: %s", 4, 9, StepVerifierCheck.ERROR_MESSAGE) + }; + verify(checker, new File[]{file}, file.getAbsolutePath(), expected); + } +} diff --git a/eng/common/pipelines/templates/steps/sparse-checkout.yml b/eng/common/pipelines/templates/steps/sparse-checkout.yml index ab95453954cb..448cb2c2e313 100644 --- a/eng/common/pipelines/templates/steps/sparse-checkout.yml +++ b/eng/common/pipelines/templates/steps/sparse-checkout.yml @@ -29,7 +29,7 @@ steps: if (!$dir) { $dir = "./$($repository.Name)" } - New-Item $dir -ItemType Directory -Force + New-Item $dir -ItemType Directory -Force | Out-Null Push-Location $dir if (Test-Path .git/info/sparse-checkout) { @@ -70,9 +70,14 @@ steps: # sparse-checkout commands after initial checkout will auto-checkout again if (!$hasInitialized) { - Write-Host "git -c advice.detachedHead=false checkout $($repository.Commitish)" + # Remove refs/heads/ prefix from branch names + $commitish = $repository.Commitish -replace '^refs/heads/', '' + + # use -- to prevent git from interpreting the commitish as a path + Write-Host "git -c advice.detachedHead=false checkout $commitish --" + # This will use the default branch if repo.Commitish is empty - git -c advice.detachedHead=false checkout $($repository.Commitish) + git -c advice.detachedHead=false checkout $commitish -- } else { Write-Host "Skipping checkout as repo has already been initialized" } diff --git a/eng/common/scripts/Get-BuildSourceDescription.ps1 b/eng/common/scripts/Get-BuildSourceDescription.ps1 new file mode 100644 index 000000000000..b0856101538d --- /dev/null +++ b/eng/common/scripts/Get-BuildSourceDescription.ps1 @@ -0,0 +1,24 @@ +param( + [string]$Variable, + [switch]$IsOutput +) + +$repoUrl = $env:BUILD_REPOSITORY_URI +$sourceBranch = $env:BUILD_SOURCEBRANCH + +$description = "[$sourceBranch]($repoUrl/tree/$sourceBranch)" +if ($sourceBranch -match "^refs/heads/(.+)$") { + $description = "Branch: [$($Matches[1])]($repoUrl/tree/$sourceBranch)" +} elseif ($sourceBranch -match "^refs/tags/(.+)$") { + $description = "Tag: [$($Matches[1])]($repoUrl/tree/$sourceBranch)" +} elseif ($sourceBranch -match "^refs/pull/(\d+)/(head|merge)$") { + $description = "Pull request: $repoUrl/pull/$($Matches[1])" +} + +if ($IsOutput) { + Write-Host "Setting output variable '$Variable' to '$description'" + Write-Host "##vso[task.setvariable variable=$Variable;isoutput=true]$description" +} else { + Write-Host "Setting variable '$Variable' to '$description'" + Write-Host "##vso[task.setvariable variable=$Variable]$description" +} diff --git a/eng/common/scripts/Helpers/CommandInvocation-Helpers.ps1 b/eng/common/scripts/Helpers/CommandInvocation-Helpers.ps1 new file mode 100644 index 000000000000..5dc0c8c7da1a --- /dev/null +++ b/eng/common/scripts/Helpers/CommandInvocation-Helpers.ps1 @@ -0,0 +1,42 @@ +function Invoke-LoggedCommand($Command, $ExecutePath, [switch]$GroupOutput) +{ + $pipelineBuild = !!$env:TF_BUILD + $startTime = Get-Date + + if($pipelineBuild -and $GroupOutput) { + Write-Host "##[group]$Command" + } else { + Write-Host "> $Command" + } + + if($ExecutePath) { + Push-Location $ExecutePath + } + + try { + Invoke-Expression $Command + + $duration = (Get-Date) - $startTime + + if($pipelineBuild -and $GroupOutput) { + Write-Host "##[endgroup]" + } + + if($LastExitCode -ne 0) + { + if($pipelineBuild) { + Write-Error "##[error]Command failed to execute ($duration): $Command`n" + } else { + Write-Error "Command failed to execute ($duration): $Command`n" + } + } + else { + Write-Host "Command succeeded ($duration)`n" + } + } + finally { + if($ExecutePath) { + Pop-Location + } + } +} diff --git a/eng/common/scripts/New-RegenerateMatrix.ps1 b/eng/common/scripts/New-RegenerateMatrix.ps1 new file mode 100644 index 000000000000..1df97420c25d --- /dev/null +++ b/eng/common/scripts/New-RegenerateMatrix.ps1 @@ -0,0 +1,102 @@ +[CmdLetBinding()] +param ( + [Parameter()] + [string]$OutputDirectory, + + [Parameter()] + [string]$OutputVariableName, + + [Parameter()] + [int]$JobCount = 8, + + # The minimum number of items per job. If the number of items is less than this, then the number of jobs will be reduced. + [Parameter()] + [int]$MinimumPerJob = 10, + + [Parameter()] + [string]$OnlyTypespec +) + +. (Join-Path $PSScriptRoot common.ps1) + +[bool]$OnlyTypespec = $OnlyTypespec -in @("true", "t", "1", "yes", "y") + +# Divide the items into groups of approximately equal size. +function Split-Items([array]$Items) { + # given $Items.Length = 22 and $JobCount = 5 + # then $itemsPerGroup = 4 + # and $largeJobCount = 2 + # and $group.Length = 5, 5, 4, 4, 4 + $itemCount = $Items.Length + $jobsForMinimum = $itemCount -lt $MinimumPerJob ? 1 : [math]::Floor($itemCount / $MinimumPerJob) + + if ($JobCount -gt $jobsForMinimum) { + $JobCount = $jobsForMinimum + } + + $itemsPerGroup = [math]::Floor($itemCount / $JobCount) + $largeJobCount = $itemCount % $itemsPerGroup + $groups = [object[]]::new($JobCount) + + $i = 0 + for ($g = 0; $g -lt $JobCount; $g++) { + $groupLength = if ($g -lt $largeJobCount) { $itemsPerGroup + 1 } else { $itemsPerGroup } + $group = [object[]]::new($groupLength) + $groups[$g] = $group + for ($gi = 0; $gi -lt $groupLength; $gi++) { + $group[$gi] = $Items[$i++] + } + } + + Write-Host "$itemCount items split into $JobCount groups of approximately $itemsPerGroup items each." + + return , $groups +} + +# ensure the output directory exists +New-Item -ItemType Directory -Path $OutputDirectory -Force | Out-Null + +if (Test-Path "Function:$GetDirectoriesForGenerationFn") { + $directoriesForGeneration = &$GetDirectoriesForGenerationFn +} +else { + $directoriesForGeneration = Get-ChildItem "$RepoRoot/sdk" -Directory | Get-ChildItem -Directory +} + +if ($OnlyTypespec) { + $directoriesForGeneration = $directoriesForGeneration | Where-Object { Test-Path "$_/tsp-location.yaml" } +} + +[array]$packageDirectories = $directoriesForGeneration +| Sort-Object -Property FullName +| ForEach-Object { + [ordered]@{ + "PackageDirectory" = "$($_.Parent.Name)/$($_.Name)" + "ServiceArea" = $_.Parent.Name + } +} + +$batches = Split-Items -Items $packageDirectories + +$matrix = [ordered]@{} +for ($i = 0; $i -lt $batches.Length; $i++) { + $batch = $batches[$i] + $json = $batch.PackageDirectory | ConvertTo-Json -AsArray + + $firstPrefix = $batch[0].ServiceArea.Substring(0, 2) + $lastPrefix = $batch[-1].ServiceArea.Substring(0, 2) + + $key = "$firstPrefix`_$lastPrefix`_$i" + $fileName = "$key.json" + + Write-Host "`n`n==================================" + Write-Host $fileName + Write-Host "==================================" + $json | Out-Host + $json | Out-File "$OutputDirectory/$fileName" + + $matrix[$key] = [ordered]@{ "JobKey" = $key; "DirectoryList" = $fileName } +} + +$compressed = ConvertTo-Json $matrix -Depth 100 -Compress +Write-Output "##vso[task.setVariable variable=$OutputVariableName;isOutput=true]$compressed" diff --git a/eng/common/scripts/Service-Level-Readme-Automation.ps1 b/eng/common/scripts/Service-Level-Readme-Automation.ps1 index e7dcbf7bf5fd..a03e78e4e223 100644 --- a/eng/common/scripts/Service-Level-Readme-Automation.ps1 +++ b/eng/common/scripts/Service-Level-Readme-Automation.ps1 @@ -40,7 +40,10 @@ param( [string]$ClientSecret, [Parameter(Mandatory = $false)] - [string]$ReadmeFolderRoot = "docs-ref-services" + [string]$ReadmeFolderRoot = "docs-ref-services", + + [Parameter(Mandatory = $false)] + [array]$Monikers = @('latest', 'preview', 'legacy') ) . $PSScriptRoot/common.ps1 . $PSScriptRoot/Helpers/Service-Level-Readme-Automation-Helpers.ps1 @@ -50,8 +53,7 @@ param( Set-StrictMode -Version 3 $fullMetadata = Get-CSVMetadata -$monikers = @("latest", "preview") -foreach($moniker in $monikers) { +foreach($moniker in $Monikers) { # The onboarded packages return is key-value pair, which key is the package index, and value is the package info from {metadata}.json # E.g. # Key as: @azure/storage-blob diff --git a/eng/common/scripts/TypeSpec-Project-Generate.ps1 b/eng/common/scripts/TypeSpec-Project-Generate.ps1 index e323f42aff6d..05a0e0bdfd45 100644 --- a/eng/common/scripts/TypeSpec-Project-Generate.ps1 +++ b/eng/common/scripts/TypeSpec-Project-Generate.ps1 @@ -11,6 +11,7 @@ param ( $ErrorActionPreference = "Stop" . $PSScriptRoot/Helpers/PSModule-Helpers.ps1 +. $PSScriptRoot/Helpers/CommandInvocation-Helpers.ps1 . $PSScriptRoot/common.ps1 Install-ModuleIfNotInstalled "powershell-yaml" "0.4.1" | Import-Module @@ -21,38 +22,30 @@ function NpmInstallForProject([string]$workingDirectory) { Write-Host "Generating from $currentDur" if (Test-Path "package.json") { + Write-Host "Removing existing package.json" Remove-Item -Path "package.json" -Force } if (Test-Path ".npmrc") { + Write-Host "Removing existing .nprc" Remove-Item -Path ".npmrc" -Force } if (Test-Path "node_modules") { + Write-Host "Removing existing node_modules" Remove-Item -Path "node_modules" -Force -Recurse } if (Test-Path "package-lock.json") { + Write-Host "Removing existing package-lock.json" Remove-Item -Path "package-lock.json" -Force } - #default to root/eng/emitter-package.json but you can override by writing - #Get-${Language}-EmitterPackageJsonPath in your Language-Settings.ps1 $replacementPackageJson = Join-Path $PSScriptRoot "../../emitter-package.json" - if (Test-Path "Function:$GetEmitterPackageJsonPathFn") { - $replacementPackageJson = &$GetEmitterPackageJsonPathFn - } Write-Host("Copying package.json from $replacementPackageJson") Copy-Item -Path $replacementPackageJson -Destination "package.json" -Force - - #default to root/eng/emitter-package-lock.json but you can override by writing - #Get-${Language}-EmitterPackageLockPath in your Language-Settings.ps1 $emitterPackageLock = Join-Path $PSScriptRoot "../../emitter-package-lock.json" - if (Test-Path "Function:$GetEmitterPackageLockPathFn") { - $emitterPackageLock = &$GetEmitterPackageLockPathFn - } - $usingLockFile = Test-Path $emitterPackageLock if ($usingLockFile) { @@ -68,12 +61,10 @@ function NpmInstallForProject([string]$workingDirectory) { } if ($usingLockFile) { - Write-Host "> npm ci" - npm ci + Invoke-LoggedCommand "npm ci" } else { - Write-Host "> npm install" - npm install + Invoke-LoggedCommand "npm install" } if ($LASTEXITCODE) { exit $LASTEXITCODE } diff --git a/eng/common/scripts/Update-DocsMsMetadata.ps1 b/eng/common/scripts/Update-DocsMsMetadata.ps1 index 94aa8c1efe1b..9b665dbc98d3 100644 --- a/eng/common/scripts/Update-DocsMsMetadata.ps1 +++ b/eng/common/scripts/Update-DocsMsMetadata.ps1 @@ -205,7 +205,7 @@ function UpdateDocsMsMetadataForPackage($packageInfoJsonLocation) { Write-Host "The docs metadata json $packageMetadataName does not exist, creating a new one to docs repo..." New-Item -ItemType Directory -Path $packageInfoLocation -Force } - $packageInfoJson = ConvertTo-Json $packageInfo + $packageInfoJson = ConvertTo-Json $packageInfo -Depth 100 Set-Content ` -Path $packageInfoLocation/$packageMetadataName ` -Value $packageInfoJson diff --git a/eng/common/scripts/Update-DocsMsPackageMonikers.ps1 b/eng/common/scripts/Update-DocsMsPackageMonikers.ps1 new file mode 100644 index 000000000000..f1f282a6b372 --- /dev/null +++ b/eng/common/scripts/Update-DocsMsPackageMonikers.ps1 @@ -0,0 +1,122 @@ +<# +.SYNOPSIS +Move metadata JSON and package-level overview markdown files for deprecated packages to the legacy folder. + +.DESCRIPTION +Move onboarding information to the "legacy" moniker for whose support is "deprecated" in the Metadata CSV. +Only one version of a package can be documented in the "legacy" moniker. If multiple versions are available, +the "latest" version will be used and the "preview" version will be deleted. + +.PARAMETER DocRepoLocation +The location of the target docs repository. +#> + +param( + [Parameter(Mandatory = $true)] + [string] $DocRepoLocation +) + +. (Join-Path $PSScriptRoot common.ps1) + +Set-StrictMode -Version 3 + +function getPackageMetadata($moniker) { + $jsonFiles = Get-ChildItem -Path (Join-Path $DocRepoLocation "metadata/$moniker") -Filter *.json + $metadata = @{} + + foreach ($jsonFile in $jsonFiles) { + $packageMetadata = Get-Content $jsonFile -Raw | ConvertFrom-Json -AsHashtable + $packageIdentity = $packageMetadata.Name + if (Test-Path "Function:$GetPackageIdentity") { + $packageIdentity = &$GetPackageIdentity $packageMetadata + } + + $metadata[$packageIdentity] = @{ File = $jsonFile; Metadata = $packageMetadata } + } + + return $metadata +} + +function getPackageInfoFromLookup($packageIdentity, $version, $lookupTable) { + if ($lookupTable.ContainsKey($packageIdentity)) { + if ($lookupTable[$packageIdentity]['Metadata'].Version -eq $version) { + # Only return if the version matches + return $lookupTable[$packageIdentity] + } + } + + return $null +} + +function moveToLegacy($packageInfo) { + $docsMsMetadata = &$GetDocsMsMetadataForPackageFn -PackageInfo $packageInfo['Metadata'] + + Write-Host "Move to legacy: $($packageInfo['Metadata'].Name)" + $packageInfoPath = $packageInfo['File'] + Move-Item "$($packageInfoPath.Directory)/$($packageInfoPath.BaseName).*" "$DocRepoLocation/metadata/legacy/" -Force + + $readmePath = "$DocRepoLocation/$($docsMsMetadata.PreviewReadMeLocation)/$($docsMsMetadata.DocsMsReadMeName)-readme.md" + if (Test-Path $readmePath) { + Move-Item ` + $readmePath ` + "$DocRepoLocation/$($docsMsMetadata.LegacyReadMeLocation)/" ` + -Force + } +} + +function deletePackageInfo($packageInfo) { + $docsMsMetadata = &$GetDocsMsMetadataForPackageFn -PackageInfo $packageInfo['Metadata'] + + Write-Host "Delete superseded package: $($packageInfo['Metadata'].Name)" + $packageInfoPath = $packageInfo['File'] + Remove-Item "$($packageInfoPath.Directory)/$($packageInfoPath.BaseName).*" -Force + + $readmePath = "$DocRepoLocation/$($docsMsMetadata.PreviewReadMeLocation)/$($docsMsMetadata.DocsMsReadMeName)-readme.md" + if (Test-Path $readmePath) { + Remove-Item $readmePath -Force + } +} + +$metadataLookup = @{ + 'latest' = getPackageMetadata 'latest' + 'preview' = getPackageMetadata 'preview' +} +$deprecatedPackages = (Get-CSVMetadata).Where({ $_.Support -eq 'deprecated' }) + +foreach ($package in $deprecatedPackages) { + $packageIdentity = $package.Package + if (Test-Path "Function:$GetPackageIdentityFromCsvMetadata") { + $packageIdentity = &$GetPackageIdentityFromCsvMetadata $package + } + + $packageInfoPreview = $packageInfoLatest = $null + if ($package.VersionPreview) { + $packageInfoPreview = getPackageInfoFromLookup ` + -packageIdentity $packageIdentity ` + -version $package.VersionPreview ` + -lookupTable $metadataLookup['preview'] + } + + if ($package.VersionGA) { + $packageInfoLatest = getPackageInfoFromLookup ` + -packageIdentity $packageIdentity ` + -version $package.VersionGA ` + -lookupTable $metadataLookup['latest'] + } + + if (!$packageInfoPreview -and !$packageInfoLatest) { + # Nothing to move or delete + continue + } + + if ($packageInfoPreview -and $packageInfoLatest) { + # Delete metadata JSON and package-level overview markdown files for + # the preview version instead of moving both. This mitigates situations + # where the "latest" verison doesn't have a package-level overview + # markdown file and the "preview" version does. + deletePackageInfo $packageInfoPreview + moveToLegacy $packageInfoLatest + } else { + moveToLegacy ($packageInfoPreview ?? $packageInfoLatest) + } +} diff --git a/eng/common/scripts/Update-GeneratedSdks.ps1 b/eng/common/scripts/Update-GeneratedSdks.ps1 new file mode 100644 index 000000000000..dd671f6d8ad8 --- /dev/null +++ b/eng/common/scripts/Update-GeneratedSdks.ps1 @@ -0,0 +1,16 @@ +[CmdLetBinding()] +param( + [Parameter(Mandatory)] + [string]$PackageDirectoriesFile +) + +. $PSScriptRoot/common.ps1 +. $PSScriptRoot/Helpers/CommandInvocation-Helpers.ps1 + +$ErrorActionPreference = 'Stop' + +if (Test-Path "Function:$UpdateGeneratedSdksFn") { + &$UpdateGeneratedSdksFn $PackageDirectoriesFile +} else { + Write-Error "Function $UpdateGeneratedSdksFn not implemented in Language-Settings.ps1" +} diff --git a/eng/common/scripts/common.ps1 b/eng/common/scripts/common.ps1 index e6b5f09fe7c8..cef0b23c5620 100644 --- a/eng/common/scripts/common.ps1 +++ b/eng/common/scripts/common.ps1 @@ -60,10 +60,11 @@ $GetPackageLevelReadmeFn = "Get-${Language}-PackageLevelReadme" $GetRepositoryLinkFn = "Get-${Language}-RepositoryLink" $GetEmitterAdditionalOptionsFn = "Get-${Language}-EmitterAdditionalOptions" $GetEmitterNameFn = "Get-${Language}-EmitterName" -$GetEmitterPackageJsonPathFn = "Get-${Language}-EmitterPackageJsonPath" -$GetEmitterPackageLockPathFn = "Get-${Language}-EmitterPackageLockPath" +$GetDirectoriesForGenerationFn = "Get-${Language}-DirectoriesForGeneration" +$UpdateGeneratedSdksFn = "Update-${Language}-GeneratedSdks" # Expected to be set in eng/scripts/docs/Docs-Onboarding.ps1 $SetDocsPackageOnboarding = "Set-${Language}-DocsPackageOnboarding" $GetDocsPackagesAlreadyOnboarded = "Get-${Language}-DocsPackagesAlreadyOnboarded" $GetPackageIdentity = "Get-${Language}-PackageIdentity" +$GetPackageIdentityFromCsvMetadata = "Get-${Language}-PackageIdentityFromCsvMetadata" diff --git a/eng/common/scripts/stress-testing/deploy-stress-tests.ps1 b/eng/common/scripts/stress-testing/deploy-stress-tests.ps1 index 8abaa40d0cb4..61d8f947d800 100644 --- a/eng/common/scripts/stress-testing/deploy-stress-tests.ps1 +++ b/eng/common/scripts/stress-testing/deploy-stress-tests.ps1 @@ -31,7 +31,10 @@ param( [Parameter(Mandatory=$False)][string]$MatrixDisplayNameFilter, [Parameter(Mandatory=$False)][array]$MatrixFilters, [Parameter(Mandatory=$False)][array]$MatrixReplace, - [Parameter(Mandatory=$False)][array]$MatrixNonSparseParameters + [Parameter(Mandatory=$False)][array]$MatrixNonSparseParameters, + + # Prevent kubernetes from deleting nodes or rebalancing pods related to this test for N days + [Parameter(Mandatory=$False)][ValidateRange(1, 14)][int]$LockDeletionForDays ) . $PSScriptRoot/stress-test-deployment-lib.ps1 diff --git a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 index bdaec9e711a9..dde43649a391 100644 --- a/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 +++ b/eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1 @@ -59,7 +59,7 @@ function Login([string]$subscription, [string]$clusterGroup, [switch]$skipPushIm $kubeContext = (RunOrExitOnFailure kubectl config view -o json) | ConvertFrom-Json -AsHashtable $defaultNamespace = $null $targetContext = $kubeContext.contexts.Where({ $_.name -eq $clusterName }) | Select -First 1 - if ($targetContext -ne $null -and $targetContext.PSObject.Properties.Name -match "namespace") { + if ($targetContext -ne $null -and $targetContext.Contains('context') -and $targetContext.context.Contains('namespace')) { $defaultNamespace = $targetContext.context.namespace } @@ -107,7 +107,8 @@ function DeployStressTests( [Parameter(Mandatory=$False)][string]$MatrixDisplayNameFilter, [Parameter(Mandatory=$False)][array]$MatrixFilters, [Parameter(Mandatory=$False)][array]$MatrixReplace, - [Parameter(Mandatory=$False)][array]$MatrixNonSparseParameters + [Parameter(Mandatory=$False)][array]$MatrixNonSparseParameters, + [Parameter(Mandatory=$False)][int]$LockDeletionForDays ) { if ($environment -eq 'pg') { if ($clusterGroup -or $subscription) { @@ -168,7 +169,7 @@ function DeployStressTests( -subscription $subscription } - if ($FailedCommands.Count -lt $pkgs.Count) { + if ($FailedCommands.Count -lt $pkgs.Count -and !$Template) { Write-Host "Releases deployed by $deployer" Run helm list --all-namespaces -l deployId=$deployer } @@ -211,12 +212,14 @@ function DeployStressPackage( } $imageTagBase += "/$($pkg.Namespace)/$($pkg.ReleaseName)" - Write-Host "Creating namespace $($pkg.Namespace) if it does not exist..." - kubectl create namespace $pkg.Namespace --dry-run=client -o yaml | kubectl apply -f - - if ($LASTEXITCODE) {exit $LASTEXITCODE} - Write-Host "Adding default resource requests to namespace/$($pkg.Namespace)" - $limitRangeSpec | kubectl apply -n $pkg.Namespace -f - - if ($LASTEXITCODE) {exit $LASTEXITCODE} + if (!$Template) { + Write-Host "Creating namespace $($pkg.Namespace) if it does not exist..." + kubectl create namespace $pkg.Namespace --dry-run=client -o yaml | kubectl apply -f - + if ($LASTEXITCODE) {exit $LASTEXITCODE} + Write-Host "Adding default resource requests to namespace/$($pkg.Namespace)" + $limitRangeSpec | kubectl apply -n $pkg.Namespace -f - + if ($LASTEXITCODE) {exit $LASTEXITCODE} + } $dockerBuildConfigs = @() @@ -317,8 +320,18 @@ function DeployStressPackage( $generatedConfigPath = Join-Path $pkg.Directory generatedValues.yaml $subCommand = $Template ? "template" : "upgrade" - $installFlag = $Template ? "" : "--install" - $helmCommandArg = "helm", $subCommand, $releaseName, $pkg.Directory, "-n", $pkg.Namespace, $installFlag, "--set", "stress-test-addons.env=$environment", "--values", $generatedConfigPath + $subCommandFlag = $Template ? "--debug" : "--install" + $helmCommandArg = "helm", $subCommand, $releaseName, $pkg.Directory, "-n", $pkg.Namespace, $subCommandFlag, "--values", $generatedConfigPath, "--set", "stress-test-addons.env=$environment" + + if ($LockDeletionForDays) { + $date = (Get-Date).AddDays($LockDeletionForDays).ToUniversalTime() + $isoDate = $date.ToString("o") + # Tell kubernetes job to run only on this specific future time. Technically it will run once per year. + $cron = "$($date.Minute) $($date.Hour) $($date.Day) $($date.Month) *" + + Write-Host "PodDisruptionBudget will be set to prevent deletion until $isoDate" + $helmCommandArg += "--set", "PodDisruptionBudgetExpiry=$($isoDate)", "--set", "PodDisruptionBudgetExpiryCron=$cron" + } $result = (Run @helmCommandArg) 2>&1 | Write-Host @@ -342,7 +355,7 @@ function DeployStressPackage( # Helm 3 stores release information in kubernetes secrets. The only way to add extra labels around # specific releases (thereby enabling filtering on `helm list`) is to label the underlying secret resources. # There is not currently support for setting these labels via the helm cli. - if(!$Template) { + if (!$Template) { $helmReleaseConfig = RunOrExitOnFailure kubectl get secrets ` -n $pkg.Namespace ` -l "status=deployed,name=$releaseName" ` diff --git a/eng/common/testproxy/target_version.txt b/eng/common/testproxy/target_version.txt index eaeb3436b8d8..49c8aea654f1 100644 --- a/eng/common/testproxy/target_version.txt +++ b/eng/common/testproxy/target_version.txt @@ -1 +1 @@ -1.0.0-dev.20230818.1 +1.0.0-dev.20230912.4 diff --git a/eng/emitter-package.json b/eng/emitter-package.json index ccf78420f433..c48cf55f3056 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,6 +1,6 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-java": "0.8.11" + "@azure-tools/typespec-java": "0.8.13" } -} \ No newline at end of file +} diff --git a/eng/jacoco-test-coverage/CHANGELOG.md b/eng/jacoco-test-coverage/CHANGELOG.md deleted file mode 100644 index 4d28c9afbfe3..000000000000 --- a/eng/jacoco-test-coverage/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Release History - -## 1.0.0-SNAPSHOT (Unreleased) - - diff --git a/eng/jacoco-test-coverage/README.md b/eng/jacoco-test-coverage/README.md deleted file mode 100644 index 56ddda8e4e3d..000000000000 --- a/eng/jacoco-test-coverage/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Microsoft Azure Client Library - Test coverage -Nothing exciting to see here, this just aggregates the modules for reporting purposes. \ No newline at end of file diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml deleted file mode 100644 index 727496176aab..000000000000 --- a/eng/jacoco-test-coverage/pom.xml +++ /dev/null @@ -1,644 +0,0 @@ - - - - - - 4.0.0 - - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../sdk/parents/azure-client-sdk-parent - - - com.azure - jacoco-test-coverage - 1.0.0-SNAPSHOT - - Microsoft Azure Client Library - Test coverage - Package for generating test coverage report for Azure Client Libraries - 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-ai-anomalydetector - 3.0.0-beta.6 - - - com.azure - azure-ai-formrecognizer - 4.2.0-beta.1 - - - com.azure - azure-ai-personalizer - 1.0.0-beta.2 - - - com.azure - azure-ai-metricsadvisor - 1.2.0-beta.1 - - - com.azure - azure-ai-textanalytics - 5.4.0-beta.1 - - - com.azure - azure-communication-chat - 1.4.0-beta.1 - - - com.azure - azure-communication-common - 2.0.0-beta.2 - - - com.azure - azure-communication-identity - 1.5.0-beta.1 - - - com.azure - azure-communication-networktraversal - 1.1.0-beta.3 - - - com.azure - azure-communication-sms - 1.2.0-beta.1 - - - com.azure - azure-communication-phonenumbers - 1.2.0-beta.1 - - - com.azure - azure-communication-callingserver - 1.0.0-beta.5 - - - com.azure - azure-containers-containerregistry - 1.3.0-beta.1 - - - com.azure - azure-analytics-synapse-accesscontrol - 1.0.0-beta.5 - - - com.azure - azure-analytics-synapse-artifacts - 1.0.0-beta.14 - - - com.azure - azure-analytics-synapse-spark - 1.0.0-beta.6 - - - com.azure - azure-core - 1.44.0-beta.1 - - - com.azure - azure-core-amqp - 2.9.0-beta.6 - - - com.azure - azure-core-amqp-experimental - 1.0.0-beta.1 - - - com.azure - azure-core-experimental - 1.0.0-beta.44 - - - com.azure - azure-core-http-jdk-httpclient - 1.0.0-beta.7 - - - com.azure - azure-core-http-netty - 1.14.0-beta.2 - - - com.azure - azure-core-http-okhttp - 1.12.0-beta.1 - - - com.azure - azure-core-management - 1.12.0-beta.1 - - - com.azure - azure-core-serializer-avro-apache - 1.0.0-beta.40 - - - com.azure - azure-core-serializer-json-gson - 1.3.0-beta.1 - - - com.azure - azure-core-serializer-json-jackson - 1.5.0-beta.1 - - - com.azure - azure-core-tracing-opentelemetry - 1.0.0-beta.40 - - - com.azure - azure-cosmos - 4.50.0-beta.1 - - - com.azure - azure-cosmos-encryption - 2.5.0-beta.1 - - - com.azure - azure-data-appconfiguration - 1.5.0-beta.2 - - - com.azure - azure-data-schemaregistry - 1.4.0-beta.3 - - - com.azure - azure-data-schemaregistry-apacheavro - 1.2.0-beta.3 - - - com.azure - azure-data-tables - 12.4.0-beta.1 - - - com.azure - azure-identity - 1.11.0-beta.1 - - - com.azure - azure-identity-extensions - 1.2.0-beta.2 - - - com.azure - azure-iot-deviceupdate - 1.1.0-beta.1 - - - com.azure - azure-json - 1.2.0-beta.1 - - - com.azure - azure-messaging-eventgrid - 4.18.0-beta.1 - - - com.azure - azure-messaging-eventgrid-cloudnative-cloudevents - 1.0.0-beta.2 - - - com.azure - azure-messaging-eventhubs - 5.16.0-beta.2 - - - com.azure - azure-messaging-eventhubs-checkpointstore-blob - 1.17.0-beta.2 - - - com.azure - azure-messaging-servicebus - 7.15.0-beta.4 - - - com.azure - azure-messaging-webpubsub - 1.3.0-beta.1 - - - com.azure - azure-monitor-ingestion - 1.1.0-beta.1 - - - com.azure - azure-monitor-opentelemetry-exporter - 1.0.0-beta.12 - - - com.azure - azure-monitor-query - 1.3.0-beta.2 - - - com.azure - azure-search-documents - 11.6.0-beta.9 - - - com.azure - azure-security-keyvault-administration - 4.4.0-beta.1 - - - com.azure - azure-security-keyvault-certificates - 4.6.0-beta.1 - - - com.azure - azure-security-keyvault-jca - 2.8.0-beta.1 - - - com.azure - azure-security-keyvault-keys - 4.7.0-beta.1 - - - com.azure - azure-security-keyvault-secrets - 4.7.0-beta.1 - - - com.azure - azure-storage-common - 12.23.0 - - - com.azure - azure-storage-blob - 12.24.0 - - - com.azure - azure-storage-blob-batch - 12.20.0 - - - com.azure - azure-storage-blob-changefeed - 12.0.0-beta.19 - - - com.azure - azure-storage-blob-cryptography - 12.23.0 - - - com.azure - azure-storage-blob-nio - 12.0.0-beta.20 - - - com.azure - azure-storage-file-share - 12.20.0 - - - com.azure - azure-storage-file-datalake - 12.17.0 - - - com.azure - azure-storage-internal-avro - 12.9.0 - - - com.azure - azure-storage-queue - 12.19.0 - - - com.azure - azure-sdk-template - 1.2.2-beta.1 - - - com.azure - azure-sdk-template-two - 1.0.0-beta.1 - - - com.azure - azure-sdk-template-three - 1.0.0-beta.1 - - - com.azure - azure-xml - 1.0.0-beta.3 - - - - com.azure.resourcemanager - azure-resourcemanager - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-appplatform - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-appservice - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-authorization - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-compute - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-containerinstance - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-containerregistry - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-containerservice - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-cosmos - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-dns - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-keyvault - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-monitor - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-msi - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-network - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-resources - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-sql - 2.31.0-beta.1 - - - com.azure.resourcemanager - azure-resourcemanager-storage - 2.31.0-beta.1 - - - - com.azure.spring - spring-cloud-azure-core - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-resourcemanager - 4.12.0-beta.1 - - - com.azure.spring - spring-messaging-azure - 4.12.0-beta.1 - - - com.azure.spring - spring-messaging-azure-eventhubs - 4.12.0-beta.1 - - - com.azure.spring - spring-messaging-azure-servicebus - 4.12.0-beta.1 - - - com.azure.spring - spring-messaging-azure-storage-queue - 4.12.0-beta.1 - - - com.azure.spring - spring-integration-azure-core - 4.12.0-beta.1 - - - com.azure.spring - spring-integration-azure-eventhubs - 4.12.0-beta.1 - - - com.azure.spring - spring-integration-azure-servicebus - 4.12.0-beta.1 - - - com.azure.spring - spring-integration-azure-storage-queue - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-autoconfigure - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-stream-binder-servicebus-core - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-stream-binder-servicebus - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-stream-binder-eventhubs - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-stream-binder-eventhubs-core - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-service - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-trace-sleuth - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-actuator - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-actuator-autoconfigure - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-appconfiguration-config - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-appconfiguration-config-web - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-feature-management - 4.12.0-beta.1 - - - com.azure.spring - spring-cloud-azure-feature-management-web - 4.12.0-beta.1 - - - com.azure - azure-spring-data-cosmos - 3.39.0-beta.1 - - - com.azure - azure-digitaltwins-core - 1.4.0-beta.1 - - - com.azure - azure-mixedreality-authentication - 1.3.0-beta.1 - - - com.azure - azure-mixedreality-remoterendering - 1.2.0-beta.1 - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0-M3 - - - - - - com.azure:azure-monitor-opentelemetry-exporter:[1.0.0-beta.12] - - - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.9 - - - report-aggregate - verify - - report-aggregate - - - ${project.reporting.outputDirectory}/test-coverage - - **/com/azure/cosmos/implementation/apachecommons/**/* - **/com/azure/cosmos/implementation/guava25/**/* - **/com/azure/cosmos/implementation/guava27/**/* - **/com/azure/cosmos/encryption/implementation/mdesrc/**/* - - - - - - - - diff --git a/eng/mgmt/automation/api-specs.yaml b/eng/mgmt/automation/api-specs.yaml index 85aa6c8f40f4..4151d28f7a81 100644 --- a/eng/mgmt/automation/api-specs.yaml +++ b/eng/mgmt/automation/api-specs.yaml @@ -96,6 +96,8 @@ service-map: service: servicemap servicebus: suffix: generated +solutions: + service: managedapplications sql: suffix: generated storage: diff --git a/eng/mgmt/automation/generation.yml b/eng/mgmt/automation/generation.yml index f3da9df30783..d1423af5d341 100644 --- a/eng/mgmt/automation/generation.yml +++ b/eng/mgmt/automation/generation.yml @@ -33,6 +33,7 @@ steps: # - template: /eng/common/testproxy/test-proxy-tool.yml # parameters: # runProxy: true +# targetVersion: 1.0.0-dev.20230908.1 - bash: | export PATH=$JAVA_HOME_11_X64/bin:$PATH diff --git a/eng/mgmt/automation/parameters.py b/eng/mgmt/automation/parameters.py index 3517a28ce121..6be41d6089b0 100644 --- a/eng/mgmt/automation/parameters.py +++ b/eng/mgmt/automation/parameters.py @@ -16,7 +16,7 @@ SDK_ROOT = '../../../' # related to file dir AUTOREST_CORE_VERSION = '3.9.7' -AUTOREST_JAVA = '@autorest/java@4.1.19' +AUTOREST_JAVA = '@autorest/java@4.1.21' DEFAULT_VERSION = '1.0.0-beta.1' GROUP_ID = 'com.azure.resourcemanager' API_SPECS_FILE = 'api-specs.yaml' diff --git a/eng/pipelines/docindex.yml b/eng/pipelines/docindex.yml index bab1ffefc82d..55720dd2989a 100644 --- a/eng/pipelines/docindex.yml +++ b/eng/pipelines/docindex.yml @@ -33,7 +33,15 @@ jobs: ContainerRegistryClientId: $(azuresdkimages-cr-clientid) ContainerRegistryClientSecret: $(azuresdkimages-cr-clientsecret) ImageId: "$(DocValidationImageId)" - # Call update docs ci script to onboard packages + + - task: Powershell@2 + inputs: + pwsh: true + filePath: eng/common/scripts/Update-DocsMsPackageMonikers.ps1 + arguments: -DocRepoLocation $(DocRepoLocation) + displayName: Move deprecated packages to legacy moniker + condition: and(succeeded(), or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Force.MainUpdate'], 'true'))) + - task: Powershell@2 inputs: pwsh: true @@ -116,6 +124,15 @@ jobs: Copy-Item "./eng/repo-docs/docms/daily.update.setting.xml" -Destination "~/.m2/settings.xml" displayName: 'Configure mvn' workingDirectory: $(Build.SourcesDirectory) + + - task: Powershell@2 + inputs: + pwsh: true + filePath: eng/common/scripts/Update-DocsMsPackageMonikers.ps1 + arguments: -DocRepoLocation $(DocRepoLocation) + displayName: Move deprecated packages to legacy moniker + condition: and(succeeded(), or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Force.MainUpdate'], 'true'))) + - task: Powershell@2 inputs: pwsh: true diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index ad166aef6c77..0e23dacfb1d3 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -79,10 +79,6 @@ jobs: parameters: runProxy: true - - template: /eng/pipelines/templates/steps/restore-test-proxy-recordings.yml - parameters: - Paths: $(SparseCheckoutDirectories) - - pwsh: | $files = Get-ChildItem -Path $(Build.SourcesDirectory) -Filter test-proxy.log foreach($file in $files){ diff --git a/eng/pipelines/templates/jobs/ci.versions.tests.yml b/eng/pipelines/templates/jobs/ci.versions.tests.yml index b4f9cf4d6f61..5fc0caeb8ab8 100644 --- a/eng/pipelines/templates/jobs/ci.versions.tests.yml +++ b/eng/pipelines/templates/jobs/ci.versions.tests.yml @@ -69,10 +69,6 @@ jobs: parameters: runProxy: true - - template: /eng/pipelines/templates/steps/restore-test-proxy-recordings.yml - parameters: - Paths: $(SparseCheckoutDirectories) - - pwsh: | $files = Get-ChildItem -Path $(Build.SourcesDirectory) -Filter test-proxy.log foreach($file in $files){ diff --git a/eng/pipelines/templates/steps/restore-test-proxy-recordings.yml b/eng/pipelines/templates/steps/restore-test-proxy-recordings.yml deleted file mode 100644 index 3156a393267c..000000000000 --- a/eng/pipelines/templates/steps/restore-test-proxy-recordings.yml +++ /dev/null @@ -1,16 +0,0 @@ -parameters: - - name: Paths - type: object - default: [] - -steps: - - task: PowerShell@2 - displayName: 'Restore Test Proxy Recordings' - inputs: - targetType: inline - script: | - $paths = '${{ convertToJson(parameters.Paths) }}'.Trim('"') | ConvertFrom-Json - foreach($path in $paths) { - Get-ChildItem -Recurse -Path $(Build.SourcesDirectory)$path -Filter assets.json | ForEach-Object { test-proxy restore -a $_.FullName } - } - pwsh: true diff --git a/eng/scripts/Language-Settings.ps1 b/eng/scripts/Language-Settings.ps1 index c491b5afd330..48e53e584c30 100644 --- a/eng/scripts/Language-Settings.ps1 +++ b/eng/scripts/Language-Settings.ps1 @@ -741,6 +741,7 @@ function Get-java-DocsMsMetadataForPackage($PackageInfo) { DocsMsReadMeName = $readmeName LatestReadMeLocation = 'docs-ref-services/latest' PreviewReadMeLocation = 'docs-ref-services/preview' + LegacyReadMeLocation = 'docs-ref-services/legacy' Suffix = '' } } diff --git a/eng/scripts/TypeSpec-Compare-CurrentToCodegeneration.ps1 b/eng/scripts/TypeSpec-Compare-CurrentToCodegeneration.ps1 index e05014b1f0a4..87f48d77bff1 100644 --- a/eng/scripts/TypeSpec-Compare-CurrentToCodegeneration.ps1 +++ b/eng/scripts/TypeSpec-Compare-CurrentToCodegeneration.ps1 @@ -43,7 +43,7 @@ Verify no diff " # prevent warning related to EOL differences which triggers an exception for some reason -git -c core.safecrlf=false diff --ignore-space-at-eol --exit-code -- "*.java" +git -c core.safecrlf=false diff --ignore-space-at-eol --exit-code -- "*.java" ":(exclude)**/src/test/**" ":(exclude)**/src/samples/**" if ($LastExitCode -ne 0) { $status = git status -s | Out-String diff --git a/eng/scripts/docs/Docs-Onboarding.ps1 b/eng/scripts/docs/Docs-Onboarding.ps1 index eefb6c418936..e00958605ac2 100644 --- a/eng/scripts/docs/Docs-Onboarding.ps1 +++ b/eng/scripts/docs/Docs-Onboarding.ps1 @@ -1,12 +1,5 @@ #$SetDocsPackageOnboarding = "Set-${Language}-DocsPackageOnboarding" function Set-java-DocsPackageOnboarding($moniker, $metadata, $docRepoLocation, $packageSourceOverride) { - - # Do not write onboarding information for legacy moniker - # TODO: remove this once legacy moniker is properly configured - if ($moniker -eq 'legacy') { - return - } - $packageJsonPath = Join-Path $docRepoLocation "package.json" $onboardingInfo = Get-Content $packageJsonPath | ConvertFrom-Json @@ -64,3 +57,9 @@ function Get-java-DocsPackagesAlreadyOnboarded($docRepoLocation, $moniker) { function Get-java-PackageIdentity($package) { return "$($package['Group']):$($package['Name'])" } + +# Declared in common.ps1 as +# $GetPackageIdentityFromCsvMetadata = "Get-${Language}-PackageIdentityFromCsvMetadata" +function Get-java-PackageIdentityFromCsvMetadata($package) { + return "$($package.GroupId):$($Package.Package)" +} \ No newline at end of file diff --git a/eng/scripts/docs/Docs-ToC.ps1 b/eng/scripts/docs/Docs-ToC.ps1 index 3152853a0e37..03c68676ed28 100644 --- a/eng/scripts/docs/Docs-ToC.ps1 +++ b/eng/scripts/docs/Docs-ToC.ps1 @@ -15,13 +15,12 @@ function Get-java-OnboardedDocsMsPackagesForMoniker ($DocRepoLocation, $moniker) $onboardingSpec = ConvertFrom-Json (Get-Content $packageOnboardingFiles -Raw) if ("preview" -eq $moniker) { $onboardingSpec = $onboardingSpec | Where-Object { $_.output_path -eq "preview/docs-ref-autogen" } - } - elseif("latest" -eq $moniker) { + } elseif("latest" -eq $moniker) { $onboardingSpec = $onboardingSpec | Where-Object { $_.output_path -eq "docs-ref-autogen" } + } elseif ("legacy" -eq $moniker) { + $onboardingSpec = $onboardingSpec | Where-Object { $_.output_path -eq "legacy/docs-ref-autogen" } } - # TODO: Add support for "legacy" moniker - $onboardedPackages = @{} foreach ($spec in $onboardingSpec.packages) { $packageName = $spec.packageArtifactId diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 8e23faf7e4bc..b8601cb632a3 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -200,7 +200,6 @@ io.opentelemetry:opentelemetry-sdk;1.28.0 io.opentelemetry:opentelemetry-sdk-metrics;1.28.0 io.opentelemetry:opentelemetry-sdk-logs;1.28.0 io.opentelemetry:opentelemetry-exporter-logging;1.28.0 -io.opentelemetry:opentelemetry-exporter-jaeger;1.28.0 io.opentelemetry:opentelemetry-exporter-otlp;1.28.0 io.opentelemetry:opentelemetry-api-logs;1.26.0-alpha io.opentelemetry:opentelemetry-sdk-testing;1.28.0 diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 5edd65e6bdb7..c0d432746ea1 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -37,18 +37,20 @@ com.azure:azure-sdk-all;1.0.0;1.0.0 com.azure:azure-sdk-parent;1.6.0;1.6.0 com.azure:azure-client-sdk-parent;1.7.0;1.7.0 com.azure:azure-ai-anomalydetector;3.0.0-beta.5;3.0.0-beta.6 +com.azure:azure-ai-contentsafety;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-ai-documenttranslator;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-ai-formrecognizer;4.1.0;4.2.0-beta.1 +com.azure:azure-ai-formrecognizer;4.1.1;4.2.0-beta.1 com.azure:azure-ai-formrecognizer-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-ai-metricsadvisor;1.1.17;1.2.0-beta.1 +com.azure:azure-ai-metricsadvisor;1.1.18;1.2.0-beta.1 com.azure:azure-ai-metricsadvisor-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-ai-openai;1.0.0-beta.4;1.0.0-beta.5 +com.azure:azure-ai-openai;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-ai-personalizer;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-ai-textanalytics;5.3.2;5.4.0-beta.1 +com.azure:azure-ai-textanalytics;5.3.3;5.4.0-beta.1 com.azure:azure-ai-textanalytics-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-ai-translation-text;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-analytics-purview-catalog;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-analytics-purview-scanning;1.0.0-beta.2;1.0.0-beta.3 +com.azure:azure-analytics-purview-sharing;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-analytics-purview-administration;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-analytics-purview-workflow;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-analytics-synapse-accesscontrol;1.0.0-beta.4;1.0.0-beta.5 @@ -61,18 +63,19 @@ com.azure:azure-aot-graalvm-support-netty;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-aot-graalvm-samples;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-aot-graalvm-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-code-customization-parent;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-communication-chat;1.3.11;1.4.0-beta.1 +com.azure:azure-communication-callautomation;1.0.4;1.1.0-beta.1 com.azure:azure-communication-callingserver;1.0.0-beta.4;1.0.0-beta.5 -com.azure:azure-communication-callautomation;1.0.3;1.1.0-beta.1 -com.azure:azure-communication-common;1.2.11;2.0.0-beta.2 +com.azure:azure-communication-chat;1.3.12;1.4.0-beta.1 +com.azure:azure-communication-common;1.2.12;2.0.0-beta.2 com.azure:azure-communication-common-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-communication-sms;1.1.16;1.2.0-beta.1 -com.azure:azure-communication-identity;1.4.9;1.5.0-beta.1 -com.azure:azure-communication-phonenumbers;1.1.5;1.2.0-beta.1 -com.azure:azure-communication-networktraversal;1.1.0-beta.2;1.1.0-beta.3 +com.azure:azure-communication-email;1.0.6;1.1.0-beta.1 +com.azure:azure-communication-identity;1.4.10;1.5.0-beta.1 com.azure:azure-communication-jobrouter;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-communication-rooms;1.0.3;1.1.0-beta.1 -com.azure:azure-containers-containerregistry;1.2.0;1.3.0-beta.1 +com.azure:azure-communication-networktraversal;1.1.0-beta.2;1.1.0-beta.3 +com.azure:azure-communication-phonenumbers;1.1.6;1.2.0-beta.1 +com.azure:azure-communication-rooms;1.0.4;1.1.0-beta.1 +com.azure:azure-communication-sms;1.1.17;1.2.0-beta.1 +com.azure:azure-containers-containerregistry;1.2.1;1.3.0-beta.1 com.azure:azure-containers-containerregistry-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core;1.43.0;1.44.0-beta.1 com.azure:azure-core-amqp;2.8.9;2.9.0-beta.6 @@ -93,33 +96,38 @@ com.azure:azure-core-test;1.20.0;1.21.0-beta.1 com.azure:azure-core-tracing-opentelemetry;1.0.0-beta.39;1.0.0-beta.40 com.azure:azure-core-tracing-opentelemetry-samples;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-version-tests;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-cosmos;4.49.0;4.50.0-beta.1 +com.azure:azure-cosmos;4.50.0;4.51.0-beta.1 com.azure:azure-cosmos-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure:azure-cosmos-dotnet-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure.cosmos.spark:azure-cosmos-spark_3_2-12;1.0.0-beta.1;1.0.0-beta.1 -com.azure.cosmos.spark:azure-cosmos-spark_3-1_2-12;4.21.1;4.22.0-beta.1 -com.azure.cosmos.spark:azure-cosmos-spark_3-2_2-12;4.21.1;4.22.0-beta.1 -com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12;4.21.1;4.22.0-beta.1 -com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12;4.21.1;4.22.0-beta.1 -com.azure:azure-cosmos-encryption;2.4.0;2.5.0-beta.1 +com.azure.cosmos.spark:azure-cosmos-spark_3-1_2-12;4.22.0;4.23.0-beta.1 +com.azure.cosmos.spark:azure-cosmos-spark_3-2_2-12;4.22.0;4.23.0-beta.1 +com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12;4.22.0;4.23.0-beta.1 +com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12;4.22.0;4.23.0-beta.1 +com.azure:azure-cosmos-encryption;2.5.0;2.6.0-beta.1 com.azure:azure-cosmos-test;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-cosmos-tests;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-data-appconfiguration;1.4.8;1.5.0-beta.2 +com.azure:azure-data-appconfiguration;1.4.9;1.5.0-beta.2 com.azure:azure-data-appconfiguration-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-data-schemaregistry;1.3.9;1.4.0-beta.3 -com.azure:azure-data-schemaregistry-apacheavro;1.1.9;1.2.0-beta.3 -com.azure:azure-data-schemaregistry-jsonschema;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-data-tables;12.3.14;12.4.0-beta.1 +com.azure:azure-data-schemaregistry;1.3.10;1.4.0-beta.3 +com.azure:azure-data-schemaregistry-apacheavro;1.1.10;1.2.0-beta.3 +com.azure:azure-data-schemaregistry-jsonschema;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-data-tables;12.3.15;12.4.0-beta.1 com.azure:azure-data-tables-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-digitaltwins-core;1.3.12;1.4.0-beta.1 com.azure:azure-developer-devcenter;1.0.0-beta.2;1.0.0-beta.3 +com.azure:azure-developer-loadtesting;1.0.6;1.1.0-beta.1 +com.azure:azure-digitaltwins-core;1.3.13;1.4.0-beta.1 com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-health-insights-clinicalmatching;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-health-insights-cancerprofiling;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-identity;1.10.1;1.11.0-beta.1 +com.azure:azure-identity;1.10.1;1.11.0-beta.2 +com.azure:azure-identity-extensions;1.1.8;1.2.0-beta.2 com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-iot-deviceupdate;1.0.10;1.1.0-beta.1 +com.azure:azure-iot-deviceupdate;1.0.11;1.1.0-beta.1 com.azure:azure-iot-modelsrepository;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-json;1.1.0;1.2.0-beta.1 +com.azure:azure-json-gson;1.0.0-beta.3;1.0.0-beta.4 +com.azure:azure-json-reflect;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-maps-traffic;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-maps-weather;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-maps-elevation;1.0.0-beta.2;1.0.0-beta.3 @@ -128,67 +136,60 @@ com.azure:azure-maps-geolocation;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-maps-render;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-maps-route;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-maps-search;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-json;1.1.0;1.2.0-beta.1 -com.azure:azure-json-gson;1.0.0-beta.3;1.0.0-beta.4 -com.azure:azure-json-reflect;1.0.0-beta.2;1.0.0-beta.3 -com.azure:azure-messaging-eventgrid;4.17.2;4.18.0-beta.1 +com.azure:azure-media-videoanalyzer-edge;1.0.0-beta.6;1.0.0-beta.7 +com.azure:azure-messaging-eventgrid;4.18.0;4.19.0-beta.1 com.azure:azure-messaging-eventgrid-cloudnative-cloudevents;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-messaging-eventhubs;5.15.8;5.16.0-beta.2 -com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.16.9;1.17.0-beta.2 -com.azure:azure-messaging-eventhubs-checkpointstore-jedis;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-messaging-eventhubs;5.16.0;5.17.0-beta.1 +com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.17.0;1.18.0-beta.1 +com.azure:azure-messaging-eventhubs-checkpointstore-jedis;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-messaging-eventhubs-stress;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventhubs-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventhubs-track2-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-messaging-servicebus;7.14.3;7.15.0-beta.4 +com.azure:azure-messaging-servicebus;7.14.4;7.15.0-beta.4 com.azure:azure-messaging-servicebus-stress;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-messaging-webpubsub;1.2.7;1.3.0-beta.1 +com.azure:azure-messaging-webpubsub;1.2.8;1.3.0-beta.1 com.azure:azure-messaging-webpubsub-client;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-mixedreality-authentication;1.2.16;1.3.0-beta.1 -com.azure:azure-mixedreality-remoterendering;1.1.21;1.2.0-beta.1 +com.azure:azure-mixedreality-authentication;1.2.17;1.3.0-beta.1 +com.azure:azure-mixedreality-remoterendering;1.1.22;1.2.0-beta.1 com.azure:azure-monitor-opentelemetry-exporter;1.0.0-beta.11;1.0.0-beta.12 -com.azure:azure-monitor-ingestion;1.0.6;1.1.0-beta.1 +com.azure:azure-monitor-ingestion;1.1.0;1.2.0-beta.1 com.azure:azure-monitor-ingestion-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-monitor-query;1.2.4;1.3.0-beta.2 +com.azure:azure-monitor-query;1.2.5;1.3.0-beta.3 com.azure:azure-monitor-query-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-perf-test-parent;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-quantum-jobs;1.0.0-beta.1;1.0.0-beta.2 -com.azure:azure-search-documents;11.5.10;11.6.0-beta.9 +com.azure:azure-search-documents;11.5.11;11.6.0-beta.10 com.azure:azure-search-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-security-attestation;1.1.16;1.2.0-beta.1 -com.azure:azure-security-confidentialledger;1.0.12;1.1.0-beta.1 -com.azure:azure-security-keyvault-administration;4.3.5;4.4.0-beta.1 -com.azure:azure-security-keyvault-certificates;4.5.5;4.6.0-beta.1 +com.azure:azure-security-attestation;1.1.17;1.2.0-beta.1 +com.azure:azure-security-confidentialledger;1.0.13;1.1.0-beta.1 +com.azure:azure-security-keyvault-administration;4.4.0;4.5.0-beta.1 +com.azure:azure-security-keyvault-certificates;4.5.6;4.6.0-beta.1 com.azure:azure-security-keyvault-jca;2.7.1;2.8.0-beta.1 com.azure:azure-security-test-keyvault-jca;1.0.0;1.0.0 -com.azure:azure-security-keyvault-keys;4.6.5;4.7.0-beta.1 -com.azure:azure-security-keyvault-secrets;4.6.5;4.7.0-beta.1 +com.azure:azure-security-keyvault-keys;4.7.0;4.8.0-beta.1 +com.azure:azure-security-keyvault-secrets;4.7.0;4.8.0-beta.1 com.azure:azure-security-keyvault-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-sdk-template;1.1.1234;1.2.2-beta.1 com.azure:azure-sdk-template-two;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-sdk-template-three;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-spring-data-cosmos;3.38.0;3.39.0-beta.1 -com.azure:azure-storage-blob;12.23.1;12.24.0 -com.azure:azure-storage-blob-batch;12.19.1;12.20.0 +com.azure:azure-storage-blob;12.24.0;12.25.0-beta.1 +com.azure:azure-storage-blob-batch;12.20.0;12.21.0-beta.1 com.azure:azure-storage-blob-changefeed;12.0.0-beta.18;12.0.0-beta.19 -com.azure:azure-storage-blob-cryptography;12.22.1;12.23.0 +com.azure:azure-storage-blob-cryptography;12.23.0;12.24.0-beta.1 com.azure:azure-storage-blob-nio;12.0.0-beta.19;12.0.0-beta.20 -com.azure:azure-storage-common;12.22.1;12.23.0 -com.azure:azure-storage-file-share;12.19.1;12.20.0 -com.azure:azure-storage-file-datalake;12.16.1;12.17.0 -com.azure:azure-storage-internal-avro;12.8.1;12.9.0 +com.azure:azure-storage-common;12.23.0;12.24.0-beta.1 +com.azure:azure-storage-file-share;12.20.0;12.21.0-beta.1 +com.azure:azure-storage-file-datalake;12.17.0;12.18.0-beta.1 +com.azure:azure-storage-internal-avro;12.9.0;12.10.0-beta.1 com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-storage-queue;12.18.1;12.19.0 +com.azure:azure-storage-queue;12.19.0;12.20.0-beta.1 com.azure:azure-template-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-media-videoanalyzer-edge;1.0.0-beta.6;1.0.0-beta.7 com.azure:azure-verticals-agrifood-farming;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-xml;1.0.0-beta.2;1.0.0-beta.3 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-communication-email;1.0.5;1.1.0-beta.1 -com.azure:azure-developer-loadtesting;1.0.5;1.1.0-beta.1 -com.azure:azure-identity-extensions;1.1.7;1.2.0-beta.2 -com.azure:azure-analytics-purview-sharing;1.0.0-beta.2;1.0.0-beta.3 com.azure.spring:azure-monitor-spring-native;1.0.0-beta.1;1.0.0-beta.1 com.azure.spring:azure-monitor-spring-native-test;1.0.0-beta.1;1.0.0-beta.1 com.azure.spring:spring-cloud-azure-appconfiguration-config-web;4.11.0;4.12.0-beta.1 @@ -225,7 +226,7 @@ com.azure.spring:spring-cloud-azure-starter-redis;4.11.0;4.12.0-beta.1 com.azure.spring:spring-cloud-azure-starter-keyvault;4.11.0;4.12.0-beta.1 com.azure.spring:spring-cloud-azure-starter-keyvault-certificates;4.11.0;4.12.0-beta.1 com.azure.spring:spring-cloud-azure-starter-keyvault-secrets;4.11.0;4.12.0-beta.1 -com.azure.spring:spring-cloud-azure-starter-monitor;1.0.0-beta.1;1.0.0-beta.1 +com.azure.spring:spring-cloud-azure-starter-monitor;1.0.0-beta.1;1.0.0-beta.2 com.azure.spring:spring-cloud-azure-starter-servicebus-jms;4.11.0;4.12.0-beta.1 com.azure.spring:spring-cloud-azure-starter-servicebus;4.11.0;4.12.0-beta.1 com.azure.spring:spring-cloud-azure-starter-storage;4.11.0;4.12.0-beta.1 @@ -288,11 +289,11 @@ com.azure.resourcemanager:azure-resourcemanager-netapp;1.0.0-beta.13;1.0.0-beta. com.azure.resourcemanager:azure-resourcemanager-storagecache;1.0.0-beta.9;1.0.0-beta.10 com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0;1.1.0-beta.4 com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.3;1.0.0-beta.4 -com.azure.resourcemanager:azure-resourcemanager-iothub;1.1.0;1.2.0-beta.4 +com.azure.resourcemanager:azure-resourcemanager-iothub;1.2.0;1.3.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.4;1.0.0-beta.5 -com.azure.resourcemanager:azure-resourcemanager-communication;2.0.0;2.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-communication;2.0.0;2.1.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-apimanagement;1.0.0-beta.4;1.0.0-beta.5 -com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.0.0-beta.4;1.0.0-beta.5 +com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-resourcegraph;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-changeanalysis;1.0.1;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-delegatednetwork;1.0.0-beta.2;1.0.0-beta.3 @@ -304,7 +305,7 @@ com.azure.resourcemanager:azure-resourcemanager-frontdoor;1.0.0-beta.3;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-mixedreality;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-automation;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-resourcemover;1.0.0;1.1.0-beta.1 -com.azure.resourcemanager:azure-resourcemanager-datafactory;1.0.0-beta.22;1.0.0-beta.23 +com.azure.resourcemanager:azure-resourcemanager-datafactory;1.0.0-beta.23;1.0.0-beta.24 com.azure.resourcemanager:azure-resourcemanager-advisor;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-appconfiguration;1.0.0-beta.7;1.0.0-beta.8 com.azure.resourcemanager:azure-resourcemanager-attestation;1.0.0-beta.2;1.0.0-beta.3 @@ -315,7 +316,7 @@ com.azure.resourcemanager:azure-resourcemanager-consumption;1.0.0-beta.3;1.0.0-b com.azure.resourcemanager:azure-resourcemanager-commerce;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-billing;1.0.0-beta.3;1.0.0-beta.4 com.azure.resourcemanager:azure-resourcemanager-batchai;1.0.0-beta.1;1.0.0-beta.2 -com.azure.resourcemanager:azure-resourcemanager-signalr;1.0.0-beta.6;1.0.0-beta.7 +com.azure.resourcemanager:azure-resourcemanager-signalr;1.0.0-beta.7;1.0.0-beta.8 com.azure.resourcemanager:azure-resourcemanager-cognitiveservices;1.0.0;1.1.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-customerinsights;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-databox;1.0.0-beta.3;1.0.0-beta.4 @@ -349,7 +350,7 @@ com.azure.resourcemanager:azure-resourcemanager-datalakestore;1.0.0-beta.2;1.0.0 com.azure.resourcemanager:azure-resourcemanager-iotcentral;1.0.0;1.1.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-labservices;1.0.0-beta.3;1.0.0-beta.4 com.azure.resourcemanager:azure-resourcemanager-vmwarecloudsimple;1.0.0-beta.2;1.0.0-beta.3 -com.azure.resourcemanager:azure-resourcemanager-managedapplications;1.0.0-beta.2;1.0.0-beta.3 +com.azure.resourcemanager:azure-resourcemanager-managedapplications;1.0.0-beta.3;1.0.0-beta.4 com.azure.resourcemanager:azure-resourcemanager-videoanalyzer;1.0.0-beta.5;1.0.0-beta.6 com.azure.resourcemanager:azure-resourcemanager-imagebuilder;1.0.0-beta.4;1.0.0-beta.5 com.azure.resourcemanager:azure-resourcemanager-maps;1.0.0;1.1.0-beta.1 @@ -405,12 +406,12 @@ com.azure.resourcemanager:azure-resourcemanager-hybridcontainerservice;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-securitydevops;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-appcomplianceautomation;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-servicenetworking;1.0.0-beta.2;1.0.0-beta.3 -com.azure.resourcemanager:azure-resourcemanager-recoveryservicessiterecovery;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-recoveryservicessiterecovery;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-billingbenefits;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-providerhub;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0;1.1.0-beta.2 -com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-voiceservices;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-graphservices;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;1.0.0;1.1.0-beta.1 @@ -418,7 +419,7 @@ com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0;1.1. com.azure.resourcemanager:azure-resourcemanager-qumulo;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-selfhelp;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-networkcloud;1.0.0;1.1.0-beta.1 -com.azure.resourcemanager:azure-resourcemanager-cosmosdbforpostgresql;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-cosmosdbforpostgresql;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-managementgroups;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-managednetworkfabric;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-iotfirmwaredefense;1.0.0-beta.1;1.0.0-beta.2 @@ -428,7 +429,8 @@ com.azure.resourcemanager:azure-resourcemanager-chaos;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-defendereasm;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-hdinsight-containers;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-apicenter;1.0.0-beta.1;1.0.0-beta.2 -com.azure.resourcemanager:azure-resourcemanager-hybridconnectivity;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-hybridconnectivity;1.0.0;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-playwrighttesting;1.0.0-beta.1;1.0.0-beta.2 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 diff --git a/pom.xml b/pom.xml index 6d46c835c391..2933b7b5264a 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,6 @@ common/perf-test-core eng/code-quality-reports - eng/jacoco-test-coverage sdk/advisor sdk/agrifood sdk/alertsmanagement @@ -49,6 +48,7 @@ sdk/consumption sdk/containerregistry sdk/containerservicefleet + sdk/contentsafety sdk/core sdk/cosmos sdk/cosmosdbforpostgresql @@ -143,6 +143,7 @@ sdk/parents sdk/peering sdk/personalizer + sdk/playwrighttesting sdk/policyinsights sdk/postgresql sdk/postgresqlflexibleserver diff --git a/sdk/agrifood/azure-verticals-agrifood-farming/README.md b/sdk/agrifood/azure-verticals-agrifood-farming/README.md index 40c27ebccf14..4b5c3f3b8ff2 100644 --- a/sdk/agrifood/azure-verticals-agrifood-farming/README.md +++ b/sdk/agrifood/azure-verticals-agrifood-farming/README.md @@ -47,7 +47,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.10.0 + 1.10.1 ``` diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/README.md b/sdk/anomalydetector/azure-ai-anomalydetector/README.md index 0e294fa71d0c..2c2250350180 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/README.md +++ b/sdk/anomalydetector/azure-ai-anomalydetector/README.md @@ -54,7 +54,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.10.0 + 1.10.1 ``` diff --git a/sdk/aot/azure-aot-graalvm-samples/pom.xml b/sdk/aot/azure-aot-graalvm-samples/pom.xml index 1eaf9948a18b..0e97d21f428b 100644 --- a/sdk/aot/azure-aot-graalvm-samples/pom.xml +++ b/sdk/aot/azure-aot-graalvm-samples/pom.xml @@ -61,7 +61,7 @@ com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 com.azure @@ -71,44 +71,44 @@ com.azure azure-security-keyvault-keys - 4.6.5 + 4.7.0 com.azure azure-storage-blob - 12.23.1 + 12.24.0 com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 com.azure azure-cosmos - 4.49.0 + 4.50.0 com.azure azure-ai-formrecognizer - 4.1.0 + 4.1.1 com.azure azure-ai-textanalytics - 5.3.2 + 5.3.3 diff --git a/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md index 935026758bca..2ba1448ca9b7 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md @@ -18,6 +18,15 @@ Note: Below breaking changes only affect the version `1.5.0-beta.1`. ### Other Changes +## 1.4.9 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.4.8 (2023-08-18) ### Other Changes diff --git a/sdk/appconfiguration/azure-data-appconfiguration/assets.json b/sdk/appconfiguration/azure-data-appconfiguration/assets.json index 7a8378f73d69..40b2c9e6febf 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/assets.json +++ b/sdk/appconfiguration/azure-data-appconfiguration/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/appconfiguration/azure-data-appconfiguration", - "Tag": "java/appconfiguration/azure-data-appconfiguration_ba464cc28f" + "Tag": "java/appconfiguration/azure-data-appconfiguration_2cf918b584" } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java index 874d8c4aa0dd..1256820cd292 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java @@ -1044,12 +1044,16 @@ public PagedFlux listConfigurationSettings(SettingSelector acceptDateTime, settingFields, null, + null, + null, addTracingNamespace(context)) .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse))), nextLink -> withContext( context -> serviceClient.getKeyValuesNextSinglePageAsync( nextLink, acceptDateTime, + null, + null, addTracingNamespace(context)) .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse))) ); @@ -1119,12 +1123,16 @@ public PagedFlux listConfigurationSettingsForSnapshot(Stri null, fields, snapshotName, + null, + null, addTracingNamespace(context)) .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse))), nextLink -> withContext( context -> serviceClient.getKeyValuesNextSinglePageAsync( nextLink, null, + null, + null, addTracingNamespace(context)) .map(pagedResponse -> toConfigurationSettingWithPagedResponse(pagedResponse))) ); diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java index daa39178e403..8b5a732d6211 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java @@ -1059,12 +1059,14 @@ public PagedIterable listConfigurationSettings(SettingSele selector == null ? null : selector.getAcceptDateTime(), selector == null ? null : toSettingFieldsList(selector.getFields()), null, + null, + null, enableSyncRestProxy(addTracingNamespace(context))); return toConfigurationSettingWithPagedResponse(pagedResponse); }, nextLink -> { final PagedResponse pagedResponse = serviceClient.getKeyValuesNextSinglePage(nextLink, - selector.getAcceptDateTime(), enableSyncRestProxy(addTracingNamespace(context))); + selector.getAcceptDateTime(), null, null, enableSyncRestProxy(addTracingNamespace(context))); return toConfigurationSettingWithPagedResponse(pagedResponse); } ); @@ -1136,12 +1138,14 @@ public PagedIterable listConfigurationSettingsForSnapshot( null, fields, snapshotName, + null, + null, enableSyncRestProxy(addTracingNamespace(context))); return toConfigurationSettingWithPagedResponse(pagedResponse); }, nextLink -> { final PagedResponse pagedResponse = serviceClient.getKeyValuesNextSinglePage(nextLink, - null, enableSyncRestProxy(addTracingNamespace(context))); + null, null, null, enableSyncRestProxy(addTracingNamespace(context))); return toConfigurationSettingWithPagedResponse(pagedResponse); } ); diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java index bd764dc60f12..a743a01d56bc 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java @@ -118,6 +118,7 @@ public final class ConfigurationClientBuilder implements private static final String CLIENT_NAME; private static final String CLIENT_VERSION; private static final HttpPipelinePolicy ADD_HEADERS_POLICY; + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); static { Map properties = CoreUtils.getProperties("azure-data-appconfiguration.properties"); @@ -255,10 +256,11 @@ private HttpPipeline createDefaultHttpPipeline(SyncTokenPolicy syncTokenPolicy, // endpoint cannot be null, which is required in request authentication Objects.requireNonNull(buildEndpoint, "'Endpoint' is required and can not be null."); + ClientOptions localClientOptions = clientOptions != null ? clientOptions : DEFAULT_CLIENT_OPTIONS; // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); policies.add(new UserAgentPolicy( - getApplicationId(clientOptions, httpLogOptions), CLIENT_NAME, CLIENT_VERSION, buildConfiguration)); + getApplicationId(localClientOptions, httpLogOptions), CLIENT_NAME, CLIENT_VERSION, buildConfiguration)); policies.add(new RequestIdPolicy()); policies.add(new AddHeadersFromContextPolicy()); policies.add(ADD_HEADERS_POLICY); @@ -286,12 +288,11 @@ private HttpPipeline createDefaultHttpPipeline(SyncTokenPolicy syncTokenPolicy, policies.add(syncTokenPolicy); policies.addAll(perRetryPolicies); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach( - header -> httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach( + header -> httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); + HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); @@ -301,6 +302,7 @@ private HttpPipeline createDefaultHttpPipeline(SyncTokenPolicy syncTokenPolicy, .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .tracer(createTracer(clientOptions)) + .clientOptions(localClientOptions) .build(); } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/AzureAppConfigurationImpl.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/AzureAppConfigurationImpl.java index 35aff14947f5..84196e0381c3 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/AzureAppConfigurationImpl.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/AzureAppConfigurationImpl.java @@ -270,6 +270,8 @@ Mono> getKeyValues( @HeaderParam("Accept-Datetime") String acceptDatetime, @QueryParam("$Select") String select, @QueryParam("snapshot") String snapshot, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Accept") String accept, Context context); @@ -286,6 +288,8 @@ ResponseBase getKeyValuesSync( @HeaderParam("Accept-Datetime") String acceptDatetime, @QueryParam("$Select") String select, @QueryParam("snapshot") String snapshot, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Accept") String accept, Context context); @@ -302,6 +306,8 @@ Mono> checkKeyValues( @HeaderParam("Accept-Datetime") String acceptDatetime, @QueryParam("$Select") String select, @QueryParam("snapshot") String snapshot, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Head("/kv") @@ -317,6 +323,8 @@ ResponseBase checkKeyValuesSync( @HeaderParam("Accept-Datetime") String acceptDatetime, @QueryParam("$Select") String select, @QueryParam("snapshot") String snapshot, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Get("/kv/{key}") @@ -447,7 +455,7 @@ Mono> getSnapshots( @QueryParam("api-version") String apiVersion, @QueryParam("After") String after, @QueryParam("$Select") String select, - @QueryParam("Status") String status, + @QueryParam("status") String status, @HeaderParam("Accept") String accept, Context context); @@ -461,7 +469,7 @@ ResponseBase getSnapshotsSync( @QueryParam("api-version") String apiVersion, @QueryParam("After") String after, @QueryParam("$Select") String select, - @QueryParam("Status") String status, + @QueryParam("status") String status, @HeaderParam("Accept") String accept, Context context); @@ -807,6 +815,8 @@ Mono> getKeyValuesNext @HostParam("endpoint") String endpoint, @HeaderParam("Sync-Token") String syncToken, @HeaderParam("Accept-Datetime") String acceptDatetime, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Accept") String accept, Context context); @@ -818,6 +828,8 @@ ResponseBase getKeyValuesNextSync( @HostParam("endpoint") String endpoint, @HeaderParam("Sync-Token") String syncToken, @HeaderParam("Accept-Datetime") String acceptDatetime, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Accept") String accept, Context context); @@ -1236,6 +1248,9 @@ public void checkKeys(String name, String after, String acceptDatetime) { * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not * valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1248,7 +1263,9 @@ public Mono> getKeyValuesSinglePageAsync( String after, String acceptDatetime, List select, - String snapshot) { + String snapshot, + String ifMatch, + String ifNoneMatch) { final String accept = "application/vnd.microsoft.appconfig.kvset+json, application/problem+json"; String selectConverted = (select == null) @@ -1266,6 +1283,8 @@ public Mono> getKeyValuesSinglePageAsync( acceptDatetime, selectConverted, snapshot, + ifMatch, + ifNoneMatch, accept, context)) .map( @@ -1290,6 +1309,9 @@ public Mono> getKeyValuesSinglePageAsync( * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not * valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1304,6 +1326,8 @@ public Mono> getKeyValuesSinglePageAsync( String acceptDatetime, List select, String snapshot, + String ifMatch, + String ifNoneMatch, Context context) { final String accept = "application/vnd.microsoft.appconfig.kvset+json, application/problem+json"; String selectConverted = @@ -1320,6 +1344,8 @@ public Mono> getKeyValuesSinglePageAsync( acceptDatetime, selectConverted, snapshot, + ifMatch, + ifNoneMatch, accept, context) .map( @@ -1344,6 +1370,9 @@ public Mono> getKeyValuesSinglePageAsync( * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not * valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1356,10 +1385,14 @@ public PagedFlux getKeyValuesAsync( String after, String acceptDatetime, List select, - String snapshot) { + String snapshot, + String ifMatch, + String ifNoneMatch) { return new PagedFlux<>( - () -> getKeyValuesSinglePageAsync(key, label, after, acceptDatetime, select, snapshot), - nextLink -> getKeyValuesNextSinglePageAsync(nextLink, acceptDatetime)); + () -> + getKeyValuesSinglePageAsync( + key, label, after, acceptDatetime, select, snapshot, ifMatch, ifNoneMatch), + nextLink -> getKeyValuesNextSinglePageAsync(nextLink, acceptDatetime, ifMatch, ifNoneMatch)); } /** @@ -1373,6 +1406,9 @@ public PagedFlux getKeyValuesAsync( * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not * valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1387,10 +1423,14 @@ public PagedFlux getKeyValuesAsync( String acceptDatetime, List select, String snapshot, + String ifMatch, + String ifNoneMatch, Context context) { return new PagedFlux<>( - () -> getKeyValuesSinglePageAsync(key, label, after, acceptDatetime, select, snapshot, context), - nextLink -> getKeyValuesNextSinglePageAsync(nextLink, acceptDatetime, context)); + () -> + getKeyValuesSinglePageAsync( + key, label, after, acceptDatetime, select, snapshot, ifMatch, ifNoneMatch, context), + nextLink -> getKeyValuesNextSinglePageAsync(nextLink, acceptDatetime, ifMatch, ifNoneMatch, context)); } /** @@ -1404,6 +1444,9 @@ public PagedFlux getKeyValuesAsync( * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not * valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1416,7 +1459,9 @@ public PagedResponse getKeyValuesSinglePage( String after, String acceptDatetime, List select, - String snapshot) { + String snapshot, + String ifMatch, + String ifNoneMatch) { final String accept = "application/vnd.microsoft.appconfig.kvset+json, application/problem+json"; String selectConverted = (select == null) @@ -1433,6 +1478,8 @@ public PagedResponse getKeyValuesSinglePage( acceptDatetime, selectConverted, snapshot, + ifMatch, + ifNoneMatch, accept, Context.NONE); return new PagedResponseBase<>( @@ -1455,6 +1502,9 @@ public PagedResponse getKeyValuesSinglePage( * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not * valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1469,6 +1519,8 @@ public PagedResponse getKeyValuesSinglePage( String acceptDatetime, List select, String snapshot, + String ifMatch, + String ifNoneMatch, Context context) { final String accept = "application/vnd.microsoft.appconfig.kvset+json, application/problem+json"; String selectConverted = @@ -1486,6 +1538,8 @@ public PagedResponse getKeyValuesSinglePage( acceptDatetime, selectConverted, snapshot, + ifMatch, + ifNoneMatch, accept, context); return new PagedResponseBase<>( @@ -1508,6 +1562,9 @@ public PagedResponse getKeyValuesSinglePage( * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not * valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1520,10 +1577,22 @@ public PagedIterable getKeyValues( String after, String acceptDatetime, List select, - String snapshot) { + String snapshot, + String ifMatch, + String ifNoneMatch) { return new PagedIterable<>( - () -> getKeyValuesSinglePage(key, label, after, acceptDatetime, select, snapshot, Context.NONE), - nextLink -> getKeyValuesNextSinglePage(nextLink, acceptDatetime)); + () -> + getKeyValuesSinglePage( + key, + label, + after, + acceptDatetime, + select, + snapshot, + ifMatch, + ifNoneMatch, + Context.NONE), + nextLink -> getKeyValuesNextSinglePage(nextLink, acceptDatetime, ifMatch, ifNoneMatch)); } /** @@ -1537,6 +1606,9 @@ public PagedIterable getKeyValues( * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. The value should be the name of the snapshot. Not * valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1551,10 +1623,14 @@ public PagedIterable getKeyValues( String acceptDatetime, List select, String snapshot, + String ifMatch, + String ifNoneMatch, Context context) { return new PagedIterable<>( - () -> getKeyValuesSinglePage(key, label, after, acceptDatetime, select, snapshot, context), - nextLink -> getKeyValuesNextSinglePage(nextLink, acceptDatetime, context)); + () -> + getKeyValuesSinglePage( + key, label, after, acceptDatetime, select, snapshot, ifMatch, ifNoneMatch, context), + nextLink -> getKeyValuesNextSinglePage(nextLink, acceptDatetime, ifMatch, ifNoneMatch, context)); } /** @@ -1567,6 +1643,9 @@ public PagedIterable getKeyValues( * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. Not valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1579,7 +1658,9 @@ public Mono> checkKeyValuesWithRespons String after, String acceptDatetime, List select, - String snapshot) { + String snapshot, + String ifMatch, + String ifNoneMatch) { String selectConverted = (select == null) ? null @@ -1596,6 +1677,8 @@ public Mono> checkKeyValuesWithRespons acceptDatetime, selectConverted, snapshot, + ifMatch, + ifNoneMatch, context)); } @@ -1609,6 +1692,9 @@ public Mono> checkKeyValuesWithRespons * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. Not valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1623,6 +1709,8 @@ public Mono> checkKeyValuesWithRespons String acceptDatetime, List select, String snapshot, + String ifMatch, + String ifNoneMatch, Context context) { String selectConverted = (select == null) @@ -1638,6 +1726,8 @@ public Mono> checkKeyValuesWithRespons acceptDatetime, selectConverted, snapshot, + ifMatch, + ifNoneMatch, context); } @@ -1651,6 +1741,9 @@ public Mono> checkKeyValuesWithRespons * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. Not valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1663,8 +1756,11 @@ public Mono checkKeyValuesAsync( String after, String acceptDatetime, List select, - String snapshot) { - return checkKeyValuesWithResponseAsync(key, label, after, acceptDatetime, select, snapshot) + String snapshot, + String ifMatch, + String ifNoneMatch) { + return checkKeyValuesWithResponseAsync( + key, label, after, acceptDatetime, select, snapshot, ifMatch, ifNoneMatch) .flatMap(ignored -> Mono.empty()); } @@ -1678,6 +1774,9 @@ public Mono checkKeyValuesAsync( * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. Not valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1692,8 +1791,11 @@ public Mono checkKeyValuesAsync( String acceptDatetime, List select, String snapshot, + String ifMatch, + String ifNoneMatch, Context context) { - return checkKeyValuesWithResponseAsync(key, label, after, acceptDatetime, select, snapshot, context) + return checkKeyValuesWithResponseAsync( + key, label, after, acceptDatetime, select, snapshot, ifMatch, ifNoneMatch, context) .flatMap(ignored -> Mono.empty()); } @@ -1707,6 +1809,9 @@ public Mono checkKeyValuesAsync( * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. Not valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -1721,6 +1826,8 @@ public ResponseBase checkKeyValuesWithResponse( String acceptDatetime, List select, String snapshot, + String ifMatch, + String ifNoneMatch, Context context) { String selectConverted = (select == null) @@ -1736,6 +1843,8 @@ public ResponseBase checkKeyValuesWithResponse( acceptDatetime, selectConverted, snapshot, + ifMatch, + ifNoneMatch, context); } @@ -1749,6 +1858,9 @@ public ResponseBase checkKeyValuesWithResponse( * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. * @param select Used to select what fields are present in the returned resource(s). * @param snapshot A filter used get key-values for a snapshot. Not valid when used with 'key' and 'label' filters. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1760,8 +1872,11 @@ public void checkKeyValues( String after, String acceptDatetime, List select, - String snapshot) { - checkKeyValuesWithResponse(key, label, after, acceptDatetime, select, snapshot, Context.NONE); + String snapshot, + String ifMatch, + String ifNoneMatch) { + checkKeyValuesWithResponse( + key, label, after, acceptDatetime, select, snapshot, ifMatch, ifNoneMatch, Context.NONE); } /** @@ -4763,13 +4878,17 @@ public PagedResponse getKeysNextSinglePage(String nextLink, String acceptDa * @param nextLink The URL to get the next list of items *

The nextLink parameter. * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of a list request along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getKeyValuesNextSinglePageAsync(String nextLink, String acceptDatetime) { + public Mono> getKeyValuesNextSinglePageAsync( + String nextLink, String acceptDatetime, String ifMatch, String ifNoneMatch) { final String accept = "application/vnd.microsoft.appconfig.kvset+json, application/problem+json"; return FluxUtil.withContext( context -> @@ -4778,6 +4897,8 @@ public Mono> getKeyValuesNextSinglePageAsync(String next this.getEndpoint(), this.getSyncToken(), acceptDatetime, + ifMatch, + ifNoneMatch, accept, context)) .map( @@ -4797,6 +4918,9 @@ public Mono> getKeyValuesNextSinglePageAsync(String next * @param nextLink The URL to get the next list of items *

The nextLink parameter. * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -4805,10 +4929,17 @@ public Mono> getKeyValuesNextSinglePageAsync(String next */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getKeyValuesNextSinglePageAsync( - String nextLink, String acceptDatetime, Context context) { + String nextLink, String acceptDatetime, String ifMatch, String ifNoneMatch, Context context) { final String accept = "application/vnd.microsoft.appconfig.kvset+json, application/problem+json"; return service.getKeyValuesNext( - nextLink, this.getEndpoint(), this.getSyncToken(), acceptDatetime, accept, context) + nextLink, + this.getEndpoint(), + this.getSyncToken(), + acceptDatetime, + ifMatch, + ifNoneMatch, + accept, + context) .map( res -> new PagedResponseBase<>( @@ -4826,17 +4957,28 @@ public Mono> getKeyValuesNextSinglePageAsync( * @param nextLink The URL to get the next list of items *

The nextLink parameter. * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of a list request along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getKeyValuesNextSinglePage(String nextLink, String acceptDatetime) { + public PagedResponse getKeyValuesNextSinglePage( + String nextLink, String acceptDatetime, String ifMatch, String ifNoneMatch) { final String accept = "application/vnd.microsoft.appconfig.kvset+json, application/problem+json"; ResponseBase res = service.getKeyValuesNextSync( - nextLink, this.getEndpoint(), this.getSyncToken(), acceptDatetime, accept, Context.NONE); + nextLink, + this.getEndpoint(), + this.getSyncToken(), + acceptDatetime, + ifMatch, + ifNoneMatch, + accept, + Context.NONE); return new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), @@ -4852,6 +4994,9 @@ public PagedResponse getKeyValuesNextSinglePage(String nextLink, Strin * @param nextLink The URL to get the next list of items *

The nextLink parameter. * @param acceptDatetime Requests the server to respond with the state of the resource at the specified time. + * @param ifMatch Used to perform an operation only if the targeted resource's etag matches the value provided. + * @param ifNoneMatch Used to perform an operation only if the targeted resource's etag does not match the value + * provided. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws HttpResponseException thrown if the request is rejected by server. @@ -4859,11 +5004,19 @@ public PagedResponse getKeyValuesNextSinglePage(String nextLink, Strin * @return the result of a list request along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getKeyValuesNextSinglePage(String nextLink, String acceptDatetime, Context context) { + public PagedResponse getKeyValuesNextSinglePage( + String nextLink, String acceptDatetime, String ifMatch, String ifNoneMatch, Context context) { final String accept = "application/vnd.microsoft.appconfig.kvset+json, application/problem+json"; ResponseBase res = service.getKeyValuesNextSync( - nextLink, this.getEndpoint(), this.getSyncToken(), acceptDatetime, accept, context); + nextLink, + this.getEndpoint(), + this.getSyncToken(), + acceptDatetime, + ifMatch, + ifNoneMatch, + accept, + context); return new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Conditions.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Conditions.java new file mode 100644 index 000000000000..5c4adcc8eb5c --- /dev/null +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Conditions.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.appconfiguration.implementation; + +import com.azure.data.appconfiguration.models.FeatureFlagFilter; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Conditions represents the conditions of a feature flag or unknown user-defined condition. + */ +public class Conditions { + // Unknown condition is a list of objects because we don't know what the condition user can put in portal or 'value'. + private Map unknownConditions; + + // Only condition we know is a list of FeatureFlagFilter. It represents one kind of condition. + private List featureFlagFilters; + + public Conditions() { + unknownConditions = new LinkedHashMap<>(); + featureFlagFilters = new ArrayList<>(); + } + + public Map getUnknownConditions() { + return unknownConditions; + } + + public List getFeatureFlagFilters() { + return featureFlagFilters; + } + + public Conditions setFeatureFlagFilters(final List featureFlagFilters) { + this.featureFlagFilters = featureFlagFilters; + return this; + } + + public Conditions setUnknownConditions(final Map unknownConditions) { + this.unknownConditions = unknownConditions; + return this; + } +} diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingDeserializationHelper.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingDeserializationHelper.java index b14e894202f8..18a7406ae89b 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingDeserializationHelper.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingDeserializationHelper.java @@ -177,11 +177,10 @@ private static FeatureFlagConfigurationSetting getFeatureFlagPropertyValue(JsonR } else if (ENABLED.equals(fieldName)) { isEnabled = reader.getBoolean(); } else if (CONDITIONS.equals(fieldName)) { - clientFilters = readClientFilters(reader); + clientFilters = readConditions(reader).getFeatureFlagFilters(); } else { reader.skipChildren(); } - } return new FeatureFlagConfigurationSetting(featureId, isEnabled) @@ -191,25 +190,29 @@ private static FeatureFlagConfigurationSetting getFeatureFlagPropertyValue(JsonR }); } - // Feature flag configuration setting: client filters - private static List readClientFilters(JsonReader jsonReader) throws IOException { + // Feature flag configuration setting: conditions + public static Conditions readConditions(JsonReader jsonReader) throws IOException { + Conditions conditions = new Conditions(); + Map unknownConditions = conditions.getUnknownConditions(); return jsonReader.readObject(reader -> { while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if (CLIENT_FILTERS.equals(fieldName)) { - return reader.readArray(ConfigurationSettingDeserializationHelper::readClientFilter); + conditions.setFeatureFlagFilters( + reader.readArray(ConfigurationSettingDeserializationHelper::readClientFilter)); } else { - reader.skipChildren(); + unknownConditions.put(fieldName, reader.readUntyped()); } } + conditions.setUnknownConditions(unknownConditions); - return null; + return conditions; }); } - private static FeatureFlagFilter readClientFilter(JsonReader jsonReader) throws IOException { + public static FeatureFlagFilter readClientFilter(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { String name = null; Map parameters = null; diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java index 13edabee16e0..8668f72722a3 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java @@ -29,15 +29,15 @@ public class Utility { private static final String HTTP_REST_PROXY_SYNC_PROXY_ENABLE = "com.azure.core.http.restproxy.syncproxy.enable"; public static final String APP_CONFIG_TRACING_NAMESPACE_VALUE = "Microsoft.AppConfiguration"; - static final String ID = "id"; - static final String DESCRIPTION = "description"; - static final String DISPLAY_NAME = "display_name"; - static final String ENABLED = "enabled"; - static final String CONDITIONS = "conditions"; - static final String CLIENT_FILTERS = "client_filters"; - static final String NAME = "name"; - static final String PARAMETERS = "parameters"; - static final String URI = "uri"; + public static final String ID = "id"; + public static final String DESCRIPTION = "description"; + public static final String DISPLAY_NAME = "display_name"; + public static final String ENABLED = "enabled"; + public static final String CONDITIONS = "conditions"; + public static final String CLIENT_FILTERS = "client_filters"; + public static final String NAME = "name"; + public static final String PARAMETERS = "parameters"; + public static final String URI = "uri"; /** * Represents any value in Etag. diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/CheckKeyValuesHeaders.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/CheckKeyValuesHeaders.java index 3004f2dabb8b..37f96eb86727 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/CheckKeyValuesHeaders.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/CheckKeyValuesHeaders.java @@ -11,6 +11,11 @@ /** The CheckKeyValuesHeaders model. */ @Fluent public final class CheckKeyValuesHeaders { + /* + * The ETag property. + */ + private String eTag; + /* * The Sync-Token property. */ @@ -25,9 +30,30 @@ public final class CheckKeyValuesHeaders { * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public CheckKeyValuesHeaders(HttpHeaders rawHeaders) { + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); this.syncToken = rawHeaders.getValue(SYNC_TOKEN); } + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the CheckKeyValuesHeaders object itself. + */ + public CheckKeyValuesHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + /** * Get the syncToken property: The Sync-Token property. * diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/CheckRevisionsHeaders.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/CheckRevisionsHeaders.java index 279b819c8d45..a42d15ef9ba6 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/CheckRevisionsHeaders.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/CheckRevisionsHeaders.java @@ -11,6 +11,11 @@ /** The CheckRevisionsHeaders model. */ @Fluent public final class CheckRevisionsHeaders { + /* + * The ETag property. + */ + private String eTag; + /* * The Sync-Token property. */ @@ -25,9 +30,30 @@ public final class CheckRevisionsHeaders { * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public CheckRevisionsHeaders(HttpHeaders rawHeaders) { + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); this.syncToken = rawHeaders.getValue(SYNC_TOKEN); } + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the CheckRevisionsHeaders object itself. + */ + public CheckRevisionsHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + /** * Get the syncToken property: The Sync-Token property. * diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetKeyValuesHeaders.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetKeyValuesHeaders.java index f04bc958ecb7..95fe4249b01f 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetKeyValuesHeaders.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetKeyValuesHeaders.java @@ -11,6 +11,11 @@ /** The GetKeyValuesHeaders model. */ @Fluent public final class GetKeyValuesHeaders { + /* + * The ETag property. + */ + private String eTag; + /* * The Sync-Token property. */ @@ -25,9 +30,30 @@ public final class GetKeyValuesHeaders { * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public GetKeyValuesHeaders(HttpHeaders rawHeaders) { + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); this.syncToken = rawHeaders.getValue(SYNC_TOKEN); } + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the GetKeyValuesHeaders object itself. + */ + public GetKeyValuesHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + /** * Get the syncToken property: The Sync-Token property. * diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetKeyValuesNextHeaders.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetKeyValuesNextHeaders.java index 2bcae4d6ead9..cc4c3489e3d8 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetKeyValuesNextHeaders.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetKeyValuesNextHeaders.java @@ -11,6 +11,11 @@ /** The GetKeyValuesNextHeaders model. */ @Fluent public final class GetKeyValuesNextHeaders { + /* + * The ETag property. + */ + private String eTag; + /* * The Sync-Token property. */ @@ -25,9 +30,30 @@ public final class GetKeyValuesNextHeaders { * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public GetKeyValuesNextHeaders(HttpHeaders rawHeaders) { + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); this.syncToken = rawHeaders.getValue(SYNC_TOKEN); } + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the GetKeyValuesNextHeaders object itself. + */ + public GetKeyValuesNextHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + /** * Get the syncToken property: The Sync-Token property. * diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetRevisionsHeaders.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetRevisionsHeaders.java index dec47f22db76..73345782fc7c 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetRevisionsHeaders.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetRevisionsHeaders.java @@ -11,6 +11,11 @@ /** The GetRevisionsHeaders model. */ @Fluent public final class GetRevisionsHeaders { + /* + * The ETag property. + */ + private String eTag; + /* * The Sync-Token property. */ @@ -25,9 +30,30 @@ public final class GetRevisionsHeaders { * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public GetRevisionsHeaders(HttpHeaders rawHeaders) { + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); this.syncToken = rawHeaders.getValue(SYNC_TOKEN); } + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the GetRevisionsHeaders object itself. + */ + public GetRevisionsHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + /** * Get the syncToken property: The Sync-Token property. * diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetRevisionsNextHeaders.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetRevisionsNextHeaders.java index 3dc20175b37f..78aa57d7e212 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetRevisionsNextHeaders.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/GetRevisionsNextHeaders.java @@ -11,6 +11,11 @@ /** The GetRevisionsNextHeaders model. */ @Fluent public final class GetRevisionsNextHeaders { + /* + * The ETag property. + */ + private String eTag; + /* * The Sync-Token property. */ @@ -25,9 +30,30 @@ public final class GetRevisionsNextHeaders { * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public GetRevisionsNextHeaders(HttpHeaders rawHeaders) { + this.eTag = rawHeaders.getValue(HttpHeaderName.ETAG); this.syncToken = rawHeaders.getValue(SYNC_TOKEN); } + /** + * Get the eTag property: The ETag property. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag property. + * + * @param eTag the eTag value to set. + * @return the GetRevisionsNextHeaders object itself. + */ + public GetRevisionsNextHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + /** * Get the syncToken property: The Sync-Token property. * diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/KeyValueListResult.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/KeyValueListResult.java index 686ae3f583d7..372f85aec07d 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/KeyValueListResult.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/models/KeyValueListResult.java @@ -20,6 +20,11 @@ public final class KeyValueListResult implements JsonSerializable items; + /* + * An identifier representing the returned state of the resource. + */ + private String etag; + /* * The URI that can be used to request the next set of paged results. */ @@ -48,6 +53,26 @@ public KeyValueListResult setItems(List items) { return this; } + /** + * Get the etag property: An identifier representing the returned state of the resource. + * + * @return the etag value. + */ + public String getEtag() { + return this.etag; + } + + /** + * Set the etag property: An identifier representing the returned state of the resource. + * + * @param etag the etag value to set. + * @return the KeyValueListResult object itself. + */ + public KeyValueListResult setEtag(String etag) { + this.etag = etag; + return this; + } + /** * Get the nextLink property: The URI that can be used to request the next set of paged results. * @@ -72,6 +97,7 @@ public KeyValueListResult setNextLink(String nextLink) { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeArrayField("items", this.items, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("etag", this.etag); jsonWriter.writeStringField("@nextLink", this.nextLink); return jsonWriter.writeEndObject(); } @@ -95,6 +121,8 @@ public static KeyValueListResult fromJson(JsonReader jsonReader) throws IOExcept if ("items".equals(fieldName)) { List items = reader.readArray(reader1 -> KeyValue.fromJson(reader1)); deserializedKeyValueListResult.items = items; + } else if ("etag".equals(fieldName)) { + deserializedKeyValueListResult.etag = reader.getString(); } else if ("@nextLink".equals(fieldName)) { deserializedKeyValueListResult.nextLink = reader.getString(); } else { diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/CreateSnapshotOperationDetail.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/CreateSnapshotOperationDetail.java index 4ff57f148175..f5e9930a319b 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/CreateSnapshotOperationDetail.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/CreateSnapshotOperationDetail.java @@ -23,6 +23,11 @@ public void setOperationId(CreateSnapshotOperationDetail operationDetail, String }); } + /** + * Creates an instance of {@link CreateSnapshotOperationDetail}. + */ + public CreateSnapshotOperationDetail() { } + /** * Gets the operationId property of the {@link CreateSnapshotOperationDetail}. * diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/FeatureFlagConfigurationSetting.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/FeatureFlagConfigurationSetting.java index c6ec527fb402..6f4db70903db 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/FeatureFlagConfigurationSetting.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/FeatureFlagConfigurationSetting.java @@ -4,14 +4,32 @@ package com.azure.data.appconfiguration.models; import com.azure.core.util.logging.ClientLogger; +import com.azure.data.appconfiguration.implementation.Conditions; +import com.azure.json.JsonProviders; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Set; -import static com.azure.data.appconfiguration.implementation.ConfigurationSettingDeserializationHelper.parseFeatureFlagValue; -import static com.azure.data.appconfiguration.implementation.ConfigurationSettingSerializationHelper.writeFeatureFlagConfigurationSetting; +import static com.azure.data.appconfiguration.implementation.ConfigurationSettingDeserializationHelper.readConditions; +import static com.azure.data.appconfiguration.implementation.Utility.CLIENT_FILTERS; +import static com.azure.data.appconfiguration.implementation.Utility.CONDITIONS; +import static com.azure.data.appconfiguration.implementation.Utility.DESCRIPTION; +import static com.azure.data.appconfiguration.implementation.Utility.DISPLAY_NAME; +import static com.azure.data.appconfiguration.implementation.Utility.ENABLED; +import static com.azure.data.appconfiguration.implementation.Utility.ID; +import static com.azure.data.appconfiguration.implementation.Utility.NAME; +import static com.azure.data.appconfiguration.implementation.Utility.PARAMETERS; /** * {@link FeatureFlagConfigurationSetting} allows you to customize your own feature flags to dynamically administer a @@ -21,16 +39,31 @@ public final class FeatureFlagConfigurationSetting extends ConfigurationSetting private static final ClientLogger LOGGER = new ClientLogger(FeatureFlagConfigurationSetting.class); private static final String FEATURE_FLAG_CONTENT_TYPE = "application/vnd.microsoft.appconfig.ff+json;charset=utf-8"; + /** + * A prefix is used to construct a feature flag configuration setting's key. + */ + public static final String KEY_PREFIX = ".appconfig.featureflag/"; private String featureId; private boolean isEnabled; private String description; private String displayName; private List clientFilters; - /** - * A prefix is used to construct a feature flag configuration setting's key. - */ - public static final String KEY_PREFIX = ".appconfig.featureflag/"; + // The flag to indicate if the 'value' field is valid. It is a temporary field to store the flag. + // If the 'value' field is not valid, we will throw an exception when user try to access the strongly-typed + // properties. + private boolean isValidFeatureFlagValue; + + // This used to store the parsed properties from the 'value' field. Given initial capacity is 5, it is enough for + // current json schema. It should be equal to the number of properties defined in the swagger schema at first level. + private final Map parsedProperties = new LinkedHashMap<>(5); + + // The required properties defined in the swagger schema. + private final List requiredJsonProperties = Arrays.asList(ID, ENABLED, CONDITIONS); + + // Swagger schema defined properties at first level of FeatureFlagConfigurationSetting. + private final List requiredOrOptionalJsonProperties = + Arrays.asList(ID, DESCRIPTION, DISPLAY_NAME, ENABLED, CONDITIONS); /** * The constructor for a feature flag configuration setting. @@ -40,12 +73,60 @@ public final class FeatureFlagConfigurationSetting extends ConfigurationSetting * @param isEnabled A boolean value to turn on/off the feature flag setting. */ public FeatureFlagConfigurationSetting(String featureId, boolean isEnabled) { + isValidFeatureFlagValue = true; + this.featureId = featureId; this.isEnabled = isEnabled; super.setKey(KEY_PREFIX + featureId); super.setContentType(FEATURE_FLAG_CONTENT_TYPE); } + @Override + public String getValue() { + // Lazily update: Update 'value' by all latest property values when this getValue() method is called. + String newValue = null; + try { + final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + final JsonWriter writer = JsonProviders.createWriter(outputStream); + + final Set knownProperties = new LinkedHashSet<>(requiredOrOptionalJsonProperties); + + writer.writeStartObject(); + // If 'value' has value, and it is a valid JSON, we need to parse it and write it back. + for (Map.Entry entry : parsedProperties.entrySet()) { + final String name = entry.getKey(); + final Object jsonValue = entry.getValue(); + try { + // Try to write the known property. If it is a known property, we need to remove it from the + // temporary 'knownProperties' bag. + if (tryWriteKnownProperty(name, jsonValue, writer, true)) { + knownProperties.remove(name); + } else { + // Unknown extension property. We need to keep it. + writer.writeUntypedField(name, jsonValue); + } + } catch (IOException e) { + throw LOGGER.logExceptionAsError(new RuntimeException(e)); + } + } + // Remaining known properties we are not processed yet after 'parsedProperties'. + for (final String propertyName : knownProperties) { + tryWriteKnownProperty(propertyName, null, writer, false); + } + writer.writeEndObject(); + + writer.flush(); + newValue = outputStream.toString(StandardCharsets.UTF_8.name()); + outputStream.close(); + } catch (IOException exception) { + LOGGER.logExceptionAsError(new IllegalArgumentException( + "Can't parse Feature Flag configuration setting value.", exception)); + } + + super.setValue(newValue); + return newValue; + } + /** * Sets the key of this setting. * @@ -69,14 +150,9 @@ public FeatureFlagConfigurationSetting setKey(String key) { */ @Override public FeatureFlagConfigurationSetting setValue(String value) { + tryParseValue(value); + isValidFeatureFlagValue = true; super.setValue(value); - // update strongly-typed properties. - final FeatureFlagConfigurationSetting updatedSetting = parseFeatureFlagValue(value); - this.featureId = updatedSetting.getFeatureId(); - this.description = updatedSetting.getDescription(); - this.isEnabled = updatedSetting.isEnabled(); - this.displayName = updatedSetting.getDisplayName(); - this.clientFilters = new ArrayList<>(updatedSetting.getClientFilters()); return this; } @@ -137,8 +213,10 @@ public FeatureFlagConfigurationSetting setTags(Map tags) { * Get the feature ID of this configuration setting. * * @return the feature ID of this configuration setting. + * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public String getFeatureId() { + checkValid(); return featureId; } @@ -151,9 +229,9 @@ public String getFeatureId() { * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public FeatureFlagConfigurationSetting setFeatureId(String featureId) { + checkValid(); this.featureId = featureId; super.setKey(KEY_PREFIX + featureId); - updateSettingValue(); return this; } @@ -161,8 +239,10 @@ public FeatureFlagConfigurationSetting setFeatureId(String featureId) { * Get the boolean indicator to show if the setting is turn on or off. * * @return the boolean indicator to show if the setting is turn on or off. + * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public boolean isEnabled() { + checkValid(); return this.isEnabled; } @@ -175,8 +255,8 @@ public boolean isEnabled() { * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public FeatureFlagConfigurationSetting setEnabled(boolean isEnabled) { + checkValid(); this.isEnabled = isEnabled; - updateSettingValue(); return this; } @@ -184,8 +264,10 @@ public FeatureFlagConfigurationSetting setEnabled(boolean isEnabled) { * Get the description of this configuration setting. * * @return the description of this configuration setting. + * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public String getDescription() { + checkValid(); return description; } @@ -198,8 +280,8 @@ public String getDescription() { * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public FeatureFlagConfigurationSetting setDescription(String description) { + checkValid(); this.description = description; - updateSettingValue(); return this; } @@ -207,8 +289,10 @@ public FeatureFlagConfigurationSetting setDescription(String description) { * Get the display name of this configuration setting. * * @return the display name of this configuration setting. + * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public String getDisplayName() { + checkValid(); return displayName; } @@ -221,8 +305,8 @@ public String getDisplayName() { * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public FeatureFlagConfigurationSetting setDisplayName(String displayName) { + checkValid(); this.displayName = displayName; - updateSettingValue(); return this; } @@ -230,8 +314,10 @@ public FeatureFlagConfigurationSetting setDisplayName(String displayName) { * Gets the feature flag filters of this configuration setting. * * @return the feature flag filters of this configuration setting. + * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public List getClientFilters() { + checkValid(); if (clientFilters == null) { clientFilters = new ArrayList<>(); } @@ -247,8 +333,8 @@ public List getClientFilters() { * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public FeatureFlagConfigurationSetting setClientFilters(List clientFilters) { + checkValid(); this.clientFilters = clientFilters; - updateSettingValue(); return this; } @@ -258,22 +344,137 @@ public FeatureFlagConfigurationSetting setClientFilters(List * @param clientFilter a feature flag filter to add to this configuration setting. * * @return The updated {@link FeatureFlagConfigurationSetting} object. + * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public FeatureFlagConfigurationSetting addClientFilter(FeatureFlagFilter clientFilter) { + checkValid(); if (clientFilters == null) { clientFilters = new ArrayList<>(); } clientFilters.add(clientFilter); - updateSettingValue(); return this; } - private void updateSettingValue() { - try { - super.setValue(writeFeatureFlagConfigurationSetting(this)); - } catch (IOException exception) { - LOGGER.logExceptionAsError(new IllegalArgumentException( - "Can't parse Feature Flag configuration setting value.", exception)); + private void checkValid() { + if (!isValidFeatureFlagValue) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("The content of the " + super.getValue() + + " property do not represent a valid feature flag configuration setting.")); + } + } + + // Try to write the known property. If it is a known property, return true. Otherwise, return false. + private boolean tryWriteKnownProperty(String propertyName, Object propertyValue, JsonWriter writer, + boolean includeOptionalWhenNull) throws IOException { + switch (propertyName) { + case ID: + writer.writeStringField(ID, featureId); + break; + case DESCRIPTION: + if (includeOptionalWhenNull || description != null) { + writer.writeStringField(DESCRIPTION, description); + } + break; + case DISPLAY_NAME: + if (includeOptionalWhenNull || displayName != null) { + writer.writeStringField(DISPLAY_NAME, displayName); + } + break; + case ENABLED: + writer.writeBooleanField(ENABLED, isEnabled); + break; + case CONDITIONS: + tryWriteConditions(propertyValue, writer); + break; + default: + return false; + } + return true; + } + + // Helper method: try to write the 'conditions' property. + private void tryWriteConditions(Object propertyValue, JsonWriter writer) throws IOException { + writer.writeStartObject(CONDITIONS); + + if (propertyValue != null && propertyValue instanceof Conditions) { + Conditions propertyValueClone = (Conditions) propertyValue; + for (Map.Entry entry : propertyValueClone.getUnknownConditions().entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + writer.writeUntypedField(key, value); + } + } + + writer.writeArrayField(CLIENT_FILTERS, this.clientFilters, (jsonWriter, filter) -> { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField(NAME, filter.getName()); + jsonWriter.writeMapField(PARAMETERS, filter.getParameters(), JsonWriter::writeUntyped); + jsonWriter.writeEndObject(); // each filter object + }); + + writer.writeEndObject(); + } + + // Given JSON string value, try to parse it and store the parsed properties to the 'parsedProperties' field. + // If the parsing is successful, updates the strongly-type property and preserves the unknown properties to + // 'parsedProperties' which we will use later in getValue() to get the unknown properties. + // Otherwise, set the flag variable 'isValidFeatureFlagValue' = false and throw an exception. + private void tryParseValue(String value) { + parsedProperties.clear(); + + try (JsonReader jsonReader = JsonProviders.createReader(value)) { + jsonReader.readObject(reader -> { + final Set requiredPropertiesCopy = new LinkedHashSet<>(requiredJsonProperties); + String featureIdCopy = this.featureId; + String descriptionCopy = this.description; + String displayNameCopy = this.displayName; + boolean isEnabledCopy = this.isEnabled; + List featureFlagFiltersCopy = this.clientFilters; + + while (reader.nextToken() != JsonToken.END_OBJECT) { + final String fieldName = reader.getFieldName(); + reader.nextToken(); + + if (ID.equals(fieldName)) { + final String id = reader.getString(); + featureIdCopy = id; + parsedProperties.put(ID, id); + } else if (DESCRIPTION.equals(fieldName)) { + final String description = reader.getString(); + descriptionCopy = description; + parsedProperties.put(DESCRIPTION, description); + } else if (DISPLAY_NAME.equals(fieldName)) { + final String displayName = reader.getString(); + displayNameCopy = displayName; + parsedProperties.put(DISPLAY_NAME, displayName); + } else if (ENABLED.equals(fieldName)) { + final boolean isEnabled = reader.getBoolean(); + isEnabledCopy = isEnabled; + parsedProperties.put(ENABLED, isEnabled); + } else if (CONDITIONS.equals(fieldName)) { + final Conditions conditions = readConditions(reader); + if (conditions != null) { + List featureFlagFilters = conditions.getFeatureFlagFilters(); + featureFlagFiltersCopy = featureFlagFilters; + parsedProperties.put(CONDITIONS, conditions); + } + } else { + // The extension property is possible, we should not skip it. + parsedProperties.put(fieldName, reader.readUntyped()); + } + requiredPropertiesCopy.remove(fieldName); + } + + this.featureId = featureIdCopy; + this.description = descriptionCopy; + this.displayName = displayNameCopy; + this.isEnabled = isEnabledCopy; + this.clientFilters = featureFlagFiltersCopy; + + return requiredPropertiesCopy.isEmpty(); + }); + } catch (IOException e) { + isValidFeatureFlagValue = false; + throw LOGGER.logExceptionAsError(new IllegalArgumentException(e)); } } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SecretReferenceConfigurationSetting.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SecretReferenceConfigurationSetting.java index d28bdeece9f6..17baf11c0226 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SecretReferenceConfigurationSetting.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SecretReferenceConfigurationSetting.java @@ -5,12 +5,18 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonProviders; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.LinkedHashMap; import java.util.Map; -import static com.azure.data.appconfiguration.implementation.ConfigurationSettingDeserializationHelper.parseSecretReferenceFieldValue; -import static com.azure.data.appconfiguration.implementation.ConfigurationSettingSerializationHelper.writeSecretReferenceConfigurationSetting; +import static com.azure.data.appconfiguration.implementation.Utility.URI; /** * {@link SecretReferenceConfigurationSetting} model. It represents a configuration setting that references as @@ -24,6 +30,11 @@ public final class SecretReferenceConfigurationSetting extends ConfigurationSett private static final String SECRET_REFERENCE_CONTENT_TYPE = "application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8"; + // The flag to indicate if the 'value' field is valid. It is a temporary field to store the flag. + // If the 'value' field is not valid, we will throw an exception when user try to access the strongly-typed + // properties. + private boolean isValidSecretReferenceValue; + private final Map parsedProperties = new LinkedHashMap<>(1); /** * The constructor for a secret reference configuration setting. * @@ -31,6 +42,8 @@ public final class SecretReferenceConfigurationSetting extends ConfigurationSett * @param secretId A uri value that used to in the JSON value of setting. e.x., {"uri":"{secretId}"}. */ public SecretReferenceConfigurationSetting(String key, String secretId) { + isValidSecretReferenceValue = true; + this.secretId = secretId; super.setKey(key); super.setValue("{\"uri\":\"" + secretId + "\"}"); @@ -41,8 +54,10 @@ public SecretReferenceConfigurationSetting(String key, String secretId) { * Get the secret ID value of this configuration setting. * * @return the secret ID value of this configuration setting. + * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public String getSecretId() { + checkValid(); return secretId; } @@ -55,8 +70,8 @@ public String getSecretId() { * @throws IllegalArgumentException if the setting's {@code value} is an invalid JSON format. */ public SecretReferenceConfigurationSetting setSecretId(String secretId) { + checkValid(); this.secretId = secretId; - updateSettingValue(); return this; } @@ -73,6 +88,54 @@ public SecretReferenceConfigurationSetting setKey(String key) { return this; } + @Override + public String getValue() { + // Lazily update: Update 'value' by all latest property values when this getValue() method is called. + String newValue = null; + try { + final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + final JsonWriter writer = JsonProviders.createWriter(outputStream); + + boolean isUriWritten = false; + + writer.writeStartObject(); + // If 'value' has value, and it is a valid JSON, we need to parse it and write it back. + for (Map.Entry entry : parsedProperties.entrySet()) { + final String name = entry.getKey(); + final Object jsonValue = entry.getValue(); + try { + // Try to write the known property. If it is a known property, we need to remove it from the + // temporary 'knownProperties' bag. + if (URI.equals(name)) { + writer.writeStringField(URI, secretId); + isUriWritten = true; + } else { + // Unknown extension property. We need to keep it. + writer.writeUntypedField(name, jsonValue); + } + } catch (IOException e) { + throw LOGGER.logExceptionAsError(new RuntimeException(e)); + } + } + + if (!isUriWritten) { + writer.writeStringField(URI, secretId); + } + + writer.writeEndObject(); + writer.flush(); + + newValue = outputStream.toString(StandardCharsets.UTF_8.name()); + outputStream.close(); + } catch (IOException exception) { + LOGGER.logExceptionAsError(new IllegalArgumentException( + "Can't parse Secret Reference configuration setting value.", exception)); + } + + super.setValue(newValue); + return newValue; + } + /** * Sets the value of this setting. * @@ -83,10 +146,9 @@ public SecretReferenceConfigurationSetting setKey(String key) { */ @Override public SecretReferenceConfigurationSetting setValue(String value) { + tryParseValue(value); + isValidSecretReferenceValue = true; super.setValue(value); - // update strongly-typed properties. - SecretReferenceConfigurationSetting updatedSetting = parseSecretReferenceFieldValue(super.getKey(), value); - this.secretId = updatedSetting.getSecretId(); return this; } @@ -139,12 +201,47 @@ public SecretReferenceConfigurationSetting setTags(Map tags) { return this; } - private void updateSettingValue() { - try { - super.setValue(writeSecretReferenceConfigurationSetting(this)); - } catch (IOException exception) { - LOGGER.logExceptionAsError(new IllegalArgumentException( - "Can't parse Secret Reference configuration setting value.", exception)); + private void checkValid() { + if (!isValidSecretReferenceValue) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("The content of the " + super.getValue() + + " property do not represent a valid secret reference configuration setting.")); + } + } + + // Given JSON string value, try to parse it and store the parsed properties to the 'parsedProperties' field. + // If the parsing is successful, updates the strongly-type property and preserves the unknown properties to + // 'parsedProperties' which we will use later in getValue() to get the unknown properties. + // Otherwise, set the flag variable 'isValidSecretReferenceValue' = false and throw an exception. + private void tryParseValue(String value) { + parsedProperties.clear(); + + try (JsonReader jsonReader = JsonProviders.createReader(value)) { + jsonReader.readObject(reader -> { + boolean isSecretIdUriValid = false; + String secreteIdUri = this.secretId; + + while (reader.nextToken() != JsonToken.END_OBJECT) { + final String fieldName = reader.getFieldName(); + reader.nextToken(); + + if (URI.equals(fieldName)) { + final String secretIdClone = reader.getString(); + secreteIdUri = secretIdClone; + parsedProperties.put(URI, secreteIdUri); + isSecretIdUriValid = true; + } else { + // The extension property is possible, we should not skip it. + parsedProperties.put(fieldName, reader.readUntyped()); + } + } + + // update strongly-typed property, 'secretId'. + this.secretId = secreteIdUri; + return isSecretIdUriValid; + }); + } catch (IOException e) { + isValidSecretReferenceValue = false; + throw LOGGER.logExceptionAsError(new IllegalArgumentException(e)); } } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SnapshotSelector.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SnapshotSelector.java index 6b03d85a2f24..6807fb63a060 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SnapshotSelector.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SnapshotSelector.java @@ -21,6 +21,11 @@ public final class SnapshotSelector { private List fields; + /** + * Creates an instance of {@link SnapshotSelector}. + */ + public SnapshotSelector() { } + /** * Gets the snapshot name * diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java index a8d2539d635d..41f9e38f4145 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java @@ -256,6 +256,38 @@ public void setFeatureFlagConfigurationSettingConvenience(HttpClient httpClient, .verifyComplete()); } + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.data.appconfiguration.TestHelper#getTestParameters") + public void featureFlagConfigurationSettingUnknownAttributesArePreserved(HttpClient httpClient, + ConfigurationServiceVersion serviceVersion) { + client = getConfigurationAsyncClient(httpClient, serviceVersion); + featureFlagConfigurationSettingUnknownAttributesArePreservedRunner( + (expected) -> { + StepVerifier.create(client.addConfigurationSetting(expected)) + .assertNext(response -> assertFeatureFlagConfigurationSettingEquals( + expected, + (FeatureFlagConfigurationSetting) response)) + .verifyComplete(); + StepVerifier.create(client.setConfigurationSetting(expected)) + .assertNext(response -> assertFeatureFlagConfigurationSettingEquals( + expected, + (FeatureFlagConfigurationSetting) response)) + .verifyComplete(); + StepVerifier.create(client.getConfigurationSetting(expected)) + .assertNext(response -> assertFeatureFlagConfigurationSettingEquals( + expected, + (FeatureFlagConfigurationSetting) response)) + .verifyComplete(); + StepVerifier.create(client.deleteConfigurationSetting(expected)) + .assertNext(response -> assertFeatureFlagConfigurationSettingEquals(expected, + (FeatureFlagConfigurationSetting) response)) + .verifyComplete(); + StepVerifier.create(client.getConfigurationSetting(expected)) + .verifyErrorSatisfies( + ex -> assertRestException(ex, HttpResponseException.class, HttpURLConnection.HTTP_NOT_FOUND)); + }); + } + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.data.appconfiguration.TestHelper#getTestParameters") public void setSecretReferenceConfigurationSettingConvenience(HttpClient httpClient, @@ -269,6 +301,38 @@ public void setSecretReferenceConfigurationSettingConvenience(HttpClient httpCli .verifyComplete()); } + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.data.appconfiguration.TestHelper#getTestParameters") + public void secretReferenceConfigurationSettingUnknownAttributesArePreserved(HttpClient httpClient, + ConfigurationServiceVersion serviceVersion) { + client = getConfigurationAsyncClient(httpClient, serviceVersion); + secretReferenceConfigurationSettingUnknownAttributesArePreservedRunner( + (expected) -> { + StepVerifier.create(client.addConfigurationSetting(expected)) + .assertNext(response -> assertSecretReferenceConfigurationSettingEquals( + expected, + (SecretReferenceConfigurationSetting) response)) + .verifyComplete(); + StepVerifier.create(client.setConfigurationSetting(expected)) + .assertNext(response -> assertSecretReferenceConfigurationSettingEquals( + expected, + (SecretReferenceConfigurationSetting) response)) + .verifyComplete(); + StepVerifier.create(client.getConfigurationSetting(expected)) + .assertNext(response -> assertSecretReferenceConfigurationSettingEquals( + expected, + (SecretReferenceConfigurationSetting) response)) + .verifyComplete(); + StepVerifier.create(client.deleteConfigurationSetting(expected)) + .assertNext(response -> assertSecretReferenceConfigurationSettingEquals(expected, + (SecretReferenceConfigurationSetting) response)) + .verifyComplete(); + StepVerifier.create(client.getConfigurationSetting(expected)) + .verifyErrorSatisfies( + ex -> assertRestException(ex, HttpResponseException.class, HttpURLConnection.HTTP_NOT_FOUND)); + }); + } + /** * Tests that when an ETag is passed to set it will only set if the current representation of the setting has the * ETag. If the set ETag doesn't match anything the update won't happen, this will result in a 412. This will diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java index 08bffda67f79..2c9509c21de1 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java @@ -220,6 +220,26 @@ public void setFeatureFlagConfigurationSettingConvenience(HttpClient httpClient, (FeatureFlagConfigurationSetting) client.setConfigurationSetting(expected))); } + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.data.appconfiguration.TestHelper#getTestParameters") + public void featureFlagConfigurationSettingUnknownAttributesArePreserved(HttpClient httpClient, + ConfigurationServiceVersion serviceVersion) { + client = getConfigurationClient(httpClient, serviceVersion); + featureFlagConfigurationSettingUnknownAttributesArePreservedRunner( + (expected) -> { + assertFeatureFlagConfigurationSettingEquals(expected, + (FeatureFlagConfigurationSetting) client.addConfigurationSetting(expected)); + assertFeatureFlagConfigurationSettingEquals(expected, + (FeatureFlagConfigurationSetting) client.setConfigurationSetting(expected)); + assertFeatureFlagConfigurationSettingEquals(expected, + (FeatureFlagConfigurationSetting) client.getConfigurationSetting(expected)); + assertFeatureFlagConfigurationSettingEquals(expected, + (FeatureFlagConfigurationSetting) client.deleteConfigurationSetting(expected)); + assertRestException(() -> client.getConfigurationSetting(expected.getKey(), expected.getLabel()), + HttpResponseException.class, HttpURLConnection.HTTP_NOT_FOUND); + }); + } + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.data.appconfiguration.TestHelper#getTestParameters") public void setSecretReferenceConfigurationSettingConvenience(HttpClient httpClient, @@ -230,6 +250,26 @@ public void setSecretReferenceConfigurationSettingConvenience(HttpClient httpCli (SecretReferenceConfigurationSetting) client.setConfigurationSetting(expected))); } + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.data.appconfiguration.TestHelper#getTestParameters") + public void secretReferenceConfigurationSettingUnknownAttributesArePreserved(HttpClient httpClient, + ConfigurationServiceVersion serviceVersion) { + client = getConfigurationClient(httpClient, serviceVersion); + secretReferenceConfigurationSettingUnknownAttributesArePreservedRunner( + (expected) -> { + assertSecretReferenceConfigurationSettingEquals(expected, + (SecretReferenceConfigurationSetting) client.addConfigurationSetting(expected)); + assertSecretReferenceConfigurationSettingEquals(expected, + (SecretReferenceConfigurationSetting) client.setConfigurationSetting(expected)); + assertSecretReferenceConfigurationSettingEquals(expected, + (SecretReferenceConfigurationSetting) client.getConfigurationSetting(expected)); + assertSecretReferenceConfigurationSettingEquals(expected, + (SecretReferenceConfigurationSetting) client.deleteConfigurationSetting(expected)); + assertRestException(() -> client.getConfigurationSetting(expected.getKey(), expected.getLabel()), + HttpResponseException.class, HttpURLConnection.HTTP_NOT_FOUND); + }); + } + /** * Tests that when an ETag is passed to set it will only set if the current representation of the setting has the * ETag. If the set ETag doesn't match anything the update won't happen, this will result in a 412. This will diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java index 8030b1e81322..0179ba5edd89 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java @@ -184,6 +184,25 @@ void setFeatureFlagConfigurationSettingRunner( getFeatureFlagConfigurationSetting(key, "new Feature Flag X")); } + @Test + public abstract void featureFlagConfigurationSettingUnknownAttributesArePreserved(HttpClient httpClient, + ConfigurationServiceVersion serviceVersion); + + void featureFlagConfigurationSettingUnknownAttributesArePreservedRunner( + Consumer testRunner) { + String key = getKey(); + FeatureFlagConfigurationSetting featureFlagX = getFeatureFlagConfigurationSetting(key, "Feature Flag X"); + String valueWithAdditionalFieldAtFirstLayer = + String.format( + "{\"id\":\"%s\",\"k1\":\"v1\",\"description\":\"%s\",\"display_name\":\"%s\",\"enabled\":%s," + + "\"conditions\":{\"requirement_type\":\"All\",\"client_filters\":" + + "[{\"name\":\"Microsoft.Percentage\",\"parameters\":{\"Value\":\"30\"}}]" + + "},\"additional_field\":\"additional_value\"}", featureFlagX.getFeatureId(), + featureFlagX.getDescription(), featureFlagX.getDisplayName(), featureFlagX.isEnabled()); + featureFlagX.setValue(valueWithAdditionalFieldAtFirstLayer); + testRunner.accept(featureFlagX); + } + @Test public abstract void setSecretReferenceConfigurationSettingConvenience(HttpClient httpClient, ConfigurationServiceVersion serviceVersion); @@ -195,6 +214,20 @@ void setSecretReferenceConfigurationSettingRunner( new SecretReferenceConfigurationSetting(key, "https://localhost/100")); } + @Test + public abstract void secretReferenceConfigurationSettingUnknownAttributesArePreserved(HttpClient httpClient, + ConfigurationServiceVersion serviceVersion); + + void secretReferenceConfigurationSettingUnknownAttributesArePreservedRunner( + Consumer testRunner) { + String key = getKey(); + String valueWithAdditionalFields = + "{\"uri\":\"uriValue\",\"objectFiledName\":{\"unknown\":\"unknown\",\"unknown2\":\"unknown2\"}," + + "\"arrayFieldName\":[{\"name\":\"Microsoft.Percentage\",\"parameters\":{\"Value\":\"30\"}}]}"; + + testRunner.accept(new SecretReferenceConfigurationSetting(key, valueWithAdditionalFields)); + } + @Test public abstract void setConfigurationSettingIfETag(HttpClient httpClient, ConfigurationServiceVersion serviceVersion); diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/FeatureFlagSettingUnitTest.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/FeatureFlagSettingUnitTest.java index f471c47a3389..fe5c0c1e85f0 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/FeatureFlagSettingUnitTest.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/FeatureFlagSettingUnitTest.java @@ -29,16 +29,6 @@ public class FeatureFlagSettingUnitTest { static final String UPDATED_DISPLAY_NAME_VALUE = "updatedDisplayName"; static final boolean UPDATED_IS_ENABLED = true; - String getFeatureFlagConfigurationSettingValue(String id, String description, String displayName, - boolean isEnabled) { - return String.format("{\"id\":\"%s\",\"description\":\"%s\",\"display_name\":\"%s\"," - + "\"enabled\":%s," - + "\"conditions\":{\"client_filters\":" - + "[{\"name\":\"Microsoft.Percentage\",\"parameters\":{\"Value\":\"30\"}}]" - + "}}", - id, description, displayName, isEnabled); - } - @Test public void accessingStronglyTypedPropertiesAfterSettingDifferentFeatureFlagJSON() { // Create a new feature flag configuration setting, @@ -64,16 +54,12 @@ public void accessingStronglyTypedPropertiesAfterSettingDifferentFeatureFlagJSON @Test public void accessingValueAfterChangingStronglyTypedProperties() { - // Create a new feature flag configuration setting, - final List featureFlagFilters = Arrays.asList( - getFlagFilter(FILTER_NAME, getFilterParameters())); - FeatureFlagConfigurationSetting setting = getFeatureFlagConfigurationSetting(NEW_KEY, DESCRIPTION_VALUE, - DISPLAY_NAME_VALUE, IS_ENABLED, featureFlagFilters); - + FeatureFlagConfigurationSetting setting = createFeatureFlagConfigurationSetting(); String expectedNewSettingValue = getFeatureFlagConfigurationSettingValue(NEW_KEY, DESCRIPTION_VALUE, DISPLAY_NAME_VALUE, IS_ENABLED); + // Test getValue() assertEquals(expectedNewSettingValue, setting.getValue()); - // Change strongly-type properties. + // Update strongly-type properties. setting.setFeatureId(UPDATED_KEY); setting.setDescription(UPDATED_DESCRIPTION_VALUE); setting.setDisplayName(UPDATED_DISPLAY_NAME_VALUE); @@ -88,14 +74,34 @@ public void accessingValueAfterChangingStronglyTypedProperties() { @Test public void throwExceptionWhenInvalidNonJsonFeatureFlagValue() { - // Create a new feature flag configuration setting, - final List featureFlagFilters = Arrays.asList( - getFlagFilter(FILTER_NAME, getFilterParameters())); - FeatureFlagConfigurationSetting setting = getFeatureFlagConfigurationSetting(NEW_KEY, DESCRIPTION_VALUE, - DISPLAY_NAME_VALUE, IS_ENABLED, featureFlagFilters); + FeatureFlagConfigurationSetting setting = createFeatureFlagConfigurationSetting(); + String expectedValue = getFeatureFlagConfigurationSettingValue(NEW_KEY, DESCRIPTION_VALUE, + DISPLAY_NAME_VALUE, IS_ENABLED); + + String originalValue = setting.getValue(); + assertEquals(expectedValue, originalValue); + + assertThrows(IllegalArgumentException.class, () -> setting.setValue("invalidValueForFeatureFlagSetting")); + assertEquals(expectedValue, setting.getValue()); + assertThrows(IllegalArgumentException.class, () -> setting.getFeatureId()); + assertThrows(IllegalArgumentException.class, () -> setting.getDescription()); + assertThrows(IllegalArgumentException.class, () -> setting.getDisplayName()); + assertThrows(IllegalArgumentException.class, () -> setting.isEnabled()); + assertThrows(IllegalArgumentException.class, () -> setting.getClientFilters()); + } - // Throws IllegalStateException when setting value to non-JSON - assertThrows(IllegalStateException.class, () -> setting.setValue("Hello World")); + @Test + public void reserveUnknownPropertiesTest() { + FeatureFlagConfigurationSetting setting = createFeatureFlagConfigurationSetting(); + String newSettingValueJSON = getUnknownPropertiesFeatureFlagConfigurationSettingValue( + UPDATED_KEY, UPDATED_DESCRIPTION_VALUE, UPDATED_DISPLAY_NAME_VALUE, UPDATED_IS_ENABLED); + + setting.setValue(newSettingValueJSON); + assertEquals(newSettingValueJSON, setting.getValue()); + assertEquals(UPDATED_KEY, setting.getFeatureId()); + assertEquals(UPDATED_DESCRIPTION_VALUE, setting.getDescription()); + assertEquals(UPDATED_DISPLAY_NAME_VALUE, setting.getDisplayName()); + assertEquals(UPDATED_IS_ENABLED, setting.isEnabled()); } @Test @@ -106,6 +112,34 @@ public void addFilter() { assertEquals(1, setting.getClientFilters().size()); } + private FeatureFlagConfigurationSetting createFeatureFlagConfigurationSetting() { + // Create a new feature flag configuration setting, + final List featureFlagFilters = Arrays.asList( + getFlagFilter(FILTER_NAME, getFilterParameters())); + return getFeatureFlagConfigurationSetting(NEW_KEY, DESCRIPTION_VALUE, + DISPLAY_NAME_VALUE, IS_ENABLED, featureFlagFilters); + } + + private String getFeatureFlagConfigurationSettingValue(String id, String description, String displayName, + boolean isEnabled) { + return String.format("{\"id\":\"%s\",\"description\":\"%s\",\"display_name\":\"%s\"," + + "\"enabled\":%s," + + "\"conditions\":{\"client_filters\":" + + "[{\"name\":\"Microsoft.Percentage\",\"parameters\":{\"Value\":\"30\"}}]" + + "}}", + id, description, displayName, isEnabled); + } + + private String getUnknownPropertiesFeatureFlagConfigurationSettingValue(String id, String description, + String displayName, boolean isEnabled) { + return String.format("{\"id\":\"%s\",\"additional_field_1\":\"additional_value_1\",\"description\":\"%s\",\"display_name\":\"%s\",\"enabled\":%s," + + "\"conditions\":{\"requirement_type\":\"All\",\"client_filters\":" + + "[{\"name\":\"Microsoft.Percentage\",\"parameters\":{\"Value\":\"30\"}}]" + + "},\"objectFiledName\":{\"unknown\":\"unknown\",\"unknown2\":\"unknown2\"}," + + "\"arrayFieldName\":[{\"name\":\"Microsoft.Percentage\",\"parameters\":{\"Value\":\"30\"}}]}", + id, description, displayName, isEnabled); + } + private FeatureFlagConfigurationSetting getFeatureFlagConfigurationSetting(String id, String description, String displayName, boolean isEnabled, List filters) { return new FeatureFlagConfigurationSetting(id, isEnabled) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/SecretReferenceConfigurationSettingUnitTest.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/SecretReferenceConfigurationSettingUnitTest.java index 3d2de6f6383d..a2fff7b8b649 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/SecretReferenceConfigurationSettingUnitTest.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/SecretReferenceConfigurationSettingUnitTest.java @@ -47,14 +47,34 @@ public void accessingValueAfterChangingStronglyTypedProperties() { public void throwExceptionWhenInvalidNonJsonSecretReferenceValue() { // Create a new feature flag configuration setting, SecretReferenceConfigurationSetting setting = getSecretReferenceConfigurationSetting(NEW_KEY, SECRET_ID_VALUE); - // Throws IllegalStateException when setting value to non-JSON - assertThrows(IllegalStateException.class, () -> setting.setValue("Hello World")); + + String expectedValue = getSecretReferenceConfigurationSettingValue(SECRET_ID_VALUE); + String originalValue = setting.getValue(); + assertEquals(expectedValue, originalValue); + assertThrows(IllegalArgumentException.class, () -> setting.setValue("invalidValueForSecretReferenceConfigurationSetting")); + assertEquals(originalValue, setting.getValue()); + assertThrows(IllegalArgumentException.class, () -> setting.getSecretId()); + } + + @Test + public void reserveUnknownPropertiesTest() { + SecretReferenceConfigurationSetting setting = getSecretReferenceConfigurationSetting(NEW_KEY, SECRET_ID_VALUE); + String newSettingValueJSON = getUnknownPropertiesSecretReferenceConfigurationSettingValue(UPDATED_SECRET_ID_VALUE); + + setting.setValue(newSettingValueJSON); + assertEquals(newSettingValueJSON, setting.getValue()); + assertEquals(UPDATED_SECRET_ID_VALUE, setting.getSecretId()); } String getSecretReferenceConfigurationSettingValue(String secretId) { return String.format("{\"uri\":\"%s\"}", secretId); } + String getUnknownPropertiesSecretReferenceConfigurationSettingValue(String secretId) { + return String.format("{\"uri\":\"%s\",\"objectFiledName\":{\"unknown\":\"unknown\",\"unknown2\":\"unknown2\"}," + + "\"arrayFieldName\":[{\"name\":\"Microsoft.Percentage\",\"parameters\":{\"Value\":\"30\"}}]}", secretId); + } + private SecretReferenceConfigurationSetting getSecretReferenceConfigurationSetting(String key, String secretId) { return new SecretReferenceConfigurationSetting(key, secretId); } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/swagger/README.md b/sdk/appconfiguration/azure-data-appconfiguration/swagger/README.md index 1cefab1ba3a1..fa1b8b3fe48f 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/swagger/README.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/swagger/README.md @@ -30,7 +30,7 @@ autorest ```yaml namespace: com.azure.data.appconfiguration input-file: -- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/2f7a3cbda00c6ae4199940d500e5212b6481d9ea/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/preview/2022-11-01-preview/appconfiguration.json +- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/appconfiguration/data-plane/Microsoft.AppConfiguration/stable/2023-10-01/appconfiguration.json models-subpackage: implementation.models custom-types-subpackage: models custom-types: KeyValueFields,KeyValueFilter,SettingFields,SnapshotSettingFilter,CompositionType,Snapshot,ConfigurationSettingsSnapshot,SnapshotStatus,SnapshotFields,SnapshotFields diff --git a/sdk/attestation/azure-security-attestation/CHANGELOG.md b/sdk/attestation/azure-security-attestation/CHANGELOG.md index bfa448438ff3..a44898062860 100644 --- a/sdk/attestation/azure-security-attestation/CHANGELOG.md +++ b/sdk/attestation/azure-security-attestation/CHANGELOG.md @@ -13,6 +13,14 @@ ### Other Changes +## 1.1.17 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. + ## 1.1.16 (2023-08-18) ### Other Changes diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/AttestationAdministrationClientBuilder.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/AttestationAdministrationClientBuilder.java index c161147f5383..db121be47038 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/AttestationAdministrationClientBuilder.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/AttestationAdministrationClientBuilder.java @@ -131,6 +131,7 @@ public final class AttestationAdministrationClientBuilder implements private static final String SDK_NAME = "name"; private static final String SDK_VERSION = "version"; private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy("retry-after-ms", ChronoUnit.MILLIS); + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); private final String[] dataplaneScope = new String[] {"https://attest.azure.net/.default"}; @@ -470,10 +471,12 @@ private AttestationClientImpl buildInnerClient() { HttpPipeline pipeline = this.pipeline; if (pipeline == null) { + ClientOptions localClientOptions = clientOptions != null ? clientOptions : DEFAULT_CLIENT_OPTIONS; + // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); policies.add(new UserAgentPolicy( - getApplicationId(clientOptions, httpLogOptions), CLIENT_NAME, CLIENT_VERSION, buildConfiguration)); + getApplicationId(localClientOptions, httpLogOptions), CLIENT_NAME, CLIENT_VERSION, buildConfiguration)); policies.add(new RequestIdPolicy()); policies.add(new AddHeadersFromContextPolicy()); @@ -491,12 +494,10 @@ private AttestationClientImpl buildInnerClient() { } policies.addAll(perRetryPolicies); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach( - header -> httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach( + header -> httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); @@ -505,6 +506,7 @@ private AttestationClientImpl buildInnerClient() { pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) + .clientOptions(localClientOptions) .build(); } diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/AttestationClientBuilder.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/AttestationClientBuilder.java index c95b282283ad..f15f14786aba 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/AttestationClientBuilder.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/AttestationClientBuilder.java @@ -96,6 +96,7 @@ public final class AttestationClientBuilder implements private static final String SDK_VERSION = "version"; private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy("retry-after-ms", ChronoUnit.MILLIS); + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); private final String[] dataplaneScope = new String[] {"https://attest.azure.net/.default"}; @@ -438,10 +439,12 @@ private AttestationClientImpl buildInnerClient() { // which were provided. HttpPipeline pipeline = this.pipeline; if (pipeline == null) { + ClientOptions localClientOptions = clientOptions != null ? clientOptions : DEFAULT_CLIENT_OPTIONS; + // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); policies.add(new UserAgentPolicy( - getApplicationId(clientOptions, httpLogOptions), CLIENT_NAME, CLIENT_VERSION, buildConfiguration)); + getApplicationId(localClientOptions, httpLogOptions), CLIENT_NAME, CLIENT_VERSION, buildConfiguration)); policies.add(new RequestIdPolicy()); policies.add(new AddHeadersFromContextPolicy()); @@ -459,12 +462,10 @@ private AttestationClientImpl buildInnerClient() { } policies.addAll(perRetryPolicies); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach( - header -> httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach( + header -> httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); @@ -473,6 +474,7 @@ private AttestationClientImpl buildInnerClient() { pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) + .clientOptions(localClientOptions) .build(); } diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationDataInterpretation.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationDataInterpretation.java index 474266f035d1..a2cc2689468c 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationDataInterpretation.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationDataInterpretation.java @@ -37,8 +37,16 @@ public static AttestationDataInterpretation fromString(String name) { return fromString(name, AttestationDataInterpretation.class); } - /** @return known AttestationType values. */ + /** + * Returns a collection of {@link AttestationDataInterpretation} as values. + * + * @return known AttestationType values. */ public static Collection values() { return values(AttestationDataInterpretation.class); } + + /** + * Creates an instance of {@link AttestationDataInterpretation} + */ + public AttestationDataInterpretation() { } } diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationPolicySetOptions.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationPolicySetOptions.java index 859075bd7903..c77ffa91d025 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationPolicySetOptions.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationPolicySetOptions.java @@ -22,6 +22,12 @@ public final class AttestationPolicySetOptions { private String policy; private AttestationSigningKey signer; + + /** + * Creates an instance of {@link AttestationPolicySetOptions} + */ + public AttestationPolicySetOptions() { } + /** * Sets the options used to validate attestation tokens returned from the service. * @param validationOptions Token Validation options to be used to enhance the validations diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationResponse.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationResponse.java index 57cf3d2183f7..18c58ff288b3 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationResponse.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationResponse.java @@ -11,6 +11,8 @@ /** * The result of an attestation operation. + * + * @param The type of the attestation response value. */ @Immutable public final class AttestationResponse extends ResponseBase { diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationSigningKey.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationSigningKey.java index bf388979fb50..433e1918a4b3 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationSigningKey.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationSigningKey.java @@ -38,14 +38,18 @@ public AttestationSigningKey(X509Certificate certificate, PrivateKey privateKey) } /** - * @return Returns the X.509 certificate associated with this Signing Key. + * Returns the X.509 certificate associated with this Signing Key. + * + * @return the X.509 certificate. */ public X509Certificate getCertificate() { return this.certificate; } /** - * @return Returns the private key associated with this signing key. + * Returns the private key associated with this signing key. + * + * @return the private key. */ public PrivateKey getPrivateKey() { return this.privateKey; @@ -63,8 +67,9 @@ public AttestationSigningKey setWeakKeyAllowed(boolean weakKeyAllowed) { } /** + * Returns if a weak key is allowed on this signing key. * - * @return Returns if a weak key is allowed on this signing key. + * @return the boolean indicator. */ public boolean isWeakKeyAllowed() { return this.weakKeyAllowed; diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationType.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationType.java index 435094ad7068..ede11ebc0d8e 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationType.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/AttestationType.java @@ -19,6 +19,11 @@ public final class AttestationType extends ExpandableStringEnum /** Static value Tpm for AttestationType. */ public static final AttestationType TPM = fromString("Tpm"); + /** + * Creates an instance of {@link AttestationType} + */ + public AttestationType() { } + /** * Creates or finds a AttestationType from its string representation. * @@ -30,7 +35,11 @@ public static AttestationType fromString(String name) { return fromString(name, AttestationType.class); } - /** @return known AttestationType values. */ + /** + * Returns the collection of {@link AttestationType} as values. + * + * @return the known AttestationType values. + */ public static Collection values() { return values(AttestationType.class); } diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/CertificateModification.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/CertificateModification.java index 03e193cb8290..94c285e7b90d 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/CertificateModification.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/CertificateModification.java @@ -16,6 +16,11 @@ public final class CertificateModification extends ExpandableStringEnum values() { return values(CertificateModification.class); } diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/PolicyModification.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/PolicyModification.java index 799cb2ef2af5..c8b19d3261cb 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/PolicyModification.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/PolicyModification.java @@ -16,6 +16,11 @@ public final class PolicyModification extends ExpandableStringEnum values() { return values(PolicyModification.class); } diff --git a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/TpmAttestationResult.java b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/TpmAttestationResult.java index a099824d4608..2a4229dc75c0 100644 --- a/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/TpmAttestationResult.java +++ b/sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/models/TpmAttestationResult.java @@ -22,7 +22,11 @@ public TpmAttestationResult(BinaryData result) { this.tpmResult = result; } - /** @return known Tpm Attestation Result. */ + /** + * Returns the known Tpm Attestation result. + * + * @return the known Tpm Attestation Result. + */ public BinaryData getTpmResult() { return tpmResult; } diff --git a/sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/models/AttestationTokenTests.java b/sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/models/AttestationTokenTests.java index 2619b1baef65..5a202ac2656a 100644 --- a/sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/models/AttestationTokenTests.java +++ b/sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/models/AttestationTokenTests.java @@ -14,6 +14,8 @@ import java.security.cert.X509Certificate; import java.time.OffsetDateTime; import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; import java.util.LinkedHashMap; import static org.junit.jupiter.api.Assertions.assertArrayEquals; @@ -24,6 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * Test for Attestation Signing Certificates APIs. @@ -269,8 +272,7 @@ void verifyAttestationTokenIssuer() { @Test void verifyAttestationTokenExpireTimeout() { - OffsetDateTime timeNow = OffsetDateTime.now(); - timeNow = timeNow.minusNanos(timeNow.getNano()); + final OffsetDateTime timeNow = OffsetDateTime.now().truncatedTo(ChronoUnit.MICROS); TestObject testObjectExpired30SecondsAgo = new TestObject() .setAlg("Test Algorithm") @@ -290,14 +292,36 @@ void verifyAttestationTokenExpireTimeout() { ((AttestationTokenImpl) newToken).validate(null, new AttestationTokenValidationOptions())); // Both the current time and the expiration time should be in the exception message. - assertTrue(ex.getMessage().contains("expiration")); + String exceptionMessage = ex.getMessage(); + assertTrue(exceptionMessage.contains("expiration"), () -> + "Expected exception message to contain 'expiration' but it didn't. Actual exception message: " + + exceptionMessage); // Because the TestObject round-trips times through Epoch times, they are in UTC time. // Adjust the target time to be in UTC rather than the current time zone, since we're checking to ensure // that the time is reflected in the exception message. OffsetDateTime expTime = timeNow.minusSeconds(30).withOffsetSameInstant(ZoneOffset.UTC); - assertTrue(ex.getMessage().contains(String.format("%tc", timeNow))); - assertTrue(ex.getMessage().contains(String.format("%tc", expTime))); + // Format of the exception message is "Current time: Expiration time: " + // Since the test could take a while and the current time is based on the time when the exception is thrown + // this can cause it to be different than 'timeNow' when the test started. + // To make sure this test isn't flaky capture the datetime string in the exception message, turn it into an + // OffsetDateTime and compare it to 'timeNow' allowing for some skew. + // Date format is 'Wed Sep 27 12:48:15 -04:00 2023' + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss XXX yyyy"); + + int currentTimeIndex = exceptionMessage.indexOf("Current time: "); + int expirationTimeIndex = exceptionMessage.indexOf("Expiration time: "); + String currentTimeInExceptionString = exceptionMessage.substring(currentTimeIndex + 14, expirationTimeIndex - 1); + OffsetDateTime currentTimeInException = OffsetDateTime.parse(currentTimeInExceptionString, formatter); + long skew = timeNow.until(currentTimeInException, ChronoUnit.SECONDS); + if (skew > 5 || skew < 0) { + fail(String.format("Expected exception message to contain 'Current Time' within 5 seconds, but not before, " + + "of %tc but it was greater. Actual exception message: %s", timeNow, exceptionMessage)); + } + + assertTrue(exceptionMessage.contains(String.format("%tc", expTime)), () -> String.format( + "Expected exception message to contain '%tc' but it didn't. Actual exception message: %s", expTime, + exceptionMessage)); } @Test diff --git a/sdk/communication/azure-communication-callautomation/CHANGELOG.md b/sdk/communication/azure-communication-callautomation/CHANGELOG.md index 2f53818007df..9e5fc6faf43f 100644 --- a/sdk/communication/azure-communication-callautomation/CHANGELOG.md +++ b/sdk/communication/azure-communication-callautomation/CHANGELOG.md @@ -12,6 +12,15 @@ ### Other Changes +## 1.0.4 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-communication-common` from `1.2.11` to version `1.2.12`. + ## 1.0.3 (2023-08-18) ### Other Changes diff --git a/sdk/communication/azure-communication-callautomation/pom.xml b/sdk/communication/azure-communication-callautomation/pom.xml index 2082ed0fc3c8..853ed8cf20d5 100644 --- a/sdk/communication/azure-communication-callautomation/pom.xml +++ b/sdk/communication/azure-communication-callautomation/pom.xml @@ -60,18 +60,18 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 com.azure azure-communication-identity - 1.4.9 + 1.4.10 test com.azure azure-messaging-servicebus - 7.14.3 + 7.14.4 test @@ -137,7 +137,7 @@ com.azure azure-communication-phonenumbers - 1.1.5 + 1.1.6 test diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationEventParser.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationEventParser.java index 38d0f35edc40..88e6490f7b8d 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationEventParser.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationEventParser.java @@ -3,6 +3,7 @@ package com.azure.communication.callautomation; +import com.azure.communication.callautomation.models.events.AddParticipantCancelled; import com.azure.communication.callautomation.models.events.AddParticipantFailed; import com.azure.communication.callautomation.models.events.AddParticipantSucceeded; import com.azure.communication.callautomation.models.events.CallAutomationEventBase; @@ -10,6 +11,7 @@ import com.azure.communication.callautomation.models.events.CallDisconnected; import com.azure.communication.callautomation.models.events.CallTransferAccepted; import com.azure.communication.callautomation.models.events.CallTransferFailed; +import com.azure.communication.callautomation.models.events.CancelAddParticipantFailed; import com.azure.communication.callautomation.models.events.ContinuousDtmfRecognitionStopped; import com.azure.communication.callautomation.models.events.ContinuousDtmfRecognitionToneFailed; import com.azure.communication.callautomation.models.events.ContinuousDtmfRecognitionToneReceived; @@ -130,6 +132,10 @@ private static CallAutomationEventBase parseSingleCloudEvent(String data, String ret = mapper.convertValue(eventData, SendDtmfCompleted.class); } else if (Objects.equals(eventType, "Microsoft.Communication.SendDtmfFailed")) { ret = mapper.convertValue(eventData, SendDtmfFailed.class); + } else if (Objects.equals(eventType, "Microsoft.Communication.AddParticipantCancelled")) { + ret = mapper.convertValue(eventData, AddParticipantCancelled.class); + } else if (Objects.equals(eventType, "Microsoft.Communication.CancelAddParticipantFailed")) { + ret = mapper.convertValue(eventData, CancelAddParticipantFailed.class); } return ret; } catch (RuntimeException e) { diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallConnection.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallConnection.java index d36138ab0e88..013d7d9a33b5 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallConnection.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallConnection.java @@ -4,6 +4,8 @@ package com.azure.communication.callautomation; import com.azure.communication.callautomation.models.CallParticipant; +import com.azure.communication.callautomation.models.CancelAddParticipantOptions; +import com.azure.communication.callautomation.models.CancelAddParticipantResult; import com.azure.communication.callautomation.models.AddParticipantOptions; import com.azure.communication.callautomation.models.AddParticipantResult; import com.azure.communication.callautomation.models.CallConnectionProperties; @@ -263,6 +265,33 @@ public Response unmuteParticipantsWithResponse(UnmuteP return callConnectionAsync.unmuteParticipantWithResponseInternal(unmuteParticipantsOptions, context).block(); } + /** + * Cancel add participant request. + * + * @param invitationId invitation ID used to add participant. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return Result of cancelling add participant request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CancelAddParticipantResult cancelAddParticipant(String invitationId) { + return callConnectionAsync.cancelAddParticipant(invitationId).block(); + } + + /** + * Cancel add participant request. + * + * @param cancelAddParticipantOptions The options for cancelling add participant request. + * @param context A {@link Context} representing the request context. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return Response with result of cancelling add participant request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAddParticipantWithResponse(CancelAddParticipantOptions cancelAddParticipantOptions, Context context) { + return callConnectionAsync.cancelAddParticipantWithResponseInternal(cancelAddParticipantOptions, context).block(); + } + //region Content management Actions /*** * Returns an object of CallContent diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallConnectionAsync.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallConnectionAsync.java index a647ca70addd..b4504a00fc21 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallConnectionAsync.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallConnectionAsync.java @@ -7,6 +7,7 @@ import com.azure.communication.callautomation.implementation.CallMediasImpl; import com.azure.communication.callautomation.implementation.accesshelpers.AddParticipantResponseConstructorProxy; import com.azure.communication.callautomation.implementation.accesshelpers.CallConnectionPropertiesConstructorProxy; +import com.azure.communication.callautomation.implementation.accesshelpers.CancelAddParticipantResponseConstructorProxy; import com.azure.communication.callautomation.implementation.accesshelpers.MuteParticipantsResponseConstructorProxy; import com.azure.communication.callautomation.implementation.accesshelpers.RemoveParticipantResponseConstructorProxy; import com.azure.communication.callautomation.implementation.accesshelpers.TransferCallResponseConstructorProxy; @@ -15,6 +16,7 @@ import com.azure.communication.callautomation.implementation.converters.CommunicationIdentifierConverter; import com.azure.communication.callautomation.implementation.converters.PhoneNumberIdentifierConverter; import com.azure.communication.callautomation.implementation.models.AddParticipantRequestInternal; +import com.azure.communication.callautomation.implementation.models.CancelAddParticipantRequest; import com.azure.communication.callautomation.implementation.models.CustomContext; import com.azure.communication.callautomation.implementation.models.MuteParticipantsRequestInternal; import com.azure.communication.callautomation.implementation.models.RemoveParticipantRequestInternal; @@ -22,6 +24,8 @@ import com.azure.communication.callautomation.implementation.models.UnmuteParticipantsRequestInternal; import com.azure.communication.callautomation.models.AddParticipantResult; import com.azure.communication.callautomation.models.CallParticipant; +import com.azure.communication.callautomation.models.CancelAddParticipantOptions; +import com.azure.communication.callautomation.models.CancelAddParticipantResult; import com.azure.communication.callautomation.models.AddParticipantOptions; import com.azure.communication.callautomation.models.CallConnectionProperties; import com.azure.communication.callautomation.models.CallInvite; @@ -488,6 +492,52 @@ Mono> unmuteParticipantWithResponseInternal(U } } + /** + * Cancel add participant request. + * + * @param invitationId invitation ID used to add participant. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return Result of cancelling add participant request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelAddParticipant(String invitationId) { + return cancelAddParticipantWithResponse(new CancelAddParticipantOptions(invitationId)).flatMap(FluxUtil::toMono); + } + + /** + * Cancel add participant request. + * + * @param cancelAddParticipantOptions Options bag for cancelAddParticipant. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return Response with result of cancelling add participant request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelAddParticipantWithResponse(CancelAddParticipantOptions cancelAddParticipantOptions) { + return withContext(context -> cancelAddParticipantWithResponseInternal(cancelAddParticipantOptions, context)); + } + + Mono> cancelAddParticipantWithResponseInternal(CancelAddParticipantOptions cancelAddParticipantOptions, Context context) { + try { + context = context == null ? Context.NONE : context; + + CancelAddParticipantRequest request = new CancelAddParticipantRequest() + .setInvitationId((cancelAddParticipantOptions.getInvitationId())) + .setOperationContext(cancelAddParticipantOptions.getOperationContext()) + .setCallbackUri(cancelAddParticipantOptions.getCallbackUrl()); + + return callConnectionInternal.cancelAddParticipantWithResponseAsync( + callConnectionId, + request, + UUID.randomUUID(), + OffsetDateTime.now(), + context).map(response -> new SimpleResponse<>(response, CancelAddParticipantResponseConstructorProxy.create(response.getValue()))); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + //region Content management Actions /*** * Returns an object of CallContentAsync diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallMedia.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallMedia.java index de6290608a08..162bdb1c4d8c 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallMedia.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallMedia.java @@ -8,6 +8,7 @@ import com.azure.communication.callautomation.models.PlayToAllOptions; import com.azure.communication.callautomation.models.PlaySource; import com.azure.communication.callautomation.models.CallMediaRecognizeOptions; +import com.azure.communication.callautomation.models.StartHoldMusicOptions; import com.azure.communication.common.CommunicationIdentifier; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; @@ -217,4 +218,52 @@ public void stopContinuousDtmfRecognition(CommunicationIdentifier targetParticip public Response stopContinuousDtmfRecognitionWithResponse(CommunicationIdentifier targetParticipant, String operationContext, String callbackUrl, Context context) { return callMediaAsync.stopContinuousDtmfRecognitionWithResponseInternal(targetParticipant, operationContext, callbackUrl, context).block(); } + + /** + * Holds participant in call. + * @param targetParticipant the target. + * @param playSourceInfo audio to play. + * @return Response for successful operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Void startHoldMusic(CommunicationIdentifier targetParticipant, + PlaySource playSourceInfo) { + return callMediaAsync.startHoldMusic(targetParticipant, playSourceInfo).block(); + } + + /** + * Holds participant in call. + * @param options - Different options to pass to the request. + * @param context Context + * @return Response for successful operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startHoldMusicWithResponse(StartHoldMusicOptions options, + Context context) { + return callMediaAsync.startHoldMusicWithResponseInternal(options, context).block(); + } + + /** + * Removes hold from participant in call. + * @param targetParticipant the target. + * @return Response for successful operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Void stopHoldMusic(CommunicationIdentifier targetParticipant) { + return callMediaAsync.stopHoldMusicAsync(targetParticipant).block(); + } + + /** + * Removes hold from participant in call. + * @param targetParticipant the target. + * @param operationContext operational context. + * @param context Context. + * @return Response for successful operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopHoldMusicWithResponse(CommunicationIdentifier targetParticipant, + String operationContext, + Context context) { + return callMediaAsync.stopHoldMusicWithResponseInternal(targetParticipant, operationContext, context).block(); + } } diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallMediaAsync.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallMediaAsync.java index 4f2f708aca7f..e7cf5c239e15 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallMediaAsync.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallMediaAsync.java @@ -10,6 +10,8 @@ import com.azure.communication.callautomation.implementation.models.DtmfToneInternal; import com.azure.communication.callautomation.implementation.models.FileSourceInternal; import com.azure.communication.callautomation.implementation.models.GenderTypeInternal; +import com.azure.communication.callautomation.implementation.models.StartHoldMusicRequestInternal; +import com.azure.communication.callautomation.implementation.models.StopHoldMusicRequestInternal; import com.azure.communication.callautomation.implementation.models.TextSourceInternal; import com.azure.communication.callautomation.implementation.models.SsmlSourceInternal; import com.azure.communication.callautomation.implementation.models.PlayOptionsInternal; @@ -30,6 +32,7 @@ import com.azure.communication.callautomation.models.PlayOptions; import com.azure.communication.callautomation.models.PlaySource; import com.azure.communication.callautomation.models.RecognizeChoice; +import com.azure.communication.callautomation.models.StartHoldMusicOptions; import com.azure.communication.callautomation.models.TextSource; import com.azure.communication.callautomation.models.SsmlSource; import com.azure.communication.callautomation.models.CallMediaRecognizeOptions; @@ -249,14 +252,7 @@ Mono> playToAllWithResponseInternal(PlayToAllOptions options, Con } PlayRequest getPlayRequest(PlayOptions options) { - PlaySourceInternal playSourceInternal = new PlaySourceInternal(); - if (options.getPlaySource() instanceof FileSource) { - playSourceInternal = getPlaySourceInternalFromFileSource((FileSource) options.getPlaySource()); - } else if (options.getPlaySource() instanceof TextSource) { - playSourceInternal = getPlaySourceInternalFromTextSource((TextSource) options.getPlaySource()); - } else if (options.getPlaySource() instanceof SsmlSource) { - playSourceInternal = getPlaySourceInternalFromSsmlSource((SsmlSource) options.getPlaySource()); - } + PlaySourceInternal playSourceInternal = convertPlaySourceToPlaySourceInternal(options.getPlaySource()); if (playSourceInternal.getSourceType() != null) { PlayRequest request = new PlayRequest() @@ -620,4 +616,83 @@ Mono> stopContinuousDtmfRecognitionWithResponseInternal(Communica } } + /** + * Holds participant in call. + * @param targetParticipant the target. + * @param playSourceInfo audio to play. + * @return Response for successful operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono startHoldMusic(CommunicationIdentifier targetParticipant, + PlaySource playSourceInfo) { + return startHoldMusicWithResponseInternal( + new StartHoldMusicOptions(targetParticipant, playSourceInfo), + Context.NONE).then(); + } + + /** + * Holds participant in call. + * @param options - Different options to pass to the request. + * @return Response for successful operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> startHoldMusicWithResponse(StartHoldMusicOptions options) { + return withContext(context -> startHoldMusicWithResponseInternal( + options, context)); + } + + Mono> startHoldMusicWithResponseInternal(StartHoldMusicOptions options, Context context) { + try { + context = context == null ? Context.NONE : context; + + StartHoldMusicRequestInternal request = new StartHoldMusicRequestInternal() + .setTargetParticipant(CommunicationIdentifierConverter.convert(options.getTargetParticipant())) + .setPlaySourceInfo(convertPlaySourceToPlaySourceInternal(options.getPlaySourceInfo())) + .setLoop(options.isLoop()) + .setOperationContext(options.getOperationContext()); + + return contentsInternal + .startHoldMusicWithResponseAsync(callConnectionId, request, context); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } + + /** + * Removes hold from participant in call. + * @param targetParticipant the target. + * @return Response for successful operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopHoldMusicAsync(CommunicationIdentifier targetParticipant) { + return stopHoldMusicWithResponseAsync(targetParticipant, null).then(); + } + + /** + * Holds participant in call. + * @param targetParticipant the target. + * @param operationContext Operational context. + * @return Response for successful operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopHoldMusicWithResponseAsync(CommunicationIdentifier targetParticipant, + String operationContext) { + return withContext(context -> stopHoldMusicWithResponseInternal(targetParticipant, operationContext, context)); + } + + Mono> stopHoldMusicWithResponseInternal(CommunicationIdentifier targetParticipant, + String operationContext, + Context context) { + try { + context = context == null ? Context.NONE : context; + StopHoldMusicRequestInternal request = new StopHoldMusicRequestInternal() + .setTargetParticipant(CommunicationIdentifierConverter.convert(targetParticipant)) + .setOperationContext(operationContext); + + return contentsInternal + .stopHoldMusicWithResponseAsync(callConnectionId, request, context); + } catch (RuntimeException ex) { + return monoError(logger, ex); + } + } } diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallConnectionsImpl.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallConnectionsImpl.java index 4690c7b02a5b..34e21ebfdefd 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallConnectionsImpl.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallConnectionsImpl.java @@ -8,6 +8,8 @@ import com.azure.communication.callautomation.implementation.models.AddParticipantResponseInternal; import com.azure.communication.callautomation.implementation.models.CallConnectionPropertiesInternal; import com.azure.communication.callautomation.implementation.models.CallParticipantInternal; +import com.azure.communication.callautomation.implementation.models.CancelAddParticipantRequest; +import com.azure.communication.callautomation.implementation.models.CancelAddParticipantResponse; import com.azure.communication.callautomation.implementation.models.CommunicationErrorResponseException; import com.azure.communication.callautomation.implementation.models.GetParticipantsResponseInternal; import com.azure.communication.callautomation.implementation.models.MuteParticipantsRequestInternal; @@ -178,6 +180,19 @@ Mono> unmute( @HeaderParam("Accept") String accept, Context context); + @Post("/calling/callConnections/{callConnectionId}/participants:cancelAddParticipant") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) + Mono> cancelAddParticipant( + @HostParam("endpoint") String endpoint, + @PathParam("callConnectionId") String callConnectionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Repeatability-Request-ID") UUID repeatabilityRequestID, + @HeaderParam("Repeatability-First-Sent") DateTimeRfc1123 repeatabilityFirstSent, + @BodyParam("application/json") CancelAddParticipantRequest cancelAddParticipantRequest, + @HeaderParam("Accept") String accept, + Context context); + @Get("/calling/callConnections/{callConnectionId}/participants/{participantRawId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) @@ -806,7 +821,7 @@ public Response transferToParticipantWithResponse( } /** - * Get participants from a call. + * Get participants from a call. Recording and transcription bots are omitted from this list. * * @param callConnectionId The call connection Id. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -837,7 +852,7 @@ public Mono> getParticipantsSinglePageAsy } /** - * Get participants from a call. + * Get participants from a call. Recording and transcription bots are omitted from this list. * * @param callConnectionId The call connection Id. * @param context The context to associate with this operation. @@ -864,7 +879,7 @@ public Mono> getParticipantsSinglePageAsy } /** - * Get participants from a call. + * Get participants from a call. Recording and transcription bots are omitted from this list. * * @param callConnectionId The call connection Id. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -880,7 +895,7 @@ public PagedFlux getParticipantsAsync(String callConnec } /** - * Get participants from a call. + * Get participants from a call. Recording and transcription bots are omitted from this list. * * @param callConnectionId The call connection Id. * @param context The context to associate with this operation. @@ -897,7 +912,7 @@ public PagedFlux getParticipantsAsync(String callConnec } /** - * Get participants from a call. + * Get participants from a call. Recording and transcription bots are omitted from this list. * * @param callConnectionId The call connection Id. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -911,7 +926,7 @@ public PagedIterable getParticipants(String callConnect } /** - * Get participants from a call. + * Get participants from a call. Recording and transcription bots are omitted from this list. * * @param callConnectionId The call connection Id. * @param context The context to associate with this operation. @@ -1811,6 +1826,228 @@ public Response unmuteWithResponse( .block(); } + /** + * Cancel add participant operation. + * + * @param callConnectionId The call connection Id. + * @param cancelAddParticipantRequest Cancellation request. + * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the + * client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate + * response without the server executing the request multiple times. The value of the Repeatability-Request-Id + * is an opaque string representing a client-generated unique identifier for the request. It is a version 4 + * (random) UUID. + * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent + * header must also be specified. The value should be the date and time at which the request was first created, + * expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelAddParticipantWithResponseAsync( + String callConnectionId, + CancelAddParticipantRequest cancelAddParticipantRequest, + UUID repeatabilityRequestID, + OffsetDateTime repeatabilityFirstSent) { + final String accept = "application/json"; + DateTimeRfc1123 repeatabilityFirstSentConverted = + repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent); + return FluxUtil.withContext( + context -> + service.cancelAddParticipant( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + repeatabilityRequestID, + repeatabilityFirstSentConverted, + cancelAddParticipantRequest, + accept, + context)); + } + + /** + * Cancel add participant operation. + * + * @param callConnectionId The call connection Id. + * @param cancelAddParticipantRequest Cancellation request. + * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the + * client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate + * response without the server executing the request multiple times. The value of the Repeatability-Request-Id + * is an opaque string representing a client-generated unique identifier for the request. It is a version 4 + * (random) UUID. + * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent + * header must also be specified. The value should be the date and time at which the request was first created, + * expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelAddParticipantWithResponseAsync( + String callConnectionId, + CancelAddParticipantRequest cancelAddParticipantRequest, + UUID repeatabilityRequestID, + OffsetDateTime repeatabilityFirstSent, + Context context) { + final String accept = "application/json"; + DateTimeRfc1123 repeatabilityFirstSentConverted = + repeatabilityFirstSent == null ? null : new DateTimeRfc1123(repeatabilityFirstSent); + return service.cancelAddParticipant( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + repeatabilityRequestID, + repeatabilityFirstSentConverted, + cancelAddParticipantRequest, + accept, + context); + } + + /** + * Cancel add participant operation. + * + * @param callConnectionId The call connection Id. + * @param cancelAddParticipantRequest Cancellation request. + * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the + * client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate + * response without the server executing the request multiple times. The value of the Repeatability-Request-Id + * is an opaque string representing a client-generated unique identifier for the request. It is a version 4 + * (random) UUID. + * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent + * header must also be specified. The value should be the date and time at which the request was first created, + * expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelAddParticipantAsync( + String callConnectionId, + CancelAddParticipantRequest cancelAddParticipantRequest, + UUID repeatabilityRequestID, + OffsetDateTime repeatabilityFirstSent) { + return cancelAddParticipantWithResponseAsync( + callConnectionId, cancelAddParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Cancel add participant operation. + * + * @param callConnectionId The call connection Id. + * @param cancelAddParticipantRequest Cancellation request. + * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the + * client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate + * response without the server executing the request multiple times. The value of the Repeatability-Request-Id + * is an opaque string representing a client-generated unique identifier for the request. It is a version 4 + * (random) UUID. + * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent + * header must also be specified. The value should be the date and time at which the request was first created, + * expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelAddParticipantAsync( + String callConnectionId, + CancelAddParticipantRequest cancelAddParticipantRequest, + UUID repeatabilityRequestID, + OffsetDateTime repeatabilityFirstSent, + Context context) { + return cancelAddParticipantWithResponseAsync( + callConnectionId, + cancelAddParticipantRequest, + repeatabilityRequestID, + repeatabilityFirstSent, + context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Cancel add participant operation. + * + * @param callConnectionId The call connection Id. + * @param cancelAddParticipantRequest Cancellation request. + * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the + * client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate + * response without the server executing the request multiple times. The value of the Repeatability-Request-Id + * is an opaque string representing a client-generated unique identifier for the request. It is a version 4 + * (random) UUID. + * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent + * header must also be specified. The value should be the date and time at which the request was first created, + * expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CancelAddParticipantResponse cancelAddParticipant( + String callConnectionId, + CancelAddParticipantRequest cancelAddParticipantRequest, + UUID repeatabilityRequestID, + OffsetDateTime repeatabilityFirstSent) { + return cancelAddParticipantAsync( + callConnectionId, cancelAddParticipantRequest, repeatabilityRequestID, repeatabilityFirstSent) + .block(); + } + + /** + * Cancel add participant operation. + * + * @param callConnectionId The call connection Id. + * @param cancelAddParticipantRequest Cancellation request. + * @param repeatabilityRequestID If specified, the client directs that the request is repeatable; that is, that the + * client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate + * response without the server executing the request multiple times. The value of the Repeatability-Request-Id + * is an opaque string representing a client-generated unique identifier for the request. It is a version 4 + * (random) UUID. + * @param repeatabilityFirstSent If Repeatability-Request-ID header is specified, then Repeatability-First-Sent + * header must also be specified. The value should be the date and time at which the request was first created, + * expressed using the IMF-fixdate form of HTTP-date. Example: Sun, 06 Nov 1994 08:49:37 GMT. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelAddParticipantWithResponse( + String callConnectionId, + CancelAddParticipantRequest cancelAddParticipantRequest, + UUID repeatabilityRequestID, + OffsetDateTime repeatabilityFirstSent, + Context context) { + return cancelAddParticipantWithResponseAsync( + callConnectionId, + cancelAddParticipantRequest, + repeatabilityRequestID, + repeatabilityFirstSent, + context) + .block(); + } + /** * Get participant from a call. * diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallMediasImpl.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallMediasImpl.java index ea118b000e62..388cc38ac951 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallMediasImpl.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallMediasImpl.java @@ -9,6 +9,11 @@ import com.azure.communication.callautomation.implementation.models.PlayRequest; import com.azure.communication.callautomation.implementation.models.RecognizeRequest; import com.azure.communication.callautomation.implementation.models.SendDtmfRequestInternal; +import com.azure.communication.callautomation.implementation.models.StartHoldMusicRequestInternal; +import com.azure.communication.callautomation.implementation.models.StartTranscriptionRequest; +import com.azure.communication.callautomation.implementation.models.StopHoldMusicRequestInternal; +import com.azure.communication.callautomation.implementation.models.StopTranscriptionRequest; +import com.azure.communication.callautomation.implementation.models.UpdateTranscriptionDataRequest; import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.HeaderParam; @@ -64,6 +69,28 @@ Mono> play( @HeaderParam("Accept") String accept, Context context); + @Post("/calling/callConnections/{callConnectionId}:StartTranscription") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) + Mono> startTranscription( + @HostParam("endpoint") String endpoint, + @PathParam("callConnectionId") String callConnectionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StartTranscriptionRequest startTranscriptionRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Post("/calling/callConnections/{callConnectionId}:StopTranscripition") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) + Mono> stopTranscription( + @HostParam("endpoint") String endpoint, + @PathParam("callConnectionId") String callConnectionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StopTranscriptionRequest stopTranscriptionRequest, + @HeaderParam("Accept") String accept, + Context context); + @Post("/calling/callConnections/{callConnectionId}:cancelAllMediaOperations") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) @@ -119,6 +146,39 @@ Mono> sendDtmf( @BodyParam("application/json") SendDtmfRequestInternal sendDtmfRequest, @HeaderParam("Accept") String accept, Context context); + + @Post("/calling/callConnections/{callConnectionId}:updateTranscriptionData") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) + Mono> updateTranscriptionData( + @HostParam("endpoint") String endpoint, + @PathParam("callConnectionId") String callConnectionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateTranscriptionDataRequest updateTranscriptionDataRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Post("/calling/callConnections/{callConnectionId}:startHoldMusic") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) + Mono> startHoldMusic( + @HostParam("endpoint") String endpoint, + @PathParam("callConnectionId") String callConnectionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StartHoldMusicRequestInternal startHoldMusicRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Post("/calling/callConnections/{callConnectionId}:stopHoldMusic") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) + Mono> stopHoldMusic( + @HostParam("endpoint") String endpoint, + @PathParam("callConnectionId") String callConnectionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StopHoldMusicRequestInternal stopHoldMusicRequest, + @HeaderParam("Accept") String accept, + Context context); } /** @@ -226,6 +286,236 @@ public Response playWithResponse(String callConnectionId, PlayRequest play return playWithResponseAsync(callConnectionId, playRequest, context).block(); } + /** + * Starts transcription in the call. + * + * @param callConnectionId The call connection id. + * @param startTranscriptionRequest The startTranscriptionRequest parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> startTranscriptionWithResponseAsync( + String callConnectionId, StartTranscriptionRequest startTranscriptionRequest) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.startTranscription( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + startTranscriptionRequest, + accept, + context)); + } + + /** + * Starts transcription in the call. + * + * @param callConnectionId The call connection id. + * @param startTranscriptionRequest The startTranscriptionRequest parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> startTranscriptionWithResponseAsync( + String callConnectionId, StartTranscriptionRequest startTranscriptionRequest, Context context) { + final String accept = "application/json"; + return service.startTranscription( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + startTranscriptionRequest, + accept, + context); + } + + /** + * Starts transcription in the call. + * + * @param callConnectionId The call connection id. + * @param startTranscriptionRequest The startTranscriptionRequest parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono startTranscriptionAsync( + String callConnectionId, StartTranscriptionRequest startTranscriptionRequest) { + return startTranscriptionWithResponseAsync(callConnectionId, startTranscriptionRequest) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Starts transcription in the call. + * + * @param callConnectionId The call connection id. + * @param startTranscriptionRequest The startTranscriptionRequest parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono startTranscriptionAsync( + String callConnectionId, StartTranscriptionRequest startTranscriptionRequest, Context context) { + return startTranscriptionWithResponseAsync(callConnectionId, startTranscriptionRequest, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Starts transcription in the call. + * + * @param callConnectionId The call connection id. + * @param startTranscriptionRequest The startTranscriptionRequest parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void startTranscription(String callConnectionId, StartTranscriptionRequest startTranscriptionRequest) { + startTranscriptionAsync(callConnectionId, startTranscriptionRequest).block(); + } + + /** + * Starts transcription in the call. + * + * @param callConnectionId The call connection id. + * @param startTranscriptionRequest The startTranscriptionRequest parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startTranscriptionWithResponse( + String callConnectionId, StartTranscriptionRequest startTranscriptionRequest, Context context) { + return startTranscriptionWithResponseAsync(callConnectionId, startTranscriptionRequest, context).block(); + } + + /** + * Stops transcription in the call. + * + * @param callConnectionId The call connection id. + * @param stopTranscriptionRequest stop transcription request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopTranscriptionWithResponseAsync( + String callConnectionId, StopTranscriptionRequest stopTranscriptionRequest) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.stopTranscription( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + stopTranscriptionRequest, + accept, + context)); + } + + /** + * Stops transcription in the call. + * + * @param callConnectionId The call connection id. + * @param stopTranscriptionRequest stop transcription request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopTranscriptionWithResponseAsync( + String callConnectionId, StopTranscriptionRequest stopTranscriptionRequest, Context context) { + final String accept = "application/json"; + return service.stopTranscription( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + stopTranscriptionRequest, + accept, + context); + } + + /** + * Stops transcription in the call. + * + * @param callConnectionId The call connection id. + * @param stopTranscriptionRequest stop transcription request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopTranscriptionAsync( + String callConnectionId, StopTranscriptionRequest stopTranscriptionRequest) { + return stopTranscriptionWithResponseAsync(callConnectionId, stopTranscriptionRequest) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Stops transcription in the call. + * + * @param callConnectionId The call connection id. + * @param stopTranscriptionRequest stop transcription request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopTranscriptionAsync( + String callConnectionId, StopTranscriptionRequest stopTranscriptionRequest, Context context) { + return stopTranscriptionWithResponseAsync(callConnectionId, stopTranscriptionRequest, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Stops transcription in the call. + * + * @param callConnectionId The call connection id. + * @param stopTranscriptionRequest stop transcription request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stopTranscription(String callConnectionId, StopTranscriptionRequest stopTranscriptionRequest) { + stopTranscriptionAsync(callConnectionId, stopTranscriptionRequest).block(); + } + + /** + * Stops transcription in the call. + * + * @param callConnectionId The call connection id. + * @param stopTranscriptionRequest stop transcription request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopTranscriptionWithResponse( + String callConnectionId, StopTranscriptionRequest stopTranscriptionRequest, Context context) { + return stopTranscriptionWithResponseAsync(callConnectionId, stopTranscriptionRequest, context).block(); + } + /** * Cancel all media operations in a call. * @@ -798,4 +1088,350 @@ public Response sendDtmfWithResponse( String callConnectionId, SendDtmfRequestInternal sendDtmfRequest, Context context) { return sendDtmfWithResponseAsync(callConnectionId, sendDtmfRequest, context).block(); } + + /** + * API to change transcription language. + * + * @param callConnectionId The call connection id. + * @param updateTranscriptionDataRequest The updateTranscriptionData request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateTranscriptionDataWithResponseAsync( + String callConnectionId, UpdateTranscriptionDataRequest updateTranscriptionDataRequest) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.updateTranscriptionData( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + updateTranscriptionDataRequest, + accept, + context)); + } + + /** + * API to change transcription language. + * + * @param callConnectionId The call connection id. + * @param updateTranscriptionDataRequest The updateTranscriptionData request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateTranscriptionDataWithResponseAsync( + String callConnectionId, UpdateTranscriptionDataRequest updateTranscriptionDataRequest, Context context) { + final String accept = "application/json"; + return service.updateTranscriptionData( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + updateTranscriptionDataRequest, + accept, + context); + } + + /** + * API to change transcription language. + * + * @param callConnectionId The call connection id. + * @param updateTranscriptionDataRequest The updateTranscriptionData request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateTranscriptionDataAsync( + String callConnectionId, UpdateTranscriptionDataRequest updateTranscriptionDataRequest) { + return updateTranscriptionDataWithResponseAsync(callConnectionId, updateTranscriptionDataRequest) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * API to change transcription language. + * + * @param callConnectionId The call connection id. + * @param updateTranscriptionDataRequest The updateTranscriptionData request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateTranscriptionDataAsync( + String callConnectionId, UpdateTranscriptionDataRequest updateTranscriptionDataRequest, Context context) { + return updateTranscriptionDataWithResponseAsync(callConnectionId, updateTranscriptionDataRequest, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * API to change transcription language. + * + * @param callConnectionId The call connection id. + * @param updateTranscriptionDataRequest The updateTranscriptionData request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void updateTranscriptionData( + String callConnectionId, UpdateTranscriptionDataRequest updateTranscriptionDataRequest) { + updateTranscriptionDataAsync(callConnectionId, updateTranscriptionDataRequest).block(); + } + + /** + * API to change transcription language. + * + * @param callConnectionId The call connection id. + * @param updateTranscriptionDataRequest The updateTranscriptionData request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateTranscriptionDataWithResponse( + String callConnectionId, UpdateTranscriptionDataRequest updateTranscriptionDataRequest, Context context) { + return updateTranscriptionDataWithResponseAsync(callConnectionId, updateTranscriptionDataRequest, context) + .block(); + } + + /** + * Hold participant from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param startHoldMusicRequest The participants to be hold from the call. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> startHoldMusicWithResponseAsync( + String callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequest) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.startHoldMusic( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + startHoldMusicRequest, + accept, + context)); + } + + /** + * Hold participant from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param startHoldMusicRequest The participants to be hold from the call. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> startHoldMusicWithResponseAsync( + String callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequest, Context context) { + final String accept = "application/json"; + return service.startHoldMusic( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + startHoldMusicRequest, + accept, + context); + } + + /** + * Hold participant from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param startHoldMusicRequest The participants to be hold from the call. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono startHoldMusicAsync( + String callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequest) { + return startHoldMusicWithResponseAsync(callConnectionId, startHoldMusicRequest) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Hold participant from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param startHoldMusicRequest The participants to be hold from the call. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono startHoldMusicAsync( + String callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequest, Context context) { + return startHoldMusicWithResponseAsync(callConnectionId, startHoldMusicRequest, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Hold participant from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param startHoldMusicRequest The participants to be hold from the call. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void startHoldMusic(String callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequest) { + startHoldMusicAsync(callConnectionId, startHoldMusicRequest).block(); + } + + /** + * Hold participant from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param startHoldMusicRequest The participants to be hold from the call. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startHoldMusicWithResponse( + String callConnectionId, StartHoldMusicRequestInternal startHoldMusicRequest, Context context) { + return startHoldMusicWithResponseAsync(callConnectionId, startHoldMusicRequest, context).block(); + } + + /** + * Unhold participants from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param stopHoldMusicRequest The participants to be hold from the call. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopHoldMusicWithResponseAsync( + String callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequest) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.stopHoldMusic( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + stopHoldMusicRequest, + accept, + context)); + } + + /** + * Unhold participants from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param stopHoldMusicRequest The participants to be hold from the call. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopHoldMusicWithResponseAsync( + String callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequest, Context context) { + final String accept = "application/json"; + return service.stopHoldMusic( + this.client.getEndpoint(), + callConnectionId, + this.client.getApiVersion(), + stopHoldMusicRequest, + accept, + context); + } + + /** + * Unhold participants from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param stopHoldMusicRequest The participants to be hold from the call. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopHoldMusicAsync(String callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequest) { + return stopHoldMusicWithResponseAsync(callConnectionId, stopHoldMusicRequest) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Unhold participants from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param stopHoldMusicRequest The participants to be hold from the call. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopHoldMusicAsync( + String callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequest, Context context) { + return stopHoldMusicWithResponseAsync(callConnectionId, stopHoldMusicRequest, context) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Unhold participants from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param stopHoldMusicRequest The participants to be hold from the call. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stopHoldMusic(String callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequest) { + stopHoldMusicAsync(callConnectionId, stopHoldMusicRequest).block(); + } + + /** + * Unhold participants from the call using identifier. + * + * @param callConnectionId The call connection id. + * @param stopHoldMusicRequest The participants to be hold from the call. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopHoldMusicWithResponse( + String callConnectionId, StopHoldMusicRequestInternal stopHoldMusicRequest, Context context) { + return stopHoldMusicWithResponseAsync(callConnectionId, stopHoldMusicRequest, context).block(); + } } diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/accesshelpers/CancelAddParticipantResponseConstructorProxy.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/accesshelpers/CancelAddParticipantResponseConstructorProxy.java new file mode 100644 index 000000000000..a9cbc5bd06eb --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/accesshelpers/CancelAddParticipantResponseConstructorProxy.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.implementation.accesshelpers; + +import com.azure.communication.callautomation.implementation.models.CancelAddParticipantResponse; +import com.azure.communication.callautomation.models.CancelAddParticipantResult; + +/** + * Helper class to access private values of {@link CancelAddParticipantResult} across package boundaries. + */ +public final class CancelAddParticipantResponseConstructorProxy { + private static CancelAddParticipantResponseConstructorAccessor accessor; + + private CancelAddParticipantResponseConstructorProxy() { } + + /** + * Type defining the methods to set the non-public properties of a {@link CancelAddParticipantResponseConstructorAccessor} + * instance. + */ + public interface CancelAddParticipantResponseConstructorAccessor { + /** + * Creates a new instance of {@link CancelAddParticipantResult} backed by an internal instance of + * {@link CancelAddParticipantResult}. + * + * @param internalResponse The internal response. + * @return A new instance of {@link CancelAddParticipantResult}. + */ + CancelAddParticipantResult create(CancelAddParticipantResponse internalResponse); + } + + /** + * The method called from {@link CancelAddParticipantResult} to set it's accessor. + * + * @param accessor The accessor. + */ + public static void setAccessor(final CancelAddParticipantResponseConstructorAccessor accessor) { + CancelAddParticipantResponseConstructorProxy.accessor = accessor; + } + + /** + * Creates a new instance of {@link CancelAddParticipantResult} backed by an internal instance of + * {@link CancelAddParticipantResult}. + * + * @param internalResponse The internal response. + * @return A new instance of {@link CancelAddParticipantResult}. + */ + public static CancelAddParticipantResult create(CancelAddParticipantResponse internalResponse) { + // This looks odd but is necessary, it is possible to engage the access helper before anywhere else in the + // application accesses BlobDownloadHeaders which triggers the accessor to be configured. So, if the accessor + // is null this effectively pokes the class to set up the accessor. + if (accessor == null) { + new CancelAddParticipantResult(); + } + + assert accessor != null; + return accessor.create(internalResponse); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AddParticipantCancelled.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AddParticipantCancelled.java new file mode 100644 index 000000000000..9a5aeba6318a --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AddParticipantCancelled.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Successful cancel add participant event. */ +@Fluent +public final class AddParticipantCancelled { + /* + * Call connection ID. + */ + @JsonProperty(value = "callConnectionId") + private String callConnectionId; + + /* + * Server call ID. + */ + @JsonProperty(value = "serverCallId") + private String serverCallId; + + /* + * Correlation ID for event to call correlation. Also called ChainId for + * skype chain ID. + */ + @JsonProperty(value = "correlationId") + private String correlationId; + + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /* + * Participant that has been cancelled. + */ + @JsonProperty(value = "participant") + private CommunicationIdentifierModel participant; + + /* + * Invitation ID used to cancel the request. + */ + @JsonProperty(value = "invitationId") + private String invitationId; + + /** + * Get the callConnectionId property: Call connection ID. + * + * @return the callConnectionId value. + */ + public String getCallConnectionId() { + return this.callConnectionId; + } + + /** + * Set the callConnectionId property: Call connection ID. + * + * @param callConnectionId the callConnectionId value to set. + * @return the AddParticipantCancelled object itself. + */ + public AddParticipantCancelled setCallConnectionId(String callConnectionId) { + this.callConnectionId = callConnectionId; + return this; + } + + /** + * Get the serverCallId property: Server call ID. + * + * @return the serverCallId value. + */ + public String getServerCallId() { + return this.serverCallId; + } + + /** + * Set the serverCallId property: Server call ID. + * + * @param serverCallId the serverCallId value to set. + * @return the AddParticipantCancelled object itself. + */ + public AddParticipantCancelled setServerCallId(String serverCallId) { + this.serverCallId = serverCallId; + return this; + } + + /** + * Get the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @return the correlationId value. + */ + public String getCorrelationId() { + return this.correlationId; + } + + /** + * Set the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @param correlationId the correlationId value to set. + * @return the AddParticipantCancelled object itself. + */ + public AddParticipantCancelled setCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @param operationContext the operationContext value to set. + * @return the AddParticipantCancelled object itself. + */ + public AddParticipantCancelled setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } + + /** + * Get the participant property: Participant that has been cancelled. + * + * @return the participant value. + */ + public CommunicationIdentifierModel getParticipant() { + return this.participant; + } + + /** + * Set the participant property: Participant that has been cancelled. + * + * @param participant the participant value to set. + * @return the AddParticipantCancelled object itself. + */ + public AddParticipantCancelled setParticipant(CommunicationIdentifierModel participant) { + this.participant = participant; + return this; + } + + /** + * Get the invitationId property: Invitation ID used to cancel the request. + * + * @return the invitationId value. + */ + public String getInvitationId() { + return this.invitationId; + } + + /** + * Set the invitationId property: Invitation ID used to cancel the request. + * + * @param invitationId the invitationId value to set. + * @return the AddParticipantCancelled object itself. + */ + public AddParticipantCancelled setInvitationId(String invitationId) { + this.invitationId = invitationId; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AddParticipantResponseInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AddParticipantResponseInternal.java index 681b6d100791..8f07f98fa8cc 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AddParticipantResponseInternal.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AddParticipantResponseInternal.java @@ -22,6 +22,12 @@ public final class AddParticipantResponseInternal { @JsonProperty(value = "operationContext") private String operationContext; + /* + * Invitation ID used to add a participant. + */ + @JsonProperty(value = "invitationId") + private String invitationId; + /** * Get the participant property: List of current participants in the call. * @@ -61,4 +67,24 @@ public AddParticipantResponseInternal setOperationContext(String operationContex this.operationContext = operationContext; return this; } + + /** + * Get the invitationId property: Invitation ID used to add a participant. + * + * @return the invitationId value. + */ + public String getInvitationId() { + return this.invitationId; + } + + /** + * Set the invitationId property: Invitation ID used to add a participant. + * + * @param invitationId the invitationId value to set. + * @return the AddParticipantResponseInternal object itself. + */ + public AddParticipantResponseInternal setInvitationId(String invitationId) { + this.invitationId = invitationId; + return this; + } } diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AnswerCallRequestInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AnswerCallRequestInternal.java index a012cbe48168..36b08abbcc90 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AnswerCallRequestInternal.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/AnswerCallRequestInternal.java @@ -34,6 +34,12 @@ public final class AnswerCallRequestInternal { @JsonProperty(value = "mediaStreamingConfiguration") private MediaStreamingConfigurationInternal mediaStreamingConfiguration; + /* + * Live Transcription Configuration. + */ + @JsonProperty(value = "transcriptionConfiguration") + private TranscriptionConfiguration transcriptionConfiguration; + /* * The endpoint URL of the Azure Cognitive Services resource attached */ @@ -127,6 +133,27 @@ public AnswerCallRequestInternal setMediaStreamingConfiguration( return this; } + /** + * Get the transcriptionConfiguration property: Live Transcription Configuration. + * + * @return the transcriptionConfiguration value. + */ + public TranscriptionConfiguration getTranscriptionConfiguration() { + return this.transcriptionConfiguration; + } + + /** + * Set the transcriptionConfiguration property: Live Transcription Configuration. + * + * @param transcriptionConfiguration the transcriptionConfiguration value to set. + * @return the AnswerCallRequestInternal object itself. + */ + public AnswerCallRequestInternal setTranscriptionConfiguration( + TranscriptionConfiguration transcriptionConfiguration) { + this.transcriptionConfiguration = transcriptionConfiguration; + return this; + } + /** * Get the azureCognitiveServicesEndpointUrl property: The endpoint URL of the Azure Cognitive Services resource * attached. diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallConnectionPropertiesInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallConnectionPropertiesInternal.java index 4681d0338283..e35f46b13e1d 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallConnectionPropertiesInternal.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallConnectionPropertiesInternal.java @@ -47,6 +47,12 @@ public final class CallConnectionPropertiesInternal { @JsonProperty(value = "mediaSubscriptionId") private String mediaSubscriptionId; + /* + * SubscriptionId for transcription + */ + @JsonProperty(value = "dataSubscriptionId") + private String dataSubscriptionId; + /* * The source caller Id, a phone number, that's shown to the PSTN * participant being invited. @@ -201,6 +207,26 @@ public CallConnectionPropertiesInternal setMediaSubscriptionId(String mediaSubsc return this; } + /** + * Get the dataSubscriptionId property: SubscriptionId for transcription. + * + * @return the dataSubscriptionId value. + */ + public String getDataSubscriptionId() { + return this.dataSubscriptionId; + } + + /** + * Set the dataSubscriptionId property: SubscriptionId for transcription. + * + * @param dataSubscriptionId the dataSubscriptionId value to set. + * @return the CallConnectionPropertiesInternal object itself. + */ + public CallConnectionPropertiesInternal setDataSubscriptionId(String dataSubscriptionId) { + this.dataSubscriptionId = dataSubscriptionId; + return this; + } + /** * Get the sourceCallerIdNumber property: The source caller Id, a phone number, that's shown to the PSTN participant * being invited. Required only when calling a PSTN callee. diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CancelAddParticipantFailed.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CancelAddParticipantFailed.java new file mode 100644 index 000000000000..60d5f6ea3b88 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CancelAddParticipantFailed.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Failed cancel add participant event. */ +@Fluent +public final class CancelAddParticipantFailed { + /* + * Call connection ID. + */ + @JsonProperty(value = "callConnectionId") + private String callConnectionId; + + /* + * Server call ID. + */ + @JsonProperty(value = "serverCallId") + private String serverCallId; + + /* + * Correlation ID for event to call correlation. Also called ChainId for + * skype chain ID. + */ + @JsonProperty(value = "correlationId") + private String correlationId; + + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /* + * Contains the resulting SIP code/sub-code and message from NGC services. + */ + @JsonProperty(value = "resultInformation") + private ResultInformation resultInformation; + + /* + * Invitation ID used to cancel the request. + */ + @JsonProperty(value = "invitationId") + private String invitationId; + + /** + * Get the callConnectionId property: Call connection ID. + * + * @return the callConnectionId value. + */ + public String getCallConnectionId() { + return this.callConnectionId; + } + + /** + * Set the callConnectionId property: Call connection ID. + * + * @param callConnectionId the callConnectionId value to set. + * @return the CancelAddParticipantFailed object itself. + */ + public CancelAddParticipantFailed setCallConnectionId(String callConnectionId) { + this.callConnectionId = callConnectionId; + return this; + } + + /** + * Get the serverCallId property: Server call ID. + * + * @return the serverCallId value. + */ + public String getServerCallId() { + return this.serverCallId; + } + + /** + * Set the serverCallId property: Server call ID. + * + * @param serverCallId the serverCallId value to set. + * @return the CancelAddParticipantFailed object itself. + */ + public CancelAddParticipantFailed setServerCallId(String serverCallId) { + this.serverCallId = serverCallId; + return this; + } + + /** + * Get the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @return the correlationId value. + */ + public String getCorrelationId() { + return this.correlationId; + } + + /** + * Set the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @param correlationId the correlationId value to set. + * @return the CancelAddParticipantFailed object itself. + */ + public CancelAddParticipantFailed setCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @param operationContext the operationContext value to set. + * @return the CancelAddParticipantFailed object itself. + */ + public CancelAddParticipantFailed setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code/sub-code and message from NGC services. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Set the resultInformation property: Contains the resulting SIP code/sub-code and message from NGC services. + * + * @param resultInformation the resultInformation value to set. + * @return the CancelAddParticipantFailed object itself. + */ + public CancelAddParticipantFailed setResultInformation(ResultInformation resultInformation) { + this.resultInformation = resultInformation; + return this; + } + + /** + * Get the invitationId property: Invitation ID used to cancel the request. + * + * @return the invitationId value. + */ + public String getInvitationId() { + return this.invitationId; + } + + /** + * Set the invitationId property: Invitation ID used to cancel the request. + * + * @param invitationId the invitationId value to set. + * @return the CancelAddParticipantFailed object itself. + */ + public CancelAddParticipantFailed setInvitationId(String invitationId) { + this.invitationId = invitationId; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CancelAddParticipantRequest.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CancelAddParticipantRequest.java new file mode 100644 index 000000000000..f8369b2a0ad8 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CancelAddParticipantRequest.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CancelAddParticipantRequest model. */ +@Fluent +public final class CancelAddParticipantRequest { + /* + * Invitation ID used to add a participant. + */ + @JsonProperty(value = "invitationId", required = true) + private String invitationId; + + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /* + * The callback URI to override the main callback URI. + */ + @JsonProperty(value = "callbackUri") + private String callbackUri; + + /** + * Get the invitationId property: Invitation ID used to add a participant. + * + * @return the invitationId value. + */ + public String getInvitationId() { + return this.invitationId; + } + + /** + * Set the invitationId property: Invitation ID used to add a participant. + * + * @param invitationId the invitationId value to set. + * @return the CancelAddParticipantRequest object itself. + */ + public CancelAddParticipantRequest setInvitationId(String invitationId) { + this.invitationId = invitationId; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @param operationContext the operationContext value to set. + * @return the CancelAddParticipantRequest object itself. + */ + public CancelAddParticipantRequest setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } + + /** + * Get the callbackUri property: The callback URI to override the main callback URI. + * + * @return the callbackUri value. + */ + public String getCallbackUri() { + return this.callbackUri; + } + + /** + * Set the callbackUri property: The callback URI to override the main callback URI. + * + * @param callbackUri the callbackUri value to set. + * @return the CancelAddParticipantRequest object itself. + */ + public CancelAddParticipantRequest setCallbackUri(String callbackUri) { + this.callbackUri = callbackUri; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CancelAddParticipantResponse.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CancelAddParticipantResponse.java new file mode 100644 index 000000000000..b8ab3772975e --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CancelAddParticipantResponse.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CancelAddParticipantResponse model. */ +@Fluent +public final class CancelAddParticipantResponse { + /* + * Invitation ID used to cancel the add participant action. + */ + @JsonProperty(value = "invitationId") + private String invitationId; + + /* + * The operation context provided by client. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /** + * Get the invitationId property: Invitation ID used to cancel the add participant action. + * + * @return the invitationId value. + */ + public String getInvitationId() { + return this.invitationId; + } + + /** + * Set the invitationId property: Invitation ID used to cancel the add participant action. + * + * @param invitationId the invitationId value to set. + * @return the CancelAddParticipantResponse object itself. + */ + public CancelAddParticipantResponse setInvitationId(String invitationId) { + this.invitationId = invitationId; + return this; + } + + /** + * Get the operationContext property: The operation context provided by client. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: The operation context provided by client. + * + * @param operationContext the operationContext value to set. + * @return the CancelAddParticipantResponse object itself. + */ + public CancelAddParticipantResponse setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CreateCallRequestInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CreateCallRequestInternal.java index b1d4dde123c6..f02b7180ef96 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CreateCallRequestInternal.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CreateCallRequestInternal.java @@ -55,6 +55,12 @@ public final class CreateCallRequestInternal { @JsonProperty(value = "mediaStreamingConfiguration") private MediaStreamingConfigurationInternal mediaStreamingConfiguration; + /* + * Live Transcription Configuration. + */ + @JsonProperty(value = "transcriptionConfiguration") + private TranscriptionConfiguration transcriptionConfiguration; + /* * The identifier of the Cognitive Service resource assigned to this call. */ @@ -210,6 +216,27 @@ public CreateCallRequestInternal setMediaStreamingConfiguration( return this; } + /** + * Get the transcriptionConfiguration property: Live Transcription Configuration. + * + * @return the transcriptionConfiguration value. + */ + public TranscriptionConfiguration getTranscriptionConfiguration() { + return this.transcriptionConfiguration; + } + + /** + * Set the transcriptionConfiguration property: Live Transcription Configuration. + * + * @param transcriptionConfiguration the transcriptionConfiguration value to set. + * @return the CreateCallRequestInternal object itself. + */ + public CreateCallRequestInternal setTranscriptionConfiguration( + TranscriptionConfiguration transcriptionConfiguration) { + this.transcriptionConfiguration = transcriptionConfiguration; + return this; + } + /** * Get the azureCognitiveServicesEndpointUrl property: The identifier of the Cognitive Service resource assigned to * this call. diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/DialogInputType.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/DialogInputType.java index 7e3c908a8833..d97b6fe7408b 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/DialogInputType.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/DialogInputType.java @@ -13,6 +13,9 @@ public final class DialogInputType extends ExpandableStringEnum /** Static value powerVirtualAgents for DialogInputType. */ public static final DialogInputType POWER_VIRTUAL_AGENTS = fromString("powerVirtualAgents"); + /** Static value azureOpenAI for DialogInputType. */ + public static final DialogInputType AZURE_OPEN_AI = fromString("azureOpenAI"); + /** * Creates or finds a DialogInputType from its string representation. * diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/DialogOptions.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/DialogOptions.java index 10aec7131ed9..72212d5c1f32 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/DialogOptions.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/DialogOptions.java @@ -14,7 +14,7 @@ public final class DialogOptions { /* * Bot identifier. */ - @JsonProperty(value = "botAppId", required = true) + @JsonProperty(value = "botAppId") private String botAppId; /* diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldParticipantRequestInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldParticipantRequestInternal.java new file mode 100644 index 000000000000..bcb1df7180a2 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldParticipantRequestInternal.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The request payload for holding participant from the call. */ +@Fluent +public final class HoldParticipantRequestInternal { + /* + * Participant to be held from the call. + */ + @JsonProperty(value = "participantToHold", required = true) + private CommunicationIdentifierModel participantToHold; + + /* + * Prompt to play while in hold. + */ + @JsonProperty(value = "playSourceInfo", required = true) + private PlaySourceInternal playSourceInfo; + + /* + * If the prompt will be looped or not. + */ + @JsonProperty(value = "loop") + private Boolean loop; + + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /** + * Get the participantToHold property: Participant to be held from the call. + * + * @return the participantToHold value. + */ + public CommunicationIdentifierModel getParticipantToHold() { + return this.participantToHold; + } + + /** + * Set the participantToHold property: Participant to be held from the call. + * + * @param participantToHold the participantToHold value to set. + * @return the HoldParticipantRequestInternal object itself. + */ + public HoldParticipantRequestInternal setParticipantToHold(CommunicationIdentifierModel participantToHold) { + this.participantToHold = participantToHold; + return this; + } + + /** + * Get the playSourceInfo property: Prompt to play while in hold. + * + * @return the playSourceInfo value. + */ + public PlaySourceInternal getPlaySourceInfo() { + return this.playSourceInfo; + } + + /** + * Set the playSourceInfo property: Prompt to play while in hold. + * + * @param playSourceInfo the playSourceInfo value to set. + * @return the HoldParticipantRequestInternal object itself. + */ + public HoldParticipantRequestInternal setPlaySourceInfo(PlaySourceInternal playSourceInfo) { + this.playSourceInfo = playSourceInfo; + return this; + } + + /** + * Get the loop property: If the prompt will be looped or not. + * + * @return the loop value. + */ + public Boolean isLoop() { + return this.loop; + } + + /** + * Set the loop property: If the prompt will be looped or not. + * + * @param loop the loop value to set. + * @return the HoldParticipantRequestInternal object itself. + */ + public HoldParticipantRequestInternal setLoop(Boolean loop) { + this.loop = loop; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @param operationContext the operationContext value to set. + * @return the HoldParticipantRequestInternal object itself. + */ + public HoldParticipantRequestInternal setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldParticipantResponseInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldParticipantResponseInternal.java new file mode 100644 index 000000000000..936a81a62ffd --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldParticipantResponseInternal.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The response payload for unmuting participants from the call. */ +@Fluent +public final class HoldParticipantResponseInternal { + /* + * The operation context provided by client. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /** + * Get the operationContext property: The operation context provided by client. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: The operation context provided by client. + * + * @param operationContext the operationContext value to set. + * @return the HoldParticipantResponseInternal object itself. + */ + public HoldParticipantResponseInternal setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingStateResponseInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingStateResponseInternal.java index 8553b6ccba2b..5aa4c7cc30a5 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingStateResponseInternal.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingStateResponseInternal.java @@ -22,6 +22,12 @@ public final class RecordingStateResponseInternal { @JsonProperty(value = "recordingState") private RecordingStateInternal recordingState; + /* + * The recordingType property. + */ + @JsonProperty(value = "recordingType") + private RecordingType recordingType; + /** * Get the recordingId property: The recordingId property. * @@ -61,4 +67,24 @@ public RecordingStateResponseInternal setRecordingState(RecordingStateInternal r this.recordingState = recordingState; return this; } + + /** + * Get the recordingType property: The recordingType property. + * + * @return the recordingType value. + */ + public RecordingType getRecordingType() { + return this.recordingType; + } + + /** + * Set the recordingType property: The recordingType property. + * + * @param recordingType the recordingType value to set. + * @return the RecordingStateResponseInternal object itself. + */ + public RecordingStateResponseInternal setRecordingType(RecordingType recordingType) { + this.recordingType = recordingType; + return this; + } } diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingType.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingType.java new file mode 100644 index 000000000000..b57759603d3b --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RecordingType. */ +public final class RecordingType extends ExpandableStringEnum { + /** Static value acs for RecordingType. */ + public static final RecordingType ACS = fromString("acs"); + + /** Static value teams for RecordingType. */ + public static final RecordingType TEAMS = fromString("teams"); + + /** + * Creates or finds a RecordingType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecordingType. + */ + @JsonCreator + public static RecordingType fromString(String name) { + return fromString(name, RecordingType.class); + } + + /** @return known RecordingType values. */ + public static Collection values() { + return values(RecordingType.class); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StartHoldMusicRequestInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StartHoldMusicRequestInternal.java new file mode 100644 index 000000000000..68374f5dc75e --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StartHoldMusicRequestInternal.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The request payload for holding participant from the call. */ +@Fluent +public final class StartHoldMusicRequestInternal { + /* + * Participant to be held from the call. + */ + @JsonProperty(value = "targetParticipant", required = true) + private CommunicationIdentifierModel targetParticipant; + + /* + * Prompt to play while in hold. + */ + @JsonProperty(value = "playSourceInfo", required = true) + private PlaySourceInternal playSourceInfo; + + /* + * If the prompt will be looped or not. + */ + @JsonProperty(value = "loop") + private Boolean loop; + + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /** + * Get the targetParticipant property: Participant to be held from the call. + * + * @return the targetParticipant value. + */ + public CommunicationIdentifierModel getTargetParticipant() { + return this.targetParticipant; + } + + /** + * Set the targetParticipant property: Participant to be held from the call. + * + * @param targetParticipant the targetParticipant value to set. + * @return the StartHoldMusicRequestInternal object itself. + */ + public StartHoldMusicRequestInternal setTargetParticipant(CommunicationIdentifierModel targetParticipant) { + this.targetParticipant = targetParticipant; + return this; + } + + /** + * Get the playSourceInfo property: Prompt to play while in hold. + * + * @return the playSourceInfo value. + */ + public PlaySourceInternal getPlaySourceInfo() { + return this.playSourceInfo; + } + + /** + * Set the playSourceInfo property: Prompt to play while in hold. + * + * @param playSourceInfo the playSourceInfo value to set. + * @return the StartHoldMusicRequestInternal object itself. + */ + public StartHoldMusicRequestInternal setPlaySourceInfo(PlaySourceInternal playSourceInfo) { + this.playSourceInfo = playSourceInfo; + return this; + } + + /** + * Get the loop property: If the prompt will be looped or not. + * + * @return the loop value. + */ + public Boolean isLoop() { + return this.loop; + } + + /** + * Set the loop property: If the prompt will be looped or not. + * + * @param loop the loop value to set. + * @return the StartHoldMusicRequestInternal object itself. + */ + public StartHoldMusicRequestInternal setLoop(Boolean loop) { + this.loop = loop; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @param operationContext the operationContext value to set. + * @return the StartHoldMusicRequestInternal object itself. + */ + public StartHoldMusicRequestInternal setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StartTranscriptionRequest.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StartTranscriptionRequest.java new file mode 100644 index 000000000000..e7bf37ee69d4 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StartTranscriptionRequest.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The StartTranscriptionRequest model. */ +@Fluent +public final class StartTranscriptionRequest { + /* + * Defines Locale for the transcription e,g en-US + */ + @JsonProperty(value = "locale") + private String locale; + + /* + * The value to identify context of the operation. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /** + * Get the locale property: Defines Locale for the transcription e,g en-US. + * + * @return the locale value. + */ + public String getLocale() { + return this.locale; + } + + /** + * Set the locale property: Defines Locale for the transcription e,g en-US. + * + * @param locale the locale value to set. + * @return the StartTranscriptionRequest object itself. + */ + public StartTranscriptionRequest setLocale(String locale) { + this.locale = locale; + return this; + } + + /** + * Get the operationContext property: The value to identify context of the operation. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: The value to identify context of the operation. + * + * @param operationContext the operationContext value to set. + * @return the StartTranscriptionRequest object itself. + */ + public StartTranscriptionRequest setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StopHoldMusicRequestInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StopHoldMusicRequestInternal.java new file mode 100644 index 000000000000..8e610bfedb83 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StopHoldMusicRequestInternal.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The request payload for holding participant from the call. */ +@Fluent +public final class StopHoldMusicRequestInternal { + /* + * Participants to be hold from the call. + * Only ACS Users are supported. + */ + @JsonProperty(value = "targetParticipant", required = true) + private CommunicationIdentifierModel targetParticipant; + + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /** + * Get the targetParticipant property: Participants to be hold from the call. Only ACS Users are supported. + * + * @return the targetParticipant value. + */ + public CommunicationIdentifierModel getTargetParticipant() { + return this.targetParticipant; + } + + /** + * Set the targetParticipant property: Participants to be hold from the call. Only ACS Users are supported. + * + * @param targetParticipant the targetParticipant value to set. + * @return the StopHoldMusicRequestInternal object itself. + */ + public StopHoldMusicRequestInternal setTargetParticipant(CommunicationIdentifierModel targetParticipant) { + this.targetParticipant = targetParticipant; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @param operationContext the operationContext value to set. + * @return the StopHoldMusicRequestInternal object itself. + */ + public StopHoldMusicRequestInternal setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StopTranscriptionRequest.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StopTranscriptionRequest.java new file mode 100644 index 000000000000..7b59cd0c318d --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/StopTranscriptionRequest.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The StopTranscriptionRequest model. */ +@Fluent +public final class StopTranscriptionRequest { + /* + * The value to identify context of the operation. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /** + * Get the operationContext property: The value to identify context of the operation. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: The value to identify context of the operation. + * + * @param operationContext the operationContext value to set. + * @return the StopTranscriptionRequest object itself. + */ + public StopTranscriptionRequest setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionConfiguration.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionConfiguration.java new file mode 100644 index 000000000000..4a2c174d4528 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionConfiguration.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configuration of live transcription. */ +@Fluent +public final class TranscriptionConfiguration { + /* + * Transport URL for live transcription + */ + @JsonProperty(value = "transportUrl", required = true) + private String transportUrl; + + /* + * The type of transport to be used for live transcription, eg. Websocket + */ + @JsonProperty(value = "transportType", required = true) + private TranscriptionTransportType transportType; + + /* + * Defines the locale for the data e.g en-CA, en-AU + */ + @JsonProperty(value = "locale", required = true) + private String locale; + + /* + * Determines if the transcription should be started immediately after call + * is answered or not. + */ + @JsonProperty(value = "startTranscription", required = true) + private boolean startTranscription; + + /** + * Get the transportUrl property: Transport URL for live transcription. + * + * @return the transportUrl value. + */ + public String getTransportUrl() { + return this.transportUrl; + } + + /** + * Set the transportUrl property: Transport URL for live transcription. + * + * @param transportUrl the transportUrl value to set. + * @return the TranscriptionConfiguration object itself. + */ + public TranscriptionConfiguration setTransportUrl(String transportUrl) { + this.transportUrl = transportUrl; + return this; + } + + /** + * Get the transportType property: The type of transport to be used for live transcription, eg. Websocket. + * + * @return the transportType value. + */ + public TranscriptionTransportType getTransportType() { + return this.transportType; + } + + /** + * Set the transportType property: The type of transport to be used for live transcription, eg. Websocket. + * + * @param transportType the transportType value to set. + * @return the TranscriptionConfiguration object itself. + */ + public TranscriptionConfiguration setTransportType(TranscriptionTransportType transportType) { + this.transportType = transportType; + return this; + } + + /** + * Get the locale property: Defines the locale for the data e.g en-CA, en-AU. + * + * @return the locale value. + */ + public String getLocale() { + return this.locale; + } + + /** + * Set the locale property: Defines the locale for the data e.g en-CA, en-AU. + * + * @param locale the locale value to set. + * @return the TranscriptionConfiguration object itself. + */ + public TranscriptionConfiguration setLocale(String locale) { + this.locale = locale; + return this; + } + + /** + * Get the startTranscription property: Determines if the transcription should be started immediately after call is + * answered or not. + * + * @return the startTranscription value. + */ + public boolean isStartTranscription() { + return this.startTranscription; + } + + /** + * Set the startTranscription property: Determines if the transcription should be started immediately after call is + * answered or not. + * + * @param startTranscription the startTranscription value to set. + * @return the TranscriptionConfiguration object itself. + */ + public TranscriptionConfiguration setStartTranscription(boolean startTranscription) { + this.startTranscription = startTranscription; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionFailed.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionFailed.java new file mode 100644 index 000000000000..5b04d62dd070 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionFailed.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TranscriptionFailed model. */ +@Fluent +public final class TranscriptionFailed { + /* + * Call connection ID. + */ + @JsonProperty(value = "callConnectionId", access = JsonProperty.Access.WRITE_ONLY) + private String callConnectionId; + + /* + * Server call ID. + */ + @JsonProperty(value = "serverCallId") + private String serverCallId; + + /* + * Correlation ID for event to call correlation. Also called ChainId for + * skype chain ID. + */ + @JsonProperty(value = "correlationId") + private String correlationId; + + /* + * Used by customers when calling answerCall action to correlate the + * request to the response event. + */ + @JsonProperty(value = "operationContext", access = JsonProperty.Access.WRITE_ONLY) + private String operationContext; + + /* + * Contains the resulting SIP code/sub-code and message from NGC services. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private ResultInformation resultInformation; + + /* + * Defines the result for TranscriptionUpdate with the current status and + * the details about the status + */ + @JsonProperty(value = "transcriptionUpdateResult", access = JsonProperty.Access.WRITE_ONLY) + private TranscriptionUpdate transcriptionUpdateResult; + + /** + * Get the callConnectionId property: Call connection ID. + * + * @return the callConnectionId value. + */ + public String getCallConnectionId() { + return this.callConnectionId; + } + + /** + * Get the serverCallId property: Server call ID. + * + * @return the serverCallId value. + */ + public String getServerCallId() { + return this.serverCallId; + } + + /** + * Set the serverCallId property: Server call ID. + * + * @param serverCallId the serverCallId value to set. + * @return the TranscriptionFailed object itself. + */ + public TranscriptionFailed setServerCallId(String serverCallId) { + this.serverCallId = serverCallId; + return this; + } + + /** + * Get the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @return the correlationId value. + */ + public String getCorrelationId() { + return this.correlationId; + } + + /** + * Set the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @param correlationId the correlationId value to set. + * @return the TranscriptionFailed object itself. + */ + public TranscriptionFailed setCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling answerCall action to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code/sub-code and message from NGC services. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the transcriptionUpdateResult property: Defines the result for TranscriptionUpdate with the current status + * and the details about the status. + * + * @return the transcriptionUpdateResult value. + */ + public TranscriptionUpdate getTranscriptionUpdateResult() { + return this.transcriptionUpdateResult; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionResumed.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionResumed.java new file mode 100644 index 000000000000..31f0d0ce0490 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionResumed.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TranscriptionResumed model. */ +@Fluent +public final class TranscriptionResumed { + /* + * Call connection ID. + */ + @JsonProperty(value = "callConnectionId", access = JsonProperty.Access.WRITE_ONLY) + private String callConnectionId; + + /* + * Server call ID. + */ + @JsonProperty(value = "serverCallId") + private String serverCallId; + + /* + * Correlation ID for event to call correlation. Also called ChainId for + * skype chain ID. + */ + @JsonProperty(value = "correlationId") + private String correlationId; + + /* + * Used by customers when calling answerCall action to correlate the + * request to the response event. + */ + @JsonProperty(value = "operationContext", access = JsonProperty.Access.WRITE_ONLY) + private String operationContext; + + /* + * Contains the resulting SIP code/sub-code and message from NGC services. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private ResultInformation resultInformation; + + /* + * Defines the result for TranscriptionUpdate with the current status and + * the details about the status + */ + @JsonProperty(value = "transcriptionUpdateResult", access = JsonProperty.Access.WRITE_ONLY) + private TranscriptionUpdate transcriptionUpdateResult; + + /** + * Get the callConnectionId property: Call connection ID. + * + * @return the callConnectionId value. + */ + public String getCallConnectionId() { + return this.callConnectionId; + } + + /** + * Get the serverCallId property: Server call ID. + * + * @return the serverCallId value. + */ + public String getServerCallId() { + return this.serverCallId; + } + + /** + * Set the serverCallId property: Server call ID. + * + * @param serverCallId the serverCallId value to set. + * @return the TranscriptionResumed object itself. + */ + public TranscriptionResumed setServerCallId(String serverCallId) { + this.serverCallId = serverCallId; + return this; + } + + /** + * Get the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @return the correlationId value. + */ + public String getCorrelationId() { + return this.correlationId; + } + + /** + * Set the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @param correlationId the correlationId value to set. + * @return the TranscriptionResumed object itself. + */ + public TranscriptionResumed setCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling answerCall action to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code/sub-code and message from NGC services. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the transcriptionUpdateResult property: Defines the result for TranscriptionUpdate with the current status + * and the details about the status. + * + * @return the transcriptionUpdateResult value. + */ + public TranscriptionUpdate getTranscriptionUpdateResult() { + return this.transcriptionUpdateResult; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionStarted.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionStarted.java new file mode 100644 index 000000000000..88ed3753de15 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionStarted.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TranscriptionStarted model. */ +@Fluent +public final class TranscriptionStarted { + /* + * Call connection ID. + */ + @JsonProperty(value = "callConnectionId", access = JsonProperty.Access.WRITE_ONLY) + private String callConnectionId; + + /* + * Server call ID. + */ + @JsonProperty(value = "serverCallId") + private String serverCallId; + + /* + * Correlation ID for event to call correlation. Also called ChainId for + * skype chain ID. + */ + @JsonProperty(value = "correlationId") + private String correlationId; + + /* + * Used by customers when calling answerCall action to correlate the + * request to the response event. + */ + @JsonProperty(value = "operationContext", access = JsonProperty.Access.WRITE_ONLY) + private String operationContext; + + /* + * Contains the resulting SIP code/sub-code and message from NGC services. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private ResultInformation resultInformation; + + /* + * Defines the result for TranscriptionUpdate with the current status and + * the details about the status + */ + @JsonProperty(value = "transcriptionUpdateResult", access = JsonProperty.Access.WRITE_ONLY) + private TranscriptionUpdate transcriptionUpdateResult; + + /** + * Get the callConnectionId property: Call connection ID. + * + * @return the callConnectionId value. + */ + public String getCallConnectionId() { + return this.callConnectionId; + } + + /** + * Get the serverCallId property: Server call ID. + * + * @return the serverCallId value. + */ + public String getServerCallId() { + return this.serverCallId; + } + + /** + * Set the serverCallId property: Server call ID. + * + * @param serverCallId the serverCallId value to set. + * @return the TranscriptionStarted object itself. + */ + public TranscriptionStarted setServerCallId(String serverCallId) { + this.serverCallId = serverCallId; + return this; + } + + /** + * Get the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @return the correlationId value. + */ + public String getCorrelationId() { + return this.correlationId; + } + + /** + * Set the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @param correlationId the correlationId value to set. + * @return the TranscriptionStarted object itself. + */ + public TranscriptionStarted setCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling answerCall action to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code/sub-code and message from NGC services. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the transcriptionUpdateResult property: Defines the result for TranscriptionUpdate with the current status + * and the details about the status. + * + * @return the transcriptionUpdateResult value. + */ + public TranscriptionUpdate getTranscriptionUpdateResult() { + return this.transcriptionUpdateResult; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionStopped.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionStopped.java new file mode 100644 index 000000000000..dd27b183ce2e --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionStopped.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TranscriptionStopped model. */ +@Fluent +public final class TranscriptionStopped { + /* + * Call connection ID. + */ + @JsonProperty(value = "callConnectionId", access = JsonProperty.Access.WRITE_ONLY) + private String callConnectionId; + + /* + * Server call ID. + */ + @JsonProperty(value = "serverCallId") + private String serverCallId; + + /* + * Correlation ID for event to call correlation. Also called ChainId for + * skype chain ID. + */ + @JsonProperty(value = "correlationId") + private String correlationId; + + /* + * Used by customers when calling answerCall action to correlate the + * request to the response event. + */ + @JsonProperty(value = "operationContext", access = JsonProperty.Access.WRITE_ONLY) + private String operationContext; + + /* + * Contains the resulting SIP code/sub-code and message from NGC services. + */ + @JsonProperty(value = "resultInformation", access = JsonProperty.Access.WRITE_ONLY) + private ResultInformation resultInformation; + + /* + * Defines the result for TranscriptionUpdate with the current status and + * the details about the status + */ + @JsonProperty(value = "transcriptionUpdateResult", access = JsonProperty.Access.WRITE_ONLY) + private TranscriptionUpdate transcriptionUpdateResult; + + /** + * Get the callConnectionId property: Call connection ID. + * + * @return the callConnectionId value. + */ + public String getCallConnectionId() { + return this.callConnectionId; + } + + /** + * Get the serverCallId property: Server call ID. + * + * @return the serverCallId value. + */ + public String getServerCallId() { + return this.serverCallId; + } + + /** + * Set the serverCallId property: Server call ID. + * + * @param serverCallId the serverCallId value to set. + * @return the TranscriptionStopped object itself. + */ + public TranscriptionStopped setServerCallId(String serverCallId) { + this.serverCallId = serverCallId; + return this; + } + + /** + * Get the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @return the correlationId value. + */ + public String getCorrelationId() { + return this.correlationId; + } + + /** + * Set the correlationId property: Correlation ID for event to call correlation. Also called ChainId for skype chain + * ID. + * + * @param correlationId the correlationId value to set. + * @return the TranscriptionStopped object itself. + */ + public TranscriptionStopped setCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling answerCall action to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code/sub-code and message from NGC services. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return this.resultInformation; + } + + /** + * Get the transcriptionUpdateResult property: Defines the result for TranscriptionUpdate with the current status + * and the details about the status. + * + * @return the transcriptionUpdateResult value. + */ + public TranscriptionUpdate getTranscriptionUpdateResult() { + return this.transcriptionUpdateResult; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionTransportType.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionTransportType.java new file mode 100644 index 000000000000..780908171932 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionTransportType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TranscriptionTransportType. */ +public final class TranscriptionTransportType extends ExpandableStringEnum { + /** Static value websocket for TranscriptionTransportType. */ + public static final TranscriptionTransportType WEBSOCKET = fromString("websocket"); + + /** + * Creates or finds a TranscriptionTransportType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TranscriptionTransportType. + */ + @JsonCreator + public static TranscriptionTransportType fromString(String name) { + return fromString(name, TranscriptionTransportType.class); + } + + /** @return known TranscriptionTransportType values. */ + public static Collection values() { + return values(TranscriptionTransportType.class); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionUpdate.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionUpdate.java new file mode 100644 index 000000000000..751a3a12c437 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/TranscriptionUpdate.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TranscriptionUpdate model. */ +@Fluent +public final class TranscriptionUpdate { + /* + * The transcriptionStatus property. + */ + @JsonProperty(value = "transcriptionStatus") + private String transcriptionStatus; + + /* + * The transcriptionStatusDetails property. + */ + @JsonProperty(value = "transcriptionStatusDetails") + private String transcriptionStatusDetails; + + /** + * Get the transcriptionStatus property: The transcriptionStatus property. + * + * @return the transcriptionStatus value. + */ + public String getTranscriptionStatus() { + return this.transcriptionStatus; + } + + /** + * Set the transcriptionStatus property: The transcriptionStatus property. + * + * @param transcriptionStatus the transcriptionStatus value to set. + * @return the TranscriptionUpdate object itself. + */ + public TranscriptionUpdate setTranscriptionStatus(String transcriptionStatus) { + this.transcriptionStatus = transcriptionStatus; + return this; + } + + /** + * Get the transcriptionStatusDetails property: The transcriptionStatusDetails property. + * + * @return the transcriptionStatusDetails value. + */ + public String getTranscriptionStatusDetails() { + return this.transcriptionStatusDetails; + } + + /** + * Set the transcriptionStatusDetails property: The transcriptionStatusDetails property. + * + * @param transcriptionStatusDetails the transcriptionStatusDetails value to set. + * @return the TranscriptionUpdate object itself. + */ + public TranscriptionUpdate setTranscriptionStatusDetails(String transcriptionStatusDetails) { + this.transcriptionStatusDetails = transcriptionStatusDetails; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/UnholdParticipantRequestInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/UnholdParticipantRequestInternal.java new file mode 100644 index 000000000000..e7d7d054fa83 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/UnholdParticipantRequestInternal.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The request payload for holding participant from the call. */ +@Fluent +public final class UnholdParticipantRequestInternal { + /* + * Participants to be hold from the call. + * Only ACS Users are supported. + */ + @JsonProperty(value = "participantToUnhold", required = true) + private CommunicationIdentifierModel participantToUnhold; + + /* + * Used by customers when calling mid-call actions to correlate the request + * to the response event. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /** + * Get the participantToUnhold property: Participants to be hold from the call. Only ACS Users are supported. + * + * @return the participantToUnhold value. + */ + public CommunicationIdentifierModel getParticipantToUnhold() { + return this.participantToUnhold; + } + + /** + * Set the participantToUnhold property: Participants to be hold from the call. Only ACS Users are supported. + * + * @param participantToUnhold the participantToUnhold value to set. + * @return the UnholdParticipantRequestInternal object itself. + */ + public UnholdParticipantRequestInternal setParticipantToUnhold(CommunicationIdentifierModel participantToUnhold) { + this.participantToUnhold = participantToUnhold; + return this; + } + + /** + * Get the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: Used by customers when calling mid-call actions to correlate the request to + * the response event. + * + * @param operationContext the operationContext value to set. + * @return the UnholdParticipantRequestInternal object itself. + */ + public UnholdParticipantRequestInternal setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/UnholdParticipantResponseInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/UnholdParticipantResponseInternal.java new file mode 100644 index 000000000000..69520eb15f22 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/UnholdParticipantResponseInternal.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The response payload for unmuting participants from the call. */ +@Fluent +public final class UnholdParticipantResponseInternal { + /* + * The operation context provided by client. + */ + @JsonProperty(value = "operationContext") + private String operationContext; + + /** + * Get the operationContext property: The operation context provided by client. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return this.operationContext; + } + + /** + * Set the operationContext property: The operation context provided by client. + * + * @param operationContext the operationContext value to set. + * @return the UnholdParticipantResponseInternal object itself. + */ + public UnholdParticipantResponseInternal setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/UpdateTranscriptionDataRequest.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/UpdateTranscriptionDataRequest.java new file mode 100644 index 000000000000..2b525886399f --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/UpdateTranscriptionDataRequest.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UpdateTranscriptionDataRequest model. */ +@Fluent +public final class UpdateTranscriptionDataRequest { + /* + * Defines new locale for transcription. + */ + @JsonProperty(value = "locale", required = true) + private String locale; + + /** + * Get the locale property: Defines new locale for transcription. + * + * @return the locale value. + */ + public String getLocale() { + return this.locale; + } + + /** + * Set the locale property: Defines new locale for transcription. + * + * @param locale the locale value to set. + * @return the UpdateTranscriptionDataRequest object itself. + */ + public UpdateTranscriptionDataRequest setLocale(String locale) { + this.locale = locale; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/AddParticipantResult.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/AddParticipantResult.java index 948882c41e25..d59bcdf74c9e 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/AddParticipantResult.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/AddParticipantResult.java @@ -23,6 +23,11 @@ public final class AddParticipantResult { */ private final String operationContext; + /* + * The invitation ID used to send out add participant request. + */ + private final String invitationId; + static { AddParticipantResponseConstructorProxy.setAccessor( new AddParticipantResponseConstructorProxy.AddParticipantResponseConstructorAccessor() { @@ -40,6 +45,7 @@ public AddParticipantResult create(AddParticipantResponseInternal internalHeader public AddParticipantResult() { this.participant = null; this.operationContext = null; + this.invitationId = null; } /** @@ -52,6 +58,7 @@ public AddParticipantResult() { this.participant = CallParticipantConverter.convert(addParticipantResponseInternal.getParticipant()); this.operationContext = addParticipantResponseInternal.getOperationContext(); + this.invitationId = addParticipantResponseInternal.getInvitationId(); } /** @@ -71,4 +78,14 @@ public CallParticipant getParticipant() { public String getOperationContext() { return this.operationContext; } + + /** + * Get the invitationId property: The invitation ID used to send out add + * participant request. + * + * @return the invitationId value. + */ + public String getInvitationId() { + return invitationId; + } } diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CancelAddParticipantOptions.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CancelAddParticipantOptions.java new file mode 100644 index 000000000000..98a89a12325a --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CancelAddParticipantOptions.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.models; + +import com.azure.core.annotation.Fluent; + +/** + * The options for cancelling add participant. + */ +@Fluent +public final class CancelAddParticipantOptions { + /** + * The inviation ID used to cancel the add participant request. + */ + private final String invitationId; + + /** + * The operational context + */ + private String operationContext; + + /** + * Callback URI override + */ + private String callbackUrl; + + /** + * Constructor + * + * @param invitationId The inviation ID used to cancel the add participant request. + */ + public CancelAddParticipantOptions(String invitationId) { + this.invitationId = invitationId; + } + + /** + * Get the invitationId. + * + * @return invitationId + */ + public String getInvitationId() { + return invitationId; + } + + /** + * Get the operationContext. + * + * @return the operationContext + */ + public String getOperationContext() { + return operationContext; + } + + /** + * Get the callback URI override. + * + * @return the callbackUriOverride + */ + public String getCallbackUrl() { + return callbackUrl; + } + + /** + * Set the operationContext. + * + * @param operationContext the operationContext to set + * @return the CancelAddParticipantOptions object itself. + */ + public CancelAddParticipantOptions setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } + + /** + * Set the callbackUriOverride. + * + * @param callbackUrl the callbackUriOverride to set + * @return the CancelAddParticipantOptions object itself. + */ + public CancelAddParticipantOptions setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CancelAddParticipantResult.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CancelAddParticipantResult.java new file mode 100644 index 000000000000..ace335f408c2 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CancelAddParticipantResult.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.models; + +import java.util.Objects; + +import com.azure.communication.callautomation.implementation.accesshelpers.CancelAddParticipantResponseConstructorProxy; +import com.azure.communication.callautomation.implementation.accesshelpers.CancelAddParticipantResponseConstructorProxy.CancelAddParticipantResponseConstructorAccessor; +import com.azure.communication.callautomation.implementation.models.CancelAddParticipantResponse; +import com.azure.core.annotation.Immutable; + +/** The CancelAddParticipantResult model. */ +@Immutable +public final class CancelAddParticipantResult { + + /** + * The invitation ID used to cancel the add participant request. + */ + private final String invitationId; + + /** + * The operation context provided by client. + */ + private final String operationContext; + + static { + CancelAddParticipantResponseConstructorProxy.setAccessor( + new CancelAddParticipantResponseConstructorAccessor() { + @Override + public CancelAddParticipantResult create(CancelAddParticipantResponse internalHeaders) { + return new CancelAddParticipantResult(internalHeaders); + } + }); + } + + /** + * Public constructor. + */ + public CancelAddParticipantResult() { + invitationId = null; + operationContext = null; + } + + /** + * Package-private constructor of the class, used internally only. + * + * @param cancelAddParticipantResponseInternal The response from the service. + */ + CancelAddParticipantResult(CancelAddParticipantResponse cancelAddParticipantResponseInternal) { + Objects.requireNonNull(cancelAddParticipantResponseInternal, + "cancelAddParticipantResponseInternal must not be null"); + + invitationId = cancelAddParticipantResponseInternal.getInvitationId(); + operationContext = cancelAddParticipantResponseInternal.getOperationContext(); + } + + /** + * Get the invitationId property: The invitation ID used to cancel the add + * participant request. + * + * @return the invitationId value. + */ + public String getInvitationId() { + return invitationId; + } + + /** + * Get the operationContext property: The operation context provided by client. + * + * @return the operationContext value. + */ + public String getOperationContext() { + return operationContext; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/StartHoldMusicOptions.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/StartHoldMusicOptions.java new file mode 100644 index 000000000000..1ef9f5dc1364 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/StartHoldMusicOptions.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.callautomation.models; + +import com.azure.communication.common.CommunicationIdentifier; + +/** + * Options for the Start Hold Music operation. + */ +public class StartHoldMusicOptions { + + /** + * Participant to put on hold. + */ + private final CommunicationIdentifier targetParticipant; + + /** + * Audio to play while on hold. + */ + private final PlaySource playSourceInfo; + + /** + * If Audio will loop. Default is true. + */ + private boolean loop; + + /** + * Operation context. + */ + private String operationContext; + + /** + * Create a new StartHoldMusicOptions object. + * @param targetParticipant Participant to be put on hold. + * @param playSourceInfo Audio to be played while on hold. + */ + public StartHoldMusicOptions(CommunicationIdentifier targetParticipant, PlaySource playSourceInfo) { + this.targetParticipant = targetParticipant; + this.playSourceInfo = playSourceInfo; + loop = true; + } + + /** + * Get Participant to be put on hold. + * @return participant. + */ + public CommunicationIdentifier getTargetParticipant() { + return targetParticipant; + } + + /** + * Get PlaySourceInfo + * @return the playSourceInfo. + */ + public PlaySource getPlaySourceInfo() { + return playSourceInfo; + } + + /** + * Get if the music is in loop. + * @return true for loop, false for play once. + */ + public boolean isLoop() { + return loop; + } + + /** + * Set the value for loop. + * @param loop - boolean. + * @return The StartHoldMusicOptions object. + */ + public StartHoldMusicOptions setLoop(boolean loop) { + this.loop = loop; + return this; + } + + /** + * Get the operation context. + * @return operation context. + */ + public String getOperationContext() { + return operationContext; + } + + /** + * Sets the operation context. + * @param operationContext Operation Context + * @return The StartHoldMusicOptions object. + */ + public StartHoldMusicOptions setOperationContext(String operationContext) { + this.operationContext = operationContext; + return this; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/AddParticipantCancelled.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/AddParticipantCancelled.java new file mode 100644 index 000000000000..97d31467ba7d --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/AddParticipantCancelled.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.models.events; + +import java.util.Map; + +import com.azure.communication.callautomation.implementation.converters.CommunicationIdentifierConverter; +import com.azure.communication.callautomation.implementation.models.CommunicationIdentifierModel; +import com.azure.communication.common.CommunicationIdentifier; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** The AddParticipantCancelled model. */ +@Immutable +public final class AddParticipantCancelled extends CallAutomationEventBase { + /* + * The invitation ID used to cancel the add participant request. + */ + @JsonProperty(value = "invitationId") + private final String invitationId; + + /* + * Participant who's invitation was cancelled + */ + @JsonIgnore + private final CommunicationIdentifier participant; + + @JsonCreator + private AddParticipantCancelled(@JsonProperty("participant") Map participant) { + invitationId = null; + ObjectMapper mapper = new ObjectMapper(); + mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + this.participant = CommunicationIdentifierConverter + .convert(mapper.convertValue(participant, CommunicationIdentifierModel.class)); + } + + /** + * Get the participant property: Participant who's invitation was cancelled. + * + * @return the participant value. + */ + public CommunicationIdentifier getParticipant() { + return this.participant; + } + + /** + * Get the invitationId property: The invitation ID used to cancel the add + * participant request. + * + * @return the invitationId value. + */ + public String getInvitationId() { + return invitationId; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/CancelAddParticipantFailed.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/CancelAddParticipantFailed.java new file mode 100644 index 000000000000..50e3b36a90d9 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/events/CancelAddParticipantFailed.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.models.events; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CancelAddParticipantFailed model. */ +@Immutable +public final class CancelAddParticipantFailed extends CallAutomationEventBase { + /* + * The invitation ID used to cancel the add participant request. + */ + @JsonProperty(value = "invitationId") + private final String invitationId; + + /* + * Contains the resulting SIP code, sub-code and message. + */ + @JsonProperty(value = "resultInformation") + private final ResultInformation resultInformation; + + private CancelAddParticipantFailed() { + invitationId = null; + resultInformation = null; + } + + /** + * Get the invitationId property: The invitation ID used to cancel the add participant request. + * + * @return the invitationId value. + */ + public String getInvitationId() { + return invitationId; + } + + /** + * Get the resultInformation property: Contains the resulting SIP code, sub-code + * and message. + * + * @return the resultInformation value. + */ + public ResultInformation getResultInformation() { + return resultInformation; + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationEventParserUnitTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationEventParserUnitTests.java index fdeee37ea326..a6e1c6b27385 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationEventParserUnitTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallAutomationEventParserUnitTests.java @@ -602,4 +602,71 @@ public void parseTransferAccptedEvent() { assertEquals("8:acs:3afbe310-c6d9-4b6f-a11e-c2aeb352f207_0000001a-0f2f-2234-655d-573a0d00443e", event.getTransferTarget().getRawId()); assertEquals("8:acs:3afbe310-c6d9-4b6f-a11e-c2aeb352f207_0000001a-0f2e-e2b4-655d-573a0d004434", event.getTransferee().getRawId()); } + + @Test + public void parseAddParticipantCancelledEvent() { + String receivedEvent = "[{\n" + + "\"id\": \"c3220fa3-79bd-473e-96a2-3ecb5be7d71f\",\n" + + "\"source\": \"calling/callConnections/421f3500-f5de-4c12-bf61-9e2641433687\",\n" + + "\"type\": \"Microsoft.Communication.AddParticipantCancelled\",\n" + + "\"data\": {\n" + + "\"operationContext\": \"context\",\n" + + "\"participant\": {\n" + + "\"rawId\": \"rawId\",\n" + + "\"phoneNumber\": {\n" + + "\"value\": \"value\"\n" + + "}\n" + + "},\n" + + "\"callConnectionId\": \"callConnectionId\",\n" + + "\"serverCallId\": \"serverCallId\",\n" + + "\"invitationId\": \"b880bd5a-1916-470a-b43d-aabf3caff91c\",\n" + + "\"correlationId\": \"b880bd5a-1916-470a-b43d-aabf3caff91c\"\n" + + "},\n" + + "\"time\": \"2023-03-22T16:57:09.287755+00:00\",\n" + + "\"specversion\": \"1.0\",\n" + + "\"datacontenttype\": \"application/json\",\n" + + "\"subject\": \"calling/callConnections/421f3500-f5de-4c12-bf61-9e2641433687\"\n" + + "}]"; + + CallAutomationEventBase event = CallAutomationEventParser.parseEvents(receivedEvent).get(0); + assertNotNull(event); + + AddParticipantCancelled addParticipantCancelled = (AddParticipantCancelled) event; + + assertNotNull(addParticipantCancelled); + assertEquals("serverCallId", addParticipantCancelled.getServerCallId()); + assertEquals("callConnectionId", addParticipantCancelled.getCallConnectionId()); + assertEquals("b880bd5a-1916-470a-b43d-aabf3caff91c", addParticipantCancelled.getInvitationId()); + } + + @Test + public void parseCancelAddParticipantFailedEvent() { + String receivedEvent = "[{\n" + + "\"id\": \"c3220fa3-79bd-473e-96a2-3ecb5be7d71f\",\n" + + "\"source\": \"calling/callConnections/421f3500-f5de-4c12-bf61-9e2641433687\",\n" + + "\"type\": \"Microsoft.Communication.CancelAddParticipantFailed\",\n" + + "\"data\": {\n" + + "\"operationContext\": \"context\",\n" + + "\"callConnectionId\": \"callConnectionId\",\n" + + "\"serverCallId\": \"serverCallId\",\n" + + "\"invitationId\": \"b880bd5a-1916-470a-b43d-aabf3caff91c\",\n" + + "\"correlationId\": \"b880bd5a-1916-470a-b43d-aabf3caff91c\"\n" + + "},\n" + + "\"time\": \"2023-03-22T16:57:09.287755+00:00\",\n" + + "\"specversion\": \"1.0\",\n" + + "\"datacontenttype\": \"application/json\",\n" + + "\"subject\": \"calling/callConnections/421f3500-f5de-4c12-bf61-9e2641433687\"\n" + + "}]"; + + CallAutomationEventBase event = CallAutomationEventParser.parseEvents(receivedEvent).get(0); + + assertNotNull(event); + + CancelAddParticipantFailed cancelAddParticipantFailed = (CancelAddParticipantFailed) event; + + assertNotNull(cancelAddParticipantFailed); + assertEquals("serverCallId", cancelAddParticipantFailed.getServerCallId()); + assertEquals("callConnectionId", cancelAddParticipantFailed.getCallConnectionId()); + assertEquals("b880bd5a-1916-470a-b43d-aabf3caff91c", cancelAddParticipantFailed.getInvitationId()); + } } diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionAsyncUnitTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionAsyncUnitTests.java index bc4941205f1b..7cd5df839e85 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionAsyncUnitTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionAsyncUnitTests.java @@ -3,6 +3,7 @@ package com.azure.communication.callautomation; +import com.azure.communication.callautomation.implementation.models.CancelAddParticipantResponse; import com.azure.communication.callautomation.implementation.models.MuteParticipantsResponseInternal; import com.azure.communication.callautomation.implementation.models.RemoveParticipantResponseInternal; import com.azure.communication.callautomation.implementation.models.TransferCallResponseInternal; @@ -12,6 +13,8 @@ import com.azure.communication.callautomation.models.CallConnectionProperties; import com.azure.communication.callautomation.models.CallInvite; import com.azure.communication.callautomation.models.CallParticipant; +import com.azure.communication.callautomation.models.CancelAddParticipantOptions; +import com.azure.communication.callautomation.models.CancelAddParticipantResult; import com.azure.communication.callautomation.models.MuteParticipantsOptions; import com.azure.communication.callautomation.models.MuteParticipantsResult; import com.azure.communication.callautomation.models.RemoveParticipantOptions; @@ -433,4 +436,46 @@ public void unmuteMoreThanOneParticipantWithResponse() { assertThrows(HttpResponseException.class, () -> callConnectionAsync.unmuteParticipantsWithResponse(muteParticipantOptions).block()); } + + @Test + public void cancelAddParticipant() { + String invitationId = "invitationId"; + + CallConnectionAsync callConnectionAsync = getCallAutomationAsyncClient(new ArrayList<>( + Collections.singletonList( + new SimpleEntry<>(serializeObject(new CancelAddParticipantResponse() + .setInvitationId(invitationId) + .setOperationContext(CALL_OPERATION_CONTEXT)), 202) + ))) + .getCallConnectionAsync(CALL_CONNECTION_ID); + + CancelAddParticipantResult result = callConnectionAsync.cancelAddParticipant(invitationId).block(); + + assertNotNull(result); + assertEquals(CALL_OPERATION_CONTEXT, result.getOperationContext()); + assertEquals(invitationId, result.getInvitationId()); + } + + @Test + public void cancelAddParticipantWithResponse() { + String invitationId = "invitationId"; + + CallConnectionAsync callConnectionAsync = getCallAutomationAsyncClient(new ArrayList<>( + Collections.singletonList( + new SimpleEntry<>(serializeObject(new CancelAddParticipantResponse() + .setInvitationId(invitationId) + .setOperationContext(CALL_OPERATION_CONTEXT)), 202) + ))) + .getCallConnectionAsync(CALL_CONNECTION_ID); + + CancelAddParticipantOptions options = new CancelAddParticipantOptions(invitationId) + .setOperationContext(CALL_OPERATION_CONTEXT); + Response response = callConnectionAsync.cancelAddParticipantWithResponse( + options).block(); + + + assertNotNull(response); + assertEquals(202, response.getStatusCode()); + assertNotNull(response.getValue()); + } } diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionUnitTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionUnitTests.java index d8a907c25a9c..a57a4c028ff3 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionUnitTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallConnectionUnitTests.java @@ -3,6 +3,7 @@ package com.azure.communication.callautomation; +import com.azure.communication.callautomation.implementation.models.CancelAddParticipantResponse; import com.azure.communication.callautomation.implementation.models.MuteParticipantsResponseInternal; import com.azure.communication.callautomation.implementation.models.RemoveParticipantResponseInternal; import com.azure.communication.callautomation.implementation.models.TransferCallResponseInternal; @@ -12,6 +13,8 @@ import com.azure.communication.callautomation.models.CallConnectionProperties; import com.azure.communication.callautomation.models.CallInvite; import com.azure.communication.callautomation.models.CallParticipant; +import com.azure.communication.callautomation.models.CancelAddParticipantOptions; +import com.azure.communication.callautomation.models.CancelAddParticipantResult; import com.azure.communication.callautomation.models.MuteParticipantsOptions; import com.azure.communication.callautomation.models.MuteParticipantsResult; import com.azure.communication.callautomation.models.RemoveParticipantOptions; @@ -326,4 +329,46 @@ public void unmuteParticipantWithResponse() { assertEquals(202, unmuteParticipantsResultResponse.getStatusCode()); assertNotNull(unmuteParticipantsResultResponse.getValue()); } + + @Test + public void cancelAddParticipant() { + String invitationId = "invitationId"; + + CallConnection callConnection = getCallAutomationClient(new ArrayList<>( + Collections.singletonList( + new SimpleEntry<>(serializeObject(new CancelAddParticipantResponse() + .setInvitationId(invitationId) + .setOperationContext(CALL_OPERATION_CONTEXT)), 202) + ))) + .getCallConnection(CALL_CONNECTION_ID); + + CancelAddParticipantResult result = callConnection.cancelAddParticipant(invitationId); + + assertNotNull(result); + assertEquals(CALL_OPERATION_CONTEXT, result.getOperationContext()); + assertEquals(invitationId, result.getInvitationId()); + } + + @Test + public void cancelAddParticipantWithResponse() { + String invitationId = "invitationId"; + + CallConnection callConnection = getCallAutomationClient(new ArrayList<>( + Collections.singletonList( + new SimpleEntry<>(serializeObject(new CancelAddParticipantResponse() + .setInvitationId(invitationId) + .setOperationContext(CALL_OPERATION_CONTEXT)), 202) + ))) + .getCallConnection(CALL_CONNECTION_ID); + + CancelAddParticipantOptions options = new CancelAddParticipantOptions(invitationId) + .setOperationContext(CALL_OPERATION_CONTEXT); + Response response = callConnection.cancelAddParticipantWithResponse( + options, Context.NONE); + + + assertNotNull(response); + assertEquals(202, response.getStatusCode()); + assertNotNull(response.getValue()); + } } diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaAsyncUnitTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaAsyncUnitTests.java index 017e40407327..ea959cd80ea8 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaAsyncUnitTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaAsyncUnitTests.java @@ -12,6 +12,7 @@ import com.azure.communication.callautomation.models.DtmfTone; import com.azure.communication.callautomation.models.FileSource; import com.azure.communication.callautomation.models.GenderType; +import com.azure.communication.callautomation.models.StartHoldMusicOptions; import com.azure.communication.callautomation.models.TextSource; import com.azure.communication.callautomation.models.SsmlSource; import com.azure.communication.callautomation.models.PlayOptions; @@ -43,11 +44,7 @@ public class CallMediaAsyncUnitTests { @BeforeEach public void setup() { - CallConnectionAsync callConnection = - CallAutomationUnitTestBase.getCallConnectionAsync(new ArrayList<>( - Collections.singletonList(new AbstractMap.SimpleEntry<>("", 202))) - ); - callMedia = callConnection.getCallMediaAsync(); + callMedia = getMockCallMedia(202); playFileSource = new FileSource(); playFileSource.setPlaySourceId("playFileSourceId"); @@ -176,11 +173,7 @@ public void recognizeWithResponseWithFileSourceDtmfOptions() { @Test public void startContinuousDtmfRecognitionWithResponse() { // override callMedia to mock 200 response code - CallConnectionAsync callConnection = - CallAutomationUnitTestBase.getCallConnectionAsync(new ArrayList<>( - Collections.singletonList(new AbstractMap.SimpleEntry<>("", 200))) - ); - callMedia = callConnection.getCallMediaAsync(); + callMedia = getMockCallMedia(200); StepVerifier.create( callMedia.startContinuousDtmfRecognitionWithResponse(new CommunicationUserIdentifier("id"), "operationContext") @@ -192,11 +185,7 @@ public void startContinuousDtmfRecognitionWithResponse() { @Test public void stopContinuousDtmfRecognitionWithResponse() { // override callMedia to mock 200 response code - CallConnectionAsync callConnection = - CallAutomationUnitTestBase.getCallConnectionAsync(new ArrayList<>( - Collections.singletonList(new AbstractMap.SimpleEntry<>("", 200))) - ); - callMedia = callConnection.getCallMediaAsync(); + callMedia = getMockCallMedia(200); StepVerifier.create( callMedia.stopContinuousDtmfRecognitionWithResponse(new CommunicationUserIdentifier("id"), "operationContext", null) @@ -337,4 +326,38 @@ public void recognizeWithResponseTextSpeechOrDtmfOptions() { .consumeNextWith(response -> assertEquals(202, response.getStatusCode())) .verifyComplete(); } + + @Test + public void startHoldMusicWithResponseTest() { + + callMedia = getMockCallMedia(200); + StartHoldMusicOptions options = new StartHoldMusicOptions( + new CommunicationUserIdentifier("id"), + new TextSource().setText("audio to play")); + StepVerifier.create( + callMedia.startHoldMusicWithResponse(options)) + .consumeNextWith(response -> assertEquals(200, response.getStatusCode())) + .verifyComplete(); + } + + @Test + public void stopHoldMusicWithResponseTest() { + + callMedia = getMockCallMedia(200); + StepVerifier.create( + callMedia.stopHoldMusicWithResponseAsync( + new CommunicationUserIdentifier("id"), + "operationalContext" + )) + .consumeNextWith(response -> assertEquals(200, response.getStatusCode())) + .verifyComplete(); + } + + private CallMediaAsync getMockCallMedia(int expectedStatusCode) { + CallConnectionAsync callConnection = + CallAutomationUnitTestBase.getCallConnectionAsync(new ArrayList<>( + Collections.singletonList(new AbstractMap.SimpleEntry<>("", expectedStatusCode))) + ); + return callConnection.getCallMediaAsync(); + } } diff --git a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaUnitTests.java b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaUnitTests.java index a238fa7d0ded..5ca2c44dc991 100644 --- a/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaUnitTests.java +++ b/sdk/communication/azure-communication-callautomation/src/test/java/com/azure/communication/callautomation/CallMediaUnitTests.java @@ -148,4 +148,30 @@ public void sendDtmfWithResponseTest() { assertEquals(response.getStatusCode(), 202); } + @Test + public void startHoldMusicWithResponseTest() { + CallConnection callConnection = + CallAutomationUnitTestBase.getCallConnection(new ArrayList<>( + Collections.singletonList(new AbstractMap.SimpleEntry<>("", 200))) + ); + callMedia = callConnection.getCallMedia(); + StartHoldMusicOptions options = new StartHoldMusicOptions( + new CommunicationUserIdentifier("id"), + new TextSource().setText("audio to play")); + Response response = callMedia.startHoldMusicWithResponse(options, null); + assertEquals(response.getStatusCode(), 200); + } + + @Test + public void stopHoldMusicWithResponseTest() { + CallConnection callConnection = + CallAutomationUnitTestBase.getCallConnection(new ArrayList<>( + Collections.singletonList(new AbstractMap.SimpleEntry<>("", 200))) + ); + callMedia = callConnection.getCallMedia(); + + Response response = callMedia.stopHoldMusicWithResponse(new CommunicationUserIdentifier("id"), + "operationalContext", Context.NONE); + assertEquals(response.getStatusCode(), 200); + } } diff --git a/sdk/communication/azure-communication-callautomation/swagger/README.md b/sdk/communication/azure-communication-callautomation/swagger/README.md index 70c08934b55a..ff22a3619bd9 100644 --- a/sdk/communication/azure-communication-callautomation/swagger/README.md +++ b/sdk/communication/azure-communication-callautomation/swagger/README.md @@ -28,7 +28,7 @@ autorest README.md --java --v4 --use=@autorest/java@4.0.20 --use=@autorest/model ``` yaml tag: package-2023-01-15-preview require: - - https://github.com/williamzhao87/azure-rest-api-specs/blob/18fef29e753a6637d5639874ab20825003ae2077/specification/communication/data-plane/CallAutomation/readme.md + - https://github.com/williamzhao87/azure-rest-api-specs/blob/8f5bd72f81f7fa9020f6834f06f3db54a475ee68/specification/communication/data-plane/CallAutomation/readme.md java: true output-folder: ../ license-header: MICROSOFT_MIT_SMALL @@ -166,6 +166,12 @@ directive: - rename-model: from: UnmuteParticipantsResponse to: UnmuteParticipantsResponseInternal +- rename-model: + from: StartHoldMusicRequest + to: StartHoldMusicRequestInternal +- rename-model: + from: StopHoldMusicRequest + to: StopHoldMusicRequestInternal - rename-model: from: CollectTonesResult to: CollectTonesResultInternal @@ -210,6 +216,8 @@ directive: - remove-model: ContinuousDtmfRecognitionStopped - remove-model: SendDtmfCompleted - remove-model: SendDtmfFailed +- remove-model: AddParticipantCancelled +- remove-model: CancelAddParticipantFailed ``` ### Rename RecordingChannelType to RecordingChannelInternal diff --git a/sdk/communication/azure-communication-callingserver/pom.xml b/sdk/communication/azure-communication-callingserver/pom.xml index f17fa8a6a615..beda36e82fe2 100644 --- a/sdk/communication/azure-communication-callingserver/pom.xml +++ b/sdk/communication/azure-communication-callingserver/pom.xml @@ -59,12 +59,12 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 com.azure azure-communication-identity - 1.4.9 + 1.4.10 test diff --git a/sdk/communication/azure-communication-chat/CHANGELOG.md b/sdk/communication/azure-communication-chat/CHANGELOG.md index c3fc16648319..eeb7263c5cc7 100644 --- a/sdk/communication/azure-communication-chat/CHANGELOG.md +++ b/sdk/communication/azure-communication-chat/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.3.12 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-communication-common` from `1.2.11` to version `1.2.12`. + ## 1.3.11 (2023-08-18) ### Other Changes diff --git a/sdk/communication/azure-communication-chat/pom.xml b/sdk/communication/azure-communication-chat/pom.xml index ebbcd96e2b7f..f5d02ba25bdd 100644 --- a/sdk/communication/azure-communication-chat/pom.xml +++ b/sdk/communication/azure-communication-chat/pom.xml @@ -55,12 +55,12 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 com.azure azure-communication-identity - 1.4.9 + 1.4.10 test diff --git a/sdk/communication/azure-communication-common/CHANGELOG.md b/sdk/communication/azure-communication-common/CHANGELOG.md index 449d3747a71b..daebd6080697 100644 --- a/sdk/communication/azure-communication-common/CHANGELOG.md +++ b/sdk/communication/azure-communication-common/CHANGELOG.md @@ -10,6 +10,14 @@ ### Other Changes +## 1.2.12 (2023-09-22) + +### Other Changes + +#### Dependency Updates +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.2.11 (2023-08-18) ### Other Changes diff --git a/sdk/communication/azure-communication-email/CHANGELOG.md b/sdk/communication/azure-communication-email/CHANGELOG.md index 44f123036214..f15974821554 100644 --- a/sdk/communication/azure-communication-email/CHANGELOG.md +++ b/sdk/communication/azure-communication-email/CHANGELOG.md @@ -10,6 +10,16 @@ ### Other Changes +## 1.0.6 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. +- Upgraded `azure-communication-common` from `1.2.11` to version `1.2.12`. + ## 1.0.5 (2023-08-18) ### Other Changes diff --git a/sdk/communication/azure-communication-email/pom.xml b/sdk/communication/azure-communication-email/pom.xml index c3b6e121b528..b8b92774a28b 100644 --- a/sdk/communication/azure-communication-email/pom.xml +++ b/sdk/communication/azure-communication-email/pom.xml @@ -65,7 +65,7 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 diff --git a/sdk/communication/azure-communication-identity/CHANGELOG.md b/sdk/communication/azure-communication-identity/CHANGELOG.md index 6fd90ab28dd5..9eb8792ad6fe 100644 --- a/sdk/communication/azure-communication-identity/CHANGELOG.md +++ b/sdk/communication/azure-communication-identity/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.4.10 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-communication-common` from `1.2.11` to version `1.2.12`. + ## 1.4.9 (2023-08-18) ### Other Changes diff --git a/sdk/communication/azure-communication-identity/pom.xml b/sdk/communication/azure-communication-identity/pom.xml index f9bfcea3d6b4..5bf01e2521b5 100644 --- a/sdk/communication/azure-communication-identity/pom.xml +++ b/sdk/communication/azure-communication-identity/pom.xml @@ -68,7 +68,7 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 org.junit.jupiter diff --git a/sdk/communication/azure-communication-jobrouter/pom.xml b/sdk/communication/azure-communication-jobrouter/pom.xml index d159661e17af..7e314dd360f1 100644 --- a/sdk/communication/azure-communication-jobrouter/pom.xml +++ b/sdk/communication/azure-communication-jobrouter/pom.xml @@ -57,7 +57,7 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 io.projectreactor diff --git a/sdk/communication/azure-communication-networktraversal/pom.xml b/sdk/communication/azure-communication-networktraversal/pom.xml index 7538626edf93..0a8fac524ec0 100644 --- a/sdk/communication/azure-communication-networktraversal/pom.xml +++ b/sdk/communication/azure-communication-networktraversal/pom.xml @@ -66,7 +66,7 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 org.junit.jupiter @@ -119,7 +119,7 @@ com.azure azure-communication-identity - 1.4.9 + 1.4.10 test diff --git a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md index 5f97d4971f54..5ed2fc13492c 100644 --- a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md +++ b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.1.6 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-communication-common` from `1.2.11` to version `1.2.12`. + ## 1.1.5 (2023-08-18) ### Other Changes diff --git a/sdk/communication/azure-communication-phonenumbers/pom.xml b/sdk/communication/azure-communication-phonenumbers/pom.xml index eee9ef1296cb..ec01431650b6 100644 --- a/sdk/communication/azure-communication-phonenumbers/pom.xml +++ b/sdk/communication/azure-communication-phonenumbers/pom.xml @@ -68,7 +68,7 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 org.junit.jupiter diff --git a/sdk/communication/azure-communication-rooms/CHANGELOG.md b/sdk/communication/azure-communication-rooms/CHANGELOG.md index 1c26d49fe131..6b22a6e8c9fe 100644 --- a/sdk/communication/azure-communication-rooms/CHANGELOG.md +++ b/sdk/communication/azure-communication-rooms/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.0.4 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-communication-common` from `1.2.11` to version `1.2.12`. + ## 1.0.3 (2023-08-18) ### Other Changes diff --git a/sdk/communication/azure-communication-rooms/pom.xml b/sdk/communication/azure-communication-rooms/pom.xml index 42d951b58bde..8239fabce04d 100644 --- a/sdk/communication/azure-communication-rooms/pom.xml +++ b/sdk/communication/azure-communication-rooms/pom.xml @@ -64,12 +64,12 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 com.azure azure-communication-identity - 1.4.9 + 1.4.10 test diff --git a/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsAsyncClientTests.java b/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsAsyncClientTests.java index e7448303d492..ad1ab67b793c 100644 --- a/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsAsyncClientTests.java +++ b/sdk/communication/azure-communication-rooms/src/test/java/com/azure/communication/rooms/RoomsAsyncClientTests.java @@ -131,7 +131,7 @@ public void createRoomFullCycleWithOutResponseStep(HttpClient httpClient) { StepVerifier.create(response3) .assertNext(result3 -> { - assertEquals(true, result3.getValidUntil().toEpochSecond() > VALID_FROM.toEpochSecond()); + assertEquals(true, result3.getValidUntil().toEpochSecond() > result3.getValidFrom().toEpochSecond()); }).verifyComplete(); Mono response4 = roomsAsyncClient.getRoom(roomId); diff --git a/sdk/communication/azure-communication-sms/CHANGELOG.md b/sdk/communication/azure-communication-sms/CHANGELOG.md index 59606b74ab23..a2a7eb88bedb 100644 --- a/sdk/communication/azure-communication-sms/CHANGELOG.md +++ b/sdk/communication/azure-communication-sms/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.1.17 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-communication-common` from `1.2.11` to version `1.2.12`. + ## 1.1.16 (2023-08-18) ### Other Changes diff --git a/sdk/communication/azure-communication-sms/pom.xml b/sdk/communication/azure-communication-sms/pom.xml index 612cac00a97b..6238383a2c34 100644 --- a/sdk/communication/azure-communication-sms/pom.xml +++ b/sdk/communication/azure-communication-sms/pom.xml @@ -59,7 +59,7 @@ com.azure azure-communication-common - 1.2.11 + 1.2.12 com.azure diff --git a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md index 570f6db94a48..560d1aa4f071 100644 --- a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md +++ b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 2.1.0-beta.1 (Unreleased) +## 2.1.0-beta.2 (Unreleased) ### Features Added @@ -10,6 +10,35 @@ ### Other Changes +## 2.1.0-beta.1 (2023-09-18) + +- Azure Resource Manager Communication client library for Java. This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-preview-2023-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Features Added + +* `models.ManagedServiceIdentityType` was added + +* `models.ManagedServiceIdentity` was added + +* `models.UserAssignedIdentity` was added + +#### `models.CommunicationServiceResource$Update` was modified + +* `withIdentity(models.ManagedServiceIdentity)` was added + +#### `models.CommunicationServiceResource$Definition` was modified + +* `withIdentity(models.ManagedServiceIdentity)` was added + +#### `models.CommunicationServiceResourceUpdate` was modified + +* `identity()` was added +* `withIdentity(models.ManagedServiceIdentity)` was added + +#### `models.CommunicationServiceResource` was modified + +* `identity()` was added + ## 2.0.0 (2023-04-03) - Azure Resource Manager Communication client library for Java. This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-2023-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/communication/azure-resourcemanager-communication/README.md b/sdk/communication/azure-resourcemanager-communication/README.md index 4537b54f2822..21a361580f7e 100644 --- a/sdk/communication/azure-resourcemanager-communication/README.md +++ b/sdk/communication/azure-resourcemanager-communication/README.md @@ -2,7 +2,7 @@ Azure Resource Manager Communication client library for Java. -This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-2023-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-preview-2023-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-communication - 2.0.0 + 2.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -103,3 +103,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcommunication%2Fazure-resourcemanager-communication%2FREADME.png) diff --git a/sdk/communication/azure-resourcemanager-communication/SAMPLE.md b/sdk/communication/azure-resourcemanager-communication/SAMPLE.md index bd3b4e56097e..9917653680fd 100644 --- a/sdk/communication/azure-resourcemanager-communication/SAMPLE.md +++ b/sdk/communication/azure-resourcemanager-communication/SAMPLE.md @@ -52,7 +52,7 @@ import com.azure.resourcemanager.communication.models.NameAvailabilityParameters /** Samples for CommunicationServices CheckNameAvailability. */ public final class CommunicationServicesCheckNameAvailabilitySamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/checkNameAvailabilityAvailable.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/checkNameAvailabilityAvailable.json */ /** * Sample code: Check name availability available. @@ -71,7 +71,7 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { } /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/checkNameAvailabilityUnavailable.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/checkNameAvailabilityUnavailable.json */ /** * Sample code: Check name availability unavailable. @@ -94,10 +94,13 @@ public final class CommunicationServicesCheckNameAvailabilitySamples { ### CommunicationServices_CreateOrUpdate ```java +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; + /** Samples for CommunicationServices CreateOrUpdate. */ public final class CommunicationServicesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/createOrUpdate.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdate.json */ /** * Sample code: Create or update resource. @@ -113,6 +116,26 @@ public final class CommunicationServicesCreateOrUpdateSamples { .withDataLocation("United States") .create(); } + + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdateWithSystemAssignedIdentity.json + */ + /** + * Sample code: Create or update resource with managed identity. + * + * @param manager Entry point to CommunicationManager. + */ + public static void createOrUpdateResourceWithManagedIdentity( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager + .communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .withDataLocation("United States") + .create(); + } } ``` @@ -122,7 +145,7 @@ public final class CommunicationServicesCreateOrUpdateSamples { /** Samples for CommunicationServices Delete. */ public final class CommunicationServicesDeleteSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/delete.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/delete.json */ /** * Sample code: Delete resource. @@ -143,7 +166,7 @@ public final class CommunicationServicesDeleteSamples { /** Samples for CommunicationServices GetByResourceGroup. */ public final class CommunicationServicesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/get.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json */ /** * Sample code: Get resource. @@ -167,7 +190,7 @@ import com.azure.resourcemanager.communication.models.LinkNotificationHubParamet /** Samples for CommunicationServices LinkNotificationHub. */ public final class CommunicationServicesLinkNotificationHubSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/linkNotificationHub.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/linkNotificationHub.json */ /** * Sample code: Link notification hub. @@ -195,7 +218,7 @@ public final class CommunicationServicesLinkNotificationHubSamples { /** Samples for CommunicationServices List. */ public final class CommunicationServicesListSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/listBySubscription.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listBySubscription.json */ /** * Sample code: List by subscription. @@ -214,7 +237,7 @@ public final class CommunicationServicesListSamples { /** Samples for CommunicationServices ListByResourceGroup. */ public final class CommunicationServicesListByResourceGroupSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/listByResourceGroup.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listByResourceGroup.json */ /** * Sample code: List by resource group. @@ -233,7 +256,7 @@ public final class CommunicationServicesListByResourceGroupSamples { /** Samples for CommunicationServices ListKeys. */ public final class CommunicationServicesListKeysSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/listKeys.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listKeys.json */ /** * Sample code: List keys. @@ -257,7 +280,7 @@ import com.azure.resourcemanager.communication.models.RegenerateKeyParameters; /** Samples for CommunicationServices RegenerateKey. */ public final class CommunicationServicesRegenerateKeySamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/regenerateKey.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/regenerateKey.json */ /** * Sample code: Regenerate key. @@ -280,13 +303,16 @@ public final class CommunicationServicesRegenerateKeySamples { ```java import com.azure.resourcemanager.communication.models.CommunicationServiceResource; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.HashMap; import java.util.Map; /** Samples for CommunicationServices Update. */ public final class CommunicationServicesUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/update.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/update.json */ /** * Sample code: Update resource. @@ -303,6 +329,105 @@ public final class CommunicationServicesUpdateSamples { resource.update().withTags(mapOf("newTag", "newVal")).apply(); } + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateWithUserAssignedIdentity.json + */ + /** + * Sample code: Update resource to add a User Assigned managed identity. + * + * @param manager Entry point to CommunicationManager. + */ + public static void updateResourceToAddAUserAssignedManagedIdentity( + com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = + manager + .communicationServices() + .getByResourceGroupWithResponse( + "MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity()))) + .apply(); + } + + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateWithSystemAssignedIdentity.json + */ + /** + * Sample code: Update resource to add a System Assigned managed identity. + * + * @param manager Entry point to CommunicationManager. + */ + public static void updateResourceToAddASystemAssignedManagedIdentity( + com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = + manager + .communicationServices() + .getByResourceGroupWithResponse( + "MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .apply(); + } + + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateRemoveSystemIdentity.json + */ + /** + * Sample code: Update resource to remove identity. + * + * @param manager Entry point to CommunicationManager. + */ + public static void updateResourceToRemoveIdentity( + com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = + manager + .communicationServices() + .getByResourceGroupWithResponse( + "MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)) + .apply(); + } + + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateWithSystemAndUserIdentity.json + */ + /** + * Sample code: Update resource to add System and User managed identities. + * + * @param manager Entry point to CommunicationManager. + */ + public static void updateResourceToAddSystemAndUserManagedIdentities( + com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = + manager + .communicationServices() + .getByResourceGroupWithResponse( + "MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity()))) + .apply(); + } + + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -325,7 +450,7 @@ import com.azure.resourcemanager.communication.models.VerificationType; /** Samples for Domains CancelVerification. */ public final class DomainsCancelVerificationSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/cancelVerification.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/cancelVerification.json */ /** * Sample code: Cancel verification. @@ -353,7 +478,7 @@ import com.azure.resourcemanager.communication.models.DomainManagement; /** Samples for Domains CreateOrUpdate. */ public final class DomainsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/createOrUpdate.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/createOrUpdate.json */ /** * Sample code: Create or update Domains resource. @@ -379,7 +504,7 @@ public final class DomainsCreateOrUpdateSamples { /** Samples for Domains Delete. */ public final class DomainsDeleteSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/delete.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/delete.json */ /** * Sample code: Delete Domains resource. @@ -400,7 +525,7 @@ public final class DomainsDeleteSamples { /** Samples for Domains Get. */ public final class DomainsGetSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/get.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json */ /** * Sample code: Get Domains resource. @@ -425,7 +550,7 @@ import com.azure.resourcemanager.communication.models.VerificationType; /** Samples for Domains InitiateVerification. */ public final class DomainsInitiateVerificationSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/initiateVerification.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/initiateVerification.json */ /** * Sample code: Initiate verification. @@ -451,7 +576,7 @@ public final class DomainsInitiateVerificationSamples { /** Samples for Domains ListByEmailServiceResource. */ public final class DomainsListByEmailServiceResourceSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/listByEmailService.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/listByEmailService.json */ /** * Sample code: List Domains resources by EmailServiceName. @@ -476,7 +601,7 @@ import com.azure.resourcemanager.communication.models.UserEngagementTracking; /** Samples for Domains Update. */ public final class DomainsUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/update.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/update.json */ /** * Sample code: Update Domains resource. @@ -501,7 +626,7 @@ public final class DomainsUpdateSamples { /** Samples for EmailServices CreateOrUpdate. */ public final class EmailServicesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/createOrUpdate.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/createOrUpdate.json */ /** * Sample code: Create or update EmailService resource. @@ -527,7 +652,7 @@ public final class EmailServicesCreateOrUpdateSamples { /** Samples for EmailServices Delete. */ public final class EmailServicesDeleteSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/delete.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/delete.json */ /** * Sample code: Delete EmailService resource. @@ -547,7 +672,7 @@ public final class EmailServicesDeleteSamples { /** Samples for EmailServices GetByResourceGroup. */ public final class EmailServicesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/get.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json */ /** * Sample code: Get EmailService resource. @@ -569,7 +694,7 @@ public final class EmailServicesGetByResourceGroupSamples { /** Samples for EmailServices List. */ public final class EmailServicesListSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/listBySubscription.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/listBySubscription.json */ /** * Sample code: List EmailService resources by subscription. @@ -589,7 +714,7 @@ public final class EmailServicesListSamples { /** Samples for EmailServices ListByResourceGroup. */ public final class EmailServicesListByResourceGroupSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/listByResourceGroup.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/listByResourceGroup.json */ /** * Sample code: List EmailService resources by resource group. @@ -609,7 +734,7 @@ public final class EmailServicesListByResourceGroupSamples { /** Samples for EmailServices ListVerifiedExchangeOnlineDomains. */ public final class EmailServicesListVerifiedExchangeOnlineDomainsSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/getVerifiedExchangeOnlineDomains.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/getVerifiedExchangeOnlineDomains.json */ /** * Sample code: Get verified Exchange Online domains. @@ -633,7 +758,7 @@ import java.util.Map; /** Samples for EmailServices Update. */ public final class EmailServicesUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/update.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/update.json */ /** * Sample code: Update EmailService resource. @@ -651,6 +776,7 @@ public final class EmailServicesUpdateSamples { resource.update().withTags(mapOf("newTag", "newVal")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -670,7 +796,7 @@ public final class EmailServicesUpdateSamples { /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/operationsList.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/operationsList.json */ /** * Sample code: Operations_List. @@ -689,7 +815,7 @@ public final class OperationsListSamples { /** Samples for SenderUsernames CreateOrUpdate. */ public final class SenderUsernamesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/createOrUpdate.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/createOrUpdate.json */ /** * Sample code: Create or update SenderUsernames resource. @@ -715,7 +841,7 @@ public final class SenderUsernamesCreateOrUpdateSamples { /** Samples for SenderUsernames Delete. */ public final class SenderUsernamesDeleteSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/delete.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/delete.json */ /** * Sample code: Delete SenderUsernames resource. @@ -742,7 +868,7 @@ public final class SenderUsernamesDeleteSamples { /** Samples for SenderUsernames Get. */ public final class SenderUsernamesGetSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/get.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json */ /** * Sample code: Get SenderUsernames resource. @@ -769,7 +895,7 @@ public final class SenderUsernamesGetSamples { /** Samples for SenderUsernames ListByDomains. */ public final class SenderUsernamesListByDomainsSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/listByDomain.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/listByDomain.json */ /** * Sample code: Get SenderUsernames resource. diff --git a/sdk/communication/azure-resourcemanager-communication/pom.xml b/sdk/communication/azure-resourcemanager-communication/pom.xml index a25ff39a67e2..4ad93306775d 100644 --- a/sdk/communication/azure-resourcemanager-communication/pom.xml +++ b/sdk/communication/azure-resourcemanager-communication/pom.xml @@ -14,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-communication - 2.1.0-beta.1 + 2.1.0-beta.2 jar Microsoft Azure SDK for Communication Management - This package contains Microsoft Azure SDK for Communication Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure Communication Services. Package tag package-2023-03. + This package contains Microsoft Azure SDK for Communication Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure Communication Services. Package tag package-preview-2023-04. https://github.com/Azure/azure-sdk-for-java @@ -45,6 +45,7 @@ UTF-8 0 0 + true diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java index 4d58952e1db4..fe96d60bc73f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java @@ -219,7 +219,7 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil .append("-") .append("com.azure.resourcemanager.communication") .append("/") - .append("2.0.0"); + .append("2.1.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -337,8 +337,10 @@ public SenderUsernames senderUsernames() { } /** - * @return Wrapped service client CommunicationServiceManagementClient providing direct access to the underlying - * auto-generated API implementation, based on Azure REST API. + * Gets wrapped service client CommunicationServiceManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client CommunicationServiceManagementClient. */ public CommunicationServiceManagementClient serviceClient() { return this.clientObject; diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java index f303a26c9ddb..14ffe2908d60 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java @@ -8,6 +8,7 @@ import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.resourcemanager.communication.models.CommunicationServicesProvisioningState; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map; @@ -21,6 +22,12 @@ public final class CommunicationServiceResourceInner extends Resource { @JsonProperty(value = "properties") private CommunicationServiceProperties innerProperties; + /* + * Managed service identity (system assigned and/or user assigned identities) + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ @@ -40,6 +47,26 @@ private CommunicationServiceProperties innerProperties() { return this.innerProperties; } + /** + * Get the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @param identity the identity value to set. + * @return the CommunicationServiceResourceInner object itself. + */ + public CommunicationServiceResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + /** * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * @@ -164,5 +191,8 @@ public void validate() { if (innerProperties() != null) { innerProperties().validate(); } + if (identity() != null) { + identity().validate(); + } } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientBuilder.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientBuilder.java index 2e621875f8cf..97e0aaf0fd96 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientBuilder.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientBuilder.java @@ -137,7 +137,7 @@ public CommunicationServiceManagementClientImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java index d327e7da8011..57298f86a783 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java @@ -194,7 +194,7 @@ public SenderUsernamesClient getSenderUsernames() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2023-03-31"; + this.apiVersion = "2023-04-01-preview"; this.operations = new OperationsClientImpl(this); this.communicationServices = new CommunicationServicesClientImpl(this); this.domains = new DomainsClientImpl(this); diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java index 393671ddd6a5..f59b6a0091b9 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java @@ -15,6 +15,7 @@ import com.azure.resourcemanager.communication.models.CommunicationServicesProvisioningState; import com.azure.resourcemanager.communication.models.LinkNotificationHubParameters; import com.azure.resourcemanager.communication.models.LinkedNotificationHub; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; import com.azure.resourcemanager.communication.models.RegenerateKeyParameters; import java.util.Collections; import java.util.List; @@ -53,6 +54,10 @@ public Map tags() { } } + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + public SystemData systemData() { return this.innerModel().systemData(); } @@ -255,6 +260,16 @@ public CommunicationServiceResourceImpl withTags(Map tags) { } } + public CommunicationServiceResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + public CommunicationServiceResourceImpl withDataLocation(String dataLocation) { this.innerModel().withDataLocation(dataLocation); return this; diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java index 7cc8668c737e..b83abee9a041 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java @@ -49,6 +49,13 @@ public interface CommunicationServiceResource { */ Map tags(); + /** + * Gets the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + /** * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * @@ -141,11 +148,13 @@ interface Definition DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } + /** The CommunicationServiceResource definition stages. */ interface DefinitionStages { /** The first stage of the CommunicationServiceResource definition. */ interface Blank extends WithLocation { } + /** The stage of the CommunicationServiceResource definition allowing to specify location. */ interface WithLocation { /** @@ -164,6 +173,7 @@ interface WithLocation { */ WithResourceGroup withRegion(String location); } + /** The stage of the CommunicationServiceResource definition allowing to specify parent resource. */ interface WithResourceGroup { /** @@ -174,12 +184,16 @@ interface WithResourceGroup { */ WithCreate withExistingResourceGroup(String resourceGroupName); } + /** * The stage of the CommunicationServiceResource definition which contains all the minimum required properties * for the resource to be created, but also allows for any other optional properties to be specified. */ interface WithCreate - extends DefinitionStages.WithTags, DefinitionStages.WithDataLocation, DefinitionStages.WithLinkedDomains { + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithDataLocation, + DefinitionStages.WithLinkedDomains { /** * Executes the create request. * @@ -195,6 +209,7 @@ interface WithCreate */ CommunicationServiceResource create(Context context); } + /** The stage of the CommunicationServiceResource definition allowing to specify tags. */ interface WithTags { /** @@ -205,6 +220,19 @@ interface WithTags { */ WithCreate withTags(Map tags); } + + /** The stage of the CommunicationServiceResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed service identity (system assigned and/or user assigned + * identities). + * + * @param identity Managed service identity (system assigned and/or user assigned identities). + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the CommunicationServiceResource definition allowing to specify dataLocation. */ interface WithDataLocation { /** @@ -216,6 +244,7 @@ interface WithDataLocation { */ WithCreate withDataLocation(String dataLocation); } + /** The stage of the CommunicationServiceResource definition allowing to specify linkedDomains. */ interface WithLinkedDomains { /** @@ -227,6 +256,7 @@ interface WithLinkedDomains { WithCreate withLinkedDomains(List linkedDomains); } } + /** * Begins update for the CommunicationServiceResource resource. * @@ -235,7 +265,7 @@ interface WithLinkedDomains { CommunicationServiceResource.Update update(); /** The template for CommunicationServiceResource update. */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithLinkedDomains { + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithLinkedDomains { /** * Executes the update request. * @@ -251,6 +281,7 @@ interface Update extends UpdateStages.WithTags, UpdateStages.WithLinkedDomains { */ CommunicationServiceResource apply(Context context); } + /** The CommunicationServiceResource update stages. */ interface UpdateStages { /** The stage of the CommunicationServiceResource update allowing to specify tags. */ @@ -264,6 +295,19 @@ interface WithTags { */ Update withTags(Map tags); } + + /** The stage of the CommunicationServiceResource update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed service identity (system assigned and/or user assigned + * identities). + * + * @param identity Managed service identity (system assigned and/or user assigned identities). + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the CommunicationServiceResource update allowing to specify linkedDomains. */ interface WithLinkedDomains { /** @@ -275,6 +319,7 @@ interface WithLinkedDomains { Update withLinkedDomains(List linkedDomains); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java index c7079d69d458..c3bd658038fc 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceUpdate.java @@ -19,6 +19,12 @@ public final class CommunicationServiceResourceUpdate extends TaggedResource { @JsonProperty(value = "properties") private CommunicationServiceUpdateProperties innerProperties; + /* + * Managed service identity (system assigned and/or user assigned identities) + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + /** Creates an instance of CommunicationServiceResourceUpdate class. */ public CommunicationServiceResourceUpdate() { } @@ -32,6 +38,26 @@ private CommunicationServiceUpdateProperties innerProperties() { return this.innerProperties; } + /** + * Get the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @param identity the identity value to set. + * @return the CommunicationServiceResourceUpdate object itself. + */ + public CommunicationServiceResourceUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + /** {@inheritDoc} */ @Override public CommunicationServiceResourceUpdate withTags(Map tags) { @@ -73,5 +99,8 @@ public void validate() { if (innerProperties() != null) { innerProperties().validate(); } + if (identity() != null) { + identity().validate(); + } } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainResource.java index f598f87076fd..7b7a3359fd1f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainResource.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/DomainResource.java @@ -145,11 +145,13 @@ interface Definition DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The DomainResource definition stages. */ interface DefinitionStages { /** The first stage of the DomainResource definition. */ interface Blank extends WithLocation { } + /** The stage of the DomainResource definition allowing to specify location. */ interface WithLocation { /** @@ -168,6 +170,7 @@ interface WithLocation { */ WithParentResource withRegion(String location); } + /** The stage of the DomainResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -179,6 +182,7 @@ interface WithParentResource { */ WithCreate withExistingEmailService(String resourceGroupName, String emailServiceName); } + /** * The stage of the DomainResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -202,6 +206,7 @@ interface WithCreate */ DomainResource create(Context context); } + /** The stage of the DomainResource definition allowing to specify tags. */ interface WithTags { /** @@ -212,6 +217,7 @@ interface WithTags { */ WithCreate withTags(Map tags); } + /** The stage of the DomainResource definition allowing to specify domainManagement. */ interface WithDomainManagement { /** @@ -222,6 +228,7 @@ interface WithDomainManagement { */ WithCreate withDomainManagement(DomainManagement domainManagement); } + /** The stage of the DomainResource definition allowing to specify userEngagementTracking. */ interface WithUserEngagementTracking { /** @@ -234,6 +241,7 @@ interface WithUserEngagementTracking { WithCreate withUserEngagementTracking(UserEngagementTracking userEngagementTracking); } } + /** * Begins update for the DomainResource resource. * @@ -258,6 +266,7 @@ interface Update extends UpdateStages.WithTags, UpdateStages.WithUserEngagementT */ DomainResource apply(Context context); } + /** The DomainResource update stages. */ interface UpdateStages { /** The stage of the DomainResource update allowing to specify tags. */ @@ -271,6 +280,7 @@ interface WithTags { */ Update withTags(Map tags); } + /** The stage of the DomainResource update allowing to specify userEngagementTracking. */ interface WithUserEngagementTracking { /** @@ -283,6 +293,7 @@ interface WithUserEngagementTracking { Update withUserEngagementTracking(UserEngagementTracking userEngagementTracking); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResource.java index 13b1000f4510..c653c6c888df 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResource.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/EmailServiceResource.java @@ -103,11 +103,13 @@ interface Definition DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } + /** The EmailServiceResource definition stages. */ interface DefinitionStages { /** The first stage of the EmailServiceResource definition. */ interface Blank extends WithLocation { } + /** The stage of the EmailServiceResource definition allowing to specify location. */ interface WithLocation { /** @@ -126,6 +128,7 @@ interface WithLocation { */ WithResourceGroup withRegion(String location); } + /** The stage of the EmailServiceResource definition allowing to specify parent resource. */ interface WithResourceGroup { /** @@ -136,6 +139,7 @@ interface WithResourceGroup { */ WithCreate withExistingResourceGroup(String resourceGroupName); } + /** * The stage of the EmailServiceResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -156,6 +160,7 @@ interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithDat */ EmailServiceResource create(Context context); } + /** The stage of the EmailServiceResource definition allowing to specify tags. */ interface WithTags { /** @@ -166,6 +171,7 @@ interface WithTags { */ WithCreate withTags(Map tags); } + /** The stage of the EmailServiceResource definition allowing to specify dataLocation. */ interface WithDataLocation { /** @@ -177,6 +183,7 @@ interface WithDataLocation { WithCreate withDataLocation(String dataLocation); } } + /** * Begins update for the EmailServiceResource resource. * @@ -201,6 +208,7 @@ interface Update extends UpdateStages.WithTags { */ EmailServiceResource apply(Context context); } + /** The EmailServiceResource update stages. */ interface UpdateStages { /** The stage of the EmailServiceResource update allowing to specify tags. */ @@ -215,6 +223,7 @@ interface WithTags { Update withTags(Map tags); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentity.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..9325a9bc0178 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentity.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Managed service identity (system assigned and/or user assigned identities). */ +@Fluent +public final class ManagedServiceIdentity { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys + * will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** Creates an instance of ManagedServiceIdentity class. */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentityType.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..c90c7855684f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ManagedServiceIdentityType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** Static value None for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = + fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SenderUsernameResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SenderUsernameResource.java index 40a600621d91..36487a7fd938 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SenderUsernameResource.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/SenderUsernameResource.java @@ -85,11 +85,13 @@ public interface SenderUsernameResource { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The SenderUsernameResource definition stages. */ interface DefinitionStages { /** The first stage of the SenderUsernameResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the SenderUsernameResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -102,6 +104,7 @@ interface WithParentResource { */ WithCreate withExistingDomain(String resourceGroupName, String emailServiceName, String domainName); } + /** * The stage of the SenderUsernameResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -122,6 +125,7 @@ interface WithCreate extends DefinitionStages.WithUsername, DefinitionStages.Wit */ SenderUsernameResource create(Context context); } + /** The stage of the SenderUsernameResource definition allowing to specify username. */ interface WithUsername { /** @@ -132,6 +136,7 @@ interface WithUsername { */ WithCreate withUsername(String username); } + /** The stage of the SenderUsernameResource definition allowing to specify displayName. */ interface WithDisplayName { /** @@ -143,6 +148,7 @@ interface WithDisplayName { WithCreate withDisplayName(String displayName); } } + /** * Begins update for the SenderUsernameResource resource. * @@ -167,6 +173,7 @@ interface Update extends UpdateStages.WithUsername, UpdateStages.WithDisplayName */ SenderUsernameResource apply(Context context); } + /** The SenderUsernameResource update stages. */ interface UpdateStages { /** The stage of the SenderUsernameResource update allowing to specify username. */ @@ -179,6 +186,7 @@ interface WithUsername { */ Update withUsername(String username); } + /** The stage of the SenderUsernameResource update allowing to specify displayName. */ interface WithDisplayName { /** @@ -190,6 +198,7 @@ interface WithDisplayName { Update withDisplayName(String displayName); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserAssignedIdentity.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..5cd6538ebbb3 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/UserAssignedIdentity.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** User assigned identity properties. */ +@Immutable +public final class UserAssignedIdentity { + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** Creates an instance of UserAssignedIdentity class. */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilitySamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilitySamples.java index 94d25eeb44ee..029494fa3a09 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilitySamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilitySamples.java @@ -9,7 +9,7 @@ /** Samples for CommunicationServices CheckNameAvailability. */ public final class CommunicationServicesCheckNameAvailabilitySamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/checkNameAvailabilityAvailable.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/checkNameAvailabilityAvailable.json */ /** * Sample code: Check name availability available. @@ -28,7 +28,7 @@ public static void checkNameAvailabilityAvailable( } /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/checkNameAvailabilityUnavailable.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/checkNameAvailabilityUnavailable.json */ /** * Sample code: Check name availability unavailable. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateSamples.java index 0094fee116b3..fe4c71d20555 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateSamples.java @@ -4,10 +4,13 @@ package com.azure.resourcemanager.communication.generated; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; + /** Samples for CommunicationServices CreateOrUpdate. */ public final class CommunicationServicesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/createOrUpdate.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdate.json */ /** * Sample code: Create or update resource. @@ -23,4 +26,24 @@ public static void createOrUpdateResource(com.azure.resourcemanager.communicatio .withDataLocation("United States") .create(); } + + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdateWithSystemAssignedIdentity.json + */ + /** + * Sample code: Create or update resource with managed identity. + * + * @param manager Entry point to CommunicationManager. + */ + public static void createOrUpdateResourceWithManagedIdentity( + com.azure.resourcemanager.communication.CommunicationManager manager) { + manager + .communicationServices() + .define("MyCommunicationResource") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .withDataLocation("United States") + .create(); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java index 8ac2049c40f7..03526ba4ed8e 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for CommunicationServices Delete. */ public final class CommunicationServicesDeleteSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/delete.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/delete.json */ /** * Sample code: Delete resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupSamples.java index ae2f31ce3496..865fb583db3a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for CommunicationServices GetByResourceGroup. */ public final class CommunicationServicesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/get.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json */ /** * Sample code: Get resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubSamples.java index 518ca5e3831b..89a42fe43155 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubSamples.java @@ -9,7 +9,7 @@ /** Samples for CommunicationServices LinkNotificationHub. */ public final class CommunicationServicesLinkNotificationHubSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/linkNotificationHub.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/linkNotificationHub.json */ /** * Sample code: Link notification hub. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupSamples.java index 615f4b7a44fa..cbf3e0e79823 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for CommunicationServices ListByResourceGroup. */ public final class CommunicationServicesListByResourceGroupSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/listByResourceGroup.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listByResourceGroup.json */ /** * Sample code: List by resource group. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListKeysSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListKeysSamples.java index af3882ca22ca..3a07133eb243 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListKeysSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListKeysSamples.java @@ -7,7 +7,7 @@ /** Samples for CommunicationServices ListKeys. */ public final class CommunicationServicesListKeysSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/listKeys.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listKeys.json */ /** * Sample code: List keys. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListSamples.java index 6eb24ffb78ec..2722680aea8e 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListSamples.java @@ -7,7 +7,7 @@ /** Samples for CommunicationServices List. */ public final class CommunicationServicesListSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/listBySubscription.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listBySubscription.json */ /** * Sample code: List by subscription. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesRegenerateKeySamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesRegenerateKeySamples.java index 70e7cb613a71..8f73c99425b4 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesRegenerateKeySamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesRegenerateKeySamples.java @@ -10,7 +10,7 @@ /** Samples for CommunicationServices RegenerateKey. */ public final class CommunicationServicesRegenerateKeySamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/regenerateKey.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/regenerateKey.json */ /** * Sample code: Regenerate key. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesUpdateSamples.java index efde62cb7f85..47518b1e908f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/CommunicationServicesUpdateSamples.java @@ -5,13 +5,16 @@ package com.azure.resourcemanager.communication.generated; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.HashMap; import java.util.Map; /** Samples for CommunicationServices Update. */ public final class CommunicationServicesUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/update.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/update.json */ /** * Sample code: Update resource. @@ -28,6 +31,105 @@ public static void updateResource(com.azure.resourcemanager.communication.Commun resource.update().withTags(mapOf("newTag", "newVal")).apply(); } + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateWithUserAssignedIdentity.json + */ + /** + * Sample code: Update resource to add a User Assigned managed identity. + * + * @param manager Entry point to CommunicationManager. + */ + public static void updateResourceToAddAUserAssignedManagedIdentity( + com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = + manager + .communicationServices() + .getByResourceGroupWithResponse( + "MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity()))) + .apply(); + } + + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateWithSystemAssignedIdentity.json + */ + /** + * Sample code: Update resource to add a System Assigned managed identity. + * + * @param manager Entry point to CommunicationManager. + */ + public static void updateResourceToAddASystemAssignedManagedIdentity( + com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = + manager + .communicationServices() + .getByResourceGroupWithResponse( + "MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .apply(); + } + + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateRemoveSystemIdentity.json + */ + /** + * Sample code: Update resource to remove identity. + * + * @param manager Entry point to CommunicationManager. + */ + public static void updateResourceToRemoveIdentity( + com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = + manager + .communicationServices() + .getByResourceGroupWithResponse( + "MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE)) + .apply(); + } + + /* + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateWithSystemAndUserIdentity.json + */ + /** + * Sample code: Update resource to add System and User managed identities. + * + * @param manager Entry point to CommunicationManager. + */ + public static void updateResourceToAddSystemAndUserManagedIdentities( + com.azure.resourcemanager.communication.CommunicationManager manager) { + CommunicationServiceResource resource = + manager + .communicationServices() + .getByResourceGroupWithResponse( + "MyResourceGroup", "MyCommunicationResource", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("newTag", "newVal")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("/user/assigned/resource/id", new UserAssignedIdentity()))) + .apply(); + } + + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCancelVerificationSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCancelVerificationSamples.java index b84913299349..cb65f097e16e 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCancelVerificationSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCancelVerificationSamples.java @@ -10,7 +10,7 @@ /** Samples for Domains CancelVerification. */ public final class DomainsCancelVerificationSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/cancelVerification.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/cancelVerification.json */ /** * Sample code: Cancel verification. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateSamples.java index cec0b6019325..41c82a11b7ce 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateSamples.java @@ -9,7 +9,7 @@ /** Samples for Domains CreateOrUpdate. */ public final class DomainsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/createOrUpdate.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/createOrUpdate.json */ /** * Sample code: Create or update Domains resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsDeleteSamples.java index 9f0530177b65..6d207259fdd8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsDeleteSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Domains Delete. */ public final class DomainsDeleteSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/delete.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/delete.json */ /** * Sample code: Delete Domains resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsGetSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsGetSamples.java index 71e1cc374e18..7251049c1f61 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsGetSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for Domains Get. */ public final class DomainsGetSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/get.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json */ /** * Sample code: Get Domains resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsInitiateVerificationSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsInitiateVerificationSamples.java index e372b6e96a3b..88e5072243b3 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsInitiateVerificationSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsInitiateVerificationSamples.java @@ -10,7 +10,7 @@ /** Samples for Domains InitiateVerification. */ public final class DomainsInitiateVerificationSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/initiateVerification.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/initiateVerification.json */ /** * Sample code: Initiate verification. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceSamples.java index 77b7a0a29083..71a1c6aef650 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceSamples.java @@ -7,7 +7,7 @@ /** Samples for Domains ListByEmailServiceResource. */ public final class DomainsListByEmailServiceResourceSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/listByEmailService.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/listByEmailService.json */ /** * Sample code: List Domains resources by EmailServiceName. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsUpdateSamples.java index da4491cb2aaf..8fac76f6b13c 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/DomainsUpdateSamples.java @@ -10,7 +10,7 @@ /** Samples for Domains Update. */ public final class DomainsUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/domains/update.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/update.json */ /** * Sample code: Update Domains resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateSamples.java index 62bca1596519..4f2dc248c864 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateSamples.java @@ -7,7 +7,7 @@ /** Samples for EmailServices CreateOrUpdate. */ public final class EmailServicesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/createOrUpdate.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/createOrUpdate.json */ /** * Sample code: Create or update EmailService resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteSamples.java index bb87e893d4bb..ec5f1d237a29 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for EmailServices Delete. */ public final class EmailServicesDeleteSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/delete.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/delete.json */ /** * Sample code: Delete EmailService resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupSamples.java index 354074777001..e32e5c02fa48 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for EmailServices GetByResourceGroup. */ public final class EmailServicesGetByResourceGroupSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/get.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json */ /** * Sample code: Get EmailService resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupSamples.java index 15403da56ebe..d1bc7f0b7d0c 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for EmailServices ListByResourceGroup. */ public final class EmailServicesListByResourceGroupSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/listByResourceGroup.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/listByResourceGroup.json */ /** * Sample code: List EmailService resources by resource group. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListSamples.java index e9be5022bab3..1886e863f883 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListSamples.java @@ -7,7 +7,7 @@ /** Samples for EmailServices List. */ public final class EmailServicesListSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/listBySubscription.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/listBySubscription.json */ /** * Sample code: List EmailService resources by subscription. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsSamples.java index fb4990f2c8aa..09dc58907269 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsSamples.java @@ -7,7 +7,7 @@ /** Samples for EmailServices ListVerifiedExchangeOnlineDomains. */ public final class EmailServicesListVerifiedExchangeOnlineDomainsSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/getVerifiedExchangeOnlineDomains.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/getVerifiedExchangeOnlineDomains.json */ /** * Sample code: Get verified Exchange Online domains. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesUpdateSamples.java index a4aa463e3197..00f4c9f2849f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/EmailServicesUpdateSamples.java @@ -11,7 +11,7 @@ /** Samples for EmailServices Update. */ public final class EmailServicesUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/emailServices/update.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/update.json */ /** * Sample code: Update EmailService resource. @@ -29,6 +29,7 @@ public static void updateEmailServiceResource( resource.update().withTags(mapOf("newTag", "newVal")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/OperationsListSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/OperationsListSamples.java index 78a43fc8327e..4be61c683661 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/OperationsListSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/OperationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/communicationServices/operationsList.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/operationsList.json */ /** * Sample code: Operations_List. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateSamples.java index 2d13fd6fbebf..ff2eb0b3edf0 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateSamples.java @@ -7,7 +7,7 @@ /** Samples for SenderUsernames CreateOrUpdate. */ public final class SenderUsernamesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/createOrUpdate.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/createOrUpdate.json */ /** * Sample code: Create or update SenderUsernames resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteSamples.java index bc0b61fe67af..f07acf600599 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for SenderUsernames Delete. */ public final class SenderUsernamesDeleteSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/delete.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/delete.json */ /** * Sample code: Delete SenderUsernames resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetSamples.java index cf5f4d1cce8b..e2730eca8ed6 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for SenderUsernames Get. */ public final class SenderUsernamesGetSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/get.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json */ /** * Sample code: Get SenderUsernames resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsSamples.java b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsSamples.java index 939a62d48a91..a8d26515d24b 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsSamples.java +++ b/sdk/communication/azure-resourcemanager-communication/src/samples/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsSamples.java @@ -7,7 +7,7 @@ /** Samples for SenderUsernames ListByDomains. */ public final class SenderUsernamesListByDomainsSamples { /* - * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2023-03-31/examples/senderUsernames/listByDomain.json + * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/listByDomain.json */ /** * Sample code: Get SenderUsernames resource. diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java index 0a7918d5a26b..ff5bac3ab6c6 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicePropertiesTests.java @@ -15,20 +15,20 @@ public void testDeserialize() throws Exception { CommunicationServiceProperties model = BinaryData .fromString( - "{\"provisioningState\":\"Unknown\",\"hostName\":\"kjfkg\",\"dataLocation\":\"awxklr\",\"notificationHubId\":\"lwckbasyypnddhs\",\"version\":\"bacphejko\",\"immutableResourceId\":\"nqgoulzndli\",\"linkedDomains\":[\"qkgfgibma\",\"gakeqsr\"]}") + "{\"provisioningState\":\"Running\",\"hostName\":\"cuertu\",\"dataLocation\":\"kdosvqw\",\"notificationHubId\":\"mdgbbjfdd\",\"version\":\"bmbexppbhtqqro\",\"immutableResourceId\":\"p\",\"linkedDomains\":[\"algbquxigjyjg\"]}") .toObject(CommunicationServiceProperties.class); - Assertions.assertEquals("awxklr", model.dataLocation()); - Assertions.assertEquals("qkgfgibma", model.linkedDomains().get(0)); + Assertions.assertEquals("kdosvqw", model.dataLocation()); + Assertions.assertEquals("algbquxigjyjg", model.linkedDomains().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CommunicationServiceProperties model = new CommunicationServiceProperties() - .withDataLocation("awxklr") - .withLinkedDomains(Arrays.asList("qkgfgibma", "gakeqsr")); + .withDataLocation("kdosvqw") + .withLinkedDomains(Arrays.asList("algbquxigjyjg")); model = BinaryData.fromObject(model).toObject(CommunicationServiceProperties.class); - Assertions.assertEquals("awxklr", model.dataLocation()); - Assertions.assertEquals("qkgfgibma", model.linkedDomains().get(0)); + Assertions.assertEquals("kdosvqw", model.dataLocation()); + Assertions.assertEquals("algbquxigjyjg", model.linkedDomains().get(0)); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java index 0bd0966dface..84b8ff93b936 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceInnerTests.java @@ -6,6 +6,9 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -17,29 +20,43 @@ public void testDeserialize() throws Exception { CommunicationServiceResourceInner model = BinaryData .fromString( - "{\"properties\":{\"provisioningState\":\"Moving\",\"hostName\":\"xxwr\",\"dataLocation\":\"jdous\",\"notificationHubId\":\"qvkoc\",\"version\":\"jdkwtnhxbnjb\",\"immutableResourceId\":\"sqrglssainq\",\"linkedDomains\":[\"nzl\",\"jfm\",\"pee\",\"vmgxsab\"]},\"location\":\"qduujitcjczdz\",\"tags\":{\"wrwjfeu\":\"dhkrwpdappdsbdk\",\"zdatqxhocdg\":\"nhutjeltmrldhugj\"},\"id\":\"ablgphuticndvk\",\"name\":\"ozwyiftyhxhuro\",\"type\":\"ftyxolniw\"}") + "{\"properties\":{\"provisioningState\":\"Updating\",\"hostName\":\"ljfmppee\",\"dataLocation\":\"vmgxsab\",\"notificationHubId\":\"qduujitcjczdz\",\"version\":\"ndhkrw\",\"immutableResourceId\":\"appd\",\"linkedDomains\":[\"kvwrwjfeu\",\"nhutjeltmrldhugj\",\"zdatqxhocdg\"]},\"identity\":{\"principalId\":\"8f41afc7-82c6-4885-a85a-61e476cf754d\",\"tenantId\":\"a2d8ceae-8082-4a91-88ee-303d2794b921\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"icndvkaozwyifty\":{\"principalId\":\"90b9f918-b083-4dff-87f5-4b362457d535\",\"clientId\":\"05d0eefd-38bc-447a-853b-a7960ecf3666\"},\"urokft\":{\"principalId\":\"000a6bec-29fe-46b8-b3b8-eb6e5d400511\",\"clientId\":\"1f529f8e-fa07-4825-bdb2-184613f70ba7\"},\"lniwpwcukjfkgiaw\":{\"principalId\":\"87abf4e7-9a4e-44ff-9408-a9687db4348d\",\"clientId\":\"f16a9c69-28df-4d02-852e-198915fb7c91\"}}},\"location\":\"lryplwckbasyy\",\"tags\":{\"phejkotynqgoulz\":\"dhsgcba\",\"gakeqsr\":\"dlikwyqkgfgibma\",\"qqedqytbciqfou\":\"yb\"},\"id\":\"lmmnkzsmodmglo\",\"name\":\"gpbkwtmut\",\"type\":\"uqktap\"}") .toObject(CommunicationServiceResourceInner.class); - Assertions.assertEquals("qduujitcjczdz", model.location()); - Assertions.assertEquals("dhkrwpdappdsbdk", model.tags().get("wrwjfeu")); - Assertions.assertEquals("jdous", model.dataLocation()); - Assertions.assertEquals("nzl", model.linkedDomains().get(0)); + Assertions.assertEquals("lryplwckbasyy", model.location()); + Assertions.assertEquals("dhsgcba", model.tags().get("phejkotynqgoulz")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); + Assertions.assertEquals("vmgxsab", model.dataLocation()); + Assertions.assertEquals("kvwrwjfeu", model.linkedDomains().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CommunicationServiceResourceInner model = new CommunicationServiceResourceInner() - .withLocation("qduujitcjczdz") - .withTags(mapOf("wrwjfeu", "dhkrwpdappdsbdk", "zdatqxhocdg", "nhutjeltmrldhugj")) - .withDataLocation("jdous") - .withLinkedDomains(Arrays.asList("nzl", "jfm", "pee", "vmgxsab")); + .withLocation("lryplwckbasyy") + .withTags(mapOf("phejkotynqgoulz", "dhsgcba", "gakeqsr", "dlikwyqkgfgibma", "qqedqytbciqfou", "yb")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "icndvkaozwyifty", + new UserAssignedIdentity(), + "urokft", + new UserAssignedIdentity(), + "lniwpwcukjfkgiaw", + new UserAssignedIdentity()))) + .withDataLocation("vmgxsab") + .withLinkedDomains(Arrays.asList("kvwrwjfeu", "nhutjeltmrldhugj", "zdatqxhocdg")); model = BinaryData.fromObject(model).toObject(CommunicationServiceResourceInner.class); - Assertions.assertEquals("qduujitcjczdz", model.location()); - Assertions.assertEquals("dhkrwpdappdsbdk", model.tags().get("wrwjfeu")); - Assertions.assertEquals("jdous", model.dataLocation()); - Assertions.assertEquals("nzl", model.linkedDomains().get(0)); + Assertions.assertEquals("lryplwckbasyy", model.location()); + Assertions.assertEquals("dhsgcba", model.tags().get("phejkotynqgoulz")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); + Assertions.assertEquals("vmgxsab", model.dataLocation()); + Assertions.assertEquals("kvwrwjfeu", model.linkedDomains().get(0)); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java index 5e4447b99145..8f54d236ae06 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceListTests.java @@ -7,6 +7,9 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; import com.azure.resourcemanager.communication.models.CommunicationServiceResourceList; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -18,12 +21,16 @@ public void testDeserialize() throws Exception { CommunicationServiceResourceList model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"mkkvnip\",\"dataLocation\":\"oxzjnchgejspod\",\"notificationHubId\":\"ilzyd\",\"version\":\"o\",\"immutableResourceId\":\"yahux\",\"linkedDomains\":[]},\"location\":\"mqnjaqw\",\"tags\":{\"gjvw\":\"sprozvcput\",\"dvpjhulsuuvmk\":\"fdatsc\",\"jdpvwryo\":\"ozkrwfndiodjpslw\"},\"id\":\"psoacctazakljl\",\"name\":\"hbcryffdfdosyge\",\"type\":\"paojakhmsbzjh\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"hostName\":\"dphlxaolt\",\"dataLocation\":\"qtrgqjbpfzfsinzg\",\"notificationHubId\":\"cjrwzoxxjtfellu\",\"version\":\"zitonpeqfpjkjl\",\"immutableResourceId\":\"fpdvhpfxxypi\",\"linkedDomains\":[]},\"location\":\"mayhuybbkpodepoo\",\"tags\":{\"eotusivyevc\":\"uvamiheognarxzxt\",\"un\":\"iqihn\",\"fygxgispemvtzfk\":\"bwjzr\"},\"id\":\"fublj\",\"name\":\"fxqeof\",\"type\":\"aeqjhqjbasvms\"}],\"nextLink\":\"qulngsntnbybkzgc\"}") + "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"mkkvnip\",\"dataLocation\":\"oxzjnchgejspod\",\"notificationHubId\":\"ilzyd\",\"version\":\"o\",\"immutableResourceId\":\"yahux\",\"linkedDomains\":[\"mqnjaqw\",\"xj\"]},\"identity\":{\"principalId\":\"f3be8d2b-688a-43d4-b0e2-568d52bbf68a\",\"tenantId\":\"aa2f6424-5eb3-4ea7-969c-7b27078085de\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"tegjvwmf\":{\"principalId\":\"028d0a20-3f3a-4509-9709-5529c3345b41\",\"clientId\":\"2c276202-c35c-4e33-ae63-214905256dd0\"},\"scmdvpjhulsuu\":{\"principalId\":\"581132a1-2434-47f8-8fa2-25e765ff3802\",\"clientId\":\"a18b8111-ae79-467a-9d7f-4c4c7cee71d7\"},\"jozkrwfndiod\":{\"principalId\":\"9bc35d3d-b2dc-4d5f-bd41-e5226ab8f7f5\",\"clientId\":\"cd63bb0f-6d43-495b-ace0-bcda2cdbbbb2\"},\"lwejdpv\":{\"principalId\":\"bdf563b0-8e4a-4f95-8f71-753bded5109d\",\"clientId\":\"2514dd15-7058-4c25-8714-edd3d27603d3\"}}},\"location\":\"yoqpsoaccta\",\"tags\":{\"dfdosygexp\":\"ljlahbcryf\",\"dphlxaolt\":\"ojakhmsbzjhcrze\"},\"id\":\"qtrgqjbpfzfsinzg\",\"name\":\"f\",\"type\":\"jrwzox\"},{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"lluwfzitonpeq\",\"dataLocation\":\"pjkjlxofpdv\",\"notificationHubId\":\"fxxypininmayhuy\",\"version\":\"kpode\",\"immutableResourceId\":\"oginuvamiheognar\",\"linkedDomains\":[\"theotusiv\"]},\"identity\":{\"principalId\":\"bfc89781-93dd-40a1-a646-9945c48b3729\",\"tenantId\":\"31adea66-0d67-4d1e-886a-88f59f449d55\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"nhungbw\":{\"principalId\":\"5d2c90d7-d1df-4048-a4c4-b7bcae2baadd\",\"clientId\":\"684b20ec-8ac2-4eaa-91a3-429b08ee9873\"}}},\"location\":\"rnfygxgispem\",\"tags\":{\"fxqeof\":\"fkufublj\",\"jqul\":\"aeqjhqjbasvms\",\"clxxwrljdo\":\"gsntnbybkzgcwr\"},\"id\":\"skcqvkocrcjd\",\"name\":\"wtnhxbnjbiksqr\",\"type\":\"lssai\"}],\"nextLink\":\"p\"}") .toObject(CommunicationServiceResourceList.class); - Assertions.assertEquals("mqnjaqw", model.value().get(0).location()); - Assertions.assertEquals("sprozvcput", model.value().get(0).tags().get("gjvw")); + Assertions.assertEquals("yoqpsoaccta", model.value().get(0).location()); + Assertions.assertEquals("ljlahbcryf", model.value().get(0).tags().get("dfdosygexp")); + Assertions + .assertEquals( + ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.value().get(0).identity().type()); Assertions.assertEquals("oxzjnchgejspod", model.value().get(0).dataLocation()); - Assertions.assertEquals("qulngsntnbybkzgc", model.nextLink()); + Assertions.assertEquals("mqnjaqw", model.value().get(0).linkedDomains().get(0)); + Assertions.assertEquals("p", model.nextLink()); } @org.junit.jupiter.api.Test @@ -34,31 +41,47 @@ public void testSerialize() throws Exception { Arrays .asList( new CommunicationServiceResourceInner() - .withLocation("mqnjaqw") - .withTags( - mapOf( - "gjvw", - "sprozvcput", - "dvpjhulsuuvmk", - "fdatsc", - "jdpvwryo", - "ozkrwfndiodjpslw")) + .withLocation("yoqpsoaccta") + .withTags(mapOf("dfdosygexp", "ljlahbcryf", "dphlxaolt", "ojakhmsbzjhcrze")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "tegjvwmf", + new UserAssignedIdentity(), + "scmdvpjhulsuu", + new UserAssignedIdentity(), + "jozkrwfndiod", + new UserAssignedIdentity(), + "lwejdpv", + new UserAssignedIdentity()))) .withDataLocation("oxzjnchgejspod") - .withLinkedDomains(Arrays.asList()), + .withLinkedDomains(Arrays.asList("mqnjaqw", "xj")), new CommunicationServiceResourceInner() - .withLocation("mayhuybbkpodepoo") + .withLocation("rnfygxgispem") .withTags( - mapOf("eotusivyevc", "uvamiheognarxzxt", "un", "iqihn", "fygxgispemvtzfk", "bwjzr")) - .withDataLocation("qtrgqjbpfzfsinzg") - .withLinkedDomains(Arrays.asList()))) - .withNextLink("qulngsntnbybkzgc"); + mapOf( + "fxqeof", "fkufublj", "jqul", "aeqjhqjbasvms", "clxxwrljdo", "gsntnbybkzgcwr")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("nhungbw", new UserAssignedIdentity()))) + .withDataLocation("pjkjlxofpdv") + .withLinkedDomains(Arrays.asList("theotusiv")))) + .withNextLink("p"); model = BinaryData.fromObject(model).toObject(CommunicationServiceResourceList.class); - Assertions.assertEquals("mqnjaqw", model.value().get(0).location()); - Assertions.assertEquals("sprozvcput", model.value().get(0).tags().get("gjvw")); + Assertions.assertEquals("yoqpsoaccta", model.value().get(0).location()); + Assertions.assertEquals("ljlahbcryf", model.value().get(0).tags().get("dfdosygexp")); + Assertions + .assertEquals( + ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.value().get(0).identity().type()); Assertions.assertEquals("oxzjnchgejspod", model.value().get(0).dataLocation()); - Assertions.assertEquals("qulngsntnbybkzgc", model.nextLink()); + Assertions.assertEquals("mqnjaqw", model.value().get(0).linkedDomains().get(0)); + Assertions.assertEquals("p", model.nextLink()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java index 3fd83c2a26bd..ff2d0a9204cb 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceResourceUpdateTests.java @@ -6,6 +6,9 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.communication.models.CommunicationServiceResourceUpdate; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -17,23 +20,30 @@ public void testDeserialize() throws Exception { CommunicationServiceResourceUpdate model = BinaryData .fromString( - "{\"properties\":{\"linkedDomains\":[\"qqedqytbciqfou\",\"lmmnkzsmodmglo\"]},\"tags\":{\"wtmutduq\":\"b\",\"spwgcuertumkdosv\":\"ta\"}}") + "{\"properties\":{\"linkedDomains\":[\"jvtbvpyss\",\"dnrujqguhmuouqfp\"]},\"identity\":{\"principalId\":\"20621513-db88-4b7f-a7ee-abec1fd88523\",\"tenantId\":\"3ae1224e-91c7-46a3-a17f-686d13f9768b\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"tnwu\":{\"principalId\":\"f3402b40-b15e-4336-9c50-6d601822fea6\",\"clientId\":\"802ef009-31dd-4797-bd29-4abe2b1cb140\"}}},\"tags\":{\"x\":\"a\",\"hr\":\"fizuckyf\"}}") .toObject(CommunicationServiceResourceUpdate.class); - Assertions.assertEquals("b", model.tags().get("wtmutduq")); - Assertions.assertEquals("qqedqytbciqfou", model.linkedDomains().get(0)); + Assertions.assertEquals("a", model.tags().get("x")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("jvtbvpyss", model.linkedDomains().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CommunicationServiceResourceUpdate model = new CommunicationServiceResourceUpdate() - .withTags(mapOf("wtmutduq", "b", "spwgcuertumkdosv", "ta")) - .withLinkedDomains(Arrays.asList("qqedqytbciqfou", "lmmnkzsmodmglo")); + .withTags(mapOf("x", "a", "hr", "fizuckyf")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("tnwu", new UserAssignedIdentity()))) + .withLinkedDomains(Arrays.asList("jvtbvpyss", "dnrujqguhmuouqfp")); model = BinaryData.fromObject(model).toObject(CommunicationServiceResourceUpdate.class); - Assertions.assertEquals("b", model.tags().get("wtmutduq")); - Assertions.assertEquals("qqedqytbciqfou", model.linkedDomains().get(0)); + Assertions.assertEquals("a", model.tags().get("x")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("jvtbvpyss", model.linkedDomains().get(0)); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java index 6c61a876a7cc..f17af2bb3942 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServiceUpdatePropertiesTests.java @@ -14,16 +14,17 @@ public final class CommunicationServiceUpdatePropertiesTests { public void testDeserialize() throws Exception { CommunicationServiceUpdateProperties model = BinaryData - .fromString("{\"linkedDomains\":[\"bmdg\",\"bjf\",\"dgmb\"]}") + .fromString("{\"linkedDomains\":[\"fvzwdzuhty\",\"wisdkft\",\"wxmnteiwao\"]}") .toObject(CommunicationServiceUpdateProperties.class); - Assertions.assertEquals("bmdg", model.linkedDomains().get(0)); + Assertions.assertEquals("fvzwdzuhty", model.linkedDomains().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CommunicationServiceUpdateProperties model = - new CommunicationServiceUpdateProperties().withLinkedDomains(Arrays.asList("bmdg", "bjf", "dgmb")); + new CommunicationServiceUpdateProperties() + .withLinkedDomains(Arrays.asList("fvzwdzuhty", "wisdkft", "wxmnteiwao")); model = BinaryData.fromObject(model).toObject(CommunicationServiceUpdateProperties.class); - Assertions.assertEquals("bmdg", model.linkedDomains().get(0)); + Assertions.assertEquals("fvzwdzuhty", model.linkedDomains().get(0)); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java index 3a7269410ac4..18eed14df043 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCheckNameAvailabilityWithResponseMockTests.java @@ -32,7 +32,7 @@ public void testCheckNameAvailabilityWithResponse() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"nameAvailable\":true,\"reason\":\"AlreadyExists\",\"message\":\"eoejzic\"}"; + String responseStr = "{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"eyp\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -64,12 +64,12 @@ public void testCheckNameAvailabilityWithResponse() throws Exception { manager .communicationServices() .checkNameAvailabilityWithResponse( - new NameAvailabilityParameters().withName("mrbpizcdrqj").withType("pyd"), + new NameAvailabilityParameters().withName("xzko").withType("cukoklyaxuconu"), com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals(true, response.nameAvailable()); - Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, response.reason()); - Assertions.assertEquals("eoejzic", response.message()); + Assertions.assertEquals(false, response.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, response.reason()); + Assertions.assertEquals("eyp", response.message()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java index e1f67ca8d03a..d0a24aeb8639 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesCreateOrUpdateMockTests.java @@ -13,6 +13,9 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.UserAssignedIdentity; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -34,7 +37,7 @@ public void testCreateOrUpdate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"hostName\":\"ids\",\"dataLocation\":\"yonobgl\",\"notificationHubId\":\"cq\",\"version\":\"ccm\",\"immutableResourceId\":\"udxytlmoyrx\",\"linkedDomains\":[\"u\",\"wpzntxhdzh\"]},\"location\":\"qj\",\"tags\":{\"pycanuzbpz\":\"kfrlhrxsbky\"},\"id\":\"afkuwb\",\"name\":\"rnwb\",\"type\":\"ehhseyvjusrts\"}"; + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"hostName\":\"sfwxosowzxc\",\"dataLocation\":\"gicjooxdjeb\",\"notificationHubId\":\"ucww\",\"version\":\"ovbvmeueciv\",\"immutableResourceId\":\"zceuojgjrw\",\"linkedDomains\":[\"iotwmcdytdxwit\",\"nrjawgqwg\",\"hniskxfbkpyc\"]},\"identity\":{\"principalId\":\"7d11bc78-0262-45f2-964f-785493c7049d\",\"tenantId\":\"c75b7df9-fd8b-455e-9a76-e0180d88c2ac\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"dauwhvylwzbtd\":{\"principalId\":\"4789c494-9a33-42e7-b82a-2a28f26ba62c\",\"clientId\":\"3486de2e-c0e2-471f-8bd7-18b377db937d\"},\"jznb\":{\"principalId\":\"7a35cbba-d98a-4c63-adf4-5b22b1bd7e13\",\"clientId\":\"1e513b04-2baa-4ea2-b0cb-32c6d7a0388e\"}}},\"location\":\"ow\",\"tags\":{\"lupj\":\"rzqlveu\",\"riplrbpbewtg\":\"khfxobbcswsrt\"},\"id\":\"fgb\",\"name\":\"c\",\"type\":\"wxzvlvqhjkb\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -65,20 +68,26 @@ public void testCreateOrUpdate() throws Exception { CommunicationServiceResource response = manager .communicationServices() - .define("upedeojnabckhs") - .withRegion("cnjbkcnxdhbt") - .withExistingResourceGroup("baiuebbaumny") - .withTags(mapOf("wpn", "h", "mclfplphoxuscr", "jtoqne")) - .withDataLocation("tfhvpesapskrdqmh") - .withLinkedDomains(Arrays.asList("upqsx", "nmic", "kvceoveilovnotyf")) + .define("kfrlhrxsbky") + .withRegion("hcdhmdual") + .withExistingResourceGroup("bh") + .withTags(mapOf("adm", "qpv", "r", "sr", "fmisg", "vxpvgomz")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("ahvljuaha", new UserAssignedIdentity()))) + .withDataLocation("z") + .withLinkedDomains(Arrays.asList("eyvjusrtslhspkde", "maofmxagkv")) .create(); - Assertions.assertEquals("qj", response.location()); - Assertions.assertEquals("kfrlhrxsbky", response.tags().get("pycanuzbpz")); - Assertions.assertEquals("yonobgl", response.dataLocation()); - Assertions.assertEquals("u", response.linkedDomains().get(0)); + Assertions.assertEquals("ow", response.location()); + Assertions.assertEquals("rzqlveu", response.tags().get("lupj")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + Assertions.assertEquals("gicjooxdjeb", response.dataLocation()); + Assertions.assertEquals("iotwmcdytdxwit", response.linkedDomains().get(0)); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java index 94e5afc56233..2b1ae24ac50a 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesDeleteMockTests.java @@ -56,6 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.communicationServices().delete("bhvgy", "gu", com.azure.core.util.Context.NONE); + manager.communicationServices().delete("uscrpabgyepsb", "tazqugxywpmueefj", com.azure.core.util.Context.NONE); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java index b82586ca7f9f..e8b8cc1f7baa 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesGetByResourceGroupWithResponseMockTests.java @@ -13,6 +13,7 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -31,7 +32,7 @@ public void testGetByResourceGroupWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Deleting\",\"hostName\":\"xdbabphlwr\",\"dataLocation\":\"lfktsths\",\"notificationHubId\":\"ocmnyyazttbtwwrq\",\"version\":\"edckzywbiexzfey\",\"immutableResourceId\":\"axibxujw\",\"linkedDomains\":[\"walm\",\"zyoxaepdkzjan\",\"ux\",\"hdwbavxbniwdjs\"]},\"location\":\"tsdbpgn\",\"tags\":{\"pzxbz\":\"x\"},\"id\":\"fzab\",\"name\":\"lcuhxwtctyqiklb\",\"type\":\"ovplw\"}"; + "{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"vmkfssxqu\",\"dataLocation\":\"kfplgmgsxnk\",\"notificationHubId\":\"kde\",\"version\":\"pvlopwiyighxpkd\",\"immutableResourceId\":\"baiuebbaumny\",\"linkedDomains\":[\"edeojnabc\"]},\"identity\":{\"principalId\":\"9ca91c4c-eb77-48ff-8df7-d7d30dd80067\",\"tenantId\":\"626adb71-13ff-4e78-93db-c9c10d1e889d\",\"type\":\"None\",\"userAssignedIdentities\":{\"ebtfhvpesap\":{\"principalId\":\"5efe3ae4-5dda-4b46-a657-863c7d7a3134\",\"clientId\":\"ec5a4207-5b87-4d64-8ad0-c932e18734c4\"},\"dqmh\":{\"principalId\":\"c721a48d-37cd-4722-9efb-5846687230ab\",\"clientId\":\"6e7d41fd-0909-4b2c-94cc-8360097e88c0\"},\"htldwk\":{\"principalId\":\"77d62b26-1736-4568-85b6-89536e6d799a\",\"clientId\":\"1f043065-64cf-49cc-a1a8-0d1b57934b86\"}}},\"location\":\"xuutkncwscwsv\",\"tags\":{\"rupqsxvnmicy\":\"togt\",\"vei\":\"vce\",\"dhbt\":\"ovnotyfjfcnjbkcn\"},\"id\":\"kphywpnvjto\",\"name\":\"nermcl\",\"type\":\"plpho\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,12 +63,13 @@ public void testGetByResourceGroupWithResponse() throws Exception { CommunicationServiceResource response = manager .communicationServices() - .getByResourceGroupWithResponse("nrs", "nlqidybyxczf", com.azure.core.util.Context.NONE) + .getByResourceGroupWithResponse("ovplw", "bhvgy", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("tsdbpgn", response.location()); - Assertions.assertEquals("x", response.tags().get("pzxbz")); - Assertions.assertEquals("lfktsths", response.dataLocation()); - Assertions.assertEquals("walm", response.linkedDomains().get(0)); + Assertions.assertEquals("xuutkncwscwsv", response.location()); + Assertions.assertEquals("togt", response.tags().get("rupqsxvnmicy")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.identity().type()); + Assertions.assertEquals("kfplgmgsxnk", response.dataLocation()); + Assertions.assertEquals("edeojnabc", response.linkedDomains().get(0)); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java index c9a3d30efa9f..e0745765819d 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesLinkNotificationHubWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testLinkNotificationHubWithResponse() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"resourceId\":\"ixzbinjeputtmryw\"}"; + String responseStr = "{\"resourceId\":\"civfsnkymuctq\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,14 +63,14 @@ public void testLinkNotificationHubWithResponse() throws Exception { manager .communicationServices() .linkNotificationHubWithResponse( - "ifsjttgzfbishcb", - "hajdeyeamdpha", + "wrmjmwvvjektc", + "senhwlrs", new LinkNotificationHubParameters() - .withResourceId("alpbuxwgipwhon") - .withConnectionString("wkgshwa"), + .withResourceId("frzpwvlqdqgb") + .withConnectionString("qylihkaetckt"), com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("ixzbinjeputtmryw", response.resourceId()); + Assertions.assertEquals("civfsnkymuctq", response.resourceId()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java index dbaf40b56512..7dea045a1058 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListByResourceGroupMockTests.java @@ -14,6 +14,7 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -32,7 +33,7 @@ public void testListByResourceGroup() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"hostName\":\"tbgsncghkj\",\"dataLocation\":\"szzhbijhtxfvgxbf\",\"notificationHubId\":\"xnehmpvec\",\"version\":\"odebfqkkrbmpu\",\"immutableResourceId\":\"riwflzlfb\",\"linkedDomains\":[\"uzycispnqza\"]},\"location\":\"gkbrpyyd\",\"tags\":{\"agnb\":\"nuqqkpikadrgvt\",\"fsiarbutr\":\"ynhijggme\",\"jrunmpxtt\":\"vpnazzm\"},\"id\":\"bh\",\"name\":\"bnlankxmyskpb\",\"type\":\"enbtkcxywny\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"arbu\",\"dataLocation\":\"rcvpnazzmhjrunmp\",\"notificationHubId\":\"tdbhrbnla\",\"version\":\"xmyskp\",\"immutableResourceId\":\"enbtkcxywny\",\"linkedDomains\":[\"synlqidybyxczfc\"]},\"identity\":{\"principalId\":\"983ee811-4e88-4e04-a331-71299154c241\",\"tenantId\":\"4e30792f-96af-4626-8308-5f4dcab3dafc\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"p\":{\"principalId\":\"4a97fbdc-5250-48ea-ae8d-f40bfa8e858d\",\"clientId\":\"e514e730-edcd-461b-bf5d-094e4fb054ae\"},\"rqlfktsthsucocmn\":{\"principalId\":\"98410989-176f-4dd8-b1f0-630a86c49396\",\"clientId\":\"21844146-dfbf-4ce0-b0db-34095ffab1cf\"},\"zt\":{\"principalId\":\"f42d3bf7-9aab-40c4-a268-d927edf01454\",\"clientId\":\"ad730d97-a363-455f-a9ee-9b85cafbab42\"}}},\"location\":\"twwrqp\",\"tags\":{\"xibxujwbhqwalm\":\"ckzywbiexzfeyue\",\"ux\":\"zyoxaepdkzjan\",\"zt\":\"hdwbavxbniwdjs\"},\"id\":\"dbpgnxytxhp\",\"name\":\"xbzpfzab\",\"type\":\"lcuhxwtctyqiklb\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,11 +62,12 @@ public void testListByResourceGroup() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.communicationServices().listByResourceGroup("uujqgidokgjljyo", com.azure.core.util.Context.NONE); + manager.communicationServices().listByResourceGroup("buynhijggm", com.azure.core.util.Context.NONE); - Assertions.assertEquals("gkbrpyyd", response.iterator().next().location()); - Assertions.assertEquals("nuqqkpikadrgvt", response.iterator().next().tags().get("agnb")); - Assertions.assertEquals("szzhbijhtxfvgxbf", response.iterator().next().dataLocation()); - Assertions.assertEquals("uzycispnqza", response.iterator().next().linkedDomains().get(0)); + Assertions.assertEquals("twwrqp", response.iterator().next().location()); + Assertions.assertEquals("ckzywbiexzfeyue", response.iterator().next().tags().get("xibxujwbhqwalm")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); + Assertions.assertEquals("rcvpnazzmhjrunmp", response.iterator().next().dataLocation()); + Assertions.assertEquals("synlqidybyxczfc", response.iterator().next().linkedDomains().get(0)); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java index 86afbbd559b6..9058ad215b21 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/CommunicationServicesListMockTests.java @@ -14,6 +14,7 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.communication.CommunicationManager; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -32,7 +33,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Updating\",\"hostName\":\"ftiyqzrnkcq\",\"dataLocation\":\"yx\",\"notificationHubId\":\"hzls\",\"version\":\"ohoqqnwvlryav\",\"immutableResourceId\":\"heun\",\"linkedDomains\":[\"hgyxzkonoc\",\"koklya\",\"uconuqszfkbey\",\"ewrmjmwvvjektc\"]},\"location\":\"enhwlrs\",\"tags\":{\"qdqgbi\":\"zpwv\",\"fcivfsnkym\":\"ylihkaetckt\",\"jf\":\"ctq\",\"fuwutttxf\":\"ebrjcxe\"},\"id\":\"jrbirphxepcyv\",\"name\":\"hfnljkyq\",\"type\":\"j\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"hostName\":\"brjcxe\",\"dataLocation\":\"fuwutttxf\",\"notificationHubId\":\"rbirphxe\",\"version\":\"yva\",\"immutableResourceId\":\"nljky\",\"linkedDomains\":[\"vuujq\"]},\"identity\":{\"principalId\":\"f342c64e-0a89-4d85-ae46-c2b6f9566603\",\"tenantId\":\"f72eed73-33ac-4821-8e7c-e043e2202e5c\",\"type\":\"None\",\"userAssignedIdentities\":{\"yoxgvcltbgsnc\":{\"principalId\":\"552f9120-4c6f-4d22-9b5b-a5fe73ec964c\",\"clientId\":\"17c275e7-1df4-4c0a-a8ca-1af0e5f05e75\"},\"jeszzhbijhtxfv\":{\"principalId\":\"4d732273-6af7-4d26-bee8-79ee41592dd6\",\"clientId\":\"28e13d66-6422-4a2f-b42d-510f0d2b4e31\"}}},\"location\":\"bfs\",\"tags\":{\"pvecxgodeb\":\"eh\",\"pukgriwflzlfb\":\"qkkrb\",\"qzahmgkbrp\":\"zpuzycisp\"},\"id\":\"y\",\"name\":\"hibnuqqkpika\",\"type\":\"rgvtqag\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,9 +64,10 @@ public void testList() throws Exception { PagedIterable response = manager.communicationServices().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("enhwlrs", response.iterator().next().location()); - Assertions.assertEquals("zpwv", response.iterator().next().tags().get("qdqgbi")); - Assertions.assertEquals("yx", response.iterator().next().dataLocation()); - Assertions.assertEquals("hgyxzkonoc", response.iterator().next().linkedDomains().get(0)); + Assertions.assertEquals("bfs", response.iterator().next().location()); + Assertions.assertEquals("eh", response.iterator().next().tags().get("pvecxgodeb")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.iterator().next().identity().type()); + Assertions.assertEquals("fuwutttxf", response.iterator().next().dataLocation()); + Assertions.assertEquals("vuujq", response.iterator().next().linkedDomains().get(0)); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java index 9e85b4afcc2c..f920f6deceb1 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DnsRecordTests.java @@ -12,7 +12,7 @@ public final class DnsRecordTests { public void testDeserialize() throws Exception { DnsRecord model = BinaryData - .fromString("{\"type\":\"dxob\",\"name\":\"dxkqpx\",\"value\":\"ajionpimexgstxg\",\"ttl\":1489591694}") + .fromString("{\"type\":\"cbkbfkg\",\"name\":\"dkexxppofm\",\"value\":\"x\",\"ttl\":825369958}") .toObject(DnsRecord.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java index 0970c97cc7f0..93d47d154645 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainPropertiesVerificationRecordsTests.java @@ -14,7 +14,7 @@ public void testDeserialize() throws Exception { DomainPropertiesVerificationRecords model = BinaryData .fromString( - "{\"Domain\":{\"type\":\"pteehzzv\",\"name\":\"yqrimzin\",\"value\":\"swjdkirso\",\"ttl\":1633669342},\"SPF\":{\"type\":\"crmnohjtckwhds\",\"name\":\"fiyipjxsqwpgrj\",\"value\":\"norcjxvsnbyxqab\",\"ttl\":1299140464},\"DKIM\":{\"type\":\"cyshurzafbljjgp\",\"name\":\"oq\",\"value\":\"mkljavb\",\"ttl\":1581174340},\"DKIM2\":{\"type\":\"ajzyul\",\"name\":\"u\",\"value\":\"krlkhbzhfepg\",\"ttl\":701234104},\"DMARC\":{\"type\":\"zloc\",\"name\":\"c\",\"value\":\"ierhhbcsglummaj\",\"ttl\":1273206758}}") + "{\"Domain\":{\"type\":\"qcjm\",\"name\":\"javbqidtqajz\",\"value\":\"l\",\"ttl\":144447336},\"SPF\":{\"type\":\"krlkhbzhfepg\",\"name\":\"qex\",\"value\":\"ocxscpaierhhbcs\",\"ttl\":526297458},\"DKIM\":{\"type\":\"a\",\"name\":\"j\",\"value\":\"dxob\",\"ttl\":1455975978},\"DKIM2\":{\"type\":\"qp\",\"name\":\"kajionpim\",\"value\":\"gstxgcp\",\"ttl\":1867037750},\"DMARC\":{\"type\":\"ajrmvdjwzrlovmc\",\"name\":\"hijco\",\"value\":\"ctbzaq\",\"ttl\":2038129581}}") .toObject(DomainPropertiesVerificationRecords.class); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainResourceInnerTests.java deleted file mode 100644 index d37b04f8814b..000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainResourceInnerTests.java +++ /dev/null @@ -1,54 +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.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.DomainResourceInner; -import com.azure.resourcemanager.communication.models.DomainManagement; -import com.azure.resourcemanager.communication.models.UserEngagementTracking; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DomainResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DomainResourceInner model = - BinaryData - .fromString( - "{\"properties\":{\"provisioningState\":\"Running\",\"dataLocation\":\"l\",\"fromSenderDomain\":\"uvfqawrlyxwj\",\"mailFromSenderDomain\":\"prbnwbxgjvtbv\",\"domainManagement\":\"AzureManaged\",\"verificationStates\":{},\"verificationRecords\":{},\"userEngagementTracking\":\"Disabled\"},\"location\":\"uqfprwzw\",\"tags\":{\"a\":\"uitnwuiz\"},\"id\":\"x\",\"name\":\"fizuckyf\",\"type\":\"hr\"}") - .toObject(DomainResourceInner.class); - Assertions.assertEquals("uqfprwzw", model.location()); - Assertions.assertEquals("uitnwuiz", model.tags().get("a")); - Assertions.assertEquals(DomainManagement.AZURE_MANAGED, model.domainManagement()); - Assertions.assertEquals(UserEngagementTracking.DISABLED, model.userEngagementTracking()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DomainResourceInner model = - new DomainResourceInner() - .withLocation("uqfprwzw") - .withTags(mapOf("a", "uitnwuiz")) - .withDomainManagement(DomainManagement.AZURE_MANAGED) - .withUserEngagementTracking(UserEngagementTracking.DISABLED); - model = BinaryData.fromObject(model).toObject(DomainResourceInner.class); - Assertions.assertEquals("uqfprwzw", model.location()); - Assertions.assertEquals("uitnwuiz", model.tags().get("a")); - Assertions.assertEquals(DomainManagement.AZURE_MANAGED, model.domainManagement()); - Assertions.assertEquals(UserEngagementTracking.DISABLED, model.userEngagementTracking()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainResourceListTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainResourceListTests.java deleted file mode 100644 index 4c7c4261603a..000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainResourceListTests.java +++ /dev/null @@ -1,91 +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.resourcemanager.communication.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.communication.fluent.models.DomainResourceInner; -import com.azure.resourcemanager.communication.models.DomainManagement; -import com.azure.resourcemanager.communication.models.DomainResourceList; -import com.azure.resourcemanager.communication.models.UserEngagementTracking; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DomainResourceListTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DomainResourceList model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Unknown\",\"dataLocation\":\"jjxhvpmo\",\"fromSenderDomain\":\"xhdzxibqeojnx\",\"mailFromSenderDomain\":\"zvddntwndeicbtwn\",\"domainManagement\":\"AzureManaged\",\"userEngagementTracking\":\"Enabled\"},\"location\":\"hrhcffcyddglmjth\",\"tags\":{\"hix\":\"wpyeicxmqciwqvh\"},\"id\":\"igdtopbob\",\"name\":\"og\",\"type\":\"m\"},{\"properties\":{\"provisioningState\":\"Moving\",\"dataLocation\":\"a\",\"fromSenderDomain\":\"rzayv\",\"mailFromSenderDomain\":\"pgvdf\",\"domainManagement\":\"AzureManaged\",\"userEngagementTracking\":\"Enabled\"},\"location\":\"utqxlngx\",\"tags\":{\"xkrxdqmi\":\"gug\",\"abhjybi\":\"tthzrvqd\",\"ktzlcuiywg\":\"ehoqfbowskan\",\"nhzgpphrcgyn\":\"ywgndrv\"},\"id\":\"ocpecfvmmco\",\"name\":\"fsxlzevgbmqjqa\",\"type\":\"c\"},{\"properties\":{\"provisioningState\":\"Deleting\",\"dataLocation\":\"kwlzuvccfwnfn\",\"fromSenderDomain\":\"cfionl\",\"mailFromSenderDomain\":\"x\",\"domainManagement\":\"CustomerManagedInExchangeOnline\",\"userEngagementTracking\":\"Enabled\"},\"location\":\"dpnqbq\",\"tags\":{\"mpmngnzscxaqwoo\":\"rjfeallnwsubisnj\",\"njeaseipheofloke\":\"hcbonqvpkvlr\",\"enjbdlwtgrhp\":\"y\",\"umasxazjpq\":\"jp\"},\"id\":\"e\",\"name\":\"ualhbxxhejj\",\"type\":\"zvdudgwdslfhotwm\"}],\"nextLink\":\"npwlbjnpg\"}") - .toObject(DomainResourceList.class); - Assertions.assertEquals("hrhcffcyddglmjth", model.value().get(0).location()); - Assertions.assertEquals("wpyeicxmqciwqvh", model.value().get(0).tags().get("hix")); - Assertions.assertEquals(DomainManagement.AZURE_MANAGED, model.value().get(0).domainManagement()); - Assertions.assertEquals(UserEngagementTracking.ENABLED, model.value().get(0).userEngagementTracking()); - Assertions.assertEquals("npwlbjnpg", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DomainResourceList model = - new DomainResourceList() - .withValue( - Arrays - .asList( - new DomainResourceInner() - .withLocation("hrhcffcyddglmjth") - .withTags(mapOf("hix", "wpyeicxmqciwqvh")) - .withDomainManagement(DomainManagement.AZURE_MANAGED) - .withUserEngagementTracking(UserEngagementTracking.ENABLED), - new DomainResourceInner() - .withLocation("utqxlngx") - .withTags( - mapOf( - "xkrxdqmi", - "gug", - "abhjybi", - "tthzrvqd", - "ktzlcuiywg", - "ehoqfbowskan", - "nhzgpphrcgyn", - "ywgndrv")) - .withDomainManagement(DomainManagement.AZURE_MANAGED) - .withUserEngagementTracking(UserEngagementTracking.ENABLED), - new DomainResourceInner() - .withLocation("dpnqbq") - .withTags( - mapOf( - "mpmngnzscxaqwoo", - "rjfeallnwsubisnj", - "njeaseipheofloke", - "hcbonqvpkvlr", - "enjbdlwtgrhp", - "y", - "umasxazjpq", - "jp")) - .withDomainManagement(DomainManagement.CUSTOMER_MANAGED_IN_EXCHANGE_ONLINE) - .withUserEngagementTracking(UserEngagementTracking.ENABLED))) - .withNextLink("npwlbjnpg"); - model = BinaryData.fromObject(model).toObject(DomainResourceList.class); - Assertions.assertEquals("hrhcffcyddglmjth", model.value().get(0).location()); - Assertions.assertEquals("wpyeicxmqciwqvh", model.value().get(0).tags().get("hix")); - Assertions.assertEquals(DomainManagement.AZURE_MANAGED, model.value().get(0).domainManagement()); - Assertions.assertEquals(UserEngagementTracking.ENABLED, model.value().get(0).userEngagementTracking()); - Assertions.assertEquals("npwlbjnpg", model.nextLink()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java index e0c3823adab9..0fb08c714a49 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsDeleteMockTests.java @@ -56,6 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.domains().delete("vo", "bvmeuecivy", "zceuojgjrw", com.azure.core.util.Context.NONE); + manager.domains().delete("yriwwroyqb", "xrmcqibycnojvk", "mefqsgzvahapjyzh", com.azure.core.util.Context.NONE); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicePropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicePropertiesTests.java index bd3f360c4b94..a265c08fe99f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicePropertiesTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicePropertiesTests.java @@ -13,15 +13,15 @@ public final class EmailServicePropertiesTests { public void testDeserialize() throws Exception { EmailServiceProperties model = BinaryData - .fromString("{\"provisioningState\":\"Failed\",\"dataLocation\":\"ofqweykhmenevfye\"}") + .fromString("{\"provisioningState\":\"Updating\",\"dataLocation\":\"zgpphrcgyncocpe\"}") .toObject(EmailServiceProperties.class); - Assertions.assertEquals("ofqweykhmenevfye", model.dataLocation()); + Assertions.assertEquals("zgpphrcgyncocpe", model.dataLocation()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - EmailServiceProperties model = new EmailServiceProperties().withDataLocation("ofqweykhmenevfye"); + EmailServiceProperties model = new EmailServiceProperties().withDataLocation("zgpphrcgyncocpe"); model = BinaryData.fromObject(model).toObject(EmailServiceProperties.class); - Assertions.assertEquals("ofqweykhmenevfye", model.dataLocation()); + Assertions.assertEquals("zgpphrcgyncocpe", model.dataLocation()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java index 474d8fb68540..b26ac3d32ced 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceInnerTests.java @@ -16,26 +16,27 @@ public void testDeserialize() throws Exception { EmailServiceResourceInner model = BinaryData .fromString( - "{\"properties\":{\"provisioningState\":\"Creating\",\"dataLocation\":\"dehxnltyfsoppu\"},\"location\":\"esnzwde\",\"tags\":{\"qvudwxdndnvowgu\":\"vorxzdmohct\"},\"id\":\"jugwdkcglhsl\",\"name\":\"zj\",\"type\":\"yggdtjixh\"}") + "{\"properties\":{\"provisioningState\":\"Updating\",\"dataLocation\":\"igdtopbob\"},\"location\":\"ghmewuam\",\"tags\":{\"t\":\"rzayv\",\"ln\":\"gvdfgiotkftutq\",\"qmi\":\"xlefgugnxkrx\",\"abhjybi\":\"tthzrvqd\"},\"id\":\"ehoqfbowskan\",\"name\":\"ktzlcuiywg\",\"type\":\"ywgndrv\"}") .toObject(EmailServiceResourceInner.class); - Assertions.assertEquals("esnzwde", model.location()); - Assertions.assertEquals("vorxzdmohct", model.tags().get("qvudwxdndnvowgu")); - Assertions.assertEquals("dehxnltyfsoppu", model.dataLocation()); + Assertions.assertEquals("ghmewuam", model.location()); + Assertions.assertEquals("rzayv", model.tags().get("t")); + Assertions.assertEquals("igdtopbob", model.dataLocation()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { EmailServiceResourceInner model = new EmailServiceResourceInner() - .withLocation("esnzwde") - .withTags(mapOf("qvudwxdndnvowgu", "vorxzdmohct")) - .withDataLocation("dehxnltyfsoppu"); + .withLocation("ghmewuam") + .withTags(mapOf("t", "rzayv", "ln", "gvdfgiotkftutq", "qmi", "xlefgugnxkrx", "abhjybi", "tthzrvqd")) + .withDataLocation("igdtopbob"); model = BinaryData.fromObject(model).toObject(EmailServiceResourceInner.class); - Assertions.assertEquals("esnzwde", model.location()); - Assertions.assertEquals("vorxzdmohct", model.tags().get("qvudwxdndnvowgu")); - Assertions.assertEquals("dehxnltyfsoppu", model.dataLocation()); + Assertions.assertEquals("ghmewuam", model.location()); + Assertions.assertEquals("rzayv", model.tags().get("t")); + Assertions.assertEquals("igdtopbob", model.dataLocation()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceListTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceListTests.java index 57a6fbef2430..88afc66eeed6 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceListTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceListTests.java @@ -18,12 +18,12 @@ public void testDeserialize() throws Exception { EmailServiceResourceList model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"dataLocation\":\"ypvhezrkg\"},\"location\":\"c\",\"tags\":{\"jpkcattpng\":\"fovgmkqsleyyvxy\",\"czsqpjhvm\":\"cr\"},\"id\":\"ajvnysounqe\",\"name\":\"a\",\"type\":\"oaeupfhyhltrpmo\"},{\"properties\":{\"provisioningState\":\"Updating\",\"dataLocation\":\"matuok\"},\"location\":\"fu\",\"tags\":{\"zydagfuaxbezyiuo\":\"odsfcpkvxodpuozm\",\"dxwzywqsmbsurexi\":\"ktwh\",\"yocf\":\"o\"},\"id\":\"fksymddystki\",\"name\":\"uxh\",\"type\":\"yudxorrqnbp\"}],\"nextLink\":\"zvyifqrvkdvj\"}") + "{\"value\":[{\"properties\":{\"provisioningState\":\"Moving\",\"dataLocation\":\"c\"},\"location\":\"nfnbacfionlebxe\",\"tags\":{\"jfeallnwsub\":\"tzxdpnqbqqwx\",\"zscxaqwo\":\"snjampmng\"},\"id\":\"chcbonqvpkvlrxnj\",\"name\":\"ase\",\"type\":\"pheoflokeyy\"},{\"properties\":{\"provisioningState\":\"Unknown\",\"dataLocation\":\"bdlwtgrhpdjpj\"},\"location\":\"asxazjpqyegualhb\",\"tags\":{\"jzzvdud\":\"e\",\"pwlbjnpg\":\"wdslfhotwmcy\"},\"id\":\"cftadeh\",\"name\":\"nltyfsoppusuesnz\",\"type\":\"dejbavo\"},{\"properties\":{\"provisioningState\":\"Running\",\"dataLocation\":\"mohctb\"},\"location\":\"udwxdndnvowguj\",\"tags\":{\"zj\":\"wdkcglhsl\",\"kuofqweykhme\":\"yggdtjixh\",\"yvdcsitynnaa\":\"evfyexfwhybcib\"},\"id\":\"dectehfiqsc\",\"name\":\"eypvhezrkg\",\"type\":\"hcjrefovgmk\"},{\"properties\":{\"provisioningState\":\"Unknown\",\"dataLocation\":\"yyvxyqjpkcattpn\"},\"location\":\"cr\",\"tags\":{\"sounqecanoaeu\":\"sqpjhvmdajvn\",\"u\":\"fhyhltrpmopjmcma\",\"aodsfcpkv\":\"kthfui\",\"uaxbezyiuokkt\":\"odpuozmyzydag\"},\"id\":\"hrdxwzywqsmbs\",\"name\":\"reximoryocfs\",\"type\":\"ksymd\"}],\"nextLink\":\"stkiiuxhqyud\"}") .toObject(EmailServiceResourceList.class); - Assertions.assertEquals("c", model.value().get(0).location()); - Assertions.assertEquals("fovgmkqsleyyvxy", model.value().get(0).tags().get("jpkcattpng")); - Assertions.assertEquals("ypvhezrkg", model.value().get(0).dataLocation()); - Assertions.assertEquals("zvyifqrvkdvj", model.nextLink()); + Assertions.assertEquals("nfnbacfionlebxe", model.value().get(0).location()); + Assertions.assertEquals("tzxdpnqbqqwx", model.value().get(0).tags().get("jfeallnwsub")); + Assertions.assertEquals("c", model.value().get(0).dataLocation()); + Assertions.assertEquals("stkiiuxhqyud", model.nextLink()); } @org.junit.jupiter.api.Test @@ -34,28 +34,46 @@ public void testSerialize() throws Exception { Arrays .asList( new EmailServiceResourceInner() - .withLocation("c") - .withTags(mapOf("jpkcattpng", "fovgmkqsleyyvxy", "czsqpjhvm", "cr")) - .withDataLocation("ypvhezrkg"), + .withLocation("nfnbacfionlebxe") + .withTags(mapOf("jfeallnwsub", "tzxdpnqbqqwx", "zscxaqwo", "snjampmng")) + .withDataLocation("c"), new EmailServiceResourceInner() - .withLocation("fu") + .withLocation("asxazjpqyegualhb") + .withTags(mapOf("jzzvdud", "e", "pwlbjnpg", "wdslfhotwmcy")) + .withDataLocation("bdlwtgrhpdjpj"), + new EmailServiceResourceInner() + .withLocation("udwxdndnvowguj") + .withTags( + mapOf( + "zj", + "wdkcglhsl", + "kuofqweykhme", + "yggdtjixh", + "yvdcsitynnaa", + "evfyexfwhybcib")) + .withDataLocation("mohctb"), + new EmailServiceResourceInner() + .withLocation("cr") .withTags( mapOf( - "zydagfuaxbezyiuo", - "odsfcpkvxodpuozm", - "dxwzywqsmbsurexi", - "ktwh", - "yocf", - "o")) - .withDataLocation("matuok"))) - .withNextLink("zvyifqrvkdvj"); + "sounqecanoaeu", + "sqpjhvmdajvn", + "u", + "fhyhltrpmopjmcma", + "aodsfcpkv", + "kthfui", + "uaxbezyiuokkt", + "odpuozmyzydag")) + .withDataLocation("yyvxyqjpkcattpn"))) + .withNextLink("stkiiuxhqyud"); model = BinaryData.fromObject(model).toObject(EmailServiceResourceList.class); - Assertions.assertEquals("c", model.value().get(0).location()); - Assertions.assertEquals("fovgmkqsleyyvxy", model.value().get(0).tags().get("jpkcattpng")); - Assertions.assertEquals("ypvhezrkg", model.value().get(0).dataLocation()); - Assertions.assertEquals("zvyifqrvkdvj", model.nextLink()); + Assertions.assertEquals("nfnbacfionlebxe", model.value().get(0).location()); + Assertions.assertEquals("tzxdpnqbqqwx", model.value().get(0).tags().get("jfeallnwsub")); + Assertions.assertEquals("c", model.value().get(0).dataLocation()); + Assertions.assertEquals("stkiiuxhqyud", model.nextLink()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceUpdateTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceUpdateTests.java index 52fb8eebf1ec..14b6df9fb591 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceUpdateTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServiceResourceUpdateTests.java @@ -15,19 +15,20 @@ public final class EmailServiceResourceUpdateTests { public void testDeserialize() throws Exception { EmailServiceResourceUpdate model = BinaryData - .fromString("{\"tags\":{\"vdcsitynn\":\"hybcibv\",\"f\":\"amdecte\"}}") + .fromString("{\"tags\":{\"coofsxlzev\":\"m\",\"abcypmivk\":\"bmqj\"}}") .toObject(EmailServiceResourceUpdate.class); - Assertions.assertEquals("hybcibv", model.tags().get("vdcsitynn")); + Assertions.assertEquals("m", model.tags().get("coofsxlzev")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { EmailServiceResourceUpdate model = - new EmailServiceResourceUpdate().withTags(mapOf("vdcsitynn", "hybcibv", "f", "amdecte")); + new EmailServiceResourceUpdate().withTags(mapOf("coofsxlzev", "m", "abcypmivk", "bmqj")); model = BinaryData.fromObject(model).toObject(EmailServiceResourceUpdate.class); - Assertions.assertEquals("hybcibv", model.tags().get("vdcsitynn")); + Assertions.assertEquals("m", model.tags().get("coofsxlzev")); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java index d47143470ef7..76ec7533c604 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesCreateOrUpdateMockTests.java @@ -33,7 +33,7 @@ public void testCreateOrUpdate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"dataLocation\":\"xsrz\"},\"location\":\"ucerscdntnevfi\",\"tags\":{\"weriofzpyqsem\":\"ygtdsslswt\",\"zhedplvwiw\":\"abnetshh\",\"tppjflcx\":\"bmwmbesldnkw\"},\"id\":\"gaokonzmnsikv\",\"name\":\"kqze\",\"type\":\"qkdltfz\"}"; + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"dataLocation\":\"xogaokonzmnsikv\"},\"location\":\"qzeqqkdltfzxm\",\"tags\":{\"dkwobdagx\":\"hgure\"},\"id\":\"ibqdxbxwakbogqx\",\"name\":\"dlkzgxhuri\",\"type\":\"lbpodxunk\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -64,18 +64,19 @@ public void testCreateOrUpdate() throws Exception { EmailServiceResource response = manager .emailServices() - .define("enq") - .withRegion("gnayqigynduh") - .withExistingResourceGroup("ewgdrjervn") - .withTags(mapOf("maqolbgycduie", "qlkth", "qlfmmdnbb", "tgccymvaolpss", "wyhzdx", "lzpswiydm")) - .withDataLocation("ndoygmifthnzdnd") + .define("mnvdfzn") + .withRegion("hh") + .withExistingResourceGroup("mcwyhzdxssadb") + .withTags(mapOf("wjmy", "zdzucerscdntnevf", "s", "tdss", "emwabnet", "tmweriofzpyq", "d", "hhszh")) + .withDataLocation("dvxzbncblylpst") .create(); - Assertions.assertEquals("ucerscdntnevfi", response.location()); - Assertions.assertEquals("ygtdsslswt", response.tags().get("weriofzpyqsem")); - Assertions.assertEquals("xsrz", response.dataLocation()); + Assertions.assertEquals("qzeqqkdltfzxm", response.location()); + Assertions.assertEquals("hgure", response.tags().get("dkwobdagx")); + Assertions.assertEquals("xogaokonzmnsikv", response.dataLocation()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java index 14e2e71271b2..f980087780f0 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesDeleteMockTests.java @@ -56,6 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.emailServices().delete("ol", "dahzxctobg", com.azure.core.util.Context.NONE); + manager.emailServices().delete("j", "n", com.azure.core.util.Context.NONE); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java index f01056acf094..b66236714fe8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesGetByResourceGroupWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetByResourceGroupWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Unknown\",\"dataLocation\":\"napnyiropuhpigv\"},\"location\":\"ylgqgitxmedjvcsl\",\"tags\":{\"rmgucnap\":\"wwncwzzhxgk\",\"oellwp\":\"t\"},\"id\":\"fdygpfqbuaceopz\",\"name\":\"qrhhu\",\"type\":\"opppcqeq\"}"; + "{\"properties\":{\"provisioningState\":\"Running\",\"dataLocation\":\"gylgqgitxmedjvcs\"},\"location\":\"n\",\"tags\":{\"zhxgktrmgucn\":\"ncw\",\"llwptfdy\":\"pkteo\",\"rhhuaopppcqeqx\":\"pfqbuaceopzf\",\"izpost\":\"lzdahzxctobgbkdm\"},\"id\":\"grcfb\",\"name\":\"nrmfqjhhk\",\"type\":\"bpvjymjhx\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,11 +62,11 @@ public void testGetByResourceGroupWithResponse() throws Exception { EmailServiceResource response = manager .emailServices() - .getByResourceGroupWithResponse("hnrztfol", "bnxknalaulppg", com.azure.core.util.Context.NONE) + .getByResourceGroupWithResponse("bnxknalaulppg", "dtpnapnyiropuhp", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("ylgqgitxmedjvcsl", response.location()); - Assertions.assertEquals("wwncwzzhxgk", response.tags().get("rmgucnap")); - Assertions.assertEquals("napnyiropuhpigv", response.dataLocation()); + Assertions.assertEquals("n", response.location()); + Assertions.assertEquals("ncw", response.tags().get("zhxgktrmgucn")); + Assertions.assertEquals("gylgqgitxmedjvcs", response.dataLocation()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java index 1ad18c57622a..034d0dadc0a2 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListByResourceGroupMockTests.java @@ -32,7 +32,7 @@ public void testListByResourceGroup() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"dataLocation\":\"blmpewww\"},\"location\":\"krvrns\",\"tags\":{\"ohxcrsbfova\":\"q\",\"sub\":\"rruvwbhsq\",\"rxbpyb\":\"gjb\",\"twss\":\"rfbjf\"},\"id\":\"t\",\"name\":\"tpvjzbexilzznfqq\",\"type\":\"vwpm\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"Updating\",\"dataLocation\":\"jzbexilzznfq\"},\"location\":\"vwpm\",\"tags\":{\"jhwqytjrybnw\":\"ruoujmk\",\"enq\":\"ewgdrjervn\",\"ndoygmifthnzdnd\":\"eh\",\"nayqi\":\"l\"},\"id\":\"ynduha\",\"name\":\"hqlkthumaqo\",\"type\":\"bgycduiertgccym\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,10 +61,10 @@ public void testListByResourceGroup() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.emailServices().listByResourceGroup("bhsfxob", com.azure.core.util.Context.NONE); + manager.emailServices().listByResourceGroup("t", com.azure.core.util.Context.NONE); - Assertions.assertEquals("krvrns", response.iterator().next().location()); - Assertions.assertEquals("q", response.iterator().next().tags().get("ohxcrsbfova")); - Assertions.assertEquals("blmpewww", response.iterator().next().dataLocation()); + Assertions.assertEquals("vwpm", response.iterator().next().location()); + Assertions.assertEquals("ruoujmk", response.iterator().next().tags().get("jhwqytjrybnw")); + Assertions.assertEquals("jzbexilzznfq", response.iterator().next().dataLocation()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java index be39c0c45424..7d5f377fbd7f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListMockTests.java @@ -32,7 +32,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Unknown\",\"dataLocation\":\"oizpostmgrcfbun\"},\"location\":\"fqjhhkxbpvjymj\",\"tags\":{\"n\":\"j\",\"ivkrtsw\":\"u\",\"vjfdx\":\"xqzvszjfa\"},\"id\":\"ivetvtcq\",\"name\":\"qtdo\",\"type\":\"mcbxvwvxysl\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"Creating\",\"dataLocation\":\"vkr\"},\"location\":\"wbxqzvszjfau\",\"tags\":{\"tvtc\":\"dxxiv\",\"wvxysl\":\"aqtdoqmcbx\",\"ytkblmpew\":\"bhsfxob\",\"shqjohxcrsbf\":\"wfbkrvrns\"},\"id\":\"vasrruvwb\",\"name\":\"sqfsubcgjbirxb\",\"type\":\"ybsrfbjfdtwss\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,8 +62,8 @@ public void testList() throws Exception { PagedIterable response = manager.emailServices().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("fqjhhkxbpvjymj", response.iterator().next().location()); - Assertions.assertEquals("j", response.iterator().next().tags().get("n")); - Assertions.assertEquals("oizpostmgrcfbun", response.iterator().next().dataLocation()); + Assertions.assertEquals("wbxqzvszjfau", response.iterator().next().location()); + Assertions.assertEquals("dxxiv", response.iterator().next().tags().get("tvtc")); + Assertions.assertEquals("vkr", response.iterator().next().dataLocation()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java index be22aa33f87b..a97c5e3212c3 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/EmailServicesListVerifiedExchangeOnlineDomainsWithResponseMockTests.java @@ -30,7 +30,7 @@ public void testListVerifiedExchangeOnlineDomainsWithResponse() throws Exception HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "[\"aruoujmkcjhwqyt\",\"r\",\"bnw\"]"; + String responseStr = "[\"olpsslqlf\",\"mdnbbglzpswiy\"]"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -64,6 +64,6 @@ public void testListVerifiedExchangeOnlineDomainsWithResponse() throws Exception .listVerifiedExchangeOnlineDomainsWithResponse(com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("aruoujmkcjhwqyt", response.get(0)); + Assertions.assertEquals("olpsslqlf", response.get(0)); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..9efa14bb5fd8 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentity; +import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.communication.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = + BinaryData + .fromString( + "{\"principalId\":\"d9480628-4fbf-498a-b769-42d157194656\",\"tenantId\":\"e297a5af-2ac5-47fa-b0f3-7dd597725a67\",\"type\":\"None\",\"userAssignedIdentities\":{\"txilnerkujy\":{\"principalId\":\"ae555323-aa31-47a3-9486-817a39c19632\",\"clientId\":\"15f3901a-6b66-459d-98e4-b2bd0a243d47\"},\"eju\":{\"principalId\":\"33cab526-be42-4fe0-b133-6deb34a31890\",\"clientId\":\"d7ccfc61-418a-4823-a9e1-9a05e5e37c6a\"},\"awrlyx\":{\"principalId\":\"00cd18cb-5bac-4bad-9c6b-665993571638\",\"clientId\":\"289f9391-0fbd-4c9c-94b0-c81f1482fb72\"},\"cpr\":{\"principalId\":\"0538de1b-21d9-43c6-9ede-df0b2199ece8\",\"clientId\":\"96914923-6ad5-42f0-8007-5541d5f8e917\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities( + mapOf( + "txilnerkujy", + new UserAssignedIdentity(), + "eju", + new UserAssignedIdentity(), + "awrlyx", + new UserAssignedIdentity(), + "cpr", + new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java index 5b7abe6d78dc..c1b2198ab423 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/OperationsListMockTests.java @@ -31,7 +31,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"name\":\"ur\",\"isDataAction\":true,\"display\":{\"provider\":\"nspydptkoenkoukn\",\"resource\":\"dwtiukbldngkp\",\"operation\":\"ipazyxoegukgjnpi\",\"description\":\"gygev\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + "{\"value\":[{\"name\":\"qftiy\",\"isDataAction\":true,\"display\":{\"provider\":\"cqvyxlwhzlsico\",\"resource\":\"qqn\",\"operation\":\"lryav\",\"description\":\"heun\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamePropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamePropertiesTests.java index b105fc3d4beb..0943236155a7 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamePropertiesTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamePropertiesTests.java @@ -14,18 +14,17 @@ public void testDeserialize() throws Exception { SenderUsernameProperties model = BinaryData .fromString( - "{\"dataLocation\":\"th\",\"username\":\"vmezy\",\"displayName\":\"hxmzsbbzoggig\",\"provisioningState\":\"Failed\"}") + "{\"dataLocation\":\"gshwankixz\",\"username\":\"injep\",\"displayName\":\"tmryw\",\"provisioningState\":\"Running\"}") .toObject(SenderUsernameProperties.class); - Assertions.assertEquals("vmezy", model.username()); - Assertions.assertEquals("hxmzsbbzoggig", model.displayName()); + Assertions.assertEquals("injep", model.username()); + Assertions.assertEquals("tmryw", model.displayName()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - SenderUsernameProperties model = - new SenderUsernameProperties().withUsername("vmezy").withDisplayName("hxmzsbbzoggig"); + SenderUsernameProperties model = new SenderUsernameProperties().withUsername("injep").withDisplayName("tmryw"); model = BinaryData.fromObject(model).toObject(SenderUsernameProperties.class); - Assertions.assertEquals("vmezy", model.username()); - Assertions.assertEquals("hxmzsbbzoggig", model.displayName()); + Assertions.assertEquals("injep", model.username()); + Assertions.assertEquals("tmryw", model.displayName()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceCollectionTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceCollectionTests.java index c7b7f6385d93..c6096bf10427 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceCollectionTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceCollectionTests.java @@ -16,11 +16,11 @@ public void testDeserialize() throws Exception { SenderUsernameResourceCollection model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"dataLocation\":\"vvdfwatkpnpul\",\"username\":\"xxbczwtr\",\"displayName\":\"iqzbq\",\"provisioningState\":\"Running\"},\"id\":\"vmyokacspkwl\",\"name\":\"zdobpxjmflbvvnch\",\"type\":\"kcciwwzjuqkhr\"}],\"nextLink\":\"jiwkuofoskghsau\"}") + "{\"value\":[{\"properties\":{\"dataLocation\":\"nbpoczvyifqrvkdv\",\"username\":\"sllr\",\"displayName\":\"vdfwatkpn\",\"provisioningState\":\"Unknown\"},\"id\":\"xxbczwtr\",\"name\":\"wiqzbqjvsovmyo\",\"type\":\"acspkwl\"},{\"properties\":{\"dataLocation\":\"obpxjmflbvvn\",\"username\":\"hrk\",\"displayName\":\"iwwzjuqk\",\"provisioningState\":\"Failed\"},\"id\":\"jiwkuofoskghsau\",\"name\":\"imjm\",\"type\":\"xieduugidyjrr\"},{\"properties\":{\"dataLocation\":\"aos\",\"username\":\"e\",\"displayName\":\"sonpclhocohs\",\"provisioningState\":\"Unknown\"},\"id\":\"leggzfbu\",\"name\":\"fmvfaxkffeiit\",\"type\":\"lvmezyvshxmzsbbz\"},{\"properties\":{\"dataLocation\":\"igrxwburvjxxjn\",\"username\":\"pydptko\",\"displayName\":\"kouknvudwtiu\",\"provisioningState\":\"Unknown\"},\"id\":\"ngkpocipazy\",\"name\":\"o\",\"type\":\"gukgjnpiucgygevq\"}],\"nextLink\":\"typmrbpizcdrqjsd\"}") .toObject(SenderUsernameResourceCollection.class); - Assertions.assertEquals("xxbczwtr", model.value().get(0).username()); - Assertions.assertEquals("iqzbq", model.value().get(0).displayName()); - Assertions.assertEquals("jiwkuofoskghsau", model.nextLink()); + Assertions.assertEquals("sllr", model.value().get(0).username()); + Assertions.assertEquals("vdfwatkpn", model.value().get(0).displayName()); + Assertions.assertEquals("typmrbpizcdrqjsd", model.nextLink()); } @org.junit.jupiter.api.Test @@ -28,11 +28,16 @@ public void testSerialize() throws Exception { SenderUsernameResourceCollection model = new SenderUsernameResourceCollection() .withValue( - Arrays.asList(new SenderUsernameResourceInner().withUsername("xxbczwtr").withDisplayName("iqzbq"))) - .withNextLink("jiwkuofoskghsau"); + Arrays + .asList( + new SenderUsernameResourceInner().withUsername("sllr").withDisplayName("vdfwatkpn"), + new SenderUsernameResourceInner().withUsername("hrk").withDisplayName("iwwzjuqk"), + new SenderUsernameResourceInner().withUsername("e").withDisplayName("sonpclhocohs"), + new SenderUsernameResourceInner().withUsername("pydptko").withDisplayName("kouknvudwtiu"))) + .withNextLink("typmrbpizcdrqjsd"); model = BinaryData.fromObject(model).toObject(SenderUsernameResourceCollection.class); - Assertions.assertEquals("xxbczwtr", model.value().get(0).username()); - Assertions.assertEquals("iqzbq", model.value().get(0).displayName()); - Assertions.assertEquals("jiwkuofoskghsau", model.nextLink()); + Assertions.assertEquals("sllr", model.value().get(0).username()); + Assertions.assertEquals("vdfwatkpn", model.value().get(0).displayName()); + Assertions.assertEquals("typmrbpizcdrqjsd", model.nextLink()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceInnerTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceInnerTests.java index 99bef902b371..33fbd3d5a6df 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceInnerTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernameResourceInnerTests.java @@ -14,18 +14,18 @@ public void testDeserialize() throws Exception { SenderUsernameResourceInner model = BinaryData .fromString( - "{\"properties\":{\"dataLocation\":\"jmvxie\",\"username\":\"uugidyjrrfby\",\"displayName\":\"svexcsonpclhoco\",\"provisioningState\":\"Running\"},\"id\":\"ev\",\"name\":\"eggzfb\",\"type\":\"hfmvfaxkffe\"}") + "{\"properties\":{\"dataLocation\":\"nfyhx\",\"username\":\"eoejzic\",\"displayName\":\"fsj\",\"provisioningState\":\"Running\"},\"id\":\"fbishcbkha\",\"name\":\"deyeamdphagalpbu\",\"type\":\"wgipwhono\"}") .toObject(SenderUsernameResourceInner.class); - Assertions.assertEquals("uugidyjrrfby", model.username()); - Assertions.assertEquals("svexcsonpclhoco", model.displayName()); + Assertions.assertEquals("eoejzic", model.username()); + Assertions.assertEquals("fsj", model.displayName()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { SenderUsernameResourceInner model = - new SenderUsernameResourceInner().withUsername("uugidyjrrfby").withDisplayName("svexcsonpclhoco"); + new SenderUsernameResourceInner().withUsername("eoejzic").withDisplayName("fsj"); model = BinaryData.fromObject(model).toObject(SenderUsernameResourceInner.class); - Assertions.assertEquals("uugidyjrrfby", model.username()); - Assertions.assertEquals("svexcsonpclhoco", model.displayName()); + Assertions.assertEquals("eoejzic", model.username()); + Assertions.assertEquals("fsj", model.displayName()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java index 212a09c80dbc..cafacfc20364 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesCreateOrUpdateWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testCreateOrUpdateWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"dataLocation\":\"mpaxmodfvuefywsb\",\"username\":\"fvmwy\",\"displayName\":\"fouyf\",\"provisioningState\":\"Updating\"},\"id\":\"cpwi\",\"name\":\"zvqtmnubexkp\",\"type\":\"ksmond\"}"; + "{\"properties\":{\"dataLocation\":\"vqtmnub\",\"username\":\"xkp\",\"displayName\":\"smond\",\"provisioningState\":\"Creating\"},\"id\":\"xvy\",\"name\":\"omgkopkwho\",\"type\":\"v\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,13 +62,13 @@ public void testCreateOrUpdateWithResponse() throws Exception { SenderUsernameResource response = manager .senderUsernames() - .define("ld") - .withExistingDomain("pkeqdcvdrhvoo", "sotbob", "dopcjwvnh") - .withUsername("mutwuoe") - .withDisplayName("pkhjwni") + .define("opcjwvnhd") + .withExistingDomain("cvkcvqvpkeqdcv", "rhvoods", "tbobz") + .withUsername("twuoegrpkhjwni") + .withDisplayName("sluicpdggkzz") .create(); - Assertions.assertEquals("fvmwy", response.username()); - Assertions.assertEquals("fouyf", response.displayName()); + Assertions.assertEquals("xkp", response.username()); + Assertions.assertEquals("smond", response.displayName()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java index 78bfab1f04d7..488b074231d8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesDeleteWithResponseMockTests.java @@ -58,6 +58,6 @@ public void testDeleteWithResponse() throws Exception { manager .senderUsernames() - .deleteWithResponse("rwdmhdlxyjrxsa", "afcnih", "wqapnedgfbcvk", "vq", com.azure.core.util.Context.NONE); + .deleteWithResponse("lxyjr", "sag", "fcnihgwq", "pnedgf", com.azure.core.util.Context.NONE); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java index a30ca5a30f8f..5060de147306 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesGetWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"dataLocation\":\"sdyhtozfikdowwq\",\"username\":\"uvxzxclvi\",\"displayName\":\"hqzonosggbhcoh\",\"provisioningState\":\"Deleting\"},\"id\":\"jnkaljutiiswacff\",\"name\":\"dkzzewkfvhqcrail\",\"type\":\"pnppfuf\"}"; + "{\"properties\":{\"dataLocation\":\"hfwdsjnkaljutiis\",\"username\":\"acffgdkzzewkfvhq\",\"displayName\":\"a\",\"provisioningState\":\"Updating\"},\"id\":\"n\",\"name\":\"pfuflrw\",\"type\":\"mh\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,10 +62,10 @@ public void testGetWithResponse() throws Exception { SenderUsernameResource response = manager .senderUsernames() - .getWithResponse("vpbttd", "morppxebmnzbtbh", "pglkf", "ohdneuel", com.azure.core.util.Context.NONE) + .getWithResponse("quuvxzxcl", "ithhqzon", "sg", "b", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("uvxzxclvi", response.username()); - Assertions.assertEquals("hqzonosggbhcoh", response.displayName()); + Assertions.assertEquals("acffgdkzzewkfvhq", response.username()); + Assertions.assertEquals("a", response.displayName()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java index 372cb44685ee..cccee43d4d97 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/SenderUsernamesListByDomainsMockTests.java @@ -32,7 +32,7 @@ public void testListByDomains() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"dataLocation\":\"xndlkzgxhu\",\"username\":\"iplbpodxunkbebxm\",\"displayName\":\"yyntwl\",\"provisioningState\":\"Succeeded\"},\"id\":\"koievseo\",\"name\":\"gqrlltmuwla\",\"type\":\"wzizxbmpgcjefuzm\"}]}"; + "{\"value\":[{\"properties\":{\"dataLocation\":\"tmuwlauwzi\",\"username\":\"xbmp\",\"displayName\":\"jefuzmuvpbttdumo\",\"provisioningState\":\"Succeeded\"},\"id\":\"ebmnzbtbhjpglk\",\"name\":\"gohdneuelfphsd\",\"type\":\"htozfikdow\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,9 +63,9 @@ public void testListByDomains() throws Exception { PagedIterable response = manager .senderUsernames() - .listByDomains("mhhv", "gureodkwobdag", "tibqdxbxwakb", com.azure.core.util.Context.NONE); + .listByDomains("ebxmubyynt", "lrb", "tkoievseotgq", com.azure.core.util.Context.NONE); - Assertions.assertEquals("iplbpodxunkbebxm", response.iterator().next().username()); - Assertions.assertEquals("yyntwl", response.iterator().next().displayName()); + Assertions.assertEquals("xbmp", response.iterator().next().username()); + Assertions.assertEquals("jefuzmuvpbttdumo", response.iterator().next().displayName()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java index c83aa9fb86ca..785bac8bcd4f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/TaggedResourceTests.java @@ -14,17 +14,20 @@ public final class TaggedResourceTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { TaggedResource model = - BinaryData.fromString("{\"tags\":{\"fpfpsalgbquxigj\":\"xppbhtqqro\"}}").toObject(TaggedResource.class); - Assertions.assertEquals("xppbhtqqro", model.tags().get("fpfpsalgbquxigj")); + BinaryData + .fromString("{\"tags\":{\"pymzidnsezcxtbzs\":\"mijcmmxdcufufs\"}}") + .toObject(TaggedResource.class); + Assertions.assertEquals("mijcmmxdcufufs", model.tags().get("pymzidnsezcxtbzs")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - TaggedResource model = new TaggedResource().withTags(mapOf("fpfpsalgbquxigj", "xppbhtqqro")); + TaggedResource model = new TaggedResource().withTags(mapOf("pymzidnsezcxtbzs", "mijcmmxdcufufs")); model = BinaryData.fromObject(model).toObject(TaggedResource.class); - Assertions.assertEquals("xppbhtqqro", model.tags().get("fpfpsalgbquxigj")); + Assertions.assertEquals("mijcmmxdcufufs", model.tags().get("pymzidnsezcxtbzs")); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java index 0ce9d62a6471..432b44b688be 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainPropertiesTests.java @@ -13,15 +13,15 @@ public final class UpdateDomainPropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { UpdateDomainProperties model = - BinaryData.fromString("{\"userEngagementTracking\":\"Disabled\"}").toObject(UpdateDomainProperties.class); - Assertions.assertEquals(UserEngagementTracking.DISABLED, model.userEngagementTracking()); + BinaryData.fromString("{\"userEngagementTracking\":\"Enabled\"}").toObject(UpdateDomainProperties.class); + Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { UpdateDomainProperties model = - new UpdateDomainProperties().withUserEngagementTracking(UserEngagementTracking.DISABLED); + new UpdateDomainProperties().withUserEngagementTracking(UserEngagementTracking.ENABLED); model = BinaryData.fromObject(model).toObject(UpdateDomainProperties.class); - Assertions.assertEquals(UserEngagementTracking.DISABLED, model.userEngagementTracking()); + Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java index 997de4347497..0ecd350cfe43 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UpdateDomainRequestParametersTests.java @@ -17,9 +17,9 @@ public void testDeserialize() throws Exception { UpdateDomainRequestParameters model = BinaryData .fromString( - "{\"properties\":{\"userEngagementTracking\":\"Enabled\"},\"tags\":{\"mcl\":\"jrmvdjwzrlo\",\"jctbza\":\"hijco\",\"sycbkbfk\":\"s\",\"c\":\"ukdkexxppofmxa\"}}") + "{\"properties\":{\"userEngagementTracking\":\"Enabled\"},\"tags\":{\"zxibqeoj\":\"ocjjxhvpmouexh\"}}") .toObject(UpdateDomainRequestParameters.class); - Assertions.assertEquals("jrmvdjwzrlo", model.tags().get("mcl")); + Assertions.assertEquals("ocjjxhvpmouexh", model.tags().get("zxibqeoj")); Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); } @@ -27,13 +27,14 @@ public void testDeserialize() throws Exception { public void testSerialize() throws Exception { UpdateDomainRequestParameters model = new UpdateDomainRequestParameters() - .withTags(mapOf("mcl", "jrmvdjwzrlo", "jctbza", "hijco", "sycbkbfk", "s", "c", "ukdkexxppofmxa")) + .withTags(mapOf("zxibqeoj", "ocjjxhvpmouexh")) .withUserEngagementTracking(UserEngagementTracking.ENABLED); model = BinaryData.fromObject(model).toObject(UpdateDomainRequestParameters.class); - Assertions.assertEquals("jrmvdjwzrlo", model.tags().get("mcl")); + Assertions.assertEquals("ocjjxhvpmouexh", model.tags().get("zxibqeoj")); Assertions.assertEquals(UserEngagementTracking.ENABLED, model.userEngagementTracking()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..b9a96967b541 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/UserAssignedIdentityTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.communication.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = + BinaryData + .fromString( + "{\"principalId\":\"0bbdf5ec-6208-465d-a303-d8e23d6f9c2e\",\"clientId\":\"aa22dffa-45e1-4bc2-a15f-0f5a4511cc1a\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java index a50707932d47..659e6266db16 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java +++ b/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/VerificationParameterTests.java @@ -13,14 +13,14 @@ public final class VerificationParameterTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { VerificationParameter model = - BinaryData.fromString("{\"verificationType\":\"SPF\"}").toObject(VerificationParameter.class); - Assertions.assertEquals(VerificationType.SPF, model.verificationType()); + BinaryData.fromString("{\"verificationType\":\"DKIM\"}").toObject(VerificationParameter.class); + Assertions.assertEquals(VerificationType.DKIM, model.verificationType()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - VerificationParameter model = new VerificationParameter().withVerificationType(VerificationType.SPF); + VerificationParameter model = new VerificationParameter().withVerificationType(VerificationType.DKIM); model = BinaryData.fromObject(model).toObject(VerificationParameter.class); - Assertions.assertEquals(VerificationType.SPF, model.verificationType()); + Assertions.assertEquals(VerificationType.DKIM, model.verificationType()); } } diff --git a/sdk/communication/test-resources/test-resources-post.ps1 b/sdk/communication/test-resources/test-resources-post.ps1 new file mode 100644 index 000000000000..bb1907528f93 --- /dev/null +++ b/sdk/communication/test-resources/test-resources-post.ps1 @@ -0,0 +1,99 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +# This script is used to set up SIP Configuration domains for Azure Communication Services SIP Routing SDK GA tests + +# It is invoked by the https://github.com/Azure/azure-sdk-for-java/blob/main/eng/New-TestResources.ps1 +# script after the ARM template, defined in https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/storage/test-resources.json, +# is finished being deployed. The ARM template is responsible for creating the Storage accounts needed for live tests. + +param ( + [hashtable] $DeploymentOutputs, + [string] $TenantId, + [string] $TestApplicationId, + [string] $TestApplicationSecret +) + +# By default stop for any error. +if (!$PSBoundParameters.ContainsKey('ErrorAction')) { + $ErrorActionPreference = 'Stop' +} + +function Log($Message) { + Write-Host ('{0} - {1}' -f [DateTime]::Now.ToLongTimeString(), $Message) +} + +Log 'Starting sdk\communication\test-resources\test-resources-post.ps1' + +if($DeploymentOutputs.ContainsKey('COMMUNICATION_SERVICE_ENDPOINT')){ + Write-Host "COMMUNICATION_SERVICE_ENDPOINT exists, proceeding." +}else{ + Write-Host "COMMUNICATION_SERVICE_ENDPOINT does not exist, ending" + exit +} + +$communicationServiceEndpoint = $DeploymentOutputs["COMMUNICATION_SERVICE_ENDPOINT"] + +if ($communicationServiceEndpoint -notmatch '\/$') { + Log "adding trailing slash to $communicationServiceEndpoint" + $communicationServiceEndpoint = $communicationServiceEndpoint + "/" +} + +if($DeploymentOutputs.ContainsKey('COMMUNICATION_SERVICE_ACCESS_KEY')){ + Write-Host "COMMUNICATION_SERVICE_ACCESS_KEY exists, proceeding." +}else{ + Write-Host "COMMUNICATION_SERVICE_ACCESS_KEY does not exist, ending" + exit +} + +$communicationServiceApiKey = $DeploymentOutputs["COMMUNICATION_SERVICE_ACCESS_KEY"] +$testDomain = $DeploymentOutputs["AZURE_TEST_DOMAIN"] + +if($DeploymentOutputs.ContainsKey('AZURE_TEST_DOMAIN')){ + Write-Host "AZURE_TEST_DOMAIN exists, proceeding." +}else{ + Write-Host "AZURE_TEST_DOMAIN does not exist, ending" + exit +} + +$payload = @" +{"domains": { "$testDomain": {"enabled": true}},"trunks": null,"routes": null} +"@ + +$utcNow = [DateTimeOffset]::UtcNow.ToString('r', [cultureinfo]::InvariantCulture) +$contentBytes = [Text.Encoding]::UTF8.GetBytes($payload) +$sha256 = [System.Security.Cryptography.HashAlgorithm]::Create('sha256') +$contentHash = $sha256.ComputeHash($contentBytes) +$contentHashBase64String = [Convert]::ToBase64String($contentHash) +$endpointParsedUri = [System.Uri]$communicationServiceEndpoint +$hostAndPort = $endpointParsedUri.Host +$apiVersion = "2023-04-01-preview" +$urlPathAndQuery = $communicationServiceEndpoint + "sip?api-version=$apiVersion" +$stringToSign = "PATCH`n/sip?api-version=$apiVersion`n$utcNow;$hostAndPort;$contentHashBase64String" +$hasher = New-Object System.Security.Cryptography.HMACSHA256 +$hasher.key = [System.Convert]::FromBase64String($communicationServiceApiKey) +$signatureBytes = $hasher.ComputeHash([Text.Encoding]::ASCII.GetBytes($stringToSign)) +$requestSignatureBase64String = [Convert]::ToBase64String($signatureBytes) +$authorizationValue = "HMAC-SHA256 SignedHeaders=date;host;x-ms-content-sha256&Signature=$requestSignatureBase64String" + +$headers = @{ + "Authorization" = $authorizationValue + "x-ms-content-sha256" = $contentHashBase64String + "Date" = $utcNow + "X-Forwarded-Host" = $hostAndPort +} + +try { + Log "Inserting Domains in SipConfig for Communication Livetest Dynamic Resource..." + $response = Invoke-RestMethod -ContentType "application/merge-patch+json" -Uri $urlPathAndQuery -Method PATCH -Headers $headers -UseBasicParsing -Body $payload -Verbose | ConvertTo-Json + Log $response + Log "Inserted Domains in SipConfig for Communication Livetest Dynamic Resource" +} +catch { + Write-Host "Exception while invoking the SIP Config Patch:" + Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__ + Write-Host "StatusDescription:" $_.Exception.Response + Write-Host "Error Message:" $_.ErrorDetails.Message +} + +Log 'Finishing sdk\communication\test-resources\test-resources-post.ps1' diff --git a/sdk/confidentialledger/azure-security-confidentialledger/CHANGELOG.md b/sdk/confidentialledger/azure-security-confidentialledger/CHANGELOG.md index 8af021216179..1958ca34cc0f 100644 --- a/sdk/confidentialledger/azure-security-confidentialledger/CHANGELOG.md +++ b/sdk/confidentialledger/azure-security-confidentialledger/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.0.13 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.0.12 (2023-08-18) ### Other Changes diff --git a/sdk/confidentialledger/azure-security-confidentialledger/README.md b/sdk/confidentialledger/azure-security-confidentialledger/README.md index 3eef4563d994..547dd7308b84 100644 --- a/sdk/confidentialledger/azure-security-confidentialledger/README.md +++ b/sdk/confidentialledger/azure-security-confidentialledger/README.md @@ -49,7 +49,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.10.0 + 1.10.1 ``` diff --git a/sdk/containerregistry/azure-containers-containerregistry/CHANGELOG.md b/sdk/containerregistry/azure-containers-containerregistry/CHANGELOG.md index a6c18f0a614c..4b1cc3c7488c 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/CHANGELOG.md +++ b/sdk/containerregistry/azure-containers-containerregistry/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.2.1 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. + ## 1.2.0 (2023-08-18) ### Other Changes diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientIntegrationTests.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientIntegrationTests.java index e86c9f725c67..168efab20bab 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientIntegrationTests.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientIntegrationTests.java @@ -23,7 +23,6 @@ import com.azure.core.util.FluxUtil; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.jupiter.params.ParameterizedTest; @@ -65,6 +64,7 @@ @Execution(ExecutionMode.SAME_THREAD) public class ContainerRegistryContentClientIntegrationTests extends ContainerRegistryClientsTestBase { + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private ContainerRegistryContentClient client; private ContainerRegistryContentAsyncClient asyncClient; private static final Random RANDOM = new Random(42); @@ -86,14 +86,8 @@ static void beforeAll() { importImage(TestUtils.getTestMode(), HELLO_WORLD_REPOSITORY_NAME, Collections.singletonList("latest")); } - @BeforeEach - void beforeEach() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - @AfterEach void afterEach() { - StepVerifier.resetDefaultTimeout(); cleanupResources(); } @@ -200,7 +194,8 @@ public void canUploadOciManifestAsync(HttpClient httpClient) { assertEquals(MANIFEST_DIGEST, getManifestResult.getDigest()); validateManifest(MANIFEST, getManifestResult.getManifest().toObject(OciImageManifest.class)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -221,8 +216,9 @@ public void canUploadDockerManifestWithTagAsync(HttpClient httpClient) { return asyncClient.getManifest(tag); })) - .assertNext(getManifestResult -> assertEquals(digest, getManifestResult.getDigest())) - .verifyComplete(); + .assertNext(getManifestResult -> assertEquals(digest, getManifestResult.getDigest())) + .expectComplete() + .verify(DEFAULT_TIMEOUT); validateTag("oci-artifact", digest, tag, httpClient); } @@ -240,7 +236,7 @@ public void canUploadBlob(HttpClient httpClient) { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void canUploadHugeBlobInChunks(HttpClient httpClient) throws IOException, InterruptedException { + public void canUploadHugeBlobInChunks(HttpClient httpClient) throws IOException { // test is too long for innerloop assumeTrue(super.getTestMode() == TestMode.LIVE); @@ -268,14 +264,14 @@ public void canUploadHugeBlobInChunksAsync(HttpClient httpClient) { long size = CHUNK_SIZE * 50; Mono data = BinaryData.fromFlux(generateAsyncStream(size), size, false); AtomicLong download = new AtomicLong(0); - StepVerifier.setDefaultTimeout(Duration.ofMinutes(30)); StepVerifier.create(data .flatMap(content -> asyncClient.uploadBlob(content)) .flatMap(r -> asyncClient.downloadStream(r.getDigest())) .flatMapMany(BinaryData::toFluxByteBuffer) .doOnNext(bb -> download.addAndGet(bb.remaining())) .then()) - .verifyComplete(); + .expectComplete() + .verify(Duration.ofMinutes(30)); assertEquals(size, download.get()); } @@ -321,7 +317,8 @@ public void downloadBlobAsync(HttpClient httpClient) throws IOException { return asyncClient.downloadStream(uploadResult.getDigest()); }) .flatMap(r -> FluxUtil.writeToOutputStream(r.toFluxByteBuffer(), stream))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); stream.flush(); assertArrayEquals(content.toBytes(), stream.toByteArray()); @@ -342,7 +339,8 @@ public void downloadSmallBlobAsync(HttpClient httpClient) throws IOException { return asyncClient.downloadStream(uploadResult.getDigest()); }) .flatMap(r -> FluxUtil.writeToOutputStream(r.toFluxByteBuffer(), stream))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); stream.flush(); assertArrayEquals(content.toBytes(), stream.toByteArray()); @@ -377,7 +375,8 @@ public void getManifestAsync(HttpClient httpClient) { assertNotNull(returnedManifest); validateManifest(MANIFEST, returnedManifest); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -441,7 +440,8 @@ public void getManifestListManifestAsync(HttpClient httpClient) { assertEquals(dockerListType.toString(), list.getMediaType()); assertEquals(11, list.getManifests().size()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } private void validateTag(String repoName, String digest, String tag, HttpClient httpClient) { diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/CHANGELOG.md b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/CHANGELOG.md index 066adad9504a..a0d770d02593 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/CHANGELOG.md +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.3 (Unreleased) ### Features Added @@ -10,6 +10,73 @@ ### Other Changes +## 1.0.0-beta.2 (2023-09-14) + +- Azure Resource Manager ContainerServiceFleet client library for Java. This package contains Microsoft Azure SDK for ContainerServiceFleet Management SDK. Azure Kubernetes Fleet Manager Client. Package tag package-2023-06-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Breaking Changes + +#### `models.UpdateRun` was modified + +* `systemData()` was removed + +### Features Added + +* `models.ApiServerAccessProfile` was added + +* `models.UserAssignedIdentity` was added + +* `models.AgentProfile` was added + +* `models.ManagedServiceIdentity` was added + +* `models.NodeImageSelection` was added + +* `models.NodeImageSelectionStatus` was added + +* `models.NodeImageVersion` was added + +* `models.ManagedServiceIdentityType` was added + +* `models.NodeImageSelectionType` was added + +#### `models.FleetPatch` was modified + +* `withIdentity(models.ManagedServiceIdentity)` was added +* `identity()` was added + +#### `models.Fleet` was modified + +* `identity()` was added + +#### `models.Fleet$Definition` was modified + +* `withIdentity(models.ManagedServiceIdentity)` was added + +#### `models.FleetHubProfile` was modified + +* `agentProfile()` was added +* `apiServerAccessProfile()` was added +* `withAgentProfile(models.AgentProfile)` was added +* `withApiServerAccessProfile(models.ApiServerAccessProfile)` was added + +#### `models.MemberUpdateStatus` was modified + +* `message()` was added + +#### `models.ManagedClusterUpdate` was modified + +* `withNodeImageSelection(models.NodeImageSelection)` was added +* `nodeImageSelection()` was added + +#### `models.Fleet$Update` was modified + +* `withIdentity(models.ManagedServiceIdentity)` was added + +#### `models.UpdateRunStatus` was modified + +* `nodeImageSelection()` was added + ## 1.0.0-beta.1 (2023-06-21) - Azure Resource Manager ContainerServiceFleet client library for Java. This package contains Microsoft Azure SDK for ContainerServiceFleet Management SDK. Azure Kubernetes Fleet Manager Client. Package tag package-2023-03-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/README.md b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/README.md index dec1589e1ecb..4b48641ff5f6 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/README.md +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/README.md @@ -2,7 +2,7 @@ Azure Resource Manager ContainerServiceFleet client library for Java. -This package contains Microsoft Azure SDK for ContainerServiceFleet Management SDK. Azure Kubernetes Fleet Manager Client. Package tag package-2023-03-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for ContainerServiceFleet Management SDK. Azure Kubernetes Fleet Manager Client. Package tag package-2023-06-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-containerservicefleet - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -103,3 +103,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcontainerservicefleet%2Fazure-resourcemanager-containerservicefleet%2FREADME.png) diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/SAMPLE.md b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/SAMPLE.md index eb8bbe4c012b..a27d7dc8d35c 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/SAMPLE.md +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/SAMPLE.md @@ -37,7 +37,7 @@ /** Samples for FleetMembers Create. */ public final class FleetMembersCreateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Create.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Create.json */ /** * Sample code: Creates a FleetMember resource with a long running operation. @@ -63,7 +63,7 @@ public final class FleetMembersCreateSamples { /** Samples for FleetMembers Delete. */ public final class FleetMembersDeleteSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Delete.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Delete.json */ /** * Sample code: Deletes a FleetMember resource asynchronously with a long running operation. @@ -83,7 +83,7 @@ public final class FleetMembersDeleteSamples { /** Samples for FleetMembers Get. */ public final class FleetMembersGetSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Get.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Get.json */ /** * Sample code: Gets a FleetMember resource. @@ -103,7 +103,7 @@ public final class FleetMembersGetSamples { /** Samples for FleetMembers ListByFleet. */ public final class FleetMembersListByFleetSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_ListByFleet.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_ListByFleet.json */ /** * Sample code: Lists the members of a Fleet. @@ -125,7 +125,7 @@ import com.azure.resourcemanager.containerservicefleet.models.FleetMember; /** Samples for FleetMembers Update. */ public final class FleetMembersUpdateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Update.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Update.json */ /** * Sample code: Updates a FleetMember resource synchronously. @@ -154,7 +154,7 @@ import java.util.Map; /** Samples for Fleets CreateOrUpdate. */ public final class FleetsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_CreateOrUpdate.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_CreateOrUpdate.json */ /** * Sample code: Creates a Fleet resource with a long running operation. @@ -173,6 +173,7 @@ public final class FleetsCreateOrUpdateSamples { .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -192,7 +193,7 @@ public final class FleetsCreateOrUpdateSamples { /** Samples for Fleets Delete. */ public final class FleetsDeleteSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_Delete.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_Delete.json */ /** * Sample code: Deletes a Fleet resource asynchronously with a long running operation. @@ -212,7 +213,7 @@ public final class FleetsDeleteSamples { /** Samples for Fleets GetByResourceGroup. */ public final class FleetsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_Get.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_Get.json */ /** * Sample code: Gets a Fleet resource. @@ -232,7 +233,7 @@ public final class FleetsGetByResourceGroupSamples { /** Samples for Fleets List. */ public final class FleetsListSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_ListBySub.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_ListBySub.json */ /** * Sample code: Lists the Fleet resources in a subscription. @@ -252,7 +253,7 @@ public final class FleetsListSamples { /** Samples for Fleets ListByResourceGroup. */ public final class FleetsListByResourceGroupSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_ListByResourceGroup.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_ListByResourceGroup.json */ /** * Sample code: Lists the Fleet resources in a resource group. @@ -272,7 +273,7 @@ public final class FleetsListByResourceGroupSamples { /** Samples for Fleets ListCredentials. */ public final class FleetsListCredentialsSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_ListCredentialsResult.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_ListCredentialsResult.json */ /** * Sample code: Lists the user credentials of a Fleet. @@ -296,7 +297,7 @@ import java.util.Map; /** Samples for Fleets Update. */ public final class FleetsUpdateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_PatchTags.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_PatchTags.json */ /** * Sample code: Update a Fleet. @@ -313,6 +314,7 @@ public final class FleetsUpdateSamples { resource.update().withTags(mapOf("env", "prod", "tier", "secure")).withIfMatch("dfjkwelr7384").apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -332,7 +334,7 @@ public final class FleetsUpdateSamples { /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Operations_List.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Operations_List.json */ /** * Sample code: List the operations for the provider. @@ -352,6 +354,8 @@ public final class OperationsListSamples { import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeSpec; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelection; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; import com.azure.resourcemanager.containerservicefleet.models.UpdateGroup; import com.azure.resourcemanager.containerservicefleet.models.UpdateRunStrategy; import com.azure.resourcemanager.containerservicefleet.models.UpdateStage; @@ -360,7 +364,7 @@ import java.util.Arrays; /** Samples for UpdateRuns CreateOrUpdate. */ public final class UpdateRunsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_CreateOrUpdate.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_CreateOrUpdate.json */ /** * Sample code: Create an UpdateRun. @@ -387,7 +391,8 @@ public final class UpdateRunsCreateOrUpdateSamples { .withUpgrade( new ManagedClusterUpgradeSpec() .withType(ManagedClusterUpgradeType.FULL) - .withKubernetesVersion("1.26.1"))) + .withKubernetesVersion("1.26.1")) + .withNodeImageSelection(new NodeImageSelection().withType(NodeImageSelectionType.LATEST))) .create(); } } @@ -399,7 +404,7 @@ public final class UpdateRunsCreateOrUpdateSamples { /** Samples for UpdateRuns Delete. */ public final class UpdateRunsDeleteSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Delete.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Delete.json */ /** * Sample code: Delete an updateRun resource. @@ -419,7 +424,7 @@ public final class UpdateRunsDeleteSamples { /** Samples for UpdateRuns Get. */ public final class UpdateRunsGetSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Get.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Get.json */ /** * Sample code: Gets an UpdateRun resource. @@ -439,7 +444,7 @@ public final class UpdateRunsGetSamples { /** Samples for UpdateRuns ListByFleet. */ public final class UpdateRunsListByFleetSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_ListByFleet.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_ListByFleet.json */ /** * Sample code: Lists the UpdateRun resources by fleet. @@ -459,7 +464,7 @@ public final class UpdateRunsListByFleetSamples { /** Samples for UpdateRuns Start. */ public final class UpdateRunsStartSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Start.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Start.json */ /** * Sample code: Starts an UpdateRun. @@ -479,7 +484,7 @@ public final class UpdateRunsStartSamples { /** Samples for UpdateRuns Stop. */ public final class UpdateRunsStopSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Stop.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Stop.json */ /** * Sample code: Stops an UpdateRun. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/pom.xml b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/pom.xml index 994dfacdaee0..bfbcc9e242ae 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/pom.xml +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/pom.xml @@ -14,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-containerservicefleet - 1.0.0-beta.2 + 1.0.0-beta.3 jar Microsoft Azure SDK for ContainerServiceFleet Management - This package contains Microsoft Azure SDK for ContainerServiceFleet Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Kubernetes Fleet Manager Client. Package tag package-2023-03-preview. + This package contains Microsoft Azure SDK for ContainerServiceFleet Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Kubernetes Fleet Manager Client. Package tag package-2023-06-preview. https://github.com/Azure/azure-sdk-for-java @@ -45,6 +45,7 @@ UTF-8 0 0 + true diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/ContainerServiceFleetManager.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/ContainerServiceFleetManager.java index c830f572a53b..f2e53c17c4f6 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/ContainerServiceFleetManager.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/ContainerServiceFleetManager.java @@ -216,7 +216,7 @@ public ContainerServiceFleetManager authenticate(TokenCredential credential, Azu .append("-") .append("com.azure.resourcemanager.containerservicefleet") .append("/") - .append("1.0.0-beta.1"); + .append("1.0.0-beta.2"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -322,8 +322,10 @@ public UpdateRuns updateRuns() { } /** - * @return Wrapped service client ContainerServiceFleetManagementClient providing direct access to the underlying - * auto-generated API implementation, based on Azure REST API. + * Gets wrapped service client ContainerServiceFleetManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client ContainerServiceFleetManagementClient. */ public ContainerServiceFleetManagementClient serviceClient() { return this.clientObject; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/FleetMembersClient.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/FleetMembersClient.java index 0471f5c8a45b..f63d744b178d 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/FleetMembersClient.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/FleetMembersClient.java @@ -155,6 +155,22 @@ FleetMemberInner create( String ifNoneMatch, Context context); + /** + * Update a FleetMember. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a member of the Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetMemberInner> beginUpdate( + String resourceGroupName, String fleetName, String fleetMemberName, FleetMemberUpdate properties); + /** * Update a FleetMember. * @@ -167,10 +183,10 @@ FleetMemberInner create( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a member of the Fleet along with {@link Response}. + * @return the {@link SyncPoller} for polling of a member of the Fleet. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetMemberInner> beginUpdate( String resourceGroupName, String fleetName, String fleetMemberName, @@ -194,6 +210,29 @@ Response updateWithResponse( FleetMemberInner update( String resourceGroupName, String fleetName, String fleetMemberName, FleetMemberUpdate properties); + /** + * Update a FleetMember. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a member of the Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetMemberInner update( + String resourceGroupName, + String fleetName, + String fleetMemberName, + FleetMemberUpdate properties, + String ifMatch, + Context context); + /** * Delete a FleetMember. * diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/FleetsClient.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/FleetsClient.java index 8e13481a37f9..1a8a5cc3e72b 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/FleetsClient.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/FleetsClient.java @@ -166,6 +166,21 @@ FleetInner createOrUpdate( String ifNoneMatch, Context context); + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginUpdate( + String resourceGroupName, String fleetName, FleetPatch properties); + /** * Update a Fleet. * @@ -177,10 +192,10 @@ FleetInner createOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Fleet resource along with {@link Response}. + * @return the {@link SyncPoller} for polling of the Fleet resource. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginUpdate( String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch, Context context); /** @@ -197,6 +212,23 @@ Response updateWithResponse( @ServiceMethod(returns = ReturnType.SINGLE) FleetInner update(String resourceGroupName, String fleetName, FleetPatch properties); + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner update( + String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch, Context context); + /** * Delete a Fleet. * diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/models/FleetInner.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/models/FleetInner.java index eb33abb3b654..9ae7c731c534 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/models/FleetInner.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/models/FleetInner.java @@ -9,6 +9,7 @@ import com.azure.core.management.SystemData; import com.azure.resourcemanager.containerservicefleet.models.FleetHubProfile; import com.azure.resourcemanager.containerservicefleet.models.FleetProvisioningState; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentity; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -30,6 +31,12 @@ public final class FleetInner extends Resource { @JsonProperty(value = "eTag", access = JsonProperty.Access.WRITE_ONLY) private String etag; + /* + * Managed identity. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ @@ -61,6 +68,26 @@ public String etag() { return this.etag; } + /** + * Get the identity property: Managed identity. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity. + * + * @param identity the identity value to set. + * @return the FleetInner object itself. + */ + public FleetInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + /** * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * @@ -125,5 +152,8 @@ public void validate() { if (innerProperties() != null) { innerProperties().validate(); } + if (identity() != null) { + identity().validate(); + } } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/models/UpdateRunInner.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/models/UpdateRunInner.java index d38284fb3d31..13ad07a5daeb 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/models/UpdateRunInner.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/fluent/models/UpdateRunInner.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate; import com.azure.resourcemanager.containerservicefleet.models.UpdateRunProvisioningState; import com.azure.resourcemanager.containerservicefleet.models.UpdateRunStatus; @@ -31,12 +30,6 @@ public final class UpdateRunInner extends ProxyResource { @JsonProperty(value = "eTag", access = JsonProperty.Access.WRITE_ONLY) private String etag; - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /** Creates an instance of UpdateRunInner class. */ public UpdateRunInner() { } @@ -62,15 +55,6 @@ public String etag() { return this.etag; } - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the provisioningState property: The provisioning state of the UpdateRun resource. * diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/ContainerServiceFleetManagementClientBuilder.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/ContainerServiceFleetManagementClientBuilder.java index acfe1c1ad16f..c6c133263ee1 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/ContainerServiceFleetManagementClientBuilder.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/ContainerServiceFleetManagementClientBuilder.java @@ -137,7 +137,7 @@ public ContainerServiceFleetManagementClientImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/ContainerServiceFleetManagementClientImpl.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/ContainerServiceFleetManagementClientImpl.java index c935723c3379..b825b86c289f 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/ContainerServiceFleetManagementClientImpl.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/ContainerServiceFleetManagementClientImpl.java @@ -181,7 +181,7 @@ public UpdateRunsClient getUpdateRuns() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2023-03-15-preview"; + this.apiVersion = "2023-06-15-preview"; this.operations = new OperationsClientImpl(this); this.fleets = new FleetsClientImpl(this); this.fleetMembers = new FleetMembersClientImpl(this); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetImpl.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetImpl.java index faec43979470..ec42ed7e9ad0 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetImpl.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetImpl.java @@ -14,6 +14,7 @@ import com.azure.resourcemanager.containerservicefleet.models.FleetHubProfile; import com.azure.resourcemanager.containerservicefleet.models.FleetPatch; import com.azure.resourcemanager.containerservicefleet.models.FleetProvisioningState; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentity; import java.util.Collections; import java.util.Map; @@ -51,6 +52,10 @@ public String etag() { return this.innerModel().etag(); } + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + public SystemData systemData() { return this.innerModel().systemData(); } @@ -140,8 +145,7 @@ public Fleet apply() { serviceManager .serviceClient() .getFleets() - .updateWithResponse(resourceGroupName, fleetName, updateProperties, updateIfMatch, Context.NONE) - .getValue(); + .update(resourceGroupName, fleetName, updateProperties, updateIfMatch, Context.NONE); return this; } @@ -150,8 +154,7 @@ public Fleet apply(Context context) { serviceManager .serviceClient() .getFleets() - .updateWithResponse(resourceGroupName, fleetName, updateProperties, updateIfMatch, context) - .getValue(); + .update(resourceGroupName, fleetName, updateProperties, updateIfMatch, context); return this; } @@ -212,6 +215,16 @@ public FleetImpl withTags(Map tags) { } } + public FleetImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + public FleetImpl withHubProfile(FleetHubProfile hubProfile) { this.innerModel().withHubProfile(hubProfile); return this; diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetMemberImpl.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetMemberImpl.java index 56c962e867b9..e0af292a07ba 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetMemberImpl.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetMemberImpl.java @@ -132,9 +132,7 @@ public FleetMember apply() { serviceManager .serviceClient() .getFleetMembers() - .updateWithResponse( - resourceGroupName, fleetName, fleetMemberName, updateProperties, updateIfMatch, Context.NONE) - .getValue(); + .update(resourceGroupName, fleetName, fleetMemberName, updateProperties, updateIfMatch, Context.NONE); return this; } @@ -143,9 +141,7 @@ public FleetMember apply(Context context) { serviceManager .serviceClient() .getFleetMembers() - .updateWithResponse( - resourceGroupName, fleetName, fleetMemberName, updateProperties, updateIfMatch, context) - .getValue(); + .update(resourceGroupName, fleetName, fleetMemberName, updateProperties, updateIfMatch, context); return this; } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetMembersClientImpl.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetMembersClientImpl.java index 90c28879b844..6761e079572c 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetMembersClientImpl.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetMembersClientImpl.java @@ -116,9 +116,9 @@ Mono>> create( @Headers({"Content-Type: application/json"}) @Patch( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}") - @ExpectedResponses({200}) + @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( + Mono>> update( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -921,7 +921,7 @@ public FleetMemberInner create( * @return a member of the Fleet along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String fleetName, String fleetMemberName, @@ -989,7 +989,7 @@ private Mono> updateWithResponseAsync( * @return a member of the Fleet along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String fleetName, String fleetMemberName, @@ -1040,6 +1040,170 @@ private Mono> updateWithResponseAsync( context); } + /** + * Update a FleetMember. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a member of the Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetMemberInner> beginUpdateAsync( + String resourceGroupName, + String fleetName, + String fleetMemberName, + FleetMemberUpdate properties, + String ifMatch) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + FleetMemberInner.class, + FleetMemberInner.class, + this.client.getContext()); + } + + /** + * Update a FleetMember. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a member of the Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetMemberInner> beginUpdateAsync( + String resourceGroupName, String fleetName, String fleetMemberName, FleetMemberUpdate properties) { + final String ifMatch = null; + Mono>> mono = + updateWithResponseAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + FleetMemberInner.class, + FleetMemberInner.class, + this.client.getContext()); + } + + /** + * Update a FleetMember. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a member of the Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetMemberInner> beginUpdateAsync( + String resourceGroupName, + String fleetName, + String fleetMemberName, + FleetMemberUpdate properties, + String ifMatch, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FleetMemberInner.class, FleetMemberInner.class, context); + } + + /** + * Update a FleetMember. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a member of the Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetMemberInner> beginUpdate( + String resourceGroupName, String fleetName, String fleetMemberName, FleetMemberUpdate properties) { + final String ifMatch = null; + return this + .beginUpdateAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch) + .getSyncPoller(); + } + + /** + * Update a FleetMember. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a member of the Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetMemberInner> beginUpdate( + String resourceGroupName, + String fleetName, + String fleetMemberName, + FleetMemberUpdate properties, + String ifMatch, + Context context) { + return this + .beginUpdateAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch, context) + .getSyncPoller(); + } + + /** + * Update a FleetMember. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a member of the Fleet on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String fleetName, + String fleetMemberName, + FleetMemberUpdate properties, + String ifMatch) { + return beginUpdateAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + /** * Update a FleetMember. * @@ -1056,8 +1220,9 @@ private Mono> updateWithResponseAsync( private Mono updateAsync( String resourceGroupName, String fleetName, String fleetMemberName, FleetMemberUpdate properties) { final String ifMatch = null; - return updateWithResponseAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + return beginUpdateAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1072,18 +1237,19 @@ private Mono updateAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a member of the Fleet along with {@link Response}. + * @return a member of the Fleet on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( + private Mono updateAsync( String resourceGroupName, String fleetName, String fleetMemberName, FleetMemberUpdate properties, String ifMatch, Context context) { - return updateWithResponseAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch, context) - .block(); + return beginUpdateAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1102,8 +1268,32 @@ public Response updateWithResponse( public FleetMemberInner update( String resourceGroupName, String fleetName, String fleetMemberName, FleetMemberUpdate properties) { final String ifMatch = null; - return updateWithResponse(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch, Context.NONE) - .getValue(); + return updateAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch).block(); + } + + /** + * Update a FleetMember. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param fleetMemberName The name of the Fleet member resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a member of the Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetMemberInner update( + String resourceGroupName, + String fleetName, + String fleetMemberName, + FleetMemberUpdate properties, + String ifMatch, + Context context) { + return updateAsync(resourceGroupName, fleetName, fleetMemberName, properties, ifMatch, context).block(); } /** diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetsClientImpl.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetsClientImpl.java index 4f4b74c66b7f..f2cf5e21992c 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetsClientImpl.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/FleetsClientImpl.java @@ -125,9 +125,9 @@ Mono>> createOrUpdate( @Headers({"Content-Type: application/json"}) @Patch( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}") - @ExpectedResponses({200}) + @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( + Mono>> update( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -1009,7 +1009,7 @@ public FleetInner createOrUpdate( * @return the Fleet resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch) { if (this.client.getEndpoint() == null) { return Mono @@ -1067,7 +1067,7 @@ private Mono> updateWithResponseAsync( * @return the Fleet resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1108,6 +1108,134 @@ private Mono> updateWithResponseAsync( context); } + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetInner> beginUpdateAsync( + String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, fleetName, properties, ifMatch); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FleetInner.class, FleetInner.class, this.client.getContext()); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetInner> beginUpdateAsync( + String resourceGroupName, String fleetName, FleetPatch properties) { + final String ifMatch = null; + Mono>> mono = + updateWithResponseAsync(resourceGroupName, fleetName, properties, ifMatch); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FleetInner.class, FleetInner.class, this.client.getContext()); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetInner> beginUpdateAsync( + String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, fleetName, properties, ifMatch, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FleetInner.class, FleetInner.class, context); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetInner> beginUpdate( + String resourceGroupName, String fleetName, FleetPatch properties) { + final String ifMatch = null; + return this.beginUpdateAsync(resourceGroupName, fleetName, properties, ifMatch).getSyncPoller(); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetInner> beginUpdate( + String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch, Context context) { + return this.beginUpdateAsync(resourceGroupName, fleetName, properties, ifMatch, context).getSyncPoller(); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Fleet resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch) { + return beginUpdateAsync(resourceGroupName, fleetName, properties, ifMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + /** * Update a Fleet. * @@ -1122,8 +1250,9 @@ private Mono> updateWithResponseAsync( @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync(String resourceGroupName, String fleetName, FleetPatch properties) { final String ifMatch = null; - return updateWithResponseAsync(resourceGroupName, fleetName, properties, ifMatch) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + return beginUpdateAsync(resourceGroupName, fleetName, properties, ifMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1137,12 +1266,14 @@ private Mono updateAsync(String resourceGroupName, String fleetName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the Fleet resource along with {@link Response}. + * @return the Fleet resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( + private Mono updateAsync( String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch, Context context) { - return updateWithResponseAsync(resourceGroupName, fleetName, properties, ifMatch, context).block(); + return beginUpdateAsync(resourceGroupName, fleetName, properties, ifMatch, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -1159,7 +1290,26 @@ public Response updateWithResponse( @ServiceMethod(returns = ReturnType.SINGLE) public FleetInner update(String resourceGroupName, String fleetName, FleetPatch properties) { final String ifMatch = null; - return updateWithResponse(resourceGroupName, fleetName, properties, ifMatch, Context.NONE).getValue(); + return updateAsync(resourceGroupName, fleetName, properties, ifMatch).block(); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Fleet resource. + * @param properties The resource properties to be updated. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner update( + String resourceGroupName, String fleetName, FleetPatch properties, String ifMatch, Context context) { + return updateAsync(resourceGroupName, fleetName, properties, ifMatch, context).block(); } /** diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/UpdateRunImpl.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/UpdateRunImpl.java index 881a14875ab3..200f8a64f00b 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/UpdateRunImpl.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/implementation/UpdateRunImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.containerservicefleet.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.containerservicefleet.fluent.models.UpdateRunInner; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate; @@ -34,10 +33,6 @@ public String etag() { return this.innerModel().etag(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public UpdateRunProvisioningState provisioningState() { return this.innerModel().provisioningState(); } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/AgentProfile.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/AgentProfile.java new file mode 100644 index 000000000000..43397ae41c43 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/AgentProfile.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Agent profile for the Fleet hub. */ +@Fluent +public final class AgentProfile { + /* + * The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet and subnet + * will be generated and used. + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /** Creates an instance of AgentProfile class. */ + public AgentProfile() { + } + + /** + * Get the subnetId property: The ID of the subnet which the Fleet hub node will join on startup. If this is not + * specified, a vnet and subnet will be generated and used. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: The ID of the subnet which the Fleet hub node will join on startup. If this is not + * specified, a vnet and subnet will be generated and used. + * + * @param subnetId the subnetId value to set. + * @return the AgentProfile object itself. + */ + public AgentProfile withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ApiServerAccessProfile.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ApiServerAccessProfile.java new file mode 100644 index 000000000000..3f2b6771dd07 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ApiServerAccessProfile.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Access profile for the Fleet hub API server. */ +@Fluent +public final class ApiServerAccessProfile { + /* + * Whether to create the Fleet hub as a private cluster or not. + */ + @JsonProperty(value = "enablePrivateCluster") + private Boolean enablePrivateCluster; + + /* + * Whether to enable apiserver vnet integration for the Fleet hub or not. + */ + @JsonProperty(value = "enableVnetIntegration") + private Boolean enableVnetIntegration; + + /* + * The subnet to be used when apiserver vnet integration is enabled. It is required when creating a new Fleet with + * BYO vnet. + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /** Creates an instance of ApiServerAccessProfile class. */ + public ApiServerAccessProfile() { + } + + /** + * Get the enablePrivateCluster property: Whether to create the Fleet hub as a private cluster or not. + * + * @return the enablePrivateCluster value. + */ + public Boolean enablePrivateCluster() { + return this.enablePrivateCluster; + } + + /** + * Set the enablePrivateCluster property: Whether to create the Fleet hub as a private cluster or not. + * + * @param enablePrivateCluster the enablePrivateCluster value to set. + * @return the ApiServerAccessProfile object itself. + */ + public ApiServerAccessProfile withEnablePrivateCluster(Boolean enablePrivateCluster) { + this.enablePrivateCluster = enablePrivateCluster; + return this; + } + + /** + * Get the enableVnetIntegration property: Whether to enable apiserver vnet integration for the Fleet hub or not. + * + * @return the enableVnetIntegration value. + */ + public Boolean enableVnetIntegration() { + return this.enableVnetIntegration; + } + + /** + * Set the enableVnetIntegration property: Whether to enable apiserver vnet integration for the Fleet hub or not. + * + * @param enableVnetIntegration the enableVnetIntegration value to set. + * @return the ApiServerAccessProfile object itself. + */ + public ApiServerAccessProfile withEnableVnetIntegration(Boolean enableVnetIntegration) { + this.enableVnetIntegration = enableVnetIntegration; + return this; + } + + /** + * Get the subnetId property: The subnet to be used when apiserver vnet integration is enabled. It is required when + * creating a new Fleet with BYO vnet. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: The subnet to be used when apiserver vnet integration is enabled. It is required when + * creating a new Fleet with BYO vnet. + * + * @param subnetId the subnetId value to set. + * @return the ApiServerAccessProfile object itself. + */ + public ApiServerAccessProfile withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/Fleet.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/Fleet.java index 5992bbf9d6c4..063c11164564 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/Fleet.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/Fleet.java @@ -58,6 +58,13 @@ public interface Fleet { */ String etag(); + /** + * Gets the identity property: Managed identity. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + /** * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * @@ -114,11 +121,13 @@ interface Definition DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } + /** The Fleet definition stages. */ interface DefinitionStages { /** The first stage of the Fleet definition. */ interface Blank extends WithLocation { } + /** The stage of the Fleet definition allowing to specify location. */ interface WithLocation { /** @@ -137,6 +146,7 @@ interface WithLocation { */ WithResourceGroup withRegion(String location); } + /** The stage of the Fleet definition allowing to specify parent resource. */ interface WithResourceGroup { /** @@ -147,12 +157,14 @@ interface WithResourceGroup { */ WithCreate withExistingResourceGroup(String resourceGroupName); } + /** * The stage of the Fleet definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. */ interface WithCreate extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, DefinitionStages.WithHubProfile, DefinitionStages.WithIfMatch, DefinitionStages.WithIfNoneMatch { @@ -171,6 +183,7 @@ interface WithCreate */ Fleet create(Context context); } + /** The stage of the Fleet definition allowing to specify tags. */ interface WithTags { /** @@ -181,6 +194,18 @@ interface WithTags { */ WithCreate withTags(Map tags); } + + /** The stage of the Fleet definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed identity.. + * + * @param identity Managed identity. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the Fleet definition allowing to specify hubProfile. */ interface WithHubProfile { /** @@ -191,6 +216,7 @@ interface WithHubProfile { */ WithCreate withHubProfile(FleetHubProfile hubProfile); } + /** The stage of the Fleet definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -201,6 +227,7 @@ interface WithIfMatch { */ WithCreate withIfMatch(String ifMatch); } + /** The stage of the Fleet definition allowing to specify ifNoneMatch. */ interface WithIfNoneMatch { /** @@ -212,6 +239,7 @@ interface WithIfNoneMatch { WithCreate withIfNoneMatch(String ifNoneMatch); } } + /** * Begins update for the Fleet resource. * @@ -220,7 +248,7 @@ interface WithIfNoneMatch { Fleet.Update update(); /** The template for Fleet update. */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithIfMatch { + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithIfMatch { /** * Executes the update request. * @@ -236,6 +264,7 @@ interface Update extends UpdateStages.WithTags, UpdateStages.WithIfMatch { */ Fleet apply(Context context); } + /** The Fleet update stages. */ interface UpdateStages { /** The stage of the Fleet update allowing to specify tags. */ @@ -248,6 +277,18 @@ interface WithTags { */ Update withTags(Map tags); } + + /** The stage of the Fleet update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed identity.. + * + * @param identity Managed identity. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the Fleet update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -259,6 +300,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetHubProfile.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetHubProfile.java index 9c9d80bdfba5..ad871aca8ba8 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetHubProfile.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetHubProfile.java @@ -16,6 +16,18 @@ public final class FleetHubProfile { @JsonProperty(value = "dnsPrefix") private String dnsPrefix; + /* + * The access profile for the Fleet hub API server. + */ + @JsonProperty(value = "apiServerAccessProfile") + private ApiServerAccessProfile apiServerAccessProfile; + + /* + * The agent profile for the Fleet hub. + */ + @JsonProperty(value = "agentProfile") + private AgentProfile agentProfile; + /* * The FQDN of the Fleet hub. */ @@ -52,6 +64,46 @@ public FleetHubProfile withDnsPrefix(String dnsPrefix) { return this; } + /** + * Get the apiServerAccessProfile property: The access profile for the Fleet hub API server. + * + * @return the apiServerAccessProfile value. + */ + public ApiServerAccessProfile apiServerAccessProfile() { + return this.apiServerAccessProfile; + } + + /** + * Set the apiServerAccessProfile property: The access profile for the Fleet hub API server. + * + * @param apiServerAccessProfile the apiServerAccessProfile value to set. + * @return the FleetHubProfile object itself. + */ + public FleetHubProfile withApiServerAccessProfile(ApiServerAccessProfile apiServerAccessProfile) { + this.apiServerAccessProfile = apiServerAccessProfile; + return this; + } + + /** + * Get the agentProfile property: The agent profile for the Fleet hub. + * + * @return the agentProfile value. + */ + public AgentProfile agentProfile() { + return this.agentProfile; + } + + /** + * Set the agentProfile property: The agent profile for the Fleet hub. + * + * @param agentProfile the agentProfile value to set. + * @return the FleetHubProfile object itself. + */ + public FleetHubProfile withAgentProfile(AgentProfile agentProfile) { + this.agentProfile = agentProfile; + return this; + } + /** * Get the fqdn property: The FQDN of the Fleet hub. * @@ -76,5 +128,11 @@ public String kubernetesVersion() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (apiServerAccessProfile() != null) { + apiServerAccessProfile().validate(); + } + if (agentProfile() != null) { + agentProfile().validate(); + } } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetMember.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetMember.java index c8c2be0c107c..fcd78346cce8 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetMember.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetMember.java @@ -89,11 +89,13 @@ public interface FleetMember { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The FleetMember definition stages. */ interface DefinitionStages { /** The first stage of the FleetMember definition. */ interface Blank extends WithParentResource { } + /** The stage of the FleetMember definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -105,6 +107,7 @@ interface WithParentResource { */ WithCreate withExistingFleet(String resourceGroupName, String fleetName); } + /** * The stage of the FleetMember definition which contains all the minimum required properties for the resource * to be created, but also allows for any other optional properties to be specified. @@ -129,6 +132,7 @@ interface WithCreate */ FleetMember create(Context context); } + /** The stage of the FleetMember definition allowing to specify clusterResourceId. */ interface WithClusterResourceId { /** @@ -143,6 +147,7 @@ interface WithClusterResourceId { */ WithCreate withClusterResourceId(String clusterResourceId); } + /** The stage of the FleetMember definition allowing to specify group. */ interface WithGroup { /** @@ -153,6 +158,7 @@ interface WithGroup { */ WithCreate withGroup(String group); } + /** The stage of the FleetMember definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -163,6 +169,7 @@ interface WithIfMatch { */ WithCreate withIfMatch(String ifMatch); } + /** The stage of the FleetMember definition allowing to specify ifNoneMatch. */ interface WithIfNoneMatch { /** @@ -174,6 +181,7 @@ interface WithIfNoneMatch { WithCreate withIfNoneMatch(String ifNoneMatch); } } + /** * Begins update for the FleetMember resource. * @@ -198,6 +206,7 @@ interface Update extends UpdateStages.WithGroup, UpdateStages.WithIfMatch { */ FleetMember apply(Context context); } + /** The FleetMember update stages. */ interface UpdateStages { /** The stage of the FleetMember update allowing to specify group. */ @@ -210,6 +219,7 @@ interface WithGroup { */ Update withGroup(String group); } + /** The stage of the FleetMember update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -221,6 +231,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetPatch.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetPatch.java index b30127962ba6..f91f23d30594 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetPatch.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/FleetPatch.java @@ -19,6 +19,12 @@ public final class FleetPatch { @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; + /* + * Managed identity. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + /** Creates an instance of FleetPatch class. */ public FleetPatch() { } @@ -43,11 +49,34 @@ public FleetPatch withTags(Map tags) { return this; } + /** + * Get the identity property: Managed identity. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity. + * + * @param identity the identity value to set. + * @return the FleetPatch object itself. + */ + public FleetPatch withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (identity() != null) { + identity().validate(); + } } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedClusterUpdate.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedClusterUpdate.java index 50aeaa31f228..c720623b9d7a 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedClusterUpdate.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedClusterUpdate.java @@ -17,6 +17,12 @@ public final class ManagedClusterUpdate { @JsonProperty(value = "upgrade", required = true) private ManagedClusterUpgradeSpec upgrade; + /* + * The node image upgrade to be applied to the target nodes in update run. + */ + @JsonProperty(value = "nodeImageSelection") + private NodeImageSelection nodeImageSelection; + /** Creates an instance of ManagedClusterUpdate class. */ public ManagedClusterUpdate() { } @@ -41,6 +47,26 @@ public ManagedClusterUpdate withUpgrade(ManagedClusterUpgradeSpec upgrade) { return this; } + /** + * Get the nodeImageSelection property: The node image upgrade to be applied to the target nodes in update run. + * + * @return the nodeImageSelection value. + */ + public NodeImageSelection nodeImageSelection() { + return this.nodeImageSelection; + } + + /** + * Set the nodeImageSelection property: The node image upgrade to be applied to the target nodes in update run. + * + * @param nodeImageSelection the nodeImageSelection value to set. + * @return the ManagedClusterUpdate object itself. + */ + public ManagedClusterUpdate withNodeImageSelection(NodeImageSelection nodeImageSelection) { + this.nodeImageSelection = nodeImageSelection; + return this; + } + /** * Validates the instance. * @@ -54,6 +80,9 @@ public void validate() { } else { upgrade().validate(); } + if (nodeImageSelection() != null) { + nodeImageSelection().validate(); + } } private static final ClientLogger LOGGER = new ClientLogger(ManagedClusterUpdate.class); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedServiceIdentity.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..ea8e5411345b --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedServiceIdentity.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Managed service identity (system assigned and/or user assigned identities). */ +@Fluent +public final class ManagedServiceIdentity { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys + * will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** Creates an instance of ManagedServiceIdentity class. */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedServiceIdentityType.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..6c8b5c0ececf --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/ManagedServiceIdentityType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** Static value None for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned, UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = + fromString("SystemAssigned, UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/MemberUpdateStatus.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/MemberUpdateStatus.java index ac39d6959039..14dcfc32be3c 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/MemberUpdateStatus.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/MemberUpdateStatus.java @@ -34,6 +34,12 @@ public final class MemberUpdateStatus { @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) private String operationId; + /* + * The status message after processing the member update operation. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + /** Creates an instance of MemberUpdateStatus class. */ public MemberUpdateStatus() { } @@ -74,6 +80,15 @@ public String operationId() { return this.operationId; } + /** + * Get the message property: The status message after processing the member update operation. + * + * @return the message value. + */ + public String message() { + return this.message; + } + /** * Validates the instance. * diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageSelection.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageSelection.java new file mode 100644 index 000000000000..1bd5f5b43521 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageSelection.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The node image upgrade to be applied to the target nodes in update run. */ +@Fluent +public final class NodeImageSelection { + /* + * The node image upgrade type. + */ + @JsonProperty(value = "type", required = true) + private NodeImageSelectionType type; + + /** Creates an instance of NodeImageSelection class. */ + public NodeImageSelection() { + } + + /** + * Get the type property: The node image upgrade type. + * + * @return the type value. + */ + public NodeImageSelectionType type() { + return this.type; + } + + /** + * Set the type property: The node image upgrade type. + * + * @param type the type value to set. + * @return the NodeImageSelection object itself. + */ + public NodeImageSelection withType(NodeImageSelectionType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model NodeImageSelection")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NodeImageSelection.class); +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageSelectionStatus.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageSelectionStatus.java new file mode 100644 index 000000000000..99be24967dff --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageSelectionStatus.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The node image upgrade specs for the update run. */ +@Immutable +public final class NodeImageSelectionStatus { + /* + * The image versions to upgrade the nodes to. + */ + @JsonProperty(value = "selectedNodeImageVersions", access = JsonProperty.Access.WRITE_ONLY) + private List selectedNodeImageVersions; + + /** Creates an instance of NodeImageSelectionStatus class. */ + public NodeImageSelectionStatus() { + } + + /** + * Get the selectedNodeImageVersions property: The image versions to upgrade the nodes to. + * + * @return the selectedNodeImageVersions value. + */ + public List selectedNodeImageVersions() { + return this.selectedNodeImageVersions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (selectedNodeImageVersions() != null) { + selectedNodeImageVersions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageSelectionType.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageSelectionType.java new file mode 100644 index 000000000000..36b051843e7d --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageSelectionType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The node image upgrade type. */ +public final class NodeImageSelectionType extends ExpandableStringEnum { + /** Static value Latest for NodeImageSelectionType. */ + public static final NodeImageSelectionType LATEST = fromString("Latest"); + + /** Static value Consistent for NodeImageSelectionType. */ + public static final NodeImageSelectionType CONSISTENT = fromString("Consistent"); + + /** + * Creates a new instance of NodeImageSelectionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NodeImageSelectionType() { + } + + /** + * Creates or finds a NodeImageSelectionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding NodeImageSelectionType. + */ + @JsonCreator + public static NodeImageSelectionType fromString(String name) { + return fromString(name, NodeImageSelectionType.class); + } + + /** + * Gets known NodeImageSelectionType values. + * + * @return known NodeImageSelectionType values. + */ + public static Collection values() { + return values(NodeImageSelectionType.class); + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageVersion.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageVersion.java new file mode 100644 index 000000000000..ba7d55c932b3 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/NodeImageVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The node upgrade image version. */ +@Immutable +public final class NodeImageVersion { + /* + * The image version to upgrade the nodes to (e.g., 'AKSUbuntu-1804gen2containerd-2022.12.13'). + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** Creates an instance of NodeImageVersion class. */ + public NodeImageVersion() { + } + + /** + * Get the version property: The image version to upgrade the nodes to (e.g., + * 'AKSUbuntu-1804gen2containerd-2022.12.13'). + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateRun.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateRun.java index 98b10bf2d212..37cad878cb4e 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateRun.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateRun.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.containerservicefleet.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.containerservicefleet.fluent.models.UpdateRunInner; @@ -41,13 +40,6 @@ public interface UpdateRun { */ String etag(); - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the provisioningState property: The provisioning state of the UpdateRun resource. * @@ -97,11 +89,13 @@ public interface UpdateRun { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The UpdateRun definition stages. */ interface DefinitionStages { /** The first stage of the UpdateRun definition. */ interface Blank extends WithParentResource { } + /** The stage of the UpdateRun definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -113,6 +107,7 @@ interface WithParentResource { */ WithCreate withExistingFleet(String resourceGroupName, String fleetName); } + /** * The stage of the UpdateRun definition which contains all the minimum required properties for the resource to * be created, but also allows for any other optional properties to be specified. @@ -137,6 +132,7 @@ interface WithCreate */ UpdateRun create(Context context); } + /** The stage of the UpdateRun definition allowing to specify strategy. */ interface WithStrategy { /** @@ -153,6 +149,7 @@ interface WithStrategy { */ WithCreate withStrategy(UpdateRunStrategy strategy); } + /** The stage of the UpdateRun definition allowing to specify managedClusterUpdate. */ interface WithManagedClusterUpdate { /** @@ -165,6 +162,7 @@ interface WithManagedClusterUpdate { */ WithCreate withManagedClusterUpdate(ManagedClusterUpdate managedClusterUpdate); } + /** The stage of the UpdateRun definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -175,6 +173,7 @@ interface WithIfMatch { */ WithCreate withIfMatch(String ifMatch); } + /** The stage of the UpdateRun definition allowing to specify ifNoneMatch. */ interface WithIfNoneMatch { /** @@ -186,6 +185,7 @@ interface WithIfNoneMatch { WithCreate withIfNoneMatch(String ifNoneMatch); } } + /** * Begins update for the UpdateRun resource. * @@ -214,6 +214,7 @@ interface Update */ UpdateRun apply(Context context); } + /** The UpdateRun update stages. */ interface UpdateStages { /** The stage of the UpdateRun update allowing to specify strategy. */ @@ -232,6 +233,7 @@ interface WithStrategy { */ Update withStrategy(UpdateRunStrategy strategy); } + /** The stage of the UpdateRun update allowing to specify managedClusterUpdate. */ interface WithManagedClusterUpdate { /** @@ -244,6 +246,7 @@ interface WithManagedClusterUpdate { */ Update withManagedClusterUpdate(ManagedClusterUpdate managedClusterUpdate); } + /** The stage of the UpdateRun update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -254,6 +257,7 @@ interface WithIfMatch { */ Update withIfMatch(String ifMatch); } + /** The stage of the UpdateRun update allowing to specify ifNoneMatch. */ interface WithIfNoneMatch { /** @@ -265,6 +269,7 @@ interface WithIfNoneMatch { Update withIfNoneMatch(String ifNoneMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateRunStatus.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateRunStatus.java index 4a27c8860ebb..cee4a783e7b8 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateRunStatus.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateRunStatus.java @@ -23,6 +23,13 @@ public final class UpdateRunStatus { @JsonProperty(value = "stages", access = JsonProperty.Access.WRITE_ONLY) private List stages; + /* + * The node image upgrade specs for the update run. It is only set in update run when `NodeImageSelection.type` is + * `Consistent`. + */ + @JsonProperty(value = "nodeImageSelection", access = JsonProperty.Access.WRITE_ONLY) + private NodeImageSelectionStatus nodeImageSelection; + /** Creates an instance of UpdateRunStatus class. */ public UpdateRunStatus() { } @@ -45,6 +52,16 @@ public List stages() { return this.stages; } + /** + * Get the nodeImageSelection property: The node image upgrade specs for the update run. It is only set in update + * run when `NodeImageSelection.type` is `Consistent`. + * + * @return the nodeImageSelection value. + */ + public NodeImageSelectionStatus nodeImageSelection() { + return this.nodeImageSelection; + } + /** * Validates the instance. * @@ -57,5 +74,8 @@ public void validate() { if (stages() != null) { stages().forEach(e -> e.validate()); } + if (nodeImageSelection() != null) { + nodeImageSelection().validate(); + } } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateState.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateState.java index 36e514a8a3c5..b5ad2b403422 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateState.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UpdateState.java @@ -22,6 +22,9 @@ public final class UpdateState extends ExpandableStringEnum { /** Static value Stopped for UpdateState. */ public static final UpdateState STOPPED = fromString("Stopped"); + /** Static value Skipped for UpdateState. */ + public static final UpdateState SKIPPED = fromString("Skipped"); + /** Static value Failed for UpdateState. */ public static final UpdateState FAILED = fromString("Failed"); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UserAssignedIdentity.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..a85b9c11535f --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/main/java/com/azure/resourcemanager/containerservicefleet/models/UserAssignedIdentity.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** User assigned identity properties. */ +@Immutable +public final class UserAssignedIdentity { + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** Creates an instance of UserAssignedIdentity class. */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersCreateSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersCreateSamples.java index 4cd1dd9dd177..376fedf90885 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersCreateSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersCreateSamples.java @@ -7,7 +7,7 @@ /** Samples for FleetMembers Create. */ public final class FleetMembersCreateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Create.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Create.json */ /** * Sample code: Creates a FleetMember resource with a long running operation. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersDeleteSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersDeleteSamples.java index 06b3c7d148d1..e0f520c77e4c 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersDeleteSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for FleetMembers Delete. */ public final class FleetMembersDeleteSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Delete.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Delete.json */ /** * Sample code: Deletes a FleetMember resource asynchronously with a long running operation. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersGetSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersGetSamples.java index 78368062b879..a20e05a95fc1 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersGetSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersGetSamples.java @@ -7,7 +7,7 @@ /** Samples for FleetMembers Get. */ public final class FleetMembersGetSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Get.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Get.json */ /** * Sample code: Gets a FleetMember resource. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersListByFleetSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersListByFleetSamples.java index 31e8867aa21c..f74160deefbf 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersListByFleetSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersListByFleetSamples.java @@ -7,7 +7,7 @@ /** Samples for FleetMembers ListByFleet. */ public final class FleetMembersListByFleetSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_ListByFleet.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_ListByFleet.json */ /** * Sample code: Lists the members of a Fleet. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersUpdateSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersUpdateSamples.java index f5aacfc5fa00..ef1ddd2c5eb4 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersUpdateSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersUpdateSamples.java @@ -9,7 +9,7 @@ /** Samples for FleetMembers Update. */ public final class FleetMembersUpdateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Update.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Update.json */ /** * Sample code: Updates a FleetMember resource synchronously. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsCreateOrUpdateSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsCreateOrUpdateSamples.java index e7c6cf562b6b..36e10809ac42 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsCreateOrUpdateSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsCreateOrUpdateSamples.java @@ -11,7 +11,7 @@ /** Samples for Fleets CreateOrUpdate. */ public final class FleetsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_CreateOrUpdate.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_CreateOrUpdate.json */ /** * Sample code: Creates a Fleet resource with a long running operation. @@ -30,6 +30,7 @@ public static void createsAFleetResourceWithALongRunningOperation( .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsDeleteSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsDeleteSamples.java index f239aa84d589..d615c510eade 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsDeleteSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Fleets Delete. */ public final class FleetsDeleteSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_Delete.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_Delete.json */ /** * Sample code: Deletes a Fleet resource asynchronously with a long running operation. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsGetByResourceGroupSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsGetByResourceGroupSamples.java index b5c13a06033a..e82b9f6e96d3 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsGetByResourceGroupSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Fleets GetByResourceGroup. */ public final class FleetsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_Get.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_Get.json */ /** * Sample code: Gets a Fleet resource. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListByResourceGroupSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListByResourceGroupSamples.java index a189cc22b9f0..61853d429177 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListByResourceGroupSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Fleets ListByResourceGroup. */ public final class FleetsListByResourceGroupSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_ListByResourceGroup.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_ListByResourceGroup.json */ /** * Sample code: Lists the Fleet resources in a resource group. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListCredentialsSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListCredentialsSamples.java index 451da254b650..e468219319da 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListCredentialsSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListCredentialsSamples.java @@ -7,7 +7,7 @@ /** Samples for Fleets ListCredentials. */ public final class FleetsListCredentialsSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_ListCredentialsResult.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_ListCredentialsResult.json */ /** * Sample code: Lists the user credentials of a Fleet. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListSamples.java index f823b805c039..bd097e4974f9 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Fleets List. */ public final class FleetsListSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_ListBySub.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_ListBySub.json */ /** * Sample code: Lists the Fleet resources in a subscription. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsUpdateSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsUpdateSamples.java index 34e247053b16..445cec38be2d 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsUpdateSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsUpdateSamples.java @@ -11,7 +11,7 @@ /** Samples for Fleets Update. */ public final class FleetsUpdateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_PatchTags.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_PatchTags.json */ /** * Sample code: Update a Fleet. @@ -28,6 +28,7 @@ public static void updateAFleet( resource.update().withTags(mapOf("env", "prod", "tier", "secure")).withIfMatch("dfjkwelr7384").apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/OperationsListSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/OperationsListSamples.java index 5548ab35f880..e9d8089bdc6d 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/OperationsListSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/OperationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Operations_List.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Operations_List.json */ /** * Sample code: List the operations for the provider. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsCreateOrUpdateSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsCreateOrUpdateSamples.java index 50e504a4b1f7..193567ab7297 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsCreateOrUpdateSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsCreateOrUpdateSamples.java @@ -7,6 +7,8 @@ import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeSpec; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelection; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; import com.azure.resourcemanager.containerservicefleet.models.UpdateGroup; import com.azure.resourcemanager.containerservicefleet.models.UpdateRunStrategy; import com.azure.resourcemanager.containerservicefleet.models.UpdateStage; @@ -15,7 +17,7 @@ /** Samples for UpdateRuns CreateOrUpdate. */ public final class UpdateRunsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_CreateOrUpdate.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_CreateOrUpdate.json */ /** * Sample code: Create an UpdateRun. @@ -42,7 +44,8 @@ public static void createAnUpdateRun( .withUpgrade( new ManagedClusterUpgradeSpec() .withType(ManagedClusterUpgradeType.FULL) - .withKubernetesVersion("1.26.1"))) + .withKubernetesVersion("1.26.1")) + .withNodeImageSelection(new NodeImageSelection().withType(NodeImageSelectionType.LATEST))) .create(); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsDeleteSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsDeleteSamples.java index a5d1abe6dc12..981b08b0a5ad 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsDeleteSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for UpdateRuns Delete. */ public final class UpdateRunsDeleteSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Delete.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Delete.json */ /** * Sample code: Delete an updateRun resource. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsGetSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsGetSamples.java index fbe61893e0d9..a75cac82694b 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsGetSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for UpdateRuns Get. */ public final class UpdateRunsGetSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Get.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Get.json */ /** * Sample code: Gets an UpdateRun resource. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsListByFleetSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsListByFleetSamples.java index d57a4f7e89ab..249e1af757d3 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsListByFleetSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsListByFleetSamples.java @@ -7,7 +7,7 @@ /** Samples for UpdateRuns ListByFleet. */ public final class UpdateRunsListByFleetSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_ListByFleet.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_ListByFleet.json */ /** * Sample code: Lists the UpdateRun resources by fleet. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStartSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStartSamples.java index 77cc2c265375..c9f3bab25b77 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStartSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStartSamples.java @@ -7,7 +7,7 @@ /** Samples for UpdateRuns Start. */ public final class UpdateRunsStartSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Start.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Start.json */ /** * Sample code: Starts an UpdateRun. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStopSamples.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStopSamples.java index 4667b8585207..5822fd255e1a 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStopSamples.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/samples/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStopSamples.java @@ -7,7 +7,7 @@ /** Samples for UpdateRuns Stop. */ public final class UpdateRunsStopSamples { /* - * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Stop.json + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Stop.json */ /** * Sample code: Stops an UpdateRun. diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/AgentProfileTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/AgentProfileTests.java new file mode 100644 index 000000000000..ab892fd9523c --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/AgentProfileTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicefleet.models.AgentProfile; +import org.junit.jupiter.api.Assertions; + +public final class AgentProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentProfile model = BinaryData.fromString("{\"subnetId\":\"jbiksqrglssai\"}").toObject(AgentProfile.class); + Assertions.assertEquals("jbiksqrglssai", model.subnetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AgentProfile model = new AgentProfile().withSubnetId("jbiksqrglssai"); + model = BinaryData.fromObject(model).toObject(AgentProfile.class); + Assertions.assertEquals("jbiksqrglssai", model.subnetId()); + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ApiServerAccessProfileTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ApiServerAccessProfileTests.java new file mode 100644 index 000000000000..47fe3c58eaef --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ApiServerAccessProfileTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicefleet.models.ApiServerAccessProfile; +import org.junit.jupiter.api.Assertions; + +public final class ApiServerAccessProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApiServerAccessProfile model = + BinaryData + .fromString( + "{\"enablePrivateCluster\":true,\"enableVnetIntegration\":false,\"subnetId\":\"kocrcjdkwtnhx\"}") + .toObject(ApiServerAccessProfile.class); + Assertions.assertEquals(true, model.enablePrivateCluster()); + Assertions.assertEquals(false, model.enableVnetIntegration()); + Assertions.assertEquals("kocrcjdkwtnhx", model.subnetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApiServerAccessProfile model = + new ApiServerAccessProfile() + .withEnablePrivateCluster(true) + .withEnableVnetIntegration(false) + .withSubnetId("kocrcjdkwtnhx"); + model = BinaryData.fromObject(model).toObject(ApiServerAccessProfile.class); + Assertions.assertEquals(true, model.enablePrivateCluster()); + Assertions.assertEquals(false, model.enableVnetIntegration()); + Assertions.assertEquals("kocrcjdkwtnhx", model.subnetId()); + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetCredentialResultTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetCredentialResultTests.java index d3ae5016cf91..362c811d7f3a 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetCredentialResultTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetCredentialResultTests.java @@ -11,7 +11,7 @@ public final class FleetCredentialResultTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { FleetCredentialResult model = - BinaryData.fromString("{\"name\":\"bbkpodep\"}").toObject(FleetCredentialResult.class); + BinaryData.fromString("{\"name\":\"nddhsgcbacph\"}").toObject(FleetCredentialResult.class); } @org.junit.jupiter.api.Test diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetCredentialResultsInnerTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetCredentialResultsInnerTests.java index b8c7c4e994f2..8fe9fc590311 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetCredentialResultsInnerTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetCredentialResultsInnerTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { FleetCredentialResultsInner model = BinaryData .fromString( - "{\"kubeconfigs\":[{\"name\":\"zoxxjtf\"},{\"name\":\"uwfzitonpe\"},{\"name\":\"jkjlxofpdvhpfx\"},{\"name\":\"ininmay\"}]}") + "{\"kubeconfigs\":[{\"name\":\"wyiftyhxhur\"},{\"name\":\"tyxolniwpwc\"},{\"name\":\"fkgiawxk\"},{\"name\":\"plwckbas\"}]}") .toObject(FleetCredentialResultsInner.class); } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetHubProfileTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetHubProfileTests.java index 789ecc349997..1154480aaa46 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetHubProfileTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetHubProfileTests.java @@ -5,6 +5,8 @@ package com.azure.resourcemanager.containerservicefleet.generated; import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicefleet.models.AgentProfile; +import com.azure.resourcemanager.containerservicefleet.models.ApiServerAccessProfile; import com.azure.resourcemanager.containerservicefleet.models.FleetHubProfile; import org.junit.jupiter.api.Assertions; @@ -14,15 +16,31 @@ public void testDeserialize() throws Exception { FleetHubProfile model = BinaryData .fromString( - "{\"dnsPrefix\":\"fdfdosygexpa\",\"fqdn\":\"akhmsbzjhcrz\",\"kubernetesVersion\":\"dphlxaolt\"}") + "{\"dnsPrefix\":\"jaeq\",\"apiServerAccessProfile\":{\"enablePrivateCluster\":true,\"enableVnetIntegration\":false,\"subnetId\":\"v\"},\"agentProfile\":{\"subnetId\":\"jqul\"},\"fqdn\":\"sntnbybkzgcw\",\"kubernetesVersion\":\"clxxwrljdo\"}") .toObject(FleetHubProfile.class); - Assertions.assertEquals("fdfdosygexpa", model.dnsPrefix()); + Assertions.assertEquals("jaeq", model.dnsPrefix()); + Assertions.assertEquals(true, model.apiServerAccessProfile().enablePrivateCluster()); + Assertions.assertEquals(false, model.apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("v", model.apiServerAccessProfile().subnetId()); + Assertions.assertEquals("jqul", model.agentProfile().subnetId()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FleetHubProfile model = new FleetHubProfile().withDnsPrefix("fdfdosygexpa"); + FleetHubProfile model = + new FleetHubProfile() + .withDnsPrefix("jaeq") + .withApiServerAccessProfile( + new ApiServerAccessProfile() + .withEnablePrivateCluster(true) + .withEnableVnetIntegration(false) + .withSubnetId("v")) + .withAgentProfile(new AgentProfile().withSubnetId("jqul")); model = BinaryData.fromObject(model).toObject(FleetHubProfile.class); - Assertions.assertEquals("fdfdosygexpa", model.dnsPrefix()); + Assertions.assertEquals("jaeq", model.dnsPrefix()); + Assertions.assertEquals(true, model.apiServerAccessProfile().enablePrivateCluster()); + Assertions.assertEquals(false, model.apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("v", model.apiServerAccessProfile().subnetId()); + Assertions.assertEquals("jqul", model.agentProfile().subnetId()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetInnerTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetInnerTests.java index 7087a900cce8..9b416feefc21 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetInnerTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetInnerTests.java @@ -6,7 +6,12 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.containerservicefleet.fluent.models.FleetInner; +import com.azure.resourcemanager.containerservicefleet.models.AgentProfile; +import com.azure.resourcemanager.containerservicefleet.models.ApiServerAccessProfile; import com.azure.resourcemanager.containerservicefleet.models.FleetHubProfile; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentity; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.containerservicefleet.models.UserAssignedIdentity; import java.util.HashMap; import java.util.Map; import org.junit.jupiter.api.Assertions; @@ -17,26 +22,51 @@ public void testDeserialize() throws Exception { FleetInner model = BinaryData .fromString( - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"hubProfile\":{\"dnsPrefix\":\"emkkvnipjox\",\"fqdn\":\"nchgej\",\"kubernetesVersion\":\"odmailzyd\"}},\"eTag\":\"o\",\"location\":\"yahux\",\"tags\":{\"xj\":\"mqnjaqw\",\"atscmd\":\"prozvcputegjvwmf\"},\"id\":\"pjhulsuuvmkj\",\"name\":\"zkrwfn\",\"type\":\"iodjp\"}") + "{\"properties\":{\"provisioningState\":\"Updating\",\"hubProfile\":{\"dnsPrefix\":\"atscmd\",\"apiServerAccessProfile\":{\"enablePrivateCluster\":true,\"enableVnetIntegration\":true,\"subnetId\":\"uuvmkjozkrwfnd\"},\"agentProfile\":{\"subnetId\":\"jpslwejd\"},\"fqdn\":\"wryoqpsoacc\",\"kubernetesVersion\":\"zakljlahbc\"}},\"eTag\":\"ffdfdosygexpa\",\"identity\":{\"principalId\":\"25876924-d820-4fad-9d0b-c3795e337e66\",\"tenantId\":\"701760d5-e1a2-47f7-8d9c-b9c33cdd6397\",\"type\":\"SystemAssigned," + + " UserAssigned\",\"userAssignedIdentities\":{\"jhcrz\":{\"principalId\":\"071ccdec-200b-45b6-9c80-affac57e48af\",\"clientId\":\"e79513bd-f885-4332-8d43-19ac8edc336d\"},\"phlxa\":{\"principalId\":\"3c2124ef-6560-4dcc-b003-ebc91bc1c2b9\",\"clientId\":\"ba0c38bb-4b5e-4a5f-bf7d-34de4c6ee185\"}}},\"location\":\"thqt\",\"tags\":{\"zfsinzgvf\":\"jbp\",\"j\":\"jrwzox\",\"fpjkjlxofp\":\"felluwfzitonpe\"},\"id\":\"vhpfxxypininmay\",\"name\":\"uybbkpodep\",\"type\":\"oginuvamiheognar\"}") .toObject(FleetInner.class); - Assertions.assertEquals("yahux", model.location()); - Assertions.assertEquals("mqnjaqw", model.tags().get("xj")); - Assertions.assertEquals("emkkvnipjox", model.hubProfile().dnsPrefix()); + Assertions.assertEquals("thqt", model.location()); + Assertions.assertEquals("jbp", model.tags().get("zfsinzgvf")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.identity().type()); + Assertions.assertEquals("atscmd", model.hubProfile().dnsPrefix()); + Assertions.assertEquals(true, model.hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions.assertEquals(true, model.hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("uuvmkjozkrwfnd", model.hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("jpslwejd", model.hubProfile().agentProfile().subnetId()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { FleetInner model = new FleetInner() - .withLocation("yahux") - .withTags(mapOf("xj", "mqnjaqw", "atscmd", "prozvcputegjvwmf")) - .withHubProfile(new FleetHubProfile().withDnsPrefix("emkkvnipjox")); + .withLocation("thqt") + .withTags(mapOf("zfsinzgvf", "jbp", "j", "jrwzox", "fpjkjlxofp", "felluwfzitonpe")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf("jhcrz", new UserAssignedIdentity(), "phlxa", new UserAssignedIdentity()))) + .withHubProfile( + new FleetHubProfile() + .withDnsPrefix("atscmd") + .withApiServerAccessProfile( + new ApiServerAccessProfile() + .withEnablePrivateCluster(true) + .withEnableVnetIntegration(true) + .withSubnetId("uuvmkjozkrwfnd")) + .withAgentProfile(new AgentProfile().withSubnetId("jpslwejd"))); model = BinaryData.fromObject(model).toObject(FleetInner.class); - Assertions.assertEquals("yahux", model.location()); - Assertions.assertEquals("mqnjaqw", model.tags().get("xj")); - Assertions.assertEquals("emkkvnipjox", model.hubProfile().dnsPrefix()); + Assertions.assertEquals("thqt", model.location()); + Assertions.assertEquals("jbp", model.tags().get("zfsinzgvf")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.identity().type()); + Assertions.assertEquals("atscmd", model.hubProfile().dnsPrefix()); + Assertions.assertEquals(true, model.hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions.assertEquals(true, model.hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("uuvmkjozkrwfnd", model.hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("jpslwejd", model.hubProfile().agentProfile().subnetId()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetListResultTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetListResultTests.java index 1f2fa25d6a17..96df994c3530 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetListResultTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetListResultTests.java @@ -6,7 +6,13 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.containerservicefleet.fluent.models.FleetInner; +import com.azure.resourcemanager.containerservicefleet.models.AgentProfile; +import com.azure.resourcemanager.containerservicefleet.models.ApiServerAccessProfile; +import com.azure.resourcemanager.containerservicefleet.models.FleetHubProfile; import com.azure.resourcemanager.containerservicefleet.models.FleetListResult; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentity; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.containerservicefleet.models.UserAssignedIdentity; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -18,11 +24,19 @@ public void testDeserialize() throws Exception { FleetListResult model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\"},\"eTag\":\"xqhabi\",\"location\":\"ikxwc\",\"tags\":{\"n\":\"scnpqxuhivy\",\"rkxvdum\":\"wby\"},\"id\":\"grtfwvu\",\"name\":\"xgaudccs\",\"type\":\"h\"}],\"nextLink\":\"cnyejhkryhtnapcz\"}") + "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"hubProfile\":{\"dnsPrefix\":\"xqhabi\",\"apiServerAccessProfile\":{\"enablePrivateCluster\":true,\"enableVnetIntegration\":false,\"subnetId\":\"zb\"},\"agentProfile\":{\"subnetId\":\"npqxuh\"},\"fqdn\":\"y\",\"kubernetesVersion\":\"iwbybrkxvdumjg\"}},\"eTag\":\"fwvuk\",\"identity\":{\"principalId\":\"471847e0-2afe-45af-aa02-e1021d2bbaae\",\"tenantId\":\"1d8e2610-6dbb-47db-a3f8-88ccfe000d8d\",\"type\":\"None\",\"userAssignedIdentities\":{\"h\":{\"principalId\":\"586f0898-b491-44c0-83ca-871c104bbe31\",\"clientId\":\"1e10f5d7-b503-4d5b-b0cd-8953571b34ff\"}}},\"location\":\"cnyejhkryhtnapcz\",\"tags\":{\"ni\":\"kjyemkk\",\"ilzyd\":\"joxzjnchgejspodm\"},\"id\":\"h\",\"name\":\"jwyahuxinpmqnja\",\"type\":\"wixjsprozvcp\"}],\"nextLink\":\"eg\"}") .toObject(FleetListResult.class); - Assertions.assertEquals("ikxwc", model.value().get(0).location()); - Assertions.assertEquals("scnpqxuhivy", model.value().get(0).tags().get("n")); - Assertions.assertEquals("cnyejhkryhtnapcz", model.nextLink()); + Assertions.assertEquals("cnyejhkryhtnapcz", model.value().get(0).location()); + Assertions.assertEquals("kjyemkk", model.value().get(0).tags().get("ni")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.value().get(0).identity().type()); + Assertions.assertEquals("xqhabi", model.value().get(0).hubProfile().dnsPrefix()); + Assertions + .assertEquals(true, model.value().get(0).hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions + .assertEquals(false, model.value().get(0).hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("zb", model.value().get(0).hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("npqxuh", model.value().get(0).hubProfile().agentProfile().subnetId()); + Assertions.assertEquals("eg", model.nextLink()); } @org.junit.jupiter.api.Test @@ -33,15 +47,37 @@ public void testSerialize() throws Exception { Arrays .asList( new FleetInner() - .withLocation("ikxwc") - .withTags(mapOf("n", "scnpqxuhivy", "rkxvdum", "wby")))) - .withNextLink("cnyejhkryhtnapcz"); + .withLocation("cnyejhkryhtnapcz") + .withTags(mapOf("ni", "kjyemkk", "ilzyd", "joxzjnchgejspodm")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("h", new UserAssignedIdentity()))) + .withHubProfile( + new FleetHubProfile() + .withDnsPrefix("xqhabi") + .withApiServerAccessProfile( + new ApiServerAccessProfile() + .withEnablePrivateCluster(true) + .withEnableVnetIntegration(false) + .withSubnetId("zb")) + .withAgentProfile(new AgentProfile().withSubnetId("npqxuh"))))) + .withNextLink("eg"); model = BinaryData.fromObject(model).toObject(FleetListResult.class); - Assertions.assertEquals("ikxwc", model.value().get(0).location()); - Assertions.assertEquals("scnpqxuhivy", model.value().get(0).tags().get("n")); - Assertions.assertEquals("cnyejhkryhtnapcz", model.nextLink()); + Assertions.assertEquals("cnyejhkryhtnapcz", model.value().get(0).location()); + Assertions.assertEquals("kjyemkk", model.value().get(0).tags().get("ni")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.value().get(0).identity().type()); + Assertions.assertEquals("xqhabi", model.value().get(0).hubProfile().dnsPrefix()); + Assertions + .assertEquals(true, model.value().get(0).hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions + .assertEquals(false, model.value().get(0).hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("zb", model.value().get(0).hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("npqxuh", model.value().get(0).hubProfile().agentProfile().subnetId()); + Assertions.assertEquals("eg", model.nextLink()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberInnerTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberInnerTests.java index 59efcbca0c35..452ec828d2e3 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberInnerTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberInnerTests.java @@ -14,17 +14,17 @@ public void testDeserialize() throws Exception { FleetMemberInner model = BinaryData .fromString( - "{\"properties\":{\"clusterResourceId\":\"wjfeusnhutjel\",\"group\":\"rl\",\"provisioningState\":\"Failed\"},\"eTag\":\"jzzd\",\"id\":\"qxhocdgeablgphut\",\"name\":\"cndvkaozwyiftyhx\",\"type\":\"urokft\"}") + "{\"properties\":{\"clusterResourceId\":\"wgcu\",\"group\":\"tumkdosvqwhbm\",\"provisioningState\":\"Succeeded\"},\"eTag\":\"jfddgmbmbe\",\"id\":\"pbhtqqrolfpfpsa\",\"name\":\"gbquxigj\",\"type\":\"jgzjaoyfhrtx\"}") .toObject(FleetMemberInner.class); - Assertions.assertEquals("wjfeusnhutjel", model.clusterResourceId()); - Assertions.assertEquals("rl", model.group()); + Assertions.assertEquals("wgcu", model.clusterResourceId()); + Assertions.assertEquals("tumkdosvqwhbm", model.group()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FleetMemberInner model = new FleetMemberInner().withClusterResourceId("wjfeusnhutjel").withGroup("rl"); + FleetMemberInner model = new FleetMemberInner().withClusterResourceId("wgcu").withGroup("tumkdosvqwhbm"); model = BinaryData.fromObject(model).toObject(FleetMemberInner.class); - Assertions.assertEquals("wjfeusnhutjel", model.clusterResourceId()); - Assertions.assertEquals("rl", model.group()); + Assertions.assertEquals("wgcu", model.clusterResourceId()); + Assertions.assertEquals("tumkdosvqwhbm", model.group()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberListResultTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberListResultTests.java index 048ba3ca007d..aee9596d199e 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberListResultTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberListResultTests.java @@ -16,11 +16,11 @@ public void testDeserialize() throws Exception { FleetMemberListResult model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"clusterResourceId\":\"nuvamiheogna\",\"group\":\"zxtheotusivyevcc\",\"provisioningState\":\"Succeeded\"},\"eTag\":\"nhungbw\",\"id\":\"rnfygxgispem\",\"name\":\"tzfkufubl\",\"type\":\"ofx\"},{\"properties\":{\"clusterResourceId\":\"ofjaeqjhqjb\",\"group\":\"v\",\"provisioningState\":\"Succeeded\"},\"eTag\":\"qulngsntnbybkzgc\",\"id\":\"wclxxwrl\",\"name\":\"douskcqvkocrcjdk\",\"type\":\"tnhxbn\"},{\"properties\":{\"clusterResourceId\":\"iksqr\",\"group\":\"ssainqpjwnzll\",\"provisioningState\":\"Failed\"},\"eTag\":\"pee\",\"id\":\"mgxsab\",\"name\":\"yqduujit\",\"type\":\"jczdzevndh\"}],\"nextLink\":\"wpdappdsbdkv\"}") + "{\"value\":[{\"properties\":{\"clusterResourceId\":\"tynqgoul\",\"group\":\"dlikwyqkgfgibma\",\"provisioningState\":\"Leaving\"},\"eTag\":\"eqsrxybzqqedqyt\",\"id\":\"iqfouflmmnkz\",\"name\":\"modmglougpb\",\"type\":\"wtmutduq\"}],\"nextLink\":\"ap\"}") .toObject(FleetMemberListResult.class); - Assertions.assertEquals("nuvamiheogna", model.value().get(0).clusterResourceId()); - Assertions.assertEquals("zxtheotusivyevcc", model.value().get(0).group()); - Assertions.assertEquals("wpdappdsbdkv", model.nextLink()); + Assertions.assertEquals("tynqgoul", model.value().get(0).clusterResourceId()); + Assertions.assertEquals("dlikwyqkgfgibma", model.value().get(0).group()); + Assertions.assertEquals("ap", model.nextLink()); } @org.junit.jupiter.api.Test @@ -29,14 +29,11 @@ public void testSerialize() throws Exception { new FleetMemberListResult() .withValue( Arrays - .asList( - new FleetMemberInner().withClusterResourceId("nuvamiheogna").withGroup("zxtheotusivyevcc"), - new FleetMemberInner().withClusterResourceId("ofjaeqjhqjb").withGroup("v"), - new FleetMemberInner().withClusterResourceId("iksqr").withGroup("ssainqpjwnzll"))) - .withNextLink("wpdappdsbdkv"); + .asList(new FleetMemberInner().withClusterResourceId("tynqgoul").withGroup("dlikwyqkgfgibma"))) + .withNextLink("ap"); model = BinaryData.fromObject(model).toObject(FleetMemberListResult.class); - Assertions.assertEquals("nuvamiheogna", model.value().get(0).clusterResourceId()); - Assertions.assertEquals("zxtheotusivyevcc", model.value().get(0).group()); - Assertions.assertEquals("wpdappdsbdkv", model.nextLink()); + Assertions.assertEquals("tynqgoul", model.value().get(0).clusterResourceId()); + Assertions.assertEquals("dlikwyqkgfgibma", model.value().get(0).group()); + Assertions.assertEquals("ap", model.nextLink()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberPropertiesTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberPropertiesTests.java index 0cd7cf97d5e4..22a32b6e4599 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberPropertiesTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberPropertiesTests.java @@ -14,18 +14,18 @@ public void testDeserialize() throws Exception { FleetMemberProperties model = BinaryData .fromString( - "{\"clusterResourceId\":\"xolniwpwcukjfk\",\"group\":\"awxklr\",\"provisioningState\":\"Failed\"}") + "{\"clusterResourceId\":\"lnerkujysvleju\",\"group\":\"qawrlyxwj\",\"provisioningState\":\"Canceled\"}") .toObject(FleetMemberProperties.class); - Assertions.assertEquals("xolniwpwcukjfk", model.clusterResourceId()); - Assertions.assertEquals("awxklr", model.group()); + Assertions.assertEquals("lnerkujysvleju", model.clusterResourceId()); + Assertions.assertEquals("qawrlyxwj", model.group()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { FleetMemberProperties model = - new FleetMemberProperties().withClusterResourceId("xolniwpwcukjfk").withGroup("awxklr"); + new FleetMemberProperties().withClusterResourceId("lnerkujysvleju").withGroup("qawrlyxwj"); model = BinaryData.fromObject(model).toObject(FleetMemberProperties.class); - Assertions.assertEquals("xolniwpwcukjfk", model.clusterResourceId()); - Assertions.assertEquals("awxklr", model.group()); + Assertions.assertEquals("lnerkujysvleju", model.clusterResourceId()); + Assertions.assertEquals("qawrlyxwj", model.group()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberUpdatePropertiesTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberUpdatePropertiesTests.java index 3015d501c82c..f1ffdb2f4229 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberUpdatePropertiesTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberUpdatePropertiesTests.java @@ -12,14 +12,14 @@ public final class FleetMemberUpdatePropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { FleetMemberUpdateProperties model = - BinaryData.fromString("{\"group\":\"hsgcbacphejkot\"}").toObject(FleetMemberUpdateProperties.class); - Assertions.assertEquals("hsgcbacphejkot", model.group()); + BinaryData.fromString("{\"group\":\"rujqg\"}").toObject(FleetMemberUpdateProperties.class); + Assertions.assertEquals("rujqg", model.group()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FleetMemberUpdateProperties model = new FleetMemberUpdateProperties().withGroup("hsgcbacphejkot"); + FleetMemberUpdateProperties model = new FleetMemberUpdateProperties().withGroup("rujqg"); model = BinaryData.fromObject(model).toObject(FleetMemberUpdateProperties.class); - Assertions.assertEquals("hsgcbacphejkot", model.group()); + Assertions.assertEquals("rujqg", model.group()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberUpdateTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberUpdateTests.java index 8d02145b3992..f26f5903f4fe 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberUpdateTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMemberUpdateTests.java @@ -12,14 +12,14 @@ public final class FleetMemberUpdateTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { FleetMemberUpdate model = - BinaryData.fromString("{\"properties\":{\"group\":\"kbasyypn\"}}").toObject(FleetMemberUpdate.class); - Assertions.assertEquals("kbasyypn", model.group()); + BinaryData.fromString("{\"properties\":{\"group\":\"nwbxgjvtbvpyssz\"}}").toObject(FleetMemberUpdate.class); + Assertions.assertEquals("nwbxgjvtbvpyssz", model.group()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FleetMemberUpdate model = new FleetMemberUpdate().withGroup("kbasyypn"); + FleetMemberUpdate model = new FleetMemberUpdate().withGroup("nwbxgjvtbvpyssz"); model = BinaryData.fromObject(model).toObject(FleetMemberUpdate.class); - Assertions.assertEquals("kbasyypn", model.group()); + Assertions.assertEquals("nwbxgjvtbvpyssz", model.group()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersCreateMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersCreateMockTests.java index e76d6e01e0a8..f077a0f0029a 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersCreateMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersCreateMockTests.java @@ -31,7 +31,7 @@ public void testCreate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"clusterResourceId\":\"hagalpbuxwgipwh\",\"group\":\"ow\",\"provisioningState\":\"Succeeded\"},\"eTag\":\"wankixzbi\",\"id\":\"eputtmrywnuzoqf\",\"name\":\"iyqzrnk\",\"type\":\"qvyxlwhzlsicoho\"}"; + "{\"properties\":{\"clusterResourceId\":\"kbogqxndlkzgx\",\"group\":\"ripl\",\"provisioningState\":\"Succeeded\"},\"eTag\":\"xunkbebxmubyynt\",\"id\":\"rbqtkoie\",\"name\":\"seotgqrllt\",\"type\":\"u\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,15 +62,15 @@ public void testCreate() throws Exception { FleetMember response = manager .fleetMembers() - .define("azyxoegukg") - .withExistingFleet("enkouknvudw", "iukbldngkpoci") - .withClusterResourceId("piu") - .withGroup("ygevqzntypmrbpiz") - .withIfMatch("zfbishcbkhaj") - .withIfNoneMatch("eyeam") + .define("d") + .withExistingFleet("emwabnet", "hhszh") + .withClusterResourceId("vwiwubmwmbesld") + .withGroup("wwtppj") + .withIfMatch("bdagxt") + .withIfNoneMatch("bqdxbx") .create(); - Assertions.assertEquals("hagalpbuxwgipwh", response.clusterResourceId()); - Assertions.assertEquals("ow", response.group()); + Assertions.assertEquals("kbogqxndlkzgx", response.clusterResourceId()); + Assertions.assertEquals("ripl", response.group()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersDeleteMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersDeleteMockTests.java index f8f6407bf60b..e15c976cb305 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersDeleteMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersDeleteMockTests.java @@ -56,8 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager - .fleetMembers() - .delete("lvmezyvshxmzsbbz", "ggi", "rxwburv", "xxjnspydptk", com.azure.core.util.Context.NONE); + manager.fleetMembers().delete("rsc", "ntnev", "iwjmygtdssls", "tmweriofzpyq", com.azure.core.util.Context.NONE); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersGetWithResponseMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersGetWithResponseMockTests.java index 936a23fd42e0..42f10892b1e1 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersGetWithResponseMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersGetWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"clusterResourceId\":\"skghsauuimj\",\"group\":\"xieduugidyjrr\",\"provisioningState\":\"Joining\"},\"eTag\":\"osvexcsonpclhoc\",\"id\":\"slkevle\",\"name\":\"gz\",\"type\":\"buhfmvfaxkffeiit\"}"; + "{\"properties\":{\"clusterResourceId\":\"olpsslqlf\",\"group\":\"dnbbglzps\",\"provisioningState\":\"Canceled\"},\"eTag\":\"mcwyhzdxssadb\",\"id\":\"nvdfznuda\",\"name\":\"dvxzbncblylpst\",\"type\":\"bhhxsrzdzuc\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,10 +62,10 @@ public void testGetWithResponse() throws Exception { FleetMember response = manager .fleetMembers() - .getWithResponse("zdobpxjmflbvvnch", "kcciwwzjuqkhr", "ajiwkuo", com.azure.core.util.Context.NONE) + .getWithResponse("ynduha", "hqlkthumaqo", "bgycduiertgccym", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("skghsauuimj", response.clusterResourceId()); - Assertions.assertEquals("xieduugidyjrr", response.group()); + Assertions.assertEquals("olpsslqlf", response.clusterResourceId()); + Assertions.assertEquals("dnbbglzps", response.group()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersListByFleetMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersListByFleetMockTests.java index 6c189e52ed40..e600897bab76 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersListByFleetMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetMembersListByFleetMockTests.java @@ -32,7 +32,7 @@ public void testListByFleet() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"clusterResourceId\":\"zvyifqrvkdvj\",\"group\":\"lrmv\",\"provisioningState\":\"Updating\"},\"eTag\":\"atkpnp\",\"id\":\"exxbczwtr\",\"name\":\"wiqzbqjvsovmyo\",\"type\":\"acspkwl\"}]}"; + "{\"value\":[{\"properties\":{\"clusterResourceId\":\"mqtaruoujmkcjh\",\"group\":\"ytjrybnwjewgdr\",\"provisioningState\":\"Succeeded\"},\"eTag\":\"naenqpehindo\",\"id\":\"mifthnzdnd\",\"name\":\"l\",\"type\":\"nayqi\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,9 +61,9 @@ public void testListByFleet() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.fleetMembers().listByFleet("uxh", "yudxorrqnbp", com.azure.core.util.Context.NONE); + manager.fleetMembers().listByFleet("sotftpvj", "bexilzznfqqnv", com.azure.core.util.Context.NONE); - Assertions.assertEquals("zvyifqrvkdvj", response.iterator().next().clusterResourceId()); - Assertions.assertEquals("lrmv", response.iterator().next().group()); + Assertions.assertEquals("mqtaruoujmkcjh", response.iterator().next().clusterResourceId()); + Assertions.assertEquals("ytjrybnwjewgdr", response.iterator().next().group()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetPatchTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetPatchTests.java index 6cb17dee757c..cdac280f65ac 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetPatchTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetPatchTests.java @@ -6,6 +6,9 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.containerservicefleet.models.FleetPatch; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentity; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.containerservicefleet.models.UserAssignedIdentity; import java.util.HashMap; import java.util.Map; import org.junit.jupiter.api.Assertions; @@ -13,17 +16,31 @@ public final class FleetPatchTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - FleetPatch model = BinaryData.fromString("{\"tags\":{\"f\":\"rgqjbpfzfsinzg\"}}").toObject(FleetPatch.class); - Assertions.assertEquals("rgqjbpfzfsinzg", model.tags().get("f")); + FleetPatch model = + BinaryData + .fromString( + "{\"tags\":{\"zevndhkrwpdappds\":\"sabkyqduujitcjcz\",\"snhu\":\"dkvwrwjfe\",\"tmrldhugjzzdatq\":\"je\"},\"identity\":{\"principalId\":\"6e2b927a-720e-424c-8e89-4e012ec3a802\",\"tenantId\":\"d906c806-8d0a-41a7-af5d-3d59b4b8b0d9\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"lgphu\":{\"principalId\":\"d46ae37b-b0cf-4afa-9413-59109bcb98ff\",\"clientId\":\"9af4399c-4a57-457f-bc30-07616cfa8057\"},\"ndv\":{\"principalId\":\"067e7edd-cc1c-4dd4-bd74-0ab3bfd1eaf5\",\"clientId\":\"ad9ed536-0a75-4789-800a-92a5d8796a92\"}}}}") + .toObject(FleetPatch.class); + Assertions.assertEquals("sabkyqduujitcjcz", model.tags().get("zevndhkrwpdappds")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FleetPatch model = new FleetPatch().withTags(mapOf("f", "rgqjbpfzfsinzg")); + FleetPatch model = + new FleetPatch() + .withTags(mapOf("zevndhkrwpdappds", "sabkyqduujitcjcz", "snhu", "dkvwrwjfe", "tmrldhugjzzdatq", "je")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf("lgphu", new UserAssignedIdentity(), "ndv", new UserAssignedIdentity()))); model = BinaryData.fromObject(model).toObject(FleetPatch.class); - Assertions.assertEquals("rgqjbpfzfsinzg", model.tags().get("f")); + Assertions.assertEquals("sabkyqduujitcjcz", model.tags().get("zevndhkrwpdappds")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetPropertiesTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetPropertiesTests.java index afa3139b2ea3..a60450472702 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetPropertiesTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetPropertiesTests.java @@ -6,6 +6,8 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.containerservicefleet.fluent.models.FleetProperties; +import com.azure.resourcemanager.containerservicefleet.models.AgentProfile; +import com.azure.resourcemanager.containerservicefleet.models.ApiServerAccessProfile; import com.azure.resourcemanager.containerservicefleet.models.FleetHubProfile; import org.junit.jupiter.api.Assertions; @@ -15,16 +17,33 @@ public void testDeserialize() throws Exception { FleetProperties model = BinaryData .fromString( - "{\"provisioningState\":\"Creating\",\"hubProfile\":{\"dnsPrefix\":\"dpvwryoqpsoaccta\",\"fqdn\":\"kljla\",\"kubernetesVersion\":\"cr\"}}") + "{\"provisioningState\":\"Deleting\",\"hubProfile\":{\"dnsPrefix\":\"eotusivyevc\",\"apiServerAccessProfile\":{\"enablePrivateCluster\":false,\"enableVnetIntegration\":false,\"subnetId\":\"un\"},\"agentProfile\":{\"subnetId\":\"jzrnf\"},\"fqdn\":\"xgispemvtzfkufu\",\"kubernetesVersion\":\"jofxqe\"}}") .toObject(FleetProperties.class); - Assertions.assertEquals("dpvwryoqpsoaccta", model.hubProfile().dnsPrefix()); + Assertions.assertEquals("eotusivyevc", model.hubProfile().dnsPrefix()); + Assertions.assertEquals(false, model.hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions.assertEquals(false, model.hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("un", model.hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("jzrnf", model.hubProfile().agentProfile().subnetId()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { FleetProperties model = - new FleetProperties().withHubProfile(new FleetHubProfile().withDnsPrefix("dpvwryoqpsoaccta")); + new FleetProperties() + .withHubProfile( + new FleetHubProfile() + .withDnsPrefix("eotusivyevc") + .withApiServerAccessProfile( + new ApiServerAccessProfile() + .withEnablePrivateCluster(false) + .withEnableVnetIntegration(false) + .withSubnetId("un")) + .withAgentProfile(new AgentProfile().withSubnetId("jzrnf"))); model = BinaryData.fromObject(model).toObject(FleetProperties.class); - Assertions.assertEquals("dpvwryoqpsoaccta", model.hubProfile().dnsPrefix()); + Assertions.assertEquals("eotusivyevc", model.hubProfile().dnsPrefix()); + Assertions.assertEquals(false, model.hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions.assertEquals(false, model.hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("un", model.hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("jzrnf", model.hubProfile().agentProfile().subnetId()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsCreateOrUpdateMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsCreateOrUpdateMockTests.java index d63544a7f0b1..abeec0bbd8c2 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsCreateOrUpdateMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsCreateOrUpdateMockTests.java @@ -12,8 +12,13 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager; +import com.azure.resourcemanager.containerservicefleet.models.AgentProfile; +import com.azure.resourcemanager.containerservicefleet.models.ApiServerAccessProfile; import com.azure.resourcemanager.containerservicefleet.models.Fleet; import com.azure.resourcemanager.containerservicefleet.models.FleetHubProfile; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentity; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.containerservicefleet.models.UserAssignedIdentity; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -34,7 +39,7 @@ public void testCreateOrUpdate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"hubProfile\":{\"dnsPrefix\":\"q\",\"fqdn\":\"a\",\"kubernetesVersion\":\"ae\"}},\"eTag\":\"fhyhltrpmopjmcma\",\"location\":\"okth\",\"tags\":{\"xodpuozmyzydagfu\":\"uaodsfcpk\",\"dxwzywqsmbsurexi\":\"xbezyiuokktwh\"},\"id\":\"o\",\"name\":\"yocf\",\"type\":\"fksymddystki\"}"; + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"hubProfile\":{\"dnsPrefix\":\"xbpvjymjhx\",\"apiServerAccessProfile\":{\"enablePrivateCluster\":false,\"enableVnetIntegration\":false,\"subnetId\":\"ivkrtsw\"},\"agentProfile\":{\"subnetId\":\"zvszj\"},\"fqdn\":\"uvjfdxxive\",\"kubernetesVersion\":\"t\"}},\"eTag\":\"aqtdoqmcbx\",\"identity\":{\"principalId\":\"79e8ddd7-dee7-4b2f-8926-28098439eb5b\",\"tenantId\":\"49e36df4-2ab7-4d11-8f9b-61f1cf91f5a3\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"hsfxoblytkb\":{\"principalId\":\"4d22572d-7e5e-4ec6-8ef0-dcc2911cfb75\",\"clientId\":\"7236ecf0-dc0f-4f56-9131-b5aaec55b683\"},\"ewwwfbkrvrnsv\":{\"principalId\":\"e56b9824-c885-4db5-bc97-92c042e7197d\",\"clientId\":\"230c9584-8b33-4874-a863-4978419464ce\"}}},\"location\":\"q\",\"tags\":{\"sbfov\":\"xc\"},\"id\":\"srruvwbhsqfsubcg\",\"name\":\"birx\",\"type\":\"pybsrfbjfdtw\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -65,20 +70,49 @@ public void testCreateOrUpdate() throws Exception { Fleet response = manager .fleets() - .define("ndnvo") - .withRegion("whybcib") - .withExistingResourceGroup("vudwx") - .withTags(mapOf("ynnaam", "dcsi", "qsc", "ectehf", "hcjrefovgmk", "eypvhezrkg")) - .withHubProfile(new FleetHubProfile().withDnsPrefix("gwdkcglhsl")) - .withIfMatch("jh") - .withIfNoneMatch("mdajv") + .define("dzumveekg") + .withRegion("tpnapnyiropuhpig") + .withExistingResourceGroup("skzbb") + .withTags( + mapOf( + "n", "ylgqgitxmedjvcsl", "rmgucnap", "wwncwzzhxgk", "oellwp", "t", "qrhhu", "fdygpfqbuaceopz")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities( + mapOf( + "eli", + new UserAssignedIdentity(), + "rzt", + new UserAssignedIdentity(), + "hb", + new UserAssignedIdentity(), + "nalaulppg", + new UserAssignedIdentity()))) + .withHubProfile( + new FleetHubProfile() + .withDnsPrefix("kfpbs") + .withApiServerAccessProfile( + new ApiServerAccessProfile() + .withEnablePrivateCluster(false) + .withEnableVnetIntegration(false) + .withSubnetId("uusdttouwa")) + .withAgentProfile(new AgentProfile().withSubnetId("kqvkelnsmvbxwyjs"))) + .withIfMatch("kdmoi") + .withIfNoneMatch("postmgrcfbunrm") .create(); - Assertions.assertEquals("okth", response.location()); - Assertions.assertEquals("uaodsfcpk", response.tags().get("xodpuozmyzydagfu")); - Assertions.assertEquals("q", response.hubProfile().dnsPrefix()); + Assertions.assertEquals("q", response.location()); + Assertions.assertEquals("xc", response.tags().get("sbfov")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.identity().type()); + Assertions.assertEquals("xbpvjymjhx", response.hubProfile().dnsPrefix()); + Assertions.assertEquals(false, response.hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions.assertEquals(false, response.hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("ivkrtsw", response.hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("zvszj", response.hubProfile().agentProfile().subnetId()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsDeleteMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsDeleteMockTests.java index 7ae131e1e905..d2479388d0d2 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsDeleteMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsDeleteMockTests.java @@ -56,6 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.fleets().delete("ualhbxxhejj", "zvdudgwdslfhotwm", "ynpwlbj", com.azure.core.util.Context.NONE); + manager.fleets().delete("wroyqbexrmcq", "bycnojvkn", "e", com.azure.core.util.Context.NONE); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsGetByResourceGroupWithResponseMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsGetByResourceGroupWithResponseMockTests.java index 20dc569b1caf..df69bc0fe7f0 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsGetByResourceGroupWithResponseMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsGetByResourceGroupWithResponseMockTests.java @@ -13,6 +13,7 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager; import com.azure.resourcemanager.containerservicefleet.models.Fleet; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentityType; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -31,7 +32,7 @@ public void testGetByResourceGroupWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Canceled\",\"hubProfile\":{\"dnsPrefix\":\"fnba\",\"fqdn\":\"ionle\",\"kubernetesVersion\":\"etqgtzxdpnq\"}},\"eTag\":\"qwxrjfeallnw\",\"location\":\"bisnja\",\"tags\":{\"onq\":\"ngnzscxaqwoochc\",\"ea\":\"pkvlrxn\",\"enjbdlwtgrhp\":\"eipheoflokeyy\"},\"id\":\"jp\",\"name\":\"umasxazjpq\",\"type\":\"e\"}"; + "{\"properties\":{\"provisioningState\":\"Failed\",\"hubProfile\":{\"dnsPrefix\":\"x\",\"apiServerAccessProfile\":{\"enablePrivateCluster\":false,\"enableVnetIntegration\":false,\"subnetId\":\"klwndnhjdauwhv\"},\"agentProfile\":{\"subnetId\":\"zbtd\"},\"fqdn\":\"ujznb\",\"kubernetesVersion\":\"ow\"}},\"eTag\":\"przqlveu\",\"identity\":{\"principalId\":\"33dd153b-be78-4c2c-a8cf-9543907cf01e\",\"tenantId\":\"37865511-d094-4af8-b869-06e99bf6f194\",\"type\":\"None\",\"userAssignedIdentities\":{\"xobbcswsrt\":{\"principalId\":\"9c2d6db5-5d68-4246-bb03-477847387366\",\"clientId\":\"3907f163-e04d-4b86-8911-34f2120724ba\"},\"plrbpbewtghf\":{\"principalId\":\"8ce6bac2-58a7-4ec5-a074-3acedf49b199\",\"clientId\":\"12ead0fb-a5b1-4edf-97fe-79a10f7d4586\"},\"c\":{\"principalId\":\"f14a2cbd-c1f9-4382-9364-022965ade64b\",\"clientId\":\"0f76d48a-6c44-49b6-ad50-a518a8313476\"},\"zvlvqhjkbegib\":{\"principalId\":\"2cdc486d-99d5-4771-b22c-fb2980815399\",\"clientId\":\"05ccb437-d0be-4ead-9e4e-fdfcc189e794\"}}},\"location\":\"mxiebw\",\"tags\":{\"wrtz\":\"oayqc\",\"ngmtsavjcb\":\"uzgwyzmhtx\"},\"id\":\"wxqpsrknftguvri\",\"name\":\"hprwmdyv\",\"type\":\"qtayri\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,11 +63,16 @@ public void testGetByResourceGroupWithResponse() throws Exception { Fleet response = manager .fleets() - .getByResourceGroupWithResponse("c", "pmivkwlzu", com.azure.core.util.Context.NONE) + .getByResourceGroupWithResponse("it", "nrjawgqwg", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("bisnja", response.location()); - Assertions.assertEquals("ngnzscxaqwoochc", response.tags().get("onq")); - Assertions.assertEquals("fnba", response.hubProfile().dnsPrefix()); + Assertions.assertEquals("mxiebw", response.location()); + Assertions.assertEquals("oayqc", response.tags().get("wrtz")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.identity().type()); + Assertions.assertEquals("x", response.hubProfile().dnsPrefix()); + Assertions.assertEquals(false, response.hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions.assertEquals(false, response.hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("klwndnhjdauwhv", response.hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("zbtd", response.hubProfile().agentProfile().subnetId()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListByResourceGroupMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListByResourceGroupMockTests.java index 08eb251c71d3..e3a93b4de8cd 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListByResourceGroupMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListByResourceGroupMockTests.java @@ -14,6 +14,7 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager; import com.azure.resourcemanager.containerservicefleet.models.Fleet; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentityType; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -32,7 +33,7 @@ public void testListByResourceGroup() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Deleting\",\"hubProfile\":{\"dnsPrefix\":\"gug\",\"fqdn\":\"krxd\",\"kubernetesVersion\":\"i\"}},\"eTag\":\"thz\",\"location\":\"qdrabhjybigehoqf\",\"tags\":{\"zlcuiywgqywgndrv\":\"skanyk\"},\"id\":\"nhzgpphrcgyn\",\"name\":\"ocpecfvmmco\",\"type\":\"fsxlzevgbmqjqa\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"hubProfile\":{\"dnsPrefix\":\"eemaofmxagkvtme\",\"apiServerAccessProfile\":{\"enablePrivateCluster\":false,\"enableVnetIntegration\":true,\"subnetId\":\"hvljuahaquh\"},\"agentProfile\":{\"subnetId\":\"mdua\"},\"fqdn\":\"exq\",\"kubernetesVersion\":\"fadmws\"}},\"eTag\":\"r\",\"identity\":{\"principalId\":\"6b6e40fa-1dfa-40bc-996a-e8354b51bc1b\",\"tenantId\":\"13ee81cb-77d7-4de4-bc91-73d574fe8e39\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"lf\":{\"principalId\":\"b1469c38-7ce9-4144-aab3-cd142fae5fa0\",\"clientId\":\"248004cf-9841-4ec8-95c9-c33abb3d2b92\"},\"gwb\":{\"principalId\":\"f7f21e04-302f-4085-933d-777e2a1ecace\",\"clientId\":\"edafd5ea-9faf-444c-b32d-6923de1eebd7\"}}},\"location\":\"beldawkzbaliourq\",\"tags\":{\"sowzxcugi\":\"auhashsfwx\",\"ucww\":\"jooxdjebw\",\"bvmeuecivy\":\"vo\"},\"id\":\"zceuojgjrw\",\"name\":\"ueiotwmcdyt\",\"type\":\"x\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,10 +62,21 @@ public void testListByResourceGroup() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.fleets().listByResourceGroup("iotkftutqxl", com.azure.core.util.Context.NONE); + manager.fleets().listByResourceGroup("ehhseyvjusrts", com.azure.core.util.Context.NONE); - Assertions.assertEquals("qdrabhjybigehoqf", response.iterator().next().location()); - Assertions.assertEquals("skanyk", response.iterator().next().tags().get("zlcuiywgqywgndrv")); - Assertions.assertEquals("gug", response.iterator().next().hubProfile().dnsPrefix()); + Assertions.assertEquals("beldawkzbaliourq", response.iterator().next().location()); + Assertions.assertEquals("auhashsfwx", response.iterator().next().tags().get("sowzxcugi")); + Assertions + .assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type()); + Assertions.assertEquals("eemaofmxagkvtme", response.iterator().next().hubProfile().dnsPrefix()); + Assertions + .assertEquals( + false, response.iterator().next().hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions + .assertEquals( + true, response.iterator().next().hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions + .assertEquals("hvljuahaquh", response.iterator().next().hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("mdua", response.iterator().next().hubProfile().agentProfile().subnetId()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListCredentialsWithResponseMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListCredentialsWithResponseMockTests.java index 6c608ad59158..37d439697218 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListCredentialsWithResponseMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListCredentialsWithResponseMockTests.java @@ -29,7 +29,8 @@ public void testListCredentialsWithResponse() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"kubeconfigs\":[{\"name\":\"esnzwde\"},{\"name\":\"vorxzdmohct\"}]}"; + String responseStr = + "{\"kubeconfigs\":[{\"name\":\"wlxkvugfhzovaw\"},{\"name\":\"u\"},{\"name\":\"thnnpr\"},{\"name\":\"peilpjzuaejxdu\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -60,7 +61,7 @@ public void testListCredentialsWithResponse() throws Exception { FleetCredentialResults response = manager .fleets() - .listCredentialsWithResponse("pgacftadehxnlty", "sop", com.azure.core.util.Context.NONE) + .listCredentialsWithResponse("qsgzvahapj", "zhpvgqzcjrvxd", com.azure.core.util.Context.NONE) .getValue(); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListMockTests.java index f3e916a3d713..3e80a9a86f51 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/FleetsListMockTests.java @@ -14,6 +14,7 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager; import com.azure.resourcemanager.containerservicefleet.models.Fleet; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentityType; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -32,7 +33,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"hubProfile\":{\"dnsPrefix\":\"pzaoqvuhr\",\"fqdn\":\"f\",\"kubernetesVersion\":\"yd\"}},\"eTag\":\"lmjthjq\",\"location\":\"pyeicxm\",\"tags\":{\"pbobjo\":\"wqvhkhixuigdt\",\"w\":\"hm\"},\"id\":\"a\",\"name\":\"a\",\"type\":\"hrzayvvtpgvdf\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"hubProfile\":{\"dnsPrefix\":\"kphywpnvjto\",\"apiServerAccessProfile\":{\"enablePrivateCluster\":true,\"enableVnetIntegration\":false,\"subnetId\":\"fpl\"},\"agentProfile\":{\"subnetId\":\"xus\"},\"fqdn\":\"pabgyeps\",\"kubernetesVersion\":\"tazqugxywpmueefj\"}},\"eTag\":\"fqkquj\",\"identity\":{\"principalId\":\"13293e28-2fa6-4836-9dfe-01d82e560dd4\",\"tenantId\":\"620d8108-3be7-4d2f-9d3e-4a670e991cd6\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"glaocq\":{\"principalId\":\"ab38fafc-5867-4cbb-828a-f49295ed22d5\",\"clientId\":\"89f76313-affc-47be-a8bb-849ab09aebce\"},\"cmgyud\":{\"principalId\":\"f9f07d02-d2cf-4d95-891f-eabd28476099\",\"clientId\":\"8fd44560-a253-4855-b9ed-76312fb1f395\"},\"lmoyrx\":{\"principalId\":\"fc44cf97-52e1-43be-93e1-9e7f297e0b06\",\"clientId\":\"76de2a1e-7bdc-4dca-b3c9-2f0c9c74ee87\"}}},\"location\":\"fudwpznt\",\"tags\":{\"ck\":\"zhlrqjb\",\"kyv\":\"rlhrxs\"},\"id\":\"ycanuzbpzkafku\",\"name\":\"b\",\"type\":\"rnwb\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,8 +63,18 @@ public void testList() throws Exception { PagedIterable response = manager.fleets().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("pyeicxm", response.iterator().next().location()); - Assertions.assertEquals("wqvhkhixuigdt", response.iterator().next().tags().get("pbobjo")); - Assertions.assertEquals("pzaoqvuhr", response.iterator().next().hubProfile().dnsPrefix()); + Assertions.assertEquals("fudwpznt", response.iterator().next().location()); + Assertions.assertEquals("zhlrqjb", response.iterator().next().tags().get("ck")); + Assertions + .assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type()); + Assertions.assertEquals("kphywpnvjto", response.iterator().next().hubProfile().dnsPrefix()); + Assertions + .assertEquals( + true, response.iterator().next().hubProfile().apiServerAccessProfile().enablePrivateCluster()); + Assertions + .assertEquals( + false, response.iterator().next().hubProfile().apiServerAccessProfile().enableVnetIntegration()); + Assertions.assertEquals("fpl", response.iterator().next().hubProfile().apiServerAccessProfile().subnetId()); + Assertions.assertEquals("xus", response.iterator().next().hubProfile().agentProfile().subnetId()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedClusterUpdateTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedClusterUpdateTests.java index 9c0b796a75ce..f661489af987 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedClusterUpdateTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedClusterUpdateTests.java @@ -8,6 +8,8 @@ import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeSpec; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelection; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; import org.junit.jupiter.api.Assertions; public final class ManagedClusterUpdateTests { @@ -15,10 +17,12 @@ public final class ManagedClusterUpdateTests { public void testDeserialize() throws Exception { ManagedClusterUpdate model = BinaryData - .fromString("{\"upgrade\":{\"type\":\"Full\",\"kubernetesVersion\":\"mdwzjeiachboo\"}}") + .fromString( + "{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"dagfuaxbezyiuok\"},\"nodeImageSelection\":{\"type\":\"Consistent\"}}") .toObject(ManagedClusterUpdate.class); - Assertions.assertEquals(ManagedClusterUpgradeType.FULL, model.upgrade().type()); - Assertions.assertEquals("mdwzjeiachboo", model.upgrade().kubernetesVersion()); + Assertions.assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, model.upgrade().type()); + Assertions.assertEquals("dagfuaxbezyiuok", model.upgrade().kubernetesVersion()); + Assertions.assertEquals(NodeImageSelectionType.CONSISTENT, model.nodeImageSelection().type()); } @org.junit.jupiter.api.Test @@ -27,10 +31,12 @@ public void testSerialize() throws Exception { new ManagedClusterUpdate() .withUpgrade( new ManagedClusterUpgradeSpec() - .withType(ManagedClusterUpgradeType.FULL) - .withKubernetesVersion("mdwzjeiachboo")); + .withType(ManagedClusterUpgradeType.NODE_IMAGE_ONLY) + .withKubernetesVersion("dagfuaxbezyiuok")) + .withNodeImageSelection(new NodeImageSelection().withType(NodeImageSelectionType.CONSISTENT)); model = BinaryData.fromObject(model).toObject(ManagedClusterUpdate.class); - Assertions.assertEquals(ManagedClusterUpgradeType.FULL, model.upgrade().type()); - Assertions.assertEquals("mdwzjeiachboo", model.upgrade().kubernetesVersion()); + Assertions.assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, model.upgrade().type()); + Assertions.assertEquals("dagfuaxbezyiuok", model.upgrade().kubernetesVersion()); + Assertions.assertEquals(NodeImageSelectionType.CONSISTENT, model.nodeImageSelection().type()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedClusterUpgradeSpecTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedClusterUpgradeSpecTests.java index 2a2c39902ae5..b0ec02c796a2 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedClusterUpgradeSpecTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedClusterUpgradeSpecTests.java @@ -14,10 +14,10 @@ public final class ManagedClusterUpgradeSpecTests { public void testDeserialize() throws Exception { ManagedClusterUpgradeSpec model = BinaryData - .fromString("{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"nrosfqpte\"}") + .fromString("{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"dxwzywqsmbsurexi\"}") .toObject(ManagedClusterUpgradeSpec.class); Assertions.assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, model.type()); - Assertions.assertEquals("nrosfqpte", model.kubernetesVersion()); + Assertions.assertEquals("dxwzywqsmbsurexi", model.kubernetesVersion()); } @org.junit.jupiter.api.Test @@ -25,9 +25,9 @@ public void testSerialize() throws Exception { ManagedClusterUpgradeSpec model = new ManagedClusterUpgradeSpec() .withType(ManagedClusterUpgradeType.NODE_IMAGE_ONLY) - .withKubernetesVersion("nrosfqpte"); + .withKubernetesVersion("dxwzywqsmbsurexi"); model = BinaryData.fromObject(model).toObject(ManagedClusterUpgradeSpec.class); Assertions.assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, model.type()); - Assertions.assertEquals("nrosfqpte", model.kubernetesVersion()); + Assertions.assertEquals("dxwzywqsmbsurexi", model.kubernetesVersion()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedServiceIdentityTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..47a42504d5e4 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentity; +import com.azure.resourcemanager.containerservicefleet.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.containerservicefleet.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = + BinaryData + .fromString( + "{\"principalId\":\"77952b03-894a-457e-8988-ea8b57558a2e\",\"tenantId\":\"01c5134b-5509-4ba1-9f87-aab331c141a1\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ljfmppee\":{\"principalId\":\"13a83be7-b7f6-4a9d-9a6b-3ea1af3f1239\",\"clientId\":\"2b5de2d9-54b5-4d93-8556-67733c79e168\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("ljfmppee", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/MemberUpdateStatusTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/MemberUpdateStatusTests.java index c964ef05c07a..318046ee3cf8 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/MemberUpdateStatusTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/MemberUpdateStatusTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { MemberUpdateStatus model = BinaryData .fromString( - "{\"status\":{\"startTime\":\"2021-09-06T05:45:20Z\",\"completedTime\":\"2021-02-14T15:50:10Z\",\"state\":\"Completed\"},\"name\":\"djwzrlov\",\"clusterResourceId\":\"lwhijcoejctbzaq\",\"operationId\":\"sycbkbfk\"}") + "{\"status\":{\"startTime\":\"2021-09-14T21:04:43Z\",\"completedTime\":\"2021-01-07T21:55:14Z\",\"state\":\"Stopping\"},\"name\":\"jzkdeslpvlopwi\",\"clusterResourceId\":\"ghxpkdw\",\"operationId\":\"aiuebbaumnyqu\",\"message\":\"deoj\"}") .toObject(MemberUpdateStatus.class); } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/NodeImageSelectionStatusTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/NodeImageSelectionStatusTests.java new file mode 100644 index 000000000000..bc78444d8d14 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/NodeImageSelectionStatusTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionStatus; + +public final class NodeImageSelectionStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NodeImageSelectionStatus model = + BinaryData + .fromString("{\"selectedNodeImageVersions\":[{\"version\":\"btfhvpesaps\"}]}") + .toObject(NodeImageSelectionStatus.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NodeImageSelectionStatus model = new NodeImageSelectionStatus(); + model = BinaryData.fromObject(model).toObject(NodeImageSelectionStatus.class); + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/NodeImageSelectionTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/NodeImageSelectionTests.java new file mode 100644 index 000000000000..da7e9454c87d --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/NodeImageSelectionTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelection; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; +import org.junit.jupiter.api.Assertions; + +public final class NodeImageSelectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NodeImageSelection model = BinaryData.fromString("{\"type\":\"Latest\"}").toObject(NodeImageSelection.class); + Assertions.assertEquals(NodeImageSelectionType.LATEST, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NodeImageSelection model = new NodeImageSelection().withType(NodeImageSelectionType.LATEST); + model = BinaryData.fromObject(model).toObject(NodeImageSelection.class); + Assertions.assertEquals(NodeImageSelectionType.LATEST, model.type()); + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/NodeImageVersionTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/NodeImageVersionTests.java new file mode 100644 index 000000000000..4b2f713fb7b1 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/NodeImageVersionTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageVersion; + +public final class NodeImageVersionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NodeImageVersion model = BinaryData.fromString("{\"version\":\"dqmh\"}").toObject(NodeImageVersion.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NodeImageVersion model = new NodeImageVersion(); + model = BinaryData.fromObject(model).toObject(NodeImageVersion.class); + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/OperationsListMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/OperationsListMockTests.java index 7dccbf3fb624..227c594eb9b6 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/OperationsListMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/OperationsListMockTests.java @@ -31,7 +31,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"name\":\"mxaxc\",\"isDataAction\":false,\"display\":{\"provider\":\"dtocj\",\"resource\":\"hvpmoue\",\"operation\":\"dzxibqeojnxqbzvd\",\"description\":\"t\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + "{\"value\":[{\"name\":\"dhtldwkyz\",\"isDataAction\":false,\"display\":{\"provider\":\"ncwscwsvlxoto\",\"resource\":\"wrupqsxvnmicykvc\",\"operation\":\"vei\",\"description\":\"vnotyfjfcnj\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateGroupStatusTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateGroupStatusTests.java index 969d9bc63c9c..fe11c7fb351d 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateGroupStatusTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateGroupStatusTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { UpdateGroupStatus model = BinaryData .fromString( - "{\"status\":{\"startTime\":\"2021-08-17T01:01:15Z\",\"completedTime\":\"2021-05-08T18:49:34Z\",\"state\":\"Completed\"},\"name\":\"aierhhb\",\"members\":[{\"status\":{\"startTime\":\"2021-07-20T05:11Z\",\"completedTime\":\"2021-01-08T14:04:30Z\",\"state\":\"Stopped\"},\"name\":\"odxobnbdxkqpxok\",\"clusterResourceId\":\"ionpimexg\",\"operationId\":\"xgcp\"}]}") + "{\"status\":{\"startTime\":\"2021-08-16T11:07:09Z\",\"completedTime\":\"2021-03-08T14:48:20Z\",\"state\":\"Skipped\"},\"name\":\"bavxbniwdjswzt\",\"members\":[{\"status\":{\"startTime\":\"2021-10-19T12:26:50Z\",\"completedTime\":\"2021-04-13T23:02:25Z\",\"state\":\"Completed\"},\"name\":\"zxbzpfzabglc\",\"clusterResourceId\":\"xwtctyqiklbbovpl\",\"operationId\":\"bhvgy\",\"message\":\"uosvmkfssxqukk\"}]}") .toObject(UpdateGroupStatus.class); } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateGroupTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateGroupTests.java index 85ca4ff55aee..01805b1d1659 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateGroupTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateGroupTests.java @@ -11,14 +11,14 @@ public final class UpdateGroupTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - UpdateGroup model = BinaryData.fromString("{\"name\":\"cs\"}").toObject(UpdateGroup.class); - Assertions.assertEquals("cs", model.name()); + UpdateGroup model = BinaryData.fromString("{\"name\":\"sfcpkvxodpuozm\"}").toObject(UpdateGroup.class); + Assertions.assertEquals("sfcpkvxodpuozm", model.name()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - UpdateGroup model = new UpdateGroup().withName("cs"); + UpdateGroup model = new UpdateGroup().withName("sfcpkvxodpuozm"); model = BinaryData.fromObject(model).toObject(UpdateGroup.class); - Assertions.assertEquals("cs", model.name()); + Assertions.assertEquals("sfcpkvxodpuozm", model.name()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunInnerTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunInnerTests.java index 947e609ce9a9..8dd852923e98 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunInnerTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunInnerTests.java @@ -7,8 +7,15 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.containerservicefleet.fluent.models.UpdateRunInner; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeSpec; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelection; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; +import com.azure.resourcemanager.containerservicefleet.models.UpdateGroup; import com.azure.resourcemanager.containerservicefleet.models.UpdateRunStrategy; +import com.azure.resourcemanager.containerservicefleet.models.UpdateStage; import java.util.Arrays; +import org.junit.jupiter.api.Assertions; public final class UpdateRunInnerTests { @org.junit.jupiter.api.Test @@ -16,16 +23,69 @@ public void testDeserialize() throws Exception { UpdateRunInner model = BinaryData .fromString( - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"strategy\":{\"stages\":[]},\"managedClusterUpdate\":{},\"status\":{\"stages\":[]}},\"eTag\":\"uxig\",\"id\":\"jgzjaoyfhrtx\",\"name\":\"lnerkujysvleju\",\"type\":\"fqawrlyxw\"}") + "{\"properties\":{\"provisioningState\":\"Failed\",\"strategy\":{\"stages\":[{\"name\":\"mouexhdzx\",\"groups\":[{\"name\":\"eojnxqbzvddn\"},{\"name\":\"wndeicbtwnp\"},{\"name\":\"aoqvuh\"},{\"name\":\"hcffcyddglmjthjq\"}],\"afterStageWaitInSeconds\":1616692109},{\"name\":\"yeicxmqciwqvhk\",\"groups\":[{\"name\":\"uigdtopbobjog\"},{\"name\":\"m\"},{\"name\":\"w\"}],\"afterStageWaitInSeconds\":54099605},{\"name\":\"a\",\"groups\":[{\"name\":\"z\"},{\"name\":\"yvvtpgvdfgio\"}],\"afterStageWaitInSeconds\":1858576873}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"tqxln\"},\"nodeImageSelection\":{\"type\":\"Consistent\"}},\"status\":{\"status\":{\"startTime\":\"2021-07-23T20:25:28Z\",\"completedTime\":\"2021-01-24T10:40:18Z\",\"state\":\"Failed\"},\"stages\":[{\"status\":{\"startTime\":\"2021-08-28T06:39:58Z\",\"completedTime\":\"2021-02-10T03:59:13Z\",\"state\":\"Completed\"},\"name\":\"vqdra\",\"groups\":[{},{}],\"afterStageWaitStatus\":{\"status\":{},\"waitDurationInSeconds\":1370032032}},{\"status\":{\"startTime\":\"2021-04-03T11:00:19Z\",\"completedTime\":\"2021-02-13T15:34:58Z\",\"state\":\"Skipped\"},\"name\":\"kanyktzlcuiywg\",\"groups\":[{},{},{},{}],\"afterStageWaitStatus\":{\"status\":{},\"waitDurationInSeconds\":508841198}}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{\"version\":\"zgpphrcgyncocpe\"},{\"version\":\"vmmcoofs\"},{\"version\":\"zevgb\"}]}}},\"eTag\":\"jqabcypmivkwlzuv\",\"id\":\"c\",\"name\":\"wnfnbacf\",\"type\":\"onlebxetqgtzxdpn\"}") .toObject(UpdateRunInner.class); + Assertions.assertEquals("mouexhdzx", model.strategy().stages().get(0).name()); + Assertions.assertEquals("eojnxqbzvddn", model.strategy().stages().get(0).groups().get(0).name()); + Assertions.assertEquals(1616692109, model.strategy().stages().get(0).afterStageWaitInSeconds()); + Assertions + .assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, model.managedClusterUpdate().upgrade().type()); + Assertions.assertEquals("tqxln", model.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals(NodeImageSelectionType.CONSISTENT, model.managedClusterUpdate().nodeImageSelection().type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { UpdateRunInner model = new UpdateRunInner() - .withStrategy(new UpdateRunStrategy().withStages(Arrays.asList())) - .withManagedClusterUpdate(new ManagedClusterUpdate()); + .withStrategy( + new UpdateRunStrategy() + .withStages( + Arrays + .asList( + new UpdateStage() + .withName("mouexhdzx") + .withGroups( + Arrays + .asList( + new UpdateGroup().withName("eojnxqbzvddn"), + new UpdateGroup().withName("wndeicbtwnp"), + new UpdateGroup().withName("aoqvuh"), + new UpdateGroup().withName("hcffcyddglmjthjq"))) + .withAfterStageWaitInSeconds(1616692109), + new UpdateStage() + .withName("yeicxmqciwqvhk") + .withGroups( + Arrays + .asList( + new UpdateGroup().withName("uigdtopbobjog"), + new UpdateGroup().withName("m"), + new UpdateGroup().withName("w"))) + .withAfterStageWaitInSeconds(54099605), + new UpdateStage() + .withName("a") + .withGroups( + Arrays + .asList( + new UpdateGroup().withName("z"), + new UpdateGroup().withName("yvvtpgvdfgio"))) + .withAfterStageWaitInSeconds(1858576873)))) + .withManagedClusterUpdate( + new ManagedClusterUpdate() + .withUpgrade( + new ManagedClusterUpgradeSpec() + .withType(ManagedClusterUpgradeType.NODE_IMAGE_ONLY) + .withKubernetesVersion("tqxln")) + .withNodeImageSelection(new NodeImageSelection().withType(NodeImageSelectionType.CONSISTENT))); model = BinaryData.fromObject(model).toObject(UpdateRunInner.class); + Assertions.assertEquals("mouexhdzx", model.strategy().stages().get(0).name()); + Assertions.assertEquals("eojnxqbzvddn", model.strategy().stages().get(0).groups().get(0).name()); + Assertions.assertEquals(1616692109, model.strategy().stages().get(0).afterStageWaitInSeconds()); + Assertions + .assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, model.managedClusterUpdate().upgrade().type()); + Assertions.assertEquals("tqxln", model.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals(NodeImageSelectionType.CONSISTENT, model.managedClusterUpdate().nodeImageSelection().type()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunListResultTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunListResultTests.java index 52a6f6d2bf06..4f99c6ddd6a0 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunListResultTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunListResultTests.java @@ -6,7 +6,14 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.containerservicefleet.fluent.models.UpdateRunInner; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeSpec; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelection; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; import com.azure.resourcemanager.containerservicefleet.models.UpdateRunListResult; +import com.azure.resourcemanager.containerservicefleet.models.UpdateRunStrategy; +import com.azure.resourcemanager.containerservicefleet.models.UpdateStage; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -16,18 +23,101 @@ public void testDeserialize() throws Exception { UpdateRunListResult model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\"},\"eTag\":\"ndlik\",\"id\":\"qkgfgibma\",\"name\":\"gakeqsr\",\"type\":\"yb\"},{\"properties\":{\"provisioningState\":\"Canceled\"},\"eTag\":\"tbciqfouflmm\",\"id\":\"zsm\",\"name\":\"dmgloug\",\"type\":\"b\"},{\"properties\":{\"provisioningState\":\"Failed\"},\"eTag\":\"uqktap\",\"id\":\"wgcu\",\"name\":\"rtumkdosvq\",\"type\":\"hbmdgbbjfdd\"}],\"nextLink\":\"bmbexppbhtqqro\"}") + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"strategy\":{\"stages\":[{\"name\":\"f\"},{\"name\":\"rwzwbng\"},{\"name\":\"itnwuizgazxufi\"}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"Full\",\"kubernetesVersion\":\"kyfi\"},\"nodeImageSelection\":{\"type\":\"Latest\"}},\"status\":{\"status\":{\"startTime\":\"2021-05-20T07:32:25Z\",\"completedTime\":\"2021-05-02T03:10:17Z\",\"state\":\"Skipped\"},\"stages\":[{}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{},{}]}}},\"eTag\":\"sdkf\",\"id\":\"hwxmnteiwa\",\"name\":\"pvkmijcmmxdcuf\",\"type\":\"fsrpymzidnse\"},{\"properties\":{\"provisioningState\":\"Failed\",\"strategy\":{\"stages\":[{\"name\":\"sgfyccsnew\"},{\"name\":\"dwzjeiach\"},{\"name\":\"oosflnr\"},{\"name\":\"sfqpteehz\"}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"pyqr\"},\"nodeImageSelection\":{\"type\":\"Latest\"}},\"status\":{\"status\":{\"startTime\":\"2021-01-12T13:01:17Z\",\"completedTime\":\"2021-01-25T11:13:44Z\",\"state\":\"Failed\"},\"stages\":[{},{},{},{}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{}]}}},\"eTag\":\"qxhcrmn\",\"id\":\"hjtckwhd\",\"name\":\"oifiyipjxsqwpgr\",\"type\":\"bznorcjxvsnby\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"strategy\":{\"stages\":[{\"name\":\"ocpcy\"},{\"name\":\"hurzafblj\"}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"btoqcjmkljavbqid\"},\"nodeImageSelection\":{\"type\":\"Latest\"}},\"status\":{\"status\":{\"startTime\":\"2021-10-17T08:13:54Z\",\"completedTime\":\"2021-01-22T00:34:47Z\",\"state\":\"Completed\"},\"stages\":[{},{},{}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{},{},{}]}}},\"eTag\":\"bzhfepgzgqexz\",\"id\":\"ocxscpaierhhbcs\",\"name\":\"l\",\"type\":\"mmajtjaodx\"},{\"properties\":{\"provisioningState\":\"Failed\",\"strategy\":{\"stages\":[{\"name\":\"k\"},{\"name\":\"pxokajionp\"}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"xg\"},\"nodeImageSelection\":{\"type\":\"Latest\"}},\"status\":{\"status\":{\"startTime\":\"2021-02-01T21:21:11Z\",\"completedTime\":\"2021-04-23T14:47:55Z\",\"state\":\"Stopped\"},\"stages\":[{}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{},{}]}}},\"eTag\":\"wzrlovmclwhij\",\"id\":\"oejctbzaqsqsy\",\"name\":\"bkbfkgukdkex\",\"type\":\"ppofmxaxcfjpgdd\"}],\"nextLink\":\"c\"}") .toObject(UpdateRunListResult.class); - Assertions.assertEquals("bmbexppbhtqqro", model.nextLink()); + Assertions.assertEquals("f", model.value().get(0).strategy().stages().get(0).name()); + Assertions + .assertEquals(ManagedClusterUpgradeType.FULL, model.value().get(0).managedClusterUpdate().upgrade().type()); + Assertions.assertEquals("kyfi", model.value().get(0).managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals( + NodeImageSelectionType.LATEST, model.value().get(0).managedClusterUpdate().nodeImageSelection().type()); + Assertions.assertEquals("c", model.nextLink()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { UpdateRunListResult model = new UpdateRunListResult() - .withValue(Arrays.asList(new UpdateRunInner(), new UpdateRunInner(), new UpdateRunInner())) - .withNextLink("bmbexppbhtqqro"); + .withValue( + Arrays + .asList( + new UpdateRunInner() + .withStrategy( + new UpdateRunStrategy() + .withStages( + Arrays + .asList( + new UpdateStage().withName("f"), + new UpdateStage().withName("rwzwbng"), + new UpdateStage().withName("itnwuizgazxufi")))) + .withManagedClusterUpdate( + new ManagedClusterUpdate() + .withUpgrade( + new ManagedClusterUpgradeSpec() + .withType(ManagedClusterUpgradeType.FULL) + .withKubernetesVersion("kyfi")) + .withNodeImageSelection( + new NodeImageSelection().withType(NodeImageSelectionType.LATEST))), + new UpdateRunInner() + .withStrategy( + new UpdateRunStrategy() + .withStages( + Arrays + .asList( + new UpdateStage().withName("sgfyccsnew"), + new UpdateStage().withName("dwzjeiach"), + new UpdateStage().withName("oosflnr"), + new UpdateStage().withName("sfqpteehz")))) + .withManagedClusterUpdate( + new ManagedClusterUpdate() + .withUpgrade( + new ManagedClusterUpgradeSpec() + .withType(ManagedClusterUpgradeType.NODE_IMAGE_ONLY) + .withKubernetesVersion("pyqr")) + .withNodeImageSelection( + new NodeImageSelection().withType(NodeImageSelectionType.LATEST))), + new UpdateRunInner() + .withStrategy( + new UpdateRunStrategy() + .withStages( + Arrays + .asList( + new UpdateStage().withName("ocpcy"), + new UpdateStage().withName("hurzafblj")))) + .withManagedClusterUpdate( + new ManagedClusterUpdate() + .withUpgrade( + new ManagedClusterUpgradeSpec() + .withType(ManagedClusterUpgradeType.NODE_IMAGE_ONLY) + .withKubernetesVersion("btoqcjmkljavbqid")) + .withNodeImageSelection( + new NodeImageSelection().withType(NodeImageSelectionType.LATEST))), + new UpdateRunInner() + .withStrategy( + new UpdateRunStrategy() + .withStages( + Arrays + .asList( + new UpdateStage().withName("k"), + new UpdateStage().withName("pxokajionp")))) + .withManagedClusterUpdate( + new ManagedClusterUpdate() + .withUpgrade( + new ManagedClusterUpgradeSpec() + .withType(ManagedClusterUpgradeType.NODE_IMAGE_ONLY) + .withKubernetesVersion("xg")) + .withNodeImageSelection( + new NodeImageSelection().withType(NodeImageSelectionType.LATEST))))) + .withNextLink("c"); model = BinaryData.fromObject(model).toObject(UpdateRunListResult.class); - Assertions.assertEquals("bmbexppbhtqqro", model.nextLink()); + Assertions.assertEquals("f", model.value().get(0).strategy().stages().get(0).name()); + Assertions + .assertEquals(ManagedClusterUpgradeType.FULL, model.value().get(0).managedClusterUpdate().upgrade().type()); + Assertions.assertEquals("kyfi", model.value().get(0).managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals( + NodeImageSelectionType.LATEST, model.value().get(0).managedClusterUpdate().nodeImageSelection().type()); + Assertions.assertEquals("c", model.nextLink()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunPropertiesTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunPropertiesTests.java index fa8afb100945..3146096ef252 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunPropertiesTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunPropertiesTests.java @@ -9,6 +9,9 @@ import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeSpec; import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelection; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; +import com.azure.resourcemanager.containerservicefleet.models.UpdateGroup; import com.azure.resourcemanager.containerservicefleet.models.UpdateRunStrategy; import com.azure.resourcemanager.containerservicefleet.models.UpdateStage; import java.util.Arrays; @@ -20,13 +23,16 @@ public void testDeserialize() throws Exception { UpdateRunProperties model = BinaryData .fromString( - "{\"provisioningState\":\"Canceled\",\"strategy\":{\"stages\":[{\"name\":\"bnwbxgjvtbvpyssz\",\"groups\":[],\"afterStageWaitInSeconds\":315783866},{\"name\":\"jq\",\"groups\":[],\"afterStageWaitInSeconds\":1745806154},{\"name\":\"uouq\",\"groups\":[],\"afterStageWaitInSeconds\":326786210},{\"name\":\"zw\",\"groups\":[],\"afterStageWaitInSeconds\":2100303933}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"nwui\"}},\"status\":{\"status\":{\"startTime\":\"2021-08-08T04:29:53Z\",\"completedTime\":\"2021-11-07T16:18:10Z\",\"state\":\"Failed\"},\"stages\":[{\"name\":\"i\",\"groups\":[]}]}}") + "{\"provisioningState\":\"Succeeded\",\"strategy\":{\"stages\":[{\"name\":\"xrjfeallnwsub\",\"groups\":[{\"name\":\"jampmngnzscxaqw\"},{\"name\":\"ochcbonqvpkvl\"}],\"afterStageWaitInSeconds\":1945684802},{\"name\":\"jease\",\"groups\":[{\"name\":\"eo\"},{\"name\":\"lokeyy\"},{\"name\":\"enjbdlwtgrhp\"},{\"name\":\"jp\"}],\"afterStageWaitInSeconds\":1270874920},{\"name\":\"asxazjpqyegualhb\",\"groups\":[{\"name\":\"e\"},{\"name\":\"jzzvdud\"}],\"afterStageWaitInSeconds\":621270176},{\"name\":\"slfhotwm\",\"groups\":[{\"name\":\"pwlbjnpg\"},{\"name\":\"cftadeh\"},{\"name\":\"nltyfsoppusuesnz\"}],\"afterStageWaitInSeconds\":332314223}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"avo\"},\"nodeImageSelection\":{\"type\":\"Consistent\"}},\"status\":{\"status\":{\"startTime\":\"2021-01-18T23:17:52Z\",\"completedTime\":\"2021-05-10T16:03:24Z\",\"state\":\"Completed\"},\"stages\":[{\"status\":{\"startTime\":\"2021-07-18T13:03:27Z\",\"completedTime\":\"2021-03-23T22:55:01Z\",\"state\":\"Stopped\"},\"name\":\"gujjugwdkcglh\",\"groups\":[{\"status\":{},\"name\":\"dyggdtjixhbku\",\"members\":[{},{},{}]},{\"status\":{},\"name\":\"yk\",\"members\":[{},{},{},{}]}],\"afterStageWaitStatus\":{\"status\":{\"startTime\":\"2021-11-13T11:48:47Z\",\"completedTime\":\"2021-06-20T14:57:34Z\",\"state\":\"Skipped\"},\"waitDurationInSeconds\":1089614022}},{\"status\":{\"startTime\":\"2021-05-17T05:51:50Z\",\"completedTime\":\"2021-02-12T00:37:49Z\",\"state\":\"Stopped\"},\"name\":\"sit\",\"groups\":[{\"status\":{},\"name\":\"mdectehfiqscjey\",\"members\":[{},{}]},{\"status\":{},\"name\":\"rkgqhcjrefo\",\"members\":[{},{},{}]}],\"afterStageWaitStatus\":{\"status\":{\"startTime\":\"2021-02-03T09:21:46Z\",\"completedTime\":\"2021-09-03T21:11:18Z\",\"state\":\"Failed\"},\"waitDurationInSeconds\":1769493620}}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{\"version\":\"attpngjcrcczsq\"}]}}}") .toObject(UpdateRunProperties.class); - Assertions.assertEquals("bnwbxgjvtbvpyssz", model.strategy().stages().get(0).name()); - Assertions.assertEquals(315783866, model.strategy().stages().get(0).afterStageWaitInSeconds()); + Assertions.assertEquals("xrjfeallnwsub", model.strategy().stages().get(0).name()); + Assertions.assertEquals("jampmngnzscxaqw", model.strategy().stages().get(0).groups().get(0).name()); + Assertions.assertEquals(1945684802, model.strategy().stages().get(0).afterStageWaitInSeconds()); Assertions .assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, model.managedClusterUpdate().upgrade().type()); - Assertions.assertEquals("nwui", model.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions.assertEquals("avo", model.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals(NodeImageSelectionType.CONSISTENT, model.managedClusterUpdate().nodeImageSelection().type()); } @org.junit.jupiter.api.Test @@ -39,32 +45,55 @@ public void testSerialize() throws Exception { Arrays .asList( new UpdateStage() - .withName("bnwbxgjvtbvpyssz") - .withGroups(Arrays.asList()) - .withAfterStageWaitInSeconds(315783866), + .withName("xrjfeallnwsub") + .withGroups( + Arrays + .asList( + new UpdateGroup().withName("jampmngnzscxaqw"), + new UpdateGroup().withName("ochcbonqvpkvl"))) + .withAfterStageWaitInSeconds(1945684802), new UpdateStage() - .withName("jq") - .withGroups(Arrays.asList()) - .withAfterStageWaitInSeconds(1745806154), + .withName("jease") + .withGroups( + Arrays + .asList( + new UpdateGroup().withName("eo"), + new UpdateGroup().withName("lokeyy"), + new UpdateGroup().withName("enjbdlwtgrhp"), + new UpdateGroup().withName("jp"))) + .withAfterStageWaitInSeconds(1270874920), new UpdateStage() - .withName("uouq") - .withGroups(Arrays.asList()) - .withAfterStageWaitInSeconds(326786210), + .withName("asxazjpqyegualhb") + .withGroups( + Arrays + .asList( + new UpdateGroup().withName("e"), + new UpdateGroup().withName("jzzvdud"))) + .withAfterStageWaitInSeconds(621270176), new UpdateStage() - .withName("zw") - .withGroups(Arrays.asList()) - .withAfterStageWaitInSeconds(2100303933)))) + .withName("slfhotwm") + .withGroups( + Arrays + .asList( + new UpdateGroup().withName("pwlbjnpg"), + new UpdateGroup().withName("cftadeh"), + new UpdateGroup().withName("nltyfsoppusuesnz"))) + .withAfterStageWaitInSeconds(332314223)))) .withManagedClusterUpdate( new ManagedClusterUpdate() .withUpgrade( new ManagedClusterUpgradeSpec() .withType(ManagedClusterUpgradeType.NODE_IMAGE_ONLY) - .withKubernetesVersion("nwui"))); + .withKubernetesVersion("avo")) + .withNodeImageSelection(new NodeImageSelection().withType(NodeImageSelectionType.CONSISTENT))); model = BinaryData.fromObject(model).toObject(UpdateRunProperties.class); - Assertions.assertEquals("bnwbxgjvtbvpyssz", model.strategy().stages().get(0).name()); - Assertions.assertEquals(315783866, model.strategy().stages().get(0).afterStageWaitInSeconds()); + Assertions.assertEquals("xrjfeallnwsub", model.strategy().stages().get(0).name()); + Assertions.assertEquals("jampmngnzscxaqw", model.strategy().stages().get(0).groups().get(0).name()); + Assertions.assertEquals(1945684802, model.strategy().stages().get(0).afterStageWaitInSeconds()); Assertions .assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, model.managedClusterUpdate().upgrade().type()); - Assertions.assertEquals("nwui", model.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions.assertEquals("avo", model.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals(NodeImageSelectionType.CONSISTENT, model.managedClusterUpdate().nodeImageSelection().type()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunStatusTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunStatusTests.java index 188cfb1be883..fd4352a7c5c3 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunStatusTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunStatusTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { UpdateRunStatus model = BinaryData .fromString( - "{\"status\":{\"startTime\":\"2021-01-29T18:51:03Z\",\"completedTime\":\"2021-10-06T17:45:29Z\",\"state\":\"Stopped\"},\"stages\":[{\"status\":{\"startTime\":\"2021-03-07T01:43:41Z\",\"completedTime\":\"2021-03-18T16:28:01Z\",\"state\":\"Stopped\"},\"name\":\"dkirsoodqxhcr\",\"groups\":[],\"afterStageWaitStatus\":{\"waitDurationInSeconds\":1543175438}}]}") + "{\"status\":{\"startTime\":\"2021-05-23T11:03:50Z\",\"completedTime\":\"2021-01-18T04:02:20Z\",\"state\":\"Stopped\"},\"stages\":[{\"status\":{\"startTime\":\"2021-12-09T10:40:37Z\",\"completedTime\":\"2021-05-12T02:27:32Z\",\"state\":\"Skipped\"},\"name\":\"uxh\",\"groups\":[{\"status\":{\"startTime\":\"2020-12-29T05:18:57Z\",\"completedTime\":\"2021-08-19T10:45:17Z\",\"state\":\"Running\"},\"name\":\"oczvy\",\"members\":[{},{}]},{\"status\":{\"startTime\":\"2020-12-25T17:33:53Z\",\"completedTime\":\"2021-11-06T12:54:53Z\",\"state\":\"NotStarted\"},\"name\":\"rm\",\"members\":[{}]}],\"afterStageWaitStatus\":{\"status\":{\"startTime\":\"2021-12-05T03:26:34Z\",\"completedTime\":\"2021-07-14T20:07:14Z\",\"state\":\"Failed\"},\"waitDurationInSeconds\":63177450}},{\"status\":{\"startTime\":\"2021-05-17T14:35:07Z\",\"completedTime\":\"2021-08-04T22:49:07Z\",\"state\":\"Failed\"},\"name\":\"iqzbq\",\"groups\":[{\"status\":{\"startTime\":\"2021-01-03T16:48:03Z\",\"completedTime\":\"2020-12-29T19:47:48Z\",\"state\":\"Running\"},\"name\":\"pkwlhz\",\"members\":[{},{}]},{\"status\":{\"startTime\":\"2021-11-18T04:52:43Z\",\"completedTime\":\"2021-11-08T00:37:22Z\",\"state\":\"Running\"},\"name\":\"nchrkcciww\",\"members\":[{},{},{}]},{\"status\":{\"startTime\":\"2021-02-07T01:05:42Z\",\"completedTime\":\"2021-05-03T11:30:29Z\",\"state\":\"Stopping\"},\"name\":\"ku\",\"members\":[{}]},{\"status\":{\"startTime\":\"2021-06-28T14:02:06Z\",\"completedTime\":\"2021-05-10T11:17:29Z\",\"state\":\"NotStarted\"},\"name\":\"mjmvxieduugidyjr\",\"members\":[{}]}],\"afterStageWaitStatus\":{\"status\":{\"startTime\":\"2021-05-02T14:53:40Z\",\"completedTime\":\"2021-06-03T02:24:21Z\",\"state\":\"Skipped\"},\"waitDurationInSeconds\":635298433}}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{\"version\":\"ocohslkevleg\"},{\"version\":\"fbuhfmvfaxkffe\"},{\"version\":\"th\"}]}}") .toObject(UpdateRunStatus.class); } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunStrategyTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunStrategyTests.java index 77da1406fa52..e8c8d040b5d7 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunStrategyTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunStrategyTests.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.containerservicefleet.generated; import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicefleet.models.UpdateGroup; import com.azure.resourcemanager.containerservicefleet.models.UpdateRunStrategy; import com.azure.resourcemanager.containerservicefleet.models.UpdateStage; import java.util.Arrays; @@ -16,10 +17,11 @@ public void testDeserialize() throws Exception { UpdateRunStrategy model = BinaryData .fromString( - "{\"stages\":[{\"name\":\"dfvzwdzuhty\",\"groups\":[],\"afterStageWaitInSeconds\":396497881}]}") + "{\"stages\":[{\"name\":\"hvmdajvnysounq\",\"groups\":[{\"name\":\"noae\"}],\"afterStageWaitInSeconds\":1901274446}]}") .toObject(UpdateRunStrategy.class); - Assertions.assertEquals("dfvzwdzuhty", model.stages().get(0).name()); - Assertions.assertEquals(396497881, model.stages().get(0).afterStageWaitInSeconds()); + Assertions.assertEquals("hvmdajvnysounq", model.stages().get(0).name()); + Assertions.assertEquals("noae", model.stages().get(0).groups().get(0).name()); + Assertions.assertEquals(1901274446, model.stages().get(0).afterStageWaitInSeconds()); } @org.junit.jupiter.api.Test @@ -30,11 +32,12 @@ public void testSerialize() throws Exception { Arrays .asList( new UpdateStage() - .withName("dfvzwdzuhty") - .withGroups(Arrays.asList()) - .withAfterStageWaitInSeconds(396497881))); + .withName("hvmdajvnysounq") + .withGroups(Arrays.asList(new UpdateGroup().withName("noae"))) + .withAfterStageWaitInSeconds(1901274446))); model = BinaryData.fromObject(model).toObject(UpdateRunStrategy.class); - Assertions.assertEquals("dfvzwdzuhty", model.stages().get(0).name()); - Assertions.assertEquals(396497881, model.stages().get(0).afterStageWaitInSeconds()); + Assertions.assertEquals("hvmdajvnysounq", model.stages().get(0).name()); + Assertions.assertEquals("noae", model.stages().get(0).groups().get(0).name()); + Assertions.assertEquals(1901274446, model.stages().get(0).afterStageWaitInSeconds()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsCreateOrUpdateMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..cd04b11386ca --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsCreateOrUpdateMockTests.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpdate; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeSpec; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelection; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; +import com.azure.resourcemanager.containerservicefleet.models.UpdateGroup; +import com.azure.resourcemanager.containerservicefleet.models.UpdateRun; +import com.azure.resourcemanager.containerservicefleet.models.UpdateRunStrategy; +import com.azure.resourcemanager.containerservicefleet.models.UpdateStage; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class UpdateRunsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"strategy\":{\"stages\":[{\"name\":\"abjy\",\"groups\":[{\"name\":\"ffimrzrtuzqogsex\"},{\"name\":\"evfdnwnwm\"},{\"name\":\"wzsyyceuzs\"},{\"name\":\"i\"}],\"afterStageWaitInSeconds\":414197490},{\"name\":\"dpfrxtrthzvaytdw\",\"groups\":[{\"name\":\"rqubpaxhexiil\"},{\"name\":\"vpdtiirqtdqoa\"}],\"afterStageWaitInSeconds\":200859544},{\"name\":\"uzf\",\"groups\":[{\"name\":\"uyfxrxxleptramxj\"},{\"name\":\"zwl\"}],\"afterStageWaitInSeconds\":2125136939},{\"name\":\"xuqlcvydypat\",\"groups\":[{\"name\":\"aojkniodk\"}],\"afterStageWaitInSeconds\":2101936696}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"Full\",\"kubernetesVersion\":\"nuj\"},\"nodeImageSelection\":{\"type\":\"Consistent\"}},\"status\":{\"status\":{\"startTime\":\"2020-12-30T11:27:59Z\",\"completedTime\":\"2021-04-12T18:02:31Z\",\"state\":\"Skipped\"},\"stages\":[{\"status\":{},\"name\":\"nfwjlfltkacjvefk\",\"groups\":[{},{}],\"afterStageWaitStatus\":{}},{\"status\":{},\"name\":\"ggkfpagaowpul\",\"groups\":[{},{},{},{}],\"afterStageWaitStatus\":{}}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{}]}}},\"eTag\":\"xkqjnsjervt\",\"id\":\"agxsdszuemps\",\"name\":\"zkfzbeyv\",\"type\":\"nqicvinvkjjxdxrb\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ContainerServiceFleetManager manager = + ContainerServiceFleetManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + UpdateRun response = + manager + .updateRuns() + .define("imfnjhfjx") + .withExistingFleet("epxgyqagvr", "mnpkukghimdblxg") + .withStrategy( + new UpdateRunStrategy() + .withStages( + Arrays + .asList( + new UpdateStage() + .withName("foqreyfkzik") + .withGroups(Arrays.asList(new UpdateGroup().withName("wneaiv"))) + .withAfterStageWaitInSeconds(322973840), + new UpdateStage() + .withName("zel") + .withGroups( + Arrays + .asList( + new UpdateGroup().withName("r"), + new UpdateGroup().withName("lsfeaenwabfatkld"))) + .withAfterStageWaitInSeconds(2043314878), + new UpdateStage() + .withName("jhwuaanozjos") + .withGroups( + Arrays + .asList( + new UpdateGroup().withName("oulpjrv"), + new UpdateGroup().withName("ag"))) + .withAfterStageWaitInSeconds(1846305847), + new UpdateStage() + .withName("imjwosyt") + .withGroups(Arrays.asList(new UpdateGroup().withName("cskfcktqumiekk"))) + .withAfterStageWaitInSeconds(1320070179)))) + .withManagedClusterUpdate( + new ManagedClusterUpdate() + .withUpgrade( + new ManagedClusterUpgradeSpec() + .withType(ManagedClusterUpgradeType.FULL) + .withKubernetesVersion("hlyfjhdgqgg")) + .withNodeImageSelection(new NodeImageSelection().withType(NodeImageSelectionType.LATEST))) + .withIfMatch("sofwqmzqalkrmnji") + .withIfNoneMatch("pxacqqudfn") + .create(); + + Assertions.assertEquals("abjy", response.strategy().stages().get(0).name()); + Assertions.assertEquals("ffimrzrtuzqogsex", response.strategy().stages().get(0).groups().get(0).name()); + Assertions.assertEquals(414197490, response.strategy().stages().get(0).afterStageWaitInSeconds()); + Assertions.assertEquals(ManagedClusterUpgradeType.FULL, response.managedClusterUpdate().upgrade().type()); + Assertions.assertEquals("nuj", response.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals( + NodeImageSelectionType.CONSISTENT, response.managedClusterUpdate().nodeImageSelection().type()); + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsDeleteMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsDeleteMockTests.java index a9c591142ce2..1070d1aece42 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsDeleteMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsDeleteMockTests.java @@ -56,8 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager - .updateRuns() - .delete("jky", "xjvuujqgidokg", "ljyoxgvcltb", "sncghkjeszz", com.azure.core.util.Context.NONE); + manager.updateRuns().delete("hykojoxafnndlpic", "koymkcd", "h", "pkkpw", com.azure.core.util.Context.NONE); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsGetWithResponseMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsGetWithResponseMockTests.java index 5bd05a25bc98..024e273caf5a 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsGetWithResponseMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsGetWithResponseMockTests.java @@ -12,10 +12,13 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; import com.azure.resourcemanager.containerservicefleet.models.UpdateRun; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -30,7 +33,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Failed\",\"strategy\":{\"stages\":[]},\"managedClusterUpdate\":{},\"status\":{\"stages\":[]}},\"eTag\":\"ymuctqhjfbebrj\",\"id\":\"erfuwuttt\",\"name\":\"fvjrbirphxepcy\",\"type\":\"ahfn\"}"; + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"strategy\":{\"stages\":[{\"name\":\"pomgkopkwhojvp\",\"groups\":[{\"name\":\"gxysmocmbqfqvm\"}],\"afterStageWaitInSeconds\":1181340997},{\"name\":\"oz\",\"groups\":[{\"name\":\"helxprglya\"},{\"name\":\"dd\"},{\"name\":\"kcbcue\"},{\"name\":\"rjxgciqib\"}],\"afterStageWaitInSeconds\":703095811},{\"name\":\"sxsdqrhzoymibm\",\"groups\":[{\"name\":\"ibahwflus\"}],\"afterStageWaitInSeconds\":2001573010}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"rkwofyyvoqa\"},\"nodeImageSelection\":{\"type\":\"Consistent\"}},\"status\":{\"status\":{\"startTime\":\"2021-02-27T01:52:43Z\",\"completedTime\":\"2021-06-16T10:32:31Z\",\"state\":\"NotStarted\"},\"stages\":[{\"status\":{},\"name\":\"washr\",\"groups\":[{},{}],\"afterStageWaitStatus\":{}},{\"status\":{},\"name\":\"qxwbpokulpiu\",\"groups\":[{},{}],\"afterStageWaitStatus\":{}}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{},{},{}]}}},\"eTag\":\"i\",\"id\":\"obyu\",\"name\":\"erpqlpqwcciuqg\",\"type\":\"dbutauvfbtkuwhh\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,7 +64,17 @@ public void testGetWithResponse() throws Exception { UpdateRun response = manager .updateRuns() - .getWithResponse("senhwlrs", "frzpwvlqdqgb", "qylihkaetckt", com.azure.core.util.Context.NONE) + .getWithResponse("yzvqt", "nubexk", "zksmondj", com.azure.core.util.Context.NONE) .getValue(); + + Assertions.assertEquals("pomgkopkwhojvp", response.strategy().stages().get(0).name()); + Assertions.assertEquals("gxysmocmbqfqvm", response.strategy().stages().get(0).groups().get(0).name()); + Assertions.assertEquals(1181340997, response.strategy().stages().get(0).afterStageWaitInSeconds()); + Assertions + .assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, response.managedClusterUpdate().upgrade().type()); + Assertions.assertEquals("rkwofyyvoqa", response.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals( + NodeImageSelectionType.CONSISTENT, response.managedClusterUpdate().nodeImageSelection().type()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsListByFleetMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsListByFleetMockTests.java index 6a7b67000058..97da5b802d02 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsListByFleetMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsListByFleetMockTests.java @@ -13,10 +13,13 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; import com.azure.resourcemanager.containerservicefleet.models.UpdateRun; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -31,7 +34,7 @@ public void testListByFleet() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"strategy\":{\"stages\":[]},\"managedClusterUpdate\":{},\"status\":{\"stages\":[]}},\"eTag\":\"gyxzk\",\"id\":\"ocukoklyax\",\"name\":\"conuqszfkbeype\",\"type\":\"rmjmwvvjektc\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"strategy\":{\"stages\":[{\"name\":\"tbhjpglkfgohdneu\",\"groups\":[{\"name\":\"phsdyhto\"},{\"name\":\"fikdowwqu\"},{\"name\":\"v\"},{\"name\":\"zx\"}],\"afterStageWaitInSeconds\":1297043875},{\"name\":\"ithhqzon\",\"groups\":[{\"name\":\"gbhcohfwdsj\"},{\"name\":\"ka\"},{\"name\":\"jutiiswacff\"}],\"afterStageWaitInSeconds\":264036091},{\"name\":\"zzewkfvhqcrai\",\"groups\":[{\"name\":\"n\"},{\"name\":\"pfuflrw\"}],\"afterStageWaitInSeconds\":1760230888},{\"name\":\"dlxyjrxs\",\"groups\":[{\"name\":\"fcnihgwq\"},{\"name\":\"pnedgf\"}],\"afterStageWaitInSeconds\":739247633}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"Full\",\"kubernetesVersion\":\"vq\"},\"nodeImageSelection\":{\"type\":\"Consistent\"}},\"status\":{\"status\":{\"startTime\":\"2021-09-19T11:38:13Z\",\"completedTime\":\"2021-10-03T13:34:01Z\",\"state\":\"Running\"},\"stages\":[{\"status\":{},\"name\":\"otbobzdopcj\",\"groups\":[{},{},{}],\"afterStageWaitStatus\":{}},{\"status\":{},\"name\":\"d\",\"groups\":[{}],\"afterStageWaitStatus\":{}},{\"status\":{},\"name\":\"rslpmutwuoeg\",\"groups\":[{},{}],\"afterStageWaitStatus\":{}}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{},{}]}}},\"eTag\":\"yqsluic\",\"id\":\"dggkzzlvmbmpa\",\"name\":\"modfvuefywsbpfvm\",\"type\":\"yhrfouyftaakcpw\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -60,6 +63,20 @@ public void testListByFleet() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.updateRuns().listByFleet("qnwvlrya", "w", com.azure.core.util.Context.NONE); + manager.updateRuns().listByFleet("lauwzizxbmpgcjef", "zmuvpbttdumorppx", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("tbhjpglkfgohdneu", response.iterator().next().strategy().stages().get(0).name()); + Assertions + .assertEquals("phsdyhto", response.iterator().next().strategy().stages().get(0).groups().get(0).name()); + Assertions + .assertEquals(1297043875, response.iterator().next().strategy().stages().get(0).afterStageWaitInSeconds()); + Assertions + .assertEquals( + ManagedClusterUpgradeType.FULL, response.iterator().next().managedClusterUpdate().upgrade().type()); + Assertions.assertEquals("vq", response.iterator().next().managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals( + NodeImageSelectionType.CONSISTENT, + response.iterator().next().managedClusterUpdate().nodeImageSelection().type()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStartMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStartMockTests.java index 2c509c85f6d0..8dbaee34a546 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStartMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStartMockTests.java @@ -12,10 +12,13 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; import com.azure.resourcemanager.containerservicefleet.models.UpdateRun; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -30,7 +33,7 @@ public void testStart() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"strategy\":{\"stages\":[]},\"managedClusterUpdate\":{},\"status\":{\"stages\":[]}},\"eTag\":\"fbxzpuzycisp\",\"id\":\"zahmgkbrpyydhibn\",\"name\":\"qqkpikadrg\",\"type\":\"tqagnbuynh\"}"; + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"strategy\":{\"stages\":[{\"name\":\"qkacewii\",\"groups\":[{\"name\":\"ubjibww\"},{\"name\":\"f\"}],\"afterStageWaitInSeconds\":1856548413}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"vpuvks\"},\"nodeImageSelection\":{\"type\":\"Latest\"}},\"status\":{\"status\":{\"startTime\":\"2021-01-28T10:41:26Z\",\"completedTime\":\"2021-07-05T23:56:24Z\",\"state\":\"Stopped\"},\"stages\":[{\"status\":{},\"name\":\"huopxodlqiynto\",\"groups\":[{},{}],\"afterStageWaitStatus\":{}},{\"status\":{},\"name\":\"osjswsr\",\"groups\":[{},{},{},{}],\"afterStageWaitStatus\":{}},{\"status\":{},\"name\":\"pzbchck\",\"groups\":[{},{},{}],\"afterStageWaitStatus\":{}}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{}]}}},\"eTag\":\"ysuiizynkedya\",\"id\":\"rwyhqmibzyhwitsm\",\"name\":\"pyy\",\"type\":\"pcdpumnz\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,6 +64,15 @@ public void testStart() throws Exception { UpdateRun response = manager .updateRuns() - .start("bijhtxfvgxbf", "mxnehmp", "ec", "godebfqkkrbmpu", com.azure.core.util.Context.NONE); + .start("reqnovvqfov", "jxywsuws", "rsndsytgadgvra", "aeneqnzarrwl", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qkacewii", response.strategy().stages().get(0).name()); + Assertions.assertEquals("ubjibww", response.strategy().stages().get(0).groups().get(0).name()); + Assertions.assertEquals(1856548413, response.strategy().stages().get(0).afterStageWaitInSeconds()); + Assertions + .assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, response.managedClusterUpdate().upgrade().type()); + Assertions.assertEquals("vpuvks", response.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals(NodeImageSelectionType.LATEST, response.managedClusterUpdate().nodeImageSelection().type()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStopMockTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStopMockTests.java index 989907a296b1..f4db12375841 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStopMockTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateRunsStopMockTests.java @@ -12,10 +12,13 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.containerservicefleet.ContainerServiceFleetManager; +import com.azure.resourcemanager.containerservicefleet.models.ManagedClusterUpgradeType; +import com.azure.resourcemanager.containerservicefleet.models.NodeImageSelectionType; import com.azure.resourcemanager.containerservicefleet.models.UpdateRun; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -30,7 +33,7 @@ public void testStop() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"strategy\":{\"stages\":[]},\"managedClusterUpdate\":{},\"status\":{\"stages\":[]}},\"eTag\":\"synlqidybyxczfc\",\"id\":\"aaxdbabphlwrq\",\"name\":\"fkts\",\"type\":\"hsucoc\"}"; + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"strategy\":{\"stages\":[{\"name\":\"kotl\",\"groups\":[{\"name\":\"yhgsy\"}],\"afterStageWaitInSeconds\":1150957892}]},\"managedClusterUpdate\":{\"upgrade\":{\"type\":\"NodeImageOnly\",\"kubernetesVersion\":\"ltdtbnnhad\"},\"nodeImageSelection\":{\"type\":\"Consistent\"}},\"status\":{\"status\":{\"startTime\":\"2020-12-23T13:08:39Z\",\"completedTime\":\"2021-09-01T15:57:06Z\",\"state\":\"Stopping\"},\"stages\":[{\"status\":{},\"name\":\"gxqquezik\",\"groups\":[{},{},{},{}],\"afterStageWaitStatus\":{}},{\"status\":{},\"name\":\"allatmelwuipic\",\"groups\":[{},{},{}],\"afterStageWaitStatus\":{}},{\"status\":{},\"name\":\"v\",\"groups\":[{}],\"afterStageWaitStatus\":{}},{\"status\":{},\"name\":\"y\",\"groups\":[{},{},{}],\"afterStageWaitStatus\":{}}],\"nodeImageSelection\":{\"selectedNodeImageVersions\":[{},{}]}}},\"eTag\":\"ueedndrdvs\",\"id\":\"kwqqtchealmf\",\"name\":\"tdaaygdvwvg\",\"type\":\"iohgwxrtfud\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -59,13 +62,16 @@ public void testStop() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); UpdateRun response = - manager - .updateRuns() - .stop( - "jggmebfsiarbu", - "rcvpnazzmhjrunmp", - "ttdbhrbnl", - "nkxmyskpbhenbtk", - com.azure.core.util.Context.NONE); + manager.updateRuns().stop("mwzn", "abikns", "rgjhxb", "dtlwwrlkd", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("kotl", response.strategy().stages().get(0).name()); + Assertions.assertEquals("yhgsy", response.strategy().stages().get(0).groups().get(0).name()); + Assertions.assertEquals(1150957892, response.strategy().stages().get(0).afterStageWaitInSeconds()); + Assertions + .assertEquals(ManagedClusterUpgradeType.NODE_IMAGE_ONLY, response.managedClusterUpdate().upgrade().type()); + Assertions.assertEquals("ltdtbnnhad", response.managedClusterUpdate().upgrade().kubernetesVersion()); + Assertions + .assertEquals( + NodeImageSelectionType.CONSISTENT, response.managedClusterUpdate().nodeImageSelection().type()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStageStatusTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStageStatusTests.java index d87c5cd07e5c..01e8c0789143 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStageStatusTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStageStatusTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { UpdateStageStatus model = BinaryData .fromString( - "{\"status\":{\"startTime\":\"2021-12-04T15:56:22Z\",\"completedTime\":\"2020-12-23T01:19:24Z\",\"state\":\"Stopped\"},\"name\":\"wpgrjbzno\",\"groups\":[{\"status\":{\"startTime\":\"2021-01-31T18:34:57Z\",\"completedTime\":\"2021-11-14T01:20:47Z\",\"state\":\"Stopping\"},\"name\":\"bnmo\",\"members\":[]},{\"status\":{\"startTime\":\"2021-08-24T13:39:32Z\",\"completedTime\":\"2021-08-24T18:20:56Z\",\"state\":\"Stopped\"},\"name\":\"ljjgpbtoqcjmkl\",\"members\":[]},{\"status\":{\"startTime\":\"2021-11-17T00:12:24Z\",\"completedTime\":\"2021-04-20T08:45:23Z\",\"state\":\"Stopping\"},\"name\":\"yulpkudjkr\",\"members\":[]}],\"afterStageWaitStatus\":{\"status\":{\"startTime\":\"2021-09-13T05:12:15Z\",\"completedTime\":\"2021-02-23T09:32:58Z\",\"state\":\"Failed\"},\"waitDurationInSeconds\":210488856}}") + "{\"status\":{\"startTime\":\"2021-11-07T07:40:57Z\",\"completedTime\":\"2021-04-24T05:01:37Z\",\"state\":\"Stopped\"},\"name\":\"ggi\",\"groups\":[{\"status\":{\"startTime\":\"2021-08-02T21:26:13Z\",\"completedTime\":\"2021-06-24T22:46:45Z\",\"state\":\"Stopping\"},\"name\":\"nspydptkoenkoukn\",\"members\":[{\"status\":{\"startTime\":\"2020-12-28T19:13:15Z\",\"completedTime\":\"2021-08-25T19:52:36Z\",\"state\":\"Skipped\"},\"name\":\"gkpocipazyxoe\",\"clusterResourceId\":\"kgjn\",\"operationId\":\"ucgygevqz\",\"message\":\"yp\"},{\"status\":{\"startTime\":\"2021-10-14T05:08:35Z\",\"completedTime\":\"2021-11-28T09:01:44Z\",\"state\":\"Skipped\"},\"name\":\"j\",\"clusterResourceId\":\"pyd\",\"operationId\":\"yhxdeoejzicwi\",\"message\":\"jttgzf\"},{\"status\":{\"startTime\":\"2021-03-25T08:46:02Z\",\"completedTime\":\"2021-05-30T04:32:56Z\",\"state\":\"Running\"},\"name\":\"deyeamdphagalpbu\",\"clusterResourceId\":\"gipwhonowkg\",\"operationId\":\"wankixzbi\",\"message\":\"eputtmrywnuzoqf\"},{\"status\":{\"startTime\":\"2021-10-11T21:17:46Z\",\"completedTime\":\"2021-11-21T21:02:37Z\",\"state\":\"NotStarted\"},\"name\":\"vyxlwhzlsicohoqq\",\"clusterResourceId\":\"vlryavwhheunmmq\",\"operationId\":\"yxzk\",\"message\":\"ocukoklyax\"}]},{\"status\":{\"startTime\":\"2021-10-22T03:41:48Z\",\"completedTime\":\"2021-02-12T02:33:14Z\",\"state\":\"Running\"},\"name\":\"beypewrmjmw\",\"members\":[{\"status\":{\"startTime\":\"2021-02-06T15:34:06Z\",\"completedTime\":\"2021-10-27T06:34:42Z\",\"state\":\"Stopped\"},\"name\":\"wlrsffrzpwv\",\"clusterResourceId\":\"dqgbiqylihkaetc\",\"operationId\":\"vfcivfsnkymuc\",\"message\":\"hjfbebrjcxe\"},{\"status\":{\"startTime\":\"2021-03-04T14:54:10Z\",\"completedTime\":\"2021-09-07T01:58:14Z\",\"state\":\"Completed\"},\"name\":\"vjrbirphxepcyvah\",\"clusterResourceId\":\"ljkyqxjvuuj\",\"operationId\":\"idokgjlj\",\"message\":\"xgvcl\"},{\"status\":{\"startTime\":\"2021-10-11T10:12:30Z\",\"completedTime\":\"2021-04-14T10:54:43Z\",\"state\":\"Stopping\"},\"name\":\"esz\",\"clusterResourceId\":\"bijhtxfvgxbf\",\"operationId\":\"xnehmpvec\",\"message\":\"odebfqkkrbmpu\"}]},{\"status\":{\"startTime\":\"2021-10-09T22:24:23Z\",\"completedTime\":\"2021-05-25T13:56:26Z\",\"state\":\"Running\"},\"name\":\"bxzpuzycisp\",\"members\":[{\"status\":{\"startTime\":\"2021-06-02T06:32:59Z\",\"completedTime\":\"2021-03-22T11:59:20Z\",\"state\":\"NotStarted\"},\"name\":\"y\",\"clusterResourceId\":\"ibnuqqkpik\",\"operationId\":\"rgvtqag\",\"message\":\"uynhijg\"},{\"status\":{\"startTime\":\"2021-04-23T17:49:38Z\",\"completedTime\":\"2021-11-02T05:09:13Z\",\"state\":\"Skipped\"},\"name\":\"utrc\",\"clusterResourceId\":\"na\",\"operationId\":\"mhjrunmpxttdbhr\",\"message\":\"l\"},{\"status\":{\"startTime\":\"2021-04-13T18:59:18Z\",\"completedTime\":\"2021-10-16T22:37:56Z\",\"state\":\"Failed\"},\"name\":\"henbtkcxywnytn\",\"clusterResourceId\":\"yn\",\"operationId\":\"idybyxczf\",\"message\":\"haaxdbabphl\"},{\"status\":{\"startTime\":\"2021-10-12T16:41:20Z\",\"completedTime\":\"2021-09-07T10:16:41Z\",\"state\":\"Running\"},\"name\":\"sucocmnyyazttbtw\",\"clusterResourceId\":\"qpuedckzywbiex\",\"operationId\":\"eyueaxibxujwb\",\"message\":\"walm\"}]}],\"afterStageWaitStatus\":{\"status\":{\"startTime\":\"2021-10-07T17:56:10Z\",\"completedTime\":\"2021-07-26T23:02:26Z\",\"state\":\"NotStarted\"},\"waitDurationInSeconds\":1101011494}}") .toObject(UpdateStageStatus.class); } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStageTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStageTests.java index 12f255a7fa12..a9380c31af97 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStageTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStageTests.java @@ -16,28 +16,24 @@ public void testDeserialize() throws Exception { UpdateStage model = BinaryData .fromString( - "{\"name\":\"kfthwxmntei\",\"groups\":[{\"name\":\"pvkmijcmmxdcuf\"},{\"name\":\"fsrpymzidnse\"},{\"name\":\"cxtbzsg\"}],\"afterStageWaitInSeconds\":121296393}") + "{\"name\":\"hy\",\"groups\":[{\"name\":\"rpmopjmc\"},{\"name\":\"atuokthfuiu\"}],\"afterStageWaitInSeconds\":1445775245}") .toObject(UpdateStage.class); - Assertions.assertEquals("kfthwxmntei", model.name()); - Assertions.assertEquals("pvkmijcmmxdcuf", model.groups().get(0).name()); - Assertions.assertEquals(121296393, model.afterStageWaitInSeconds()); + Assertions.assertEquals("hy", model.name()); + Assertions.assertEquals("rpmopjmc", model.groups().get(0).name()); + Assertions.assertEquals(1445775245, model.afterStageWaitInSeconds()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { UpdateStage model = new UpdateStage() - .withName("kfthwxmntei") + .withName("hy") .withGroups( - Arrays - .asList( - new UpdateGroup().withName("pvkmijcmmxdcuf"), - new UpdateGroup().withName("fsrpymzidnse"), - new UpdateGroup().withName("cxtbzsg"))) - .withAfterStageWaitInSeconds(121296393); + Arrays.asList(new UpdateGroup().withName("rpmopjmc"), new UpdateGroup().withName("atuokthfuiu"))) + .withAfterStageWaitInSeconds(1445775245); model = BinaryData.fromObject(model).toObject(UpdateStage.class); - Assertions.assertEquals("kfthwxmntei", model.name()); - Assertions.assertEquals("pvkmijcmmxdcuf", model.groups().get(0).name()); - Assertions.assertEquals(121296393, model.afterStageWaitInSeconds()); + Assertions.assertEquals("hy", model.name()); + Assertions.assertEquals("rpmopjmc", model.groups().get(0).name()); + Assertions.assertEquals(1445775245, model.afterStageWaitInSeconds()); } } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStatusTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStatusTests.java index 4716012cd2cc..57c63c3f03e5 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStatusTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UpdateStatusTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { UpdateStatus model = BinaryData .fromString( - "{\"startTime\":\"2020-12-26T05:08:12Z\",\"completedTime\":\"2021-01-23T02:14:07Z\",\"state\":\"Stopping\"}") + "{\"startTime\":\"2021-01-03T07:04:49Z\",\"completedTime\":\"2021-04-12T11:49:32Z\",\"state\":\"Stopping\"}") .toObject(UpdateStatus.class); } diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UserAssignedIdentityTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..e3c96d8a8bb5 --- /dev/null +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/UserAssignedIdentityTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservicefleet.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerservicefleet.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = + BinaryData + .fromString( + "{\"principalId\":\"76b7828f-37cf-466a-9823-c05f180a3472\",\"clientId\":\"ac729feb-61c8-45b4-b1de-5cacf436ee60\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/WaitStatusTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/WaitStatusTests.java index 15506705ac0a..1cec50bf5a55 100644 --- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/WaitStatusTests.java +++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/generated/WaitStatusTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { WaitStatus model = BinaryData .fromString( - "{\"status\":{\"startTime\":\"2021-04-20T10:26:18Z\",\"completedTime\":\"2021-10-12T01:56:34Z\",\"state\":\"Stopped\"},\"waitDurationInSeconds\":1046063438}") + "{\"status\":{\"startTime\":\"2021-04-22T17:58:43Z\",\"completedTime\":\"2021-09-11T06:43:14Z\",\"state\":\"NotStarted\"},\"waitDurationInSeconds\":1045887723}") .toObject(WaitStatus.class); } diff --git a/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md b/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md new file mode 100644 index 000000000000..d1e592dc7498 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md @@ -0,0 +1,21 @@ +# Release History + +## 1.0.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 1.0.0-beta.1 (2023-09-28) + +- Azure AI ContentSafety client library for Java. This package contains Microsoft Azure ContentSafety client library. + +### Features Added +* Text Analysis API: Scans text for sexual content, violence, hate, and self harm with multi-severity levels. +* Image Analysis API: Scans images for sexual content, violence, hate, and self harm with multi-severity levels. +* Text Blocklist Management APIs: The default AI classifiers are sufficient for most content safety needs; however, you might need to screen for terms that are specific to your use case. You can create blocklists of terms to use with the Text API. + diff --git a/sdk/contentsafety/azure-ai-contentsafety/README.md b/sdk/contentsafety/azure-ai-contentsafety/README.md new file mode 100644 index 000000000000..d00981aee946 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/README.md @@ -0,0 +1,288 @@ +# Azure ContentSafety client library for Java + +[Azure AI Content Safety][contentsafety_overview] detects harmful user-generated and AI-generated content in applications and services. Content Safety includes several APIs that allow you to detect material that is harmful: + +* Text Analysis API: Scans text for sexual content, violence, hate, and self harm with multi-severity levels. +* Image Analysis API: Scans images for sexual content, violence, hate, and self harm with multi-severity levels. +* Text Blocklist Management APIs: The default AI classifiers are sufficient for most content safety needs; however, you might need to screen for terms that are specific to your use case. You can create blocklists of terms to use with the Text API. + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] +- [Product documentation][product_documentation] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- You need an [Azure subscription][azure_sub] to use this package. +- An existing [Azure AI Content Safety][contentsafety_overview] instance. + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-ai-contentsafety;current}) +```xml + + com.azure + azure-ai-contentsafety + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Authenticate the client + +#### Get the endpoint +You can find the endpoint for your Azure AI Content Safety service resource using the [Azure Portal][azure_portal] or [Azure CLI][azure_cli_endpoint_lookup]: + +```bash +# Get the endpoint for the Azure AI Content Safety service resource +az cognitiveservices account show --name "" --resource-group "" --query "properties.endpoint" +``` + +#### Get the API key + +The API key can be found in the [Azure Portal][azure_portal] or by running the following [Azure CLI][azure_cli_key_lookup] command: + +```bash +az cognitiveservices account keys list --name "" --resource-group "" +``` +#### Create a ContentSafetyClient with KeyCredential +```java com.azure.ai.contentsafety.createClient +String endpoint = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_ENDPOINT"); +String key = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_KEY"); + +ContentSafetyClient contentSafetyClient = new ContentSafetyClientBuilder() + .credential(new KeyCredential(key)) + .endpoint(endpoint).buildClient(); +``` + +## Key concepts +### Harm categories + +Content Safety recognizes four distinct categories of objectionable content. + +|Category |Description | +|---------|---------| +|Hate |Hate refers to any content that attacks or uses pejorative or discriminatory language in reference to a person or identity group based on certain differentiating attributes of that group. This includes but is not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, religion, immigration status, ability status, personal appearance, and body size.| +|Sexual |Sexual describes content related to anatomical organs and genitals, romantic relationships, acts portrayed in erotic or affectionate terms, pregnancy, physical sexual acts—including those acts portrayed as an assault or a forced sexual violent act against one’s will—, prostitution, pornography, and abuse.| +|Violence |Violence describes content related to physical actions intended to hurt, injure, damage, or kill someone or something. It also includes weapons, guns and related entities, such as manufacturers, associations, legislation, and similar.| +|Self-harm |Self-harm describes content related to physical actions intended to purposely hurt, injure, or damage one’s body or kill oneself.| + +Classification can be multi-labeled. For example, when a text sample goes through the text moderation model, it could be classified as both Sexual content and Violence. + +### Severity levels + +Every harm category the service applies also comes with a severity level rating. The severity level is meant to indicate the severity of the consequences of showing the flagged content. + +|Severity |Label | +|---------|---------| +|0 |Safe| +|2 |Low| +|4 |Medium| +|6 |High| + +### Text blocklist management + +Following operations are supported to manage your text blocklist: + +* Create or modify a blocklist +* List all blocklists +* Get a blocklist by blocklistName +* Add blockItems to a blocklist +* Remove blockItems from a blocklist +* List all blockItems in a blocklist by blocklistName +* Get a blockItem in a blocklist by blockItemId and blocklistName +* Delete a blocklist and all of its blockItems + +You can set the blocklists you want to use when analyze text, then you can get blocklist match result from returned response. + +## Examples +The following section provides several code snippets covering some of the most common Content Safety service tasks, including: + +* [Analyze text](#analyze-text) +* [Analyze image](#analyze-image) +* [Manage text blocklist](#manage-text-blocklist) + +### Analyze text + +#### Analyze text without blocklists +```java com.azure.ai.contentsafety.analyzetext +String endpoint = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_ENDPOINT"); +String key = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_KEY"); +ContentSafetyClient contentSafetyClient = new ContentSafetyClientBuilder() + .credential(new KeyCredential(key)) + .endpoint(endpoint).buildClient(); + +AnalyzeTextResult response = contentSafetyClient.analyzeText(new AnalyzeTextOptions("This is text example")); + +System.out.println("Hate severity: " + response.getHateResult().getSeverity()); +System.out.println("SelfHarm severity: " + response.getSelfHarmResult().getSeverity()); +System.out.println("Sexual severity: " + response.getSexualResult().getSeverity()); +System.out.println("Violence severity: " + response.getViolenceResult().getSeverity()); +``` + +#### Analyze text with blocklists +```java com.azure.ai.contentsafety.analyzetextwithblocklist +// After you edit your blocklist, it usually takes effect in 5 minutes, please wait some time before analyzing with blocklist after editing. +AnalyzeTextOptions request = new AnalyzeTextOptions("I h*te you and I want to k*ll you"); +request.getBlocklistNames().add(blocklistName); +request.setBreakByBlocklists(true); + +AnalyzeTextResult analyzeTextResult; +try { + analyzeTextResult = contentSafetyClient.analyzeText(request); +} catch (HttpResponseException ex) { + System.out.println("Analyze text failed.\nStatus code: " + ex.getResponse().getStatusCode() + ", Error message: " + ex.getMessage()); + throw ex; +} + +if (analyzeTextResult.getBlocklistsMatchResults() != null) { + System.out.println("\nBlocklist match result:"); + for (TextBlocklistMatchResult matchResult : analyzeTextResult.getBlocklistsMatchResults()) { + System.out.println("Blockitem was hit in text: Offset: " + matchResult.getOffset() + ", Length: " + matchResult.getLength()); + System.out.println("BlocklistName: " + matchResult.getBlocklistName() + ", BlockItemId: " + matchResult.getBlockItemId() + ", BlockItemText: " + matchResult.getBlockItemText()); + } +} +``` + +### Analyze image +```java com.azure.ai.contentsafety.analyzeimage +String endpoint = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_ENDPOINT"); +String key = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_KEY"); + +ContentSafetyClient contentSafetyClient = new ContentSafetyClientBuilder() + .credential(new KeyCredential(key)) + .endpoint(endpoint).buildClient(); + +ImageData image = new ImageData(); +String cwd = System.getProperty("user.dir"); +String source = "/src/samples/resources/image.jpg"; +image.setContent(Files.readAllBytes(Paths.get(cwd, source))); + +AnalyzeImageResult response = + contentSafetyClient.analyzeImage(new AnalyzeImageOptions(image)); + +System.out.println("Hate severity: " + response.getHateResult().getSeverity()); +System.out.println("SelfHarm severity: " + response.getSelfHarmResult().getSeverity()); +System.out.println("Sexual severity: " + response.getSexualResult().getSeverity()); +System.out.println("Violence severity: " + response.getViolenceResult().getSeverity()); +``` + +### Manage text blocklist + +#### Create or update text blocklist +```java com.azure.ai.contentsafety.createtextblocklist +String blocklistName = "TestBlocklist"; +Map description = new HashMap<>(); +description.put("description", "Test Blocklist"); +BinaryData resource = BinaryData.fromObject(description); +RequestOptions requestOptions = new RequestOptions(); +Response response = + contentSafetyClient.createOrUpdateTextBlocklistWithResponse(blocklistName, resource, requestOptions); +if (response.getStatusCode() == 201) { + System.out.println("\nBlocklist " + blocklistName + " created."); +} else if (response.getStatusCode() == 200) { + System.out.println("\nBlocklist " + blocklistName + " updated."); +} +``` +#### Add blockItems +```java com.azure.ai.contentsafety.addblockitems +String blockItemText1 = "k*ll"; +String blockItemText2 = "h*te"; +List blockItems = Arrays.asList(new TextBlockItemInfo(blockItemText1).setDescription("Kill word"), + new TextBlockItemInfo(blockItemText2).setDescription("Hate word")); +AddBlockItemsResult addedBlockItems = contentSafetyClient.addBlockItems(blocklistName, new AddBlockItemsOptions(blockItems)); +if (addedBlockItems != null && addedBlockItems.getValue() != null) { + System.out.println("\nBlockItems added:"); + for (TextBlockItem addedBlockItem : addedBlockItems.getValue()) { + System.out.println("BlockItemId: " + addedBlockItem.getBlockItemId() + ", Text: " + addedBlockItem.getText() + ", Description: " + addedBlockItem.getDescription()); + } +} +``` +#### List text blocklists +```java com.azure.ai.contentsafety.listtextblocklists +PagedIterable allTextBlocklists = contentSafetyClient.listTextBlocklists(); +System.out.println("\nList Blocklist:"); +for (TextBlocklist blocklist : allTextBlocklists) { + System.out.println("Blocklist: " + blocklist.getBlocklistName() + ", Description: " + blocklist.getDescription()); +} +``` +#### Get text blocklist +```java com.azure.ai.contentsafety.gettextblocklist +TextBlocklist getBlocklist = contentSafetyClient.getTextBlocklist(blocklistName); +if (getBlocklist != null) { + System.out.println("\nGet blocklist:"); + System.out.println("BlocklistName: " + getBlocklist.getBlocklistName() + ", Description: " + getBlocklist.getDescription()); +} +``` +#### List blockItems +``` java com.azure.ai.contentsafety.listtextblocklistitems +PagedIterable allBlockitems = contentSafetyClient.listTextBlocklistItems(blocklistName); +System.out.println("\nList BlockItems:"); +for (TextBlockItem blocklistItem : allBlockitems) { + System.out.println("BlockItemId: " + blocklistItem.getBlockItemId() + ", Text: " + blocklistItem.getText() + ", Description: " + blocklistItem.getDescription()); +} +``` +#### Get blockItem +```java com.azure.ai.contentsafety.gettextblocklistitem +String getBlockItemId = addedBlockItems.getValue().get(0).getBlockItemId(); +TextBlockItem getBlockItem = contentSafetyClient.getTextBlocklistItem(blocklistName, getBlockItemId); +System.out.println("\nGet BlockItem:"); +System.out.println("BlockItemId: " + getBlockItem.getBlockItemId() + ", Text: " + getBlockItem.getText() + ", Description: " + getBlockItem.getDescription()); +``` +#### Remove blockItems +```java com.azure.ai.contentsafety.removeblockitems +String removeBlockItemId = addedBlockItems.getValue().get(0).getBlockItemId(); +List removeBlockItemIds = new ArrayList<>(); +removeBlockItemIds.add(removeBlockItemId); +contentSafetyClient.removeBlockItems(blocklistName, new RemoveBlockItemsOptions(removeBlockItemIds)); +``` +#### Delete text blocklist +```java com.azure.ai.contentsafety.deletetextblocklist +contentSafetyClient.deleteTextBlocklist(blocklistName); +``` +## Troubleshooting +### General + +Azure AI Content Safety client library will raise exceptions defined in [Azure Core][azure_core_exception]. Error codes are defined as below: + +|Error Code |Possible reasons |Suggestions| +|-----------|-------------------|-----------| +|InvalidRequestBody |One or more fields in the request body do not match the API definition. |1. Check the API version you specified in the API call.
2. Check the corresponding API definition for the API version you selected.| +|InvalidResourceName |The resource name you specified in the URL does not meet the requirements, like the blocklist name, blocklist term ID, etc. |1. Check the API version you specified in the API call.
2. Check whether the given name has invalid characters according to the API definition.| +|ResourceNotFound |The resource you specified in the URL may not exist, like the blocklist name. |1. Check the API version you specified in the API call.
2. Double check the existence of the resource specified in the URL.| +|InternalError |Some unexpected situations on the server side have been triggered. |1. You may want to retry a few times after a small period and see it the issue happens again.
2. Contact Azure Support if this issue persists.| +|ServerBusy |The server side cannot process the request temporarily. |1. You may want to retry a few times after a small period and see it the issue happens again.
2.Contact Azure Support if this issue persists.| +|TooManyRequests |The current RPS has exceeded the quota for your current SKU. |1. Check the pricing table to understand the RPS quota.
2.Contact Azure Support if you need more QPS.| + +## Next steps +### Additional documentation + +For more extensive documentation on Azure Content Safety, see the [Azure AI Content Safety][contentsafety_overview] on docs.microsoft.com. + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[product_documentation]: https://aka.ms/acs-doc +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[contentsafety_overview]: https://aka.ms/acs-doc +[azure_portal]: https://ms.portal.azure.com/ +[azure_cli_endpoint_lookup]: https://docs.microsoft.com/cli/azure/cognitiveservices/account?view=azure-cli-latest#az-cognitiveservices-account-show +[azure_cli_key_lookup]: https://docs.microsoft.com/cli/azure/cognitiveservices/account/keys?view=azure-cli-latest#az-cognitiveservices-account-keys-list + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcontentsafety%2Fazure-ai-contentsafety%2FREADME.png) diff --git a/sdk/contentsafety/azure-ai-contentsafety/assets.json b/sdk/contentsafety/azure-ai-contentsafety/assets.json new file mode 100644 index 000000000000..c0de92f7d8b6 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo" : "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath" : "java", + "TagPrefix" : "java/contentsafety/azure-ai-contentsafety", + "Tag" : "java/contentsafety/azure-ai-contentsafety_10dc4f5dac" +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/pom.xml b/sdk/contentsafety/azure-ai-contentsafety/pom.xml new file mode 100644 index 000000000000..ad574848cd62 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/pom.xml @@ -0,0 +1,96 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-ai-contentsafety + 1.0.0-beta.2 + jar + + Microsoft Azure SDK for ContentSafety + This package contains Microsoft Azure ContentSafety client library. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.43.0 + + + com.azure + azure-core-http-netty + 1.13.7 + + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + org.mockito + mockito-core + 4.11.0 + test + + + com.azure + azure-core-test + 1.20.0 + test + + + com.azure + azure-identity + 1.10.1 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + + + diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyAsyncClient.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyAsyncClient.java new file mode 100644 index 000000000000..4b87a0ecdca4 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyAsyncClient.java @@ -0,0 +1,735 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.ai.contentsafety.implementation.ContentSafetyClientImpl; +import com.azure.ai.contentsafety.models.AddBlockItemsOptions; +import com.azure.ai.contentsafety.models.AddBlockItemsResult; +import com.azure.ai.contentsafety.models.AnalyzeImageOptions; +import com.azure.ai.contentsafety.models.AnalyzeImageResult; +import com.azure.ai.contentsafety.models.AnalyzeTextOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextResult; +import com.azure.ai.contentsafety.models.RemoveBlockItemsOptions; +import com.azure.ai.contentsafety.models.TextBlockItem; +import com.azure.ai.contentsafety.models.TextBlocklist; +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.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the asynchronous ContentSafetyClient type. */ +@ServiceClient(builder = ContentSafetyClientBuilder.class, isAsync = true) +public final class ContentSafetyAsyncClient { + @Generated private final ContentSafetyClientImpl serviceClient; + + /** + * Initializes an instance of ContentSafetyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ContentSafetyAsyncClient(ContentSafetyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Analyze Text + * + *

A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     text: String (Required)
+     *     categories (Optional): [
+     *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
+     *     ]
+     *     blocklistNames (Optional): [
+     *         String (Optional)
+     *     ]
+     *     breakByBlocklists: Boolean (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistsMatchResults (Optional): [
+     *          (Optional){
+     *             blocklistName: String (Required)
+     *             blockItemId: String (Required)
+     *             blockItemText: String (Required)
+     *             offset: int (Required)
+     *             length: int (Required)
+     *         }
+     *     ]
+     *     hateResult (Optional): {
+     *         category: String(Hate/SelfHarm/Sexual/Violence) (Required)
+     *         severity: int (Required)
+     *     }
+     *     selfHarmResult (Optional): (recursive schema, see selfHarmResult above)
+     *     sexualResult (Optional): (recursive schema, see sexualResult above)
+     *     violenceResult (Optional): (recursive schema, see violenceResult above)
+     * }
+     * }
+ * + * @param body The request of text analysis. + * @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 the analysis response of the text along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeTextWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.analyzeTextWithResponseAsync(body, requestOptions); + } + + /** + * Analyze Image + * + *

A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     image (Required): {
+     *         content: byte[] (Optional)
+     *         blobUrl: String (Optional)
+     *     }
+     *     categories (Optional): [
+     *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     hateResult (Optional): {
+     *         category: String(Hate/SelfHarm/Sexual/Violence) (Required)
+     *         severity: int (Required)
+     *     }
+     *     selfHarmResult (Optional): (recursive schema, see selfHarmResult above)
+     *     sexualResult (Optional): (recursive schema, see sexualResult above)
+     *     violenceResult (Optional): (recursive schema, see violenceResult above)
+     * }
+     * }
+ * + * @param body The analysis request of the image. + * @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 the analysis response of the image along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeImageWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.analyzeImageWithResponseAsync(body, requestOptions); + } + + /** + * Get Text Blocklist By blocklistName + * + *

Returns text blocklist details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 text Blocklist along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextBlocklistWithResponse( + String blocklistName, RequestOptions requestOptions) { + return this.serviceClient.getTextBlocklistWithResponseAsync(blocklistName, requestOptions); + } + + /** + * Create Or Update Text Blocklist + * + *

Updates a text blocklist, if blocklistName does not exist, create a new blocklist. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param resource The resource instance. + * @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 text Blocklist along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTextBlocklistWithResponse( + String blocklistName, BinaryData resource, RequestOptions requestOptions) { + // Convenience API is not generated, as operation 'createOrUpdateTextBlocklist' is + // 'application/merge-patch+json' + return this.serviceClient.createOrUpdateTextBlocklistWithResponseAsync(blocklistName, resource, requestOptions); + } + + /** + * Delete Text Blocklist By blocklistName + * + *

Deletes a text blocklist. + * + * @param blocklistName Text blocklist name. + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteTextBlocklistWithResponse(String blocklistName, RequestOptions requestOptions) { + return this.serviceClient.deleteTextBlocklistWithResponseAsync(blocklistName, requestOptions); + } + + /** + * Get All Text Blocklists + * + *

Get all text blocklists details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @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 all text blocklists details as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTextBlocklists(RequestOptions requestOptions) { + return this.serviceClient.listTextBlocklistsAsync(requestOptions); + } + + /** + * Add BlockItems To Text Blocklist + * + *

Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blockItems (Required): [
+     *          (Required){
+     *             description: String (Optional)
+     *             text: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Optional): [
+     *          (Optional){
+     *             blockItemId: String (Required)
+     *             description: String (Optional)
+     *             text: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param addBlockItemsOptions The request of adding blockItems to text blocklist. + * @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 the response of adding blockItems to text blocklist along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addBlockItemsWithResponse( + String blocklistName, BinaryData addBlockItemsOptions, RequestOptions requestOptions) { + return this.serviceClient.addBlockItemsWithResponseAsync(blocklistName, addBlockItemsOptions, requestOptions); + } + + /** + * Remove BlockItems From Text Blocklist + * + *

Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blockItemIds (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param removeBlockItemsOptions The request of removing blockItems from text blocklist. + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeBlockItemsWithResponse( + String blocklistName, BinaryData removeBlockItemsOptions, RequestOptions requestOptions) { + return this.serviceClient.removeBlockItemsWithResponseAsync( + blocklistName, removeBlockItemsOptions, requestOptions); + } + + /** + * Get BlockItem By blocklistName And blockItemId + * + *

Get blockItem By blockItemId from a text blocklist. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param blockItemId Block Item Id. It will be uuid. + * @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 blockItem By blockItemId from a text blocklist along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextBlocklistItemWithResponse( + String blocklistName, String blockItemId, RequestOptions requestOptions) { + return this.serviceClient.getTextBlocklistItemWithResponseAsync(blocklistName, blockItemId, requestOptions); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 all blockItems in a text blocklist as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTextBlocklistItems(String blocklistName, RequestOptions requestOptions) { + return this.serviceClient.listTextBlocklistItemsAsync(blocklistName, requestOptions); + } + + /** + * Analyze Text + * + *

A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + * @param body The request of text analysis. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the analysis response of the text on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono analyzeText(AnalyzeTextOptions body) { + // Generated convenience method for analyzeTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return analyzeTextWithResponse(BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AnalyzeTextResult.class)); + } + + /** + * Analyze Image + * + *

A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + * @param body The analysis request of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the analysis response of the image on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono analyzeImage(AnalyzeImageOptions body) { + // Generated convenience method for analyzeImageWithResponse + RequestOptions requestOptions = new RequestOptions(); + return analyzeImageWithResponse(BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AnalyzeImageResult.class)); + } + + /** + * Get Text Blocklist By blocklistName + * + *

Returns text blocklist details. + * + * @param blocklistName Text blocklist name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return text Blocklist on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTextBlocklist(String blocklistName) { + // Generated convenience method for getTextBlocklistWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextBlocklistWithResponse(blocklistName, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TextBlocklist.class)); + } + + /** + * Delete Text Blocklist By blocklistName + * + *

Deletes a text blocklist. + * + * @param blocklistName Text blocklist name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteTextBlocklist(String blocklistName) { + // Generated convenience method for deleteTextBlocklistWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteTextBlocklistWithResponse(blocklistName, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Get All Text Blocklists + * + *

Get all text blocklists details. + * + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all text blocklists details as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTextBlocklists() { + // Generated convenience method for listTextBlocklists + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listTextBlocklists(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( + TextBlocklist.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), + null)); + }); + } + + /** + * Add BlockItems To Text Blocklist + * + *

Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request. + * + * @param blocklistName Text blocklist name. + * @param addBlockItemsOptions The request of adding blockItems to text blocklist. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of adding blockItems to text blocklist on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono addBlockItems(String blocklistName, AddBlockItemsOptions addBlockItemsOptions) { + // Generated convenience method for addBlockItemsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return addBlockItemsWithResponse(blocklistName, BinaryData.fromObject(addBlockItemsOptions), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AddBlockItemsResult.class)); + } + + /** + * Remove BlockItems From Text Blocklist + * + *

Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. + * + * @param blocklistName Text blocklist name. + * @param removeBlockItemsOptions The request of removing blockItems from text blocklist. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono removeBlockItems(String blocklistName, RemoveBlockItemsOptions removeBlockItemsOptions) { + // Generated convenience method for removeBlockItemsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return removeBlockItemsWithResponse( + blocklistName, BinaryData.fromObject(removeBlockItemsOptions), requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * Get BlockItem By blocklistName And blockItemId + * + *

Get blockItem By blockItemId from a text blocklist. + * + * @param blocklistName Text blocklist name. + * @param blockItemId Block Item Id. It will be uuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return blockItem By blockItemId from a text blocklist on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTextBlocklistItem(String blocklistName, String blockItemId) { + // Generated convenience method for getTextBlocklistItemWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextBlocklistItemWithResponse(blocklistName, blockItemId, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TextBlockItem.class)); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + * @param blocklistName Text blocklist name. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all blockItems in a text blocklist as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTextBlocklistItems(String blocklistName, Integer top, Integer skip) { + // Generated convenience method for listTextBlocklistItems + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + PagedFlux pagedFluxResponse = listTextBlocklistItems(blocklistName, 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( + TextBlockItem.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), + null)); + }); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + * @param blocklistName Text blocklist name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all blockItems in a text blocklist as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTextBlocklistItems(String blocklistName) { + // Generated convenience method for listTextBlocklistItems + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listTextBlocklistItems(blocklistName, 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( + TextBlockItem.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), + null)); + }); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClient.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClient.java new file mode 100644 index 000000000000..7924302049d3 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClient.java @@ -0,0 +1,660 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.ai.contentsafety.implementation.ContentSafetyClientImpl; +import com.azure.ai.contentsafety.models.AddBlockItemsOptions; +import com.azure.ai.contentsafety.models.AddBlockItemsResult; +import com.azure.ai.contentsafety.models.AnalyzeImageOptions; +import com.azure.ai.contentsafety.models.AnalyzeImageResult; +import com.azure.ai.contentsafety.models.AnalyzeTextOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextResult; +import com.azure.ai.contentsafety.models.RemoveBlockItemsOptions; +import com.azure.ai.contentsafety.models.TextBlockItem; +import com.azure.ai.contentsafety.models.TextBlocklist; +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.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** Initializes a new instance of the synchronous ContentSafetyClient type. */ +@ServiceClient(builder = ContentSafetyClientBuilder.class) +public final class ContentSafetyClient { + @Generated private final ContentSafetyClientImpl serviceClient; + + /** + * Initializes an instance of ContentSafetyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ContentSafetyClient(ContentSafetyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Analyze Text + * + *

A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     text: String (Required)
+     *     categories (Optional): [
+     *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
+     *     ]
+     *     blocklistNames (Optional): [
+     *         String (Optional)
+     *     ]
+     *     breakByBlocklists: Boolean (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistsMatchResults (Optional): [
+     *          (Optional){
+     *             blocklistName: String (Required)
+     *             blockItemId: String (Required)
+     *             blockItemText: String (Required)
+     *             offset: int (Required)
+     *             length: int (Required)
+     *         }
+     *     ]
+     *     hateResult (Optional): {
+     *         category: String(Hate/SelfHarm/Sexual/Violence) (Required)
+     *         severity: int (Required)
+     *     }
+     *     selfHarmResult (Optional): (recursive schema, see selfHarmResult above)
+     *     sexualResult (Optional): (recursive schema, see sexualResult above)
+     *     violenceResult (Optional): (recursive schema, see violenceResult above)
+     * }
+     * }
+ * + * @param body The request of text analysis. + * @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 the analysis response of the text along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response analyzeTextWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.analyzeTextWithResponse(body, requestOptions); + } + + /** + * Analyze Image + * + *

A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     image (Required): {
+     *         content: byte[] (Optional)
+     *         blobUrl: String (Optional)
+     *     }
+     *     categories (Optional): [
+     *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     hateResult (Optional): {
+     *         category: String(Hate/SelfHarm/Sexual/Violence) (Required)
+     *         severity: int (Required)
+     *     }
+     *     selfHarmResult (Optional): (recursive schema, see selfHarmResult above)
+     *     sexualResult (Optional): (recursive schema, see sexualResult above)
+     *     violenceResult (Optional): (recursive schema, see violenceResult above)
+     * }
+     * }
+ * + * @param body The analysis request of the image. + * @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 the analysis response of the image along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response analyzeImageWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.analyzeImageWithResponse(body, requestOptions); + } + + /** + * Get Text Blocklist By blocklistName + * + *

Returns text blocklist details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 text Blocklist along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextBlocklistWithResponse(String blocklistName, RequestOptions requestOptions) { + return this.serviceClient.getTextBlocklistWithResponse(blocklistName, requestOptions); + } + + /** + * Create Or Update Text Blocklist + * + *

Updates a text blocklist, if blocklistName does not exist, create a new blocklist. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param resource The resource instance. + * @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 text Blocklist along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTextBlocklistWithResponse( + String blocklistName, BinaryData resource, RequestOptions requestOptions) { + // Convenience API is not generated, as operation 'createOrUpdateTextBlocklist' is + // 'application/merge-patch+json' + return this.serviceClient.createOrUpdateTextBlocklistWithResponse(blocklistName, resource, requestOptions); + } + + /** + * Delete Text Blocklist By blocklistName + * + *

Deletes a text blocklist. + * + * @param blocklistName Text blocklist name. + * @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 the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteTextBlocklistWithResponse(String blocklistName, RequestOptions requestOptions) { + return this.serviceClient.deleteTextBlocklistWithResponse(blocklistName, requestOptions); + } + + /** + * Get All Text Blocklists + * + *

Get all text blocklists details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @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 all text blocklists details as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTextBlocklists(RequestOptions requestOptions) { + return this.serviceClient.listTextBlocklists(requestOptions); + } + + /** + * Add BlockItems To Text Blocklist + * + *

Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blockItems (Required): [
+     *          (Required){
+     *             description: String (Optional)
+     *             text: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Optional): [
+     *          (Optional){
+     *             blockItemId: String (Required)
+     *             description: String (Optional)
+     *             text: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param addBlockItemsOptions The request of adding blockItems to text blocklist. + * @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 the response of adding blockItems to text blocklist along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addBlockItemsWithResponse( + String blocklistName, BinaryData addBlockItemsOptions, RequestOptions requestOptions) { + return this.serviceClient.addBlockItemsWithResponse(blocklistName, addBlockItemsOptions, requestOptions); + } + + /** + * Remove BlockItems From Text Blocklist + * + *

Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blockItemIds (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param removeBlockItemsOptions The request of removing blockItems from text blocklist. + * @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 the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeBlockItemsWithResponse( + String blocklistName, BinaryData removeBlockItemsOptions, RequestOptions requestOptions) { + return this.serviceClient.removeBlockItemsWithResponse(blocklistName, removeBlockItemsOptions, requestOptions); + } + + /** + * Get BlockItem By blocklistName And blockItemId + * + *

Get blockItem By blockItemId from a text blocklist. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param blockItemId Block Item Id. It will be uuid. + * @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 blockItem By blockItemId from a text blocklist along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextBlocklistItemWithResponse( + String blocklistName, String blockItemId, RequestOptions requestOptions) { + return this.serviceClient.getTextBlocklistItemWithResponse(blocklistName, blockItemId, requestOptions); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 all blockItems in a text blocklist as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTextBlocklistItems(String blocklistName, RequestOptions requestOptions) { + return this.serviceClient.listTextBlocklistItems(blocklistName, requestOptions); + } + + /** + * Analyze Text + * + *

A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + * @param body The request of text analysis. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the analysis response of the text. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AnalyzeTextResult analyzeText(AnalyzeTextOptions body) { + // Generated convenience method for analyzeTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return analyzeTextWithResponse(BinaryData.fromObject(body), requestOptions) + .getValue() + .toObject(AnalyzeTextResult.class); + } + + /** + * Analyze Image + * + *

A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + * @param body The analysis request of the image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the analysis response of the image. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AnalyzeImageResult analyzeImage(AnalyzeImageOptions body) { + // Generated convenience method for analyzeImageWithResponse + RequestOptions requestOptions = new RequestOptions(); + return analyzeImageWithResponse(BinaryData.fromObject(body), requestOptions) + .getValue() + .toObject(AnalyzeImageResult.class); + } + + /** + * Get Text Blocklist By blocklistName + * + *

Returns text blocklist details. + * + * @param blocklistName Text blocklist name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return text Blocklist. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TextBlocklist getTextBlocklist(String blocklistName) { + // Generated convenience method for getTextBlocklistWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextBlocklistWithResponse(blocklistName, requestOptions).getValue().toObject(TextBlocklist.class); + } + + /** + * Delete Text Blocklist By blocklistName + * + *

Deletes a text blocklist. + * + * @param blocklistName Text blocklist name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteTextBlocklist(String blocklistName) { + // Generated convenience method for deleteTextBlocklistWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteTextBlocklistWithResponse(blocklistName, requestOptions).getValue(); + } + + /** + * Get All Text Blocklists + * + *

Get all text blocklists details. + * + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all text blocklists details as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTextBlocklists() { + // Generated convenience method for listTextBlocklists + RequestOptions requestOptions = new RequestOptions(); + return serviceClient + .listTextBlocklists(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(TextBlocklist.class)); + } + + /** + * Add BlockItems To Text Blocklist + * + *

Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request. + * + * @param blocklistName Text blocklist name. + * @param addBlockItemsOptions The request of adding blockItems to text blocklist. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of adding blockItems to text blocklist. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AddBlockItemsResult addBlockItems(String blocklistName, AddBlockItemsOptions addBlockItemsOptions) { + // Generated convenience method for addBlockItemsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return addBlockItemsWithResponse(blocklistName, BinaryData.fromObject(addBlockItemsOptions), requestOptions) + .getValue() + .toObject(AddBlockItemsResult.class); + } + + /** + * Remove BlockItems From Text Blocklist + * + *

Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. + * + * @param blocklistName Text blocklist name. + * @param removeBlockItemsOptions The request of removing blockItems from text blocklist. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void removeBlockItems(String blocklistName, RemoveBlockItemsOptions removeBlockItemsOptions) { + // Generated convenience method for removeBlockItemsWithResponse + RequestOptions requestOptions = new RequestOptions(); + removeBlockItemsWithResponse(blocklistName, BinaryData.fromObject(removeBlockItemsOptions), requestOptions) + .getValue(); + } + + /** + * Get BlockItem By blocklistName And blockItemId + * + *

Get blockItem By blockItemId from a text blocklist. + * + * @param blocklistName Text blocklist name. + * @param blockItemId Block Item Id. It will be uuid. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return blockItem By blockItemId from a text blocklist. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TextBlockItem getTextBlocklistItem(String blocklistName, String blockItemId) { + // Generated convenience method for getTextBlocklistItemWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextBlocklistItemWithResponse(blocklistName, blockItemId, requestOptions) + .getValue() + .toObject(TextBlockItem.class); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + * @param blocklistName Text blocklist name. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all blockItems in a text blocklist as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTextBlocklistItems(String blocklistName, Integer top, Integer skip) { + // Generated convenience method for listTextBlocklistItems + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + return serviceClient + .listTextBlocklistItems(blocklistName, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(TextBlockItem.class)); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + * @param blocklistName Text blocklist name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all blockItems in a text blocklist as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTextBlocklistItems(String blocklistName) { + // Generated convenience method for listTextBlocklistItems + RequestOptions requestOptions = new RequestOptions(); + return serviceClient + .listTextBlocklistItems(blocklistName, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(TextBlockItem.class)); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClientBuilder.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClientBuilder.java new file mode 100644 index 000000000000..a73fa667ef78 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyClientBuilder.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.ai.contentsafety.implementation.ContentSafetyClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.KeyCredentialTrait; +import com.azure.core.credential.KeyCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +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.AddHeadersPolicy; +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.HttpPolicyProviders; +import com.azure.core.http.policy.KeyCredentialPolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A builder for creating a new instance of the ContentSafetyClient type. */ +@ServiceClientBuilder(serviceClients = {ContentSafetyClient.class, ContentSafetyAsyncClient.class}) +public final class ContentSafetyClientBuilder + implements HttpTrait, + ConfigurationTrait, + KeyCredentialTrait, + EndpointTrait { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-ai-contentsafety.properties"); + + @Generated private final List pipelinePolicies; + + /** Create an instance of the ContentSafetyClientBuilder. */ + @Generated + public ContentSafetyClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated private HttpPipeline pipeline; + + /** {@inheritDoc}. */ + @Generated + @Override + public ContentSafetyClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** {@inheritDoc}. */ + @Generated + @Override + public ContentSafetyClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated private HttpLogOptions httpLogOptions; + + /** {@inheritDoc}. */ + @Generated + @Override + public ContentSafetyClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated private ClientOptions clientOptions; + + /** {@inheritDoc}. */ + @Generated + @Override + public ContentSafetyClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated private RetryOptions retryOptions; + + /** {@inheritDoc}. */ + @Generated + @Override + public ContentSafetyClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** {@inheritDoc}. */ + @Generated + @Override + public ContentSafetyClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated private Configuration configuration; + + /** {@inheritDoc}. */ + @Generated + @Override + public ContentSafetyClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The KeyCredential used for authentication. + */ + @Generated private KeyCredential keyCredential; + + /** {@inheritDoc}. */ + @Generated + @Override + public ContentSafetyClientBuilder credential(KeyCredential keyCredential) { + this.keyCredential = keyCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated private String endpoint; + + /** {@inheritDoc}. */ + @Generated + @Override + public ContentSafetyClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated private ContentSafetyServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the ContentSafetyClientBuilder. + */ + @Generated + public ContentSafetyClientBuilder serviceVersion(ContentSafetyServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ContentSafetyClientBuilder. + */ + @Generated + public ContentSafetyClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ContentSafetyClientImpl with the provided parameters. + * + * @return an instance of ContentSafetyClientImpl. + */ + @Generated + private ContentSafetyClientImpl buildInnerClient() { + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ContentSafetyServiceVersion localServiceVersion = + (serviceVersion != null) ? serviceVersion : ContentSafetyServiceVersion.getLatest(); + ContentSafetyClientImpl client = + new ContentSafetyClientImpl( + localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, + localServiceVersion); + return client; + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = new HttpHeaders(); + localClientOptions + .getHeaders() + .forEach(header -> headers.set(HttpHeaderName.fromString(header.getName()), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (keyCredential != null) { + policies.add(new KeyCredentialPolicy("Ocp-Apim-Subscription-Key", keyCredential)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ContentSafetyAsyncClient class. + * + * @return an instance of ContentSafetyAsyncClient. + */ + @Generated + public ContentSafetyAsyncClient buildAsyncClient() { + return new ContentSafetyAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ContentSafetyClient class. + * + * @return an instance of ContentSafetyClient. + */ + @Generated + public ContentSafetyClient buildClient() { + return new ContentSafetyClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ContentSafetyClientBuilder.class); +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyServiceVersion.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyServiceVersion.java new file mode 100644 index 000000000000..448861f6dab2 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentSafetyServiceVersion.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.core.util.ServiceVersion; + +/** Service version of ContentSafetyClient. */ +public enum ContentSafetyServiceVersion implements ServiceVersion { + /** Enum value 2023-04-30-preview. */ + V2023_04_30_PREVIEW("2023-04-30-preview"); + + private final String version; + + ContentSafetyServiceVersion(String version) { + this.version = version; + } + + /** {@inheritDoc} */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ContentSafetyServiceVersion}. + */ + public static ContentSafetyServiceVersion getLatest() { + return V2023_04_30_PREVIEW; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentSafetyClientImpl.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentSafetyClientImpl.java new file mode 100644 index 000000000000..e8de94873250 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentSafetyClientImpl.java @@ -0,0 +1,1957 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.implementation; + +import com.azure.ai.contentsafety.ContentSafetyServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +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.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +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.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.UrlBuilder; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ContentSafetyClient type. */ +public final class ContentSafetyClientImpl { + /** The proxy service used to perform REST calls. */ + private final ContentSafetyClientService service; + + /** + * Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://<resource-name>.cognitiveservices.azure.com). + */ + private final String endpoint; + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://<resource-name>.cognitiveservices.azure.com). + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Service version. */ + private final ContentSafetyServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ContentSafetyServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * Initializes an instance of ContentSafetyClient client. + * + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://<resource-name>.cognitiveservices.azure.com). + * @param serviceVersion Service version. + */ + public ContentSafetyClientImpl(String endpoint, ContentSafetyServiceVersion serviceVersion) { + this( + new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), + endpoint, + serviceVersion); + } + + /** + * Initializes an instance of ContentSafetyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://<resource-name>.cognitiveservices.azure.com). + * @param serviceVersion Service version. + */ + public ContentSafetyClientImpl( + HttpPipeline httpPipeline, String endpoint, ContentSafetyServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ContentSafetyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://<resource-name>.cognitiveservices.azure.com). + * @param serviceVersion Service version. + */ + public ContentSafetyClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + String endpoint, + ContentSafetyServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = + RestProxy.create(ContentSafetyClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ContentSafetyClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/contentsafety") + @ServiceInterface(name = "ContentSafetyClient") + public interface ContentSafetyClientService { + @Post("/text:analyze") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> analyzeText( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/text:analyze") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response analyzeTextSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/image:analyze") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> analyzeImage( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Post("/image:analyze") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response analyzeImageSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, + Context context); + + @Get("/text/blocklists/{blocklistName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTextBlocklist( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/text/blocklists/{blocklistName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getTextBlocklistSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Patch("/text/blocklists/{blocklistName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdateTextBlocklist( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("Content-Type") String contentType, + @HeaderParam("accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, + RequestOptions requestOptions, + Context context); + + @Patch("/text/blocklists/{blocklistName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrUpdateTextBlocklistSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("Content-Type") String contentType, + @HeaderParam("accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, + RequestOptions requestOptions, + Context context); + + @Delete("/text/blocklists/{blocklistName}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteTextBlocklist( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Delete("/text/blocklists/{blocklistName}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteTextBlocklistSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/text/blocklists") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listTextBlocklists( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/text/blocklists") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listTextBlocklistsSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Post("/text/blocklists/{blocklistName}:addBlockItems") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addBlockItems( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData addBlockItemsOptions, + RequestOptions requestOptions, + Context context); + + @Post("/text/blocklists/{blocklistName}:addBlockItems") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response addBlockItemsSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData addBlockItemsOptions, + RequestOptions requestOptions, + Context context); + + @Post("/text/blocklists/{blocklistName}:removeBlockItems") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> removeBlockItems( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData removeBlockItemsOptions, + RequestOptions requestOptions, + Context context); + + @Post("/text/blocklists/{blocklistName}:removeBlockItems") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response removeBlockItemsSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData removeBlockItemsOptions, + RequestOptions requestOptions, + Context context); + + @Get("/text/blocklists/{blocklistName}/blockItems/{blockItemId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTextBlocklistItem( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @PathParam("blockItemId") String blockItemId, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/text/blocklists/{blocklistName}/blockItems/{blockItemId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getTextBlocklistItemSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @PathParam("blockItemId") String blockItemId, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/text/blocklists/{blocklistName}/blockItems") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listTextBlocklistItems( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("/text/blocklists/{blocklistName}/blockItems") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listTextBlocklistItemsSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("blocklistName") String blocklistName, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listTextBlocklistsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listTextBlocklistsNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listTextBlocklistItemsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listTextBlocklistItemsNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + RequestOptions requestOptions, + Context context); + } + + /** + * Analyze Text + * + *

A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     text: String (Required)
+     *     categories (Optional): [
+     *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
+     *     ]
+     *     blocklistNames (Optional): [
+     *         String (Optional)
+     *     ]
+     *     breakByBlocklists: Boolean (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistsMatchResults (Optional): [
+     *          (Optional){
+     *             blocklistName: String (Required)
+     *             blockItemId: String (Required)
+     *             blockItemText: String (Required)
+     *             offset: int (Required)
+     *             length: int (Required)
+     *         }
+     *     ]
+     *     hateResult (Optional): {
+     *         category: String(Hate/SelfHarm/Sexual/Violence) (Required)
+     *         severity: int (Required)
+     *     }
+     *     selfHarmResult (Optional): (recursive schema, see selfHarmResult above)
+     *     sexualResult (Optional): (recursive schema, see sexualResult above)
+     *     violenceResult (Optional): (recursive schema, see violenceResult above)
+     * }
+     * }
+ * + * @param body The request of text analysis. + * @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 the analysis response of the text along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeTextWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.analyzeText( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + accept, + body, + requestOptions, + context)); + } + + /** + * Analyze Text + * + *

A sync API for harmful content analysis for text. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     text: String (Required)
+     *     categories (Optional): [
+     *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
+     *     ]
+     *     blocklistNames (Optional): [
+     *         String (Optional)
+     *     ]
+     *     breakByBlocklists: Boolean (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistsMatchResults (Optional): [
+     *          (Optional){
+     *             blocklistName: String (Required)
+     *             blockItemId: String (Required)
+     *             blockItemText: String (Required)
+     *             offset: int (Required)
+     *             length: int (Required)
+     *         }
+     *     ]
+     *     hateResult (Optional): {
+     *         category: String(Hate/SelfHarm/Sexual/Violence) (Required)
+     *         severity: int (Required)
+     *     }
+     *     selfHarmResult (Optional): (recursive schema, see selfHarmResult above)
+     *     sexualResult (Optional): (recursive schema, see sexualResult above)
+     *     violenceResult (Optional): (recursive schema, see violenceResult above)
+     * }
+     * }
+ * + * @param body The request of text analysis. + * @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 the analysis response of the text along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response analyzeTextWithResponse(BinaryData body, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.analyzeTextSync( + this.getEndpoint(), this.getServiceVersion().getVersion(), accept, body, requestOptions, Context.NONE); + } + + /** + * Analyze Image + * + *

A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     image (Required): {
+     *         content: byte[] (Optional)
+     *         blobUrl: String (Optional)
+     *     }
+     *     categories (Optional): [
+     *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     hateResult (Optional): {
+     *         category: String(Hate/SelfHarm/Sexual/Violence) (Required)
+     *         severity: int (Required)
+     *     }
+     *     selfHarmResult (Optional): (recursive schema, see selfHarmResult above)
+     *     sexualResult (Optional): (recursive schema, see sexualResult above)
+     *     violenceResult (Optional): (recursive schema, see violenceResult above)
+     * }
+     * }
+ * + * @param body The analysis request of the image. + * @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 the analysis response of the image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> analyzeImageWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.analyzeImage( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + accept, + body, + requestOptions, + context)); + } + + /** + * Analyze Image + * + *

A sync API for harmful content analysis for image. Currently, we support four categories: Hate, SelfHarm, + * Sexual, Violence. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     image (Required): {
+     *         content: byte[] (Optional)
+     *         blobUrl: String (Optional)
+     *     }
+     *     categories (Optional): [
+     *         String(Hate/SelfHarm/Sexual/Violence) (Optional)
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     hateResult (Optional): {
+     *         category: String(Hate/SelfHarm/Sexual/Violence) (Required)
+     *         severity: int (Required)
+     *     }
+     *     selfHarmResult (Optional): (recursive schema, see selfHarmResult above)
+     *     sexualResult (Optional): (recursive schema, see sexualResult above)
+     *     violenceResult (Optional): (recursive schema, see violenceResult above)
+     * }
+     * }
+ * + * @param body The analysis request of the image. + * @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 the analysis response of the image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response analyzeImageWithResponse(BinaryData body, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.analyzeImageSync( + this.getEndpoint(), this.getServiceVersion().getVersion(), accept, body, requestOptions, Context.NONE); + } + + /** + * Get Text Blocklist By blocklistName + * + *

Returns text blocklist details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 text Blocklist along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextBlocklistWithResponseAsync( + String blocklistName, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getTextBlocklist( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + requestOptions, + context)); + } + + /** + * Get Text Blocklist By blocklistName + * + *

Returns text blocklist details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 text Blocklist along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextBlocklistWithResponse(String blocklistName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getTextBlocklistSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + requestOptions, + Context.NONE); + } + + /** + * Create Or Update Text Blocklist + * + *

Updates a text blocklist, if blocklistName does not exist, create a new blocklist. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param resource The resource instance. + * @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 text Blocklist along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateTextBlocklistWithResponseAsync( + String blocklistName, BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.createOrUpdateTextBlocklist( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + contentType, + accept, + resource, + requestOptions, + context)); + } + + /** + * Create Or Update Text Blocklist + * + *

Updates a text blocklist, if blocklistName does not exist, create a new blocklist. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param resource The resource instance. + * @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 text Blocklist along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateTextBlocklistWithResponse( + String blocklistName, BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.createOrUpdateTextBlocklistSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + contentType, + accept, + resource, + requestOptions, + Context.NONE); + } + + /** + * Delete Text Blocklist By blocklistName + * + *

Deletes a text blocklist. + * + * @param blocklistName Text blocklist name. + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteTextBlocklistWithResponseAsync( + String blocklistName, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.deleteTextBlocklist( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + requestOptions, + context)); + } + + /** + * Delete Text Blocklist By blocklistName + * + *

Deletes a text blocklist. + * + * @param blocklistName Text blocklist name. + * @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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteTextBlocklistWithResponse(String blocklistName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteTextBlocklistSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + requestOptions, + Context.NONE); + } + + /** + * Get All Text Blocklists + * + *

Get all text blocklists details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @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 all text blocklists details along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTextBlocklistsSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listTextBlocklists( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + accept, + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get All Text Blocklists + * + *

Get all text blocklists details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @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 all text blocklists details as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTextBlocklistsAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedFlux<>( + () -> listTextBlocklistsSinglePageAsync(requestOptions), + nextLink -> listTextBlocklistsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Get All Text Blocklists + * + *

Get all text blocklists details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @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 all text blocklists details along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listTextBlocklistsSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = + service.listTextBlocklistsSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + accept, + requestOptions, + Context.NONE); + return new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null); + } + + /** + * Get All Text Blocklists + * + *

Get all text blocklists details. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @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 all text blocklists details as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTextBlocklists(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedIterable<>( + () -> listTextBlocklistsSinglePage(requestOptions), + nextLink -> listTextBlocklistsNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Add BlockItems To Text Blocklist + * + *

Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blockItems (Required): [
+     *          (Required){
+     *             description: String (Optional)
+     *             text: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Optional): [
+     *          (Optional){
+     *             blockItemId: String (Required)
+     *             description: String (Optional)
+     *             text: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param addBlockItemsOptions The request of adding blockItems to text blocklist. + * @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 the response of adding blockItems to text blocklist along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addBlockItemsWithResponseAsync( + String blocklistName, BinaryData addBlockItemsOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.addBlockItems( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + addBlockItemsOptions, + requestOptions, + context)); + } + + /** + * Add BlockItems To Text Blocklist + * + *

Add blockItems to a text blocklist. You can add at most 100 BlockItems in one request. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blockItems (Required): [
+     *          (Required){
+     *             description: String (Optional)
+     *             text: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + *

Response Body Schema + * + *

{@code
+     * {
+     *     value (Optional): [
+     *          (Optional){
+     *             blockItemId: String (Required)
+     *             description: String (Optional)
+     *             text: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param addBlockItemsOptions The request of adding blockItems to text blocklist. + * @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 the response of adding blockItems to text blocklist along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addBlockItemsWithResponse( + String blocklistName, BinaryData addBlockItemsOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.addBlockItemsSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + addBlockItemsOptions, + requestOptions, + Context.NONE); + } + + /** + * Remove BlockItems From Text Blocklist + * + *

Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blockItemIds (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param removeBlockItemsOptions The request of removing blockItems from text blocklist. + * @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 the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeBlockItemsWithResponseAsync( + String blocklistName, BinaryData removeBlockItemsOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.removeBlockItems( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + removeBlockItemsOptions, + requestOptions, + context)); + } + + /** + * Remove BlockItems From Text Blocklist + * + *

Remove blockItems from a text blocklist. You can remove at most 100 BlockItems in one request. + * + *

Request Body Schema + * + *

{@code
+     * {
+     *     blockItemIds (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param removeBlockItemsOptions The request of removing blockItems from text blocklist. + * @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 the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeBlockItemsWithResponse( + String blocklistName, BinaryData removeBlockItemsOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.removeBlockItemsSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + removeBlockItemsOptions, + requestOptions, + Context.NONE); + } + + /** + * Get BlockItem By blocklistName And blockItemId + * + *

Get blockItem By blockItemId from a text blocklist. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param blockItemId Block Item Id. It will be uuid. + * @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 blockItem By blockItemId from a text blocklist along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextBlocklistItemWithResponseAsync( + String blocklistName, String blockItemId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getTextBlocklistItem( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + blockItemId, + accept, + requestOptions, + context)); + } + + /** + * Get BlockItem By blocklistName And blockItemId + * + *

Get blockItem By blockItemId from a text blocklist. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @param blockItemId Block Item Id. It will be uuid. + * @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 blockItem By blockItemId from a text blocklist along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextBlocklistItemWithResponse( + String blocklistName, String blockItemId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getTextBlocklistItemSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + blockItemId, + accept, + requestOptions, + Context.NONE); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 all blockItems in a text blocklist along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTextBlocklistItemsSinglePageAsync( + String blocklistName, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listTextBlocklistItems( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + requestOptions, + context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 all blockItems in a text blocklist as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listTextBlocklistItemsAsync(String blocklistName, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedFlux<>( + (pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback( + requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTextBlocklistItemsSinglePageAsync(blocklistName, requestOptionsLocal); + }, + (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback( + requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTextBlocklistItemsNextSinglePageAsync(nextLink, requestOptionsLocal); + }); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 all blockItems in a text blocklist along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listTextBlocklistItemsSinglePage( + String blocklistName, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = + service.listTextBlocklistItemsSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + blocklistName, + accept, + requestOptions, + Context.NONE); + return new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get all blockItems in a text blocklist. + * + *

Query Parameters + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * + * You can add these to a request with {@link RequestOptions#addQueryParam} + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param blocklistName Text blocklist name. + * @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 all blockItems in a text blocklist as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listTextBlocklistItems(String blocklistName, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE); + return new PagedIterable<>( + (pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback( + requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTextBlocklistItemsSinglePage(blocklistName, requestOptionsLocal); + }, + (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback( + requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listTextBlocklistItemsNextSinglePage(nextLink, requestOptionsLocal); + }); + } + + /** + * Get All Text Blocklists + * + *

Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 TextBlocklist items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTextBlocklistsNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listTextBlocklistsNext( + nextLink, this.getEndpoint(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get All Text Blocklists + * + *

Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blocklistName: String (Required)
+     *     description: String (Optional)
+     * }
+     * }
+ * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 TextBlocklist items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listTextBlocklistsNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = + service.listTextBlocklistsNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 TextBlockItem items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTextBlocklistItemsNextSinglePageAsync( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listTextBlocklistItemsNext( + nextLink, this.getEndpoint(), accept, requestOptions, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null)); + } + + /** + * Get All BlockItems By blocklistName + * + *

Get the next page of items. + * + *

Response Body Schema + * + *

{@code
+     * {
+     *     blockItemId: String (Required)
+     *     description: String (Optional)
+     *     text: String (Required)
+     * }
+     * }
+ * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 TextBlockItem items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listTextBlocklistItemsNextSinglePage( + String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = + service.listTextBlocklistItemsNextSync( + nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + getValues(res.getValue(), "value"), + getNextLink(res.getValue(), "nextLink"), + null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/package-info.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/package-info.java new file mode 100644 index 000000000000..f7db41a5139c --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for ContentSafety. Analyze harmful content. */ +package com.azure.ai.contentsafety.implementation; diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AddBlockItemsOptions.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AddBlockItemsOptions.java new file mode 100644 index 000000000000..c11099260e73 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AddBlockItemsOptions.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The request of adding blockItems to text blocklist. */ +@Immutable +public final class AddBlockItemsOptions { + /* + * Array of blockItemInfo to add. + */ + @Generated + @JsonProperty(value = "blockItems") + private List blockItems; + + /** + * Creates an instance of AddBlockItemsOptions class. + * + * @param blockItems the blockItems value to set. + */ + @Generated + @JsonCreator + public AddBlockItemsOptions(@JsonProperty(value = "blockItems") List blockItems) { + this.blockItems = blockItems; + } + + /** + * Get the blockItems property: Array of blockItemInfo to add. + * + * @return the blockItems value. + */ + @Generated + public List getBlockItems() { + return this.blockItems; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AddBlockItemsResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AddBlockItemsResult.java new file mode 100644 index 000000000000..31892c1614c1 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AddBlockItemsResult.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of adding blockItems to text blocklist. */ +@Immutable +public final class AddBlockItemsResult { + /* + * Array of blockItems added. + */ + @Generated + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of AddBlockItemsResult class. */ + @Generated + private AddBlockItemsResult() {} + + /** + * Get the value property: Array of blockItems added. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageOptions.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageOptions.java new file mode 100644 index 000000000000..ea2edcb91d58 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageOptions.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The analysis request of the image. */ +@Fluent +public final class AnalyzeImageOptions { + /* + * The image needs to be analyzed. + */ + @Generated + @JsonProperty(value = "image") + private ImageData image; + + /* + * The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be + * returned. + */ + @Generated + @JsonProperty(value = "categories") + private List categories; + + /** + * Creates an instance of AnalyzeImageOptions class. + * + * @param image the image value to set. + */ + @Generated + @JsonCreator + public AnalyzeImageOptions(@JsonProperty(value = "image") ImageData image) { + this.image = image; + } + + /** + * Get the image property: The image needs to be analyzed. + * + * @return the image value. + */ + @Generated + public ImageData getImage() { + return this.image; + } + + /** + * Get the categories property: The categories will be analyzed. If not assigned, a default set of the categories' + * analysis results will be returned. + * + * @return the categories value. + */ + @Generated + public List getCategories() { + return this.categories; + } + + /** + * Set the categories property: The categories will be analyzed. If not assigned, a default set of the categories' + * analysis results will be returned. + * + * @param categories the categories value to set. + * @return the AnalyzeImageOptions object itself. + */ + @Generated + public AnalyzeImageOptions setCategories(List categories) { + this.categories = categories; + return this; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageResult.java new file mode 100644 index 000000000000..8f0774787c93 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeImageResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The analysis response of the image. */ +@Immutable +public final class AnalyzeImageResult { + /* + * Analysis result for Hate category. + */ + @Generated + @JsonProperty(value = "hateResult") + private ImageAnalyzeSeverityResult hateResult; + + /* + * Analysis result for SelfHarm category. + */ + @Generated + @JsonProperty(value = "selfHarmResult") + private ImageAnalyzeSeverityResult selfHarmResult; + + /* + * Analysis result for Sexual category. + */ + @Generated + @JsonProperty(value = "sexualResult") + private ImageAnalyzeSeverityResult sexualResult; + + /* + * Analysis result for Violence category. + */ + @Generated + @JsonProperty(value = "violenceResult") + private ImageAnalyzeSeverityResult violenceResult; + + /** Creates an instance of AnalyzeImageResult class. */ + @Generated + private AnalyzeImageResult() {} + + /** + * Get the hateResult property: Analysis result for Hate category. + * + * @return the hateResult value. + */ + @Generated + public ImageAnalyzeSeverityResult getHateResult() { + return this.hateResult; + } + + /** + * Get the selfHarmResult property: Analysis result for SelfHarm category. + * + * @return the selfHarmResult value. + */ + @Generated + public ImageAnalyzeSeverityResult getSelfHarmResult() { + return this.selfHarmResult; + } + + /** + * Get the sexualResult property: Analysis result for Sexual category. + * + * @return the sexualResult value. + */ + @Generated + public ImageAnalyzeSeverityResult getSexualResult() { + return this.sexualResult; + } + + /** + * Get the violenceResult property: Analysis result for Violence category. + * + * @return the violenceResult value. + */ + @Generated + public ImageAnalyzeSeverityResult getViolenceResult() { + return this.violenceResult; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextOptions.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextOptions.java new file mode 100644 index 000000000000..69c5487f4954 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextOptions.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The analysis request of the text. */ +@Fluent +public final class AnalyzeTextOptions { + /* + * The text needs to be scanned. We support at most 1000 characters (unicode code points) in text of one request. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The categories will be analyzed. If not assigned, a default set of the categories' analysis results will be + * returned. + */ + @Generated + @JsonProperty(value = "categories") + private List categories; + + /* + * The names of blocklists. + */ + @Generated + @JsonProperty(value = "blocklistNames") + private List blocklistNames; + + /* + * When set to true, further analyses of harmful content will not be performed in cases where blocklists are hit. + * When set to false, all analyses of harmful content will be performed, whether or not blocklists are hit. + */ + @Generated + @JsonProperty(value = "breakByBlocklists") + private Boolean breakByBlocklists; + + /** + * Creates an instance of AnalyzeTextOptions class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + public AnalyzeTextOptions(@JsonProperty(value = "text") String text) { + this.text = text; + } + + /** + * Get the text property: The text needs to be scanned. We support at most 1000 characters (unicode code points) in + * text of one request. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the categories property: The categories will be analyzed. If not assigned, a default set of the categories' + * analysis results will be returned. + * + * @return the categories value. + */ + @Generated + public List getCategories() { + return this.categories; + } + + /** + * Set the categories property: The categories will be analyzed. If not assigned, a default set of the categories' + * analysis results will be returned. + * + * @param categories the categories value to set. + * @return the AnalyzeTextOptions object itself. + */ + @Generated + public AnalyzeTextOptions setCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the blocklistNames property: The names of blocklists. + * + * @return the blocklistNames value. + */ + @Generated + public List getBlocklistNames() { + return this.blocklistNames; + } + + /** + * Set the blocklistNames property: The names of blocklists. + * + * @param blocklistNames the blocklistNames value to set. + * @return the AnalyzeTextOptions object itself. + */ + @Generated + public AnalyzeTextOptions setBlocklistNames(List blocklistNames) { + this.blocklistNames = blocklistNames; + return this; + } + + /** + * Get the breakByBlocklists property: When set to true, further analyses of harmful content will not be performed + * in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether + * or not blocklists are hit. + * + * @return the breakByBlocklists value. + */ + @Generated + public Boolean isBreakByBlocklists() { + return this.breakByBlocklists; + } + + /** + * Set the breakByBlocklists property: When set to true, further analyses of harmful content will not be performed + * in cases where blocklists are hit. When set to false, all analyses of harmful content will be performed, whether + * or not blocklists are hit. + * + * @param breakByBlocklists the breakByBlocklists value to set. + * @return the AnalyzeTextOptions object itself. + */ + @Generated + public AnalyzeTextOptions setBreakByBlocklists(Boolean breakByBlocklists) { + this.breakByBlocklists = breakByBlocklists; + return this; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextResult.java new file mode 100644 index 000000000000..966b5e0339c0 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/AnalyzeTextResult.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The analysis response of the text. */ +@Immutable +public final class AnalyzeTextResult { + /* + * The details of blocklist match. + */ + @Generated + @JsonProperty(value = "blocklistsMatchResults") + private List blocklistsMatchResults; + + /* + * Analysis result for Hate category. + */ + @Generated + @JsonProperty(value = "hateResult") + private TextAnalyzeSeverityResult hateResult; + + /* + * Analysis result for SelfHarm category. + */ + @Generated + @JsonProperty(value = "selfHarmResult") + private TextAnalyzeSeverityResult selfHarmResult; + + /* + * Analysis result for Sexual category. + */ + @Generated + @JsonProperty(value = "sexualResult") + private TextAnalyzeSeverityResult sexualResult; + + /* + * Analysis result for Violence category. + */ + @Generated + @JsonProperty(value = "violenceResult") + private TextAnalyzeSeverityResult violenceResult; + + /** Creates an instance of AnalyzeTextResult class. */ + @Generated + private AnalyzeTextResult() {} + + /** + * Get the blocklistsMatchResults property: The details of blocklist match. + * + * @return the blocklistsMatchResults value. + */ + @Generated + public List getBlocklistsMatchResults() { + return this.blocklistsMatchResults; + } + + /** + * Get the hateResult property: Analysis result for Hate category. + * + * @return the hateResult value. + */ + @Generated + public TextAnalyzeSeverityResult getHateResult() { + return this.hateResult; + } + + /** + * Get the selfHarmResult property: Analysis result for SelfHarm category. + * + * @return the selfHarmResult value. + */ + @Generated + public TextAnalyzeSeverityResult getSelfHarmResult() { + return this.selfHarmResult; + } + + /** + * Get the sexualResult property: Analysis result for Sexual category. + * + * @return the sexualResult value. + */ + @Generated + public TextAnalyzeSeverityResult getSexualResult() { + return this.sexualResult; + } + + /** + * Get the violenceResult property: Analysis result for Violence category. + * + * @return the violenceResult value. + */ + @Generated + public TextAnalyzeSeverityResult getViolenceResult() { + return this.violenceResult; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageAnalyzeSeverityResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageAnalyzeSeverityResult.java new file mode 100644 index 000000000000..e3b2dc979020 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageAnalyzeSeverityResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Image analysis result. */ +@Immutable +public final class ImageAnalyzeSeverityResult { + /* + * The image category. + */ + @Generated + @JsonProperty(value = "category") + private ImageCategory category; + + /* + * The higher the severity of input content, the larger this value, currently its value could be: 0,2,4,6. + */ + @Generated + @JsonProperty(value = "severity") + private int severity; + + /** + * Creates an instance of ImageAnalyzeSeverityResult class. + * + * @param category the category value to set. + * @param severity the severity value to set. + */ + @Generated + @JsonCreator + private ImageAnalyzeSeverityResult( + @JsonProperty(value = "category") ImageCategory category, @JsonProperty(value = "severity") int severity) { + this.category = category; + this.severity = severity; + } + + /** + * Get the category property: The image category. + * + * @return the category value. + */ + @Generated + public ImageCategory getCategory() { + return this.category; + } + + /** + * Get the severity property: The higher the severity of input content, the larger this value, currently its value + * could be: 0,2,4,6. + * + * @return the severity value. + */ + @Generated + public int getSeverity() { + return this.severity; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageCategory.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageCategory.java new file mode 100644 index 000000000000..0b0eac63083a --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageCategory.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Image analyze category. */ +public final class ImageCategory extends ExpandableStringEnum { + /** Static value Hate for ImageCategory. */ + @Generated public static final ImageCategory HATE = fromString("Hate"); + + /** Static value SelfHarm for ImageCategory. */ + @Generated public static final ImageCategory SELF_HARM = fromString("SelfHarm"); + + /** Static value Sexual for ImageCategory. */ + @Generated public static final ImageCategory SEXUAL = fromString("Sexual"); + + /** Static value Violence for ImageCategory. */ + @Generated public static final ImageCategory VIOLENCE = fromString("Violence"); + + /** + * Creates a new instance of ImageCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ImageCategory() {} + + /** + * Creates or finds a ImageCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImageCategory. + */ + @Generated + @JsonCreator + public static ImageCategory fromString(String name) { + return fromString(name, ImageCategory.class); + } + + /** + * Gets known ImageCategory values. + * + * @return known ImageCategory values. + */ + @Generated + public static Collection values() { + return values(ImageCategory.class); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageData.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageData.java new file mode 100644 index 000000000000..ac9a98c24ad0 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/ImageData.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The content or blob url of image, could be base64 encoding bytes or blob url. If both are given, the request will be + * refused. The maximum size of image is 2048 pixels * 2048 pixels, no larger than 4MB at the same time. The minimum + * size of image is 50 pixels * 50 pixels. + */ +@Fluent +public final class ImageData { + /* + * Base64 encoding of image. + */ + @Generated + @JsonProperty(value = "content") + private byte[] content; + + /* + * The blob url of image. + */ + @Generated + @JsonProperty(value = "blobUrl") + private String blobUrl; + + /** Creates an instance of ImageData class. */ + @Generated + public ImageData() {} + + /** + * Get the content property: Base64 encoding of image. + * + * @return the content value. + */ + @Generated + public byte[] getContent() { + return CoreUtils.clone(this.content); + } + + /** + * Set the content property: Base64 encoding of image. + * + * @param content the content value to set. + * @return the ImageData object itself. + */ + @Generated + public ImageData setContent(byte[] content) { + this.content = CoreUtils.clone(content); + return this; + } + + /** + * Get the blobUrl property: The blob url of image. + * + * @return the blobUrl value. + */ + @Generated + public String getBlobUrl() { + return this.blobUrl; + } + + /** + * Set the blobUrl property: The blob url of image. + * + * @param blobUrl the blobUrl value to set. + * @return the ImageData object itself. + */ + @Generated + public ImageData setBlobUrl(String blobUrl) { + this.blobUrl = blobUrl; + return this; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/RemoveBlockItemsOptions.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/RemoveBlockItemsOptions.java new file mode 100644 index 000000000000..b5bd0b6c79aa --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/RemoveBlockItemsOptions.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The request of removing blockItems from text blocklist. */ +@Immutable +public final class RemoveBlockItemsOptions { + /* + * Array of blockItemIds to remove. + */ + @Generated + @JsonProperty(value = "blockItemIds") + private List blockItemIds; + + /** + * Creates an instance of RemoveBlockItemsOptions class. + * + * @param blockItemIds the blockItemIds value to set. + */ + @Generated + @JsonCreator + public RemoveBlockItemsOptions(@JsonProperty(value = "blockItemIds") List blockItemIds) { + this.blockItemIds = blockItemIds; + } + + /** + * Get the blockItemIds property: Array of blockItemIds to remove. + * + * @return the blockItemIds value. + */ + @Generated + public List getBlockItemIds() { + return this.blockItemIds; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextAnalyzeSeverityResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextAnalyzeSeverityResult.java new file mode 100644 index 000000000000..dc17fafa4984 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextAnalyzeSeverityResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Text analysis result. */ +@Immutable +public final class TextAnalyzeSeverityResult { + /* + * The text category. + */ + @Generated + @JsonProperty(value = "category") + private TextCategory category; + + /* + * The higher the severity of input content, the larger this value is. The values could be: 0,2,4,6. + */ + @Generated + @JsonProperty(value = "severity") + private int severity; + + /** + * Creates an instance of TextAnalyzeSeverityResult class. + * + * @param category the category value to set. + * @param severity the severity value to set. + */ + @Generated + @JsonCreator + private TextAnalyzeSeverityResult( + @JsonProperty(value = "category") TextCategory category, @JsonProperty(value = "severity") int severity) { + this.category = category; + this.severity = severity; + } + + /** + * Get the category property: The text category. + * + * @return the category value. + */ + @Generated + public TextCategory getCategory() { + return this.category; + } + + /** + * Get the severity property: The higher the severity of input content, the larger this value is. The values could + * be: 0,2,4,6. + * + * @return the severity value. + */ + @Generated + public int getSeverity() { + return this.severity; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlockItem.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlockItem.java new file mode 100644 index 000000000000..c0f31b14677d --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlockItem.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Item in TextBlocklist. */ +@Immutable +public final class TextBlockItem { + /* + * Block Item Id. It will be uuid. + */ + @Generated + @JsonProperty(value = "blockItemId", access = JsonProperty.Access.WRITE_ONLY) + private String blockItemId; + + /* + * Block item description. + */ + @Generated + @JsonProperty(value = "description") + private String description; + + /* + * Block item content. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /** + * Creates an instance of TextBlockItem class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + private TextBlockItem(@JsonProperty(value = "text") String text) { + this.text = text; + } + + /** + * Get the blockItemId property: Block Item Id. It will be uuid. + * + * @return the blockItemId value. + */ + @Generated + public String getBlockItemId() { + return this.blockItemId; + } + + /** + * Get the description property: Block item description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the text property: Block item content. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlockItemInfo.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlockItemInfo.java new file mode 100644 index 000000000000..018f1c09f7be --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlockItemInfo.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Block item info in text blocklist. */ +@Fluent +public final class TextBlockItemInfo { + /* + * Block item description. + */ + @Generated + @JsonProperty(value = "description") + private String description; + + /* + * Block item content. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /** + * Creates an instance of TextBlockItemInfo class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + public TextBlockItemInfo(@JsonProperty(value = "text") String text) { + this.text = text; + } + + /** + * Get the description property: Block item description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Block item description. + * + * @param description the description value to set. + * @return the TextBlockItemInfo object itself. + */ + @Generated + public TextBlockItemInfo setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the text property: Block item content. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklist.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklist.java new file mode 100644 index 000000000000..4b6a1396d009 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklist.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Text Blocklist. */ +@Fluent +public final class TextBlocklist { + /* + * Text blocklist name. + */ + @Generated + @JsonProperty(value = "blocklistName", access = JsonProperty.Access.WRITE_ONLY) + private String blocklistName; + + /* + * Text blocklist description. + */ + @Generated + @JsonProperty(value = "description") + private String description; + + /** Creates an instance of TextBlocklist class. */ + @Generated + public TextBlocklist() {} + + /** + * Get the blocklistName property: Text blocklist name. + * + * @return the blocklistName value. + */ + @Generated + public String getBlocklistName() { + return this.blocklistName; + } + + /** + * Get the description property: Text blocklist description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Text blocklist description. + * + * @param description the description value to set. + * @return the TextBlocklist object itself. + */ + @Generated + public TextBlocklist setDescription(String description) { + this.description = description; + return this; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklistMatchResult.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklistMatchResult.java new file mode 100644 index 000000000000..27b42d51837c --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextBlocklistMatchResult.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The result of blocklist match. */ +@Immutable +public final class TextBlocklistMatchResult { + /* + * The name of matched blocklist. + */ + @Generated + @JsonProperty(value = "blocklistName") + private String blocklistName; + + /* + * The id of matched item. + */ + @Generated + @JsonProperty(value = "blockItemId") + private String blockItemId; + + /* + * The content of matched item. + */ + @Generated + @JsonProperty(value = "blockItemText") + private String blockItemText; + + /* + * The character offset of matched text in original input. + */ + @Generated + @JsonProperty(value = "offset") + private int offset; + + /* + * The length of matched text in original input. + */ + @Generated + @JsonProperty(value = "length") + private int length; + + /** + * Creates an instance of TextBlocklistMatchResult class. + * + * @param blocklistName the blocklistName value to set. + * @param blockItemId the blockItemId value to set. + * @param blockItemText the blockItemText value to set. + * @param offset the offset value to set. + * @param length the length value to set. + */ + @Generated + @JsonCreator + private TextBlocklistMatchResult( + @JsonProperty(value = "blocklistName") String blocklistName, + @JsonProperty(value = "blockItemId") String blockItemId, + @JsonProperty(value = "blockItemText") String blockItemText, + @JsonProperty(value = "offset") int offset, + @JsonProperty(value = "length") int length) { + this.blocklistName = blocklistName; + this.blockItemId = blockItemId; + this.blockItemText = blockItemText; + this.offset = offset; + this.length = length; + } + + /** + * Get the blocklistName property: The name of matched blocklist. + * + * @return the blocklistName value. + */ + @Generated + public String getBlocklistName() { + return this.blocklistName; + } + + /** + * Get the blockItemId property: The id of matched item. + * + * @return the blockItemId value. + */ + @Generated + public String getBlockItemId() { + return this.blockItemId; + } + + /** + * Get the blockItemText property: The content of matched item. + * + * @return the blockItemText value. + */ + @Generated + public String getBlockItemText() { + return this.blockItemText; + } + + /** + * Get the offset property: The character offset of matched text in original input. + * + * @return the offset value. + */ + @Generated + public int getOffset() { + return this.offset; + } + + /** + * Get the length property: The length of matched text in original input. + * + * @return the length value. + */ + @Generated + public int getLength() { + return this.length; + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextCategory.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextCategory.java new file mode 100644 index 000000000000..957f7df8d38d --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/TextCategory.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Text analyze category. */ +public final class TextCategory extends ExpandableStringEnum { + /** Static value Hate for TextCategory. */ + @Generated public static final TextCategory HATE = fromString("Hate"); + + /** Static value SelfHarm for TextCategory. */ + @Generated public static final TextCategory SELF_HARM = fromString("SelfHarm"); + + /** Static value Sexual for TextCategory. */ + @Generated public static final TextCategory SEXUAL = fromString("Sexual"); + + /** Static value Violence for TextCategory. */ + @Generated public static final TextCategory VIOLENCE = fromString("Violence"); + + /** + * Creates a new instance of TextCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TextCategory() {} + + /** + * Creates or finds a TextCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding TextCategory. + */ + @Generated + @JsonCreator + public static TextCategory fromString(String name) { + return fromString(name, TextCategory.class); + } + + /** + * Gets known TextCategory values. + * + * @return known TextCategory values. + */ + @Generated + public static Collection values() { + return values(TextCategory.class); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/package-info.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/package-info.java new file mode 100644 index 000000000000..67ad637f33f6 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for ContentSafety. Analyze harmful content. */ +package com.azure.ai.contentsafety.models; diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/package-info.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/package-info.java new file mode 100644 index 000000000000..6e4b5f8db65b --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for ContentSafety. Analyze harmful content. */ +package com.azure.ai.contentsafety; diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/module-info.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/module-info.java new file mode 100644 index 000000000000..4924f777a9aa --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/module-info.java @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.ai.contentsafety { + requires transitive com.azure.core; + + exports com.azure.ai.contentsafety; + exports com.azure.ai.contentsafety.models; + + opens com.azure.ai.contentsafety.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/resources/azure-ai-contentsafety.properties b/sdk/contentsafety/azure-ai-contentsafety/src/main/resources/azure-ai-contentsafety.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/resources/azure-ai-contentsafety.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/AnalyzeImage.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/AnalyzeImage.java new file mode 100644 index 000000000000..0eb16cf98681 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/AnalyzeImage.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.ai.contentsafety.models.AnalyzeImageOptions; +import com.azure.ai.contentsafety.models.AnalyzeImageResult; +import com.azure.ai.contentsafety.models.ImageData; +import com.azure.core.credential.KeyCredential; +import com.azure.core.util.Configuration; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class AnalyzeImage { + public static void main(String[] args) throws IOException { + // BEGIN:com.azure.ai.contentsafety.analyzeimage + String endpoint = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_ENDPOINT"); + String key = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_KEY"); + + ContentSafetyClient contentSafetyClient = new ContentSafetyClientBuilder() + .credential(new KeyCredential(key)) + .endpoint(endpoint).buildClient(); + + ImageData image = new ImageData(); + String cwd = System.getProperty("user.dir"); + String source = "/src/samples/resources/image.jpg"; + image.setContent(Files.readAllBytes(Paths.get(cwd, source))); + + AnalyzeImageResult response = + contentSafetyClient.analyzeImage(new AnalyzeImageOptions(image)); + + System.out.println("Hate severity: " + response.getHateResult().getSeverity()); + System.out.println("SelfHarm severity: " + response.getSelfHarmResult().getSeverity()); + System.out.println("Sexual severity: " + response.getSexualResult().getSeverity()); + System.out.println("Violence severity: " + response.getViolenceResult().getSeverity()); + // END:com.azure.ai.contentsafety.analyzeimage + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/AnalyzeText.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/AnalyzeText.java new file mode 100644 index 000000000000..31eb01c7b581 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/AnalyzeText.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.ai.contentsafety.models.AnalyzeTextOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextResult; +import com.azure.core.credential.KeyCredential; +import com.azure.core.util.Configuration; + + +public class AnalyzeText { + public static void main(String[] args) { + // BEGIN:com.azure.ai.contentsafety.analyzetext + String endpoint = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_ENDPOINT"); + String key = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_KEY"); + ContentSafetyClient contentSafetyClient = new ContentSafetyClientBuilder() + .credential(new KeyCredential(key)) + .endpoint(endpoint).buildClient(); + + AnalyzeTextResult response = contentSafetyClient.analyzeText(new AnalyzeTextOptions("This is text example")); + + System.out.println("Hate severity: " + response.getHateResult().getSeverity()); + System.out.println("SelfHarm severity: " + response.getSelfHarmResult().getSeverity()); + System.out.println("Sexual severity: " + response.getSexualResult().getSeverity()); + System.out.println("Violence severity: " + response.getViolenceResult().getSeverity()); + // END:com.azure.ai.contentsafety.analyzetext + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/ManageTextBlocklist.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/ManageTextBlocklist.java new file mode 100644 index 000000000000..ee40b1e93eee --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/ManageTextBlocklist.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.ai.contentsafety.models.TextBlockItem; +import com.azure.ai.contentsafety.models.TextBlocklistMatchResult; +import com.azure.ai.contentsafety.models.AddBlockItemsResult; +import com.azure.ai.contentsafety.models.TextBlockItemInfo; +import com.azure.ai.contentsafety.models.RemoveBlockItemsOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextOptions; +import com.azure.ai.contentsafety.models.AnalyzeTextResult; +import com.azure.ai.contentsafety.models.TextBlocklist; +import com.azure.ai.contentsafety.models.AddBlockItemsOptions; +import com.azure.core.credential.KeyCredential; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; + +import java.util.HashMap; +import java.util.Map; +import java.util.List; +import java.util.Arrays; +import java.util.ArrayList; + +public class ManageTextBlocklist { + public static void main(String[] args) { + // BEGIN:com.azure.ai.contentsafety.createClient + String endpoint = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_ENDPOINT"); + String key = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_KEY"); + + ContentSafetyClient contentSafetyClient = new ContentSafetyClientBuilder() + .credential(new KeyCredential(key)) + .endpoint(endpoint).buildClient(); + // END:com.azure.ai.contentsafety.createClient + + // BEGIN:com.azure.ai.contentsafety.createtextblocklist + String blocklistName = "TestBlocklist"; + Map description = new HashMap<>(); + description.put("description", "Test Blocklist"); + BinaryData resource = BinaryData.fromObject(description); + RequestOptions requestOptions = new RequestOptions(); + Response response = + contentSafetyClient.createOrUpdateTextBlocklistWithResponse(blocklistName, resource, requestOptions); + if (response.getStatusCode() == 201) { + System.out.println("\nBlocklist " + blocklistName + " created."); + } else if (response.getStatusCode() == 200) { + System.out.println("\nBlocklist " + blocklistName + " updated."); + } + // END:com.azure.ai.contentsafety.createtextblocklist + + // BEGIN:com.azure.ai.contentsafety.addblockitems + String blockItemText1 = "k*ll"; + String blockItemText2 = "h*te"; + List blockItems = Arrays.asList(new TextBlockItemInfo(blockItemText1).setDescription("Kill word"), + new TextBlockItemInfo(blockItemText2).setDescription("Hate word")); + AddBlockItemsResult addedBlockItems = contentSafetyClient.addBlockItems(blocklistName, new AddBlockItemsOptions(blockItems)); + if (addedBlockItems != null && addedBlockItems.getValue() != null) { + System.out.println("\nBlockItems added:"); + for (TextBlockItem addedBlockItem : addedBlockItems.getValue()) { + System.out.println("BlockItemId: " + addedBlockItem.getBlockItemId() + ", Text: " + addedBlockItem.getText() + ", Description: " + addedBlockItem.getDescription()); + } + } + // END:com.azure.ai.contentsafety.addblockitems + + + // BEGIN:com.azure.ai.contentsafety.analyzetextwithblocklist + // After you edit your blocklist, it usually takes effect in 5 minutes, please wait some time before analyzing with blocklist after editing. + AnalyzeTextOptions request = new AnalyzeTextOptions("I h*te you and I want to k*ll you"); + request.getBlocklistNames().add(blocklistName); + request.setBreakByBlocklists(true); + + AnalyzeTextResult analyzeTextResult; + try { + analyzeTextResult = contentSafetyClient.analyzeText(request); + } catch (HttpResponseException ex) { + System.out.println("Analyze text failed.\nStatus code: " + ex.getResponse().getStatusCode() + ", Error message: " + ex.getMessage()); + throw ex; + } + + if (analyzeTextResult.getBlocklistsMatchResults() != null) { + System.out.println("\nBlocklist match result:"); + for (TextBlocklistMatchResult matchResult : analyzeTextResult.getBlocklistsMatchResults()) { + System.out.println("Blockitem was hit in text: Offset: " + matchResult.getOffset() + ", Length: " + matchResult.getLength()); + System.out.println("BlocklistName: " + matchResult.getBlocklistName() + ", BlockItemId: " + matchResult.getBlockItemId() + ", BlockItemText: " + matchResult.getBlockItemText()); + } + } + // END:com.azure.ai.contentsafety.analyzetextwithblocklist + + // BEGIN:com.azure.ai.contentsafety.listtextblocklists + PagedIterable allTextBlocklists = contentSafetyClient.listTextBlocklists(); + System.out.println("\nList Blocklist:"); + for (TextBlocklist blocklist : allTextBlocklists) { + System.out.println("Blocklist: " + blocklist.getBlocklistName() + ", Description: " + blocklist.getDescription()); + } + // END:com.azure.ai.contentsafety.listtextblocklists + + // BEGIN:com.azure.ai.contentsafety.gettextblocklist + TextBlocklist getBlocklist = contentSafetyClient.getTextBlocklist(blocklistName); + if (getBlocklist != null) { + System.out.println("\nGet blocklist:"); + System.out.println("BlocklistName: " + getBlocklist.getBlocklistName() + ", Description: " + getBlocklist.getDescription()); + } + // END:com.azure.ai.contentsafety.gettextblocklist + + // BEGIN:com.azure.ai.contentsafety.listtextblocklistitems + PagedIterable allBlockitems = contentSafetyClient.listTextBlocklistItems(blocklistName); + System.out.println("\nList BlockItems:"); + for (TextBlockItem blocklistItem : allBlockitems) { + System.out.println("BlockItemId: " + blocklistItem.getBlockItemId() + ", Text: " + blocklistItem.getText() + ", Description: " + blocklistItem.getDescription()); + } + // END:com.azure.ai.contentsafety.listtextblocklistitems + + // BEGIN:com.azure.ai.contentsafety.gettextblocklistitem + String getBlockItemId = addedBlockItems.getValue().get(0).getBlockItemId(); + TextBlockItem getBlockItem = contentSafetyClient.getTextBlocklistItem(blocklistName, getBlockItemId); + System.out.println("\nGet BlockItem:"); + System.out.println("BlockItemId: " + getBlockItem.getBlockItemId() + ", Text: " + getBlockItem.getText() + ", Description: " + getBlockItem.getDescription()); + // END:com.azure.ai.contentsafety.gettextblocklistitem + + // BEGIN:com.azure.ai.contentsafety.removeblockitems + String removeBlockItemId = addedBlockItems.getValue().get(0).getBlockItemId(); + List removeBlockItemIds = new ArrayList<>(); + removeBlockItemIds.add(removeBlockItemId); + contentSafetyClient.removeBlockItems(blocklistName, new RemoveBlockItemsOptions(removeBlockItemIds)); + // END:com.azure.ai.contentsafety.removeblockitems + + // BEGIN:com.azure.ai.contentsafety.deletetextblocklist + contentSafetyClient.deleteTextBlocklist(blocklistName); + // END:com.azure.ai.contentsafety.deletetextblocklist + + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/ReadmeSamples.java b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/ReadmeSamples.java new file mode 100644 index 000000000000..857dabd4daae --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/samples/java/com/azure/ai/contentsafety/ReadmeSamples.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.ai.contentsafety.readme + // END: com.azure.ai.contentsafety.readme + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/samples/resources/image.jpg b/sdk/contentsafety/azure-ai-contentsafety/src/samples/resources/image.jpg new file mode 100644 index 000000000000..1edbaf9f2936 Binary files /dev/null and b/sdk/contentsafety/azure-ai-contentsafety/src/samples/resources/image.jpg differ diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/AnalyzeImageTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/AnalyzeImageTests.java new file mode 100644 index 000000000000..2dac8a13b1a2 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/AnalyzeImageTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.ai.contentsafety.models.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +public final class AnalyzeImageTests extends ContentSafetyClientTestBase { + @Test + public void testAnalyzeImageTests() throws IOException { + // method invocation + ImageData image = new ImageData(); + String cwd = System.getProperty("user.dir"); + String source = "/src/samples/resources/image.jpg"; + image.setContent(Files.readAllBytes(Paths.get(cwd, source))); + + AnalyzeImageResult response = + contentSafetyClient.analyzeImage( + new AnalyzeImageOptions(image)); + + // response assertion + Assertions.assertNotNull(response); + + ImageAnalyzeSeverityResult responseHateResult = response.getHateResult(); + Assertions.assertNotNull(responseHateResult); + + ImageCategory responseHateResultCategory = responseHateResult.getCategory(); + Assertions.assertEquals(ImageCategory.HATE, responseHateResultCategory); + int responseHateResultSeverity = responseHateResult.getSeverity(); + Assertions.assertEquals(0, responseHateResultSeverity); + ImageAnalyzeSeverityResult responseSelfHarmResult = response.getSelfHarmResult(); + Assertions.assertNotNull(responseSelfHarmResult); + + ImageCategory responseSelfHarmResultCategory = responseSelfHarmResult.getCategory(); + Assertions.assertEquals(ImageCategory.SELF_HARM, responseSelfHarmResultCategory); + int responseSelfHarmResultSeverity = responseSelfHarmResult.getSeverity(); + Assertions.assertEquals(0, responseSelfHarmResultSeverity); + ImageAnalyzeSeverityResult responseSexualResult = response.getSexualResult(); + Assertions.assertNotNull(responseSexualResult); + + ImageCategory responseSexualResultCategory = responseSexualResult.getCategory(); + Assertions.assertEquals(ImageCategory.SEXUAL, responseSexualResultCategory); + int responseSexualResultSeverity = responseSexualResult.getSeverity(); + Assertions.assertEquals(0, responseSexualResultSeverity); + ImageAnalyzeSeverityResult responseViolenceResult = response.getViolenceResult(); + Assertions.assertNotNull(responseViolenceResult); + + ImageCategory responseViolenceResultCategory = responseViolenceResult.getCategory(); + Assertions.assertEquals(ImageCategory.VIOLENCE, responseViolenceResultCategory); + int responseViolenceResultSeverity = responseViolenceResult.getSeverity(); + Assertions.assertEquals(2, responseViolenceResultSeverity); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/AnalyzeTextTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/AnalyzeTextTests.java new file mode 100644 index 000000000000..3a7cca60a64f --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/AnalyzeTextTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.ai.contentsafety.models.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.List; + +public final class AnalyzeTextTests extends ContentSafetyClientTestBase { + @Test + public void testAnalyzeTextTests() { + // method invocation + AnalyzeTextResult response = contentSafetyClient.analyzeText(new AnalyzeTextOptions("This is text example")); + + // response assertion + Assertions.assertNotNull(response); + + List responseBlocklistsMatchResults = response.getBlocklistsMatchResults(); + Assertions.assertEquals(0, responseBlocklistsMatchResults.size()); + TextAnalyzeSeverityResult responseHateResult = response.getHateResult(); + Assertions.assertNotNull(responseHateResult); + + TextCategory responseHateResultCategory = responseHateResult.getCategory(); + Assertions.assertEquals(TextCategory.HATE, responseHateResultCategory); + int responseHateResultSeverity = responseHateResult.getSeverity(); + Assertions.assertEquals(0, responseHateResultSeverity); + TextAnalyzeSeverityResult responseSelfHarmResult = response.getSelfHarmResult(); + Assertions.assertNotNull(responseSelfHarmResult); + + TextCategory responseSelfHarmResultCategory = responseSelfHarmResult.getCategory(); + Assertions.assertEquals(TextCategory.SELF_HARM, responseSelfHarmResultCategory); + int responseSelfHarmResultSeverity = responseSelfHarmResult.getSeverity(); + Assertions.assertEquals(0, responseSelfHarmResultSeverity); + TextAnalyzeSeverityResult responseSexualResult = response.getSexualResult(); + Assertions.assertNotNull(responseSexualResult); + + TextCategory responseSexualResultCategory = responseSexualResult.getCategory(); + Assertions.assertEquals(TextCategory.SEXUAL, responseSexualResultCategory); + int responseSexualResultSeverity = responseSexualResult.getSeverity(); + Assertions.assertEquals(0, responseSexualResultSeverity); + TextAnalyzeSeverityResult responseViolenceResult = response.getViolenceResult(); + Assertions.assertNotNull(responseViolenceResult); + + TextCategory responseViolenceResultCategory = responseViolenceResult.getCategory(); + Assertions.assertEquals(TextCategory.VIOLENCE, responseViolenceResultCategory); + int responseViolenceResultSeverity = responseViolenceResult.getSeverity(); + Assertions.assertEquals(0, responseViolenceResultSeverity); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/ContentSafetyClientTestBase.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/ContentSafetyClientTestBase.java new file mode 100644 index 000000000000..d4c30f8f3570 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/ContentSafetyClientTestBase.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.credential.KeyCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class ContentSafetyClientTestBase extends TestProxyTestBase { + protected ContentSafetyClient contentSafetyClient; + + @Override + protected void beforeTest() { + String endpoint = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_ENDPOINT", "https://fake_cs_resource.cognitiveservices.azure.com"); + String key = Configuration.getGlobalConfiguration().get("CONTENT_SAFETY_KEY", "00000000000000000000000000000000"); + ContentSafetyClientBuilder contentSafetyClientbuilder = + new ContentSafetyClientBuilder() + .credential(new KeyCredential(key)) + .endpoint(endpoint) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + contentSafetyClientbuilder.httpClient(interceptorManager.getPlaybackClient()); + } else if (getTestMode() == TestMode.RECORD) { + contentSafetyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + contentSafetyClient = contentSafetyClientbuilder.buildClient(); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/ManageTextBlocklistTests.java b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/ManageTextBlocklistTests.java new file mode 100644 index 000000000000..df30d63c007e --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/src/test/java/com/azure/ai/contentsafety/ManageTextBlocklistTests.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.ai.contentsafety; + +import com.azure.ai.contentsafety.models.*; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.*; + +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class ManageTextBlocklistTests extends ContentSafetyClientTestBase { + private static String blocklistName = "blocklistTest"; + private static String blocklistItemId = ""; + @Test + @Order(1) + public void testCreateOrUpdateTextBlocklistTests() { + BinaryData resource = BinaryData.fromString("{\"description\":\"Test Blocklist\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + contentSafetyClient.createOrUpdateTextBlocklistWithResponse(blocklistName, resource, requestOptions); + Assertions.assertEquals(201, response.getStatusCode()); + } + + + @Test + @Order(2) + public void testGetAllTextBlocklistsTests() { + // method invocation + PagedIterable response = contentSafetyClient.listTextBlocklists(); + + // response assertion + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + TextBlocklist firstItem = response.iterator().next(); + Assertions.assertNotNull(firstItem); + + String firstItemBlocklistName = firstItem.getBlocklistName(); + Assertions.assertEquals(blocklistName, firstItemBlocklistName); + String firstItemDescription = firstItem.getDescription(); + Assertions.assertEquals("Test Blocklist", firstItemDescription); + + } + + @Test + @Order(3) + public void testGetTextBlocklistByBlocklistNameTests() { + // method invocation + TextBlocklist response = contentSafetyClient.getTextBlocklist(blocklistName); + + // response assertion + Assertions.assertNotNull(response); + + String responseBlocklistName = response.getBlocklistName(); + Assertions.assertEquals(blocklistName, responseBlocklistName); + String responseDescription = response.getDescription(); + Assertions.assertEquals("Test Blocklist", responseDescription); + } + + @Test + @Order(4) + public void testAddBlockItemsToTextBlocklistTests() { + // method invocation + AddBlockItemsResult response = + contentSafetyClient.addBlockItems( + blocklistName, + new AddBlockItemsOptions( + Arrays.asList(new TextBlockItemInfo("fuck").setDescription("fuck word")))); + + // response assertion + Assertions.assertNotNull(response); + Assertions.assertEquals(1, response.getValue().size()); + + List responseValue = response.getValue(); + TextBlockItem responseValueFirstItem = responseValue.get(0); + + Assertions.assertNotNull(responseValueFirstItem); + Assertions.assertEquals("fuck word", responseValueFirstItem.getDescription()); + Assertions.assertEquals("fuck", responseValueFirstItem.getText()); + Assertions.assertNotNull(responseValueFirstItem.getBlockItemId()); + blocklistItemId = new String(responseValueFirstItem.getBlockItemId()); + System.out.println("debug blocklistItemId: " + blocklistItemId); + } + + @Test + @Order(5) + public void testGetAllBlockItemsByBlocklistNameTests() { + // method invocation + PagedIterable response = contentSafetyClient.listTextBlocklistItems(blocklistName, null, null); + + // response assertion + Optional firstItem = response.stream().findFirst(); + Assertions.assertNotNull(firstItem); + Assertions.assertEquals("fuck word", firstItem.get().getDescription()); + Assertions.assertEquals("fuck", firstItem.get().getText()); + } + + @Test + @Order(6) + public void testGetBlockItemByBlocklistNameAndBlockItemIdTests() { + // method invocation + System.out.println("debug blocklistItemId: " + blocklistItemId); + TextBlockItem response = + contentSafetyClient.getTextBlocklistItem(blocklistName, blocklistItemId); + + // response assertion + Assertions.assertNotNull(response); + + String responseBlockItemId = response.getBlockItemId(); + Assertions.assertEquals(blocklistItemId, responseBlockItemId); + String responseDescription = response.getDescription(); + Assertions.assertEquals("fuck word", responseDescription); + String responseText = response.getText(); + Assertions.assertEquals("fuck", responseText); + } + + @Test + @Order(7) + public void testRemoveBlockItemsFromTextBlocklistTests() { + // method invocation + System.out.println("debug blocklistItemId: " + blocklistItemId); + contentSafetyClient.removeBlockItems( + blocklistName, new RemoveBlockItemsOptions(Arrays.asList(blocklistItemId))); + } + + @Test + @Order(8) + public void testDeleteTextBlocklistByBlocklistNameTests() { + // method invocation + contentSafetyClient.deleteTextBlocklist(blocklistName); + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/test-resources.json b/sdk/contentsafety/azure-ai-contentsafety/test-resources.json new file mode 100644 index 000000000000..a73fc44240ac --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/test-resources.json @@ -0,0 +1,213 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "name": { + "type": "String" + }, + "location": { + "type": "String" + }, + "resourceGroupName": { + "type": "String" + }, + "resourceGroupId": { + "type": "String" + }, + "sku": { + "type": "String" + }, + "tagValues": { + "type": "Object" + }, + "virtualNetworkType": { + "type": "String" + }, + "vnet": { + "type": "Object" + }, + "ipRules": { + "type": "Array" + }, + "identity": { + "type": "Object" + }, + "privateEndpoints": { + "type": "Array" + }, + "privateDnsZone": { + "type": "String" + } + }, + "variables": { + "defaultVNetName": "csCSDefaultVNet9901", + "defaultSubnetName": "csCSDefaultSubnet9901", + "defaultAddressPrefix": "13.41.6.0/26" + }, + "resources": [ + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2017-05-10", + "name": "deployVnet", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": {}, + "variables": {}, + "resources": [ + { + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2020-04-01", + "name": "[if(equals(parameters('virtualNetworkType'), 'External'), parameters('vnet').name, variables('defaultVNetName'))]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": "[if(equals(parameters('virtualNetworkType'), 'External'), parameters('vnet').addressPrefixes, json(concat('[{\"', variables('defaultAddressPrefix'),'\"}]')))]" + }, + "subnets": [ + { + "name": "[if(equals(parameters('virtualNetworkType'), 'External'), parameters('vnet').subnets.subnet.name, variables('defaultSubnetName'))]", + "properties": { + "serviceEndpoints": [ + { + "service": "Microsoft.CognitiveServices", + "locations": [ + "[parameters('location')]" + ] + } + ], + "addressPrefix": "[if(equals(parameters('virtualNetworkType'), 'External'), parameters('vnet').subnets.subnet.addressPrefix, variables('defaultAddressPrefix'))]" + } + } + ] + } + } + ] + }, + "parameters": {} + }, + "condition": "[and(and(not(empty(parameters('vnet'))), equals(parameters('vnet').newOrExisting, 'new')), equals(parameters('virtualNetworkType'), 'External'))]" + }, + { + "type": "Microsoft.CognitiveServices/accounts", + "apiVersion": "2022-03-01", + "name": "[parameters('name')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Resources/deployments/', 'deployVnet')]" + ], + "tags": "[if(contains(parameters('tagValues'), 'Microsoft.CognitiveServices/accounts'), parameters('tagValues')['Microsoft.CognitiveServices/accounts'], json('{}'))]", + "sku": { + "name": "[parameters('sku')]" + }, + "kind": "ContentSafety", + "identity": "[parameters('identity')]", + "properties": { + "customSubDomainName": "[toLower(parameters('name'))]", + "publicNetworkAccess": "[if(equals(parameters('virtualNetworkType'), 'Internal'), 'Disabled', 'Enabled')]", + "networkAcls": { + "defaultAction": "[if(equals(parameters('virtualNetworkType'), 'External'), 'Deny', 'Allow')]", + "virtualNetworkRules": "[if(equals(parameters('virtualNetworkType'), 'External'), json(concat('[{\"id\": \"', concat(subscription().id, '/resourceGroups/', parameters('vnet').resourceGroup, '/providers/Microsoft.Network/virtualNetworks/', parameters('vnet').name, '/subnets/', parameters('vnet').subnets.subnet.name), '\"}]')), json('[]'))]", + "ipRules": "[if(or(empty(parameters('ipRules')), empty(parameters('ipRules')[0].value)), json('[]'), parameters('ipRules'))]" + } + } + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2017-05-10", + "name": "[concat('deployPrivateEndpoint-', parameters('privateEndpoints')[copyIndex()].privateEndpoint.name)]", + "dependsOn": [ + "[parameters('name')]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "location": "[parameters('location')]", + "name": "[parameters('privateEndpoints')[copyIndex()].privateEndpoint.name]", + "type": "Microsoft.Network/privateEndpoints", + "apiVersion": "2020-03-01", + "properties": { + "subnet": { + "id": "[parameters('privateEndpoints')[copyIndex()].privateEndpoint.properties.subnet.id]" + }, + "privateLinkServiceConnections": [ + { + "name": "[parameters('privateEndpoints')[copyIndex()].privateEndpoint.name]", + "properties": { + "privateLinkServiceId": "[concat(parameters('resourceGroupId'), '/providers/Microsoft.CognitiveServices/accounts/', parameters('name'))]", + "groupIds": "[parameters('privateEndpoints')[copyIndex()].privateEndpoint.properties.privateLinkServiceConnections[0].properties.groupIds]" + } + } + ] + }, + "tags": {} + } + ] + } + }, + "subscriptionId": "[parameters('privateEndpoints')[copyIndex()].subscription.subscriptionId]", + "resourceGroup": "[parameters('privateEndpoints')[copyIndex()].resourceGroup.value.name]", + "copy": { + "name": "privateendpointscopy", + "count": "[length(parameters('privateEndpoints'))]" + }, + "condition": "[equals(parameters('virtualNetworkType'), 'Internal')]" + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2017-05-10", + "name": "[concat('deployDnsZoneGroup-', parameters('privateEndpoints')[copyIndex()].privateEndpoint.name)]", + "dependsOn": [ + "[concat('Microsoft.Resources/deployments/', concat('deployPrivateEndpoint-', parameters('privateEndpoints')[copyIndex()].privateEndpoint.name))]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "type": "Microsoft.Network/privateEndpoints/privateDnsZoneGroups", + "apiVersion": "2020-03-01", + "name": "[concat(parameters('privateEndpoints')[copyIndex()].privateEndpoint.name, '/', 'default')]", + "location": "[parameters('location')]", + "properties": { + "privateDnsZoneConfigs": [ + { + "name": "privatelink-cognitiveservices", + "properties": { + "privateDnsZoneId": "[concat(parameters('resourceGroupId'), '/providers/Microsoft.Network/privateDnsZones/', parameters('privateDnsZone'))]" + } + } + ] + } + } + ] + } + }, + "subscriptionId": "[parameters('privateEndpoints')[copyIndex()].subscription.subscriptionId]", + "resourceGroup": "[parameters('privateEndpoints')[copyIndex()].resourceGroup.value.name]", + "copy": { + "name": "privateendpointdnscopy", + "count": "[length(parameters('privateEndpoints'))]" + }, + "condition": "[equals(parameters('virtualNetworkType'), 'Internal')]" + } + ], + "outputs": { + "CONTENT_SAFETY_ENDPOINT": { + "type": "string", + "value": "[variables('endpointValue')]" + }, + "CONTENT_SAFETY_KEY": { + "type": "string", + "value": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts',variables('uniqueSubDomainName')), '2017-04-18').key1]" + } + } +} diff --git a/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml b/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml new file mode 100644 index 000000000000..36893b3adfe0 --- /dev/null +++ b/sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/cognitiveservices/ContentSafety +repo: Azure/azure-rest-api-specs +commit: b253e331e2f0365f698e88eb3058a4f69bcc502a +additionalDirectories: [] + diff --git a/sdk/contentsafety/ci.yml b/sdk/contentsafety/ci.yml new file mode 100644 index 000000000000..3aa1bd8737b3 --- /dev/null +++ b/sdk/contentsafety/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/contentsafety/ci.yml + - sdk/contentsafety/azure-ai-contentsafety/ + exclude: + - sdk/contentsafety/pom.xml + - sdk/contentsafety/azure-ai-contentsafety/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/contentsafety/ci.yml + - sdk/contentsafety/azure-ai-contentsafety/ + exclude: + - sdk/contentsafety/pom.xml + - sdk/contentsafety/azure-ai-contentsafety/pom.xml + +parameters: + - name: release_azureaicontentsafety + displayName: azure-ai-contentsafety + type: boolean + default: true + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: contentsafety + EnableBatchRelease: true + Artifacts: + - name: azure-ai-contentsafety + groupId: com.azure + safeName: azureaicontentsafety + releaseInBatch: ${{ parameters.release_azureaicontentsafety }} diff --git a/sdk/contentsafety/pom.xml b/sdk/contentsafety/pom.xml new file mode 100644 index 000000000000..170bab08f140 --- /dev/null +++ b/sdk/contentsafety/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-contentsafety-service + pom + 1.0.0 + + + azure-ai-contentsafety + + diff --git a/sdk/core/azure-core-amqp/CHANGELOG.md b/sdk/core/azure-core-amqp/CHANGELOG.md index bdf53c71507e..f383efdce84a 100644 --- a/sdk/core/azure-core-amqp/CHANGELOG.md +++ b/sdk/core/azure-core-amqp/CHANGELOG.md @@ -8,6 +8,8 @@ ### Bugs Fixed +- Fixes the potential NullPointerException in ReactorSession if the thread constructing ReactorSession ever happens to run the disposeWork (cleanup phase) synchronously. ([36916](https://github.com/Azure/azure-sdk-for-java/issues/36916)) + ### Other Changes ## 2.8.9 (2023-09-07) diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSession.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSession.java index 17193cc37550..03e817a00dc0 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSession.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/ReactorSession.java @@ -95,7 +95,7 @@ public class ReactorSession implements AmqpSession { private final ReactorHandlerProvider handlerProvider; private final Mono cbsNodeSupplier; - private final Disposable.Composite connectionSubscriptions; + private final Disposable.Composite subscriptions = Disposables.composite(); private final AtomicReference transactionCoordinator = new AtomicReference<>(); private final Flux shutdownSignals; @@ -147,10 +147,8 @@ public ReactorSession(AmqpConnection amqpConnection, Session session, SessionHan .cache(1); shutdownSignals = amqpConnection.getShutdownSignals(); - connectionSubscriptions = Disposables.composite( - this.endpointStates.subscribe(), - - shutdownSignals.flatMap(signal -> closeAsync("Shutdown signal received", null, false)).subscribe()); + subscriptions.add(this.endpointStates.subscribe()); + subscriptions.add(shutdownSignals.flatMap(signal -> closeAsync("Shutdown signal received", null, false)).subscribe()); session.open(); } @@ -746,10 +744,10 @@ private void disposeWork(ErrorCondition errorCondition, boolean disposeLinks) { }); sessionHandler.close(); - connectionSubscriptions.dispose(); + subscriptions.dispose(); })); - connectionSubscriptions.add(closeLinksMono.subscribe()); + subscriptions.add(closeLinksMono.subscribe()); } private boolean removeLink(ConcurrentMap> openLinks, String key) { diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java index ab651cb66f92..638fd8281c10 100644 --- a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java @@ -26,7 +26,9 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.EventLoopGroup; +import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpMethod; +import io.netty.handler.proxy.HttpProxyHandler; import io.netty.handler.proxy.ProxyConnectException; import io.netty.handler.stream.ChunkedNioFile; import io.netty.handler.stream.ChunkedStream; @@ -40,6 +42,8 @@ import reactor.netty.NettyPipeline; import reactor.netty.http.client.HttpClientRequest; import reactor.netty.http.client.HttpClientResponse; +import reactor.util.function.Tuple2; +import reactor.util.function.Tuples; import javax.net.ssl.SSLException; import java.io.IOException; @@ -120,7 +124,8 @@ public Mono send(HttpRequest request, Context context) { private Mono attemptAsync(HttpRequest request, boolean eagerlyReadResponse, boolean ignoreResponseBody, boolean headersEagerlyConverted, Long responseTimeout, ProgressReporter progressReporter, boolean proxyRetry) { - Flux nettyRequest = nettyClient.request(toReactorNettyHttpMethod(request.getHttpMethod())) + Flux> nettyRequest = nettyClient + .request(toReactorNettyHttpMethod(request.getHttpMethod())) .uri(request.getUrl().toString()) .send(bodySendDelegate(request)) .responseConnection(responseDelegate(request, disableBufferCopy, eagerlyReadResponse, ignoreResponseBody, @@ -132,11 +137,18 @@ private Mono attemptAsync(HttpRequest request, boolean eagerlyRead } return nettyRequest.single() - .flatMap(response -> { + .flatMap(responseAndHeaders -> { + HttpResponse response = responseAndHeaders.getT1(); if (addProxyHandler && response.getStatusCode() == 407) { - return proxyRetry - ? Mono.error(new ProxyConnectException("Connection to proxy failed.")) - : Mono.error(new ProxyConnectException("First attempt to connect to proxy failed.")); + if (proxyRetry) { + // Exhausted retry attempt return an error. + return Mono.error(new HttpProxyHandler.HttpProxyConnectException( + "Failed to connect to proxy. Status: 407", responseAndHeaders.getT2())); + } else { + // Retry the request. + return attemptAsync(request, eagerlyReadResponse, ignoreResponseBody, headersEagerlyConverted, + responseTimeout, progressReporter, true); + } } else { return Mono.just(response); } @@ -285,7 +297,7 @@ private static NettyOutbound sendInputStream(NettyOutbound reactorNettyOutbound, * HttpHeaders. * @return a delegate upon invocation setup Rest response object */ - private static BiFunction> responseDelegate( + private static BiFunction>> responseDelegate( HttpRequest restRequest, boolean disableBufferCopy, boolean eagerlyReadResponse, boolean ignoreResponseBody, boolean headersEagerlyConverted) { return (reactorNettyResponse, reactorNettyConnection) -> { @@ -314,11 +326,11 @@ private static BiFunction> re return reactorNettyConnection.inbound().receive().aggregate().asByteArray() .doFinally(ignored -> closeConnection(reactorNettyConnection)) .switchIfEmpty(Mono.just(EMPTY_BYTES)) - .map(bytes -> new NettyAsyncHttpBufferedResponse(reactorNettyResponse, restRequest, bytes, - headersEagerlyConverted)); + .map(bytes -> Tuples.of(new NettyAsyncHttpBufferedResponse(reactorNettyResponse, restRequest, bytes, + headersEagerlyConverted), reactorNettyResponse.responseHeaders())); } else { - return Mono.just(new NettyAsyncHttpResponse(reactorNettyResponse, reactorNettyConnection, restRequest, - disableBufferCopy, headersEagerlyConverted)); + return Mono.just(Tuples.of(new NettyAsyncHttpResponse(reactorNettyResponse, reactorNettyConnection, + restRequest, disableBufferCopy, headersEagerlyConverted), reactorNettyResponse.responseHeaders())); } }; } diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/HttpProxyHandler.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/HttpProxyHandler.java index c48f1919ce57..4e27042688cb 100644 --- a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/HttpProxyHandler.java +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/HttpProxyHandler.java @@ -45,7 +45,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; @@ -94,7 +93,6 @@ public final class HttpProxyHandler extends ProxyHandler { private final AuthorizationChallengeHandler challengeHandler; private final AtomicReference proxyChallengeHolderReference; private final HttpClientCodec codec; - private final AtomicBoolean hasHandledChallenge = new AtomicBoolean(); private String authScheme = null; private HttpResponseStatus status; @@ -190,7 +188,6 @@ private String createAuthorizationHeader() { * created from the same client. */ if (proxyChallengeHolder != null) { - hasHandledChallenge.set(true); // Attempt to apply digest challenges, these are preferred over basic authorization. List> digestChallenges = proxyChallengeHolder.getDigestChallenges(); if (!CoreUtils.isNullOrEmpty(digestChallenges)) { @@ -238,19 +235,9 @@ protected boolean handleResponse(ChannelHandlerContext ctx, Object o) throws Pro } boolean responseComplete = o instanceof LastHttpContent; - if (responseComplete) { - if (status == null) { - throw new io.netty.handler.proxy.HttpProxyHandler.HttpProxyConnectException( - "Never received response for CONNECT request.", innerHeaders); - } else if (status.code() != 200) { - // Return the error response on the first attempt as the proxy handler doesn't apply credentials on the - // first attempt. - if (hasHandledChallenge.get()) { - // Later attempts throw an exception. - throw new io.netty.handler.proxy.HttpProxyHandler.HttpProxyConnectException( - "Failed to connect to proxy. Status: " + status, innerHeaders); - } - } + if (responseComplete && status == null) { + throw new io.netty.handler.proxy.HttpProxyHandler.HttpProxyConnectException( + "Never received response for CONNECT request.", innerHeaders); } return responseComplete; diff --git a/sdk/core/azure-core-metrics-opentelemetry/README.md b/sdk/core/azure-core-metrics-opentelemetry/README.md index 1377837ede0d..bf2897a87573 100644 --- a/sdk/core/azure-core-metrics-opentelemetry/README.md +++ b/sdk/core/azure-core-metrics-opentelemetry/README.md @@ -81,9 +81,10 @@ SdkMeterProvider meterProvider = SdkMeterProvider.builder() .registerMetricReader(PeriodicMetricReader.builder(OtlpGrpcMetricExporter.builder().build()).build()) .build(); +OpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder().setMeterProvider(meterProvider).build(); // Pass OpenTelemetry instance to MetricsOptions. MetricsOptions customMetricsOptions = new OpenTelemetryMetricsOptions() - .setOpenTelemetry(OpenTelemetrySdk.builder().setMeterProvider(meterProvider).build()); + .setOpenTelemetry(openTelemetry); // configure Azure Client to use customMetricsOptions - it will use meterProvider // to create meters and instruments diff --git a/sdk/core/azure-core-metrics-opentelemetry/pom.xml b/sdk/core/azure-core-metrics-opentelemetry/pom.xml index f3eeda546dce..c0ec62ea4941 100644 --- a/sdk/core/azure-core-metrics-opentelemetry/pom.xml +++ b/sdk/core/azure-core-metrics-opentelemetry/pom.xml @@ -141,7 +141,6 @@ io.opentelemetry:opentelemetry-sdk-testing:[1.28.0] io.opentelemetry:opentelemetry-exporter-logging:[1.28.0] io.opentelemetry:opentelemetry-exporter-otlp:[1.28.0] - io.opentelemetry:opentelemetry-exporter-jaeger:[1.28.0] diff --git a/sdk/core/azure-core-metrics-opentelemetry/src/main/java/com/azure/core/metrics/opentelemetry/OpenTelemetryMeterProvider.java b/sdk/core/azure-core-metrics-opentelemetry/src/main/java/com/azure/core/metrics/opentelemetry/OpenTelemetryMeterProvider.java index 48ed6e292360..11b081910de2 100644 --- a/sdk/core/azure-core-metrics-opentelemetry/src/main/java/com/azure/core/metrics/opentelemetry/OpenTelemetryMeterProvider.java +++ b/sdk/core/azure-core-metrics-opentelemetry/src/main/java/com/azure/core/metrics/opentelemetry/OpenTelemetryMeterProvider.java @@ -68,7 +68,7 @@ public OpenTelemetryMeterProvider() { * .registerMetricReader(PeriodicMetricReader.builder(OtlpGrpcMetricExporter.builder().build()).build()) * .build(); * - * OpenTelemetry openTelemetry = OpenTelemetrySdk.builder() + * OpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder() * .setTracerProvider(tracerProvider) * .setMeterProvider(meterProvider) * .setPropagators(ContextPropagators.create(W3CTraceContextPropagator.getInstance())) diff --git a/sdk/core/azure-core-metrics-opentelemetry/src/samples/java/com/azure/core/metrics/opentelemetry/MetricsJavaDocCodeSnippets.java b/sdk/core/azure-core-metrics-opentelemetry/src/samples/java/com/azure/core/metrics/opentelemetry/MetricsJavaDocCodeSnippets.java index cd9b07106b3c..448bd2e59a7b 100644 --- a/sdk/core/azure-core-metrics-opentelemetry/src/samples/java/com/azure/core/metrics/opentelemetry/MetricsJavaDocCodeSnippets.java +++ b/sdk/core/azure-core-metrics-opentelemetry/src/samples/java/com/azure/core/metrics/opentelemetry/MetricsJavaDocCodeSnippets.java @@ -11,7 +11,6 @@ import com.azure.core.util.metrics.Meter; import com.azure.core.util.metrics.MeterProvider; import io.opentelemetry.api.GlobalOpenTelemetry; -import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator; @@ -93,9 +92,10 @@ public void readmeSampleCustomSdkConfiguration() { .registerMetricReader(PeriodicMetricReader.builder(OtlpGrpcMetricExporter.builder().build()).build()) .build(); + OpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder().setMeterProvider(meterProvider).build(); // Pass OpenTelemetry instance to MetricsOptions. MetricsOptions customMetricsOptions = new OpenTelemetryMetricsOptions() - .setOpenTelemetry(OpenTelemetrySdk.builder().setMeterProvider(meterProvider).build()); + .setOpenTelemetry(openTelemetry); // configure Azure Client to use customMetricsOptions - it will use meterProvider // to create meters and instruments @@ -108,6 +108,7 @@ public void readmeSampleCustomSdkConfiguration() { sampleClient.methodCall("get items"); // END: readme-sample-customConfiguration + openTelemetry.close(); } /** @@ -125,7 +126,7 @@ public void configureClientLibraryToUseCustomMeter() { .registerMetricReader(PeriodicMetricReader.builder(OtlpGrpcMetricExporter.builder().build()).build()) .build(); - OpenTelemetry openTelemetry = OpenTelemetrySdk.builder() + OpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder() .setTracerProvider(tracerProvider) .setMeterProvider(meterProvider) .setPropagators(ContextPropagators.create(W3CTraceContextPropagator.getInstance())) @@ -157,6 +158,7 @@ public void configureClientLibraryToUseCustomMeter() { span.end(); // END: com.azure.core.util.metrics.OpenTelemetryMeterProvider.createMeter#custom + openTelemetry.close(); } /** diff --git a/sdk/core/azure-core-serializer-json-gson/src/main/java/com/azure/core/serializer/json/gson/implementation/JsonSerializableTypeAdapter.java b/sdk/core/azure-core-serializer-json-gson/src/main/java/com/azure/core/serializer/json/gson/implementation/JsonSerializableTypeAdapter.java index 0c852342e6ed..04156b6ba6d7 100644 --- a/sdk/core/azure-core-serializer-json-gson/src/main/java/com/azure/core/serializer/json/gson/implementation/JsonSerializableTypeAdapter.java +++ b/sdk/core/azure-core-serializer-json-gson/src/main/java/com/azure/core/serializer/json/gson/implementation/JsonSerializableTypeAdapter.java @@ -3,6 +3,7 @@ package com.azure.core.serializer.json.gson.implementation; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonSerializable; @@ -11,8 +12,6 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; /** * Implementation of GSON's {@link TypeAdapter} that is capable of handling {@link JsonSerializable} types. @@ -21,7 +20,7 @@ public class JsonSerializableTypeAdapter extends TypeAdapter private static final ClientLogger LOGGER = new ClientLogger(JsonSerializableTypeAdapter.class); private final Class> jsonSerializableType; - private final MethodHandle readJson; + private final ReflectiveInvoker readJson; /** * Creates an instance of {@link JsonSerializableTypeAdapter}. @@ -32,9 +31,8 @@ public class JsonSerializableTypeAdapter extends TypeAdapter public JsonSerializableTypeAdapter(Class> jsonSerializableType) { this.jsonSerializableType = jsonSerializableType; try { - MethodHandles.Lookup lookup = ReflectionUtils.getLookupToUse(jsonSerializableType); - this.readJson = lookup.unreflect(jsonSerializableType.getDeclaredMethod("fromJson", - com.azure.json.JsonReader.class)); + this.readJson = ReflectionUtils.getMethodInvoker(jsonSerializableType, + jsonSerializableType.getDeclaredMethod("fromJson", com.azure.json.JsonReader.class)); } catch (Exception e) { throw LOGGER.logExceptionAsError(new IllegalStateException(e)); } @@ -49,13 +47,11 @@ public void write(JsonWriter out, JsonSerializable value) throws IOException public JsonSerializable read(JsonReader in) throws IOException { try { return jsonSerializableType.cast(readJson.invokeWithArguments(new GsonJsonReader(in, null, true))); - } catch (Throwable e) { - if (e instanceof IOException) { - throw (IOException) e; - } else if (e instanceof Exception) { - throw new IOException(e); + } catch (Exception exception) { + if (exception instanceof IOException) { + throw (IOException) exception; } else { - throw (Error) e; + throw new IOException(exception); } } } diff --git a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/HeaderCollectionHandler.java b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/HeaderCollectionHandler.java index cef46213aaa6..2c69f6ba9f5f 100644 --- a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/HeaderCollectionHandler.java +++ b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/HeaderCollectionHandler.java @@ -3,14 +3,12 @@ package com.azure.core.serializer.json.jackson.implementation; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.security.PrivilegedAction; import java.util.HashMap; import java.util.Locale; @@ -22,10 +20,10 @@ */ final class HeaderCollectionHandler { private static final int CACHE_SIZE_LIMIT = 10000; - private static final Map FIELD_TO_SETTER_CACHE = new ConcurrentHashMap<>(); + private static final Map FIELD_TO_SETTER_INVOKER_CACHE = new ConcurrentHashMap<>(); // Dummy constant that indicates no setter was found for the Field. - private static final MethodHandle NO_SETTER_HANDLE = MethodHandles.identity(HeaderCollectionHandler.class); + private static final ReflectiveInvoker NO_SETTER_REFLECTIVE_INVOKER = ReflectionUtils.createNoOpInvoker(); private final String prefix; private final int prefixLength; @@ -86,24 +84,23 @@ private boolean usePublicSetter(Object deserializedHeaders, ClientLogger logger) final String clazzSimpleName = clazz.getSimpleName(); final String fieldName = declaringField.getName(); - MethodHandle setterHandler = getFromCache(declaringField, clazz, clazzSimpleName, fieldName, logger); + ReflectiveInvoker + setterReflectiveInvoker = getFromCache(declaringField, clazz, clazzSimpleName, fieldName, logger); - if (setterHandler == NO_SETTER_HANDLE) { + if (setterReflectiveInvoker == NO_SETTER_REFLECTIVE_INVOKER) { return false; } try { - setterHandler.invokeWithArguments(deserializedHeaders, values); - logger.verbose("Set header collection {} on class {} using MethodHandle.", fieldName, clazzSimpleName); + setterReflectiveInvoker.invokeWithArguments(deserializedHeaders, values); + logger.log(LogLevel.VERBOSE, () -> + "Set header collection " + fieldName + " on class " + clazzSimpleName + " using reflection."); return true; - } catch (Throwable ex) { - if (ex instanceof Error) { - throw (Error) ex; - } - - logger.verbose("Failed to set header {} collection on class {} using MethodHandle.", fieldName, - clazzSimpleName, ex); + } catch (Exception ex) { + logger.log(LogLevel.VERBOSE, () -> + "Failed to set header " + fieldName + " collection on class " + clazzSimpleName + " using reflection.", + ex); return false; } } @@ -112,58 +109,27 @@ private static String getPotentialSetterName(String fieldName) { return "set" + fieldName.substring(0, 1).toUpperCase(Locale.ROOT) + fieldName.substring(1); } - private static MethodHandle getFromCache(Field key, Class clazz, String clazzSimpleName, + private static ReflectiveInvoker getFromCache(Field key, Class clazz, String clazzSimpleName, String fieldName, ClientLogger logger) { - if (FIELD_TO_SETTER_CACHE.size() >= CACHE_SIZE_LIMIT) { - FIELD_TO_SETTER_CACHE.clear(); + if (FIELD_TO_SETTER_INVOKER_CACHE.size() >= CACHE_SIZE_LIMIT) { + FIELD_TO_SETTER_INVOKER_CACHE.clear(); } - return FIELD_TO_SETTER_CACHE.computeIfAbsent(key, field -> { - MethodHandles.Lookup lookupToUse; - try { - lookupToUse = ReflectionUtils.getLookupToUse(clazz); - } catch (Exception ex) { - logger.verbose("Failed to retrieve MethodHandles.Lookup for field {}. Will attempt to make field accessible.", field, ex); - - // In a previous implementation compute returned null here in an attempt to indicate that there is no - // setter for the field. Unfortunately, null isn't a valid indicator to computeIfAbsent that a - // computation has been performed and this cache would never effectively be a cache as compute would - // always be performed when there was no setter for the field. - // - // Now the implementation returns a dummy constant when there is no setter for the field. This now - // results in this case properly inserting into the cache and only running when a new type is seen or - // the cache is cleared due to reaching capacity. - return NO_SETTER_HANDLE; - } - + return FIELD_TO_SETTER_INVOKER_CACHE.computeIfAbsent(key, field -> { String setterName = getPotentialSetterName(fieldName); try { - MethodHandle handle = lookupToUse.findVirtual(clazz, setterName, - MethodType.methodType(clazz, Map.class)); + ReflectiveInvoker reflectiveInvoker = ReflectionUtils.getMethodInvoker(clazz, clazz.getDeclaredMethod(setterName, + Map.class)); - logger.verbose("Using MethodHandle for setter {} on class {}.", setterName, clazzSimpleName); + logger.log(LogLevel.VERBOSE, () -> + "Using invoker for setter " + setterName + " on class " + clazzSimpleName + "."); - return handle; - } catch (ReflectiveOperationException ex) { - logger.verbose("Failed to retrieve MethodHandle for setter {} on class {}. " - + "Will attempt to make field accessible. " - + "Please consider adding public setter.", setterName, - clazzSimpleName, ex); - } - - try { - Method setterMethod = clazz.getDeclaredMethod(setterName, Map.class); - MethodHandle handle = lookupToUse.unreflect(setterMethod); - - logger.verbose("Using unreflected MethodHandle for setter {} on class {}.", setterName, - clazzSimpleName); - - return handle; - } catch (ReflectiveOperationException ex) { - logger.verbose("Failed to unreflect MethodHandle for setter {} on class {}." - + "Will attempt to make field accessible. " - + "Please consider adding public setter.", setterName, clazzSimpleName, ex); + return reflectiveInvoker; + } catch (Exception ex) { + logger.log(LogLevel.VERBOSE, () -> + "Failed to retrieve invoker for setter " + setterName + " on class " + clazzSimpleName + + ". Will attempt to make field accessible. Please consider adding public setter.", ex); } // In a previous implementation compute returned null here in an attempt to indicate that there is no setter @@ -174,7 +140,7 @@ private static MethodHandle getFromCache(Field key, Class clazz, String clazz // Now the implementation returns a dummy constant when there is no setter for the field. This now results // in this case properly inserting into the cache and only running when a new type is seen or the cache is // cleared due to reaching capacity. - return NO_SETTER_HANDLE; + return NO_SETTER_REFLECTIVE_INVOKER; }); } } diff --git a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/JacksonDatabind215.java b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/JacksonDatabind215.java index 484dfca356d3..f6ed1cde6b7c 100644 --- a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/JacksonDatabind215.java +++ b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/JacksonDatabind215.java @@ -3,13 +3,12 @@ package com.azure.core.serializer.json.jackson.implementation; +import com.azure.core.implementation.ReflectiveInvoker; +import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; - /** * Utility methods for Jackson Databind types when it's known that the version is 2.15+. */ @@ -18,39 +17,38 @@ final class JacksonDatabind215 { private static final String STREAM_READ_CONSTRAINTS = "com.fasterxml.jackson.core.StreamReadConstraints"; private static final String STREAM_READ_CONSTRAINTS_BUILDER = STREAM_READ_CONSTRAINTS + "$Builder"; - private static final MethodHandle CREATE_STREAM_READ_CONSTRAINTS_BUILDER; - private static final MethodHandle SET_MAX_STRING_LENGTH; - private static final MethodHandle BUILD_STREAM_READ_CONSTRAINTS; - private static final MethodHandle SET_STREAM_READ_CONSTRAINTS; + private static final ReflectiveInvoker CREATE_STREAM_READ_CONSTRAINTS_BUILDER; + private static final ReflectiveInvoker SET_MAX_STRING_LENGTH; + private static final ReflectiveInvoker BUILD_STREAM_READ_CONSTRAINTS; + private static final ReflectiveInvoker SET_STREAM_READ_CONSTRAINTS; private static final boolean USE_JACKSON_215; static { - MethodHandles.Lookup publicLookup = MethodHandles.publicLookup(); ClassLoader thisClassLoader = JacksonDatabind215.class.getClassLoader(); - MethodHandle createStreamReadConstraintsBuilder = null; - MethodHandle setMaxStringLength = null; - MethodHandle buildStreamReadConstraints = null; - MethodHandle setStreamReadConstraints = null; + ReflectiveInvoker createStreamReadConstraintsBuilder = null; + ReflectiveInvoker setMaxStringLength = null; + ReflectiveInvoker buildStreamReadConstraints = null; + ReflectiveInvoker setStreamReadConstraints = null; boolean useJackson215 = false; try { Class streamReadConstraints = Class.forName(STREAM_READ_CONSTRAINTS, true, thisClassLoader); Class streamReadConstraintsBuilder = Class.forName(STREAM_READ_CONSTRAINTS_BUILDER, true, thisClassLoader); - createStreamReadConstraintsBuilder = publicLookup.unreflect(streamReadConstraints - .getDeclaredMethod("builder")); - setMaxStringLength = publicLookup.unreflect(streamReadConstraintsBuilder - .getDeclaredMethod("maxStringLength", int.class)); - buildStreamReadConstraints = publicLookup.unreflect(streamReadConstraintsBuilder - .getDeclaredMethod("build")); - setStreamReadConstraints = publicLookup.unreflect(JsonFactory.class.getDeclaredMethod( - "setStreamReadConstraints", streamReadConstraints)); + createStreamReadConstraintsBuilder = ReflectionUtils.getMethodInvoker(streamReadConstraints, + streamReadConstraints.getDeclaredMethod("builder"), false); + setMaxStringLength = ReflectionUtils.getMethodInvoker(streamReadConstraintsBuilder, + streamReadConstraintsBuilder.getDeclaredMethod("maxStringLength", int.class), false); + buildStreamReadConstraints = ReflectionUtils.getMethodInvoker(streamReadConstraintsBuilder, + streamReadConstraintsBuilder.getDeclaredMethod("build"), false); + setStreamReadConstraints = ReflectionUtils.getMethodInvoker(JsonFactory.class, + JsonFactory.class.getDeclaredMethod("setStreamReadConstraints", streamReadConstraints), false); useJackson215 = true; } catch (Throwable ex) { if (ex instanceof LinkageError) { - LOGGER.info("Attempted to create MethodHandles for Jackson 2.15 features but failed. It's possible " + LOGGER.info("Attempted to create invokers for Jackson 2.15 features but failed. It's possible " + "that your application will run without error even with this failure. The Azure SDKs only set " + "updated StreamReadConstraints to allow for larger payloads to be handled."); } else if (ex instanceof Error) { @@ -79,18 +77,18 @@ static ObjectMapper mutateStreamReadConstraints(ObjectMapper objectMapper) { } try { - Object streamReadConstraintsBuilder = CREATE_STREAM_READ_CONSTRAINTS_BUILDER.invoke(); + Object streamReadConstraintsBuilder = CREATE_STREAM_READ_CONSTRAINTS_BUILDER.invokeStatic(); - SET_MAX_STRING_LENGTH.invoke(streamReadConstraintsBuilder, 50 * 1024 * 1024); - SET_STREAM_READ_CONSTRAINTS.invoke(objectMapper.tokenStreamFactory(), - BUILD_STREAM_READ_CONSTRAINTS.invoke(streamReadConstraintsBuilder)); + SET_MAX_STRING_LENGTH.invokeWithArguments(streamReadConstraintsBuilder, 50 * 1024 * 1024); + SET_STREAM_READ_CONSTRAINTS.invokeWithArguments(objectMapper.tokenStreamFactory(), + BUILD_STREAM_READ_CONSTRAINTS.invokeWithArguments(streamReadConstraintsBuilder)); return objectMapper; - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; + } catch (Exception exception) { + if (exception instanceof RuntimeException) { + throw LOGGER.logExceptionAsError((RuntimeException) exception); } else { - throw LOGGER.logExceptionAsError(new IllegalStateException(throwable)); + throw LOGGER.logExceptionAsError(new IllegalStateException(exception)); } } } diff --git a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/JsonSerializableDeserializer.java b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/JsonSerializableDeserializer.java index e853091bd0ea..27e2c9528b6e 100644 --- a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/JsonSerializableDeserializer.java +++ b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/JsonSerializableDeserializer.java @@ -3,6 +3,7 @@ package com.azure.core.serializer.json.jackson.implementation; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; @@ -12,14 +13,12 @@ import com.fasterxml.jackson.databind.JsonDeserializer; import java.io.IOException; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; public class JsonSerializableDeserializer extends JsonDeserializer> { private static final ClientLogger LOGGER = new ClientLogger(JsonSerializableDeserializer.class); private final Class> jsonSerializableType; - private final MethodHandle readJson; + private final ReflectiveInvoker readJson; /** * Creates an instance of {@link JsonSerializableDeserializer}. @@ -29,8 +28,8 @@ public class JsonSerializableDeserializer extends JsonDeserializer> jsonSerializableType) { this.jsonSerializableType = jsonSerializableType; try { - MethodHandles.Lookup lookup = ReflectionUtils.getLookupToUse(jsonSerializableType); - this.readJson = lookup.unreflect(jsonSerializableType.getDeclaredMethod("fromJson", JsonReader.class)); + this.readJson = ReflectionUtils.getMethodInvoker(jsonSerializableType, + jsonSerializableType.getDeclaredMethod("fromJson", JsonReader.class)); } catch (Exception e) { throw LOGGER.logExceptionAsError(new IllegalStateException(e)); } @@ -41,13 +40,11 @@ public JsonSerializable deserialize(JsonParser p, DeserializationContext ctxt try { return jsonSerializableType.cast(readJson.invokeWithArguments( new JacksonJsonReader(p, null, null, false, null))); - } catch (Throwable e) { - if (e instanceof IOException) { - throw (IOException) e; - } else if (e instanceof Exception) { - throw new IOException(e); + } catch (Exception exception) { + if (exception instanceof IOException) { + throw (IOException) exception; } else { - throw (Error) e; + throw new IOException(exception); } } } diff --git a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/ObjectMapperShim.java b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/ObjectMapperShim.java index b3aeb77a4e47..3b538021a5ef 100644 --- a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/ObjectMapperShim.java +++ b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/ObjectMapperShim.java @@ -6,6 +6,7 @@ import com.azure.core.annotation.HeaderCollection; import com.azure.core.http.HttpHeader; import com.azure.core.http.HttpHeaders; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.implementation.TypeUtil; import com.azure.core.util.logging.ClientLogger; @@ -16,8 +17,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.ParameterizedType; @@ -43,11 +42,11 @@ public final class ObjectMapperShim { private static final int CACHE_SIZE_LIMIT = 10000; private static final Map TYPE_TO_JAVA_TYPE_CACHE = new ConcurrentHashMap<>(); - private static final Map TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE + private static final Map TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE = new ConcurrentHashMap<>(); // Dummy constant that indicates an HttpHeaders-based constructor wasn't found for the Type. - private static final MethodHandle NO_CONSTRUCTOR_HANDLE = MethodHandles.identity(ObjectMapperShim.class); + private static final ReflectiveInvoker NO_CONSTRUCTOR_REFLECTIVE_INVOKER = ReflectionUtils.createNoOpInvoker(); /** * Creates the JSON {@code ObjectMapper} capable of serializing azure.core types, with flattening and additional @@ -284,22 +283,18 @@ public T deserialize(HttpHeaders headers, Type deserializedHeadersType) thro } try { - MethodHandle constructor = getFromHeadersConstructorCache(deserializedHeadersType); + ReflectiveInvoker constructor = getFromHeadersConstructorCache(deserializedHeadersType); - if (constructor != NO_CONSTRUCTOR_HANDLE) { + if (constructor != NO_CONSTRUCTOR_REFLECTIVE_INVOKER) { return (T) constructor.invokeWithArguments(headers); } - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; - } - + } catch (Exception exception) { // invokeWithArguments will fail with a non-RuntimeException if the reflective call was invalid. - if (throwable instanceof RuntimeException) { - throw (RuntimeException) throwable; + if (exception instanceof RuntimeException) { + throw (RuntimeException) exception; } - LOGGER.verbose("Failed to find or use MethodHandle Constructor that accepts HttpHeaders for " + LOGGER.verbose("Failed to find or use invoker Constructor that accepts HttpHeaders for " + deserializedHeadersType + "."); } @@ -414,7 +409,7 @@ private static JavaType getFromTypeCache(Type key, Function comp return TYPE_TO_JAVA_TYPE_CACHE.computeIfAbsent(key, compute); } - private static MethodHandle getFromHeadersConstructorCache(Type key) { + private static ReflectiveInvoker getFromHeadersConstructorCache(Type key) { if (TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE.size() >= CACHE_SIZE_LIMIT) { TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE.clear(); } @@ -422,8 +417,8 @@ private static MethodHandle getFromHeadersConstructorCache(Type key) { return TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE.computeIfAbsent(key, type -> { try { Class headersClass = TypeUtil.getRawClass(type); - MethodHandles.Lookup lookup = ReflectionUtils.getLookupToUse(headersClass); - return lookup.unreflectConstructor(headersClass.getDeclaredConstructor(HttpHeaders.class)); + return ReflectionUtils.getConstructorInvoker(headersClass, + headersClass.getDeclaredConstructor(HttpHeaders.class)); } catch (Throwable throwable) { if (throwable instanceof Error) { throw (Error) throwable; @@ -439,7 +434,7 @@ private static MethodHandle getFromHeadersConstructorCache(Type key) { // new type is seen or the cache is cleared due to reaching capacity. // // With this change, benchmarking deserialize(HttpHeaders, Type) saw a 20% performance improvement. - return NO_CONSTRUCTOR_HANDLE; + return NO_CONSTRUCTOR_REFLECTIVE_INVOKER; } }); } diff --git a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/XmlMapperFactory.java b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/XmlMapperFactory.java index f208d4f6ea2d..d2f442afbbcd 100644 --- a/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/XmlMapperFactory.java +++ b/sdk/core/azure-core-serializer-json-jackson/src/main/java/com/azure/core/serializer/json/jackson/implementation/XmlMapperFactory.java @@ -3,14 +3,14 @@ package com.azure.core.serializer.json.jackson.implementation; +import com.azure.core.implementation.ReflectiveInvoker; +import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.logging.LogLevel; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.cfg.MapperBuilder; import com.fasterxml.jackson.databind.cfg.PackageVersion; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.lang.reflect.Array; public final class XmlMapperFactory { @@ -20,11 +20,11 @@ public final class XmlMapperFactory { private static final String XML_MAPPER_BUILDER = "com.fasterxml.jackson.dataformat.xml.XmlMapper$Builder"; private static final String FROM_XML_PARSER = "com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser$Feature"; private static final String TO_XML_GENERATOR = "com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator$Feature"; - private final MethodHandle createXmlMapperBuilder; - private final MethodHandle defaultUseWrapper; - private final MethodHandle enableWriteXmlDeclaration; + private final ReflectiveInvoker createXmlMapperBuilder; + private final ReflectiveInvoker defaultUseWrapper; + private final ReflectiveInvoker enableWriteXmlDeclaration; private final Object writeXmlDeclaration; - private final MethodHandle enableEmptyElementAsNull; + private final ReflectiveInvoker enableEmptyElementAsNull; private final Object emptyElementAsNull; private final boolean useJackson212; @@ -33,13 +33,11 @@ public final class XmlMapperFactory { public static final XmlMapperFactory INSTANCE = new XmlMapperFactory(); private XmlMapperFactory() { - MethodHandles.Lookup publicLookup = MethodHandles.publicLookup(); - - MethodHandle createXmlMapperBuilder; - MethodHandle defaultUseWrapper; - MethodHandle enableWriteXmlDeclaration; + ReflectiveInvoker createXmlMapperBuilder; + ReflectiveInvoker defaultUseWrapper; + ReflectiveInvoker enableWriteXmlDeclaration; Object writeXmlDeclaration; - MethodHandle enableEmptyElementAsNull; + ReflectiveInvoker enableEmptyElementAsNull; Object emptyElementAsNull; try { Class xmlMapper = Class.forName(XML_MAPPER); @@ -47,15 +45,16 @@ private XmlMapperFactory() { Class fromXmlParser = Class.forName(FROM_XML_PARSER); Class toXmlGenerator = Class.forName(TO_XML_GENERATOR); - createXmlMapperBuilder = publicLookup.unreflect(xmlMapper.getDeclaredMethod("builder")); - defaultUseWrapper = publicLookup.unreflect(xmlMapperBuilder.getDeclaredMethod("defaultUseWrapper", - boolean.class)); + createXmlMapperBuilder = ReflectionUtils.getMethodInvoker(xmlMapper, + xmlMapper.getDeclaredMethod("builder"), false); + defaultUseWrapper = ReflectionUtils.getMethodInvoker(xmlMapperBuilder, + xmlMapperBuilder.getDeclaredMethod("defaultUseWrapper", boolean.class), false); - enableWriteXmlDeclaration = publicLookup.unreflect(xmlMapperBuilder.getDeclaredMethod("enable", - Array.newInstance(toXmlGenerator, 0).getClass())); + enableWriteXmlDeclaration = ReflectionUtils.getMethodInvoker(xmlMapperBuilder, + xmlMapperBuilder.getDeclaredMethod("enable", Array.newInstance(toXmlGenerator, 0).getClass()), false); writeXmlDeclaration = toXmlGenerator.getDeclaredField("WRITE_XML_DECLARATION").get(null); - enableEmptyElementAsNull = publicLookup.unreflect(xmlMapperBuilder.getDeclaredMethod("enable", - Array.newInstance(fromXmlParser, 0).getClass())); + enableEmptyElementAsNull = ReflectionUtils.getMethodInvoker(xmlMapperBuilder, + xmlMapperBuilder.getDeclaredMethod("enable", Array.newInstance(fromXmlParser, 0).getClass()), false); emptyElementAsNull = fromXmlParser.getDeclaredField("EMPTY_ELEMENT_AS_NULL").get(null); } catch (Throwable ex) { // Throw the Error only if it isn't a LinkageError. @@ -64,7 +63,7 @@ private XmlMapperFactory() { throw (Error) ex; } - throw LOGGER.logExceptionAsError(new IllegalStateException("Failed to retrieve MethodHandles used to " + throw LOGGER.logExceptionAsError(new IllegalStateException("Failed to retrieve invokers used to " + "create XmlMapper. XML serialization won't be supported until " + "'com.fasterxml.jackson.dataformat:jackson-dataformat-xml' is added to the classpath or updated to a " + "supported version. " + JacksonVersion.getHelpInfo(), ex)); @@ -84,7 +83,7 @@ public ObjectMapper createXmlMapper() { ObjectMapper xmlMapper; try { MapperBuilder xmlMapperBuilder = ObjectMapperFactory - .initializeMapperBuilder((MapperBuilder) createXmlMapperBuilder.invoke()); + .initializeMapperBuilder((MapperBuilder) createXmlMapperBuilder.invokeStatic()); defaultUseWrapper.invokeWithArguments(xmlMapperBuilder, false); enableWriteXmlDeclaration.invokeWithArguments(xmlMapperBuilder, writeXmlDeclaration); @@ -96,12 +95,8 @@ public ObjectMapper createXmlMapper() { enableEmptyElementAsNull.invokeWithArguments(xmlMapperBuilder, emptyElementAsNull); xmlMapper = xmlMapperBuilder.build(); - } catch (Throwable e) { - if (e instanceof Error) { - throw (Error) e; - } - - throw LOGGER.logExceptionAsError(new IllegalStateException("Unable to create XmlMapper instance.", e)); + } catch (Exception ex) { + throw LOGGER.logExceptionAsError(new IllegalStateException("Unable to create XmlMapper instance.", ex)); } if (useJackson212 && jackson212IsSafe) { diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/TestProxyPlaybackClient.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/TestProxyPlaybackClient.java index 5864ee515c38..33176ae08d45 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/TestProxyPlaybackClient.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/TestProxyPlaybackClient.java @@ -36,9 +36,9 @@ import static com.azure.core.test.implementation.TestingHelpers.X_RECORDING_FILE_LOCATION; import static com.azure.core.test.implementation.TestingHelpers.X_RECORDING_ID; import static com.azure.core.test.utils.TestProxyUtils.checkForTestProxyErrors; +import static com.azure.core.test.utils.TestProxyUtils.createAddSanitizersRequest; import static com.azure.core.test.utils.TestProxyUtils.getAssetJsonFile; import static com.azure.core.test.utils.TestProxyUtils.getMatcherRequests; -import static com.azure.core.test.utils.TestProxyUtils.getSanitizerRequests; import static com.azure.core.test.utils.TestProxyUtils.loadSanitizers; /** @@ -81,10 +81,10 @@ public TestProxyPlaybackClient(HttpClient httpClient, boolean skipRecordingReque * @throws RuntimeException Failed to serialize body payload. */ public Queue startPlayback(File recordFile, Path testClassPath) { - HttpRequest request = null; + HttpRequest request; String assetJsonPath = getAssetJsonFile(recordFile, testClassPath); try { - request = new HttpRequest(HttpMethod.POST, String.format("%s/playback/start", proxyUrl)) + request = new HttpRequest(HttpMethod.POST, proxyUrl + "/playback/start") .setBody(SERIALIZER.serialize(new RecordFilePayload(recordFile.toString(), assetJsonPath), SerializerEncoding.JSON)) .setHeader(HttpHeaderName.ACCEPT, "application/json") @@ -92,12 +92,12 @@ public Queue startPlayback(File recordFile, Path testClassPath) { } catch (IOException e) { throw new RuntimeException(e); } + try (HttpResponse response = client.sendSync(request, Context.NONE)) { checkForTestProxyErrors(response); xRecordingId = response.getHeaderValue(X_RECORDING_ID); - xRecordingFileLocation - = new String(Base64.getUrlDecoder().decode( - response.getHeaders().get(X_RECORDING_FILE_LOCATION).getValue()), StandardCharsets.UTF_8); + xRecordingFileLocation = new String(Base64.getUrlDecoder().decode( + response.getHeaders().getValue(X_RECORDING_FILE_LOCATION)), StandardCharsets.UTF_8); addProxySanitization(this.sanitizers); addMatcherRequests(this.matchers); String body = response.getBodyAsString().block(); @@ -131,9 +131,9 @@ public Queue startPlayback(File recordFile, Path testClassPath) { * Stops playback of a test recording. */ public void stopPlayback() { - HttpRequest request = new HttpRequest(HttpMethod.POST, String.format("%s/playback/stop", proxyUrl.toString())) + HttpRequest request = new HttpRequest(HttpMethod.POST, proxyUrl + "/playback/stop") .setHeader(X_RECORDING_ID, xRecordingId); - client.sendSync(request, Context.NONE); + client.sendSync(request, Context.NONE).close(); } /** @@ -189,11 +189,10 @@ public HttpResponse sendSync(HttpRequest request, Context context) { */ public void addProxySanitization(List sanitizers) { if (isPlayingBack()) { - getSanitizerRequests(sanitizers, proxyUrl) - .forEach(request -> { - request.setHeader(X_RECORDING_ID, xRecordingId); - client.sendSync(request, Context.NONE); - }); + HttpRequest request = createAddSanitizersRequest(sanitizers, proxyUrl) + .setHeader(X_RECORDING_ID, xRecordingId); + + client.sendSync(request, Context.NONE).close(); } else { this.sanitizers.addAll(sanitizers); } @@ -211,7 +210,7 @@ public void addMatcherRequests(List matchers) { } matcherRequests.forEach(request -> { request.setHeader(X_RECORDING_ID, xRecordingId); - client.sendSync(request, Context.NONE); + client.sendSync(request, Context.NONE).close(); }); } else { this.matchers.addAll(matchers); diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/TestProxyRecordPolicy.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/TestProxyRecordPolicy.java index 2b852dca3bb0..b1bcf125ba88 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/TestProxyRecordPolicy.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/TestProxyRecordPolicy.java @@ -12,8 +12,8 @@ import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.test.models.TestProxyRecordingOptions; import com.azure.core.test.models.RecordFilePayload; +import com.azure.core.test.models.TestProxyRecordingOptions; import com.azure.core.test.models.TestProxySanitizer; import com.azure.core.test.utils.HttpURLConnectionHttpClient; import com.azure.core.test.utils.TestProxyUtils; @@ -21,7 +21,6 @@ import com.azure.core.util.serializer.JacksonAdapter; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import reactor.core.publisher.Mono; @@ -30,13 +29,12 @@ import java.net.URL; import java.nio.file.Path; import java.util.ArrayList; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; import java.util.Queue; +import static com.azure.core.test.utils.TestProxyUtils.checkForTestProxyErrors; +import static com.azure.core.test.utils.TestProxyUtils.createAddSanitizersRequest; import static com.azure.core.test.utils.TestProxyUtils.getAssetJsonFile; -import static com.azure.core.test.utils.TestProxyUtils.getSanitizerRequests; import static com.azure.core.test.utils.TestProxyUtils.loadSanitizers; @@ -45,6 +43,7 @@ */ public class TestProxyRecordPolicy implements HttpPipelinePolicy { private static final SerializerAdapter SERIALIZER = new JacksonAdapter(); + private static final ObjectMapper MAPPER = new ObjectMapper(); private static final HttpHeaderName X_RECORDING_ID = HttpHeaderName.fromString("x-recording-id"); private final HttpClient client; private final URL proxyUrl; @@ -75,29 +74,31 @@ public TestProxyRecordPolicy(HttpClient httpClient, boolean skipRecordingRequest * @throws RuntimeException Failed to serialize body payload. */ public void startRecording(File recordFile, Path testClassPath) { - String assetJsonPath = getAssetJsonFile(recordFile, testClassPath); - HttpRequest request = null; try { - request = new HttpRequest(HttpMethod.POST, String.format("%s/record/start", proxyUrl.toString())) + String assetJsonPath = getAssetJsonFile(recordFile, testClassPath); + HttpRequest request = new HttpRequest(HttpMethod.POST, proxyUrl + "/record/start") .setBody(SERIALIZER.serialize(new RecordFilePayload(recordFile.toString(), assetJsonPath), SerializerEncoding.JSON)) .setHeader(HttpHeaderName.CONTENT_TYPE, "application/json"); + + try (HttpResponse response = client.sendSync(request, Context.NONE)) { + checkForTestProxyErrors(response); + + this.xRecordingId = response.getHeaderValue(X_RECORDING_ID); + } + + addProxySanitization(this.sanitizers); + setDefaultRecordingOptions(); } catch (IOException e) { throw new RuntimeException(e); } - HttpResponse response = client.sendSync(request, Context.NONE); - - this.xRecordingId = response.getHeaderValue(X_RECORDING_ID); - - addProxySanitization(this.sanitizers); - setDefaultRecordingOptions(); } private void setDefaultRecordingOptions() { - HttpRequest request = new HttpRequest(HttpMethod.POST, String.format("%s/Admin/SetRecordingOptions", proxyUrl.toString())); - request.setBody("{\"HandleRedirects\": false}"); - request.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - client.sendSync(request, Context.NONE); + HttpRequest request = new HttpRequest(HttpMethod.POST, proxyUrl + "/Admin/SetRecordingOptions") + .setBody("{\"HandleRedirects\": false}") + .setHeader(HttpHeaderName.CONTENT_TYPE, "application/json"); + client.sendSync(request, Context.NONE).close(); } /** @@ -105,11 +106,11 @@ private void setDefaultRecordingOptions() { * @param variables A list of random variables generated during the test which is saved in the recording. */ public void stopRecording(Queue variables) { - HttpRequest request = new HttpRequest(HttpMethod.POST, String.format("%s/record/stop", proxyUrl.toString())) + HttpRequest request = new HttpRequest(HttpMethod.POST, proxyUrl + "/record/stop") .setHeader(HttpHeaderName.CONTENT_TYPE, "application/json") .setHeader(X_RECORDING_ID, xRecordingId) .setBody(serializeVariables(variables)); - client.sendSync(request, Context.NONE); + client.sendSync(request, Context.NONE).close(); } /** @@ -122,16 +123,26 @@ private String serializeVariables(Queue variables) { return "{}"; } + StringBuilder builder = new StringBuilder() + .append('{'); + int count = 0; - Map map = new LinkedHashMap<>(); for (String variable : variables) { - map.put(String.valueOf(count++), variable); - } - try { - return SERIALIZER.serialize(map, SerializerEncoding.JSON); - } catch (IOException e) { - throw new RuntimeException(e); + if (count > 0) { + builder.append(','); + } + + builder.append('"').append(count).append("\":\""); + count++; + + if (variable == null) { + builder.append("null"); + } else { + builder.append('"').append(variable).append('"'); + } } + + return builder.append('}').toString(); } /** @@ -178,11 +189,10 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN */ public void addProxySanitization(List sanitizers) { if (isRecording()) { - getSanitizerRequests(sanitizers, proxyUrl) - .forEach(request -> { - request.setHeader(X_RECORDING_ID, xRecordingId); - client.sendSync(request, Context.NONE); - }); + HttpRequest request = createAddSanitizersRequest(sanitizers, proxyUrl) + .setHeader(X_RECORDING_ID, xRecordingId); + + client.sendSync(request, Context.NONE).close(); } else { this.sanitizers.addAll(sanitizers); } @@ -198,17 +208,14 @@ private boolean isRecording() { * @throws IllegalArgumentException if testProxyRecordingOptions cannot be serialized */ public void setRecordingOptions(TestProxyRecordingOptions testProxyRecordingOptions) { - HttpRequest request = new HttpRequest(HttpMethod.POST, String.format("%s/admin/setrecordingoptions", proxyUrl.toString())); - String body; try { - ObjectMapper mapper = new ObjectMapper(); - body = mapper.writeValueAsString(testProxyRecordingOptions); - } catch (JsonProcessingException ex) { + HttpRequest request = new HttpRequest(HttpMethod.POST, proxyUrl + "/admin/setrecordingoptions") + .setBody(MAPPER.writeValueAsString(testProxyRecordingOptions)) + .setHeader(HttpHeaderName.CONTENT_TYPE, "application/json"); + client.sendSync(request, Context.NONE).close(); + } catch (IOException ex) { throw new IllegalArgumentException("Failed to process JSON input", ex); } - request.setBody(body); - request.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - client.sendSync(request, Context.NONE); } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyManager.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyManager.java index 5897e43e0cf8..f073570cfaf3 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyManager.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyManager.java @@ -8,10 +8,14 @@ import com.azure.core.http.HttpResponse; import com.azure.core.util.Configuration; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.time.Duration; @@ -46,25 +50,50 @@ public TestProxyManager(Path testClassPath) { public void startProxy() { try { // if we're not running in CI we will check to see if someone has started the proxy, and start one if not. - if (runningLocally() && !checkAlive(1, Duration.ofSeconds(1))) { + if (runningLocally() && !checkAlive(1, Duration.ofSeconds(1), null)) { String commandLine = Paths.get(TestProxyDownloader.getProxyDirectory().toString(), TestProxyUtils.getProxyProcessName()).toString(); - ProcessBuilder builder = new ProcessBuilder(commandLine, - "--storage-location", - TestUtils.getRepoRootResolveUntil(testClassPath, "eng").toString()); + Path repoRoot = TestUtils.getRepoRootResolveUntil(testClassPath, "eng"); + + // Resolve the path to the repo root 'target' folder and create the folder if it doesn't exist. + // This folder will be used to store the 'test-proxy.log' file to enable simpler debugging of Test Proxy + // locally. This is similar to what CI does, but CI uses a PowerShell process to run the Test Proxy + // where running locally uses a Java ProcessBuilder. + Path repoRootTarget = repoRoot.resolve("target"); + if (!Files.exists(repoRootTarget)) { + Files.createDirectory(repoRootTarget); + } + + ProcessBuilder builder = new ProcessBuilder(commandLine, "--storage-location", repoRoot.toString()) + .redirectOutput(repoRootTarget.resolve("test-proxy.log").toFile()); Map environment = builder.environment(); - environment.put("LOGGING__LOGLEVEL", "Information"); - environment.put("LOGGING__LOGLEVEL__MICROSOFT", "Warning"); - environment.put("LOGGING__LOGLEVEL__DEFAULT", "Information"); + environment.put("LOGGING__LOGLEVEL", "Debug"); + environment.put("LOGGING__LOGLEVEL__MICROSOFT", "Debug"); + environment.put("LOGGING__LOGLEVEL__DEFAULT", "Debug"); proxy = builder.start(); } // in either case the proxy should now be started, so let's wait to make sure. - if (checkAlive(10, Duration.ofSeconds(6))) { + if (checkAlive(10, Duration.ofSeconds(6), proxy)) { return; } - throw new RuntimeException("Test proxy did not initialize."); + // If the Test Proxy process doesn't start within the timeout period read the error stream of the Process + // for any additional details that could help determine why the Test Proxy process didn't start. + // Include this additional information in the exception message. + ByteArrayOutputStream errorLog = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int read; + while ((read = proxy.getErrorStream().read(buffer)) != -1) { + errorLog.write(buffer, 0, read); + } + + String errorLogString = new String(errorLog.toByteArray(), StandardCharsets.UTF_8); + if (CoreUtils.isNullOrEmpty(errorLogString)) { + throw new RuntimeException("Test proxy did not initialize."); + } else { + throw new RuntimeException("Test proxy did not initialize. Error log: " + errorLogString); + } } catch (IOException e) { throw LOGGER.logExceptionAsError(new UncheckedIOException(e)); } catch (InterruptedException e) { @@ -72,14 +101,19 @@ public void startProxy() { } } - private boolean checkAlive(int loops, Duration waitTime) throws InterruptedException { + private static boolean checkAlive(int loops, Duration waitTime, Process proxy) throws InterruptedException { HttpURLConnectionHttpClient client = new HttpURLConnectionHttpClient(); HttpRequest request = new HttpRequest(HttpMethod.GET, String.format("%s/admin/isalive", TestProxyUtils.getProxyUrl())); for (int i = 0; i < loops; i++) { - HttpResponse response = null; + // If the proxy isn't alive and the exit value isn't 0, then the proxy process has exited with an error + // and stop waiting. + if (proxy != null && !proxy.isAlive() && proxy.exitValue() != 0) { + return false; + } + try { - response = client.sendSync(request, Context.NONE); + HttpResponse response = client.sendSync(request, Context.NONE); if (response != null && response.getStatusCode() == 200) { return true; } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyUtils.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyUtils.java index f565f732f6ed..8690cf0fdf4a 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyUtils.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyUtils.java @@ -13,6 +13,7 @@ import com.azure.core.test.models.TestProxyRequestMatcher; import com.azure.core.test.models.TestProxySanitizer; import com.azure.core.test.models.TestProxySanitizerType; +import com.azure.core.util.CoreUtils; import com.azure.core.util.UrlBuilder; import com.azure.core.util.logging.ClientLogger; @@ -45,8 +46,7 @@ public class TestProxyUtils { private static final ClientLogger LOGGER = new ClientLogger(TestProxyUtils.class); private static final HttpHeaderName X_RECORDING_SKIP = HttpHeaderName.fromString("x-recording-skip"); - private static final List JSON_PROPERTIES_TO_REDACT - = new ArrayList( + private static final List JSON_PROPERTIES_TO_REDACT = new ArrayList<>( Arrays.asList("authHeader", "accountKey", "accessToken", "accountName", "applicationId", "apiKey", "connectionString", "url", "host", "password", "userName")); @@ -55,18 +55,24 @@ public class TestProxyUtils { put("operation-location", URL_REGEX); }}; - private static final List BODY_REGEX_TO_REDACT - = new ArrayList<>(Arrays.asList("(?:)(?.*)(?:)", "(?:Password=)(?.*)(?:;)", - "(?:User ID=)(?.*)(?:;)", "(?:)(?.*)(?:)", - "(?:)(?.*)(?:)")); - private static final String URL_REGEX = "(?<=http://|https://)([^/?]+)"; private static final List HEADER_KEYS_TO_REDACT = new ArrayList<>(Arrays.asList("Ocp-Apim-Subscription-Key", "api-key", "x-api-key", "subscription-key")); private static final String REDACTED_VALUE = "REDACTED"; - private static final String DELEGATION_KEY_CLIENTID_REGEX = "(?:)(?.*)(?:)"; - private static final String DELEGATION_KEY_TENANTID_REGEX = "(?:)(?.*)(?:)"; + // Redacts the following JSON properties in a request or response body: + // - Password + // - User ID + private static final String JSON_BODY_REGEX_REDACTIONS = "(?:(Password|User ID)=)(?.*)(?:;)"; + + // Redacts the following XML elements in a request or response body: + // - PrimaryKey + // - SecondaryKey + // - SignedOid + // - SignedTid + // - Value + private static final String XML_BODY_REGEX_REDACTIONS = + "(?:<(PrimaryKey|SecondaryKey|SignedOid|SignedTid|Value)>)(?.*)(?:)"; private static final HttpHeaderName X_RECORDING_UPSTREAM_BASE_URI = HttpHeaderName.fromString("x-recording-upstream-base-uri"); private static final HttpHeaderName X_RECORDING_MODE = HttpHeaderName.fromString("x-recording-mode"); @@ -91,7 +97,8 @@ public class TestProxyUtils { * @param skipRecordingRequestBody Flag indicating to skip recording request bodies when tests run in Record mode. * @throws RuntimeException Construction of one of the URLs failed. */ - public static void changeHeaders(HttpRequest request, URL proxyUrl, String xRecordingId, String mode, boolean skipRecordingRequestBody) { + public static void changeHeaders(HttpRequest request, URL proxyUrl, String xRecordingId, String mode, + boolean skipRecordingRequestBody) { HttpHeader upstreamUri = request.getHeaders().get(X_RECORDING_UPSTREAM_BASE_URI); UrlBuilder proxyUrlBuilder = UrlBuilder.parse(request.getUrl()); @@ -265,7 +272,7 @@ public static List loadSanitizers() { } private static String createCustomMatcherRequestBody(CustomMatcher customMatcher) { - return String.format("{\"ignoredHeaders\":\"%s\",\"excludedHeaders\":\"%s\",\"compareBodies\":%s,\"ignoredQueryParameters\":\"%s\", \"ignoreQueryOrdering\":%s}", + return String.format("{\"ignoredHeaders\":\"%s\",\"excludedHeaders\":\"%s\",\"compareBodies\":%s,\"ignoredQueryParameters\":\"%s\",\"ignoreQueryOrdering\":%s}", getCommaSeperatedString(customMatcher.getHeadersKeyOnlyMatch()), getCommaSeperatedString(customMatcher.getExcludedHeaders()), customMatcher.isComparingBodies(), @@ -278,7 +285,7 @@ private static String getCommaSeperatedString(List stringList) { return null; } return stringList.stream() - .filter(s -> s != null && !s.isEmpty()) + .filter(s -> !CoreUtils.isNullOrEmpty(s)) .collect(Collectors.joining(",")); } @@ -320,7 +327,10 @@ private static String createRegexRequestBody(String key, String regex, String va * @param proxyUrl The proxyUrl to use when constructing requests. * @return the list of sanitizer {@link HttpRequest requests} to be sent. * @throws RuntimeException if {@link TestProxySanitizerType} is not supported. + * @deprecated Use {@link #createAddSanitizersRequest(List, URL)} instead as this will create a bulk HttpRequest + * for setting the sanitizers for a test proxy session instead of a request per sanitizer. */ + @Deprecated public static List getSanitizerRequests(List sanitizers, URL proxyUrl) { return sanitizers.stream().map(testProxySanitizer -> { String requestBody; @@ -328,43 +338,101 @@ public static List getSanitizerRequests(List sa switch (testProxySanitizer.getType()) { case URL: sanitizerType = TestProxySanitizerType.URL.getName(); - requestBody = - createRegexRequestBody(null, testProxySanitizer.getRegex(), - testProxySanitizer.getRedactedValue(), testProxySanitizer.getGroupForReplace()); + requestBody = createRegexRequestBody(null, testProxySanitizer.getRegex(), + testProxySanitizer.getRedactedValue(), testProxySanitizer.getGroupForReplace()); return createHttpRequest(requestBody, sanitizerType, proxyUrl); + case BODY_REGEX: sanitizerType = TestProxySanitizerType.BODY_REGEX.getName(); requestBody = createRegexRequestBody(null, testProxySanitizer.getRegex(), testProxySanitizer.getRedactedValue(), testProxySanitizer.getGroupForReplace()); return createHttpRequest(requestBody, sanitizerType, proxyUrl); + case BODY_KEY: sanitizerType = TestProxySanitizerType.BODY_KEY.getName(); requestBody = createBodyJsonKeyRequestBody(testProxySanitizer.getKey(), testProxySanitizer.getRegex(), testProxySanitizer.getRedactedValue()); return createHttpRequest(requestBody, sanitizerType, proxyUrl); + case HEADER: sanitizerType = HEADER.getName(); if (testProxySanitizer.getKey() == null && testProxySanitizer.getRegex() == null) { throw new RuntimeException( - String.format("Missing regexKey and/or headerKey for sanitizer type {%s}", sanitizerType)); + "Missing regexKey and/or headerKey for sanitizer type {" + sanitizerType + "}"); } requestBody = createRegexRequestBody(testProxySanitizer.getKey(), testProxySanitizer.getRegex(), testProxySanitizer.getRedactedValue(), testProxySanitizer.getGroupForReplace()); return createHttpRequest(requestBody, sanitizerType, proxyUrl); + default: - throw new RuntimeException( - String.format("Sanitizer type {%s} not supported", testProxySanitizer.getType())); + throw new RuntimeException("Sanitizer type {" + testProxySanitizer.getType() + "} not supported"); } }).collect(Collectors.toList()); } + /** + * Creates a request to bulk add sanitizers to the test proxy server. + *

+ * For more information about adding bulk sanitizers see the + * Passing Sanitizers in Bulk + * wiki. + * + * @param sanitizers The list of sanitizers to be added. + * @param proxyUrl The proxyUrl to use when constructing requests. + * @return The {@link HttpRequest request} to be sent. + * @throws RuntimeException if {@link TestProxySanitizerType} is not supported. + */ + public static HttpRequest createAddSanitizersRequest(List sanitizers, URL proxyUrl) { + List sanitizersJsonPayloads = new ArrayList<>(sanitizers.size()); + + for (TestProxySanitizer sanitizer : sanitizers) { + String requestBody; + String sanitizerType; + switch (sanitizer.getType()) { + case URL: + sanitizerType = TestProxySanitizerType.URL.getName(); + requestBody = createRegexRequestBody(null, sanitizer.getRegex(), sanitizer.getRedactedValue(), + sanitizer.getGroupForReplace()); + break; + + case BODY_REGEX: + sanitizerType = TestProxySanitizerType.BODY_REGEX.getName(); + requestBody = createRegexRequestBody(null, sanitizer.getRegex(), sanitizer.getRedactedValue(), + sanitizer.getGroupForReplace()); + break; + + case BODY_KEY: + sanitizerType = TestProxySanitizerType.BODY_KEY.getName(); + requestBody = createBodyJsonKeyRequestBody(sanitizer.getKey(), sanitizer.getRegex(), + sanitizer.getRedactedValue()); + break; + + case HEADER: + sanitizerType = HEADER.getName(); + if (sanitizer.getKey() == null && sanitizer.getRegex() == null) { + throw new RuntimeException( + "Missing regexKey and/or headerKey for sanitizer type {" + sanitizerType + "}"); + } + requestBody = createRegexRequestBody(sanitizer.getKey(), sanitizer.getRegex(), sanitizer.getRedactedValue(), + sanitizer.getGroupForReplace()); + break; + + default: + throw new RuntimeException("Sanitizer type {" + sanitizer.getType() + "} not supported"); + } + + sanitizersJsonPayloads.add("{\"Name\":\"" + sanitizerType + "\",\"Body\":" + requestBody + "}"); + } + + String requestBody = "[" + CoreUtils.stringJoin(",", sanitizersJsonPayloads) + "]"; + return new HttpRequest(HttpMethod.POST, proxyUrl + "/Admin/AddSanitizers").setBody(requestBody); + } + private static HttpRequest createHttpRequest(String requestBody, String sanitizerType, URL proxyUrl) { - HttpRequest request - = new HttpRequest(HttpMethod.POST, String.format("%s/Admin/AddSanitizer", proxyUrl.toString())) - .setBody(requestBody); - request.setHeader(X_ABSTRACTION_IDENTIFIER, sanitizerType); - return request; + return new HttpRequest(HttpMethod.POST, proxyUrl + "/Admin/AddSanitizer") + .setBody(requestBody) + .setHeader(X_ABSTRACTION_IDENTIFIER, sanitizerType); } /** @@ -381,23 +449,23 @@ public static List getMatcherRequests(List switch (testProxyMatcher.getType()) { case HEADERLESS: matcherType = TestProxyRequestMatcher.TestProxyRequestMatcherType.HEADERLESS.getName(); - request - = new HttpRequest(HttpMethod.POST, String.format("%s/Admin/setmatcher", proxyUrl.toString())); + request = new HttpRequest(HttpMethod.POST, proxyUrl + "/Admin/setmatcher"); break; + case BODILESS: - request - = new HttpRequest(HttpMethod.POST, String.format("%s/Admin/setmatcher", proxyUrl.toString())); matcherType = TestProxyRequestMatcher.TestProxyRequestMatcherType.BODILESS.getName(); + request = new HttpRequest(HttpMethod.POST, proxyUrl + "/Admin/setmatcher"); break; + case CUSTOM: CustomMatcher customMatcher = (CustomMatcher) testProxyMatcher; String requestBody = createCustomMatcherRequestBody(customMatcher); matcherType = TestProxyRequestMatcher.TestProxyRequestMatcherType.CUSTOM.getName(); - request - = new HttpRequest(HttpMethod.POST, String.format("%s/Admin/setmatcher", proxyUrl.toString())).setBody(requestBody); + request = new HttpRequest(HttpMethod.POST, proxyUrl + "/Admin/setmatcher").setBody(requestBody); break; + default: - throw new RuntimeException(String.format("Matcher type {%s} not supported", testProxyMatcher.getType())); + throw new RuntimeException("Matcher type {" + testProxyMatcher.getType() + "} not supported"); } request.setHeader(X_ABSTRACTION_IDENTIFIER, matcherType); @@ -411,9 +479,7 @@ public static List getMatcherRequests(List */ public static HttpRequest setCompareBodiesMatcher() { String requestBody = createCustomMatcherRequestBody(new CustomMatcher().setComparingBodies(false)); - HttpRequest request = - new HttpRequest(HttpMethod.POST, String.format("%s/Admin/setmatcher", proxyUrl.toString())).setBody( - requestBody); + HttpRequest request = new HttpRequest(HttpMethod.POST, proxyUrl + "/Admin/setmatcher").setBody(requestBody); request.setHeader(X_ABSTRACTION_IDENTIFIER, TestProxyRequestMatcher.TestProxyRequestMatcherType.CUSTOM.getName()); @@ -426,25 +492,22 @@ private static TestProxySanitizer addDefaultUrlSanitizer() { private static List addDefaultBodySanitizers() { return JSON_PROPERTIES_TO_REDACT.stream() - .map(jsonProperty -> - new TestProxySanitizer(String.format("$..%s", jsonProperty), null, REDACTED_VALUE, - TestProxySanitizerType.BODY_KEY)) + .map(jsonProperty -> new TestProxySanitizer("$.." + jsonProperty, null, REDACTED_VALUE, + TestProxySanitizerType.BODY_KEY)) .collect(Collectors.toList()); } private static List addDefaultRegexSanitizers() { - List regexSanitizers = getUserDelegationSanitizers(); + List regexSanitizers = new ArrayList<>(); - regexSanitizers.addAll(BODY_REGEX_TO_REDACT.stream() - .map(bodyRegex -> new TestProxySanitizer(bodyRegex, REDACTED_VALUE, TestProxySanitizerType.BODY_REGEX).setGroupForReplace("secret")) - .collect(Collectors.toList())); + regexSanitizers.add(new TestProxySanitizer(JSON_BODY_REGEX_REDACTIONS, REDACTED_VALUE, + TestProxySanitizerType.BODY_REGEX).setGroupForReplace("secret")); + regexSanitizers.add(new TestProxySanitizer(XML_BODY_REGEX_REDACTIONS, REDACTED_VALUE, + TestProxySanitizerType.BODY_REGEX).setGroupForReplace("secret")); - // add body key with regex sanitizers - List keyRegexSanitizers = new ArrayList<>(); + // Add header key regexes HEADER_KEY_REGEX_TO_REDACT.forEach((key, regex) -> - keyRegexSanitizers.add(new TestProxySanitizer(key, regex, REDACTED_VALUE, HEADER))); - - regexSanitizers.addAll(keyRegexSanitizers); + regexSanitizers.add(new TestProxySanitizer(key, regex, REDACTED_VALUE, HEADER))); return regexSanitizers; } @@ -455,11 +518,4 @@ private static List addDefaultHeaderKeySanitizers() { new TestProxySanitizer(headerKey, null, REDACTED_VALUE, HEADER)) .collect(Collectors.toList()); } - - private static List getUserDelegationSanitizers() { - List userDelegationSanitizers = new ArrayList<>(); - userDelegationSanitizers.add(new TestProxySanitizer(DELEGATION_KEY_CLIENTID_REGEX, REDACTED_VALUE, TestProxySanitizerType.BODY_REGEX).setGroupForReplace("secret")); - userDelegationSanitizers.add(new TestProxySanitizer(DELEGATION_KEY_TENANTID_REGEX, REDACTED_VALUE, TestProxySanitizerType.BODY_REGEX).setGroupForReplace("secret")); - return userDelegationSanitizers; - } } diff --git a/sdk/core/azure-core-tracing-opentelemetry-samples/pom.xml b/sdk/core/azure-core-tracing-opentelemetry-samples/pom.xml index 375b49e323d9..903b28e642a5 100644 --- a/sdk/core/azure-core-tracing-opentelemetry-samples/pom.xml +++ b/sdk/core/azure-core-tracing-opentelemetry-samples/pom.xml @@ -48,7 +48,7 @@ com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 test @@ -59,14 +59,14 @@ io.opentelemetry - opentelemetry-exporter-jaeger - 1.28.0 + opentelemetry-sdk-extension-autoconfigure + 1.28.0 test com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 test diff --git a/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/CreateConfigurationSettingLoggingExporterSample.java b/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/CreateConfigurationSettingLoggingExporterSample.java index a8cfc139a79d..5bfd36c69ed9 100644 --- a/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/CreateConfigurationSettingLoggingExporterSample.java +++ b/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/CreateConfigurationSettingLoggingExporterSample.java @@ -3,6 +3,9 @@ package com.azure.core.tracing.opentelemetry.samples; +import com.azure.core.tracing.opentelemetry.OpenTelemetryTracingOptions; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.TracingOptions; import com.azure.data.appconfiguration.ConfigurationClient; import com.azure.data.appconfiguration.ConfigurationClientBuilder; import io.opentelemetry.api.trace.Span; @@ -18,7 +21,6 @@ * in App Configuration through the {@link ConfigurationClient}. */ public class CreateConfigurationSettingLoggingExporterSample { - private static final Tracer TRACER = configureLoggingExporter(); private static final String CONNECTION_STRING = ""; /** @@ -26,22 +28,38 @@ public class CreateConfigurationSettingLoggingExporterSample { * * @param args Ignored args. */ + @SuppressWarnings("try") public static void main(String[] args) { - configureLoggingExporter(); + OpenTelemetrySdk openTelemetry = configureTracing(); + + // In this sample we configured OpenTelemetry without registering global instance, so we need to pass it explicitly to the Azure SDK. + // If we used ApplicationInsights or OpenTelemetry agent, or registered global instance, we would not need to pass it explicitly. + TracingOptions tracingOptions = new OpenTelemetryTracingOptions().setOpenTelemetry(openTelemetry); ConfigurationClient client = new ConfigurationClientBuilder() .connectionString(CONNECTION_STRING) + .clientOptions(new ClientOptions().setTracingOptions(tracingOptions)) .buildClient(); - doClientWork(client); + Tracer tracer = openTelemetry.getTracer("sample"); + + Span span = tracer.spanBuilder("my-span").startSpan(); + try (Scope s = span.makeCurrent()) { + // current span propagates into synchronous calls automatically. ApplicationInsights or OpenTelemetry agent + // also propagate context through async reactor calls. + client.setConfigurationSetting("hello", "text", "World"); + } finally { + span.end(); + } + + openTelemetry.close(); } /** - * Configure the OpenTelemetry {@link LoggingSpanExporter} to enable tracing. - * - * @return The OpenTelemetry {@link Tracer} instance. + * Configure the OpenTelemetry to print traces with {@link LoggingSpanExporter}. */ - private static Tracer configureLoggingExporter() { + private static OpenTelemetrySdk configureTracing() { + // configure OpenTelemetry explicitly or with io.opentelemetry:opentelemetry-sdk-extension-autoconfigure package SdkTracerProvider tracerProvider = SdkTracerProvider.builder() .addSpanProcessor(BatchSpanProcessor.builder(LoggingSpanExporter.create()).build()) @@ -49,23 +67,6 @@ private static Tracer configureLoggingExporter() { return OpenTelemetrySdk.builder() .setTracerProvider(tracerProvider) - .buildAndRegisterGlobal() - .getTracer("AppConfig-Sample"); - } - - /** - * Creates the {@link ConfigurationClient} and creates a configuration in Azure App Configuration with distributed - * tracing enabled and using the Logging exporter to export telemetry events. - */ - @SuppressWarnings("try") - private static void doClientWork(ConfigurationClient client) { - Span span = TRACER.spanBuilder("my-span").startSpan(); - try (Scope s = span.makeCurrent()) { - // current span propagates into synchronous calls automatically. ApplicationInsights or OpenTelemetry agent - // also propagate context through async reactor calls. - client.setConfigurationSetting("hello", "text", "World"); - } finally { - span.end(); - } + .build(); } } diff --git a/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/ListKeyVaultSecretsAutoConfigurationSample.java b/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/ListKeyVaultSecretsAutoConfigurationSample.java index c0651fc95be4..f917f5a474d9 100644 --- a/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/ListKeyVaultSecretsAutoConfigurationSample.java +++ b/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/ListKeyVaultSecretsAutoConfigurationSample.java @@ -8,11 +8,11 @@ import com.azure.security.keyvault.secrets.SecretClient; import com.azure.security.keyvault.secrets.SecretClientBuilder; import com.azure.security.keyvault.secrets.models.KeyVaultSecret; -import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Scope; -import io.opentelemetry.exporter.logging.LoggingSpanExporter; +import io.opentelemetry.sdk.OpenTelemetrySdk; +import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; import reactor.util.context.Context; import static com.azure.core.util.tracing.Tracer.PARENT_TRACE_CONTEXT_KEY; @@ -26,7 +26,8 @@ public class ListKeyVaultSecretsAutoConfigurationSample { private static final String VAULT_URL = ""; @SuppressWarnings("try") public void syncClient() { - Tracer tracer = configureTracing(); + OpenTelemetrySdk openTelemetry = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk(); + Tracer tracer = openTelemetry.getTracer("sample"); // BEGIN: readme-sample-context-auto-propagation SecretClient secretClient = new SecretClientBuilder() @@ -46,10 +47,12 @@ public void syncClient() { } // END: readme-sample-context-auto-propagation + openTelemetry.close(); } public void asyncClient() { - Tracer tracer = configureTracing(); + OpenTelemetrySdk openTelemetry = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk(); + Tracer tracer = openTelemetry.getTracer("sample"); // BEGIN: readme-sample-context-manual-propagation SecretAsyncClient secretAsyncClient = new SecretClientBuilder() @@ -73,20 +76,7 @@ public void asyncClient() { } finally { span.end(); } - // END: readme-sample-context-manual-propagation - } - - /** - * Configure the OpenTelemetry {@link LoggingSpanExporter} to enable tracing. - * - * @return The OpenTelemetry {@link Tracer} instance. - */ - private static Tracer configureTracing() { - // configure OpenTelemetry SDK using io.opentelemetry:opentelemetry-sdk-extension-autoconfigure: - // OpenTelemetrySdk sdk = AutoConfiguredOpenTelemetrySdk.initialize() - // .getOpenTelemetrySdk(); - - return GlobalOpenTelemetry.getTracer("Async-List-KV-Secrets-Sample"); + openTelemetry.close(); } } diff --git a/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/ListKeyVaultSecretsJaegerExporterSample.java b/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/ListKeyVaultSecretsJaegerExporterSample.java deleted file mode 100644 index f6a1a8796060..000000000000 --- a/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/ListKeyVaultSecretsJaegerExporterSample.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.tracing.opentelemetry.samples; - -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.security.keyvault.secrets.SecretClient; -import com.azure.security.keyvault.secrets.SecretClientBuilder; -import com.azure.security.keyvault.secrets.models.KeyVaultSecret; -import io.opentelemetry.api.trace.Span; -import io.opentelemetry.api.trace.Tracer; -import io.opentelemetry.context.Scope; -import io.opentelemetry.exporter.jaeger.JaegerGrpcSpanExporter; -import io.opentelemetry.sdk.OpenTelemetrySdk; -import io.opentelemetry.sdk.trace.SdkTracerProvider; -import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor; - -import java.time.Duration; - -/** - * Sample to demonstrate using {@link JaegerGrpcSpanExporter} to export telemetry events when asynchronously creating - * and listing secrets from a Key Vault using the {@link SecretClient}. - */ -public class ListKeyVaultSecretsJaegerExporterSample { - private static final Tracer TRACER = configureJaegerExporter(); - private static final String VAULT_URL = ""; - - /** - * The main method to run the application. - * - * @param args Ignored args. - */ - public static void main(String[] args) { - SecretClient secretClient = new SecretClientBuilder() - .vaultUrl(VAULT_URL) - .credential(new DefaultAzureCredentialBuilder().build()) - .buildClient(); - - doClientWork(secretClient); - } - - /** - * Configure the OpenTelemetry {@link JaegerGrpcSpanExporter} to enable tracing. - * - * @return The OpenTelemetry {@link Tracer} instance. - */ - private static Tracer configureJaegerExporter() { - // Export traces to Jaeger - JaegerGrpcSpanExporter jaegerExporter = - JaegerGrpcSpanExporter.builder() - .setEndpoint("http://localhost:14250") - .setTimeout(Duration.ofMinutes(30000)) - .build(); - - // Set to process the spans by the Jaeger Exporter - return OpenTelemetrySdk.builder() - .setTracerProvider( - SdkTracerProvider.builder().addSpanProcessor(SimpleSpanProcessor.create(jaegerExporter)).build()) - .buildAndRegisterGlobal() - .getTracer("List-KV-Secrets-Sample"); - } - - /** - * Create a secret and list all the secrets for a Key Vault using the - * {@link SecretClient} with distributed tracing enabled and using the Jaeger exporter to export telemetry events. - */ - @SuppressWarnings("try") - private static void doClientWork(SecretClient secretClient) { - - Span span = TRACER.spanBuilder("my-span").startSpan(); - try (Scope s = span.makeCurrent()) { - // current span propagates into synchronous calls automatically. ApplicationInsights or OpenTelemetry agent - // also propagate context through async reactor calls. - secretClient.setSecret(new KeyVaultSecret("StorageAccountPassword", "password")); - secretClient.listPropertiesOfSecrets().forEach(secretProperties -> { - KeyVaultSecret secret = secretClient.getSecret(secretProperties.getName()); - System.out.printf("Retrieved Secret with name: %s%n", secret.getName()); - }); - } finally { - span.end(); - } - } -} diff --git a/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/TracingJavaDocCodeSnippets.java b/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/TracingJavaDocCodeSnippets.java index bba479c1a55f..5bf4d5d352f4 100644 --- a/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/TracingJavaDocCodeSnippets.java +++ b/sdk/core/azure-core-tracing-opentelemetry-samples/src/samples/java/com/azure/core/tracing/opentelemetry/samples/TracingJavaDocCodeSnippets.java @@ -9,15 +9,15 @@ import com.azure.core.util.Context; import com.azure.core.util.TracingOptions; import com.azure.core.util.tracing.TracerProvider; -import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Scope; import io.opentelemetry.exporter.logging.LoggingSpanExporter; import io.opentelemetry.sdk.OpenTelemetrySdk; +import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; import io.opentelemetry.sdk.trace.SdkTracerProvider; -import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor; +import io.opentelemetry.sdk.trace.export.BatchSpanProcessor; import static com.azure.core.util.tracing.Tracer.PARENT_TRACE_CONTEXT_KEY; @@ -31,16 +31,15 @@ public void sampleGlobalSdkConfiguration() { // BEGIN: com.azure.core.util.tracing.TracingOptions#default // no need to configure OpenTelemetry if you're using the OpenTelemetry Java agent (or another vendor-specific Java agent based on it). - // if you're using OpenTelemetry SDK, you can configure it with io.opentelemetry:opentelemetry-sdk-extension-autoconfigure package: - // AutoConfiguredOpenTelemetrySdk.initialize(); + OpenTelemetry opentelemetry = AutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk(); // configure Azure Client, no metric configuration needed AzureClient sampleClient = new AzureClientBuilder() .endpoint("https://my-client.azure.com") .build(); - Span span = GlobalOpenTelemetry.getTracer("azure-core-samples") + Span span = opentelemetry.getTracer("azure-core-samples") .spanBuilder("doWork") .startSpan(); @@ -63,10 +62,10 @@ public void customProviderSdkConfiguration() { // configure OpenTelemetry SDK explicitly per https://opentelemetry.io/docs/instrumentation/java/manual/ SdkTracerProvider tracerProvider = SdkTracerProvider.builder() - .addSpanProcessor(SimpleSpanProcessor.create(LoggingSpanExporter.create())) + .addSpanProcessor(BatchSpanProcessor.builder(LoggingSpanExporter.create()).build()) .build(); - OpenTelemetry openTelemetry = OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).build(); + OpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).build(); // Pass OpenTelemetry container to TracingOptions. TracingOptions customTracingOptions = new OpenTelemetryTracingOptions() .setOpenTelemetry(openTelemetry); @@ -82,13 +81,14 @@ public void customProviderSdkConfiguration() { sampleClient.methodCall("get items"); // END: com.azure.core.tracing.TracingOptions#custom + openTelemetry.close(); } public void passContextExplicitly() { // BEGIN: com.azure.core.util.tracing#explicit-parent SdkTracerProvider tracerProvider = SdkTracerProvider.builder() - .addSpanProcessor(SimpleSpanProcessor.create(LoggingSpanExporter.create())) + .addSpanProcessor(BatchSpanProcessor.builder(LoggingSpanExporter.create()).build()) .build(); AzureClient sampleClient = new AzureClientBuilder() @@ -110,6 +110,7 @@ public void passContextExplicitly() { parent.end(); // END: com.azure.core.util.tracing#explicit-parent + tracerProvider.close(); } /** diff --git a/sdk/core/azure-core-tracing-opentelemetry/README.md b/sdk/core/azure-core-tracing-opentelemetry/README.md index 666ea28e868d..17662d13ceda 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/README.md +++ b/sdk/core/azure-core-tracing-opentelemetry/README.md @@ -75,10 +75,10 @@ Pass OpenTelemetry TracerProvider to Azure client: // configure OpenTelemetry SDK explicitly per https://opentelemetry.io/docs/instrumentation/java/manual/ SdkTracerProvider tracerProvider = SdkTracerProvider.builder() - .addSpanProcessor(SimpleSpanProcessor.create(LoggingSpanExporter.create())) + .addSpanProcessor(BatchSpanProcessor.builder(LoggingSpanExporter.create()).build()) .build(); -OpenTelemetry openTelemetry = OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).build(); +OpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).build(); // Pass OpenTelemetry container to TracingOptions. TracingOptions customTracingOptions = new OpenTelemetryTracingOptions() .setOpenTelemetry(openTelemetry); @@ -133,7 +133,7 @@ Pass OpenTelemetry `Context` under `PARENT_TRACE_CONTEXT_KEY` in `com.azure.core ```java com.azure.core.util.tracing#explicit-parent SdkTracerProvider tracerProvider = SdkTracerProvider.builder() - .addSpanProcessor(SimpleSpanProcessor.create(LoggingSpanExporter.create())) + .addSpanProcessor(BatchSpanProcessor.builder(LoggingSpanExporter.create()).build()) .build(); AzureClient sampleClient = new AzureClientBuilder() @@ -181,7 +181,6 @@ try { } finally { span.end(); } - ``` ### Using the plugin package with AMQP client libraries diff --git a/sdk/core/azure-core-tracing-opentelemetry/src/main/java/com/azure/core/tracing/opentelemetry/OpenTelemetryTracingOptions.java b/sdk/core/azure-core-tracing-opentelemetry/src/main/java/com/azure/core/tracing/opentelemetry/OpenTelemetryTracingOptions.java index 00d39794a706..6183b68910b8 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/src/main/java/com/azure/core/tracing/opentelemetry/OpenTelemetryTracingOptions.java +++ b/sdk/core/azure-core-tracing-opentelemetry/src/main/java/com/azure/core/tracing/opentelemetry/OpenTelemetryTracingOptions.java @@ -40,10 +40,10 @@ TracerProvider getOpenTelemetryProvider() { * * // configure OpenTelemetry SDK explicitly per https://opentelemetry.io/docs/instrumentation/java/manual/ * SdkTracerProvider tracerProvider = SdkTracerProvider.builder() - * .addSpanProcessor(SimpleSpanProcessor.create(LoggingSpanExporter.create())) + * .addSpanProcessor(BatchSpanProcessor.builder(LoggingSpanExporter.create()).build()) * .build(); * - * OpenTelemetry openTelemetry = OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).build(); + * OpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).build(); * // Pass OpenTelemetry container to TracingOptions. * TracingOptions customTracingOptions = new OpenTelemetryTracingOptions() * .setOpenTelemetry(openTelemetry); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java index 417a6423e4c8..77cb141caf82 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java @@ -22,7 +22,7 @@ import java.util.regex.PatternSyntaxException; /** - * This represents proxy configuration to be used in http clients.. + * This represents proxy configuration to be used in http clients. */ public class ProxyOptions { private static final ClientLogger LOGGER = new ClientLogger(ProxyOptions.class); @@ -136,7 +136,7 @@ public InetSocketAddress getAddress() { } /** - * Gets the type of the prxoy. + * Gets the type of the proxy. * * @return the type of the proxy. */ diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java index 0529626882e4..6d2da7a7f55d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java @@ -246,16 +246,14 @@ private void logBody(HttpRequest request, int contentLength, LoggingEventBuilder } else { // Add non-mutating operators to the data stream. AccessibleByteArrayOutputStream stream = new AccessibleByteArrayOutputStream(contentLength); - request.setBody( - content.toFluxByteBuffer() - .doOnNext(byteBuffer -> { - try { - ImplUtils.writeByteBufferToStream(byteBuffer.duplicate(), stream); - } catch (IOException ex) { - throw LOGGER.logExceptionAsError(new UncheckedIOException(ex)); - } - }) - .doFinally(ignored -> logBody(logBuilder, logger, contentType, stream.toString(StandardCharsets.UTF_8)))); + request.setBody(Flux.using(() -> content, con -> con.toFluxByteBuffer() + .doOnNext(byteBuffer -> { + try { + ImplUtils.writeByteBufferToStream(byteBuffer.duplicate(), stream); + } catch (IOException ex) { + throw LOGGER.logExceptionAsError(new UncheckedIOException(ex)); + } + }), ignored -> logBody(logBuilder, logger, contentType, stream.toString(StandardCharsets.UTF_8)))); } } @@ -548,15 +546,14 @@ public HttpHeaders getHeaders() { public Flux getBody() { AccessibleByteArrayOutputStream stream = new AccessibleByteArrayOutputStream(contentLength); - return actualResponse.getBody() + return Flux.using(() -> actualResponse, response -> response.getBody() .doOnNext(byteBuffer -> { try { ImplUtils.writeByteBufferToStream(byteBuffer.duplicate(), stream); } catch (IOException ex) { throw LOGGER.logExceptionAsError(new UncheckedIOException(ex)); } - }) - .doFinally(ignored -> doLog(stream.toString(StandardCharsets.UTF_8))); + }), ignored -> doLog(stream.toString(StandardCharsets.UTF_8))); } @Override diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ConstructorReflectiveInvoker.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ConstructorReflectiveInvoker.java new file mode 100644 index 000000000000..387ad7c5a9f9 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ConstructorReflectiveInvoker.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation; + +import java.lang.reflect.Constructor; + +/** + * {@link Constructor}-based implementation of {@link ReflectiveInvoker}. + */ +final class ConstructorReflectiveInvoker implements ReflectiveInvoker { + private final Constructor constructor; + + ConstructorReflectiveInvoker(Constructor constructor) { + this.constructor = constructor; + } + + @Override + public Object invokeStatic(Object... args) throws Exception { + return constructor.newInstance(args); + } + + @Override + public Object invokeWithArguments(Object target, Object... args) throws Exception { + return constructor.newInstance(args); + } + + @Override + public int getParameterCount() { + return constructor.getParameterCount(); + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ImplUtils.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ImplUtils.java index 852ff0fd16fa..88e86c2ce9e7 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ImplUtils.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ImplUtils.java @@ -356,12 +356,12 @@ public static URL createUrl(String urlString) throws MalformedURLException { @SuppressWarnings("unchecked") public static Class getClassByName(String className) { - Objects.requireNonNull("'className' cannot be null"); + Objects.requireNonNull(className, "'className' cannot be null"); try { return (Class) Class.forName(className, false, ImplUtils.class.getClassLoader()); } catch (ClassNotFoundException e) { - String message = String.format("Class `%s` is not found on the classpath.", className); - throw LOGGER.logExceptionAsError(new RuntimeException(message, e)); + throw LOGGER.logExceptionAsError(new RuntimeException( + "Class '" + className + "' is not found on the classpath.", e)); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/MethodHandleReflectiveInvoker.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/MethodHandleReflectiveInvoker.java new file mode 100644 index 000000000000..28bb148817fc --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/MethodHandleReflectiveInvoker.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation; + +import java.lang.invoke.MethodHandle; + +/** + * {@link MethodHandle}-based implementation of {@link ReflectiveInvoker}. + */ +final class MethodHandleReflectiveInvoker implements ReflectiveInvoker { + private static final Object[] NO_ARGS = new Object[0]; + + private final MethodHandle methodHandle; + + MethodHandleReflectiveInvoker(MethodHandle methodHandle) { + this.methodHandle = methodHandle; + } + + @Override + public Object invokeStatic(Object... args) throws Exception { + try { + return methodHandle.invokeWithArguments(args); + } catch (Throwable throwable) { + if (throwable instanceof Error) { + throw (Error) throwable; + } else { + throw (Exception) throwable; + } + } + } + + @Override + public Object invokeWithArguments(Object target, Object... args) throws Exception { + try { + return methodHandle.invokeWithArguments(createFinalArgs(target, args)); + } catch (Throwable throwable) { + if (throwable instanceof Error) { + throw (Error) throwable; + } else { + throw (Exception) throwable; + } + } + } + + @Override + public int getParameterCount() { + return methodHandle.type().parameterCount(); + } + + private static Object[] createFinalArgs(Object target, Object... args) { + if (target == null && (args == null || args.length == 0)) { + return NO_ARGS; + } + + if (args == null || args.length == 0) { + return new Object[] { target }; + } + + Object[] finalArgs = new Object[args.length + 1]; + finalArgs[0] = target; + System.arraycopy(args, 0, finalArgs, 1, args.length); + + return finalArgs; + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/MethodReflectiveInvoker.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/MethodReflectiveInvoker.java new file mode 100644 index 000000000000..fe1d8bfe5fc9 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/MethodReflectiveInvoker.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation; + +import java.lang.reflect.Method; + +/** + * {@link Method}-based implementation of {@link ReflectiveInvoker}. + */ +final class MethodReflectiveInvoker implements ReflectiveInvoker { + private final Method method; + + MethodReflectiveInvoker(Method method) { + this.method = method; + } + + @Override + public Object invokeStatic(Object... args) throws Exception { + return method.invoke(null, args); + } + + @Override + public Object invokeWithArguments(Object target, Object... args) throws Exception { + return method.invoke(target, args); + } + + @Override + public int getParameterCount() { + return method.getParameterCount(); + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionSerializable.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionSerializable.java index d09b34ca130d..11a4e4fef033 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionSerializable.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionSerializable.java @@ -13,11 +13,10 @@ import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.io.OutputStream; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Map; +import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @@ -30,53 +29,51 @@ */ public final class ReflectionSerializable { private static final ClientLogger LOGGER = new ClientLogger(ReflectionSerializable.class); - private static final Map, MethodHandle> FROM_JSON_CACHE; + private static final Map, ReflectiveInvoker> FROM_JSON_CACHE; private static final Class XML_SERIALIZABLE; private static final Class XML_READER; - private static final XmlStreamExceptionCallable XML_READER_CREATOR; - private static final XmlStreamExceptionCallable XML_WRITER_CREATOR; - private static final XmlStreamExceptionCallable XML_WRITER_WRITE_XML_START_DOCUMENT; - private static final XmlStreamExceptionCallable XML_WRITER_WRITE_XML_SERIALIZABLE; - private static final XmlStreamExceptionCallable XML_WRITER_FLUSH; + private static final ReflectiveInvoker XML_READER_CREATOR; + private static final ReflectiveInvoker XML_WRITER_CREATOR; + private static final ReflectiveInvoker XML_WRITER_WRITE_XML_START_DOCUMENT; + private static final ReflectiveInvoker XML_WRITER_WRITE_XML_SERIALIZABLE; + private static final ReflectiveInvoker XML_WRITER_FLUSH; static final boolean XML_SERIALIZABLE_SUPPORTED; - private static final Map, MethodHandle> FROM_XML_CACHE; + private static final Map, ReflectiveInvoker> FROM_XML_CACHE; static { FROM_JSON_CACHE = new ConcurrentHashMap<>(); Class xmlSerializable = null; Class xmlReader = null; - XmlStreamExceptionCallable xmlReaderCreator = null; - XmlStreamExceptionCallable xmlWriterCreator = null; - XmlStreamExceptionCallable xmlWriterWriteStartDocument = null; - XmlStreamExceptionCallable xmlWriterWriteXmlSerializable = null; - XmlStreamExceptionCallable xmlWriterFlush = null; + ReflectiveInvoker xmlReaderCreator = null; + ReflectiveInvoker xmlWriterCreator = null; + ReflectiveInvoker xmlWriterWriteStartDocument = null; + ReflectiveInvoker xmlWriterWriteXmlSerializable = null; + ReflectiveInvoker xmlWriterFlush = null; boolean xmlSerializableSupported = false; try { xmlSerializable = Class.forName("com.azure.xml.XmlSerializable"); xmlReader = Class.forName("com.azure.xml.XmlReader"); Class xmlProviders = Class.forName("com.azure.xml.XmlProviders"); - MethodHandles.Lookup lookup = ReflectionUtils.getLookupToUse(xmlProviders); - MethodHandle handle = lookup.unreflect(xmlProviders.getDeclaredMethod("createReader", byte[].class)); - xmlReaderCreator = createXmlCallable(AutoCloseable.class, handle); + xmlReaderCreator = ReflectionUtils.getMethodInvoker(xmlProviders, + xmlProviders.getDeclaredMethod("createReader", byte[].class)); - handle = lookup.unreflect(xmlProviders.getDeclaredMethod("createWriter", OutputStream.class)); - xmlWriterCreator = createXmlCallable(AutoCloseable.class, handle); + xmlWriterCreator = ReflectionUtils.getMethodInvoker(xmlProviders, + xmlProviders.getDeclaredMethod("createWriter", OutputStream.class)); Class xmlWriter = Class.forName("com.azure.xml.XmlWriter"); - handle = lookup.unreflect(xmlWriter.getDeclaredMethod("writeStartDocument")); - xmlWriterWriteStartDocument = createXmlCallable(Object.class, handle); + xmlWriterWriteStartDocument = ReflectionUtils.getMethodInvoker(xmlWriter, + xmlWriter.getDeclaredMethod("writeStartDocument")); - handle = lookup.unreflect(xmlWriter.getDeclaredMethod("writeXml", xmlSerializable)); - xmlWriterWriteXmlSerializable = createXmlCallable(Object.class, handle); + xmlWriterWriteXmlSerializable = ReflectionUtils.getMethodInvoker(xmlWriter, + xmlWriter.getDeclaredMethod("writeXml", xmlSerializable)); - handle = lookup.unreflect(xmlWriter.getDeclaredMethod("flush")); - xmlWriterFlush = createXmlCallable(Object.class, handle); + xmlWriterFlush = ReflectionUtils.getMethodInvoker(xmlWriter, xmlWriter.getDeclaredMethod("flush")); xmlSerializableSupported = true; } catch (Throwable e) { @@ -182,17 +179,17 @@ public static Object deserializeAsJsonSerializable(Class jsonSerializable, by FROM_JSON_CACHE.clear(); } - MethodHandle readJson = FROM_JSON_CACHE.computeIfAbsent(jsonSerializable, clazz -> { + ReflectiveInvoker readJson = FROM_JSON_CACHE.computeIfAbsent(jsonSerializable, clazz -> { try { - MethodHandles.Lookup lookup = ReflectionUtils.getLookupToUse(clazz); - return lookup.unreflect(jsonSerializable.getDeclaredMethod("fromJson", JsonReader.class)); + return ReflectionUtils.getMethodInvoker(clazz, + jsonSerializable.getDeclaredMethod("fromJson", JsonReader.class)); } catch (Exception e) { throw LOGGER.logExceptionAsError(new IllegalStateException(e)); } }); try (JsonReader jsonReader = JsonProviders.createReader(json)) { - return readJson.invoke(jsonReader); + return readJson.invokeStatic(jsonReader); } catch (Throwable e) { if (e instanceof IOException) { throw (IOException) e; @@ -250,10 +247,12 @@ public static String serializeXmlSerializableToString(Object xmlSerializable) th private static T serializeXmlSerializableWithReturn(Object xmlSerializable, Function returner) throws IOException { try (AccessibleByteArrayOutputStream outputStream = new AccessibleByteArrayOutputStream(); - AutoCloseable xmlWriter = XML_WRITER_CREATOR.call(outputStream)) { - XML_WRITER_WRITE_XML_START_DOCUMENT.call(xmlWriter); - XML_WRITER_WRITE_XML_SERIALIZABLE.call(xmlWriter, xmlSerializable); - XML_WRITER_FLUSH.call(xmlWriter); + AutoCloseable xmlWriter + = callXmlInvoker(AutoCloseable.class, () -> XML_WRITER_CREATOR.invokeStatic(outputStream))) { + callXmlInvoker(Object.class, () -> XML_WRITER_WRITE_XML_START_DOCUMENT.invokeWithArguments(xmlWriter)); + callXmlInvoker(Object.class, () -> XML_WRITER_WRITE_XML_SERIALIZABLE.invokeWithArguments(xmlWriter, + xmlSerializable)); + callXmlInvoker(Object.class, () -> XML_WRITER_FLUSH.invokeWithArguments(xmlWriter)); return returner.apply(outputStream); } catch (IOException ex) { @@ -272,10 +271,12 @@ private static T serializeXmlSerializableWithReturn(Object xmlSerializable, */ public static void serializeXmlSerializableIntoOutputStream(Object xmlSerializable, OutputStream outputStream) throws IOException { - try (AutoCloseable xmlWriter = XML_WRITER_CREATOR.call(outputStream)) { - XML_WRITER_WRITE_XML_START_DOCUMENT.call(xmlWriter); - XML_WRITER_WRITE_XML_SERIALIZABLE.call(xmlWriter, xmlSerializable); - XML_WRITER_FLUSH.call(xmlWriter); + try (AutoCloseable xmlWriter + = callXmlInvoker(AutoCloseable.class, () -> XML_WRITER_CREATOR.invokeStatic(outputStream))) { + callXmlInvoker(Object.class, () -> XML_WRITER_WRITE_XML_START_DOCUMENT.invokeWithArguments(xmlWriter)); + callXmlInvoker(Object.class, () -> XML_WRITER_WRITE_XML_SERIALIZABLE.invokeWithArguments(xmlWriter, + xmlSerializable)); + callXmlInvoker(Object.class, () -> XML_WRITER_FLUSH.invokeWithArguments(xmlWriter)); } catch (IOException ex) { throw ex; } catch (Exception ex) { @@ -300,17 +301,18 @@ public static Object deserializeAsXmlSerializable(Class xmlSerializable, byte FROM_XML_CACHE.clear(); } - MethodHandle readXml = FROM_XML_CACHE.computeIfAbsent(xmlSerializable, clazz -> { + ReflectiveInvoker readXml = FROM_XML_CACHE.computeIfAbsent(xmlSerializable, clazz -> { try { - MethodHandles.Lookup lookup = ReflectionUtils.getLookupToUse(clazz); - return lookup.unreflect(xmlSerializable.getMethod("fromXml", XML_READER)); + return ReflectionUtils.getMethodInvoker(xmlSerializable, + xmlSerializable.getDeclaredMethod("fromXml", XML_READER)); } catch (Exception e) { throw LOGGER.logExceptionAsError(new IllegalStateException(e)); } }); - try (AutoCloseable xmlReader = XML_READER_CREATOR.call((Object) xml)) { - return readXml.invoke(xmlReader); + try (AutoCloseable xmlReader + = callXmlInvoker(AutoCloseable.class, () -> XML_READER_CREATOR.invokeStatic((Object) xml))) { + return readXml.invokeStatic(xmlReader); } catch (Throwable e) { if (e instanceof IOException) { throw (IOException) e; @@ -322,37 +324,16 @@ public static Object deserializeAsXmlSerializable(Class xmlSerializable, byte } } - /** - * Similar to {@link java.util.concurrent.Callable} except it's checked with an {@link XMLStreamException} and - * accepts parameters. - * - * @param Type returned by the callable. - */ - private interface XmlStreamExceptionCallable { - /** - * Computes a result or throws if it's unable to do so. - * - * @param parameters Parameters used to compute the result. - * @return The result. - * @throws XMLStreamException If a result is unable to be computed. - */ - T call(Object... parameters) throws XMLStreamException; - } - - private static XmlStreamExceptionCallable createXmlCallable(Class returnType, MethodHandle methodHandle) { - return parameters -> { - try { - return returnType.cast(methodHandle.invokeWithArguments(parameters)); - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; - } else if (throwable instanceof XMLStreamException) { - throw (XMLStreamException) throwable; - } else { - throw new XMLStreamException(throwable); - } + private static T callXmlInvoker(Class returnType, Callable invoker) throws XMLStreamException { + try { + return returnType.cast(invoker.call()); + } catch (Exception exception) { + if (exception instanceof XMLStreamException) { + throw (XMLStreamException) exception; + } else { + throw new XMLStreamException(exception); } - }; + } } private ReflectionSerializable() { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtils.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtils.java index e1e60101310f..394c112f0767 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtils.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtils.java @@ -4,187 +4,167 @@ package com.azure.core.implementation; import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.logging.LogLevel; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; import java.lang.reflect.Constructor; -import java.security.PrivilegedExceptionAction; +import java.lang.reflect.Method; /** * Utility methods that aid in performing reflective operations. */ -@SuppressWarnings("deprecation") -public final class ReflectionUtils { +public abstract class ReflectionUtils { private static final ClientLogger LOGGER = new ClientLogger(ReflectionUtils.class); - - private static final boolean MODULE_BASED; - - private static final MethodHandle CLASS_GET_MODULE_METHOD_HANDLE; - private static final MethodHandle MODULE_IS_NAMED_METHOD_HANDLE; - private static final MethodHandle MODULE_ADD_READS_METHOD_HANDLE; - private static final MethodHandle METHOD_HANDLES_PRIVATE_LOOKUP_IN_METHOD_HANDLE; - private static final MethodHandle MODULE_IS_OPEN_UNCONDITIONALLY_METHOD_HANDLE; - private static final MethodHandle MODULE_IS_OPEN_TO_OTHER_MODULE_METHOD_HANDLE; - - private static final MethodHandles.Lookup LOOKUP; - private static final Object CORE_MODULE; - - private static final MethodHandle JDK_INTERNAL_PRIVATE_LOOKUP_IN_CONSTRUCTOR; + private static final ReflectionUtilsApi INSTANCE; static { - boolean moduleBased = false; - MethodHandle classGetModule = null; - MethodHandle moduleIsNamed = null; - MethodHandle moduleAddReads = null; - MethodHandle methodHandlesPrivateLookupIn = null; - MethodHandle moduleIsOpenUnconditionally = null; - MethodHandle moduleIsOpenToOtherModule = null; - - MethodHandles.Lookup lookup = MethodHandles.lookup(); - Object coreModule = null; - - MethodHandle jdkInternalPrivateLookupInConstructor = null; - + ReflectionUtilsApi instance; try { - Class moduleClass = Class.forName("java.lang.Module"); - classGetModule = lookup.unreflect(Class.class.getDeclaredMethod("getModule")); - moduleIsNamed = lookup.unreflect(moduleClass.getDeclaredMethod("isNamed")); - moduleAddReads = lookup.unreflect(moduleClass.getDeclaredMethod("addReads", moduleClass)); - methodHandlesPrivateLookupIn = lookup.findStatic(MethodHandles.class, "privateLookupIn", - MethodType.methodType(MethodHandles.Lookup.class, Class.class, MethodHandles.Lookup.class)); - moduleIsOpenUnconditionally = lookup.unreflect(moduleClass.getDeclaredMethod("isOpen", String.class)); - moduleIsOpenToOtherModule = lookup.unreflect( - moduleClass.getDeclaredMethod("isOpen", String.class, moduleClass)); - - coreModule = classGetModule.invokeWithArguments(ReflectionUtils.class); - moduleBased = true; - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; - } else { - LOGGER.log(LogLevel.INFORMATIONAL, - () -> "Unable to create MethodHandles to use Java 9+ MethodHandles.privateLookupIn. " - + "Will attempt to fallback to using the package-private constructor.", throwable); - } + LOGGER.verbose("Attempting to use java.lang.invoke package to handle reflection."); + instance = new ReflectionUtilsMethodHandle(); + LOGGER.verbose("Successfully used java.lang.invoke package to handle reflection."); + } catch (LinkageError ignored) { + LOGGER.verbose("Failed to use java.lang.invoke package to handle reflection. Falling back to " + + "java.lang.reflect package to handle reflection."); + instance = new ReflectionUtilsClassic(); + LOGGER.verbose("Successfully used java.lang.reflect package to handle reflection."); } - if (!moduleBased) { - try { - Constructor privateLookupInConstructor = - MethodHandles.Lookup.class.getDeclaredConstructor(Class.class); + INSTANCE = instance; + } - if (!privateLookupInConstructor.isAccessible()) { - privateLookupInConstructor.setAccessible(true); - } - jdkInternalPrivateLookupInConstructor = lookup.unreflectConstructor(privateLookupInConstructor); - } catch (ReflectiveOperationException ex) { - throw LOGGER.logExceptionAsError( - new RuntimeException("Unable to use package-private MethodHandles.Lookup constructor.", ex)); - } - } - - MODULE_BASED = moduleBased; - CLASS_GET_MODULE_METHOD_HANDLE = classGetModule; - MODULE_IS_NAMED_METHOD_HANDLE = moduleIsNamed; - MODULE_ADD_READS_METHOD_HANDLE = moduleAddReads; - METHOD_HANDLES_PRIVATE_LOOKUP_IN_METHOD_HANDLE = methodHandlesPrivateLookupIn; - MODULE_IS_OPEN_UNCONDITIONALLY_METHOD_HANDLE = moduleIsOpenUnconditionally; - MODULE_IS_OPEN_TO_OTHER_MODULE_METHOD_HANDLE = moduleIsOpenToOtherModule; - LOOKUP = lookup; - CORE_MODULE = coreModule; - JDK_INTERNAL_PRIVATE_LOOKUP_IN_CONSTRUCTOR = jdkInternalPrivateLookupInConstructor; + /** + * Creates an {@link ReflectiveInvoker} instance that will invoke a {@link Method}. + *

+ * Calls {@link #getMethodInvoker(Class, Method, boolean)} with {@code scopeToAzureCore} set to true. + * + * @param targetClass The class that contains the method. + * @param method The method to invoke. + * @return An {@link ReflectiveInvoker} instance that will invoke the method. + * @throws NullPointerException If {@code method} is null. + * @throws Exception If the {@link ReflectiveInvoker} cannot be created. + */ + public static ReflectiveInvoker getMethodInvoker(Class targetClass, Method method) throws Exception { + return getMethodInvoker(targetClass, method, true); } /** - * Gets the {@link MethodHandles.Lookup} to use when performing reflective operations. + * Creates an {@link ReflectiveInvoker} instance that will invoke a {@link Method}. *

- * If Java 8 is being used this will always return {@link MethodHandles.Lookup#publicLookup()} as Java 8 doesn't - * have module boundaries that will prevent reflective access to the {@code targetClass}. + * {@code targetClass} may be null but when using an environment that supports MethodHandles for handling reflection + * this may result in exceptions being thrown due to the inability to scope the MethodHandle to a module. To attempt + * to alleviate this issue, if {@code targetClass} is null {@link Method#getDeclaringClass()} will be used to infer + * the class. *

- * If Java 9 or above is being used this will return a {@link MethodHandles.Lookup} based on whether the module - * containing the {@code targetClass} exports the package containing the class. Otherwise, the - * {@link MethodHandles.Lookup} associated to {@code com.azure.core} will attempt to read the module containing - * {@code targetClass}. + * {@code scopeToAzure} is only when used when MethodHandles are being used and Java 9+ modules are being used. This + * will determine whether to use a MethodHandles.Lookup scoped to {@code azure-core} or to use a public + * MethodHandles.Lookup. Scoping a MethodHandles.Lookup to {@code azure-core} requires to module containing the + * class to open or export to {@code azure-core} which generally only holds true for other Azure SDKs, for example + * there are cases where a reflective invocation is needed to Jackson which won't open or export to + * {@code azure-core} and the only APIs invoked reflectively are public APIs so the public MethodHandles.Lookup will + * be used. * - * @param targetClass The {@link Class} that will need to be reflectively accessed. - * @return The {@link MethodHandles.Lookup} that will allow {@code com.azure.core} to access the {@code targetClass} - * reflectively. - * @throws Exception If the underlying reflective calls throw an exception. + * @param targetClass The class that contains the method. + * @param method The method to invoke. + * @param scopeToAzureCore If Java 9+ modules is being used this will scope MethodHandle-based reflection to using + * {@code azure-core} as the scoped module, otherwise this is ignored. + * @return An {@link ReflectiveInvoker} instance that will invoke the method. + * @throws NullPointerException If {@code method} is null. + * @throws Exception If the {@link ReflectiveInvoker} cannot be created. */ - public static MethodHandles.Lookup getLookupToUse(Class targetClass) throws Exception { - try { - if (MODULE_BASED) { - Object responseModule = CLASS_GET_MODULE_METHOD_HANDLE.invoke(targetClass); - - // The unnamed module is opened unconditionally, have Core read it and use a private proxy lookup to - // enable all lookup scenarios. - if (!(boolean) MODULE_IS_NAMED_METHOD_HANDLE.invoke(responseModule)) { - MODULE_ADD_READS_METHOD_HANDLE.invokeWithArguments(CORE_MODULE, responseModule); - return performSafePrivateLookupIn(targetClass); - } - - - // If the response module is the Core module return the Core private lookup. - if (responseModule == CORE_MODULE) { - return LOOKUP; - } - - // Next check if the target class module is opened either unconditionally or to Core's module. If so, - // also use a private proxy lookup to enable all lookup scenarios. - String packageName = targetClass.getPackage().getName(); - if ((boolean) MODULE_IS_OPEN_UNCONDITIONALLY_METHOD_HANDLE - .invokeWithArguments(responseModule, packageName) - || (boolean) MODULE_IS_OPEN_TO_OTHER_MODULE_METHOD_HANDLE - .invokeWithArguments(responseModule, packageName, CORE_MODULE)) { - MODULE_ADD_READS_METHOD_HANDLE.invokeWithArguments(CORE_MODULE, responseModule); - return performSafePrivateLookupIn(targetClass); - } - - // Otherwise, return the public lookup as there are no specialty ways to access the other module. - return MethodHandles.publicLookup(); - } else { - return (MethodHandles.Lookup) JDK_INTERNAL_PRIVATE_LOOKUP_IN_CONSTRUCTOR.invoke(targetClass); - } - } catch (Throwable throwable) { - // invoke(Class targetClass, Method method, boolean scopeToAzureCore) + throws Exception { + if (method == null) { + throw LOGGER.logExceptionAsError(new NullPointerException("'method' cannot be null.")); } + + targetClass = (targetClass == null) ? method.getDeclaringClass() : targetClass; + return INSTANCE.getMethodInvoker(targetClass, method, scopeToAzureCore); + } + + /** + * Creates an {@link ReflectiveInvoker} instance that will invoke a {@link Constructor}. + *

+ * Calls {@link #getConstructorInvoker(Class, Constructor, boolean)} with {@code scopeToAzureCore} set to true. + * + * @param targetClass The class that contains the constructor. + * @param constructor The constructor to invoke. + * @return An {@link ReflectiveInvoker} instance that will invoke the constructor. + * @throws NullPointerException If {@code constructor} is null. + * @throws Exception If the {@link ReflectiveInvoker} cannot be created. + */ + public static ReflectiveInvoker getConstructorInvoker(Class targetClass, Constructor constructor) + throws Exception { + return getConstructorInvoker(targetClass, constructor, true); } - @SuppressWarnings("removal") - private static MethodHandles.Lookup performSafePrivateLookupIn(Class targetClass) throws Throwable { - // MethodHandles::privateLookupIn() throws SecurityException if denied by the security manager - if (System.getSecurityManager() == null) { - return (MethodHandles.Lookup) METHOD_HANDLES_PRIVATE_LOOKUP_IN_METHOD_HANDLE - .invokeExact(targetClass, LOOKUP); - } else { - return java.security.AccessController.doPrivileged((PrivilegedExceptionAction) () -> { - try { - return (MethodHandles.Lookup) METHOD_HANDLES_PRIVATE_LOOKUP_IN_METHOD_HANDLE - .invokeExact(targetClass, LOOKUP); - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; - } else { - throw (Exception) throwable; - } - } - }); + /** + * Creates an {@link ReflectiveInvoker} instance that will invoke a {@link Constructor}. + *

+ * {@code targetClass} may be null but when using an environment that supports MethodHandles for handling reflection + * this may result in exceptions being thrown due to the inability to scope the MethodHandle to a module. To attempt + * to alleviate this issue, if {@code targetClass} is null {@link Constructor#getDeclaringClass()} will be used to + * infer the class. + *

+ * {@code scopeToAzure} is only when used when MethodHandles are being used and Java 9+ modules are being used. This + * will determine whether to use a MethodHandles.Lookup scoped to {@code azure-core} or to use a public + * MethodHandles.Lookup. Scoping a MethodHandles.Lookup to {@code azure-core} requires to module containing the + * class to open or export to {@code azure-core} which generally only holds true for other Azure SDKs, for example + * there are cases where a reflective invocation is needed to Jackson which won't open or export to + * {@code azure-core} and the only APIs invoked reflectively are public APIs so the public MethodHandles.Lookup will + * be used. + * + * @param targetClass The class that contains the constructor. + * @param constructor The constructor to invoke. + * @param scopeToAzureCore If Java 9+ modules is being used this will scope MethodHandle-based reflection to using + * {@code azure-core} as the scoped module, otherwise this is ignored. + * @return An {@link ReflectiveInvoker} instance that will invoke the constructor. + * @throws NullPointerException If {@code constructor} is null. + * @throws Exception If the {@link ReflectiveInvoker} cannot be created. + */ + public static ReflectiveInvoker getConstructorInvoker(Class targetClass, Constructor constructor, + boolean scopeToAzureCore) throws Exception { + if (constructor == null) { + throw LOGGER.logExceptionAsError(new NullPointerException("'constructor' cannot be null.")); } + + targetClass = (targetClass == null) ? constructor.getDeclaringClass() : targetClass; + return INSTANCE.getConstructorInvoker(targetClass, constructor, scopeToAzureCore); } + /** + * Determines whether a Java 9+ module-based implementation of {@link ReflectionUtilsApi} is being used. + * + * @return Whether a Java 9+ module-based implementation of {@link ReflectionUtilsApi} is being used. + */ public static boolean isModuleBased() { - return MODULE_BASED; + return INSTANCE.isModuleBased(); + } + + /** + * Creates a dummy {@link ReflectiveInvoker} that will always return null. Used for scenarios where an {@link ReflectiveInvoker} is + * needed as an identifier but will never be used. + * + * @return A dummy {@link ReflectiveInvoker} that will always return null. + */ + public static ReflectiveInvoker createNoOpInvoker() { + return new NoOpReflectiveInvoker(); + } + + private static final class NoOpReflectiveInvoker implements ReflectiveInvoker { + @Override + public Object invokeStatic(Object... args) { + return null; + } + + @Override + public Object invokeWithArguments(Object target, Object... args) { + return null; + } + + @Override + public int getParameterCount() { + return 0; + } } ReflectionUtils() { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtilsApi.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtilsApi.java new file mode 100644 index 000000000000..ad57225d4fb0 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtilsApi.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +/** + * Interface that defines implementation-agnostic methods for creating {@link ReflectiveInvoker Invokers} that will invoke + * {@link Method Methods}, {@link Constructor Constructors}, and {@link Field Fields}. + */ +interface ReflectionUtilsApi { + /** + * Creates an {@link ReflectiveInvoker} instance that will invoke a {@link Method}. + *

+ * {@code targetClass} may be null but when using an environment that supports MethodHandles for handling reflection + * this may result in exceptions being thrown due to the inability to scope the MethodHandle to a module. To attempt + * to alleviate this issue, if {@code targetClass} is null {@link Method#getDeclaringClass()} will be used to infer + * the class. + *

+ * {@code scopeToAzure} is only when used when MethodHandles are being used and Java 9+ modules are being used. This + * will determine whether to use a MethodHandles.Lookup scoped to {@code azure-core} or to use a public + * MethodHandles.Lookup. Scoping a MethodHandles.Lookup to {@code azure-core} requires to module containing the + * class to open or export to {@code azure-core} which generally only holds true for other Azure SDKs, for example + * there are cases where a reflective invocation is needed to Jackson which won't open or export to + * {@code azure-core} and the only APIs invoked reflectively are public APIs so the public MethodHandles.Lookup will + * be used. + * + * @param targetClass The class that contains the method. + * @param method The method to invoke. + * @param scopeToAzureCore If Java 9+ modules is being used this will scope MethodHandle-based reflection to using + * {@code azure-core} as the scoped module, otherwise this is ignored. + * @return An {@link ReflectiveInvoker} instance that will invoke the method. + * @throws NullPointerException If {@code method} is null. + * @throws Exception If the {@link ReflectiveInvoker} cannot be created. + */ + ReflectiveInvoker getMethodInvoker(Class targetClass, Method method, boolean scopeToAzureCore) throws Exception; + + /** + * Creates an {@link ReflectiveInvoker} instance that will invoke a {@link Constructor}. + *

+ * {@code targetClass} may be null but when using an environment that supports MethodHandles for handling reflection + * this may result in exceptions being thrown due to the inability to scope the MethodHandle to a module. To attempt + * to alleviate this issue, if {@code targetClass} is null {@link Constructor#getDeclaringClass()} will be used to + * infer the class. + *

+ * {@code scopeToAzure} is only when used when MethodHandles are being used and Java 9+ modules are being used. This + * will determine whether to use a MethodHandles.Lookup scoped to {@code azure-core} or to use a public + * MethodHandles.Lookup. Scoping a MethodHandles.Lookup to {@code azure-core} requires to module containing the + * class to open or export to {@code azure-core} which generally only holds true for other Azure SDKs, for example + * there are cases where a reflective invocation is needed to Jackson which won't open or export to + * {@code azure-core} and the only APIs invoked reflectively are public APIs so the public MethodHandles.Lookup will + * be used. + * + * @param targetClass The class that contains the constructor. + * @param constructor The constructor to invoke. + * @param scopeToAzureCore If Java 9+ modules is being used this will scope MethodHandle-based reflection to using + * {@code azure-core} as the scoped module, otherwise this is ignored. + * @return An {@link ReflectiveInvoker} instance that will invoke the constructor. + * @throws NullPointerException If {@code constructor} is null. + * @throws Exception If the {@link ReflectiveInvoker} cannot be created. + */ + ReflectiveInvoker getConstructorInvoker(Class targetClass, Constructor constructor, boolean scopeToAzureCore) + throws Exception; + + /** + * Indicates whether the {@link ReflectionUtilsApi} instance uses Java 9+ modules. + * + * @return Whether the {@link ReflectionUtilsApi} instance uses Java 9+ modules. + */ + boolean isModuleBased(); +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtilsClassic.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtilsClassic.java new file mode 100644 index 000000000000..7ddb98702237 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtilsClassic.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; + +/** + * Implementation for {@link ReflectionUtilsApi} using {@code java.lang.reflect} to handle reflectively invoking APIs. + */ +final class ReflectionUtilsClassic implements ReflectionUtilsApi { + @Override + public ReflectiveInvoker getMethodInvoker(Class targetClass, Method method, boolean scopeToAzureCore) { + return new MethodReflectiveInvoker(method); + } + + @Override + public ReflectiveInvoker getConstructorInvoker(Class targetClass, Constructor constructor, boolean scopeToAzureCore) { + return new ConstructorReflectiveInvoker(constructor); + } + + @Override + public boolean isModuleBased() { + return false; + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtilsMethodHandle.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtilsMethodHandle.java new file mode 100644 index 000000000000..1fb407986072 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectionUtilsMethodHandle.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.security.PrivilegedExceptionAction; + +/** + * Implementation for {@link ReflectionUtilsApi} using {@code java.lang.invoke} to handle reflectively invoking APIs. + */ +@SuppressWarnings("deprecation") +final class ReflectionUtilsMethodHandle implements ReflectionUtilsApi { + private static final ClientLogger LOGGER = new ClientLogger(ReflectionUtilsMethodHandle.class); + private static final boolean MODULE_BASED; + + private static final MethodHandle CLASS_GET_MODULE_METHOD_HANDLE; + private static final MethodHandle MODULE_IS_NAMED_METHOD_HANDLE; + private static final MethodHandle MODULE_ADD_READS_METHOD_HANDLE; + private static final MethodHandle METHOD_HANDLES_PRIVATE_LOOKUP_IN_METHOD_HANDLE; + private static final MethodHandle MODULE_IS_OPEN_UNCONDITIONALLY_METHOD_HANDLE; + private static final MethodHandle MODULE_IS_OPEN_TO_OTHER_MODULE_METHOD_HANDLE; + + private static final MethodHandles.Lookup LOOKUP; + private static final Object CORE_MODULE; + + private static final MethodHandle JDK_INTERNAL_PRIVATE_LOOKUP_IN_CONSTRUCTOR; + + static { + boolean moduleBased = false; + MethodHandle classGetModule = null; + MethodHandle moduleIsNamed = null; + MethodHandle moduleAddReads = null; + MethodHandle methodHandlesPrivateLookupIn = null; + MethodHandle moduleIsOpenUnconditionally = null; + MethodHandle moduleIsOpenToOtherModule = null; + + MethodHandles.Lookup lookup = MethodHandles.lookup(); + Object coreModule = null; + + MethodHandle jdkInternalPrivateLookupInConstructor = null; + + try { + Class moduleClass = Class.forName("java.lang.Module"); + classGetModule = lookup.unreflect(Class.class.getDeclaredMethod("getModule")); + moduleIsNamed = lookup.unreflect(moduleClass.getDeclaredMethod("isNamed")); + moduleAddReads = lookup.unreflect(moduleClass.getDeclaredMethod("addReads", moduleClass)); + methodHandlesPrivateLookupIn = lookup.findStatic(MethodHandles.class, "privateLookupIn", + MethodType.methodType(MethodHandles.Lookup.class, Class.class, MethodHandles.Lookup.class)); + moduleIsOpenUnconditionally = lookup.unreflect(moduleClass.getDeclaredMethod("isOpen", String.class)); + moduleIsOpenToOtherModule = lookup.unreflect( + moduleClass.getDeclaredMethod("isOpen", String.class, moduleClass)); + + coreModule = classGetModule.invokeWithArguments(ReflectionUtils.class); + moduleBased = true; + } catch (Throwable throwable) { + if (throwable instanceof Error) { + throw (Error) throwable; + } else { + LOGGER.log(LogLevel.INFORMATIONAL, + () -> "Unable to create MethodHandles to use Java 9+ MethodHandles.privateLookupIn. " + + "Will attempt to fallback to using the package-private constructor.", throwable); + } + } + + if (!moduleBased) { + try { + Constructor privateLookupInConstructor = + MethodHandles.Lookup.class.getDeclaredConstructor(Class.class); + + if (!privateLookupInConstructor.isAccessible()) { + privateLookupInConstructor.setAccessible(true); + } + + jdkInternalPrivateLookupInConstructor = lookup.unreflectConstructor(privateLookupInConstructor); + } catch (ReflectiveOperationException ex) { + throw LOGGER.logExceptionAsError( + new RuntimeException("Unable to use package-private MethodHandles.Lookup constructor.", ex)); + } + } + + MODULE_BASED = moduleBased; + CLASS_GET_MODULE_METHOD_HANDLE = classGetModule; + MODULE_IS_NAMED_METHOD_HANDLE = moduleIsNamed; + MODULE_ADD_READS_METHOD_HANDLE = moduleAddReads; + METHOD_HANDLES_PRIVATE_LOOKUP_IN_METHOD_HANDLE = methodHandlesPrivateLookupIn; + MODULE_IS_OPEN_UNCONDITIONALLY_METHOD_HANDLE = moduleIsOpenUnconditionally; + MODULE_IS_OPEN_TO_OTHER_MODULE_METHOD_HANDLE = moduleIsOpenToOtherModule; + LOOKUP = lookup; + CORE_MODULE = coreModule; + JDK_INTERNAL_PRIVATE_LOOKUP_IN_CONSTRUCTOR = jdkInternalPrivateLookupInConstructor; + } + + @Override + public ReflectiveInvoker getMethodInvoker(Class targetClass, Method method, boolean scopeToAzureCore) throws Exception { + MethodHandles.Lookup lookup = getLookupToUse(targetClass, scopeToAzureCore); + + return new MethodHandleReflectiveInvoker(lookup.unreflect(method)); + } + + @Override + public ReflectiveInvoker getConstructorInvoker(Class targetClass, Constructor constructor, boolean scopeToAzureCore) + throws Exception { + MethodHandles.Lookup lookup = getLookupToUse(targetClass, scopeToAzureCore); + + return new MethodHandleReflectiveInvoker(lookup.unreflectConstructor(constructor)); + } + + @Override + public boolean isModuleBased() { + return MODULE_BASED; + } + + /** + * Gets the {@link MethodHandles.Lookup} to use when performing reflective operations. + *

+ * If Java 8 is being used this will always return {@link MethodHandles.Lookup#publicLookup()} as Java 8 doesn't + * have module boundaries that will prevent reflective access to the {@code targetClass}. + *

+ * If Java 9 or above is being used this will return a {@link MethodHandles.Lookup} based on whether the module + * containing the {@code targetClass} exports the package containing the class. Otherwise, the + * {@link MethodHandles.Lookup} associated to {@code com.azure.core} will attempt to read the module containing + * {@code targetClass}. + * + * @param targetClass The {@link Class} that will need to be reflectively accessed. + * @param scopeToAzureCore Whether to scope the {@link MethodHandles.Lookup} to {@code com.azure.core} if Java 9+ + * modules is being used. + * @return The {@link MethodHandles.Lookup} that will allow {@code com.azure.core} to access the {@code targetClass} + * reflectively. + * @throws Exception If the underlying reflective calls throw an exception. + */ + private static MethodHandles.Lookup getLookupToUse(Class targetClass, boolean scopeToAzureCore) + throws Exception { + try { + if (MODULE_BASED) { + if (!scopeToAzureCore) { + return MethodHandles.publicLookup(); + } + + Object responseModule = CLASS_GET_MODULE_METHOD_HANDLE.invoke(targetClass); + + // The unnamed module is opened unconditionally, have Core read it and use a private proxy lookup to + // enable all lookup scenarios. + if (!(boolean) MODULE_IS_NAMED_METHOD_HANDLE.invoke(responseModule)) { + MODULE_ADD_READS_METHOD_HANDLE.invokeWithArguments(CORE_MODULE, responseModule); + return performSafePrivateLookupIn(targetClass); + } + + // If the response module is the Core module return the Core private lookup. + if (responseModule == CORE_MODULE) { + return LOOKUP; + } + + // Next check if the target class module is opened either unconditionally or to Core's module. If so, + // also use a private proxy lookup to enable all lookup scenarios. + String packageName = targetClass.getPackage().getName(); + if ((boolean) MODULE_IS_OPEN_UNCONDITIONALLY_METHOD_HANDLE.invokeWithArguments(responseModule, + packageName) || (boolean) MODULE_IS_OPEN_TO_OTHER_MODULE_METHOD_HANDLE.invokeWithArguments( + responseModule, packageName, CORE_MODULE)) { + MODULE_ADD_READS_METHOD_HANDLE.invokeWithArguments(CORE_MODULE, responseModule); + return performSafePrivateLookupIn(targetClass); + } + + // Otherwise, return the public lookup as there are no specialty ways to access the other module. + return MethodHandles.publicLookup(); + } else { + return (MethodHandles.Lookup) JDK_INTERNAL_PRIVATE_LOOKUP_IN_CONSTRUCTOR.invoke(targetClass); + } + } catch (Throwable throwable) { + // invoke(Class targetClass) throws Throwable { + // MethodHandles::privateLookupIn() throws SecurityException if denied by the security manager + if (System.getSecurityManager() == null) { + return (MethodHandles.Lookup) METHOD_HANDLES_PRIVATE_LOOKUP_IN_METHOD_HANDLE + .invokeExact(targetClass, LOOKUP); + } else { + return java.security.AccessController.doPrivileged((PrivilegedExceptionAction) () -> { + try { + return (MethodHandles.Lookup) METHOD_HANDLES_PRIVATE_LOOKUP_IN_METHOD_HANDLE + .invokeExact(targetClass, LOOKUP); + } catch (Throwable throwable) { + if (throwable instanceof Error) { + throw (Error) throwable; + } else { + throw (Exception) throwable; + } + } + }); + } + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectiveInvoker.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectiveInvoker.java new file mode 100644 index 000000000000..e931092d8f81 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/ReflectiveInvoker.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation; + +/** + * Interface that defines an implementation-agnostic way to invoke APIs reflectively. + */ +public interface ReflectiveInvoker { + /** + * Invokes an API that doesn't have a target. + *

+ * APIs without a target are constructors and static methods. + * + * @return The result of invoking the API. + * @param args The arguments to pass to the API. + * @throws Exception If the API invocation fails. + */ + Object invokeStatic(Object... args) throws Exception; + + /** + * Invokes the API on the target object with the provided arguments. + * + * @param target The target object to invoke the API on. + * @param args The arguments to pass to the API. + * @return The result of invoking the API. + * @throws Exception If the API invocation fails. + */ + Object invokeWithArguments(Object target, Object... args) throws Exception; + + /** + * Gets the number of parameters the API takes. + * + * @return The number of parameters the API takes. + */ + int getParameterCount(); +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/ResponseConstructorsCache.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/ResponseConstructorsCache.java index ab9ac9e95166..5f7510731ebe 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/ResponseConstructorsCache.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/ResponseConstructorsCache.java @@ -7,12 +7,11 @@ import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.Response; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.implementation.serializer.HttpResponseDecoder; import com.azure.core.util.logging.ClientLogger; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.lang.reflect.Constructor; import java.util.Arrays; import java.util.Comparator; @@ -20,7 +19,7 @@ import java.util.concurrent.ConcurrentHashMap; /** - * A concurrent cache of {@link Response} {@link MethodHandle} constructors. + * A concurrent cache of {@link Response} {@link ReflectiveInvoker} constructors. */ public final class ResponseConstructorsCache { private static final String THREE_PARAM_ERROR = "Failed to deserialize 3-parameter response."; @@ -28,23 +27,23 @@ public final class ResponseConstructorsCache { private static final String FIVE_PARAM_ERROR = "Failed to deserialize 5-parameter response."; private static final String INVALID_PARAM_COUNT = "Response constructor with expected parameters not found."; - private static final Map, MethodHandle> CACHE = new ConcurrentHashMap<>(); + private static final Map, ReflectiveInvoker> CACHE = new ConcurrentHashMap<>(); private static final ClientLogger LOGGER = new ClientLogger(ResponseConstructorsCache.class); /** - * Identify the suitable {@link MethodHandle} to construct the given response class. + * Identify the suitable {@link ReflectiveInvoker} to construct the given response class. * * @param responseClass The response class. - * @return The {@link MethodHandle} that is capable of constructing an instance of the class or null if no handle is + * @return The {@link ReflectiveInvoker} that is capable of constructing an instance of the class or null if no handle is * found. */ - public MethodHandle get(Class> responseClass) { + public ReflectiveInvoker get(Class> responseClass) { return CACHE.computeIfAbsent(responseClass, ResponseConstructorsCache::locateResponseConstructor); } /** - * Identify the most specific {@link MethodHandle} to construct the given response class. + * Identify the most specific {@link ReflectiveInvoker} to construct the given response class. *

* Lookup is the following order: *

    @@ -58,26 +57,10 @@ public MethodHandle get(Class> responseClass) { * amount of resources. * * @param responseClass The response class. - * @return The {@link MethodHandle} that is capable of constructing an instance of the class or null if no handle is + * @return The {@link ReflectiveInvoker} that is capable of constructing an instance of the class or null if no handle is * found. */ - private static MethodHandle locateResponseConstructor(Class responseClass) { - MethodHandles.Lookup lookupToUse; - try { - lookupToUse = ReflectionUtils.getLookupToUse(responseClass); - } catch (Exception ex) { - if (ex instanceof RuntimeException) { - throw LOGGER.logExceptionAsError((RuntimeException) ex); - } - - throw LOGGER.logExceptionAsError(new RuntimeException(ex)); - } - - /* - * Now that the MethodHandles.Lookup has been found to create the MethodHandle instance begin searching for - * the most specific MethodHandle that can be used to create the response class (as mentioned in the method - * Javadocs). - */ + private static ReflectiveInvoker locateResponseConstructor(Class responseClass) { Constructor[] constructors = responseClass.getDeclaredConstructors(); // Sort constructors in the "descending order" of parameter count. Arrays.sort(constructors, Comparator.comparing(Constructor::getParameterCount, (a, b) -> b - a)); @@ -94,8 +77,12 @@ private static MethodHandle locateResponseConstructor(Class responseClass) { * 3) SDK libraries create an accessible MethodHandles.Lookup which com.azure.core can use to spoof * as the SDK library. */ - return lookupToUse.unreflectConstructor(constructor); - } catch (IllegalAccessException ex) { + return ReflectionUtils.getConstructorInvoker(responseClass, constructor); + } catch (Exception ex) { + if (ex instanceof RuntimeException) { + throw LOGGER.logExceptionAsError((RuntimeException) ex); + } + throw LOGGER.logExceptionAsError(new RuntimeException(ex)); } } @@ -109,49 +96,45 @@ private static MethodHandle locateResponseConstructor(Class responseClass) { } /** - * Invoke the {@link MethodHandle} to construct and instance of the response class. + * Invoke the {@link ReflectiveInvoker} to construct and instance of the response class. * - * @param handle The {@link MethodHandle} capable of constructing an instance of the response class. + * @param reflectiveInvoker The {@link ReflectiveInvoker} capable of constructing an instance of the response class. * @param decodedResponse The decoded HTTP response. * @param bodyAsObject The HTTP response body. * @return An instance of the {@link Response} implementation. */ - public Response invoke(final MethodHandle handle, - final HttpResponseDecoder.HttpDecodedResponse decodedResponse, final Object bodyAsObject) { + public Response invoke(ReflectiveInvoker reflectiveInvoker, HttpResponseDecoder.HttpDecodedResponse decodedResponse, + Object bodyAsObject) { final HttpResponse httpResponse = decodedResponse.getSourceResponse(); final HttpRequest httpRequest = httpResponse.getRequest(); final int responseStatusCode = httpResponse.getStatusCode(); final HttpHeaders responseHeaders = httpResponse.getHeaders(); - final int paramCount = handle.type().parameterCount(); + final int paramCount = reflectiveInvoker.getParameterCount(); switch (paramCount) { case 3: - return constructResponse(handle, THREE_PARAM_ERROR, httpRequest, responseStatusCode, + return constructResponse(reflectiveInvoker, THREE_PARAM_ERROR, httpRequest, responseStatusCode, responseHeaders); case 4: - return constructResponse(handle, FOUR_PARAM_ERROR, httpRequest, responseStatusCode, + return constructResponse(reflectiveInvoker, FOUR_PARAM_ERROR, httpRequest, responseStatusCode, responseHeaders, bodyAsObject); case 5: - return constructResponse(handle, FIVE_PARAM_ERROR, httpRequest, responseStatusCode, + return constructResponse(reflectiveInvoker, FIVE_PARAM_ERROR, httpRequest, responseStatusCode, responseHeaders, bodyAsObject, decodedResponse.getDecodedHeaders()); default: throw LOGGER.logExceptionAsError(new IllegalStateException(INVALID_PARAM_COUNT)); } } - private static Response constructResponse(MethodHandle handle, String exceptionMessage, Object... params) { + private static Response constructResponse(ReflectiveInvoker reflectiveInvoker, String exceptionMessage, Object... params) { try { - return (Response) handle.invokeWithArguments(params); - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; - } - - if (throwable instanceof RuntimeException) { - throw LOGGER.logExceptionAsError((RuntimeException) throwable); + return (Response) reflectiveInvoker.invokeStatic(params); + } catch (Exception exception) { + if (exception instanceof RuntimeException) { + throw LOGGER.logExceptionAsError((RuntimeException) exception); } - throw LOGGER.logExceptionAsError(new IllegalStateException(exceptionMessage, throwable)); + throw LOGGER.logExceptionAsError(new IllegalStateException(exceptionMessage, exception)); } } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/ResponseExceptionConstructorCache.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/ResponseExceptionConstructorCache.java index 05448318a949..a812fd26b574 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/ResponseExceptionConstructorCache.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/ResponseExceptionConstructorCache.java @@ -5,41 +5,36 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpResponse; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.reflect.Constructor; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** - * A concurrent cache of {@link HttpResponseException} {@link MethodHandle} constructors. + * A concurrent cache of {@link HttpResponseException} {@link ReflectiveInvoker} constructors. */ public final class ResponseExceptionConstructorCache { - private static final Map, MethodHandle> CACHE = new ConcurrentHashMap<>(); + private static final Map, ReflectiveInvoker> CACHE = new ConcurrentHashMap<>(); private static final ClientLogger LOGGER = new ClientLogger(ResponseExceptionConstructorCache.class); /** - * Identifies the suitable {@link MethodHandle} to construct the given exception class. + * Identifies the suitable {@link ReflectiveInvoker} to construct the given exception class. * * @param exceptionClass The exception class. - * @return The {@link MethodHandle} that is capable of constructing an instance of the class, or null if no handle + * @return The {@link ReflectiveInvoker} that is capable of constructing an instance of the class, or null if no handle * is found. */ - public MethodHandle get(Class exceptionClass, Class exceptionBodyType) { + public ReflectiveInvoker get(Class exceptionClass, Class exceptionBodyType) { return CACHE.computeIfAbsent(exceptionClass, key -> locateExceptionConstructor(key, exceptionBodyType)); } - private static MethodHandle locateExceptionConstructor(Class exceptionClass, + private static ReflectiveInvoker locateExceptionConstructor(Class exceptionClass, Class exceptionBodyType) { try { - MethodHandles.Lookup lookupToUse = ReflectionUtils.getLookupToUse(exceptionClass); - Constructor constructor = exceptionClass.getConstructor(String.class, HttpResponse.class, - exceptionBodyType); - - return lookupToUse.unreflectConstructor(constructor); + return ReflectionUtils.getConstructorInvoker(exceptionClass, + exceptionClass.getConstructor(String.class, HttpResponse.class, exceptionBodyType)); } catch (Exception ex) { if (ex instanceof RuntimeException) { throw LOGGER.logExceptionAsError((RuntimeException) ex); @@ -50,20 +45,16 @@ private static MethodHandle locateExceptionConstructor(Class T invoke(MethodHandle handle, String exceptionMessage, + static T invoke(ReflectiveInvoker reflectiveInvoker, String exceptionMessage, HttpResponse httpResponse, Object exceptionBody) { try { - return (T) handle.invokeWithArguments(exceptionMessage, httpResponse, exceptionBody); - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; - } - - if (throwable instanceof RuntimeException) { - throw LOGGER.logExceptionAsError((RuntimeException) throwable); + return (T) reflectiveInvoker.invokeWithArguments(exceptionMessage, httpResponse, exceptionBody); + } catch (Exception exception) { + if (exception instanceof RuntimeException) { + throw LOGGER.logExceptionAsError((RuntimeException) exception); } - throw LOGGER.logExceptionAsError(new IllegalStateException(exceptionMessage, throwable)); + throw LOGGER.logExceptionAsError(new IllegalStateException(exceptionMessage, exception)); } } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java index 02488db114a7..ea1aa827b0ad 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/rest/RestProxyBase.java @@ -22,6 +22,7 @@ import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.ResponseBase; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionSerializable; import com.azure.core.implementation.TypeUtil; import com.azure.core.implementation.http.UnexpectedExceptionInformation; @@ -37,7 +38,6 @@ import reactor.core.Exceptions; import java.io.IOException; -import java.lang.invoke.MethodHandle; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.net.URL; @@ -165,8 +165,8 @@ public Response createResponse(HttpResponseDecoder.HttpDecodedResponse response, // Ideally, in the future the SDKs won't need to dabble in reflection here as the Response subtypes should be // given a way to register their constructor as a callback method that consumes HttpDecodedResponse and the // body as an Object. - MethodHandle constructorHandle = RESPONSE_CONSTRUCTORS_CACHE.get(cls); - return RESPONSE_CONSTRUCTORS_CACHE.invoke(constructorHandle, response, bodyAsObject); + ReflectiveInvoker constructorReflectiveInvoker = RESPONSE_CONSTRUCTORS_CACHE.get(cls); + return RESPONSE_CONSTRUCTORS_CACHE.invoke(constructorReflectiveInvoker, response, bodyAsObject); } /** @@ -351,9 +351,9 @@ public static HttpResponseException instantiateUnexpectedException(UnexpectedExc // Finally, if the HttpResponseException subclass doesn't exist in azure-core, use reflection to create a // new instance of it. try { - MethodHandle handle = RESPONSE_EXCEPTION_CONSTRUCTOR_CACHE.get(exceptionType, + ReflectiveInvoker reflectiveInvoker = RESPONSE_EXCEPTION_CONSTRUCTOR_CACHE.get(exceptionType, exception.getExceptionBodyType()); - return ResponseExceptionConstructorCache.invoke(handle, exceptionMessage.toString(), httpResponse, + return ResponseExceptionConstructorCache.invoke(reflectiveInvoker, exceptionMessage.toString(), httpResponse, responseDecodedContent); } catch (RuntimeException e) { // And if reflection fails, return an HttpResponseException. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/HeaderCollectionHandler.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/HeaderCollectionHandler.java index a5a0cf07898d..fc1787bb708a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/HeaderCollectionHandler.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/HeaderCollectionHandler.java @@ -3,14 +3,12 @@ package com.azure.core.implementation.jackson; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.security.PrivilegedAction; import java.util.HashMap; import java.util.Locale; @@ -22,10 +20,10 @@ */ final class HeaderCollectionHandler { private static final int CACHE_SIZE_LIMIT = 10000; - private static final Map FIELD_TO_SETTER_CACHE = new ConcurrentHashMap<>(); + private static final Map FIELD_TO_SETTER_INVOKER_CACHE = new ConcurrentHashMap<>(); // Dummy constant that indicates no setter was found for the Field. - private static final MethodHandle NO_SETTER_HANDLE = MethodHandles.identity(HeaderCollectionHandler.class); + private static final ReflectiveInvoker NO_SETTER_REFLECTIVE_INVOKER = ReflectionUtils.createNoOpInvoker(); private final String prefix; private final int prefixLength; @@ -86,24 +84,23 @@ private boolean usePublicSetter(Object deserializedHeaders, ClientLogger logger) final String clazzSimpleName = clazz.getSimpleName(); final String fieldName = declaringField.getName(); - MethodHandle setterHandler = getFromCache(declaringField, clazz, clazzSimpleName, fieldName, logger); + ReflectiveInvoker + setterReflectiveInvoker = getFromCache(declaringField, clazz, clazzSimpleName, fieldName, logger); - if (setterHandler == NO_SETTER_HANDLE) { + if (setterReflectiveInvoker == NO_SETTER_REFLECTIVE_INVOKER) { return false; } try { - setterHandler.invokeWithArguments(deserializedHeaders, values); - logger.verbose("Set header collection {} on class {} using MethodHandle.", fieldName, clazzSimpleName); + setterReflectiveInvoker.invokeWithArguments(deserializedHeaders, values); + logger.log(LogLevel.VERBOSE, () -> + "Set header collection " + fieldName + " on class " + clazzSimpleName + " using reflection."); return true; - } catch (Throwable ex) { - if (ex instanceof Error) { - throw (Error) ex; - } - - logger.verbose("Failed to set header {} collection on class {} using MethodHandle.", fieldName, - clazzSimpleName, ex); + } catch (Exception ex) { + logger.log(LogLevel.VERBOSE, () -> + "Failed to set header " + fieldName + " collection on class " + clazzSimpleName + " using reflection.", + ex); return false; } } @@ -112,58 +109,27 @@ private static String getPotentialSetterName(String fieldName) { return "set" + fieldName.substring(0, 1).toUpperCase(Locale.ROOT) + fieldName.substring(1); } - private static MethodHandle getFromCache(Field key, Class clazz, String clazzSimpleName, + private static ReflectiveInvoker getFromCache(Field key, Class clazz, String clazzSimpleName, String fieldName, ClientLogger logger) { - if (FIELD_TO_SETTER_CACHE.size() >= CACHE_SIZE_LIMIT) { - FIELD_TO_SETTER_CACHE.clear(); + if (FIELD_TO_SETTER_INVOKER_CACHE.size() >= CACHE_SIZE_LIMIT) { + FIELD_TO_SETTER_INVOKER_CACHE.clear(); } - return FIELD_TO_SETTER_CACHE.computeIfAbsent(key, field -> { - MethodHandles.Lookup lookupToUse; - try { - lookupToUse = ReflectionUtils.getLookupToUse(clazz); - } catch (Exception ex) { - logger.verbose("Failed to retrieve MethodHandles.Lookup for field {}. Will attempt to make field accessible.", field, ex); - - // In a previous implementation compute returned null here in an attempt to indicate that there is no - // setter for the field. Unfortunately, null isn't a valid indicator to computeIfAbsent that a - // computation has been performed and this cache would never effectively be a cache as compute would - // always be performed when there was no setter for the field. - // - // Now the implementation returns a dummy constant when there is no setter for the field. This now - // results in this case properly inserting into the cache and only running when a new type is seen or - // the cache is cleared due to reaching capacity. - return NO_SETTER_HANDLE; - } - + return FIELD_TO_SETTER_INVOKER_CACHE.computeIfAbsent(key, field -> { String setterName = getPotentialSetterName(fieldName); try { - MethodHandle handle = lookupToUse.findVirtual(clazz, setterName, - MethodType.methodType(clazz, Map.class)); + ReflectiveInvoker reflectiveInvoker = ReflectionUtils.getMethodInvoker(clazz, + clazz.getDeclaredMethod(setterName, Map.class)); - logger.verbose("Using MethodHandle for setter {} on class {}.", setterName, clazzSimpleName); + logger.log(LogLevel.VERBOSE, () -> + "Using invoker for setter " + setterName + " on class " + clazzSimpleName + "."); - return handle; - } catch (ReflectiveOperationException ex) { - logger.verbose("Failed to retrieve MethodHandle for setter {} on class {}. " - + "Will attempt to make field accessible. " - + "Please consider adding public setter.", setterName, - clazzSimpleName, ex); - } - - try { - Method setterMethod = clazz.getDeclaredMethod(setterName, Map.class); - MethodHandle handle = lookupToUse.unreflect(setterMethod); - - logger.verbose("Using unreflected MethodHandle for setter {} on class {}.", setterName, - clazzSimpleName); - - return handle; - } catch (ReflectiveOperationException ex) { - logger.verbose("Failed to unreflect MethodHandle for setter {} on class {}." - + "Will attempt to make field accessible. " - + "Please consider adding public setter.", setterName, clazzSimpleName, ex); + return reflectiveInvoker; + } catch (Exception ex) { + logger.log(LogLevel.VERBOSE, () -> + "Failed to retrieve invoker for setter " + setterName + " on class " + clazzSimpleName + + ". Will attempt to make field accessible. Please consider adding public setter.", ex); } // In a previous implementation compute returned null here in an attempt to indicate that there is no setter @@ -174,7 +140,7 @@ private static MethodHandle getFromCache(Field key, Class clazz, String clazz // Now the implementation returns a dummy constant when there is no setter for the field. This now results // in this case properly inserting into the cache and only running when a new type is seen or the cache is // cleared due to reaching capacity. - return NO_SETTER_HANDLE; + return NO_SETTER_REFLECTIVE_INVOKER; }); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/JacksonDatabind215.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/JacksonDatabind215.java index bbba7ac6caa8..75c05df72e4e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/JacksonDatabind215.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/JacksonDatabind215.java @@ -3,13 +3,12 @@ package com.azure.core.implementation.jackson; +import com.azure.core.implementation.ReflectiveInvoker; +import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; - /** * Utility methods for Jackson Databind types when it's known that the version is 2.15+. */ @@ -18,39 +17,38 @@ final class JacksonDatabind215 { private static final String STREAM_READ_CONSTRAINTS = "com.fasterxml.jackson.core.StreamReadConstraints"; private static final String STREAM_READ_CONSTRAINTS_BUILDER = STREAM_READ_CONSTRAINTS + "$Builder"; - private static final MethodHandle CREATE_STREAM_READ_CONSTRAINTS_BUILDER; - private static final MethodHandle SET_MAX_STRING_LENGTH; - private static final MethodHandle BUILD_STREAM_READ_CONSTRAINTS; - private static final MethodHandle SET_STREAM_READ_CONSTRAINTS; + private static final ReflectiveInvoker CREATE_STREAM_READ_CONSTRAINTS_BUILDER; + private static final ReflectiveInvoker SET_MAX_STRING_LENGTH; + private static final ReflectiveInvoker BUILD_STREAM_READ_CONSTRAINTS; + private static final ReflectiveInvoker SET_STREAM_READ_CONSTRAINTS; private static final boolean USE_JACKSON_215; static { - MethodHandles.Lookup publicLookup = MethodHandles.publicLookup(); ClassLoader thisClassLoader = JacksonDatabind215.class.getClassLoader(); - MethodHandle createStreamReadConstraintsBuilder = null; - MethodHandle setMaxStringLength = null; - MethodHandle buildStreamReadConstraints = null; - MethodHandle setStreamReadConstraints = null; + ReflectiveInvoker createStreamReadConstraintsBuilder = null; + ReflectiveInvoker setMaxStringLength = null; + ReflectiveInvoker buildStreamReadConstraints = null; + ReflectiveInvoker setStreamReadConstraints = null; boolean useJackson215 = false; try { Class streamReadConstraints = Class.forName(STREAM_READ_CONSTRAINTS, true, thisClassLoader); Class streamReadConstraintsBuilder = Class.forName(STREAM_READ_CONSTRAINTS_BUILDER, true, thisClassLoader); - createStreamReadConstraintsBuilder = publicLookup.unreflect(streamReadConstraints - .getDeclaredMethod("builder")); - setMaxStringLength = publicLookup.unreflect(streamReadConstraintsBuilder - .getDeclaredMethod("maxStringLength", int.class)); - buildStreamReadConstraints = publicLookup.unreflect(streamReadConstraintsBuilder - .getDeclaredMethod("build")); - setStreamReadConstraints = publicLookup.unreflect(JsonFactory.class.getDeclaredMethod( - "setStreamReadConstraints", streamReadConstraints)); + createStreamReadConstraintsBuilder = ReflectionUtils.getMethodInvoker(streamReadConstraints, + streamReadConstraints.getDeclaredMethod("builder"), false); + setMaxStringLength = ReflectionUtils.getMethodInvoker(streamReadConstraintsBuilder, + streamReadConstraintsBuilder.getDeclaredMethod("maxStringLength", int.class), false); + buildStreamReadConstraints = ReflectionUtils.getMethodInvoker(streamReadConstraintsBuilder, + streamReadConstraintsBuilder.getDeclaredMethod("build"), false); + setStreamReadConstraints = ReflectionUtils.getMethodInvoker(JsonFactory.class, + JsonFactory.class.getDeclaredMethod("setStreamReadConstraints", streamReadConstraints), false); useJackson215 = true; } catch (Throwable ex) { if (ex instanceof LinkageError) { - LOGGER.info("Attempted to create MethodHandles for Jackson 2.15 features but failed. It's possible " + LOGGER.info("Attempted to create invoker for Jackson 2.15 features but failed. It's possible " + "that your application will run without error even with this failure. The Azure SDKs only set " + "updated StreamReadConstraints to allow for larger payloads to be handled."); } else if (ex instanceof Error) { @@ -79,19 +77,19 @@ static ObjectMapper mutateStreamReadConstraints(ObjectMapper objectMapper) { } try { - Object streamReadConstraintsBuilder = CREATE_STREAM_READ_CONSTRAINTS_BUILDER.invoke(); + Object streamReadConstraintsBuilder = CREATE_STREAM_READ_CONSTRAINTS_BUILDER.invokeStatic(); - SET_MAX_STRING_LENGTH.invoke(streamReadConstraintsBuilder, 50 * 1024 * 1024); - SET_STREAM_READ_CONSTRAINTS.invoke(objectMapper.tokenStreamFactory(), - BUILD_STREAM_READ_CONSTRAINTS.invoke(streamReadConstraintsBuilder)); + SET_MAX_STRING_LENGTH.invokeWithArguments(streamReadConstraintsBuilder, 50 * 1024 * 1024); + SET_STREAM_READ_CONSTRAINTS.invokeWithArguments(objectMapper.tokenStreamFactory(), + BUILD_STREAM_READ_CONSTRAINTS.invokeWithArguments(streamReadConstraintsBuilder)); return objectMapper; - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; - } else { - throw LOGGER.logExceptionAsError(new IllegalStateException(throwable)); + } catch (Exception exception) { + if (exception instanceof RuntimeException) { + throw LOGGER.logExceptionAsError((RuntimeException) exception); } + + throw LOGGER.logExceptionAsError(new IllegalStateException(exception)); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/JsonSerializableDeserializer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/JsonSerializableDeserializer.java index d50065f9cba9..77603d3f9971 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/JsonSerializableDeserializer.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/JsonSerializableDeserializer.java @@ -3,6 +3,7 @@ package com.azure.core.implementation.jackson; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; @@ -17,8 +18,6 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import java.io.IOException; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; final class JsonSerializableDeserializer extends JsonDeserializer> { private static final ClientLogger LOGGER = new ClientLogger(JsonSerializableDeserializer.class); @@ -36,7 +35,7 @@ public JsonDeserializer modifyDeserializer(DeserializationConfig config, Bean }); private final Class> jsonSerializableType; - private final MethodHandle readJson; + private final ReflectiveInvoker readJson; /** * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. @@ -55,8 +54,8 @@ public static Module getModule() { JsonSerializableDeserializer(Class> jsonSerializableType) { this.jsonSerializableType = jsonSerializableType; try { - MethodHandles.Lookup lookup = ReflectionUtils.getLookupToUse(jsonSerializableType); - this.readJson = lookup.unreflect(jsonSerializableType.getDeclaredMethod("fromJson", JsonReader.class)); + this.readJson = ReflectionUtils.getMethodInvoker(jsonSerializableType, jsonSerializableType + .getDeclaredMethod("fromJson", JsonReader.class)); } catch (Exception e) { throw LOGGER.logExceptionAsError(new IllegalStateException(e)); } @@ -66,13 +65,11 @@ public static Module getModule() { public JsonSerializable deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { try { return jsonSerializableType.cast(readJson.invokeWithArguments(AzureJsonUtils.createReader(p))); - } catch (Throwable e) { + } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; - } else if (e instanceof Exception) { - throw new IOException(e); } else { - throw (Error) e; + throw new IOException(e); } } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/ObjectMapperShim.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/ObjectMapperShim.java index 179e678cd34e..d2f766644fef 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/ObjectMapperShim.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/ObjectMapperShim.java @@ -6,6 +6,7 @@ import com.azure.core.annotation.HeaderCollection; import com.azure.core.http.HttpHeader; import com.azure.core.http.HttpHeaders; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.ReflectionUtils; import com.azure.core.implementation.TypeUtil; import com.azure.core.util.logging.ClientLogger; @@ -16,8 +17,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.ParameterizedType; @@ -43,11 +42,11 @@ public final class ObjectMapperShim { private static final int CACHE_SIZE_LIMIT = 10000; private static final Map TYPE_TO_JAVA_TYPE_CACHE = new ConcurrentHashMap<>(); - private static final Map TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE - = new ConcurrentHashMap<>(); + private static final Map TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE = + new ConcurrentHashMap<>(); // Dummy constant that indicates an HttpHeaders-based constructor wasn't found for the Type. - private static final MethodHandle NO_CONSTRUCTOR_HANDLE = MethodHandles.identity(ObjectMapperShim.class); + private static final ReflectiveInvoker NO_CONSTRUCTOR_REFLECTIVE_INVOKER = ReflectionUtils.createNoOpInvoker(); /** * Creates and configures JSON {@code ObjectMapper} capable of serializing azure.core types, with flattening and @@ -298,22 +297,18 @@ public T deserialize(HttpHeaders headers, Type deserializedHeadersType) thro } try { - MethodHandle constructor = getFromHeadersConstructorCache(deserializedHeadersType); + ReflectiveInvoker constructor = getFromHeadersConstructorCache(deserializedHeadersType); - if (constructor != NO_CONSTRUCTOR_HANDLE) { + if (constructor != NO_CONSTRUCTOR_REFLECTIVE_INVOKER) { return (T) constructor.invokeWithArguments(headers); } - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; - } - + } catch (Exception exception) { // invokeWithArguments will fail with a non-RuntimeException if the reflective call was invalid. - if (throwable instanceof RuntimeException) { - throw (RuntimeException) throwable; + if (exception instanceof RuntimeException) { + throw (RuntimeException) exception; } - LOGGER.verbose("Failed to find or use MethodHandle Constructor that accepts HttpHeaders for " + LOGGER.verbose("Failed to find or use invoker Constructor that accepts HttpHeaders for " + deserializedHeadersType + "."); } @@ -428,7 +423,7 @@ private static JavaType getFromTypeCache(Type key, Function comp return TYPE_TO_JAVA_TYPE_CACHE.computeIfAbsent(key, compute); } - private static MethodHandle getFromHeadersConstructorCache(Type key) { + private static ReflectiveInvoker getFromHeadersConstructorCache(Type key) { if (TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE.size() >= CACHE_SIZE_LIMIT) { TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE.clear(); } @@ -436,8 +431,8 @@ private static MethodHandle getFromHeadersConstructorCache(Type key) { return TYPE_TO_STRONGLY_TYPED_HEADERS_CONSTRUCTOR_CACHE.computeIfAbsent(key, type -> { try { Class headersClass = TypeUtil.getRawClass(type); - MethodHandles.Lookup lookup = ReflectionUtils.getLookupToUse(headersClass); - return lookup.unreflectConstructor(headersClass.getDeclaredConstructor(HttpHeaders.class)); + return ReflectionUtils.getConstructorInvoker(headersClass, + headersClass.getDeclaredConstructor(HttpHeaders.class)); } catch (Throwable throwable) { if (throwable instanceof Error) { throw (Error) throwable; @@ -453,7 +448,7 @@ private static MethodHandle getFromHeadersConstructorCache(Type key) { // new type is seen or the cache is cleared due to reaching capacity. // // With this change, benchmarking deserialize(HttpHeaders, Type) saw a 20% performance improvement. - return NO_CONSTRUCTOR_HANDLE; + return NO_CONSTRUCTOR_REFLECTIVE_INVOKER; } }); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/XmlMapperFactory.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/XmlMapperFactory.java index 88053cc01d6f..f511d7e25e29 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/XmlMapperFactory.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/jackson/XmlMapperFactory.java @@ -3,14 +3,14 @@ package com.azure.core.implementation.jackson; +import com.azure.core.implementation.ReflectiveInvoker; +import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.logging.LogLevel; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.cfg.MapperBuilder; import com.fasterxml.jackson.databind.cfg.PackageVersion; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.lang.reflect.Array; public final class XmlMapperFactory { @@ -20,11 +20,11 @@ public final class XmlMapperFactory { private static final String XML_MAPPER_BUILDER = "com.fasterxml.jackson.dataformat.xml.XmlMapper$Builder"; private static final String FROM_XML_PARSER = "com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser$Feature"; private static final String TO_XML_GENERATOR = "com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator$Feature"; - private final MethodHandle createXmlMapperBuilder; - private final MethodHandle defaultUseWrapper; - private final MethodHandle enableWriteXmlDeclaration; + private final ReflectiveInvoker createXmlMapperBuilder; + private final ReflectiveInvoker defaultUseWrapper; + private final ReflectiveInvoker enableWriteXmlDeclaration; private final Object writeXmlDeclaration; - private final MethodHandle enableEmptyElementAsNull; + private final ReflectiveInvoker enableEmptyElementAsNull; private final Object emptyElementAsNull; final boolean useJackson212; @@ -33,14 +33,13 @@ public final class XmlMapperFactory { public static final XmlMapperFactory INSTANCE = new XmlMapperFactory(); private XmlMapperFactory() { - MethodHandles.Lookup publicLookup = MethodHandles.publicLookup(); ClassLoader thisClassLoader = XmlMapperFactory.class.getClassLoader(); - MethodHandle createXmlMapperBuilder; - MethodHandle defaultUseWrapper; - MethodHandle enableWriteXmlDeclaration; + ReflectiveInvoker createXmlMapperBuilder; + ReflectiveInvoker defaultUseWrapper; + ReflectiveInvoker enableWriteXmlDeclaration; Object writeXmlDeclaration; - MethodHandle enableEmptyElementAsNull; + ReflectiveInvoker enableEmptyElementAsNull; Object emptyElementAsNull; try { Class xmlMapper = Class.forName(XML_MAPPER, true, thisClassLoader); @@ -48,15 +47,16 @@ private XmlMapperFactory() { Class fromXmlParser = Class.forName(FROM_XML_PARSER, true, thisClassLoader); Class toXmlGenerator = Class.forName(TO_XML_GENERATOR, true, thisClassLoader); - createXmlMapperBuilder = publicLookup.unreflect(xmlMapper.getDeclaredMethod("builder")); - defaultUseWrapper = publicLookup.unreflect(xmlMapperBuilder.getDeclaredMethod("defaultUseWrapper", - boolean.class)); + createXmlMapperBuilder = ReflectionUtils.getMethodInvoker(xmlMapper, xmlMapper.getDeclaredMethod("builder"), + false); + defaultUseWrapper = ReflectionUtils.getMethodInvoker(xmlMapperBuilder, + xmlMapperBuilder.getDeclaredMethod("defaultUseWrapper", boolean.class), false); - enableWriteXmlDeclaration = publicLookup.unreflect(xmlMapperBuilder.getDeclaredMethod("enable", - Array.newInstance(toXmlGenerator, 0).getClass())); + enableWriteXmlDeclaration = ReflectionUtils.getMethodInvoker(xmlMapperBuilder, + xmlMapperBuilder.getDeclaredMethod("enable", Array.newInstance(toXmlGenerator, 0).getClass()), false); writeXmlDeclaration = toXmlGenerator.getDeclaredField("WRITE_XML_DECLARATION").get(null); - enableEmptyElementAsNull = publicLookup.unreflect(xmlMapperBuilder.getDeclaredMethod("enable", - Array.newInstance(fromXmlParser, 0).getClass())); + enableEmptyElementAsNull = ReflectionUtils.getMethodInvoker(xmlMapperBuilder, + xmlMapperBuilder.getDeclaredMethod("enable", Array.newInstance(fromXmlParser, 0).getClass()), false); emptyElementAsNull = fromXmlParser.getDeclaredField("EMPTY_ELEMENT_AS_NULL").get(null); } catch (Throwable ex) { // Throw the Error only if it isn't a LinkageError. @@ -65,7 +65,7 @@ private XmlMapperFactory() { throw (Error) ex; } - throw LOGGER.logExceptionAsError(new IllegalStateException("Failed to retrieve MethodHandles used to " + throw LOGGER.logExceptionAsError(new IllegalStateException("Failed to retrieve invoker used to " + "create XmlMapper. XML serialization won't be supported until " + "'com.fasterxml.jackson.dataformat:jackson-dataformat-xml' is added to the classpath or updated to a " + "supported version. " + JacksonVersion.getHelpInfo(), ex)); @@ -85,7 +85,7 @@ public ObjectMapper createXmlMapper() { ObjectMapper xmlMapper; try { MapperBuilder xmlMapperBuilder = ObjectMapperFactory - .initializeMapperBuilder((MapperBuilder) createXmlMapperBuilder.invoke()); + .initializeMapperBuilder((MapperBuilder) createXmlMapperBuilder.invokeStatic()); defaultUseWrapper.invokeWithArguments(xmlMapperBuilder, false); enableWriteXmlDeclaration.invokeWithArguments(xmlMapperBuilder, writeXmlDeclaration); @@ -97,12 +97,13 @@ public ObjectMapper createXmlMapper() { enableEmptyElementAsNull.invokeWithArguments(xmlMapperBuilder, emptyElementAsNull); xmlMapper = xmlMapperBuilder.build(); - } catch (Throwable e) { - if (e instanceof Error) { - throw (Error) e; + } catch (Exception exception) { + if (exception instanceof RuntimeException) { + throw LOGGER.logExceptionAsError((RuntimeException) exception); } - throw LOGGER.logExceptionAsError(new IllegalStateException("Unable to create XmlMapper instance.", e)); + throw LOGGER.logExceptionAsError(new IllegalStateException("Unable to create XmlMapper instance.", + exception)); } if (useJackson212 && jackson212IsSafe) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/logging/DefaultLogger.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/logging/DefaultLogger.java index 3d4e9411fd42..c40fe8e2d6c3 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/logging/DefaultLogger.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/logging/DefaultLogger.java @@ -12,16 +12,16 @@ import java.io.PrintWriter; import java.io.StringWriter; +import java.nio.charset.StandardCharsets; import java.nio.file.InvalidPathException; import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoField; /** * This class is an internal implementation of slf4j logger. */ public final class DefaultLogger extends MarkerIgnoringBase { private static final long serialVersionUID = -144261058636441630L; - private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); // The template for the log message: // YYYY-MM-DD HH:MM:ss.SSS [thread] [level] classpath - message @@ -49,7 +49,7 @@ public final class DefaultLogger extends MarkerIgnoringBase { * @param clazz Class creating the logger. */ public DefaultLogger(Class clazz) { - this(clazz.getName()); + this(clazz.getCanonicalName(), false); } /** @@ -59,14 +59,20 @@ public DefaultLogger(Class clazz) { * name passes in. */ public DefaultLogger(String className) { - String classPath; + this(getClassPathFromClassName(className), false); + } + + private static String getClassPathFromClassName(String className) { try { - classPath = Class.forName(className).getCanonicalName(); + return Class.forName(className).getCanonicalName(); } catch (ClassNotFoundException | InvalidPathException e) { // Swallow ClassNotFoundException as the passed class name may not correlate to an actual class. // Swallow InvalidPathException as the className may contain characters that aren't legal file characters. - classPath = className; + return className; } + } + + private DefaultLogger(String classPath, boolean ignored) { this.classPath = classPath; int configuredLogLevel = fromEnvironment().getLogLevel(); @@ -75,7 +81,6 @@ public DefaultLogger(String className) { isInfoEnabled = LogLevel.INFORMATIONAL.getLogLevel() >= configuredLogLevel; isWarnEnabled = LogLevel.WARNING.getLogLevel() >= configuredLogLevel; isErrorEnabled = LogLevel.ERROR.getLogLevel() >= configuredLogLevel; - } private static LogLevel fromEnvironment() { @@ -377,9 +382,57 @@ private void log(String levelName, String message, Throwable t) { * * @return The current time in {@code DATE_FORMAT} */ - private String getFormattedDate() { + private static String getFormattedDate() { LocalDateTime now = LocalDateTime.now(); - return DATE_FORMAT.format(now); + + // yyyy-MM-dd HH:mm:ss.SSS + // 23 characters that will be ASCII + byte[] bytes = new byte[23]; + + // yyyy- + int year = now.getYear(); + int round = year / 1000; + bytes[0] = (byte) ('0' + round); + year = year - (1000 * round); + round = year / 100; + bytes[1] = (byte) ('0' + round); + year = year - (100 * round); + round = year / 10; + bytes[2] = (byte) ('0' + round); + bytes[3] = (byte) ('0' + (year - (10 * round))); + bytes[4] = '-'; + + // MM- + zeroPad(now.getDayOfMonth(), bytes, 5); + bytes[7] = '-'; + + // dd + zeroPad(now.getDayOfMonth(), bytes, 8); + bytes[10] = ' '; + + // HH: + zeroPad(now.getHour(), bytes, 11); + bytes[13] = ':'; + + // mm: + zeroPad(now.getMinute(), bytes, 14); + bytes[16] = ':'; + + // ss. + zeroPad(now.getSecond(), bytes, 17); + bytes[19] = '.'; + + // SSS + int millis = now.get(ChronoField.MILLI_OF_SECOND); + round = millis / 100; + bytes[20] = (byte) ('0' + round); + millis = millis - (100 * round); + round = millis / 10; + bytes[21] = (byte) ('0' + round); + bytes[22] = (byte) ('0' + (millis - (10 * round))); + + // Use UTF-8 as it's more performant than ASCII in Java 8 + return new String(bytes, StandardCharsets.UTF_8); } /** @@ -398,4 +451,15 @@ void writeWithThrowable(StringBuilder stringBuilder, Throwable t) { } System.out.print(stringBuilder.toString()); } + + private static void zeroPad(int value, byte[] bytes, int index) { + if (value < 10) { + bytes[index++] = '0'; + bytes[index] = (byte) ('0' + value); + } else { + int high = value / 10; + bytes[index++] = (byte) ('0' + high); + bytes[index] = (byte) ('0' + (value - (10 * high))); + } + } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ReferenceManagerImpl.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ReferenceManagerImpl.java index 662a023a86ca..64977478aa86 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ReferenceManagerImpl.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ReferenceManagerImpl.java @@ -3,12 +3,12 @@ package com.azure.core.implementation.util; +import com.azure.core.implementation.ReflectiveInvoker; +import com.azure.core.implementation.ReflectionUtils; import com.azure.core.util.ReferenceManager; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.logging.LogLevel; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.lang.ref.ReferenceQueue; import java.util.Objects; import java.util.concurrent.ThreadFactory; @@ -27,18 +27,18 @@ public final class ReferenceManagerImpl implements ReferenceManager { private static final String BASE_THREAD_NAME = "azure-sdk-referencemanager"; private static final Object CLEANER; - private static final MethodHandle CLEANER_REGISTER; + private static final ReflectiveInvoker CLEANER_REGISTER; static { Object cleaner = null; - MethodHandle cleanerRegister = null; + ReflectiveInvoker cleanerRegister = null; try { - MethodHandles.Lookup lookup = MethodHandles.lookup(); Class cleanerClass = Class.forName("java.lang.ref.Cleaner"); cleaner = cleanerClass.getDeclaredMethod("create", ThreadFactory.class) .invoke(null, (ThreadFactory) r -> new Thread(r, BASE_THREAD_NAME)); - cleanerRegister = lookup.unreflect(cleanerClass.getMethod("register", Object.class, Runnable.class)); - } catch (ReflectiveOperationException ex) { + cleanerRegister = ReflectionUtils.getMethodInvoker(cleanerClass, + cleanerClass.getDeclaredMethod("register", Object.class, Runnable.class), false); + } catch (Exception ex) { LOGGER.log(LogLevel.VERBOSE, () -> "Unable to use java.lang.ref.Cleaner to manage references.", ex); } @@ -93,14 +93,12 @@ public void register(Object object, Runnable cleanupAction) { new CleanableReference<>(object, cleanupAction, this); } else { try { - CLEANER_REGISTER.invoke(CLEANER, object, cleanupAction); - } catch (Throwable throwable) { - if (throwable instanceof Error) { - throw (Error) throwable; - } else if (throwable instanceof RuntimeException) { - throw LOGGER.logExceptionAsError((RuntimeException) throwable); + CLEANER_REGISTER.invokeWithArguments(CLEANER, object, cleanupAction); + } catch (Exception exception) { + if (exception instanceof RuntimeException) { + throw LOGGER.logExceptionAsError((RuntimeException) exception); } else { - throw LOGGER.logExceptionAsError(new RuntimeException(throwable)); + throw LOGGER.logExceptionAsError(new RuntimeException(exception)); } } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java index 5eec79c5bea7..d60c9e61cc41 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java @@ -4,26 +4,24 @@ package com.azure.core.util; import com.azure.core.implementation.ReflectionUtils; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.logging.LogLevel; import com.fasterxml.jackson.annotation.JsonValue; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.Collection; import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; -import static java.lang.invoke.MethodType.methodType; - /** * Base implementation for expandable, single string enums. * * @param a specific expandable enum type */ public abstract class ExpandableStringEnum> { - private static final Map, MethodHandle> CONSTRUCTORS = new ConcurrentHashMap<>(); + private static final Map, ReflectiveInvoker> CONSTRUCTORS = new ConcurrentHashMap<>(); private static final Map, ConcurrentHashMap>> VALUES = new ConcurrentHashMap<>(); @@ -65,7 +63,11 @@ protected static > T fromString(String name, C if (value != null) { return value; } else { - MethodHandle ctor = CONSTRUCTORS.computeIfAbsent(clazz, ExpandableStringEnum::getDefaultConstructor); + if (CONSTRUCTORS.size() > 10000) { + CONSTRUCTORS.clear(); + } + + ReflectiveInvoker ctor = CONSTRUCTORS.computeIfAbsent(clazz, ExpandableStringEnum::getDefaultConstructor); if (ctor == null) { // logged in ExpandableStringEnum::getDefaultConstructor @@ -73,9 +75,10 @@ protected static > T fromString(String name, C } try { - value = (T) ctor.invoke(); - } catch (Throwable e) { - LOGGER.warning("Failed to create {}, default constructor threw exception", clazz.getName(), e); + value = (T) ctor.invokeWithArguments(null); + } catch (Exception e) { + LOGGER.log(LogLevel.WARNING, + () -> "Failed to create " + clazz.getName() + ", default constructor threw exception", e); return null; } @@ -83,14 +86,14 @@ protected static > T fromString(String name, C } } - private static MethodHandle getDefaultConstructor(Class clazz) { + private static ReflectiveInvoker getDefaultConstructor(Class clazz) { try { - MethodHandles.Lookup lookup = ReflectionUtils.getLookupToUse(clazz); - return lookup.findConstructor(clazz, methodType(void.class)); + return ReflectionUtils.getConstructorInvoker(clazz, clazz.getDeclaredConstructor()); } catch (NoSuchMethodException | IllegalAccessException e) { - LOGGER.verbose("Can't find or access default constructor for {}, make sure corresponding package is open to azure-core", clazz.getName(), e); + LOGGER.log(LogLevel.VERBOSE, () -> "Can't find or access default constructor for " + clazz.getName() + + ", make sure corresponding package is open to azure-core", e); } catch (Exception e) { - LOGGER.verbose("Failed to get lookup for {}", clazz.getName(), e); + LOGGER.log(LogLevel.VERBOSE, () -> "Failed to get default constructor for " + clazz.getName(), e); } return null; diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/PollerFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/PollerFlux.java index 691ffe6eceac..63342da5212d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/PollerFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/PollerFlux.java @@ -512,13 +512,7 @@ private Flux> pollingLoop() { */ private Duration getDelay(PollResponse pollResponse) { Duration retryAfter = pollResponse.getRetryAfter(); - if (retryAfter == null) { - return this.pollInterval; - } else { - return retryAfter.compareTo(Duration.ZERO) > 0 - ? retryAfter - : this.pollInterval; - } + return (retryAfter == null || retryAfter.isNegative() || retryAfter.isZero()) ? this.pollInterval : retryAfter; } /** diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/credential/TokenCacheTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/credential/TokenCacheTests.java index 5bdb343d02f2..518e0465212a 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/credential/TokenCacheTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/credential/TokenCacheTests.java @@ -4,7 +4,6 @@ package com.azure.core.credential; import com.azure.core.implementation.AccessTokenCache; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -19,18 +18,14 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -import java.util.stream.Collectors; import java.util.stream.IntStream; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; public class TokenCacheTests { + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); - @BeforeEach - void beforeEach() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } @Test public void testOnlyOneThreadRefreshesToken() { AtomicLong refreshes = new AtomicLong(0); @@ -47,7 +42,8 @@ public void testOnlyOneThreadRefreshesToken() { .runOn(Schedulers.boundedElastic()) .flatMap(start -> cache.getToken()) .then()) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Ensure that only one refresh attempt is made. assertEquals(1, refreshes.get()); @@ -71,7 +67,8 @@ public void testOnlyOneAsyncThreadRefreshesToken() { .runOn(Schedulers.boundedElastic()) .flatMap(start -> cache.getToken(new TokenRequestContext(), false)) .then()) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Ensure that only one refresh attempt is made. assertEquals(1, refreshes.get()); @@ -94,9 +91,11 @@ public void testEachAsyncThreadRefreshesToken() { .parallel(5) // Runs cache.getToken() on 5 different threads .runOn(Schedulers.boundedElastic()) - .flatMap(start -> cache.getToken(new TokenRequestContext().addScopes("test" + atomicInteger.incrementAndGet() + "/.default"), true)) + .flatMap(start -> cache.getToken(new TokenRequestContext() + .addScopes("test" + atomicInteger.incrementAndGet() + "/.default"), true)) .then()) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Ensure that refresh attempts are made. assertEquals(5, refreshes.get()); @@ -119,7 +118,7 @@ public void testEachSyncThreadRefreshesToken() { .flatMap(integer -> { cache.getTokenSync(new TokenRequestContext().addScopes("test" + integer + "/.default"), true); return IntStream.of(integer); - }).boxed().collect(Collectors.toList()); + }).forEach(ignored -> { }); // Ensure that refresh attempts are made. assertEquals(5, refreshes.get()); @@ -143,7 +142,7 @@ public void testOnlyOneSyncThreadRefreshesToken() { .flatMap(integer -> { cache.getTokenSync(new TokenRequestContext(), false); return IntStream.of(integer); - }).boxed().collect(Collectors.toList()); + }).forEach(ignored -> { }); // Ensure that only one refresh attempt is made. assertEquals(1, refreshes.get()); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HttpLoggingPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HttpLoggingPolicyTests.java index e4a20a13620f..86861fa6c5e9 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HttpLoggingPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HttpLoggingPolicyTests.java @@ -22,11 +22,12 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -44,7 +45,6 @@ import java.io.ByteArrayInputStream; import java.io.PrintStream; import java.net.MalformedURLException; -import java.net.URL; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -75,12 +75,30 @@ @ResourceLock(Resources.SYSTEM_OUT) public class HttpLoggingPolicyTests { private static final String REDACTED = "REDACTED"; - private static final Context CONTEXT = new Context("caller-method", HttpLoggingPolicyTests.class.getName()); private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); - private PrintStream originalSystemOut; + private static String initialLogLevel; + private static PrintStream originalSystemOut; + private AccessibleByteArrayOutputStream logCaptureStream; + @BeforeAll + public static void captureInitialLogLevel() { + initialLogLevel = EnvironmentConfiguration.getGlobalConfiguration().get(PROPERTY_AZURE_LOG_LEVEL); + originalSystemOut = System.out; + } + + @AfterAll + public static void resetInitialLogLevel() { + if (initialLogLevel == null) { + EnvironmentConfiguration.getGlobalConfiguration().remove(PROPERTY_AZURE_LOG_LEVEL); + } else { + EnvironmentConfiguration.getGlobalConfiguration().put(PROPERTY_AZURE_LOG_LEVEL, initialLogLevel); + } + + System.setOut(originalSystemOut); + } + @BeforeEach public void prepareForTest() { // Set the log level to information for the test. @@ -90,7 +108,6 @@ public void prepareForTest() { * DefaultLogger uses System.out to log. Inject a custom PrintStream to log into for the duration of the test to * capture the log messages. */ - originalSystemOut = System.out; logCaptureStream = new AccessibleByteArrayOutputStream(); System.setOut(new PrintStream(logCaptureStream)); } @@ -99,9 +116,6 @@ public void prepareForTest() { public void cleanupAfterTest() { // Reset or clear the log level after the test completes. clearTestLogLevel(); - - // Reset System.err to the original PrintStream. - System.setOut(originalSystemOut); } /** @@ -118,7 +132,8 @@ public void redactQueryParameters(String requestUrl, String expectedQueryString, .httpClient(new NoOpHttpClient()) .build(); - StepVerifier.create(pipeline.send(new HttpRequest(HttpMethod.POST, requestUrl), CONTEXT)) + StepVerifier.create(pipeline.send(new HttpRequest(HttpMethod.POST, requestUrl), + getCallerMethodContext("redactQueryParameters"))) .verifyComplete(); assertTrue(convertOutputStreamToString(logCaptureStream).contains(expectedQueryString)); @@ -138,7 +153,8 @@ public void redactQueryParametersSync(String requestUrl, String expectedQueryStr .httpClient(new NoOpHttpClient()) .build(); - pipeline.sendSync(new HttpRequest(HttpMethod.POST, requestUrl), CONTEXT); + pipeline.sendSync(new HttpRequest(HttpMethod.POST, requestUrl), + getCallerMethodContext("redactQueryParametersSync")); assertTrue(convertOutputStreamToString(logCaptureStream).contains(expectedQueryString)); } @@ -174,7 +190,7 @@ private static Stream redactQueryParametersSupplier() { @MethodSource("validateLoggingDoesNotConsumeSupplier") public void validateLoggingDoesNotConsumeRequest(Flux stream, byte[] data, int contentLength) throws MalformedURLException { - URL requestUrl = createUrl("https://test.com"); + String url = "https://test.com/validateLoggingDoesNotConsumeRequest"; HttpHeaders requestHeaders = new HttpHeaders() .set(HttpHeaderName.CONTENT_TYPE, ContentType.APPLICATION_JSON) .set(HttpHeaderName.CONTENT_LENGTH, Integer.toString(contentLength)); @@ -186,15 +202,15 @@ public void validateLoggingDoesNotConsumeRequest(Flux stream, byte[] .then(Mono.empty())) .build(); - StepVerifier.create(pipeline.send(new HttpRequest(HttpMethod.POST, requestUrl, requestHeaders, stream), - CONTEXT)) + StepVerifier.create(pipeline.send(new HttpRequest(HttpMethod.POST, createUrl(url), requestHeaders, stream), + getCallerMethodContext("validateLoggingDoesNotConsumeRequest"))) .verifyComplete(); String logString = convertOutputStreamToString(logCaptureStream); List messages = HttpLogMessage.fromString(logString); assertEquals(1, messages.size()); - HttpLogMessage expectedRequest = HttpLogMessage.request(HttpMethod.POST, "https://test.com", data); + HttpLogMessage expectedRequest = HttpLogMessage.request(HttpMethod.POST, url, data); expectedRequest.assertEqual(messages.get(0), HttpLogDetailLevel.BODY, LogLevel.INFORMATIONAL); } @@ -206,7 +222,7 @@ public void validateLoggingDoesNotConsumeRequest(Flux stream, byte[] @Execution(ExecutionMode.SAME_THREAD) public void validateLoggingDoesNotConsumeRequestSync(BinaryData requestBody, byte[] data, int contentLength) throws MalformedURLException { - URL requestUrl = createUrl("https://test.com"); + String url = "https://test.com/validateLoggingDoesNotConsumeRequestSync"; HttpHeaders requestHeaders = new HttpHeaders() .set(HttpHeaderName.CONTENT_TYPE, ContentType.APPLICATION_JSON) .set(HttpHeaderName.CONTENT_LENGTH, Integer.toString(contentLength)); @@ -218,13 +234,14 @@ public void validateLoggingDoesNotConsumeRequestSync(BinaryData requestBody, byt .then(Mono.empty())) .build(); - pipeline.sendSync(new HttpRequest(HttpMethod.POST, requestUrl, requestHeaders, requestBody), CONTEXT); + pipeline.sendSync(new HttpRequest(HttpMethod.POST, createUrl(url), requestHeaders, requestBody), + getCallerMethodContext("validateLoggingDoesNotConsumeRequestSync")); String logString = convertOutputStreamToString(logCaptureStream); List messages = HttpLogMessage.fromString(logString); assertEquals(1, messages.size()); - HttpLogMessage expectedRequest = HttpLogMessage.request(HttpMethod.POST, "https://test.com", data); + HttpLogMessage expectedRequest = HttpLogMessage.request(HttpMethod.POST, url, data); expectedRequest.assertEqual(messages.get(0), HttpLogDetailLevel.BODY, LogLevel.INFORMATIONAL); } @@ -234,7 +251,7 @@ public void validateLoggingDoesNotConsumeRequestSync(BinaryData requestBody, byt @ParameterizedTest(name = "[{index}] {displayName}") @MethodSource("validateLoggingDoesNotConsumeSupplier") public void validateLoggingDoesNotConsumeResponse(Flux stream, byte[] data, int contentLength) { - HttpRequest request = new HttpRequest(HttpMethod.GET, "https://test.com"); + HttpRequest request = new HttpRequest(HttpMethod.GET, "https://test.com/validateLoggingDoesNotConsumeResponse"); HttpHeaders responseHeaders = new HttpHeaders() .set(HttpHeaderName.CONTENT_TYPE, ContentType.APPLICATION_JSON) .set(HttpHeaderName.CONTENT_LENGTH, Integer.toString(contentLength)); @@ -244,7 +261,7 @@ public void validateLoggingDoesNotConsumeResponse(Flux stream, byte[ .httpClient(ignored -> Mono.just(new MockHttpResponse(ignored, responseHeaders, stream))) .build(); - StepVerifier.create(pipeline.send(request, CONTEXT)) + StepVerifier.create(pipeline.send(request, getCallerMethodContext("validateLoggingDoesNotConsumeResponse"))) .assertNext(response -> StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(response.getBody())) .assertNext(bytes -> assertArraysEqual(data, bytes)) .verifyComplete()) @@ -260,7 +277,7 @@ public void validateLoggingDoesNotConsumeResponse(Flux stream, byte[ @ParameterizedTest(name = "[{index}] {displayName}") @MethodSource("validateLoggingDoesNotConsumeSupplierSync") public void validateLoggingDoesNotConsumeResponseSync(BinaryData responseBody, byte[] data, int contentLength) { - HttpRequest request = new HttpRequest(HttpMethod.GET, "https://test.com"); + HttpRequest request = new HttpRequest(HttpMethod.GET, "https://test./validateLoggingDoesNotConsumeResponseSync"); HttpHeaders responseHeaders = new HttpHeaders() .set(HttpHeaderName.CONTENT_TYPE, ContentType.APPLICATION_JSON) .set(HttpHeaderName.CONTENT_LENGTH, Integer.toString(contentLength)); @@ -270,8 +287,10 @@ public void validateLoggingDoesNotConsumeResponseSync(BinaryData responseBody, b .httpClient(ignored -> Mono.just(new MockHttpResponse(ignored, responseHeaders, responseBody))) .build(); - HttpResponse response = pipeline.sendSync(request, CONTEXT); - assertArraysEqual(data, response.getBodyAsByteArray().block()); + try (HttpResponse response = pipeline.sendSync(request, + getCallerMethodContext("validateLoggingDoesNotConsumeResponseSync"))) { + assertArraysEqual(data, response.getBodyAsBinaryData().toBytes()); + } String logString = convertOutputStreamToString(logCaptureStream); assertTrue(logString.contains(new String(data, StandardCharsets.UTF_8))); @@ -395,10 +414,10 @@ public Mono getBodyAsString(Charset charset) { @ParameterizedTest(name = "[{index}] {displayName}") @EnumSource(value = HttpLogDetailLevel.class, mode = EnumSource.Mode.INCLUDE, names = {"BASIC", "HEADERS", "BODY", "BODY_AND_HEADERS"}) - public void loggingIncludesRetryCount(HttpLogDetailLevel logLevel) - throws JsonProcessingException, InterruptedException { + public void loggingIncludesRetryCount(HttpLogDetailLevel logLevel) { AtomicInteger requestCount = new AtomicInteger(); - HttpRequest request = new HttpRequest(HttpMethod.GET, "https://test.com") + String url = "https://test.com/loggingIncludesRetryCount/" + logLevel; + HttpRequest request = new HttpRequest(HttpMethod.GET, url) .setHeader(HttpHeaderName.X_MS_CLIENT_REQUEST_ID, "client-request-id"); byte[] responseBody = new byte[] {24, 42}; @@ -410,42 +429,47 @@ public void loggingIncludesRetryCount(HttpLogDetailLevel logLevel) .policies(new RetryPolicy(), new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(logLevel))) .httpClient(ignored -> (requestCount.getAndIncrement() == 0) ? Mono.error(new RuntimeException("Try again!")) - : Mono.fromCallable( - () -> new com.azure.core.http.MockHttpResponse(ignored, 200, responseHeaders, responseBody))) + : Mono.just(new com.azure.core.http.MockHttpResponse(ignored, 200, responseHeaders, responseBody))) .build(); - HttpLogMessage expectedRetry1 = HttpLogMessage.request(HttpMethod.GET, "https://test.com", null) + HttpLogMessage expectedRetry1 = HttpLogMessage.request(HttpMethod.GET, url, null) .setTryCount(1) .setHeaders(request.getHeaders()); - HttpLogMessage expectedRetry2 = HttpLogMessage.request(HttpMethod.GET, "https://test.com", null) + HttpLogMessage expectedRetry2 = HttpLogMessage.request(HttpMethod.GET, url, null) .setTryCount(2) .setHeaders(request.getHeaders()); - HttpLogMessage expectedResponse = HttpLogMessage.response("https://test.com", responseBody, 200) + HttpLogMessage expectedResponse = HttpLogMessage.response(url, responseBody, 200) .setHeaders(responseHeaders); - StepVerifier.create(pipeline.send(request, CONTEXT) - .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getBody())) - .doFinally(s -> { - String logString = convertOutputStreamToString(logCaptureStream); - List messages = HttpLogMessage.fromString(logString); - assertEquals(3, messages.size()); - - expectedRetry1.assertEqual(messages.get(0), logLevel, LogLevel.INFORMATIONAL); - expectedRetry2.assertEqual(messages.get(1), logLevel, LogLevel.INFORMATIONAL); - expectedResponse.assertEqual(messages.get(2), logLevel, LogLevel.INFORMATIONAL); - })) + StepVerifier.create(pipeline.send(request, getCallerMethodContext("loggingIncludesRetryCount")) + .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getBody()))) .assertNext(body -> assertArraysEqual(responseBody, body)) .verifyComplete(); + + String logString = convertOutputStreamToString(logCaptureStream); + + + // if HttpLoggingPolicy logger was created when verbose was enabled, + // there is no way to change it. + List messages = HttpLogMessage.fromString(logString).stream() + .filter(m -> !m.getMessage().equals("Error resume.")).collect(Collectors.toList()); + + expectedRetry1.assertEqual(messages.get(0), logLevel, LogLevel.INFORMATIONAL); + expectedRetry2.assertEqual(messages.get(1), logLevel, LogLevel.INFORMATIONAL); + expectedResponse.assertEqual(messages.get(2), logLevel, LogLevel.INFORMATIONAL); + + assertEquals(3, messages.size()); } @ParameterizedTest(name = "[{index}] {displayName}") @EnumSource(value = HttpLogDetailLevel.class, mode = EnumSource.Mode.INCLUDE, names = {"BASIC", "HEADERS", "BODY", "BODY_AND_HEADERS"}) - public void loggingHeadersAndBodyVerbose(HttpLogDetailLevel logLevel) throws JsonProcessingException { + public void loggingHeadersAndBodyVerbose(HttpLogDetailLevel logLevel) { setupLogLevel(LogLevel.VERBOSE.getLogLevel()); byte[] requestBody = new byte[] {42}; byte[] responseBody = new byte[] {24, 42}; - HttpRequest request = new HttpRequest(HttpMethod.POST, "https://test.com") + String url = "https://test.com/loggingHeadersAndBodyVerbose/" + logLevel; + HttpRequest request = new HttpRequest(HttpMethod.POST, url) .setBody(requestBody) .setHeader(HttpHeaderName.X_MS_CLIENT_REQUEST_ID, "client-request-id"); @@ -458,24 +482,24 @@ public void loggingHeadersAndBodyVerbose(HttpLogDetailLevel logLevel) throws Jso .httpClient(r -> Mono.just(new com.azure.core.http.MockHttpResponse(r, 200, responseHeaders, responseBody))) .build(); - HttpLogMessage expectedRequest = HttpLogMessage.request(HttpMethod.POST, "https://test.com", requestBody) - .setHeaders(request.getHeaders()); - HttpLogMessage expectedResponse = HttpLogMessage.response("https://test.com", responseBody, 200) + HttpLogMessage expectedRequest = HttpLogMessage.request(HttpMethod.POST, url, requestBody) + .setHeaders(request.getHeaders()) + .setTryCount(1); + HttpLogMessage expectedResponse = HttpLogMessage.response(url, responseBody, 200) .setHeaders(responseHeaders); - StepVerifier.create(pipeline.send(request, CONTEXT) - .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getBody())) - .doFinally(s -> { - String logString = convertOutputStreamToString(logCaptureStream); - - List messages = HttpLogMessage.fromString(logString); - assertEquals(2, messages.size()); - - expectedRequest.assertEqual(messages.get(0), logLevel, LogLevel.VERBOSE); - expectedResponse.assertEqual(messages.get(1), logLevel, LogLevel.VERBOSE); - })) + StepVerifier.create(pipeline.send(request, getCallerMethodContext("loggingHeadersAndBodyVerbose")) + .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getBody()))) .assertNext(body -> assertArraysEqual(responseBody, body)) .verifyComplete(); + + String logString = convertOutputStreamToString(logCaptureStream); + + List messages = HttpLogMessage.fromString(logString); + assertEquals(2, messages.size()); + + expectedRequest.assertEqual(messages.get(0), logLevel, LogLevel.VERBOSE); + expectedResponse.assertEqual(messages.get(1), logLevel, LogLevel.VERBOSE); } @ParameterizedTest(name = "[{index}] {displayName}") @@ -483,7 +507,8 @@ public void loggingHeadersAndBodyVerbose(HttpLogDetailLevel logLevel) throws Jso names = {"BASIC", "HEADERS", "BODY", "BODY_AND_HEADERS"}) public void loggingIncludesRetryCountSync(HttpLogDetailLevel logLevel) { AtomicInteger requestCount = new AtomicInteger(); - HttpRequest request = new HttpRequest(HttpMethod.GET, "https://test.com") + String url = "https://test.com/loggingIncludesRetryCountSync/" + logLevel; + HttpRequest request = new HttpRequest(HttpMethod.GET, url) .setHeader(HttpHeaderName.X_MS_CLIENT_REQUEST_ID, "client-request-id"); byte[] responseBody = new byte[] {24, 42}; @@ -498,16 +523,17 @@ public void loggingIncludesRetryCountSync(HttpLogDetailLevel logLevel) { : Mono.just(new com.azure.core.http.MockHttpResponse(ignored, 200, responseHeaders, responseBody))) .build(); - HttpLogMessage expectedRetry1 = HttpLogMessage.request(HttpMethod.GET, "https://test.com", null) + HttpLogMessage expectedRetry1 = HttpLogMessage.request(HttpMethod.GET, url, null) .setTryCount(1) .setHeaders(request.getHeaders()); - HttpLogMessage expectedRetry2 = HttpLogMessage.request(HttpMethod.GET, "https://test.com", null) + HttpLogMessage expectedRetry2 = HttpLogMessage.request(HttpMethod.GET, url, null) .setTryCount(2) .setHeaders(request.getHeaders()); - HttpLogMessage expectedResponse = HttpLogMessage.response("https://test.com", responseBody, 200) + HttpLogMessage expectedResponse = HttpLogMessage.response(url, responseBody, 200) .setHeaders(responseHeaders); - try (HttpResponse response = pipeline.sendSync(request, CONTEXT)) { + try (HttpResponse response = pipeline.sendSync(request, + getCallerMethodContext("loggingIncludesRetryCountSync"))) { BinaryData content = response.getBodyAsBinaryData(); assertEquals(2, requestCount.get()); String logString = convertOutputStreamToString(logCaptureStream); @@ -534,7 +560,8 @@ public void loggingHeadersAndBodyVerboseSync(HttpLogDetailLevel logLevel) { setupLogLevel(LogLevel.VERBOSE.getLogLevel()); byte[] requestBody = new byte[] {42}; byte[] responseBody = new byte[] {24, 42}; - HttpRequest request = new HttpRequest(HttpMethod.POST, "https://test.com") + String url = "https://test.com/loggingHeadersAndBodyVerboseSync/" + logLevel; + HttpRequest request = new HttpRequest(HttpMethod.POST, url) .setBody(requestBody) .setHeader(HttpHeaderName.X_MS_CLIENT_REQUEST_ID, "client-request-id"); @@ -547,13 +574,32 @@ public void loggingHeadersAndBodyVerboseSync(HttpLogDetailLevel logLevel) { .httpClient(r -> Mono.just(new com.azure.core.http.MockHttpResponse(r, 200, responseHeaders, responseBody))) .build(); - HttpLogMessage expectedRequest = HttpLogMessage.request(HttpMethod.POST, "https://test.com", requestBody) - .setHeaders(request.getHeaders()); - HttpLogMessage expectedResponse = HttpLogMessage.response("https://test.com", responseBody, 200) + HttpLogMessage expectedRequest = HttpLogMessage.request(HttpMethod.POST, url, requestBody) + .setHeaders(request.getHeaders()) + .setTryCount(1); + HttpLogMessage expectedResponse = HttpLogMessage.response(url, responseBody, 200) .setHeaders(responseHeaders); - HttpResponse response = pipeline.sendSync(request, CONTEXT); - assertArraysEqual(responseBody, response.getBodyAsByteArray().block()); + try (HttpResponse response = pipeline.sendSync(request, + getCallerMethodContext("loggingHeadersAndBodyVerboseSync"))) { + assertArraysEqual(responseBody, response.getBodyAsBinaryData().toBytes()); + + String logString = convertOutputStreamToString(logCaptureStream); + + // if HttpLoggingPolicy logger was created when verbose was enabled, + // there is no way to change it. + List messages = HttpLogMessage.fromString(logString).stream() + .filter(m -> !m.getMessage().equals("Error resume.")).collect(Collectors.toList()); + + assertEquals(2, messages.size(), logString); + + expectedRequest.assertEqual(messages.get(0), logLevel, LogLevel.VERBOSE); + expectedResponse.assertEqual(messages.get(1), logLevel, LogLevel.VERBOSE); + } + } + + private static Context getCallerMethodContext(String testMethodName) { + return new Context("caller-method", HttpLoggingPolicyTests.class.getName() + "." + testMethodName); } private void setupLogLevel(int logLevelToSet) { @@ -733,7 +779,6 @@ public static List fromString(String logRecord) { } void assertEqual(HttpLogMessage other, HttpLogDetailLevel httpLevel, LogLevel logLevel) { - assertEquals(this.message, other.message); assertEquals(this.method, other.method); assertEquals(this.url, other.url); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/RestProxyResponseConstructionBenchmark.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/RestProxyResponseConstructionBenchmark.java index 1fd3a2f9d331..74a1b6fd999c 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/RestProxyResponseConstructionBenchmark.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/RestProxyResponseConstructionBenchmark.java @@ -6,6 +6,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpRequest; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.TypeUtil; import com.azure.core.implementation.http.rest.ResponseConstructorsCache; import org.openjdk.jmh.annotations.Benchmark; @@ -19,7 +20,6 @@ import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.infra.Blackhole; -import java.lang.invoke.MethodHandle; import java.util.concurrent.TimeUnit; /** @@ -57,11 +57,11 @@ public void directConstruction(Blackhole blackhole) { /** * Benchmarks creating a {@link Response} type using the {@link ResponseConstructorsCache} and the - * {@link MethodHandle} it caches that points to the Response type's constructor. + * {@link ReflectiveInvoker} it caches that points to the Response type's constructor. */ @Benchmark public void reflectionConstruction(Blackhole blackhole) throws Throwable { - MethodHandle constructor = CONSTRUCTORS_CACHE.get(RESPONSE_TYPE); + ReflectiveInvoker constructor = CONSTRUCTORS_CACHE.get(RESPONSE_TYPE); blackhole.consume(constructor.invokeWithArguments(REQUEST, 200, HEADERS, "value", DESERIALIZED_HEADERS)); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/ReflectionUtilsTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/ReflectionUtilsTests.java index 1ac7ab9aab9b..8c936f308e77 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/ReflectionUtilsTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/ReflectionUtilsTests.java @@ -3,27 +3,89 @@ package com.azure.core.implementation; +import com.azure.core.http.HttpHeaders; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledForJreRange; +import org.junit.jupiter.api.condition.EnabledIf; +import org.junit.jupiter.api.condition.JRE; +import org.junit.jupiter.api.function.Executable; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; /** * Tests for {@link ReflectionUtils}. */ public class ReflectionUtilsTests { - /* - * This is an integration test instead of a unit test because integration tests use the generated JAR, with - * multi-release support, instead of the class files in Maven's output directory. Given that, the integration tests - * will hook into the different Java version implementations. - */ + @EnabledForJreRange(max = JRE.JAVA_8) @Test - public void validateImplementationVersion() { - String javaSpecificationVersion = System.getProperty("java.specification.version"); - if ("1.8".equals(javaSpecificationVersion)) { - assertFalse(ReflectionUtils.isModuleBased(), "Java 8 can't use module-based privateLookupIn."); - } else { - assertTrue(ReflectionUtils.isModuleBased(), "Java 9+ must use module-based privateLookupIn."); + public void java8UsesClassicReflection() { + assertFalse(ReflectionUtils.isModuleBased()); + } + + @EnabledForJreRange(min = JRE.JAVA_9) + @Test + public void java9PlusUsesModuleBasedPrivateLookupIn() { + assertTrue(ReflectionUtils.isModuleBased()); + } + + @EnabledIf("invokePackageUnavailable") + @Test + public void classicReflectionUsedWhenInvokePackageUnavailable() { + assertFalse(ReflectionUtils.isModuleBased()); + } + + private static boolean invokePackageUnavailable() { + try { + Class.forName("java.lang.invoke.MethodHandles"); + return false; + } catch (ClassNotFoundException ex) { + return true; + } + } + + @ParameterizedTest + @MethodSource("validateNullPointerExceptionThrownSupplier") + public void validateNullPointerExceptionThrown(Executable executable) { + assertThrows(NullPointerException.class, executable); + } + + @SuppressWarnings("DataFlowIssue") + private static Stream validateNullPointerExceptionThrownSupplier() { + return Stream.of( + () -> ReflectionUtils.getConstructorInvoker(null, null), + () -> ReflectionUtils.getConstructorInvoker(null, null, false), + () -> ReflectionUtils.getMethodInvoker(null, null), + () -> ReflectionUtils.getMethodInvoker(null, null, false) + ); + } + + @ParameterizedTest + @MethodSource("nullTargetClassUsesAnImplicitClassSupplier") + public void nullTargetClassUsesAnImplicitClass(Executable executable) { + assertDoesNotThrow(executable); + } + + private static Stream nullTargetClassUsesAnImplicitClassSupplier() { + try { + Constructor httpHeadersConstructor = HttpHeaders.class.getDeclaredConstructor(); + Method httpHeadersSet = HttpHeaders.class.getDeclaredMethod("set", String.class, String.class); + return Stream.of( + () -> ReflectionUtils.getConstructorInvoker(null, httpHeadersConstructor), + () -> ReflectionUtils.getConstructorInvoker(null, httpHeadersConstructor, true), + () -> ReflectionUtils.getMethodInvoker(null, httpHeadersSet), + () -> ReflectionUtils.getMethodInvoker(null, httpHeadersSet, true) + ); + } catch (ReflectiveOperationException ex) { + throw new RuntimeException(ex); } } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/rest/ResponseConstructorsCacheBenchMark.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/rest/ResponseConstructorsCacheBenchMark.java index 889f3b2ec887..e608797537d7 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/rest/ResponseConstructorsCacheBenchMark.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/rest/ResponseConstructorsCacheBenchMark.java @@ -4,6 +4,7 @@ package com.azure.core.implementation.http.rest; import com.azure.core.http.rest.Response; +import com.azure.core.implementation.ReflectiveInvoker; import com.azure.core.implementation.TypeUtil; import org.openjdk.jmh.Main; import org.openjdk.jmh.annotations.Benchmark; @@ -21,7 +22,6 @@ import reactor.core.publisher.Mono; import java.io.IOException; -import java.lang.invoke.MethodHandle; import java.lang.reflect.Constructor; import java.util.concurrent.TimeUnit; @@ -55,9 +55,9 @@ public void reflectionCache(Blackhole blackhole) { Class> responseClass = (Class>) TypeUtil.getRawClass(inputs[i].returnType()); // Step1: Locate Constructor using Reflection. - MethodHandle handle = defaultCache.get(responseClass); + ReflectiveInvoker reflectiveInvoker = defaultCache.get(responseClass); // Step2: Invoke Constructor using Reflection. - Response response = defaultCache.invoke(handle, inputs[i].decodedResponse(), + Response response = defaultCache.invoke(reflectiveInvoker, inputs[i].decodedResponse(), inputs[i].bodyAsObject()); // avoid JVM dead code detection blackhole.consume(response); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/util/UrlBuilderTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/util/UrlBuilderTests.java index 85952a986395..64ed6a00cfc8 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/util/UrlBuilderTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/util/UrlBuilderTests.java @@ -806,8 +806,8 @@ public void parallelParsing() throws InterruptedException { public void fluxParallelParsing() { AtomicInteger callCount = new AtomicInteger(); Mono mono = Flux.range(0, 20000) - .parallel() - .runOn(Schedulers.parallel()) + .parallel(Runtime.getRuntime().availableProcessors()) + .runOn(Schedulers.boundedElastic()) .map(i -> { callCount.incrementAndGet(); return UrlBuilder.parse("https://example" + i + ".com"); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/util/polling/PollerTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/util/polling/PollerTests.java index 23d8147dcfe9..2197b41cdb3a 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/util/polling/PollerTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/util/polling/PollerTests.java @@ -14,6 +14,7 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiFunction; import java.util.function.Function; @@ -374,14 +375,14 @@ public void verifyExceptionPropagationFromPollingOperation() { Function, Mono> activationOperation = ignored -> Mono.just(activationResponse); - final AtomicReference cnt = new AtomicReference<>(0); + final AtomicInteger cnt = new AtomicInteger(); Function, Mono>> pollOperation = (pollingContext) -> { - cnt.getAndSet(cnt.get() + 1); - if (cnt.get() <= 2) { + int count = cnt.incrementAndGet(); + if (count <= 2) { return Mono.just(new PollResponse<>(IN_PROGRESS, new Response("1"))); - } else if (cnt.get() == 3) { + } else if (count == 3) { throw new RuntimeException("Polling operation failed!"); - } else if (cnt.get() == 4) { + } else if (count == 4) { return Mono.just(new PollResponse<>(IN_PROGRESS, new Response("2"))); } else { return Mono.just(new PollResponse<>(SUCCESSFULLY_COMPLETED, new Response("3"))); @@ -405,14 +406,14 @@ public void verifyErrorFromPollingOperation() { Function, Mono> activationOperation = ignored -> Mono.just(activationResponse); - final AtomicReference cnt = new AtomicReference<>(0); + final AtomicInteger cnt = new AtomicInteger(); Function, Mono>> pollOperation = (pollingContext) -> { - cnt.getAndSet(cnt.get() + 1); - if (cnt.get() <= 2) { + int count = cnt.incrementAndGet(); + if (count <= 2) { return Mono.just(new PollResponse<>(IN_PROGRESS, new Response("1"))); - } else if (cnt.get() == 3) { + } else if (count == 3) { return Mono.just(new PollResponse<>(FAILED, new Response("2"))); - } else if (cnt.get() == 4) { + } else if (count == 4) { return Mono.just(new PollResponse<>(IN_PROGRESS, new Response("3"))); } else { return Mono.just(new PollResponse<>(SUCCESSFULLY_COMPLETED, new Response("4"))); @@ -687,14 +688,14 @@ public void verifyExceptionPropagationFromPollingOperationSyncPoller() { Function, Mono> activationOperation = ignored -> Mono.just(activationResponse); - final AtomicReference cnt = new AtomicReference<>(0); + final AtomicInteger cnt = new AtomicInteger(); Function, Mono>> pollOperation = (pollingContext) -> { - cnt.getAndSet(cnt.get() + 1); - if (cnt.get() <= 2) { + int count = cnt.incrementAndGet(); + if (count <= 2) { return Mono.just(new PollResponse<>(IN_PROGRESS, new Response("1"))); - } else if (cnt.get() == 3) { + } else if (count == 3) { throw new RuntimeException("Polling operation failed!"); - } else if (cnt.get() == 4) { + } else if (count == 4) { return Mono.just(new PollResponse<>(IN_PROGRESS, new Response("2"))); } else { return Mono.just(new PollResponse<>(SUCCESSFULLY_COMPLETED, new Response("3"))); diff --git a/sdk/cosmos/azure-cosmos-benchmark/pom.xml b/sdk/cosmos/azure-cosmos-benchmark/pom.xml index f20ad87dad59..83d92990d83b 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/pom.xml +++ b/sdk/cosmos/azure-cosmos-benchmark/pom.xml @@ -51,13 +51,13 @@ Licensed under the MIT License. com.azure azure-cosmos - 4.50.0-beta.1 + 4.51.0-beta.1 com.azure azure-cosmos-encryption - 2.5.0-beta.1 + 2.6.0-beta.1 @@ -76,13 +76,6 @@ Licensed under the MIT License. - - - com.azure - azure-core-tracing-opentelemetry - 1.0.0-beta.39 - - com.beust jcommander @@ -189,7 +182,7 @@ Licensed under the MIT License. com.azure azure-security-keyvault-keys - 4.6.5 + 4.7.0 compile diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/AsyncBenchmark.java b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/AsyncBenchmark.java index 908dc36f70dd..dd9e0a2818d4 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/AsyncBenchmark.java +++ b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/AsyncBenchmark.java @@ -7,6 +7,7 @@ import com.azure.cosmos.CosmosAsyncClient; import com.azure.cosmos.CosmosAsyncContainer; import com.azure.cosmos.CosmosAsyncDatabase; +import com.azure.cosmos.CosmosClient; import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.CosmosDiagnosticsHandler; import com.azure.cosmos.CosmosDiagnosticsThresholds; @@ -58,6 +59,8 @@ abstract class AsyncBenchmark { private final MetricRegistry metricsRegistry = new MetricRegistry(); private final ScheduledReporter reporter; + private final ScheduledReporter resultReporter; + private volatile Meter successMeter; private volatile Meter failureMeter; private boolean databaseCreated; @@ -73,10 +76,6 @@ abstract class AsyncBenchmark { final Semaphore concurrencyControlSemaphore; Timer latency; - private static final String SUCCESS_COUNTER_METER_NAME = "#Successful Operations"; - private static final String FAILURE_COUNTER_METER_NAME = "#Unsuccessful Operations"; - private static final String LATENCY_METER_NAME = "latency"; - private AtomicBoolean warmupMode = new AtomicBoolean(false); AsyncBenchmark(Configuration cfg) { @@ -130,6 +129,8 @@ abstract class AsyncBenchmark { gatewayConnectionConfig.setMaxConnectionPoolSize(cfg.getMaxConnectionPoolSize()); cosmosClientBuilder = cosmosClientBuilder.gatewayMode(gatewayConnectionConfig); } + + CosmosClient syncClient = cosmosClientBuilder.buildClient(); cosmosClient = cosmosClientBuilder.buildAsyncClient(); try { @@ -258,6 +259,18 @@ uuid, new PartitionKey(partitionKey), PojoizedJson.class) .build(); } + if (configuration.getResultUploadDatabase() != null && configuration.getResultUploadContainer() != null) { + resultReporter = CosmosTotalResultReporter + .forRegistry( + metricsRegistry, + syncClient.getDatabase(configuration.getResultUploadDatabase()).getContainer(configuration.getResultUploadContainer()), + configuration) + .convertRatesTo(TimeUnit.SECONDS) + .convertDurationsTo(TimeUnit.MILLISECONDS).build(); + } else { + resultReporter = null; + } + boolean shouldOpenConnectionsAndInitCaches = configuration.getConnectionMode() == ConnectionMode.DIRECT && configuration.isProactiveConnectionManagementEnabled() && !configuration.isUseUnWarmedUpContainer(); @@ -357,6 +370,9 @@ protected void initializeMetersIfSkippedEnoughOperations(AtomicLong count) { resetMeters(); initializeMeter(); reporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS); + if (resultReporter != null) { + resultReporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS); + } warmupMode.set(false); } } @@ -371,18 +387,18 @@ protected void onError(Throwable throwable) { protected abstract void performWorkload(BaseSubscriber baseSubscriber, long i) throws Exception; private void resetMeters() { - metricsRegistry.remove(SUCCESS_COUNTER_METER_NAME); - metricsRegistry.remove(FAILURE_COUNTER_METER_NAME); + metricsRegistry.remove(Configuration.SUCCESS_COUNTER_METER_NAME); + metricsRegistry.remove(Configuration.FAILURE_COUNTER_METER_NAME); if (latencyAwareOperations(configuration.getOperationType())) { - metricsRegistry.remove(LATENCY_METER_NAME); + metricsRegistry.remove(Configuration.LATENCY_METER_NAME); } } private void initializeMeter() { - successMeter = metricsRegistry.meter(SUCCESS_COUNTER_METER_NAME); - failureMeter = metricsRegistry.meter(FAILURE_COUNTER_METER_NAME); + successMeter = metricsRegistry.meter(Configuration.SUCCESS_COUNTER_METER_NAME); + failureMeter = metricsRegistry.meter(Configuration.FAILURE_COUNTER_METER_NAME); if (latencyAwareOperations(configuration.getOperationType())) { - latency = metricsRegistry.register(LATENCY_METER_NAME, new Timer(new HdrHistogramResetOnSnapshotReservoir())); + latency = metricsRegistry.register(Configuration.LATENCY_METER_NAME, new Timer(new HdrHistogramResetOnSnapshotReservoir())); } } @@ -415,6 +431,9 @@ void run() throws Exception { warmupMode.set(true); } else { reporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS); + if (resultReporter != null) { + resultReporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS); + } } long startTime = System.currentTimeMillis(); @@ -485,6 +504,11 @@ protected void hookOnError(Throwable throwable) { reporter.report(); reporter.close(); + + if (resultReporter != null) { + resultReporter.report(); + resultReporter.close(); + } } protected Mono sparsityMono(long i) { diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/Configuration.java b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/Configuration.java index 1919937b90eb..507e6f4edf12 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/Configuration.java +++ b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/Configuration.java @@ -33,7 +33,9 @@ import java.util.List; public class Configuration { - + public static final String SUCCESS_COUNTER_METER_NAME = "#Successful Operations"; + public static final String FAILURE_COUNTER_METER_NAME = "#Unsuccessful Operations"; + public static final String LATENCY_METER_NAME = "Latency"; public final static String DEFAULT_PARTITION_KEY_PATH = "/pk"; private final static int DEFAULT_GRAPHITE_SERVER_PORT = 2003; private MeterRegistry azureMonitorMeterRegistry; @@ -230,6 +232,21 @@ public Duration convert(String value) { @Parameter(names = "-nonPointLatencyThresholdMs", description = "Latency threshold for non-point operations") private int nonPointLatencyThresholdMs = -1; + @Parameter(names = "-testVariationName", description = "An identifier for the test variation") + private String testVariationName = ""; + + @Parameter(names = "-branchName", description = "The branch name form where the source code being tested was built") + private String branchName = ""; + + @Parameter(names = "-commitId", description = "A commit identifier showing the version of the source code being tested") + private String commitId = ""; + + @Parameter(names = "-resultUploadDatabase", description = "The name of the database into which to upload the results") + private String resultUploadDatabase = ""; + + @Parameter(names = "-resultUploadContainer", description = "AThe name of the container inot which to upload the results") + private String resultUploadContainer = ""; + public enum Environment { Daily, // This is the CTL environment where we run the workload for a fixed number of hours Staging; // This is the CTL environment where the worload runs as a long running job @@ -484,6 +501,18 @@ public int getGraphiteEndpointPort() { } } + public String getTestVariationName() { + return this.testVariationName; + } + + public String getBranchName() { + return this.branchName; + } + + public String getCommitId() { + return this.commitId; + } + public int getNumberOfCollectionForCtl(){ return this.numberOfCollectionForCtl; } @@ -595,6 +624,14 @@ public Integer getMinConnectionPoolSizePerEndpoint() { return minConnectionPoolSizePerEndpoint; } + public String getResultUploadDatabase() { + return Strings.emptyToNull(resultUploadDatabase); + } + + public String getResultUploadContainer() { + return Strings.emptyToNull(resultUploadContainer); + } + public void tryGetValuesFromSystem() { serviceEndpoint = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("SERVICE_END_POINT")), serviceEndpoint); @@ -656,6 +693,21 @@ public void tryGetValuesFromSystem() { tupleSize = Integer.parseInt( StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("COSMOS_IDENTITY_TUPLE_SIZE")), Integer.toString(tupleSize))); + + testVariationName = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get( + "COSMOS_TEST_VARIATION_NAME")), testVariationName); + + branchName = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get( + "COSMOS_BRANCH_NAME")), branchName); + + commitId = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get( + "COSMOS_COMMIT_ID")), commitId); + + resultUploadDatabase = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get( + "COSMOS_RESULT_UPLOAD_DATABASE")), resultUploadDatabase); + + resultUploadContainer = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get( + "COSMOS_RESULT_UPLOAD_CONTAINER")), resultUploadContainer); } private synchronized MeterRegistry azureMonitorMeterRegistry(String instrumentationKey) { diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/CosmosTotalResultReporter.java b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/CosmosTotalResultReporter.java new file mode 100644 index 000000000000..13c3223fed3f --- /dev/null +++ b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/CosmosTotalResultReporter.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.cosmos.benchmark; + +import com.azure.cosmos.CosmosContainer; +import com.azure.cosmos.implementation.cpu.CpuMemoryReader; +import com.azure.cosmos.models.PartitionKey; +import com.codahale.metrics.Counter; +import com.codahale.metrics.Gauge; +import com.codahale.metrics.Histogram; +import com.codahale.metrics.Meter; +import com.codahale.metrics.MetricAttribute; +import com.codahale.metrics.MetricFilter; +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.ScheduledReporter; +import com.codahale.metrics.Snapshot; +import com.codahale.metrics.Timer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.Duration; +import java.time.Instant; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import java.util.SortedMap; +import java.util.Collections; + +public class CosmosTotalResultReporter extends ScheduledReporter { + private final static Logger LOGGER = LoggerFactory.getLogger(CosmosTotalResultReporter.class); + static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + private final MetricRegistry resultRegistry = new MetricRegistry(); + private final Histogram successRate = resultRegistry.histogram("successRate"); + private final Histogram failureRate = resultRegistry.histogram("failureRate"); + private final Histogram medianLatency = resultRegistry.histogram("medianLatency"); + private final Histogram p99Latency = resultRegistry.histogram("p99Latency"); + + private final Histogram cpuUsage = resultRegistry.histogram("cpuUsage"); + + private final CpuMemoryReader cpuReader; + + private final CosmosContainer results; + + private final String operation; + + private final String testVariationName; + + private final String branchName; + + private final String commitId; + + private final int concurrency; + + private Instant lastRecorded; + private long lastRecordedSuccessCount; + private long lastRecordedFailureCount; + + public CosmosTotalResultReporter( + MetricRegistry registry, + TimeUnit rateUnit, + TimeUnit durationUnit, + MetricFilter filter, + ScheduledExecutorService executor, + boolean shutdownExecutorOnStop, + Set disabledMetricAttributes, + CosmosContainer results, + Configuration config) { + super(registry, "cosmos-reporter", filter, rateUnit, durationUnit, executor, shutdownExecutorOnStop, disabledMetricAttributes); + + this.lastRecorded = Instant.now(); + this.cpuReader = new CpuMemoryReader(); + this.results = results; + if (config.isSync()) { + this.operation = "SYNC_" + config.getOperationType().name(); + } else { + this.operation = config.getOperationType().name(); + } + this.testVariationName = config.getTestVariationName(); + this.branchName = config.getBranchName(); + this.commitId = config.getCommitId(); + this.concurrency = config.getConcurrency(); + } + + @Override + public void stop() { + super.stop(); + + DateTimeFormatter formatter = DateTimeFormatter + .ofPattern("yyyy-MM-dd HH:mm:ss.nnnnnnn") + .withZone(ZoneId.from(ZoneOffset.UTC)); + + Instant nowSnapshot = Instant.now(); + Snapshot successSnapshot = this.successRate.getSnapshot(); + Snapshot failureSnapshot = this.failureRate.getSnapshot(); + Snapshot medianLatencySnapshot = this.medianLatency.getSnapshot(); + Snapshot p99LatencySnapshot = this.p99Latency.getSnapshot(); + Snapshot cpuUsageSnapshot = this.cpuUsage.getSnapshot(); + + ObjectNode doc = OBJECT_MAPPER.createObjectNode(); + String id = UUID.randomUUID().toString(); + doc.put("id", id); + doc.put("TIMESTAMP", formatter.format(nowSnapshot).substring(0, 27)); + doc.put("Operation", this.operation); + doc.put("TestVariationName", this.testVariationName); + doc.put("BranchName", this.branchName); + doc.put("CommitId", this.commitId); + doc.put("Concurrency", this.concurrency); + doc.put("CpuUsage", (cpuUsageSnapshot.get75thPercentile())); + doc.put("SuccessRate", ((long)successSnapshot.get75thPercentile())/100d); + doc.put("FailureRate", ((long)failureSnapshot.get75thPercentile())/100d); + double p99 = new BigDecimal(Double.toString(p99LatencySnapshot.get75thPercentile()/1000000)) + .setScale(2, RoundingMode.HALF_UP) + .doubleValue(); + double median = new BigDecimal(Double.toString(medianLatencySnapshot.get75thPercentile()/1000000)) + .setScale(2, RoundingMode.HALF_UP) + .doubleValue(); + + doc.put("P99LatencyInMs", p99); + doc.put("MedianLatencyInMs", median); + + results.createItem(doc, new PartitionKey(id), null); + + LOGGER.info("Final results uploaded to {} - {}", results.getId(), doc.toPrettyString()); + } + + @Override + public void report( + SortedMap gauges, + SortedMap counters, + SortedMap histograms, + SortedMap meters, + SortedMap timers) { + // We are only interested in success / failure rate and median and P99 latency for now + + Meter successMeter = meters.get(Configuration.SUCCESS_COUNTER_METER_NAME); + Meter failureMeter = meters.get(Configuration.FAILURE_COUNTER_METER_NAME); + Timer latencyTimer = timers.get(Configuration.LATENCY_METER_NAME); + + Instant nowSnapshot = Instant.now(); + + double intervalInSeconds = Duration.between(lastRecorded, nowSnapshot).toMillis() / 1000; + if (intervalInSeconds > 0) { + long successSnapshot = successMeter.getCount(); + this.successRate.update((long)(100d * (successSnapshot - lastRecordedSuccessCount) / intervalInSeconds)); + + long failureSnapshot = failureMeter.getCount(); + this.failureRate.update((long)(100d * (failureSnapshot - lastRecordedFailureCount) / intervalInSeconds)); + + Snapshot latencySnapshot = latencyTimer.getSnapshot(); + + this.medianLatency.update((long) (latencySnapshot.getMedian())); + this.p99Latency.update((long) (latencySnapshot.get99thPercentile())); + this.cpuUsage.update((long)(100d * cpuReader.getSystemWideCpuUsage())); + + lastRecordedSuccessCount = successSnapshot; + lastRecordedFailureCount = failureSnapshot; + lastRecorded = nowSnapshot; + } + } + + /** + * Returns a new {@link Builder} for {@link CosmosTotalResultReporter}. + * + * @param registry the registry to report + * @param resultsContainer the Cosmos DB container to write the results into + * @param config the Configuration for the test run + * @return a {@link Builder} instance for a {@link CosmosTotalResultReporter} + */ + public static Builder forRegistry(MetricRegistry registry, CosmosContainer resultsContainer, Configuration config) { + return new Builder(registry, resultsContainer, config); + } + + /** + * A builder for {@link CosmosTotalResultReporter} instances. Defaults to using the default locale and + * time zone, writing to {@code System.out}, converting rates to events/second, converting + * durations to milliseconds, and not filtering metrics. + */ + public static class Builder { + private final MetricRegistry registry; + + private final CosmosContainer resultsContainer; + private TimeUnit rateUnit; + private TimeUnit durationUnit; + private MetricFilter filter; + private ScheduledExecutorService executor; + private boolean shutdownExecutorOnStop; + private Set disabledMetricAttributes; + + private final Configuration config; + + + private Builder(MetricRegistry registry, CosmosContainer resultsContainer, Configuration config) { + this.registry = registry; + this.rateUnit = TimeUnit.SECONDS; + this.durationUnit = TimeUnit.MILLISECONDS; + this.filter = MetricFilter.ALL; + this.executor = null; + this.shutdownExecutorOnStop = true; + this.disabledMetricAttributes = Collections.emptySet(); + this.resultsContainer = resultsContainer; + this.config = config; + } + + /** + * Specifies whether the executor (used for reporting) will be stopped with same time with reporter. + * Default value is true. + * Setting this parameter to false, has the sense in combining with providing external managed executor via {@link #scheduleOn(ScheduledExecutorService)}. + * + * @param shutdownExecutorOnStop if true, then executor will be stopped in same time with this reporter + * @return {@code this} + */ + public Builder shutdownExecutorOnStop(boolean shutdownExecutorOnStop) { + this.shutdownExecutorOnStop = shutdownExecutorOnStop; + return this; + } + + /** + * Specifies the executor to use while scheduling reporting of metrics. + * Default value is null. + * Null value leads to executor will be auto created on start. + * + * @param executor the executor to use while scheduling reporting of metrics. + * @return {@code this} + */ + public Builder scheduleOn(ScheduledExecutorService executor) { + this.executor = executor; + return this; + } + + /** + * Convert rates to the given time unit. + * + * @param rateUnit a unit of time + * @return {@code this} + */ + public Builder convertRatesTo(TimeUnit rateUnit) { + this.rateUnit = rateUnit; + return this; + } + + /** + * Convert durations to the given time unit. + * + * @param durationUnit a unit of time + * @return {@code this} + */ + public Builder convertDurationsTo(TimeUnit durationUnit) { + this.durationUnit = durationUnit; + return this; + } + + /** + * Only report metrics which match the given filter. + * + * @param filter a {@link MetricFilter} + * @return {@code this} + */ + public Builder filter(MetricFilter filter) { + this.filter = filter; + return this; + } + + /** + * Don't report the passed metric attributes for all metrics (e.g. "p999", "stddev" or "m15"). + * See {@link MetricAttribute}. + * + * @param disabledMetricAttributes a {@link MetricFilter} + * @return {@code this} + */ + public Builder disabledMetricAttributes(Set disabledMetricAttributes) { + this.disabledMetricAttributes = disabledMetricAttributes; + return this; + } + + /** + * Builds a {@link CosmosTotalResultReporter} with the given properties. + * + * @return a {@link CosmosTotalResultReporter} + */ + public CosmosTotalResultReporter build() { + return new CosmosTotalResultReporter(registry, + rateUnit, + durationUnit, + filter, + executor, + shutdownExecutorOnStop, + disabledMetricAttributes, + resultsContainer, + config); + } + } +} diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/DocDBUtils.java b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/DocDBUtils.java index 2739d9cb4e79..ed0b2b57c43c 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/DocDBUtils.java +++ b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/DocDBUtils.java @@ -3,24 +3,72 @@ package com.azure.cosmos.benchmark; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.implementation.AsyncDocumentClient; +import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.Database; import com.azure.cosmos.implementation.DocumentCollection; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; +import com.azure.cosmos.implementation.ResourceType; +import com.azure.cosmos.implementation.TestConfigurations; +import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.FeedResponse; import com.azure.cosmos.models.SqlParameter; import com.azure.cosmos.models.SqlQuerySpec; import java.util.Collections; +import java.util.concurrent.ConcurrentHashMap; class DocDBUtils { private DocDBUtils() { } + private static final ConcurrentHashMap dummyQueryStateForDBQuery = new ConcurrentHashMap<>(); + + private static final ConcurrentHashMap dummyQueryStateForColQuery = new ConcurrentHashMap<>(); + + + public static QueryFeedOperationState createDummyQueryFeedOperationState( + ResourceType resourceType, + OperationType operationType, + CosmosQueryRequestOptions options, + AsyncDocumentClient client) { + CosmosAsyncClient cosmosClient = new CosmosClientBuilder() + .key(client.getMasterKeyOrResourceToken()) + .endpoint(client.getServiceEndpoint().toString()) + .buildAsyncClient(); + return new QueryFeedOperationState( + cosmosClient, + "SomeSpanName", + "SomeDBName", + "SomeContainerName", + resourceType, + operationType, + null, + options, + new CosmosPagedFluxOptions() + ); + } + static Database getDatabase(AsyncDocumentClient client, String databaseId) { + QueryFeedOperationState state = dummyQueryStateForDBQuery.computeIfAbsent( + client, + (c) -> { + return createDummyQueryFeedOperationState( + ResourceType.Database, + OperationType.Query, + new CosmosQueryRequestOptions(), + c + ); + } + ); + FeedResponse feedResponsePages = client .queryDatabases(new SqlQuerySpec("SELECT * FROM root r WHERE r.id=@id", - Collections.singletonList(new SqlParameter("@id", databaseId))), null) + Collections.singletonList(new SqlParameter("@id", databaseId))), state) .single().block(); if (feedResponsePages.getResults().isEmpty()) { @@ -31,11 +79,23 @@ static Database getDatabase(AsyncDocumentClient client, String databaseId) { static DocumentCollection getCollection(AsyncDocumentClient client, String databaseLink, String collectionId) { + QueryFeedOperationState state = dummyQueryStateForColQuery.computeIfAbsent( + client, + (c) -> { + return createDummyQueryFeedOperationState( + ResourceType.DocumentCollection, + OperationType.Query, + new CosmosQueryRequestOptions(), + c + ); + } + ); + FeedResponse feedResponsePages = client .queryCollections(databaseLink, new SqlQuerySpec("SELECT * FROM root r WHERE r.id=@id", Collections.singletonList(new SqlParameter("@id", collectionId))), - null) + state) .single().block(); if (feedResponsePages.getResults().isEmpty()) { diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/ReadMyWriteWorkflow.java b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/ReadMyWriteWorkflow.java index f6333b6d08d4..6b208d35fcf5 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/ReadMyWriteWorkflow.java +++ b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/ReadMyWriteWorkflow.java @@ -7,12 +7,16 @@ import com.azure.cosmos.CosmosBridgeInternal; import com.azure.cosmos.CosmosException; import com.azure.cosmos.implementation.AsyncDocumentClient; +import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.Database; import com.azure.cosmos.implementation.Document; import com.azure.cosmos.implementation.DocumentCollection; import com.azure.cosmos.implementation.NotFoundException; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.RequestOptions; import com.azure.cosmos.implementation.ResourceResponse; +import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.PartitionKey; import com.azure.cosmos.models.SqlParameter; @@ -278,7 +282,19 @@ private Flux xPartitionQuery(SqlQuerySpec query) { CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); options.setMaxDegreeOfParallelism(-1); - return client.queryDocuments(getCollectionLink(), query, options, Document.class) + QueryFeedOperationState state = new QueryFeedOperationState( + cosmosClient, + "xPartitionQuery", + configuration.getDatabaseId(), + configuration.getCollectionId(), + ResourceType.Document, + OperationType.Query, + null, + options, + new CosmosPagedFluxOptions() + ); + + return client.queryDocuments(getCollectionLink(), query, state, Document.class) .flatMap(p -> Flux.fromIterable(p.getResults())); } @@ -296,7 +312,20 @@ private Flux singlePartitionQuery(Document d) { SqlQuerySpec sqlQuerySpec = new SqlQuerySpec(String.format("Select top 100 * from c where c.%s = '%s'", QUERY_FIELD_NAME, d.getString(QUERY_FIELD_NAME))); - return client.queryDocuments(getCollectionLink(), sqlQuerySpec, options, Document.class) + + QueryFeedOperationState state = new QueryFeedOperationState( + cosmosClient, + "singlePartitionQuery", + configuration.getDatabaseId(), + configuration.getCollectionId(), + ResourceType.Document, + OperationType.Query, + null, + options, + new CosmosPagedFluxOptions() + ); + + return client.queryDocuments(getCollectionLink(), sqlQuerySpec, state, Document.class) .flatMap(p -> Flux.fromIterable(p.getResults())); } diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/SyncBenchmark.java b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/SyncBenchmark.java index d041aa406375..c92d1939c84e 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/SyncBenchmark.java +++ b/sdk/cosmos/azure-cosmos-benchmark/src/main/java/com/azure/cosmos/benchmark/SyncBenchmark.java @@ -52,6 +52,8 @@ abstract class SyncBenchmark { private final MetricRegistry metricsRegistry = new MetricRegistry(); private final ScheduledReporter reporter; + + private final ScheduledReporter resultReporter; private final ExecutorService executorService; private Meter successMeter; @@ -222,6 +224,18 @@ public T apply(T o, Throwable throwable) { .convertDurationsTo(TimeUnit.MILLISECONDS).build(); } + if (configuration.getResultUploadDatabase() != null && configuration.getResultUploadContainer() != null) { + resultReporter = CosmosTotalResultReporter + .forRegistry( + metricsRegistry, + cosmosClient.getDatabase(configuration.getResultUploadDatabase()).getContainer(configuration.getResultUploadContainer()), + configuration) + .convertRatesTo(TimeUnit.SECONDS) + .convertDurationsTo(TimeUnit.MILLISECONDS).build(); + } else { + resultReporter = null; + } + MeterRegistry registry = configuration.getAzureMonitorMeterRegistry(); if (registry != null) { @@ -261,8 +275,8 @@ protected void onError(Throwable throwable) { void run() throws Exception { - successMeter = metricsRegistry.meter("#Successful Operations"); - failureMeter = metricsRegistry.meter("#Unsuccessful Operations"); + successMeter = metricsRegistry.meter(Configuration.SUCCESS_COUNTER_METER_NAME); + failureMeter = metricsRegistry.meter(Configuration.FAILURE_COUNTER_METER_NAME); switch (configuration.getOperationType()) { case ReadLatency: @@ -278,13 +292,16 @@ void run() throws Exception { // case QueryAggregateTopOrderby: // case QueryTopOrderby: case Mixed: - latency = metricsRegistry.register("Latency", new Timer(new HdrHistogramResetOnSnapshotReservoir())); + latency = metricsRegistry.register(Configuration.LATENCY_METER_NAME, new Timer(new HdrHistogramResetOnSnapshotReservoir())); break; default: break; } reporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS); + if (resultReporter != null) { + resultReporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS); + } long startTime = System.currentTimeMillis(); AtomicLong count = new AtomicLong(0); @@ -375,6 +392,11 @@ public T apply(T t, Throwable throwable) { reporter.report(); reporter.close(); + + if (resultReporter != null) { + resultReporter.report(); + resultReporter.close(); + } } RuntimeException propagate(Exception e) { diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/ReadMyWritesConsistencyTest.java b/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/ReadMyWritesConsistencyTest.java index 4b3a4288c8e0..1b05bb39a4a8 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/ReadMyWritesConsistencyTest.java +++ b/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/ReadMyWritesConsistencyTest.java @@ -6,8 +6,12 @@ import com.azure.cosmos.implementation.AsyncDocumentClient; import com.azure.cosmos.implementation.Database; import com.azure.cosmos.implementation.DocumentCollection; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.RequestOptions; +import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.TestConfigurations; +import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.IncludedPath; import com.azure.cosmos.models.IndexingPolicy; import com.azure.cosmos.models.PartitionKeyDefinition; @@ -175,14 +179,20 @@ DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { private void scheduleScaleUp(int delayStartInSeconds, int newThroughput) { AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); - Flux.just(0L).delayElements(Duration.ofSeconds(delayStartInSeconds), Schedulers.newSingle("ScaleUpThread")).flatMap(aVoid -> { + QueryFeedOperationState state = DocDBUtils.createDummyQueryFeedOperationState( + ResourceType.Offer, + OperationType.Query, + new CosmosQueryRequestOptions(), + housekeepingClient + ); + Flux.just(0L).delayElements(Duration.ofSeconds(delayStartInSeconds), Schedulers.newSingle("ScaleUpThread")).flatMap(aVoid -> { // increase throughput to max for a single partition collection to avoid throttling // for bulk insert and later queries. return housekeepingClient.queryOffers( String.format("SELECT * FROM r WHERE r.offerResourceId = '%s'", collection.getResourceId()) - , null).flatMap(page -> Flux.fromIterable(page.getResults())) + , state).flatMap(page -> Flux.fromIterable(page.getResults())) .take(1).flatMap(offer -> { logger.info("going to scale up collection, newThroughput {}", newThroughput); offer.setThroughput(newThroughput); diff --git a/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/Utils.java b/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/Utils.java index 09146657fdf3..d0932a1de01a 100644 --- a/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/Utils.java +++ b/sdk/cosmos/azure-cosmos-benchmark/src/test/java/com/azure/cosmos/benchmark/Utils.java @@ -3,17 +3,24 @@ package com.azure.cosmos.benchmark; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.DirectConnectionConfig; import com.azure.cosmos.ThrottlingRetryOptions; import com.azure.cosmos.implementation.AsyncDocumentClient; import com.azure.cosmos.implementation.ConnectionPolicy; +import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.Database; import com.azure.cosmos.implementation.DatabaseForTest; import com.azure.cosmos.implementation.DocumentCollection; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.ResourceResponse; +import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.TestConfigurations; import com.azure.cosmos.models.CosmosClientTelemetryConfig; +import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.FeedResponse; import com.azure.cosmos.models.SqlQuerySpec; import reactor.core.publisher.Flux; @@ -92,7 +99,14 @@ private DatabaseManagerImpl(AsyncDocumentClient client) { @Override public Flux> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); + QueryFeedOperationState state = DocDBUtils.createDummyQueryFeedOperationState( + ResourceType.Database, + OperationType.Query, + new CosmosQueryRequestOptions(), + client + ); + + return client.queryDatabases(query, state); } @Override diff --git a/sdk/cosmos/azure-cosmos-dotnet-benchmark/pom.xml b/sdk/cosmos/azure-cosmos-dotnet-benchmark/pom.xml index a0a7ab7890f8..683a3b57214a 100644 --- a/sdk/cosmos/azure-cosmos-dotnet-benchmark/pom.xml +++ b/sdk/cosmos/azure-cosmos-dotnet-benchmark/pom.xml @@ -50,7 +50,7 @@ Licensed under the MIT License. com.azure azure-cosmos - 4.50.0-beta.1 + 4.51.0-beta.1 diff --git a/sdk/cosmos/azure-cosmos-encryption/CHANGELOG.md b/sdk/cosmos/azure-cosmos-encryption/CHANGELOG.md index 4b74e5fddfe1..59920ffedc2a 100644 --- a/sdk/cosmos/azure-cosmos-encryption/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-encryption/CHANGELOG.md @@ -1,6 +1,6 @@ ## Release History -### 2.5.0-beta.1 (Unreleased) +### 2.6.0-beta.1 (Unreleased) #### Features Added @@ -10,6 +10,10 @@ #### Other Changes +### 2.5.0 (2023-09-25) +#### Other Changes +* Updated `azure-cosmos` to version `4.50.0`. + ### 2.4.0 (2023-08-21) #### Other Changes * Updated `azure-cosmos` to version `4.49.0`. diff --git a/sdk/cosmos/azure-cosmos-encryption/README.md b/sdk/cosmos/azure-cosmos-encryption/README.md index 5e5f35e04403..97b84246232f 100644 --- a/sdk/cosmos/azure-cosmos-encryption/README.md +++ b/sdk/cosmos/azure-cosmos-encryption/README.md @@ -12,7 +12,7 @@ The Azure Cosmos Encryption Plugin is used for encrypting data with a user-provi com.azure azure-cosmos-encryption - 2.4.0 + 2.5.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/cosmos/azure-cosmos-encryption/pom.xml b/sdk/cosmos/azure-cosmos-encryption/pom.xml index 2664e870db91..a9410a4d2d2f 100644 --- a/sdk/cosmos/azure-cosmos-encryption/pom.xml +++ b/sdk/cosmos/azure-cosmos-encryption/pom.xml @@ -13,7 +13,7 @@ Licensed under the MIT License. com.azure azure-cosmos-encryption - 2.5.0-beta.1 + 2.6.0-beta.1 Encryption Plugin for Azure Cosmos DB SDK This Package contains Encryption Plugin for Microsoft Azure Cosmos SDK jar @@ -57,13 +57,13 @@ Licensed under the MIT License. com.azure azure-cosmos - 4.50.0-beta.1 + 4.51.0-beta.1 com.azure azure-security-keyvault-keys - 4.6.5 + 4.7.0 test diff --git a/sdk/cosmos/azure-cosmos-encryption/src/main/java/com/azure/cosmos/encryption/CosmosEncryptionAsyncContainer.java b/sdk/cosmos/azure-cosmos-encryption/src/main/java/com/azure/cosmos/encryption/CosmosEncryptionAsyncContainer.java index f6a4c84142f0..f53508cc2a60 100644 --- a/sdk/cosmos/azure-cosmos-encryption/src/main/java/com/azure/cosmos/encryption/CosmosEncryptionAsyncContainer.java +++ b/sdk/cosmos/azure-cosmos-encryption/src/main/java/com/azure/cosmos/encryption/CosmosEncryptionAsyncContainer.java @@ -3,11 +3,11 @@ package com.azure.cosmos.encryption; -import com.azure.cosmos.BridgeInternal; import com.azure.cosmos.CosmosAsyncContainer; import com.azure.cosmos.CosmosBridgeInternal; import com.azure.cosmos.CosmosException; import com.azure.cosmos.encryption.implementation.Constants; +import com.azure.cosmos.encryption.implementation.CosmosEncryptionQueryTransformer; import com.azure.cosmos.encryption.implementation.CosmosResponseFactory; import com.azure.cosmos.encryption.implementation.EncryptionImplementationBridgeHelpers; import com.azure.cosmos.encryption.implementation.EncryptionProcessor; @@ -62,12 +62,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; -import java.util.stream.Collectors; import static com.azure.cosmos.implementation.Utils.getEffectiveCosmosChangeFeedRequestOptions; -import static com.azure.cosmos.implementation.Utils.setContinuationTokenAndMaxItemCount; import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; /** @@ -792,34 +791,6 @@ private Mono> setByteArrayContent(CosmosItemResponse< ).defaultIfEmpty(rsp); } - private Function>> queryDecryptionTransformer(Class classType, - boolean isChangeFeed, - Function>> func) { - return func.andThen(flux -> - flux.publishOn(encryptionScheduler) - .flatMap( - page -> { - boolean useEtagAsContinuation = isChangeFeed; - boolean isNoChangesResponse = isChangeFeed ? - ModelBridgeInternal.getNoChangesFromFeedResponse(page) - : false; - List> jsonNodeArrayMonoList = - page.getResults().stream().map(jsonNode -> decryptResponseNode(jsonNode)).collect(Collectors.toList()); - return Flux.concat(jsonNodeArrayMonoList).map( - item -> getItemDeserializer().convert(classType, item) - ).collectList().map(itemList -> BridgeInternal.createFeedResponseWithQueryMetrics(itemList, - page.getResponseHeaders(), - BridgeInternal.queryMetricsFromFeedResponse(page), - ModelBridgeInternal.getQueryPlanDiagnosticsContext(page), - useEtagAsContinuation, - isNoChangesResponse, - page.getCosmosDiagnostics()) - ); - } - ) - ); - } - private Mono> readItemHelper(String id, PartitionKey partitionKey, CosmosItemRequestOptions requestOptions, @@ -1027,92 +998,199 @@ private CosmosPagedFlux queryItemsHelper(SqlQuerySpec sqlQuerySpec, CosmosQueryRequestOptions options, Class classType, boolean isRetry) { - setRequestHeaders(options); - CosmosQueryRequestOptions finalOptions = options; - Flux> tFlux = CosmosBridgeInternal.queryItemsInternal(container, sqlQuerySpec, options, - new Transformer() { - @Override - public Function>> transform(Function>> func) { - return queryDecryptionTransformer(classType, false, func); - } - }).byPage().onErrorResume(exception -> { - if (exception instanceof CosmosException) { - final CosmosException cosmosException = (CosmosException) exception; - if (!isRetry && isIncorrectContainerRid(cosmosException)) { - this.encryptionProcessor.getIsEncryptionSettingsInitDone().set(false); - return this.encryptionProcessor.initializeEncryptionSettingsAsync(true).thenMany( - (CosmosPagedFlux.defer(() -> queryItemsHelper(sqlQuerySpec,finalOptions, classType, true).byPage()))); - } - } - return Mono.error(exception); - }); - return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { - setContinuationTokenAndMaxItemCount(pagedFluxOptions, finalOptions); - return tFlux; + AtomicBoolean shouldRetry = new AtomicBoolean(!isRetry); + + Transformer transformer = new CosmosEncryptionQueryTransformer( + this.encryptionScheduler, + this.getEncryptionProcessor(), + this.getItemDeserializer(), + classType, + false); + + Flux> result = this.transformQueryItemsInternal( + transformer, + sqlQuerySpec, + options, + pagedFluxOptions + ).apply(pagedFluxOptions); + + return result + .onErrorResume(exception -> { + if (exception instanceof CosmosException) { + final CosmosException cosmosException = (CosmosException) exception; + if (shouldRetry.get() && isIncorrectContainerRid(cosmosException)) { + // stale cache, refresh caches and then retry + this.encryptionProcessor.getIsEncryptionSettingsInitDone().set(false); + shouldRetry.set(false); + + return this.encryptionProcessor + .initializeEncryptionSettingsAsync(true) + .thenMany( + Flux.defer(() -> { + return this.transformQueryItemsInternal( + transformer, + sqlQuerySpec, + options, + pagedFluxOptions + ).apply(pagedFluxOptions); + }) + ); + } + } + return Mono.error(exception); + }); }); } + private Function>> transformQueryItemsInternal( + Transformer transformer, + SqlQuerySpec sqlQuerySpec, + CosmosQueryRequestOptions queryRequestOptions, + CosmosPagedFluxOptions pagedFluxOptions) { + + CosmosQueryRequestOptions finalOptions = setRequestHeaders(queryRequestOptions); + + return transformer.transform( + cosmosAsyncContainerAccessor.queryItemsInternalFunc( + this.container, + sqlQuerySpec, + finalOptions, + JsonNode.class) + ); + } + + private Function>> transformQueryChangeFeedInternal( + Transformer transformer, + CosmosChangeFeedRequestOptions changeFeedRequestOptions, + CosmosPagedFluxOptions pagedFluxOptions) { + + CosmosChangeFeedRequestOptions finalOptions = setRequestHeaders(changeFeedRequestOptions);; + getEffectiveCosmosChangeFeedRequestOptions(pagedFluxOptions, finalOptions); + + return transformer.transform( + cosmosAsyncContainerAccessor + .queryChangeFeedInternalFunc( + this.container, + finalOptions, + JsonNode.class) + ); + } + + private Function>> transformQueryItemsWithMonoSqlQuerySpec( + Transformer transformer, + Mono sqlQuerySpecMono, + CosmosQueryRequestOptions options, + CosmosPagedFluxOptions pagedFluxOptions) { + + CosmosQueryRequestOptions finalOptions = setRequestHeaders(options); + + return transformer.transform( + cosmosAsyncContainerAccessor.queryItemsInternalFuncWithMonoSqlQuerySpec( + this.container, + sqlQuerySpecMono, + finalOptions, + JsonNode.class + ) + ); + } + private CosmosPagedFlux queryChangeFeedHelper(CosmosChangeFeedRequestOptions options, Class classType, boolean isRetry) { - setRequestHeaders(options); - CosmosChangeFeedRequestOptions finalOptions = options; - Flux> tFlux = - UtilBridgeInternal.createCosmosPagedFlux(((Transformer) func -> queryDecryptionTransformer(classType, - true, - func)).transform(cosmosAsyncContainerAccessor.queryChangeFeedInternalFunc(this.container, options, - JsonNode.class))).byPage().onErrorResume(exception -> { - if (exception instanceof CosmosException) { - final CosmosException cosmosException = (CosmosException) exception; - if (!isRetry && isIncorrectContainerRid(cosmosException)) { - this.encryptionProcessor.getIsEncryptionSettingsInitDone().set(false); - return this.encryptionProcessor.initializeEncryptionSettingsAsync(true).thenMany( - (CosmosPagedFlux.defer(() -> queryChangeFeedHelper(finalOptions, classType, true).byPage()))); - } - } - return Mono.error(exception); - }); - return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { - getEffectiveCosmosChangeFeedRequestOptions(pagedFluxOptions, finalOptions); - return tFlux; + AtomicBoolean shouldRetry = new AtomicBoolean(!isRetry); + + Transformer transformer = new CosmosEncryptionQueryTransformer( + this.encryptionScheduler, + this.getEncryptionProcessor(), + this.getItemDeserializer(), + classType, + true); + + Flux> result = this.transformQueryChangeFeedInternal( + transformer, + options, + pagedFluxOptions + ).apply(pagedFluxOptions); + + return result + .onErrorResume(exception -> { + if (exception instanceof CosmosException) { + final CosmosException cosmosException = (CosmosException) exception; + if (shouldRetry.get() && isIncorrectContainerRid(cosmosException)) { + // stale cache, refresh caches and then retry + this.encryptionProcessor.getIsEncryptionSettingsInitDone().set(false); + shouldRetry.set(false); + + return this.encryptionProcessor + .initializeEncryptionSettingsAsync(true) + .thenMany( + Flux.defer(() -> { + return this.transformQueryChangeFeedInternal( + transformer, + options, + pagedFluxOptions + ).apply(pagedFluxOptions); + }) + ); + } + } + return Mono.error(exception); + }); }); } - private CosmosPagedFlux queryItemsHelperWithMonoSqlQuerySpec(Mono sqlQuerySpecMono, SqlQuerySpecWithEncryption sqlQuerySpecWithEncryption, CosmosQueryRequestOptions options, Class classType, boolean isRetry) { - setRequestHeaders(options); - CosmosQueryRequestOptions finalOptions = options; - - Flux> tFlux = CosmosBridgeInternal.queryItemsInternal(container, sqlQuerySpecMono, options, - new Transformer() { - @Override - public Function>> transform(Function>> func) { - return queryDecryptionTransformer(classType, false, func); - } - }).byPage().onErrorResume(exception -> { - if (exception instanceof CosmosException) { - final CosmosException cosmosException = (CosmosException) exception; - if (!isRetry && isIncorrectContainerRid(cosmosException)) { - this.encryptionProcessor.getIsEncryptionSettingsInitDone().set(false); - return this.encryptionProcessor.initializeEncryptionSettingsAsync(true).thenMany( - (CosmosPagedFlux.defer(() -> queryItemsHelper(specWithEncryptionAccessor.getSqlQuerySpec(sqlQuerySpecWithEncryption), finalOptions, classType, true).byPage()))); - } - } - return Mono.error(exception); - }); - return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { - setContinuationTokenAndMaxItemCount(pagedFluxOptions, finalOptions); - return tFlux; + AtomicBoolean shouldRetry = new AtomicBoolean(!isRetry); + + Transformer transformer = new CosmosEncryptionQueryTransformer( + this.encryptionScheduler, + this.getEncryptionProcessor(), + this.getItemDeserializer(), + classType, + false); + + Flux> result = this.transformQueryItemsWithMonoSqlQuerySpec( + transformer, + sqlQuerySpecMono, + options, + pagedFluxOptions + ).apply(pagedFluxOptions); + + return result + .onErrorResume(exception -> { + if (exception instanceof CosmosException) { + final CosmosException cosmosException = (CosmosException) exception; + if (shouldRetry.get() && isIncorrectContainerRid(cosmosException)) { + // stale cache, refresh caches and then retry + this.encryptionProcessor.getIsEncryptionSettingsInitDone().set(false); + shouldRetry.set(false); + + return this.encryptionProcessor + .initializeEncryptionSettingsAsync(true) + .thenMany( + Flux.defer(() -> { + return this.transformQueryItemsInternal( + transformer, + specWithEncryptionAccessor.getSqlQuerySpec(sqlQuerySpecWithEncryption), + options, + pagedFluxOptions + ).apply(pagedFluxOptions); + }) + ); + } + } + return Mono.error(exception); + }); }); } @@ -1422,14 +1500,17 @@ private void setRequestHeaders(CosmosItemRequestOptions requestOptions) { cosmosItemRequestOptionsAccessor.setHeader(requestOptions, Constants.INTENDED_COLLECTION_RID_HEADER, this.encryptionProcessor.getContainerRid()); } - private void setRequestHeaders(CosmosQueryRequestOptions requestOptions) { + private CosmosQueryRequestOptions setRequestHeaders(CosmosQueryRequestOptions requestOptions) { cosmosQueryRequestOptionsAccessor.setHeader(requestOptions, Constants.IS_CLIENT_ENCRYPTED_HEADER, "true"); cosmosQueryRequestOptionsAccessor.setHeader(requestOptions, Constants.INTENDED_COLLECTION_RID_HEADER, this.encryptionProcessor.getContainerRid()); + System.out.println("Setting collectionRid header " + this.encryptionProcessor.getContainerRid()); + return requestOptions; } - private void setRequestHeaders(CosmosChangeFeedRequestOptions requestOptions) { + private CosmosChangeFeedRequestOptions setRequestHeaders(CosmosChangeFeedRequestOptions requestOptions) { cosmosChangeFeedRequestOptionsAccessor.setHeader(requestOptions, Constants.IS_CLIENT_ENCRYPTED_HEADER, "true"); cosmosChangeFeedRequestOptionsAccessor.setHeader(requestOptions, Constants.INTENDED_COLLECTION_RID_HEADER, this.encryptionProcessor.getContainerRid()); + return requestOptions; } private void setRequestHeaders(CosmosBatchRequestOptions requestOptions) { diff --git a/sdk/cosmos/azure-cosmos-encryption/src/main/java/com/azure/cosmos/encryption/implementation/CosmosEncryptionQueryTransformer.java b/sdk/cosmos/azure-cosmos-encryption/src/main/java/com/azure/cosmos/encryption/implementation/CosmosEncryptionQueryTransformer.java new file mode 100644 index 000000000000..c46cb04e00cf --- /dev/null +++ b/sdk/cosmos/azure-cosmos-encryption/src/main/java/com/azure/cosmos/encryption/implementation/CosmosEncryptionQueryTransformer.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.cosmos.encryption.implementation; + +import com.azure.cosmos.BridgeInternal; +import com.azure.cosmos.implementation.CosmosPagedFluxOptions; +import com.azure.cosmos.implementation.ItemDeserializer; +import com.azure.cosmos.implementation.query.Transformer; +import com.azure.cosmos.models.FeedResponse; +import com.azure.cosmos.models.ModelBridgeInternal; +import com.fasterxml.jackson.databind.JsonNode; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; + +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class CosmosEncryptionQueryTransformer implements Transformer { + private final Scheduler encryptionScheduler; + private final EncryptionProcessor encryptionProcessor; + private final ItemDeserializer itemDeserializer; + private final Class classType; + private final boolean isChangeFeed; + + public CosmosEncryptionQueryTransformer( + Scheduler encryptionScheduler, + EncryptionProcessor encryptionProcessor, + ItemDeserializer itemDeserializer, + Class classType, + Boolean isChangeFeed) { + this.encryptionScheduler = encryptionScheduler; + this.encryptionProcessor = encryptionProcessor; + this.itemDeserializer = itemDeserializer; + this.classType = classType; + this.isChangeFeed = isChangeFeed; + } + + @Override + public Function>> transform(Function>> func) { + return queryDecryptionTransformer(this.classType, this.isChangeFeed, func); + } + + private Function>> queryDecryptionTransformer( + Class classType, + boolean isChangeFeed, + Function>> func) { + return func.andThen(flux -> + flux.publishOn(encryptionScheduler) + .flatMap( + page -> { + boolean useEtagAsContinuation = isChangeFeed; + boolean isNoChangesResponse = isChangeFeed ? + ModelBridgeInternal.getNoChangesFromFeedResponse(page) + : false; + List> jsonNodeArrayMonoList = + page.getResults().stream().map(jsonNode -> decryptResponseNode(jsonNode)).collect(Collectors.toList()); + return Flux.concat(jsonNodeArrayMonoList).map( + item -> this.itemDeserializer.convert(classType, item) + ).collectList().map(itemList -> BridgeInternal.createFeedResponseWithQueryMetrics(itemList, + page.getResponseHeaders(), + BridgeInternal.queryMetricsFromFeedResponse(page), + ModelBridgeInternal.getQueryPlanDiagnosticsContext(page), + useEtagAsContinuation, + isNoChangesResponse, + page.getCosmosDiagnostics()) + ); + } + ) + ); + } + + Mono decryptResponseNode( + JsonNode jsonNode) { + + if (jsonNode == null) { + return Mono.empty(); + } + + return this.encryptionProcessor.decryptJsonNode( + jsonNode); + } +} diff --git a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md index 65aff9eaccae..04bcb2cde547 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/CHANGELOG.md @@ -1,6 +1,6 @@ ## Release History -### 4.22.0-beta.1 (Unreleased) +### 4.23.0-beta.1 (Unreleased) #### Features Added @@ -8,6 +8,13 @@ #### Bugs Fixed +#### Other Changes + +### 4.22.0 (2023-09-19) + +#### Features Added +* Added throughput control support for `gateway mode`. See [PR 36687](https://github.com/Azure/azure-sdk-for-java/pull/36687) + #### Other Changes * Reduce noisy log in `ThroughputControlHelper` from `INFO` to `DEBUG` - See [PR 36653](https://github.com/Azure/azure-sdk-for-java/pull/36653) diff --git a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/README.md b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/README.md index 4576a0b01a71..01488c2398e6 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/README.md +++ b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/README.md @@ -29,6 +29,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-1_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |--------------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.1.1 - 3.1.2 | 8 | 2.12 | 8.\*, 9.\* | | 4.21.1 | 3.1.1 - 3.1.2 | 8 | 2.12 | 8.\*, 9.\* | | 4.21.0 | 3.1.1 - 3.1.2 | 8 | 2.12 | 8.\*, 9.\* | | 4.20.0 | 3.1.1 - 3.1.2 | 8 | 2.12 | 8.\*, 9.\* | @@ -77,6 +78,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-2_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.1 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.20.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | @@ -110,6 +112,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-3_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.1 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.0 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.20.0 | 3.3.0 | 8 | 2.12 | 11.\* | @@ -125,17 +128,18 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-4_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.4.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.1 | 3.4.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.0 | 3.4.0 | 8 | 2.12 | 11.\*, 12.\* | ### Download You can use the maven coordinate of the jar to auto install the Spark Connector to your Databricks Runtime 8 from Maven: -`com.azure.cosmos.spark:azure-cosmos-spark_3-1_2-12:4.21.1` +`com.azure.cosmos.spark:azure-cosmos-spark_3-1_2-12:4.22.0` You can also integrate against Cosmos DB Spark Connector in your SBT project: ```scala -libraryDependencies += "com.azure.cosmos.spark" % "azure-cosmos-spark_3-1_2-12" % "4.21.1" +libraryDependencies += "com.azure.cosmos.spark" % "azure-cosmos-spark_3-1_2-12" % "4.22.0" ``` Cosmos DB Spark Connector is available on [Maven Central Repo](https://central.sonatype.com/search?namespace=com.azure.cosmos.spark). diff --git a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/pom.xml b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/pom.xml index da0e430b7424..924f64fcf410 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-1_2-12/pom.xml +++ b/sdk/cosmos/azure-cosmos-spark_3-1_2-12/pom.xml @@ -11,7 +11,7 @@ com.azure.cosmos.spark azure-cosmos-spark_3-1_2-12 - 4.22.0-beta.1 + 4.23.0-beta.1 jar https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/cosmos/azure-cosmos-spark_3-1_2-12 OLTP Spark 3.1 Connector for Azure Cosmos DB SQL API diff --git a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md index 46f4c3283e54..197b4824da49 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/CHANGELOG.md @@ -1,6 +1,6 @@ ## Release History -### 4.22.0-beta.1 (Unreleased) +### 4.23.0-beta.1 (Unreleased) #### Features Added @@ -8,6 +8,13 @@ #### Bugs Fixed +#### Other Changes + +### 4.22.0 (2023-09-19) + +#### Features Added +* Added throughput control support for `gateway mode`. See [PR 36687](https://github.com/Azure/azure-sdk-for-java/pull/36687) + #### Other Changes * Reduce noisy log in `ThroughputControlHelper` from `INFO` to `DEBUG` - See [PR 36653](https://github.com/Azure/azure-sdk-for-java/pull/36653) diff --git a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/README.md b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/README.md index 92cee77245aa..ab4d88ad2a22 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/README.md +++ b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/README.md @@ -28,6 +28,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-2_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.1 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.20.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | @@ -61,6 +62,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-3_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.1 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.0 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.20.0 | 3.3.0 | 8 | 2.12 | 11.\* | @@ -76,6 +78,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-1_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |--------------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 8.\*, 9.\* | | 4.21.1 | 3.2.0 - 3.2.1 | 8 | 2.12 | 8.\*, 9.\* | | 4.21.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 8.\*, 9.\* | | 4.20.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 8.\*, 9.\* | @@ -124,17 +127,18 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-4_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.4.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.1 | 3.4.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.0 | 3.4.0 | 8 | 2.12 | 11.\*, 12.\* | ### Download You can use the maven coordinate of the jar to auto install the Spark Connector to your Databricks Runtime 10 from Maven: -`com.azure.cosmos.spark:azure-cosmos-spark_3-2_2-12:4.21.1` +`com.azure.cosmos.spark:azure-cosmos-spark_3-2_2-12:4.22.0` You can also integrate against Cosmos DB Spark Connector in your SBT project: ```scala -libraryDependencies += "com.azure.cosmos.spark" % "azure-cosmos-spark_3-2_2-12" % "4.21.1" +libraryDependencies += "com.azure.cosmos.spark" % "azure-cosmos-spark_3-2_2-12" % "4.22.0" ``` Cosmos DB Spark Connector is available on [Maven Central Repo](https://central.sonatype.com/search?namespace=com.azure.cosmos.spark). diff --git a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/pom.xml b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/pom.xml index 517745afd9f2..21124855a343 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-2_2-12/pom.xml +++ b/sdk/cosmos/azure-cosmos-spark_3-2_2-12/pom.xml @@ -11,7 +11,7 @@ com.azure.cosmos.spark azure-cosmos-spark_3-2_2-12 - 4.22.0-beta.1 + 4.23.0-beta.1 jar https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/cosmos/azure-cosmos-spark_3-2_2-12 OLTP Spark 3.2 Connector for Azure Cosmos DB SQL API diff --git a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md index 578407f787a1..cffa2002134d 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/CHANGELOG.md @@ -1,6 +1,6 @@ ## Release History -### 4.22.0-beta.1 (Unreleased) +### 4.23.0-beta.1 (Unreleased) #### Features Added @@ -8,6 +8,13 @@ #### Bugs Fixed +#### Other Changes + +### 4.22.0 (2023-09-19) + +#### Features Added +* Added throughput control support for `gateway mode`. See [PR 36687](https://github.com/Azure/azure-sdk-for-java/pull/36687) + #### Other Changes * Reduce noisy log in `ThroughputControlHelper` from `INFO` to `DEBUG` - See [PR 36653](https://github.com/Azure/azure-sdk-for-java/pull/36653) diff --git a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/README.md b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/README.md index 706974d61e4c..c47334622646 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/README.md +++ b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/README.md @@ -28,6 +28,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-3_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.1 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.0 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.20.0 | 3.3.0 | 8 | 2.12 | 11.\* | @@ -43,6 +44,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-2_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.1 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.20.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | @@ -76,6 +78,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-1_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |--------------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.1 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.20.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | @@ -124,17 +127,18 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-4_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------|----------------------|--------------------------|-------------------------------| +| 4.22.0 | 3.4.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.1 | 3.4.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.0 | 3.4.0 | 8 | 2.12 | 11.\*, 12.\* | ### Download You can use the maven coordinate of the jar to auto install the Spark Connector to your Databricks Runtime 11 from Maven: -`com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12:4.21.1` +`com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12:4.22.0` You can also integrate against Cosmos DB Spark Connector in your SBT project: ```scala -libraryDependencies += "com.azure.cosmos.spark" % "azure-cosmos-spark_3-3_2-12" % "4.21.1" +libraryDependencies += "com.azure.cosmos.spark" % "azure-cosmos-spark_3-3_2-12" % "4.22.0" ``` Cosmos DB Spark Connector is available on [Maven Central Repo](https://central.sonatype.com/search?namespace=com.azure.cosmos.spark). diff --git a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/pom.xml b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/pom.xml index 06cd75ddbdf8..562e537dfa26 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-3_2-12/pom.xml +++ b/sdk/cosmos/azure-cosmos-spark_3-3_2-12/pom.xml @@ -11,7 +11,7 @@ com.azure.cosmos.spark azure-cosmos-spark_3-3_2-12 - 4.22.0-beta.1 + 4.23.0-beta.1 jar https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/cosmos/azure-cosmos-spark_3-3_2-12 OLTP Spark 3.3 Connector for Azure Cosmos DB SQL API diff --git a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md index 6edc99c4d0ca..46f6228e3b76 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/CHANGELOG.md @@ -1,6 +1,6 @@ ## Release History -### 4.22.0-beta.1 (Unreleased) +### 4.23.0-beta.1 (Unreleased) #### Features Added @@ -8,6 +8,13 @@ #### Bugs Fixed +#### Other Changes + +### 4.22.0 (2023-09-19) + +#### Features Added +* Added throughput control support for `gateway mode`. See [PR 36687](https://github.com/Azure/azure-sdk-for-java/pull/36687) + #### Other Changes * Reduce noisy log in `ThroughputControlHelper` from `INFO` to `DEBUG` - See [PR 36653](https://github.com/Azure/azure-sdk-for-java/pull/36653) diff --git a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/README.md b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/README.md index eb4197d4eace..ea35bc8ac76c 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/README.md +++ b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/README.md @@ -28,12 +28,14 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-4_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------| -------------------- | ----------------------- |-------------------------------| +| 4.22.0 | 3.4.0 | 8 | 2.12 | n/a | | 4.21.1 | 3.4.0 | 8 | 2.12 | n/a | | 4.21.0 | 3.4.0 | 8 | 2.12 | n/a | #### azure-cosmos-spark_3-3_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------|--------------------------| -------------------- | ----------------------- |-------------------------------| +| 4.22.0 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.1 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.21.0 | 3.3.0 | 8 | 2.12 | 11.\*, 12.\* | | 4.20.0 | 3.3.0 | 8 | 2.12 | 11.\* | @@ -49,6 +51,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-2_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |-----------| ------------------------ | -------------------- | ----------------------- | ----------------------------- | +| 4.22.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.1 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.20.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | @@ -82,6 +85,7 @@ https://github.com/Azure/azure-sdk-for-java/issues/new #### azure-cosmos-spark_3-1_2-12 | Connector | Supported Spark Versions | Minimum Java Version | Supported Scala Versions | Supported Databricks Runtimes | |--------------| ------------------------ | -------------------- | ----------------------- | ----------------------------- | +| 4.22.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.1 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.21.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | | 4.20.0 | 3.2.0 - 3.2.1 | 8 | 2.12 | 10.\* | @@ -130,11 +134,11 @@ https://github.com/Azure/azure-sdk-for-java/issues/new ### Download You can use the maven coordinate of the jar to auto install the Spark Connector to your Databricks Runtime 11 from Maven: -`com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12:4.21.1` +`com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12:4.22.0` You can also integrate against Cosmos DB Spark Connector in your SBT project: ```scala -libraryDependencies += "com.azure.cosmos.spark" % "azure-cosmos-spark_3-4_2-12" % "4.21.1" +libraryDependencies += "com.azure.cosmos.spark" % "azure-cosmos-spark_3-4_2-12" % "4.22.0" ``` Cosmos DB Spark Connector is available on [Maven Central Repo](https://central.sonatype.com/search?namespace=com.azure.cosmos.spark). diff --git a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/pom.xml b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/pom.xml index 15b461333e58..585a8c997592 100644 --- a/sdk/cosmos/azure-cosmos-spark_3-4_2-12/pom.xml +++ b/sdk/cosmos/azure-cosmos-spark_3-4_2-12/pom.xml @@ -11,7 +11,7 @@ com.azure.cosmos.spark azure-cosmos-spark_3-4_2-12 - 4.22.0-beta.1 + 4.23.0-beta.1 jar https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/cosmos/azure-cosmos-spark_3-4_2-12 OLTP Spark 3.4 Connector for Azure Cosmos DB SQL API diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/docs/quick-start.md b/sdk/cosmos/azure-cosmos-spark_3_2-12/docs/quick-start.md index a0c5335ee9f4..286500cbe6ff 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/docs/quick-start.md +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/docs/quick-start.md @@ -26,16 +26,16 @@ You can use any other Spark 3.1.1 spark offering as well, also you should be abl SLF4J is only needed if you plan to use logging, please also download an SLF4J binding which will link the SLF4J API with the logging implementation of your choice. See the [SLF4J user manual](https://www.slf4j.org/manual.html) for more information. For Spark 3.1: -- Install Cosmos DB Spark Connector, in your spark Cluster [com.azure.cosmos.spark:azure-cosmos-spark_3-1_2-12:4.21.1](https://search.maven.org/artifact/com.azure.cosmos.spark/azure-cosmos-spark_3-1_2-12/4.21.1/jar) +- Install Cosmos DB Spark Connector, in your spark Cluster [com.azure.cosmos.spark:azure-cosmos-spark_3-1_2-12:4.22.0](https://search.maven.org/artifact/com.azure.cosmos.spark/azure-cosmos-spark_3-1_2-12/4.22.0/jar) For Spark 3.2: -- Install Cosmos DB Spark Connector, in your spark Cluster [com.azure.cosmos.spark:azure-cosmos-spark_3-2_2-12:4.21.1](https://search.maven.org/artifact/com.azure.cosmos.spark/azure-cosmos-spark_3-2_2-12/4.21.1/jar) +- Install Cosmos DB Spark Connector, in your spark Cluster [com.azure.cosmos.spark:azure-cosmos-spark_3-2_2-12:4.22.0](https://search.maven.org/artifact/com.azure.cosmos.spark/azure-cosmos-spark_3-2_2-12/4.22.0/jar) For Spark 3.3: -- Install Cosmos DB Spark Connector, in your spark Cluster [com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12:4.21.1](https://search.maven.org/artifact/com.azure.cosmos.spark/azure-cosmos-spark_3-3_2-12/4.21.1/jar) +- Install Cosmos DB Spark Connector, in your spark Cluster [com.azure.cosmos.spark:azure-cosmos-spark_3-3_2-12:4.22.0](https://search.maven.org/artifact/com.azure.cosmos.spark/azure-cosmos-spark_3-3_2-12/4.22.0/jar) For Spark 3.4: -- Install Cosmos DB Spark Connector, in your spark Cluster [com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12:4.21.1](https://search.maven.org/artifact/com.azure.cosmos.spark/azure-cosmos-spark_3-4_2-12/4.21.1/jar) +- Install Cosmos DB Spark Connector, in your spark Cluster [com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12:4.22.0](https://search.maven.org/artifact/com.azure.cosmos.spark/azure-cosmos-spark_3-4_2-12/4.22.0/jar) The getting started guide is based on PySpark however you can use the equivalent scala version as well, and you can run the following code snippet in an Azure Databricks PySpark notebook. diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml b/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml index e2456ba5e222..251ba3b56e26 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/pom.xml @@ -63,7 +63,7 @@ com.azure azure-cosmos - 4.50.0-beta.1 + 4.51.0-beta.1 org.scala-lang.modules diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/SparkBridgeInternal.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/SparkBridgeInternal.scala index 4d377e6996aa..690dd10bb667 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/SparkBridgeInternal.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/SparkBridgeInternal.scala @@ -6,7 +6,7 @@ package com.azure.cosmos import com.azure.cosmos.implementation.{DocumentCollection, PartitionKeyRange, SparkBridgeImplementationInternal} import com.azure.cosmos.implementation.feedranges.FeedRangeEpkImpl import com.azure.cosmos.implementation.routing.Range -import com.azure.cosmos.models.{FeedRange, ModelBridgeInternal} +import com.azure.cosmos.models.{CosmosQueryRequestOptions, FeedRange, ModelBridgeInternal} import com.azure.cosmos.spark.NormalizedRange import scala.collection.mutable.ArrayBuffer @@ -16,6 +16,11 @@ import scala.collection.JavaConverters._ // scalastyle:on underscore.import private[cosmos] object SparkBridgeInternal { + + //scalastyle:off null + val defaultQueryRequestOptions: CosmosQueryRequestOptions = null + //scalastyle:on null + def trySplitFeedRange ( container: CosmosAsyncContainer, @@ -56,10 +61,12 @@ private[cosmos] object SparkBridgeInternal { ): List[PartitionKeyRange] = { val pkRanges = new ArrayBuffer[PartitionKeyRange]() + + container .getDatabase .getDocClientWrapper - .readPartitionKeyRanges(container.getLink, null) + .readPartitionKeyRanges(container.getLink, defaultQueryRequestOptions) .collectList .block() .forEach(feedResponse => feedResponse.getResults.forEach(pkRange => pkRanges += pkRange)) diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/BulkWriter.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/BulkWriter.scala index be407589b1f1..16518e4ba93f 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/BulkWriter.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/BulkWriter.scala @@ -113,12 +113,7 @@ class BulkWriter(container: CosmosAsyncContainer, writeConfig.initialMicroBatchSize match { case Some(customInitialMicroBatchSize) => - ImplementationBridgeHelpers.CosmosBulkExecutionOptionsHelper - .getCosmosBulkExecutionOptionsAccessor - .setInitialMicroBatchSize( - cosmosBulkExecutionOptions, - customInitialMicroBatchSize - ) + cosmosBulkExecutionOptions.setInitialMicroBatchSize(Math.max(1, customInitialMicroBatchSize)) case None => } diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/PartitionMetadataCache.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/PartitionMetadataCache.scala index b874516f1d16..a38df917f139 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/PartitionMetadataCache.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/main/scala/com/azure/cosmos/spark/PartitionMetadataCache.scala @@ -52,7 +52,6 @@ private object PartitionMetadataCache extends BasicLoggingTrait { // purged cached items if they haven't been retrieved within 2 hours private[this] val cachedItemTtlInMsDefault: Long = 2 * 60 * 60 * 1000 - // TODO @fabianm reevaluate usage of test hooks over reflection and/or making the fields vars // so that they can simply be changed under test private[this] var cacheTestOverride: Option[TrieMap[String, PartitionMetadata]] = None private[this] var testTimerOverride: Option[Timer] = None diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayChangeFeedITest.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayChangeFeedITest.scala index ca39f5f4a798..5bced2b5598b 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayChangeFeedITest.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayChangeFeedITest.scala @@ -117,8 +117,6 @@ class SparkE2EGatewayChangeFeedITest assertMetrics(meterRegistry, "cosmos.client.system.avgCpuLoad", expectedToFind = true) assertMetrics(meterRegistry, "cosmos.client.req.gw", expectedToFind = true) assertMetrics(meterRegistry, "cosmos.client.req.rntbd", expectedToFind = false) - assertMetrics(meterRegistry, "cosmos.client.rntbd", expectedToFind = false) - assertMetrics(meterRegistry, "cosmos.client.rntbd.addressResolution", expectedToFind = false) } //scalastyle:on magic.number //scalastyle:on multiple.string.literals diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayQueryITest.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayQueryITest.scala index 9986504212ed..bf9d64a7cf18 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayQueryITest.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayQueryITest.scala @@ -70,8 +70,6 @@ extends IntegrationSpec assertMetrics(meterRegistry, "cosmos.client.op.latency", expectedToFind = true) assertMetrics(meterRegistry, "cosmos.client.req.gw", expectedToFind = true) assertMetrics(meterRegistry, "cosmos.client.req.rntbd", expectedToFind = false) - assertMetrics(meterRegistry, "cosmos.client.rntbd", expectedToFind = false) - assertMetrics(meterRegistry, "cosmos.client.rntbd.addressResolution", expectedToFind = false) } //scalastyle:on magic.number //scalastyle:on multiple.string.literals diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayWriteITest.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayWriteITest.scala index e475e4ba668c..48588e4d48a2 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayWriteITest.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EGatewayWriteITest.scala @@ -167,8 +167,6 @@ class SparkE2EGatewayWriteITest assertMetrics(meterRegistry, "cosmos.client.system.avgCpuLoad", expectedToFind = true) assertMetrics(meterRegistry, "cosmos.client.req.gw", expectedToFind = true) assertMetrics(meterRegistry, "cosmos.client.req.rntbd", expectedToFind = false) - assertMetrics(meterRegistry, "cosmos.client.rntbd", expectedToFind = false) - assertMetrics(meterRegistry, "cosmos.client.rntbd.addressResolution", expectedToFind = false) } } //scalastyle:on magic.number diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EQueryITestBase.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EQueryITestBase.scala index cf3940dc166a..643d252c01cf 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EQueryITestBase.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EQueryITestBase.scala @@ -301,6 +301,9 @@ abstract class SparkE2EQueryITestBase if (itemCountPos > 0) { val startPos = itemCountPos + "itemCount:".length val itemCount = msg.substring(startPos, msg.indexOf(",", startPos)).toInt + if (itemCount > 3) { + this.logInfo(s"Wrong log message: $msg") + } itemCount should be <= 2 } } diff --git a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EThroughputControlITest.scala b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EThroughputControlITest.scala index f6f28b0fee53..0b7d607bffbe 100644 --- a/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EThroughputControlITest.scala +++ b/sdk/cosmos/azure-cosmos-spark_3_2-12/src/test/scala/com/azure/cosmos/spark/SparkE2EThroughputControlITest.scala @@ -19,35 +19,39 @@ class SparkE2EThroughputControlITest extends IntegrationSpec with Spark with Cos val throughputControlDatabase = cosmosClient.getDatabase(throughputControlDatabaseId) throughputControlDatabase.createContainerIfNotExists(throughputControlContainerId, "/groupId").block() - val cfg = Map("spark.cosmos.accountEndpoint" -> TestConfigurations.HOST, - "spark.cosmos.accountKey" -> TestConfigurations.MASTER_KEY, - "spark.cosmos.database" -> cosmosDatabase, - "spark.cosmos.container" -> cosmosContainer, - "spark.cosmos.read.inferSchema.enabled" -> "true", - "spark.cosmos.throughputControl.enabled" -> "true", - "spark.cosmos.throughputControl.name" -> "sparkTest", - "spark.cosmos.throughputControl.targetThroughput" -> "6", - "spark.cosmos.throughputControl.globalControl.database" -> throughputControlDatabaseId, - "spark.cosmos.throughputControl.globalControl.container" -> throughputControlContainerId, - "spark.cosmos.throughputControl.globalControl.renewIntervalInMS" -> "5000", - "spark.cosmos.throughputControl.globalControl.expireIntervalInMS" -> "20000" - ) - - val newSpark = getSpark - - // scalastyle:off underscore.import - // scalastyle:off import.grouping - import spark.implicits._ - val spark = newSpark - // scalastyle:on underscore.import - // scalastyle:on import.grouping - - val df = Seq( - ("Quark", "Quark", "Red", 1.0 / 2) - ).toDF("particle name", "id", "color", "spin") - - df.write.format("cosmos.oltp").mode("Append").options(cfg).save() - spark.read.format("cosmos.oltp").options(cfg).load() + for (useGatewayMode <- Array(true, false)) { + val cfg = Map("spark.cosmos.accountEndpoint" -> TestConfigurations.HOST, + "spark.cosmos.accountKey" -> TestConfigurations.MASTER_KEY, + "spark.cosmos.database" -> cosmosDatabase, + "spark.cosmos.container" -> cosmosContainer, + "spark.cosmos.read.inferSchema.enabled" -> "true", + "spark.cosmos.throughputControl.enabled" -> "true", + "spark.cosmos.throughputControl.name" -> getThroughputControlGroupName(useGatewayMode), + "spark.cosmos.throughputControl.targetThroughput" -> "6", + "spark.cosmos.throughputControl.globalControl.database" -> throughputControlDatabaseId, + "spark.cosmos.throughputControl.globalControl.container" -> throughputControlContainerId, + "spark.cosmos.throughputControl.globalControl.renewIntervalInMS" -> "5000", + "spark.cosmos.throughputControl.globalControl.expireIntervalInMS" -> "20000", + "spark.cosmos.useGatewayMode" -> useGatewayMode.toString, + "spark.cosmos.applicationName" -> "limitThroughputUsage" + ) + + val newSpark = getSpark + + // scalastyle:off underscore.import + // scalastyle:off import.grouping + import spark.implicits._ + val spark = newSpark + // scalastyle:on underscore.import + // scalastyle:on import.grouping + + val df = Seq( + ("Quark", "Quark", "Red", 1.0 / 2) + ).toDF("particle name", "id", "color", "spin") + + df.write.format("cosmos.oltp").mode("Append").options(cfg).save() + spark.read.format("cosmos.oltp").options(cfg).load() + } } "spark throughput control" should "limit throughput usage after updating targetThroughput" in { @@ -59,38 +63,42 @@ class SparkE2EThroughputControlITest extends IntegrationSpec with Spark with Cos val throughputControlDatabase = cosmosClient.getDatabase(throughputControlDatabaseId) throughputControlDatabase.createContainerIfNotExists(throughputControlContainerId, "/groupId").block() - val cfg = Map("spark.cosmos.accountEndpoint" -> TestConfigurations.HOST, - "spark.cosmos.accountKey" -> TestConfigurations.MASTER_KEY, - "spark.cosmos.database" -> cosmosDatabase, - "spark.cosmos.container" -> cosmosContainer, - "spark.cosmos.read.inferSchema.enabled" -> "true", - "spark.cosmos.throughputControl.enabled" -> "true", - "spark.cosmos.throughputControl.name" -> "sparkTest", - "spark.cosmos.throughputControl.targetThroughputThreshold" -> "0.9", - "spark.cosmos.throughputControl.globalControl.database" -> throughputControlDatabaseId, - "spark.cosmos.throughputControl.globalControl.container" -> throughputControlContainerId, - ) - - val newSpark = getSpark - - // scalastyle:off underscore.import - // scalastyle:off import.grouping - import spark.implicits._ - val spark = newSpark - // scalastyle:on underscore.import - // scalastyle:on import.grouping - - val df = Seq( - ("Quark", "Quark", "Red", 1.0 / 2) - ).toDF("particle name", "id", "color", "spin") - - df.write.format("cosmos.oltp").mode("Append").options(cfg).save() - - spark - .read - .format("cosmos.oltp") - .options(cfg + ("spark.cosmos.throughputControl.targetThroughputThreshold" -> "0.8")) - .load() + for (useGatewayMode <- Array(true, false)) { + val cfg = Map("spark.cosmos.accountEndpoint" -> TestConfigurations.HOST, + "spark.cosmos.accountKey" -> TestConfigurations.MASTER_KEY, + "spark.cosmos.database" -> cosmosDatabase, + "spark.cosmos.container" -> cosmosContainer, + "spark.cosmos.read.inferSchema.enabled" -> "true", + "spark.cosmos.throughputControl.enabled" -> "true", + "spark.cosmos.throughputControl.name" -> getThroughputControlGroupName(useGatewayMode), + "spark.cosmos.throughputControl.targetThroughputThreshold" -> "0.9", + "spark.cosmos.throughputControl.globalControl.database" -> throughputControlDatabaseId, + "spark.cosmos.throughputControl.globalControl.container" -> throughputControlContainerId, + "spark.cosmos.useGatewayMode" -> useGatewayMode.toString, + "spark.cosmos.applicationName" -> "updatingTargetThroughput" + ) + + val newSpark = getSpark + + // scalastyle:off underscore.import + // scalastyle:off import.grouping + import spark.implicits._ + val spark = newSpark + // scalastyle:on underscore.import + // scalastyle:on import.grouping + + val df = Seq( + ("Quark", "Quark", "Red", 1.0 / 2) + ).toDF("particle name", "id", "color", "spin") + + df.write.format("cosmos.oltp").mode("Append").options(cfg).save() + + spark + .read + .format("cosmos.oltp") + .options(cfg + ("spark.cosmos.throughputControl.targetThroughputThreshold" -> "0.8")) + .load() + } } "spark throughput control" should "be able to use a different account config" in { @@ -122,35 +130,39 @@ class SparkE2EThroughputControlITest extends IntegrationSpec with Spark with Cos container.createItem(objectNode).block() } - val cfg = Map("spark.cosmos.accountEndpoint" -> TestConfigurations.HOST, - "spark.cosmos.accountKey" -> TestConfigurations.MASTER_KEY, - "spark.cosmos.database" -> cosmosDatabase, - "spark.cosmos.container" -> cosmosContainer, - "spark.cosmos.read.inferSchema.enabled" -> "true", - "spark.cosmos.read.maxItemCount" -> "1", - "spark.cosmos.throughputControl.enabled" -> "true", - "spark.cosmos.throughputControl.accountEndpoint" -> TestConfigurations.THROUGHPUT_CONTROL_ACCOUNT_HOST, - "spark.cosmos.throughputControl.accountKey" -> TestConfigurations.THROUGHPUT_CONTROL_MASTER_KEY, - "spark.cosmos.throughputControl.name" -> "sparkTest", - "spark.cosmos.throughputControl.targetThroughput" -> "6", - "spark.cosmos.throughputControl.globalControl.database" -> throughputControlDatabaseId, - "spark.cosmos.throughputControl.globalControl.container" -> throughputControlContainerId, - "spark.cosmos.throughputControl.globalControl.renewIntervalInMS" -> "5000", - "spark.cosmos.throughputControl.globalControl.expireIntervalInMS" -> "20000" - ) + for (useGatewayMode <- Array(true, false)) { + val cfg = Map("spark.cosmos.accountEndpoint" -> TestConfigurations.HOST, + "spark.cosmos.accountKey" -> TestConfigurations.MASTER_KEY, + "spark.cosmos.database" -> cosmosDatabase, + "spark.cosmos.container" -> cosmosContainer, + "spark.cosmos.read.inferSchema.enabled" -> "true", + "spark.cosmos.read.maxItemCount" -> "1", + "spark.cosmos.throughputControl.enabled" -> "true", + "spark.cosmos.throughputControl.accountEndpoint" -> TestConfigurations.THROUGHPUT_CONTROL_ACCOUNT_HOST, + "spark.cosmos.throughputControl.accountKey" -> TestConfigurations.THROUGHPUT_CONTROL_MASTER_KEY, + "spark.cosmos.throughputControl.name" -> getThroughputControlGroupName(useGatewayMode), + "spark.cosmos.throughputControl.targetThroughput" -> "6", + "spark.cosmos.throughputControl.globalControl.database" -> throughputControlDatabaseId, + "spark.cosmos.throughputControl.globalControl.container" -> throughputControlContainerId, + "spark.cosmos.throughputControl.globalControl.renewIntervalInMS" -> "5000", + "spark.cosmos.throughputControl.globalControl.expireIntervalInMS" -> "20000", + "spark.cosmos.useGatewayMode" -> useGatewayMode.toString, + "spark.cosmos.applicationName" -> "usingDifferentThroughputControlAccount" + ) - val newSpark = getSpark + val newSpark = getSpark - // scalastyle:off underscore.import - // scalastyle:off import.grouping - import spark.implicits._ - val spark = newSpark - // scalastyle:on underscore.import - // scalastyle:on import.grouping + // scalastyle:off underscore.import + // scalastyle:off import.grouping + import spark.implicits._ + val spark = newSpark + // scalastyle:on underscore.import + // scalastyle:on import.grouping - val df = spark.read.format("cosmos.oltp.changeFeed").options(cfg).load() - val rowsArray = df.collect() - rowsArray should have size 10 + val df = spark.read.format("cosmos.oltp.changeFeed").options(cfg).load() + val rowsArray = df.collect() + rowsArray should have size 10 + } } finally { if (throughputControlClient != null) { throughputControlDatabase.delete().block() @@ -168,17 +180,68 @@ class SparkE2EThroughputControlITest extends IntegrationSpec with Spark with Cos .block() try { + for (useGatewayMode <- Array(true, false)) { + val cfg = Map("spark.cosmos.accountEndpoint" -> TestConfigurations.HOST, + "spark.cosmos.accountKey" -> TestConfigurations.MASTER_KEY, + "spark.cosmos.database" -> cosmosDatabase, + "spark.cosmos.container" -> testContainer.getId, + "spark.cosmos.read.inferSchema.enabled" -> "true", + "spark.cosmos.throughputControl.enabled" -> "true", + "spark.cosmos.throughputControl.globalControl.useDedicatedContainer" -> "false", + "spark.cosmos.throughputControl.name" -> getThroughputControlGroupName(useGatewayMode), + "spark.cosmos.throughputControl.targetThroughput" -> "6", + "spark.cosmos.throughputControl.globalControl.renewIntervalInMS" -> "5000", + "spark.cosmos.throughputControl.globalControl.expireIntervalInMS" -> "20000", + "spark.cosmos.useGatewayMode" -> useGatewayMode.toString, + "spark.cosmos.applicationName" -> "withoutDedicatedThroughputContainer" + ) + + val newSpark = getSpark + + // scalastyle:off underscore.import + // scalastyle:off import.grouping + import spark.implicits._ + val spark = newSpark + // scalastyle:on underscore.import + // scalastyle:on import.grouping + + val df = Seq( + ("Quark", "Quark", "Red", 1.0 / 2) + ).toDF("particle name", "id", "color", "spin") + + df.write.format("cosmos.oltp").mode("Append").options(cfg).save() + spark.read.format("cosmos.oltp").options(cfg).load() + } + } finally { + testContainer.delete().block() + } + } + + "spark throughput control" should "limit low priority requests" in { + + val throughputControlDatabaseId = "testThroughputControlDB" + val throughputControlContainerId = "testThroughputControlContainer" + + cosmosClient.createDatabaseIfNotExists(throughputControlDatabaseId).block() + val throughputControlDatabase = cosmosClient.getDatabase(throughputControlDatabaseId) + throughputControlDatabase.createContainerIfNotExists(throughputControlContainerId, "/groupId").block() + + for (useGatewayMode <- Array(true, false)) { val cfg = Map("spark.cosmos.accountEndpoint" -> TestConfigurations.HOST, "spark.cosmos.accountKey" -> TestConfigurations.MASTER_KEY, "spark.cosmos.database" -> cosmosDatabase, - "spark.cosmos.container" -> testContainer.getId, + "spark.cosmos.container" -> cosmosContainer, "spark.cosmos.read.inferSchema.enabled" -> "true", "spark.cosmos.throughputControl.enabled" -> "true", - "spark.cosmos.throughputControl.globalControl.useDedicatedContainer" -> "false", - "spark.cosmos.throughputControl.name" -> "sparkTest", + "spark.cosmos.throughputControl.name" -> getThroughputControlGroupName(useGatewayMode), "spark.cosmos.throughputControl.targetThroughput" -> "6", + "spark.cosmos.throughputControl.priorityLevel" -> "Low", + "spark.cosmos.throughputControl.globalControl.database" -> throughputControlDatabaseId, + "spark.cosmos.throughputControl.globalControl.container" -> throughputControlContainerId, "spark.cosmos.throughputControl.globalControl.renewIntervalInMS" -> "5000", - "spark.cosmos.throughputControl.globalControl.expireIntervalInMS" -> "20000" + "spark.cosmos.throughputControl.globalControl.expireIntervalInMS" -> "20000", + "spark.cosmos.useGatewayMode" -> useGatewayMode.toString, + "spark.cosmos.applicationName" -> "withLowPriorityLevel" ) val newSpark = getSpark @@ -196,49 +259,10 @@ class SparkE2EThroughputControlITest extends IntegrationSpec with Spark with Cos df.write.format("cosmos.oltp").mode("Append").options(cfg).save() spark.read.format("cosmos.oltp").options(cfg).load() - } finally { - testContainer.delete().block() - } + } } - "spark throughput control" should "limit low priority requests" in { - - val throughputControlDatabaseId = "testThroughputControlDB" - val throughputControlContainerId = "testThroughputControlContainer" - - cosmosClient.createDatabaseIfNotExists(throughputControlDatabaseId).block() - val throughputControlDatabase = cosmosClient.getDatabase(throughputControlDatabaseId) - throughputControlDatabase.createContainerIfNotExists(throughputControlContainerId, "/groupId").block() - - val cfg = Map("spark.cosmos.accountEndpoint" -> TestConfigurations.HOST, - "spark.cosmos.accountKey" -> TestConfigurations.MASTER_KEY, - "spark.cosmos.database" -> cosmosDatabase, - "spark.cosmos.container" -> cosmosContainer, - "spark.cosmos.read.inferSchema.enabled" -> "true", - "spark.cosmos.throughputControl.enabled" -> "true", - "spark.cosmos.throughputControl.name" -> "sparkTest", - "spark.cosmos.throughputControl.targetThroughput" -> "6", - "spark.cosmos.throughputControl.priorityLevel" -> "Low", - "spark.cosmos.throughputControl.globalControl.database" -> throughputControlDatabaseId, - "spark.cosmos.throughputControl.globalControl.container" -> throughputControlContainerId, - "spark.cosmos.throughputControl.globalControl.renewIntervalInMS" -> "5000", - "spark.cosmos.throughputControl.globalControl.expireIntervalInMS" -> "20000" - ) - - val newSpark = getSpark - - // scalastyle:off underscore.import - // scalastyle:off import.grouping - import spark.implicits._ - val spark = newSpark - // scalastyle:on underscore.import - // scalastyle:on import.grouping - - val df = Seq( - ("Quark", "Quark", "Red", 1.0 / 2) - ).toDF("particle name", "id", "color", "spin") - - df.write.format("cosmos.oltp").mode("Append").options(cfg).save() - spark.read.format("cosmos.oltp").options(cfg).load() + private[this] def getThroughputControlGroupName(useGatewayMode: Boolean): String = { + s"sparkTest-${useGatewayMode.toString}-${UUID.randomUUID().toString}" } } diff --git a/sdk/cosmos/azure-cosmos-test/pom.xml b/sdk/cosmos/azure-cosmos-test/pom.xml index 2849b313476a..63ccad6c5e50 100644 --- a/sdk/cosmos/azure-cosmos-test/pom.xml +++ b/sdk/cosmos/azure-cosmos-test/pom.xml @@ -54,7 +54,7 @@ Licensed under the MIT License. com.azure azure-cosmos - 4.50.0-beta.1 + 4.51.0-beta.1 diff --git a/sdk/cosmos/azure-cosmos-test/src/main/java/com/azure/cosmos/test/implementation/faultinjection/FaultInjectionServerErrorRule.java b/sdk/cosmos/azure-cosmos-test/src/main/java/com/azure/cosmos/test/implementation/faultinjection/FaultInjectionServerErrorRule.java index cc573f8b1b1b..b30cf15aff2b 100644 --- a/sdk/cosmos/azure-cosmos-test/src/main/java/com/azure/cosmos/test/implementation/faultinjection/FaultInjectionServerErrorRule.java +++ b/sdk/cosmos/azure-cosmos-test/src/main/java/com/azure/cosmos/test/implementation/faultinjection/FaultInjectionServerErrorRule.java @@ -161,7 +161,9 @@ public FaultInjectionServerErrorResultInternal getResult() { @Override public boolean isValid() { Instant now = Instant.now(); - return this.enabled && now.isAfter(this.startTime) && now.isBefore(this.expireTime); + return this.enabled + && (now.equals(this.startTime) || now.isAfter(this.startTime)) + && (now.equals(this.expireTime) || now.isBefore(this.expireTime)); } @Override diff --git a/sdk/cosmos/azure-cosmos-tests/pom.xml b/sdk/cosmos/azure-cosmos-tests/pom.xml index 6695a6d66972..ffc2eabbf36b 100644 --- a/sdk/cosmos/azure-cosmos-tests/pom.xml +++ b/sdk/cosmos/azure-cosmos-tests/pom.xml @@ -99,7 +99,7 @@ Licensed under the MIT License. com.azure azure-cosmos - 4.50.0-beta.1 + 4.51.0-beta.1 com.azure diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ClientMetricsTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ClientMetricsTest.java index d5343ee9140a..fff5baceda92 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ClientMetricsTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ClientMetricsTest.java @@ -67,6 +67,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; @@ -197,7 +198,19 @@ public void maxValueExceedingDefinedLimitStillWorksWithoutException() throws Exc List measurements = new ArrayList<>(); requestLatencyMeter.measure().forEach(measurements::add); - assertThat(measurements.size()).isEqualTo(3); + int expectedMeasurementCount = 3; + if (measurements.size() < expectedMeasurementCount) { + logger.error("Size should have been 3 but was {}", measurements.size()); + for (int i = 0; i < measurements.size(); i++) { + Measurement m = measurements.get(i); + logger.error( + "{}: {}", + i, + m); + } + } + + assertThat(measurements.size()).isGreaterThanOrEqualTo(expectedMeasurementCount); assertThat(measurements.get(0).getStatistic().getTagValueRepresentation()).isEqualTo("count"); assertThat(measurements.get(0).getValue()).isEqualTo(1); @@ -249,7 +262,7 @@ public void createItem() throws Exception { this.validateMetrics( expectedOperationTag, expectedRequestTag, - 1, + 0, 300 ); @@ -274,7 +287,7 @@ public void createItem() throws Exception { Tag.of( TagName.Operation.toString(), "Document/Create"), Tag.of(TagName.RequestOperationType.toString(), "Document/Create"), - 1, + 0, 300 ); } @@ -321,7 +334,7 @@ public void createItemWithAllMetrics() throws Exception { this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "201"), Tag.of(TagName.RequestStatusCode.toString(), "201/0"), - 1, + 0, 300 ); @@ -329,7 +342,7 @@ public void createItemWithAllMetrics() throws Exception { Tag.of( TagName.Operation.toString(), "Document/Create"), Tag.of(TagName.RequestOperationType.toString(), "Document/Create"), - 1, + 0, 300 ); @@ -374,7 +387,7 @@ public void readItem() throws Exception { this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "200"), Tag.of(TagName.RequestStatusCode.toString(), "200/0"), - 1, + 0, 500 ); @@ -382,7 +395,7 @@ public void readItem() throws Exception { Tag.of( TagName.Operation.toString(), "Document/Read"), Tag.of(TagName.RequestOperationType.toString(), "Document/Read"), - 1, + 0, 500 ); @@ -467,7 +480,7 @@ public void replaceItem() throws Exception { this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "200"), Tag.of(TagName.RequestStatusCode.toString(), "200/0"), - 1, + 0, 1000 ); @@ -475,7 +488,7 @@ public void replaceItem() throws Exception { Tag.of( TagName.Operation.toString(), "Document/Replace"), Tag.of(TagName.RequestOperationType.toString(), "Document/Replace"), - 1, + 0, 1000 ); } finally { @@ -534,7 +547,7 @@ public void readAllItems() throws Exception { this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "200"), Tag.of(TagName.RequestStatusCode.toString(), "200/0"), - 1, + 0, 3000 ); @@ -542,7 +555,7 @@ public void readAllItems() throws Exception { Tag.of( TagName.Operation.toString(), "Document/ReadFeed/readAllItems." + container.getId()), Tag.of(TagName.RequestOperationType.toString(), "Document/Query"), - 1, + 0, 10000 ); @@ -583,7 +596,7 @@ public void readAllItemsWithDetailMetrics() throws Exception { this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "200"), Tag.of(TagName.RequestStatusCode.toString(), "200/0"), - 1, + 0, 10000 ); @@ -591,7 +604,7 @@ public void readAllItemsWithDetailMetrics() throws Exception { Tag.of( TagName.Operation.toString(), "Document/ReadFeed/readAllItems." + container.getId()), Tag.of(TagName.RequestOperationType.toString(), "Document/Query"), - 1, + 0, 10000 ); @@ -636,7 +649,7 @@ public void readAllItemsWithDetailMetricsWithExplicitPageSize() throws Exception this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "200"), Tag.of(TagName.RequestStatusCode.toString(), "200/0"), - 1, + 0, 10000 ); @@ -644,7 +657,7 @@ public void readAllItemsWithDetailMetricsWithExplicitPageSize() throws Exception Tag.of( TagName.Operation.toString(), "Document/ReadFeed/readAllItems." + container.getId()), Tag.of(TagName.RequestOperationType.toString(), "Document/Query"), - 1, + 0, 10000 ); @@ -690,7 +703,7 @@ public void queryItems() throws Exception { this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "200"), Tag.of(TagName.RequestStatusCode.toString(), "200/0"), - 1, + 0, 100000 ); @@ -698,7 +711,7 @@ public void queryItems() throws Exception { Tag.of( TagName.Operation.toString(), "Document/Query/queryItems." + container.getId()), Tag.of(TagName.RequestOperationType.toString(), "Document/Query"), - 1, + 0, 100000 ); @@ -768,7 +781,7 @@ public void itemPatchSuccess() { this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "200"), Tag.of(TagName.RequestStatusCode.toString(), "200/0"), - 1, + 0, 3000 ); @@ -776,7 +789,7 @@ public void itemPatchSuccess() { Tag.of( TagName.Operation.toString(), "Document/Patch"), Tag.of(TagName.RequestOperationType.toString(), "Document/Patch"), - 1, + 0, 3000 ); } finally { @@ -822,7 +835,7 @@ public void createItem_withBulk() { this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "200"), Tag.of(TagName.RequestStatusCode.toString(), "200/0"), - 1, + 0, 10000 ); @@ -830,7 +843,7 @@ public void createItem_withBulk() { Tag.of( TagName.Operation.toString(), "Document/Batch"), Tag.of(TagName.RequestOperationType.toString(), "Document/Batch"), - 1, + 0, 10000 ); } finally { @@ -884,7 +897,7 @@ public void batchMultipleItemExecution() { this.validateMetrics( Tag.of(TagName.OperationStatusCode.toString(), "200"), Tag.of(TagName.RequestStatusCode.toString(), "200/0"), - 1, + 0, 3000 ); @@ -892,7 +905,7 @@ public void batchMultipleItemExecution() { Tag.of( TagName.Operation.toString(), "Document/Batch"), Tag.of(TagName.RequestOperationType.toString(), "Document/Batch"), - 1, + 0, 3000 ); } finally { @@ -1263,9 +1276,10 @@ private void validateItemCountMetrics(Tag expectedOperationTag) { private void validateReasonableRUs(Meter reportedRequestChargeMeter, int expectedMinRu, int expectedMaxRu) { List measurements = new ArrayList<>(); reportedRequestChargeMeter.measure().forEach(measurements::add); - + logger.info("RequestedRequestChargeMeter: {} {}", reportedRequestChargeMeter, reportedRequestChargeMeter.getId()); assertThat(measurements.size()).isGreaterThan(0); for (int i = 0; i < measurements.size(); i++) { + assertThat(measurements.get(i).getValue()).isGreaterThanOrEqualTo(expectedMinRu); assertThat(measurements.get(i).getValue()).isLessThanOrEqualTo(expectedMaxRu); } @@ -1374,19 +1388,49 @@ private Meter assertMetrics(String prefix, boolean expectedToFind, Tag withTag) fail(message); } + if (meterMatches.size() > 1) { + StringBuilder sb = new StringBuilder(); + final AtomicReference exactMatchMeter = new AtomicReference<>(null); + meterMatches.forEach(m -> { + if (exactMatchMeter.get() == null && m.getId().getName().equals(prefix)) { + exactMatchMeter.set(m); + } + + String message = String.format( + "Found more than one meter '%s' for prefix '%s' withTag '%s' --> '%s'", + m.getId(), + prefix, + withTag, + m); + sb.append(message); + sb.append(System.getProperty("line.separator")); + logger.info(message); + }); + + if (exactMatchMeter.get() != null) { + logger.info("Found exact match {}", exactMatchMeter); + return exactMatchMeter.get(); + } + } + return meterMatches.get(0); } else { if (meterMatches.size() > 0) { - String message = String.format( - "Found unexpected meter '%s' for prefix '%s' withTag '%s'", - meters.get(0).getId(), - prefix, - withTag); - logger.error(message); - meterMatches.forEach(m -> - logger.info("Found unexpected meter {}", m.getId().getName())); - - fail(message); + StringBuilder sb = new StringBuilder(); + meterMatches.forEach(m -> { + String message = String.format( + "Found unexpected meter '%s' for prefix '%s' withTag '%s' --> '%s'", + m, + prefix, + withTag, + m); + sb.append(message); + sb.append(System.getProperty("line.separator")); + logger.error(message); + }); + + + fail(sb.toString()); } assertThat(meterMatches.size()).isEqualTo(0); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ClientTelemetryTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ClientTelemetryTest.java index e70c6a8ace0b..4fadc05f4726 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ClientTelemetryTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ClientTelemetryTest.java @@ -173,8 +173,9 @@ public void operationsList(CosmosClient cosmosClient) throws Exception { FeedResponse response = iterator.next(); } - //Verifying above query operation, we should have 2 operation (1 latency, 1 request charge) - assertThat(clientTelemetry.getClientTelemetryInfo().getOperationInfoMap().size()).isEqualTo(2); + // Verifying above query operation, we should have 4 operation (1 latency, 1 request charge - + // for both query plan and the actual feed response) + assertThat(clientTelemetry.getClientTelemetryInfo().getOperationInfoMap().size()).isEqualTo(4); } @Test(groups = {"emulator"}, timeOut = TIMEOUT) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDiagnosticsTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDiagnosticsTest.java index 62df6bb11ecb..802c8d2c1148 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDiagnosticsTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosDiagnosticsTest.java @@ -79,6 +79,7 @@ import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -1385,13 +1386,17 @@ public void responseStatisticRequestStartTimeUTCForDirectCall() { fail("Request should succeeded, but failed with " + exception); } - List clientSideRequestStatistics = (List) cosmosDiagnostics.getClientSideRequestStatistics(); - List responseStatistic = clientSideRequestStatistics.get(0).getResponseStatisticsList(); + Collection clientSideRequestStatistics = cosmosDiagnostics.getClientSideRequestStatistics(); + ClientSideRequestStatistics.StoreResponseStatistics[] responseStatistic = + clientSideRequestStatistics.iterator() + .next() + .getResponseStatisticsList() + .toArray(new ClientSideRequestStatistics.StoreResponseStatistics[0]); - assert responseStatistic.size() == 2; + assert responseStatistic.length == 2; - Instant firstRequestStartTime = responseStatistic.get(0).getRequestStartTimeUTC(); - Instant secondRequestStartTime = responseStatistic.get(1).getRequestStartTimeUTC(); + Instant firstRequestStartTime = responseStatistic[0].getRequestStartTimeUTC(); + Instant secondRequestStartTime = responseStatistic[1].getRequestStartTimeUTC(); assert firstRequestStartTime != null && secondRequestStartTime != null; assert firstRequestStartTime != secondRequestStartTime; @@ -1498,9 +1503,9 @@ private List getStoreRespon Field storeResponseStatisticsField = ClientSideRequestStatistics.class.getDeclaredField("supplementalResponseStatisticsList"); storeResponseStatisticsField.setAccessible(true); @SuppressWarnings({"unchecked"}) - List list - = (List) storeResponseStatisticsField.get(requestStatistics); - return list; + Collection list + = (Collection) storeResponseStatisticsField.get(requestStatistics); + return new ArrayList<>(list); } private void clearStoreResponseStatistics(ClientSideRequestStatistics requestStatistics) throws Exception { diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosTracerTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosTracerTest.java index c68fbf93a7f9..288c854e1ad8 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosTracerTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosTracerTest.java @@ -57,8 +57,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import org.assertj.core.api.Assertions; import org.mockito.Mockito; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.testng.SkipException; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -90,7 +88,6 @@ // TODO: Annie: enable emulator group public class CosmosTracerTest extends TestSuiteBase { - private final static Logger LOGGER = LoggerFactory.getLogger(CosmosTracerTest.class); private final static ObjectMapper OBJECT_MAPPER = Utils.getSimpleObjectMapper(); private static String ITEM_ID; @@ -783,6 +780,7 @@ public void cosmosAsyncContainer( enableRequestLevelTracing, forceThresholdViolations, samplingRate); + mockTracer.reset(); } @@ -1252,12 +1250,9 @@ private void verifyOTelTracerAttributes( assertThat(currentSpan).isNotNull(); assertThat(currentSpan.getContext()).isNotNull(); - CosmosDiagnosticsContext ctx = DiagnosticsProvider.getCosmosDiagnosticsContextFromTraceContextOrThrow( - currentSpan.getContext() - ); assertThat(cosmosDiagnostics.getDiagnosticsContext()).isNotNull(); - assertThat(cosmosDiagnostics.getDiagnosticsContext()).isSameAs(ctx); + CosmosDiagnosticsContext ctx = cosmosDiagnostics.getDiagnosticsContext(); Map attributes = currentSpan.getAttributes(); if (databaseName != null) { @@ -1325,15 +1320,13 @@ private void verifyOTelTracerDiagnostics(CosmosDiagnostics cosmosDiagnostics, assertThat(currentSpan).isNotNull(); assertThat(currentSpan.getContext()).isNotNull(); - CosmosDiagnosticsContext ctx = DiagnosticsProvider.getCosmosDiagnosticsContextFromTraceContextOrThrow( - currentSpan.getContext() - ); + CosmosDiagnosticsContext ctx = cosmosDiagnostics.getDiagnosticsContext(); assertThat(cosmosDiagnostics.getUserAgent()).isEqualTo(ctx.getUserAgent()); assertThat(ctx.getSystemUsage()).isNotNull(); assertThat(ctx.getConnectionMode()).isEqualTo(client.getConnectionPolicy().getConnectionMode().toString()); - Collection events = currentSpan.getEvents(); + Collection events = mockTracer.getEventsOfAllCollectedSiblingSpans(); if (ctx.isCompleted() && (ctx.isFailure() || ctx.isThresholdViolated())) { if (ctx.isFailure()) { assertThat(events).anyMatch(e -> e.getName() .equals("failure")); @@ -1359,15 +1352,13 @@ private void verifyOTelTracerTransport(CosmosDiagnostics lastCosmosDiagnostics, TracerUnderTest.SpanRecord currentSpan = mockTracer.getCurrentSpan(); assertThat(currentSpan).isNotNull(); assertThat(currentSpan.getContext()).isNotNull(); - CosmosDiagnosticsContext ctx = DiagnosticsProvider.getCosmosDiagnosticsContextFromTraceContextOrThrow( - currentSpan.getContext() - ); + CosmosDiagnosticsContext ctx = lastCosmosDiagnostics.getDiagnosticsContext(); assertThat(lastCosmosDiagnostics).isNotNull(); assertThat(lastCosmosDiagnostics.getDiagnosticsContext()).isNotNull(); assertThat(lastCosmosDiagnostics.getDiagnosticsContext()).isSameAs(ctx); - Collection events = currentSpan.getEvents(); + Collection events = mockTracer.getEventsOfAllCollectedSiblingSpans(); if (!enableRequestLevelTracing || // For Gateway we rely on http out-of-the-box tracing client.getConnectionPolicy().getConnectionMode() != ConnectionMode.DIRECT) { @@ -1408,7 +1399,7 @@ private void verifyOTelTracerTransport(CosmosDiagnostics lastCosmosDiagnostics, private void assertStoreResponseStatistics( CosmosDiagnosticsContext ctx, TracerUnderTest mockTracer, - List storeResponseStatistics) { + Collection storeResponseStatistics) { for (ClientSideRequestStatistics.StoreResponseStatistics responseStatistics: storeResponseStatistics) { StoreResultDiagnostics storeResultDiagnostics = responseStatistics.getStoreResult(); @@ -1604,8 +1595,11 @@ private static void assertEvent( assertThat(mockTracer).isNotNull(); assertThat(mockTracer.getCurrentSpan()).isNotNull(); List filteredEvents = - mockTracer.getCurrentSpan().getEvents().stream().filter(e -> + mockTracer.getEventsOfAllCollectedSiblingSpans().stream().filter(e -> e.getName().equals(eventName)).collect(Collectors.toList()); + if (filteredEvents.size() == 0) { + logger.error("Event: {}", eventName); + } assertThat(filteredEvents).hasSizeGreaterThanOrEqualTo(1); if (time != null) { filteredEvents = @@ -1752,11 +1746,11 @@ private void verifyLegacyTracerDiagnostics(CosmosDiagnostics cosmosDiagnostics, for (ClientSideRequestStatistics clientSideStatistics : feedResponseDiagnostics.getClientSideRequestStatistics()) { if (clientSideStatistics.getResponseStatisticsList() != null && clientSideStatistics.getResponseStatisticsList().size() > 0 - && clientSideStatistics.getResponseStatisticsList().get(0).getStoreResult() != null) { + && clientSideStatistics.getResponseStatisticsList().iterator().next().getStoreResult() != null) { String pkRangeId = clientSideStatistics .getResponseStatisticsList() - .get(0) + .iterator().next() .getStoreResult() .getStoreResponseDiagnostics() .getPartitionKeyRangeId(); @@ -1794,7 +1788,7 @@ private void verifyLegacyTracerDiagnostics(CosmosDiagnostics cosmosDiagnostics, String eventName = "Query Metrics for PKRange " + queryMetrics.getKey(); assertThat(mockTracer.getCurrentSpan()).isNotNull(); List filteredEvents = - mockTracer.getCurrentSpan().getEvents().stream().filter( + mockTracer.getEventsOfAllCollectedSiblingSpans().stream().filter( e -> e.getName().equals(eventName)).collect(Collectors.toList()); assertThat(filteredEvents).hasSizeGreaterThanOrEqualTo(1); assertThat(filteredEvents.size()).isGreaterThanOrEqualTo(1); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/EndToEndTimeOutWithAvailabilityTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/EndToEndTimeOutWithAvailabilityTest.java index 6b7bd79a39e4..b39af38a0e61 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/EndToEndTimeOutWithAvailabilityTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/EndToEndTimeOutWithAvailabilityTest.java @@ -54,8 +54,6 @@ public class EndToEndTimeOutWithAvailabilityTest extends TestSuiteBase { private static final int DEFAULT_NUM_DOCUMENTS = 100; private final Random random; - private final List createdDocuments = new ArrayList<>(); - private final CosmosEndToEndOperationLatencyPolicyConfig endToEndOperationLatencyPolicyConfig; private static final int TIMEOUT = 60000; private CosmosAsyncClient clientWithPreferredRegions; private CosmosAsyncContainer cosmosAsyncContainer; @@ -69,8 +67,6 @@ public class EndToEndTimeOutWithAvailabilityTest extends TestSuiteBase { public EndToEndTimeOutWithAvailabilityTest(CosmosClientBuilder clientBuilder) { super(clientBuilder); random = new Random(); - endToEndOperationLatencyPolicyConfig = new CosmosEndToEndOperationLatencyPolicyConfigBuilder(Duration.ofSeconds(2)) - .build(); } @BeforeClass(groups = {"multi-master"}, timeOut = SETUP_TIMEOUT * 100) @@ -119,10 +115,10 @@ public void testThresholdAvailabilityStrategy(OperationType operationType, Fault CosmosDiagnosticsContext diagnosticsContext = cosmosDiagnostics.getDiagnosticsContext(); assertThat(diagnosticsContext).isNotNull(); assertThat(diagnosticsContext.getContactedRegionNames().size()).isGreaterThan(1); - ObjectNode diagnosticsNode = null; + ObjectNode diagnosticsNode; try { if (operationType == OperationType.Query) { - assertThat(cosmosDiagnostics.getClientSideRequestStatistics().iterator().next().getResponseStatisticsList().get(0).getRegionName()) + assertThat(cosmosDiagnostics.getClientSideRequestStatistics().iterator().next().getResponseStatisticsList().iterator().next().getRegionName()) .isEqualTo(regions.get(1).toLowerCase(Locale.ROOT)); } else { diagnosticsNode = (ObjectNode) OBJECT_MAPPER.readTree(cosmosDiagnostics.toString()); @@ -142,9 +138,7 @@ public static Object[][] faultInjectionArgProvider() { {OperationType.Replace, FaultInjectionOperationType.REPLACE_ITEM}, {OperationType.Create, FaultInjectionOperationType.CREATE_ITEM}, {OperationType.Delete, FaultInjectionOperationType.DELETE_ITEM}, - // TODO @fabianm wire up clientContext - availability strategy not yet wired up for query - // reenable when adding query support - //{OperationType.Query, FaultInjectionOperationType.QUERY_ITEM}, + {OperationType.Query, FaultInjectionOperationType.QUERY_ITEM}, {OperationType.Patch, FaultInjectionOperationType.PATCH_ITEM} }; } diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/FaultInjectionWithAvailabilityStrategyTests.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/FaultInjectionWithAvailabilityStrategyTests.java index f91084e17aa7..be8068f36f34 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/FaultInjectionWithAvailabilityStrategyTests.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/FaultInjectionWithAvailabilityStrategyTests.java @@ -3,11 +3,13 @@ package com.azure.cosmos; import com.azure.cosmos.implementation.AsyncDocumentClient; +import com.azure.cosmos.implementation.ClientSideRequestStatistics; import com.azure.cosmos.implementation.DatabaseAccount; import com.azure.cosmos.implementation.DatabaseAccountLocation; import com.azure.cosmos.implementation.GlobalEndpointManager; import com.azure.cosmos.implementation.HttpConstants; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; +import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.RxDocumentClientImpl; import com.azure.cosmos.implementation.TestConfigurations; import com.azure.cosmos.implementation.Utils; @@ -20,14 +22,17 @@ import com.azure.cosmos.models.CosmosPatchItemRequestOptions; import com.azure.cosmos.models.CosmosPatchOperations; import com.azure.cosmos.models.CosmosQueryRequestOptions; +import com.azure.cosmos.models.FeedRange; import com.azure.cosmos.models.FeedResponse; import com.azure.cosmos.models.PartitionKey; import com.azure.cosmos.models.PartitionKeyDefinition; +import com.azure.cosmos.models.ThroughputProperties; import com.azure.cosmos.rx.TestSuiteBase; import com.azure.cosmos.test.faultinjection.CosmosFaultInjectionHelper; import com.azure.cosmos.test.faultinjection.FaultInjectionCondition; import com.azure.cosmos.test.faultinjection.FaultInjectionConditionBuilder; import com.azure.cosmos.test.faultinjection.FaultInjectionConnectionType; +import com.azure.cosmos.test.faultinjection.FaultInjectionEndpointBuilder; import com.azure.cosmos.test.faultinjection.FaultInjectionOperationType; import com.azure.cosmos.test.faultinjection.FaultInjectionResultBuilders; import com.azure.cosmos.test.faultinjection.FaultInjectionRule; @@ -37,6 +42,7 @@ import com.azure.cosmos.util.CosmosPagedFlux; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; +import org.apache.commons.lang3.ArrayUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterClass; @@ -63,6 +69,7 @@ @SuppressWarnings("SameParameterValue") public class FaultInjectionWithAvailabilityStrategyTests extends TestSuiteBase { + private static final int PHYSICAL_PARTITION_COUNT = 3; private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private final static Logger logger = LoggerFactory.getLogger(FaultInjectionWithAvailabilityStrategyTests.class); @@ -125,10 +132,6 @@ public class FaultInjectionWithAvailabilityStrategyTests extends TestSuiteBase { private final static Consumer validateDiagnosticsContextHasDiagnosticsForOnlyFirstRegionButWithRegionalFailover = (ctx) -> { - logger.info( - "Diagnostics Context to evaluate: {}", - ctx != null ? ctx.toJson() : "NULL"); - assertThat(ctx).isNotNull(); if (ctx != null) { assertThat(ctx.getDiagnostics()).isNotNull(); @@ -139,10 +142,6 @@ public class FaultInjectionWithAvailabilityStrategyTests extends TestSuiteBase { private final static Consumer validateDiagnosticsContextHasDiagnosticsForOneOrTwoRegionsButTwoContactedRegions = (ctx) -> { - logger.info( - "Diagnostics Context to evaluate: {}", - ctx != null ? ctx.toJson() : "NULL"); - assertThat(ctx).isNotNull(); if (ctx != null) { assertThat(ctx.getDiagnostics()).isNotNull(); @@ -220,10 +219,6 @@ public void beforeClass() { this.validateDiagnosticsContextHasDiagnosticsForAllRegions = (ctx) -> { - logger.debug( - "Diagnostics Context to evaluate: {}", - ctx != null ? ctx.toJson() : "NULL"); - assertThat(ctx).isNotNull(); if (ctx != null) { assertThat(ctx.getDiagnostics()).isNotNull(); @@ -232,30 +227,27 @@ public void beforeClass() { } }; - this.validateDiagnosticsContextHasDiagnosticsForOnlyFirstRegion = - (ctx) -> { - logger.info( - "Diagnostics Context to evaluate: {}", - ctx != null ? ctx.toJson() : "NULL"); + this.validateDiagnosticsContextHasDiagnosticsForOnlyFirstRegion = (ctx) -> { + assertThat(ctx).isNotNull(); + if (ctx != null) { + assertThat(ctx.getDiagnostics()).isNotNull(); + assertThat(ctx.getDiagnostics().size()).isEqualTo(1); + assertThat(ctx.getContactedRegionNames().size()).isEqualTo(1); + assertThat(ctx.getContactedRegionNames().iterator().next()) + .isEqualTo(this.writeableRegions.get(0).toLowerCase(Locale.ROOT)); + } + }; - assertThat(ctx).isNotNull(); - if (ctx != null) { - assertThat(ctx.getDiagnostics()).isNotNull(); - assertThat(ctx.getDiagnostics().size()).isEqualTo(1); - assertThat(ctx.getContactedRegionNames().size()).isEqualTo(1); - assertThat(ctx.getContactedRegionNames().iterator().next()) - .isEqualTo(this.writeableRegions.get(0).toLowerCase(Locale.ROOT)); - } - }; + FeedRange ALL_PARTITIONS = null; this.injectReadSessionNotAvailableIntoAllRegions = - (c, operationType) -> injectReadSessionNotAvailableError(c, this.writeableRegions, operationType); + (c, operationType) -> injectReadSessionNotAvailableError(c, this.writeableRegions, operationType, ALL_PARTITIONS); this.injectReadSessionNotAvailableIntoFirstRegionOnly = - (c, operationType) -> injectReadSessionNotAvailableError(c, this.getFirstRegion(), operationType); + (c, operationType) -> injectReadSessionNotAvailableError(c, this.getFirstRegion(), operationType, ALL_PARTITIONS); this.injectReadSessionNotAvailableIntoAllExceptFirstRegion = - (c, operationType) -> injectReadSessionNotAvailableError(c, this.getAllRegionsExceptFirst(), operationType); + (c, operationType) -> injectReadSessionNotAvailableError(c, this.getAllRegionsExceptFirst(), operationType, ALL_PARTITIONS); this.injectTransitTimeoutIntoFirstRegionOnly = (c, operationType) -> injectTransitTimeout(c, this.getFirstRegion(), operationType); @@ -737,7 +729,12 @@ public void readAfterCreation( readItemCallback, faultInjectionCallback, validateStatusCode, - validateDiagnosticsContext); + 1, + ArrayUtils.toArray(validateDiagnosticsContext), + null, + null, + 0, + 0); } @DataProvider(name = "testConfigs_writeAfterCreation") @@ -1531,48 +1528,262 @@ public void writeAfterCreation( actionAfterInitialCreation, faultInjectionCallback, validateStatusCode, - validateDiagnosticsContext); + 1, + ArrayUtils.toArray(validateDiagnosticsContext), + null, + null, + 0, + 0); } - @DataProvider(name = "testConfigs_queryAfterCreation") - public Object[][] testConfigs_queryAfterCreation() { - BiFunction queryReturnsFirstNonEmptyPage = (query, params) -> { - - CosmosQueryRequestOptions queryOptions = new CosmosQueryRequestOptions(); - CosmosEndToEndOperationLatencyPolicyConfig e2ePolicy = ImplementationBridgeHelpers - .CosmosItemRequestOptionsHelper - .getCosmosItemRequestOptionsAccessor() - .getEndToEndOperationLatencyPolicyConfig(params.options); - queryOptions.setCosmosEndToEndOperationLatencyPolicyConfig(e2ePolicy); - - CosmosPagedFlux queryPagedFlux = params.container.queryItems( - query, - queryOptions, - ObjectNode.class - ); - - List> returnedPages = - queryPagedFlux.byPage(100).collectList().block(); - - for (FeedResponse page: returnedPages) { - if (page.getResults() != null && page.getResults().size() > 0) { - return new CosmosResponseWrapper(page); - } - } + private CosmosResponseWrapper queryReturnsTotalRecordCountCore( + String query, + ItemOperationInvocationParameters params, + int requestedPageSize + ) { + return queryReturnsTotalRecordCountCore(query, params, requestedPageSize, false); + } + private CosmosResponseWrapper queryReturnsTotalRecordCountCore( + String query, + ItemOperationInvocationParameters params, + int requestedPageSize, + boolean enforceEmptyPages + ) { + CosmosQueryRequestOptions queryOptions = new CosmosQueryRequestOptions(); + + if (enforceEmptyPages) { + ImplementationBridgeHelpers + .CosmosQueryRequestOptionsHelper + .getCosmosQueryRequestOptionsAccessor() + .setAllowEmptyPages(queryOptions, true); + } + + CosmosEndToEndOperationLatencyPolicyConfig e2ePolicy = ImplementationBridgeHelpers + .CosmosItemRequestOptionsHelper + .getCosmosItemRequestOptionsAccessor() + .getEndToEndOperationLatencyPolicyConfig(params.options); + queryOptions.setCosmosEndToEndOperationLatencyPolicyConfig(e2ePolicy); + + CosmosPagedFlux queryPagedFlux = params.container.queryItems( + query, + queryOptions, + ObjectNode.class + ); + + List> returnedPages = + queryPagedFlux.byPage(requestedPageSize).collectList().block(); + + ArrayList foundCtxs = new ArrayList<>(); + + if (returnedPages.isEmpty()) { return new CosmosResponseWrapper( null, HttpConstants.StatusCodes.NOTFOUND, - NO_QUERY_PAGE_SUB_STATUS_CODE); + NO_QUERY_PAGE_SUB_STATUS_CODE, + null); + } + + long totalRecordCount = 0L; + for (FeedResponse page: returnedPages) { + if (page.getCosmosDiagnostics() != null) { + foundCtxs.add(page.getCosmosDiagnostics().getDiagnosticsContext()); + } else { + foundCtxs.add(null); + } + + if (page.getResults() != null && page.getResults().size() > 0) { + totalRecordCount += page.getResults().size(); + } + } + + return new CosmosResponseWrapper( + foundCtxs.toArray(new CosmosDiagnosticsContext[0]), + HttpConstants.StatusCodes.OK, + HttpConstants.SubStatusCodes.UNKNOWN, + totalRecordCount); + } + + @DataProvider(name = "testConfigs_queryAfterCreation") + public Object[][] testConfigs_queryAfterCreation() { + + final int ENOUGH_DOCS_SAME_PK_TO_EXCEED_PAGE_SIZE = 10; + final int NO_OTHER_DOCS_WITH_SAME_PK = 0; + final int NO_OTHER_DOCS_WITH_SAME_ID = 0; + final int ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION = PHYSICAL_PARTITION_COUNT * 10; + final int SINGLE_REGION = 1; + final int TWO_REGIONS = 2; + final int ONE_FOR_QUERY_PLAN = 1; + final String FIRST_REGION_NAME = writeableRegions.get(0).toLowerCase(Locale.ROOT); + final String SECOND_REGION_NAME = writeableRegions.get(1).toLowerCase(Locale.ROOT); + + BiConsumer injectReadSessionNotAvailableIntoFirstRegionOnlyForSinglePartition = + (c, operationType) -> injectReadSessionNotAvailableError(c, this.getFirstRegion(), operationType, c.getFeedRanges().block().get(0)); + + BiFunction queryReturnsTotalRecordCountWithDefaultPageSize = (query, params) -> + queryReturnsTotalRecordCountCore(query, params, 100); + + BiFunction queryReturnsTotalRecordCountWithPageSizeOne = (query, params) -> + queryReturnsTotalRecordCountCore(query, params, 1); + + BiFunction queryReturnsTotalRecordCountWithPageSizeOneAndEmptyPagesEnabled = (query, params) -> + queryReturnsTotalRecordCountCore(query, params, 1, true); + + BiConsumer validateExpectedRecordCount = (response, expectedRecordCount) -> { + if (expectedRecordCount != null) { + assertThat(response).isNotNull(); + assertThat(response.getTotalRecordCount()).isNotNull(); + assertThat(response.getTotalRecordCount()).isEqualTo(expectedRecordCount); + } }; + Consumer validateEmptyResults = + (response) -> validateExpectedRecordCount.accept(response, 0L); + + Consumer validateExactlyOneRecordReturned = + (response) -> validateExpectedRecordCount.accept(response, 1L); + + Consumer validateAllRecordsSameIdReturned = + (response) -> validateExpectedRecordCount.accept( + response, + 1L + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION); + + Consumer validateAllRecordsSamePartitionReturned = + (response) -> validateExpectedRecordCount.accept( + response, + 1L + ENOUGH_DOCS_SAME_PK_TO_EXCEED_PAGE_SIZE); + Function singlePartitionQueryGenerator = (params) -> - "SELECT * FROM c WHERE c.id = '" - + params.idAndPkValuePair.getLeft() - + "' AND c.mypk = '" + "SELECT * FROM c WHERE c.mypk = '" + params.idAndPkValuePair.getRight() + "'"; + Function singlePartitionWithAggregatesAndOrderByQueryGenerator = (params) -> + "SELECT DISTINCT c.id FROM c WHERE c.mypk = '" + + params.idAndPkValuePair.getRight() + + "' ORDER BY c.id"; + + Function singlePartitionEmptyResultQueryGenerator = (params) -> + "SELECT * FROM c WHERE c.mypk = '" + + params.idAndPkValuePair.getRight() + + "' and c.id = 'NotExistingId'"; + + Function crossPartitionQueryGenerator = (params) -> + "SELECT * FROM c WHERE CONTAINS (c.id, '" + + params.idAndPkValuePair.getLeft() + + "')"; + + Function crossPartitionWithAggregatesAndOrderByQueryGenerator = (params) -> + "SELECT DISTINCT c.id FROM c WHERE CONTAINS (c.id, '" + + params.idAndPkValuePair.getLeft() + + "')"; + + Function crossPartitionEmptyResultQueryGenerator = (params) -> + "SELECT * FROM c WHERE CONTAINS (c.id, 'NotExistingId')"; + + BiConsumer validateCtxRegions = + (ctx, expectedNumberOfRegionsContacted) -> { + assertThat(ctx).isNotNull(); + if (ctx != null) { + assertThat(ctx.getContactedRegionNames().size()).isEqualTo(expectedNumberOfRegionsContacted); + } + }; + + Consumer validateCtxQueryPlan = + (ctx) -> { + assertThat(ctx).isNotNull(); + if (ctx != null) { + assertThat(ctx.getDiagnostics()).isNotNull(); + // Query Plan + at least one query response + + assertThat(ctx.getDiagnostics().size()).isGreaterThanOrEqualTo(1); + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isGreaterThanOrEqualTo(1); + assertThat(diagnostics[0]).isNotNull(); + assertThat(diagnostics[0].getFeedResponseDiagnostics()).isNull(); + assertThat(diagnostics[0].getClientSideRequestStatistics()).isNotNull(); + assertThat(diagnostics[0].getClientSideRequestStatistics().size()).isEqualTo(1); + ClientSideRequestStatistics[] clientStats = + diagnostics[0].getClientSideRequestStatistics().toArray(new ClientSideRequestStatistics[0]); + assertThat(clientStats.length).isEqualTo(1); + assertThat(clientStats[0]).isNotNull(); + assertThat(clientStats[0].getGatewayStatisticsList()).isNotNull(); + ClientSideRequestStatistics.GatewayStatistics[] gwStats = + clientStats[0].getGatewayStatisticsList().toArray(new ClientSideRequestStatistics.GatewayStatistics[0]); + assertThat(gwStats.length).isGreaterThanOrEqualTo(1); + assertThat(gwStats[0]).isNotNull(); + assertThat(gwStats[0].getOperationType()).isEqualTo(OperationType.QueryPlan); + } + }; + + Consumer validateCtxOnlyFeedResponsesExceptQueryPlan = + (ctx) -> { + assertThat(ctx).isNotNull(); + if (ctx != null) { + assertThat(ctx.getDiagnostics()).isNotNull(); + // Query Plan + at least one query response + + assertThat(ctx.getDiagnostics().size()).isGreaterThanOrEqualTo(1); + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isGreaterThanOrEqualTo(1); + + // Validate that at most one FeedResponse has query plan diagnostics + CosmosDiagnostics[] feedResponseDiagnosticsWithQueryPlan = Arrays.stream(diagnostics) + .filter(d -> d.getFeedResponseDiagnostics() != null + && d.getFeedResponseDiagnostics().getQueryPlanDiagnosticsContext() != null) + .toArray(count -> new CosmosDiagnostics[count]); + + assertThat(feedResponseDiagnosticsWithQueryPlan.length).isLessThanOrEqualTo(1); + + int start = 0; + if (diagnostics[0].getFeedResponseDiagnostics() == null) { + // skip query plan + start = 1; + } + + assertThat(diagnostics.length).isGreaterThanOrEqualTo(start + 1); + + for (int i = start; i < diagnostics.length; i++) { + CosmosDiagnostics currentDiagnostics = diagnostics[i]; + assertThat(currentDiagnostics.getFeedResponseDiagnostics()).isNotNull(); + assertThat(currentDiagnostics.getFeedResponseDiagnostics().getQueryMetricsMap()).isNotNull(); + assertThat(currentDiagnostics.getFeedResponseDiagnostics().getClientSideRequestStatistics()).isNotNull(); + assertThat(currentDiagnostics.getFeedResponseDiagnostics().getClientSideRequestStatistics().size()).isGreaterThanOrEqualTo(1); + } + } + }; + + Consumer validateCtxSingleRegion = + (ctx) -> validateCtxRegions.accept(ctx, SINGLE_REGION); + + Consumer validateCtxTwoRegions = + (ctx) -> validateCtxRegions.accept(ctx, TWO_REGIONS); + + Consumer validateCtxFirstRegionFailureSecondRegionSuccessfulSingleFeedResponse = (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isEqualTo(3); + CosmosDiagnostics firstRegionDiagnostics = diagnostics[1]; + assertThat(firstRegionDiagnostics.getFeedResponseDiagnostics()).isNull(); + assertThat(firstRegionDiagnostics.getContactedRegionNames()).isNotNull(); + assertThat(firstRegionDiagnostics.getContactedRegionNames().size()).isEqualTo(1); + assertThat(firstRegionDiagnostics.getContactedRegionNames().iterator().next()) + .isEqualTo(this.writeableRegions.get(0).toLowerCase(Locale.ROOT)); + + CosmosDiagnostics secondRegionDiagnostics = diagnostics[2]; + assertThat(secondRegionDiagnostics.getFeedResponseDiagnostics()).isNotNull(); + assertThat(secondRegionDiagnostics.getContactedRegionNames()).isNotNull(); + assertThat(secondRegionDiagnostics.getContactedRegionNames().size()).isEqualTo(1); + assertThat(secondRegionDiagnostics.getContactedRegionNames().iterator().next()) + .isEqualTo(this.writeableRegions.get(1).toLowerCase(Locale.ROOT)); + assertThat(secondRegionDiagnostics.getFeedResponseDiagnostics().getQueryPlanDiagnosticsContext()).isNotNull(); + assertThat(secondRegionDiagnostics.getFeedResponseDiagnostics().getClientSideRequestStatistics()).isNotNull(); + assertThat(secondRegionDiagnostics.getFeedResponseDiagnostics().getClientSideRequestStatistics().size()).isEqualTo(1); + }; + + BiConsumer injectQueryPlanTransitTimeout = + (c, operationType) -> injectGatewayTransitTimeout( + c, this.getFirstRegion(), FaultInjectionOperationType.METADATA_REQUEST_QUERY_PLAN); + return new Object[][] { // CONFIG description // new Object[] { @@ -1584,18 +1795,657 @@ public Object[][] testConfigs_queryAfterCreation() { // BiFunction queryExecution // Failure injection callback // Status code/sub status code validation callback - // Diagnostics context validation callback + // Expected number of DiagnosticsContext instances - there will be one per page returned form the PagedFlux + // Diagnostics context validation callback applied to the first DiagnosticsContext instance + // Diagnostics context validation callback applied to the all other DiagnosticsContext instances + // Consumer - callback to validate the response (status codes, total records returned etc.) + // numberOfOtherDocumentsWithSameId - number of other documents to be created with the same id-value + // (but different pk-value). Mostly used to ensure cross-partition queries have to + // touch more than one partition. + // numberOfOtherDocumentsWithSamePk - number of documents to be created with the same pk-value + // (but different id-value). Mostly used to force a certain number of documents being + // returned for single partition queries. // }, + + // Plain vanilla single partition query. No failure injection and all records will fit into a single page new Object[] { - "FirstNonEmptyPage_AllGood_NoAvailabilityStrategy", + "DefaultPageSize_SinglePartition_AllGood_NoAvailabilityStrategy", Duration.ofSeconds(1), noAvailabilityStrategy, noRegionSwitchHint, singlePartitionQueryGenerator, - queryReturnsFirstNonEmptyPage, + queryReturnsTotalRecordCountWithDefaultPageSize, noFailureInjection, validateStatusCodeIs200Ok, - validateDiagnosticsContextHasDiagnosticsForOnlyFirstRegion + 1, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + null, + validateExactlyOneRecordReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple cross partition query. No failure injection and all records returned for a partition will fit + // into a single page. But there will be one page per partition + new Object[] { + "DefaultPageSize_CrossPartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + crossPartitionQueryGenerator, + queryReturnsTotalRecordCountWithDefaultPageSize, + noFailureInjection, + validateStatusCodeIs200Ok, + PHYSICAL_PARTITION_COUNT, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + validateAllRecordsSameIdReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple single partition query. No failure injection but page size set to 1 - so, multiple pages will + // be returned from the PagedFlux - for each document one page - and the expectation is that there + // will be as many CosmosDiagnosticsContext instances as pages. + new Object[] { + "PageSizeOne_SinglePartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + singlePartitionQueryGenerator, + queryReturnsTotalRecordCountWithPageSizeOne, + noFailureInjection, + validateStatusCodeIs200Ok, + 1 + ENOUGH_DOCS_SAME_PK_TO_EXCEED_PAGE_SIZE, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + validateAllRecordsSamePartitionReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + ENOUGH_DOCS_SAME_PK_TO_EXCEED_PAGE_SIZE + }, + + // Simple cross partition query. No failure injection but page size set to 1 - so, multiple pages will + // be returned from the PagedFlux per physical partition - for each document one page - and the + // expectation is that there will be as many CosmosDiagnosticsContext instances as pages. + new Object[] { + "PageSizeOne_CrossPartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + crossPartitionQueryGenerator, + queryReturnsTotalRecordCountWithPageSizeOne, + noFailureInjection, + validateStatusCodeIs200Ok, + 1 + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + validateAllRecordsSameIdReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple single partition query intended to not return any results. No failure injection and only + // one empty page expected - with exactly one CosmosDiagnostics instance + new Object[] { + "EmptyResults_SinglePartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + singlePartitionEmptyResultQueryGenerator, + queryReturnsTotalRecordCountWithPageSizeOne, + noFailureInjection, + validateStatusCodeIs200Ok, + 1, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan + ), + null, + validateEmptyResults, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple cross partition query intended to not return any results. No failures injected. + // Empty pages should be skipped (except for the last one) - so, exactly one empty page expected - + // with exactly one CosmosDiagnostics instance - even when this is a cross-partition query touching all + // partitions + new Object[] { + "EmptyResults_CrossPartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + crossPartitionEmptyResultQueryGenerator, + queryReturnsTotalRecordCountWithPageSizeOne, + noFailureInjection, + validateStatusCodeIs200Ok, + // empty pages are skipped except for the last one + 1, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics[1].getClientSideRequestStatistics().size()) + .isEqualTo(PHYSICAL_PARTITION_COUNT); + assertThat(diagnostics[1].getFeedResponseDiagnostics().getQueryMetricsMap().size()) + .isEqualTo(PHYSICAL_PARTITION_COUNT); + } + ), + null, + validateEmptyResults, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple cross partition query intended to not return any results. No failures injected. + // Empty pages should be returned - so, exactly one page per partition expected - + // with exactly one CosmosDiagnostics instance (plus query plan on very first one) + new Object[] { + "EmptyResults_EnableEmptyPageRetrieval_CrossPartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + crossPartitionEmptyResultQueryGenerator, + queryReturnsTotalRecordCountWithPageSizeOneAndEmptyPagesEnabled, + noFailureInjection, + validateStatusCodeIs200Ok, + // empty pages are bubbled up + PHYSICAL_PARTITION_COUNT, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics[1].getClientSideRequestStatistics().size()) + .isEqualTo(1); + assertThat(diagnostics[1].getFeedResponseDiagnostics().getQueryMetricsMap().size()) + .isEqualTo(1); + } + ), + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics[0].getClientSideRequestStatistics().size()) + .isEqualTo(1); + assertThat(diagnostics[0].getFeedResponseDiagnostics().getQueryMetricsMap().size()) + .isEqualTo(1); + } + ), + validateEmptyResults, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple cross partition query intended to not return any results except on one partition. + // No failures injected. Empty pages of all but one partition will be skipped, but + // query metrics and client side request statistics are captured in the merged diagnostics. + new Object[] { + "AllButOnePartitionEmptyResults_CrossPartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + crossPartitionQueryGenerator, + queryReturnsTotalRecordCountWithDefaultPageSize, + noFailureInjection, + validateStatusCodeIs200Ok, + 1, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics[1].getClientSideRequestStatistics().size()) + .isEqualTo(PHYSICAL_PARTITION_COUNT); + assertThat(diagnostics[1].getFeedResponseDiagnostics().getQueryMetricsMap().size()) + .isEqualTo(PHYSICAL_PARTITION_COUNT); + } + ), + null, + validateExactlyOneRecordReturned, + NO_OTHER_DOCS_WITH_SAME_ID, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Single partition query with DISTINCT and ORDER BY. No failures injected + // Expect to get as many pages and diagnostics contexts as there are documents for this PK-value + new Object[] { + "AggregatesAndOrderBy_PageSizeOne_SinglePartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + singlePartitionWithAggregatesAndOrderByQueryGenerator, + queryReturnsTotalRecordCountWithPageSizeOne, + noFailureInjection, + validateStatusCodeIs200Ok, + 1 + ENOUGH_DOCS_SAME_PK_TO_EXCEED_PAGE_SIZE, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + validateAllRecordsSamePartitionReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + ENOUGH_DOCS_SAME_PK_TO_EXCEED_PAGE_SIZE + }, + + // Single partition query with DISTINCT and ORDER BY. No failures injected + // Only a single document matches the where condition - but this is a cross partition query. Because + // the single page returned in the CosmosPagedFlux had to peek into all physical partitions to be + // able to achieve global ordering in the query pipeline a single CosmosDiagnosticsContext instance + // is returned - but with query metrics and client request statistics for all partitions + new Object[] { + "AggregatesAndOrderBy_PageSizeOne_CrossPartitionSingleRecord_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + crossPartitionWithAggregatesAndOrderByQueryGenerator, + queryReturnsTotalRecordCountWithPageSizeOne, + noFailureInjection, + validateStatusCodeIs200Ok, + 1, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics[1].getClientSideRequestStatistics().size()) + .isEqualTo(PHYSICAL_PARTITION_COUNT); + assertThat(diagnostics[1].getFeedResponseDiagnostics().getQueryMetricsMap().size()) + .isEqualTo(PHYSICAL_PARTITION_COUNT); + } + ), + null, + validateExactlyOneRecordReturned, + NO_OTHER_DOCS_WITH_SAME_PK, + NO_OTHER_DOCS_WITH_SAME_ID + }, + + // Cross partition query with DISTINCT and ORDER BY. Documents from all partitions meet the where + // condition but the distinct id value is identical - so, to the application only a single record is + // returned. Because the page size is 1 we expect as many pages / CosmosDiagnosticsContext instances + // as there are documents with the same id-value. + new Object[] { + "AggregatesAndOrderBy_PageSizeOne_CrossPartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + crossPartitionWithAggregatesAndOrderByQueryGenerator, + queryReturnsTotalRecordCountWithPageSizeOne, + noFailureInjection, + validateStatusCodeIs200Ok, + 1 + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxOnlyFeedResponsesExceptQueryPlan + ), + validateExactlyOneRecordReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Cross partition query with DISTINCT and ORDER BY. Documents from all partitions meet the where + // condition but the distinct id value is identical - so, to the application only a single record is + // returned. Because the page size is 1 we expect as many pages / CosmosDiagnosticsContext instances + // as there are documents with the same id-value. + new Object[] { + "AggregatesAndOrderBy_DefaultPageSize_CrossPartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + crossPartitionWithAggregatesAndOrderByQueryGenerator, + queryReturnsTotalRecordCountWithDefaultPageSize, + noFailureInjection, + validateStatusCodeIs200Ok, + PHYSICAL_PARTITION_COUNT, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics[1].getClientSideRequestStatistics().size()) + .isEqualTo(1); + assertThat(diagnostics[1].getFeedResponseDiagnostics().getQueryMetricsMap().size()) + .isEqualTo(1); + } + ), + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics[0].getClientSideRequestStatistics().size()) + .isEqualTo(1); + assertThat(diagnostics[0].getFeedResponseDiagnostics().getQueryMetricsMap().size()) + .isEqualTo(1); + } + ), + validateExactlyOneRecordReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Cross partition query with DISTINCT and ORDER BY. Single document meets the where + // condition, but queries against all partitions need to be executed. Expect to see a single + // page and CosmosDiagnosticsContext - but including three request statistics and query metrics. + new Object[] { + "AggregatesAndOrderBy_DefaultPageSize_SingleRecordCrossPartition_AllGood_NoAvailabilityStrategy", + Duration.ofSeconds(1), + noAvailabilityStrategy, + noRegionSwitchHint, + crossPartitionWithAggregatesAndOrderByQueryGenerator, + queryReturnsTotalRecordCountWithDefaultPageSize, + noFailureInjection, + validateStatusCodeIs200Ok, + 1, + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics[1].getClientSideRequestStatistics().size()) + .isEqualTo(PHYSICAL_PARTITION_COUNT); + assertThat(diagnostics[1].getFeedResponseDiagnostics().getQueryMetricsMap().size()) + .isEqualTo(PHYSICAL_PARTITION_COUNT); + } + ), + null, + validateExactlyOneRecordReturned, + NO_OTHER_DOCS_WITH_SAME_ID, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple single partition query - 404/1002 injected into all partition of the first region + // RegionSwitchHint is local - with eager availability strategy - so, the expectation is that the + // hedging will provide a successful response. There should only be a single CosmosDiagnosticsContext + // (and page) - but it should have three CosmosDiagnostics instances - first for query plan, second for + // the attempt in the first region and third one for hedging returning successful response. + new Object[] { + "DefaultPageSize_SinglePartition_404-1002_OnlyFirstRegion_LocalPreferred_EagerAvailabilityStrategy", + Duration.ofSeconds(10), + eagerThresholdAvailabilityStrategy, + CosmosRegionSwitchHint.LOCAL_REGION_PREFERRED, + singlePartitionQueryGenerator, + queryReturnsTotalRecordCountWithDefaultPageSize, + injectReadSessionNotAvailableIntoFirstRegionOnly, + validateStatusCodeIs200Ok, + 1, + ArrayUtils.toArray( + validateCtxTwoRegions, + validateCtxFirstRegionFailureSecondRegionSuccessfulSingleFeedResponse, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isEqualTo(3); + + // Ensure first FeedResponse CosmoDiagnostics has at least requests to first region + // (possibly also fail-over to secondary region) + assertThat(diagnostics[1].getContactedRegionNames().size()).isGreaterThanOrEqualTo(1); + assertThat(diagnostics[1].getContactedRegionNames().contains(FIRST_REGION_NAME)) + .isEqualTo(true); + + // Ensure second FeedResponse CosmoDiagnostics has only requests to second region + assertThat(diagnostics[2].getContactedRegionNames().size()).isEqualTo(1); + assertThat(diagnostics[2].getContactedRegionNames().contains(SECOND_REGION_NAME)) + .isEqualTo(true); + } + ), + null, + validateExactlyOneRecordReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple cross partition query - 404/1002 injected into all partition of the first region + // RegionSwitchHint is remote - with reluctant availability strategy - so, the expectation is that the + // retry on the first region will provide a successful response and no hedging is happening. + // There should be one CosmosDiagnosticsContext (and page) per partition - each should only have + // a single CosmosDiagnostics instance contacting both regions. + new Object[] { + "DefaultPageSize_CrossPartition_404-1002_OnlyFirstRegion_AllPartitions_RemotePreferred_ReluctantAvailabilityStrategy", + Duration.ofSeconds(3), + reluctantThresholdAvailabilityStrategy, + CosmosRegionSwitchHint.REMOTE_REGION_PREFERRED, + crossPartitionQueryGenerator, + queryReturnsTotalRecordCountWithDefaultPageSize, + injectReadSessionNotAvailableIntoFirstRegionOnly, + validateStatusCodeIs200Ok, + PHYSICAL_PARTITION_COUNT, + ArrayUtils.toArray( + validateCtxTwoRegions, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isEqualTo(2); + + // Ensure fail-over happened + assertThat(diagnostics[1].getContactedRegionNames().size()).isEqualTo(2); + assertThat(diagnostics[1].getContactedRegionNames().contains(FIRST_REGION_NAME)) + .isEqualTo(true); + assertThat(diagnostics[1].getContactedRegionNames().contains(SECOND_REGION_NAME)) + .isEqualTo(true); + } + ), + ArrayUtils.toArray( + validateCtxTwoRegions, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isEqualTo(1); + + // Ensure fail-over happened + assertThat(diagnostics[0].getContactedRegionNames().size()).isEqualTo(2); + assertThat(diagnostics[0].getContactedRegionNames().contains(FIRST_REGION_NAME)) + .isEqualTo(true); + assertThat(diagnostics[0].getContactedRegionNames().contains(SECOND_REGION_NAME)) + .isEqualTo(true); + } + ), + validateAllRecordsSameIdReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple cross partition query - 404/1002 injected into only a single partition of the first region + // RegionSwitchHint is remote - with reluctant availability strategy - so, the expectation is that the + // retry on the first region will provide a successful response for the one partition and no hedging is + // happening. There should be one CosmosDiagnosticsContext (and page) per partition - each should only have + // a single CosmosDiagnostics instance contacting both regions. + new Object[] { + "DefaultPageSize_CrossPartition_404-1002_OnlyFirstRegion_SinglePartition_RemotePreferred_ReluctantAvailabilityStrategy", + Duration.ofSeconds(1), + reluctantThresholdAvailabilityStrategy, + CosmosRegionSwitchHint.REMOTE_REGION_PREFERRED, + crossPartitionQueryGenerator, + queryReturnsTotalRecordCountWithDefaultPageSize, + injectReadSessionNotAvailableIntoFirstRegionOnlyForSinglePartition, + validateStatusCodeIs200Ok, + PHYSICAL_PARTITION_COUNT, + ArrayUtils.toArray( + validateCtxTwoRegions, + validateCtxQueryPlan, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isEqualTo(2); + + // Ensure fail-over happened + assertThat(diagnostics[1].getContactedRegionNames().size()).isEqualTo(2); + assertThat(diagnostics[1].getContactedRegionNames().contains(FIRST_REGION_NAME)) + .isEqualTo(true); + assertThat(diagnostics[1].getContactedRegionNames().contains(SECOND_REGION_NAME)) + .isEqualTo(true); + } + ), + ArrayUtils.toArray( + validateCtxSingleRegion, + validateCtxOnlyFeedResponsesExceptQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isEqualTo(1); + + // Ensure no fail-over happened + assertThat(diagnostics[0].getContactedRegionNames().size()).isEqualTo(1); + assertThat(diagnostics[0].getContactedRegionNames().contains(FIRST_REGION_NAME)) + .isEqualTo(true); + } + ), + validateAllRecordsSameIdReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple single partition query - 404/1002 injected into all partition of the first region + // RegionSwitchHint is local - with eager availability strategy - so, the expectation is that the + // hedging will provide a successful response. There should only be a single CosmosDiagnosticsContext + // (and page) - but it should have three CosmosDiagnostics instances - first for query plan, second for + // the attempt in the first region and third one for hedging returning successful response. + new Object[] { + "DefaultPageSize_SinglePartition_503_AllRegions_EagerAvailabilityStrategy", + Duration.ofSeconds(10), + eagerThresholdAvailabilityStrategy, + CosmosRegionSwitchHint.LOCAL_REGION_PREFERRED, + singlePartitionQueryGenerator, + queryReturnsTotalRecordCountWithDefaultPageSize, + injectServiceUnavailableIntoAllRegions, + validateStatusCodeIsServiceUnavailable, + 1, + ArrayUtils.toArray( + validateCtxTwoRegions, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isEqualTo(3); + + // Ensure first FeedResponse reaches both regions since Clinet Retry + // policy should kick in and retry in remote region + assertThat(diagnostics[1].getContactedRegionNames().size()).isEqualTo(2); + assertThat(diagnostics[1].getContactedRegionNames().contains(FIRST_REGION_NAME)) + .isEqualTo(true); + assertThat(diagnostics[1].getContactedRegionNames().contains(SECOND_REGION_NAME)) + .isEqualTo(true); + + // Ensure second FeedResponse CosmoDiagnostics has only requests to second region + assertThat(diagnostics[2].getContactedRegionNames().size()).isEqualTo(1); + assertThat(diagnostics[2].getContactedRegionNames().contains(SECOND_REGION_NAME)) + .isEqualTo(true); + } + ), + null, + null, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK + }, + + // Simple single partition query. Gateway timeout for query plan retrieval in first region injected. + // This test case validates that the availability strategy and hedging is also applied for the + // query plan request. The expectation is that the query plan request in the first region won't finish, + // the query plan will then be retrieved from the second region but the actual query is executed against the + // first region. + new Object[] { + "DefaultPageSize_SinglePartition_QueryPLanHighLatency_EagerAvailabilityStrategy", + Duration.ofSeconds(3), + reluctantThresholdAvailabilityStrategy, + noRegionSwitchHint, + singlePartitionQueryGenerator, + queryReturnsTotalRecordCountWithDefaultPageSize, + injectQueryPlanTransitTimeout, + validateStatusCodeIs200Ok, + 1, + ArrayUtils.toArray( + validateCtxTwoRegions, + validateCtxQueryPlan, + (ctx) -> { + CosmosDiagnostics[] diagnostics = ctx.getDiagnostics().toArray(new CosmosDiagnostics[0]); + assertThat(diagnostics.length).isGreaterThanOrEqualTo(3); + + // Ensure that the query plan has been retrieved from the second region + assertThat(diagnostics[0].getContactedRegionNames().size()).isEqualTo(1); + assertThat(diagnostics[0].getContactedRegionNames().iterator().next()).isEqualTo(FIRST_REGION_NAME); + assertThat(diagnostics[0].getClientSideRequestStatistics()).isNotNull(); + assertThat(diagnostics[0].getClientSideRequestStatistics().size()).isGreaterThanOrEqualTo(1); + ClientSideRequestStatistics requestStats = diagnostics[0].getClientSideRequestStatistics().iterator().next(); + assertThat(requestStats.getGatewayStatisticsList()).isNotNull(); + assertThat(requestStats.getGatewayStatisticsList().size()).isGreaterThanOrEqualTo(1); + assertThat(requestStats.getGatewayStatisticsList().iterator().next().getOperationType()).isEqualTo(OperationType.QueryPlan); + assertThat(requestStats.getGatewayStatisticsList().iterator().next().getStatusCode()).isEqualTo(408); + + // Ensure that the query plan has been retrieved from the second region + assertThat(diagnostics[1].getContactedRegionNames().size()).isEqualTo(1); + assertThat(diagnostics[1].getContactedRegionNames().iterator().next()).isEqualTo(SECOND_REGION_NAME); + assertThat(diagnostics[1].getClientSideRequestStatistics()).isNotNull(); + assertThat(diagnostics[1].getClientSideRequestStatistics().size()).isGreaterThanOrEqualTo(1); + requestStats = diagnostics[1].getClientSideRequestStatistics().iterator().next(); + assertThat(requestStats.getGatewayStatisticsList()).isNotNull(); + assertThat(requestStats.getGatewayStatisticsList().size()).isGreaterThanOrEqualTo(1); + assertThat(requestStats.getGatewayStatisticsList().iterator().next().getOperationType()).isEqualTo(OperationType.QueryPlan); + assertThat(requestStats.getGatewayStatisticsList().iterator().next().getStatusCode()).isEqualTo(200); + + + // There possibly is an incomplete diagnostics for the failed query plan retrieval in the first region + // Last Diagnostics should be for processed request against the first region with the + // query plan retrieved from the second region + boolean found = false; + for (int i = 2; i < diagnostics.length; i++) { + if (diagnostics[i].getFeedResponseDiagnostics() != null && + diagnostics[i].getFeedResponseDiagnostics().getQueryMetricsMap() != null) { + + found = true; + assertThat(diagnostics[i].getFeedResponseDiagnostics().getClientSideRequestStatistics()).isNotNull(); + assertThat(diagnostics[i].getFeedResponseDiagnostics().getClientSideRequestStatistics().size()).isGreaterThanOrEqualTo(1); + assertThat(diagnostics[i].getContactedRegionNames().size()).isEqualTo(1); + assertThat(diagnostics[i].getContactedRegionNames().iterator().next()).isEqualTo(FIRST_REGION_NAME); + } + } + + assertThat(found).isEqualTo(true); + } + ), + null, + validateExactlyOneRecordReturned, + ENOUGH_DOCS_OTHER_PK_TO_HIT_EVERY_PARTITION, + NO_OTHER_DOCS_WITH_SAME_PK }, }; } @@ -1610,7 +2460,12 @@ public void queryAfterCreation( BiFunction queryExecution, BiConsumer faultInjectionCallback, BiConsumer validateStatusCode, - Consumer validateDiagnosticsContext) { + int expectedDiagnosticsContextCount, + Consumer[] firstDiagnosticsContextValidations, + Consumer[] otherDiagnosticsContextValidations, + Consumer responseValidator, + int numberOfOtherDocumentsWithSameId, + int numberOfOtherDocumentsWithSamePk) { execute( testCaseId, @@ -1622,7 +2477,12 @@ public void queryAfterCreation( (params) -> queryExecution.apply(queryGenerator.apply(params), params), faultInjectionCallback, validateStatusCode, - validateDiagnosticsContext); + expectedDiagnosticsContextCount, + firstDiagnosticsContextValidations, + otherDiagnosticsContextValidations, + responseValidator, + numberOfOtherDocumentsWithSameId, + numberOfOtherDocumentsWithSamePk); } private static ObjectNode createTestItemAsJson(String id, String pkValue) { @@ -1646,7 +2506,9 @@ private CosmosAsyncContainer createTestContainer(CosmosAsyncClient clientWithPre .createContainerIfNotExists( new CosmosContainerProperties( containerId, - new PartitionKeyDefinition().setPaths(Arrays.asList("/mypk")))) + new PartitionKeyDefinition().setPaths(Arrays.asList("/mypk"))), + // for PHYSICAL_PARTITION_COUNT partitions + ThroughputProperties.createManualThroughput(6_000 * PHYSICAL_PARTITION_COUNT)) .block(); return databaseWithSeveralWriteableRegions.getContainer(containerId); @@ -1657,7 +2519,28 @@ private static void inject( CosmosAsyncContainer containerWithSeveralWriteableRegions, List applicableRegions, FaultInjectionOperationType applicableOperationType, - FaultInjectionServerErrorResult toBeInjectedServerErrorResult) { + FaultInjectionServerErrorResult toBeInjectedServerErrorResult, + FeedRange applicableFeedRange) { + + inject( + ruleName, + containerWithSeveralWriteableRegions, + applicableRegions, + applicableOperationType, + toBeInjectedServerErrorResult, + applicableFeedRange, + FaultInjectionConnectionType.DIRECT + ); + } + + private static void inject( + String ruleName, + CosmosAsyncContainer containerWithSeveralWriteableRegions, + List applicableRegions, + FaultInjectionOperationType applicableOperationType, + FaultInjectionServerErrorResult toBeInjectedServerErrorResult, + FeedRange applicableFeedRange, + FaultInjectionConnectionType connectionType) { FaultInjectionRuleBuilder ruleBuilder = new FaultInjectionRuleBuilder(ruleName); @@ -1666,12 +2549,21 @@ private static void inject( // inject 404/1002s in all regions // configure in accordance with preferredRegions on the client for (String region : applicableRegions) { - FaultInjectionCondition faultInjectionConditionForReads = - new FaultInjectionConditionBuilder() - .operationType(applicableOperationType) - .connectionType(FaultInjectionConnectionType.DIRECT) - .region(region) - .build(); + FaultInjectionConditionBuilder conditionBuilder = new FaultInjectionConditionBuilder() + .operationType(applicableOperationType) + .connectionType(connectionType) + .region(region); + + if (applicableFeedRange != null) { + conditionBuilder = conditionBuilder.endpoints( + new FaultInjectionEndpointBuilder(applicableFeedRange) + .replicaCount(4) + .includePrimary(true) + .build() + ); + } + + FaultInjectionCondition faultInjectionConditionForReads = conditionBuilder.build(); // sustained fault injection FaultInjectionRule readSessionUnavailableRule = ruleBuilder @@ -1696,7 +2588,8 @@ private static void inject( private static void injectReadSessionNotAvailableError( CosmosAsyncContainer containerWithSeveralWriteableRegions, List applicableRegions, - FaultInjectionOperationType operationType) { + FaultInjectionOperationType operationType, + FeedRange applicableFeedRange) { String ruleName = "serverErrorRule-read-session-unavailable-" + UUID.randomUUID(); FaultInjectionServerErrorResult badSessionTokenServerErrorResult = FaultInjectionResultBuilders @@ -1708,7 +2601,8 @@ private static void injectReadSessionNotAvailableError( containerWithSeveralWriteableRegions, applicableRegions, operationType, - badSessionTokenServerErrorResult + badSessionTokenServerErrorResult, + applicableFeedRange ); } @@ -1728,7 +2622,30 @@ private static void injectTransitTimeout( containerWithSeveralWriteableRegions, applicableRegions, faultInjectionOperationType, - timeoutResult + timeoutResult, + null + ); + } + + private static void injectGatewayTransitTimeout( + CosmosAsyncContainer containerWithSeveralWriteableRegions, + List applicableRegions, + FaultInjectionOperationType faultInjectionOperationType) { + + String ruleName = "serverErrorRule-gatewayTransitTimeout-" + UUID.randomUUID(); + FaultInjectionServerErrorResult timeoutResult = FaultInjectionResultBuilders + .getResultBuilder(FaultInjectionServerErrorType.RESPONSE_DELAY) + .delay(Duration.ofSeconds(6)) + .build(); + + inject( + ruleName, + containerWithSeveralWriteableRegions, + applicableRegions, + faultInjectionOperationType, + timeoutResult, + null, + FaultInjectionConnectionType.GATEWAY ); } @@ -1748,7 +2665,8 @@ private static void injectServiceUnavailable( containerWithSeveralWriteableRegions, applicableRegions, faultInjectionOperationType, - serviceUnavailableResult + serviceUnavailableResult, + null ); } @@ -1767,7 +2685,8 @@ private static void injectInternalServerError( containerWithSeveralWriteableRegions, applicableRegions, faultInjectionOperationType, - serviceUnavailableResult + serviceUnavailableResult, + null ); } @@ -1781,7 +2700,12 @@ private void execute( Function actionAfterInitialCreation, BiConsumer faultInjectionCallback, BiConsumer validateStatusCode, - Consumer validateDiagnosticsContext) { + int expectedDiagnosticsContextCount, + Consumer[] firstDiagnosticsContextValidations, + Consumer[] otherDiagnosticsContextValidations, + Consumer validateResponse, + int numberOfOtherDocumentsWithSameId, + int numberOfOtherDocumentsWithSamePk) { logger.info("START {}", testCaseId); @@ -1796,6 +2720,18 @@ private void execute( .getContainer(this.testContainerId); testContainer.createItem(createdItem).block(); + + for (int i = 0; i < numberOfOtherDocumentsWithSameId; i++) { + String additionalPK = UUID.randomUUID().toString(); + testContainer.createItem(new CosmosDiagnosticsTest.TestItem(documentId, additionalPK)).block(); + } + + for (int i = 0; i < numberOfOtherDocumentsWithSamePk; i++) { + String sharedPK = documentId; + String additionalDocumentId = UUID.randomUUID().toString(); + testContainer.createItem(new CosmosDiagnosticsTest.TestItem(additionalDocumentId, sharedPK)).block(); + } + if (faultInjectionCallback != null) { faultInjectionCallback.accept(testContainer, faultInjectionOperationType); } @@ -1824,18 +2760,40 @@ private void execute( CosmosResponseWrapper response = actionAfterInitialCreation.apply(params); - CosmosDiagnosticsContext diagnosticsContext = response.getDiagnosticsContext(); + CosmosDiagnosticsContext[] diagnosticsContexts = response.getDiagnosticsContexts(); + assertThat(diagnosticsContexts).isNotNull(); + assertThat(diagnosticsContexts.length).isEqualTo(expectedDiagnosticsContextCount); logger.info( - "DIAGNOSTICS CONTEXT: {}", - diagnosticsContext != null ? diagnosticsContext.toJson(): "NULL"); + "DIAGNOSTICS CONTEXT COUNT: {}", + diagnosticsContexts.length); + for (CosmosDiagnosticsContext diagnosticsContext: diagnosticsContexts) { + logger.info( + "DIAGNOSTICS CONTEXT: {} {}", + diagnosticsContext != null ? diagnosticsContext.toString() : "n/a", + diagnosticsContext != null ? diagnosticsContext.toJson() : "NULL"); + } if (response == null) { fail("Response is null"); } else { validateStatusCode.accept(response.getStatusCode(), null); + if (validateResponse != null) { + validateResponse.accept(response); + } + } + + for (Consumer ctxValidation : firstDiagnosticsContextValidations) { + ctxValidation.accept(diagnosticsContexts[0]); + } + + for (int i = 1; i < diagnosticsContexts.length; i++) { + CosmosDiagnosticsContext currentCtx = diagnosticsContexts[i]; + + for (Consumer ctxValidation : otherDiagnosticsContextValidations) { + ctxValidation.accept(currentCtx); + } } - validateDiagnosticsContext.accept(diagnosticsContext); } catch (Exception e) { if (e instanceof CosmosException) { CosmosException cosmosException = Utils.as(e, CosmosException.class); @@ -1846,11 +2804,17 @@ private void execute( logger.info("EXCEPTION: ", e); logger.info( - "DIAGNOSTICS CONTEXT: {}", + "DIAGNOSTICS CONTEXT: {} {}", + diagnosticsContext != null ? diagnosticsContext.toString() : "n/a", diagnosticsContext != null ? diagnosticsContext.toJson(): "NULL"); validateStatusCode.accept(cosmosException.getStatusCode(), cosmosException.getSubStatusCode()); - validateDiagnosticsContext.accept(diagnosticsContext); + if (firstDiagnosticsContextValidations != null) { + assertThat(expectedDiagnosticsContextCount).isEqualTo(1); + for (Consumer ctxValidation : firstDiagnosticsContextValidations) { + ctxValidation.accept(diagnosticsContext); + } + } } else { fail("A CosmosException instance should have been thrown.", e); } @@ -1900,57 +2864,49 @@ private Map getRegionMap(DatabaseAccount databaseAccount, boolea } private static class CosmosResponseWrapper { - private final CosmosDiagnosticsContext diagnosticsContext; + private final CosmosDiagnosticsContext[] diagnosticsContexts; private final Integer statusCode; private final Integer subStatusCode; - public CosmosResponseWrapper(CosmosItemResponse itemResponse) { + private final Long totalRecordCount; + + public CosmosResponseWrapper(CosmosItemResponse itemResponse) { if (itemResponse.getDiagnostics() != null && itemResponse.getDiagnostics().getDiagnosticsContext() != null) { - this.diagnosticsContext = itemResponse.getDiagnostics().getDiagnosticsContext(); + this.diagnosticsContexts = ArrayUtils.toArray(itemResponse.getDiagnostics().getDiagnosticsContext()); } else { - this.diagnosticsContext = null; + this.diagnosticsContexts = null; } this.statusCode = itemResponse.getStatusCode(); this.subStatusCode = null; + this.totalRecordCount = itemResponse.getItem() != null ? 1L : 0L; } public CosmosResponseWrapper(CosmosException exception) { if (exception.getDiagnostics() != null && exception.getDiagnostics().getDiagnosticsContext() != null) { - this.diagnosticsContext = exception.getDiagnostics().getDiagnosticsContext(); + this.diagnosticsContexts = ArrayUtils.toArray(exception.getDiagnostics().getDiagnosticsContext()); } else { - this.diagnosticsContext = null; + this.diagnosticsContexts = null; } this.statusCode = exception.getStatusCode(); this.subStatusCode = exception.getSubStatusCode(); + this.totalRecordCount = null; } - public CosmosResponseWrapper(FeedResponse feedResponse) { - if (feedResponse.getCosmosDiagnostics() != null && - feedResponse.getCosmosDiagnostics().getDiagnosticsContext() != null) { - - this.diagnosticsContext = feedResponse.getCosmosDiagnostics().getDiagnosticsContext(); - } else { - this.diagnosticsContext = null; - } - - this.statusCode = 200; - this.subStatusCode = 0; - } - - public CosmosResponseWrapper(CosmosDiagnosticsContext ctx, int statusCode, Integer subStatusCode) { - this.diagnosticsContext = ctx; + public CosmosResponseWrapper(CosmosDiagnosticsContext[] ctxs, int statusCode, Integer subStatusCode, Long totalRecordCount) { + this.diagnosticsContexts = ctxs; this.statusCode = statusCode; this.subStatusCode = subStatusCode; + this.totalRecordCount = totalRecordCount; } - public CosmosDiagnosticsContext getDiagnosticsContext() { - return this.diagnosticsContext; + public CosmosDiagnosticsContext[] getDiagnosticsContexts() { + return this.diagnosticsContexts; } public Integer getStatusCode() { @@ -1961,6 +2917,9 @@ public Integer getSubStatusCode() { return this.subStatusCode; } + public Long getTotalRecordCount() { + return this.totalRecordCount; + } } private static class ItemOperationInvocationParameters { diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ProactiveConnectionManagementTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ProactiveConnectionManagementTest.java index ac3f7cf83575..35472220fcf9 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ProactiveConnectionManagementTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/ProactiveConnectionManagementTest.java @@ -39,12 +39,14 @@ import java.net.URI; import java.time.Duration; +import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; @@ -133,9 +135,13 @@ public void openConnectionsAndInitCachesWithInvalidCosmosClientConfig(List preferredRegions, int numProactiveConnectionRegions, int ignoredNoOfContainers, int ignoredMinConnectionPoolSize, Duration ignoredAggressiveConnectionEstablishmentDuration) { + public void openConnectionsAndInitCachesWithContainer(ProactiveConnectionManagementTestConfig proactiveConnectionManagementTestConfig) { CosmosAsyncClient asyncClient = null; + List preferredRegions = proactiveConnectionManagementTestConfig.preferredRegions; + int proactiveConnectionRegionCount = proactiveConnectionManagementTestConfig.proactiveConnectionRegionsCount; + + CosmosAsyncContainer cosmosAsyncContainer = null; try { asyncClient = new CosmosClientBuilder() @@ -150,16 +156,16 @@ public void openConnectionsAndInitCachesWithContainer(List preferredRegi List cosmosContainerIdentities = new ArrayList<>(); - String containerId = "id1"; + String containerId = "id1" + UUID.randomUUID(); cosmosAsyncDatabase.createContainerIfNotExists(containerId, "/mypk").block(); - CosmosAsyncContainer cosmosAsyncContainer = cosmosAsyncDatabase.getContainer(containerId); + cosmosAsyncContainer = cosmosAsyncDatabase.getContainer(containerId); cosmosContainerIdentities.add(new CosmosContainerIdentity(cosmosAsyncDatabase.getId(), containerId)); CosmosContainerProactiveInitConfig proactiveContainerInitConfig = new CosmosContainerProactiveInitConfigBuilder(cosmosContainerIdentities) - .setProactiveConnectionRegionsCount(numProactiveConnectionRegions) - .build(); + .setProactiveConnectionRegionsCount(proactiveConnectionRegionCount) + .build(); RntbdTransportClient rntbdTransportClient = (RntbdTransportClient) ReflectionUtils.getTransportClient(asyncClient); AsyncDocumentClient asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(asyncClient); @@ -172,7 +178,7 @@ public void openConnectionsAndInitCachesWithContainer(List preferredRegi ConcurrentHashMap collectionInfoByNameMap = getCollectionInfoByNameMap(rxDocumentClient); Set endpoints = ConcurrentHashMap.newKeySet(); - cosmosAsyncContainer.openConnectionsAndInitCaches(numProactiveConnectionRegions).block(); + cosmosAsyncContainer.openConnectionsAndInitCaches(proactiveConnectionRegionCount).block(); UnmodifiableList readEndpoints = globalEndpointManager.getReadEndpoints(); @@ -223,24 +229,36 @@ public void openConnectionsAndInitCachesWithContainer(List preferredRegi assertThat(provider.count()).isEqualTo(endpoints.size()); assertThat(collectionInfoByNameMap.size()).isEqualTo(cosmosContainerIdentities.size()); assertThat(routingMap.size()).isEqualTo(cosmosContainerIdentities.size()); - - cosmosAsyncContainer.delete().block(); } finally { + if (cosmosAsyncContainer != null) { + safeDeleteCollection(cosmosAsyncContainer); + } safeClose(asyncClient); } } @Test(groups = {"multi-master"}, dataProvider = "proactiveContainerInitConfigs") public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnectionPoolSize_ThroughSystemConfig( - List preferredRegions, int numProactiveConnectionRegions, int numContainers, int minConnectionPoolSizePerEndpoint, Duration ignoredAggressiveConnectionEstablishmentDuration) { + ProactiveConnectionManagementTestConfig proactiveConnectionManagementTestConfig) throws InterruptedException { + + CosmosAsyncClient asyncClientWithOpenConnections = null; + CosmosClient syncClientWithOpenConnections = null; - CosmosAsyncClient clientWithOpenConnections = null; List asyncContainers = new ArrayList<>(); + // test config parameters + List preferredRegions = proactiveConnectionManagementTestConfig.preferredRegions; + + int containerCount = proactiveConnectionManagementTestConfig.containerCount; + int minConnectionPoolSizePerEndpoint = proactiveConnectionManagementTestConfig.minConnectionPoolSizePerEndpoint; + int proactiveConnectionRegionsCount = proactiveConnectionManagementTestConfig.proactiveConnectionRegionsCount; + + boolean isSystemPropertySetBeforeDirectConnectionConfig = proactiveConnectionManagementTestConfig.isSystemPropertySetBeforeDirectConnectionConfig; + try { List cosmosContainerIdentities = new ArrayList<>(); - for (int i = 1; i <= numContainers; i++) { + for (int i = 1; i <= containerCount; i++) { String containerId = String.format("id%d", i); cosmosAsyncDatabase.createContainerIfNotExists(containerId, "/mypk").block(); asyncContainers.add(cosmosAsyncDatabase.getContainer(containerId)); @@ -249,22 +267,73 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect CosmosContainerProactiveInitConfig proactiveContainerInitConfig = new CosmosContainerProactiveInitConfigBuilder(cosmosContainerIdentities) - .setProactiveConnectionRegionsCount(numProactiveConnectionRegions) + .setProactiveConnectionRegionsCount(proactiveConnectionRegionsCount) .build(); - System.setProperty("COSMOS.MIN_CONNECTION_POOL_SIZE_PER_ENDPOINT", String.valueOf(minConnectionPoolSizePerEndpoint)); + // allow enough time for the container to be available for reads + Thread.sleep(5_000); + + if (isSystemPropertySetBeforeDirectConnectionConfig) { + System.setProperty("COSMOS.MIN_CONNECTION_POOL_SIZE_PER_ENDPOINT", String.valueOf(minConnectionPoolSizePerEndpoint)); + + if (proactiveConnectionManagementTestConfig.isSyncClient) { + syncClientWithOpenConnections = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .endpointDiscoveryEnabled(true) + .preferredRegions(preferredRegions) + .openConnectionsAndInitCaches(proactiveContainerInitConfig) + .directMode(DirectConnectionConfig.getDefaultConfig()) + .buildClient(); + } else { + asyncClientWithOpenConnections = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .endpointDiscoveryEnabled(true) + .preferredRegions(preferredRegions) + .openConnectionsAndInitCaches(proactiveContainerInitConfig) + .directMode(DirectConnectionConfig.getDefaultConfig()) + .buildAsyncClient(); + } + } else { + DirectConnectionConfig directConnectionConfig = DirectConnectionConfig.getDefaultConfig(); + + System.setProperty("COSMOS.MIN_CONNECTION_POOL_SIZE_PER_ENDPOINT", String.valueOf(minConnectionPoolSizePerEndpoint)); + + if (proactiveConnectionManagementTestConfig.isSyncClient) { + syncClientWithOpenConnections = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .endpointDiscoveryEnabled(true) + .preferredRegions(preferredRegions) + .openConnectionsAndInitCaches(proactiveContainerInitConfig) + .directMode(directConnectionConfig) + .buildClient(); + } else { + asyncClientWithOpenConnections = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .endpointDiscoveryEnabled(true) + .preferredRegions(preferredRegions) + .openConnectionsAndInitCaches(proactiveContainerInitConfig) + .directMode(directConnectionConfig) + .buildAsyncClient(); + } + } - clientWithOpenConnections = new CosmosClientBuilder() - .endpoint(TestConfigurations.HOST) - .key(TestConfigurations.MASTER_KEY) - .endpointDiscoveryEnabled(true) - .preferredRegions(preferredRegions) - .openConnectionsAndInitCaches(proactiveContainerInitConfig) - .directMode() - .buildAsyncClient(); + RntbdTransportClient rntbdTransportClient; + AsyncDocumentClient asyncDocumentClient; + + if (proactiveConnectionManagementTestConfig.isSyncClient) { + rntbdTransportClient = + (RntbdTransportClient) ReflectionUtils.getTransportClient(syncClientWithOpenConnections); + asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(syncClientWithOpenConnections.asyncClient()); + } else { + rntbdTransportClient = + (RntbdTransportClient) ReflectionUtils.getTransportClient(asyncClientWithOpenConnections); + asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(asyncClientWithOpenConnections); + } - RntbdTransportClient rntbdTransportClient = (RntbdTransportClient) ReflectionUtils.getTransportClient(clientWithOpenConnections); - AsyncDocumentClient asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(clientWithOpenConnections); RxDocumentClientImpl rxDocumentClient = (RxDocumentClientImpl) asyncDocumentClient; GlobalAddressResolver globalAddressResolver = ReflectionUtils.getGlobalAddressResolver(rxDocumentClient); GlobalEndpointManager globalEndpointManager = ReflectionUtils.getGlobalEndpointManager(rxDocumentClient); @@ -332,23 +401,33 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect for (CosmosAsyncContainer asyncContainer : asyncContainers) { asyncContainer.delete().block(); } - - safeClose(clientWithOpenConnections); + System.clearProperty("COSMOS.MIN_CONNECTION_POOL_SIZE_PER_ENDPOINT"); + safeClose(asyncClientWithOpenConnections); + safeCloseSyncClient(syncClientWithOpenConnections); } } @Test(groups = {"multi-master"}, dataProvider = "proactiveContainerInitConfigs") public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnectionPoolSize_ThroughProactiveContainerInitConfig( - List preferredRegions, int numProactiveConnectionRegions, int numContainers, int minConnectionPoolSizePerEndpoint, Duration ignoredAggressiveConnectionEstablishmentDuration) { + ProactiveConnectionManagementTestConfig proactiveConnectionManagementTestConfig) throws InterruptedException { + + CosmosAsyncClient asyncClientWithOpenConnections = null; + CosmosClient syncClientWithOpenConnections = null; - CosmosAsyncClient clientWithOpenConnections = null; List asyncContainers = new ArrayList<>(); + // test config parameters + List preferredRegions = proactiveConnectionManagementTestConfig.preferredRegions; + + int containerCount = proactiveConnectionManagementTestConfig.containerCount; + int minConnectionPoolSizePerEndpoint = proactiveConnectionManagementTestConfig.minConnectionPoolSizePerEndpoint; + int proactiveConnectionRegionsCount = proactiveConnectionManagementTestConfig.proactiveConnectionRegionsCount; + try { List cosmosContainerIdentities = new ArrayList<>(); - for (int i = 1; i <= numContainers; i++) { + for (int i = 1; i <= containerCount; i++) { String containerId = String.format("id%d", i); cosmosAsyncDatabase.createContainerIfNotExists(containerId, "/mypk").block(); asyncContainers.add(cosmosAsyncDatabase.getContainer(containerId)); @@ -357,7 +436,7 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect CosmosContainerProactiveInitConfigBuilder proactiveContainerInitConfigBuilder = new CosmosContainerProactiveInitConfigBuilder(cosmosContainerIdentities) - .setProactiveConnectionRegionsCount(numProactiveConnectionRegions); + .setProactiveConnectionRegionsCount(proactiveConnectionRegionsCount); for (int i = 0; i < cosmosContainerIdentities.size(); i++) { proactiveContainerInitConfigBuilder = proactiveContainerInitConfigBuilder @@ -367,7 +446,27 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect CosmosContainerProactiveInitConfig proactiveContainerInitConfig = proactiveContainerInitConfigBuilder .build(); - clientWithOpenConnections = new CosmosClientBuilder() + RntbdTransportClient rntbdTransportClient; + AsyncDocumentClient asyncDocumentClient; + + // allow enough time for the container to be available for reads + Thread.sleep(5_000); + + if (proactiveConnectionManagementTestConfig.isSyncClient) { + syncClientWithOpenConnections = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .endpointDiscoveryEnabled(true) + .preferredRegions(preferredRegions) + .openConnectionsAndInitCaches(proactiveContainerInitConfig) + .directMode() + .buildClient(); + + rntbdTransportClient = + (RntbdTransportClient) ReflectionUtils.getTransportClient(syncClientWithOpenConnections); + asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(syncClientWithOpenConnections.asyncClient()); + } else { + asyncClientWithOpenConnections = new CosmosClientBuilder() .endpoint(TestConfigurations.HOST) .key(TestConfigurations.MASTER_KEY) .endpointDiscoveryEnabled(true) @@ -376,8 +475,11 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect .directMode() .buildAsyncClient(); - RntbdTransportClient rntbdTransportClient = (RntbdTransportClient) ReflectionUtils.getTransportClient(clientWithOpenConnections); - AsyncDocumentClient asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(clientWithOpenConnections); + rntbdTransportClient = + (RntbdTransportClient) ReflectionUtils.getTransportClient(asyncClientWithOpenConnections); + asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(asyncClientWithOpenConnections); + } + RxDocumentClientImpl rxDocumentClient = (RxDocumentClientImpl) asyncDocumentClient; GlobalAddressResolver globalAddressResolver = ReflectionUtils.getGlobalAddressResolver(rxDocumentClient); GlobalEndpointManager globalEndpointManager = ReflectionUtils.getGlobalEndpointManager(rxDocumentClient); @@ -388,8 +490,8 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect Set endpoints = ConcurrentHashMap.newKeySet(); UnmodifiableList readEndpoints = globalEndpointManager.getReadEndpoints(); List proactiveConnectionEndpoints = readEndpoints.subList( - 0, - Math.min(readEndpoints.size(), proactiveContainerInitConfig.getProactiveConnectionRegionsCount())); + 0, + Math.min(readEndpoints.size(), proactiveContainerInitConfig.getProactiveConnectionRegionsCount())); Flux asyncContainerFlux = Flux.fromIterable(asyncContainers); Flux>> partitionKeyRangeFlux = @@ -448,22 +550,34 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect asyncContainer.delete().block(); } - safeClose(clientWithOpenConnections); + safeClose(asyncClientWithOpenConnections); + safeCloseSyncClient(syncClientWithOpenConnections); } } @Test(groups = {"multi-master"}, dataProvider = "proactiveContainerInitConfigs") public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnectionPoolSize_ThroughProactiveContainerInitConfig_WithTimeout( - List preferredRegions, int numProactiveConnectionRegions, int numContainers, int minConnectionPoolSizePerEndpoint, Duration aggressiveWarmupDuration) { + ProactiveConnectionManagementTestConfig proactiveConnectionManagementTestConfig) { + + CosmosAsyncClient asyncClientWithOpenConnections = null; + CosmosClient syncClientWithOpenConnections = null; - CosmosAsyncClient clientWithOpenConnections = null; List asyncContainers = new ArrayList<>(); + // test config parameters + List preferredRegions = proactiveConnectionManagementTestConfig.preferredRegions; + + int containerCount = proactiveConnectionManagementTestConfig.containerCount; + int minConnectionPoolSizePerEndpoint = proactiveConnectionManagementTestConfig.minConnectionPoolSizePerEndpoint; + int proactiveConnectionRegionsCount = proactiveConnectionManagementTestConfig.proactiveConnectionRegionsCount; + + Duration aggressiveWarmupDuration = proactiveConnectionManagementTestConfig.aggressiveWarmupDuration; + try { List cosmosContainerIdentities = new ArrayList<>(); - for (int i = 0; i < numContainers; i++) { + for (int i = 0; i < containerCount; i++) { String containerId = String.format("id%d", i); cosmosAsyncDatabase.createContainerIfNotExists(containerId, "/mypk").block(); asyncContainers.add(cosmosAsyncDatabase.getContainer(containerId)); @@ -471,10 +585,10 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect } CosmosContainerProactiveInitConfigBuilder proactiveContainerInitConfigBuilder = new - CosmosContainerProactiveInitConfigBuilder(cosmosContainerIdentities) - .setProactiveConnectionRegionsCount(numProactiveConnectionRegions); + CosmosContainerProactiveInitConfigBuilder(cosmosContainerIdentities) + .setProactiveConnectionRegionsCount(proactiveConnectionRegionsCount); - for (int i = 0; i < numContainers; i++) { + for (int i = 0; i < containerCount; i++) { proactiveContainerInitConfigBuilder = proactiveContainerInitConfigBuilder .setMinConnectionPoolSizePerEndpointForContainer(cosmosContainerIdentities.get(i), minConnectionPoolSizePerEndpoint); } @@ -483,7 +597,29 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect .setAggressiveWarmupDuration(aggressiveWarmupDuration) .build(); - clientWithOpenConnections = new CosmosClientBuilder() + RntbdTransportClient rntbdTransportClient; + AsyncDocumentClient asyncDocumentClient; + + // allow enough time for the container to be available for reads + Thread.sleep(5_000); + + Instant clientBuildStartTime = Instant.now(); + + if (proactiveConnectionManagementTestConfig.isSyncClient) { + syncClientWithOpenConnections = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .endpointDiscoveryEnabled(true) + .preferredRegions(preferredRegions) + .openConnectionsAndInitCaches(proactiveContainerInitConfig) + .directMode() + .buildClient(); + + rntbdTransportClient = + (RntbdTransportClient) ReflectionUtils.getTransportClient(syncClientWithOpenConnections); + asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(syncClientWithOpenConnections.asyncClient()); + } else { + asyncClientWithOpenConnections = new CosmosClientBuilder() .endpoint(TestConfigurations.HOST) .key(TestConfigurations.MASTER_KEY) .endpointDiscoveryEnabled(true) @@ -492,10 +628,26 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect .directMode() .buildAsyncClient(); - Thread.sleep(5); + rntbdTransportClient = + (RntbdTransportClient) ReflectionUtils.getTransportClient(asyncClientWithOpenConnections); + asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(asyncClientWithOpenConnections); + } + + Instant clientBuildEndTime = Instant.now(); + + Duration approxClientBuildTime = Duration.between(clientBuildStartTime, clientBuildEndTime); + + // delta b/w connection warm up and everything else part of building + // a client should ideally not be greater than 5s + Duration delta = Duration.ofSeconds(5); + + boolean clientBuildTimeIsApproximatelyAggressiveWarmUpDuration = approxClientBuildTime.minus(delta).compareTo(aggressiveWarmupDuration) < 0; + + // case where the aggressive warmup duration is set too a high value than is required to warmup containers + boolean clientBuildTimeIsLesserThanAggressiveWarmUpDuration = approxClientBuildTime.compareTo(aggressiveWarmupDuration) < 0; + + assertThat(clientBuildTimeIsApproximatelyAggressiveWarmUpDuration || clientBuildTimeIsLesserThanAggressiveWarmUpDuration).isTrue(); - RntbdTransportClient rntbdTransportClient = (RntbdTransportClient) ReflectionUtils.getTransportClient(clientWithOpenConnections); - AsyncDocumentClient asyncDocumentClient = ReflectionUtils.getAsyncDocumentClient(clientWithOpenConnections); RxDocumentClientImpl rxDocumentClient = (RxDocumentClientImpl) asyncDocumentClient; GlobalAddressResolver globalAddressResolver = ReflectionUtils.getGlobalAddressResolver(rxDocumentClient); GlobalEndpointManager globalEndpointManager = ReflectionUtils.getGlobalEndpointManager(rxDocumentClient); @@ -571,24 +723,72 @@ public void openConnectionsAndInitCachesWithCosmosClient_And_PerContainerConnect asyncContainer.delete().block(); } - safeClose(clientWithOpenConnections); + safeClose(asyncClientWithOpenConnections); + safeCloseSyncClient(syncClientWithOpenConnections); } } @DataProvider(name = "proactiveContainerInitConfigs") - private Object[][] proactiveContainerInitConfigs() { + private Object[] proactiveContainerInitConfigs() { Iterator locationIterator = this.databaseAccount.getReadableLocations().iterator(); - List preferredLocations = new ArrayList<>(); + List preferredRegions = new ArrayList<>(); while (locationIterator.hasNext()) { DatabaseAccountLocation accountLocation = locationIterator.next(); - preferredLocations.add(accountLocation.getName()); + preferredRegions.add(accountLocation.getName()); } - // configure list of preferredLocation, no of proactive connection regions, no of containers, min connection pool size per endpoint, connection warm up timeout - return new Object[][]{ - new Object[]{preferredLocations, 2, 3, 4, Duration.ofMillis(250)}, - new Object[]{preferredLocations, 2, 3, 5, Duration.ofMillis(1000)} + return new Object[] { + new ProactiveConnectionManagementTestConfig() + .withPreferredRegions(preferredRegions) + .withProactiveConnectionRegionsCount(2) + .withContainerCount(3) + .withMinConnectionPoolSizePerEndpoint(4) + .withAggressiveWarmupDuration(Duration.ofMillis(250)) + .withIsSystemPropertySetBeforeDirectConnectionConfig(true) + .withIsSyncClient(false), + new ProactiveConnectionManagementTestConfig() + .withPreferredRegions(preferredRegions) + .withProactiveConnectionRegionsCount(2) + .withContainerCount(3) + .withMinConnectionPoolSizePerEndpoint(5) + .withAggressiveWarmupDuration(Duration.ofMillis(1000)) + .withIsSystemPropertySetBeforeDirectConnectionConfig(false) + .withIsSyncClient(false), + // in this test config the aggressive warmup duration is set to an unreasonably high value + // the client build should not block until this aggressive warm up duration time + new ProactiveConnectionManagementTestConfig() + .withPreferredRegions(preferredRegions) + .withProactiveConnectionRegionsCount(2) + .withContainerCount(3) + .withMinConnectionPoolSizePerEndpoint(5) + .withAggressiveWarmupDuration(Duration.ofMinutes(1000)) + .withIsSystemPropertySetBeforeDirectConnectionConfig(false) + .withIsSyncClient(false), + new ProactiveConnectionManagementTestConfig() + .withPreferredRegions(preferredRegions) + .withProactiveConnectionRegionsCount(2) + .withContainerCount(3) + .withMinConnectionPoolSizePerEndpoint(4) + .withAggressiveWarmupDuration(Duration.ofMillis(250)) + .withIsSystemPropertySetBeforeDirectConnectionConfig(true) + .withIsSyncClient(true), + new ProactiveConnectionManagementTestConfig() + .withPreferredRegions(preferredRegions) + .withProactiveConnectionRegionsCount(2) + .withContainerCount(3) + .withMinConnectionPoolSizePerEndpoint(5) + .withAggressiveWarmupDuration(Duration.ofMillis(1000)) + .withIsSystemPropertySetBeforeDirectConnectionConfig(false) + .withIsSyncClient(true), + new ProactiveConnectionManagementTestConfig() + .withPreferredRegions(preferredRegions) + .withProactiveConnectionRegionsCount(2) + .withContainerCount(3) + .withMinConnectionPoolSizePerEndpoint(5) + .withAggressiveWarmupDuration(Duration.ofMinutes(1000)) + .withIsSystemPropertySetBeforeDirectConnectionConfig(false) + .withIsSyncClient(true) }; } @@ -663,4 +863,60 @@ private Mono>> buildPartitionKeyRangeR false, null)); } + + private class ProactiveConnectionManagementTestConfig { + private List preferredRegions; + private int proactiveConnectionRegionsCount; + private int minConnectionPoolSizePerEndpoint; + private int containerCount; + private Duration aggressiveWarmupDuration; + private boolean isSystemPropertySetBeforeDirectConnectionConfig; + private boolean isSyncClient; + + public ProactiveConnectionManagementTestConfig() { + this.preferredRegions = new ArrayList<>(); + this.proactiveConnectionRegionsCount = 0; + this.minConnectionPoolSizePerEndpoint = 0; + this.containerCount = 0; + this.aggressiveWarmupDuration = Duration.ofHours(24); + this.isSystemPropertySetBeforeDirectConnectionConfig = false; + this.isSyncClient = false; + } + + public ProactiveConnectionManagementTestConfig withPreferredRegions(List preferredRegions) { + this.preferredRegions = preferredRegions; + return this; + } + + public ProactiveConnectionManagementTestConfig withProactiveConnectionRegionsCount(int proactiveConnectionRegionsCount) { + this.proactiveConnectionRegionsCount = proactiveConnectionRegionsCount; + return this; + } + + public ProactiveConnectionManagementTestConfig withMinConnectionPoolSizePerEndpoint(int minConnectionPoolSizePerEndpoint) { + this.minConnectionPoolSizePerEndpoint = minConnectionPoolSizePerEndpoint; + return this; + } + + public ProactiveConnectionManagementTestConfig withContainerCount(int containerCount) { + this.containerCount = containerCount; + return this; + } + + public ProactiveConnectionManagementTestConfig withAggressiveWarmupDuration(Duration aggressiveWarmupDuration) { + this.aggressiveWarmupDuration = aggressiveWarmupDuration; + return this; + } + + public ProactiveConnectionManagementTestConfig withIsSystemPropertySetBeforeDirectConnectionConfig( + boolean isSystemPropertySetBeforeDirectConnectionConfig) { + this.isSystemPropertySetBeforeDirectConnectionConfig = isSystemPropertySetBeforeDirectConnectionConfig; + return this; + } + + public ProactiveConnectionManagementTestConfig withIsSyncClient(boolean isSyncClient) { + this.isSyncClient = isSyncClient; + return this; + } + } } diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/TracerUnderTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/TracerUnderTest.java index 6e44956a8ff9..d540a827cdba 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/TracerUnderTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/TracerUnderTest.java @@ -36,6 +36,8 @@ public class TracerUnderTest implements Tracer { private final ConcurrentLinkedDeque spanStack = new ConcurrentLinkedDeque<>(); private SpanRecord currentSpan = null; + + private final ConcurrentLinkedDeque collectedSiblingSpans = new ConcurrentLinkedDeque<>(); SpanKind kind = SpanKind.INTERNAL; private Context startCore( @@ -45,10 +47,17 @@ private Context startCore( SpanKind kind, Context context ) { - LOGGER.info("--> start {}", methodName); + LOGGER.info("--> start {} {}", this.currentSpan, methodName); SpanRecord parent = this.currentSpan; if (parent != null) { - this.spanStack.push(parent); + if (methodName.equals(parent.name)) { + LOGGER.info("Added new sibling span {}", parent.name); + this.collectedSiblingSpans.add(parent); + parent = null; + } else { + LOGGER.info("Added new parent span {}", parent.name); + this.spanStack.push(parent); + } this.currentSpan = null; } assertThat(this.currentSpan).isNull(); @@ -102,21 +111,29 @@ public synchronized void end(String statusMessage, Throwable error, Context cont this.currentSpan.setError(error); this.currentSpan.setStatusMessage(statusMessage); + String spanName = this.currentSpan.name; + + + + String currentSpanHash = this.currentSpan.toString(); SpanRecord parent = this.spanStack.poll(); if (parent == null) { if (this.currentSpan.getError() != null) { - LOGGER.info("Span-Error: {}", this.currentSpan.getError().getMessage(), this.currentSpan.getError()); + LOGGER.info("Span-Error: {} {}", this.currentSpan, this.currentSpan.getError().getMessage(), this.currentSpan.getError()); } if (this.currentSpan.getStatusMessage() != null) { - LOGGER.info("Span-StatusMessage: {}", this.currentSpan.getStatusMessage()); + LOGGER.info("Span-StatusMessage: {} {}", this.currentSpan, this.currentSpan.getStatusMessage()); } - LOGGER.info("Span-Json: {}", this.currentSpan.toJson()); + LOGGER.info("Span-Json: {} {}", this.currentSpan, this.currentSpan.toJson()); } else { + LOGGER.info("Setting currentSpan {} to parent {}", this.currentSpan, parent); this.currentSpan = parent; } + + LOGGER.info("<-- end {} {}", currentSpanHash, spanName); } @Override @@ -132,14 +149,31 @@ public synchronized void addEvent(String name, Map attributes, O } public synchronized void reset() { + LOGGER.info("RESET {}", this.currentSpan); this.spanStack.clear(); - this.currentSpan = null;; + this.currentSpan = null; + this.collectedSiblingSpans.clear(); } public SpanRecord getCurrentSpan() { return this.currentSpan; } + public Collection getEventsOfAllCollectedSiblingSpans() { + ArrayList events = new ArrayList<>(this.currentSpan.events); + LOGGER.info("getEventsOfAllCollectedSiblingSpans: {} {} - Siblings {}", this.currentSpan, this.currentSpan.events.size(), this.collectedSiblingSpans.size()); + for (SpanRecord siblingSpan : this.collectedSiblingSpans) { + if (siblingSpan.name.equals(this.currentSpan.name)) { + LOGGER.info(" Included {} {}: {}", siblingSpan, siblingSpan.name, siblingSpan.events.size()); + events.addAll(siblingSpan.events); + } else { + LOGGER.info(" Skipped {} {}: {}", siblingSpan, siblingSpan.name, siblingSpan.events.size()); + } + } + + return events; + } + public synchronized String toJson() { SpanRecord rootSpan = null; if (this.spanStack.isEmpty()) { @@ -296,7 +330,9 @@ public void addChild(SpanRecord child) { public String toString() { StringBuilder sb = new StringBuilder(); - sb.append(this.name) + sb.append(super.toString()) + .append(" - ") + .append(this.name) .append(" - ") .append(this.startTime) .append(" - ") diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/ConsistencyTests2.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/ConsistencyTests2.java index d132a027c508..c9c1d8ec48c7 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/ConsistencyTests2.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/ConsistencyTests2.java @@ -10,7 +10,6 @@ import com.azure.cosmos.GatewayConnectionConfig; import com.azure.cosmos.implementation.clienttelemetry.ClientTelemetry; import com.azure.cosmos.models.CosmosClientTelemetryConfig; -import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.FeedResponse; import com.azure.cosmos.models.PartitionKey; @@ -225,9 +224,17 @@ public void validateNoChargeOnFailedSessionRead() throws Exception { CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); cosmosQueryRequestOptions.setPartitionKey(new PartitionKey(PartitionKeyInternal.Empty.toJson())); cosmosQueryRequestOptions.setSessionToken(token); + + QueryFeedOperationState dummyState = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.ReadFeed, + cosmosQueryRequestOptions, + readSecondaryClient + ); + FailureValidator validator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.NOTFOUND).subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); Flux> feedObservable = readSecondaryClient.readDocuments( - parentResource.getSelfLink(), cosmosQueryRequestOptions, Document.class); + parentResource.getSelfLink(), dummyState, Document.class); validateQueryFailure(feedObservable, validator); } finally { safeClose(writeClient); @@ -283,11 +290,15 @@ public void validateSessionTokenAsync() { Mono task2 = ParallelAsync.forEachAsync(Range.between(0, 1000), 5, index -> { try { CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); - ModelBridgeInternal.setQueryRequestOptionsEmptyPagesAllowed(cosmosQueryRequestOptions, true); + ImplementationBridgeHelpers + .CosmosQueryRequestOptionsHelper + .getCosmosQueryRequestOptionsAccessor() + .setAllowEmptyPages(cosmosQueryRequestOptions, true); + FeedResponse queryResponse = client.queryDocuments( createdCollection.getSelfLink(), "SELECT * FROM c WHERE c.Id = 'foo'", - cosmosQueryRequestOptions, + TestUtils.createDummyQueryFeedOperationState(ResourceType.Document, OperationType.Query, cosmosQueryRequestOptions, client), Document.class) .blockFirst(); String lsnHeaderValue = queryResponse.getResponseHeaders().get(WFConstants.BackendHeaders.LSN); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/DocumentQuerySpyWireContentTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/DocumentQuerySpyWireContentTest.java index 1cba7dfbe967..e458abae5168 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/DocumentQuerySpyWireContentTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/DocumentQuerySpyWireContentTest.java @@ -96,7 +96,11 @@ public void queryWithContinuationTokenLimit(CosmosQueryRequestOptions options, S client.clearCapturedRequests(); Flux> queryObservable = client - .queryDocuments(collectionLink, query, options, Document.class); + .queryDocuments( + collectionLink, + query, + TestUtils.createDummyQueryFeedOperationState(ResourceType.Document, OperationType.Query, options, client), + Document.class); List results = queryObservable.flatMap(p -> Flux.fromIterable(p.getResults())) .collectList().block(); @@ -161,13 +165,19 @@ public void before_DocumentQuerySpyWireContentTest() throws Exception { TimeUnit.SECONDS.sleep(1); CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.Query, + options, + client + ); // do the query once to ensure the collection is cached. - client.queryDocuments(getMultiPartitionCollectionLink(), "select * from root", options, Document.class) + client.queryDocuments(getMultiPartitionCollectionLink(), "select * from root", state, Document.class) .then().block(); // do the query once to ensure the collection is cached. - client.queryDocuments(getSinglePartitionCollectionLink(), "select * from root", options, Document.class) + client.queryDocuments(getSinglePartitionCollectionLink(), "select * from root", state, Document.class) .then().block(); } diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/RequestHeadersSpyWireTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/RequestHeadersSpyWireTest.java index 86a27def759b..013e7157355a 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/RequestHeadersSpyWireTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/RequestHeadersSpyWireTest.java @@ -130,7 +130,11 @@ public void queryWithMaxIntegratedCacheStaleness(CosmosQueryRequestOptions optio client.clearCapturedRequests(); - client.queryDocuments(collectionLink, query, options, Document.class).blockLast(); + client.queryDocuments( + collectionLink, + query, + TestUtils.createDummyQueryFeedOperationState(ResourceType.Document, OperationType.Query, options, client), + Document.class).blockLast(); List requests = client.getCapturedRequests(); for (HttpRequest httpRequest : requests) { @@ -150,8 +154,15 @@ public void queryWithMaxIntegratedCacheStalenessInNanoseconds() { client.clearCapturedRequests(); + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.Query, + cosmosQueryRequestOptions, + client + ); + assertThatThrownBy(() -> client - .queryDocuments(collectionLink, query, cosmosQueryRequestOptions, Document.class) + .queryDocuments(collectionLink, query, state, Document.class) .blockLast()) .isInstanceOf(IllegalArgumentException.class) .hasMessage("MaxIntegratedCacheStaleness granularity is milliseconds"); @@ -167,10 +178,17 @@ public void queryWithMaxIntegratedCacheStalenessInNegative() { String collectionLink = getDocumentCollectionLink(); + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.Query, + cosmosQueryRequestOptions, + client + ); + client.clearCapturedRequests(); assertThatThrownBy(() -> client - .queryDocuments(collectionLink, query, cosmosQueryRequestOptions, Document.class) + .queryDocuments(collectionLink, query, state, Document.class) .blockLast()) .isInstanceOf(IllegalArgumentException.class) .hasMessage("MaxIntegratedCacheStaleness duration cannot be negative"); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/SessionTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/SessionTest.java index a545ed633194..5728141c079d 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/SessionTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/SessionTest.java @@ -42,7 +42,7 @@ public class SessionTest extends TestSuiteBase { private Database createdDatabase; private DocumentCollection createdCollection; - private String collectionId = "+ -_,:.|~" + UUID.randomUUID().toString() + " +-_,:.|~"; + private String collectionId = "+ -_,:.|~" + UUID.randomUUID() + " +-_,:.|~"; private SpyClientUnderTestFactory.SpyBaseClass spyClient; private AsyncDocumentClient houseKeepingClient; private ConnectionMode connectionMode; @@ -188,7 +188,15 @@ public void partitionedSessionToken(boolean isNameBased) throws NoSuchMethodExce String query = "select * from c"; CosmosQueryRequestOptions queryRequestOptions = new CosmosQueryRequestOptions(); queryRequestOptions.setPartitionKey(new PartitionKey(documentCreated.getId())); - spyClient.queryDocuments(getCollectionLink(isNameBased), query, queryRequestOptions, Document.class).blockFirst(); + + QueryFeedOperationState dummyState = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.Query, + queryRequestOptions, + spyClient + ); + + spyClient.queryDocuments(getCollectionLink(isNameBased), query, dummyState, Document.class).blockFirst(); assertThat(getSessionTokensInRequests()).hasSize(1); assertThat(getSessionTokensInRequests().get(0)).isNotEmpty(); assertThat(getSessionTokensInRequests().get(0)).doesNotContain(","); // making sure we have only one scope session token @@ -196,7 +204,13 @@ public void partitionedSessionToken(boolean isNameBased) throws NoSuchMethodExce // Session token validation for cross partition query spyClient.clearCapturedRequests(); queryRequestOptions = new CosmosQueryRequestOptions(); - spyClient.queryDocuments(getCollectionLink(isNameBased), query, queryRequestOptions, Document.class).blockFirst(); + dummyState = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.Query, + queryRequestOptions, + spyClient + ); + spyClient.queryDocuments(getCollectionLink(isNameBased), query, dummyState, Document.class).blockFirst(); assertThat(getSessionTokensInRequests().size()).isGreaterThanOrEqualTo(1); assertThat(getSessionTokensInRequests().get(0)).isNotEmpty(); assertThat(getSessionTokensInRequests().get(0)).doesNotContain(","); // making sure we have only one scope session token @@ -206,7 +220,13 @@ public void partitionedSessionToken(boolean isNameBased) throws NoSuchMethodExce List feedRanges = spyClient.getFeedRanges(getCollectionLink(isNameBased)).block(); queryRequestOptions = new CosmosQueryRequestOptions(); queryRequestOptions.setFeedRange(feedRanges.get(0)); - spyClient.queryDocuments(getCollectionLink(isNameBased), query, queryRequestOptions, Document.class).blockFirst(); + dummyState = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.Query, + queryRequestOptions, + spyClient + ); + spyClient.queryDocuments(getCollectionLink(isNameBased), query, dummyState, Document.class).blockFirst(); assertThat(getSessionTokensInRequests().size()).isGreaterThanOrEqualTo(1); assertThat(getSessionTokensInRequests().get(0)).isNotEmpty(); assertThat(getSessionTokensInRequests().get(0)).doesNotContain(","); // making sure we have only one scope session token @@ -214,10 +234,16 @@ public void partitionedSessionToken(boolean isNameBased) throws NoSuchMethodExce // Session token validation for readAll with partition query spyClient.clearCapturedRequests(); queryRequestOptions = new CosmosQueryRequestOptions(); + dummyState = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.ReadFeed, + queryRequestOptions, + spyClient + ); spyClient.readAllDocuments( getCollectionLink(isNameBased), new PartitionKey(documentCreated.getId()), - queryRequestOptions, + dummyState, Document.class).blockFirst(); assertThat(getSessionTokensInRequests().size()).isEqualTo(1); assertThat(getSessionTokensInRequests().get(0)).isNotEmpty(); @@ -226,7 +252,15 @@ public void partitionedSessionToken(boolean isNameBased) throws NoSuchMethodExce // Session token validation for readAll with cross partition spyClient.clearCapturedRequests(); queryRequestOptions = new CosmosQueryRequestOptions(); - spyClient.readDocuments(getCollectionLink(isNameBased), queryRequestOptions, Document.class).blockFirst(); + + dummyState = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.ReadFeed, + queryRequestOptions, + spyClient + ); + + spyClient.readDocuments(getCollectionLink(isNameBased), dummyState, Document.class).blockFirst(); assertThat(getSessionTokensInRequests().size()).isGreaterThanOrEqualTo(1); assertThat(getSessionTokensInRequests().get(0)).isNotEmpty(); assertThat(getSessionTokensInRequests().get(0)).doesNotContain(","); // making sure we have only one scope session token diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java index c5a78de4f31d..239031904edb 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestSuiteBase.java @@ -3,6 +3,8 @@ package com.azure.cosmos.implementation; import com.azure.cosmos.ConsistencyLevel; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.CosmosException; import com.azure.cosmos.DirectConnectionConfig; import com.azure.cosmos.DocumentClientTest; @@ -122,7 +124,12 @@ private DatabaseManagerImpl(AsyncDocumentClient client) { @Override public Flux> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.Query, + new CosmosQueryRequestOptions(), + client); + return client.queryDatabases(query, state); } @Override @@ -171,14 +178,29 @@ protected static void truncateCollection(DocumentCollection collection) { try { List paths = collection.getPartitionKey().getPaths(); + CosmosAsyncClient cosmosClient = new CosmosClientBuilder() + .key(TestConfigurations.MASTER_KEY) + .endpoint(TestConfigurations.HOST) + .buildAsyncClient(); CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); options.setMaxDegreeOfParallelism(-1); + QueryFeedOperationState state = new QueryFeedOperationState( + cosmosClient, + "truncateCollection", + collection.getSelfLink(), + collection.getId(), + ResourceType.Document, + OperationType.Query, + null, + options, + new CosmosPagedFluxOptions() + ); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 100); logger.info("Truncating DocumentCollection {} documents ...", collection.getId()); - houseKeepingClient.queryDocuments(collection.getSelfLink(), "SELECT * FROM root", options, Document.class) + houseKeepingClient.queryDocuments(collection.getSelfLink(), "SELECT * FROM root", state, Document.class) .publishOn(Schedulers.parallel()) .flatMap(page -> Flux.fromIterable(page.getResults())) .flatMap(doc -> { @@ -199,7 +221,18 @@ protected static void truncateCollection(DocumentCollection collection) { logger.info("Truncating DocumentCollection {} triggers ...", collection.getId()); - houseKeepingClient.queryTriggers(collection.getSelfLink(), "SELECT * FROM root", options) + state = new QueryFeedOperationState( + cosmosClient, + "truncateTriggers", + collection.getSelfLink(), + collection.getId(), + ResourceType.Document, + OperationType.Query, + null, + options, + new CosmosPagedFluxOptions() + ); + houseKeepingClient.queryTriggers(collection.getSelfLink(), "SELECT * FROM root", state) .publishOn(Schedulers.parallel()) .flatMap(page -> Flux.fromIterable(page.getResults())) .flatMap(trigger -> { @@ -215,7 +248,18 @@ protected static void truncateCollection(DocumentCollection collection) { logger.info("Truncating DocumentCollection {} storedProcedures ...", collection.getId()); - houseKeepingClient.queryStoredProcedures(collection.getSelfLink(), "SELECT * FROM root", options) + state = new QueryFeedOperationState( + cosmosClient, + "truncateStoredProcs", + collection.getSelfLink(), + collection.getId(), + ResourceType.Document, + OperationType.Query, + null, + options, + new CosmosPagedFluxOptions() + ); + houseKeepingClient.queryStoredProcedures(collection.getSelfLink(), "SELECT * FROM root", state) .publishOn(Schedulers.parallel()) .flatMap(page -> Flux.fromIterable(page.getResults())) .flatMap(storedProcedure -> { @@ -231,7 +275,18 @@ protected static void truncateCollection(DocumentCollection collection) { logger.info("Truncating DocumentCollection {} udfs ...", collection.getId()); - houseKeepingClient.queryUserDefinedFunctions(collection.getSelfLink(), "SELECT * FROM root", options) + state = new QueryFeedOperationState( + cosmosClient, + "truncateUserDefinedFunctions", + collection.getSelfLink(), + collection.getId(), + ResourceType.Document, + OperationType.Query, + null, + options, + new CosmosPagedFluxOptions() + ); + houseKeepingClient.queryUserDefinedFunctions(collection.getSelfLink(), "SELECT * FROM root", state) .publishOn(Schedulers.parallel()) .flatMap(page -> Flux.fromIterable(page.getResults())) .flatMap(udf -> { @@ -487,8 +542,14 @@ static protected DocumentCollection getCollectionDefinitionWithRangeRangeIndex() } public static void deleteCollectionIfExists(AsyncDocumentClient client, String databaseId, String collectionId) { + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.DocumentCollection, + OperationType.Query, + new CosmosQueryRequestOptions(), + client + ); List res = client.queryCollections("dbs/" + databaseId, - String.format("SELECT * FROM root r where r.id = '%s'", collectionId), null).single().block() + String.format("SELECT * FROM root r where r.id = '%s'", collectionId), state).single().block() .getResults(); if (!res.isEmpty()) { deleteCollection(client, TestUtils.getCollectionNameLink(databaseId, collectionId)); @@ -503,11 +564,17 @@ public static void deleteDocumentIfExists(AsyncDocumentClient client, String dat CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); PartitionKey pk = new PartitionKey(docId); options.setPartitionKey(pk); + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Document, + OperationType.Query, + new CosmosQueryRequestOptions(), + client + ); List res = client .queryDocuments( TestUtils.getCollectionNameLink(databaseId, collectionId), String.format("SELECT * FROM root r where r.id = '%s'", docId), - options, + state, Document.class) .single().block().getResults(); if (!res.isEmpty()) { @@ -535,8 +602,14 @@ public static void deleteDocument(AsyncDocumentClient client, String documentLin } public static void deleteUserIfExists(AsyncDocumentClient client, String databaseId, String userId) { + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.User, + OperationType.Query, + new CosmosQueryRequestOptions(), + client + ); List res = client - .queryUsers("dbs/" + databaseId, String.format("SELECT * FROM root r where r.id = '%s'", userId), null) + .queryUsers("dbs/" + databaseId, String.format("SELECT * FROM root r where r.id = '%s'", userId), state) .single().block().getResults(); if (!res.isEmpty()) { deleteUser(client, TestUtils.getUserNameLink(databaseId, userId)); @@ -568,7 +641,13 @@ static protected Database createDatabase(AsyncDocumentClient client, String data } static protected Database createDatabaseIfNotExists(AsyncDocumentClient client, String databaseId) { - return client.queryDatabases(String.format("SELECT * FROM r where r.id = '%s'", databaseId), null).flatMap(p -> Flux.fromIterable(p.getResults())).switchIfEmpty( + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Database, + OperationType.Query, + new CosmosQueryRequestOptions(), + client + ); + return client.queryDatabases(String.format("SELECT * FROM r where r.id = '%s'", databaseId), state).flatMap(p -> Flux.fromIterable(p.getResults())).switchIfEmpty( Flux.defer(() -> { Database databaseDefinition = new Database(); @@ -596,7 +675,13 @@ static protected void safeDeleteDatabase(AsyncDocumentClient client, String data static protected void safeDeleteAllCollections(AsyncDocumentClient client, Database database) { if (database != null) { - List collections = client.readCollections(database.getSelfLink(), null) + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.DocumentCollection, + OperationType.ReadFeed, + new CosmosQueryRequestOptions(), + client + ); + List collections = client.readCollections(database.getSelfLink(), state) .flatMap(p -> Flux.fromIterable(p.getResults())) .collectList() .single() diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestUtils.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestUtils.java index bca86aa49199..69d5d6d059f5 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestUtils.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/TestUtils.java @@ -2,10 +2,9 @@ // Licensed under the MIT License. package com.azure.cosmos.implementation; -import com.azure.cosmos.BridgeInternal; -import com.azure.cosmos.CosmosDiagnostics; -import com.azure.cosmos.implementation.directconnectivity.ReflectionUtils; -import com.azure.cosmos.implementation.directconnectivity.TimeoutHelper; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.models.CosmosQueryRequestOptions; import org.mockito.Mockito; import java.util.UUID; @@ -42,6 +41,28 @@ public static String getUserNameLink(String databaseId, String userId) { return DATABASES_PATH_SEGMENT + "/" + databaseId + "/" + USERS_PATH_SEGMENT + "/" + userId; } + public static QueryFeedOperationState createDummyQueryFeedOperationState( + ResourceType resourceType, + OperationType operationType, + CosmosQueryRequestOptions options, + AsyncDocumentClient client) { + CosmosAsyncClient cosmosClient = new CosmosClientBuilder() + .key(client.getMasterKeyOrResourceToken()) + .endpoint(client.getServiceEndpoint().toString()) + .buildAsyncClient(); + return new QueryFeedOperationState( + cosmosClient, + "SomeSpanName", + "SomeDBName", + "SomeContainerName", + resourceType, + operationType, + null, + options, + new CosmosPagedFluxOptions() + ); + } + public static DiagnosticsClientContext mockDiagnosticsClientContext() { DiagnosticsClientContext clientContext = Mockito.mock(DiagnosticsClientContext.class); Mockito.doReturn(new DiagnosticsClientContext.DiagnosticsClientConfig()).when(clientContext).getConfig(); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/directconnectivity/DCDocumentCrudTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/directconnectivity/DCDocumentCrudTest.java index 590f989e0026..aab22fd0c56b 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/directconnectivity/DCDocumentCrudTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/directconnectivity/DCDocumentCrudTest.java @@ -7,6 +7,7 @@ import com.azure.cosmos.DirectConnectionConfig; import com.azure.cosmos.implementation.AsyncDocumentClient.Builder; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; +import com.azure.cosmos.implementation.TestUtils; import com.azure.cosmos.implementation.clienttelemetry.ClientTelemetry; import com.azure.cosmos.models.CosmosClientTelemetryConfig; import com.azure.cosmos.implementation.Configs; @@ -230,7 +231,10 @@ public void crossPartitionQuery() { ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 100); Flux> results = client.queryDocuments( - getCollectionLink(), "SELECT * FROM r", options, Document.class); + getCollectionLink(), + "SELECT * FROM r", + TestUtils.createDummyQueryFeedOperationState(ResourceType.Document, OperationType.Query, options, client), + Document.class); FeedResponseListValidator validator = new FeedResponseListValidator.Builder() .totalSize(documentList.size()) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/query/DocumentProducerTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/query/DocumentProducerTest.java index 67568f0097c0..bee53a8ad198 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/query/DocumentProducerTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/query/DocumentProducerTest.java @@ -8,6 +8,7 @@ import com.azure.cosmos.implementation.CosmosError; import com.azure.cosmos.implementation.DiagnosticsClientContext; import com.azure.cosmos.implementation.Document; +import com.azure.cosmos.implementation.DocumentClientRetryPolicy; import com.azure.cosmos.implementation.GlobalEndpointManager; import com.azure.cosmos.implementation.HttpConstants; import com.azure.cosmos.implementation.IRetryPolicyFactory; @@ -63,6 +64,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -542,6 +544,14 @@ public void simple() { , responses)); IDocumentQueryClient queryClient = Mockito.mock(IDocumentQueryClient.class); + doAnswer(invocation -> { + Supplier retryPolicyFactory = invocation.getArgument(2); + RxDocumentServiceRequest req = invocation.getArgument(3); + BiFunction, RxDocumentServiceRequest, Mono>> feedOperation = + invocation.getArgument(4); + + return feedOperation.apply(retryPolicyFactory, req); + }).when(queryClient).executeFeedOperationWithAvailabilityStrategy(any(), any(), any(), any(), any()); String initialContinuationToken = "initial-cp"; DocumentProducer documentProducer = new DocumentProducer<>( @@ -620,6 +630,15 @@ public void retries() { behaviourAfterException); IDocumentQueryClient queryClient = Mockito.mock(IDocumentQueryClient.class); + doAnswer(invocation -> { + Supplier retryPolicyFactory = invocation.getArgument(2); + RxDocumentServiceRequest req = invocation.getArgument(3); + BiFunction, RxDocumentServiceRequest, Mono>> feedOperation = + invocation.getArgument(4); + + return feedOperation.apply(retryPolicyFactory, req); + }).when(queryClient).executeFeedOperationWithAvailabilityStrategy(any(), any(), any(), any(), any()); + String initialContinuationToken = "initial-cp"; DocumentProducer documentProducer = new DocumentProducer<>( @@ -702,6 +721,14 @@ public void retriesExhausted() { exceptionBehaviour); IDocumentQueryClient queryClient = Mockito.mock(IDocumentQueryClient.class); + doAnswer(invocation -> { + Supplier retryPolicyFactory = invocation.getArgument(2); + RxDocumentServiceRequest req = invocation.getArgument(3); + BiFunction, RxDocumentServiceRequest, Mono>> feedOperation = + invocation.getArgument(4); + + return feedOperation.apply(retryPolicyFactory, req); + }).when(queryClient).executeFeedOperationWithAvailabilityStrategy(any(), any(), any(), any(), any()); String initialContinuationToken = "initial-cp"; DocumentProducer documentProducer = new DocumentProducer( @@ -815,6 +842,15 @@ private int getLastValueInAsc(int initialValue, List> res private IDocumentQueryClient mockQueryClient(List replacementRanges) { IDocumentQueryClient client = Mockito.mock(IDocumentQueryClient.class); RxPartitionKeyRangeCache cache = Mockito.mock(RxPartitionKeyRangeCache.class); + + doAnswer(invocation -> { + Supplier retryPolicyFactory = invocation.getArgument(2); + RxDocumentServiceRequest req = invocation.getArgument(3); + BiFunction, RxDocumentServiceRequest, Mono>> feedOperation = + invocation.getArgument(4); + + return feedOperation.apply(retryPolicyFactory, req); + }).when(client).executeFeedOperationWithAvailabilityStrategy(any(), any(), any(), any(), any()); doReturn(cache).when(client).getPartitionKeyRangeCache(); doReturn(Mono.just(new Utils.ValueHolder<>(replacementRanges))) .when(cache).tryGetOverlappingRangesAsync(any(), any(), any(), anyBoolean(), ArgumentMatchers.any()); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/query/ReadManySplitTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/query/ReadManySplitTest.java index 1612201cfa19..58cf734a970a 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/query/ReadManySplitTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/query/ReadManySplitTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BiFunction; import java.util.function.Function; +import java.util.function.Supplier; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.when; @@ -114,7 +115,7 @@ protected DocumentProducer createDocumentProducer(String collectionRid, TriFunction createRequestFunc, Function>> executeFunc, - Callable createRetryPolicyFunc, + Supplier createRetryPolicyFunc, FeedRangeEpkImpl feedRange) { return new DocumentProducer( client, diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/throughputControl/ThroughputControlTests.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/throughputControl/ThroughputControlTests.java index cd1b20017514..869cb1e8c690 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/throughputControl/ThroughputControlTests.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/implementation/throughputControl/ThroughputControlTests.java @@ -63,7 +63,7 @@ public class ThroughputControlTests extends TestSuiteBase { private CosmosAsyncDatabase database; private CosmosAsyncContainer container; - @Factory(dataProvider = "simpleClientBuildersForDirectTcpWithoutRetryOnThrottledRequests") + @Factory(dataProvider = "simpleClientBuildersWithoutRetryOnThrottledRequests") public ThroughputControlTests(CosmosClientBuilder clientBuilder) { super(clientBuilder); this.subscriberValidationTimeout = TIMEOUT; diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureCrossPartitionTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureCrossPartitionTest.java index 4d602c65e5a4..ce9ae238c301 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureCrossPartitionTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureCrossPartitionTest.java @@ -93,12 +93,12 @@ private void warmUp() { public Object[][] queryProvider() { return new Object[][] { // query, maxItemCount, max expected back pressure buffered, total number of expected query results - { "SELECT * FROM r", 1, Queues.SMALL_BUFFER_SIZE, numberOfDocs}, - { "SELECT * FROM r", 100, Queues.SMALL_BUFFER_SIZE, numberOfDocs}, - { "SELECT * FROM r ORDER BY r.prop", 100, Queues.SMALL_BUFFER_SIZE + 3 * numberOfPartitions, numberOfDocs}, - { "SELECT TOP 500 * FROM r", 1, Queues.SMALL_BUFFER_SIZE, 500}, - { "SELECT TOP 500 * FROM r", 100, Queues.SMALL_BUFFER_SIZE, 500}, - { "SELECT TOP 500 * FROM r ORDER BY r.prop", 100, Queues.SMALL_BUFFER_SIZE + 3 * numberOfPartitions , 500}, + { "SELECT * FROM r", 1, 2 * Queues.SMALL_BUFFER_SIZE, numberOfDocs}, + { "SELECT * FROM r", 100, 2 * Queues.SMALL_BUFFER_SIZE, numberOfDocs}, + { "SELECT * FROM r ORDER BY r.prop", 100, 2 * Queues.SMALL_BUFFER_SIZE + 3 * numberOfPartitions, numberOfDocs}, + { "SELECT TOP 500 * FROM r", 1, 2 * Queues.SMALL_BUFFER_SIZE, 500}, + { "SELECT TOP 500 * FROM r", 100, 2 * Queues.SMALL_BUFFER_SIZE, 500}, + { "SELECT TOP 500 * FROM r ORDER BY r.prop", 100, 2 * Queues.SMALL_BUFFER_SIZE + 3 * numberOfPartitions , 500}, }; } @@ -206,7 +206,7 @@ public void before_BackPressureCrossPartitionTest() { createdCollection, docDefList); - numberOfPartitions = CosmosBridgeInternal.getAsyncDocumentClient(client).readPartitionKeyRanges(getCollectionLink(), null) + numberOfPartitions = CosmosBridgeInternal.getAsyncDocumentClient(client).readPartitionKeyRanges(getCollectionLink(), (CosmosQueryRequestOptions) null) .flatMap(p -> Flux.fromIterable(p.getResults())).collectList().single().block().size(); waitIfNeededForReplicasToCatchUp(getClientBuilder()); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureTest.java index 1d6ae27e3fb8..abee1236ba68 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/BackPressureTest.java @@ -10,7 +10,11 @@ import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.implementation.InternalObjectNode; import com.azure.cosmos.implementation.Offer; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; +import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.RxDocumentClientUnderTest; +import com.azure.cosmos.implementation.TestConfigurations; import com.azure.cosmos.implementation.TestUtils; import com.azure.cosmos.models.CosmosContainerProperties; import com.azure.cosmos.models.CosmosContainerRequestOptions; @@ -100,7 +104,7 @@ public void readFeedPages() throws Exception { // validate that the difference between the number of requests to backend // and the number of returned results is always less than a fixed threshold assertThat(rxClient.httpRequests.size() - subscriber.valueCount()) - .isLessThanOrEqualTo(Queues.SMALL_BUFFER_SIZE); + .isLessThanOrEqualTo(2 * Queues.SMALL_BUFFER_SIZE); subscriber.requestMore(1); i++; @@ -187,7 +191,7 @@ public void queryPages() throws Exception { // validate that the difference between the number of requests to backend // and the number of returned results is always less than a fixed threshold assertThat(rxClient.httpRequests.size() - subscriber.valueCount()) - .isLessThanOrEqualTo(Queues.SMALL_BUFFER_SIZE); + .isLessThanOrEqualTo(2 * Queues.SMALL_BUFFER_SIZE); subscriber.requestMore(1); i++; @@ -247,19 +251,30 @@ public void queryItems() throws Exception { public void before_BackPressureTest() throws Exception { CosmosContainerRequestOptions options = new CosmosContainerRequestOptions(); - client = new ClientUnderTestBuilder(getClientBuilder()).buildAsyncClient(); + client = new ClientUnderTestBuilder( + getClientBuilder() + .key(TestConfigurations.MASTER_KEY) + .endpoint(TestConfigurations.HOST)) + .buildAsyncClient(); createdDatabase = getSharedCosmosDatabase(client); createdCollection = createCollection(createdDatabase, getSinglePartitionCollectionDefinition(), options, 1000); RxDocumentClientUnderTest rxClient = (RxDocumentClientUnderTest)CosmosBridgeInternal.getAsyncDocumentClient(client); + QueryFeedOperationState state = TestUtils.createDummyQueryFeedOperationState( + ResourceType.Offer, + OperationType.Query, + new CosmosQueryRequestOptions(), + rxClient + ); + // increase throughput to max for a single partition collection to avoid throttling // for bulk insert and later queries. Offer offer = rxClient.queryOffers( String.format("SELECT * FROM r WHERE r.offerResourceId = '%s'", createdCollection.read().block().getProperties().getResourceId()) - , null).take(1).map(FeedResponse::getResults).single().block().get(0); + , state).take(1).map(FeedResponse::getResults).single().block().get(0); offer.setThroughput(6000); offer = rxClient.replaceOffer(offer).block().getResource(); assertThat(offer.getThroughput()).isEqualTo(6000); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ChangeFeedTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ChangeFeedTest.java index b6a20ac28779..83c1f975c5ea 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ChangeFeedTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ChangeFeedTest.java @@ -22,6 +22,7 @@ import com.azure.cosmos.implementation.routing.Range; import com.azure.cosmos.models.ChangeFeedPolicy; import com.azure.cosmos.models.CosmosChangeFeedRequestOptions; +import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.FeedRange; import com.azure.cosmos.models.FeedResponse; import com.azure.cosmos.models.ModelBridgeInternal; @@ -123,7 +124,7 @@ public void changeFeed_fromBeginning() throws Exception { @Test(groups = { "query" }, timeOut = 5 * TIMEOUT) public void changesFromPartitionKeyRangeId_FromBeginning() { - List partitionKeyRangeIds = client.readPartitionKeyRanges(getCollectionLink(), null) + List partitionKeyRangeIds = client.readPartitionKeyRanges(getCollectionLink(), (CosmosQueryRequestOptions) null) .flatMap(p -> Flux.fromIterable(p.getResults()), 1) .map(Resource::getId) .collectList() diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/CosmosReadAllItemsTests.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/CosmosReadAllItemsTests.java new file mode 100644 index 000000000000..6e2e34e946e9 --- /dev/null +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/CosmosReadAllItemsTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.rx; + +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosAsyncContainer; +import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.TestObject; +import com.azure.cosmos.implementation.FeedResponseListValidator; +import com.azure.cosmos.models.CosmosQueryRequestOptions; +import com.azure.cosmos.models.PartitionKey; +import com.azure.cosmos.util.CosmosPagedFlux; +import org.testng.SkipException; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Factory; +import org.testng.annotations.Test; + +import java.util.UUID; + +public class CosmosReadAllItemsTests extends TestSuiteBase { + private final static int TIMEOUT = 30000; + private CosmosAsyncClient client; + private CosmosAsyncContainer container; + + @Factory(dataProvider = "clientBuildersWithSessionConsistency") + public CosmosReadAllItemsTests(CosmosClientBuilder clientBuilder) { + super(clientBuilder); + } + + @Test(groups = { "query" }, timeOut = 2 * TIMEOUT) + public void readMany_UsePageSizeInPagedFluxOption() { + // first creating few items + String pkValue = UUID.randomUUID().toString(); + int itemCount = 10; + for (int i = 0; i < itemCount; i++) { + TestObject testObject = TestObject.create(pkValue); + this.container.createItem(testObject).block(); + } + + CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); + + FeedResponseListValidator validator1 = + new FeedResponseListValidator + .Builder() + .totalSize(itemCount) + .numberOfPages(2) + .build(); + CosmosPagedFlux queryObservable1 = + this.container.readAllItems(new PartitionKey(pkValue), cosmosQueryRequestOptions, TestObject.class); + + validateQuerySuccess(queryObservable1.byPage(5), validator1, TIMEOUT); + + FeedResponseListValidator validator2 = + new FeedResponseListValidator + .Builder() + .totalSize(itemCount) + .numberOfPages(1) + .build(); + validateQuerySuccess(queryObservable1.byPage(), validator2, TIMEOUT); + } + + @AfterClass(groups = { "query" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + public void afterClass() { + safeClose(client); + } + + @BeforeClass(groups = { "query" }, timeOut = SETUP_TIMEOUT) + public void before_TopQueryTests() { + this.client = getClientBuilder().buildAsyncClient(); + this.container = getSharedSinglePartitionCosmosContainer(client); + } +} diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OfferQueryTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OfferQueryTest.java index bf48ea27d230..d0e79d6d3f28 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OfferQueryTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OfferQueryTest.java @@ -2,14 +2,21 @@ // Licensed under the MIT License. package com.azure.cosmos.rx; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.implementation.AsyncDocumentClient; import com.azure.cosmos.implementation.AsyncDocumentClient.Builder; +import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.Database; import com.azure.cosmos.implementation.DatabaseForTest; import com.azure.cosmos.implementation.DocumentCollection; import com.azure.cosmos.implementation.FeedResponseListValidator; import com.azure.cosmos.implementation.FeedResponseValidator; import com.azure.cosmos.implementation.Offer; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; +import com.azure.cosmos.implementation.ResourceType; +import com.azure.cosmos.implementation.TestConfigurations; import com.azure.cosmos.implementation.TestSuiteBase; import com.azure.cosmos.implementation.TestUtils; import com.azure.cosmos.models.FeedResponse; @@ -55,9 +62,13 @@ public void queryOffersWithFilter() throws Exception { CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 2); - Flux> queryObservable = client.queryOffers(query, null); + Flux> queryObservable = client.queryOffers( + query, + TestUtils.createDummyQueryFeedOperationState(ResourceType.Offer, OperationType.Query, options, client)); - List allOffers = client.readOffers(null).flatMap(f -> Flux.fromIterable(f.getResults())).collectList().single().block(); + List allOffers = client + .readOffers(TestUtils.createDummyQueryFeedOperationState(ResourceType.Offer, OperationType.ReadFeed, options, client)) + .flatMap(f -> Flux.fromIterable(f.getResults())).collectList().single().block(); List expectedOffers = allOffers.stream().filter(o -> collectionResourceId.equals(o.getString("offerResourceId"))).collect(Collectors.toList()); assertThat(expectedOffers).isNotEmpty(); @@ -85,9 +96,14 @@ public void queryOffersFilterMorePages() throws Exception { CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 1); - Flux> queryObservable = client.queryOffers(query, options); - List expectedOffers = client.readOffers(null).flatMap(f -> Flux.fromIterable(f.getResults())) + Flux> queryObservable = client.queryOffers( + query, + TestUtils.createDummyQueryFeedOperationState(ResourceType.Offer, OperationType.Query, options, client)); + + List expectedOffers = client + .readOffers(TestUtils.createDummyQueryFeedOperationState(ResourceType.Offer, OperationType.ReadFeed, new CosmosQueryRequestOptions(), client)) + .flatMap(f -> Flux.fromIterable(f.getResults())) .collectList() .single().block() .stream().filter(o -> collectionResourceIds.contains(o.getOfferResourceId())) @@ -114,7 +130,22 @@ public void queryCollections_NoResults() throws Exception { String query = "SELECT * from root r where r.id = '2'"; CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); - Flux> queryObservable = client.queryCollections(getDatabaseLink(), query, options); + CosmosAsyncClient cosmosClient = new CosmosClientBuilder() + .key(TestConfigurations.MASTER_KEY) + .endpoint(TestConfigurations.HOST) + .buildAsyncClient(); + QueryFeedOperationState dummyState = new QueryFeedOperationState( + cosmosClient, + "SomeSpanName", + "SomeDBName", + "SomeContainerName", + ResourceType.Document, + OperationType.Query, + null, + options, + new CosmosPagedFluxOptions() + ); + Flux> queryObservable = client.queryCollections(getDatabaseLink(), query, dummyState); FeedResponseListValidator validator = new FeedResponseListValidator.Builder() .containsExactly(new ArrayList<>()) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OfferReadReplaceTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OfferReadReplaceTest.java index 675257012ebe..6d6064d48b0a 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OfferReadReplaceTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OfferReadReplaceTest.java @@ -2,6 +2,10 @@ // Licensed under the MIT License. package com.azure.cosmos.rx; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.ResourceType; +import com.azure.cosmos.implementation.TestUtils; +import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.FeedResponse; import com.azure.cosmos.implementation.AsyncDocumentClient; import com.azure.cosmos.implementation.Database; @@ -38,7 +42,15 @@ public OfferReadReplaceTest(AsyncDocumentClient.Builder clientBuilder) { @Test(groups = { "emulator" }, timeOut = TIMEOUT) public void readAndReplaceOffer() { - List offers = client.readOffers(null).map(FeedResponse::getResults).flatMap(list -> Flux.fromIterable(list)).collectList().block(); + List offers = client + .readOffers( + TestUtils.createDummyQueryFeedOperationState( + ResourceType.Offer, + OperationType.ReadFeed, + new CosmosQueryRequestOptions(), + client)) + .map(FeedResponse::getResults) + .flatMap(list -> Flux.fromIterable(list)).collectList().block(); int i; for (i = 0; i < offers.size(); i++) { diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OrderbyDocumentQueryTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OrderbyDocumentQueryTest.java index 06c5599eb457..8ee52438baaf 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OrderbyDocumentQueryTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/OrderbyDocumentQueryTest.java @@ -445,8 +445,9 @@ public void queryScopedToSinglePartition_StartWithContinuationToken() throws Exc options.setPartitionKey(new PartitionKey("duplicatePartitionKeyValue")); CosmosPagedFlux queryObservable = createdCollection.queryItems(query, options, InternalObjectNode.class); + int preferredPageSize = 3; TestSubscriber> subscriber = new TestSubscriber<>(); - queryObservable.byPage(3).take(1).subscribe(subscriber); + queryObservable.byPage(preferredPageSize).take(1).subscribe(subscriber); subscriber.awaitTerminalEvent(); subscriber.assertComplete(); @@ -464,8 +465,7 @@ public void queryScopedToSinglePartition_StartWithContinuationToken() throws Exc List expectedDocs = createdDocuments.stream() .filter(d -> (StringUtils.equals("duplicatePartitionKeyValue", ModelBridgeInternal.getStringFromJsonSerializable(d,"mypk")))) .filter(d -> (ModelBridgeInternal.getIntFromJsonSerializable(d,"propScopedPartitionInt") > 2)).collect(Collectors.toList()); - Integer maxItemCount = ModelBridgeInternal.getMaxItemCountFromQueryRequestOptions(options); - int expectedPageSize = (expectedDocs.size() + maxItemCount - 1) / maxItemCount; + int expectedPageSize = (expectedDocs.size() + preferredPageSize - 1) / preferredPageSize; assertThat(expectedDocs).hasSize(10 - 3); @@ -481,7 +481,7 @@ public void queryScopedToSinglePartition_StartWithContinuationToken() throws Exc .requestChargeGreaterThanOrEqualTo(1.0).build()) .build(); - validateQuerySuccess(queryObservable.byPage(page.getContinuationToken()), validator); + validateQuerySuccess(queryObservable.byPage(page.getContinuationToken(), preferredPageSize), validator); } @Test(groups = { "query" }, timeOut = TIMEOUT) @@ -697,7 +697,7 @@ public void before_OrderbyDocumentQueryTest() throws Exception { } numberOfPartitions = CosmosBridgeInternal.getAsyncDocumentClient(client) - .readPartitionKeyRanges("dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(), null) + .readPartitionKeyRanges("dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(), (CosmosQueryRequestOptions) null) .flatMap(p -> Flux.fromIterable(p.getResults())).collectList().single().block().size(); waitIfNeededForReplicasToCatchUp(getClientBuilder()); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ParallelDocumentQueryTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ParallelDocumentQueryTest.java index d35c9d0a651f..a6ec3d45d320 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ParallelDocumentQueryTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ParallelDocumentQueryTest.java @@ -115,12 +115,14 @@ public void queryMetricEquality() throws Exception { options.setQueryMetricsEnabled(true); options.setMaxDegreeOfParallelism(0); + int preferredPageSize = 5; + CosmosPagedFlux queryObservable = createdCollection.queryItems(query, options, InternalObjectNode.class); - List> resultList1 = queryObservable.byPage(5).collectList().block(); + List> resultList1 = queryObservable.byPage(preferredPageSize).collectList().block(); options.setMaxDegreeOfParallelism(4); CosmosPagedFlux threadedQueryObs = createdCollection.queryItems(query, options, InternalObjectNode.class); - List> resultList2 = threadedQueryObs.byPage().collectList().block(); + List> resultList2 = threadedQueryObs.byPage(preferredPageSize).collectList().block(); assertThat(resultList1.size()).isEqualTo(resultList2.size()); for(int i = 0; i < resultList1.size(); i++){ @@ -224,7 +226,7 @@ public void partitionKeyRangeId() { int sum = 0; for (String partitionKeyRangeId : - CosmosBridgeInternal.getAsyncDocumentClient(client).readPartitionKeyRanges(getCollectionLink(), null) + CosmosBridgeInternal.getAsyncDocumentClient(client).readPartitionKeyRanges(getCollectionLink(), (CosmosQueryRequestOptions) null) .flatMap(p -> Flux.fromIterable(p.getResults())) .map(Resource::getId).collectList().single().block()) { String query = "SELECT * from root"; diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedExceptionHandlingTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedExceptionHandlingTest.java index 0964eb653708..dc513bf148a9 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedExceptionHandlingTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedExceptionHandlingTest.java @@ -8,6 +8,7 @@ import com.azure.cosmos.implementation.DiagnosticsProvider; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.models.CosmosClientTelemetryConfig; import com.azure.cosmos.models.CosmosDatabaseProperties; @@ -55,24 +56,20 @@ public void readFeedException() throws Exception { final CosmosAsyncClientWrapper mockedClientWrapper = Mockito.spy(new CosmosAsyncClientWrapper(client)); Mockito.when(mockedClientWrapper.readAllDatabases()).thenReturn(UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, "testSpan", "testDb", null, - null, - OperationType.ReadFeed, ResourceType.Database, - client, + OperationType.ReadFeed, null, - ImplementationBridgeHelpers - .CosmosAsyncClientHelper - .getCosmosAsyncClientAccessor() - .getEffectiveDiagnosticsThresholds( - client, - ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getDiagnosticsThresholds(new CosmosQueryRequestOptions()))); + new CosmosQueryRequestOptions(), + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); return response; })); TestSubscriber> subscriber = new TestSubscriber<>(); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedOffersTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedOffersTest.java index 613f52f01da3..aff4b8d6d536 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedOffersTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ReadFeedOffersTest.java @@ -2,6 +2,14 @@ // Licensed under the MIT License. package com.azure.cosmos.rx; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.implementation.CosmosPagedFluxOptions; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; +import com.azure.cosmos.implementation.ResourceType; +import com.azure.cosmos.implementation.TestConfigurations; +import com.azure.cosmos.implementation.TestUtils; import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.FeedResponse; import com.azure.cosmos.models.ModelBridgeInternal; @@ -51,7 +59,23 @@ public void readOffers() throws Exception { CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 2); - Flux> feedObservable = client.readOffers(options); + CosmosAsyncClient cosmosClient = new CosmosClientBuilder() + .key(TestConfigurations.MASTER_KEY) + .endpoint(TestConfigurations.HOST) + .buildAsyncClient(); + QueryFeedOperationState dummyState = new QueryFeedOperationState( + cosmosClient, + "SomeSpanName", + "SomeDBName", + "SomeContainerName", + ResourceType.Document, + OperationType.Query, + null, + options, + new CosmosPagedFluxOptions() + ); + + Flux> feedObservable = client.readOffers(dummyState); int maxItemCount = ModelBridgeInternal.getMaxItemCountFromQueryRequestOptions(options); int expectedPageSize = (allOffers.size() + maxItemCount - 1) / maxItemCount; @@ -75,7 +99,14 @@ public void before_ReadFeedOffersTest() { createCollections(client); } - allOffers = client.readOffers(null) + allOffers = client.readOffers( + TestUtils.createDummyQueryFeedOperationState( + ResourceType.Offer, + OperationType.ReadFeed, + new CosmosQueryRequestOptions(), + client + ) + ) .map(FeedResponse::getResults) .collectList() .map(list -> list.stream().flatMap(Collection::stream).collect(Collectors.toList())) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ResourceTokenTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ResourceTokenTest.java index 64b0e0b30871..79fd892beed9 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ResourceTokenTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/ResourceTokenTest.java @@ -5,7 +5,8 @@ import com.azure.cosmos.ConnectionMode; import com.azure.cosmos.ConsistencyLevel; import com.azure.cosmos.implementation.AsyncDocumentClient; -import com.azure.cosmos.implementation.ImplementationBridgeHelpers; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.clienttelemetry.ClientTelemetry; import com.azure.cosmos.models.CosmosClientTelemetryConfig; import com.azure.cosmos.implementation.ConnectionPolicy; @@ -476,7 +477,7 @@ public void queryItemFromResourceToken(DocumentCollection documentCollection, Pe asyncClientResourceToken.queryDocuments( documentCollection.getAltLink(), "select * from c", - queryRequestOptions, + TestUtils.createDummyQueryFeedOperationState(ResourceType.Document, OperationType.Query, queryRequestOptions, asyncClientResourceToken), Document.class); FeedResponseListValidator validator = new FeedResponseListValidator.Builder() diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/SinglePartitionDocumentQueryTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/SinglePartitionDocumentQueryTest.java index 48bc2641609f..432407f8e43e 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/SinglePartitionDocumentQueryTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/SinglePartitionDocumentQueryTest.java @@ -281,7 +281,7 @@ public void continuationToken() throws Exception { .allPagesSatisfy(new FeedResponseValidator.Builder() .requestChargeGreaterThanOrEqualTo(1.0).build()) .build(); - validateQuerySuccess(queryObservable.byPage(page.getContinuationToken()), validator); + validateQuerySuccess(queryObservable.byPage(page.getContinuationToken(), maxItemCount), validator); } @Test(groups = { "query" }, timeOut = TIMEOUT) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java index 6525dc33cbbd..98c8f536eb0f 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TestSuiteBase.java @@ -1045,9 +1045,10 @@ public static Object[][] simpleClientBuildersWithDirectTcpWithContentResponseOnW } @DataProvider - public static Object[][] simpleClientBuildersForDirectTcpWithoutRetryOnThrottledRequests() { + public static Object[][] simpleClientBuildersWithoutRetryOnThrottledRequests() { return new Object[][]{ - {createDirectRxDocumentClient(ConsistencyLevel.SESSION, Protocol.TCP, false, null, true, false)}, + { createDirectRxDocumentClient(ConsistencyLevel.SESSION, Protocol.TCP, false, null, true, false) }, + { createGatewayRxDocumentClient(ConsistencyLevel.SESSION, false, null, true, false) } }; } diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TopQueryTests.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TopQueryTests.java index 11d78c17af4b..c48b0f7d6fcc 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TopQueryTests.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/TopQueryTests.java @@ -58,6 +58,7 @@ public void queryDocumentsWithTop(Boolean qmEnabled) throws Exception { int expectedTotalSize = 20; int expectedNumberOfPages = 3; + int pageSize = 9; int[] expectedPageLengths = new int[] { 9, 9, 2 }; for (int i = 0; i < 2; i++) { @@ -81,11 +82,24 @@ public void queryDocumentsWithTop(Boolean qmEnabled) throws Exception { CosmosPagedFlux queryObservable3 = createdCollection.queryItems("SELECT TOP 20 * from c", options, InternalObjectNode.class); + // validate the pageSize in byPage() will be honored FeedResponseListValidator validator3 = new FeedResponseListValidator.Builder() .totalSize(expectedTotalSize).numberOfPages(expectedNumberOfPages).pageLengths(expectedPageLengths) .hasValidQueryMetrics(qmEnabled).build(); - validateQuerySuccess(queryObservable3.byPage(), validator3, TIMEOUT); + validateQuerySuccess(queryObservable3.byPage(pageSize), validator3, TIMEOUT); + + // validate default value will be used for byPage + FeedResponseListValidator validator4 = + new FeedResponseListValidator + .Builder() + .totalSize(expectedTotalSize) + .numberOfPages(1) + .pageLengths(new int[] { expectedTotalSize }) + .hasValidQueryMetrics(qmEnabled) + .build(); + + validateQuerySuccess(queryObservable3.byPage(), validator4, TIMEOUT); if (i == 0) { options.setPartitionKey(new PartitionKey(firstPk)); diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/FullFidelityChangeFeedProcessorTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/FullFidelityChangeFeedProcessorTest.java index 25134096fdce..c95d7a4ac241 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/FullFidelityChangeFeedProcessorTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/FullFidelityChangeFeedProcessorTest.java @@ -4,12 +4,17 @@ import com.azure.cosmos.ChangeFeedProcessor; import com.azure.cosmos.ChangeFeedProcessorBuilder; +import com.azure.cosmos.ChangeFeedProcessorContext; import com.azure.cosmos.CosmosAsyncClient; import com.azure.cosmos.CosmosAsyncContainer; import com.azure.cosmos.CosmosAsyncDatabase; import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfigBuilder; +import com.azure.cosmos.implementation.AsyncDocumentClient; import com.azure.cosmos.implementation.InternalObjectNode; import com.azure.cosmos.implementation.Utils; +import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; +import com.azure.cosmos.implementation.changefeed.common.ChangeFeedState; import com.azure.cosmos.implementation.changefeed.epkversion.ServiceItemLeaseV1; import com.azure.cosmos.models.ChangeFeedProcessorItem; import com.azure.cosmos.models.ChangeFeedProcessorOptions; @@ -22,19 +27,23 @@ import com.azure.cosmos.models.PartitionKey; import com.azure.cosmos.models.SqlParameter; import com.azure.cosmos.models.SqlQuerySpec; +import com.azure.cosmos.models.ThroughputProperties; import com.azure.cosmos.rx.TestSuiteBase; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.RandomStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; import org.testng.annotations.Factory; import org.testng.annotations.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; +import reactor.util.retry.Retry; import java.time.Duration; import java.util.ArrayList; @@ -42,10 +51,15 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import java.util.function.BiConsumer; import java.util.function.Consumer; +import java.util.stream.Collectors; +import static com.azure.cosmos.BridgeInternal.extractContainerSelfLink; +import static com.azure.cosmos.CosmosBridgeInternal.getContextClient; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; @@ -58,6 +72,7 @@ public class FullFidelityChangeFeedProcessorTest extends TestSuiteBase { private final int FEED_COUNT = 10; private final int CHANGE_FEED_PROCESSOR_TIMEOUT = 5000; private final int FEED_COLLECTION_THROUGHPUT = 400; + private final int FEED_COLLECTION_THROUGHPUT_FOR_SPLIT = 10100; private final int LEASE_COLLECTION_THROUGHPUT = 400; private CosmosAsyncClient client; @@ -67,29 +82,38 @@ public FullFidelityChangeFeedProcessorTest(CosmosClientBuilder clientBuilder) { super(clientBuilder); } + @DataProvider + public Object[] contextTestConfigs() { + return new Object[] {true, false}; + } + // Using this test to verify basic functionality - @Test(groups = { "emulator" }, timeOut = 50 * CHANGE_FEED_PROCESSOR_TIMEOUT) - public void fullFidelityChangeFeedProcessorStartFromNow() throws InterruptedException { + @Test(groups = { "emulator" }, dataProvider = "contextTestConfigs", timeOut = 50 * CHANGE_FEED_PROCESSOR_TIMEOUT) + public void fullFidelityChangeFeedProcessorStartFromNow(boolean isContextRequired) throws InterruptedException { CosmosAsyncContainer createdFeedCollection = createFeedCollection(FEED_COLLECTION_THROUGHPUT); CosmosAsyncContainer createdLeaseCollection = createLeaseCollection(LEASE_COLLECTION_THROUGHPUT); try { List createdDocuments = new ArrayList<>(); Map receivedDocuments = new ConcurrentHashMap<>(); + Set receivedLeaseTokensFromContext = ConcurrentHashMap.newKeySet(); ChangeFeedProcessorOptions changeFeedProcessorOptions = new ChangeFeedProcessorOptions(); - ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder() + + ChangeFeedProcessorBuilder changeFeedProcessorBuilder = new ChangeFeedProcessorBuilder() .options(changeFeedProcessorOptions) .hostName(hostName) - .handleAllVersionsAndDeletesChanges((List docs) -> { - log.info("START processing from thread {}", Thread.currentThread().getId()); - for (ChangeFeedProcessorItem item : docs) { - processItem(item, receivedDocuments); - } - log.info("END processing from thread {}", Thread.currentThread().getId()); - }) .feedContainer(createdFeedCollection) - .leaseContainer(createdLeaseCollection) - .buildChangeFeedProcessor(); + .leaseContainer(createdLeaseCollection); + + if (isContextRequired) { + changeFeedProcessorBuilder = changeFeedProcessorBuilder + .handleAllVersionsAndDeletesChanges(changeFeedProcessorHandlerWithContext(receivedDocuments, receivedLeaseTokensFromContext)); + } else { + changeFeedProcessorBuilder = changeFeedProcessorBuilder + .handleAllVersionsAndDeletesChanges(changeFeedProcessorHandler(receivedDocuments)); + } + + ChangeFeedProcessor changeFeedProcessor = changeFeedProcessorBuilder.buildChangeFeedProcessor(); try { changeFeedProcessor.start().subscribeOn(Schedulers.boundedElastic()) @@ -113,6 +137,25 @@ public void fullFidelityChangeFeedProcessorStartFromNow() throws InterruptedExce changeFeedProcessor.stop().subscribeOn(Schedulers.boundedElastic()).timeout(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); + // query for leases from the createdLeaseCollection + String leaseQuery = "select * from c where not contains(c.id, \"info\")"; + List leaseDocuments = + createdLeaseCollection + .queryItems(leaseQuery, JsonNode.class) + .byPage() + .blockFirst() + .getResults(); + + List leaseTokensCollectedFromLeaseCollection = + leaseDocuments.stream().map(lease -> lease.get("LeaseToken").asText()).collect(Collectors.toList()); + + if (isContextRequired) { + assertThat(leaseTokensCollectedFromLeaseCollection).isNotNull(); + assertThat(receivedLeaseTokensFromContext.size()).isEqualTo(leaseTokensCollectedFromLeaseCollection.size()); + + assertThat(receivedLeaseTokensFromContext.containsAll(leaseTokensCollectedFromLeaseCollection)).isTrue(); + } + // Wait for the feed processor to shut down. Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); @@ -129,30 +172,33 @@ public void fullFidelityChangeFeedProcessorStartFromNow() throws InterruptedExce } } - // Using this test to verify basic functionality - @Test(groups = { "emulator" }, timeOut = 50 * CHANGE_FEED_PROCESSOR_TIMEOUT) - public void fullFidelityChangeFeedProcessorStartFromContinuationToken() throws InterruptedException { + @Test(groups = { "emulator" }, dataProvider = "contextTestConfigs", timeOut = 50 * CHANGE_FEED_PROCESSOR_TIMEOUT) + public void fullFidelityChangeFeedProcessorStartFromContinuationToken(boolean isContextRequired) throws InterruptedException { CosmosAsyncContainer createdFeedCollection = createFeedCollection(FEED_COLLECTION_THROUGHPUT); CosmosAsyncContainer createdLeaseCollection = createLeaseCollection(LEASE_COLLECTION_THROUGHPUT); try { List createdDocuments = new ArrayList<>(); Map receivedDocuments = new ConcurrentHashMap<>(); + Set receivedLeaseTokensFromContext = ConcurrentHashMap.newKeySet(); ChangeFeedProcessorOptions changeFeedProcessorOptions = new ChangeFeedProcessorOptions(); - ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder() + + ChangeFeedProcessorBuilder changeFeedProcessorBuilder = new ChangeFeedProcessorBuilder() .options(changeFeedProcessorOptions) .hostName(hostName) - .handleAllVersionsAndDeletesChanges((List docs) -> { - log.info("START processing from thread {}", Thread.currentThread().getId()); - for (ChangeFeedProcessorItem item : docs) { - processItem(item, receivedDocuments); - } - log.info("END processing from thread {}", Thread.currentThread().getId()); - }) .feedContainer(createdFeedCollection) - .leaseContainer(createdLeaseCollection) - .buildChangeFeedProcessor(); + .leaseContainer(createdLeaseCollection); + + if (isContextRequired) { + changeFeedProcessorBuilder = changeFeedProcessorBuilder.handleAllVersionsAndDeletesChanges( + changeFeedProcessorHandlerWithContext(receivedDocuments, receivedLeaseTokensFromContext)); + } else { + changeFeedProcessorBuilder = changeFeedProcessorBuilder.handleAllVersionsAndDeletesChanges( + changeFeedProcessorHandler(receivedDocuments)); + } + + ChangeFeedProcessor changeFeedProcessor = changeFeedProcessorBuilder.buildChangeFeedProcessor(); try { changeFeedProcessor.start().subscribeOn(Schedulers.boundedElastic()) @@ -176,6 +222,26 @@ public void fullFidelityChangeFeedProcessorStartFromContinuationToken() throws I changeFeedProcessor.stop().subscribeOn(Schedulers.boundedElastic()).timeout(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); + // query for leases from the createdLeaseCollection + String leaseQuery = "select * from c where not contains(c.id, \"info\")"; + List leaseDocuments = + createdLeaseCollection + .queryItems(leaseQuery, JsonNode.class) + .byPage() + .blockFirst() + .getResults(); + + List leaseTokensCollectedFromLeaseCollection = + leaseDocuments.stream().map(lease -> lease.get("LeaseToken").asText()).collect(Collectors.toList()); + + if (isContextRequired) { + assertThat(leaseTokensCollectedFromLeaseCollection).isNotNull(); + assertThat(receivedLeaseTokensFromContext.size()).isEqualTo(leaseTokensCollectedFromLeaseCollection.size()); + + assertThat(receivedLeaseTokensFromContext.containsAll(leaseTokensCollectedFromLeaseCollection)).isTrue(); + + } + // Wait for the feed processor to shut down. Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); @@ -879,6 +945,321 @@ public void inactiveOwnersRecovery() throws InterruptedException { } } + @Test(groups = { "emulator" }, timeOut = 50 * CHANGE_FEED_PROCESSOR_TIMEOUT) + public void endToEndTimeoutConfigShouldBeSuppressed() throws InterruptedException { + CosmosAsyncClient clientWithE2ETimeoutConfig = null; + CosmosAsyncContainer createdFeedCollection = createFeedCollection(FEED_COLLECTION_THROUGHPUT); + CosmosAsyncContainer createdLeaseCollection = createLeaseCollection(LEASE_COLLECTION_THROUGHPUT); + + try { + clientWithE2ETimeoutConfig = this.getClientBuilder() + .endToEndOperationLatencyPolicyConfig(new CosmosEndToEndOperationLatencyPolicyConfigBuilder(Duration.ofMillis(1)).build()) + .contentResponseOnWriteEnabled(true) + .buildAsyncClient(); + + CosmosAsyncDatabase testDatabase = clientWithE2ETimeoutConfig.getDatabase(this.createdDatabase.getId()); + CosmosAsyncContainer createdFeedCollectionDuplicate = testDatabase.getContainer(createdFeedCollection.getId()); + CosmosAsyncContainer createdLeaseCollectionDuplicate = testDatabase.getContainer(createdLeaseCollection.getId()); + + List createdDocuments = new ArrayList<>(); + Map receivedDocuments = new ConcurrentHashMap<>(); + ChangeFeedProcessorOptions changeFeedProcessorOptions = new ChangeFeedProcessorOptions(); + ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder() + .options(changeFeedProcessorOptions) + .hostName(hostName) + .handleAllVersionsAndDeletesChanges((List docs) -> { + log.info("START processing from thread {}", Thread.currentThread().getId()); + for (ChangeFeedProcessorItem item : docs) { + processItem(item, receivedDocuments); + } + log.info("END processing from thread {}", Thread.currentThread().getId()); + }) + .feedContainer(createdFeedCollectionDuplicate) + .leaseContainer(createdLeaseCollectionDuplicate) + .buildChangeFeedProcessor(); + + try { + changeFeedProcessor.start().subscribeOn(Schedulers.boundedElastic()) + .timeout(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)) + .subscribe(); + logger.info("Starting ChangeFeed processor"); + + // Wait for the feed processor to receive and process the documents. + Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); + + logger.info("Finished starting ChangeFeed processor"); + + setupReadFeedDocuments(createdDocuments, receivedDocuments, createdFeedCollection, FEED_COUNT); + logger.info("Set up read feed documents"); + + // Wait for the feed processor to receive and process the documents. + Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); + logger.info("Validating changes now"); + + validateChangeFeedProcessing(changeFeedProcessor, createdDocuments, receivedDocuments, 10 * CHANGE_FEED_PROCESSOR_TIMEOUT); + + changeFeedProcessor.stop().subscribeOn(Schedulers.boundedElastic()).timeout(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); + + // Wait for the feed processor to shut down. + Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); + + } catch (Exception ex) { + log.error("Change feed processor did not start and stopped in the expected time", ex); + throw ex; + } + + } finally { + safeDeleteCollection(createdFeedCollection); + safeDeleteCollection(createdLeaseCollection); + safeClose(clientWithE2ETimeoutConfig); + // Allow some time for the collections to be deleted before exiting. + Thread.sleep(500); + } + } + + // todo: this test was run against an FFCF account, worth re-enabling + // when we have such an account for the live tests pipeline + @Test(groups = { "split" }, dataProvider = "contextTestConfigs", timeOut = 160 * CHANGE_FEED_PROCESSOR_TIMEOUT, enabled = false) + public void readFeedDocumentsAfterSplit(boolean isContextRequired) throws InterruptedException { + CosmosAsyncContainer createdFeedCollectionForSplit = createFeedCollection(FEED_COLLECTION_THROUGHPUT); + CosmosAsyncContainer createdLeaseCollection = createLeaseCollection(2 * LEASE_COLLECTION_THROUGHPUT); + CosmosAsyncContainer createdLeaseMonitorCollection = createLeaseMonitorCollection(LEASE_COLLECTION_THROUGHPUT); + + try { + List createdDocuments = new ArrayList<>(); + Map receivedDocuments = new ConcurrentHashMap<>(); + Set receivedLeaseTokensFromContext = ConcurrentHashMap.newKeySet(); + Set queriedLeaseTokensFromLeaseCollection = ConcurrentHashMap.newKeySet(); + + LeaseStateMonitor leaseStateMonitor = new LeaseStateMonitor(); + + // create a monitoring CFP for ensuring the leases are updating as expected + ChangeFeedProcessor leaseMonitoringChangeFeedProcessor = new ChangeFeedProcessorBuilder() + .hostName(hostName) + .handleLatestVersionChanges(leasesChangeFeedProcessorHandler(leaseStateMonitor)) + .feedContainer(createdLeaseCollection) + .leaseContainer(createdLeaseMonitorCollection) + .options(new ChangeFeedProcessorOptions() + .setLeasePrefix("MONITOR") + .setStartFromBeginning(true) + .setMaxItemCount(10) + .setLeaseRenewInterval(Duration.ofSeconds(2)) + ).buildChangeFeedProcessor(); + + ChangeFeedProcessorBuilder changeFeedProcessorBuilderForFeedMonitoring = new ChangeFeedProcessorBuilder() + .hostName(hostName) + .feedContainer(createdFeedCollectionForSplit) + .leaseContainer(createdLeaseCollection) + .options(new ChangeFeedProcessorOptions() + .setLeasePrefix("TEST") + .setStartFromBeginning(false)); + + if (isContextRequired) { + changeFeedProcessorBuilderForFeedMonitoring = changeFeedProcessorBuilderForFeedMonitoring + .handleAllVersionsAndDeletesChanges(changeFeedProcessorHandlerWithContext(receivedDocuments, receivedLeaseTokensFromContext)); + } else { + changeFeedProcessorBuilderForFeedMonitoring = changeFeedProcessorBuilderForFeedMonitoring + .handleAllVersionsAndDeletesChanges(changeFeedProcessorHandler(receivedDocuments)); + } + + ChangeFeedProcessor changeFeedProcessor = changeFeedProcessorBuilderForFeedMonitoring.buildChangeFeedProcessor(); + + leaseMonitoringChangeFeedProcessor.start().subscribeOn(Schedulers.boundedElastic()) + .timeout(Duration.ofMillis(200 * CHANGE_FEED_PROCESSOR_TIMEOUT)) + .onErrorResume(throwable -> { + logger.error("Change feed processor for lease monitoring did not start in the expected time", throwable); + return Mono.error(throwable); + }) + .then( + changeFeedProcessor.start().subscribeOn(Schedulers.boundedElastic()) + .timeout(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)) + .onErrorResume(throwable -> { + logger.error("Change feed processor did not start in the expected time", throwable); + return Mono.error(throwable); + })) + .subscribe(); + + // allow time for both the lease monitoring CFP and + // feed monitoring CFP to start + Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); + + // generate a first batch of documents on the feed collection to be split + setupReadFeedDocuments(createdDocuments, receivedDocuments, createdFeedCollectionForSplit, FEED_COUNT); + + // Wait for the feed processor to receive and process the first batch of documents and apply throughput change. + Thread.sleep(4 * CHANGE_FEED_PROCESSOR_TIMEOUT); + validateChangeFeedProcessing(changeFeedProcessor, createdDocuments, receivedDocuments, 10 * CHANGE_FEED_PROCESSOR_TIMEOUT); + + // query for leases from the createdLeaseCollection + String leaseQuery = "select * from c where not contains(c.id, \"info\")"; + List leaseDocuments = + createdLeaseCollection + .queryItems(leaseQuery, JsonNode.class) + .byPage() + .blockFirst() + .getResults(); + + // collect lease documents before the monitored collection undergoes a split + queriedLeaseTokensFromLeaseCollection + .addAll(leaseDocuments.stream().map(lease -> lease.get("LeaseToken").asText()).collect(Collectors.toList())); + + createdFeedCollectionForSplit + .readThroughput().subscribeOn(Schedulers.boundedElastic()) + .flatMap(currentThroughput -> + createdFeedCollectionForSplit + .replaceThroughput(ThroughputProperties.createManualThroughput(FEED_COLLECTION_THROUGHPUT_FOR_SPLIT)) + .subscribeOn(Schedulers.boundedElastic()) + ).subscribe(); + + // Retrieve the latest continuation token value. + long continuationToken = Long.MAX_VALUE; + for (JsonNode item : leaseStateMonitor.receivedLeases.values()) { + JsonNode tempToken = item.get("ContinuationToken"); + + long continuationTokenValue = 0; + if (tempToken != null && StringUtils.isNotEmpty(tempToken.asText())) { + ChangeFeedState changeFeedState = ChangeFeedState.fromString(tempToken.asText()); + continuationTokenValue = + Long.parseLong(changeFeedState.getContinuation().getCurrentContinuationToken().getToken().replace("\"", "")); + } + if (tempToken == null || continuationTokenValue == 0) { + logger.error("Found unexpected lease with continuation token value of null or 0"); + try { + logger.info("ERROR LEASE FOUND {}", OBJECT_MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(item)); + } catch (JsonProcessingException e) { + logger.error("Failure in processing json [{}]", e.getMessage(), e); + } + leaseStateMonitor.isContinuationTokenAdvancing = false; + } + else { + // keep the lowest continuation token value + if (continuationToken > continuationTokenValue) { + continuationToken = continuationTokenValue; + } + } + } + if (continuationToken == Long.MAX_VALUE) { + // something went wrong; we could not find any valid leases. + logger.error("Could not find any valid lease documents"); + leaseStateMonitor.isContinuationTokenAdvancing = false; + } + else { + leaseStateMonitor.parentContinuationToken = continuationToken; + } + leaseStateMonitor.isAfterLeaseInitialization = true; + + // Loop through reading the current partition count until we get a split + // This can take up to two minute or more. + String partitionKeyRangesPath = extractContainerSelfLink(createdFeedCollectionForSplit); + + AsyncDocumentClient contextClient = getContextClient(createdDatabase); + Flux.just(1).subscribeOn(Schedulers.boundedElastic()) + .flatMap(value -> { + logger.warn("Reading current throughput change."); + return contextClient.readPartitionKeyRanges(partitionKeyRangesPath, (CosmosQueryRequestOptions) null); + }) + .map(partitionKeyRangeFeedResponse -> { + int count = partitionKeyRangeFeedResponse.getResults().size(); + + if (count < 2) { + logger.warn("Throughput change is pending."); + throw new RuntimeException("Throughput change is not done."); + } + return count; + }) + // this will timeout approximately after 30 minutes + .retryWhen(Retry.max(40).filter(throwable -> { + try { + logger.warn("Retrying..."); + // Splits are taking longer, so increasing sleep time between retries + Thread.sleep(10 * CHANGE_FEED_PROCESSOR_TIMEOUT); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted exception", e); + } + return true; + })) + .last() + .doOnSuccess(partitionCount -> { + leaseStateMonitor.isAfterSplits = true; + }) + .block(); + + assertThat(changeFeedProcessor.isStarted()).as("Change Feed Processor instance is running").isTrue(); + + // generate the second batch of documents + createReadFeedDocuments(createdDocuments, createdFeedCollectionForSplit, FEED_COUNT); + + // Wait for the feed processor to receive and process the second batch of documents. + waitToReceiveDocuments(receivedDocuments, 2 * CHANGE_FEED_PROCESSOR_TIMEOUT, FEED_COUNT * 2); + + changeFeedProcessor.stop().subscribeOn(Schedulers.boundedElastic()).timeout(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); + leaseMonitoringChangeFeedProcessor.stop().subscribeOn(Schedulers.boundedElastic()).timeout(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); + + int leaseCount = changeFeedProcessor.getCurrentState() .map(List::size).block(); + assertThat(leaseCount > 1).as("Found %d leases", leaseCount).isTrue(); + + assertThat(receivedDocuments.size()).isEqualTo(createdDocuments.size()); + for (InternalObjectNode item : createdDocuments) { + assertThat(receivedDocuments.containsKey(item.getId())).as("Document with getId: " + item.getId()).isTrue(); + } + + // check the continuation tokens have advanced after splits + assertThat(leaseStateMonitor.isContinuationTokenAdvancing && leaseStateMonitor.parentContinuationToken > 0) + .as("Continuation tokens for the leases after split should advance from parent value; parent: %d", leaseStateMonitor.parentContinuationToken).isTrue(); + + // query for leases from the createdLeaseCollection after monitored collection undergoes a split + leaseDocuments = createdLeaseCollection + .queryItems(leaseQuery, JsonNode.class) + .byPage() + .blockFirst() + .getResults(); + + queriedLeaseTokensFromLeaseCollection.addAll( + leaseDocuments.stream().map(lease -> lease.get("LeaseToken").asText()).collect(Collectors.toList())); + + if (isContextRequired) { + assertThat(receivedLeaseTokensFromContext.size()) + .isEqualTo(queriedLeaseTokensFromLeaseCollection.size()); + + assertThat(receivedLeaseTokensFromContext.containsAll(queriedLeaseTokensFromLeaseCollection)).isTrue(); + } + + // Wait for the feed processor to shutdown. + Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); + + } finally { + System.out.println("Start to delete FeedCollectionForSplit"); + safeDeleteCollection(createdFeedCollectionForSplit); + safeDeleteCollection(createdLeaseCollection); + + // Allow some time for the collections to be deleted before exiting. + Thread.sleep(500); + } + } + + private Consumer> changeFeedProcessorHandler(Map receivedDocuments) { + return docs -> { + logger.info("START processing from thread in test {}", Thread.currentThread().getId()); + for (ChangeFeedProcessorItem item : docs) { + processItem(item, receivedDocuments); + } + logger.info("END processing from thread {}", Thread.currentThread().getId()); + }; + } + + private BiConsumer, ChangeFeedProcessorContext> changeFeedProcessorHandlerWithContext( + Map receivedDocuments, Set receivedLeaseTokensFromContext) { + return (docs, context) -> { + logger.info("START processing from thread in test {}", Thread.currentThread().getId()); + for (ChangeFeedProcessorItem item : docs) { + processItem(item, receivedDocuments); + } + validateChangeFeedProcessorContext(context); + processChangeFeedProcessorContext(context, receivedLeaseTokensFromContext); + logger.info("END processing from thread {}", Thread.currentThread().getId()); + }; + } + void validateChangeFeedProcessing(ChangeFeedProcessor changeFeedProcessor, List createdDocuments, Map receivedDocuments, int sleepTime) throws InterruptedException { assertThat(changeFeedProcessor.isStarted()).as("Change Feed Processor instance is running").isTrue(); @@ -908,6 +1289,13 @@ void validateChangeFeedProcessing(ChangeFeedProcessor changeFeedProcessor, List< } } + void validateChangeFeedProcessorContext(ChangeFeedProcessorContext changeFeedProcessorContext) { + + String leaseToken = changeFeedProcessorContext.getLeaseToken(); + + assertThat(leaseToken).isNotNull(); + } + private Consumer> fullFidelityChangeFeedProcessorHandler(Map receivedDocuments) { return docs -> { log.info("START processing from thread in test {}", Thread.currentThread().getId()); @@ -987,8 +1375,81 @@ private CosmosAsyncContainer createLeaseCollection(int provisionedThroughput) { return createCollection(createdDatabase, collectionDefinition, options, provisionedThroughput); } + private CosmosAsyncContainer createLeaseMonitorCollection(int provisionedThroughput) { + CosmosContainerRequestOptions options = new CosmosContainerRequestOptions(); + CosmosContainerProperties collectionDefinition = new CosmosContainerProperties( + "monitor_" + UUID.randomUUID(), + "/id"); + return createCollection(createdDatabase, collectionDefinition, options, provisionedThroughput); + } + + private Consumer> leasesChangeFeedProcessorHandler(LeaseStateMonitor leaseStateMonitor) { + return docs -> { + log.info("LEASES processing from thread in test {}", Thread.currentThread().getId()); + for (ChangeFeedProcessorItem item : docs) { + try { + log + .debug("LEASE RECEIVED {}", OBJECT_MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(item)); + } catch (JsonProcessingException e) { + log.error("Failure in processing json [{}]", e.getMessage(), e); + } + + JsonNode leaseToken = item.getCurrent().get("LeaseToken"); + + if (leaseToken != null) { + JsonNode continuationTokenNode = item.getCurrent().get("ContinuationToken"); + if (continuationTokenNode == null) { + // Something catastrophic went wrong and the lease is malformed. + log.error("Found invalid lease document"); + leaseStateMonitor.isContinuationTokenAdvancing = false; + } + else { + log.info("LEASE {} with continuation {}", leaseToken.asText(), continuationTokenNode.asText()); + if (leaseStateMonitor.isAfterLeaseInitialization) { + String value = continuationTokenNode.asText().replaceAll("[^0-9]", ""); + if (value.isEmpty()) { + log.error("Found unexpected continuation token that does not conform to the expected format"); + leaseStateMonitor.isContinuationTokenAdvancing = false; + } + long continuationToken = Long.parseLong(value); + if (leaseStateMonitor.parentContinuationToken > continuationToken) { + log.error("Found unexpected continuation token that did not advance after the split; parent: {}, current: {}"); + leaseStateMonitor.isContinuationTokenAdvancing = false; + } + } + } + leaseStateMonitor.receivedLeases.put(item.getCurrent().get("id").asText(), item.getCurrent()); + } + } + log.info("LEASES processing from thread {}", Thread.currentThread().getId()); + }; + } + private static synchronized void processItem(ChangeFeedProcessorItem item, Map receivedDocuments) { log.info("RECEIVED {}", item); receivedDocuments.put(item.getCurrent().get("id").asText(), item); } -} \ No newline at end of file + + private static synchronized void processChangeFeedProcessorContext( + ChangeFeedProcessorContext context, + Set receivedLeaseTokens) { + + if (context == null) { + fail("The context cannot be null."); + } + + if (context.getLeaseToken() == null || context.getLeaseToken().isEmpty()) { + fail("The lease token cannot be null or empty."); + } + + receivedLeaseTokens.add(context.getLeaseToken()); + } + + class LeaseStateMonitor { + public Map receivedLeases = new ConcurrentHashMap<>(); + public volatile boolean isAfterLeaseInitialization = false; + public volatile boolean isAfterSplits = false; + public volatile long parentContinuationToken = 0; + public volatile boolean isContinuationTokenAdvancing = true; + } +} diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/IncrementalChangeFeedProcessorTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/IncrementalChangeFeedProcessorTest.java index 97812c1fd790..50c472665401 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/IncrementalChangeFeedProcessorTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/epkversion/IncrementalChangeFeedProcessorTest.java @@ -9,6 +9,7 @@ import com.azure.cosmos.CosmosAsyncContainer; import com.azure.cosmos.CosmosAsyncDatabase; import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfigBuilder; import com.azure.cosmos.implementation.AsyncDocumentClient; import com.azure.cosmos.implementation.DatabaseAccount; import com.azure.cosmos.implementation.DatabaseAccountLocation; @@ -64,7 +65,6 @@ import java.util.UUID; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ThreadLocalRandom; import java.util.function.Consumer; import static com.azure.cosmos.BridgeInternal.extractContainerSelfLink; @@ -1177,7 +1177,7 @@ public void readFeedDocumentsAfterSplit() throws InterruptedException { Flux.just(1).subscribeOn(Schedulers.boundedElastic()) .flatMap(value -> { logger.warn("Reading current throughput change."); - return contextClient.readPartitionKeyRanges(partitionKeyRangesPath, null); + return contextClient.readPartitionKeyRanges(partitionKeyRangesPath, (CosmosQueryRequestOptions) null); }) .map(partitionKeyRangeFeedResponse -> { int count = partitionKeyRangeFeedResponse.getResults().size(); @@ -1540,6 +1540,75 @@ public void readFeedDocuments_pollDelay() throws InterruptedException { } } + @Test(groups = {"query" }, timeOut = 2 * TIMEOUT) + public void endToEndTimeoutConfigShouldBeSuppressed() throws InterruptedException { + CosmosAsyncClient clientWithE2ETimeoutConfig = null; + CosmosAsyncContainer createdFeedCollection = createFeedCollection(FEED_COLLECTION_THROUGHPUT); + CosmosAsyncContainer createdLeaseCollection = createLeaseCollection(LEASE_COLLECTION_THROUGHPUT); + + try { + clientWithE2ETimeoutConfig = this.getClientBuilder() + .endToEndOperationLatencyPolicyConfig(new CosmosEndToEndOperationLatencyPolicyConfigBuilder(Duration.ofMillis(1)).build()) + .contentResponseOnWriteEnabled(true) + .buildAsyncClient(); + + CosmosAsyncDatabase testDatabase = clientWithE2ETimeoutConfig.getDatabase(this.createdDatabase.getId()); + CosmosAsyncContainer createdFeedCollectionDuplicate = testDatabase.getContainer(createdFeedCollection.getId()); + CosmosAsyncContainer createdLeaseCollectionDuplicate = testDatabase.getContainer(createdLeaseCollection.getId()); + + List createdDocuments = new ArrayList<>(); + Map receivedDocuments = new ConcurrentHashMap<>(); + setupReadFeedDocuments(createdDocuments, receivedDocuments, createdFeedCollection, FEED_COUNT); + + changeFeedProcessor = new ChangeFeedProcessorBuilder() + .hostName(hostName) + .handleLatestVersionChanges(changeFeedProcessorHandler(receivedDocuments)) + .feedContainer(createdFeedCollectionDuplicate) + .leaseContainer(createdLeaseCollectionDuplicate) + .options(new ChangeFeedProcessorOptions() + .setLeaseRenewInterval(Duration.ofSeconds(20)) + .setLeaseAcquireInterval(Duration.ofSeconds(10)) + .setLeaseExpirationInterval(Duration.ofSeconds(30)) + .setFeedPollDelay(Duration.ofSeconds(2)) + .setLeasePrefix("TEST") + .setMaxItemCount(10) + .setStartFromBeginning(true) + .setMaxScaleCount(0) // unlimited + ) + .buildChangeFeedProcessor(); + + try { + changeFeedProcessor.start().subscribeOn(Schedulers.boundedElastic()) + .timeout(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)) + .subscribe(); + } catch (Exception ex) { + logger.error("Change feed processor did not start in the expected time", ex); + throw ex; + } + + // Wait for the feed processor to receive and process the documents. + Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); + + assertThat(changeFeedProcessor.isStarted()).as("Change Feed Processor instance is running").isTrue(); + + changeFeedProcessor.stop().subscribeOn(Schedulers.boundedElastic()).timeout(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); + + for (InternalObjectNode item : createdDocuments) { + assertThat(receivedDocuments.containsKey(item.getId())).as("Document with getId: " + item.getId()).isTrue(); + } + + // Wait for the feed processor to shutdown. + Thread.sleep(CHANGE_FEED_PROCESSOR_TIMEOUT); + } finally { + safeDeleteCollection(createdFeedCollection); + safeDeleteCollection(createdLeaseCollection); + safeClose(clientWithE2ETimeoutConfig); + + // Allow some time for the collections to be deleted before exiting. + Thread.sleep(500); + } + } + void validateChangeFeedProcessing(ChangeFeedProcessor changeFeedProcessor, List createdDocuments, Map receivedDocuments, int sleepTime) throws InterruptedException { try { changeFeedProcessor.start().subscribeOn(Schedulers.boundedElastic()) diff --git a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/pkversion/IncrementalChangeFeedProcessorTest.java b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/pkversion/IncrementalChangeFeedProcessorTest.java index 8c6c19d0d07d..aa1472f5ddfb 100644 --- a/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/pkversion/IncrementalChangeFeedProcessorTest.java +++ b/sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/rx/changefeed/pkversion/IncrementalChangeFeedProcessorTest.java @@ -8,6 +8,7 @@ import com.azure.cosmos.CosmosAsyncContainer; import com.azure.cosmos.CosmosAsyncDatabase; import com.azure.cosmos.CosmosClientBuilder; +import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfigBuilder; import com.azure.cosmos.implementation.AsyncDocumentClient; import com.azure.cosmos.implementation.DatabaseAccount; import com.azure.cosmos.implementation.DatabaseAccountLocation; @@ -1302,7 +1303,7 @@ public void readFeedDocumentsAfterSplit() throws InterruptedException { Flux.just(1).subscribeOn(Schedulers.boundedElastic()) .flatMap(value -> { log.warn("Reading current throughput change."); - return contextClient.readPartitionKeyRanges(partitionKeyRangesPath, null); + return contextClient.readPartitionKeyRanges(partitionKeyRangesPath, (CosmosQueryRequestOptions) null); }) .map(partitionKeyRangeFeedResponse -> { int count = partitionKeyRangeFeedResponse.getResults().size(); @@ -1696,6 +1697,75 @@ public void readFeedDocuments_pollDelay() throws InterruptedException { } } + @Test(groups = { "emulator" }, timeOut = 2 * TIMEOUT) + public void endToEndTimeoutConfigShouldBeSuppressed() throws InterruptedException { + CosmosAsyncClient clientWithE2ETimeoutConfig = null; + CosmosAsyncContainer createdFeedCollection = createFeedCollection(FEED_COLLECTION_THROUGHPUT); + CosmosAsyncContainer createdLeaseCollection = createLeaseCollection(LEASE_COLLECTION_THROUGHPUT); + + try { + clientWithE2ETimeoutConfig = this.getClientBuilder() + .endToEndOperationLatencyPolicyConfig(new CosmosEndToEndOperationLatencyPolicyConfigBuilder(Duration.ofMillis(1)).build()) + .contentResponseOnWriteEnabled(true) + .buildAsyncClient(); + + CosmosAsyncDatabase testDatabase = clientWithE2ETimeoutConfig.getDatabase(this.createdDatabase.getId()); + CosmosAsyncContainer createdFeedCollectionDuplicate = testDatabase.getContainer(createdFeedCollection.getId()); + CosmosAsyncContainer createdLeaseCollectionDuplicate = testDatabase.getContainer(createdLeaseCollection.getId()); + + List createdDocuments = new ArrayList<>(); + Map receivedDocuments = new ConcurrentHashMap<>(); + setupReadFeedDocuments(createdDocuments, receivedDocuments, createdFeedCollection, FEED_COUNT); + + changeFeedProcessor = new ChangeFeedProcessorBuilder() + .hostName(hostName) + .handleChanges(changeFeedProcessorHandler(receivedDocuments)) + .feedContainer(createdFeedCollectionDuplicate) + .leaseContainer(createdLeaseCollectionDuplicate) + .options(new ChangeFeedProcessorOptions() + .setLeaseRenewInterval(Duration.ofSeconds(20)) + .setLeaseAcquireInterval(Duration.ofSeconds(10)) + .setLeaseExpirationInterval(Duration.ofSeconds(30)) + .setFeedPollDelay(Duration.ofSeconds(2)) + .setLeasePrefix("TEST") + .setMaxItemCount(10) + .setStartFromBeginning(true) + .setMaxScaleCount(0) // unlimited + ) + .buildChangeFeedProcessor(); + + try { + changeFeedProcessor.start().subscribeOn(Schedulers.boundedElastic()) + .timeout(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)) + .subscribe(); + } catch (Exception ex) { + log.error("Change feed processor did not start in the expected time", ex); + throw ex; + } + + // Wait for the feed processor to receive and process the documents. + Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); + + assertThat(changeFeedProcessor.isStarted()).as("Change Feed Processor instance is running").isTrue(); + + changeFeedProcessor.stop().subscribeOn(Schedulers.boundedElastic()).timeout(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); + + for (InternalObjectNode item : createdDocuments) { + assertThat(receivedDocuments.containsKey(item.getId())).as("Document with getId: " + item.getId()).isTrue(); + } + + // Wait for the feed processor to shutdown. + Thread.sleep(CHANGE_FEED_PROCESSOR_TIMEOUT); + } finally { + safeDeleteCollection(createdFeedCollection); + safeDeleteCollection(createdLeaseCollection); + safeClose(clientWithE2ETimeoutConfig); + + // Allow some time for the collections to be deleted before exiting. + Thread.sleep(500); + } + } + void validateChangeFeedProcessing(ChangeFeedProcessor changeFeedProcessor, List createdDocuments, Map receivedDocuments, int sleepTime) throws InterruptedException { try { changeFeedProcessor.start().subscribeOn(Schedulers.boundedElastic()) diff --git a/sdk/cosmos/azure-cosmos/CHANGELOG.md b/sdk/cosmos/azure-cosmos/CHANGELOG.md index 3f379dce23ef..4a3305504172 100644 --- a/sdk/cosmos/azure-cosmos/CHANGELOG.md +++ b/sdk/cosmos/azure-cosmos/CHANGELOG.md @@ -1,30 +1,46 @@ ## Release History -### 4.50.0-beta.1 (Unreleased) +### 4.51.0-beta.1 (Unreleased) #### Features Added +* Added a preview API to `ChangeFeedProcessorBuilder` to process an additional `ChangeFeedProcessorContext` for handling all versions and deletes changes. - See [PR 36715](https://github.com/Azure/azure-sdk-for-java/pull/36715) #### Breaking Changes #### Bugs Fixed +* Fixed an issue with the threshold based availability strategy, which could result in missing diagnostics and unnecessarily high tail latency - See [PR 36508](https://github.com/Azure/azure-sdk-for-java/pull/36508) and [PR 36786](https://github.com/Azure/azure-sdk-for-java/pull/36786). #### Other Changes -* Handling negative end-to-end timeouts provided more gracefully by throwing a `CosmsoException` (`OperationCancelledException`) instead of `IllegalArgumentException`. - See [PR 36507](https://github.com/Azure/azure-sdk-for-java/pull/36507) -* Reverted preserve ordering in bulk mode([PR 35892](https://github.com/Azure/azure-sdk-for-java/pull/35892)). See [PR 36638](https://github.com/Azure/azure-sdk-for-java/pull/36638) -### 4.49.0 (2023-08-21) +### 4.50.0 (2023-09-25) #### Features Added -* Added a flag for allowing customers to preserve ordering in bulk mode. See [PR 35892](https://github.com/Azure/azure-sdk-for-java/pull/35892) -* Added a flag to bypass integrated cache when dedicated gateway is used. See [PR 35865](https://github.com/Azure/azure-sdk-for-java/pull/35865) -* Added new aggressive retry timeouts for in-region calls. See [PR 35987](https://github.com/Azure/azure-sdk-for-java/pull/35987) +* Added throughput control support for `gateway mode`. See [PR 36687](https://github.com/Azure/azure-sdk-for-java/pull/36687) +* Added public API to change the initial micro batch size in `CosmosBulkExecutionOptions`. The micro batch size is dynamically adjusted based on throttling rate. By default, it starts with a relatively large micro batch size, which can result in a short spike of throttled requests at the beginning of a bulk execution - reducing the initial micro batch size - for example to 1 - will start with smaller batch size and then dynamically increase it without causing the initial short spike of throttled requests. See [PR 36910](https://github.com/Azure/azure-sdk-for-java/pull/36910) #### Bugs Fixed -* Wired `proactiveInit` into the diagnostics to track warmed up containers, proactive connection regions and aggressive warm up duration - See [PR 36111](https://github.com/Azure/azure-sdk-for-java/pull/36111) -* Fixed possible `NullPointerException` issue if health-check flow kicks in before RNTBD context negotiation for a given channel - See [PR 36397](https://github.com/Azure/azure-sdk-for-java/pull/36397). +* Disabled `CosmosEndToEndOperationLatencyPolicyConfig` feature in `ChangeFeedProcessor`. Setting `CosmosEndToEndOperationLatencyPolicyConfig` at `CosmosClient` level will not affect `ChangeFeedProcessor` requests in any way. See [PR 36775](https://github.com/Azure/azure-sdk-for-java/pull/36775) +* Fixed staleness issue of `COSMOS.MIN_CONNECTION_POOL_SIZE_PER_ENDPOINT` system property - See [PR 36599](https://github.com/Azure/azure-sdk-for-java/pull/36599). +* Fixed an issue where `pageSize` from `byPage` is not always being honored. This only happens when the same `CosmosQueryRequestOptions` being used through different requests, and different pageSize being used. See [PR 36847](https://github.com/Azure/azure-sdk-for-java/pull/36847) +* Fixed an issue where build of `CosmosClient` and `CosmosAsyncClient` was getting blocked for the entire aggressive warmup duration even when all the connections have been opened already. - See [PR 36889](https://github.com/Azure/azure-sdk-for-java/pull/36889) +* Fixed `CosmosClient` connection warm up bug to open connections aggressively. - See [PR 36889](https://github.com/Azure/azure-sdk-for-java/pull/36889) #### Other Changes -* Added coverage for `ChangeFeedProcessor` in `Latest Version` change feed mode to read change feed from a custom start time for multi-write accounts. - See[PR 36257](https://github.com/Azure/azure-sdk-for-java/pull/36257) +* Handling negative end-to-end timeouts provided more gracefully by throwing a `CosmsoException` (`OperationCancelledException`) instead of `IllegalArgumentException`. - See [PR 36507](https://github.com/Azure/azure-sdk-for-java/pull/36507) +* Reverted preserve ordering in bulk mode([PR 35892](https://github.com/Azure/azure-sdk-for-java/pull/35892)). See [PR 36638](https://github.com/Azure/azure-sdk-for-java/pull/36638) + +### 4.45.2-hotfix (2023-09-18) +> [!IMPORTANT] +> We strongly recommend our customers to upgrade directly to at least 4.48.2 or above if they have been using the 4.45.2-hotfix version of `azure-cosmos`. Versions 4.46.0 - 4.48.1 will miss important fixes that have been backported to 4.45.2-hotfix. +#### Bugs Fixed +* Added capability to mark a region as unavailable when a request is cancelled due to end-to-end timeout and connection issues + with the region in the direct connectivity mode. - See [PR 35586](https://github.com/Azure/azure-sdk-for-java/pull/35586) +* Fixed an issue where `ConnectionStateListener` tracked staled `Uris` which fails to mark the current `Uris` unhealthy properly - See [PR 36067](https://github.com/Azure/azure-sdk-for-java/pull/36067) +* Fixed an issue to update the last unhealthy timestamp for an `Uri` instance only when transitioning to `Unhealthy` from a different health status - See [36083](https://github.com/Azure/azure-sdk-for-java/pull/36083) +* Improved the channel health check flow to deem a channel unhealthy when it sees consecutive cancellations. - See [PR 36225](https://github.com/Azure/azure-sdk-for-java/pull/36225) +* Optimized the replica validation flow to validate replica health with `Unknown` health status only when the replica is + used by a container which is also part of the connection warm-up flow. - See [PR 36225](https://github.com/Azure/azure-sdk-for-java/pull/36225) +* Fixed possible `NullPointerException` issue if health-check flow kicks in before RNTBD context negotiation for a given channel - See [PR 36397](https://github.com/Azure/azure-sdk-for-java/pull/36397). ### 4.48.2 (2023-08-25) > [!IMPORTANT] @@ -35,6 +51,19 @@ #### Other Changes * Handling negative end-to-end timeouts provided more gracefully by throwing a `CosmosException` (`OperationCancelledException`) instead of `IllegalArgumentException`. - See [PR 36535](https://github.com/Azure/azure-sdk-for-java/pull/36535) +### 4.49.0 (2023-08-21) +#### Features Added +* Added a flag for allowing customers to preserve ordering in bulk mode. See [PR 35892](https://github.com/Azure/azure-sdk-for-java/pull/35892) +* Added a flag to bypass integrated cache when dedicated gateway is used. See [PR 35865](https://github.com/Azure/azure-sdk-for-java/pull/35865) +* Added new aggressive retry timeouts for in-region calls. See [PR 35987](https://github.com/Azure/azure-sdk-for-java/pull/35987) + +#### Bugs Fixed +* Wired `proactiveInit` into the diagnostics to track warmed up containers, proactive connection regions and aggressive warm up duration - See [PR 36111](https://github.com/Azure/azure-sdk-for-java/pull/36111) +* Fixed possible `NullPointerException` issue if health-check flow kicks in before RNTBD context negotiation for a given channel - See [PR 36397](https://github.com/Azure/azure-sdk-for-java/pull/36397). + +#### Other Changes +* Added coverage for `ChangeFeedProcessor` in `Latest Version` change feed mode to read change feed from a custom start time for multi-write accounts. - See[PR 36257](https://github.com/Azure/azure-sdk-for-java/pull/36257) + ### 4.48.1 (2023-08-09) #### Bugs Fixed * Fixed request start time in the `CosmosDiagnostics` for individual request responses - See [PR 35705](https://github.com/Azure/azure-sdk-for-java/pull/35705) @@ -49,7 +78,6 @@ used by a container which is also part of the connection warm-up flow. - See [PR 36225](https://github.com/Azure/azure-sdk-for-java/pull/36225) ### 4.48.0 (2023-07-18) - #### Bugs Fixed * Fixed an issue with deserialization of `conflictResolutionTimestamp` for All versions and deletes change feed mode. - See [PR 35909](https://github.com/Azure/azure-sdk-for-java/pull/35909) * Added capability to mark a region as unavailable when a request is cancelled due to end-to-end timeout and connection issues @@ -58,8 +86,11 @@ used by a container which is also part of the connection warm-up flow. - See [PR #### Other Changes * Added fault injection support for Gateway connection mode - See [PR 35378](https://github.com/Azure/azure-sdk-for-java/pull/35378) -### 4.47.0 (2023-06-26) +### 4.37.2-hotfix (2023-07-17) +#### Bugs Fixed +* Fixed an issue with deserialization of `conflictResolutionTimestamp` for All versions and deletes change feed mode. - See [PR 35912](https://github.com/Azure/azure-sdk-for-java/pull/35912) +### 4.47.0 (2023-06-26) #### Features Added * Added the capability to specify region switch hints through `CosmosClientBuilder#setSessionRetryOptions` for optimizing retries for `READ_SESSION_NOT_AVAILABLE` errors. - See [PR 35292](https://github.com/Azure/azure-sdk-for-java/pull/35292) * Added API to exclude regions on request options which helps avoid a regions from preferred regions for the request. - See [PR 35166](https://github.com/Azure/azure-sdk-for-java/pull/35166) @@ -71,7 +102,6 @@ used by a container which is also part of the connection warm-up flow. - See [PR there are non-existent document IDs also passed through the API - See [PR 35513](https://github.com/Azure/azure-sdk-for-java/pull/35513) ### 4.46.0 (2023-06-09) - #### Features Added * Added the capability to filter request-level metrics based on diagnostic thresholds. Request-level metrics usually are used to capture metrics per backend endpoint/replica - a high cardinality dimension. Filtering by diagnostic thresholds reduces the overhead - but also means request-level metrics can only be used for debugging purposes - not for monitoring purposes. So, it is important to use the unfiltered operation-level metrics for health monitoring in this case. - See [PR 35114](https://github.com/Azure/azure-sdk-for-java/pull/35114) * Added optional tags/dimensions for PartitionId/ReplicaId as alternative to ServiceAddress for direct-mode (rntbd) request-level metrics. - See [PR 35164](https://github.com/Azure/azure-sdk-for-java/pull/35164) @@ -92,13 +122,11 @@ there are non-existent document IDs also passed through the API - See [PR 35513] * Extending maximum retry delay in `SessionTokenMismatchRetryPolicy`. - See [PR 35360](https://github.com/Azure/azure-sdk-for-java/pull/35360) ### 4.45.1 (2023-05-19) - #### Bugs Fixed * Fixed an issue where status code & sub-status code `408/20008` will always be populated in the CosmosDiagnostics in case of `RNTBD` request failures - See [PR 34999](https://github.com/Azure/azure-sdk-for-java/pull/34999) * Fixed `readMany` API bug to enable swallowing of `404 Not Found` exceptions for 404/0 scenarios when `readMany` performs point-reads internally - See [PR 34966](https://github.com/Azure/azure-sdk-for-java/pull/34966) ### 4.45.0 (2023-05-12) - #### Features Added * Added support for priority based throttling - See [PR 34121](https://github.com/Azure/azure-sdk-for-java/pull/34121) * Added configurability for minimum connection pool size for all containers through a system property - `COSMOS.MIN_CONNECTION_POOL_SIZE_PER_ENDPOINT` - See [PR 33983](https://github.com/Azure/azure-sdk-for-java/pull/33983). @@ -121,13 +149,11 @@ there are non-existent document IDs also passed through the API - See [PR 35513] * Added support for threshold based speculative processing - See [PR 34686](https://github.com/Azure/azure-sdk-for-java/pull/34686) ### 4.44.0 (2023-04-21) - #### Bugs Fixed * Fixed an issue where throughput control is not triggered properly when target throughput is being used - See [PR 34393](https://github.com/Azure/azure-sdk-for-java/pull/34393) * Fixed an issue where `IllegalStateException` being thrown during replica validation - See [PR 34538](https://github.com/Azure/azure-sdk-for-java/pull/34538) ### 4.43.0 (2023-04-06) - #### Features Added * Added option to enable automatic retries for write operations - See [34227](https://github.com/Azure/azure-sdk-for-java/pull/34227) * Added option to enable automatic logging of Cosmos diagnostics for errors or requests exceeding latency threshold - See [33209](https://github.com/Azure/azure-sdk-for-java/pull/33209) @@ -137,7 +163,6 @@ there are non-existent document IDs also passed through the API - See [PR 35513] * Changed the default structure of Open Telemetry events being emitted by the SDK to follow the semantic profile for Cosmos DB. Use the `COSMOS.USE_LEGACY_TRACING` system property to retrun to the previous event structure: `-DCOSMOS.USE_LEGACY_TRACING=true` - See [33209](https://github.com/Azure/azure-sdk-for-java/pull/33209) ### 4.42.0 (2023-03-17) - #### Features Added * Added support for Move operation - See [PR 31078](https://github.com/Azure/azure-sdk-for-java/pull/31078) * GA of `subpartition` functionality in SDK - See [32501](https://github.com/Azure/azure-sdk-for-java/pull/32501) @@ -153,7 +178,6 @@ there are non-existent document IDs also passed through the API - See [PR 35513] * Added fault injection support - See [PR 33329](https://github.com/Azure/azure-sdk-for-java/pull/33329). ### 4.41.0 (2023-02-17) - #### Features Added * Added ability to configure proactive connection management via `CosmosClientBuilder.openConnectionsAndInitCaches(CosmosContainerProactiveInitConfig)`. - See [PR 33267](https://github.com/Azure/azure-sdk-for-java/pull/33267) * Added internal merge handling - See [PR 31428](https://github.com/Azure/azure-sdk-for-java/pull/31428). See [PR 32097](https://github.com/Azure/azure-sdk-for-java/pull/32097). See [PR 32078](https://github.com/Azure/azure-sdk-for-java/pull/32078). See [PR 32165](https://github.com/Azure/azure-sdk-for-java/pull/32165). See [32259](https://github.com/Azure/azure-sdk-for-java/pull/32259). See [32496](https://github.com/Azure/azure-sdk-for-java/pull/32496) @@ -188,7 +212,6 @@ there are non-existent document IDs also passed through the API - See [PR 35513] * Added cross region retries for data plane, query plan and metadata requests failed with http timeouts - See [PR 32450](https://github.com/Azure/azure-sdk-for-java/pull/32450) ### 4.39.0 (2022-11-16) - #### Bugs Fixed * Fixed a rare race condition for `query plan` cache exceeding the allowed size limit - See [PR 31859](https://github.com/Azure/azure-sdk-for-java/pull/31859) * Added improvement in `RntbdClientChannelHealthChecker` for detecting continuous transit timeout. - See [PR 31544](https://github.com/Azure/azure-sdk-for-java/pull/31544) diff --git a/sdk/cosmos/azure-cosmos/README.md b/sdk/cosmos/azure-cosmos/README.md index 62a028135115..2126055bd8eb 100644 --- a/sdk/cosmos/azure-cosmos/README.md +++ b/sdk/cosmos/azure-cosmos/README.md @@ -45,7 +45,7 @@ add the direct dependency to your project as follows. com.azure azure-cosmos - 4.49.0 + 4.50.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/cosmos/azure-cosmos/pom.xml b/sdk/cosmos/azure-cosmos/pom.xml index 9a3dd9bc9c56..0a8d14b44c71 100644 --- a/sdk/cosmos/azure-cosmos/pom.xml +++ b/sdk/cosmos/azure-cosmos/pom.xml @@ -13,7 +13,7 @@ Licensed under the MIT License. com.azure azure-cosmos - 4.50.0-beta.1 + 4.51.0-beta.1 Microsoft Azure SDK for SQL API of Azure Cosmos DB Service This Package contains Microsoft Azure Cosmos SDK (with Reactive Extension Reactor support) for Azure Cosmos DB SQL API jar diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/ChangeFeedProcessorBuilder.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/ChangeFeedProcessorBuilder.java index 5b65795038a6..2137915686d0 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/ChangeFeedProcessorBuilder.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/ChangeFeedProcessorBuilder.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.JsonNode; import java.util.List; +import java.util.function.BiConsumer; import java.util.function.Consumer; import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkArgument; @@ -54,6 +55,24 @@ * .buildChangeFeedProcessor(); * * + * + * Below is an example of building ChangeFeedProcessor for AllVersionsAndDeletes mode when also wishing to process a {@link ChangeFeedProcessorContext}. + * + *
    + * ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder()
    + *     .hostName(hostName)
    + *     .feedContainer(feedContainer)
    + *     .leaseContainer(leaseContainer)
    + *     .handleAllVersionsAndDeletesChanges((docs, context) -> {
    + *         for (ChangeFeedProcessorItem item : docs) {
    + *             // Implementation for handling and processing of each ChangeFeedProcessorItem item goes here
    + *         }
    + *         String leaseToken = context.getLeaseToken();
    + *         // Handling of the lease token corresponding to a batch of change feed processor item goes here
    + *     })
    + *     .buildChangeFeedProcessor();
    + * 
    + * */ public class ChangeFeedProcessorBuilder { private String hostName; @@ -63,6 +82,7 @@ public class ChangeFeedProcessorBuilder { private Consumer> incrementalModeLeaseConsumerPkRangeIdVersion; private Consumer> incrementalModeLeaseConsumerEpkVersion; private Consumer> fullFidelityModeLeaseConsumer; + private BiConsumer, ChangeFeedProcessorContext> fullFidelityModeLeaseWithContextConsumer; private ChangeFeedMode changeFeedMode = ChangeFeedMode.INCREMENTAL; private LeaseVersion leaseVersion = LeaseVersion.PARTITION_KEY_BASED_LEASE; @@ -183,12 +203,48 @@ public ChangeFeedProcessorBuilder handleLatestVersionChanges(Consumer> consumer) { + checkNotNull(consumer, "consumer cannot be null"); + checkArgument(this.fullFidelityModeLeaseWithContextConsumer == null, + "handleAllVersionsAndDeletesChanges biConsumer has already been defined."); + this.fullFidelityModeLeaseConsumer = consumer; this.changeFeedMode = ChangeFeedMode.FULL_FIDELITY; this.leaseVersion = LeaseVersion.EPK_RANGE_BASED_LEASE; return this; } + /** + * Sets a {@link BiConsumer} function which will be called to process changes for AllVersionsAndDeletes change feed mode. + * + * + *
    +     * .handleAllVersionsAndDeletesChanges((docs, context) -> {
    +     *     for (ChangeFeedProcessorItem item : docs) {
    +     *         // Implementation for handling and processing of each ChangeFeedProcessorItem item goes here
    +     *     }
    +     *     String leaseToken = context.getLeaseToken();
    +     *     // Handling of the lease token corresponding to a batch of change feed processor item goes here
    +     * })
    +     * 
    + * + * + * @param biConsumer the {@link BiConsumer} to call for handling the feeds and the {@link ChangeFeedProcessorContext} instance. + * @return current Builder. + */ + @Beta(value = Beta.SinceVersion.V4_51_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING) + public ChangeFeedProcessorBuilder handleAllVersionsAndDeletesChanges( + BiConsumer, ChangeFeedProcessorContext> biConsumer) { + + checkNotNull(biConsumer, "biConsumer cannot be null"); + checkArgument(this.fullFidelityModeLeaseConsumer == null, + "handleAllVersionsAndDeletesChanges consumer has already been defined."); + + this.fullFidelityModeLeaseWithContextConsumer = biConsumer; + this.changeFeedMode = ChangeFeedMode.FULL_FIDELITY; + this.leaseVersion = LeaseVersion.EPK_RANGE_BASED_LEASE; + return this; + } + /** * Sets the {@link ChangeFeedProcessorOptions} to be used. * Unless specifically set the default values that will be used are: @@ -225,12 +281,21 @@ public ChangeFeedProcessor buildChangeFeedProcessor() { if (this.leaseVersion == LeaseVersion.EPK_RANGE_BASED_LEASE) { switch (this.changeFeedMode) { case FULL_FIDELITY: - changeFeedProcessor = new FullFidelityChangeFeedProcessorImpl( + if (this.fullFidelityModeLeaseConsumer != null) { + changeFeedProcessor = new FullFidelityChangeFeedProcessorImpl( this.hostName, this.feedContainer, this.leaseContainer, this.fullFidelityModeLeaseConsumer, this.changeFeedProcessorOptions); + } else if (this.fullFidelityModeLeaseWithContextConsumer != null) { + changeFeedProcessor = new FullFidelityChangeFeedProcessorImpl( + this.hostName, + this.feedContainer, + this.leaseContainer, + this.fullFidelityModeLeaseWithContextConsumer, + this.changeFeedProcessorOptions); + } break; case INCREMENTAL: changeFeedProcessor = new com.azure.cosmos.implementation.changefeed.epkversion.IncrementalChangeFeedProcessorImpl( @@ -268,7 +333,7 @@ private void validateChangeFeedProcessorBuilder() { } private boolean isFullFidelityConsumerDefined() { - return this.fullFidelityModeLeaseConsumer != null; + return this.fullFidelityModeLeaseConsumer != null || this.fullFidelityModeLeaseWithContextConsumer != null; } private boolean isIncrementalConsumerDefined() { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/ChangeFeedProcessorContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/ChangeFeedProcessorContext.java new file mode 100644 index 000000000000..5aeb39eacf6e --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/ChangeFeedProcessorContext.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos; + +import com.azure.cosmos.util.Beta; + +import java.util.function.BiConsumer; + +/** + * Encapsulates properties which are mapped to a batch of change feed documents + * processed when {@link ChangeFeedProcessorBuilder#handleAllVersionsAndDeletesChanges(BiConsumer)} + * lambda is invoked. + *
    + *
    + * NOTE: This interface is not designed to be implemented by end users. + * */ +@Beta(value = Beta.SinceVersion.V4_51_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING) +public interface ChangeFeedProcessorContext { + /** + * Gets the lease token corresponding to the source of + * a batch of change feed documents. + * + * @return the lease token + * */ + @Beta(value = Beta.SinceVersion.V4_51_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING) + String getLeaseToken(); +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncClient.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncClient.java index 1cf61549740f..ec9f0053f86b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncClient.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncClient.java @@ -16,6 +16,7 @@ import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.Permission; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.RequestOptions; import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.Strings; @@ -62,7 +63,6 @@ import java.util.stream.Collectors; import static com.azure.core.util.FluxUtil.withContext; -import static com.azure.cosmos.implementation.Utils.setContinuationTokenAndMaxItemCount; import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; /** @@ -98,7 +98,6 @@ public final class CosmosAsyncClient implements Closeable { private final DiagnosticsProvider diagnosticsProvider; private final Tag clientCorrelationTag; private final String accountTagValue; - private final boolean clientMetricsEnabled; private final boolean isSendClientTelemetryToServiceEnabled; private final MeterRegistry clientMetricRegistrySnapshot; private final CosmosContainerProactiveInitConfig proactiveContainerInitConfig; @@ -191,7 +190,6 @@ public final class CosmosAsyncClient implements Closeable { this.clientMetricRegistrySnapshot = telemetryConfigAccessor .getClientMetricRegistry(effectiveTelemetryConfig); - this.clientMetricsEnabled = clientMetricRegistrySnapshot != null; CosmosMeterOptions cpuMeterOptions = telemetryConfigAccessor .getMeterOptions(effectiveTelemetryConfig, CosmosMetricName.SYSTEM_CPU); @@ -206,7 +204,7 @@ public final class CosmosAsyncClient implements Closeable { ".documents.azure.com", "" ); - if (this.clientMetricsEnabled) { + if (this.clientMetricRegistrySnapshot != null) { telemetryConfigAccessor.setClientCorrelationTag( effectiveTelemetryConfig, this.clientCorrelationTag ); @@ -462,22 +460,22 @@ CosmosPagedFlux readAllDatabases(CosmosQueryRequestOpt return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { String spanName = "readAllDatabases"; CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + this, spanName, null, null, - operationId, - OperationType.ReadFeed, ResourceType.Database, - this, - nonNullOptions.getConsistencyLevel(), - this.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); - return getDocClientWrapper().readDatabases(options) + OperationType.ReadFeed, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + + return getDocClientWrapper().readDatabases(state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosDatabasePropertiesFromV2Results(response.getResults()), @@ -616,7 +614,9 @@ void openConnectionsAndInitCaches(Duration aggressiveWarmupDuration) { // with a sink and block on the wrapping flux for the specified duration private Flux wrapSourceFluxAndSoftCompleteAfterTimeout(Flux source, Duration timeout) { return Flux.create(sink -> { - source.subscribe(t -> sink.next(t)); + source + .doFinally(signalType -> sink.complete()) + .subscribe(t -> sink.next(t)); }) .take(timeout); } @@ -637,22 +637,22 @@ private CosmosPagedFlux queryDatabasesInternal( return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { String spanName = "queryDatabases"; CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + this, spanName, null, null, - operationId, - OperationType.Query, ResourceType.Database, - this, - nonNullOptions.getConsistencyLevel(), - this.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); - return getDocClientWrapper().queryDatabases(querySpec, options) + OperationType.Query, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + + return getDocClientWrapper().queryDatabases(querySpec, state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosDatabasePropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -829,7 +829,7 @@ public EnumSet getMetricCategories(CosmosAsyncClient client) { @Override public boolean shouldEnableEmptyPageDiagnostics(CosmosAsyncClient client) { - return client.clientMetricsEnabled || client.isTransportLevelTracingEnabled(); + return client.clientMetricRegistrySnapshot != null || client.isTransportLevelTracingEnabled(); } @Override diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java index ee8efd6399cc..8e12aecbdf3c 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java @@ -4,6 +4,7 @@ import com.azure.core.util.Context; import com.azure.cosmos.implementation.AsyncDocumentClient; +import com.azure.cosmos.implementation.ChangeFeedOperationState; import com.azure.cosmos.implementation.Configs; import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.CosmosSchedulers; @@ -18,6 +19,7 @@ import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.PartitionKeyHelper; import com.azure.cosmos.implementation.Paths; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.RequestOptions; import com.azure.cosmos.implementation.ResourceResponse; import com.azure.cosmos.implementation.ResourceType; @@ -68,7 +70,6 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -79,8 +80,6 @@ import java.util.function.Function; import static com.azure.core.util.FluxUtil.withContext; -import static com.azure.cosmos.implementation.Utils.getEffectiveCosmosChangeFeedRequestOptions; -import static com.azure.cosmos.implementation.Utils.setContinuationTokenAndMaxItemCount; import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkArgument; import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; @@ -96,8 +95,6 @@ public class CosmosAsyncContainer { ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.getCosmosQueryRequestOptionsAccessor(); private static final ImplementationBridgeHelpers.CosmosItemRequestOptionsHelper.CosmosItemRequestOptionsAccessor itemOptionsAccessor = ImplementationBridgeHelpers.CosmosItemRequestOptionsHelper.getCosmosItemRequestOptionsAccessor(); - private static final ImplementationBridgeHelpers.CosmosChangeFeedRequestOptionsHelper.CosmosChangeFeedRequestOptionsAccessor cfOptionsAccessor = - ImplementationBridgeHelpers.CosmosChangeFeedRequestOptionsHelper.getCosmosChangeFeedRequestOptionsAccessor(); private static final ImplementationBridgeHelpers.FeedResponseHelper.FeedResponseAccessor feedResponseAccessor = ImplementationBridgeHelpers.FeedResponseHelper.getFeedResponseAccessor(); @@ -652,24 +649,23 @@ CosmosPagedFlux readAllItems(CosmosQueryRequestOptions options, Class queryOptionsAccessor.withEmptyPageDiagnosticsEnabled(nonNullOptions, true) : nonNullOptions; - queryOptionsAccessor.applyMaxItemCount(options, pagedFluxOptions); - - pagedFluxOptions.setTracerAndTelemetryInformation( + QueryFeedOperationState state = new QueryFeedOperationState( + client, this.readAllItemsSpanName, database.getId(), this.getId(), - OperationType.ReadFeed, ResourceType.Document, - client, + OperationType.ReadFeed, queryOptionsAccessor.getQueryNameOrDefault(requestOptions, this.readAllItemsSpanName), - requestOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(requestOptions))); + requestOptions, + pagedFluxOptions + ); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, requestOptions); + pagedFluxOptions.setFeedOperationState(state); return getDatabase() .getDocClientWrapper() - .readDocuments(getLink(), requestOptions, classType) + .readDocuments(getLink(), state, classType) .map(response -> prepareFeedResponse(response, false)); }); } @@ -947,37 +943,33 @@ CosmosPagedFlux queryItemsInternal( Function>> queryItemsInternalFunc( SqlQuerySpec sqlQuerySpec, CosmosQueryRequestOptions cosmosQueryRequestOptions, Class classType) { + CosmosAsyncClient client = this.getDatabase().getClient(); + CosmosQueryRequestOptions nonNullOptions = + cosmosQueryRequestOptions != null ? cosmosQueryRequestOptions : new CosmosQueryRequestOptions(); + CosmosQueryRequestOptions options = clientAccessor.shouldEnableEmptyPageDiagnostics(client) ? + queryOptionsAccessor.withEmptyPageDiagnosticsEnabled(nonNullOptions, true) + : nonNullOptions; + Function>> pagedFluxOptionsFluxFunction = (pagedFluxOptions -> { - CosmosAsyncClient client = this.getDatabase().getClient(); - CosmosQueryRequestOptions nonNullOptions = - cosmosQueryRequestOptions != null ? cosmosQueryRequestOptions : new CosmosQueryRequestOptions(); - CosmosQueryRequestOptions options = clientAccessor.shouldEnableEmptyPageDiagnostics(client) ? - queryOptionsAccessor.withEmptyPageDiagnosticsEnabled(nonNullOptions, true) - : nonNullOptions; String spanName = this.queryItemsSpanName; - queryOptionsAccessor.applyMaxItemCount(options, pagedFluxOptions); - - pagedFluxOptions.setTracerAndTelemetryInformation( + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, database.getId(), this.getId(), - OperationType.Query, ResourceType.Document, - client, + OperationType.Query, queryOptionsAccessor.getQueryNameOrDefault(options, spanName), - options.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(options))); + options, + pagedFluxOptions + ); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); - ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .setCancelledRequestDiagnosticsTracker(options, new ArrayList<>()); + pagedFluxOptions.setFeedOperationState(state); return getDatabase() .getDocClientWrapper() - .queryDocuments(CosmosAsyncContainer.this.getLink(), sqlQuerySpec, options, classType) + .queryDocuments(CosmosAsyncContainer.this.getLink(), sqlQuerySpec, state, classType) .map(response -> prepareFeedResponse(response, false)); }); @@ -994,22 +986,24 @@ Function>> queryItemsInternalFu queryOptionsAccessor.withEmptyPageDiagnosticsEnabled(nonNullOptions, true) : nonNullOptions; String spanName = this.queryItemsSpanName; - queryOptionsAccessor.applyMaxItemCount(options, pagedFluxOptions); - pagedFluxOptions.setTracerAndTelemetryInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, database.getId(), this.getId(), - OperationType.Query, ResourceType.Document, - client, + OperationType.Query, queryOptionsAccessor.getQueryNameOrDefault(options, spanName), - options.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(options))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); + options, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); return sqlQuerySpecMono.flux() .flatMap(sqlQuerySpec -> getDatabase().getDocClientWrapper() - .queryDocuments(CosmosAsyncContainer.this.getLink(), sqlQuerySpec, cosmosQueryRequestOptions, classType)) + .queryDocuments(CosmosAsyncContainer.this.getLink(), sqlQuerySpec, state, classType)) .map(response -> prepareFeedResponse(response, false)); }); @@ -1084,20 +1078,20 @@ Function>> queryChangeFeedInter CosmosAsyncClient client = this.getDatabase().getClient(); String spanName = this.queryChangeFeedSpanName; - cfOptionsAccessor.applyMaxItemCount(cosmosChangeFeedRequestOptions, pagedFluxOptions); - pagedFluxOptions.setTracerAndTelemetryInformation( + + ChangeFeedOperationState state = new ChangeFeedOperationState( + client, spanName, database.getId(), this.getId(), - OperationType.ReadFeed, ResourceType.Document, - client, + OperationType.ReadFeed, spanName, - null, - client.getEffectiveDiagnosticsThresholds( - cfOptionsAccessor.getDiagnosticsThresholds(cosmosChangeFeedRequestOptions))); + cosmosChangeFeedRequestOptions, + pagedFluxOptions + ); - getEffectiveCosmosChangeFeedRequestOptions(pagedFluxOptions, cosmosChangeFeedRequestOptions); + pagedFluxOptions.setFeedOperationState(state); final AsyncDocumentClient clientWrapper = this.database.getDocClientWrapper(); return clientWrapper @@ -1113,7 +1107,7 @@ Function>> queryChangeFeedInter } return clientWrapper - .queryDocumentChangeFeed(collection, cosmosChangeFeedRequestOptions, classType) + .queryDocumentChangeFeedFromPagedFlux(collection, state, classType) .map(response -> prepareFeedResponse(response, true)); }); }); @@ -1554,23 +1548,27 @@ public CosmosPagedFlux readAllItems( : options; requestOptions.setPartitionKey(partitionKey); + + return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { - queryOptionsAccessor.applyMaxItemCount(options, pagedFluxOptions); - pagedFluxOptions.setTracerAndTelemetryInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, this.readAllItemsOfLogicalPartitionSpanName, database.getId(), this.getId(), - OperationType.ReadFeed, ResourceType.Document, - this.getDatabase().getClient(), + OperationType.ReadFeed, queryOptionsAccessor.getQueryNameOrDefault(requestOptions, this.readAllItemsOfLogicalPartitionSpanName), - requestOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(options))); + requestOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, requestOptions); return getDatabase() .getDocClientWrapper() - .readAllDocuments(getLink(), partitionKey, requestOptions, classType) + .readAllDocuments(getLink(), partitionKey, state, classType) .map(response -> prepareFeedResponse(response, false)); }); } @@ -1886,24 +1884,25 @@ public CosmosAsyncScripts getScripts() { * obtained conflicts or an error. */ public CosmosPagedFlux readAllConflicts(CosmosQueryRequestOptions options) { - CosmosQueryRequestOptions requestOptions = options == null ? new CosmosQueryRequestOptions() : options; return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { CosmosAsyncClient client = this.getDatabase().getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, this.readAllConflictsSpanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, this.readAllConflictsSpanName, database.getId(), this.getId(), - operationId, - OperationType.ReadFeed, ResourceType.Conflict, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); + OperationType.ReadFeed, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, this.readAllConflictsSpanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, requestOptions); - return database.getDocClientWrapper().readConflicts(getLink(), requestOptions) + return database.getDocClientWrapper().readConflicts(getLink(), state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosConflictPropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -1953,18 +1952,22 @@ public CosmosPagedFlux queryConflicts(String query, Co return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { CosmosAsyncClient client = this.getDatabase().getClient(); String operationId = queryOptionsAccessor.getQueryNameOrDefault(requestOptions, this.queryConflictsSpanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, this.queryConflictsSpanName, database.getId(), this.getId(), - operationId, - OperationType.Query, ResourceType.Conflict, - client, - requestOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(requestOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, requestOptions); - return database.getDocClientWrapper().queryConflicts(getLink(), query, requestOptions) + OperationType.Query, + queryOptionsAccessor.getQueryNameOrDefault(requestOptions, this.queryConflictsSpanName), + requestOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + + return database.getDocClientWrapper().queryConflicts(getLink(), query, state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosConflictPropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -2409,11 +2412,24 @@ private Mono readThroughputInternal(Context context) { } private Mono readThroughputInternal(Mono responseMono) { + + QueryFeedOperationState state = new QueryFeedOperationState( + this.database.getClient(), + "readThroughputInternal", + this.database.getId(), + this.getId(), + ResourceType.Offer, + OperationType.Query, + null, + new CosmosQueryRequestOptions(), + new CosmosPagedFluxOptions() + ); + return responseMono .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()) - , new CosmosQueryRequestOptions()) + , state) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults().isEmpty()) { @@ -2463,11 +2479,24 @@ private Mono replaceThroughputInternal(ThroughputProperties private Mono replaceThroughputInternal(Mono responseMono, ThroughputProperties throughputProperties) { + + QueryFeedOperationState state = new QueryFeedOperationState( + this.database.getClient(), + "replaceThroughputInternal", + this.database.getId(), + this.getId(), + ResourceType.Offer, + OperationType.Query, + null, + new CosmosQueryRequestOptions(), + new CosmosPagedFluxOptions() + ); + return responseMono .flatMap(response -> this.database.getDocClientWrapper() .queryOffers(database.getOfferQuerySpecFromResourceId(response.getProperties() .getResourceId()) - , new CosmosQueryRequestOptions()) + , state) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults().isEmpty()) { @@ -2709,6 +2738,25 @@ public Mono> readMany( return cosmosAsyncContainer.readMany(itemIdentityList, requestOptions, classType); } + + @Override + public Function>> queryItemsInternalFunc( + CosmosAsyncContainer cosmosAsyncContainer, + SqlQuerySpec sqlQuerySpec, + CosmosQueryRequestOptions cosmosQueryRequestOptions, + Class classType) { + + return cosmosAsyncContainer.queryItemsInternalFunc(sqlQuerySpec, cosmosQueryRequestOptions, classType); + } + + @Override + public Function>> queryItemsInternalFuncWithMonoSqlQuerySpec( + CosmosAsyncContainer cosmosAsyncContainer, + Mono sqlQuerySpecMono, + CosmosQueryRequestOptions cosmosQueryRequestOptions, + Class classType) { + return cosmosAsyncContainer.queryItemsInternalFunc(sqlQuerySpecMono, cosmosQueryRequestOptions, classType); + } }); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncDatabase.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncDatabase.java index 8ad273a054a8..3ce76b08602f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncDatabase.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncDatabase.java @@ -4,12 +4,14 @@ import com.azure.core.util.Context; import com.azure.cosmos.implementation.AsyncDocumentClient; +import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.DiagnosticsProvider; import com.azure.cosmos.implementation.HttpConstants; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.Offer; import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.Paths; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.RequestOptions; import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; @@ -37,7 +39,6 @@ import java.util.List; import static com.azure.core.util.FluxUtil.withContext; -import static com.azure.cosmos.implementation.Utils.setContinuationTokenAndMaxItemCount; /** * Perform read and delete databases, update database throughput, and perform operations on child resources @@ -639,18 +640,22 @@ public CosmosPagedFlux readAllContainers(CosmosQueryR .CosmosQueryRequestOptionsHelper .getCosmosQueryRequestOptionsAccessor() .getQueryNameOrDefault(requestOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, getId(), null, - operationId, - OperationType.ReadFeed, ResourceType.DocumentCollection, - client, - requestOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(requestOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, requestOptions); - return getDocClientWrapper().readCollections(getLink(), requestOptions) + OperationType.ReadFeed, + queryOptionsAccessor.getQueryNameOrDefault(requestOptions, spanName), + requestOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + + return getDocClientWrapper().readCollections(getLink(), state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosContainerPropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -934,22 +939,22 @@ CosmosPagedFlux readAllUsers(CosmosQueryRequestOptions opt String spanName = "readAllUsers." + this.getId(); CosmosAsyncClient client = this.getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, getId(), null, - operationId, - OperationType.ReadFeed, ResourceType.User, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); - return getDocClientWrapper().readUsers(getLink(), options) + OperationType.ReadFeed, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + + return getDocClientWrapper().readUsers(getLink(), state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosUserPropertiesFromV2Results(response.getResults()), response .getResponseHeaders(), @@ -997,22 +1002,22 @@ public CosmosPagedFlux readAllClientEncrypt String spanName = "readAllClientEncryptionKeys." + this.getId(); CosmosAsyncClient client = this.getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, getId(), null, - operationId, - OperationType.ReadFeed, ResourceType.ClientEncryptionKey, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); - return getDocClientWrapper().readClientEncryptionKeys(getLink(), options) + OperationType.ReadFeed, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + + return getDocClientWrapper().readClientEncryptionKeys(getLink(), state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getClientEncryptionKeyPropertiesList(response.getResults()), response .getResponseHeaders(), @@ -1098,22 +1103,22 @@ private CosmosPagedFlux queryClientEncrypti String spanName = "queryClientEncryptionKeys." + this.getId(); CosmosAsyncClient client = this.getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, getId(), null, - operationId, - OperationType.Query, ResourceType.ClientEncryptionKey, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); - return getDocClientWrapper().queryClientEncryptionKeys(getLink(), querySpec, options) + OperationType.Query, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + + return getDocClientWrapper().queryClientEncryptionKeys(getLink(), querySpec, state) .map(response -> BridgeInternal.createFeedResponseWithQueryMetrics( ModelBridgeInternal.getClientEncryptionKeyPropertiesList(response.getResults()), response.getResponseHeaders(), @@ -1282,22 +1287,22 @@ private CosmosPagedFlux queryContainersInternal(SqlQu String spanName = "queryContainers." + this.getId(); CosmosAsyncClient client = this.getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, getId(), null, - operationId, - OperationType.Query, ResourceType.DocumentCollection, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); - return getDocClientWrapper().queryCollections(getLink(), querySpec, options) + OperationType.Query, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + + return getDocClientWrapper().queryCollections(getLink(), querySpec, state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosContainerPropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -1310,22 +1315,22 @@ private CosmosPagedFlux queryUsersInternal(SqlQuerySpec qu String spanName = "queryUsers." + this.getId(); CosmosAsyncClient client = this.getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, getId(), null, - operationId, - OperationType.Query, ResourceType.User, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); - return getDocClientWrapper().queryUsers(getLink(), querySpec, options) + OperationType.Query, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + + return getDocClientWrapper().queryUsers(getLink(), querySpec, state) .map(response -> BridgeInternal.createFeedResponseWithQueryMetrics( ModelBridgeInternal.getCosmosUserPropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -1520,10 +1525,23 @@ private Mono replaceThroughputInternal(ThroughputProperties } private Mono replaceThroughputInternal(Mono responseMono, ThroughputProperties throughputProperties) { + + QueryFeedOperationState state = new QueryFeedOperationState( + this.getClient(), + "replaceThroughputInternal", + this.getId(), + null, + ResourceType.Offer, + OperationType.Query, + null, + new CosmosQueryRequestOptions(), + new CosmosPagedFluxOptions() + ); + return responseMono .flatMap(response -> this.getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties().getResourceId()), - new CosmosQueryRequestOptions()) + state) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults().isEmpty()) { @@ -1551,7 +1569,8 @@ private Mono readThroughputInternal(Context context) { Context nestedContext = context.addData( DiagnosticsProvider.COSMOS_CALL_DEPTH, DiagnosticsProvider.COSMOS_CALL_DEPTH_VAL); - Mono responseMono = readThroughputInternal(this.readInternal(new CosmosDatabaseRequestOptions(), nestedContext)); + CosmosQueryRequestOptions qryOptions = new CosmosQueryRequestOptions(); + Mono responseMono = readThroughputInternal(this.readInternal(new CosmosDatabaseRequestOptions(), nestedContext), qryOptions); return this.client.getDiagnosticsProvider().traceEnabledCosmosResponsePublisher( responseMono, context, @@ -1562,14 +1581,30 @@ private Mono readThroughputInternal(Context context) { null, OperationType.Read, ResourceType.Offer, - null); + ImplementationBridgeHelpers + .CosmosQueryRequestOptionsHelper + .getCosmosQueryRequestOptionsAccessor() + .toRequestOptions(qryOptions)); } - private Mono readThroughputInternal(Mono responseMono) { + private Mono readThroughputInternal(Mono responseMono, CosmosQueryRequestOptions qryOptions) { + + QueryFeedOperationState state = new QueryFeedOperationState( + this.getClient(), + "readThroughputInternal", + this.getId(), + null, + ResourceType.Offer, + OperationType.Query, + null, + new CosmosQueryRequestOptions(), + new CosmosPagedFluxOptions() + ); + return responseMono .flatMap(response -> getDocClientWrapper() .queryOffers(getOfferQuerySpecFromResourceId(response.getProperties().getResourceId()), - new CosmosQueryRequestOptions()) + state) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults().isEmpty()) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncScripts.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncScripts.java index 806be4d2edb7..127de87f308f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncScripts.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncScripts.java @@ -5,6 +5,7 @@ import com.azure.core.util.Context; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.RequestOptions; import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.StoredProcedure; @@ -25,7 +26,6 @@ import reactor.core.publisher.Mono; import static com.azure.core.util.FluxUtil.withContext; -import static com.azure.cosmos.implementation.Utils.setContinuationTokenAndMaxItemCount; /** * The type Cosmos async scripts. This contains async methods to operate on cosmos scripts like UDFs, StoredProcedures @@ -121,24 +121,23 @@ CosmosPagedFlux readAllStoredProcedures(CosmosQ String spanName = "readAllStoredProcedures." + this.container.getId(); CosmosAsyncClient client = this.container.getDatabase().getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, this.container.getDatabase().getId(), this.container.getId(), - operationId, - OperationType.ReadFeed, ResourceType.StoredProcedure, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); + OperationType.ReadFeed, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); return database.getDocClientWrapper() - .readStoredProcedures(container.getLink(), options) + .readStoredProcedures(container.getLink(), state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosStoredProcedurePropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -255,23 +254,23 @@ CosmosPagedFlux readAllUserDefinedFunctions String spanName = "readAllUserDefinedFunctions." + this.container.getId(); CosmosAsyncClient client = this.container.getDatabase().getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, this.container.getDatabase().getId(), this.container.getId(), - operationId, - OperationType.ReadFeed, ResourceType.UserDefinedFunction, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); + OperationType.ReadFeed, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + return database.getDocClientWrapper() - .readUserDefinedFunctions(container.getLink(), options) + .readUserDefinedFunctions(container.getLink(), state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosUserDefinedFunctionPropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -387,23 +386,23 @@ CosmosPagedFlux readAllTriggers(CosmosQueryRequestOptio String spanName = "readAllTriggers." + this.container.getId(); CosmosAsyncClient client = this.container.getDatabase().getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, this.container.getDatabase().getId(), this.container.getId(), - operationId, - OperationType.ReadFeed, ResourceType.Trigger, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); + OperationType.ReadFeed, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + return database.getDocClientWrapper() - .readTriggers(container.getLink(), options) + .readTriggers(container.getLink(), state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosTriggerPropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -470,23 +469,23 @@ private CosmosPagedFlux queryStoredProceduresIn String spanName = "queryStoredProcedures." + this.container.getId(); CosmosAsyncClient client = this.container.getDatabase().getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, this.container.getDatabase().getId(), this.container.getId(), - operationId, - OperationType.Query, ResourceType.StoredProcedure, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); + OperationType.Query, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + return database.getDocClientWrapper() - .queryStoredProcedures(container.getLink(), querySpec, options) + .queryStoredProcedures(container.getLink(), querySpec, state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosStoredProcedurePropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -501,23 +500,23 @@ private CosmosPagedFlux queryUserDefinedFun String spanName = "queryUserDefinedFunctions." + this.container.getId(); CosmosAsyncClient client = this.container.getDatabase().getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, this.container.getDatabase().getId(), this.container.getId(), - operationId, - OperationType.Query, ResourceType.UserDefinedFunction, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); + OperationType.Query, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + return database.getDocClientWrapper() - .queryUserDefinedFunctions(container.getLink(), querySpec, options) + .queryUserDefinedFunctions(container.getLink(), querySpec, state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosUserDefinedFunctionPropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), @@ -539,23 +538,23 @@ private CosmosPagedFlux queryTriggersInternal( CosmosAsyncClient client = this.container.getDatabase().getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, this.container.getDatabase().getId(), this.container.getId(), - operationId, - OperationType.Query, ResourceType.Trigger, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); + OperationType.Query, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + return database.getDocClientWrapper() - .queryTriggers(container.getLink(), querySpec, options) + .queryTriggers(container.getLink(), querySpec, state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosTriggerPropertiesFromV2Results(response.getResults()), response.getResponseHeaders(), diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncUser.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncUser.java index 3bb06495dd60..45cf0f1ae331 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncUser.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncUser.java @@ -8,6 +8,7 @@ import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.Paths; import com.azure.cosmos.implementation.Permission; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.models.CosmosPermissionProperties; import com.azure.cosmos.models.CosmosPermissionRequestOptions; @@ -21,7 +22,6 @@ import reactor.core.publisher.Mono; import static com.azure.core.util.FluxUtil.withContext; -import static com.azure.cosmos.implementation.Utils.setContinuationTokenAndMaxItemCount; /** * The type Cosmos async user. @@ -160,23 +160,23 @@ CosmosPagedFlux readAllPermissions(CosmosQueryReques String spanName = "readAllPermissions." + this.getId(); CosmosAsyncClient client = this.getDatabase().getClient(); CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(nonNullOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, this.getDatabase().getId(), null, - operationId, - OperationType.ReadFeed, ResourceType.Permission, - client, - nonNullOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(nonNullOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, options); + OperationType.ReadFeed, + queryOptionsAccessor.getQueryNameOrDefault(nonNullOptions, spanName), + nonNullOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + return getDatabase().getDocClientWrapper() - .readPermissions(getLink(), options) + .readPermissions(getLink(), state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosPermissionPropertiesFromResults(response.getResults()), response.getResponseHeaders(), @@ -216,23 +216,23 @@ public CosmosPagedFlux queryPermissions(String query return UtilBridgeInternal.createCosmosPagedFlux(pagedFluxOptions -> { String spanName = "queryPermissions." + this.getId(); CosmosAsyncClient client = this.getDatabase().getClient(); - String operationId = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getQueryNameOrDefault(requestOptions, spanName); - pagedFluxOptions.setTracerInformation( + + QueryFeedOperationState state = new QueryFeedOperationState( + client, spanName, this.getDatabase().getId(), null, - operationId, - OperationType.Query, ResourceType.Permission, - client, - requestOptions.getConsistencyLevel(), - client.getEffectiveDiagnosticsThresholds(queryOptionsAccessor.getDiagnosticsThresholds(requestOptions))); - setContinuationTokenAndMaxItemCount(pagedFluxOptions, requestOptions); + OperationType.Query, + queryOptionsAccessor.getQueryNameOrDefault(requestOptions, spanName), + requestOptions, + pagedFluxOptions + ); + + pagedFluxOptions.setFeedOperationState(state); + return getDatabase().getDocClientWrapper() - .queryPermissions(getLink(), query, requestOptions) + .queryPermissions(getLink(), query, state) .map(response -> feedResponseAccessor.createFeedResponse( ModelBridgeInternal.getCosmosPermissionPropertiesFromResults(response.getResults()), response.getResponseHeaders(), diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosBridgeInternal.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosBridgeInternal.java index c417e81dfdd8..df52de106050 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosBridgeInternal.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosBridgeInternal.java @@ -5,17 +5,13 @@ import com.azure.cosmos.implementation.AsyncDocumentClient; import com.azure.cosmos.implementation.ConnectionPolicy; -import com.azure.cosmos.implementation.CosmosClientMetadataCachesSnapshot; import com.azure.cosmos.implementation.Strings; import com.azure.cosmos.implementation.Warning; import com.azure.cosmos.implementation.query.Transformer; import com.azure.cosmos.models.CosmosChangeFeedRequestOptions; -import com.azure.cosmos.models.CosmosQueryRequestOptions; -import com.azure.cosmos.models.SqlQuerySpec; import com.azure.cosmos.util.CosmosPagedFlux; import com.azure.cosmos.util.UtilBridgeInternal; import com.fasterxml.jackson.databind.JsonNode; -import reactor.core.publisher.Mono; import static com.azure.cosmos.implementation.Warning.INTERNAL_USE_ONLY_WARNING; @@ -133,28 +129,6 @@ public static CosmosException cosmosException(int statusCode, Exception innerExc return new CosmosException(statusCode, innerException); } - @Warning(value = INTERNAL_USE_ONLY_WARNING) - public static CosmosPagedFlux queryItemsInternal(CosmosAsyncContainer container, - SqlQuerySpec sqlQuerySpec, - CosmosQueryRequestOptions cosmosQueryRequestOptions, - Transformer transformer) { - return UtilBridgeInternal.createCosmosPagedFlux(transformer.transform(container.queryItemsInternalFunc( - sqlQuerySpec, - cosmosQueryRequestOptions, - JsonNode.class))); - } - - @Warning(value = INTERNAL_USE_ONLY_WARNING) - public static CosmosPagedFlux queryItemsInternal(CosmosAsyncContainer container, - Mono sqlQuerySpecMono, - CosmosQueryRequestOptions cosmosQueryRequestOptions, - Transformer transformer) { - return UtilBridgeInternal.createCosmosPagedFlux(transformer.transform(container.queryItemsInternalFunc( - sqlQuerySpecMono, - cosmosQueryRequestOptions, - JsonNode.class))); - } - @Warning(value = INTERNAL_USE_ONLY_WARNING) public static CosmosPagedFlux queryChangeFeedInternal( CosmosAsyncContainer container, diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClient.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClient.java index f3eb971f2c94..fbc9eccbb655 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClient.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClient.java @@ -5,7 +5,7 @@ import com.azure.core.annotation.ServiceClient; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; -import com.azure.cosmos.implementation.OpenConnectionResponse; +import com.azure.cosmos.models.CosmosContainerIdentity; import com.azure.cosmos.models.CosmosDatabaseProperties; import com.azure.cosmos.models.CosmosDatabaseRequestOptions; import com.azure.cosmos.models.CosmosDatabaseResponse; @@ -205,6 +205,14 @@ void openConnectionsAndInitCaches(Duration aggressiveWarmupDuration) { asyncClientWrapper.openConnectionsAndInitCaches(aggressiveWarmupDuration); } + void recordOpenConnectionsAndInitCachesCompleted(List cosmosContainerIdentities) { + this.asyncClientWrapper.recordOpenConnectionsAndInitCachesCompleted(cosmosContainerIdentities); + } + + void recordOpenConnectionsAndInitCachesStarted(List cosmosContainerIdentities) { + this.asyncClientWrapper.recordOpenConnectionsAndInitCachesStarted(cosmosContainerIdentities); + } + CosmosDatabaseResponse blockDatabaseResponse(Mono databaseMono) { try { return databaseMono.block(); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClientBuilder.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClientBuilder.java index 616ad0d6a837..10843d506f18 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClientBuilder.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClientBuilder.java @@ -1051,7 +1051,6 @@ CosmosAsyncClient buildAsyncClient(boolean logStartupInfo) { buildConnectionPolicy(); CosmosAsyncClient cosmosAsyncClient = new CosmosAsyncClient(this); if (proactiveContainerInitConfig != null) { - cosmosAsyncClient.recordOpenConnectionsAndInitCachesStarted(proactiveContainerInitConfig.getCosmosContainerIdentities()); Duration aggressiveWarmupDuration = proactiveContainerInitConfig @@ -1085,6 +1084,9 @@ public CosmosClient buildClient() { buildConnectionPolicy(); CosmosClient cosmosClient = new CosmosClient(this); if (proactiveContainerInitConfig != null) { + + cosmosClient.recordOpenConnectionsAndInitCachesStarted(proactiveContainerInitConfig.getCosmosContainerIdentities()); + Duration aggressiveWarmupDuration = proactiveContainerInitConfig .getAggressiveWarmupDuration(); if (aggressiveWarmupDuration != null) { @@ -1092,6 +1094,8 @@ public CosmosClient buildClient() { } else { cosmosClient.openConnectionsAndInitCaches(); } + + cosmosClient.recordOpenConnectionsAndInitCachesCompleted(proactiveContainerInitConfig.getCosmosContainerIdentities()); } logStartupInfo(stopwatch, cosmosClient.asyncClient()); return cosmosClient; @@ -1191,7 +1195,7 @@ private void logStartupInfo(StopWatch stopwatch, CosmosAsyncClient client) { DiagnosticsProvider provider = client.getDiagnosticsProvider(); if (provider != null) { - tracingCfg = provider.isEnabled() + ", " + provider.isRealTracer(); + tracingCfg = provider.getTraceConfigLog(); } // NOTE: if changing the logging below - do not log any confidential info like master key credentials etc. diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsContext.java index 9348a1fa779f..fc946c2ac957 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsContext.java @@ -81,6 +81,8 @@ public final class CosmosDiagnosticsContext { private ArrayList requestInfo = null; + private final Integer sequenceNumber; + CosmosDiagnosticsContext( String spanName, String accountName, @@ -95,7 +97,8 @@ public final class CosmosDiagnosticsContext { CosmosDiagnosticsThresholds thresholds, String trackingId, String connectionMode, - String userAgent) { + String userAgent, + Integer sequenceNumber) { checkNotNull(spanName, "Argument 'spanName' must not be null."); checkNotNull(accountName, "Argument 'accountName' must not be null."); @@ -124,6 +127,7 @@ public final class CosmosDiagnosticsContext { this.trackingId = trackingId; this.userAgent = userAgent; this.connectionMode = connectionMode; + this.sequenceNumber = sequenceNumber; } /** @@ -203,6 +207,16 @@ public String getOperationId() { return this.operationId; } + /** + * For feed operations the sequence number allows identifying the order of diagnostics. For each page produced + * in the page flux the sequence number will be incremented by 1. For point operations the sequence number + * is always null. + * @return null for point operations or the monotonically increasing sequence number of pages/diagnostics + */ + public Integer getSequenceNumber() { + return this.sequenceNumber; + } + /** * The effective consistency level of the operation * @return the effective consistency level of the operation @@ -254,11 +268,13 @@ public boolean isThresholdViolated() { } if (this.operationType.isPointOperation()) { - if (this.thresholds.getPointOperationLatencyThreshold().compareTo(this.duration) < 0) { + if (Duration.ZERO.equals(this.thresholds.getPointOperationLatencyThreshold()) + || this.thresholds.getPointOperationLatencyThreshold().compareTo(this.duration) < 0) { return true; } } else { - if (this.thresholds.getNonPointOperationLatencyThreshold().compareTo(this.duration) < 0) { + if (Duration.ZERO.equals(this.thresholds.getNonPointOperationLatencyThreshold()) + || this.thresholds.getNonPointOperationLatencyThreshold().compareTo(this.duration) < 0) { return true; } } @@ -276,6 +292,12 @@ void addDiagnostics(CosmosDiagnostics cosmosDiagnostics) { return; } + if (cosmosDiagnostics.getFeedResponseDiagnostics() != null && + !diagAccessor.isDiagnosticsCapturedInPagedFlux(cosmosDiagnostics).get()) { + + return; + } + synchronized (this.spanName) { if (this.samplingRateSnapshot != null) { diagAccessor.setSamplingRateSnapshot(cosmosDiagnostics, this.samplingRateSnapshot); @@ -472,28 +494,40 @@ public boolean isFailure() { } void startOperation() { - checkState( - this.startTime == null, - "Method 'startOperation' must not be called multiple times."); synchronized (this.spanName) { + checkState( + this.startTime == null, + "Method 'startOperation' must not be called multiple times."); this.startTime = Instant.now(); this.cachedRequestDiagnostics = null; } } - synchronized boolean endOperation(int statusCode, int subStatusCode, Integer actualItemCount, Throwable finalError) { + boolean endOperation(int statusCode, + int subStatusCode, + Integer actualItemCount, + Double requestCharge, + CosmosDiagnostics diagnostics, + Throwable finalError) { synchronized (this.spanName) { boolean hasCompletedOperation = this.isCompleted.compareAndSet(false, true); if (hasCompletedOperation) { - this.recordOperation(statusCode, subStatusCode, actualItemCount, finalError); + this.recordOperation( + statusCode, subStatusCode, actualItemCount, requestCharge, diagnostics, finalError); } return hasCompletedOperation; } } - synchronized void recordOperation(int statusCode, int subStatusCode, Integer actualItemCount, Throwable finalError) { + void recordOperation(int statusCode, + int subStatusCode, + Integer actualItemCount, + Double requestCharge, + CosmosDiagnostics diagnostics, + Throwable finalError) { + synchronized (this.spanName) { this.statusCode = statusCode; this.subStatusCode = subStatusCode; @@ -503,15 +537,31 @@ synchronized void recordOperation(int statusCode, int subStatusCode, Integer act this.actualItemCount.addAndGet(actualItemCount); } } - this.duration = Duration.between(this.startTime, Instant.now()); + + if (this.startTime != null) { + this.duration = Duration.between(this.startTime, Instant.now()); + } else { + this.duration = null; + } + + if (diagnostics != null) { + this.addDiagnostics(diagnostics); + } + + if (requestCharge != null) { + this.addRequestCharge(requestCharge.floatValue()); + } + this.cachedRequestDiagnostics = null; } } - synchronized void setSamplingRateSnapshot(double samplingRate) { - this.samplingRateSnapshot = samplingRate; - for (CosmosDiagnostics d : this.diagnostics) { - diagAccessor.setSamplingRateSnapshot(d, samplingRate); + void setSamplingRateSnapshot(double samplingRate) { + synchronized (this.spanName) { + this.samplingRateSnapshot = samplingRate; + for (CosmosDiagnostics d : this.diagnostics) { + diagAccessor.setSamplingRateSnapshot(d, samplingRate); + } } } @@ -532,6 +582,9 @@ String getRequestDiagnostics() { if (this.trackingId != null && !this.trackingId.isEmpty()) { ctxNode.put("trackingId", this.trackingId); } + if (this.sequenceNumber != null) { + ctxNode.put("sequenceNumber", this.sequenceNumber); + } ctxNode.put("consistency", this.consistencyLevel.toString()); ctxNode.put("status", this.statusCode); if (this.subStatusCode != 0) { @@ -663,7 +716,7 @@ private static void addRequestInfoForGatewayStatistics( private static void addRequestInfoForStoreResponses( ClientSideRequestStatistics requestStats, List requestInfo, - List storeResponses) { + Collection storeResponses) { for (ClientSideRequestStatistics.StoreResponseStatistics responseStats: storeResponses) { @@ -852,7 +905,8 @@ public CosmosDiagnosticsContext create(String spanName, String account, String e String operationId, ConsistencyLevel consistencyLevel, Integer maxItemCount, CosmosDiagnosticsThresholds thresholds, String trackingId, - String connectionMode, String userAgent) { + String connectionMode, String userAgent, + Integer sequenceNumber) { return new CosmosDiagnosticsContext( spanName, @@ -868,7 +922,8 @@ public CosmosDiagnosticsContext create(String spanName, String account, String e thresholds, trackingId, connectionMode, - userAgent); + userAgent, + sequenceNumber); } @Override @@ -886,23 +941,7 @@ public void startOperation(CosmosDiagnosticsContext ctx) { public void recordOperation(CosmosDiagnosticsContext ctx, int statusCode, int subStatusCode, Integer actualItemCount, Double requestCharge, CosmosDiagnostics diagnostics, Throwable finalError) { - validateAndRecordOperationResult(ctx, requestCharge, diagnostics); - ctx.recordOperation(statusCode, subStatusCode, actualItemCount, finalError); - } - - private void validateAndRecordOperationResult( - CosmosDiagnosticsContext ctx, - Double requestCharge, - CosmosDiagnostics diagnostics) { - - checkNotNull(ctx, "Argument 'ctx' must not be null."); - if (diagnostics != null) { - ctx.addDiagnostics(diagnostics); - } - - if (requestCharge != null) { - ctx.addRequestCharge(requestCharge.floatValue()); - } + ctx.recordOperation(statusCode, subStatusCode, actualItemCount, requestCharge, diagnostics, finalError); } @Override @@ -910,8 +949,7 @@ public boolean endOperation(CosmosDiagnosticsContext ctx, int statusCode, int su Integer actualItemCount, Double requestCharge, CosmosDiagnostics diagnostics, Throwable finalError) { - validateAndRecordOperationResult(ctx, requestCharge, diagnostics); - return ctx.endOperation(statusCode, subStatusCode, actualItemCount, finalError); + return ctx.endOperation(statusCode, subStatusCode, actualItemCount, requestCharge, diagnostics, finalError); } @Override diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/AsyncDocumentClient.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/AsyncDocumentClient.java index 64d40747dc4d..668c10c1fd19 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/AsyncDocumentClient.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/AsyncDocumentClient.java @@ -423,10 +423,10 @@ public AzureKeyCredential getCredential() { * The {@link Flux} will contain one or several feed response of the read databases. * In case of failure the {@link Flux} will error. * - * @param options the query request options. + * @param state the query operation state * @return a {@link Flux} containing one or several feed response pages of read databases or an error. */ - Flux> readDatabases(CosmosQueryRequestOptions options); + Flux> readDatabases(QueryFeedOperationState state); /** * Query for databases. @@ -436,10 +436,10 @@ public AzureKeyCredential getCredential() { * In case of failure the {@link Flux} will error. * * @param query the query. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of read databases or an error. */ - Flux> queryDatabases(String query, CosmosQueryRequestOptions options); + Flux> queryDatabases(String query, QueryFeedOperationState state); /** * Query for databases. @@ -449,10 +449,10 @@ public AzureKeyCredential getCredential() { * In case of failure the {@link Flux} will error. * * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained databases or an error. */ - Flux> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options); + Flux> queryDatabases(SqlQuerySpec querySpec, QueryFeedOperationState state); /** * Creates a document collection. @@ -516,10 +516,10 @@ Mono> createCollection(String databaseLink, * In case of failure the {@link Flux} will error. * * @param databaseLink the database link. - * @param options the query request options. + * @param state the query option state. * @return a {@link Flux} containing one or several feed response pages of the read collections or an error. */ - Flux> readCollections(String databaseLink, CosmosQueryRequestOptions options); + Flux> readCollections(String databaseLink, QueryFeedOperationState state); /** * Query for document collections in a database. @@ -530,10 +530,10 @@ Mono> createCollection(String databaseLink, * * @param databaseLink the database link. * @param query the query. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained collections or an error. */ - Flux> queryCollections(String databaseLink, String query, CosmosQueryRequestOptions options); + Flux> queryCollections(String databaseLink, String query, QueryFeedOperationState state); /** * Query for document collections in a database. @@ -544,10 +544,10 @@ Mono> createCollection(String databaseLink, * * @param databaseLink the database link. * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained collections or an error. */ - Flux> queryCollections(String databaseLink, SqlQuerySpec querySpec, CosmosQueryRequestOptions options); + Flux> queryCollections(String databaseLink, SqlQuerySpec querySpec, QueryFeedOperationState state); /** * Creates a document. @@ -671,12 +671,12 @@ Mono> upsertDocument(String collectionLink, Object do * In case of failure the {@link Flux} will error. * * @param collectionLink the collection link. - * @param options the query request options. + * @param state the query operation state. * @param the type parameter * @return a {@link Flux} containing one or several feed response pages of the read documents or an error. */ Flux> readDocuments( - String collectionLink, CosmosQueryRequestOptions options, Class classOfT); + String collectionLink, QueryFeedOperationState state, Class classOfT); /** @@ -688,12 +688,12 @@ Flux> readDocuments( * * @param collectionLink the link to the parent document collection. * @param query the query. - * @param options the query request options. + * @param state the query operation state. * @param the type parameter * @return a {@link Flux} containing one or several feed response pages of the obtained document or an error. */ Flux> queryDocuments( - String collectionLink, String query, CosmosQueryRequestOptions options, Class classOfT); + String collectionLink, String query, QueryFeedOperationState state, Class classOfT); /** * Query for documents in a document collection. @@ -704,12 +704,12 @@ Flux> queryDocuments( * * @param collectionLink the link to the parent document collection. * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state. * @param the type parameter * @return a {@link Flux} containing one or several feed response pages of the obtained documents or an error. */ Flux> queryDocuments( - String collectionLink, SqlQuerySpec querySpec, CosmosQueryRequestOptions options, Class classOfT); + String collectionLink, SqlQuerySpec querySpec, QueryFeedOperationState state, Class classOfT); /** * Query for documents change feed in a document collection. @@ -727,6 +727,22 @@ Flux> queryDocumentChangeFeed( CosmosChangeFeedRequestOptions requestOptions, Class classOfT); + /** + * Query for documents change feed in a document collection. + * After subscription the operation will be performed. + * The {@link Flux} will contain one or several feed response pages of the obtained documents. + * In case of failure the {@link Flux} will error. + * + * @param collection the parent document collection. + * @param state the change feed operation state. + * @param the type parameter + * @return a {@link Flux} containing one or several feed response pages of the obtained documents or an error. + */ + Flux> queryDocumentChangeFeedFromPagedFlux( + DocumentCollection collection, + ChangeFeedOperationState state, + Class classOfT); + /** * Reads all partition key ranges in a document collection. * After subscription the operation will be performed. @@ -734,9 +750,10 @@ Flux> queryDocumentChangeFeed( * In case of failure the {@link Flux} will error. * * @param collectionLink the link to the parent document collection. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained partition key ranges or an error. */ + Flux> readPartitionKeyRanges(String collectionLink, QueryFeedOperationState state); Flux> readPartitionKeyRanges(String collectionLink, CosmosQueryRequestOptions options); /** @@ -809,10 +826,10 @@ Mono> createStoredProcedure(String collectionL * In case of failure the {@link Flux} will error. * * @param collectionLink the collection link. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the read stored procedures or an error. */ - Flux> readStoredProcedures(String collectionLink, CosmosQueryRequestOptions options); + Flux> readStoredProcedures(String collectionLink, QueryFeedOperationState state); /** * Query for stored procedures in a document collection. @@ -823,10 +840,10 @@ Mono> createStoredProcedure(String collectionL * * @param collectionLink the collection link. * @param query the query. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained stored procedures or an error. */ - Flux> queryStoredProcedures(String collectionLink, String query, CosmosQueryRequestOptions options); + Flux> queryStoredProcedures(String collectionLink, String query, QueryFeedOperationState state); /** * Query for stored procedures in a document collection. @@ -837,11 +854,11 @@ Mono> createStoredProcedure(String collectionL * * @param collectionLink the collection link. * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained stored procedures or an error. */ Flux> queryStoredProcedures(String collectionLink, SqlQuerySpec querySpec, - CosmosQueryRequestOptions options); + QueryFeedOperationState state); /** * Executes a stored procedure @@ -937,10 +954,10 @@ Mono executeBatchRequest(String collectionLink, * In case of failure the {@link Flux} will error. * * @param collectionLink the collection link. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the read triggers or an error. */ - Flux> readTriggers(String collectionLink, CosmosQueryRequestOptions options); + Flux> readTriggers(String collectionLink, QueryFeedOperationState state); /** * Query for triggers. @@ -951,10 +968,10 @@ Mono executeBatchRequest(String collectionLink, * * @param collectionLink the collection link. * @param query the query. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained triggers or an error. */ - Flux> queryTriggers(String collectionLink, String query, CosmosQueryRequestOptions options); + Flux> queryTriggers(String collectionLink, String query, QueryFeedOperationState state); /** * Query for triggers. @@ -965,10 +982,10 @@ Mono executeBatchRequest(String collectionLink, * * @param collectionLink the collection link. * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained triggers or an error. */ - Flux> queryTriggers(String collectionLink, SqlQuerySpec querySpec, CosmosQueryRequestOptions options); + Flux> queryTriggers(String collectionLink, SqlQuerySpec querySpec, QueryFeedOperationState state); /** * Creates a user defined function. @@ -1032,10 +1049,10 @@ Mono> createUserDefinedFunction(String col * In case of failure the {@link Flux} will error. * * @param collectionLink the collection link. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the read user defined functions or an error. */ - Flux> readUserDefinedFunctions(String collectionLink, CosmosQueryRequestOptions options); + Flux> readUserDefinedFunctions(String collectionLink, QueryFeedOperationState state); /** * Query for user defined functions. @@ -1046,11 +1063,11 @@ Mono> createUserDefinedFunction(String col * * @param collectionLink the collection link. * @param query the query. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained user defined functions or an error. */ Flux> queryUserDefinedFunctions(String collectionLink, String query, - CosmosQueryRequestOptions options); + QueryFeedOperationState state); /** * Query for user defined functions. @@ -1061,11 +1078,11 @@ Flux> queryUserDefinedFunctions(String collect * * @param collectionLink the collection link. * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained user defined functions or an error. */ Flux> queryUserDefinedFunctions(String collectionLink, SqlQuerySpec querySpec, - CosmosQueryRequestOptions options); + QueryFeedOperationState state); /** * Reads a conflict. @@ -1088,10 +1105,10 @@ Flux> queryUserDefinedFunctions(String collect * In case of failure the {@link Flux} will error. * * @param collectionLink the collection link. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the read conflicts or an error. */ - Flux> readConflicts(String collectionLink, CosmosQueryRequestOptions options); + Flux> readConflicts(String collectionLink, QueryFeedOperationState state); /** * Query for conflicts. @@ -1101,11 +1118,11 @@ Flux> queryUserDefinedFunctions(String collect * In case of failure the {@link Flux} will error. * * @param collectionLink the collection link. - * @param query the query. - * @param options the query request options. + * @param query the query statement. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained conflicts or an error. */ - Flux> queryConflicts(String collectionLink, String query, CosmosQueryRequestOptions options); + Flux> queryConflicts(String collectionLink, String query, QueryFeedOperationState state); /** * Query for conflicts. @@ -1116,10 +1133,10 @@ Flux> queryUserDefinedFunctions(String collect * * @param collectionLink the collection link. * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained conflicts or an error. */ - Flux> queryConflicts(String collectionLink, SqlQuerySpec querySpec, CosmosQueryRequestOptions options); + Flux> queryConflicts(String collectionLink, SqlQuerySpec querySpec, QueryFeedOperationState state); /** * Deletes a conflict. @@ -1209,10 +1226,10 @@ Flux> queryUserDefinedFunctions(String collect * In case of failure the {@link Flux} will error. * * @param databaseLink the database link. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the read users or an error. */ - Flux> readUsers(String databaseLink, CosmosQueryRequestOptions options); + Flux> readUsers(String databaseLink, QueryFeedOperationState state); /** * Query for users. @@ -1223,10 +1240,10 @@ Flux> queryUserDefinedFunctions(String collect * * @param databaseLink the database link. * @param query the query. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained users or an error. */ - Flux> queryUsers(String databaseLink, String query, CosmosQueryRequestOptions options); + Flux> queryUsers(String databaseLink, String query, QueryFeedOperationState state); /** * Query for users. @@ -1237,10 +1254,10 @@ Flux> queryUserDefinedFunctions(String collect * * @param databaseLink the database link. * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained users or an error. */ - Flux> queryUsers(String databaseLink, SqlQuerySpec querySpec, CosmosQueryRequestOptions options); + Flux> queryUsers(String databaseLink, SqlQuerySpec querySpec, QueryFeedOperationState state); /** * Reads a client encryption key. @@ -1290,10 +1307,10 @@ Flux> queryUserDefinedFunctions(String collect * In case of failure the {@link Flux} will error. * * @param databaseLink the database link. - * @param options the query request options. + * @param state the query option state. * @return a {@link Flux} containing one or several feed response pages of the read client encryption keys or an error. */ - Flux> readClientEncryptionKeys(String databaseLink, CosmosQueryRequestOptions options); + Flux> readClientEncryptionKeys(String databaseLink, QueryFeedOperationState state); /** * Query for client encryption keys. @@ -1304,10 +1321,10 @@ Flux> queryUserDefinedFunctions(String collect * * @param databaseLink the database link. * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state * @return a {@link Flux} containing one or several feed response pages of the obtained client encryption keys or an error. */ - Flux> queryClientEncryptionKeys(String databaseLink, SqlQuerySpec querySpec, CosmosQueryRequestOptions options); + Flux> queryClientEncryptionKeys(String databaseLink, SqlQuerySpec querySpec, QueryFeedOperationState state); /** * Creates a permission. @@ -1384,10 +1401,10 @@ Flux> queryUserDefinedFunctions(String collect * In case of failure the {@link Flux} will error. * * @param permissionLink the permission link. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the read permissions or an error. */ - Flux> readPermissions(String permissionLink, CosmosQueryRequestOptions options); + Flux> readPermissions(String permissionLink, QueryFeedOperationState state); /** * Query for permissions. @@ -1398,10 +1415,10 @@ Flux> queryUserDefinedFunctions(String collect * * @param permissionLink the permission link. * @param query the query. - * @param options the query request options. + * @param state the query operation state * @return a {@link Flux} containing one or several feed response pages of the obtained permissions or an error. */ - Flux> queryPermissions(String permissionLink, String query, CosmosQueryRequestOptions options); + Flux> queryPermissions(String permissionLink, String query, QueryFeedOperationState state); /** * Query for permissions. @@ -1412,10 +1429,10 @@ Flux> queryUserDefinedFunctions(String collect * * @param permissionLink the permission link. * @param querySpec the SQL query specification. - * @param options the query request options. + * @param state the query operation state * @return a {@link Flux} containing one or several feed response pages of the obtained permissions or an error. */ - Flux> queryPermissions(String permissionLink, SqlQuerySpec querySpec, CosmosQueryRequestOptions options); + Flux> queryPermissions(String permissionLink, SqlQuerySpec querySpec, QueryFeedOperationState state); /** * Replaces an offer. @@ -1448,10 +1465,10 @@ Flux> queryUserDefinedFunctions(String collect * The {@link Flux} will contain one or several feed response pages of the read offers. * In case of failure the {@link Flux} will error. * - * @param options the query request options. + * @param state the query operation request. * @return a {@link Flux} containing one or several feed response pages of the read offers or an error. */ - Flux> readOffers(CosmosQueryRequestOptions options); + Flux> readOffers(QueryFeedOperationState state); /** * Query for offers in a database. @@ -1461,10 +1478,10 @@ Flux> queryUserDefinedFunctions(String collect * In case of failure the {@link Flux} will error. * * @param query the query. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained offers or an error. */ - Flux> queryOffers(String query, CosmosQueryRequestOptions options); + Flux> queryOffers(String query, QueryFeedOperationState state); /** * Query for offers in a database. @@ -1474,10 +1491,10 @@ Flux> queryUserDefinedFunctions(String collect * In case of failure the {@link Flux} will error. * * @param querySpec the query specification. - * @param options the query request options. + * @param state the query operation state. * @return a {@link Flux} containing one or several feed response pages of the obtained offers or an error. */ - Flux> queryOffers(SqlQuerySpec querySpec, CosmosQueryRequestOptions options); + Flux> queryOffers(SqlQuerySpec querySpec, QueryFeedOperationState state); /** * Gets database account information. @@ -1513,14 +1530,14 @@ Mono> readMany( * * @param collectionLink the link to the parent document collection. * @param partitionKey the logical partition key. - * @param options the query request options. + * @param state the query operation state. * @param the type parameter * @return a {@link Flux} containing one or several feed response pages of the obtained documents or an error. */ Flux> readAllDocuments( String collectionLink, PartitionKey partitionKey, - CosmosQueryRequestOptions options, + QueryFeedOperationState state, Class classOfT ); @@ -1599,4 +1616,6 @@ Flux> readAllDocuments( * @param cosmosContainerIdentities the {@link CosmosContainerIdentity} list. */ void recordOpenConnectionsAndInitCachesStarted(List cosmosContainerIdentities); + + public String getMasterKeyOrResourceToken(); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ChangeFeedOperationState.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ChangeFeedOperationState.java new file mode 100644 index 000000000000..fc616a2b8886 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ChangeFeedOperationState.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.implementation; + +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.models.CosmosChangeFeedRequestOptions; +import com.azure.cosmos.models.ModelBridgeInternal; + +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + +public class ChangeFeedOperationState extends FeedOperationState { + private static final ImplementationBridgeHelpers + .CosmosChangeFeedRequestOptionsHelper + .CosmosChangeFeedRequestOptionsAccessor cfOptAccessor = ImplementationBridgeHelpers + .CosmosChangeFeedRequestOptionsHelper + .getCosmosChangeFeedRequestOptionsAccessor(); + + private final CosmosChangeFeedRequestOptions options; + + public ChangeFeedOperationState( + CosmosAsyncClient cosmosAsyncClient, + String spanName, + String dbName, + String containerName, + ResourceType resourceType, + OperationType operationType, + String operationId, + CosmosChangeFeedRequestOptions changeFeedRequestOptions, + CosmosPagedFluxOptions fluxOptions + ) { + super( + cosmosAsyncClient, + spanName, + dbName, + containerName, + resourceType, + checkNotNull(operationType, "Argument 'operationType' must not be null."), + operationId, + clientAccessor.getEffectiveConsistencyLevel( + cosmosAsyncClient, + operationType, + null), + clientAccessor.getEffectiveDiagnosticsThresholds( + cosmosAsyncClient, + cfOptAccessor.getDiagnosticsThresholds( + checkNotNull(changeFeedRequestOptions, "Argument 'changeFeedRequestOptions' must not be null."))), + fluxOptions, + getEffectiveMaxItemCount(fluxOptions, changeFeedRequestOptions) + ); + + this.options = ModelBridgeInternal + .getEffectiveChangeFeedRequestOptions( + changeFeedRequestOptions, fluxOptions); + } + + public CosmosChangeFeedRequestOptions getChangeFeedOptions() { + return this.options; + } + + @Override + public void setRequestContinuation(String requestContinuation) { + super.setRequestContinuation(requestContinuation); + + if (this.options != null) { + ModelBridgeInternal.setChangeFeedRequestOptionsContinuation( + requestContinuation, + this.options + ); + } + } + + @Override + public void setMaxItemCount(Integer maxItemCount) { + super.setMaxItemCount(maxItemCount); + + if (this.options != null) { + this.options.setMaxItemCount(maxItemCount); + } + } + + private static Integer getEffectiveMaxItemCount( + CosmosPagedFluxOptions pagedFluxOptions, + CosmosChangeFeedRequestOptions changeFeedOptions) { + + if (pagedFluxOptions != null && pagedFluxOptions.getMaxItemCount() != null) { + return pagedFluxOptions.getMaxItemCount(); + } + + if (changeFeedOptions == null) { + return null; + } + + return changeFeedOptions.getMaxItemCount(); + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ClientSideRequestStatistics.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ClientSideRequestStatistics.java index 648cd3e93ec0..8ff16265828a 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ClientSideRequestStatistics.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ClientSideRequestStatistics.java @@ -19,6 +19,7 @@ import java.time.Duration; import java.time.Instant; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -28,14 +29,16 @@ import java.util.Objects; import java.util.Set; import java.util.UUID; +import java.util.concurrent.ConcurrentLinkedDeque; +import java.util.stream.Collectors; @JsonSerialize(using = ClientSideRequestStatistics.ClientSideRequestStatisticsSerializer.class) public class ClientSideRequestStatistics { private static final int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final DiagnosticsClientContext.DiagnosticsClientConfig diagnosticsClientConfig; private String activityId; - private List responseStatisticsList; - private List supplementalResponseStatisticsList; + private Collection responseStatisticsList; + private Collection supplementalResponseStatisticsList; private Map addressResolutionStatistics; private List contactedReplicas; @@ -58,8 +61,8 @@ public ClientSideRequestStatistics(DiagnosticsClientContext diagnosticsClientCon this.diagnosticsClientConfig = diagnosticsClientContext.getConfig(); this.requestStartTimeUTC = Instant.now(); this.requestEndTimeUTC = Instant.now(); - this.responseStatisticsList = new ArrayList<>(); - this.supplementalResponseStatisticsList = new ArrayList<>(); + this.responseStatisticsList = new ConcurrentLinkedDeque<>(); + this.supplementalResponseStatisticsList = new ConcurrentLinkedDeque<>(); this.gatewayStatisticsList = new ArrayList<>(); this.addressResolutionStatistics = new HashMap<>(); this.contactedReplicas = Collections.synchronizedList(new ArrayList<>()); @@ -217,7 +220,8 @@ public void recordGatewayResponse( gatewayStatistics.faultInjectionRuleId = storeResponseDiagnostics.getFaultInjectionRuleId(); gatewayStatistics.faultInjectionEvaluationResults = storeResponseDiagnostics.getFaultInjectionEvaluationResults(); - this.activityId = storeResponseDiagnostics.getActivityId(); + this.activityId = storeResponseDiagnostics.getActivityId() != null ? storeResponseDiagnostics.getActivityId() : + rxDocumentServiceRequest.getActivityId().toString(); this.gatewayStatisticsList.add(gatewayStatistics); } @@ -295,7 +299,8 @@ private void mergeContactedReplicas(List otherContactedReplicas) { this.setContactedReplicas(new ArrayList<>(totalContactedReplicas)); } - private void mergeSupplementalResponses(List other) { + // Called under lock + private void mergeSupplementalResponses(Collection other) { if (other == null) { return; } @@ -308,7 +313,8 @@ private void mergeSupplementalResponses(List other) { this.supplementalResponseStatisticsList.addAll(other); } - private void mergeResponseStatistics(List other) { + // Called under lock + private void mergeResponseStatistics(Collection other) { if (other == null) { return; } @@ -318,8 +324,9 @@ private void mergeResponseStatistics(List other) { return; } - this.responseStatisticsList.addAll(other); - this.responseStatisticsList.sort( + ArrayList temp = new ArrayList<>(this.responseStatisticsList); + temp.addAll(other); + temp.sort( (StoreResponseStatistics left, StoreResponseStatistics right) -> { if (left == null || left.requestStartTimeUTC == null) { return -1; @@ -331,6 +338,7 @@ private void mergeResponseStatistics(List other) { return left.requestStartTimeUTC.compareTo(right.requestStartTimeUTC); } ); + this.responseStatisticsList = new ConcurrentLinkedDeque<>(temp); } private void mergeAddressResolutionStatistics( @@ -431,6 +439,7 @@ public void recordContributingPointOperation(ClientSideRequestStatistics other) this.mergeClientSideRequestStatistics(other); } + // Called under lock public void mergeClientSideRequestStatistics(ClientSideRequestStatistics other) { if (other == null) { return; @@ -502,7 +511,7 @@ public RetryContext getRetryContext() { return retryContext; } - public List getResponseStatisticsList() { + public Collection getResponseStatisticsList() { return responseStatisticsList; } @@ -545,7 +554,7 @@ private int getMaxResponsePayloadSizeInBytesFromGateway() { return maxResponsePayloadSizeInBytes; } - public List getSupplementalResponseStatisticsList() { + public Collection getSupplementalResponseStatisticsList() { return supplementalResponseStatisticsList; } @@ -673,15 +682,16 @@ public void serialize( } } - public static List getCappedSupplementalResponseStatisticsList(List supplementalResponseStatisticsList) { + public static Collection getCappedSupplementalResponseStatisticsList(Collection supplementalResponseStatisticsList) { int supplementalResponseStatisticsListCount = supplementalResponseStatisticsList.size(); int initialIndex = Math.max(supplementalResponseStatisticsListCount - MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING, 0); if (initialIndex != 0) { - List subList = supplementalResponseStatisticsList - .subList(initialIndex, - supplementalResponseStatisticsListCount); - return subList; + return supplementalResponseStatisticsList + .stream() + .skip(initialIndex) + .limit(supplementalResponseStatisticsListCount) + .collect(Collectors.toCollection(ConcurrentLinkedDeque::new)); } return supplementalResponseStatisticsList; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ConnectionPolicy.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ConnectionPolicy.java index f42ad853289d..7d81799968d0 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ConnectionPolicy.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ConnectionPolicy.java @@ -96,11 +96,14 @@ private ConnectionPolicy( .DirectConnectionConfigHelper .getDirectConnectionConfigAccessor() .isHealthCheckTimeoutDetectionEnabled(directConnectionConfig); + + // NOTE: should be compared with COSMOS.MIN_CONNECTION_POOL_SIZE_PER_ENDPOINT + // read during client initialization before connections are created for the container this.minConnectionPoolSizePerEndpoint = - ImplementationBridgeHelpers - .DirectConnectionConfigHelper - .getDirectConnectionConfigAccessor() - .getMinConnectionPoolSizePerEndpoint(directConnectionConfig); + Math.max(ImplementationBridgeHelpers + .DirectConnectionConfigHelper + .getDirectConnectionConfigAccessor() + .getMinConnectionPoolSizePerEndpoint(directConnectionConfig), Configs.getMinConnectionPoolSizePerEndpoint()); } private ConnectionPolicy() { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosPagedFluxOptions.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosPagedFluxOptions.java index 80e318a23935..ed2b848c0994 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosPagedFluxOptions.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosPagedFluxOptions.java @@ -3,9 +3,6 @@ package com.azure.cosmos.implementation; -import com.azure.cosmos.ConsistencyLevel; -import com.azure.cosmos.CosmosAsyncClient; -import com.azure.cosmos.CosmosDiagnosticsThresholds; import com.azure.cosmos.util.CosmosPagedFlux; import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; @@ -15,48 +12,17 @@ * @see CosmosPagedFlux */ public class CosmosPagedFluxOptions { - private static final ImplementationBridgeHelpers.CosmosAsyncClientHelper.CosmosAsyncClientAccessor clientAccessor = - ImplementationBridgeHelpers.CosmosAsyncClientHelper.getCosmosAsyncClientAccessor(); + private FeedOperationState operationState; private String requestContinuation; private Integer maxItemCount; - private DiagnosticsProvider tracerProvider; - private String spanName; - private String databaseId; - private String containerId; - private OperationType operationType; - private ResourceType resourceType; - private String serviceEndpoint; - private CosmosAsyncClient cosmosAsyncClient; - private CosmosDiagnosticsThresholds thresholds; - private String operationId; - - private String userAgent; - private String connectionMode; - public ConsistencyLevel effectiveConsistencyLevel; - - public double samplingRateSnapshot = 1; public CosmosPagedFluxOptions() {} - public String getContainerId() { - return containerId; + public FeedOperationState getFeedOperationState() { + return this.operationState; } - public OperationType getOperationType() { - return operationType; - } - - public ResourceType getResourceType() { - return resourceType; - } - - public CosmosAsyncClient getCosmosAsyncClient() { - return cosmosAsyncClient; - } - - public ConsistencyLevel getEffectiveConsistencyLevel() { return this.effectiveConsistencyLevel; } - /** * Gets the request continuation token. * @@ -112,124 +78,33 @@ public Integer getMaxItemCount() { */ public CosmosPagedFluxOptions setMaxItemCount(Integer maxItemCount) { this.maxItemCount = maxItemCount; + if (this.operationState != null) { + this.operationState.setMaxItemCount(maxItemCount); + } return this; } - /** - * Gets the tracer provider - * @return tracerProvider - */ - public DiagnosticsProvider getDiagnosticsProvider() { - return this.tracerProvider; + public void setFeedOperationState(FeedOperationState state) { + this.operationState = checkNotNull(state, "Argument 'state' must not be NULL."); } - /** - * Gets the tracer span name - * @return tracerSpanName - */ - public String getSpanName() { - return spanName; - } - - /** - * Gets the databaseId - * @return databaseId - */ - public String getDatabaseId() { - return databaseId; - } - - /** - * Gets the service end point - * @return serviceEndpoint - */ - public String getAccountTag() { - return serviceEndpoint; - } - - public CosmosDiagnosticsThresholds getDiagnosticsThresholds() { - return this.thresholds; - } - - public String getOperationId() { - return this.operationId; - } - - public String getUserAgent() { return this.userAgent; } - - public String getConnectionMode() { return this.connectionMode; } - - - public void setTracerInformation( - String tracerSpanName, - String databaseId, - String containerId, - String operationId, - OperationType operationType, - ResourceType resourceType, - CosmosAsyncClient cosmosAsyncClient, - ConsistencyLevel consistencyLevel, - CosmosDiagnosticsThresholds thresholds) { - - checkNotNull(tracerSpanName, "Argument 'tracerSpanName' must not be NULL."); - checkNotNull(operationType, "Argument 'operationType' must not be NULL."); - checkNotNull(resourceType, "Argument 'resourceType' must not be NULL."); - checkNotNull(cosmosAsyncClient, "Argument 'cosmosAsyncClient' must not be NULL."); - checkNotNull(thresholds, "Argument 'thresholds' must not be NULL."); - - this.databaseId = databaseId; - this.containerId = containerId; - this.spanName = tracerSpanName; - this.tracerProvider = clientAccessor.getDiagnosticsProvider(cosmosAsyncClient); - this.serviceEndpoint = clientAccessor.getAccountTagValue(cosmosAsyncClient); - this.connectionMode = clientAccessor.getConnectionMode(cosmosAsyncClient); - this.userAgent = clientAccessor.getUserAgent(cosmosAsyncClient); - this.operationId = operationId; - this.operationType = operationType; - this.resourceType = resourceType; - this.cosmosAsyncClient = cosmosAsyncClient; - this.effectiveConsistencyLevel = clientAccessor - .getEffectiveConsistencyLevel(cosmosAsyncClient, operationType, consistencyLevel); - this.thresholds = thresholds; - } + public double getSamplingRateSnapshot() { + FeedOperationState stateSnapshot = this.operationState; + if (stateSnapshot == null) { + return 0; + } - public void setTracerAndTelemetryInformation(String tracerSpanName, - String databaseId, - String containerId, - OperationType operationType, - ResourceType resourceType, - CosmosAsyncClient cosmosAsyncClient, - String operationId, - ConsistencyLevel consistencyLevel, - CosmosDiagnosticsThresholds thresholds - ) { - checkNotNull(tracerSpanName, "Argument 'tracerSpanName' must not be NULL."); - checkNotNull(databaseId, "Argument 'databaseId' must not be NULL."); - checkNotNull(operationType, "Argument 'operationType' must not be NULL."); - checkNotNull(resourceType, "Argument 'resourceType' must not be NULL."); - checkNotNull(cosmosAsyncClient, "Argument 'cosmosAsyncClient' must not be NULL."); - checkNotNull(thresholds, "Argument 'thresholds' must not be NULL."); - this.tracerProvider = clientAccessor.getDiagnosticsProvider(cosmosAsyncClient); - this.serviceEndpoint = clientAccessor.getAccountTagValue(cosmosAsyncClient); - this.connectionMode = clientAccessor.getConnectionMode(cosmosAsyncClient); - this.userAgent = clientAccessor.getUserAgent(cosmosAsyncClient); - this.spanName = tracerSpanName; - this.databaseId = databaseId; - this.containerId = containerId; - this.operationType = operationType; - this.resourceType = resourceType; - this.cosmosAsyncClient = cosmosAsyncClient; - this.operationId = operationId; - this.effectiveConsistencyLevel = clientAccessor - .getEffectiveConsistencyLevel(cosmosAsyncClient, operationType, consistencyLevel); - this.thresholds = thresholds; - } + Double samplingRateSnapshot = stateSnapshot.getSamplingRateSnapshot(); + if (samplingRateSnapshot == null) { + return 0; + } - public double getSamplingRateSnapshot() { - return this.samplingRateSnapshot; + return samplingRateSnapshot; } public void setSamplingRateSnapshot(double samplingRateSnapshot) { - this.samplingRateSnapshot = samplingRateSnapshot; + if (this.operationState != null) { + this.operationState.setSamplingRateSnapshot(samplingRateSnapshot); + } } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DatabaseForTest.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DatabaseForTest.java index a9572f8f5575..63916d77245f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DatabaseForTest.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DatabaseForTest.java @@ -3,7 +3,10 @@ package com.azure.cosmos.implementation; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosClientBuilder; import com.azure.cosmos.implementation.apachecommons.lang.RandomStringUtils; +import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.FeedResponse; import com.azure.cosmos.models.SqlParameter; import com.azure.cosmos.models.SqlQuerySpec; @@ -84,6 +87,7 @@ public static DatabaseForTest create(DatabaseManager client) { public static void cleanupStaleTestDatabases(DatabaseManager client) { logger.info("Cleaning stale test databases ..."); + List dbs = client.queryDatabases( new SqlQuerySpec("SELECT * FROM c WHERE STARTSWITH(c.id, @PREFIX)", Collections.singletonList(new SqlParameter("@PREFIX", DatabaseForTest.SHARED_DB_ID_PREFIX)))) diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DiagnosticsProvider.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DiagnosticsProvider.java index 32faa428c133..0af0200913c3 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DiagnosticsProvider.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DiagnosticsProvider.java @@ -148,6 +148,27 @@ public boolean isRealTracer() { return this.tracer.isEnabled() && this.tracer != EnabledNoOpTracer.INSTANCE; } + public String getTraceConfigLog() { + StringBuilder sb = new StringBuilder(); + sb.append(this.isEnabled()); + sb.append(", "); + sb.append(this.isRealTracer()); + sb.append(", "); + sb.append(this.tracer.getClass().getCanonicalName()); + if (!this.diagnosticHandlers.isEmpty()) { + sb.append(", ["); + for (int i = 0; i < this.diagnosticHandlers.size(); i++) { + if (i > 0) { + sb.append(", "); + } + sb.append(this.diagnosticHandlers.get(i).getClass().getCanonicalName()); + } + sb.append("]"); + } + + return sb.toString(); + } + public CosmosClientTelemetryConfig getClientTelemetryConfig() { return this.telemetryConfig; } @@ -168,26 +189,6 @@ public static Context getContextFromReactorOrNull(ContextView reactorContext) { return null; } - private static CosmosDiagnosticsContext getCosmosDiagnosticsContextFromTraceContextOrNull(Context traceContext) { - Object cosmosCtx = traceContext.getData(COSMOS_DIAGNOSTICS_CONTEXT_KEY).orElse(null); - - if (cosmosCtx instanceof CosmosDiagnosticsContext) { - return (CosmosDiagnosticsContext) cosmosCtx; - } - - return null; - } - - public static CosmosDiagnosticsContext getCosmosDiagnosticsContextFromTraceContextOrThrow(Context traceContext) { - Object cosmosCtx = traceContext.getData(COSMOS_DIAGNOSTICS_CONTEXT_KEY).orElse(null); - - if (cosmosCtx instanceof CosmosDiagnosticsContext) { - return (CosmosDiagnosticsContext) cosmosCtx; - } - - throw new IllegalStateException("CosmosDiagnosticsContext not present."); - } - /** * Stores {@link Context} in Reactor {@link reactor.util.context.Context}. * @@ -237,6 +238,7 @@ public Context startSpan( public void endSpan( Signal signal, + CosmosDiagnosticsContext cosmosCtx, int statusCode, Integer actualItemCount, Double requestCharge, @@ -244,7 +246,7 @@ public void endSpan( ) { // called in PagedFlux - needs to be exception less - otherwise will result in hanging Flux. try { - this.endSpanCore(signal, statusCode, actualItemCount, requestCharge, diagnostics); + this.endSpanCore(signal, cosmosCtx, statusCode, actualItemCount, requestCharge, diagnostics); } catch (Throwable error) { LOGGER.error("Unexpected exception in DiagnosticsProvider.endSpan. ", error); System.exit(9901); @@ -253,6 +255,7 @@ public void endSpan( private void endSpanCore( Signal signal, + CosmosDiagnosticsContext cosmosCtx, int statusCode, Integer actualItemCount, Double requestCharge, @@ -268,7 +271,7 @@ private void endSpanCore( switch (signal.getType()) { case ON_COMPLETE: case ON_NEXT: - end(statusCode, 0, actualItemCount, requestCharge, diagnostics,null, context); + end(cosmosCtx, statusCode, 0, actualItemCount, requestCharge, diagnostics,null, context); break; case ON_ERROR: Throwable throwable = null; @@ -289,9 +292,12 @@ private void endSpanCore( effectiveRequestCharge = exception.getRequestCharge(); } effectiveDiagnostics = exception.getDiagnostics(); + if (effectiveDiagnostics != null) { + diagnosticsAccessor.isDiagnosticsCapturedInPagedFlux(effectiveDiagnostics).set(true); + } } } - end(statusCode, subStatusCode, actualItemCount, effectiveRequestCharge, effectiveDiagnostics, throwable, context); + end(cosmosCtx, statusCode, subStatusCode, actualItemCount, effectiveRequestCharge, effectiveDiagnostics, throwable, context); break; default: // ON_SUBSCRIBE isn't the right state to end span @@ -299,7 +305,7 @@ private void endSpanCore( } } - public void endSpan(Context context, Throwable throwable) { + public void endSpan(CosmosDiagnosticsContext cosmosCtx, Context context, Throwable throwable) { // called in PagedFlux - needs to be exception less - otherwise will result in hanging Flux. try { int statusCode = DiagnosticsProvider.ERROR_CODE; @@ -314,17 +320,17 @@ public void endSpan(Context context, Throwable throwable) { effectiveRequestCharge = exception.getRequestCharge(); effectiveDiagnostics = exception.getDiagnostics(); } - end(statusCode, subStatusCode, null, effectiveRequestCharge, effectiveDiagnostics, throwable, context); + end(cosmosCtx, statusCode, subStatusCode, null, effectiveRequestCharge, effectiveDiagnostics, throwable, context); } catch (Throwable error) { LOGGER.error("Unexpected exception in DiagnosticsProvider.endSpan. ", error); System.exit(9905); } } - public void endSpan(Context context) { + public void endSpan(CosmosDiagnosticsContext cosmosCtx, Context context) { // called in PagedFlux - needs to be exception less - otherwise will result in hanging Flux. try { - end(200, 0, null, null, null,null, context); + end(cosmosCtx, 200, 0, null, null, null,null, context); } catch (Throwable error) { LOGGER.error("Unexpected exception in DiagnosticsProvider.endSpan. ", error); System.exit(9904); @@ -332,14 +338,14 @@ public void endSpan(Context context) { } public void recordPage( - Context context, + CosmosDiagnosticsContext cosmosCtx, CosmosDiagnostics diagnostics, Integer actualItemCount, Double requestCharge ) { // called in PagedFlux - needs to be exception less - otherwise will result in hanging Flux. try { - this.recordPageCore(context, diagnostics, actualItemCount, requestCharge); + this.recordPageCore(cosmosCtx, diagnostics, actualItemCount, requestCharge); } catch (Throwable error) { LOGGER.error("Unexpected exception in DiagnosticsProvider.recordPage. ", error); System.exit(9902); @@ -347,22 +353,18 @@ public void recordPage( } private void recordPageCore( - Context context, + CosmosDiagnosticsContext cosmosCtx, CosmosDiagnostics diagnostics, Integer actualItemCount, Double requestCharge ) { - if (context == null) { - return; - } - - CosmosDiagnosticsContext cosmosCtx = getCosmosDiagnosticsContextFromTraceContextOrThrow(context); ctxAccessor.recordOperation( cosmosCtx, 200, 0, actualItemCount, requestCharge, diagnostics, null); } public void recordFeedResponseConsumerLatency( Signal signal, + CosmosDiagnosticsContext cosmosCtx, Duration feedResponseConsumerLatency ) { // called in PagedFlux - needs to be exception less - otherwise will result in hanging Flux. @@ -379,7 +381,7 @@ public void recordFeedResponseConsumerLatency( } this.recordFeedResponseConsumerLatencyCore( - context, getCosmosDiagnosticsContextFromTraceContextOrNull(context), feedResponseConsumerLatency); + context, cosmosCtx, feedResponseConsumerLatency); } catch (Throwable error) { LOGGER.error("Unexpected exception in DiagnosticsProvider.recordFeedResponseConsumerLatency. ", error); System.exit(9902); @@ -647,6 +649,7 @@ private Mono diagnosticsEnabledPublisher( this.endSpan( signal, + cosmosCtx, statusCodeFunc.apply(response), actualItemCountFunc.apply(response), requestChargeFunc.apply(response), @@ -657,6 +660,7 @@ private Mono diagnosticsEnabledPublisher( // part of exception message this.endSpan( signal, + cosmosCtx, ERROR_CODE, null, null, @@ -704,10 +708,11 @@ private Mono publisherWithDiagnostics(Mono resultPublisher, thresholds, trackingId, clientAccessor.getConnectionMode(client), - clientAccessor.getUserAgent(client)); + clientAccessor.getUserAgent(client), + null); if (requestOptions != null) { - requestOptions.setDiagnosticsContext(cosmosCtx); + requestOptions.setDiagnosticsContextSupplier(() -> cosmosCtx); } return diagnosticsEnabledPublisher( @@ -722,6 +727,7 @@ private Mono publisherWithDiagnostics(Mono resultPublisher, } private void end( + CosmosDiagnosticsContext cosmosCtx, int statusCode, int subStatusCode, Integer actualItemCount, @@ -730,7 +736,7 @@ private void end( Throwable throwable, Context context) { - CosmosDiagnosticsContext cosmosCtx = getCosmosDiagnosticsContextFromTraceContextOrThrow(context); + checkNotNull(cosmosCtx, "Argument 'cosmosCtx' must not be null."); // endOperation can be called form two places in Reactor - making sure we process completion only once if (ctxAccessor.endOperation( @@ -993,10 +999,10 @@ private void addClientSideRequestStatisticsOnTracerEvent( OffsetDateTime.ofInstant(clientSideRequestStatistics.getRequestStartTimeUTC(), ZoneOffset.UTC), context); if (clientSideRequestStatistics.getResponseStatisticsList() != null && clientSideRequestStatistics.getResponseStatisticsList().size() > 0 - && clientSideRequestStatistics.getResponseStatisticsList().get(0).getStoreResult() != null) { + && clientSideRequestStatistics.getResponseStatisticsList().iterator().next() != null) { String eventName = "Diagnostics for PKRange " - + clientSideRequestStatistics.getResponseStatisticsList().get(0).getStoreResult().getStoreResponseDiagnostics().getPartitionKeyRangeId(); + + clientSideRequestStatistics.getResponseStatisticsList().iterator().next().getStoreResult().getStoreResponseDiagnostics().getPartitionKeyRangeId(); this.addEvent(eventName, attributes, OffsetDateTime.ofInstant(clientSideRequestStatistics.getRequestStartTimeUTC(), ZoneOffset.UTC), context); } else if (clientSideRequestStatistics.getGatewayStatisticsList() != null && clientSideRequestStatistics.getGatewayStatisticsList().size() > 0) { @@ -1225,7 +1231,7 @@ public void endSpan(CosmosDiagnosticsContext cosmosCtx, Context context) { } private void recordStoreResponseStatistics( - List storeResponseStatistics, + Collection storeResponseStatistics, Context context) { for (ClientSideRequestStatistics.StoreResponseStatistics responseStatistics: storeResponseStatistics) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/FeedOperationState.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/FeedOperationState.java new file mode 100644 index 000000000000..4b0d42049314 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/FeedOperationState.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.implementation; + +import com.azure.cosmos.BridgeInternal; +import com.azure.cosmos.ConsistencyLevel; +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.CosmosDiagnosticsContext; +import com.azure.cosmos.CosmosDiagnosticsThresholds; + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; + +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + +public abstract class FeedOperationState { + + protected static final ImplementationBridgeHelpers + .CosmosAsyncClientHelper + .CosmosAsyncClientAccessor clientAccessor = ImplementationBridgeHelpers + .CosmosAsyncClientHelper + .getCosmosAsyncClientAccessor(); + + protected static final ImplementationBridgeHelpers + .CosmosDiagnosticsContextHelper + .CosmosDiagnosticsContextAccessor ctxAccessor = ImplementationBridgeHelpers + .CosmosDiagnosticsContextHelper + .getCosmosDiagnosticsContextAccessor(); + + private final CosmosAsyncClient cosmosAsyncClient; + private final CosmosDiagnosticsThresholds thresholds; + + + private final AtomicReference ctxHolder; + + + + private final AtomicReference diagnosticsFactoryResetCallback; + + private final AtomicReference> diagnosticsFactoryMergeCallback; + + private final AtomicReference requestContinuation; + private final AtomicReference maxItemCount; + + private final AtomicInteger sequenceNumberGenerator; + private final AtomicReference samplingRate; + + private final CosmosPagedFluxOptions fluxOptions; + + public FeedOperationState( + CosmosAsyncClient cosmosAsyncClient, + String spanName, + String dbName, + String containerName, + ResourceType resourceType, + OperationType operationType, + String operationId, + ConsistencyLevel effectiveConsistencyLevel, + CosmosDiagnosticsThresholds thresholds, + CosmosPagedFluxOptions fluxOptions, + Integer initialMaxItemCount + ) { + checkNotNull(cosmosAsyncClient, "Argument 'cosmosAsyncClient' must not be null." ); + checkNotNull(thresholds, "Argument 'thresholds' must not be null." ); + checkNotNull(effectiveConsistencyLevel, "Argument 'effectiveConsistencyLevel' must not be null." ); + + this.cosmosAsyncClient = cosmosAsyncClient; + this.thresholds = thresholds; + this.diagnosticsFactoryResetCallback = new AtomicReference<>(null); + this.diagnosticsFactoryMergeCallback = new AtomicReference<>(null); + if (fluxOptions != null) { + this.requestContinuation = new AtomicReference<>(fluxOptions.getRequestContinuation()); + } else { + this.requestContinuation = new AtomicReference<>(null); + } + + this.maxItemCount = new AtomicReference<>(initialMaxItemCount); + this.sequenceNumberGenerator = new AtomicInteger(0); + this.fluxOptions = fluxOptions; + this.samplingRate = new AtomicReference<>(null); + + CosmosDiagnosticsContext cosmosCtx = ctxAccessor.create( + checkNotNull(spanName, "Argument 'spanName' must not be null." ), + clientAccessor.getAccountTagValue(cosmosAsyncClient), + BridgeInternal.getServiceEndpoint(this.cosmosAsyncClient), + dbName, + containerName, + checkNotNull(resourceType, "Argument 'resourceType' must not be null." ), + checkNotNull(operationType, "Argument 'operationType' must not be null." ), + operationId, + checkNotNull(effectiveConsistencyLevel, "Argument 'effectiveConsistencyLevel' must not be null." ), + initialMaxItemCount != null ? initialMaxItemCount : Constants.Properties.DEFAULT_MAX_PAGE_SIZE, + this.thresholds, + null, + clientAccessor.getConnectionMode(cosmosAsyncClient), + clientAccessor.getUserAgent(cosmosAsyncClient), + this.sequenceNumberGenerator.incrementAndGet()); + this.ctxHolder = new AtomicReference<>(cosmosCtx); + } + + public void registerDiagnosticsFactory(Runnable resetCallback, Consumer mergeCallback) { + this.diagnosticsFactoryResetCallback.set(resetCallback); + this.diagnosticsFactoryMergeCallback.set(mergeCallback); + } + + public Double getSamplingRateSnapshot() { + return this.samplingRate.get(); + } + + public void setSamplingRateSnapshot(double samplingRateSnapshot) { + this.samplingRate.set(samplingRateSnapshot); + CosmosDiagnosticsContext ctxSnapshot = this.ctxHolder.get(); + ctxAccessor.setSamplingRateSnapshot(ctxSnapshot, samplingRateSnapshot); + } + + // Can return null + public CosmosPagedFluxOptions getPagedFluxOptions() { + return this.fluxOptions; + } + + public void setMaxItemCount(Integer maxItemCount) { + this.maxItemCount.set(maxItemCount); + } + + public Integer getMaxItemCount() { + return this.maxItemCount.get(); + } + + public String getRequestContinuation() { + return this.requestContinuation.get(); + } + + public void setRequestContinuation(String requestContinuation) { + this.requestContinuation.set(requestContinuation); + if (this.fluxOptions != null) { + this.fluxOptions.setRequestContinuation(requestContinuation); + } + } + + public DiagnosticsProvider getDiagnosticsProvider() { + return clientAccessor.getDiagnosticsProvider(this.cosmosAsyncClient); + } + + public String getSpanName() { + return ctxAccessor.getSpanName(this.ctxHolder.get()); + } + + public CosmosDiagnosticsContext getDiagnosticsContextSnapshot() { + return this.ctxHolder.get(); + } + + public void resetDiagnosticsContext() { + CosmosDiagnosticsContext snapshot = this.ctxHolder.get(); + if (snapshot == null) { + throw new IllegalStateException("CosmosDiagnosticsContext must never be null"); + } + + final CosmosDiagnosticsContext cosmosCtx = ctxAccessor.create( + ctxAccessor.getSpanName(snapshot), + ctxAccessor.getEndpoint(snapshot), + BridgeInternal.getServiceEndpoint(this.cosmosAsyncClient), + snapshot.getDatabaseName(), + snapshot.getContainerName(), + ctxAccessor.getResourceType(snapshot), + ctxAccessor.getOperationType(snapshot), + snapshot.getOperationId(), + snapshot.getEffectiveConsistencyLevel(), + this.maxItemCount.get(), + this.thresholds, + snapshot.getTrackingId(), + snapshot.getConnectionMode(), + snapshot.getUserAgent(), + this.sequenceNumberGenerator.incrementAndGet() + ); + Double samplingRateSnapshot = this.samplingRate.get(); + if (samplingRateSnapshot != null) { + ctxAccessor.setSamplingRateSnapshot(cosmosCtx, samplingRateSnapshot); + } + + this.ctxHolder.set(cosmosCtx); + + if (this.diagnosticsFactoryResetCallback != null) { + Runnable resetCallbackSnapshot = this.diagnosticsFactoryResetCallback.get(); + if (resetCallbackSnapshot != null) { + resetCallbackSnapshot.run(); + } + } + } + + public void mergeDiagnosticsContext() { + final CosmosDiagnosticsContext cosmosCtx = this.ctxHolder.get(); + + if (this.diagnosticsFactoryMergeCallback != null) { + Consumer mergeCallbackSnapshot = this.diagnosticsFactoryMergeCallback.get(); + if (mergeCallbackSnapshot != null) { + mergeCallbackSnapshot.accept(cosmosCtx); + } + } + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java index 299223d5cd8a..44d184db8c9d 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ImplementationBridgeHelpers.java @@ -60,6 +60,7 @@ import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.models.PartitionKey; import com.azure.cosmos.models.PriorityLevel; +import com.azure.cosmos.models.SqlQuerySpec; import com.azure.cosmos.util.CosmosPagedFlux; import com.azure.cosmos.util.UtilBridgeInternal; import com.fasterxml.jackson.databind.JsonNode; @@ -257,6 +258,8 @@ public static CosmosQueryRequestOptionsAccessor getCosmosQueryRequestOptionsAcce } public interface CosmosQueryRequestOptionsAccessor { + CosmosQueryRequestOptions clone( + CosmosQueryRequestOptions toBeCloned); void setOperationContext(CosmosQueryRequestOptions queryRequestOptions, OperationContextAndListenerTuple operationContext); OperationContextAndListenerTuple getOperationContext(CosmosQueryRequestOptions queryRequestOptions); CosmosQueryRequestOptions setHeader(CosmosQueryRequestOptions queryRequestOptions, String name, String value); @@ -266,20 +269,25 @@ public interface CosmosQueryRequestOptionsAccessor { UUID getCorrelationActivityId(CosmosQueryRequestOptions queryRequestOptions); CosmosQueryRequestOptions setCorrelationActivityId(CosmosQueryRequestOptions queryRequestOptions, UUID correlationActivityId); boolean isEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequestOptions); - CosmosQueryRequestOptions setEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequestOptions, boolean emptyPageDiagnosticsEnabled); CosmosQueryRequestOptions withEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequestOptions, boolean emptyPageDiagnosticsEnabled); Function getItemFactoryMethod(CosmosQueryRequestOptions queryRequestOptions, Class classOfT); CosmosQueryRequestOptions setItemFactoryMethod(CosmosQueryRequestOptions queryRequestOptions, Function factoryMethod); String getQueryNameOrDefault(CosmosQueryRequestOptions queryRequestOptions, String defaultQueryName); RequestOptions toRequestOptions(CosmosQueryRequestOptions queryRequestOptions); CosmosDiagnosticsThresholds getDiagnosticsThresholds(CosmosQueryRequestOptions options); - void applyMaxItemCount(CosmosQueryRequestOptions requestOptions, CosmosPagedFluxOptions fluxOptions); CosmosEndToEndOperationLatencyPolicyConfig getEndToEndOperationLatencyPolicyConfig(CosmosQueryRequestOptions options); List getExcludeRegions(CosmosQueryRequestOptions options); List getCancelledRequestDiagnosticsTracker(CosmosQueryRequestOptions options); void setCancelledRequestDiagnosticsTracker( CosmosQueryRequestOptions options, List cancelledRequestDiagnosticsTracker); + void setAllowEmptyPages(CosmosQueryRequestOptions options, boolean emptyPagesAllowed); + + boolean getAllowEmptyPages(CosmosQueryRequestOptions options); + + Integer getMaxItemCount(CosmosQueryRequestOptions options); + + String getRequestContinuation(CosmosQueryRequestOptions options); } } @@ -321,9 +329,7 @@ public interface CosmosChangeFeedRequestOptionsAccessor { Function getItemFactoryMethod(CosmosChangeFeedRequestOptions queryRequestOptions, Class classOfT); CosmosChangeFeedRequestOptions setItemFactoryMethod(CosmosChangeFeedRequestOptions queryRequestOptions, Function factoryMethod); CosmosDiagnosticsThresholds getDiagnosticsThresholds(CosmosChangeFeedRequestOptions options); - void applyMaxItemCount(CosmosChangeFeedRequestOptions requestOptions, CosmosPagedFluxOptions fluxOptions); List getExcludeRegions(CosmosChangeFeedRequestOptions cosmosChangeFeedRequestOptions); - } } @@ -426,10 +432,6 @@ CosmosBulkExecutionOptions setTargetedMicroBatchRetryRate( double minRetryRate, double maxRetryRate); - int getInitialMicroBatchSize(CosmosBulkExecutionOptions options); - - CosmosBulkExecutionOptions setInitialMicroBatchSize(CosmosBulkExecutionOptions options, int initialMicroBatchSize); - int getMaxMicroBatchPayloadSizeInBytes(CosmosBulkExecutionOptions options); CosmosBulkExecutionOptions setMaxMicroBatchPayloadSizeInBytes(CosmosBulkExecutionOptions options, int maxMicroBatchPayloadSizeInBytes); @@ -795,7 +797,8 @@ CosmosDiagnosticsContext create( CosmosDiagnosticsThresholds thresholds, String trackingId, String connectionMode, - String userAgent); + String userAgent, + Integer sequenceNumber); CosmosDiagnosticsSystemUsageSnapshot createSystemUsageSnapshot( String cpu, @@ -904,6 +907,18 @@ Mono> readMany( List itemIdentityList, CosmosQueryRequestOptions requestOptions, Class classType); + + Function>> queryItemsInternalFunc( + CosmosAsyncContainer cosmosAsyncContainer, + SqlQuerySpec sqlQuerySpec, + CosmosQueryRequestOptions cosmosQueryRequestOptions, + Class classType); + + Function>> queryItemsInternalFuncWithMonoSqlQuerySpec( + CosmosAsyncContainer cosmosAsyncContainer, + Mono sqlQuerySpecMono, + CosmosQueryRequestOptions cosmosQueryRequestOptions, + Class classType); } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/IndexUtilizationInfo.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/IndexUtilizationInfo.java index 5bd4307499ad..68b729b98c79 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/IndexUtilizationInfo.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/IndexUtilizationInfo.java @@ -22,13 +22,13 @@ public final class IndexUtilizationInfo { new ArrayList<>(), /* utilizedCompositeIndexes */ new ArrayList<>()); /* potentialCompositeIndexes */ - @JsonProperty(value = "UtilizedSingleIndexes", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "UtilizedSingleIndexes", access = JsonProperty.Access.READ_WRITE) private List utilizedSingleIndexes; - @JsonProperty(value = "PotentialSingleIndexes", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "PotentialSingleIndexes", access = JsonProperty.Access.READ_WRITE) private List potentialSingleIndexes; - @JsonProperty(value = "UtilizedCompositeIndexes", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "UtilizedCompositeIndexes", access = JsonProperty.Access.READ_WRITE) private List utilizedCompositeIndexes; - @JsonProperty(value = "PotentialCompositeIndexes", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "PotentialCompositeIndexes", access = JsonProperty.Access.READ_WRITE) private List potentialCompositeIndexes; IndexUtilizationInfo() {} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/QueryFeedOperationState.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/QueryFeedOperationState.java new file mode 100644 index 000000000000..a2f0c31ee70f --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/QueryFeedOperationState.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.implementation; + +import com.azure.cosmos.CosmosAsyncClient; +import com.azure.cosmos.models.CosmosQueryRequestOptions; +import com.azure.cosmos.models.ModelBridgeInternal; + +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + +public final class QueryFeedOperationState extends FeedOperationState { + + private static final ImplementationBridgeHelpers + .CosmosQueryRequestOptionsHelper + .CosmosQueryRequestOptionsAccessor qryOptAccessor = ImplementationBridgeHelpers + .CosmosQueryRequestOptionsHelper + .getCosmosQueryRequestOptionsAccessor(); + + private final CosmosQueryRequestOptions options; + private final RequestOptions requestOptions; + + public QueryFeedOperationState( + CosmosAsyncClient cosmosAsyncClient, + String spanName, + String dbName, + String containerName, + ResourceType resourceType, + OperationType operationType, + String operationId, + CosmosQueryRequestOptions queryRequestOptions, + CosmosPagedFluxOptions fluxOptions + ) { + super( + cosmosAsyncClient, + spanName, + dbName, + containerName, + resourceType, + checkNotNull(operationType, "Argument 'operationType' must not be null."), + operationId, + clientAccessor.getEffectiveConsistencyLevel( + cosmosAsyncClient, + operationType, + queryRequestOptions.getConsistencyLevel()), + clientAccessor.getEffectiveDiagnosticsThresholds( + cosmosAsyncClient, + qryOptAccessor.getDiagnosticsThresholds( + checkNotNull(queryRequestOptions, "Argument 'queryRequestOptions' must not be null."))), + fluxOptions, + getEffectiveMaxItemCount(fluxOptions, queryRequestOptions) + ); + + String requestOptionsContinuation = qryOptAccessor.getRequestContinuation(queryRequestOptions); + if (requestOptionsContinuation != null && + (fluxOptions == null || fluxOptions.getRequestContinuation() == null)) { + + this.setRequestContinuation(requestOptionsContinuation); + + if (fluxOptions != null) { + fluxOptions.setRequestContinuation(requestOptionsContinuation); + } + } + + Integer maxItemCountFromRequestOptions = qryOptAccessor.getMaxItemCount(queryRequestOptions); + if (maxItemCountFromRequestOptions != null && + (fluxOptions == null || fluxOptions.getMaxItemCount() == null)) { + + this.setMaxItemCount(maxItemCountFromRequestOptions); + + if (fluxOptions != null) { + fluxOptions.setMaxItemCount(maxItemCountFromRequestOptions); + } + } + + this.options = qryOptAccessor.clone(queryRequestOptions); + // apply the maxItemCount/continuation to the cloned request options + this.setMaxItemCountCore(this.getMaxItemCount()); + this.setRequestContinuationCore(this.getRequestContinuation()); + this.requestOptions = qryOptAccessor.toRequestOptions(this.options); + } + + public RequestOptions toRequestOptions() { + return this.requestOptions; + } + + public CosmosQueryRequestOptions getQueryOptions() { + return this.options; + } + + @Override + public void setRequestContinuation(String requestContinuation) { + super.setRequestContinuation(requestContinuation); + + this.setRequestContinuationCore(requestContinuation); + } + + private void setRequestContinuationCore(String requestContinuation) { + if (this.options != null) { + ModelBridgeInternal.setQueryRequestOptionsContinuationToken( + this.options, + requestContinuation + ); + } + } + + @Override + public void setMaxItemCount(Integer maxItemCount) { + super.setMaxItemCount(maxItemCount); + + this.setMaxItemCountCore(maxItemCount); + } + + private void setMaxItemCountCore(Integer maxItemCount) { + + if (this.options != null) { + ModelBridgeInternal.setQueryRequestOptionsMaxItemCount( + this.options, + maxItemCount + ); + } + } + + private static Integer getEffectiveMaxItemCount( + CosmosPagedFluxOptions pagedFluxOptions, + CosmosQueryRequestOptions queryOptions) { + + if (pagedFluxOptions != null && pagedFluxOptions.getMaxItemCount() != null) { + return pagedFluxOptions.getMaxItemCount(); + } + + if (queryOptions == null) { + return null; + } + + return qryOptAccessor.getMaxItemCount(queryOptions); + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RequestOptions.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RequestOptions.java index d345041eab43..9788c4d47c78 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RequestOptions.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RequestOptions.java @@ -17,6 +17,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Supplier; /** * Encapsulates options that can be specified for a request issued to the Azure Cosmos DB database service. @@ -50,7 +51,7 @@ public class RequestOptions { private CosmosEndToEndOperationLatencyPolicyConfig endToEndOperationLatencyConfig; private List excludeRegions; - private CosmosDiagnosticsContext diagnosticsCtx; + private Supplier diagnosticsCtxSupplier; public RequestOptions() {} @@ -76,7 +77,7 @@ public RequestOptions(RequestOptions toBeCloned) { this.trackingId = toBeCloned.trackingId; this.nonIdempotentWriteRetriesEnabled = toBeCloned.nonIdempotentWriteRetriesEnabled; this.endToEndOperationLatencyConfig = toBeCloned.endToEndOperationLatencyConfig; - this.diagnosticsCtx = toBeCloned.diagnosticsCtx; + this.diagnosticsCtxSupplier = toBeCloned.diagnosticsCtxSupplier; if (toBeCloned.customOptions != null) { this.customOptions = new HashMap<>(toBeCloned.customOptions); @@ -496,12 +497,17 @@ public void setDiagnosticsThresholds(CosmosDiagnosticsThresholds thresholds) { this.thresholds = thresholds; } - public void setDiagnosticsContext(CosmosDiagnosticsContext ctx) { - this.diagnosticsCtx = ctx; + public void setDiagnosticsContextSupplier(Supplier ctxSupplier) { + this.diagnosticsCtxSupplier = ctxSupplier; } - public CosmosDiagnosticsContext getDiagnosticsContext() { - return this.diagnosticsCtx; + public CosmosDiagnosticsContext getDiagnosticsContextSnapshot() { + Supplier ctxSupplierSnapshot = this.diagnosticsCtxSupplier; + if (ctxSupplierSnapshot == null) { + return null; + } + + return ctxSupplierSnapshot.get(); } public void setCosmosEndToEndLatencyPolicyConfig(CosmosEndToEndOperationLatencyPolicyConfig endToEndOperationLatencyPolicyConfig) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java index 70be8af5086a..03fdbea181af 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentClientImpl.java @@ -17,7 +17,6 @@ import com.azure.cosmos.DirectConnectionConfig; import com.azure.cosmos.SessionRetryOptions; import com.azure.cosmos.ThresholdBasedAvailabilityStrategy; -import com.azure.cosmos.implementation.apachecommons.collections.list.UnmodifiableList; import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; import com.azure.cosmos.implementation.apachecommons.lang.tuple.ImmutablePair; import com.azure.cosmos.implementation.batch.BatchResponseParser; @@ -115,6 +114,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiFunction; import java.util.function.Function; +import java.util.function.Supplier; import java.util.stream.Collectors; import static com.azure.cosmos.BridgeInternal.documentFromObject; @@ -148,6 +148,11 @@ public class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorization private final static ImplementationBridgeHelpers.CosmosDiagnosticsContextHelper.CosmosDiagnosticsContextAccessor ctxAccessor = ImplementationBridgeHelpers.CosmosDiagnosticsContextHelper.getCosmosDiagnosticsContextAccessor(); + + private final static + ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.CosmosQueryRequestOptionsAccessor qryOptAccessor = + ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.getCosmosQueryRequestOptionsAccessor(); + private static final String tempMachineId = "uuid:" + UUID.randomUUID(); private static final AtomicInteger activeClientsCnt = new AtomicInteger(0); private static final Map clientMap = new ConcurrentHashMap<>(); @@ -347,7 +352,7 @@ private RxDocumentClientImpl(URI serviceEndpoint, String[] segments = StringUtils.split(permission.getResourceLink(), Constants.Properties.PATH_SEPARATOR.charAt(0)); - if (segments.length <= 0) { + if (segments.length == 0) { throw new IllegalArgumentException("resourceLink"); } @@ -863,8 +868,8 @@ private Mono> readDatabaseInternal(String databaseLin } @Override - public Flux> readDatabases(CosmosQueryRequestOptions options) { - return readFeed(options, ResourceType.Database, Database.class, Paths.DATABASES_ROOT); + public Flux> readDatabases(QueryFeedOperationState state) { + return readFeed(state, ResourceType.Database, Database.class, Paths.DATABASES_ROOT); } private String parentResourceLinkToQueryLink(String parentResourceLink, ResourceType resourceTypeEnum) { @@ -927,22 +932,22 @@ private OperationContextAndListenerTuple getOperationContextAndListenerTuple(Req private Flux> createQuery( String parentResourceLink, SqlQuerySpec sqlQuery, - CosmosQueryRequestOptions options, + QueryFeedOperationState state, Class klass, ResourceType resourceTypeEnum) { String resourceLink = parentResourceLinkToQueryLink(parentResourceLink, resourceTypeEnum); - UUID correlationActivityIdOfRequestOptions = ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .getCorrelationActivityId(options); + CosmosQueryRequestOptions nonNullQueryOptions = state.getQueryOptions(); + + UUID correlationActivityIdOfRequestOptions = qryOptAccessor + .getCorrelationActivityId(nonNullQueryOptions); UUID correlationActivityId = correlationActivityIdOfRequestOptions != null ? correlationActivityIdOfRequestOptions : randomUuid(); final AtomicBoolean isQueryCancelledOnTimeout = new AtomicBoolean(false); - IDocumentQueryClient queryClient = documentQueryClientImpl(RxDocumentClientImpl.this, getOperationContextAndListenerTuple(options)); + IDocumentQueryClient queryClient = documentQueryClientImpl(RxDocumentClientImpl.this, getOperationContextAndListenerTuple(nonNullQueryOptions)); // Trying to put this logic as low as the query pipeline // Since for parallelQuery, each partition will have its own request, so at this point, there will be no request associate with this retry policy. @@ -951,15 +956,32 @@ private Flux> createQuery( this.collectionCache, null, resourceLink, - ModelBridgeInternal.getPropertiesFromQueryRequestOptions(options)); + ModelBridgeInternal.getPropertiesFromQueryRequestOptions(nonNullQueryOptions)); - return ObservableHelper.fluxInlineIfPossibleAsObs( - () -> createQueryInternal( - resourceLink, sqlQuery, options, klass, resourceTypeEnum, queryClient, correlationActivityId, isQueryCancelledOnTimeout), - invalidPartitionExceptionRetryPolicy); + + final ScopedDiagnosticsFactory diagnosticsFactory = new ScopedDiagnosticsFactory(this); + state.registerDiagnosticsFactory( + diagnosticsFactory::reset, + diagnosticsFactory::merge); + + return + ObservableHelper.fluxInlineIfPossibleAsObs( + () -> createQueryInternal( + diagnosticsFactory, resourceLink, sqlQuery, state.getQueryOptions(), klass, resourceTypeEnum, queryClient, correlationActivityId, isQueryCancelledOnTimeout), + invalidPartitionExceptionRetryPolicy + ).flatMap(result -> { + diagnosticsFactory.merge(state.getDiagnosticsContextSnapshot()); + return Mono.just(result); + }) + .onErrorMap(throwable -> { + diagnosticsFactory.merge(state.getDiagnosticsContextSnapshot()); + return throwable; + }) + .doOnCancel(() -> diagnosticsFactory.merge(state.getDiagnosticsContextSnapshot())); } private Flux> createQueryInternal( + DiagnosticsClientContext diagnosticsClientContext, String resourceLink, SqlQuerySpec sqlQuery, CosmosQueryRequestOptions options, @@ -971,7 +993,7 @@ private Flux> createQueryInternal( Flux> executionContext = DocumentQueryExecutionContextFactory - .createDocumentQueryExecutionContextAsync(this, queryClient, resourceTypeEnum, klass, sqlQuery, + .createDocumentQueryExecutionContextAsync(diagnosticsClientContext, queryClient, resourceTypeEnum, klass, sqlQuery, options, resourceLink, false, activityId, Configs.isQueryPlanCachingEnabled(), queryPlanCache, isQueryCancelledOnTimeout); @@ -1023,9 +1045,7 @@ private static void applyExceptionToMergedDiagnostics( CosmosException exception) { List cancelledRequestDiagnostics = - ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() + qryOptAccessor .getCancelledRequestDiagnosticsTracker(requestOptions); // if there is any cancelled requests, collect cosmos diagnostics @@ -1068,8 +1088,6 @@ private static Flux> getFeedResponseFluxWithTimeout( Duration endToEndTimeout = endToEndPolicyConfig.getEndToEndOperationTimeout(); - - Flux> flux; if (endToEndTimeout.isNegative()) { return feedResponseFlux .timeout(endToEndTimeout) @@ -1106,14 +1124,14 @@ private static Flux> getFeedResponseFluxWithTimeout( } @Override - public Flux> queryDatabases(String query, CosmosQueryRequestOptions options) { - return queryDatabases(new SqlQuerySpec(query), options); + public Flux> queryDatabases(String query, QueryFeedOperationState state) { + return queryDatabases(new SqlQuerySpec(query), state); } @Override - public Flux> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { - return createQuery(Paths.DATABASES_ROOT, querySpec, options, Database.class, ResourceType.Database); + public Flux> queryDatabases(SqlQuerySpec querySpec, QueryFeedOperationState state) { + return createQuery(Paths.DATABASES_ROOT, querySpec, state, Database.class, ResourceType.Database); } @Override @@ -1351,26 +1369,26 @@ private Mono> readCollectionInternal(String } @Override - public Flux> readCollections(String databaseLink, CosmosQueryRequestOptions options) { + public Flux> readCollections(String databaseLink, QueryFeedOperationState state) { if (StringUtils.isEmpty(databaseLink)) { throw new IllegalArgumentException("databaseLink"); } - return readFeed(options, ResourceType.DocumentCollection, DocumentCollection.class, + return readFeed(state, ResourceType.DocumentCollection, DocumentCollection.class, Utils.joinPath(databaseLink, Paths.COLLECTIONS_PATH_SEGMENT)); } @Override public Flux> queryCollections(String databaseLink, String query, - CosmosQueryRequestOptions options) { - return createQuery(databaseLink, new SqlQuerySpec(query), options, DocumentCollection.class, ResourceType.DocumentCollection); + QueryFeedOperationState state) { + return createQuery(databaseLink, new SqlQuerySpec(query), state, DocumentCollection.class, ResourceType.DocumentCollection); } @Override public Flux> queryCollections(String databaseLink, - SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { - return createQuery(databaseLink, querySpec, options, DocumentCollection.class, ResourceType.DocumentCollection); + SqlQuerySpec querySpec, QueryFeedOperationState state) { + return createQuery(databaseLink, querySpec, state, DocumentCollection.class, ResourceType.DocumentCollection); } private static String serializeProcedureParams(List objectArray) { @@ -2709,13 +2727,13 @@ private Mono> readDocumentInternal(String documentLin @Override public Flux> readDocuments( - String collectionLink, CosmosQueryRequestOptions options, Class classOfT) { + String collectionLink, QueryFeedOperationState state, Class classOfT) { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } - return queryDocuments(collectionLink, "SELECT * FROM r", options, classOfT); + return queryDocuments(collectionLink, "SELECT * FROM r", state, classOfT); } @Override @@ -3113,9 +3131,9 @@ private Flux> pointReadsForReadMany( @Override public Flux> queryDocuments( - String collectionLink, String query, CosmosQueryRequestOptions options, Class classOfT) { + String collectionLink, String query, QueryFeedOperationState state, Class classOfT) { - return queryDocuments(collectionLink, new SqlQuerySpec(query), options, classOfT); + return queryDocuments(collectionLink, new SqlQuerySpec(query), state, classOfT); } private IDocumentQueryClient documentQueryClientImpl(RxDocumentClientImpl rxDocumentClientImpl, OperationContextAndListenerTuple operationContextAndListenerTuple) { @@ -3173,6 +3191,23 @@ public QueryCompatibilityMode getQueryCompatibilityMode() { return QueryCompatibilityMode.Default; } + @Override + public Mono executeFeedOperationWithAvailabilityStrategy( + ResourceType resourceType, + OperationType operationType, + Supplier retryPolicyFactory, + RxDocumentServiceRequest req, + BiFunction, RxDocumentServiceRequest, Mono> feedOperation) { + + return RxDocumentClientImpl.this.executeFeedOperationWithAvailabilityStrategy( + resourceType, + operationType, + retryPolicyFactory, + req, + feedOperation + ); + } + @Override public Mono readFeedAsync(RxDocumentServiceRequest request) { // TODO Auto-generated method stub @@ -3185,10 +3220,10 @@ public Mono readFeedAsync(RxDocumentServiceRequest re public Flux> queryDocuments( String collectionLink, SqlQuerySpec querySpec, - CosmosQueryRequestOptions options, + QueryFeedOperationState state, Class classOfT) { SqlQuerySpecLogger.getInstance().logQuery(querySpec); - return createQuery(collectionLink, querySpec, options, classOfT, ResourceType.Document); + return createQuery(collectionLink, querySpec, state, classOfT, ResourceType.Document); } @Override @@ -3210,11 +3245,16 @@ public Flux> queryDocumentChangeFeed( return changeFeedQueryImpl.executeAsync(); } + @Override + public Flux> queryDocumentChangeFeedFromPagedFlux(DocumentCollection collection, ChangeFeedOperationState state, Class classOfT) { + return queryDocumentChangeFeed(collection, state.getChangeFeedOptions(), classOfT); + } + @Override public Flux> readAllDocuments( String collectionLink, PartitionKey partitionKey, - CosmosQueryRequestOptions options, + QueryFeedOperationState state, Class classOfT) { if (StringUtils.isEmpty(collectionLink)) { @@ -3225,7 +3265,36 @@ public Flux> readAllDocuments( throw new IllegalArgumentException("partitionKey"); } - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(this, + final CosmosQueryRequestOptions effectiveOptions = + qryOptAccessor.clone(state.getQueryOptions()); + + RequestOptions nonNullRequestOptions = qryOptAccessor.toRequestOptions(effectiveOptions); + + CosmosEndToEndOperationLatencyPolicyConfig endToEndPolicyConfig = + nonNullRequestOptions.getCosmosEndToEndLatencyPolicyConfig(); + + List orderedApplicableRegionsForSpeculation = getApplicableRegionsForSpeculation( + endToEndPolicyConfig, + ResourceType.Document, + OperationType.Query, + false, + nonNullRequestOptions); + + DiagnosticsClientContext effectiveClientContext; + ScopedDiagnosticsFactory diagnosticsFactory; + if (orderedApplicableRegionsForSpeculation.size() < 2) { + effectiveClientContext = this; + diagnosticsFactory = null; + } else { + diagnosticsFactory = new ScopedDiagnosticsFactory(this); + state.registerDiagnosticsFactory( + () -> diagnosticsFactory.reset(), + (ctx) -> diagnosticsFactory.merge(ctx)); + effectiveClientContext = diagnosticsFactory; + } + + RxDocumentServiceRequest request = RxDocumentServiceRequest.create( + effectiveClientContext, OperationType.Query, ResourceType.Document, collectionLink, @@ -3252,10 +3321,7 @@ public Flux> readAllDocuments( final AtomicBoolean isQueryCancelledOnTimeout = new AtomicBoolean(false); - IDocumentQueryClient queryClient = documentQueryClientImpl(RxDocumentClientImpl.this, getOperationContextAndListenerTuple(options)); - - final CosmosQueryRequestOptions effectiveOptions = - ModelBridgeInternal.createQueryRequestOptions(options); + IDocumentQueryClient queryClient = documentQueryClientImpl(RxDocumentClientImpl.this, getOperationContextAndListenerTuple(state.getQueryOptions())); // Trying to put this logic as low as the query pipeline // Since for parallelQuery, each partition will have its own request, so at this point, there will be no request associate with this retry policy. @@ -3266,7 +3332,7 @@ public Flux> readAllDocuments( resourceLink, ModelBridgeInternal.getPropertiesFromQueryRequestOptions(effectiveOptions)); - return ObservableHelper.fluxInlineIfPossibleAsObs( + Flux> innerFlux = ObservableHelper.fluxInlineIfPossibleAsObs( () -> { Flux> valueHolderMono = this.partitionKeyRangeCache .tryLookupAsync( @@ -3274,6 +3340,7 @@ public Flux> readAllDocuments( collection.getResourceId(), null, null).flux(); + return valueHolderMono.flatMap(collectionRoutingMapValueHolder -> { CollectionRoutingMap routingMap = collectionRoutingMapValueHolder.v; @@ -3292,6 +3359,7 @@ public Flux> readAllDocuments( routingMap.getRangeByEffectivePartitionKey(effectivePartitionKeyString); return createQueryInternal( + effectiveClientContext, resourceLink, querySpec, ModelBridgeInternal.setPartitionKeyRangeIdInternal(effectiveOptions, range.getId()), @@ -3303,6 +3371,21 @@ public Flux> readAllDocuments( }); }, invalidPartitionExceptionRetryPolicy); + + if (orderedApplicableRegionsForSpeculation.size() < 2) { + return innerFlux; + } + + return innerFlux + .flatMap(result -> { + diagnosticsFactory.merge(nonNullRequestOptions); + return Mono.just(result); + }) + .onErrorMap(throwable -> { + diagnosticsFactory.merge(nonNullRequestOptions); + return throwable; + }) + .doOnCancel(() -> diagnosticsFactory.merge(nonNullRequestOptions)); }); } @@ -3313,16 +3396,26 @@ public Map getQueryPlanCache() { @Override public Flux> readPartitionKeyRanges(final String collectionLink, - CosmosQueryRequestOptions options) { + QueryFeedOperationState state) { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } - return readFeed(options, ResourceType.PartitionKeyRange, PartitionKeyRange.class, + return readFeed(state, ResourceType.PartitionKeyRange, PartitionKeyRange.class, Utils.joinPath(collectionLink, Paths.PARTITION_KEY_RANGES_PATH_SEGMENT)); } + @Override + public Flux> readPartitionKeyRanges(String collectionLink, CosmosQueryRequestOptions options) { + if (StringUtils.isEmpty(collectionLink)) { + throw new IllegalArgumentException("collectionLink"); + } + + return readFeed(options, ResourceType.PartitionKeyRange, PartitionKeyRange.class, + Utils.joinPath(collectionLink, Paths.PARTITION_KEY_RANGES_PATH_SEGMENT)); + } + private RxDocumentServiceRequest getStoredProcedureRequest(String collectionLink, StoredProcedure storedProcedure, RequestOptions options, OperationType operationType) { if (StringUtils.isEmpty(collectionLink)) { @@ -3336,10 +3429,8 @@ private RxDocumentServiceRequest getStoredProcedureRequest(String collectionLink String path = Utils.joinPath(collectionLink, Paths.STORED_PROCEDURES_PATH_SEGMENT); Map requestHeaders = this.getRequestHeaders(options, ResourceType.StoredProcedure, operationType); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(this, operationType, + return RxDocumentServiceRequest.create(this, operationType, ResourceType.StoredProcedure, path, storedProcedure, requestHeaders, options); - - return request; } private RxDocumentServiceRequest getUserDefinedFunctionRequest(String collectionLink, UserDefinedFunction udf, @@ -3355,10 +3446,8 @@ private RxDocumentServiceRequest getUserDefinedFunctionRequest(String collection String path = Utils.joinPath(collectionLink, Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT); Map requestHeaders = this.getRequestHeaders(options, ResourceType.UserDefinedFunction, operationType); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(this, + return RxDocumentServiceRequest.create(this, operationType, ResourceType.UserDefinedFunction, path, udf, requestHeaders, options); - - return request; } @Override @@ -3507,26 +3596,26 @@ private Mono> readStoredProcedureInternal(Stri @Override public Flux> readStoredProcedures(String collectionLink, - CosmosQueryRequestOptions options) { + QueryFeedOperationState state) { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } - return readFeed(options, ResourceType.StoredProcedure, StoredProcedure.class, + return readFeed(state, ResourceType.StoredProcedure, StoredProcedure.class, Utils.joinPath(collectionLink, Paths.STORED_PROCEDURES_PATH_SEGMENT)); } @Override public Flux> queryStoredProcedures(String collectionLink, String query, - CosmosQueryRequestOptions options) { - return queryStoredProcedures(collectionLink, new SqlQuerySpec(query), options); + QueryFeedOperationState state) { + return queryStoredProcedures(collectionLink, new SqlQuerySpec(query), state); } @Override public Flux> queryStoredProcedures(String collectionLink, - SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { - return createQuery(collectionLink, querySpec, options, StoredProcedure.class, ResourceType.StoredProcedure); + SqlQuerySpec querySpec, QueryFeedOperationState state) { + return createQuery(collectionLink, querySpec, state, StoredProcedure.class, ResourceType.StoredProcedure); } @Override @@ -3644,10 +3733,8 @@ private RxDocumentServiceRequest getTriggerRequest(String collectionLink, Trigge String path = Utils.joinPath(collectionLink, Paths.TRIGGERS_PATH_SEGMENT); Map requestHeaders = getRequestHeaders(options, ResourceType.Trigger, operationType); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(this, operationType, ResourceType.Trigger, path, + return RxDocumentServiceRequest.create(this, operationType, ResourceType.Trigger, path, trigger, requestHeaders, options); - - return request; } @Override @@ -3746,26 +3833,26 @@ private Mono> readTriggerInternal(String triggerLink, } @Override - public Flux> readTriggers(String collectionLink, CosmosQueryRequestOptions options) { + public Flux> readTriggers(String collectionLink, QueryFeedOperationState state) { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } - return readFeed(options, ResourceType.Trigger, Trigger.class, + return readFeed(state, ResourceType.Trigger, Trigger.class, Utils.joinPath(collectionLink, Paths.TRIGGERS_PATH_SEGMENT)); } @Override public Flux> queryTriggers(String collectionLink, String query, - CosmosQueryRequestOptions options) { - return queryTriggers(collectionLink, new SqlQuerySpec(query), options); + QueryFeedOperationState state) { + return queryTriggers(collectionLink, new SqlQuerySpec(query), state); } @Override public Flux> queryTriggers(String collectionLink, SqlQuerySpec querySpec, - CosmosQueryRequestOptions options) { - return createQuery(collectionLink, querySpec, options, Trigger.class, ResourceType.Trigger); + QueryFeedOperationState state) { + return createQuery(collectionLink, querySpec, state, Trigger.class, ResourceType.Trigger); } @Override @@ -3914,26 +4001,32 @@ private Mono> readUserDefinedFunctionInter @Override public Flux> readUserDefinedFunctions(String collectionLink, - CosmosQueryRequestOptions options) { + QueryFeedOperationState state) { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } - return readFeed(options, ResourceType.UserDefinedFunction, UserDefinedFunction.class, + return readFeed(state, ResourceType.UserDefinedFunction, UserDefinedFunction.class, Utils.joinPath(collectionLink, Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT)); } @Override - public Flux> queryUserDefinedFunctions(String collectionLink, - String query, CosmosQueryRequestOptions options) { - return queryUserDefinedFunctions(collectionLink, new SqlQuerySpec(query), options); + public Flux> queryUserDefinedFunctions( + String collectionLink, + String query, + QueryFeedOperationState state) { + + return queryUserDefinedFunctions(collectionLink, new SqlQuerySpec(query), state); } @Override - public Flux> queryUserDefinedFunctions(String collectionLink, - SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { - return createQuery(collectionLink, querySpec, options, UserDefinedFunction.class, ResourceType.UserDefinedFunction); + public Flux> queryUserDefinedFunctions( + String collectionLink, + SqlQuerySpec querySpec, + QueryFeedOperationState state) { + + return createQuery(collectionLink, querySpec, state, UserDefinedFunction.class, ResourceType.UserDefinedFunction); } @Override @@ -3971,26 +4064,26 @@ private Mono> readConflictInternal(String conflictLin } @Override - public Flux> readConflicts(String collectionLink, CosmosQueryRequestOptions options) { + public Flux> readConflicts(String collectionLink, QueryFeedOperationState state) { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } - return readFeed(options, ResourceType.Conflict, Conflict.class, + return readFeed(state, ResourceType.Conflict, Conflict.class, Utils.joinPath(collectionLink, Paths.CONFLICTS_PATH_SEGMENT)); } @Override public Flux> queryConflicts(String collectionLink, String query, - CosmosQueryRequestOptions options) { - return queryConflicts(collectionLink, new SqlQuerySpec(query), options); + QueryFeedOperationState state) { + return queryConflicts(collectionLink, new SqlQuerySpec(query), state); } @Override public Flux> queryConflicts(String collectionLink, SqlQuerySpec querySpec, - CosmosQueryRequestOptions options) { - return createQuery(collectionLink, querySpec, options, Conflict.class, ResourceType.Conflict); + QueryFeedOperationState state) { + return createQuery(collectionLink, querySpec, state, Conflict.class, ResourceType.Conflict); } @Override @@ -4082,10 +4175,8 @@ private RxDocumentServiceRequest getUserRequest(String databaseLink, User user, String path = Utils.joinPath(databaseLink, Paths.USERS_PATH_SEGMENT); Map requestHeaders = getRequestHeaders(options, ResourceType.User, operationType); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(this, + return RxDocumentServiceRequest.create(this, operationType, ResourceType.User, path, user, requestHeaders, options); - - return request; } @Override @@ -4177,25 +4268,25 @@ private Mono> readUserInternal(String userLink, RequestOp } @Override - public Flux> readUsers(String databaseLink, CosmosQueryRequestOptions options) { + public Flux> readUsers(String databaseLink, QueryFeedOperationState state) { if (StringUtils.isEmpty(databaseLink)) { throw new IllegalArgumentException("databaseLink"); } - return readFeed(options, ResourceType.User, User.class, + return readFeed(state, ResourceType.User, User.class, Utils.joinPath(databaseLink, Paths.USERS_PATH_SEGMENT)); } @Override - public Flux> queryUsers(String databaseLink, String query, CosmosQueryRequestOptions options) { - return queryUsers(databaseLink, new SqlQuerySpec(query), options); + public Flux> queryUsers(String databaseLink, String query, QueryFeedOperationState state) { + return queryUsers(databaseLink, new SqlQuerySpec(query), state); } @Override public Flux> queryUsers(String databaseLink, SqlQuerySpec querySpec, - CosmosQueryRequestOptions options) { - return createQuery(databaseLink, querySpec, options, User.class, ResourceType.User); + QueryFeedOperationState state) { + return createQuery(databaseLink, querySpec, state, User.class, ResourceType.User); } @Override @@ -4260,10 +4351,8 @@ private RxDocumentServiceRequest getClientEncryptionKeyRequest(String databaseLi String path = Utils.joinPath(databaseLink, Paths.CLIENT_ENCRYPTION_KEY_PATH_SEGMENT); Map requestHeaders = getRequestHeaders(options, ResourceType.ClientEncryptionKey, operationType); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(this, + return RxDocumentServiceRequest.create(this, operationType, ResourceType.ClientEncryptionKey, path, clientEncryptionKey, requestHeaders, options); - - return request; } @Override @@ -4303,18 +4392,23 @@ private Mono> replaceClientEncryptionKeyIn } @Override - public Flux> readClientEncryptionKeys(String databaseLink, CosmosQueryRequestOptions options) { + public Flux> readClientEncryptionKeys( + String databaseLink, + QueryFeedOperationState state) { if (StringUtils.isEmpty(databaseLink)) { throw new IllegalArgumentException("databaseLink"); } - return readFeed(options, ResourceType.ClientEncryptionKey, ClientEncryptionKey.class, + return readFeed(state, ResourceType.ClientEncryptionKey, ClientEncryptionKey.class, Utils.joinPath(databaseLink, Paths.CLIENT_ENCRYPTION_KEY_PATH_SEGMENT)); } @Override - public Flux> queryClientEncryptionKeys(String databaseLink, SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { - return createQuery(databaseLink, querySpec, options, ClientEncryptionKey.class, ResourceType.ClientEncryptionKey); + public Flux> queryClientEncryptionKeys( + String databaseLink, + SqlQuerySpec querySpec, + QueryFeedOperationState state) { + return createQuery(databaseLink, querySpec, state, ClientEncryptionKey.class, ResourceType.ClientEncryptionKey); } @Override @@ -4378,10 +4472,8 @@ private RxDocumentServiceRequest getPermissionRequest(String userLink, Permissio String path = Utils.joinPath(userLink, Paths.PERMISSIONS_PATH_SEGMENT); Map requestHeaders = getRequestHeaders(options, ResourceType.Permission, operationType); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(this, + return RxDocumentServiceRequest.create(this, operationType, ResourceType.Permission, path, permission, requestHeaders, options); - - return request; } @Override @@ -4475,26 +4567,26 @@ private Mono> readPermissionInternal(String permiss } @Override - public Flux> readPermissions(String userLink, CosmosQueryRequestOptions options) { + public Flux> readPermissions(String userLink, QueryFeedOperationState state) { if (StringUtils.isEmpty(userLink)) { throw new IllegalArgumentException("userLink"); } - return readFeed(options, ResourceType.Permission, Permission.class, + return readFeed(state, ResourceType.Permission, Permission.class, Utils.joinPath(userLink, Paths.PERMISSIONS_PATH_SEGMENT)); } @Override public Flux> queryPermissions(String userLink, String query, - CosmosQueryRequestOptions options) { - return queryPermissions(userLink, new SqlQuerySpec(query), options); + QueryFeedOperationState state) { + return queryPermissions(userLink, new SqlQuerySpec(query), state); } @Override public Flux> queryPermissions(String userLink, SqlQuerySpec querySpec, - CosmosQueryRequestOptions options) { - return createQuery(userLink, querySpec, options, Permission.class, ResourceType.Permission); + QueryFeedOperationState state) { + return createQuery(userLink, querySpec, state, Permission.class, ResourceType.Permission); } @Override @@ -4551,59 +4643,32 @@ private Mono> readOfferInternal(String offerLink, Docume } @Override - public Flux> readOffers(CosmosQueryRequestOptions options) { - return readFeed(options, ResourceType.Offer, Offer.class, + public Flux> readOffers(QueryFeedOperationState state) { + return readFeed(state, ResourceType.Offer, Offer.class, Utils.joinPath(Paths.OFFERS_PATH_SEGMENT, null)); } -// private Flux> readFeedCollectionChild(FeedOptions options, ResourceType resourceType, -// Class klass, String resourceLink) { -// if (options == null) { -// options = new FeedOptions(); -// } -// -// int maxPageSize = options.getMaxItemCount() != null ? options.getMaxItemCount() : -1; -// -// final FeedOptions finalFeedOptions = options; -// RequestOptions requestOptions = new RequestOptions(); -// requestOptions.setPartitionKey(options.getPartitionKey()); -// BiFunction createRequestFunc = (continuationToken, pageSize) -> { -// Map requestHeaders = new HashMap<>(); -// if (continuationToken != null) { -// requestHeaders.put(HttpConstants.HttpHeaders.CONTINUATION, continuationToken); -// } -// requestHeaders.put(HttpConstants.HttpHeaders.PAGE_SIZE, Integer.toString(pageSize)); -// RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ReadFeed, -// resourceType, resourceLink, requestHeaders, finalFeedOptions); -// return request; -// }; -// -// Function>> executeFunc = request -> { -// return ObservableHelper.inlineIfPossibleAsObs(() -> { -// Mono> collectionObs = this.collectionCache.resolveCollectionAsync(request); -// Mono requestObs = this.addPartitionKeyInformation(request, null, null, requestOptions, collectionObs); -// -// return requestObs.flatMap(req -> this.readFeed(req) -// .map(response -> toFeedResponsePage(response, klass))); -// }, this.resetSessionTokenRetryPolicy.getRequestPolicy()); -// }; -// -// return Paginator.getPaginatedQueryResultAsObservable(options, createRequestFunc, executeFunc, klass, maxPageSize); -// } private Flux> readFeed( - CosmosQueryRequestOptions options, + QueryFeedOperationState state, ResourceType resourceType, Class klass, String resourceLink) { - if (options == null) { - options = new CosmosQueryRequestOptions(); - } + return readFeed(state.getQueryOptions(), resourceType, klass, resourceLink); + } - Integer maxItemCount = ModelBridgeInternal.getMaxItemCountFromQueryRequestOptions(options); + private Flux> readFeed( + CosmosQueryRequestOptions options, + ResourceType resourceType, + Class klass, + String resourceLink) { + + final CosmosQueryRequestOptions nonNullOptions = options != null ? options : new CosmosQueryRequestOptions(); + Integer maxItemCount = ModelBridgeInternal.getMaxItemCountFromQueryRequestOptions(nonNullOptions); int maxPageSize = maxItemCount != null ? maxItemCount : -1; - final CosmosQueryRequestOptions finalCosmosQueryRequestOptions = options; - // TODO @fabianm wire up clientContext + + assert(resourceType != ResourceType.Document); + // readFeed is only used for non-document operations - no need to wire up hedging DocumentClientRetryPolicy retryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(null); BiFunction createRequestFunc = (continuationToken, pageSize) -> { Map requestHeaders = new HashMap<>(); @@ -4612,7 +4677,7 @@ private Flux> readFeed( } requestHeaders.put(HttpConstants.HttpHeaders.PAGE_SIZE, Integer.toString(pageSize)); RxDocumentServiceRequest request = RxDocumentServiceRequest.create(this, - OperationType.ReadFeed, resourceType, resourceLink, requestHeaders, finalCosmosQueryRequestOptions); + OperationType.ReadFeed, resourceType, resourceLink, requestHeaders, nonNullOptions); retryPolicy.onBeforeSendRequest(request); return request; }; @@ -4623,26 +4688,26 @@ private Flux> readFeed( ImplementationBridgeHelpers .CosmosQueryRequestOptionsHelper .getCosmosQueryRequestOptionsAccessor() - .getItemFactoryMethod(finalCosmosQueryRequestOptions, klass), + .getItemFactoryMethod(nonNullOptions, klass), klass)), retryPolicy); return Paginator .getPaginatedQueryResultAsObservable( - options, + nonNullOptions, createRequestFunc, executeFunc, maxPageSize); } @Override - public Flux> queryOffers(String query, CosmosQueryRequestOptions options) { - return queryOffers(new SqlQuerySpec(query), options); + public Flux> queryOffers(String query, QueryFeedOperationState state) { + return queryOffers(new SqlQuerySpec(query), state); } @Override - public Flux> queryOffers(SqlQuerySpec querySpec, CosmosQueryRequestOptions options) { - return createQuery(null, querySpec, options, Offer.class, ResourceType.Offer); + public Flux> queryOffers(SqlQuerySpec querySpec, QueryFeedOperationState state) { + return createQuery(null, querySpec, state, Offer.class, ResourceType.Offer); } @Override @@ -4830,7 +4895,11 @@ public synchronized void enableThroughputControlGroup(ThroughputControlGroupInte this.connectionPolicy.getConnectionMode(), this.partitionKeyRangeCache); - this.storeModel.enableThroughputControl(throughputControlStore); + if (ConnectionMode.DIRECT == this.connectionPolicy.getConnectionMode()) { + this.storeModel.enableThroughputControl(throughputControlStore); + } else { + this.gatewayProxy.enableThroughputControl(throughputControlStore); + } } this.throughputControlStore.enableThroughputControlGroup(group, throughputQueryMono); @@ -4873,6 +4942,11 @@ public void recordOpenConnectionsAndInitCachesStarted(List> wrapPointOperationWithAvailabilityStrat // the error would otherwise be treated as transient Mono initialMonoAcrossAllRegions = callback.apply(clonedOptions, endToEndPolicyConfig, diagnosticsFactory) - .map(response -> new NonTransientPointOperationResult(response)) + .map(NonTransientPointOperationResult::new) .onErrorResume( - t -> isCosmosException(t), + RxDocumentClientImpl::isCosmosException, t -> Mono.just( new NonTransientPointOperationResult( Utils.as(Exceptions.unwrap(t), CosmosException.class)))); @@ -5051,7 +5125,7 @@ private Mono> wrapPointOperationWithAvailabilityStrat } else { clonedOptions.setExcludeRegions( getEffectiveExcludedRegionsForHedging( - initialRequestOptions.getExcludeRegions(), + nonNullRequestOptions.getExcludeRegions(), orderedApplicableRegionsForSpeculation, region) ); @@ -5061,9 +5135,9 @@ private Mono> wrapPointOperationWithAvailabilityStrat // and non-transient errors Mono regionalCrossRegionRetryMono = callback.apply(clonedOptions, endToEndPolicyConfig, diagnosticsFactory) - .map(response -> new NonTransientPointOperationResult(response)) + .map(NonTransientPointOperationResult::new) .onErrorResume( - t -> isNonTransientCosmosException(t), + RxDocumentClientImpl::isNonTransientCosmosException, t -> Mono.just( new NonTransientPointOperationResult( Utils.as(Exceptions.unwrap(t), CosmosException.class)))); @@ -5121,7 +5195,7 @@ private Mono> wrapPointOperationWithAvailabilityStrat CosmosException cosmosException = Utils.as(innerException, CosmosException.class); diagnosticsFactory.merge(nonNullRequestOptions); return cosmosException; - } else if (exception instanceof NoSuchElementException) { + } else if (innerException instanceof NoSuchElementException) { logger.trace( "Operation in {} completed with empty result because it was cancelled.", orderedApplicableRegionsForSpeculation.get(index)); @@ -5231,12 +5305,7 @@ private DiagnosticsClientContext getEffectiveClientContext(DiagnosticsClientCont * @param operationType - the operationT * @return the applicable endpoints ordered by preference list if any */ - private List getApplicableEndPoints(OperationType operationType, RequestOptions options) { - List excludedRegions = null; - if (options != null) { - excludedRegions = options.getExcludeRegions(); - } - + private List getApplicableEndPoints(OperationType operationType, List excludedRegions) { if (operationType.isReadOnlyOperation()) { return withoutNulls(this.globalEndpointManager.getApplicableReadEndpoints(excludedRegions)); } else if (operationType.isWriteOperation()) { @@ -5270,6 +5339,21 @@ private List getApplicableRegionsForSpeculation( boolean isIdempotentWriteRetriesEnabled, RequestOptions options) { + return getApplicableRegionsForSpeculation( + endToEndPolicyConfig, + resourceType, + operationType, + isIdempotentWriteRetriesEnabled, + options.getExcludeRegions()); + } + + private List getApplicableRegionsForSpeculation( + CosmosEndToEndOperationLatencyPolicyConfig endToEndPolicyConfig, + ResourceType resourceType, + OperationType operationType, + boolean isIdempotentWriteRetriesEnabled, + List excludedRegions) { + if (endToEndPolicyConfig == null || !endToEndPolicyConfig.isEnabled()) { return EMPTY_REGION_LIST; } @@ -5290,13 +5374,11 @@ private List getApplicableRegionsForSpeculation( return EMPTY_REGION_LIST; } - List endpoints = getApplicableEndPoints(operationType, options); + List endpoints = getApplicableEndPoints(operationType, excludedRegions); HashSet normalizedExcludedRegions = new HashSet<>(); - if (options.getExcludeRegions() != null) { - options - .getExcludeRegions() - .forEach(r -> normalizedExcludedRegions.add(r.toLowerCase(Locale.ROOT))); + if (excludedRegions != null) { + excludedRegions.forEach(r -> normalizedExcludedRegions.add(r.toLowerCase(Locale.ROOT))); } List orderedRegionsForSpeculation = new ArrayList<>(); @@ -5310,6 +5392,158 @@ private List getApplicableRegionsForSpeculation( return orderedRegionsForSpeculation; } + private Mono executeFeedOperationWithAvailabilityStrategy( + final ResourceType resourceType, + final OperationType operationType, + final Supplier retryPolicyFactory, + final RxDocumentServiceRequest req, + final BiFunction, RxDocumentServiceRequest, Mono> feedOperation + ) { + checkNotNull(retryPolicyFactory, "Argument 'retryPolicyFactory' must not be null."); + checkNotNull(req, "Argument 'req' must not be null."); + assert(resourceType == ResourceType.Document); + + CosmosEndToEndOperationLatencyPolicyConfig endToEndPolicyConfig = req + .requestContext + .getEndToEndOperationLatencyPolicyConfig(); + + List initialExcludedRegions = req.requestContext.getExcludeRegions(); + List orderedApplicableRegionsForSpeculation = this.getApplicableRegionsForSpeculation( + endToEndPolicyConfig, + resourceType, + operationType, + false, + initialExcludedRegions + ); + + if (orderedApplicableRegionsForSpeculation.size() < 2) { + // There is at most one applicable region - no hedging possible + return feedOperation.apply(retryPolicyFactory, req); + } + + ThresholdBasedAvailabilityStrategy availabilityStrategy = + (ThresholdBasedAvailabilityStrategy)endToEndPolicyConfig.getAvailabilityStrategy(); + List>> monoList = new ArrayList<>(); + + orderedApplicableRegionsForSpeculation + .forEach(region -> { + RxDocumentServiceRequest clonedRequest = req.clone(); + + if (monoList.isEmpty()) { + // no special error handling for transient errors to suppress them here + // because any cross-regional retries are expected to be processed + // by the ClientRetryPolicy for the initial request - so, any outcome of the + // initial Mono should be treated as non-transient error - even when + // the error would otherwise be treated as transient + Mono> initialMonoAcrossAllRegions = + feedOperation.apply(retryPolicyFactory, clonedRequest) + .map(NonTransientFeedOperationResult::new) + .onErrorResume( + RxDocumentClientImpl::isCosmosException, + t -> Mono.just( + new NonTransientFeedOperationResult<>( + Utils.as(Exceptions.unwrap(t), CosmosException.class)))); + + if (logger.isDebugEnabled()) { + monoList.add(initialMonoAcrossAllRegions.doOnSubscribe(c -> logger.debug( + "STARTING to process {} operation in region '{}'", + operationType, + region))); + } else { + monoList.add(initialMonoAcrossAllRegions); + } + } else { + clonedRequest.requestContext.setExcludeRegions( + getEffectiveExcludedRegionsForHedging( + initialExcludedRegions, + orderedApplicableRegionsForSpeculation, + region) + ); + + // Non-Transient errors are mapped to a value - this ensures the firstWithValue + // operator below will complete the composite Mono for both successful values + // and non-transient errors + Mono> regionalCrossRegionRetryMono = + feedOperation.apply(retryPolicyFactory, clonedRequest) + .map(NonTransientFeedOperationResult::new) + .onErrorResume( + RxDocumentClientImpl::isNonTransientCosmosException, + t -> Mono.just( + new NonTransientFeedOperationResult<>( + Utils.as(Exceptions.unwrap(t), CosmosException.class)))); + + Duration delayForCrossRegionalRetry = (availabilityStrategy) + .getThreshold() + .plus((availabilityStrategy) + .getThresholdStep() + .multipliedBy(monoList.size() - 1)); + + if (logger.isDebugEnabled()) { + monoList.add( + regionalCrossRegionRetryMono + .doOnSubscribe(c -> logger.debug("STARTING to process {} operation in region '{}'", operationType, region)) + .delaySubscription(delayForCrossRegionalRetry)); + } else { + monoList.add( + regionalCrossRegionRetryMono + .delaySubscription(delayForCrossRegionalRetry)); + } + } + }); + + // NOTE - merging diagnosticsFactory cannot only happen in + // doFinally operator because the doFinally operator is a side effect method - + // meaning it executes concurrently with firing the onComplete/onError signal + // doFinally is also triggered by cancellation + // So, to make sure merging the Context happens synchronously in line we + // have to ensure merging is happening on error/completion + // and also in doOnCancel. + return Mono + .firstWithValue(monoList) + .flatMap(nonTransientResult -> { + if (nonTransientResult.isError()) { + return Mono.error(nonTransientResult.exception); + } + + return Mono.just(nonTransientResult.response); + }) + .onErrorMap(throwable -> { + Throwable exception = Exceptions.unwrap(throwable); + + if (exception instanceof NoSuchElementException) { + + List innerThrowables = Exceptions + .unwrapMultiple(exception.getCause()); + + int index = 0; + for (Throwable innerThrowable : innerThrowables) { + Throwable innerException = Exceptions.unwrap(innerThrowable); + + // collect latest CosmosException instance bubbling up for a region + if (innerException instanceof CosmosException) { + return Utils.as(innerException, CosmosException.class); + } else if (innerException instanceof NoSuchElementException) { + logger.trace( + "Operation in {} completed with empty result because it was cancelled.", + orderedApplicableRegionsForSpeculation.get(index)); + } else if (logger.isWarnEnabled()) { + String message = "Unexpected Non-CosmosException when processing operation in '" + + orderedApplicableRegionsForSpeculation.get(index) + + "'."; + logger.warn( + message, + innerException + ); + } + + index++; + } + } + + return exception; + }); + } + @FunctionalInterface private interface DocumentPointOperation { Mono> apply(RequestOptions requestOptions, CosmosEndToEndOperationLatencyPolicyConfig endToEndOperationLatencyPolicyConfig, DiagnosticsClientContext clientContextOverride); @@ -5344,9 +5578,38 @@ public ResourceResponse getResponse() { } } + private static class NonTransientFeedOperationResult { + private final T response; + private final CosmosException exception; + + public NonTransientFeedOperationResult(CosmosException exception) { + checkNotNull(exception, "Argument 'exception' must not be null."); + this.exception = exception; + this.response = null; + } + + public NonTransientFeedOperationResult(T response) { + checkNotNull(response, "Argument 'response' must not be null."); + this.exception = null; + this.response = response; + } + + public boolean isError() { + return this.exception != null; + } + + public CosmosException getException() { + return this.exception; + } + + public T getResponse() { + return this.response; + } + } + private static class ScopedDiagnosticsFactory implements DiagnosticsClientContext { - private AtomicBoolean isMerged = new AtomicBoolean(false); + private final AtomicBoolean isMerged = new AtomicBoolean(false); private final DiagnosticsClientContext inner; private final ConcurrentLinkedQueue createdDiagnostics; @@ -5374,16 +5637,27 @@ public String getUserAgent() { } public void merge(RequestOptions requestOptions) { + CosmosDiagnosticsContext knownCtx = null; + + if (requestOptions != null) { + CosmosDiagnosticsContext ctxSnapshot = requestOptions.getDiagnosticsContextSnapshot(); + if (ctxSnapshot != null) { + knownCtx = requestOptions.getDiagnosticsContextSnapshot(); + } + } + + merge(knownCtx); + } + + public void merge(CosmosDiagnosticsContext knownCtx) { if (!isMerged.compareAndSet(false, true)) { return; } CosmosDiagnosticsContext ctx = null; - if (requestOptions != null && - requestOptions.getDiagnosticsContext() != null) { - - ctx = requestOptions.getDiagnosticsContext(); + if (knownCtx != null) { + ctx = knownCtx; } else { for (CosmosDiagnostics diagnostics : this.createdDiagnostics) { if (diagnostics.getDiagnosticsContext() != null) { @@ -5403,5 +5677,10 @@ public void merge(RequestOptions requestOptions) { } } } + + public void reset() { + this.createdDiagnostics.clear(); + this.isMerged.set(false); + } } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentServiceRequest.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentServiceRequest.java index 54a0116864dd..91a57bdb7f87 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentServiceRequest.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxDocumentServiceRequest.java @@ -1056,6 +1056,7 @@ public RxDocumentServiceRequest clone() { rxDocumentServiceRequest.requestContext = this.requestContext.clone(); rxDocumentServiceRequest.feedRange = this.feedRange; rxDocumentServiceRequest.effectiveRange = this.effectiveRange; + rxDocumentServiceRequest.isFeed = this.isFeed; return rxDocumentServiceRequest; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java index 4cf7b59b996e..be7b8321aca6 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RxGatewayStoreModel.java @@ -209,7 +209,7 @@ public Mono performRequest(RxDocumentServiceRequest r request.requestContext.resourcePhysicalAddress = uri.toString(); if (this.throughputControlStore != null) { - return this.throughputControlStore.processRequest(request, performRequestInternal(request, method, uri)); + return this.throughputControlStore.processRequest(request, Mono.defer(() -> this.performRequestInternal(request, method, uri))); } return this.performRequestInternal(request, method, uri); @@ -568,8 +568,7 @@ public Mono processMessage(RxDocumentServiceRequest r @Override public void enableThroughputControl(ThroughputControlStore throughputControlStore) { - // no-op - // Disable throughput control for gateway mode + this.throughputControlStore = throughputControlStore; } @Override diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Utils.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Utils.java index 6c553a22649d..21ed06586f02 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Utils.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/Utils.java @@ -579,30 +579,6 @@ public static String utf8StringFromOrNull(byte[] bytes) { return new String(bytes, StandardCharsets.UTF_8); } - public static void setContinuationTokenAndMaxItemCount(CosmosPagedFluxOptions pagedFluxOptions, CosmosQueryRequestOptions cosmosQueryRequestOptions) { - if (pagedFluxOptions == null) { - return; - } - if (pagedFluxOptions.getRequestContinuation() != null) { - ModelBridgeInternal.setQueryRequestOptionsContinuationToken(cosmosQueryRequestOptions, pagedFluxOptions.getRequestContinuation()); - } - if (pagedFluxOptions.getMaxItemCount() != null) { - ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(cosmosQueryRequestOptions, pagedFluxOptions.getMaxItemCount()); - } else { - ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .applyMaxItemCount(cosmosQueryRequestOptions, pagedFluxOptions); - - // if query request options also don't have maxItemCount set, apply defaults - if (pagedFluxOptions.getMaxItemCount() == null) { - ModelBridgeInternal.setQueryRequestOptionsMaxItemCount( - cosmosQueryRequestOptions, Constants.Properties.DEFAULT_MAX_PAGE_SIZE); - pagedFluxOptions.setMaxItemCount(Constants.Properties.DEFAULT_MAX_PAGE_SIZE); - } - } - } - public static CosmosChangeFeedRequestOptions getEffectiveCosmosChangeFeedRequestOptions( CosmosPagedFluxOptions pagedFluxOptions, CosmosChangeFeedRequestOptions cosmosChangeFeedRequestRequestOptions) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/PartitionScopeThresholds.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/PartitionScopeThresholds.java index f8296cbfb2e4..32b0e2071973 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/PartitionScopeThresholds.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/batch/PartitionScopeThresholds.java @@ -35,10 +35,7 @@ public PartitionScopeThresholds(String pkRangeId, CosmosBulkExecutionOptions opt this.pkRangeId = pkRangeId; this.options = options; - this.targetMicroBatchSize = new AtomicInteger( - ImplementationBridgeHelpers.CosmosBulkExecutionOptionsHelper - .getCosmosBulkExecutionOptionsAccessor() - .getInitialMicroBatchSize(options)); + this.targetMicroBatchSize = new AtomicInteger(options.getInitialMicroBatchSize()); this.totalOperationCount = new AtomicLong(0); this.currentThresholds = new AtomicReference<>(new CurrentIntervalThresholds()); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxClientCollectionCache.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxClientCollectionCache.java index b69368a06d5f..d3514d5fff83 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxClientCollectionCache.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxClientCollectionCache.java @@ -70,7 +70,6 @@ public RxClientCollectionCache(DiagnosticsClientContext diagnosticsClientContext } protected Mono getByRidAsync(MetadataDiagnosticsContext metaDataDiagnosticsContext, String collectionRid, Map properties) { - // TODO @fabianm wire up clientContext DocumentClientRetryPolicy retryPolicyInstance = new ClearingSessionContainerClientRetryPolicy(this.sessionContainer, this.retryPolicy.getRequestPolicy(null)); return ObservableHelper.inlineIfPossible( () -> this.readCollectionAsync(metaDataDiagnosticsContext, PathsHelper.generatePath(ResourceType.DocumentCollection, collectionRid, false), retryPolicyInstance, properties) @@ -78,7 +77,6 @@ protected Mono getByRidAsync(MetadataDiagnosticsContext meta } protected Mono getByNameAsync(MetadataDiagnosticsContext metaDataDiagnosticsContext, String resourceAddress, Map properties) { - // TODO @fabianm wire up clientContext DocumentClientRetryPolicy retryPolicyInstance = new ClearingSessionContainerClientRetryPolicy(this.sessionContainer, this.retryPolicy.getRequestPolicy(null)); return ObservableHelper.inlineIfPossible( () -> this.readCollectionAsync(metaDataDiagnosticsContext, resourceAddress, retryPolicyInstance, properties), diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxPartitionKeyRangeCache.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxPartitionKeyRangeCache.java index efdf4d590156..dab4f2838194 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxPartitionKeyRangeCache.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/caches/RxPartitionKeyRangeCache.java @@ -3,6 +3,7 @@ package com.azure.cosmos.implementation.caches; import com.azure.cosmos.CosmosException; +import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.DiagnosticsClientContext; import com.azure.cosmos.implementation.DocumentCollection; import com.azure.cosmos.implementation.Exceptions; @@ -10,6 +11,7 @@ import com.azure.cosmos.implementation.NotFoundException; import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.PartitionKeyRange; +import com.azure.cosmos.implementation.QueryFeedOperationState; import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.RxDocumentClientImpl; import com.azure.cosmos.implementation.RxDocumentServiceRequest; @@ -257,6 +259,7 @@ private Mono> getPartitionKeyRange(MetadataDiagnosticsCo ModelBridgeInternal.setQueryRequestOptionsProperties(cosmosQueryRequestOptions, properties); } Instant addressCallStartTime = Instant.now(); + return client.readPartitionKeyRanges(coll.getSelfLink(), cosmosQueryRequestOptions) // maxConcurrent = 1 to makes it in the right getOrder .flatMap(p -> { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/ChangeFeedProcessorContextImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/ChangeFeedProcessorContextImpl.java new file mode 100644 index 000000000000..f29790c8280d --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/ChangeFeedProcessorContextImpl.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos.implementation.changefeed.common; + +import com.azure.cosmos.ChangeFeedProcessorContext; +import com.azure.cosmos.implementation.changefeed.ChangeFeedObserverContext; + +public final class ChangeFeedProcessorContextImpl implements ChangeFeedProcessorContext { + + private final ChangeFeedObserverContext changeFeedObserverContext; + + public ChangeFeedProcessorContextImpl(ChangeFeedObserverContext changeFeedObserverContext) { + this.changeFeedObserverContext = changeFeedObserverContext; + } + + @Override + public String getLeaseToken() { + + if (changeFeedObserverContext == null) { + throw new IllegalStateException("changeFeedObserverContext cannot be null!"); + } + + return changeFeedObserverContext.getLeaseToken(); + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/DefaultObserver.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/DefaultObserver.java index 3db26e6904b5..cace001a8e8e 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/DefaultObserver.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/DefaultObserver.java @@ -5,19 +5,28 @@ import com.azure.cosmos.implementation.changefeed.ChangeFeedObserver; import com.azure.cosmos.implementation.changefeed.ChangeFeedObserverCloseReason; import com.azure.cosmos.implementation.changefeed.ChangeFeedObserverContext; +import com.azure.cosmos.ChangeFeedProcessorContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import reactor.core.publisher.Mono; import java.util.List; +import java.util.function.BiConsumer; import java.util.function.Consumer; public class DefaultObserver implements ChangeFeedObserver { private static final Logger log = LoggerFactory.getLogger(DefaultObserver.class); private final Consumer> consumer; + private final BiConsumer, ChangeFeedProcessorContext> biConsumer; public DefaultObserver(Consumer> consumer) { this.consumer = consumer; + this.biConsumer = null; + } + + public DefaultObserver(BiConsumer, ChangeFeedProcessorContext> biConsumer) { + this.biConsumer = biConsumer; + this.consumer = null; } @Override @@ -34,7 +43,13 @@ public void close(ChangeFeedObserverContext context, ChangeFeedObserverCloseR public Mono processChanges(ChangeFeedObserverContext context, List docs) { log.info("Start processing from thread {}", Thread.currentThread().getId()); try { - consumer.accept(docs); + + if (consumer != null) { + consumer.accept(docs); + } else if (biConsumer != null) { + biConsumer.accept(docs, new ChangeFeedProcessorContextImpl<>(context)); + } + log.info("Done processing from thread {}", Thread.currentThread().getId()); } catch (Exception ex) { log.warn("Unexpected exception thrown from thread {}", Thread.currentThread().getId(), ex); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/DefaultObserverFactory.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/DefaultObserverFactory.java index e864cf6030d3..b1c8be6b55fd 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/DefaultObserverFactory.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/DefaultObserverFactory.java @@ -4,23 +4,38 @@ import com.azure.cosmos.implementation.changefeed.ChangeFeedObserver; import com.azure.cosmos.implementation.changefeed.ChangeFeedObserverFactory; +import com.azure.cosmos.ChangeFeedProcessorContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; +import java.util.function.BiConsumer; import java.util.function.Consumer; public class DefaultObserverFactory implements ChangeFeedObserverFactory { private final Logger log = LoggerFactory.getLogger(DefaultObserverFactory.class); - private final Consumer> consumer; + private final BiConsumer, ChangeFeedProcessorContext> biConsumer; public DefaultObserverFactory(Consumer> consumer) { this.consumer = consumer; + this.biConsumer = null; + } + + public DefaultObserverFactory(BiConsumer, ChangeFeedProcessorContext> biConsumer) { + this.biConsumer = biConsumer; + this.consumer = null; } @Override public ChangeFeedObserver createObserver() { - return new DefaultObserver<>(consumer); + + if (consumer != null) { + return new DefaultObserver<>(consumer); + } else if (biConsumer != null) { + return new DefaultObserver<>(biConsumer); + } + + throw new IllegalStateException("Both consumer and biConsumer cannot be null"); } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/PartitionedByIdCollectionRequestOptionsFactory.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/PartitionedByIdCollectionRequestOptionsFactory.java index 872ce2279332..2630de930425 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/PartitionedByIdCollectionRequestOptionsFactory.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/common/PartitionedByIdCollectionRequestOptionsFactory.java @@ -2,22 +2,33 @@ // Licensed under the MIT License. package com.azure.cosmos.implementation.changefeed.common; +import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfig; +import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfigBuilder; import com.azure.cosmos.models.CosmosItemRequestOptions; import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.implementation.changefeed.Lease; import com.azure.cosmos.implementation.changefeed.RequestOptionsFactory; +import java.time.Duration; + /** * Used to create request setOptions for partitioned lease collections, when partition getKey is defined as /getId. */ public class PartitionedByIdCollectionRequestOptionsFactory implements RequestOptionsFactory { + private static CosmosEndToEndOperationLatencyPolicyConfig DISABLED_E2E_TIMEOUT_CONFIG = + new CosmosEndToEndOperationLatencyPolicyConfigBuilder(Duration.ofSeconds(5)) + .enable(false) + .build(); + @Override public CosmosItemRequestOptions createItemRequestOptions(Lease lease) { - return new CosmosItemRequestOptions(); + // Disable e2e timeout config within changeFeedProcessor + return new CosmosItemRequestOptions().setCosmosEndToEndOperationLatencyPolicyConfig(DISABLED_E2E_TIMEOUT_CONFIG); } @Override public CosmosQueryRequestOptions createQueryRequestOptions() { - return new CosmosQueryRequestOptions(); + // Disable e2e timeout config within changeFeedProcessor + return new CosmosQueryRequestOptions().setCosmosEndToEndOperationLatencyPolicyConfig(DISABLED_E2E_TIMEOUT_CONFIG); } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/ChangeFeedProcessorImplBase.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/ChangeFeedProcessorImplBase.java index f14d05d1d5d2..77a7742f4e2b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/ChangeFeedProcessorImplBase.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/ChangeFeedProcessorImplBase.java @@ -28,6 +28,7 @@ import com.azure.cosmos.implementation.changefeed.common.EqualPartitionsBalancingStrategy; import com.azure.cosmos.implementation.changefeed.common.PartitionedByIdCollectionRequestOptionsFactory; import com.azure.cosmos.implementation.changefeed.common.TraceHealthMonitor; +import com.azure.cosmos.ChangeFeedProcessorContext; import com.azure.cosmos.models.ChangeFeedProcessorItem; import com.azure.cosmos.models.ChangeFeedProcessorOptions; import com.azure.cosmos.models.ChangeFeedProcessorState; @@ -46,6 +47,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.function.BiConsumer; import java.util.function.Consumer; import static com.azure.cosmos.CosmosBridgeInternal.getContextClient; @@ -75,7 +77,6 @@ public abstract class ChangeFeedProcessorImplBase implements ChangeFeedProces private HealthMonitor healthMonitor; private volatile PartitionManager partitionManager; - public ChangeFeedProcessorImplBase( String hostName, CosmosAsyncContainer feedContainer, @@ -105,6 +106,33 @@ public ChangeFeedProcessorImplBase( this.observerFactory = new DefaultObserverFactory<>(consumer); } + public ChangeFeedProcessorImplBase(String hostName, + CosmosAsyncContainer feedContainer, + CosmosAsyncContainer leaseContainer, + ChangeFeedProcessorOptions changeFeedProcessorOptions, + BiConsumer, ChangeFeedProcessorContext> biConsumer, + ChangeFeedMode changeFeedMode) { + checkNotNull(hostName, "Argument 'hostName' can not be null"); + checkNotNull(feedContainer, "Argument 'feedContainer' can not be null"); + checkNotNull(biConsumer, "Argument 'biConsumer' can not be null"); + + if (changeFeedProcessorOptions == null) { + changeFeedProcessorOptions = new ChangeFeedProcessorOptions(); + } + this.validateChangeFeedProcessorOptions(changeFeedProcessorOptions); + this.validateLeaseContainer(leaseContainer); + + this.hostName = hostName; + this.changeFeedProcessorOptions = changeFeedProcessorOptions; + this.feedContextClient = new ChangeFeedContextClientImpl(feedContainer); + this.leaseContextClient = new ChangeFeedContextClientImpl(leaseContainer); + this.scheduler = this.changeFeedProcessorOptions.getScheduler(); + this.feedContextClient.setScheduler(this.scheduler); + this.leaseContextClient.setScheduler(this.scheduler); + this.changeFeedMode = changeFeedMode; + this.observerFactory = new DefaultObserverFactory<>(biConsumer); + } + abstract CosmosChangeFeedRequestOptions createRequestOptionsForProcessingFromNow(FeedRange feedRange); private void validateChangeFeedProcessorOptions(ChangeFeedProcessorOptions changeFeedProcessorOptions) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/DocumentServiceLeaseUpdaterImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/DocumentServiceLeaseUpdaterImpl.java index 4b36abe1abd2..615df7da9903 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/DocumentServiceLeaseUpdaterImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/DocumentServiceLeaseUpdaterImpl.java @@ -60,7 +60,7 @@ public Mono updateLease( return Mono.just(this) - .flatMap( value -> this.tryReplaceLease(cachedLease, itemId, partitionKey)) + .flatMap( value -> this.tryReplaceLease(cachedLease, itemId, partitionKey, requestOptions)) .map(leaseDocument -> { cachedLease.setServiceItemLease(ServiceItemLeaseV1.fromDocument(leaseDocument)); return cachedLease; @@ -137,8 +137,13 @@ public Mono updateLease( private Mono tryReplaceLease( Lease lease, String itemId, - PartitionKey partitionKey) throws LeaseLostException { - return this.client.replaceItem(itemId, partitionKey, lease, this.getCreateIfMatchOptions(lease)) + PartitionKey partitionKey, + CosmosItemRequestOptions cosmosItemRequestOptions) throws LeaseLostException { + return this.client.replaceItem( + itemId, + partitionKey, + lease, + this.getCreateIfMatchOptions(cosmosItemRequestOptions, lease)) .map(cosmosItemResponse -> BridgeInternal.getProperties(cosmosItemResponse)) .onErrorResume(re -> { if (re instanceof CosmosException) { @@ -162,8 +167,7 @@ private Mono tryReplaceLease( }); } - private CosmosItemRequestOptions getCreateIfMatchOptions(Lease lease) { - CosmosItemRequestOptions createIfMatchOptions = new CosmosItemRequestOptions(); + private CosmosItemRequestOptions getCreateIfMatchOptions(CosmosItemRequestOptions createIfMatchOptions, Lease lease) { createIfMatchOptions.setIfMatchETag(lease.getConcurrencyToken()); return createIfMatchOptions; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/FullFidelityChangeFeedProcessorImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/FullFidelityChangeFeedProcessorImpl.java index 1166e735622d..b03f8b6fef1b 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/FullFidelityChangeFeedProcessorImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/FullFidelityChangeFeedProcessorImpl.java @@ -5,12 +5,14 @@ import com.azure.cosmos.CosmosAsyncContainer; import com.azure.cosmos.implementation.changefeed.common.ChangeFeedMode; +import com.azure.cosmos.ChangeFeedProcessorContext; import com.azure.cosmos.models.ChangeFeedProcessorItem; import com.azure.cosmos.models.ChangeFeedProcessorOptions; import com.azure.cosmos.models.CosmosChangeFeedRequestOptions; import com.azure.cosmos.models.FeedRange; import java.util.List; +import java.util.function.BiConsumer; import java.util.function.Consumer; public class FullFidelityChangeFeedProcessorImpl extends ChangeFeedProcessorImplBase { @@ -25,6 +27,16 @@ public FullFidelityChangeFeedProcessorImpl( super(hostName, feedContainer, leaseContainer, changeFeedProcessorOptions, consumer, ChangeFeedMode.FULL_FIDELITY); } + public FullFidelityChangeFeedProcessorImpl( + String hostName, + CosmosAsyncContainer feedContainer, + CosmosAsyncContainer leaseContainer, + BiConsumer, ChangeFeedProcessorContext> biConsumer, + ChangeFeedProcessorOptions changeFeedProcessorOptions) { + + super(hostName, feedContainer, leaseContainer, changeFeedProcessorOptions, biConsumer, ChangeFeedMode.FULL_FIDELITY); + } + @Override CosmosChangeFeedRequestOptions createRequestOptionsForProcessingFromNow(FeedRange feedRange) { return CosmosChangeFeedRequestOptions diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/LeaseStoreImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/LeaseStoreImpl.java index 8e6c9906a226..a9155cd7cf4e 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/LeaseStoreImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/LeaseStoreImpl.java @@ -74,7 +74,11 @@ public Mono markInitialized() { InternalObjectNode containerDocument = new InternalObjectNode(); containerDocument.setId(markerDocId); - return this.client.createItem(this.leaseCollectionLink, containerDocument, new CosmosItemRequestOptions(), false) + return this.client.createItem( + this.leaseCollectionLink, + containerDocument, + this.requestOptionsFactory.createItemRequestOptions(ServiceItemLeaseV1.fromDocument(containerDocument)), + false) .map( item -> { return true; }) @@ -98,7 +102,11 @@ public Mono acquireInitializationLock(Duration lockExpirationTime) { containerDocument.setId(lockId); BridgeInternal.setProperty(containerDocument, Constants.Properties.TTL, Long.valueOf(lockExpirationTime.getSeconds()).intValue()); - return this.client.createItem(this.leaseCollectionLink, containerDocument, new CosmosItemRequestOptions(), false) + return this.client.createItem( + this.leaseCollectionLink, + containerDocument, + this.requestOptionsFactory.createItemRequestOptions(ServiceItemLeaseV1.fromDocument(containerDocument)), + false) .map(documentResourceResponse -> { if (BridgeInternal.getProperties(documentResourceResponse) != null) { this.lockETag = BridgeInternal.getProperties(documentResourceResponse).getETag(); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/LeaseStoreManagerImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/LeaseStoreManagerImpl.java index 6472a93ebd53..13c561e009ab 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/LeaseStoreManagerImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/LeaseStoreManagerImpl.java @@ -170,7 +170,11 @@ public Mono createLeaseIfNotExist(FeedRangeEpkImpl feedRange, String cont .withContinuationToken(continuationToken) .withProperties(properties); - return this.leaseDocumentClient.createItem(this.settings.getLeaseCollectionLink(), documentServiceLease, null, false) + return this.leaseDocumentClient.createItem( + this.settings.getLeaseCollectionLink(), + documentServiceLease, + this.requestOptionsFactory.createItemRequestOptions(documentServiceLease), + false) .onErrorResume( ex -> { if (ex instanceof CosmosException) { CosmosException e = (CosmosException) ex; @@ -204,8 +208,10 @@ public Mono delete(Lease lease) { } return this.leaseDocumentClient - .deleteItem(lease.getId(), new PartitionKey(lease.getId()), - this.requestOptionsFactory.createItemRequestOptions(lease)) + .deleteItem( + lease.getId(), + new PartitionKey(lease.getId()), + this.requestOptionsFactory.createItemRequestOptions(lease)) .onErrorResume( ex -> { if (ex instanceof CosmosException) { CosmosException e = (CosmosException) ex; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/DocumentServiceLeaseUpdaterImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/DocumentServiceLeaseUpdaterImpl.java index a6dc837a5026..7cb517933574 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/DocumentServiceLeaseUpdaterImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/DocumentServiceLeaseUpdaterImpl.java @@ -55,7 +55,7 @@ public Mono updateLease(final Lease cachedLease, String itemId, Partition return Mono.just(this) - .flatMap( value -> this.tryReplaceLease(cachedLease, itemId, partitionKey)) + .flatMap( value -> this.tryReplaceLease(cachedLease, itemId, partitionKey, requestOptions)) .map(leaseDocument -> { cachedLease.setServiceItemLease(ServiceItemLease.fromDocument(leaseDocument)); return cachedLease; @@ -127,9 +127,12 @@ public Mono updateLease(final Lease cachedLease, String itemId, Partition }); } - private Mono tryReplaceLease(Lease lease, String itemId, PartitionKey partitionKey) - throws LeaseLostException { - return this.client.replaceItem(itemId, partitionKey, lease, this.getCreateIfMatchOptions(lease)) + private Mono tryReplaceLease( + Lease lease, + String itemId, + PartitionKey partitionKey, + CosmosItemRequestOptions cosmosItemRequestOptions) throws LeaseLostException { + return this.client.replaceItem(itemId, partitionKey, lease, this.getCreateIfMatchOptions(cosmosItemRequestOptions, lease)) .map(cosmosItemResponse -> BridgeInternal.getProperties(cosmosItemResponse)) .onErrorResume(re -> { if (re instanceof CosmosException) { @@ -153,10 +156,8 @@ private Mono tryReplaceLease(Lease lease, String itemId, Par }); } - private CosmosItemRequestOptions getCreateIfMatchOptions(Lease lease) { - CosmosItemRequestOptions createIfMatchOptions = new CosmosItemRequestOptions(); + private CosmosItemRequestOptions getCreateIfMatchOptions(CosmosItemRequestOptions createIfMatchOptions, Lease lease) { createIfMatchOptions.setIfMatchETag(lease.getConcurrencyToken()); - return createIfMatchOptions; } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/LeaseStoreImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/LeaseStoreImpl.java index ffc9031115ed..9a2b93045785 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/LeaseStoreImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/LeaseStoreImpl.java @@ -6,6 +6,7 @@ import com.azure.cosmos.CosmosException; import com.azure.cosmos.implementation.InternalObjectNode; import com.azure.cosmos.implementation.changefeed.common.ChangeFeedHelper; +import com.azure.cosmos.implementation.changefeed.epkversion.ServiceItemLeaseV1; import com.azure.cosmos.models.CosmosItemRequestOptions; import com.azure.cosmos.models.PartitionKey; import com.azure.cosmos.implementation.Constants; @@ -73,7 +74,11 @@ public Mono markInitialized() { InternalObjectNode containerDocument = new InternalObjectNode(); containerDocument.setId(markerDocId); - return this.client.createItem(this.leaseCollectionLink, containerDocument, new CosmosItemRequestOptions(), false) + return this.client.createItem( + this.leaseCollectionLink, + containerDocument, + this.requestOptionsFactory.createItemRequestOptions(ServiceItemLeaseV1.fromDocument(containerDocument)), + false) .map( item -> true) .onErrorResume(throwable -> { if (throwable instanceof CosmosException) { @@ -95,7 +100,11 @@ public Mono acquireInitializationLock(Duration lockExpirationTime) { containerDocument.setId(lockId); BridgeInternal.setProperty(containerDocument, Constants.Properties.TTL, Long.valueOf(lockExpirationTime.getSeconds()).intValue()); - return this.client.createItem(this.leaseCollectionLink, containerDocument, new CosmosItemRequestOptions(), false) + return this.client.createItem( + this.leaseCollectionLink, + containerDocument, + this.requestOptionsFactory.createItemRequestOptions(ServiceItemLeaseV1.fromDocument(containerDocument)), + false) .map(documentResourceResponse -> { if (BridgeInternal.getProperties(documentResourceResponse) != null) { this.lockETag = BridgeInternal.getProperties(documentResourceResponse).getETag(); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/LeaseStoreManagerImpl.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/LeaseStoreManagerImpl.java index edc8d5ab4354..06a77f883409 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/LeaseStoreManagerImpl.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/pkversion/LeaseStoreManagerImpl.java @@ -165,7 +165,11 @@ public Mono createLeaseIfNotExist(String leaseToken, String continuationT .withContinuationToken(continuationToken) .withProperties(properties); - return this.leaseDocumentClient.createItem(this.settings.getLeaseCollectionLink(), documentServiceLease, null, false) + return this.leaseDocumentClient.createItem( + this.settings.getLeaseCollectionLink(), + documentServiceLease, + this.requestOptionsFactory.createItemRequestOptions(documentServiceLease), + false) .onErrorResume( ex -> { if (ex instanceof CosmosException) { CosmosException e = (CosmosException) ex; @@ -198,8 +202,10 @@ public Mono delete(Lease lease) { } return this.leaseDocumentClient - .deleteItem(lease.getId(), new PartitionKey(lease.getId()), - this.requestOptionsFactory.createItemRequestOptions(lease)) + .deleteItem( + lease.getId(), + new PartitionKey(lease.getId()), + this.requestOptionsFactory.createItemRequestOptions(lease)) .onErrorResume( ex -> { if (ex instanceof CosmosException) { CosmosException e = (CosmosException) ex; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/clienttelemetry/ClientTelemetryMetrics.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/clienttelemetry/ClientTelemetryMetrics.java index 18bf38ed032f..74bd43fdb073 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/clienttelemetry/ClientTelemetryMetrics.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/clienttelemetry/ClientTelemetryMetrics.java @@ -836,7 +836,7 @@ private void recordRequestTimeline( private void recordStoreResponseStatistics( CosmosDiagnosticsContext ctx, CosmosAsyncClient client, - List storeResponseStatistics) { + Collection storeResponseStatistics) { if (!this.metricCategories.contains(MetricCategory.RequestSummary)) { return; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/ContainerDirectConnectionMetadata.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/ContainerDirectConnectionMetadata.java index 61e97beaa67f..cd569ebf76f3 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/ContainerDirectConnectionMetadata.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/ContainerDirectConnectionMetadata.java @@ -3,14 +3,18 @@ package com.azure.cosmos.implementation.directconnectivity; +import com.azure.cosmos.implementation.Configs; + import java.util.concurrent.atomic.AtomicInteger; public final class ContainerDirectConnectionMetadata { private final AtomicInteger minConnectionPoolSizePerEndpointForContainer; + // NOTE: should be compared with COSMOS.MIN_CONNECTION_POOL_SIZE_PER_ENDPOINT + // read during client initialization before connections are created for the container public ContainerDirectConnectionMetadata() { - this.minConnectionPoolSizePerEndpointForContainer = new AtomicInteger(1); + this.minConnectionPoolSizePerEndpointForContainer = new AtomicInteger(Configs.getMinConnectionPoolSizePerEndpoint()); } public void setMinConnectionPoolSizePerEndpointForContainer(int minConnectionPoolSizePerEndpointForContainer) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/GlobalAddressResolver.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/GlobalAddressResolver.java index 29ac9f9e9a9f..fed1cbde61a8 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/GlobalAddressResolver.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/GlobalAddressResolver.java @@ -175,8 +175,10 @@ public Flux submitOpenConnectionTasksAndInitCaches(CosmosContainerProactiv ContainerDirectConnectionMetadata containerDirectConnectionMetadata = containerPropertiesMap .get(cosmosContainerIdentity); - int connectionsPerEndpointCountForContainer = containerDirectConnectionMetadata - .getMinConnectionPoolSizePerEndpointForContainer(); + // check against the COSMOS.MIN_CONNECTION_POOL_SIZE_PER_ENDPOINT system property + // during client initialization + int connectionsPerEndpointCountForContainer = Math.max(containerDirectConnectionMetadata + .getMinConnectionPoolSizePerEndpointForContainer(), Configs.getMinConnectionPoolSizePerEndpoint()); return this.submitOpenConnectionInternal( endpointCache, diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/rntbd/RntbdRequestManager.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/rntbd/RntbdRequestManager.java index 91012efc39b7..5a64291402f5 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/rntbd/RntbdRequestManager.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/directconnectivity/rntbd/RntbdRequestManager.java @@ -765,7 +765,7 @@ int pendingRequestCount() { } Optional rntbdContext() { - return Optional.of(this.contextFuture.getNow(null)); + return Optional.ofNullable(this.contextFuture.getNow(null)); } CompletableFuture rntbdContextRequestFuture() { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ChangeFeedFetcher.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ChangeFeedFetcher.java index ffb1e4ee413b..df8f92710910 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ChangeFeedFetcher.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ChangeFeedFetcher.java @@ -60,7 +60,12 @@ public ChangeFeedFetcher( this.feedRangeContinuationFeedRangeGoneRetryPolicy = null; this.createRequestFunc = createRequestFunc; } else { - // TODO @fabianm wire up clientContext + // TODO @fabianm wire up clientContext - for now no availability strategy is wired up for ChangeFeed + // requests - and this is expected/by design for now. But it is certainly worth discussing/checking whether + // we should include change feed requests as well - there are a few challenges especially for multi master + // accounts depending on the consistency level - and usually change feed is not processed in OLTP + // scenarios, so, keeping it out of scope for now is a reasonable decision. But probably worth + // double checking this decision in a few months. DocumentClientRetryPolicy retryPolicyInstance = client.getResetSessionTokenRetryPolicy().getRequestPolicy(null); String collectionLink = PathsHelper.generatePath( ResourceType.DocumentCollection, changeFeedState.getContainerRid(), false); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DefaultDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DefaultDocumentQueryExecutionContext.java index dfc36bf6cf2e..eb9c1af55796 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DefaultDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DefaultDocumentQueryExecutionContext.java @@ -8,7 +8,9 @@ import com.azure.cosmos.implementation.DiagnosticsClientContext; import com.azure.cosmos.implementation.DocumentClientRetryPolicy; import com.azure.cosmos.implementation.HttpConstants; +import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.InvalidPartitionExceptionRetryPolicy; +import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.PartitionKeyRange; import com.azure.cosmos.implementation.PartitionKeyRangeGoneRetryPolicy; import com.azure.cosmos.implementation.PathsHelper; @@ -45,6 +47,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiFunction; import java.util.function.Function; +import java.util.function.Supplier; import static com.azure.cosmos.models.ModelBridgeInternal.getPartitionKeyRangeIdInternal; @@ -94,7 +97,10 @@ public Flux> executeAsync() { cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); } - CosmosQueryRequestOptions newCosmosQueryRequestOptions = ModelBridgeInternal.createQueryRequestOptions(cosmosQueryRequestOptions); + CosmosQueryRequestOptions newCosmosQueryRequestOptions = ImplementationBridgeHelpers + .CosmosQueryRequestOptionsHelper + .getCosmosQueryRequestOptionsAccessor() + .clone(cosmosQueryRequestOptions); // We can not go to backend with the composite continuation token, // but we still need the gateway for the query plan. @@ -146,11 +152,10 @@ public Mono> getTargetPartitionKeyRangesById(String reso .flatMap(partitionKeyRange -> Mono.just(Collections.singletonList(partitionKeyRange.v))); } - protected Function>> executeInternalAsyncFunc() { + private DocumentClientRetryPolicy createClientRetryPolicyInstance() { RxCollectionCache collectionCache = this.client.getCollectionCache(); IPartitionKeyRangeCache partitionKeyRangeCache = this.client.getPartitionKeyRangeCache(); - // TODO @fabianm wire up clientContext - DocumentClientRetryPolicy retryPolicyInstance = this.client.getResetSessionTokenRetryPolicy().getRequestPolicy(null); + DocumentClientRetryPolicy retryPolicyInstance = this.client.getResetSessionTokenRetryPolicy().getRequestPolicy(this.diagnosticsClientContext); retryPolicyInstance = new InvalidPartitionExceptionRetryPolicy( collectionCache, @@ -159,49 +164,64 @@ protected Function>> executeInter ModelBridgeInternal.getPropertiesFromQueryRequestOptions(this.cosmosQueryRequestOptions)); if (super.resourceTypeEnum.isPartitioned()) { retryPolicyInstance = new PartitionKeyRangeGoneRetryPolicy(this.diagnosticsClientContext, - collectionCache, - partitionKeyRangeCache, - PathsHelper.getCollectionPath(super.resourceLink), - retryPolicyInstance, - ModelBridgeInternal.getPropertiesFromQueryRequestOptions(this.cosmosQueryRequestOptions)); + collectionCache, + partitionKeyRangeCache, + PathsHelper.getCollectionPath(super.resourceLink), + retryPolicyInstance, + ModelBridgeInternal.getPropertiesFromQueryRequestOptions(this.cosmosQueryRequestOptions)); } - final DocumentClientRetryPolicy finalRetryPolicyInstance = retryPolicyInstance; - - return req -> { - finalRetryPolicyInstance.onBeforeSendRequest(req); - this.fetchExecutionRangeAccumulator.beginFetchRange(); - this.fetchSchedulingMetrics.start(); - return BackoffRetryUtility.executeRetry(() -> { - this.retries.incrementAndGet(); - return executeRequestAsync( - this.factoryMethod, - req); - }, finalRetryPolicyInstance) - .map(tFeedResponse -> { - this.fetchSchedulingMetrics.stop(); - this.fetchExecutionRangeAccumulator.endFetchRange(tFeedResponse.getActivityId(), - tFeedResponse.getResults().size(), - this.retries.get()); - ImmutablePair schedulingTimeSpanMap = - new ImmutablePair<>(DEFAULT_PARTITION_RANGE, this.fetchSchedulingMetrics.getElapsedTime()); - if (!StringUtils.isEmpty(tFeedResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.QUERY_METRICS))) { - QueryMetrics qm = - BridgeInternal.createQueryMetricsFromDelimitedStringAndClientSideMetrics(tFeedResponse.getResponseHeaders() - .get(HttpConstants.HttpHeaders.QUERY_METRICS), - new ClientSideMetrics(this.retries.get(), - tFeedResponse.getRequestCharge(), - this.fetchExecutionRangeAccumulator.getExecutionRanges(), - Collections.singletonList(schedulingTimeSpanMap)), - tFeedResponse.getActivityId(), - tFeedResponse.getResponseHeaders().getOrDefault(HttpConstants.HttpHeaders.INDEX_UTILIZATION, null)); - String pkrId = tFeedResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID); - String queryMetricKey = DEFAULT_PARTITION_RANGE + ",pkrId:" + pkrId; - BridgeInternal.putQueryMetricsIntoMap(tFeedResponse, queryMetricKey, qm); - } - return tFeedResponse; - }); - }; + return retryPolicyInstance; + } + + protected Function>> executeInternalAsyncFunc() { + return req -> this.client.executeFeedOperationWithAvailabilityStrategy( + ResourceType.Document, + OperationType.Query, + this::createClientRetryPolicyInstance, + req, + this::executeInternalFuncCore); + } + + private Mono> executeInternalFuncCore( + final Supplier retryPolicyFactory, + final RxDocumentServiceRequest req + ) { + + DocumentClientRetryPolicy finalRetryPolicyInstance = retryPolicyFactory.get(); + finalRetryPolicyInstance.onBeforeSendRequest(req); + this.fetchExecutionRangeAccumulator.beginFetchRange(); + this.fetchSchedulingMetrics.start(); + + return BackoffRetryUtility.executeRetry(() -> { + this.retries.incrementAndGet(); + return executeRequestAsync( + this.factoryMethod, + req); + }, finalRetryPolicyInstance) + .map(tFeedResponse -> { + this.fetchSchedulingMetrics.stop(); + this.fetchExecutionRangeAccumulator.endFetchRange(tFeedResponse.getActivityId(), + tFeedResponse.getResults().size(), + this.retries.get()); + ImmutablePair schedulingTimeSpanMap = + new ImmutablePair<>(DEFAULT_PARTITION_RANGE, this.fetchSchedulingMetrics.getElapsedTime()); + if (!StringUtils.isEmpty(tFeedResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.QUERY_METRICS))) { + QueryMetrics qm = + BridgeInternal.createQueryMetricsFromDelimitedStringAndClientSideMetrics(tFeedResponse.getResponseHeaders() + .get(HttpConstants.HttpHeaders.QUERY_METRICS), + new ClientSideMetrics(this.retries.get(), + tFeedResponse.getRequestCharge(), + this.fetchExecutionRangeAccumulator.getExecutionRanges(), + Collections.singletonList(schedulingTimeSpanMap)), + tFeedResponse.getActivityId(), + tFeedResponse.getResponseHeaders().getOrDefault(HttpConstants.HttpHeaders.INDEX_UTILIZATION, null)); + String pkrId = tFeedResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID); + String queryMetricKey = DEFAULT_PARTITION_RANGE + ",pkrId:" + pkrId; + BridgeInternal.putQueryMetricsIntoMap(tFeedResponse, queryMetricKey, qm); + } + return tFeedResponse; + }); } public RxDocumentServiceRequest createRequestAsync(String continuationToken, Integer maxPageSize) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentProducer.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentProducer.java index 74225a8774d0..4239f7f59ced 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentProducer.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentProducer.java @@ -9,9 +9,11 @@ import com.azure.cosmos.implementation.HttpConstants; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.ObservableHelper; +import com.azure.cosmos.implementation.OperationType; import com.azure.cosmos.implementation.PartitionKeyRange; import com.azure.cosmos.implementation.QueryMetrics; import com.azure.cosmos.implementation.QueryMetricsConstants; +import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.RxDocumentServiceRequest; import com.azure.cosmos.implementation.Utils; import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; @@ -36,7 +38,6 @@ import java.util.List; import java.util.Locale; import java.util.UUID; -import java.util.concurrent.Callable; import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; @@ -47,6 +48,10 @@ * This is meant to be internally used only by our sdk. */ class DocumentProducer { + + private static final ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.CosmosQueryRequestOptionsAccessor qryOptionsAccessor = + ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.getCosmosQueryRequestOptionsAccessor(); + private static final Logger logger = LoggerFactory.getLogger(DocumentProducer.class); private int retries; @@ -98,7 +103,7 @@ void populatePartitionedQueryMetrics() { protected final String collectionLink; protected final TriFunction createRequestFunc; protected final Function>> executeRequestFuncWithRetries; - protected final Callable createRetryPolicyFunc; + protected final Supplier createRetryPolicyFunc; protected final int pageSize; protected final UUID correlatedActivityId; public int top; @@ -114,7 +119,7 @@ public DocumentProducer( TriFunction createRequestFunc, Function>> executeRequestFunc, String collectionLink, - Callable createRetryPolicyFunc, + Supplier createRetryPolicyFunc, Class resourceType , UUID correlatedActivityId, int initialPageSize, // = -1, @@ -132,37 +137,47 @@ public DocumentProducer( this.fetchSchedulingMetrics.ready(); this.fetchExecutionRangeAccumulator = new FetchExecutionRangeAccumulator(feedRange.getRange().toString()); this.operationContextTextProvider = operationContextTextProvider; - this.executeRequestFuncWithRetries = request -> { - retries = -1; - this.fetchSchedulingMetrics.start(); - this.fetchExecutionRangeAccumulator.beginFetchRange(); - DocumentClientRetryPolicy retryPolicy = null; - if (createRetryPolicyFunc != null) { - try { - retryPolicy = createRetryPolicyFunc.call(); - } catch (Exception e) { - return Mono.error(e); - } - } - DocumentClientRetryPolicy finalRetryPolicy = retryPolicy; + BiFunction, RxDocumentServiceRequest, Mono>> + executeFeedOperationCore = (clientRetryPolicyFactory, request) -> { + DocumentClientRetryPolicy finalRetryPolicy = clientRetryPolicyFactory.get(); return ObservableHelper.inlineIfPossibleAsObs( - () -> { - if(finalRetryPolicy != null) { - finalRetryPolicy.onBeforeSendRequest(request); - } + () -> { + if(finalRetryPolicy != null) { + finalRetryPolicy.onBeforeSendRequest(request); + } - ++retries; - return executeRequestFunc.apply(request); - }, retryPolicy); + ++retries; + return executeRequestFunc.apply(request); + }, finalRetryPolicy); }; this.correlatedActivityId = correlatedActivityId; - this.cosmosQueryRequestOptions = cosmosQueryRequestOptions != null ? - ModelBridgeInternal.createQueryRequestOptions(cosmosQueryRequestOptions) - : new CosmosQueryRequestOptions(); + this.cosmosQueryRequestOptions = cosmosQueryRequestOptions != null + ? qryOptionsAccessor.clone(cosmosQueryRequestOptions) + : new CosmosQueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsContinuationToken(this.cosmosQueryRequestOptions, initialContinuationToken); + + this.executeRequestFuncWithRetries = request -> { + retries = -1; + this.fetchSchedulingMetrics.start(); + this.fetchExecutionRangeAccumulator.beginFetchRange(); + + return this.client.executeFeedOperationWithAvailabilityStrategy( + ResourceType.Document, + OperationType.Query, + () -> { + if (createRetryPolicyFunc != null) { + return createRetryPolicyFunc.get(); + } + + return null; + }, + request, + executeFeedOperationCore); + }; + this.lastResponseContinuationToken = initialContinuationToken; this.resourceType = resourceType; this.collectionLink = collectionLink; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextBase.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextBase.java index 58966584f691..cb3ba2617e43 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextBase.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextBase.java @@ -46,6 +46,10 @@ */ public abstract class DocumentQueryExecutionContextBase implements IDocumentQueryExecutionContext { + + private static final ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.CosmosQueryRequestOptionsAccessor qryOptAccessor = + ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.getCosmosQueryRequestOptionsAccessor(); + protected final DiagnosticsClientContext diagnosticsClientContext; protected ResourceType resourceTypeEnum; protected String resourceLink; @@ -169,7 +173,8 @@ protected Mono> getFeedResponse( } public CosmosQueryRequestOptions getFeedOptions(String continuationToken, Integer maxPageSize) { - CosmosQueryRequestOptions options = ModelBridgeInternal.createQueryRequestOptions(this.cosmosQueryRequestOptions); + CosmosQueryRequestOptions options = + qryOptAccessor.clone(this.cosmosQueryRequestOptions); ModelBridgeInternal.setQueryRequestOptionsContinuationTokenAndMaxItemCount(options, continuationToken, maxPageSize); return options; } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java index 733749807ea5..a13cfc65348d 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/DocumentQueryExecutionContextFactory.java @@ -130,7 +130,7 @@ private static Mono>,QueryInfo>> getPartitionKeyRang client, query, resourceLink, - cosmosQueryRequestOptions != null ? cosmosQueryRequestOptions.getPartitionKey() : null); + cosmosQueryRequestOptions); return queryExecutionInfoMono.flatMap( partitionedQueryExecutionInfo -> { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/IDocumentQueryClient.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/IDocumentQueryClient.java index a6e5b592b113..42583fb2d5be 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/IDocumentQueryClient.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/IDocumentQueryClient.java @@ -2,6 +2,9 @@ // Licensed under the MIT License. package com.azure.cosmos.implementation.query; +import com.azure.cosmos.implementation.DocumentClientRetryPolicy; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.caches.IPartitionKeyRangeCache; import com.azure.cosmos.implementation.caches.RxCollectionCache; import com.azure.cosmos.ConsistencyLevel; @@ -10,6 +13,9 @@ import com.azure.cosmos.implementation.RxDocumentServiceResponse; import reactor.core.publisher.Mono; +import java.util.function.BiFunction; +import java.util.function.Supplier; + /** * While this class is public, but it is not part of our published public APIs. * This is meant to be internally used only by our sdk. @@ -49,6 +55,13 @@ public interface IDocumentQueryClient { QueryCompatibilityMode getQueryCompatibilityMode(); + Mono executeFeedOperationWithAvailabilityStrategy( + final ResourceType resourceType, + final OperationType operationType, + final Supplier retryPolicyFactory, + final RxDocumentServiceRequest req, + final BiFunction, RxDocumentServiceRequest, Mono> feedOperation); + /// /// A client query compatibility mode when making query request. /// Can be used to force a specific query request format. diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/OrderByDocumentProducer.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/OrderByDocumentProducer.java index 4bfdb256f966..bce5e35e654c 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/OrderByDocumentProducer.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/OrderByDocumentProducer.java @@ -2,7 +2,6 @@ // Licensed under the MIT License. package com.azure.cosmos.implementation.query; -import com.azure.cosmos.BridgeInternal; import com.azure.cosmos.implementation.ClientSideRequestStatistics; import com.azure.cosmos.implementation.DistinctClientSideRequestStatisticsCollection; import com.azure.cosmos.implementation.Document; @@ -26,7 +25,6 @@ import java.util.Collections; import java.util.Map; import java.util.UUID; -import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import java.util.function.Supplier; @@ -47,7 +45,7 @@ class OrderByDocumentProducer extends DocumentProducer { Function>> executeRequestFunc, FeedRangeEpkImpl feedRange, String collectionLink, - Callable createRetryPolicyFunc, + Supplier createRetryPolicyFunc, Class resourceType, UUID correlatedActivityId, int initialPageSize, @@ -73,12 +71,11 @@ protected Flux produceOnFeedRangeGone(Flux row) { double requestCharge = tracker.getAndResetCharge(); Map headers = Utils.immutableMapOf(HttpConstants.HttpHeaders.REQUEST_CHARGE, String.valueOf(requestCharge)); FeedResponse fr = feedResponseAccessor.createFeedResponse( - Collections.singletonList((Document) row), headers, null); + Collections.singletonList(row), headers, null); return new DocumentProducerFeedResponse(fr, row.getSourceRange()); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/OrderByDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/OrderByDocumentQueryExecutionContext.java index 1533649a6f38..c8a110853a7d 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/OrderByDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/OrderByDocumentQueryExecutionContext.java @@ -44,11 +44,11 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; +import java.util.function.Supplier; import java.util.regex.Pattern; /** @@ -545,15 +545,15 @@ List getExtendedTypesIsDefinedFunctions(int index, boolean isAscending) @Override protected OrderByDocumentProducer createDocumentProducer( - String collectionRid, - String continuationToken, - int initialPageSize, - CosmosQueryRequestOptions cosmosQueryRequestOptions, - SqlQuerySpec querySpecForInit, - Map commonRequestHeaders, - TriFunction createRequestFunc, - Function>> executeFunc, - Callable createRetryPolicyFunc, FeedRangeEpkImpl feedRange) { + String collectionRid, + String continuationToken, + int initialPageSize, + CosmosQueryRequestOptions cosmosQueryRequestOptions, + SqlQuerySpec querySpecForInit, + Map commonRequestHeaders, + TriFunction createRequestFunc, + Function>> executeFunc, + Supplier createRetryPolicyFunc, FeedRangeEpkImpl feedRange) { return new OrderByDocumentProducer(consumeComparer, client, collectionRid, diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java index 302ab47216ae..020b8633d2be 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContext.java @@ -8,8 +8,10 @@ import com.azure.cosmos.implementation.ClientSideRequestStatistics; import com.azure.cosmos.implementation.Configs; import com.azure.cosmos.implementation.DiagnosticsClientContext; +import com.azure.cosmos.implementation.DistinctClientSideRequestStatisticsCollection; import com.azure.cosmos.implementation.DocumentClientRetryPolicy; import com.azure.cosmos.implementation.DocumentCollection; +import com.azure.cosmos.implementation.FeedResponseDiagnostics; import com.azure.cosmos.implementation.HttpConstants; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.PartitionKeyRange; @@ -39,7 +41,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; @@ -53,6 +54,11 @@ public class ParallelDocumentQueryExecutionContext extends ParallelDocumentQueryExecutionContextBase { private static final Logger logger = LoggerFactory.getLogger(ParallelDocumentQueryExecutionContext.class); + + private static final ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.CosmosQueryRequestOptionsAccessor qryOptAccessor = + ImplementationBridgeHelpers + .CosmosQueryRequestOptionsHelper + .getCosmosQueryRequestOptionsAccessor(); private final static ImplementationBridgeHelpers.CosmosDiagnosticsHelper.CosmosDiagnosticsAccessor diagnosticsAccessor = ImplementationBridgeHelpers.CosmosDiagnosticsHelper.getCosmosDiagnosticsAccessor(); @@ -203,28 +209,6 @@ private void populatePartitionToContinuationMap( } } - /* private List getPartitionKeyRangesForContinuation( - CompositeContinuationToken compositeContinuationToken, - List partitionKeyRanges) { - Map partitionRangeIdToTokenMap = new HashMap<>(); - ValueHolder> outPartitionRangeIdToTokenMap = new ValueHolder<>(partitionRangeIdToTokenMap); - // Find the partition key range we left off on and fill the range to continuation token map - int startIndex = this.findTargetRangeAndExtractContinuationTokens(this.feedRanges, - compositeContinuationToken.getRange(), - outPartitionRangeIdToTokenMap, - compositeContinuationToken.getToken()); - List rightHandSideRanges = new ArrayList(); - for (int i = startIndex; i < partitionKeyRanges.size(); i++) { - PartitionKeyRange range = partitionKeyRanges.get(i); - if (partitionRangeIdToTokenMap.containsKey(range.getId())) { - this.partitionKeyRangeToContinuationTokenMap.put(range, compositeContinuationToken.getToken()); - } - rightHandSideRanges.add(partitionKeyRanges.get(i)); - } - - return rightHandSideRanges; - } -*/ private static class EmptyPagesFilterTransformer implements Function.DocumentProducerFeedResponse>, Flux>> { private final RequestChargeTracker tracker; @@ -232,6 +216,10 @@ private static class EmptyPagesFilterTransformer private final CosmosQueryRequestOptions cosmosQueryRequestOptions; private final UUID correlatedActivityId; private final ConcurrentMap emptyPageQueryMetricsMap = new ConcurrentHashMap<>(); + + private final DistinctClientSideRequestStatisticsCollection skippedClientSideRequestStatistics = + new DistinctClientSideRequestStatisticsCollection(); + private CosmosDiagnostics cosmosDiagnostics; private final Supplier operationContextTextProvider; @@ -299,14 +287,35 @@ private static Map headerResponse( String.valueOf(requestCharge)); } + private void mergeAndResetSkippedRequestStats(CosmosDiagnostics diagnostics) { + if (!skippedClientSideRequestStatistics.isEmpty()) { + if (diagnostics != null) { + + FeedResponseDiagnostics feedResponseDiagnostics = diagnosticsAccessor + .getFeedResponseDiagnostics(diagnostics); + feedResponseDiagnostics.addClientSideRequestStatistics(skippedClientSideRequestStatistics); + } + skippedClientSideRequestStatistics.clear(); + } + } + + private void mergeAndResetQueryMetrics(FeedResponse page) { + //Combining previous empty page query metrics with current non empty page query metrics + if (!emptyPageQueryMetricsMap.isEmpty()) { + ConcurrentMap currentQueryMetrics = + BridgeInternal.queryMetricsFromFeedResponse(page); + QueryMetrics.mergeQueryMetricsMap(currentQueryMetrics, emptyPageQueryMetricsMap); + emptyPageQueryMetricsMap.clear(); + } + } + @Override public Flux> apply(Flux.DocumentProducerFeedResponse> source) { // Emit an empty page so the downstream observables know when there are no more // results. return source.filter(documentProducerFeedResponse -> { if (documentProducerFeedResponse.pageResult.getResults().isEmpty() - && !ModelBridgeInternal - .getEmptyPagesAllowedFromQueryRequestOptions(this.cosmosQueryRequestOptions)) { + && !qryOptAccessor.getAllowEmptyPages(this.cosmosQueryRequestOptions)) { // filter empty pages and accumulate charge tracker.addCharge(documentProducerFeedResponse.pageResult.getRequestCharge()); ConcurrentMap currentQueryMetrics = @@ -314,9 +323,14 @@ public Flux> apply(Flux.DocumentProducerFeed QueryMetrics.mergeQueryMetricsMap(emptyPageQueryMetricsMap, currentQueryMetrics); cosmosDiagnostics = documentProducerFeedResponse.pageResult.getCosmosDiagnostics(); - if (ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() + // keep a reference of the request statistics for the skipped FeedResponses + Collection skippedRequestStatsForPage = + diagnosticsAccessor.getClientSideRequestStatistics(cosmosDiagnostics); + if (skippedRequestStatsForPage != null && !skippedRequestStatsForPage.isEmpty()) { + skippedClientSideRequestStatistics.addAll(skippedRequestStatsForPage); + } + + if (qryOptAccessor .isEmptyPageDiagnosticsEnabled(cosmosQueryRequestOptions)) { logEmptyPageDiagnostics( @@ -331,12 +345,7 @@ public Flux> apply(Flux.DocumentProducerFeed return true; }).map(documentProducerFeedResponse -> { //Combining previous empty page query metrics with current non empty page query metrics - if (!emptyPageQueryMetricsMap.isEmpty()) { - ConcurrentMap currentQueryMetrics = - BridgeInternal.queryMetricsFromFeedResponse(documentProducerFeedResponse.pageResult); - QueryMetrics.mergeQueryMetricsMap(currentQueryMetrics, emptyPageQueryMetricsMap); - emptyPageQueryMetricsMap.clear(); - } + mergeAndResetQueryMetrics(documentProducerFeedResponse.pageResult); // Add the request charge double charge = tracker.getAndResetCharge(); @@ -390,17 +399,28 @@ public Flux> apply(Flux.DocumentProducerFeed return page; }).map(documentProducerFeedResponse -> { + // merge query metrics for any empty pages after a non-empty page. + mergeAndResetQueryMetrics(documentProducerFeedResponse.pageResult); + // Unwrap the documentProducerFeedResponse and get back the feedResponse + mergeAndResetSkippedRequestStats(documentProducerFeedResponse.pageResult.getCosmosDiagnostics()); + return documentProducerFeedResponse.pageResult; }).switchIfEmpty(Flux.defer(() -> { // create an empty page if there is no result - return Flux.just(BridgeInternal.createFeedResponseWithQueryMetrics(Utils.immutableListOf(), - headerResponse(tracker.getAndResetCharge()), - emptyPageQueryMetricsMap, - null, - false, - false, - cosmosDiagnostics)); + FeedResponse artificialEmptyFeedResponse = + BridgeInternal.createFeedResponseWithQueryMetrics( + Utils.immutableListOf(), + headerResponse(tracker.getAndResetCharge()), + emptyPageQueryMetricsMap, + null, + false, + false, + cosmosDiagnostics); + + mergeAndResetSkippedRequestStats(artificialEmptyFeedResponse.getCosmosDiagnostics()); + + return Flux.just(artificialEmptyFeedResponse); })); } } @@ -474,7 +494,7 @@ protected DocumentProducer createDocumentProducer( Map commonRequestHeaders, TriFunction createRequestFunc, Function>> executeFunc, - Callable createRetryPolicyFunc, FeedRangeEpkImpl feedRange) { + Supplier createRetryPolicyFunc, FeedRangeEpkImpl feedRange) { return new DocumentProducer<>(client, collectionRid, cosmosQueryRequestOptions, diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContextBase.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContextBase.java index d003d33fca20..ecaacb5ec272 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContextBase.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/ParallelDocumentQueryExecutionContextBase.java @@ -26,9 +26,9 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; +import java.util.function.Supplier; /** * While this class is public, but it is not part of our published public APIs. @@ -103,8 +103,7 @@ protected void initialize( commonRequestHeaders, createRequestFunc, executeFunc, - // TODO @fabianm wire up clientContext - () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy(null), + () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy(this.diagnosticsClientContext), targetRange); documentProducers.add(dp); @@ -120,7 +119,7 @@ abstract protected DocumentProducer createDocumentProducer(String collectionR TriFunction createRequestFunc, Function>> executeFunc, - Callable createRetryPolicyFunc, + Supplier createRetryPolicyFunc, FeedRangeEpkImpl feedRange); @Override @@ -163,7 +162,6 @@ protected void initializeReadMany( this.factoryMethod, request); - // TODO: Review pagesize -1 DocumentProducer dp = createDocumentProducer( collectionRid, @@ -174,8 +172,7 @@ protected void initializeReadMany( commonRequestHeaders, createRequestFunc, executeFunc, - // TODO @fabianm wire up clientContext - () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy(null), + () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy(this.diagnosticsClientContext), feedRangeEpk); documentProducers.add(dp); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java index 4261d357f3e0..1c6b43ec60cf 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedDocumentQueryExecutionContext.java @@ -22,6 +22,9 @@ public class PipelinedDocumentQueryExecutionContext extends PipelinedQueryExecutionContextBase { + private static final ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.CosmosQueryRequestOptionsAccessor qryOptAccessor = + ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.getCosmosQueryRequestOptionsAccessor(); + private final IDocumentQueryExecutionComponent component; private PipelinedDocumentQueryExecutionContext( @@ -47,7 +50,8 @@ private static BiFunction, Flux { - CosmosQueryRequestOptions orderByCosmosQueryRequestOptions = ModelBridgeInternal.createQueryRequestOptions(requestOptions); + CosmosQueryRequestOptions orderByCosmosQueryRequestOptions = + qryOptAccessor.clone(requestOptions); ModelBridgeInternal.setQueryRequestOptionsContinuationToken(orderByCosmosQueryRequestOptions, continuationToken); ImplementationBridgeHelpers .CosmosQueryRequestOptionsHelper @@ -61,11 +65,9 @@ private static BiFunction, Flux { - CosmosQueryRequestOptions parallelCosmosQueryRequestOptions = ModelBridgeInternal.createQueryRequestOptions(requestOptions); - ImplementationBridgeHelpers - .CosmosQueryRequestOptionsHelper - .getCosmosQueryRequestOptionsAccessor() - .setItemFactoryMethod(parallelCosmosQueryRequestOptions, null); + CosmosQueryRequestOptions parallelCosmosQueryRequestOptions = + qryOptAccessor.clone(requestOptions); + qryOptAccessor.setItemFactoryMethod(parallelCosmosQueryRequestOptions, null); ModelBridgeInternal.setQueryRequestOptionsContinuationToken(parallelCosmosQueryRequestOptions, continuationToken); documentQueryParams.setCosmosQueryRequestOptions(parallelCosmosQueryRequestOptions); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java index 531e261756ce..651b0e6cda1f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/PipelinedQueryExecutionContext.java @@ -4,6 +4,7 @@ import com.azure.cosmos.implementation.DiagnosticsClientContext; import com.azure.cosmos.implementation.DocumentCollection; +import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.PartitionKeyRange; import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.models.CosmosQueryRequestOptions; @@ -21,6 +22,9 @@ public final class PipelinedQueryExecutionContext extends PipelinedQueryExecutionContextBase { + private static final ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.CosmosQueryRequestOptionsAccessor qryOptAccessor = + ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.getCosmosQueryRequestOptionsAccessor(); + private final IDocumentQueryExecutionComponent component; private PipelinedQueryExecutionContext(IDocumentQueryExecutionComponent component, int actualPageSize, @@ -41,7 +45,7 @@ private static BiFunction, Flux { - CosmosQueryRequestOptions parallelCosmosQueryRequestOptions = ModelBridgeInternal.createQueryRequestOptions(requestOptions); + CosmosQueryRequestOptions parallelCosmosQueryRequestOptions = qryOptAccessor.clone(requestOptions); ModelBridgeInternal.setQueryRequestOptionsContinuationToken(parallelCosmosQueryRequestOptions, continuationToken); initParams.setCosmosQueryRequestOptions(parallelCosmosQueryRequestOptions); @@ -67,7 +71,7 @@ private static BiFunction, Flux Flux> createAsyncCore( + static Flux> createAsyncCore( DiagnosticsClientContext diagnosticsClientContext, IDocumentQueryClient client, PipelinedDocumentQueryParams initParams, diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java index a25daa4b7b2e..b299d57161f6 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/QueryPlanRetriever.java @@ -4,8 +4,11 @@ package com.azure.cosmos.implementation.query; import com.azure.cosmos.BridgeInternal; +import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfig; import com.azure.cosmos.implementation.DiagnosticsClientContext; +import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.routing.PartitionKeyInternal; +import com.azure.cosmos.models.CosmosQueryRequestOptions; import com.azure.cosmos.models.ModelBridgeInternal; import com.azure.cosmos.models.PartitionKey; import com.azure.cosmos.models.SqlQuerySpec; @@ -20,9 +23,15 @@ import java.util.HashMap; import java.util.Map; -import java.util.function.Function; +import java.util.function.BiFunction; +import java.util.function.Supplier; class QueryPlanRetriever { + + private final static + ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.CosmosQueryRequestOptionsAccessor qryOptAccessor = + ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.getCosmosQueryRequestOptionsAccessor(); + private static final String TRUE = "True"; private static final String SUPPORTED_QUERY_FEATURES = QueryFeature.Aggregate.name() + ", " + QueryFeature.CompositeAggregate.name() + ", " + @@ -40,7 +49,15 @@ static Mono getQueryPlanThroughGatewayAsync(Diagn IDocumentQueryClient queryClient, SqlQuerySpec sqlQuerySpec, String resourceLink, - PartitionKey partitionKey) { + CosmosQueryRequestOptions initialQueryRequestOptions) { + + CosmosQueryRequestOptions nonNullRequestOptions = initialQueryRequestOptions != null + ? initialQueryRequestOptions + : new CosmosQueryRequestOptions(); + + PartitionKey partitionKey = nonNullRequestOptions.getPartitionKey(); + + final Map requestHeaders = new HashMap<>(); requestHeaders.put(HttpConstants.HttpHeaders.CONTENT_TYPE, RuntimeConstants.MediaTypes.JSON); requestHeaders.put(HttpConstants.HttpHeaders.IS_QUERY_PLAN_REQUEST, TRUE); @@ -52,30 +69,40 @@ static Mono getQueryPlanThroughGatewayAsync(Diagn requestHeaders.put(HttpConstants.HttpHeaders.PARTITION_KEY, partitionKeyInternal.toJson()); } - final RxDocumentServiceRequest request = RxDocumentServiceRequest.create(diagnosticsClientContext, + final RxDocumentServiceRequest queryPlanRequest = RxDocumentServiceRequest.create(diagnosticsClientContext, OperationType.QueryPlan, ResourceType.Document, resourceLink, requestHeaders); - request.useGatewayMode = true; - request.setByteBuffer(ModelBridgeInternal.serializeJsonToByteBuffer(sqlQuerySpec)); + queryPlanRequest.useGatewayMode = true; + queryPlanRequest.setByteBuffer(ModelBridgeInternal.serializeJsonToByteBuffer(sqlQuerySpec)); - // TODO @fabianm wire up clientContext - final DocumentClientRetryPolicy retryPolicyInstance = - queryClient.getResetSessionTokenRetryPolicy().getRequestPolicy(null); + CosmosEndToEndOperationLatencyPolicyConfig end2EndConfig = + qryOptAccessor.getEndToEndOperationLatencyPolicyConfig(nonNullRequestOptions); + if (end2EndConfig != null) { + queryPlanRequest.requestContext.setEndToEndOperationLatencyPolicyConfig(end2EndConfig); + } - Function> executeFunc = req -> { - return BackoffRetryUtility.executeRetry(() -> { + BiFunction, RxDocumentServiceRequest, Mono> executeFunc = + (retryPolicyFactory, req) -> { + DocumentClientRetryPolicy retryPolicyInstance = retryPolicyFactory.get(); retryPolicyInstance.onBeforeSendRequest(req); - return queryClient.executeQueryAsync(request).flatMap(rxDocumentServiceResponse -> { - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo = - new PartitionedQueryExecutionInfo(rxDocumentServiceResponse.getResponseBodyAsByteArray(), rxDocumentServiceResponse.getGatewayHttpRequestTimeline()); - return Mono.just(partitionedQueryExecutionInfo); - }); - }, retryPolicyInstance); - }; + return BackoffRetryUtility.executeRetry(() -> + queryClient.executeQueryAsync(req).flatMap(rxDocumentServiceResponse -> { + PartitionedQueryExecutionInfo partitionedQueryExecutionInfo = + new PartitionedQueryExecutionInfo(rxDocumentServiceResponse.getResponseBodyAsByteArray(), rxDocumentServiceResponse.getGatewayHttpRequestTimeline()); + return Mono.just(partitionedQueryExecutionInfo); + + }), retryPolicyInstance); + }; - return executeFunc.apply(request); + return queryClient.executeFeedOperationWithAvailabilityStrategy( + ResourceType.Document, + OperationType.QueryPlan, + () -> queryClient.getResetSessionTokenRetryPolicy().getRequestPolicy(diagnosticsClientContext), + queryPlanRequest, + executeFunc + ); } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/metrics/FetchExecutionRange.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/metrics/FetchExecutionRange.java index 54ed687f469a..6ccdf9b1ad7f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/metrics/FetchExecutionRange.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/query/metrics/FetchExecutionRange.java @@ -2,13 +2,19 @@ // Licensed under the MIT License. package com.azure.cosmos.implementation.query.metrics; +import com.azure.cosmos.implementation.DiagnosticsInstantSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + import java.time.Instant; /** * Stores information about fetch execution */ public class FetchExecutionRange { + @JsonSerialize(using = DiagnosticsInstantSerializer.class) private final Instant startTime; + + @JsonSerialize(using = DiagnosticsInstantSerializer.class) private final Instant endTime; private final String partitionId; private final long numberOfDocuments; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/controller/container/ThroughputContainerController.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/controller/container/ThroughputContainerController.java index 0bc41548bec4..9f5e938f22db 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/controller/container/ThroughputContainerController.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/controller/container/ThroughputContainerController.java @@ -9,8 +9,13 @@ import com.azure.cosmos.CosmosBridgeInternal; import com.azure.cosmos.CosmosException; import com.azure.cosmos.implementation.AsyncDocumentClient; +import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.CosmosSchedulers; import com.azure.cosmos.implementation.HttpConstants; +import com.azure.cosmos.implementation.ImplementationBridgeHelpers; +import com.azure.cosmos.implementation.OperationType; +import com.azure.cosmos.implementation.QueryFeedOperationState; +import com.azure.cosmos.implementation.ResourceType; import com.azure.cosmos.implementation.RxDocumentServiceRequest; import com.azure.cosmos.implementation.Utils; import com.azure.cosmos.implementation.apachecommons.lang.StringUtils; @@ -145,13 +150,13 @@ private Mono resolveContainerResourceId() { private Mono resolveDatabaseThroughput() { return Mono.justOrEmpty(this.targetDatabaseRid) .switchIfEmpty(this.resolveDatabaseResourceId()) - .flatMap(databaseRid -> this.resolveThroughputByResourceId(databaseRid)); + .flatMap(this::resolveThroughputByResourceId); } private Mono resolveContainerThroughput() { if (StringUtils.isEmpty(this.targetContainerRid)) { return this.resolveContainerResourceId() - .flatMap(containerRid -> this.resolveThroughputByResourceId(containerRid)) + .flatMap(this::resolveThroughputByResourceId) .onErrorResume(throwable -> { if (this.isOwnerResourceNotExistsException(throwable)) { // During initialization time, the collection cache may contain staled info, @@ -165,10 +170,10 @@ private Mono resolveContainerThroughput() { return Mono.error(throwable); }) - .retryWhen(RetrySpec.max(1).filter(throwable -> this.isOwnerResourceNotExistsException(throwable))); + .retryWhen(RetrySpec.max(1).filter(this::isOwnerResourceNotExistsException)); } else { return Mono.just(this.targetContainerRid) - .flatMap(containerRid -> this.resolveThroughputByResourceId(containerRid)); + .flatMap(this::resolveThroughputByResourceId); } } @@ -208,7 +213,7 @@ private Mono resolveContainerMaxThroughputCore() { // which is constant value, hence no need to resolve throughput return Mono.empty(); }) - .map(throughputResponse -> this.getMaxContainerThroughput(throughputResponse)) + .map(this::getMaxContainerThroughput) .onErrorResume(throwable -> { if (this.isOwnerResourceNotExistsException(throwable)) { this.cancellationTokenSource.close(); @@ -219,7 +224,7 @@ private Mono resolveContainerMaxThroughputCore() { .retryWhen( // Throughput can be configured on database level or container level // Retry at most 1 time so we can try on database and container both - RetrySpec.max(1).filter(throwable -> this.isOfferNotConfiguredException(throwable)) + RetrySpec.max(1).filter(this::isOfferNotConfiguredException) ); } @@ -229,8 +234,19 @@ private Mono resolveThroughputByResourceId(String resourceId // We are not supporting serverless account for throughput control for now. But the protocol may change in future, // use https://github.com/Azure/azure-sdk-for-java/issues/18776 to keep track for possible future work. checkArgument(StringUtils.isNotEmpty(resourceId), "ResourceId can not be null or empty"); + QueryFeedOperationState state = new QueryFeedOperationState( + ImplementationBridgeHelpers.CosmosAsyncDatabaseHelper.getCosmosAsyncDatabaseAccessor().getCosmosAsyncClient(this.targetContainer.getDatabase()), + "resolveThroughputByResourceId", + this.targetContainer.getDatabase().getId(), + this.targetContainer.getId(), + ResourceType.Offer, + OperationType.Query, + null, + new CosmosQueryRequestOptions(), + new CosmosPagedFluxOptions() + ); return this.client.queryOffers( - BridgeInternal.getOfferQuerySpecFromResourceId(this.targetContainer, resourceId), new CosmosQueryRequestOptions()) + BridgeInternal.getOfferQuerySpecFromResourceId(this.targetContainer, resourceId), state) .single() .flatMap(offerFeedResponse -> { if (offerFeedResponse.getResults().isEmpty()) { @@ -319,7 +335,7 @@ public boolean canHandleRequest(RxDocumentServiceRequest request) { private Mono createAndInitializeGroupControllers() { return Flux.fromIterable(this.groups) - .flatMap(group -> this.resolveThroughputGroupController(group)) + .flatMap(this::resolveThroughputGroupController) .then(Mono.just(this)); } @@ -372,7 +388,7 @@ private Flux refreshContainerMaxThroughputTask(LinkedCancellationToken can } }) .flatMapIterable(controller -> this.groups) - .flatMap(group -> this.resolveThroughputGroupController(group)) + .flatMap(this::resolveThroughputGroupController) .doOnNext(groupController -> groupController.onContainerMaxThroughputRefresh(this.maxContainerThroughput.get())) .onErrorResume(throwable -> { logger.warn("Refresh throughput failed with reason {}", throwable.getMessage()); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/controller/request/GlobalThroughputRequestController.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/controller/request/GlobalThroughputRequestController.java index 21c9adfa52f8..6fdec7d63b4f 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/controller/request/GlobalThroughputRequestController.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/throughputControl/controller/request/GlobalThroughputRequestController.java @@ -22,7 +22,7 @@ public GlobalThroughputRequestController(double initialScheduledThroughput) { @Override @SuppressWarnings("unchecked") public Mono init() { - return Mono.just((T)requestThrottler); + return Mono.just((T)this); } @Override diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosBulkExecutionOptions.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosBulkExecutionOptions.java index d2ebee2b7be9..a8f3d4711a1e 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosBulkExecutionOptions.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosBulkExecutionOptions.java @@ -70,11 +70,33 @@ public CosmosBulkExecutionOptions() { this(null, null, null); } - int getInitialMicroBatchSize() { + /** + * Gets the initial size of micro batches that will be sent to the backend. The size of micro batches will + * be dynamically adjusted based on the throttling rate. The default value is 100 - so, it starts with relatively + * large micro batches and when the throttling rate is too high, it will reduce the batch size. When the + * short spikes of throttling before dynamically reducing the initial batch size results in side effects for other + * workloads the initial micro batch size can be reduced - for example set to 1 - at which point it would + * start with small micro batches and then increase the batch size over time. + * @return the initial micro batch size + */ + public int getInitialMicroBatchSize() { return initialMicroBatchSize; } - CosmosBulkExecutionOptions setInitialMicroBatchSize(int initialMicroBatchSize) { + /** + * Sets the initial size of micro batches that will be sent to the backend. The size of micro batches will + * be dynamically adjusted based on the throttling rate. The default value is 100 - so, it starts with relatively + * large micro batches and when the throttling rate is too high, it will reduce the batch size. When the + * short spikes of throttling before dynamically reducing the initial batch size results in side effects for other + * workloads the initial micro batch size can be reduced - for example set to 1 - at which point it would + * start with small micro batches and then increase the batch size over time. + * @param initialMicroBatchSize the initial micro batch size to be used. Must be a positive integer. + * @return the bulk execution options. + */ + public CosmosBulkExecutionOptions setInitialMicroBatchSize(int initialMicroBatchSize) { + checkArgument( + initialMicroBatchSize > 0, + "The argument 'initialMicroBatchSize' must be a positive integer."); this.initialMicroBatchSize = initialMicroBatchSize; return this; } @@ -369,16 +391,6 @@ public CosmosBulkExecutionOptions setTargetedMicroBatchRetryRate( return options.setTargetedMicroBatchRetryRate(minRetryRate, maxRetryRate); } - @Override - public int getInitialMicroBatchSize(CosmosBulkExecutionOptions options) { - return options.getInitialMicroBatchSize(); - } - - @Override - public CosmosBulkExecutionOptions setInitialMicroBatchSize(CosmosBulkExecutionOptions options, int initialMicroBatchSize) { - return options.setInitialMicroBatchSize(initialMicroBatchSize); - } - @Override public CosmosBulkExecutionOptions setHeader(CosmosBulkExecutionOptions cosmosBulkExecutionOptions, String name, String value) { diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosChangeFeedRequestOptions.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosChangeFeedRequestOptions.java index b8049fab1fc7..90b09a674848 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosChangeFeedRequestOptions.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosChangeFeedRequestOptions.java @@ -595,22 +595,6 @@ public CosmosDiagnosticsThresholds getDiagnosticsThresholds(CosmosChangeFeedRequ return options.thresholds; } - @Override - public void applyMaxItemCount( - CosmosChangeFeedRequestOptions requestOptions, - CosmosPagedFluxOptions fluxOptions) { - - if (requestOptions == null || fluxOptions == null) { - return; - } - - if (fluxOptions.getMaxItemCount() != null) { - return; - } - - fluxOptions.setMaxItemCount(requestOptions.getMaxItemCount()); - } - @Override public List getExcludeRegions(CosmosChangeFeedRequestOptions cosmosChangeFeedRequestOptions) { return cosmosChangeFeedRequestOptions.excludeRegions; diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosClientTelemetryConfig.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosClientTelemetryConfig.java index c2db5ae1e9f8..4e7248814696 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosClientTelemetryConfig.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosClientTelemetryConfig.java @@ -90,6 +90,11 @@ public CosmosClientTelemetryConfig() { this.tracer = null; this.tracingOptions = null; this.samplingRate = 1; + CosmosMicrometerMetricsOptions defaultMetricsOptions = new CosmosMicrometerMetricsOptions(); + this.isClientMetricsEnabled = defaultMetricsOptions.isEnabled(); + if (this.isClientMetricsEnabled) { + this.micrometerMetricsOptions = defaultMetricsOptions; + } } /** @@ -146,7 +151,6 @@ public CosmosClientTelemetryConfig metricsOptions(MetricsOptions clientMetricsOp checkNotNull(clientMetricsOptions, "expected non-null clientMetricsOptions"); if (! (clientMetricsOptions instanceof CosmosMicrometerMetricsOptions)) { - // TODO @fabianm - extend this to OpenTelemetry etc. eventually throw new IllegalArgumentException( "Currently only MetricsOptions of type CosmosMicrometerMetricsOptions are supported"); } @@ -281,7 +285,7 @@ public CosmosClientTelemetryConfig metricTagNames(String... tagNames) { String validTagNames = String.join( ", ", - (String[]) Arrays.stream(TagName.values()).map(tag -> tag.toString()).toArray()); + (String[]) Arrays.stream(TagName.values()).map(TagName::toString).toArray()); throw new IllegalArgumentException( String.format( @@ -295,7 +299,7 @@ public CosmosClientTelemetryConfig metricTagNames(String... tagNames) { }); EnumSet newTagNames = EnumSet.noneOf(TagName.class); - tagNameStream.forEach(tagName -> newTagNames.add(tagName)); + tagNameStream.forEach(newTagNames::add); this.metricTagNamesOverride = newTagNames; @@ -540,6 +544,10 @@ public String getClientCorrelationId(CosmosClientTelemetryConfig config) { @Override public MeterRegistry getClientMetricRegistry(CosmosClientTelemetryConfig config) { + if (!config.isClientMetricsEnabled) { + return null; + } + return config.getClientMetricRegistry(); } @@ -600,6 +608,13 @@ public ClientTelemetry getClientTelemetry(CosmosClientTelemetryConfig config) { public void addDiagnosticsHandler(CosmosClientTelemetryConfig config, CosmosDiagnosticsHandler handler) { + for (CosmosDiagnosticsHandler existingHandler : config.diagnosticHandlers) { + if (existingHandler.getClass().getCanonicalName().equals(handler.getClass().getCanonicalName())) { + // Handler already had been added - this can happen for example when multiple + // Cosmos(Async)Clients are created from a single CosmosClientBuilder. + return; + } + } config.diagnosticHandlers.add(handler); } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java index c994432a4408..fb6a9a627fe1 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosQueryRequestOptions.java @@ -8,7 +8,6 @@ import com.azure.cosmos.CosmosDiagnosticsThresholds; import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfig; import com.azure.cosmos.implementation.Configs; -import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.implementation.RequestOptions; import com.azure.cosmos.implementation.Strings; @@ -59,8 +58,8 @@ public class CosmosQueryRequestOptions { private Function itemFactoryMethod; private String queryName; private CosmosEndToEndOperationLatencyPolicyConfig cosmosEndToEndOperationLatencyPolicyConfig; - private List cancelledRequestDiagnosticsTracker = new ArrayList<>(); private List excludeRegions; + private List cancelledRequestDiagnosticsTracker = new ArrayList<>(); /** * Instantiates a new query request options. @@ -699,7 +698,8 @@ CosmosQueryRequestOptions withEmptyPageDiagnosticsEnabled(boolean emptyPageDiagn return this; } - return new CosmosQueryRequestOptions(this).setEmptyPageDiagnosticsEnabled(emptyPageDiagnosticsEnabled); + return new CosmosQueryRequestOptions(this) + .setEmptyPageDiagnosticsEnabled(emptyPageDiagnosticsEnabled); } Function getItemFactoryMethod() { return this.itemFactoryMethod; } @@ -725,6 +725,11 @@ static void initialize() { ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.setCosmosQueryRequestOptionsAccessor( new ImplementationBridgeHelpers.CosmosQueryRequestOptionsHelper.CosmosQueryRequestOptionsAccessor() { + @Override + public CosmosQueryRequestOptions clone(CosmosQueryRequestOptions toBeCloned) { + return new CosmosQueryRequestOptions(toBeCloned); + } + @Override public void setOperationContext(CosmosQueryRequestOptions queryRequestOptions, OperationContextAndListenerTuple operationContextAndListenerTuple) { @@ -784,11 +789,6 @@ public boolean isEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequ return queryRequestOptions.isEmptyPageDiagnosticsEnabled(); } - @Override - public CosmosQueryRequestOptions setEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequestOptions, boolean emptyPageDiagnosticsEnabled) { - return queryRequestOptions.setEmptyPageDiagnosticsEnabled(emptyPageDiagnosticsEnabled); - } - @Override public CosmosQueryRequestOptions withEmptyPageDiagnosticsEnabled(CosmosQueryRequestOptions queryRequestOptions, boolean emptyPageDiagnosticsEnabled) { return queryRequestOptions.withEmptyPageDiagnosticsEnabled(emptyPageDiagnosticsEnabled); @@ -846,22 +846,6 @@ public CosmosDiagnosticsThresholds getDiagnosticsThresholds(CosmosQueryRequestOp return options.thresholds; } - @Override - public void applyMaxItemCount( - CosmosQueryRequestOptions requestOptions, - CosmosPagedFluxOptions fluxOptions) { - - if (requestOptions == null || requestOptions.getMaxItemCount() == null || fluxOptions == null) { - return; - } - - if (fluxOptions.getMaxItemCount() != null) { - return; - } - - fluxOptions.setMaxItemCount(requestOptions.getMaxItemCount()); - } - @Override public CosmosEndToEndOperationLatencyPolicyConfig getEndToEndOperationLatencyPolicyConfig(CosmosQueryRequestOptions options) { return options.getEndToEndOperationLatencyConfig(); @@ -879,6 +863,26 @@ public void setCancelledRequestDiagnosticsTracker( options.setCancelledRequestDiagnosticsTracker(cancelledRequestDiagnosticsTracker); } + @Override + public void setAllowEmptyPages(CosmosQueryRequestOptions options, boolean emptyPagesAllowed) { + options.setEmptyPagesAllowed(emptyPagesAllowed); + } + + @Override + public boolean getAllowEmptyPages(CosmosQueryRequestOptions options) { + return options.isEmptyPagesAllowed(); + } + + @Override + public Integer getMaxItemCount(CosmosQueryRequestOptions options) { + return options.getMaxItemCount(); + } + + @Override + public String getRequestContinuation(CosmosQueryRequestOptions options) { + return options.getRequestContinuation(); + } + @Override public List getExcludeRegions(CosmosQueryRequestOptions options) { return options.getExcludedRegions(); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java index 8fc0565b34ff..344c906335a6 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/ModelBridgeInternal.java @@ -225,29 +225,11 @@ public static RequestOptions toRequestOptions(CosmosContainerRequestOptions cosm return cosmosContainerRequestOptions.toRequestOptions(); } -// @Warning(value = INTERNAL_USE_ONLY_WARNING) -// public static CosmosContainerRequestOptions setOfferThroughput(CosmosContainerRequestOptions cosmosContainerRequestOptions, -// Integer offerThroughput) { -// return cosmosContainerRequestOptions.setOfferThroughput(offerThroughput); -// } -// -// @Warning(value = INTERNAL_USE_ONLY_WARNING) -// public static CosmosContainerRequestOptions setThroughputProperties(CosmosContainerRequestOptions cosmosContainerRequestOptions, -// ThroughputProperties throughputProperties) { -// return cosmosContainerRequestOptions.setThroughputProperties(throughputProperties); -// } - @Warning(value = INTERNAL_USE_ONLY_WARNING) public static RequestOptions toRequestOptions(CosmosDatabaseRequestOptions cosmosDatabaseRequestOptions) { return cosmosDatabaseRequestOptions.toRequestOptions(); } -// @Warning(value = INTERNAL_USE_ONLY_WARNING) -// public static CosmosDatabaseRequestOptions setOfferThroughput(CosmosDatabaseRequestOptions cosmosDatabaseRequestOptions, -// Integer offerThroughput) { -// return cosmosDatabaseRequestOptions.setOfferThroughput(offerThroughput); -// } - @Warning(value = INTERNAL_USE_ONLY_WARNING) public static CosmosDatabaseRequestOptions setThroughputProperties( CosmosDatabaseRequestOptions cosmosDatabaseRequestOptions, @@ -342,7 +324,7 @@ public static FeedResponse toFeedResponsePage( Function factoryMethod, Class cls) { - return new FeedResponse(response.getQueryResponse(factoryMethod, cls), response); + return new FeedResponse<>(response.getQueryResponse(factoryMethod, cls), response); } @Warning(value = INTERNAL_USE_ONLY_WARNING) @@ -356,7 +338,7 @@ public static FeedResponse toChangeFeedResponsePage( Function factoryMethod, Class cls) { - return new FeedResponse( + return new FeedResponse<>( noChanges(response) ? Collections.emptyList() : response.getQueryResponse(factoryMethod, cls), response.getResponseHeaders(), noChanges(response)); } @@ -708,21 +690,11 @@ public static void addQueryPlanDiagnosticsContextToFeedResponse(FeedResponse feedResponse.setQueryPlanDiagnosticsContext(queryPlanDiagnosticsContext); } - @Warning(value = INTERNAL_USE_ONLY_WARNING) - public static QueryInfo getQueryInfoFromFeedResponse(FeedResponse response) { - return response.getQueryInfo(); - } - @Warning(value = INTERNAL_USE_ONLY_WARNING) public static boolean getNoChangesFromFeedResponse(FeedResponse response) { return response.getNoChanges(); } - @Warning(value = INTERNAL_USE_ONLY_WARNING) - public static CosmosQueryRequestOptions createQueryRequestOptions(CosmosQueryRequestOptions options) { - return new CosmosQueryRequestOptions(options); - } - @Warning(value = INTERNAL_USE_ONLY_WARNING) public static Integer getMaxItemCountFromQueryRequestOptions(CosmosQueryRequestOptions options) { return options.getMaxItemCount(); @@ -756,16 +728,6 @@ public static CosmosQueryRequestOptions setQueryRequestOptionsProperties(CosmosQ return options.setProperties(properties); } - @Warning(value = INTERNAL_USE_ONLY_WARNING) - public static boolean getEmptyPagesAllowedFromQueryRequestOptions(CosmosQueryRequestOptions options) { - return options.isEmptyPagesAllowed(); - } - - @Warning(value = INTERNAL_USE_ONLY_WARNING) - public static CosmosQueryRequestOptions setQueryRequestOptionsEmptyPagesAllowed(CosmosQueryRequestOptions options, boolean emptyPageAllowed) { - return options.setEmptyPagesAllowed(emptyPageAllowed); - } - @Warning(value = INTERNAL_USE_ONLY_WARNING) public static IndexingPolicy createIndexingPolicy(Index[] indexes) { return new IndexingPolicy(indexes); @@ -935,11 +897,6 @@ public static CosmosBulkOperationResponse createCosmosBulkO batchContext); } - @Warning(value = INTERNAL_USE_ONLY_WARNING) - public static int getPayloadLength(CosmosBatchResponse cosmosBatchResponse) { - return cosmosBatchResponse.getResponseLength(); - } - @Warning(value = INTERNAL_USE_ONLY_WARNING) public static List getPatchOperationsFromCosmosPatch(CosmosPatchOperations cosmosPatchOperations) { return cosmosPatchOperations.getPatchOperations(); diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PriorityLevel.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PriorityLevel.java index 72fdf901e9b3..421c2f92d59d 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PriorityLevel.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/PriorityLevel.java @@ -3,27 +3,13 @@ package com.azure.cosmos.models; -import java.time.Duration; -import java.util.Collection; -import java.util.EnumSet; +import com.azure.cosmos.implementation.ImplementationBridgeHelpers; +import com.fasterxml.jackson.annotation.JsonValue; + import java.util.Locale; import java.util.Objects; import java.util.StringJoiner; -import com.azure.core.http.ProxyOptions; -import com.azure.core.util.tracing.Tracer; -import com.azure.cosmos.CosmosDiagnosticsHandler; -import com.azure.cosmos.CosmosDiagnosticsThresholds; -import com.azure.cosmos.implementation.ImplementationBridgeHelpers; -import com.azure.cosmos.implementation.clienttelemetry.ClientTelemetry; -import com.azure.cosmos.implementation.clienttelemetry.CosmosMeterOptions; -import com.azure.cosmos.implementation.clienttelemetry.MetricCategory; -import com.azure.cosmos.implementation.clienttelemetry.TagName; -import com.azure.cosmos.implementation.directconnectivity.rntbd.RntbdConstants; -import com.fasterxml.jackson.annotation.JsonValue; -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.Tag; - import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; /** diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/util/Beta.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/util/Beta.java index 9540b655c473..da7fd9f4da9a 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/util/Beta.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/util/Beta.java @@ -95,6 +95,8 @@ public enum SinceVersion { /** v4.35.0 */ V4_35_0, /** v4.37.0 */ - V4_37_0 + V4_37_0, + /** v4.51.0 */ + V4_51_0 } } diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/util/CosmosPagedFlux.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/util/CosmosPagedFlux.java index fba1bd12e246..c9701ec78f19 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/util/CosmosPagedFlux.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/util/CosmosPagedFlux.java @@ -7,15 +7,12 @@ import com.azure.core.util.FluxUtil; import com.azure.core.util.IterableStream; import com.azure.core.util.paging.ContinuablePagedFlux; -import com.azure.cosmos.BridgeInternal; import com.azure.cosmos.CosmosDiagnostics; -import com.azure.cosmos.CosmosDiagnosticsContext; import com.azure.cosmos.implementation.CosmosPagedFluxOptions; import com.azure.cosmos.implementation.DiagnosticsProvider; +import com.azure.cosmos.implementation.FeedOperationState; import com.azure.cosmos.implementation.ImplementationBridgeHelpers; import com.azure.cosmos.models.FeedResponse; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; @@ -41,12 +38,9 @@ * @see FeedResponse */ public final class CosmosPagedFlux extends ContinuablePagedFlux> { - private final static Logger LOGGER = LoggerFactory.getLogger(CosmosPagedFlux.class); private final static ImplementationBridgeHelpers.CosmosDiagnosticsHelper.CosmosDiagnosticsAccessor cosmosDiagnosticsAccessor = ImplementationBridgeHelpers.CosmosDiagnosticsHelper.getCosmosDiagnosticsAccessor(); - private static final ImplementationBridgeHelpers.CosmosDiagnosticsContextHelper.CosmosDiagnosticsContextAccessor ctxAccessor = - ImplementationBridgeHelpers.CosmosDiagnosticsContextHelper.getCosmosDiagnosticsContextAccessor(); private final Function>> optionsFluxFunction; private final Consumer> feedResponseConsumer; @@ -146,7 +140,8 @@ private CosmosPagedFluxOptions createCosmosPagedFluxOptions() { } private Flux wrapWithTracingIfEnabled(CosmosPagedFluxOptions pagedFluxOptions, Flux publisher) { - DiagnosticsProvider tracerProvider = pagedFluxOptions.getDiagnosticsProvider(); + FeedOperationState stateSnapshot = pagedFluxOptions.getFeedOperationState(); + DiagnosticsProvider tracerProvider = stateSnapshot != null ? stateSnapshot.getDiagnosticsProvider() : null; if (tracerProvider == null || !tracerProvider.isEnabled()) { @@ -158,7 +153,6 @@ private Flux wrapWithTracingIfEnabled(CosmosPagedFluxOptions private void recordFeedResponse( CosmosPagedFluxOptions pagedFluxOptions, - Context traceCtx, DiagnosticsProvider tracerProvider, FeedResponse response, AtomicLong feedResponseConsumerLatencyInNanos) { @@ -180,10 +174,10 @@ private void recordFeedResponse( if (isTracerEnabled(tracerProvider)) { tracerProvider.recordPage( - traceCtx, - response != null ? response.getCosmosDiagnostics() : null, + pagedFluxOptions.getFeedOperationState().getDiagnosticsContextSnapshot(), + diagnostics, actualItemCount, - response != null ? response.getRequestCharge() : null); + response.getRequestCharge()); } // If the user has passed feedResponseConsumer, then call it with each feedResponse @@ -202,6 +196,7 @@ private void recordFeedResponse( private Flux> byPage(CosmosPagedFluxOptions pagedFluxOptions, Context context) { AtomicReference startTime = new AtomicReference<>(); AtomicLong feedResponseConsumerLatencyInNanos = new AtomicLong(0); + Object lockHolder = new Object(); Flux> result = wrapWithTracingIfEnabled( @@ -214,80 +209,91 @@ private Flux> byPage(CosmosPagedFluxOptions pagedFluxOptions, Co FeedResponse response = signal.get(); Context traceCtx = DiagnosticsProvider.getContextFromReactorOrNull(signal.getContextView()); - DiagnosticsProvider tracerProvider = pagedFluxOptions.getDiagnosticsProvider(); - switch (signal.getType()) { - case ON_COMPLETE: - this.recordFeedResponse(pagedFluxOptions, traceCtx, tracerProvider, response, feedResponseConsumerLatencyInNanos); - if (isTracerEnabled(tracerProvider)) { - tracerProvider.recordFeedResponseConsumerLatency( - signal, - Duration.ofNanos(feedResponseConsumerLatencyInNanos.get())); - - tracerProvider.endSpan(traceCtx); - } - - break; - case ON_NEXT: - this.recordFeedResponse(pagedFluxOptions, traceCtx, tracerProvider, response, feedResponseConsumerLatencyInNanos); - - break; - - case ON_ERROR: - if (isTracerEnabled(tracerProvider)) { - tracerProvider.recordFeedResponseConsumerLatency( - signal, - Duration.ofNanos(feedResponseConsumerLatencyInNanos.get())); - - // all info is extracted from CosmosException when applicable - tracerProvider.endSpan( - traceCtx, - signal.getThrowable() - ); - } - - break; - - default: - break; - }}); - - - final DiagnosticsProvider tracerProvider = pagedFluxOptions.getDiagnosticsProvider(); + FeedOperationState state = pagedFluxOptions.getFeedOperationState(); + DiagnosticsProvider tracerProvider = state != null ? state.getDiagnosticsProvider() : null; + + synchronized (lockHolder) { + switch (signal.getType()) { + case ON_COMPLETE: + this.recordFeedResponse(pagedFluxOptions, tracerProvider, response, feedResponseConsumerLatencyInNanos); + + if (isTracerEnabled(tracerProvider)) { + state.mergeDiagnosticsContext(); + tracerProvider.recordFeedResponseConsumerLatency( + signal, + state.getDiagnosticsContextSnapshot(), + Duration.ofNanos(feedResponseConsumerLatencyInNanos.get())); + + tracerProvider.endSpan(state.getDiagnosticsContextSnapshot(), traceCtx); + } + + break; + case ON_NEXT: + this.recordFeedResponse(pagedFluxOptions, tracerProvider, response, feedResponseConsumerLatencyInNanos); + + if (isTracerEnabled(tracerProvider)) { + state.mergeDiagnosticsContext(); + tracerProvider.endSpan(state.getDiagnosticsContextSnapshot(), traceCtx); + state.resetDiagnosticsContext(); + + DiagnosticsProvider.setContextInReactor(tracerProvider.startSpan( + state.getSpanName(), + state.getDiagnosticsContextSnapshot(), + traceCtx)); + } + + break; + + case ON_ERROR: + if (isTracerEnabled(tracerProvider)) { + state.mergeDiagnosticsContext(); + tracerProvider.recordFeedResponseConsumerLatency( + signal, + state.getDiagnosticsContextSnapshot(), + Duration.ofNanos(feedResponseConsumerLatencyInNanos.get())); + + // all info is extracted from CosmosException when applicable + tracerProvider.endSpan( + state.getDiagnosticsContextSnapshot(), + traceCtx, + signal.getThrowable() + ); + } + + break; + + default: + break; + } + } + }); + + final FeedOperationState state = pagedFluxOptions.getFeedOperationState(); + final DiagnosticsProvider tracerProvider = state != null ? state.getDiagnosticsProvider() : null; if (isTracerEnabled(tracerProvider)) { - - final CosmosDiagnosticsContext cosmosCtx = ctxAccessor.create( - pagedFluxOptions.getSpanName(), - pagedFluxOptions.getAccountTag(), - BridgeInternal.getServiceEndpoint(pagedFluxOptions.getCosmosAsyncClient()), - pagedFluxOptions.getDatabaseId(), - pagedFluxOptions.getContainerId(), - pagedFluxOptions.getResourceType(), - pagedFluxOptions.getOperationType(), - pagedFluxOptions.getOperationId(), - pagedFluxOptions.getEffectiveConsistencyLevel(), - pagedFluxOptions.getMaxItemCount(), - pagedFluxOptions.getDiagnosticsThresholds(), - null, - pagedFluxOptions.getConnectionMode(), - pagedFluxOptions.getUserAgent()); - ctxAccessor.setSamplingRateSnapshot(cosmosCtx, pagedFluxOptions.getSamplingRateSnapshot()); - return Flux .deferContextual(reactorCtx -> result .doOnCancel(() -> { Context traceCtx = DiagnosticsProvider.getContextFromReactorOrNull(reactorCtx); - tracerProvider.endSpan(traceCtx); + synchronized (lockHolder) { + state.mergeDiagnosticsContext(); + tracerProvider.endSpan(state.getDiagnosticsContextSnapshot(), traceCtx); + } }) .doOnComplete(() -> { Context traceCtx = DiagnosticsProvider.getContextFromReactorOrNull(reactorCtx); - tracerProvider.endSpan(traceCtx); + synchronized(lockHolder) { + state.mergeDiagnosticsContext(); + tracerProvider.endSpan(state.getDiagnosticsContextSnapshot(), traceCtx); + } })) .contextWrite(DiagnosticsProvider.setContextInReactor( - pagedFluxOptions.getDiagnosticsProvider().startSpan( - pagedFluxOptions.getSpanName(), - cosmosCtx, - context))); + tracerProvider.startSpan( + state.getSpanName(), + state.getDiagnosticsContextSnapshot(), + context) + )); } diff --git a/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/ChangeFeedProcessorAllVersionsAndDeletesModeCodeSnippet.java b/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/ChangeFeedProcessorAllVersionsAndDeletesModeCodeSnippet.java index 2cae67956699..acb673f57125 100644 --- a/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/ChangeFeedProcessorAllVersionsAndDeletesModeCodeSnippet.java +++ b/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/ChangeFeedProcessorAllVersionsAndDeletesModeCodeSnippet.java @@ -59,5 +59,59 @@ public void handleAllVersionsAndDeletesChangesCodeSnippet() { // END: com.azure.cosmos.allVersionsAndDeletesChangeFeedProcessor.handleChanges .buildChangeFeedProcessor(); } + + public void changeFeedProcessorBuilderWithContextCodeSnippet() { + String hostName = "test-host-name"; + CosmosAsyncClient cosmosAsyncClient = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .contentResponseOnWriteEnabled(true) + .consistencyLevel(ConsistencyLevel.SESSION) + .buildAsyncClient(); + CosmosAsyncDatabase cosmosAsyncDatabase = cosmosAsyncClient.getDatabase("testDb"); + CosmosAsyncContainer feedContainer = cosmosAsyncDatabase.getContainer("feedContainer"); + CosmosAsyncContainer leaseContainer = cosmosAsyncDatabase.getContainer("leaseContainer"); + // BEGIN: com.azure.cosmos.allVersionsAndDeletesChangeFeedProcessorWithContext.builder + ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder() + .hostName(hostName) + .feedContainer(feedContainer) + .leaseContainer(leaseContainer) + .handleAllVersionsAndDeletesChanges((docs, context) -> { + for (ChangeFeedProcessorItem item : docs) { + // Implementation for handling and processing of each ChangeFeedProcessorItem item goes here + } + String leaseToken = context.getLeaseToken(); + // Handling of the lease token corresponding to a batch of change feed processor item goes here + }) + .buildChangeFeedProcessor(); + // END: com.azure.cosmos.allVersionsAndDeletesChangeFeedProcessorWithContext.builder + } + + public void handleAllVersionsAndDeletesChangesWithContextCodeSnippet() { + String hostName = "test-host-name"; + CosmosAsyncClient cosmosAsyncClient = new CosmosClientBuilder() + .endpoint(TestConfigurations.HOST) + .key(TestConfigurations.MASTER_KEY) + .contentResponseOnWriteEnabled(true) + .consistencyLevel(ConsistencyLevel.SESSION) + .buildAsyncClient(); + CosmosAsyncDatabase cosmosAsyncDatabase = cosmosAsyncClient.getDatabase("testDb"); + CosmosAsyncContainer feedContainer = cosmosAsyncDatabase.getContainer("feedContainer"); + CosmosAsyncContainer leaseContainer = cosmosAsyncDatabase.getContainer("leaseContainer"); + ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder() + .hostName(hostName) + .feedContainer(feedContainer) + .leaseContainer(leaseContainer) + // BEGIN: com.azure.cosmos.allVersionsAndDeletesChangeFeedProcessorWithContext.handleChanges + .handleAllVersionsAndDeletesChanges((docs, context) -> { + for (ChangeFeedProcessorItem item : docs) { + // Implementation for handling and processing of each ChangeFeedProcessorItem item goes here + } + String leaseToken = context.getLeaseToken(); + // Handling of the lease token corresponding to a batch of change feed processor item goes here + }) + // END: com.azure.cosmos.allVersionsAndDeletesChangeFeedProcessorWithContext.handleChanges + .buildChangeFeedProcessor(); + } } diff --git a/sdk/cosmos/tests.yml b/sdk/cosmos/tests.yml index ff6571ebb7d8..ead6ac8537dd 100644 --- a/sdk/cosmos/tests.yml +++ b/sdk/cosmos/tests.yml @@ -47,7 +47,7 @@ stages: - $(sub-config-cosmos-azure-cloud-test-resources) MatrixConfigs: - Name: Cosmos_live_test_integration - Path: sdk/spring/cosmos-integration-matrix.json + Path: sdk/spring/pipeline/cosmos-integration-matrix.json Selection: all GenerateVMJobs: true ServiceDirectory: spring diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/CHANGELOG.md b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/CHANGELOG.md index df93f57b5e5e..e412244ea315 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/CHANGELOG.md +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.1.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,10 @@ ### Other Changes +## 1.0.0 (2023-09-22) + +- Azure Resource Manager CosmosDBForPostgreSql client library for Java. This package contains Microsoft Azure SDK for CosmosDBForPostgreSql Management SDK. Azure Cosmos DB for PostgreSQL database service resource provider REST APIs. Package tag package-2022-11-08. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + ## 1.0.0-beta.1 (2023-06-13) - Azure Resource Manager CosmosDBForPostgreSql client library for Java. This package contains Microsoft Azure SDK for CosmosDBForPostgreSql Management SDK. Azure Cosmos DB for PostgreSQL database service resource provider REST APIs. Package tag package-2022-11-08. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/README.md b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/README.md index 405ed6a3bfa2..107256a1b76f 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/README.md +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-cosmosdbforpostgresql - 1.0.0-beta.1 + 1.0.0 ``` [//]: # ({x-version-update-end}) @@ -103,3 +103,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcosmosdbforpostgresql%2Fazure-resourcemanager-cosmosdbforpostgresql%2FREADME.png) diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/SAMPLE.md b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/SAMPLE.md index 07a517791230..d8bd27119f74 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/SAMPLE.md +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/SAMPLE.md @@ -94,61 +94,108 @@ import java.util.Map; /** Samples for Clusters Create. */ public final class ClustersCreateSamples { /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateSingleNode.json */ /** - * Sample code: Create a new cluster as a read replica. + * Sample code: Create a new single node cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewClusterAsAReadReplica( + public static void createANewSingleNodeCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-singlenode") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withSourceResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") - .withSourceLocation("westus") + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(true) + .withCoordinatorServerEdition("GeneralPurpose") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(8) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) .create(); } /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev1.json */ /** - * Sample code: Create a new cluster as a point in time restore. + * Sample code: Create a new single node Burstable 1 vCore cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewClusterAsAPointInTimeRestore( + public static void createANewSingleNodeBurstable1VCoreCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-burstablev1") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withSourceResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") - .withSourceLocation("westus") - .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(false) + .withCoordinatorServerEdition("BurstableMemoryOptimized") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(1) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) .create(); } /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreate.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev2.json */ /** - * Sample code: Create a new cluster. + * Sample code: Create a new single node Burstable 2 vCores cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewCluster( + public static void createANewSingleNodeBurstable2VCoresCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-burstablev2") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(false) + .withCoordinatorServerEdition("BurstableGeneralPurpose") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(2) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateMultiNode.json + */ + /** + * Sample code: Create a new multi-node cluster. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewMultiNodeCluster( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster-multinode") .withRegion("westus") .withExistingResourceGroup("TestGroup") .withTags(mapOf()) @@ -170,6 +217,50 @@ public final class ClustersCreateSamples { .create(); } + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + */ + /** + * Sample code: Create a new cluster as a read replica. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewClusterAsAReadReplica( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") + .withSourceLocation("westus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + */ + /** + * Sample code: Create a new cluster as a point in time restore. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewClusterAsAPointInTimeRestore( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") + .withSourceLocation("westus") + .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .create(); + } + + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/pom.xml b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/pom.xml index 0f323f3dc4f0..d5d0a3d49b25 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/pom.xml +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-cosmosdbforpostgresql - 1.0.0-beta.2 + 1.1.0-beta.1 jar Microsoft Azure SDK for CosmosDBForPostgreSql Management diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/CosmosDBForPostgreSqlManager.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/CosmosDBForPostgreSqlManager.java index 607deb1ce525..fcd5c8e88101 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/CosmosDBForPostgreSqlManager.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/CosmosDBForPostgreSqlManager.java @@ -235,7 +235,7 @@ public CosmosDBForPostgreSqlManager authenticate(TokenCredential credential, Azu .append("-") .append("com.azure.resourcemanager.cosmosdbforpostgresql") .append("/") - .append("1.0.0-beta.1"); + .append("1.0.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -390,8 +390,10 @@ public PrivateLinkResources privateLinkResources() { } /** - * @return Wrapped service client CosmosDBForPostgreSql providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * Gets wrapped service client CosmosDBForPostgreSql providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client CosmosDBForPostgreSql. */ public CosmosDBForPostgreSql serviceClient() { return this.clientObject; diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterInner.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterInner.java index 2a03c4c805f0..798a7869f1cd 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterInner.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterInner.java @@ -209,7 +209,8 @@ public ClusterInner withPreferredPrimaryZone(String preferredPrimaryZone) { } /** - * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Get the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -218,7 +219,8 @@ public Boolean enableShardsOnCoordinator() { } /** - * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Set the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. * @return the ClusterInner object itself. diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterProperties.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterProperties.java index 6f24c9787152..22d77a68f0f4 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterProperties.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterProperties.java @@ -64,7 +64,8 @@ public final class ClusterProperties { private String preferredPrimaryZone; /* - * If shards on coordinator is enabled or not for the cluster. + * If distributed tables are placed on coordinator or not. Should be set to 'true' on single node clusters. + * Requires shard rebalancing after value is changed. */ @JsonProperty(value = "enableShardsOnCoordinator") private Boolean enableShardsOnCoordinator; @@ -309,7 +310,8 @@ public ClusterProperties withPreferredPrimaryZone(String preferredPrimaryZone) { } /** - * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Get the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -318,7 +320,8 @@ public Boolean enableShardsOnCoordinator() { } /** - * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Set the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. * @return the ClusterProperties object itself. diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterPropertiesForUpdate.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterPropertiesForUpdate.java index eaae41d743d2..82ee433f3368 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterPropertiesForUpdate.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterPropertiesForUpdate.java @@ -31,7 +31,8 @@ public final class ClusterPropertiesForUpdate { private String citusVersion; /* - * If shards on coordinator is enabled or not for the cluster. + * If distributed tables are placed on coordinator or not. Should be set to 'true' on single node clusters. + * Requires shard rebalancing after value is changed. */ @JsonProperty(value = "enableShardsOnCoordinator") private Boolean enableShardsOnCoordinator; @@ -177,7 +178,8 @@ public ClusterPropertiesForUpdate withCitusVersion(String citusVersion) { } /** - * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Get the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -186,7 +188,8 @@ public Boolean enableShardsOnCoordinator() { } /** - * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Set the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. * @return the ClusterPropertiesForUpdate object itself. diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/RoleProperties.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/RoleProperties.java index c1409ef3c368..e2fb46c24d88 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/RoleProperties.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/RoleProperties.java @@ -15,7 +15,7 @@ public final class RoleProperties { /* * The password of the cluster role. */ - @JsonProperty(value = "password", required = true) + @JsonProperty(value = "password") private String password; /* diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/implementation/CosmosDBForPostgreSqlBuilder.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/implementation/CosmosDBForPostgreSqlBuilder.java index ce102e0c51db..c9ccadc2ab01 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/implementation/CosmosDBForPostgreSqlBuilder.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/implementation/CosmosDBForPostgreSqlBuilder.java @@ -137,7 +137,7 @@ public CosmosDBForPostgreSqlImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Cluster.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Cluster.java index 8536be225f70..b2e31ff60e31 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Cluster.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Cluster.java @@ -113,7 +113,8 @@ public interface Cluster { String preferredPrimaryZone(); /** - * Gets the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Gets the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be + * set to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -280,11 +281,13 @@ interface Definition DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } + /** The Cluster definition stages. */ interface DefinitionStages { /** The first stage of the Cluster definition. */ interface Blank extends WithLocation { } + /** The stage of the Cluster definition allowing to specify location. */ interface WithLocation { /** @@ -303,6 +306,7 @@ interface WithLocation { */ WithResourceGroup withRegion(String location); } + /** The stage of the Cluster definition allowing to specify parent resource. */ interface WithResourceGroup { /** @@ -313,6 +317,7 @@ interface WithResourceGroup { */ WithCreate withExistingResourceGroup(String resourceGroupName); } + /** * The stage of the Cluster definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. @@ -353,6 +358,7 @@ interface WithCreate */ Cluster create(Context context); } + /** The stage of the Cluster definition allowing to specify tags. */ interface WithTags { /** @@ -363,6 +369,7 @@ interface WithTags { */ WithCreate withTags(Map tags); } + /** The stage of the Cluster definition allowing to specify administratorLoginPassword. */ interface WithAdministratorLoginPassword { /** @@ -374,6 +381,7 @@ interface WithAdministratorLoginPassword { */ WithCreate withAdministratorLoginPassword(String administratorLoginPassword); } + /** The stage of the Cluster definition allowing to specify postgresqlVersion. */ interface WithPostgresqlVersion { /** @@ -384,6 +392,7 @@ interface WithPostgresqlVersion { */ WithCreate withPostgresqlVersion(String postgresqlVersion); } + /** The stage of the Cluster definition allowing to specify citusVersion. */ interface WithCitusVersion { /** @@ -394,6 +403,7 @@ interface WithCitusVersion { */ WithCreate withCitusVersion(String citusVersion); } + /** The stage of the Cluster definition allowing to specify maintenanceWindow. */ interface WithMaintenanceWindow { /** @@ -404,6 +414,7 @@ interface WithMaintenanceWindow { */ WithCreate withMaintenanceWindow(MaintenanceWindow maintenanceWindow); } + /** The stage of the Cluster definition allowing to specify preferredPrimaryZone. */ interface WithPreferredPrimaryZone { /** @@ -415,17 +426,20 @@ interface WithPreferredPrimaryZone { */ WithCreate withPreferredPrimaryZone(String preferredPrimaryZone); } + /** The stage of the Cluster definition allowing to specify enableShardsOnCoordinator. */ interface WithEnableShardsOnCoordinator { /** - * Specifies the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the - * cluster.. + * Specifies the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. + * Should be set to 'true' on single node clusters. Requires shard rebalancing after value is changed.. * - * @param enableShardsOnCoordinator If shards on coordinator is enabled or not for the cluster. + * @param enableShardsOnCoordinator If distributed tables are placed on coordinator or not. Should be set to + * 'true' on single node clusters. Requires shard rebalancing after value is changed. * @return the next definition stage. */ WithCreate withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator); } + /** The stage of the Cluster definition allowing to specify enableHa. */ interface WithEnableHa { /** @@ -436,6 +450,7 @@ interface WithEnableHa { */ WithCreate withEnableHa(Boolean enableHa); } + /** The stage of the Cluster definition allowing to specify coordinatorServerEdition. */ interface WithCoordinatorServerEdition { /** @@ -448,6 +463,7 @@ interface WithCoordinatorServerEdition { */ WithCreate withCoordinatorServerEdition(String coordinatorServerEdition); } + /** The stage of the Cluster definition allowing to specify coordinatorStorageQuotaInMb. */ interface WithCoordinatorStorageQuotaInMb { /** @@ -460,6 +476,7 @@ interface WithCoordinatorStorageQuotaInMb { */ WithCreate withCoordinatorStorageQuotaInMb(Integer coordinatorStorageQuotaInMb); } + /** The stage of the Cluster definition allowing to specify coordinatorVCores. */ interface WithCoordinatorVCores { /** @@ -472,6 +489,7 @@ interface WithCoordinatorVCores { */ WithCreate withCoordinatorVCores(Integer coordinatorVCores); } + /** The stage of the Cluster definition allowing to specify coordinatorEnablePublicIpAccess. */ interface WithCoordinatorEnablePublicIpAccess { /** @@ -482,6 +500,7 @@ interface WithCoordinatorEnablePublicIpAccess { */ WithCreate withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess); } + /** The stage of the Cluster definition allowing to specify nodeServerEdition. */ interface WithNodeServerEdition { /** @@ -492,6 +511,7 @@ interface WithNodeServerEdition { */ WithCreate withNodeServerEdition(String nodeServerEdition); } + /** The stage of the Cluster definition allowing to specify nodeCount. */ interface WithNodeCount { /** @@ -506,6 +526,7 @@ interface WithNodeCount { */ WithCreate withNodeCount(Integer nodeCount); } + /** The stage of the Cluster definition allowing to specify nodeStorageQuotaInMb. */ interface WithNodeStorageQuotaInMb { /** @@ -518,6 +539,7 @@ interface WithNodeStorageQuotaInMb { */ WithCreate withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb); } + /** The stage of the Cluster definition allowing to specify nodeVCores. */ interface WithNodeVCores { /** @@ -530,6 +552,7 @@ interface WithNodeVCores { */ WithCreate withNodeVCores(Integer nodeVCores); } + /** The stage of the Cluster definition allowing to specify nodeEnablePublicIpAccess. */ interface WithNodeEnablePublicIpAccess { /** @@ -540,6 +563,7 @@ interface WithNodeEnablePublicIpAccess { */ WithCreate withNodeEnablePublicIpAccess(Boolean nodeEnablePublicIpAccess); } + /** The stage of the Cluster definition allowing to specify sourceResourceId. */ interface WithSourceResourceId { /** @@ -550,6 +574,7 @@ interface WithSourceResourceId { */ WithCreate withSourceResourceId(String sourceResourceId); } + /** The stage of the Cluster definition allowing to specify sourceLocation. */ interface WithSourceLocation { /** @@ -560,6 +585,7 @@ interface WithSourceLocation { */ WithCreate withSourceLocation(String sourceLocation); } + /** The stage of the Cluster definition allowing to specify pointInTimeUtc. */ interface WithPointInTimeUtc { /** @@ -571,6 +597,7 @@ interface WithPointInTimeUtc { WithCreate withPointInTimeUtc(OffsetDateTime pointInTimeUtc); } } + /** * Begins update for the Cluster resource. * @@ -611,6 +638,7 @@ interface Update */ Cluster apply(Context context); } + /** The Cluster update stages. */ interface UpdateStages { /** The stage of the Cluster update allowing to specify tags. */ @@ -623,6 +651,7 @@ interface WithTags { */ Update withTags(Map tags); } + /** The stage of the Cluster update allowing to specify administratorLoginPassword. */ interface WithAdministratorLoginPassword { /** @@ -635,6 +664,7 @@ interface WithAdministratorLoginPassword { */ Update withAdministratorLoginPassword(String administratorLoginPassword); } + /** The stage of the Cluster update allowing to specify postgresqlVersion. */ interface WithPostgresqlVersion { /** @@ -645,6 +675,7 @@ interface WithPostgresqlVersion { */ Update withPostgresqlVersion(String postgresqlVersion); } + /** The stage of the Cluster update allowing to specify citusVersion. */ interface WithCitusVersion { /** @@ -655,17 +686,20 @@ interface WithCitusVersion { */ Update withCitusVersion(String citusVersion); } + /** The stage of the Cluster update allowing to specify enableShardsOnCoordinator. */ interface WithEnableShardsOnCoordinator { /** - * Specifies the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the - * cluster.. + * Specifies the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. + * Should be set to 'true' on single node clusters. Requires shard rebalancing after value is changed.. * - * @param enableShardsOnCoordinator If shards on coordinator is enabled or not for the cluster. + * @param enableShardsOnCoordinator If distributed tables are placed on coordinator or not. Should be set to + * 'true' on single node clusters. Requires shard rebalancing after value is changed. * @return the next definition stage. */ Update withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator); } + /** The stage of the Cluster update allowing to specify enableHa. */ interface WithEnableHa { /** @@ -676,6 +710,7 @@ interface WithEnableHa { */ Update withEnableHa(Boolean enableHa); } + /** The stage of the Cluster update allowing to specify preferredPrimaryZone. */ interface WithPreferredPrimaryZone { /** @@ -687,6 +722,7 @@ interface WithPreferredPrimaryZone { */ Update withPreferredPrimaryZone(String preferredPrimaryZone); } + /** The stage of the Cluster update allowing to specify coordinatorServerEdition. */ interface WithCoordinatorServerEdition { /** @@ -698,6 +734,7 @@ interface WithCoordinatorServerEdition { */ Update withCoordinatorServerEdition(String coordinatorServerEdition); } + /** The stage of the Cluster update allowing to specify coordinatorStorageQuotaInMb. */ interface WithCoordinatorStorageQuotaInMb { /** @@ -708,6 +745,7 @@ interface WithCoordinatorStorageQuotaInMb { */ Update withCoordinatorStorageQuotaInMb(Integer coordinatorStorageQuotaInMb); } + /** The stage of the Cluster update allowing to specify coordinatorVCores. */ interface WithCoordinatorVCores { /** @@ -718,6 +756,7 @@ interface WithCoordinatorVCores { */ Update withCoordinatorVCores(Integer coordinatorVCores); } + /** The stage of the Cluster update allowing to specify coordinatorEnablePublicIpAccess. */ interface WithCoordinatorEnablePublicIpAccess { /** @@ -728,6 +767,7 @@ interface WithCoordinatorEnablePublicIpAccess { */ Update withCoordinatorEnablePublicIpAccess(Boolean coordinatorEnablePublicIpAccess); } + /** The stage of the Cluster update allowing to specify nodeServerEdition. */ interface WithNodeServerEdition { /** @@ -738,6 +778,7 @@ interface WithNodeServerEdition { */ Update withNodeServerEdition(String nodeServerEdition); } + /** The stage of the Cluster update allowing to specify nodeCount. */ interface WithNodeCount { /** @@ -752,6 +793,7 @@ interface WithNodeCount { */ Update withNodeCount(Integer nodeCount); } + /** The stage of the Cluster update allowing to specify nodeStorageQuotaInMb. */ interface WithNodeStorageQuotaInMb { /** @@ -762,6 +804,7 @@ interface WithNodeStorageQuotaInMb { */ Update withNodeStorageQuotaInMb(Integer nodeStorageQuotaInMb); } + /** The stage of the Cluster update allowing to specify nodeVCores. */ interface WithNodeVCores { /** @@ -772,6 +815,7 @@ interface WithNodeVCores { */ Update withNodeVCores(Integer nodeVCores); } + /** The stage of the Cluster update allowing to specify maintenanceWindow. */ interface WithMaintenanceWindow { /** @@ -783,6 +827,7 @@ interface WithMaintenanceWindow { Update withMaintenanceWindow(MaintenanceWindow maintenanceWindow); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/ClusterForUpdate.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/ClusterForUpdate.java index c4e36b7097dc..c2735b25a05e 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/ClusterForUpdate.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/ClusterForUpdate.java @@ -131,7 +131,8 @@ public ClusterForUpdate withCitusVersion(String citusVersion) { } /** - * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Get the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -140,7 +141,8 @@ public Boolean enableShardsOnCoordinator() { } /** - * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Set the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. * @return the ClusterForUpdate object itself. diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/FirewallRule.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/FirewallRule.java index 7f5786cb2cdf..067e56856672 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/FirewallRule.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/FirewallRule.java @@ -81,11 +81,13 @@ interface Definition DefinitionStages.WithEndIpAddress, DefinitionStages.WithCreate { } + /** The FirewallRule definition stages. */ interface DefinitionStages { /** The first stage of the FirewallRule definition. */ interface Blank extends WithParentResource { } + /** The stage of the FirewallRule definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -97,6 +99,7 @@ interface WithParentResource { */ WithStartIpAddress withExistingServerGroupsv2(String resourceGroupName, String clusterName); } + /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ interface WithStartIpAddress { /** @@ -108,6 +111,7 @@ interface WithStartIpAddress { */ WithEndIpAddress withStartIpAddress(String startIpAddress); } + /** The stage of the FirewallRule definition allowing to specify endIpAddress. */ interface WithEndIpAddress { /** @@ -119,6 +123,7 @@ interface WithEndIpAddress { */ WithCreate withEndIpAddress(String endIpAddress); } + /** * The stage of the FirewallRule definition which contains all the minimum required properties for the resource * to be created, but also allows for any other optional properties to be specified. @@ -140,6 +145,7 @@ interface WithCreate { FirewallRule create(Context context); } } + /** * Begins update for the FirewallRule resource. * @@ -164,6 +170,7 @@ interface Update extends UpdateStages.WithStartIpAddress, UpdateStages.WithEndIp */ FirewallRule apply(Context context); } + /** The FirewallRule update stages. */ interface UpdateStages { /** The stage of the FirewallRule update allowing to specify startIpAddress. */ @@ -177,6 +184,7 @@ interface WithStartIpAddress { */ Update withStartIpAddress(String startIpAddress); } + /** The stage of the FirewallRule update allowing to specify endIpAddress. */ interface WithEndIpAddress { /** @@ -189,6 +197,7 @@ interface WithEndIpAddress { Update withEndIpAddress(String endIpAddress); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/PrivateEndpointConnection.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/PrivateEndpointConnection.java index 007301f8aef9..5d0353c5bedf 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/PrivateEndpointConnection.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/PrivateEndpointConnection.java @@ -87,11 +87,13 @@ public interface PrivateEndpointConnection { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The PrivateEndpointConnection definition stages. */ interface DefinitionStages { /** The first stage of the PrivateEndpointConnection definition. */ interface Blank extends WithParentResource { } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -103,6 +105,7 @@ interface WithParentResource { */ WithCreate withExistingServerGroupsv2(String resourceGroupName, String clusterName); } + /** * The stage of the PrivateEndpointConnection definition which contains all the minimum required properties for * the resource to be created, but also allows for any other optional properties to be specified. @@ -124,6 +127,7 @@ interface WithCreate */ PrivateEndpointConnection create(Context context); } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ interface WithPrivateEndpoint { /** @@ -134,6 +138,7 @@ interface WithPrivateEndpoint { */ WithCreate withPrivateEndpoint(PrivateEndpoint privateEndpoint); } + /** * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. */ @@ -150,6 +155,7 @@ WithCreate withPrivateLinkServiceConnectionState( PrivateLinkServiceConnectionState privateLinkServiceConnectionState); } } + /** * Begins update for the PrivateEndpointConnection resource. * @@ -174,6 +180,7 @@ interface Update extends UpdateStages.WithPrivateEndpoint, UpdateStages.WithPriv */ PrivateEndpointConnection apply(Context context); } + /** The PrivateEndpointConnection update stages. */ interface UpdateStages { /** The stage of the PrivateEndpointConnection update allowing to specify privateEndpoint. */ @@ -186,6 +193,7 @@ interface WithPrivateEndpoint { */ Update withPrivateEndpoint(PrivateEndpoint privateEndpoint); } + /** The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. */ interface WithPrivateLinkServiceConnectionState { /** @@ -200,6 +208,7 @@ Update withPrivateLinkServiceConnectionState( PrivateLinkServiceConnectionState privateLinkServiceConnectionState); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Role.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Role.java index f6b93bfebc79..4e5ad1747f0a 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Role.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Role.java @@ -66,11 +66,13 @@ interface Definition DefinitionStages.WithPassword, DefinitionStages.WithCreate { } + /** The Role definition stages. */ interface DefinitionStages { /** The first stage of the Role definition. */ interface Blank extends WithParentResource { } + /** The stage of the Role definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -82,6 +84,7 @@ interface WithParentResource { */ WithPassword withExistingServerGroupsv2(String resourceGroupName, String clusterName); } + /** The stage of the Role definition allowing to specify password. */ interface WithPassword { /** @@ -92,6 +95,7 @@ interface WithPassword { */ WithCreate withPassword(String password); } + /** * The stage of the Role definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. @@ -113,6 +117,7 @@ interface WithCreate { Role create(Context context); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/samples/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCreateSamples.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/samples/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCreateSamples.java index e9e2118b4110..fb6d0c1ac0a4 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/samples/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCreateSamples.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/samples/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCreateSamples.java @@ -11,61 +11,108 @@ /** Samples for Clusters Create. */ public final class ClustersCreateSamples { /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateSingleNode.json */ /** - * Sample code: Create a new cluster as a read replica. + * Sample code: Create a new single node cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewClusterAsAReadReplica( + public static void createANewSingleNodeCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-singlenode") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withSourceResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") - .withSourceLocation("westus") + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(true) + .withCoordinatorServerEdition("GeneralPurpose") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(8) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) .create(); } /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev1.json */ /** - * Sample code: Create a new cluster as a point in time restore. + * Sample code: Create a new single node Burstable 1 vCore cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewClusterAsAPointInTimeRestore( + public static void createANewSingleNodeBurstable1VCoreCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-burstablev1") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withSourceResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") - .withSourceLocation("westus") - .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(false) + .withCoordinatorServerEdition("BurstableMemoryOptimized") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(1) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) .create(); } /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreate.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev2.json */ /** - * Sample code: Create a new cluster. + * Sample code: Create a new single node Burstable 2 vCores cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewCluster( + public static void createANewSingleNodeBurstable2VCoresCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-burstablev2") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(false) + .withCoordinatorServerEdition("BurstableGeneralPurpose") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(2) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateMultiNode.json + */ + /** + * Sample code: Create a new multi-node cluster. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewMultiNodeCluster( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster-multinode") .withRegion("westus") .withExistingResourceGroup("TestGroup") .withTags(mapOf()) @@ -87,6 +134,50 @@ public static void createANewCluster( .create(); } + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + */ + /** + * Sample code: Create a new cluster as a read replica. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewClusterAsAReadReplica( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") + .withSourceLocation("westus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + */ + /** + * Sample code: Create a new cluster as a point in time restore. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewClusterAsAPointInTimeRestore( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") + .withSourceLocation("westus") + .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .create(); + } + + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterConfigurationListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterConfigurationListResultTests.java index f2ee19f9bb74..a455268a181b 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterConfigurationListResultTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterConfigurationListResultTests.java @@ -7,6 +7,8 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ConfigurationInner; import com.azure.resourcemanager.cosmosdbforpostgresql.models.ClusterConfigurationListResult; +import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; +import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRoleGroupConfiguration; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -16,9 +18,12 @@ public void testDeserialize() throws Exception { ClusterConfigurationListResult model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"description\":\"tnwu\",\"dataType\":\"Numeric\",\"allowedValues\":\"zxufiz\",\"requiresRestart\":false,\"serverRoleGroupConfigurations\":[],\"provisioningState\":\"Canceled\"},\"id\":\"hr\",\"name\":\"idf\",\"type\":\"zwdzuh\"}],\"nextLink\":\"mwisdkfthwxmnt\"}") + "{\"value\":[{\"properties\":{\"description\":\"tnwu\",\"dataType\":\"Numeric\",\"allowedValues\":\"zxufiz\",\"requiresRestart\":false,\"serverRoleGroupConfigurations\":[{\"role\":\"Coordinator\",\"value\":\"i\",\"defaultValue\":\"fidfvzw\",\"source\":\"uht\"}],\"provisioningState\":\"Canceled\"},\"id\":\"sdkf\",\"name\":\"hwxmnteiwa\",\"type\":\"pvkmijcmmxdcuf\"}],\"nextLink\":\"srp\"}") .toObject(ClusterConfigurationListResult.class); Assertions.assertEquals(false, model.value().get(0).requiresRestart()); + Assertions + .assertEquals(ServerRole.COORDINATOR, model.value().get(0).serverRoleGroupConfigurations().get(0).role()); + Assertions.assertEquals("i", model.value().get(0).serverRoleGroupConfigurations().get(0).value()); } @org.junit.jupiter.api.Test @@ -30,8 +35,16 @@ public void testSerialize() throws Exception { .asList( new ConfigurationInner() .withRequiresRestart(false) - .withServerRoleGroupConfigurations(Arrays.asList()))); + .withServerRoleGroupConfigurations( + Arrays + .asList( + new ServerRoleGroupConfiguration() + .withRole(ServerRole.COORDINATOR) + .withValue("i"))))); model = BinaryData.fromObject(model).toObject(ClusterConfigurationListResult.class); Assertions.assertEquals(false, model.value().get(0).requiresRestart()); + Assertions + .assertEquals(ServerRole.COORDINATOR, model.value().get(0).serverRoleGroupConfigurations().get(0).role()); + Assertions.assertEquals("i", model.value().get(0).serverRoleGroupConfigurations().get(0).value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCheckNameAvailabilityWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCheckNameAvailabilityWithResponseMockTests.java index 83102b9782b0..b4fe74131b6b 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCheckNameAvailabilityWithResponseMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCheckNameAvailabilityWithResponseMockTests.java @@ -32,7 +32,7 @@ public void testCheckNameAvailabilityWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"message\":\"bxzpuzycisp\",\"nameAvailable\":true,\"name\":\"hmgkbrpyy\",\"type\":\"ibnuqqkpik\"}"; + "{\"message\":\"notyfjfcnjbkcn\",\"nameAvailable\":true,\"name\":\"ttkphywpnvjtoqne\",\"type\":\"clfp\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -64,12 +64,12 @@ public void testCheckNameAvailabilityWithResponse() throws Exception { manager .clusters() .checkNameAvailabilityWithResponse( - new NameAvailabilityRequest().withName("flz"), com.azure.core.util.Context.NONE) + new NameAvailabilityRequest().withName("eil"), com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("bxzpuzycisp", response.message()); + Assertions.assertEquals("notyfjfcnjbkcn", response.message()); Assertions.assertEquals(true, response.nameAvailable()); - Assertions.assertEquals("hmgkbrpyy", response.name()); - Assertions.assertEquals("ibnuqqkpik", response.type()); + Assertions.assertEquals("ttkphywpnvjtoqne", response.name()); + Assertions.assertEquals("clfp", response.type()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersDeleteMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersDeleteMockTests.java index 3ccc9c216e90..128997b17809 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersDeleteMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersDeleteMockTests.java @@ -56,6 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.clusters().delete("uujqgidokgjljyo", "gvcl", com.azure.core.util.Context.NONE); + manager.clusters().delete("fhvpesaps", "rdqmhjjdhtldwkyz", com.azure.core.util.Context.NONE); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStartMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStartMockTests.java index b0a197c7de24..1c17aab32826 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStartMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStartMockTests.java @@ -56,6 +56,6 @@ public void testStart() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.clusters().start("bgsncghkjeszzhb", "jhtxfvgxbfsmxne", com.azure.core.util.Context.NONE); + manager.clusters().start("uutkncw", "cwsvlxotog", com.azure.core.util.Context.NONE); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStopMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStopMockTests.java index 4bfe1e36ed9c..9b2b9a1f4be9 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStopMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStopMockTests.java @@ -56,6 +56,6 @@ public void testStop() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.clusters().stop("mpvecxgodebfqk", "rbmpukgri", com.azure.core.util.Context.NONE); + manager.clusters().stop("wrupqsxvnmicykvc", "o", com.azure.core.util.Context.NONE); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationInnerTests.java index c109b211766c..904ff4e66452 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationInnerTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationInnerTests.java @@ -17,11 +17,11 @@ public void testDeserialize() throws Exception { ConfigurationInner model = BinaryData .fromString( - "{\"properties\":{\"description\":\"aop\",\"dataType\":\"Enumeration\",\"allowedValues\":\"jcmmxdcufufsrp\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[{\"role\":\"Worker\",\"value\":\"nsez\",\"defaultValue\":\"tbzsgfyccs\",\"source\":\"wmdwzjeiachboo\"},{\"role\":\"Worker\",\"value\":\"lnrosfqp\",\"defaultValue\":\"ehzzvypyqrim\",\"source\":\"npvswjdkirso\"},{\"role\":\"Worker\",\"value\":\"qxhcrmn\",\"defaultValue\":\"jtckwhdso\",\"source\":\"iy\"}],\"provisioningState\":\"InProgress\"},\"id\":\"sqwpgrjb\",\"name\":\"norcjxvsnbyxqab\",\"type\":\"mocpc\"}") + "{\"properties\":{\"description\":\"idnsezcxtb\",\"dataType\":\"Numeric\",\"allowedValues\":\"yc\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[{\"role\":\"Worker\",\"value\":\"mdwzjeiachboo\",\"defaultValue\":\"lnrosfqp\",\"source\":\"ehzzvypyqrim\"},{\"role\":\"Worker\",\"value\":\"npvswjdkirso\",\"defaultValue\":\"qxhcrmn\",\"source\":\"jtckwhdso\"}],\"provisioningState\":\"Succeeded\"},\"id\":\"i\",\"name\":\"jxsqwpgrjbz\",\"type\":\"orcjxvsnby\"}") .toObject(ConfigurationInner.class); Assertions.assertEquals(true, model.requiresRestart()); Assertions.assertEquals(ServerRole.WORKER, model.serverRoleGroupConfigurations().get(0).role()); - Assertions.assertEquals("nsez", model.serverRoleGroupConfigurations().get(0).value()); + Assertions.assertEquals("mdwzjeiachboo", model.serverRoleGroupConfigurations().get(0).value()); } @org.junit.jupiter.api.Test @@ -32,12 +32,11 @@ public void testSerialize() throws Exception { .withServerRoleGroupConfigurations( Arrays .asList( - new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("nsez"), - new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("lnrosfqp"), - new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("qxhcrmn"))); + new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("mdwzjeiachboo"), + new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("npvswjdkirso"))); model = BinaryData.fromObject(model).toObject(ConfigurationInner.class); Assertions.assertEquals(true, model.requiresRestart()); Assertions.assertEquals(ServerRole.WORKER, model.serverRoleGroupConfigurations().get(0).role()); - Assertions.assertEquals("nsez", model.serverRoleGroupConfigurations().get(0).value()); + Assertions.assertEquals("mdwzjeiachboo", model.serverRoleGroupConfigurations().get(0).value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationPropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationPropertiesTests.java index b511385a229a..124f0efbb68c 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationPropertiesTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationPropertiesTests.java @@ -17,11 +17,11 @@ public void testDeserialize() throws Exception { ConfigurationProperties model = BinaryData .fromString( - "{\"description\":\"hurzafblj\",\"dataType\":\"Integer\",\"allowedValues\":\"toqcjmklja\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[{\"role\":\"Worker\",\"value\":\"tqajzyulpkudjkrl\",\"defaultValue\":\"bzhfepgzgqexz\",\"source\":\"c\"},{\"role\":\"Coordinator\",\"value\":\"c\",\"defaultValue\":\"ierhhbcsglummaj\",\"source\":\"aodxo\"},{\"role\":\"Coordinator\",\"value\":\"bdxkqpxokaj\",\"defaultValue\":\"npime\",\"source\":\"stxgc\"}],\"provisioningState\":\"Succeeded\"}") + "{\"description\":\"abnmocpcyshu\",\"dataType\":\"Enumeration\",\"allowedValues\":\"bl\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[{\"role\":\"Worker\",\"value\":\"toqcjmklja\",\"defaultValue\":\"qidtqajzyu\",\"source\":\"kudjkrlkhb\"},{\"role\":\"Worker\",\"value\":\"fepgzgq\",\"defaultValue\":\"zloc\",\"source\":\"c\"},{\"role\":\"Coordinator\",\"value\":\"ierhhbcsglummaj\",\"defaultValue\":\"aodxo\",\"source\":\"bdxkqpxokaj\"}],\"provisioningState\":\"Canceled\"}") .toObject(ConfigurationProperties.class); Assertions.assertEquals(true, model.requiresRestart()); Assertions.assertEquals(ServerRole.WORKER, model.serverRoleGroupConfigurations().get(0).role()); - Assertions.assertEquals("tqajzyulpkudjkrl", model.serverRoleGroupConfigurations().get(0).value()); + Assertions.assertEquals("toqcjmklja", model.serverRoleGroupConfigurations().get(0).value()); } @org.junit.jupiter.api.Test @@ -32,16 +32,14 @@ public void testSerialize() throws Exception { .withServerRoleGroupConfigurations( Arrays .asList( - new ServerRoleGroupConfiguration() - .withRole(ServerRole.WORKER) - .withValue("tqajzyulpkudjkrl"), - new ServerRoleGroupConfiguration().withRole(ServerRole.COORDINATOR).withValue("c"), + new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("toqcjmklja"), + new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("fepgzgq"), new ServerRoleGroupConfiguration() .withRole(ServerRole.COORDINATOR) - .withValue("bdxkqpxokaj"))); + .withValue("ierhhbcsglummaj"))); model = BinaryData.fromObject(model).toObject(ConfigurationProperties.class); Assertions.assertEquals(true, model.requiresRestart()); Assertions.assertEquals(ServerRole.WORKER, model.serverRoleGroupConfigurations().get(0).role()); - Assertions.assertEquals("tqajzyulpkudjkrl", model.serverRoleGroupConfigurations().get(0).value()); + Assertions.assertEquals("toqcjmklja", model.serverRoleGroupConfigurations().get(0).value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetCoordinatorWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetCoordinatorWithResponseMockTests.java index 5d93eda2f75c..1b4e21838624 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetCoordinatorWithResponseMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetCoordinatorWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetCoordinatorWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"value\":\"rqhakauha\",\"source\":\"sfwxosowzxc\",\"description\":\"i\",\"defaultValue\":\"ooxdjebwpuc\",\"dataType\":\"Enumeration\",\"allowedValues\":\"ovbvmeueciv\",\"requiresRestart\":true,\"provisioningState\":\"InProgress\"},\"id\":\"ojgjrwjueiotwmc\",\"name\":\"ytdxwit\",\"type\":\"nrjawgqwg\"}"; + "{\"properties\":{\"value\":\"vpgylgqgitxmed\",\"source\":\"c\",\"description\":\"ynqwwncwzzhxgk\",\"defaultValue\":\"mgucna\",\"dataType\":\"Boolean\",\"allowedValues\":\"oellwp\",\"requiresRestart\":false,\"provisioningState\":\"InProgress\"},\"id\":\"fqbuaceopzf\",\"name\":\"rhhuaopppcqeqx\",\"type\":\"lzdahzxctobgbkdm\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,9 +62,10 @@ public void testGetCoordinatorWithResponse() throws Exception { ServerConfiguration response = manager .configurations() - .getCoordinatorWithResponse("b", "e", "dawkzbali", com.azure.core.util.Context.NONE) + .getCoordinatorWithResponse( + "tfolhbnx", "nalaulppg", "dtpnapnyiropuhp", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("rqhakauha", response.value()); + Assertions.assertEquals("vpgylgqgitxmed", response.value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetNodeWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetNodeWithResponseMockTests.java index 419ae33f5098..dbf8a169b5d3 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetNodeWithResponseMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetNodeWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetNodeWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"value\":\"hpvgqz\",\"source\":\"rvxdjzlmw\",\"description\":\"kvugfhzovawjvzun\",\"defaultValue\":\"thnnpr\",\"dataType\":\"Boolean\",\"allowedValues\":\"eilpjzuaejxdu\",\"requiresRestart\":false,\"provisioningState\":\"InProgress\"},\"id\":\"btdzumveekg\",\"name\":\"wozuhkf\",\"type\":\"bsjyofdx\"}"; + "{\"properties\":{\"value\":\"oygmift\",\"source\":\"zdnds\",\"description\":\"nayqi\",\"defaultValue\":\"nduhavhqlkthum\",\"dataType\":\"Enumeration\",\"allowedValues\":\"bgycduiertgccym\",\"requiresRestart\":true,\"provisioningState\":\"InProgress\"},\"id\":\"slqlfmmdn\",\"name\":\"bglzpswi\",\"type\":\"d\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,9 +62,10 @@ public void testGetNodeWithResponse() throws Exception { ServerConfiguration response = manager .configurations() - .getNodeWithResponse("ibycno", "v", "nmefqsgzvahapj", com.azure.core.util.Context.NONE) + .getNodeWithResponse( + "taruoujmkcj", "wqytjrybnwjewgdr", "ervnaenqpehi", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("hpvgqz", response.value()); + Assertions.assertEquals("oygmift", response.value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetWithResponseMockTests.java index d3f79ae9842b..63d1ad6ecc93 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetWithResponseMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetWithResponseMockTests.java @@ -13,6 +13,7 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; import com.azure.resourcemanager.cosmosdbforpostgresql.models.Configuration; +import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -31,7 +32,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"description\":\"c\",\"dataType\":\"Boolean\",\"allowedValues\":\"ualaexqpvfadmw\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[],\"provisioningState\":\"Canceled\"},\"id\":\"pv\",\"name\":\"omzlfmi\",\"type\":\"gwb\"}"; + "{\"properties\":{\"description\":\"i\",\"dataType\":\"Enumeration\",\"allowedValues\":\"pjzu\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[{\"role\":\"Coordinator\",\"value\":\"ultskzbbtdz\",\"defaultValue\":\"veekgpwozuhkfp\",\"source\":\"jyofdxluusdtto\"},{\"role\":\"Coordinator\",\"value\":\"aboekqv\",\"defaultValue\":\"lns\",\"source\":\"bxwyjsflhhcaa\"}],\"provisioningState\":\"Failed\"},\"id\":\"xisxyawjoyaqcsl\",\"name\":\"jpkiidzyexznelix\",\"type\":\"nr\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,9 +63,11 @@ public void testGetWithResponse() throws Exception { Configuration response = manager .configurations() - .getWithResponse("tslhspkdeem", "ofmxagkvtmelmqkr", "ahvljuaha", com.azure.core.util.Context.NONE) + .getWithResponse("qzcjrvxdj", "lmwlxkvugfhzo", "awjvzunluthnnp", com.azure.core.util.Context.NONE) .getValue(); Assertions.assertEquals(true, response.requiresRestart()); + Assertions.assertEquals(ServerRole.COORDINATOR, response.serverRoleGroupConfigurations().get(0).role()); + Assertions.assertEquals("ultskzbbtdz", response.serverRoleGroupConfigurations().get(0).value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByClusterMockTests.java index 9c85bba3a21f..9be3954dcac8 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByClusterMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByClusterMockTests.java @@ -14,6 +14,7 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; import com.azure.resourcemanager.cosmosdbforpostgresql.models.Configuration; +import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -32,7 +33,7 @@ public void testListByCluster() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"description\":\"bh\",\"dataType\":\"Boolean\",\"allowedValues\":\"lhrxsbkyvpyc\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[],\"provisioningState\":\"Succeeded\"},\"id\":\"kafkuwbcrnwbm\",\"name\":\"hhseyv\",\"type\":\"us\"}]}"; + "{\"value\":[{\"properties\":{\"description\":\"btn\",\"dataType\":\"Enumeration\",\"allowedValues\":\"bwwaloa\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[{\"role\":\"Coordinator\",\"value\":\"rtzju\",\"defaultValue\":\"wyzmhtxon\",\"source\":\"ts\"},{\"role\":\"Worker\",\"value\":\"jcbpwxqpsrknft\",\"defaultValue\":\"vriuhprwmdyvx\",\"source\":\"ayriwwroyqbexrm\"}],\"provisioningState\":\"Canceled\"},\"id\":\"ycnojvknmefqsg\",\"name\":\"vah\",\"type\":\"pjyzhpv\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,8 +62,12 @@ public void testListByCluster() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.configurations().listByCluster("udxytlmoyrx", "wfudwpzntxhdzhl", com.azure.core.util.Context.NONE); + manager.configurations().listByCluster("c", "wxzvlvqhjkb", com.azure.core.util.Context.NONE); Assertions.assertEquals(true, response.iterator().next().requiresRestart()); + Assertions + .assertEquals( + ServerRole.COORDINATOR, response.iterator().next().serverRoleGroupConfigurations().get(0).role()); + Assertions.assertEquals("rtzju", response.iterator().next().serverRoleGroupConfigurations().get(0).value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByServerMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByServerMockTests.java index c7e52e169a6e..a110a2f75e79 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByServerMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByServerMockTests.java @@ -32,7 +32,7 @@ public void testListByServer() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"value\":\"notyfjfcnjbkcn\",\"source\":\"hbttkphyw\",\"description\":\"vjtoqnermclfp\",\"defaultValue\":\"hoxus\",\"dataType\":\"Numeric\",\"allowedValues\":\"bgyepsbj\",\"requiresRestart\":false,\"provisioningState\":\"InProgress\"},\"id\":\"xywpmueefjzwfqkq\",\"name\":\"jidsuyonobglaoc\",\"type\":\"xtccmg\"}]}"; + "{\"value\":[{\"properties\":{\"value\":\"rjaw\",\"source\":\"wgxhn\",\"description\":\"kxfbkpycgklwndn\",\"defaultValue\":\"dauwhvylwzbtd\",\"dataType\":\"Numeric\",\"allowedValues\":\"znbmpowuwprzq\",\"requiresRestart\":true,\"provisioningState\":\"Canceled\"},\"id\":\"upjm\",\"name\":\"hfxobbcswsrtj\",\"type\":\"iplrbpbewtghfgb\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,8 +61,8 @@ public void testListByServer() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.configurations().listByServer("wrupqsxvnmicykvc", "o", "eil", com.azure.core.util.Context.NONE); + manager.configurations().listByServer("ueiotwmcdyt", "x", "it", com.azure.core.util.Context.NONE); - Assertions.assertEquals("notyfjfcnjbkcn", response.iterator().next().value()); + Assertions.assertEquals("rjaw", response.iterator().next().value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnCoordinatorMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnCoordinatorMockTests.java index 111a075548d0..1797b3a37dc3 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnCoordinatorMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnCoordinatorMockTests.java @@ -32,7 +32,7 @@ public void testUpdateOnCoordinator() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"value\":\"loayqcgw\",\"source\":\"zjuzgwyz\",\"description\":\"txon\",\"defaultValue\":\"ts\",\"dataType\":\"Enumeration\",\"allowedValues\":\"bp\",\"requiresRestart\":true,\"provisioningState\":\"Succeeded\"},\"id\":\"knftguvriuh\",\"name\":\"rwmdyvxqtay\",\"type\":\"iwwroyqbexrmc\"}"; + "{\"properties\":{\"value\":\"wfbkrvrns\",\"source\":\"hqjohxcrsbfova\",\"description\":\"ruvw\",\"defaultValue\":\"sqfsubcgjbirxb\",\"dataType\":\"Numeric\",\"allowedValues\":\"rfbjf\",\"requiresRestart\":false,\"provisioningState\":\"Succeeded\"},\"id\":\"t\",\"name\":\"tpvjzbexilzznfqq\",\"type\":\"vwpm\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -64,12 +64,12 @@ public void testUpdateOnCoordinator() throws Exception { manager .configurations() .updateOnCoordinator( - "hniskxfbkpyc", - "klwndnhjdauwhv", - "l", - new ServerConfigurationInner().withValue("btdhxujznbm"), + "izpost", + "grcfb", + "nrmfqjhhk", + new ServerConfigurationInner().withValue("pvjymjhxxjyng"), com.azure.core.util.Context.NONE); - Assertions.assertEquals("loayqcgw", response.value()); + Assertions.assertEquals("wfbkrvrns", response.value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnNodeMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnNodeMockTests.java index 215852209600..ce781856b390 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnNodeMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnNodeMockTests.java @@ -32,7 +32,7 @@ public void testUpdateOnNode() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"value\":\"qwwncw\",\"source\":\"hxg\",\"description\":\"rmgucnap\",\"defaultValue\":\"eoellwptfdygp\",\"dataType\":\"Boolean\",\"allowedValues\":\"ac\",\"requiresRestart\":true,\"provisioningState\":\"Succeeded\"},\"id\":\"rhhuaopppcqeqx\",\"name\":\"lzdahzxctobgbkdm\",\"type\":\"izpost\"}"; + "{\"properties\":{\"value\":\"mwmbes\",\"source\":\"nkww\",\"description\":\"pjflcxogao\",\"defaultValue\":\"nzmnsikvm\",\"dataType\":\"Boolean\",\"allowedValues\":\"qqkdltfzxmhhvhgu\",\"requiresRestart\":false,\"provisioningState\":\"Succeeded\"},\"id\":\"obdagxtibqdxb\",\"name\":\"wakbogqxndl\",\"type\":\"zgx\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -64,12 +64,12 @@ public void testUpdateOnNode() throws Exception { manager .configurations() .updateOnNode( - "uusdttouwa", - "oekqvk", - "lns", - new ServerConfigurationInner().withValue("bxwyjsflhhcaa"), + "cwyhzdxssa", + "bzmnvdfznud", + "od", + new ServerConfigurationInner().withValue("zbn"), com.azure.core.util.Context.NONE); - Assertions.assertEquals("qwwncw", response.value()); + Assertions.assertEquals("mwmbes", response.value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleInnerTests.java index 0262339ca3e9..ab645ea60d9d 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleInnerTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleInnerTests.java @@ -14,18 +14,18 @@ public void testDeserialize() throws Exception { FirewallRuleInner model = BinaryData .fromString( - "{\"properties\":{\"startIpAddress\":\"sycbkbfk\",\"endIpAddress\":\"ukdkexxppofmxa\",\"provisioningState\":\"Failed\"},\"id\":\"pg\",\"name\":\"dtocj\",\"type\":\"xhvpmoue\"}") + "{\"properties\":{\"startIpAddress\":\"clwhijcoejctbz\",\"endIpAddress\":\"qsqsy\",\"provisioningState\":\"Canceled\"},\"id\":\"fkgukdkexxppof\",\"name\":\"xaxcfjpgddtocjjx\",\"type\":\"vpmouexhdzxib\"}") .toObject(FirewallRuleInner.class); - Assertions.assertEquals("sycbkbfk", model.startIpAddress()); - Assertions.assertEquals("ukdkexxppofmxa", model.endIpAddress()); + Assertions.assertEquals("clwhijcoejctbz", model.startIpAddress()); + Assertions.assertEquals("qsqsy", model.endIpAddress()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { FirewallRuleInner model = - new FirewallRuleInner().withStartIpAddress("sycbkbfk").withEndIpAddress("ukdkexxppofmxa"); + new FirewallRuleInner().withStartIpAddress("clwhijcoejctbz").withEndIpAddress("qsqsy"); model = BinaryData.fromObject(model).toObject(FirewallRuleInner.class); - Assertions.assertEquals("sycbkbfk", model.startIpAddress()); - Assertions.assertEquals("ukdkexxppofmxa", model.endIpAddress()); + Assertions.assertEquals("clwhijcoejctbz", model.startIpAddress()); + Assertions.assertEquals("qsqsy", model.endIpAddress()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleListResultTests.java index 933a5fe1d842..9eff2bb72b08 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleListResultTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleListResultTests.java @@ -16,10 +16,10 @@ public void testDeserialize() throws Exception { FirewallRuleListResult model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"startIpAddress\":\"dntwndeicbtw\",\"endIpAddress\":\"pzaoqvuhr\",\"provisioningState\":\"Succeeded\"},\"id\":\"cyddglmjthjqk\",\"name\":\"pyeicxm\",\"type\":\"ciwqvhk\"},{\"properties\":{\"startIpAddress\":\"ixuigdtopbobj\",\"endIpAddress\":\"ghmewuam\",\"provisioningState\":\"Failed\"},\"id\":\"z\",\"name\":\"yvvtpgvdfgio\",\"type\":\"kftutqxlngxlefg\"},{\"properties\":{\"startIpAddress\":\"gnxkrxdqmidtth\",\"endIpAddress\":\"rvqdra\",\"provisioningState\":\"Canceled\"},\"id\":\"big\",\"name\":\"h\",\"type\":\"qfbow\"}]}") + "{\"value\":[{\"properties\":{\"startIpAddress\":\"uhrhcffcyddgl\",\"endIpAddress\":\"jthjqkwpyei\",\"provisioningState\":\"Succeeded\"},\"id\":\"ciwqvhk\",\"name\":\"ixuigdtopbobj\",\"type\":\"ghmewuam\"},{\"properties\":{\"startIpAddress\":\"uhrzayvvt\",\"endIpAddress\":\"gvdfgiotkftutq\",\"provisioningState\":\"Failed\"},\"id\":\"xlefgugnxkrx\",\"name\":\"qmi\",\"type\":\"tthzrvqd\"},{\"properties\":{\"startIpAddress\":\"abhjybi\",\"endIpAddress\":\"ehoqfbowskan\",\"provisioningState\":\"Failed\"},\"id\":\"lcuiywgqywgndr\",\"name\":\"ynhz\",\"type\":\"pphrcgynco\"},{\"properties\":{\"startIpAddress\":\"pec\",\"endIpAddress\":\"vmmcoofs\",\"provisioningState\":\"Canceled\"},\"id\":\"v\",\"name\":\"bmqj\",\"type\":\"abcypmivk\"}]}") .toObject(FirewallRuleListResult.class); - Assertions.assertEquals("dntwndeicbtw", model.value().get(0).startIpAddress()); - Assertions.assertEquals("pzaoqvuhr", model.value().get(0).endIpAddress()); + Assertions.assertEquals("uhrhcffcyddgl", model.value().get(0).startIpAddress()); + Assertions.assertEquals("jthjqkwpyei", model.value().get(0).endIpAddress()); } @org.junit.jupiter.api.Test @@ -29,11 +29,12 @@ public void testSerialize() throws Exception { .withValue( Arrays .asList( - new FirewallRuleInner().withStartIpAddress("dntwndeicbtw").withEndIpAddress("pzaoqvuhr"), - new FirewallRuleInner().withStartIpAddress("ixuigdtopbobj").withEndIpAddress("ghmewuam"), - new FirewallRuleInner().withStartIpAddress("gnxkrxdqmidtth").withEndIpAddress("rvqdra"))); + new FirewallRuleInner().withStartIpAddress("uhrhcffcyddgl").withEndIpAddress("jthjqkwpyei"), + new FirewallRuleInner().withStartIpAddress("uhrzayvvt").withEndIpAddress("gvdfgiotkftutq"), + new FirewallRuleInner().withStartIpAddress("abhjybi").withEndIpAddress("ehoqfbowskan"), + new FirewallRuleInner().withStartIpAddress("pec").withEndIpAddress("vmmcoofs"))); model = BinaryData.fromObject(model).toObject(FirewallRuleListResult.class); - Assertions.assertEquals("dntwndeicbtw", model.value().get(0).startIpAddress()); - Assertions.assertEquals("pzaoqvuhr", model.value().get(0).endIpAddress()); + Assertions.assertEquals("uhrhcffcyddgl", model.value().get(0).startIpAddress()); + Assertions.assertEquals("jthjqkwpyei", model.value().get(0).endIpAddress()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulePropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulePropertiesTests.java index 2f87e696ab71..3e3ccec370f0 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulePropertiesTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulePropertiesTests.java @@ -14,18 +14,18 @@ public void testDeserialize() throws Exception { FirewallRuleProperties model = BinaryData .fromString( - "{\"startIpAddress\":\"hd\",\"endIpAddress\":\"xibqeojnx\",\"provisioningState\":\"Failed\"}") + "{\"startIpAddress\":\"eojnxqbzvddn\",\"endIpAddress\":\"wndeicbtwnp\",\"provisioningState\":\"Canceled\"}") .toObject(FirewallRuleProperties.class); - Assertions.assertEquals("hd", model.startIpAddress()); - Assertions.assertEquals("xibqeojnx", model.endIpAddress()); + Assertions.assertEquals("eojnxqbzvddn", model.startIpAddress()); + Assertions.assertEquals("wndeicbtwnp", model.endIpAddress()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { FirewallRuleProperties model = - new FirewallRuleProperties().withStartIpAddress("hd").withEndIpAddress("xibqeojnx"); + new FirewallRuleProperties().withStartIpAddress("eojnxqbzvddn").withEndIpAddress("wndeicbtwnp"); model = BinaryData.fromObject(model).toObject(FirewallRuleProperties.class); - Assertions.assertEquals("hd", model.startIpAddress()); - Assertions.assertEquals("xibqeojnx", model.endIpAddress()); + Assertions.assertEquals("eojnxqbzvddn", model.startIpAddress()); + Assertions.assertEquals("wndeicbtwnp", model.endIpAddress()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesCreateOrUpdateMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesCreateOrUpdateMockTests.java index bdafb04b5dc9..39b5304f913f 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesCreateOrUpdateMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesCreateOrUpdateMockTests.java @@ -31,7 +31,7 @@ public void testCreateOrUpdate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"startIpAddress\":\"ujmkcjhwqy\",\"endIpAddress\":\"jrybnwjewgdrjer\",\"provisioningState\":\"Succeeded\"},\"id\":\"nqpeh\",\"name\":\"ndoygmifthnzdnd\",\"type\":\"l\"}"; + "{\"properties\":{\"startIpAddress\":\"hgw\",\"endIpAddress\":\"apnedgfbcvkc\",\"provisioningState\":\"Succeeded\"},\"id\":\"keqdcvdrhvoods\",\"name\":\"tbobz\",\"type\":\"opcjwvnhd\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,13 +62,13 @@ public void testCreateOrUpdate() throws Exception { FirewallRule response = manager .firewallRules() - .define("gjb") - .withExistingServerGroupsv2("bfovasrruvwbhsq", "sub") - .withStartIpAddress("rxbpyb") - .withEndIpAddress("rfbjf") + .define("c") + .withExistingServerGroupsv2("sg", "b") + .withStartIpAddress("hfwdsjnkaljutiis") + .withEndIpAddress("acffgdkzzewkfvhq") .create(); - Assertions.assertEquals("ujmkcjhwqy", response.startIpAddress()); - Assertions.assertEquals("jrybnwjewgdrjer", response.endIpAddress()); + Assertions.assertEquals("hgw", response.startIpAddress()); + Assertions.assertEquals("apnedgfbcvkc", response.endIpAddress()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesGetWithResponseMockTests.java index 4d11ed835a89..72b6e4eac932 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesGetWithResponseMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesGetWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"startIpAddress\":\"j\",\"endIpAddress\":\"n\",\"provisioningState\":\"Canceled\"},\"id\":\"vkr\",\"name\":\"swbxqz\",\"type\":\"szjfauvjfdxxivet\"}"; + "{\"properties\":{\"startIpAddress\":\"tkoievseotgq\",\"endIpAddress\":\"l\",\"provisioningState\":\"Failed\"},\"id\":\"wlauwzizxbmpg\",\"name\":\"jefuzmuvpbttdumo\",\"type\":\"p\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,10 +62,10 @@ public void testGetWithResponse() throws Exception { FirewallRule response = manager .firewallRules() - .getWithResponse("grcfb", "nrmfqjhhk", "bpvjymjhx", com.azure.core.util.Context.NONE) + .getWithResponse("uriplbpodxunkb", "bxmubyynt", "lrb", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("j", response.startIpAddress()); - Assertions.assertEquals("n", response.endIpAddress()); + Assertions.assertEquals("tkoievseotgq", response.startIpAddress()); + Assertions.assertEquals("l", response.endIpAddress()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesListByClusterMockTests.java index e7a61831fed9..7651e8bd7cf3 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesListByClusterMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesListByClusterMockTests.java @@ -32,7 +32,7 @@ public void testListByCluster() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"startIpAddress\":\"lqbhsf\",\"endIpAddress\":\"obl\",\"provisioningState\":\"Succeeded\"},\"id\":\"lmpewwwfbkr\",\"name\":\"rn\",\"type\":\"vshqjohxcr\"}]}"; + "{\"value\":[{\"properties\":{\"startIpAddress\":\"bhjpglkfgohdne\",\"endIpAddress\":\"el\",\"provisioningState\":\"Succeeded\"},\"id\":\"dyhtozfikdowwquu\",\"name\":\"xzxcl\",\"type\":\"ithhqzon\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,9 +61,9 @@ public void testListByCluster() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.firewallRules().listByCluster("t", "qaqtdoqmcbxvwvxy", com.azure.core.util.Context.NONE); + manager.firewallRules().listByCluster("xe", "mnzb", com.azure.core.util.Context.NONE); - Assertions.assertEquals("lqbhsf", response.iterator().next().startIpAddress()); - Assertions.assertEquals("obl", response.iterator().next().endIpAddress()); + Assertions.assertEquals("bhjpglkfgohdne", response.iterator().next().startIpAddress()); + Assertions.assertEquals("el", response.iterator().next().endIpAddress()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityInnerTests.java index d6e9791a1eba..1b44d37d046a 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityInnerTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityInnerTests.java @@ -14,26 +14,26 @@ public void testDeserialize() throws Exception { NameAvailabilityInner model = BinaryData .fromString( - "{\"message\":\"oo\",\"nameAvailable\":true,\"name\":\"zevgb\",\"type\":\"jqabcypmivkwlzuv\"}") + "{\"message\":\"rjfeallnwsubisnj\",\"nameAvailable\":false,\"name\":\"ngnzscxaqwoochc\",\"type\":\"nqvpkvlrxnje\"}") .toObject(NameAvailabilityInner.class); - Assertions.assertEquals("oo", model.message()); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals("zevgb", model.name()); - Assertions.assertEquals("jqabcypmivkwlzuv", model.type()); + Assertions.assertEquals("rjfeallnwsubisnj", model.message()); + Assertions.assertEquals(false, model.nameAvailable()); + Assertions.assertEquals("ngnzscxaqwoochc", model.name()); + Assertions.assertEquals("nqvpkvlrxnje", model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { NameAvailabilityInner model = new NameAvailabilityInner() - .withMessage("oo") - .withNameAvailable(true) - .withName("zevgb") - .withType("jqabcypmivkwlzuv"); + .withMessage("rjfeallnwsubisnj") + .withNameAvailable(false) + .withName("ngnzscxaqwoochc") + .withType("nqvpkvlrxnje"); model = BinaryData.fromObject(model).toObject(NameAvailabilityInner.class); - Assertions.assertEquals("oo", model.message()); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals("zevgb", model.name()); - Assertions.assertEquals("jqabcypmivkwlzuv", model.type()); + Assertions.assertEquals("rjfeallnwsubisnj", model.message()); + Assertions.assertEquals(false, model.nameAvailable()); + Assertions.assertEquals("ngnzscxaqwoochc", model.name()); + Assertions.assertEquals("nqvpkvlrxnje", model.type()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityRequestTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityRequestTests.java index 12d6aa12e648..d68f6ff7cf9c 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityRequestTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityRequestTests.java @@ -12,14 +12,14 @@ public final class NameAvailabilityRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { NameAvailabilityRequest model = - BinaryData.fromString("{\"name\":\"fvm\"}").toObject(NameAvailabilityRequest.class); - Assertions.assertEquals("fvm", model.name()); + BinaryData.fromString("{\"name\":\"tqgtzxdpnqbqq\"}").toObject(NameAvailabilityRequest.class); + Assertions.assertEquals("tqgtzxdpnqbqq", model.name()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - NameAvailabilityRequest model = new NameAvailabilityRequest().withName("fvm"); + NameAvailabilityRequest model = new NameAvailabilityRequest().withName("tqgtzxdpnqbqq"); model = BinaryData.fromObject(model).toObject(NameAvailabilityRequest.class); - Assertions.assertEquals("fvm", model.name()); + Assertions.assertEquals("tqgtzxdpnqbqq", model.name()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationDisplayTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationDisplayTests.java index 9ab5d709595c..7e93e332d64d 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationDisplayTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationDisplayTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { OperationDisplay model = BinaryData .fromString( - "{\"provider\":\"hvmdajvnysounq\",\"resource\":\"a\",\"operation\":\"ae\",\"description\":\"fhyhltrpmopjmcma\"}") + "{\"provider\":\"auu\",\"resource\":\"jmvxie\",\"operation\":\"ugidyjrr\",\"description\":\"y\"}") .toObject(OperationDisplay.class); } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationInnerTests.java index 951ddb4b4b46..1ee5d23bae38 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationInnerTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationInnerTests.java @@ -14,7 +14,7 @@ public void testDeserialize() throws Exception { OperationInner model = BinaryData .fromString( - "{\"name\":\"ixhbkuofqweykhm\",\"display\":{\"provider\":\"vfyexfw\",\"resource\":\"bcibvyvdcsitynn\",\"operation\":\"mdectehfiqscjey\",\"description\":\"hezrkgq\"},\"isDataAction\":true,\"origin\":\"user\",\"properties\":{\"cattpngjcrcczsq\":\"datavgmkqsleyyvxyqjp\"}}") + "{\"name\":\"llr\",\"display\":{\"provider\":\"d\",\"resource\":\"atkpnp\",\"operation\":\"exxbczwtr\",\"description\":\"iqzbq\"},\"isDataAction\":true,\"origin\":\"user\",\"properties\":{\"lhzdobp\":\"dataokacspk\",\"kcciwwzjuqkhr\":\"datajmflbvvnch\",\"oskg\":\"dataajiwkuo\"}}") .toObject(OperationInner.class); Assertions.assertEquals(true, model.isDataAction()); } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationListResultTests.java index 68fa6b368aab..1c41a471b919 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationListResultTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationListResultTests.java @@ -16,7 +16,7 @@ public void testDeserialize() throws Exception { OperationListResult model = BinaryData .fromString( - "{\"value\":[{\"name\":\"nfnbacfionlebxe\",\"display\":{\"provider\":\"tzxdpnqbqqwx\",\"resource\":\"feallnwsu\",\"operation\":\"snjampmng\",\"description\":\"scxaq\"},\"isDataAction\":true,\"origin\":\"NotSpecified\",\"properties\":{\"pkvlrxn\":\"dataonq\",\"eipheoflokeyy\":\"dataea\",\"jp\":\"dataenjbdlwtgrhp\",\"e\":\"dataumasxazjpq\"}},{\"name\":\"alhbx\",\"display\":{\"provider\":\"jj\",\"resource\":\"v\",\"operation\":\"dgwdslfhot\",\"description\":\"cynpwlbjnp\"},\"isDataAction\":false,\"origin\":\"user\",\"properties\":{\"usue\":\"dataehxnltyfsop\",\"orxzdmohctbqvud\":\"datanzwdejba\",\"nvowgujju\":\"dataxdn\",\"zj\":\"datawdkcglhsl\"}}],\"nextLink\":\"ggd\"}") + "{\"value\":[{\"name\":\"pheoflokeyy\",\"display\":{\"provider\":\"jbdlwtgrhpdjpju\",\"resource\":\"sxazjpq\",\"operation\":\"gual\",\"description\":\"xxhejjzzvd\"},\"isDataAction\":true,\"origin\":\"system\",\"properties\":{\"cynpwlbjnp\":\"datafhotw\"}},{\"name\":\"cftadeh\",\"display\":{\"provider\":\"tyfsoppusuesn\",\"resource\":\"dejbavo\",\"operation\":\"zdmohctbqvu\",\"description\":\"xdn\"},\"isDataAction\":false,\"origin\":\"system\",\"properties\":{\"dyggdtjixhbku\":\"datajjugwdkcglhslaz\",\"fyexfwhy\":\"datafqweykhmene\",\"amdecte\":\"datacibvyvdcsitynn\"}},{\"name\":\"iqscjeypv\",\"display\":{\"provider\":\"rkgqhcjrefo\",\"resource\":\"mkqsleyyv\",\"operation\":\"qjpkcattpngjcrc\",\"description\":\"sqpjhvmdajvn\"},\"isDataAction\":true,\"origin\":\"user\",\"properties\":{\"yhltrpmopjmcm\":\"datacanoaeupf\"}},{\"name\":\"u\",\"display\":{\"provider\":\"hfuiuaodsfc\",\"resource\":\"vxodpu\",\"operation\":\"myzydagfuaxbez\",\"description\":\"uokktwhrdxwz\"},\"isDataAction\":false,\"origin\":\"system\",\"properties\":{\"ksymd\":\"dataureximoryocfs\",\"kiiuxhqyudxor\":\"datays\"}}],\"nextLink\":\"nbpoczvyifqrvkdv\"}") .toObject(OperationListResult.class); Assertions.assertEquals(true, model.value().get(0).isDataAction()); } @@ -28,7 +28,10 @@ public void testSerialize() throws Exception { .withValue( Arrays .asList( - new OperationInner().withIsDataAction(true), new OperationInner().withIsDataAction(false))); + new OperationInner().withIsDataAction(true), + new OperationInner().withIsDataAction(false), + new OperationInner().withIsDataAction(true), + new OperationInner().withIsDataAction(false))); model = BinaryData.fromObject(model).toObject(OperationListResult.class); Assertions.assertEquals(true, model.value().get(0).isDataAction()); } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationsListMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationsListMockTests.java index b4bf49057ac6..0b8d07ca3d70 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationsListMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationsListMockTests.java @@ -32,7 +32,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"name\":\"blylpstdbh\",\"display\":{\"provider\":\"rzdzucerscdnt\",\"resource\":\"vfiwjmygtdss\",\"operation\":\"wtmwerio\",\"description\":\"pyqs\"},\"isDataAction\":false,\"origin\":\"NotSpecified\",\"properties\":{\"vwiwubmwmbesld\":\"datatshhszhedp\"}}]}"; + "{\"value\":[{\"name\":\"hojvpajqgxysmocm\",\"display\":{\"provider\":\"qvmkcxo\",\"resource\":\"pvhelxprg\",\"operation\":\"atddc\",\"description\":\"bcuejrjxgci\"},\"isDataAction\":false,\"origin\":\"system\",\"properties\":{\"bahwfl\":\"dataxsdqrhzoymibmrqy\",\"yvoqa\":\"dataszdtmhrkwof\",\"wo\":\"datapiexpbtgiw\",\"kcnqxwbpo\":\"datanwashrtd\"}}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionInnerTests.java index adf976b024fd..6d9bedfef9fc 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionInnerTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionInnerTests.java @@ -17,13 +17,13 @@ public void testDeserialize() throws Exception { PrivateEndpointConnectionInner model = BinaryData .fromString( - "{\"properties\":{\"groupIds\":[\"zywqsmbsu\"],\"privateEndpoint\":{\"id\":\"imoryocfsfksym\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"tki\",\"actionsRequired\":\"xhqyudxorrqnb\"},\"provisioningState\":\"Creating\"},\"id\":\"vyifqrvkdvjsl\",\"name\":\"rm\",\"type\":\"vdfwatkpn\"}") + "{\"properties\":{\"groupIds\":[\"hjfbebrjcxe\",\"fuwutttxf\"],\"privateEndpoint\":{\"id\":\"birphxepcyva\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"jky\",\"actionsRequired\":\"j\"},\"provisioningState\":\"Creating\"},\"id\":\"qgidokgjljyo\",\"name\":\"gvcl\",\"type\":\"bgsncghkjeszzhb\"}") .toObject(PrivateEndpointConnectionInner.class); Assertions .assertEquals( - PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("tki", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("xhqyudxorrqnb", model.privateLinkServiceConnectionState().actionsRequired()); + PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("jky", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("j", model.privateLinkServiceConnectionState().actionsRequired()); } @org.junit.jupiter.api.Test @@ -33,14 +33,14 @@ public void testSerialize() throws Exception { .withPrivateEndpoint(new PrivateEndpoint()) .withPrivateLinkServiceConnectionState( new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) - .withDescription("tki") - .withActionsRequired("xhqyudxorrqnb")); + .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("jky") + .withActionsRequired("j")); model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionInner.class); Assertions .assertEquals( - PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("tki", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("xhqyudxorrqnb", model.privateLinkServiceConnectionState().actionsRequired()); + PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("jky", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("j", model.privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionListResultTests.java index e665d1fa358f..db7df280cc86 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionListResultTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionListResultTests.java @@ -6,8 +6,12 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpoint; import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointConnectionListResult; +import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkServiceConnectionState; import java.util.Arrays; +import org.junit.jupiter.api.Assertions; public final class PrivateEndpointConnectionListResultTests { @org.junit.jupiter.api.Test @@ -15,14 +19,59 @@ public void testDeserialize() throws Exception { PrivateEndpointConnectionListResult model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Failed\"},\"id\":\"uaodsfcpk\",\"name\":\"xodpuozmyzydagfu\",\"type\":\"xbezyiuokktwh\"}]}") + "{\"value\":[{\"properties\":{\"groupIds\":[\"csonpclhoco\"],\"privateEndpoint\":{\"id\":\"kevle\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"buhfmvfaxkffeiit\",\"actionsRequired\":\"vmezy\"},\"provisioningState\":\"Failed\"},\"id\":\"mzsb\",\"name\":\"zoggigrxwburvjxx\",\"type\":\"nspydptkoenkoukn\"},{\"properties\":{\"groupIds\":[\"tiukbldngkpoci\",\"azyxoegukg\",\"npiucgygevqznty\"],\"privateEndpoint\":{\"id\":\"bpizcdrqjsdpydn\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"de\",\"actionsRequired\":\"jzicwifsjt\"},\"provisioningState\":\"Deleting\"},\"id\":\"bishcbkhajdeyea\",\"name\":\"dphagalpbuxwgip\",\"type\":\"honowkgshwank\"},{\"properties\":{\"groupIds\":[\"injep\"],\"privateEndpoint\":{\"id\":\"mryw\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"qftiy\",\"actionsRequired\":\"rnkcqvyxlw\"},\"provisioningState\":\"Deleting\"},\"id\":\"icohoqqnwvl\",\"name\":\"yav\",\"type\":\"hheunmmqhgyx\"},{\"properties\":{\"groupIds\":[\"ocukoklyax\"],\"privateEndpoint\":{\"id\":\"nuqszfkbey\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"mjmwvvjektcx\",\"actionsRequired\":\"nhwlrsffrzpwvl\"},\"provisioningState\":\"Succeeded\"},\"id\":\"biqylihkaet\",\"name\":\"kt\",\"type\":\"fcivfsnkym\"}]}") .toObject(PrivateEndpointConnectionListResult.class); + Assertions + .assertEquals( + PrivateEndpointServiceConnectionStatus.REJECTED, + model.value().get(0).privateLinkServiceConnectionState().status()); + Assertions + .assertEquals("buhfmvfaxkffeiit", model.value().get(0).privateLinkServiceConnectionState().description()); + Assertions.assertEquals("vmezy", model.value().get(0).privateLinkServiceConnectionState().actionsRequired()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PrivateEndpointConnectionListResult model = - new PrivateEndpointConnectionListResult().withValue(Arrays.asList(new PrivateEndpointConnectionInner())); + new PrivateEndpointConnectionListResult() + .withValue( + Arrays + .asList( + new PrivateEndpointConnectionInner() + .withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) + .withDescription("buhfmvfaxkffeiit") + .withActionsRequired("vmezy")), + new PrivateEndpointConnectionInner() + .withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("de") + .withActionsRequired("jzicwifsjt")), + new PrivateEndpointConnectionInner() + .withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("qftiy") + .withActionsRequired("rnkcqvyxlw")), + new PrivateEndpointConnectionInner() + .withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("mjmwvvjektcx") + .withActionsRequired("nhwlrsffrzpwvl")))); model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionListResult.class); + Assertions + .assertEquals( + PrivateEndpointServiceConnectionStatus.REJECTED, + model.value().get(0).privateLinkServiceConnectionState().status()); + Assertions + .assertEquals("buhfmvfaxkffeiit", model.value().get(0).privateLinkServiceConnectionState().description()); + Assertions.assertEquals("vmezy", model.value().get(0).privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionPropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionPropertiesTests.java index a27fef2cff07..c8c10a73f59f 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionPropertiesTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionPropertiesTests.java @@ -17,13 +17,13 @@ public void testDeserialize() throws Exception { PrivateEndpointConnectionProperties model = BinaryData .fromString( - "{\"groupIds\":[\"exxbczwtr\",\"wiqzbqjvsovmyo\",\"acspkwl\"],\"privateEndpoint\":{\"id\":\"obpxjmflbvvn\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"cciw\",\"actionsRequired\":\"juqk\"},\"provisioningState\":\"Succeeded\"}") + "{\"groupIds\":[\"txfvgx\",\"fsm\",\"nehmpvecx\",\"odebfqkkrbmpu\"],\"privateEndpoint\":{\"id\":\"iw\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"fbxzpuzycisp\",\"actionsRequired\":\"zahmgkbrpyydhibn\"},\"provisioningState\":\"Failed\"}") .toObject(PrivateEndpointConnectionProperties.class); Assertions .assertEquals( PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("cciw", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("juqk", model.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("fbxzpuzycisp", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("zahmgkbrpyydhibn", model.privateLinkServiceConnectionState().actionsRequired()); } @org.junit.jupiter.api.Test @@ -34,13 +34,13 @@ public void testSerialize() throws Exception { .withPrivateLinkServiceConnectionState( new PrivateLinkServiceConnectionState() .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) - .withDescription("cciw") - .withActionsRequired("juqk")); + .withDescription("fbxzpuzycisp") + .withActionsRequired("zahmgkbrpyydhibn")); model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class); Assertions .assertEquals( PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("cciw", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("juqk", model.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("fbxzpuzycisp", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("zahmgkbrpyydhibn", model.privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java index 11bc423b357d..6ff43b30bf2b 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java @@ -34,7 +34,7 @@ public void testCreateOrUpdate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"groupIds\":[\"fv\",\"efyw\"],\"privateEndpoint\":{\"id\":\"fvmwy\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"uyfta\",\"actionsRequired\":\"cpwi\"},\"provisioningState\":\"Succeeded\"},\"id\":\"tmnubexkpzksmon\",\"name\":\"jmquxvypomgk\",\"type\":\"pkwhojvpa\"}"; + "{\"properties\":{\"groupIds\":[\"dtlwwrlkd\",\"tncvokot\"],\"privateEndpoint\":{\"id\":\"d\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"y\",\"actionsRequired\":\"ogjltdtbnnhad\"},\"provisioningState\":\"Succeeded\"},\"id\":\"kvci\",\"name\":\"hnvpamqgxq\",\"type\":\"u\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -65,20 +65,20 @@ public void testCreateOrUpdate() throws Exception { PrivateEndpointConnection response = manager .privateEndpointConnections() - .define("sag") - .withExistingServerGroupsv2("mh", "lxyjr") + .define("iyntorzihle") + .withExistingServerGroupsv2("n", "synljphuopxodl") .withPrivateEndpoint(new PrivateEndpoint()) .withPrivateLinkServiceConnectionState( new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) - .withDescription("xcxrsl") - .withActionsRequired("utwu")) + .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) + .withDescription("iizynkedyatrwyh") + .withActionsRequired("ibzyhwitsmyp")) .create(); Assertions .assertEquals( - PrivateEndpointServiceConnectionStatus.PENDING, response.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("uyfta", response.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("cpwi", response.privateLinkServiceConnectionState().actionsRequired()); + PrivateEndpointServiceConnectionStatus.REJECTED, response.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("y", response.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("ogjltdtbnnhad", response.privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java index a85e04439c1b..40be293f8e0c 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java @@ -32,7 +32,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"groupIds\":[\"ozfikdowwq\"],\"privateEndpoint\":{\"id\":\"xzxcl\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"hqzonosggbhcoh\",\"actionsRequired\":\"dsjnka\"},\"provisioningState\":\"Deleting\"},\"id\":\"iiswacffgdkzze\",\"name\":\"kfvhqcrailvpn\",\"type\":\"pfuflrw\"}"; + "{\"properties\":{\"groupIds\":[\"e\"],\"privateEndpoint\":{\"id\":\"arrwlquu\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"kacewiipfp\",\"actionsRequired\":\"ji\"},\"provisioningState\":\"Creating\"},\"id\":\"f\",\"name\":\"ohqkvpuvksgpls\",\"type\":\"kn\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,13 +63,13 @@ public void testGetWithResponse() throws Exception { PrivateEndpointConnection response = manager .privateEndpointConnections() - .getWithResponse("zmuvpbttdumorppx", "bmnzbtbhjpgl", "fgohdneuelfphs", com.azure.core.util.Context.NONE) + .getWithResponse("reqnovvqfov", "jxywsuws", "rsndsytgadgvra", com.azure.core.util.Context.NONE) .getValue(); Assertions .assertEquals( PrivateEndpointServiceConnectionStatus.REJECTED, response.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("hqzonosggbhcoh", response.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("dsjnka", response.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("kacewiipfp", response.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("ji", response.privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsListByClusterMockTests.java index 7fd5afbf9498..31aaba8ff11b 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsListByClusterMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsListByClusterMockTests.java @@ -33,7 +33,7 @@ public void testListByCluster() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"groupIds\":[\"sikvmkqzeqqkdlt\",\"zxmhhvhgu\",\"eodkwobda\",\"xtibqdxbxwakbog\"],\"privateEndpoint\":{\"id\":\"dlkzgxhuri\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"odxun\",\"actionsRequired\":\"ebxmubyynt\"},\"provisioningState\":\"Creating\"},\"id\":\"qtkoievs\",\"name\":\"otgqrlltmu\",\"type\":\"lauwzizxbmpgcjef\"}]}"; + "{\"value\":[{\"properties\":{\"groupIds\":[\"uqerpqlpqwc\"],\"privateEndpoint\":{\"id\":\"qgbdbuta\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"tkuwhhmhykojo\",\"actionsRequired\":\"fnndl\"},\"provisioningState\":\"Deleting\"},\"id\":\"koymkcd\",\"name\":\"h\",\"type\":\"pkkpw\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,17 +62,16 @@ public void testListByCluster() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager - .privateEndpointConnections() - .listByCluster("k", "wtppjflcxogaoko", com.azure.core.util.Context.NONE); + manager.privateEndpointConnections().listByCluster("ulpiuj", "aasipqi", com.azure.core.util.Context.NONE); Assertions .assertEquals( PrivateEndpointServiceConnectionStatus.APPROVED, response.iterator().next().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("odxun", response.iterator().next().privateLinkServiceConnectionState().description()); Assertions .assertEquals( - "ebxmubyynt", response.iterator().next().privateLinkServiceConnectionState().actionsRequired()); + "tkuwhhmhykojo", response.iterator().next().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("fnndl", response.iterator().next().privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointTests.java index 6c5c1233ce7a..e5dcb3e36225 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointTests.java @@ -10,7 +10,7 @@ public final class PrivateEndpointTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - PrivateEndpoint model = BinaryData.fromString("{\"id\":\"jiwkuofoskghsau\"}").toObject(PrivateEndpoint.class); + PrivateEndpoint model = BinaryData.fromString("{\"id\":\"pikad\"}").toObject(PrivateEndpoint.class); } @org.junit.jupiter.api.Test diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceInnerTests.java index e8c17a389461..97e2a9c5e0ae 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceInnerTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceInnerTests.java @@ -15,17 +15,15 @@ public void testDeserialize() throws Exception { PrivateLinkResourceInner model = BinaryData .fromString( - "{\"properties\":{\"groupId\":\"dpydn\",\"requiredMembers\":[\"xdeoejzic\",\"ifsjttgzfbishcb\"],\"requiredZoneNames\":[\"jdeyeamdpha\",\"alpbuxwgipwhon\",\"wkgshwa\",\"kix\"]},\"id\":\"injep\",\"name\":\"ttmrywnuzoqf\",\"type\":\"iyqzrnk\"}") + "{\"properties\":{\"groupId\":\"xdbabphlwr\",\"requiredMembers\":[\"ktsthsucocmny\"],\"requiredZoneNames\":[\"t\"]},\"id\":\"twwrqp\",\"name\":\"edckzywbiexzfey\",\"type\":\"eaxib\"}") .toObject(PrivateLinkResourceInner.class); - Assertions.assertEquals("jdeyeamdpha", model.requiredZoneNames().get(0)); + Assertions.assertEquals("t", model.requiredZoneNames().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - PrivateLinkResourceInner model = - new PrivateLinkResourceInner() - .withRequiredZoneNames(Arrays.asList("jdeyeamdpha", "alpbuxwgipwhon", "wkgshwa", "kix")); + PrivateLinkResourceInner model = new PrivateLinkResourceInner().withRequiredZoneNames(Arrays.asList("t")); model = BinaryData.fromObject(model).toObject(PrivateLinkResourceInner.class); - Assertions.assertEquals("jdeyeamdpha", model.requiredZoneNames().get(0)); + Assertions.assertEquals("t", model.requiredZoneNames().get(0)); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceListResultTests.java index 20f08e775106..787502ef4222 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceListResultTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceListResultTests.java @@ -8,6 +8,7 @@ import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkResourceListResult; import java.util.Arrays; +import org.junit.jupiter.api.Assertions; public final class PrivateLinkResourceListResultTests { @org.junit.jupiter.api.Test @@ -15,8 +16,9 @@ public void testDeserialize() throws Exception { PrivateLinkResourceListResult model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"groupId\":\"vxieduugidyj\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"y\",\"name\":\"osvexcsonpclhoc\",\"type\":\"hslkevleggzf\"},{\"properties\":{\"groupId\":\"fmvfaxkffeiit\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"ez\",\"name\":\"v\",\"type\":\"hxmzsbbzoggig\"},{\"properties\":{\"groupId\":\"burvjxxjnspy\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"oenkouknvudwti\",\"name\":\"kbldngkpocipa\",\"type\":\"yxoegukgjnp\"},{\"properties\":{\"groupId\":\"gygev\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"yp\",\"name\":\"rbpizc\",\"type\":\"r\"}]}") + "{\"value\":[{\"properties\":{\"groupId\":\"agnb\",\"requiredMembers\":[\"hijggme\",\"fsiarbutr\",\"vpnazzm\"],\"requiredZoneNames\":[\"unmpxttd\",\"hrbnlankxmyskpbh\"]},\"id\":\"btkcxywnytnrsyn\",\"name\":\"qidybyx\",\"type\":\"zfcl\"}]}") .toObject(PrivateLinkResourceListResult.class); + Assertions.assertEquals("unmpxttd", model.value().get(0).requiredZoneNames().get(0)); } @org.junit.jupiter.api.Test @@ -26,10 +28,9 @@ public void testSerialize() throws Exception { .withValue( Arrays .asList( - new PrivateLinkResourceInner().withRequiredZoneNames(Arrays.asList()), - new PrivateLinkResourceInner().withRequiredZoneNames(Arrays.asList()), - new PrivateLinkResourceInner().withRequiredZoneNames(Arrays.asList()), - new PrivateLinkResourceInner().withRequiredZoneNames(Arrays.asList()))); + new PrivateLinkResourceInner() + .withRequiredZoneNames(Arrays.asList("unmpxttd", "hrbnlankxmyskpbh")))); model = BinaryData.fromObject(model).toObject(PrivateLinkResourceListResult.class); + Assertions.assertEquals("unmpxttd", model.value().get(0).requiredZoneNames().get(0)); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcePropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcePropertiesTests.java index 217267a973f7..48ebc5326d63 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcePropertiesTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcePropertiesTests.java @@ -15,16 +15,16 @@ public void testDeserialize() throws Exception { PrivateLinkResourceProperties model = BinaryData .fromString( - "{\"groupId\":\"vyxlwhzlsicohoqq\",\"requiredMembers\":[\"lryav\",\"hheunmmqhgyx\",\"konocu\",\"oklyaxuconuq\"],\"requiredZoneNames\":[\"kbeype\",\"rmjmwvvjektc\"]}") + "{\"groupId\":\"jwbhqwalmuz\",\"requiredMembers\":[\"aepdkzjanc\",\"xrhdwbavxbniwdjs\",\"zt\",\"dbpgnxytxhp\"],\"requiredZoneNames\":[\"zpfzabglc\",\"hxw\"]}") .toObject(PrivateLinkResourceProperties.class); - Assertions.assertEquals("kbeype", model.requiredZoneNames().get(0)); + Assertions.assertEquals("zpfzabglc", model.requiredZoneNames().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PrivateLinkResourceProperties model = - new PrivateLinkResourceProperties().withRequiredZoneNames(Arrays.asList("kbeype", "rmjmwvvjektc")); + new PrivateLinkResourceProperties().withRequiredZoneNames(Arrays.asList("zpfzabglc", "hxw")); model = BinaryData.fromObject(model).toObject(PrivateLinkResourceProperties.class); - Assertions.assertEquals("kbeype", model.requiredZoneNames().get(0)); + Assertions.assertEquals("zpfzabglc", model.requiredZoneNames().get(0)); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java index 16d683b2841f..e6c3a780c335 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"groupId\":\"dtkcnqxwbpokulp\",\"requiredMembers\":[\"waasip\"],\"requiredZoneNames\":[\"obyu\",\"erpqlpqwcciuqg\"]},\"id\":\"butauvfb\",\"name\":\"kuwhh\",\"type\":\"hykojoxafnndlpic\"}"; + "{\"properties\":{\"groupId\":\"ikf\",\"requiredMembers\":[\"n\",\"a\"],\"requiredZoneNames\":[\"wczelpci\",\"elsfeaen\",\"abfatkl\"]},\"id\":\"xbjhwuaanozjosph\",\"name\":\"oulpjrv\",\"type\":\"ag\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,9 +62,9 @@ public void testGetWithResponse() throws Exception { PrivateLinkResource response = manager .privateLinkResources() - .getWithResponse("yyv", "qacpiex", "btgiwbwoenwas", com.azure.core.util.Context.NONE) + .getWithResponse("imfnjhfjx", "mszkkfo", "rey", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("obyu", response.requiredZoneNames().get(0)); + Assertions.assertEquals("wczelpci", response.requiredZoneNames().get(0)); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesListByClusterMockTests.java index a0180c498e19..61980b963223 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesListByClusterMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesListByClusterMockTests.java @@ -32,7 +32,7 @@ public void testListByCluster() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"groupId\":\"zapvhelx\",\"requiredMembers\":[\"lya\",\"dd\",\"kcbcue\",\"rjxgciqib\"],\"requiredZoneNames\":[\"sxsdqrhzoymibm\"]},\"id\":\"yiba\",\"name\":\"wfluszdt\",\"type\":\"hrkwo\"}]}"; + "{\"value\":[{\"properties\":{\"groupId\":\"piccjzkzivgv\",\"requiredMembers\":[\"ayrhyrnx\",\"mueedndrdvstk\",\"qqtch\",\"alm\"],\"requiredZoneNames\":[\"d\",\"aygdvwvgpioh\",\"wxrt\"]},\"id\":\"dxepxgyq\",\"name\":\"gvr\",\"type\":\"mnpkukghimdblxg\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,8 +61,8 @@ public void testListByCluster() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.privateLinkResources().listByCluster("qgxy", "mocmbqfqvmk", com.azure.core.util.Context.NONE); + manager.privateLinkResources().listByCluster("zikywgg", "kallatmel", com.azure.core.util.Context.NONE); - Assertions.assertEquals("sxsdqrhzoymibm", response.iterator().next().requiredZoneNames().get(0)); + Assertions.assertEquals("d", response.iterator().next().requiredZoneNames().get(0)); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerRoleGroupConfigurationTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerRoleGroupConfigurationTests.java index 17fe4ec4a385..3aad6504c215 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerRoleGroupConfigurationTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerRoleGroupConfigurationTests.java @@ -15,18 +15,18 @@ public void testDeserialize() throws Exception { ServerRoleGroupConfiguration model = BinaryData .fromString( - "{\"role\":\"Coordinator\",\"value\":\"maajrmvdjwzrlo\",\"defaultValue\":\"clwhijcoejctbz\",\"source\":\"s\"}") + "{\"role\":\"Worker\",\"value\":\"imexgstxgcpodgma\",\"defaultValue\":\"r\",\"source\":\"djwzrlov\"}") .toObject(ServerRoleGroupConfiguration.class); - Assertions.assertEquals(ServerRole.COORDINATOR, model.role()); - Assertions.assertEquals("maajrmvdjwzrlo", model.value()); + Assertions.assertEquals(ServerRole.WORKER, model.role()); + Assertions.assertEquals("imexgstxgcpodgma", model.value()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ServerRoleGroupConfiguration model = - new ServerRoleGroupConfiguration().withRole(ServerRole.COORDINATOR).withValue("maajrmvdjwzrlo"); + new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("imexgstxgcpodgma"); model = BinaryData.fromObject(model).toObject(ServerRoleGroupConfiguration.class); - Assertions.assertEquals(ServerRole.COORDINATOR, model.role()); - Assertions.assertEquals("maajrmvdjwzrlo", model.value()); + Assertions.assertEquals(ServerRole.WORKER, model.role()); + Assertions.assertEquals("imexgstxgcpodgma", model.value()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersGetWithResponseMockTests.java index 8455a39690d1..1cd68c156603 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersGetWithResponseMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersGetWithResponseMockTests.java @@ -32,7 +32,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"fullyQualifiedDomainName\":\"plwzbhvgyugu\",\"role\":\"Worker\",\"state\":\"kfssxqukkf\",\"haState\":\"gmgsxnkjzkde\",\"availabilityZone\":\"pvlopwiyighxpkd\",\"postgresqlVersion\":\"baiuebbaumny\",\"citusVersion\":\"ped\",\"serverEdition\":\"jn\",\"storageQuotaInMb\":949740199,\"vCores\":1650881541,\"enableHa\":true,\"enablePublicIpAccess\":true,\"isReadOnly\":true,\"administratorLogin\":\"ebtfhvpesap\"},\"id\":\"rdqmhjjdhtldwkyz\",\"name\":\"uutkncw\",\"type\":\"cwsvlxotog\"}"; + "{\"properties\":{\"fullyQualifiedDomainName\":\"laexqp\",\"role\":\"Coordinator\",\"state\":\"mwsrcrgvxpvgo\",\"haState\":\"lf\",\"availabilityZone\":\"sgwbnbbeld\",\"postgresqlVersion\":\"k\",\"citusVersion\":\"ali\",\"serverEdition\":\"rqhakauha\",\"storageQuotaInMb\":798376166,\"vCores\":706986266,\"enableHa\":false,\"enablePublicIpAccess\":false,\"isReadOnly\":false,\"administratorLogin\":\"cugicjoox\"},\"id\":\"ebwpucwwfvo\",\"name\":\"bvmeuecivy\",\"type\":\"zceuojgjrw\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,16 +63,16 @@ public void testGetWithResponse() throws Exception { ClusterServer response = manager .servers() - .getWithResponse("xytxhpzxbz", "fzab", "lcuhxwtctyqiklb", com.azure.core.util.Context.NONE) + .getWithResponse("ofmxagkvtmelmqkr", "ahvljuaha", "uhcdhm", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals(ServerRole.WORKER, response.role()); - Assertions.assertEquals("pvlopwiyighxpkd", response.availabilityZone()); - Assertions.assertEquals("baiuebbaumny", response.postgresqlVersion()); - Assertions.assertEquals("ped", response.citusVersion()); - Assertions.assertEquals("jn", response.serverEdition()); - Assertions.assertEquals(949740199, response.storageQuotaInMb()); - Assertions.assertEquals(1650881541, response.vCores()); - Assertions.assertEquals(true, response.enableHa()); + Assertions.assertEquals(ServerRole.COORDINATOR, response.role()); + Assertions.assertEquals("sgwbnbbeld", response.availabilityZone()); + Assertions.assertEquals("k", response.postgresqlVersion()); + Assertions.assertEquals("ali", response.citusVersion()); + Assertions.assertEquals("rqhakauha", response.serverEdition()); + Assertions.assertEquals(798376166, response.storageQuotaInMb()); + Assertions.assertEquals(706986266, response.vCores()); + Assertions.assertEquals(false, response.enableHa()); } } diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersListByClusterMockTests.java index b2e6bdaba72a..5a50d4c1101d 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersListByClusterMockTests.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersListByClusterMockTests.java @@ -33,7 +33,7 @@ public void testListByCluster() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"fullyQualifiedDomainName\":\"xmyskp\",\"role\":\"Worker\",\"state\":\"btkcxywnytnrsyn\",\"haState\":\"idybyxczf\",\"availabilityZone\":\"haaxdbabphl\",\"postgresqlVersion\":\"qlfktsths\",\"citusVersion\":\"ocmnyyazttbtwwrq\",\"serverEdition\":\"edckzywbiexzfey\",\"storageQuotaInMb\":2061798656,\"vCores\":537783371,\"enableHa\":true,\"enablePublicIpAccess\":true,\"isReadOnly\":true,\"administratorLogin\":\"qwalmuzyoxaepd\"},\"id\":\"jancu\",\"name\":\"rhdwbavxbniw\",\"type\":\"jswztsdbpg\"}]}"; + "{\"value\":[{\"properties\":{\"fullyQualifiedDomainName\":\"kqujidsuyono\",\"role\":\"Worker\",\"state\":\"ocqxtccmg\",\"haState\":\"dxyt\",\"availabilityZone\":\"oyrxvwfudwpzntxh\",\"postgresqlVersion\":\"hl\",\"citusVersion\":\"jbhckfrlhr\",\"serverEdition\":\"bkyvp\",\"storageQuotaInMb\":1219489836,\"vCores\":427278595,\"enableHa\":true,\"enablePublicIpAccess\":false,\"isReadOnly\":false,\"administratorLogin\":\"kuwbcrnwb\"},\"id\":\"hhseyv\",\"name\":\"us\",\"type\":\"tslhspkdeem\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,15 +62,15 @@ public void testListByCluster() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.servers().listByCluster("rcvpnazzmhjrunmp", "ttdbhrbnl", com.azure.core.util.Context.NONE); + manager.servers().listByCluster("gxywpmue", "fjz", com.azure.core.util.Context.NONE); Assertions.assertEquals(ServerRole.WORKER, response.iterator().next().role()); - Assertions.assertEquals("haaxdbabphl", response.iterator().next().availabilityZone()); - Assertions.assertEquals("qlfktsths", response.iterator().next().postgresqlVersion()); - Assertions.assertEquals("ocmnyyazttbtwwrq", response.iterator().next().citusVersion()); - Assertions.assertEquals("edckzywbiexzfey", response.iterator().next().serverEdition()); - Assertions.assertEquals(2061798656, response.iterator().next().storageQuotaInMb()); - Assertions.assertEquals(537783371, response.iterator().next().vCores()); + Assertions.assertEquals("oyrxvwfudwpzntxh", response.iterator().next().availabilityZone()); + Assertions.assertEquals("hl", response.iterator().next().postgresqlVersion()); + Assertions.assertEquals("jbhckfrlhr", response.iterator().next().citusVersion()); + Assertions.assertEquals("bkyvp", response.iterator().next().serverEdition()); + Assertions.assertEquals(1219489836, response.iterator().next().storageQuotaInMb()); + Assertions.assertEquals(427278595, response.iterator().next().vCores()); Assertions.assertEquals(true, response.iterator().next().enableHa()); } } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/CHANGELOG.md b/sdk/datafactory/azure-resourcemanager-datafactory/CHANGELOG.md index 09bf4dbf2470..223b77ba8f20 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/CHANGELOG.md +++ b/sdk/datafactory/azure-resourcemanager-datafactory/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.23 (Unreleased) +## 1.0.0-beta.24 (Unreleased) ### Features Added @@ -10,6 +10,1436 @@ ### Other Changes +## 1.0.0-beta.23 (2023-09-27) + +- Azure Resource Manager DataFactory client library for Java. This package contains Microsoft Azure SDK for DataFactory Management SDK. The Azure Data Factory V2 management API provides a RESTful set of web services that interact with Azure Data Factory V2 services. Package tag package-2018-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Breaking Changes + +* `models.CosmosDbServicePrincipalCredentialType` was removed + +* `models.SalesforceSourceReadBehavior` was removed + +#### `models.SapEccLinkedService` was modified + +* `withUsername(java.lang.String)` was removed +* `java.lang.String url()` -> `java.lang.Object url()` +* `java.lang.String username()` -> `java.lang.Object username()` +* `withUrl(java.lang.String)` was removed + +#### `models.SmartsheetLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.HBaseLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.DrillLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.SnowflakeLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.SapOdpLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.SapOpenHubLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.SalesforceSource` was modified + +* `withReadBehavior(models.SalesforceSourceReadBehavior)` was removed +* `models.SalesforceSourceReadBehavior readBehavior()` -> `java.lang.Object readBehavior()` + +#### `models.SalesforceServiceCloudSource` was modified + +* `withReadBehavior(models.SalesforceSourceReadBehavior)` was removed +* `models.SalesforceSourceReadBehavior readBehavior()` -> `java.lang.Object readBehavior()` + +#### `models.VerticaLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.HDInsightOnDemandLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.FileServerLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureDataLakeStoreReadSettings` was modified + +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed + +#### `models.AmazonS3LinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.NetezzaLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.MagentoLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.InformixLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.HttpReadSettings` was modified + +* `enablePartitionDiscovery()` was removed +* `withPartitionRootPath(java.lang.Object)` was removed +* `partitionRootPath()` was removed +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed + +#### `models.HttpLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.GreenplumLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.PostgreSqlLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.CommonDataServiceForAppsLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.SquareLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureBlobFSReadSettings` was modified + +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed + +#### `models.AzureBatchLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.MongoDbLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.SapHanaLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.OracleCloudStorageLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.TeamDeskLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.AsanaLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.ConcurLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.SynapseNotebookActivity` was modified + +* `java.lang.Integer numExecutors()` -> `java.lang.Object numExecutors()` +* `withNumExecutors(java.lang.Integer)` was removed + +#### `models.MariaDBLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.XeroLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.AzureFileStorageReadSettings` was modified + +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed + +#### `models.AzureMLServiceLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.FtpReadSettings` was modified + +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` +* `java.lang.Boolean useBinaryTransfer()` -> `java.lang.Object useBinaryTransfer()` +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed +* `withUseBinaryTransfer(java.lang.Boolean)` was removed + +#### `models.DynamicsAXLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.FileServerReadSettings` was modified + +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed + +#### `models.PrestoLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AmazonRdsForOracleLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.SalesforceLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.RestResourceDataset` was modified + +* `java.lang.Object paginationRules()` -> `java.util.Map paginationRules()` +* `java.lang.Object additionalHeaders()` -> `java.util.Map additionalHeaders()` +* `withAdditionalHeaders(java.lang.Object)` was removed +* `withPaginationRules(java.lang.Object)` was removed + +#### `models.SapBWLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.ZohoLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.SapTableLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.JiraLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.AzureFileStorageLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureSqlDatabaseLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureSqlDWLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.ShopifyLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.TeradataLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.SparkLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.OracleServiceCloudLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureBlobStorageLinkedService` was modified + +* `withAccountKind(java.lang.String)` was removed +* `java.lang.String accountKind()` -> `java.lang.Object accountKind()` +* `withServiceEndpoint(java.lang.String)` was removed +* `java.lang.String serviceEndpoint()` -> `java.lang.Object serviceEndpoint()` + +#### `models.AzureDataLakeStoreLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.ServiceNowLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureSearchLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.AzureMySqlLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.HubspotLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AmazonS3CompatibleReadSettings` was modified + +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed + +#### `models.DynamicsLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.CassandraLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.SftpReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` + +#### `models.ODataLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.GoogleAdWordsLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.HDInsightLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.AzureBlobStorageReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` + +#### `models.RestServiceLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.CosmosDbLinkedService` was modified + +* `withServicePrincipalCredentialType(models.CosmosDbServicePrincipalCredentialType)` was removed +* `withEncryptedCredential(java.lang.Object)` was removed +* `models.CosmosDbServicePrincipalCredentialType servicePrincipalCredentialType()` -> `java.lang.Object servicePrincipalCredentialType()` +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureBlobFSLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.AmazonS3ReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` + +#### `models.AzureDataLakeAnalyticsLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.HiveLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureDatabricksDeltaLakeLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.GoogleSheetsLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.EloquaLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.HDInsightHiveActivity` was modified + +* `java.util.List variables()` -> `java.util.Map variables()` +* `withVariables(java.util.List)` was removed + +#### `models.SapCloudForCustomerLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.GoogleCloudStorageLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.OdbcLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.HdfsLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.AzurePostgreSqlLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureMLLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.OracleLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.AzureFunctionLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.HdfsReadSettings` was modified + +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed + +#### `models.AmazonS3CompatibleLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.PaypalLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.SalesforceMarketingCloudLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureDatabricksLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.QuickbaseLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.MicrosoftAccessLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AzureMariaDBLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.SqlServerLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AmazonRedshiftLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.ResponsysLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.ImpalaLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.SftpServerLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.MySqlLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.PhoenixLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.Db2LinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.DynamicsCrmLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.FtpServerLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.QuickBooksLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.SalesforceServiceCloudLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.GoogleCloudStorageReadSettings` was modified + +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed + +#### `models.CouchbaseLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.SharePointOnlineListLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.SybaseLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.AmazonMwsLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.GoogleBigQueryLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.DataworldLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.OracleCloudStorageReadSettings` was modified + +* `java.lang.Boolean enablePartitionDiscovery()` -> `java.lang.Object enablePartitionDiscovery()` +* `withEnablePartitionDiscovery(java.lang.Boolean)` was removed + +#### `models.AzureSqlMILinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.Office365LinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +#### `models.AmazonRdsForSqlServerLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.ZendeskLinkedService` was modified + +* `withEncryptedCredential(java.lang.Object)` was removed +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` + +#### `models.MarketoLinkedService` was modified + +* `java.lang.Object encryptedCredential()` -> `java.lang.String encryptedCredential()` +* `withEncryptedCredential(java.lang.Object)` was removed + +### Features Added + +* `models.MapperPolicy` was added + +* `models.ChangeDataCaptureResource$Update` was added + +* `models.SecureInputOutputPolicy` was added + +* `models.ChangeDataCaptureFolder` was added + +* `models.ActivityOnInactiveMarkAs` was added + +* `models.ChangeDataCaptureListResponse` was added + +* `models.ConnectionType` was added + +* `models.MappingType` was added + +* `models.MapperSourceConnectionsInfo` was added + +* `models.ChangeDataCaptureResource$DefinitionStages` was added + +* `models.ChangeDataCaptures` was added + +* `models.FrequencyType` was added + +* `models.ActivityState` was added + +* `models.MapperDslConnectorProperties` was added + +* `models.MapperConnectionReference` was added + +* `models.IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem` was added + +* `models.ChangeDataCaptureResource$Definition` was added + +* `models.ChangeDataCaptureResource$UpdateStages` was added + +* `models.MapperAttributeMapping` was added + +* `models.ChangeDataCaptureResource` was added + +* `models.MapperTargetConnectionsInfo` was added + +* `models.MapperAttributeMappings` was added + +* `models.MapperAttributeReference` was added + +* `models.MapperConnection` was added + +* `models.MapperTable` was added + +* `models.DataMapperMapping` was added + +* `models.MapperTableSchema` was added + +* `models.MapperPolicyRecurrence` was added + +#### `models.SapEccLinkedService` was modified + +* `withUsername(java.lang.Object)` was added +* `withUrl(java.lang.Object)` was added + +#### `models.SmartsheetLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.Activity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `onInactiveMarkAs()` was added +* `state()` was added +* `withState(models.ActivityState)` was added + +#### `models.HBaseLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.DrillLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SnowflakeLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SapOdpLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.MongoDbAtlasLinkedService` was modified + +* `withDriverVersion(java.lang.Object)` was added +* `driverVersion()` was added + +#### `models.SapOpenHubLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SalesforceSource` was modified + +* `withReadBehavior(java.lang.Object)` was added + +#### `models.SalesforceServiceCloudSource` was modified + +* `withReadBehavior(java.lang.Object)` was added + +#### `models.VerticaLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.HDInsightOnDemandLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.FileServerLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SqlMISource` was modified + +* `withIsolationLevel(java.lang.Object)` was added +* `isolationLevel()` was added + +#### `models.AzureDataLakeStoreReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.ScriptActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.HDInsightSparkActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.AmazonS3LinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.NetezzaLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.MagentoLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.InformixLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.WebActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.HttpReadSettings` was modified + +* `withAdditionalColumns(java.lang.Object)` was added +* `additionalColumns()` was added + +#### `models.GetMetadataActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `DataFactoryManager` was modified + +* `changeDataCaptures()` was added + +#### `models.FilterActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.HttpLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.GreenplumLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.PostgreSqlLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ForEachActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.CommonDataServiceForAppsLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ExecuteWranglingDataflowActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.SquareLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureBlobFSReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.AzureBatchLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.MongoDbLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.DatabricksNotebookActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.SapHanaLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.WaitActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.OracleCloudStorageLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.CopyActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.IfConditionActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.TeamDeskLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AsanaLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ExecutionActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.WebhookActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.ValidationActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.ConcurLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.CustomActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.SynapseNotebookActivity` was modified + +* `targetSparkConfiguration()` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withNumExecutors(java.lang.Object)` was added +* `withState(models.ActivityState)` was added +* `withConfigurationType(models.ConfigurationType)` was added +* `configurationType()` was added +* `withSparkConfig(java.util.Map)` was added +* `sparkConfig()` was added +* `withTargetSparkConfiguration(models.SparkConfigurationParametrizationReference)` was added + +#### `models.MariaDBLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.XeroLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureFileStorageReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.AzureMLServiceLinkedService` was modified + +* `withAuthentication(java.lang.Object)` was added +* `authentication()` was added +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.FtpReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added +* `withUseBinaryTransfer(java.lang.Object)` was added + +#### `models.IntegrationRuntimeDataFlowProperties` was modified + +* `withCustomProperties(java.util.List)` was added +* `customProperties()` was added + +#### `models.DynamicsAXLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.FileServerReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.PrestoLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureMLBatchExecutionActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.AmazonRdsForOracleLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SetVariableActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withSetSystemVariable(java.lang.Boolean)` was added +* `withState(models.ActivityState)` was added +* `policy()` was added +* `setSystemVariable()` was added +* `withPolicy(models.SecureInputOutputPolicy)` was added + +#### `models.SalesforceLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.RestResourceDataset` was modified + +* `withPaginationRules(java.util.Map)` was added +* `withAdditionalHeaders(java.util.Map)` was added + +#### `models.SapBWLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ZohoLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SapTableLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.JiraLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureFileStorageLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.DataLakeAnalyticsUsqlActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.AmazonRdsForSqlServerSource` was modified + +* `withIsolationLevel(java.lang.Object)` was added +* `isolationLevel()` was added + +#### `models.AzureSqlDatabaseLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureSqlDWLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureMLExecutePipelineActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.DatabricksSparkJarActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.ShopifyLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.TeradataLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SparkLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.OracleServiceCloudLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureBlobStorageLinkedService` was modified + +* `withAccountKind(java.lang.Object)` was added +* `withServiceEndpoint(java.lang.Object)` was added + +#### `models.AzureDataLakeStoreLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ServiceNowLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureSearchLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ExecuteSsisPackageActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.UntilActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.DeleteActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.AzureMySqlLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SynapseSparkJobDefinitionActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.HubspotLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ControlActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.AmazonS3CompatibleReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.HDInsightPigActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.DynamicsLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.CassandraLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SftpReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.ODataLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.GoogleAdWordsLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.HDInsightLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureBlobStorageReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.RestServiceLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.CosmosDbLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added +* `withServicePrincipalCredentialType(java.lang.Object)` was added + +#### `models.AzureBlobFSLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SelfHostedIntegrationRuntime` was modified + +* `selfContainedInteractiveAuthoringEnabled()` was added +* `withSelfContainedInteractiveAuthoringEnabled(java.lang.Boolean)` was added + +#### `models.AmazonS3ReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.SqlServerSource` was modified + +* `withIsolationLevel(java.lang.Object)` was added +* `isolationLevel()` was added + +#### `models.SwitchActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.AzureDataLakeAnalyticsLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.HiveLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureDatabricksDeltaLakeLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.GoogleSheetsLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.EloquaLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureMLUpdateResourceActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.SqlDWSource` was modified + +* `withIsolationLevel(java.lang.Object)` was added +* `isolationLevel()` was added + +#### `models.AzureFunctionActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.ExecutePipelineActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.HDInsightHiveActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withVariables(java.util.Map)` was added + +#### `models.SapCloudForCustomerLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.GoogleCloudStorageLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.FailActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.OdbcLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.HdfsLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzurePostgreSqlLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureMLLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.OracleLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureFunctionLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.HdfsReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.AmazonS3CompatibleLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.PaypalLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SalesforceMarketingCloudLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AzureDatabricksLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SelfHostedIntegrationRuntimeStatus` was modified + +* `selfContainedInteractiveAuthoringEnabled()` was added + +#### `models.QuickbaseLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.MicrosoftAccessLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.DatabricksSparkPythonActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.AzureMariaDBLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ExecuteDataFlowActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.SqlServerLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AmazonRedshiftLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ResponsysLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ImpalaLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SftpServerLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.MySqlLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.HDInsightStreamingActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.PhoenixLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.Db2LinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.DynamicsCrmLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.LookupActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.FtpServerLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.QuickBooksLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SalesforceServiceCloudLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.GoogleCloudStorageReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.CouchbaseLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SharePointOnlineListLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AppendVariableActivity` was modified + +* `withState(models.ActivityState)` was added +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added + +#### `models.SybaseLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.HDInsightMapReduceActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.AmazonMwsLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.GoogleBigQueryLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.SqlServerStoredProcedureActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.AzureSqlSource` was modified + +* `isolationLevel()` was added +* `withIsolationLevel(java.lang.Object)` was added + +#### `models.DataworldLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.OracleCloudStorageReadSettings` was modified + +* `withEnablePartitionDiscovery(java.lang.Object)` was added + +#### `models.AzureDataExplorerCommandActivity` was modified + +* `withOnInactiveMarkAs(models.ActivityOnInactiveMarkAs)` was added +* `withState(models.ActivityState)` was added + +#### `models.AzureSqlMILinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.PipelineExternalComputeScaleProperties` was modified + +* `withNumberOfExternalNodes(java.lang.Integer)` was added +* `withNumberOfPipelineNodes(java.lang.Integer)` was added +* `numberOfPipelineNodes()` was added +* `numberOfExternalNodes()` was added + +#### `models.Office365LinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.AmazonRdsForSqlServerLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.ZendeskLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + +#### `models.MarketoLinkedService` was modified + +* `withEncryptedCredential(java.lang.String)` was added + ## 1.0.0-beta.22 (2023-03-13) - Azure Resource Manager DataFactory client library for Java. This package contains Microsoft Azure SDK for DataFactory Management SDK. The Azure Data Factory V2 management API provides a RESTful set of web services that interact with Azure Data Factory V2 services. Package tag package-2018-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/README.md b/sdk/datafactory/azure-resourcemanager-datafactory/README.md index aa491db959ff..82f638fd08ff 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/README.md +++ b/sdk/datafactory/azure-resourcemanager-datafactory/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-datafactory - 1.0.0-beta.22 + 1.0.0-beta.23 ``` [//]: # ({x-version-update-end}) @@ -190,3 +190,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fdatafactory%2Fazure-resourcemanager-datafactory%2FREADME.png) diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/SAMPLE.md b/sdk/datafactory/azure-resourcemanager-datafactory/SAMPLE.md index 9cdc7b270cf2..a926eb39e66f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/SAMPLE.md +++ b/sdk/datafactory/azure-resourcemanager-datafactory/SAMPLE.md @@ -5,6 +5,16 @@ - [QueryByPipelineRun](#activityruns_querybypipelinerun) +## ChangeDataCapture + +- [CreateOrUpdate](#changedatacapture_createorupdate) +- [Delete](#changedatacapture_delete) +- [Get](#changedatacapture_get) +- [ListByFactory](#changedatacapture_listbyfactory) +- [Start](#changedatacapture_start) +- [Status](#changedatacapture_status) +- [Stop](#changedatacapture_stop) + ## CredentialOperations - [CreateOrUpdate](#credentialoperations_createorupdate) @@ -193,6 +203,219 @@ public final class ActivityRunsQueryByPipelineRunSamples { } ``` +### ChangeDataCapture_CreateOrUpdate + +```java +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureResource; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import java.util.List; + +/** Samples for ChangeDataCapture CreateOrUpdate. */ +public final class ChangeDataCaptureCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Create.json + */ + /** + * Sample code: ChangeDataCapture_Create. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureCreate(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .define("exampleChangeDataCapture") + .withExistingFactory("exampleResourceGroup", "exampleFactoryName") + .withSourceConnectionsInfo((List) null) + .withTargetConnectionsInfo((List) null) + .withPolicy((MapperPolicy) null) + .withDescription( + "Sample demo change data capture to transfer data from delimited (csv) to Azure SQL Database with" + + " automapped and non-automapped mappings.") + .withAllowVNetOverride(false) + .create(); + } + + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Update.json + */ + /** + * Sample code: ChangeDataCapture_Update. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureUpdate(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + ChangeDataCaptureResource resource = + manager + .changeDataCaptures() + .getWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + null, + com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withDescription( + "Sample demo change data capture to transfer data from delimited (csv) to Azure SQL Database. Updating" + + " table mappings.") + .withAllowVNetOverride(false) + .withStatus("Stopped") + .apply(); + } +} +``` + +### ChangeDataCapture_Delete + +```java +/** Samples for ChangeDataCapture Delete. */ +public final class ChangeDataCaptureDeleteSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Delete.json + */ + /** + * Sample code: ChangeDataCapture_Delete. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureDelete(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .deleteWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + com.azure.core.util.Context.NONE); + } +} +``` + +### ChangeDataCapture_Get + +```java +/** Samples for ChangeDataCapture Get. */ +public final class ChangeDataCaptureGetSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Get.json + */ + /** + * Sample code: ChangeDataCapture_Get. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureGet(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .getWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### ChangeDataCapture_ListByFactory + +```java +/** Samples for ChangeDataCapture ListByFactory. */ +public final class ChangeDataCaptureListByFactorySamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_ListByFactory.json + */ + /** + * Sample code: ChangeDataCapture_ListByFactory. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureListByFactory( + com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .listByFactory("exampleResourceGroup", "exampleFactoryName", com.azure.core.util.Context.NONE); + } +} +``` + +### ChangeDataCapture_Start + +```java +/** Samples for ChangeDataCapture Start. */ +public final class ChangeDataCaptureStartSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Start.json + */ + /** + * Sample code: ChangeDataCapture_Start. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureStart(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .startWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + com.azure.core.util.Context.NONE); + } +} +``` + +### ChangeDataCapture_Status + +```java +/** Samples for ChangeDataCapture Status. */ +public final class ChangeDataCaptureStatusSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Status.json + */ + /** + * Sample code: ChangeDataCapture_Start. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureStart(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .statusWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + com.azure.core.util.Context.NONE); + } +} +``` + +### ChangeDataCapture_Stop + +```java +/** Samples for ChangeDataCapture Stop. */ +public final class ChangeDataCaptureStopSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Stop.json + */ + /** + * Sample code: ChangeDataCapture_Stop. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureStop(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .stopWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + com.azure.core.util.Context.NONE); + } +} +``` + ### CredentialOperations_CreateOrUpdate ```java @@ -415,6 +638,7 @@ public final class DataFlowDebugSessionAddDataFlowSamples { com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -476,6 +700,7 @@ public final class DataFlowDebugSessionCreateSamples { com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -900,6 +1125,7 @@ public final class DatasetsCreateOrUpdateSamples { .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -1309,6 +1535,7 @@ public final class FactoriesUpdateSamples { resource.update().withTags(mapOf("exampleTag", "exampleValue")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -2223,6 +2450,7 @@ public final class ManagedPrivateEndpointsCreateOrUpdateSamples { .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -2341,6 +2569,7 @@ public final class ManagedVirtualNetworksCreateOrUpdateSamples { .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -2688,6 +2917,7 @@ public final class PipelinesCreateOrUpdateSamples { .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -2740,6 +2970,7 @@ public final class PipelinesCreateRunSamples { com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -3154,6 +3385,7 @@ public final class TriggersCreateOrUpdateSamples { .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/pom.xml b/sdk/datafactory/azure-resourcemanager-datafactory/pom.xml index 77e969c462a3..a84bae8cc105 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/pom.xml +++ b/sdk/datafactory/azure-resourcemanager-datafactory/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-datafactory - 1.0.0-beta.23 + 1.0.0-beta.24 jar Microsoft Azure SDK for DataFactory Management @@ -45,6 +45,7 @@ UTF-8 0 0 + true @@ -102,7 +103,7 @@ com.azure azure-storage-blob - 12.23.1 + 12.24.0 test diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/DataFactoryManager.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/DataFactoryManager.java index 7e65231d4a17..1770cebf8f91 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/DataFactoryManager.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/DataFactoryManager.java @@ -25,6 +25,7 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.datafactory.fluent.DataFactoryManagementClient; import com.azure.resourcemanager.datafactory.implementation.ActivityRunsImpl; +import com.azure.resourcemanager.datafactory.implementation.ChangeDataCapturesImpl; import com.azure.resourcemanager.datafactory.implementation.CredentialOperationsImpl; import com.azure.resourcemanager.datafactory.implementation.DataFactoryManagementClientBuilder; import com.azure.resourcemanager.datafactory.implementation.DataFlowDebugSessionsImpl; @@ -48,6 +49,7 @@ import com.azure.resourcemanager.datafactory.implementation.TriggerRunsImpl; import com.azure.resourcemanager.datafactory.implementation.TriggersImpl; import com.azure.resourcemanager.datafactory.models.ActivityRuns; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptures; import com.azure.resourcemanager.datafactory.models.CredentialOperations; import com.azure.resourcemanager.datafactory.models.DataFlowDebugSessions; import com.azure.resourcemanager.datafactory.models.DataFlows; @@ -125,6 +127,8 @@ public final class DataFactoryManager { private GlobalParameters globalParameters; + private ChangeDataCaptures changeDataCaptures; + private final DataFactoryManagementClient clientObject; private DataFactoryManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -290,7 +294,7 @@ public DataFactoryManager authenticate(TokenCredential credential, AzureProfile .append("-") .append("com.azure.resourcemanager.datafactory") .append("/") - .append("1.0.0-beta.22"); + .append("1.0.0-beta.23"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -620,8 +624,22 @@ public GlobalParameters globalParameters() { } /** - * @return Wrapped service client DataFactoryManagementClient providing direct access to the underlying - * auto-generated API implementation, based on Azure REST API. + * Gets the resource collection API of ChangeDataCaptures. It manages ChangeDataCaptureResource. + * + * @return Resource collection API of ChangeDataCaptures. + */ + public ChangeDataCaptures changeDataCaptures() { + if (this.changeDataCaptures == null) { + this.changeDataCaptures = new ChangeDataCapturesImpl(clientObject.getChangeDataCaptures(), this); + } + return changeDataCaptures; + } + + /** + * Gets wrapped service client DataFactoryManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client DataFactoryManagementClient. */ public DataFactoryManagementClient serviceClient() { return this.clientObject; diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/ChangeDataCapturesClient.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/ChangeDataCapturesClient.java new file mode 100644 index 000000000000..2feeec884344 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/ChangeDataCapturesClient.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCaptureResourceInner; + +/** An instance of this class provides access to all the operations defined in ChangeDataCapturesClient. */ +public interface ChangeDataCapturesClient { + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFactory(String resourceGroupName, String factoryName); + + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFactory( + String resourceGroupName, String factoryName, Context context); + + /** + * Creates or updates a change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param changeDataCapture Change data capture resource definition. + * @param ifMatch ETag of the change data capture entity. Should only be specified for update, for which it should + * match existing entity or can be * for unconditional update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change data capture resource type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + ChangeDataCaptureResourceInner changeDataCapture, + String ifMatch, + Context context); + + /** + * Creates or updates a change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param changeDataCapture Change data capture resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change data capture resource type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChangeDataCaptureResourceInner createOrUpdate( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + ChangeDataCaptureResourceInner changeDataCapture); + + /** + * Gets a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param ifNoneMatch ETag of the change data capture entity. Should only be specified for get. If the ETag matches + * the existing entity tag, or if * was provided, then no content will be returned. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + String ifNoneMatch, + Context context); + + /** + * Gets a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChangeDataCaptureResourceInner get(String resourceGroupName, String factoryName, String changeDataCaptureName); + + /** + * Deletes a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context); + + /** + * Deletes a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String factoryName, String changeDataCaptureName); + + /** + * Starts a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response startWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context); + + /** + * Starts a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String factoryName, String changeDataCaptureName); + + /** + * Stops a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response stopWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context); + + /** + * Stops a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String factoryName, String changeDataCaptureName); + + /** + * Gets the current status for the change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status for the change data capture resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response statusWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context); + + /** + * Gets the current status for the change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status for the change data capture resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + String status(String resourceGroupName, String factoryName, String changeDataCaptureName); +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/DataFactoryManagementClient.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/DataFactoryManagementClient.java index 81c1344f83a8..68f0c744135e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/DataFactoryManagementClient.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/DataFactoryManagementClient.java @@ -197,4 +197,11 @@ public interface DataFactoryManagementClient { * @return the GlobalParametersClient object. */ GlobalParametersClient getGlobalParameters(); + + /** + * Gets the ChangeDataCapturesClient object to access its operations. + * + * @return the ChangeDataCapturesClient object. + */ + ChangeDataCapturesClient getChangeDataCaptures(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonMwsLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonMwsLinkedServiceTypeProperties.java index f8d211c4d9ca..c0c4b704e009 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonMwsLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonMwsLinkedServiceTypeProperties.java @@ -70,10 +70,10 @@ public final class AmazonMwsLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AmazonMwsLinkedServiceTypeProperties class. */ public AmazonMwsLinkedServiceTypeProperties() { @@ -269,22 +269,22 @@ public AmazonMwsLinkedServiceTypeProperties withUsePeerVerification(Object usePe /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonMwsLinkedServiceTypeProperties object itself. */ - public AmazonMwsLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AmazonMwsLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRdsForLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRdsForLinkedServiceTypeProperties.java index db60e883ee4b..5cea4c510b29 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRdsForLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRdsForLinkedServiceTypeProperties.java @@ -26,10 +26,10 @@ public final class AmazonRdsForLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AmazonRdsForLinkedServiceTypeProperties class. */ public AmazonRdsForLinkedServiceTypeProperties() { @@ -79,22 +79,22 @@ public AmazonRdsForLinkedServiceTypeProperties withPassword(SecretBase password) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonRdsForLinkedServiceTypeProperties object itself. */ - public AmazonRdsForLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AmazonRdsForLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRdsForSqlServerLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRdsForSqlServerLinkedServiceTypeProperties.java index e501595efe80..f49cc3494026 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRdsForSqlServerLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRdsForSqlServerLinkedServiceTypeProperties.java @@ -33,10 +33,10 @@ public final class AmazonRdsForSqlServerLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * Sql always encrypted properties. @@ -114,22 +114,22 @@ public AmazonRdsForSqlServerLinkedServiceTypeProperties withPassword(SecretBase /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonRdsForSqlServerLinkedServiceTypeProperties object itself. */ - public AmazonRdsForSqlServerLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AmazonRdsForSqlServerLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRedshiftLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRedshiftLinkedServiceTypeProperties.java index 283ef049ba93..7cd59e39c3d5 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRedshiftLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonRedshiftLinkedServiceTypeProperties.java @@ -45,10 +45,10 @@ public final class AmazonRedshiftLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AmazonRedshiftLinkedServiceTypeProperties class. */ public AmazonRedshiftLinkedServiceTypeProperties() { @@ -164,22 +164,22 @@ public AmazonRedshiftLinkedServiceTypeProperties withPort(Object port) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonRedshiftLinkedServiceTypeProperties object itself. */ - public AmazonRedshiftLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AmazonRedshiftLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonS3CompatibleLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonS3CompatibleLinkedServiceTypeProperties.java index ccb1140a0506..fd7462071649 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonS3CompatibleLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonS3CompatibleLinkedServiceTypeProperties.java @@ -41,10 +41,10 @@ public final class AmazonS3CompatibleLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AmazonS3CompatibleLinkedServiceTypeProperties class. */ public AmazonS3CompatibleLinkedServiceTypeProperties() { @@ -142,22 +142,22 @@ public AmazonS3CompatibleLinkedServiceTypeProperties withForcePathStyle(Object f /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonS3CompatibleLinkedServiceTypeProperties object itself. */ - public AmazonS3CompatibleLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AmazonS3CompatibleLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonS3LinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonS3LinkedServiceTypeProperties.java index e76fe88ced28..9c745124bda6 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonS3LinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AmazonS3LinkedServiceTypeProperties.java @@ -47,10 +47,10 @@ public final class AmazonS3LinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AmazonS3LinkedServiceTypeProperties class. */ public AmazonS3LinkedServiceTypeProperties() { @@ -168,22 +168,22 @@ public AmazonS3LinkedServiceTypeProperties withSessionToken(SecretBase sessionTo /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonS3LinkedServiceTypeProperties object itself. */ - public AmazonS3LinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AmazonS3LinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AppFiguresLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AppFiguresLinkedServiceTypeProperties.java index a2f3ba3b655a..a38c19e5840f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AppFiguresLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AppFiguresLinkedServiceTypeProperties.java @@ -13,7 +13,7 @@ @Fluent public final class AppFiguresLinkedServiceTypeProperties { /* - * The username of the Appfigures source. + * The username of the Appfigures source. Type: string (or Expression with resultType string). */ @JsonProperty(value = "userName", required = true) private Object username; @@ -35,7 +35,8 @@ public AppFiguresLinkedServiceTypeProperties() { } /** - * Get the username property: The username of the Appfigures source. + * Get the username property: The username of the Appfigures source. Type: string (or Expression with resultType + * string). * * @return the username value. */ @@ -44,7 +45,8 @@ public Object username() { } /** - * Set the username property: The username of the Appfigures source. + * Set the username property: The username of the Appfigures source. Type: string (or Expression with resultType + * string). * * @param username the username value to set. * @return the AppFiguresLinkedServiceTypeProperties object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AppendVariableActivityTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AppendVariableActivityTypeProperties.java index cc6a315f58f0..9316a34ce323 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AppendVariableActivityTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AppendVariableActivityTypeProperties.java @@ -17,7 +17,8 @@ public final class AppendVariableActivityTypeProperties { private String variableName; /* - * Value to be appended. Could be a static value or Expression + * Value to be appended. Type: could be a static value matching type of the variable item or Expression with + * resultType matching type of the variable item */ @JsonProperty(value = "value") private Object value; @@ -47,7 +48,8 @@ public AppendVariableActivityTypeProperties withVariableName(String variableName } /** - * Get the value property: Value to be appended. Could be a static value or Expression. + * Get the value property: Value to be appended. Type: could be a static value matching type of the variable item or + * Expression with resultType matching type of the variable item. * * @return the value value. */ @@ -56,7 +58,8 @@ public Object value() { } /** - * Set the value property: Value to be appended. Could be a static value or Expression. + * Set the value property: Value to be appended. Type: could be a static value matching type of the variable item or + * Expression with resultType matching type of the variable item. * * @param value the value value to set. * @return the AppendVariableActivityTypeProperties object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AsanaLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AsanaLinkedServiceTypeProperties.java index 2bc9e49c9d2c..961118a2f770 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AsanaLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AsanaLinkedServiceTypeProperties.java @@ -20,10 +20,10 @@ public final class AsanaLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AsanaLinkedServiceTypeProperties class. */ public AsanaLinkedServiceTypeProperties() { @@ -51,22 +51,22 @@ public AsanaLinkedServiceTypeProperties withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AsanaLinkedServiceTypeProperties object itself. */ - public AsanaLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AsanaLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBatchLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBatchLinkedServiceTypeProperties.java index 246859f824a5..ab229487d55c 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBatchLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBatchLinkedServiceTypeProperties.java @@ -46,10 +46,10 @@ public final class AzureBatchLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The credential reference containing authentication information. @@ -163,22 +163,22 @@ public AzureBatchLinkedServiceTypeProperties withLinkedServiceName(LinkedService /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureBatchLinkedServiceTypeProperties object itself. */ - public AzureBatchLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureBatchLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBlobFSLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBlobFSLinkedServiceTypeProperties.java index 3343f657b628..ec81a65fb5b7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBlobFSLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBlobFSLinkedServiceTypeProperties.java @@ -54,10 +54,10 @@ public final class AzureBlobFSLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The credential reference containing authentication information. @@ -233,22 +233,22 @@ public AzureBlobFSLinkedServiceTypeProperties withAzureCloudType(Object azureClo /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureBlobFSLinkedServiceTypeProperties object itself. */ - public AzureBlobFSLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureBlobFSLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBlobStorageLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBlobStorageLinkedServiceTypeProperties.java index 02150fcc15e8..a720c61d3a2b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBlobStorageLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureBlobStorageLinkedServiceTypeProperties.java @@ -45,7 +45,7 @@ public final class AzureBlobStorageLinkedServiceTypeProperties { * property. */ @JsonProperty(value = "serviceEndpoint") - private String serviceEndpoint; + private Object serviceEndpoint; /* * The ID of the service principal used to authenticate against Azure SQL Data Warehouse. Type: string (or @@ -80,11 +80,11 @@ public final class AzureBlobStorageLinkedServiceTypeProperties { * purpose v2), BlobStorage, or BlockBlobStorage. Type: string (or Expression with resultType string). */ @JsonProperty(value = "accountKind") - private String accountKind; + private Object accountKind; /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") private String encryptedCredential; @@ -202,7 +202,7 @@ public AzureBlobStorageLinkedServiceTypeProperties withSasToken(AzureKeyVaultSec * * @return the serviceEndpoint value. */ - public String serviceEndpoint() { + public Object serviceEndpoint() { return this.serviceEndpoint; } @@ -213,7 +213,7 @@ public String serviceEndpoint() { * @param serviceEndpoint the serviceEndpoint value to set. * @return the AzureBlobStorageLinkedServiceTypeProperties object itself. */ - public AzureBlobStorageLinkedServiceTypeProperties withServiceEndpoint(String serviceEndpoint) { + public AzureBlobStorageLinkedServiceTypeProperties withServiceEndpoint(Object serviceEndpoint) { this.serviceEndpoint = serviceEndpoint; return this; } @@ -315,7 +315,7 @@ public AzureBlobStorageLinkedServiceTypeProperties withAzureCloudType(Object azu * * @return the accountKind value. */ - public String accountKind() { + public Object accountKind() { return this.accountKind; } @@ -327,14 +327,14 @@ public String accountKind() { * @param accountKind the accountKind value to set. * @return the AzureBlobStorageLinkedServiceTypeProperties object itself. */ - public AzureBlobStorageLinkedServiceTypeProperties withAccountKind(String accountKind) { + public AzureBlobStorageLinkedServiceTypeProperties withAccountKind(Object accountKind) { this.accountKind = accountKind; return this; } /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ @@ -344,7 +344,7 @@ public String encryptedCredential() { /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureBlobStorageLinkedServiceTypeProperties object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDataLakeAnalyticsLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDataLakeAnalyticsLinkedServiceTypeProperties.java index baf377c54110..b368d52a0868 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDataLakeAnalyticsLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDataLakeAnalyticsLinkedServiceTypeProperties.java @@ -60,10 +60,10 @@ public final class AzureDataLakeAnalyticsLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AzureDataLakeAnalyticsLinkedServiceTypeProperties class. */ public AzureDataLakeAnalyticsLinkedServiceTypeProperties() { @@ -225,22 +225,22 @@ public AzureDataLakeAnalyticsLinkedServiceTypeProperties withDataLakeAnalyticsUr /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureDataLakeAnalyticsLinkedServiceTypeProperties object itself. */ - public AzureDataLakeAnalyticsLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureDataLakeAnalyticsLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDataLakeStoreLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDataLakeStoreLinkedServiceTypeProperties.java index f44fa62d84e6..1f5e437cfa22 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDataLakeStoreLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDataLakeStoreLinkedServiceTypeProperties.java @@ -69,10 +69,10 @@ public final class AzureDataLakeStoreLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The credential reference containing authentication information. @@ -262,22 +262,22 @@ public AzureDataLakeStoreLinkedServiceTypeProperties withResourceGroupName(Objec /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureDataLakeStoreLinkedServiceTypeProperties object itself. */ - public AzureDataLakeStoreLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureDataLakeStoreLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDatabricksDetltaLakeLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDatabricksDetltaLakeLinkedServiceTypeProperties.java index 39aacf8a8a33..fed3447c0861 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDatabricksDetltaLakeLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDatabricksDetltaLakeLinkedServiceTypeProperties.java @@ -36,10 +36,10 @@ public final class AzureDatabricksDetltaLakeLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The credential reference containing authentication information. @@ -127,22 +127,22 @@ public AzureDatabricksDetltaLakeLinkedServiceTypeProperties withClusterId(Object /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureDatabricksDetltaLakeLinkedServiceTypeProperties object itself. */ - public AzureDatabricksDetltaLakeLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureDatabricksDetltaLakeLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDatabricksLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDatabricksLinkedServiceTypeProperties.java index 4616712a2e60..e4aaeb3ce15c 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDatabricksLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureDatabricksLinkedServiceTypeProperties.java @@ -134,10 +134,10 @@ public final class AzureDatabricksLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The policy id for limiting the ability to configure clusters based on a user defined set of rules. Type: string @@ -525,22 +525,22 @@ public AzureDatabricksLinkedServiceTypeProperties withNewClusterEnableElasticDis /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureDatabricksLinkedServiceTypeProperties object itself. */ - public AzureDatabricksLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureDatabricksLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureFileStorageLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureFileStorageLinkedServiceTypeProperties.java index 7d89b84b379f..cb121c3c6224 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureFileStorageLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureFileStorageLinkedServiceTypeProperties.java @@ -71,10 +71,10 @@ public final class AzureFileStorageLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AzureFileStorageLinkedServiceTypeProperties class. */ public AzureFileStorageLinkedServiceTypeProperties() { @@ -270,22 +270,22 @@ public AzureFileStorageLinkedServiceTypeProperties withSnapshot(Object snapshot) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureFileStorageLinkedServiceTypeProperties object itself. */ - public AzureFileStorageLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureFileStorageLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureFunctionLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureFunctionLinkedServiceTypeProperties.java index de5e33992085..c9516c5cc352 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureFunctionLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureFunctionLinkedServiceTypeProperties.java @@ -27,10 +27,10 @@ public final class AzureFunctionLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The credential reference containing authentication information. @@ -99,22 +99,22 @@ public AzureFunctionLinkedServiceTypeProperties withFunctionKey(SecretBase funct /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureFunctionLinkedServiceTypeProperties object itself. */ - public AzureFunctionLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureFunctionLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMLLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMLLinkedServiceTypeProperties.java index 43f2a4c398b0..214c8d62ab12 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMLLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMLLinkedServiceTypeProperties.java @@ -55,10 +55,10 @@ public final class AzureMLLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * Type of authentication (Required to specify MSI) used to connect to AzureML. Type: string (or Expression with @@ -203,22 +203,22 @@ public AzureMLLinkedServiceTypeProperties withTenant(Object tenant) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureMLLinkedServiceTypeProperties object itself. */ - public AzureMLLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureMLLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMLServiceLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMLServiceLinkedServiceTypeProperties.java index 063f95bd4fc6..2bc1f5a791fb 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMLServiceLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMLServiceLinkedServiceTypeProperties.java @@ -30,6 +30,13 @@ public final class AzureMLServiceLinkedServiceTypeProperties { @JsonProperty(value = "mlWorkspaceName", required = true) private Object mlWorkspaceName; + /* + * Type of authentication (Required to specify MSI) used to connect to AzureML. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "authentication") + private Object authentication; + /* * The ID of the service principal used to authenticate against the endpoint of a published Azure ML Service * pipeline. Type: string (or Expression with resultType string). @@ -53,10 +60,10 @@ public final class AzureMLServiceLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AzureMLServiceLinkedServiceTypeProperties class. */ public AzureMLServiceLinkedServiceTypeProperties() { @@ -128,6 +135,28 @@ public AzureMLServiceLinkedServiceTypeProperties withMlWorkspaceName(Object mlWo return this; } + /** + * Get the authentication property: Type of authentication (Required to specify MSI) used to connect to AzureML. + * Type: string (or Expression with resultType string). + * + * @return the authentication value. + */ + public Object authentication() { + return this.authentication; + } + + /** + * Set the authentication property: Type of authentication (Required to specify MSI) used to connect to AzureML. + * Type: string (or Expression with resultType string). + * + * @param authentication the authentication value to set. + * @return the AzureMLServiceLinkedServiceTypeProperties object itself. + */ + public AzureMLServiceLinkedServiceTypeProperties withAuthentication(Object authentication) { + this.authentication = authentication; + return this; + } + /** * Get the servicePrincipalId property: The ID of the service principal used to authenticate against the endpoint of * a published Azure ML Service pipeline. Type: string (or Expression with resultType string). @@ -196,22 +225,22 @@ public AzureMLServiceLinkedServiceTypeProperties withTenant(Object tenant) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureMLServiceLinkedServiceTypeProperties object itself. */ - public AzureMLServiceLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureMLServiceLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMariaDBLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMariaDBLinkedServiceTypeProperties.java index 4a1852e2908c..62be12e87f4a 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMariaDBLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMariaDBLinkedServiceTypeProperties.java @@ -25,10 +25,10 @@ public final class AzureMariaDBLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AzureMariaDBLinkedServiceTypeProperties class. */ public AzureMariaDBLinkedServiceTypeProperties() { @@ -78,22 +78,22 @@ public AzureMariaDBLinkedServiceTypeProperties withPwd(AzureKeyVaultSecretRefere /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureMariaDBLinkedServiceTypeProperties object itself. */ - public AzureMariaDBLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureMariaDBLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMySqlLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMySqlLinkedServiceTypeProperties.java index db52689f40fe..e83a66ce9511 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMySqlLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureMySqlLinkedServiceTypeProperties.java @@ -26,10 +26,10 @@ public final class AzureMySqlLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AzureMySqlLinkedServiceTypeProperties class. */ public AzureMySqlLinkedServiceTypeProperties() { @@ -79,22 +79,22 @@ public AzureMySqlLinkedServiceTypeProperties withPassword(AzureKeyVaultSecretRef /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureMySqlLinkedServiceTypeProperties object itself. */ - public AzureMySqlLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureMySqlLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzurePostgreSqlLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzurePostgreSqlLinkedServiceTypeProperties.java index 9889525ca23f..e67a616a7984 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzurePostgreSqlLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzurePostgreSqlLinkedServiceTypeProperties.java @@ -25,10 +25,10 @@ public final class AzurePostgreSqlLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AzurePostgreSqlLinkedServiceTypeProperties class. */ public AzurePostgreSqlLinkedServiceTypeProperties() { @@ -78,22 +78,22 @@ public AzurePostgreSqlLinkedServiceTypeProperties withPassword(AzureKeyVaultSecr /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzurePostgreSqlLinkedServiceTypeProperties object itself. */ - public AzurePostgreSqlLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzurePostgreSqlLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSearchLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSearchLinkedServiceTypeProperties.java index 29c4b8aa17e2..b28a6bf4fc7d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSearchLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSearchLinkedServiceTypeProperties.java @@ -26,10 +26,10 @@ public final class AzureSearchLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of AzureSearchLinkedServiceTypeProperties class. */ public AzureSearchLinkedServiceTypeProperties() { @@ -77,22 +77,22 @@ public AzureSearchLinkedServiceTypeProperties withKey(SecretBase key) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureSearchLinkedServiceTypeProperties object itself. */ - public AzureSearchLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureSearchLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlDWLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlDWLinkedServiceTypeProperties.java index f43e9e9e4956..8ffafa61b619 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlDWLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlDWLinkedServiceTypeProperties.java @@ -57,10 +57,10 @@ public final class AzureSqlDWLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The credential reference containing authentication information. @@ -206,22 +206,22 @@ public AzureSqlDWLinkedServiceTypeProperties withAzureCloudType(Object azureClou /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureSqlDWLinkedServiceTypeProperties object itself. */ - public AzureSqlDWLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureSqlDWLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlDatabaseLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlDatabaseLinkedServiceTypeProperties.java index b1fe2ef8e6b2..e43b8db62efa 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlDatabaseLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlDatabaseLinkedServiceTypeProperties.java @@ -57,10 +57,10 @@ public final class AzureSqlDatabaseLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * Sql always encrypted properties. @@ -212,22 +212,22 @@ public AzureSqlDatabaseLinkedServiceTypeProperties withAzureCloudType(Object azu /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureSqlDatabaseLinkedServiceTypeProperties object itself. */ - public AzureSqlDatabaseLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureSqlDatabaseLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlMILinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlMILinkedServiceTypeProperties.java index 7eeb3adacab1..55a7d9bb0122 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlMILinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureSqlMILinkedServiceTypeProperties.java @@ -57,10 +57,10 @@ public final class AzureSqlMILinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * Sql always encrypted properties. @@ -212,22 +212,22 @@ public AzureSqlMILinkedServiceTypeProperties withAzureCloudType(Object azureClou /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureSqlMILinkedServiceTypeProperties object itself. */ - public AzureSqlMILinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public AzureSqlMILinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureStorageLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureStorageLinkedServiceTypeProperties.java index 6f4302376327..48df5bc68398 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureStorageLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/AzureStorageLinkedServiceTypeProperties.java @@ -39,7 +39,7 @@ public final class AzureStorageLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") private String encryptedCredential; @@ -134,7 +134,7 @@ public AzureStorageLinkedServiceTypeProperties withSasToken(AzureKeyVaultSecretR /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ @@ -144,7 +144,7 @@ public String encryptedCredential() { /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureStorageLinkedServiceTypeProperties object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CassandraLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CassandraLinkedServiceTypeProperties.java index 611b1a2050f1..1b3c4658b017 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CassandraLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CassandraLinkedServiceTypeProperties.java @@ -44,10 +44,10 @@ public final class CassandraLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of CassandraLinkedServiceTypeProperties class. */ public CassandraLinkedServiceTypeProperties() { @@ -157,22 +157,22 @@ public CassandraLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the CassandraLinkedServiceTypeProperties object itself. */ - public CassandraLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public CassandraLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ChangeDataCapture.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ChangeDataCapture.java new file mode 100644 index 000000000000..3b4be7105eee --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ChangeDataCapture.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureFolder; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A Azure Data Factory object which automatically detects data changes at the source and then sends the updated data to + * the destination. + */ +@Fluent +public final class ChangeDataCapture { + /* + * The folder that this CDC is in. If not specified, CDC will appear at the root level. + */ + @JsonProperty(value = "folder") + private ChangeDataCaptureFolder folder; + + /* + * The description of the change data capture. + */ + @JsonProperty(value = "description") + private String description; + + /* + * List of sources connections that can be used as sources in the CDC. + */ + @JsonProperty(value = "sourceConnectionsInfo", required = true) + private List sourceConnectionsInfo; + + /* + * List of target connections that can be used as sources in the CDC. + */ + @JsonProperty(value = "targetConnectionsInfo", required = true) + private List targetConnectionsInfo; + + /* + * CDC policy + */ + @JsonProperty(value = "policy", required = true) + private MapperPolicy policy; + + /* + * A boolean to determine if the vnet configuration needs to be overwritten. + */ + @JsonProperty(value = "allowVNetOverride") + private Boolean allowVNetOverride; + + /* + * Status of the CDC as to if it is running or stopped. + */ + @JsonProperty(value = "status") + private String status; + + /** Creates an instance of ChangeDataCapture class. */ + public ChangeDataCapture() { + } + + /** + * Get the folder property: The folder that this CDC is in. If not specified, CDC will appear at the root level. + * + * @return the folder value. + */ + public ChangeDataCaptureFolder folder() { + return this.folder; + } + + /** + * Set the folder property: The folder that this CDC is in. If not specified, CDC will appear at the root level. + * + * @param folder the folder value to set. + * @return the ChangeDataCapture object itself. + */ + public ChangeDataCapture withFolder(ChangeDataCaptureFolder folder) { + this.folder = folder; + return this; + } + + /** + * Get the description property: The description of the change data capture. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the change data capture. + * + * @param description the description value to set. + * @return the ChangeDataCapture object itself. + */ + public ChangeDataCapture withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the sourceConnectionsInfo property: List of sources connections that can be used as sources in the CDC. + * + * @return the sourceConnectionsInfo value. + */ + public List sourceConnectionsInfo() { + return this.sourceConnectionsInfo; + } + + /** + * Set the sourceConnectionsInfo property: List of sources connections that can be used as sources in the CDC. + * + * @param sourceConnectionsInfo the sourceConnectionsInfo value to set. + * @return the ChangeDataCapture object itself. + */ + public ChangeDataCapture withSourceConnectionsInfo(List sourceConnectionsInfo) { + this.sourceConnectionsInfo = sourceConnectionsInfo; + return this; + } + + /** + * Get the targetConnectionsInfo property: List of target connections that can be used as sources in the CDC. + * + * @return the targetConnectionsInfo value. + */ + public List targetConnectionsInfo() { + return this.targetConnectionsInfo; + } + + /** + * Set the targetConnectionsInfo property: List of target connections that can be used as sources in the CDC. + * + * @param targetConnectionsInfo the targetConnectionsInfo value to set. + * @return the ChangeDataCapture object itself. + */ + public ChangeDataCapture withTargetConnectionsInfo(List targetConnectionsInfo) { + this.targetConnectionsInfo = targetConnectionsInfo; + return this; + } + + /** + * Get the policy property: CDC policy. + * + * @return the policy value. + */ + public MapperPolicy policy() { + return this.policy; + } + + /** + * Set the policy property: CDC policy. + * + * @param policy the policy value to set. + * @return the ChangeDataCapture object itself. + */ + public ChangeDataCapture withPolicy(MapperPolicy policy) { + this.policy = policy; + return this; + } + + /** + * Get the allowVNetOverride property: A boolean to determine if the vnet configuration needs to be overwritten. + * + * @return the allowVNetOverride value. + */ + public Boolean allowVNetOverride() { + return this.allowVNetOverride; + } + + /** + * Set the allowVNetOverride property: A boolean to determine if the vnet configuration needs to be overwritten. + * + * @param allowVNetOverride the allowVNetOverride value to set. + * @return the ChangeDataCapture object itself. + */ + public ChangeDataCapture withAllowVNetOverride(Boolean allowVNetOverride) { + this.allowVNetOverride = allowVNetOverride; + return this; + } + + /** + * Get the status property: Status of the CDC as to if it is running or stopped. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Status of the CDC as to if it is running or stopped. + * + * @param status the status value to set. + * @return the ChangeDataCapture object itself. + */ + public ChangeDataCapture withStatus(String status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (folder() != null) { + folder().validate(); + } + if (sourceConnectionsInfo() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceConnectionsInfo in model ChangeDataCapture")); + } else { + sourceConnectionsInfo().forEach(e -> e.validate()); + } + if (targetConnectionsInfo() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetConnectionsInfo in model ChangeDataCapture")); + } else { + targetConnectionsInfo().forEach(e -> e.validate()); + } + if (policy() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property policy in model ChangeDataCapture")); + } else { + policy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ChangeDataCapture.class); +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ChangeDataCaptureResourceInner.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ChangeDataCaptureResourceInner.java new file mode 100644 index 000000000000..46e9695cf8c7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ChangeDataCaptureResourceInner.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureFolder; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** Change data capture resource type. */ +@Fluent +public final class ChangeDataCaptureResourceInner extends SubResource { + /* + * Properties of the change data capture. + */ + @JsonProperty(value = "properties", required = true) + private ChangeDataCapture innerProperties = new ChangeDataCapture(); + + /* + * The resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Etag identifies change in the resource. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Change data capture resource type. + */ + @JsonIgnore private Map additionalProperties; + + /** Creates an instance of ChangeDataCaptureResourceInner class. */ + public ChangeDataCaptureResourceInner() { + } + + /** + * Get the innerProperties property: Properties of the change data capture. + * + * @return the innerProperties value. + */ + private ChangeDataCapture innerProperties() { + return this.innerProperties; + } + + /** + * Get the name property: The resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the etag property: Etag identifies change in the resource. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the additionalProperties property: Change data capture resource type. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Change data capture resource type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ChangeDataCaptureResourceInner object itself. + */ + public ChangeDataCaptureResourceInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** {@inheritDoc} */ + @Override + public ChangeDataCaptureResourceInner withId(String id) { + super.withId(id); + return this; + } + + /** + * Get the folder property: The folder that this CDC is in. If not specified, CDC will appear at the root level. + * + * @return the folder value. + */ + public ChangeDataCaptureFolder folder() { + return this.innerProperties() == null ? null : this.innerProperties().folder(); + } + + /** + * Set the folder property: The folder that this CDC is in. If not specified, CDC will appear at the root level. + * + * @param folder the folder value to set. + * @return the ChangeDataCaptureResourceInner object itself. + */ + public ChangeDataCaptureResourceInner withFolder(ChangeDataCaptureFolder folder) { + if (this.innerProperties() == null) { + this.innerProperties = new ChangeDataCapture(); + } + this.innerProperties().withFolder(folder); + return this; + } + + /** + * Get the description property: The description of the change data capture. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the change data capture. + * + * @param description the description value to set. + * @return the ChangeDataCaptureResourceInner object itself. + */ + public ChangeDataCaptureResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ChangeDataCapture(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the sourceConnectionsInfo property: List of sources connections that can be used as sources in the CDC. + * + * @return the sourceConnectionsInfo value. + */ + public List sourceConnectionsInfo() { + return this.innerProperties() == null ? null : this.innerProperties().sourceConnectionsInfo(); + } + + /** + * Set the sourceConnectionsInfo property: List of sources connections that can be used as sources in the CDC. + * + * @param sourceConnectionsInfo the sourceConnectionsInfo value to set. + * @return the ChangeDataCaptureResourceInner object itself. + */ + public ChangeDataCaptureResourceInner withSourceConnectionsInfo( + List sourceConnectionsInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new ChangeDataCapture(); + } + this.innerProperties().withSourceConnectionsInfo(sourceConnectionsInfo); + return this; + } + + /** + * Get the targetConnectionsInfo property: List of target connections that can be used as sources in the CDC. + * + * @return the targetConnectionsInfo value. + */ + public List targetConnectionsInfo() { + return this.innerProperties() == null ? null : this.innerProperties().targetConnectionsInfo(); + } + + /** + * Set the targetConnectionsInfo property: List of target connections that can be used as sources in the CDC. + * + * @param targetConnectionsInfo the targetConnectionsInfo value to set. + * @return the ChangeDataCaptureResourceInner object itself. + */ + public ChangeDataCaptureResourceInner withTargetConnectionsInfo( + List targetConnectionsInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new ChangeDataCapture(); + } + this.innerProperties().withTargetConnectionsInfo(targetConnectionsInfo); + return this; + } + + /** + * Get the policy property: CDC policy. + * + * @return the policy value. + */ + public MapperPolicy policy() { + return this.innerProperties() == null ? null : this.innerProperties().policy(); + } + + /** + * Set the policy property: CDC policy. + * + * @param policy the policy value to set. + * @return the ChangeDataCaptureResourceInner object itself. + */ + public ChangeDataCaptureResourceInner withPolicy(MapperPolicy policy) { + if (this.innerProperties() == null) { + this.innerProperties = new ChangeDataCapture(); + } + this.innerProperties().withPolicy(policy); + return this; + } + + /** + * Get the allowVNetOverride property: A boolean to determine if the vnet configuration needs to be overwritten. + * + * @return the allowVNetOverride value. + */ + public Boolean allowVNetOverride() { + return this.innerProperties() == null ? null : this.innerProperties().allowVNetOverride(); + } + + /** + * Set the allowVNetOverride property: A boolean to determine if the vnet configuration needs to be overwritten. + * + * @param allowVNetOverride the allowVNetOverride value to set. + * @return the ChangeDataCaptureResourceInner object itself. + */ + public ChangeDataCaptureResourceInner withAllowVNetOverride(Boolean allowVNetOverride) { + if (this.innerProperties() == null) { + this.innerProperties = new ChangeDataCapture(); + } + this.innerProperties().withAllowVNetOverride(allowVNetOverride); + return this; + } + + /** + * Get the status property: Status of the CDC as to if it is running or stopped. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: Status of the CDC as to if it is running or stopped. + * + * @param status the status value to set. + * @return the ChangeDataCaptureResourceInner object itself. + */ + public ChangeDataCaptureResourceInner withStatus(String status) { + if (this.innerProperties() == null) { + this.innerProperties = new ChangeDataCapture(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model ChangeDataCaptureResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ChangeDataCaptureResourceInner.class); +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CommonDataServiceForAppsLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CommonDataServiceForAppsLinkedServiceTypeProperties.java index ee372517f5e6..0adf112c070d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CommonDataServiceForAppsLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CommonDataServiceForAppsLinkedServiceTypeProperties.java @@ -95,10 +95,10 @@ public final class CommonDataServiceForAppsLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of CommonDataServiceForAppsLinkedServiceTypeProperties class. */ public CommonDataServiceForAppsLinkedServiceTypeProperties() { @@ -362,22 +362,22 @@ public CommonDataServiceForAppsLinkedServiceTypeProperties withServicePrincipalC /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the CommonDataServiceForAppsLinkedServiceTypeProperties object itself. */ - public CommonDataServiceForAppsLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public CommonDataServiceForAppsLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ConcurLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ConcurLinkedServiceTypeProperties.java index a1280c48776e..e70cecc2e98a 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ConcurLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ConcurLinkedServiceTypeProperties.java @@ -58,10 +58,10 @@ public final class ConcurLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of ConcurLinkedServiceTypeProperties class. */ public ConcurLinkedServiceTypeProperties() { @@ -217,22 +217,22 @@ public ConcurLinkedServiceTypeProperties withUsePeerVerification(Object usePeerV /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ConcurLinkedServiceTypeProperties object itself. */ - public ConcurLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public ConcurLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CosmosDbLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CosmosDbLinkedServiceTypeProperties.java index e9852212b80a..17579118e081 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CosmosDbLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CosmosDbLinkedServiceTypeProperties.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.resourcemanager.datafactory.models.CosmosDbConnectionMode; -import com.azure.resourcemanager.datafactory.models.CosmosDbServicePrincipalCredentialType; import com.azure.resourcemanager.datafactory.models.CredentialReference; import com.azure.resourcemanager.datafactory.models.SecretBase; import com.fasterxml.jackson.annotation.JsonProperty; @@ -47,10 +46,10 @@ public final class CosmosDbLinkedServiceTypeProperties { /* * The service principal credential type to use in Server-To-Server authentication. 'ServicePrincipalKey' for - * key/secret, 'ServicePrincipalCert' for certificate. Type: string (or Expression with resultType string). + * key/secret, 'ServicePrincipalCert' for certificate. Type: string. */ @JsonProperty(value = "servicePrincipalCredentialType") - private CosmosDbServicePrincipalCredentialType servicePrincipalCredentialType; + private Object servicePrincipalCredentialType; /* * The credential of the service principal object in Azure Active Directory. If servicePrincipalCredentialType is @@ -77,17 +76,17 @@ public final class CosmosDbLinkedServiceTypeProperties { private Object azureCloudType; /* - * The connection mode used to access CosmosDB account. Type: string (or Expression with resultType string). + * The connection mode used to access CosmosDB account. Type: string. */ @JsonProperty(value = "connectionMode") private CosmosDbConnectionMode connectionMode; /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The credential reference containing authentication information. @@ -209,25 +208,23 @@ public CosmosDbLinkedServiceTypeProperties withServicePrincipalId(Object service /** * Get the servicePrincipalCredentialType property: The service principal credential type to use in Server-To-Server - * authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string (or - * Expression with resultType string). + * authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string. * * @return the servicePrincipalCredentialType value. */ - public CosmosDbServicePrincipalCredentialType servicePrincipalCredentialType() { + public Object servicePrincipalCredentialType() { return this.servicePrincipalCredentialType; } /** * Set the servicePrincipalCredentialType property: The service principal credential type to use in Server-To-Server - * authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string (or - * Expression with resultType string). + * authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string. * * @param servicePrincipalCredentialType the servicePrincipalCredentialType value to set. * @return the CosmosDbLinkedServiceTypeProperties object itself. */ public CosmosDbLinkedServiceTypeProperties withServicePrincipalCredentialType( - CosmosDbServicePrincipalCredentialType servicePrincipalCredentialType) { + Object servicePrincipalCredentialType) { this.servicePrincipalCredentialType = servicePrincipalCredentialType; return this; } @@ -305,8 +302,7 @@ public CosmosDbLinkedServiceTypeProperties withAzureCloudType(Object azureCloudT } /** - * Get the connectionMode property: The connection mode used to access CosmosDB account. Type: string (or Expression - * with resultType string). + * Get the connectionMode property: The connection mode used to access CosmosDB account. Type: string. * * @return the connectionMode value. */ @@ -315,8 +311,7 @@ public CosmosDbConnectionMode connectionMode() { } /** - * Set the connectionMode property: The connection mode used to access CosmosDB account. Type: string (or Expression - * with resultType string). + * Set the connectionMode property: The connection mode used to access CosmosDB account. Type: string. * * @param connectionMode the connectionMode value to set. * @return the CosmosDbLinkedServiceTypeProperties object itself. @@ -328,22 +323,22 @@ public CosmosDbLinkedServiceTypeProperties withConnectionMode(CosmosDbConnection /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the CosmosDbLinkedServiceTypeProperties object itself. */ - public CosmosDbLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public CosmosDbLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CouchbaseLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CouchbaseLinkedServiceTypeProperties.java index 4219a6f0e003..636ba53ec3ec 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CouchbaseLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/CouchbaseLinkedServiceTypeProperties.java @@ -25,10 +25,10 @@ public final class CouchbaseLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of CouchbaseLinkedServiceTypeProperties class. */ public CouchbaseLinkedServiceTypeProperties() { @@ -78,22 +78,22 @@ public CouchbaseLinkedServiceTypeProperties withCredString(AzureKeyVaultSecretRe /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the CouchbaseLinkedServiceTypeProperties object itself. */ - public CouchbaseLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public CouchbaseLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DataworldLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DataworldLinkedServiceTypeProperties.java index c9f8ec48a011..6099e5ba28c7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DataworldLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DataworldLinkedServiceTypeProperties.java @@ -20,10 +20,10 @@ public final class DataworldLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of DataworldLinkedServiceTypeProperties class. */ public DataworldLinkedServiceTypeProperties() { @@ -51,22 +51,22 @@ public DataworldLinkedServiceTypeProperties withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DataworldLinkedServiceTypeProperties object itself. */ - public DataworldLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public DataworldLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/Db2LinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/Db2LinkedServiceTypeProperties.java index 11ac2d735645..7a37ea2b7366 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/Db2LinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/Db2LinkedServiceTypeProperties.java @@ -69,11 +69,10 @@ public final class Db2LinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. It is mutually exclusive with connectionString property. Type: string (or Expression with - * resultType string). + * credential manager. It is mutually exclusive with connectionString property. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of Db2LinkedServiceTypeProperties class. */ public Db2LinkedServiceTypeProperties() { @@ -258,23 +257,23 @@ public Db2LinkedServiceTypeProperties withCertificateCommonName(Object certifica /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. It is mutually exclusive with connectionString property. Type: - * string (or Expression with resultType string). + * string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. It is mutually exclusive with connectionString property. Type: - * string (or Expression with resultType string). + * string. * * @param encryptedCredential the encryptedCredential value to set. * @return the Db2LinkedServiceTypeProperties object itself. */ - public Db2LinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public Db2LinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DrillLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DrillLinkedServiceTypeProperties.java index da7abe5d2089..11383d3107fe 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DrillLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DrillLinkedServiceTypeProperties.java @@ -25,10 +25,10 @@ public final class DrillLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of DrillLinkedServiceTypeProperties class. */ public DrillLinkedServiceTypeProperties() { @@ -78,22 +78,22 @@ public DrillLinkedServiceTypeProperties withPwd(AzureKeyVaultSecretReference pwd /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DrillLinkedServiceTypeProperties object itself. */ - public DrillLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public DrillLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsAXLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsAXLinkedServiceTypeProperties.java index faa6c5e0b7b1..1583509dd37d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsAXLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsAXLinkedServiceTypeProperties.java @@ -47,10 +47,10 @@ public final class DynamicsAXLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of DynamicsAXLinkedServiceTypeProperties class. */ public DynamicsAXLinkedServiceTypeProperties() { @@ -170,22 +170,22 @@ public DynamicsAXLinkedServiceTypeProperties withAadResourceId(Object aadResourc /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DynamicsAXLinkedServiceTypeProperties object itself. */ - public DynamicsAXLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public DynamicsAXLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsCrmLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsCrmLinkedServiceTypeProperties.java index 1878f61d8576..a91e34bbb84d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsCrmLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsCrmLinkedServiceTypeProperties.java @@ -93,10 +93,10 @@ public final class DynamicsCrmLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of DynamicsCrmLinkedServiceTypeProperties class. */ public DynamicsCrmLinkedServiceTypeProperties() { @@ -358,22 +358,22 @@ public DynamicsCrmLinkedServiceTypeProperties withServicePrincipalCredential( /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DynamicsCrmLinkedServiceTypeProperties object itself. */ - public DynamicsCrmLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public DynamicsCrmLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsLinkedServiceTypeProperties.java index e9c88c50647c..96f7cd5a94a6 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/DynamicsLinkedServiceTypeProperties.java @@ -94,10 +94,10 @@ public final class DynamicsLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The credential reference containing authentication information. @@ -362,22 +362,22 @@ public DynamicsLinkedServiceTypeProperties withServicePrincipalCredential(Secret /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DynamicsLinkedServiceTypeProperties object itself. */ - public DynamicsLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public DynamicsLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/EloquaLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/EloquaLinkedServiceTypeProperties.java index dc77b8009264..338375b65566 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/EloquaLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/EloquaLinkedServiceTypeProperties.java @@ -51,10 +51,10 @@ public final class EloquaLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of EloquaLinkedServiceTypeProperties class. */ public EloquaLinkedServiceTypeProperties() { @@ -190,22 +190,22 @@ public EloquaLinkedServiceTypeProperties withUsePeerVerification(Object usePeerV /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the EloquaLinkedServiceTypeProperties object itself. */ - public EloquaLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public EloquaLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FileServerLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FileServerLinkedServiceTypeProperties.java index 4df9face24c2..98335e998f7f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FileServerLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FileServerLinkedServiceTypeProperties.java @@ -32,10 +32,10 @@ public final class FileServerLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of FileServerLinkedServiceTypeProperties class. */ public FileServerLinkedServiceTypeProperties() { @@ -103,22 +103,22 @@ public FileServerLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the FileServerLinkedServiceTypeProperties object itself. */ - public FileServerLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public FileServerLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FtpServerLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FtpServerLinkedServiceTypeProperties.java index 0ebeb448db91..68cfe63e8712 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FtpServerLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FtpServerLinkedServiceTypeProperties.java @@ -46,10 +46,10 @@ public final class FtpServerLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * If true, connect to the FTP server over SSL/TLS channel. Default value is true. Type: boolean (or Expression @@ -173,22 +173,22 @@ public FtpServerLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the FtpServerLinkedServiceTypeProperties object itself. */ - public FtpServerLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public FtpServerLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleAdWordsLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleAdWordsLinkedServiceTypeProperties.java index 6a001acef78a..81399576cd7d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleAdWordsLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleAdWordsLinkedServiceTypeProperties.java @@ -20,7 +20,8 @@ public final class GoogleAdWordsLinkedServiceTypeProperties { private Object connectionProperties; /* - * The Client customer ID of the AdWords account that you want to fetch report data for. + * The Client customer ID of the AdWords account that you want to fetch report data for. Type: string (or + * Expression with resultType string). */ @JsonProperty(value = "clientCustomerID") private Object clientCustomerId; @@ -59,13 +60,14 @@ public final class GoogleAdWordsLinkedServiceTypeProperties { /* * The service account email ID that is used for ServiceAuthentication and can only be used on self-hosted IR. + * Type: string (or Expression with resultType string). */ @JsonProperty(value = "email") private Object email; /* * The full path to the .p12 key file that is used to authenticate the service account email address and can only - * be used on self-hosted IR. + * be used on self-hosted IR. Type: string (or Expression with resultType string). */ @JsonProperty(value = "keyFilePath") private Object keyFilePath; @@ -73,24 +75,24 @@ public final class GoogleAdWordsLinkedServiceTypeProperties { /* * The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over * SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file - * installed with the IR. + * installed with the IR. Type: string (or Expression with resultType string). */ @JsonProperty(value = "trustedCertPath") private Object trustedCertPath; /* * Specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default - * value is false. + * value is false. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "useSystemTrustStore") private Object useSystemTrustStore; /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of GoogleAdWordsLinkedServiceTypeProperties class. */ public GoogleAdWordsLinkedServiceTypeProperties() { @@ -120,7 +122,7 @@ public GoogleAdWordsLinkedServiceTypeProperties withConnectionProperties(Object /** * Get the clientCustomerId property: The Client customer ID of the AdWords account that you want to fetch report - * data for. + * data for. Type: string (or Expression with resultType string). * * @return the clientCustomerId value. */ @@ -130,7 +132,7 @@ public Object clientCustomerId() { /** * Set the clientCustomerId property: The Client customer ID of the AdWords account that you want to fetch report - * data for. + * data for. Type: string (or Expression with resultType string). * * @param clientCustomerId the clientCustomerId value to set. * @return the GoogleAdWordsLinkedServiceTypeProperties object itself. @@ -251,7 +253,7 @@ public GoogleAdWordsLinkedServiceTypeProperties withClientSecret(SecretBase clie /** * Get the email property: The service account email ID that is used for ServiceAuthentication and can only be used - * on self-hosted IR. + * on self-hosted IR. Type: string (or Expression with resultType string). * * @return the email value. */ @@ -261,7 +263,7 @@ public Object email() { /** * Set the email property: The service account email ID that is used for ServiceAuthentication and can only be used - * on self-hosted IR. + * on self-hosted IR. Type: string (or Expression with resultType string). * * @param email the email value to set. * @return the GoogleAdWordsLinkedServiceTypeProperties object itself. @@ -273,7 +275,7 @@ public GoogleAdWordsLinkedServiceTypeProperties withEmail(Object email) { /** * Get the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account - * email address and can only be used on self-hosted IR. + * email address and can only be used on self-hosted IR. Type: string (or Expression with resultType string). * * @return the keyFilePath value. */ @@ -283,7 +285,7 @@ public Object keyFilePath() { /** * Set the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account - * email address and can only be used on self-hosted IR. + * email address and can only be used on self-hosted IR. Type: string (or Expression with resultType string). * * @param keyFilePath the keyFilePath value to set. * @return the GoogleAdWordsLinkedServiceTypeProperties object itself. @@ -296,7 +298,7 @@ public GoogleAdWordsLinkedServiceTypeProperties withKeyFilePath(Object keyFilePa /** * Get the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying * the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default - * value is the cacerts.pem file installed with the IR. + * value is the cacerts.pem file installed with the IR. Type: string (or Expression with resultType string). * * @return the trustedCertPath value. */ @@ -307,7 +309,7 @@ public Object trustedCertPath() { /** * Set the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying * the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default - * value is the cacerts.pem file installed with the IR. + * value is the cacerts.pem file installed with the IR. Type: string (or Expression with resultType string). * * @param trustedCertPath the trustedCertPath value to set. * @return the GoogleAdWordsLinkedServiceTypeProperties object itself. @@ -319,7 +321,7 @@ public GoogleAdWordsLinkedServiceTypeProperties withTrustedCertPath(Object trust /** * Get the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or - * from a specified PEM file. The default value is false. + * from a specified PEM file. The default value is false. Type: boolean (or Expression with resultType boolean). * * @return the useSystemTrustStore value. */ @@ -329,7 +331,7 @@ public Object useSystemTrustStore() { /** * Set the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or - * from a specified PEM file. The default value is false. + * from a specified PEM file. The default value is false. Type: boolean (or Expression with resultType boolean). * * @param useSystemTrustStore the useSystemTrustStore value to set. * @return the GoogleAdWordsLinkedServiceTypeProperties object itself. @@ -341,22 +343,22 @@ public GoogleAdWordsLinkedServiceTypeProperties withUseSystemTrustStore(Object u /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GoogleAdWordsLinkedServiceTypeProperties object itself. */ - public GoogleAdWordsLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public GoogleAdWordsLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleBigQueryLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleBigQueryLinkedServiceTypeProperties.java index 2ae826b9d2e4..c193b60435fa 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleBigQueryLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleBigQueryLinkedServiceTypeProperties.java @@ -14,20 +14,22 @@ @Fluent public final class GoogleBigQueryLinkedServiceTypeProperties { /* - * The default BigQuery project to query against. + * The default BigQuery project to query against. Type: string (or Expression with resultType string). */ @JsonProperty(value = "project", required = true) private Object project; /* - * A comma-separated list of public BigQuery projects to access. + * A comma-separated list of public BigQuery projects to access. Type: string (or Expression with resultType + * string). */ @JsonProperty(value = "additionalProjects") private Object additionalProjects; /* * Whether to request access to Google Drive. Allowing Google Drive access enables support for federated tables - * that combine BigQuery data with data from Google Drive. The default value is false. + * that combine BigQuery data with data from Google Drive. The default value is false. Type: string (or Expression + * with resultType string). */ @JsonProperty(value = "requestGoogleDriveScope") private Object requestGoogleDriveScope; @@ -60,13 +62,14 @@ public final class GoogleBigQueryLinkedServiceTypeProperties { /* * The service account email ID that is used for ServiceAuthentication and can only be used on self-hosted IR. + * Type: string (or Expression with resultType string). */ @JsonProperty(value = "email") private Object email; /* * The full path to the .p12 key file that is used to authenticate the service account email address and can only - * be used on self-hosted IR. + * be used on self-hosted IR. Type: string (or Expression with resultType string). */ @JsonProperty(value = "keyFilePath") private Object keyFilePath; @@ -74,31 +77,32 @@ public final class GoogleBigQueryLinkedServiceTypeProperties { /* * The full path of the .pem file containing trusted CA certificates for verifying the server when connecting over * SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file - * installed with the IR. + * installed with the IR. Type: string (or Expression with resultType string). */ @JsonProperty(value = "trustedCertPath") private Object trustedCertPath; /* * Specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default - * value is false. + * value is false.Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "useSystemTrustStore") private Object useSystemTrustStore; /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of GoogleBigQueryLinkedServiceTypeProperties class. */ public GoogleBigQueryLinkedServiceTypeProperties() { } /** - * Get the project property: The default BigQuery project to query against. + * Get the project property: The default BigQuery project to query against. Type: string (or Expression with + * resultType string). * * @return the project value. */ @@ -107,7 +111,8 @@ public Object project() { } /** - * Set the project property: The default BigQuery project to query against. + * Set the project property: The default BigQuery project to query against. Type: string (or Expression with + * resultType string). * * @param project the project value to set. * @return the GoogleBigQueryLinkedServiceTypeProperties object itself. @@ -118,7 +123,8 @@ public GoogleBigQueryLinkedServiceTypeProperties withProject(Object project) { } /** - * Get the additionalProjects property: A comma-separated list of public BigQuery projects to access. + * Get the additionalProjects property: A comma-separated list of public BigQuery projects to access. Type: string + * (or Expression with resultType string). * * @return the additionalProjects value. */ @@ -127,7 +133,8 @@ public Object additionalProjects() { } /** - * Set the additionalProjects property: A comma-separated list of public BigQuery projects to access. + * Set the additionalProjects property: A comma-separated list of public BigQuery projects to access. Type: string + * (or Expression with resultType string). * * @param additionalProjects the additionalProjects value to set. * @return the GoogleBigQueryLinkedServiceTypeProperties object itself. @@ -140,7 +147,7 @@ public GoogleBigQueryLinkedServiceTypeProperties withAdditionalProjects(Object a /** * Get the requestGoogleDriveScope property: Whether to request access to Google Drive. Allowing Google Drive access * enables support for federated tables that combine BigQuery data with data from Google Drive. The default value is - * false. + * false. Type: string (or Expression with resultType string). * * @return the requestGoogleDriveScope value. */ @@ -151,7 +158,7 @@ public Object requestGoogleDriveScope() { /** * Set the requestGoogleDriveScope property: Whether to request access to Google Drive. Allowing Google Drive access * enables support for federated tables that combine BigQuery data with data from Google Drive. The default value is - * false. + * false. Type: string (or Expression with resultType string). * * @param requestGoogleDriveScope the requestGoogleDriveScope value to set. * @return the GoogleBigQueryLinkedServiceTypeProperties object itself. @@ -250,7 +257,7 @@ public GoogleBigQueryLinkedServiceTypeProperties withClientSecret(SecretBase cli /** * Get the email property: The service account email ID that is used for ServiceAuthentication and can only be used - * on self-hosted IR. + * on self-hosted IR. Type: string (or Expression with resultType string). * * @return the email value. */ @@ -260,7 +267,7 @@ public Object email() { /** * Set the email property: The service account email ID that is used for ServiceAuthentication and can only be used - * on self-hosted IR. + * on self-hosted IR. Type: string (or Expression with resultType string). * * @param email the email value to set. * @return the GoogleBigQueryLinkedServiceTypeProperties object itself. @@ -272,7 +279,7 @@ public GoogleBigQueryLinkedServiceTypeProperties withEmail(Object email) { /** * Get the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account - * email address and can only be used on self-hosted IR. + * email address and can only be used on self-hosted IR. Type: string (or Expression with resultType string). * * @return the keyFilePath value. */ @@ -282,7 +289,7 @@ public Object keyFilePath() { /** * Set the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account - * email address and can only be used on self-hosted IR. + * email address and can only be used on self-hosted IR. Type: string (or Expression with resultType string). * * @param keyFilePath the keyFilePath value to set. * @return the GoogleBigQueryLinkedServiceTypeProperties object itself. @@ -295,7 +302,7 @@ public GoogleBigQueryLinkedServiceTypeProperties withKeyFilePath(Object keyFileP /** * Get the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying * the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default - * value is the cacerts.pem file installed with the IR. + * value is the cacerts.pem file installed with the IR. Type: string (or Expression with resultType string). * * @return the trustedCertPath value. */ @@ -306,7 +313,7 @@ public Object trustedCertPath() { /** * Set the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying * the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default - * value is the cacerts.pem file installed with the IR. + * value is the cacerts.pem file installed with the IR. Type: string (or Expression with resultType string). * * @param trustedCertPath the trustedCertPath value to set. * @return the GoogleBigQueryLinkedServiceTypeProperties object itself. @@ -318,7 +325,7 @@ public GoogleBigQueryLinkedServiceTypeProperties withTrustedCertPath(Object trus /** * Get the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or - * from a specified PEM file. The default value is false. + * from a specified PEM file. The default value is false.Type: boolean (or Expression with resultType boolean). * * @return the useSystemTrustStore value. */ @@ -328,7 +335,7 @@ public Object useSystemTrustStore() { /** * Set the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or - * from a specified PEM file. The default value is false. + * from a specified PEM file. The default value is false.Type: boolean (or Expression with resultType boolean). * * @param useSystemTrustStore the useSystemTrustStore value to set. * @return the GoogleBigQueryLinkedServiceTypeProperties object itself. @@ -340,22 +347,22 @@ public GoogleBigQueryLinkedServiceTypeProperties withUseSystemTrustStore(Object /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GoogleBigQueryLinkedServiceTypeProperties object itself. */ - public GoogleBigQueryLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public GoogleBigQueryLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleCloudStorageLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleCloudStorageLinkedServiceTypeProperties.java index 5515efddbcf4..5c93182b46eb 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleCloudStorageLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleCloudStorageLinkedServiceTypeProperties.java @@ -34,10 +34,10 @@ public final class GoogleCloudStorageLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of GoogleCloudStorageLinkedServiceTypeProperties class. */ public GoogleCloudStorageLinkedServiceTypeProperties() { @@ -113,22 +113,22 @@ public GoogleCloudStorageLinkedServiceTypeProperties withServiceUrl(Object servi /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GoogleCloudStorageLinkedServiceTypeProperties object itself. */ - public GoogleCloudStorageLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public GoogleCloudStorageLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleSheetsLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleSheetsLinkedServiceTypeProperties.java index 6638c2365ecc..e8a21ed63a64 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleSheetsLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GoogleSheetsLinkedServiceTypeProperties.java @@ -20,10 +20,10 @@ public final class GoogleSheetsLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of GoogleSheetsLinkedServiceTypeProperties class. */ public GoogleSheetsLinkedServiceTypeProperties() { @@ -51,22 +51,22 @@ public GoogleSheetsLinkedServiceTypeProperties withApiToken(SecretBase apiToken) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GoogleSheetsLinkedServiceTypeProperties object itself. */ - public GoogleSheetsLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public GoogleSheetsLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GreenplumLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GreenplumLinkedServiceTypeProperties.java index ff85fba756ac..39f6ba4aeddb 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GreenplumLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/GreenplumLinkedServiceTypeProperties.java @@ -25,10 +25,10 @@ public final class GreenplumLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of GreenplumLinkedServiceTypeProperties class. */ public GreenplumLinkedServiceTypeProperties() { @@ -78,22 +78,22 @@ public GreenplumLinkedServiceTypeProperties withPwd(AzureKeyVaultSecretReference /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GreenplumLinkedServiceTypeProperties object itself. */ - public GreenplumLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public GreenplumLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HBaseLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HBaseLinkedServiceTypeProperties.java index f87c95f729f6..e523c4575d8f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HBaseLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HBaseLinkedServiceTypeProperties.java @@ -78,10 +78,10 @@ public final class HBaseLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of HBaseLinkedServiceTypeProperties class. */ public HBaseLinkedServiceTypeProperties() { @@ -303,22 +303,22 @@ public HBaseLinkedServiceTypeProperties withAllowSelfSignedServerCert(Object all /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HBaseLinkedServiceTypeProperties object itself. */ - public HBaseLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public HBaseLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightHiveActivityTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightHiveActivityTypeProperties.java index 5756795cbd9e..abf2f59f2f1c 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightHiveActivityTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightHiveActivityTypeProperties.java @@ -56,7 +56,8 @@ public final class HDInsightHiveActivityTypeProperties { * User specified arguments under hivevar namespace. */ @JsonProperty(value = "variables") - private List variables; + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map variables; /* * Query timeout value (in minutes). Effective when the HDInsight cluster is with ESP (Enterprise Security @@ -195,7 +196,7 @@ public HDInsightHiveActivityTypeProperties withDefines(Map defin * * @return the variables value. */ - public List variables() { + public Map variables() { return this.variables; } @@ -205,7 +206,7 @@ public List variables() { * @param variables the variables value to set. * @return the HDInsightHiveActivityTypeProperties object itself. */ - public HDInsightHiveActivityTypeProperties withVariables(List variables) { + public HDInsightHiveActivityTypeProperties withVariables(Map variables) { this.variables = variables; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightLinkedServiceTypeProperties.java index 68301c915ef5..567377d30230 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightLinkedServiceTypeProperties.java @@ -45,10 +45,10 @@ public final class HDInsightLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * Specify if the HDInsight is created with ESP (Enterprise Security Package). Type: Boolean. @@ -172,22 +172,22 @@ public HDInsightLinkedServiceTypeProperties withHcatalogLinkedServiceName( /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HDInsightLinkedServiceTypeProperties object itself. */ - public HDInsightLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public HDInsightLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightOnDemandLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightOnDemandLinkedServiceTypeProperties.java index e873c3a6baab..4a1befd18790 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightOnDemandLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HDInsightOnDemandLinkedServiceTypeProperties.java @@ -181,10 +181,10 @@ public final class HDInsightOnDemandLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * Specifies the size of the head node for the HDInsight cluster. @@ -804,22 +804,22 @@ public HDInsightOnDemandLinkedServiceTypeProperties withYarnConfiguration(Object /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HDInsightOnDemandLinkedServiceTypeProperties object itself. */ - public HDInsightOnDemandLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public HDInsightOnDemandLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HdfsLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HdfsLinkedServiceTypeProperties.java index 204e8b295063..3d0f8de7383f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HdfsLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HdfsLinkedServiceTypeProperties.java @@ -28,10 +28,10 @@ public final class HdfsLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * User name for Windows authentication. Type: string (or Expression with resultType string). @@ -95,22 +95,22 @@ public HdfsLinkedServiceTypeProperties withAuthenticationType(Object authenticat /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HdfsLinkedServiceTypeProperties object itself. */ - public HdfsLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public HdfsLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HiveLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HiveLinkedServiceTypeProperties.java index 069d8b2b22c3..f43a4370f286 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HiveLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HiveLinkedServiceTypeProperties.java @@ -118,10 +118,10 @@ public final class HiveLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of HiveLinkedServiceTypeProperties class. */ public HiveLinkedServiceTypeProperties() { @@ -466,22 +466,22 @@ public HiveLinkedServiceTypeProperties withAllowSelfSignedServerCert(Object allo /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HiveLinkedServiceTypeProperties object itself. */ - public HiveLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public HiveLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HttpLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HttpLinkedServiceTypeProperties.java index 91f565c2680c..5773c47ef471 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HttpLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HttpLinkedServiceTypeProperties.java @@ -63,10 +63,10 @@ public final class HttpLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * If true, validate the HTTPS server SSL certificate. Default value is true. Type: boolean (or Expression with @@ -237,22 +237,22 @@ public HttpLinkedServiceTypeProperties withCertThumbprint(Object certThumbprint) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HttpLinkedServiceTypeProperties object itself. */ - public HttpLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public HttpLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HubspotLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HubspotLinkedServiceTypeProperties.java index 6a6cbfdcde07..5ae449138ea3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HubspotLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/HubspotLinkedServiceTypeProperties.java @@ -57,10 +57,10 @@ public final class HubspotLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of HubspotLinkedServiceTypeProperties class. */ public HubspotLinkedServiceTypeProperties() { @@ -214,22 +214,22 @@ public HubspotLinkedServiceTypeProperties withUsePeerVerification(Object usePeer /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HubspotLinkedServiceTypeProperties object itself. */ - public HubspotLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public HubspotLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ImpalaLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ImpalaLinkedServiceTypeProperties.java index 96b6631bf31f..3161d61d39fd 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ImpalaLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ImpalaLinkedServiceTypeProperties.java @@ -79,10 +79,10 @@ public final class ImpalaLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of ImpalaLinkedServiceTypeProperties class. */ public ImpalaLinkedServiceTypeProperties() { @@ -306,22 +306,22 @@ public ImpalaLinkedServiceTypeProperties withAllowSelfSignedServerCert(Object al /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ImpalaLinkedServiceTypeProperties object itself. */ - public ImpalaLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public ImpalaLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/InformixLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/InformixLinkedServiceTypeProperties.java index 766d98f282d7..d0ee8ff3ca84 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/InformixLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/InformixLinkedServiceTypeProperties.java @@ -14,7 +14,7 @@ public final class InformixLinkedServiceTypeProperties { /* * The non-access credential portion of the connection string as well as an optional encrypted credential. Type: - * string, SecureString or AzureKeyVaultSecretReference. + * string, or SecureString, or AzureKeyVaultSecretReference, or Expression with resultType string. */ @JsonProperty(value = "connectionString", required = true) private Object connectionString; @@ -46,10 +46,10 @@ public final class InformixLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of InformixLinkedServiceTypeProperties class. */ public InformixLinkedServiceTypeProperties() { @@ -57,7 +57,8 @@ public InformixLinkedServiceTypeProperties() { /** * Get the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @return the connectionString value. */ @@ -67,7 +68,8 @@ public Object connectionString() { /** * Set the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @param connectionString the connectionString value to set. * @return the InformixLinkedServiceTypeProperties object itself. @@ -165,22 +167,22 @@ public InformixLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the InformixLinkedServiceTypeProperties object itself. */ - public InformixLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public InformixLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/JiraLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/JiraLinkedServiceTypeProperties.java index 2a1b1a27b86d..ac127928ce93 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/JiraLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/JiraLinkedServiceTypeProperties.java @@ -58,10 +58,10 @@ public final class JiraLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of JiraLinkedServiceTypeProperties class. */ public JiraLinkedServiceTypeProperties() { @@ -217,22 +217,22 @@ public JiraLinkedServiceTypeProperties withUsePeerVerification(Object usePeerVer /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the JiraLinkedServiceTypeProperties object itself. */ - public JiraLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public JiraLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MagentoLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MagentoLinkedServiceTypeProperties.java index 202f2c16b78a..164a47e91995 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MagentoLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MagentoLinkedServiceTypeProperties.java @@ -45,10 +45,10 @@ public final class MagentoLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of MagentoLinkedServiceTypeProperties class. */ public MagentoLinkedServiceTypeProperties() { @@ -162,22 +162,22 @@ public MagentoLinkedServiceTypeProperties withUsePeerVerification(Object usePeer /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MagentoLinkedServiceTypeProperties object itself. */ - public MagentoLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public MagentoLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MapperTableProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MapperTableProperties.java new file mode 100644 index 000000000000..7e24bccc6a3d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MapperTableProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import com.azure.resourcemanager.datafactory.models.MapperTableSchema; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties for a CDC table. */ +@Fluent +public final class MapperTableProperties { + /* + * List of columns for the source table. + */ + @JsonProperty(value = "schema") + private List schema; + + /* + * List of name/value pairs for connection properties. + */ + @JsonProperty(value = "dslConnectorProperties") + private List dslConnectorProperties; + + /** Creates an instance of MapperTableProperties class. */ + public MapperTableProperties() { + } + + /** + * Get the schema property: List of columns for the source table. + * + * @return the schema value. + */ + public List schema() { + return this.schema; + } + + /** + * Set the schema property: List of columns for the source table. + * + * @param schema the schema value to set. + * @return the MapperTableProperties object itself. + */ + public MapperTableProperties withSchema(List schema) { + this.schema = schema; + return this; + } + + /** + * Get the dslConnectorProperties property: List of name/value pairs for connection properties. + * + * @return the dslConnectorProperties value. + */ + public List dslConnectorProperties() { + return this.dslConnectorProperties; + } + + /** + * Set the dslConnectorProperties property: List of name/value pairs for connection properties. + * + * @param dslConnectorProperties the dslConnectorProperties value to set. + * @return the MapperTableProperties object itself. + */ + public MapperTableProperties withDslConnectorProperties(List dslConnectorProperties) { + this.dslConnectorProperties = dslConnectorProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schema() != null) { + schema().forEach(e -> e.validate()); + } + if (dslConnectorProperties() != null) { + dslConnectorProperties().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MariaDBLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MariaDBLinkedServiceTypeProperties.java index fb694e8e214e..e1a4e5fe8d83 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MariaDBLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MariaDBLinkedServiceTypeProperties.java @@ -25,10 +25,10 @@ public final class MariaDBLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of MariaDBLinkedServiceTypeProperties class. */ public MariaDBLinkedServiceTypeProperties() { @@ -78,22 +78,22 @@ public MariaDBLinkedServiceTypeProperties withPwd(AzureKeyVaultSecretReference p /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MariaDBLinkedServiceTypeProperties object itself. */ - public MariaDBLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public MariaDBLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MarketoLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MarketoLinkedServiceTypeProperties.java index f9b4bfb3941f..eba83cd86e2f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MarketoLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MarketoLinkedServiceTypeProperties.java @@ -51,10 +51,10 @@ public final class MarketoLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of MarketoLinkedServiceTypeProperties class. */ public MarketoLinkedServiceTypeProperties() { @@ -188,22 +188,22 @@ public MarketoLinkedServiceTypeProperties withUsePeerVerification(Object usePeer /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MarketoLinkedServiceTypeProperties object itself. */ - public MarketoLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public MarketoLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MicrosoftAccessLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MicrosoftAccessLinkedServiceTypeProperties.java index ee2767fd98df..9a87851a8306 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MicrosoftAccessLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MicrosoftAccessLinkedServiceTypeProperties.java @@ -14,7 +14,7 @@ public final class MicrosoftAccessLinkedServiceTypeProperties { /* * The non-access credential portion of the connection string as well as an optional encrypted credential. Type: - * string, SecureString or AzureKeyVaultSecretReference. + * string, or SecureString, or AzureKeyVaultSecretReference, or Expression with resultType string. */ @JsonProperty(value = "connectionString", required = true) private Object connectionString; @@ -46,10 +46,10 @@ public final class MicrosoftAccessLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of MicrosoftAccessLinkedServiceTypeProperties class. */ public MicrosoftAccessLinkedServiceTypeProperties() { @@ -57,7 +57,8 @@ public MicrosoftAccessLinkedServiceTypeProperties() { /** * Get the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @return the connectionString value. */ @@ -67,7 +68,8 @@ public Object connectionString() { /** * Set the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @param connectionString the connectionString value to set. * @return the MicrosoftAccessLinkedServiceTypeProperties object itself. @@ -165,22 +167,22 @@ public MicrosoftAccessLinkedServiceTypeProperties withPassword(SecretBase passwo /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MicrosoftAccessLinkedServiceTypeProperties object itself. */ - public MicrosoftAccessLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public MicrosoftAccessLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MongoDbAtlasLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MongoDbAtlasLinkedServiceTypeProperties.java index 02e93f7edf1d..a233ead39a73 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MongoDbAtlasLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MongoDbAtlasLinkedServiceTypeProperties.java @@ -25,6 +25,13 @@ public final class MongoDbAtlasLinkedServiceTypeProperties { @JsonProperty(value = "database", required = true) private Object database; + /* + * The driver version that you want to choose. Allowed value are v1 and v2. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "driverVersion") + private Object driverVersion; + /** Creates an instance of MongoDbAtlasLinkedServiceTypeProperties class. */ public MongoDbAtlasLinkedServiceTypeProperties() { } @@ -73,6 +80,28 @@ public MongoDbAtlasLinkedServiceTypeProperties withDatabase(Object database) { return this; } + /** + * Get the driverVersion property: The driver version that you want to choose. Allowed value are v1 and v2. Type: + * string (or Expression with resultType string). + * + * @return the driverVersion value. + */ + public Object driverVersion() { + return this.driverVersion; + } + + /** + * Set the driverVersion property: The driver version that you want to choose. Allowed value are v1 and v2. Type: + * string (or Expression with resultType string). + * + * @param driverVersion the driverVersion value to set. + * @return the MongoDbAtlasLinkedServiceTypeProperties object itself. + */ + public MongoDbAtlasLinkedServiceTypeProperties withDriverVersion(Object driverVersion) { + this.driverVersion = driverVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MongoDbLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MongoDbLinkedServiceTypeProperties.java index c9ad4053f35e..6c4ae2c3826d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MongoDbLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MongoDbLinkedServiceTypeProperties.java @@ -72,10 +72,10 @@ public final class MongoDbLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of MongoDbLinkedServiceTypeProperties class. */ public MongoDbLinkedServiceTypeProperties() { @@ -275,22 +275,22 @@ public MongoDbLinkedServiceTypeProperties withAllowSelfSignedServerCert(Object a /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MongoDbLinkedServiceTypeProperties object itself. */ - public MongoDbLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public MongoDbLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MySqlLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MySqlLinkedServiceTypeProperties.java index 7468960a95b2..c5259e6169f1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MySqlLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/MySqlLinkedServiceTypeProperties.java @@ -13,7 +13,7 @@ @Fluent public final class MySqlLinkedServiceTypeProperties { /* - * The connection string. + * The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. */ @JsonProperty(value = "connectionString", required = true) private Object connectionString; @@ -26,17 +26,18 @@ public final class MySqlLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of MySqlLinkedServiceTypeProperties class. */ public MySqlLinkedServiceTypeProperties() { } /** - * Get the connectionString property: The connection string. + * Get the connectionString property: The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. * * @return the connectionString value. */ @@ -45,7 +46,8 @@ public Object connectionString() { } /** - * Set the connectionString property: The connection string. + * Set the connectionString property: The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. * * @param connectionString the connectionString value to set. * @return the MySqlLinkedServiceTypeProperties object itself. @@ -77,22 +79,22 @@ public MySqlLinkedServiceTypeProperties withPassword(AzureKeyVaultSecretReferenc /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MySqlLinkedServiceTypeProperties object itself. */ - public MySqlLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public MySqlLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/NetezzaLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/NetezzaLinkedServiceTypeProperties.java index 848a8991aeba..d2ee0666fab7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/NetezzaLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/NetezzaLinkedServiceTypeProperties.java @@ -25,10 +25,10 @@ public final class NetezzaLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of NetezzaLinkedServiceTypeProperties class. */ public NetezzaLinkedServiceTypeProperties() { @@ -78,22 +78,22 @@ public NetezzaLinkedServiceTypeProperties withPwd(AzureKeyVaultSecretReference p /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the NetezzaLinkedServiceTypeProperties object itself. */ - public NetezzaLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public NetezzaLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ODataLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ODataLinkedServiceTypeProperties.java index 0cbc134ebcab..4034dd857d50 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ODataLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ODataLinkedServiceTypeProperties.java @@ -103,10 +103,10 @@ public final class ODataLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of ODataLinkedServiceTypeProperties class. */ public ODataLinkedServiceTypeProperties() { @@ -398,22 +398,22 @@ public ODataLinkedServiceTypeProperties withServicePrincipalEmbeddedCertPassword /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ODataLinkedServiceTypeProperties object itself. */ - public ODataLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public ODataLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OdbcLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OdbcLinkedServiceTypeProperties.java index f0d61d412e17..14bf51ae97ea 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OdbcLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OdbcLinkedServiceTypeProperties.java @@ -14,7 +14,7 @@ public final class OdbcLinkedServiceTypeProperties { /* * The non-access credential portion of the connection string as well as an optional encrypted credential. Type: - * string, SecureString or AzureKeyVaultSecretReference. + * string, or SecureString, or AzureKeyVaultSecretReference, or Expression with resultType string. */ @JsonProperty(value = "connectionString", required = true) private Object connectionString; @@ -46,10 +46,10 @@ public final class OdbcLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of OdbcLinkedServiceTypeProperties class. */ public OdbcLinkedServiceTypeProperties() { @@ -57,7 +57,8 @@ public OdbcLinkedServiceTypeProperties() { /** * Get the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @return the connectionString value. */ @@ -67,7 +68,8 @@ public Object connectionString() { /** * Set the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @param connectionString the connectionString value to set. * @return the OdbcLinkedServiceTypeProperties object itself. @@ -165,22 +167,22 @@ public OdbcLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the OdbcLinkedServiceTypeProperties object itself. */ - public OdbcLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public OdbcLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/Office365LinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/Office365LinkedServiceTypeProperties.java index 4bb4727aaace..ecbd98463fdc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/Office365LinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/Office365LinkedServiceTypeProperties.java @@ -39,10 +39,10 @@ public final class Office365LinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of Office365LinkedServiceTypeProperties class. */ public Office365LinkedServiceTypeProperties() { @@ -136,22 +136,22 @@ public Office365LinkedServiceTypeProperties withServicePrincipalKey(SecretBase s /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the Office365LinkedServiceTypeProperties object itself. */ - public Office365LinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public Office365LinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleCloudStorageLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleCloudStorageLinkedServiceTypeProperties.java index 6d497f5c71df..da0243ee70c8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleCloudStorageLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleCloudStorageLinkedServiceTypeProperties.java @@ -34,10 +34,10 @@ public final class OracleCloudStorageLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of OracleCloudStorageLinkedServiceTypeProperties class. */ public OracleCloudStorageLinkedServiceTypeProperties() { @@ -113,22 +113,22 @@ public OracleCloudStorageLinkedServiceTypeProperties withServiceUrl(Object servi /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the OracleCloudStorageLinkedServiceTypeProperties object itself. */ - public OracleCloudStorageLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public OracleCloudStorageLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleLinkedServiceTypeProperties.java index 04534eced337..2e8b1d5d0d49 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleLinkedServiceTypeProperties.java @@ -26,10 +26,10 @@ public final class OracleLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of OracleLinkedServiceTypeProperties class. */ public OracleLinkedServiceTypeProperties() { @@ -79,22 +79,22 @@ public OracleLinkedServiceTypeProperties withPassword(AzureKeyVaultSecretReferen /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the OracleLinkedServiceTypeProperties object itself. */ - public OracleLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public OracleLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleServiceCloudLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleServiceCloudLinkedServiceTypeProperties.java index b7842570f2d3..963ad2b88811 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleServiceCloudLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/OracleServiceCloudLinkedServiceTypeProperties.java @@ -53,10 +53,10 @@ public final class OracleServiceCloudLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of OracleServiceCloudLinkedServiceTypeProperties class. */ public OracleServiceCloudLinkedServiceTypeProperties() { @@ -192,22 +192,22 @@ public OracleServiceCloudLinkedServiceTypeProperties withUsePeerVerification(Obj /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the OracleServiceCloudLinkedServiceTypeProperties object itself. */ - public OracleServiceCloudLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public OracleServiceCloudLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PaypalLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PaypalLinkedServiceTypeProperties.java index cfe9d5f46b10..6dd00561eac7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PaypalLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PaypalLinkedServiceTypeProperties.java @@ -13,7 +13,7 @@ @Fluent public final class PaypalLinkedServiceTypeProperties { /* - * The URL of the PayPal instance. (i.e. api.sandbox.paypal.com) + * The URL of the PayPal instance. (i.e. api.sandbox.paypal.com) */ @JsonProperty(value = "host", required = true) private Object host; @@ -51,17 +51,17 @@ public final class PaypalLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of PaypalLinkedServiceTypeProperties class. */ public PaypalLinkedServiceTypeProperties() { } /** - * Get the host property: The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). + * Get the host property: The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). * * @return the host value. */ @@ -70,7 +70,7 @@ public Object host() { } /** - * Set the host property: The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). + * Set the host property: The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). * * @param host the host value to set. * @return the PaypalLinkedServiceTypeProperties object itself. @@ -188,22 +188,22 @@ public PaypalLinkedServiceTypeProperties withUsePeerVerification(Object usePeerV /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the PaypalLinkedServiceTypeProperties object itself. */ - public PaypalLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public PaypalLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PhoenixLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PhoenixLinkedServiceTypeProperties.java index 770b9ab93bde..11a053bee62b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PhoenixLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PhoenixLinkedServiceTypeProperties.java @@ -86,10 +86,10 @@ public final class PhoenixLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of PhoenixLinkedServiceTypeProperties class. */ public PhoenixLinkedServiceTypeProperties() { @@ -333,22 +333,22 @@ public PhoenixLinkedServiceTypeProperties withAllowSelfSignedServerCert(Object a /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the PhoenixLinkedServiceTypeProperties object itself. */ - public PhoenixLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public PhoenixLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PostgreSqlLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PostgreSqlLinkedServiceTypeProperties.java index 5dc71503e5d1..3b6f390babbe 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PostgreSqlLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PostgreSqlLinkedServiceTypeProperties.java @@ -13,7 +13,7 @@ @Fluent public final class PostgreSqlLinkedServiceTypeProperties { /* - * The connection string. + * The connection string. Type: string, SecureString or AzureKeyVaultSecretReference. */ @JsonProperty(value = "connectionString", required = true) private Object connectionString; @@ -26,17 +26,18 @@ public final class PostgreSqlLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of PostgreSqlLinkedServiceTypeProperties class. */ public PostgreSqlLinkedServiceTypeProperties() { } /** - * Get the connectionString property: The connection string. + * Get the connectionString property: The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. * * @return the connectionString value. */ @@ -45,7 +46,8 @@ public Object connectionString() { } /** - * Set the connectionString property: The connection string. + * Set the connectionString property: The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. * * @param connectionString the connectionString value to set. * @return the PostgreSqlLinkedServiceTypeProperties object itself. @@ -77,22 +79,22 @@ public PostgreSqlLinkedServiceTypeProperties withPassword(AzureKeyVaultSecretRef /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the PostgreSqlLinkedServiceTypeProperties object itself. */ - public PostgreSqlLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public PostgreSqlLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PrestoLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PrestoLinkedServiceTypeProperties.java index e8917d1a6b92..08591d767dd2 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PrestoLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/PrestoLinkedServiceTypeProperties.java @@ -98,10 +98,10 @@ public final class PrestoLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of PrestoLinkedServiceTypeProperties class. */ public PrestoLinkedServiceTypeProperties() { @@ -385,22 +385,22 @@ public PrestoLinkedServiceTypeProperties withTimeZoneId(Object timeZoneId) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the PrestoLinkedServiceTypeProperties object itself. */ - public PrestoLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public PrestoLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/QuickBooksLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/QuickBooksLinkedServiceTypeProperties.java index 0257bacbfba9..93170490f923 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/QuickBooksLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/QuickBooksLinkedServiceTypeProperties.java @@ -62,10 +62,10 @@ public final class QuickBooksLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of QuickBooksLinkedServiceTypeProperties class. */ public QuickBooksLinkedServiceTypeProperties() { @@ -237,22 +237,22 @@ public QuickBooksLinkedServiceTypeProperties withUseEncryptedEndpoints(Object us /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the QuickBooksLinkedServiceTypeProperties object itself. */ - public QuickBooksLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public QuickBooksLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/QuickbaseLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/QuickbaseLinkedServiceTypeProperties.java index 457ed9f9685a..491464ee4556 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/QuickbaseLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/QuickbaseLinkedServiceTypeProperties.java @@ -26,10 +26,10 @@ public final class QuickbaseLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of QuickbaseLinkedServiceTypeProperties class. */ public QuickbaseLinkedServiceTypeProperties() { @@ -77,22 +77,22 @@ public QuickbaseLinkedServiceTypeProperties withUserToken(SecretBase userToken) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the QuickbaseLinkedServiceTypeProperties object itself. */ - public QuickbaseLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public QuickbaseLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ResponsysLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ResponsysLinkedServiceTypeProperties.java index ed426eb1ebfb..b7b8564c1e74 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ResponsysLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ResponsysLinkedServiceTypeProperties.java @@ -54,10 +54,10 @@ public final class ResponsysLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of ResponsysLinkedServiceTypeProperties class. */ public ResponsysLinkedServiceTypeProperties() { @@ -197,22 +197,22 @@ public ResponsysLinkedServiceTypeProperties withUsePeerVerification(Object usePe /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ResponsysLinkedServiceTypeProperties object itself. */ - public ResponsysLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public ResponsysLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/RestResourceDatasetTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/RestResourceDatasetTypeProperties.java index 722b3f6bfca4..a41af9bb36a2 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/RestResourceDatasetTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/RestResourceDatasetTypeProperties.java @@ -5,7 +5,9 @@ package com.azure.resourcemanager.datafactory.fluent.models; import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; /** Properties specific to this dataset type. */ @Fluent @@ -32,17 +34,18 @@ public final class RestResourceDatasetTypeProperties { private Object requestBody; /* - * The additional HTTP headers in the request to the RESTful API. Type: string (or Expression with resultType - * string). + * The additional HTTP headers in the request to the RESTful API. */ @JsonProperty(value = "additionalHeaders") - private Object additionalHeaders; + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map additionalHeaders; /* - * The pagination rules to compose next page requests. Type: string (or Expression with resultType string). + * The pagination rules to compose next page requests. */ @JsonProperty(value = "paginationRules") - private Object paginationRules; + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map paginationRules; /** Creates an instance of RestResourceDatasetTypeProperties class. */ public RestResourceDatasetTypeProperties() { @@ -115,45 +118,41 @@ public RestResourceDatasetTypeProperties withRequestBody(Object requestBody) { } /** - * Get the additionalHeaders property: The additional HTTP headers in the request to the RESTful API. Type: string - * (or Expression with resultType string). + * Get the additionalHeaders property: The additional HTTP headers in the request to the RESTful API. * * @return the additionalHeaders value. */ - public Object additionalHeaders() { + public Map additionalHeaders() { return this.additionalHeaders; } /** - * Set the additionalHeaders property: The additional HTTP headers in the request to the RESTful API. Type: string - * (or Expression with resultType string). + * Set the additionalHeaders property: The additional HTTP headers in the request to the RESTful API. * * @param additionalHeaders the additionalHeaders value to set. * @return the RestResourceDatasetTypeProperties object itself. */ - public RestResourceDatasetTypeProperties withAdditionalHeaders(Object additionalHeaders) { + public RestResourceDatasetTypeProperties withAdditionalHeaders(Map additionalHeaders) { this.additionalHeaders = additionalHeaders; return this; } /** - * Get the paginationRules property: The pagination rules to compose next page requests. Type: string (or Expression - * with resultType string). + * Get the paginationRules property: The pagination rules to compose next page requests. * * @return the paginationRules value. */ - public Object paginationRules() { + public Map paginationRules() { return this.paginationRules; } /** - * Set the paginationRules property: The pagination rules to compose next page requests. Type: string (or Expression - * with resultType string). + * Set the paginationRules property: The pagination rules to compose next page requests. * * @param paginationRules the paginationRules value to set. * @return the RestResourceDatasetTypeProperties object itself. */ - public RestResourceDatasetTypeProperties withPaginationRules(Object paginationRules) { + public RestResourceDatasetTypeProperties withPaginationRules(Map paginationRules) { this.paginationRules = paginationRules; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/RestServiceLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/RestServiceLinkedServiceTypeProperties.java index 321fb0648a00..7652b9e74322 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/RestServiceLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/RestServiceLinkedServiceTypeProperties.java @@ -15,7 +15,7 @@ @Fluent public final class RestServiceLinkedServiceTypeProperties { /* - * The base URL of the REST service. + * The base URL of the REST service. Type: string (or Expression with resultType string). */ @JsonProperty(value = "url", required = true) private Object url; @@ -34,7 +34,7 @@ public final class RestServiceLinkedServiceTypeProperties { private RestServiceAuthenticationType authenticationType; /* - * The user name used in Basic authentication type. + * The user name used in Basic authentication type. Type: string (or Expression with resultType string). */ @JsonProperty(value = "userName") private Object username; @@ -53,7 +53,8 @@ public final class RestServiceLinkedServiceTypeProperties { private Object authHeaders; /* - * The application's client ID used in AadServicePrincipal authentication type. + * The application's client ID used in AadServicePrincipal authentication type. Type: string (or Expression with + * resultType string). */ @JsonProperty(value = "servicePrincipalId") private Object servicePrincipalId; @@ -66,7 +67,7 @@ public final class RestServiceLinkedServiceTypeProperties { /* * The tenant information (domain name or tenant ID) used in AadServicePrincipal authentication type under which - * your application resides. + * your application resides. Type: string (or Expression with resultType string). */ @JsonProperty(value = "tenant") private Object tenant; @@ -80,17 +81,17 @@ public final class RestServiceLinkedServiceTypeProperties { private Object azureCloudType; /* - * The resource you are requesting authorization to use. + * The resource you are requesting authorization to use. Type: string (or Expression with resultType string). */ @JsonProperty(value = "aadResourceId") private Object aadResourceId; /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The credential reference containing authentication information. @@ -136,7 +137,7 @@ public RestServiceLinkedServiceTypeProperties() { } /** - * Get the url property: The base URL of the REST service. + * Get the url property: The base URL of the REST service. Type: string (or Expression with resultType string). * * @return the url value. */ @@ -145,7 +146,7 @@ public Object url() { } /** - * Set the url property: The base URL of the REST service. + * Set the url property: The base URL of the REST service. Type: string (or Expression with resultType string). * * @param url the url value to set. * @return the RestServiceLinkedServiceTypeProperties object itself. @@ -200,7 +201,8 @@ public RestServiceLinkedServiceTypeProperties withAuthenticationType( } /** - * Get the username property: The user name used in Basic authentication type. + * Get the username property: The user name used in Basic authentication type. Type: string (or Expression with + * resultType string). * * @return the username value. */ @@ -209,7 +211,8 @@ public Object username() { } /** - * Set the username property: The user name used in Basic authentication type. + * Set the username property: The user name used in Basic authentication type. Type: string (or Expression with + * resultType string). * * @param username the username value to set. * @return the RestServiceLinkedServiceTypeProperties object itself. @@ -263,6 +266,7 @@ public RestServiceLinkedServiceTypeProperties withAuthHeaders(Object authHeaders /** * Get the servicePrincipalId property: The application's client ID used in AadServicePrincipal authentication type. + * Type: string (or Expression with resultType string). * * @return the servicePrincipalId value. */ @@ -272,6 +276,7 @@ public Object servicePrincipalId() { /** * Set the servicePrincipalId property: The application's client ID used in AadServicePrincipal authentication type. + * Type: string (or Expression with resultType string). * * @param servicePrincipalId the servicePrincipalId value to set. * @return the RestServiceLinkedServiceTypeProperties object itself. @@ -303,7 +308,7 @@ public RestServiceLinkedServiceTypeProperties withServicePrincipalKey(SecretBase /** * Get the tenant property: The tenant information (domain name or tenant ID) used in AadServicePrincipal - * authentication type under which your application resides. + * authentication type under which your application resides. Type: string (or Expression with resultType string). * * @return the tenant value. */ @@ -313,7 +318,7 @@ public Object tenant() { /** * Set the tenant property: The tenant information (domain name or tenant ID) used in AadServicePrincipal - * authentication type under which your application resides. + * authentication type under which your application resides. Type: string (or Expression with resultType string). * * @param tenant the tenant value to set. * @return the RestServiceLinkedServiceTypeProperties object itself. @@ -348,7 +353,8 @@ public RestServiceLinkedServiceTypeProperties withAzureCloudType(Object azureClo } /** - * Get the aadResourceId property: The resource you are requesting authorization to use. + * Get the aadResourceId property: The resource you are requesting authorization to use. Type: string (or Expression + * with resultType string). * * @return the aadResourceId value. */ @@ -357,7 +363,8 @@ public Object aadResourceId() { } /** - * Set the aadResourceId property: The resource you are requesting authorization to use. + * Set the aadResourceId property: The resource you are requesting authorization to use. Type: string (or Expression + * with resultType string). * * @param aadResourceId the aadResourceId value to set. * @return the RestServiceLinkedServiceTypeProperties object itself. @@ -369,22 +376,22 @@ public RestServiceLinkedServiceTypeProperties withAadResourceId(Object aadResour /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the RestServiceLinkedServiceTypeProperties object itself. */ - public RestServiceLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public RestServiceLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceLinkedServiceTypeProperties.java index b4eef2e600c2..5b7f37df7b2e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceLinkedServiceTypeProperties.java @@ -46,10 +46,10 @@ public final class SalesforceLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SalesforceLinkedServiceTypeProperties class. */ public SalesforceLinkedServiceTypeProperties() { @@ -165,22 +165,22 @@ public SalesforceLinkedServiceTypeProperties withApiVersion(Object apiVersion) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SalesforceLinkedServiceTypeProperties object itself. */ - public SalesforceLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SalesforceLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceMarketingCloudLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceMarketingCloudLinkedServiceTypeProperties.java index ff85114d8bb6..62adfc956c5e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceMarketingCloudLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceMarketingCloudLinkedServiceTypeProperties.java @@ -55,10 +55,10 @@ public final class SalesforceMarketingCloudLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SalesforceMarketingCloudLinkedServiceTypeProperties class. */ public SalesforceMarketingCloudLinkedServiceTypeProperties() { @@ -200,22 +200,22 @@ public SalesforceMarketingCloudLinkedServiceTypeProperties withUsePeerVerificati /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SalesforceMarketingCloudLinkedServiceTypeProperties object itself. */ - public SalesforceMarketingCloudLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SalesforceMarketingCloudLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceServiceCloudLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceServiceCloudLinkedServiceTypeProperties.java index 779705caf71c..b9b0b9ab0b00 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceServiceCloudLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SalesforceServiceCloudLinkedServiceTypeProperties.java @@ -52,10 +52,10 @@ public final class SalesforceServiceCloudLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SalesforceServiceCloudLinkedServiceTypeProperties class. */ public SalesforceServiceCloudLinkedServiceTypeProperties() { @@ -195,22 +195,22 @@ public SalesforceServiceCloudLinkedServiceTypeProperties withExtendedProperties( /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SalesforceServiceCloudLinkedServiceTypeProperties object itself. */ - public SalesforceServiceCloudLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SalesforceServiceCloudLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapBWLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapBWLinkedServiceTypeProperties.java index 1a7d9d26debb..dac97dc3a159 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapBWLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapBWLinkedServiceTypeProperties.java @@ -46,10 +46,10 @@ public final class SapBWLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SapBWLinkedServiceTypeProperties class. */ public SapBWLinkedServiceTypeProperties() { @@ -163,22 +163,22 @@ public SapBWLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapBWLinkedServiceTypeProperties object itself. */ - public SapBWLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SapBWLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapCloudForCustomerLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapCloudForCustomerLinkedServiceTypeProperties.java index 1a9ef6e3389b..d5bccbce34c3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapCloudForCustomerLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapCloudForCustomerLinkedServiceTypeProperties.java @@ -33,11 +33,10 @@ public final class SapCloudForCustomerLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Either encryptedCredential or username/password must be provided. Type: string (or - * Expression with resultType string). + * credential manager. Either encryptedCredential or username/password must be provided. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SapCloudForCustomerLinkedServiceTypeProperties class. */ public SapCloudForCustomerLinkedServiceTypeProperties() { @@ -110,23 +109,23 @@ public SapCloudForCustomerLinkedServiceTypeProperties withPassword(SecretBase pa /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. Either encryptedCredential or username/password must be - * provided. Type: string (or Expression with resultType string). + * provided. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. Either encryptedCredential or username/password must be - * provided. Type: string (or Expression with resultType string). + * provided. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapCloudForCustomerLinkedServiceTypeProperties object itself. */ - public SapCloudForCustomerLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SapCloudForCustomerLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapEccLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapEccLinkedServiceTypeProperties.java index ca7d1a8b797a..5a1170516ccc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapEccLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapEccLinkedServiceTypeProperties.java @@ -17,13 +17,13 @@ public final class SapEccLinkedServiceTypeProperties { * string (or Expression with resultType string). */ @JsonProperty(value = "url", required = true) - private String url; + private Object url; /* * The username for Basic authentication. Type: string (or Expression with resultType string). */ @JsonProperty(value = "username") - private String username; + private Object username; /* * The password for Basic authentication. @@ -33,8 +33,7 @@ public final class SapEccLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Either encryptedCredential or username/password must be provided. Type: string (or - * Expression with resultType string). + * credential manager. Either encryptedCredential or username/password must be provided. Type: string. */ @JsonProperty(value = "encryptedCredential") private String encryptedCredential; @@ -49,7 +48,7 @@ public SapEccLinkedServiceTypeProperties() { * * @return the url value. */ - public String url() { + public Object url() { return this.url; } @@ -60,7 +59,7 @@ public String url() { * @param url the url value to set. * @return the SapEccLinkedServiceTypeProperties object itself. */ - public SapEccLinkedServiceTypeProperties withUrl(String url) { + public SapEccLinkedServiceTypeProperties withUrl(Object url) { this.url = url; return this; } @@ -71,7 +70,7 @@ public SapEccLinkedServiceTypeProperties withUrl(String url) { * * @return the username value. */ - public String username() { + public Object username() { return this.username; } @@ -82,7 +81,7 @@ public String username() { * @param username the username value to set. * @return the SapEccLinkedServiceTypeProperties object itself. */ - public SapEccLinkedServiceTypeProperties withUsername(String username) { + public SapEccLinkedServiceTypeProperties withUsername(Object username) { this.username = username; return this; } @@ -110,7 +109,7 @@ public SapEccLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. Either encryptedCredential or username/password must be - * provided. Type: string (or Expression with resultType string). + * provided. Type: string. * * @return the encryptedCredential value. */ @@ -121,7 +120,7 @@ public String encryptedCredential() { /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. Either encryptedCredential or username/password must be - * provided. Type: string (or Expression with resultType string). + * provided. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapEccLinkedServiceTypeProperties object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapHanaLinkedServiceProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapHanaLinkedServiceProperties.java index 01222b50c129..944256632ee4 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapHanaLinkedServiceProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapHanaLinkedServiceProperties.java @@ -44,10 +44,10 @@ public final class SapHanaLinkedServiceProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SapHanaLinkedServiceProperties class. */ public SapHanaLinkedServiceProperties() { @@ -159,22 +159,22 @@ public SapHanaLinkedServiceProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapHanaLinkedServiceProperties object itself. */ - public SapHanaLinkedServiceProperties withEncryptedCredential(Object encryptedCredential) { + public SapHanaLinkedServiceProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapOdpLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapOdpLinkedServiceTypeProperties.java index 46bcfde46039..ce440ca0a912 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapOdpLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapOdpLinkedServiceTypeProperties.java @@ -124,10 +124,10 @@ public final class SapOdpLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SapOdpLinkedServiceTypeProperties class. */ public SapOdpLinkedServiceTypeProperties() { @@ -505,22 +505,22 @@ public SapOdpLinkedServiceTypeProperties withSubscriberName(Object subscriberNam /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapOdpLinkedServiceTypeProperties object itself. */ - public SapOdpLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SapOdpLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapOpenHubLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapOpenHubLinkedServiceTypeProperties.java index da458c0c67d7..b1e03d513e65 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapOpenHubLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapOpenHubLinkedServiceTypeProperties.java @@ -78,10 +78,10 @@ public final class SapOpenHubLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SapOpenHubLinkedServiceTypeProperties class. */ public SapOpenHubLinkedServiceTypeProperties() { @@ -309,22 +309,22 @@ public SapOpenHubLinkedServiceTypeProperties withLogonGroup(Object logonGroup) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapOpenHubLinkedServiceTypeProperties object itself. */ - public SapOpenHubLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SapOpenHubLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapTableLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapTableLinkedServiceTypeProperties.java index ee5e1d3dbb15..b8ff837a63f1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapTableLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SapTableLinkedServiceTypeProperties.java @@ -112,10 +112,10 @@ public final class SapTableLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SapTableLinkedServiceTypeProperties class. */ public SapTableLinkedServiceTypeProperties() { @@ -451,22 +451,22 @@ public SapTableLinkedServiceTypeProperties withLogonGroup(Object logonGroup) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapTableLinkedServiceTypeProperties object itself. */ - public SapTableLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SapTableLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SelfHostedIntegrationRuntimeStatusTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SelfHostedIntegrationRuntimeStatusTypeProperties.java index ecbc559e7ca0..6aabfb2c4324 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SelfHostedIntegrationRuntimeStatusTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SelfHostedIntegrationRuntimeStatusTypeProperties.java @@ -115,6 +115,13 @@ public final class SelfHostedIntegrationRuntimeStatusTypeProperties { @JsonProperty(value = "autoUpdateETA", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime autoUpdateEta; + /* + * An alternative option to ensure interactive authoring function when your self-hosted integration runtime is + * unable to establish a connection with Azure Relay. + */ + @JsonProperty(value = "selfContainedInteractiveAuthoringEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean selfContainedInteractiveAuthoringEnabled; + /** Creates an instance of SelfHostedIntegrationRuntimeStatusTypeProperties class. */ public SelfHostedIntegrationRuntimeStatusTypeProperties() { } @@ -291,6 +298,16 @@ public OffsetDateTime autoUpdateEta() { return this.autoUpdateEta; } + /** + * Get the selfContainedInteractiveAuthoringEnabled property: An alternative option to ensure interactive authoring + * function when your self-hosted integration runtime is unable to establish a connection with Azure Relay. + * + * @return the selfContainedInteractiveAuthoringEnabled value. + */ + public Boolean selfContainedInteractiveAuthoringEnabled() { + return this.selfContainedInteractiveAuthoringEnabled; + } + /** * Validates the instance. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SelfHostedIntegrationRuntimeTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SelfHostedIntegrationRuntimeTypeProperties.java index 105cc159e477..f6b56bdcb3ed 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SelfHostedIntegrationRuntimeTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SelfHostedIntegrationRuntimeTypeProperties.java @@ -17,6 +17,13 @@ public final class SelfHostedIntegrationRuntimeTypeProperties { @JsonProperty(value = "linkedInfo") private LinkedIntegrationRuntimeType linkedInfo; + /* + * An alternative option to ensure interactive authoring function when your self-hosted integration runtime is + * unable to establish a connection with Azure Relay. + */ + @JsonProperty(value = "selfContainedInteractiveAuthoringEnabled") + private Boolean selfContainedInteractiveAuthoringEnabled; + /** Creates an instance of SelfHostedIntegrationRuntimeTypeProperties class. */ public SelfHostedIntegrationRuntimeTypeProperties() { } @@ -41,6 +48,29 @@ public SelfHostedIntegrationRuntimeTypeProperties withLinkedInfo(LinkedIntegrati return this; } + /** + * Get the selfContainedInteractiveAuthoringEnabled property: An alternative option to ensure interactive authoring + * function when your self-hosted integration runtime is unable to establish a connection with Azure Relay. + * + * @return the selfContainedInteractiveAuthoringEnabled value. + */ + public Boolean selfContainedInteractiveAuthoringEnabled() { + return this.selfContainedInteractiveAuthoringEnabled; + } + + /** + * Set the selfContainedInteractiveAuthoringEnabled property: An alternative option to ensure interactive authoring + * function when your self-hosted integration runtime is unable to establish a connection with Azure Relay. + * + * @param selfContainedInteractiveAuthoringEnabled the selfContainedInteractiveAuthoringEnabled value to set. + * @return the SelfHostedIntegrationRuntimeTypeProperties object itself. + */ + public SelfHostedIntegrationRuntimeTypeProperties withSelfContainedInteractiveAuthoringEnabled( + Boolean selfContainedInteractiveAuthoringEnabled) { + this.selfContainedInteractiveAuthoringEnabled = selfContainedInteractiveAuthoringEnabled; + return this; + } + /** * Validates the instance. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ServiceNowLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ServiceNowLinkedServiceTypeProperties.java index fadca18cd9a4..db10ef54897b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ServiceNowLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ServiceNowLinkedServiceTypeProperties.java @@ -70,10 +70,10 @@ public final class ServiceNowLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of ServiceNowLinkedServiceTypeProperties class. */ public ServiceNowLinkedServiceTypeProperties() { @@ -270,22 +270,22 @@ public ServiceNowLinkedServiceTypeProperties withUsePeerVerification(Object useP /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ServiceNowLinkedServiceTypeProperties object itself. */ - public ServiceNowLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public ServiceNowLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SetVariableActivityTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SetVariableActivityTypeProperties.java index fac13bcb719b..a93c44d17a86 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SetVariableActivityTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SetVariableActivityTypeProperties.java @@ -17,11 +17,17 @@ public final class SetVariableActivityTypeProperties { private String variableName; /* - * Value to be set. Could be a static value or Expression + * Value to be set. Could be a static value or Expression. */ @JsonProperty(value = "value") private Object value; + /* + * If set to true, it sets the pipeline run return value. + */ + @JsonProperty(value = "setSystemVariable") + private Boolean setSystemVariable; + /** Creates an instance of SetVariableActivityTypeProperties class. */ public SetVariableActivityTypeProperties() { } @@ -66,6 +72,26 @@ public SetVariableActivityTypeProperties withValue(Object value) { return this; } + /** + * Get the setSystemVariable property: If set to true, it sets the pipeline run return value. + * + * @return the setSystemVariable value. + */ + public Boolean setSystemVariable() { + return this.setSystemVariable; + } + + /** + * Set the setSystemVariable property: If set to true, it sets the pipeline run return value. + * + * @param setSystemVariable the setSystemVariable value to set. + * @return the SetVariableActivityTypeProperties object itself. + */ + public SetVariableActivityTypeProperties withSetSystemVariable(Boolean setSystemVariable) { + this.setSystemVariable = setSystemVariable; + return this; + } + /** * Validates the instance. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SftpServerLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SftpServerLinkedServiceTypeProperties.java index 0f19a29a91fb..77a1a88534bc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SftpServerLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SftpServerLinkedServiceTypeProperties.java @@ -46,10 +46,10 @@ public final class SftpServerLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * The SSH private key file path for SshPublicKey authentication. Only valid for on-premises copy. For on-premises @@ -197,22 +197,22 @@ public SftpServerLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SftpServerLinkedServiceTypeProperties object itself. */ - public SftpServerLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SftpServerLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SharePointOnlineListLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SharePointOnlineListLinkedServiceTypeProperties.java index 14c4d3c9e56a..402410708521 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SharePointOnlineListLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SharePointOnlineListLinkedServiceTypeProperties.java @@ -42,10 +42,10 @@ public final class SharePointOnlineListLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SharePointOnlineListLinkedServiceTypeProperties class. */ public SharePointOnlineListLinkedServiceTypeProperties() { @@ -143,22 +143,22 @@ public SharePointOnlineListLinkedServiceTypeProperties withServicePrincipalKey(S /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SharePointOnlineListLinkedServiceTypeProperties object itself. */ - public SharePointOnlineListLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SharePointOnlineListLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ShopifyLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ShopifyLinkedServiceTypeProperties.java index 0a383d8c999d..1ad2887bd8ae 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ShopifyLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ShopifyLinkedServiceTypeProperties.java @@ -45,10 +45,10 @@ public final class ShopifyLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of ShopifyLinkedServiceTypeProperties class. */ public ShopifyLinkedServiceTypeProperties() { @@ -164,22 +164,22 @@ public ShopifyLinkedServiceTypeProperties withUsePeerVerification(Object usePeer /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ShopifyLinkedServiceTypeProperties object itself. */ - public ShopifyLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public ShopifyLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SmartsheetLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SmartsheetLinkedServiceTypeProperties.java index 56c81ff47861..c2df6853c292 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SmartsheetLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SmartsheetLinkedServiceTypeProperties.java @@ -20,10 +20,10 @@ public final class SmartsheetLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SmartsheetLinkedServiceTypeProperties class. */ public SmartsheetLinkedServiceTypeProperties() { @@ -51,22 +51,22 @@ public SmartsheetLinkedServiceTypeProperties withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SmartsheetLinkedServiceTypeProperties object itself. */ - public SmartsheetLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SmartsheetLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SnowflakeLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SnowflakeLinkedServiceTypeProperties.java index 07d2dcb060a2..bb9313e90111 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SnowflakeLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SnowflakeLinkedServiceTypeProperties.java @@ -26,10 +26,10 @@ public final class SnowflakeLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SnowflakeLinkedServiceTypeProperties class. */ public SnowflakeLinkedServiceTypeProperties() { @@ -77,22 +77,22 @@ public SnowflakeLinkedServiceTypeProperties withPassword(AzureKeyVaultSecretRefe /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SnowflakeLinkedServiceTypeProperties object itself. */ - public SnowflakeLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SnowflakeLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SparkLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SparkLinkedServiceTypeProperties.java index b5f6f19d486a..ae545cf6154d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SparkLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SparkLinkedServiceTypeProperties.java @@ -99,10 +99,10 @@ public final class SparkLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SparkLinkedServiceTypeProperties class. */ public SparkLinkedServiceTypeProperties() { @@ -383,22 +383,22 @@ public SparkLinkedServiceTypeProperties withAllowSelfSignedServerCert(Object all /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SparkLinkedServiceTypeProperties object itself. */ - public SparkLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SparkLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SqlServerLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SqlServerLinkedServiceTypeProperties.java index a62f97fd1624..627b6adc882e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SqlServerLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SqlServerLinkedServiceTypeProperties.java @@ -33,10 +33,10 @@ public final class SqlServerLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /* * Sql always encrypted properties. @@ -114,22 +114,22 @@ public SqlServerLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SqlServerLinkedServiceTypeProperties object itself. */ - public SqlServerLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SqlServerLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SquareLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SquareLinkedServiceTypeProperties.java index 4730da6e62da..d834585dd73d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SquareLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SquareLinkedServiceTypeProperties.java @@ -19,7 +19,7 @@ public final class SquareLinkedServiceTypeProperties { private Object connectionProperties; /* - * The URL of the Square instance. (i.e. mystore.mysquare.com) + * The URL of the Square instance. (i.e. mystore.mysquare.com) */ @JsonProperty(value = "host") private Object host; @@ -63,10 +63,10 @@ public final class SquareLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SquareLinkedServiceTypeProperties class. */ public SquareLinkedServiceTypeProperties() { @@ -95,7 +95,7 @@ public SquareLinkedServiceTypeProperties withConnectionProperties(Object connect } /** - * Get the host property: The URL of the Square instance. (i.e. mystore.mysquare.com). + * Get the host property: The URL of the Square instance. (i.e. mystore.mysquare.com). * * @return the host value. */ @@ -104,7 +104,7 @@ public Object host() { } /** - * Set the host property: The URL of the Square instance. (i.e. mystore.mysquare.com). + * Set the host property: The URL of the Square instance. (i.e. mystore.mysquare.com). * * @param host the host value to set. * @return the SquareLinkedServiceTypeProperties object itself. @@ -244,22 +244,22 @@ public SquareLinkedServiceTypeProperties withUsePeerVerification(Object usePeerV /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SquareLinkedServiceTypeProperties object itself. */ - public SquareLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SquareLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SybaseLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SybaseLinkedServiceTypeProperties.java index c4e7f43c2e0c..21d1c66c6c43 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SybaseLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SybaseLinkedServiceTypeProperties.java @@ -51,10 +51,10 @@ public final class SybaseLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of SybaseLinkedServiceTypeProperties class. */ public SybaseLinkedServiceTypeProperties() { @@ -182,22 +182,22 @@ public SybaseLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SybaseLinkedServiceTypeProperties object itself. */ - public SybaseLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public SybaseLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SynapseNotebookActivityTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SynapseNotebookActivityTypeProperties.java index c2aa1bb3016d..670a829065de 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SynapseNotebookActivityTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/SynapseNotebookActivityTypeProperties.java @@ -7,7 +7,9 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.datafactory.models.BigDataPoolParametrizationReference; +import com.azure.resourcemanager.datafactory.models.ConfigurationType; import com.azure.resourcemanager.datafactory.models.NotebookParameter; +import com.azure.resourcemanager.datafactory.models.SparkConfigurationParametrizationReference; import com.azure.resourcemanager.datafactory.models.SynapseNotebookReference; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -59,10 +61,29 @@ public final class SynapseNotebookActivityTypeProperties { /* * Number of executors to launch for this session, which will override the 'numExecutors' of the notebook you - * provide. + * provide. Type: integer (or Expression with resultType integer). */ @JsonProperty(value = "numExecutors") - private Integer numExecutors; + private Object numExecutors; + + /* + * The type of the spark config. + */ + @JsonProperty(value = "configurationType") + private ConfigurationType configurationType; + + /* + * The spark configuration of the spark job. + */ + @JsonProperty(value = "targetSparkConfiguration") + private SparkConfigurationParametrizationReference targetSparkConfiguration; + + /* + * Spark configuration property. + */ + @JsonProperty(value = "sparkConfig") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map sparkConfig; /** Creates an instance of SynapseNotebookActivityTypeProperties class. */ public SynapseNotebookActivityTypeProperties() { @@ -200,26 +221,87 @@ public SynapseNotebookActivityTypeProperties withDriverSize(Object driverSize) { /** * Get the numExecutors property: Number of executors to launch for this session, which will override the - * 'numExecutors' of the notebook you provide. + * 'numExecutors' of the notebook you provide. Type: integer (or Expression with resultType integer). * * @return the numExecutors value. */ - public Integer numExecutors() { + public Object numExecutors() { return this.numExecutors; } /** * Set the numExecutors property: Number of executors to launch for this session, which will override the - * 'numExecutors' of the notebook you provide. + * 'numExecutors' of the notebook you provide. Type: integer (or Expression with resultType integer). * * @param numExecutors the numExecutors value to set. * @return the SynapseNotebookActivityTypeProperties object itself. */ - public SynapseNotebookActivityTypeProperties withNumExecutors(Integer numExecutors) { + public SynapseNotebookActivityTypeProperties withNumExecutors(Object numExecutors) { this.numExecutors = numExecutors; return this; } + /** + * Get the configurationType property: The type of the spark config. + * + * @return the configurationType value. + */ + public ConfigurationType configurationType() { + return this.configurationType; + } + + /** + * Set the configurationType property: The type of the spark config. + * + * @param configurationType the configurationType value to set. + * @return the SynapseNotebookActivityTypeProperties object itself. + */ + public SynapseNotebookActivityTypeProperties withConfigurationType(ConfigurationType configurationType) { + this.configurationType = configurationType; + return this; + } + + /** + * Get the targetSparkConfiguration property: The spark configuration of the spark job. + * + * @return the targetSparkConfiguration value. + */ + public SparkConfigurationParametrizationReference targetSparkConfiguration() { + return this.targetSparkConfiguration; + } + + /** + * Set the targetSparkConfiguration property: The spark configuration of the spark job. + * + * @param targetSparkConfiguration the targetSparkConfiguration value to set. + * @return the SynapseNotebookActivityTypeProperties object itself. + */ + public SynapseNotebookActivityTypeProperties withTargetSparkConfiguration( + SparkConfigurationParametrizationReference targetSparkConfiguration) { + this.targetSparkConfiguration = targetSparkConfiguration; + return this; + } + + /** + * Get the sparkConfig property: Spark configuration property. + * + * @return the sparkConfig value. + */ + public Map sparkConfig() { + return this.sparkConfig; + } + + /** + * Set the sparkConfig property: Spark configuration property. + * + * @param sparkConfig the sparkConfig value to set. + * @return the SynapseNotebookActivityTypeProperties object itself. + */ + public SynapseNotebookActivityTypeProperties withSparkConfig(Map sparkConfig) { + this.sparkConfig = sparkConfig; + return this; + } + /** * Validates the instance. * @@ -247,6 +329,9 @@ public void validate() { } }); } + if (targetSparkConfiguration() != null) { + targetSparkConfiguration().validate(); + } } private static final ClientLogger LOGGER = new ClientLogger(SynapseNotebookActivityTypeProperties.class); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TeamDeskLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TeamDeskLinkedServiceTypeProperties.java index 877343ff1544..ae0be9dd1120 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TeamDeskLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TeamDeskLinkedServiceTypeProperties.java @@ -45,10 +45,10 @@ public final class TeamDeskLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of TeamDeskLinkedServiceTypeProperties class. */ public TeamDeskLinkedServiceTypeProperties() { @@ -158,22 +158,22 @@ public TeamDeskLinkedServiceTypeProperties withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the TeamDeskLinkedServiceTypeProperties object itself. */ - public TeamDeskLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public TeamDeskLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TeradataLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TeradataLinkedServiceTypeProperties.java index fb1ffe6a9c8c..a4396ec9fcbe 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TeradataLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TeradataLinkedServiceTypeProperties.java @@ -44,10 +44,10 @@ public final class TeradataLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of TeradataLinkedServiceTypeProperties class. */ public TeradataLinkedServiceTypeProperties() { @@ -157,22 +157,22 @@ public TeradataLinkedServiceTypeProperties withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the TeradataLinkedServiceTypeProperties object itself. */ - public TeradataLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public TeradataLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TwilioLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TwilioLinkedServiceTypeProperties.java index 44e50c9cc30a..edddab4d7657 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TwilioLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/TwilioLinkedServiceTypeProperties.java @@ -13,7 +13,7 @@ @Fluent public final class TwilioLinkedServiceTypeProperties { /* - * The Account SID of Twilio service. + * The Account SID of Twilio service. Type: string (or Expression with resultType string). */ @JsonProperty(value = "userName", required = true) private Object username; @@ -29,7 +29,8 @@ public TwilioLinkedServiceTypeProperties() { } /** - * Get the username property: The Account SID of Twilio service. + * Get the username property: The Account SID of Twilio service. Type: string (or Expression with resultType + * string). * * @return the username value. */ @@ -38,7 +39,8 @@ public Object username() { } /** - * Set the username property: The Account SID of Twilio service. + * Set the username property: The Account SID of Twilio service. Type: string (or Expression with resultType + * string). * * @param username the username value to set. * @return the TwilioLinkedServiceTypeProperties object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/UntilActivityTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/UntilActivityTypeProperties.java index eacca70d6f76..ef83dde4c10f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/UntilActivityTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/UntilActivityTypeProperties.java @@ -23,8 +23,7 @@ public final class UntilActivityTypeProperties { /* * Specifies the timeout for the activity to run. If there is no value specified, it takes the value of * TimeSpan.FromDays(7) which is 1 week as default. Type: string (or Expression with resultType string), pattern: - * ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). Type: string (or Expression with resultType string), - * pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). */ @JsonProperty(value = "timeout") private Object timeout; @@ -64,8 +63,7 @@ public UntilActivityTypeProperties withExpression(Expression expression) { /** * Get the timeout property: Specifies the timeout for the activity to run. If there is no value specified, it takes * the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or Expression with resultType - * string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). Type: string (or Expression with - * resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). * * @return the timeout value. */ @@ -76,8 +74,7 @@ public Object timeout() { /** * Set the timeout property: Specifies the timeout for the activity to run. If there is no value specified, it takes * the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or Expression with resultType - * string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). Type: string (or Expression with - * resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). * * @param timeout the timeout value to set. * @return the UntilActivityTypeProperties object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/VerticaLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/VerticaLinkedServiceTypeProperties.java index b62501b0e2bc..15013ba75c40 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/VerticaLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/VerticaLinkedServiceTypeProperties.java @@ -25,10 +25,10 @@ public final class VerticaLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of VerticaLinkedServiceTypeProperties class. */ public VerticaLinkedServiceTypeProperties() { @@ -78,22 +78,22 @@ public VerticaLinkedServiceTypeProperties withPwd(AzureKeyVaultSecretReference p /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the VerticaLinkedServiceTypeProperties object itself. */ - public VerticaLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public VerticaLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/WaitActivityTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/WaitActivityTypeProperties.java index 9c19591d0b5b..2ba02ffed7e1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/WaitActivityTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/WaitActivityTypeProperties.java @@ -12,7 +12,7 @@ @Fluent public final class WaitActivityTypeProperties { /* - * Duration in seconds. + * Duration in seconds. Type: integer (or Expression with resultType integer). */ @JsonProperty(value = "waitTimeInSeconds", required = true) private Object waitTimeInSeconds; @@ -22,7 +22,7 @@ public WaitActivityTypeProperties() { } /** - * Get the waitTimeInSeconds property: Duration in seconds. + * Get the waitTimeInSeconds property: Duration in seconds. Type: integer (or Expression with resultType integer). * * @return the waitTimeInSeconds value. */ @@ -31,7 +31,7 @@ public Object waitTimeInSeconds() { } /** - * Set the waitTimeInSeconds property: Duration in seconds. + * Set the waitTimeInSeconds property: Duration in seconds. Type: integer (or Expression with resultType integer). * * @param waitTimeInSeconds the waitTimeInSeconds value to set. * @return the WaitActivityTypeProperties object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/XeroLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/XeroLinkedServiceTypeProperties.java index acf176d795e0..c960ddf72e65 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/XeroLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/XeroLinkedServiceTypeProperties.java @@ -59,10 +59,10 @@ public final class XeroLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of XeroLinkedServiceTypeProperties class. */ public XeroLinkedServiceTypeProperties() { @@ -220,22 +220,22 @@ public XeroLinkedServiceTypeProperties withUsePeerVerification(Object usePeerVer /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the XeroLinkedServiceTypeProperties object itself. */ - public XeroLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public XeroLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ZendeskLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ZendeskLinkedServiceTypeProperties.java index 84539acda81f..f6451132a041 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ZendeskLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ZendeskLinkedServiceTypeProperties.java @@ -45,10 +45,10 @@ public final class ZendeskLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of ZendeskLinkedServiceTypeProperties class. */ public ZendeskLinkedServiceTypeProperties() { @@ -158,22 +158,22 @@ public ZendeskLinkedServiceTypeProperties withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ZendeskLinkedServiceTypeProperties object itself. */ - public ZendeskLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public ZendeskLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ZohoLinkedServiceTypeProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ZohoLinkedServiceTypeProperties.java index b76c3254764f..b4262db6b80b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ZohoLinkedServiceTypeProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/ZohoLinkedServiceTypeProperties.java @@ -51,10 +51,10 @@ public final class ZohoLinkedServiceTypeProperties { /* * The encrypted credential used for authentication. Credentials are encrypted using the integration runtime - * credential manager. Type: string (or Expression with resultType string). + * credential manager. Type: string. */ @JsonProperty(value = "encryptedCredential") - private Object encryptedCredential; + private String encryptedCredential; /** Creates an instance of ZohoLinkedServiceTypeProperties class. */ public ZohoLinkedServiceTypeProperties() { @@ -190,22 +190,22 @@ public ZohoLinkedServiceTypeProperties withUsePeerVerification(Object usePeerVer /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.encryptedCredential; } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ZohoLinkedServiceTypeProperties object itself. */ - public ZohoLinkedServiceTypeProperties withEncryptedCredential(Object encryptedCredential) { + public ZohoLinkedServiceTypeProperties withEncryptedCredential(String encryptedCredential) { this.encryptedCredential = encryptedCredential; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ActivityRunsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ActivityRunsClientImpl.java index 9f27731f1b6f..0e0fbbde620a 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ActivityRunsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ActivityRunsClientImpl.java @@ -55,8 +55,7 @@ public final class ActivityRunsClientImpl implements ActivityRunsClient { public interface ActivityRunsService { @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/pipelineruns/{runId}/queryActivityruns") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelineruns/{runId}/queryActivityruns") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> queryByPipelineRun( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ChangeDataCaptureResourceImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ChangeDataCaptureResourceImpl.java new file mode 100644 index 000000000000..d3b96ee51534 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ChangeDataCaptureResourceImpl.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCaptureResourceInner; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureFolder; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureResource; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ChangeDataCaptureResourceImpl + implements ChangeDataCaptureResource, ChangeDataCaptureResource.Definition, ChangeDataCaptureResource.Update { + private ChangeDataCaptureResourceInner innerObject; + + private final com.azure.resourcemanager.datafactory.DataFactoryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public Map additionalProperties() { + Map inner = this.innerModel().additionalProperties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ChangeDataCaptureFolder folder() { + return this.innerModel().folder(); + } + + public String description() { + return this.innerModel().description(); + } + + public List sourceConnectionsInfo() { + List inner = this.innerModel().sourceConnectionsInfo(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List targetConnectionsInfo() { + List inner = this.innerModel().targetConnectionsInfo(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MapperPolicy policy() { + return this.innerModel().policy(); + } + + public Boolean allowVNetOverride() { + return this.innerModel().allowVNetOverride(); + } + + public String status() { + return this.innerModel().status(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ChangeDataCaptureResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.datafactory.DataFactoryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String factoryName; + + private String changeDataCaptureName; + + private String createIfMatch; + + private String updateIfMatch; + + public ChangeDataCaptureResourceImpl withExistingFactory(String resourceGroupName, String factoryName) { + this.resourceGroupName = resourceGroupName; + this.factoryName = factoryName; + return this; + } + + public ChangeDataCaptureResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getChangeDataCaptures() + .createOrUpdateWithResponse( + resourceGroupName, + factoryName, + changeDataCaptureName, + this.innerModel(), + createIfMatch, + Context.NONE) + .getValue(); + return this; + } + + public ChangeDataCaptureResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getChangeDataCaptures() + .createOrUpdateWithResponse( + resourceGroupName, factoryName, changeDataCaptureName, this.innerModel(), createIfMatch, context) + .getValue(); + return this; + } + + ChangeDataCaptureResourceImpl( + String name, com.azure.resourcemanager.datafactory.DataFactoryManager serviceManager) { + this.innerObject = new ChangeDataCaptureResourceInner(); + this.serviceManager = serviceManager; + this.changeDataCaptureName = name; + this.createIfMatch = null; + } + + public ChangeDataCaptureResourceImpl update() { + this.updateIfMatch = null; + return this; + } + + public ChangeDataCaptureResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getChangeDataCaptures() + .createOrUpdateWithResponse( + resourceGroupName, + factoryName, + changeDataCaptureName, + this.innerModel(), + updateIfMatch, + Context.NONE) + .getValue(); + return this; + } + + public ChangeDataCaptureResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getChangeDataCaptures() + .createOrUpdateWithResponse( + resourceGroupName, factoryName, changeDataCaptureName, this.innerModel(), updateIfMatch, context) + .getValue(); + return this; + } + + ChangeDataCaptureResourceImpl( + ChangeDataCaptureResourceInner innerObject, + com.azure.resourcemanager.datafactory.DataFactoryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.factoryName = Utils.getValueFromIdByName(innerObject.id(), "factories"); + this.changeDataCaptureName = Utils.getValueFromIdByName(innerObject.id(), "adfcdcs"); + } + + public ChangeDataCaptureResource refresh() { + String localIfNoneMatch = null; + this.innerObject = + serviceManager + .serviceClient() + .getChangeDataCaptures() + .getWithResponse(resourceGroupName, factoryName, changeDataCaptureName, localIfNoneMatch, Context.NONE) + .getValue(); + return this; + } + + public ChangeDataCaptureResource refresh(Context context) { + String localIfNoneMatch = null; + this.innerObject = + serviceManager + .serviceClient() + .getChangeDataCaptures() + .getWithResponse(resourceGroupName, factoryName, changeDataCaptureName, localIfNoneMatch, context) + .getValue(); + return this; + } + + public Response startWithResponse(Context context) { + return serviceManager + .changeDataCaptures() + .startWithResponse(resourceGroupName, factoryName, changeDataCaptureName, context); + } + + public void start() { + serviceManager.changeDataCaptures().start(resourceGroupName, factoryName, changeDataCaptureName); + } + + public Response stopWithResponse(Context context) { + return serviceManager + .changeDataCaptures() + .stopWithResponse(resourceGroupName, factoryName, changeDataCaptureName, context); + } + + public void stop() { + serviceManager.changeDataCaptures().stop(resourceGroupName, factoryName, changeDataCaptureName); + } + + public ChangeDataCaptureResourceImpl withSourceConnectionsInfo( + List sourceConnectionsInfo) { + this.innerModel().withSourceConnectionsInfo(sourceConnectionsInfo); + return this; + } + + public ChangeDataCaptureResourceImpl withTargetConnectionsInfo( + List targetConnectionsInfo) { + this.innerModel().withTargetConnectionsInfo(targetConnectionsInfo); + return this; + } + + public ChangeDataCaptureResourceImpl withPolicy(MapperPolicy policy) { + this.innerModel().withPolicy(policy); + return this; + } + + public ChangeDataCaptureResourceImpl withAdditionalProperties(Map additionalProperties) { + this.innerModel().withAdditionalProperties(additionalProperties); + return this; + } + + public ChangeDataCaptureResourceImpl withFolder(ChangeDataCaptureFolder folder) { + this.innerModel().withFolder(folder); + return this; + } + + public ChangeDataCaptureResourceImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public ChangeDataCaptureResourceImpl withAllowVNetOverride(Boolean allowVNetOverride) { + this.innerModel().withAllowVNetOverride(allowVNetOverride); + return this; + } + + public ChangeDataCaptureResourceImpl withStatus(String status) { + this.innerModel().withStatus(status); + return this; + } + + public ChangeDataCaptureResourceImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.createIfMatch = ifMatch; + return this; + } else { + this.updateIfMatch = ifMatch; + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ChangeDataCapturesClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ChangeDataCapturesClientImpl.java new file mode 100644 index 000000000000..fb31b4e10fc2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ChangeDataCapturesClientImpl.java @@ -0,0 +1,1457 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.datafactory.fluent.ChangeDataCapturesClient; +import com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCaptureResourceInner; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ChangeDataCapturesClient. */ +public final class ChangeDataCapturesClientImpl implements ChangeDataCapturesClient { + /** The proxy service used to perform REST calls. */ + private final ChangeDataCapturesService service; + + /** The service client containing this operation class. */ + private final DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of ChangeDataCapturesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChangeDataCapturesClientImpl(DataFactoryManagementClientImpl client) { + this.service = + RestProxy.create(ChangeDataCapturesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DataFactoryManagementClientChangeDataCaptures to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DataFactoryManagemen") + public interface ChangeDataCapturesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/adfcdcs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFactory( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("factoryName") String factoryName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/adfcdcs/{changeDataCaptureName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("factoryName") String factoryName, + @PathParam("changeDataCaptureName") String changeDataCaptureName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("If-Match") String ifMatch, + @BodyParam("application/json") ChangeDataCaptureResourceInner changeDataCapture, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/adfcdcs/{changeDataCaptureName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("factoryName") String factoryName, + @PathParam("changeDataCaptureName") String changeDataCaptureName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("If-None-Match") String ifNoneMatch, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/adfcdcs/{changeDataCaptureName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("factoryName") String factoryName, + @PathParam("changeDataCaptureName") String changeDataCaptureName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/adfcdcs/{changeDataCaptureName}/start") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> start( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("factoryName") String factoryName, + @PathParam("changeDataCaptureName") String changeDataCaptureName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/adfcdcs/{changeDataCaptureName}/stop") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> stop( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("factoryName") String factoryName, + @PathParam("changeDataCaptureName") String changeDataCaptureName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/adfcdcs/{changeDataCaptureName}/status") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> status( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("factoryName") String factoryName, + @PathParam("changeDataCaptureName") String changeDataCaptureName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFactoryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFactorySinglePageAsync( + String resourceGroupName, String factoryName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByFactory( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFactorySinglePageAsync( + String resourceGroupName, String factoryName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByFactory( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFactoryAsync(String resourceGroupName, String factoryName) { + return new PagedFlux<>( + () -> listByFactorySinglePageAsync(resourceGroupName, factoryName), + nextLink -> listByFactoryNextSinglePageAsync(nextLink)); + } + + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFactoryAsync( + String resourceGroupName, String factoryName, Context context) { + return new PagedFlux<>( + () -> listByFactorySinglePageAsync(resourceGroupName, factoryName, context), + nextLink -> listByFactoryNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFactory(String resourceGroupName, String factoryName) { + return new PagedIterable<>(listByFactoryAsync(resourceGroupName, factoryName)); + } + + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFactory( + String resourceGroupName, String factoryName, Context context) { + return new PagedIterable<>(listByFactoryAsync(resourceGroupName, factoryName, context)); + } + + /** + * Creates or updates a change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param changeDataCapture Change data capture resource definition. + * @param ifMatch ETag of the change data capture entity. Should only be specified for update, for which it should + * match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change data capture resource type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + ChangeDataCaptureResourceInner changeDataCapture, + String ifMatch) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + if (changeDataCapture == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCapture is required and cannot be null.")); + } else { + changeDataCapture.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + ifMatch, + changeDataCapture, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param changeDataCapture Change data capture resource definition. + * @param ifMatch ETag of the change data capture entity. Should only be specified for update, for which it should + * match existing entity or can be * for unconditional update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change data capture resource type along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + ChangeDataCaptureResourceInner changeDataCapture, + String ifMatch, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + if (changeDataCapture == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCapture is required and cannot be null.")); + } else { + changeDataCapture.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + ifMatch, + changeDataCapture, + accept, + context); + } + + /** + * Creates or updates a change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param changeDataCapture Change data capture resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change data capture resource type on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + ChangeDataCaptureResourceInner changeDataCapture) { + final String ifMatch = null; + return createOrUpdateWithResponseAsync( + resourceGroupName, factoryName, changeDataCaptureName, changeDataCapture, ifMatch) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param changeDataCapture Change data capture resource definition. + * @param ifMatch ETag of the change data capture entity. Should only be specified for update, for which it should + * match existing entity or can be * for unconditional update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change data capture resource type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + ChangeDataCaptureResourceInner changeDataCapture, + String ifMatch, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, factoryName, changeDataCaptureName, changeDataCapture, ifMatch, context) + .block(); + } + + /** + * Creates or updates a change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param changeDataCapture Change data capture resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change data capture resource type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChangeDataCaptureResourceInner createOrUpdate( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + ChangeDataCaptureResourceInner changeDataCapture) { + final String ifMatch = null; + return createOrUpdateWithResponse( + resourceGroupName, factoryName, changeDataCaptureName, changeDataCapture, ifMatch, Context.NONE) + .getValue(); + } + + /** + * Gets a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param ifNoneMatch ETag of the change data capture entity. Should only be specified for get. If the ETag matches + * the existing entity tag, or if * was provided, then no content will be returned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName, String ifNoneMatch) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + ifNoneMatch, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param ifNoneMatch ETag of the change data capture entity. Should only be specified for get. If the ETag matches + * the existing entity tag, or if * was provided, then no content will be returned. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + String ifNoneMatch, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + ifNoneMatch, + accept, + context); + } + + /** + * Gets a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName) { + final String ifNoneMatch = null; + return getWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName, ifNoneMatch) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param ifNoneMatch ETag of the change data capture entity. Should only be specified for get. If the ETag matches + * the existing entity tag, or if * was provided, then no content will be returned. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + String ifNoneMatch, + Context context) { + return getWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName, ifNoneMatch, context) + .block(); + } + + /** + * Gets a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChangeDataCaptureResourceInner get( + String resourceGroupName, String factoryName, String changeDataCaptureName) { + final String ifNoneMatch = null; + return getWithResponse(resourceGroupName, factoryName, changeDataCaptureName, ifNoneMatch, Context.NONE) + .getValue(); + } + + /** + * Deletes a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String factoryName, String changeDataCaptureName) { + return deleteWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + return deleteWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName, context).block(); + } + + /** + * Deletes a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String factoryName, String changeDataCaptureName) { + deleteWithResponse(resourceGroupName, factoryName, changeDataCaptureName, Context.NONE); + } + + /** + * Starts a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startWithResponseAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startWithResponseAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Starts a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String factoryName, String changeDataCaptureName) { + return startWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Starts a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + return startWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName, context).block(); + } + + /** + * Starts a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String factoryName, String changeDataCaptureName) { + startWithResponse(resourceGroupName, factoryName, changeDataCaptureName, Context.NONE); + } + + /** + * Stops a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> stopWithResponseAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Stops a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> stopWithResponseAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Stops a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String factoryName, String changeDataCaptureName) { + return stopWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Stops a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + return stopWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName, context).block(); + } + + /** + * Stops a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceGroupName, String factoryName, String changeDataCaptureName) { + stopWithResponse(resourceGroupName, factoryName, changeDataCaptureName, Context.NONE); + } + + /** + * Gets the current status for the change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status for the change data capture resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> statusWithResponseAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .status( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the current status for the change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status for the change data capture resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> statusWithResponseAsync( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (factoryName == null) { + return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null.")); + } + if (changeDataCaptureName == null) { + return Mono + .error(new IllegalArgumentException("Parameter changeDataCaptureName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .status( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + factoryName, + changeDataCaptureName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the current status for the change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status for the change data capture resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono statusAsync(String resourceGroupName, String factoryName, String changeDataCaptureName) { + return statusWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the current status for the change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status for the change data capture resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response statusWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + return statusWithResponseAsync(resourceGroupName, factoryName, changeDataCaptureName, context).block(); + } + + /** + * Gets the current status for the change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status for the change data capture resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public String status(String resourceGroupName, String factoryName, String changeDataCaptureName) { + return statusWithResponse(resourceGroupName, factoryName, changeDataCaptureName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFactoryNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByFactoryNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFactoryNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByFactoryNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ChangeDataCapturesImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ChangeDataCapturesImpl.java new file mode 100644 index 000000000000..6c42a7ef82d5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ChangeDataCapturesImpl.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datafactory.fluent.ChangeDataCapturesClient; +import com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCaptureResourceInner; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureResource; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptures; + +public final class ChangeDataCapturesImpl implements ChangeDataCaptures { + private static final ClientLogger LOGGER = new ClientLogger(ChangeDataCapturesImpl.class); + + private final ChangeDataCapturesClient innerClient; + + private final com.azure.resourcemanager.datafactory.DataFactoryManager serviceManager; + + public ChangeDataCapturesImpl( + ChangeDataCapturesClient innerClient, com.azure.resourcemanager.datafactory.DataFactoryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByFactory(String resourceGroupName, String factoryName) { + PagedIterable inner = + this.serviceClient().listByFactory(resourceGroupName, factoryName); + return Utils.mapPage(inner, inner1 -> new ChangeDataCaptureResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByFactory( + String resourceGroupName, String factoryName, Context context) { + PagedIterable inner = + this.serviceClient().listByFactory(resourceGroupName, factoryName, context); + return Utils.mapPage(inner, inner1 -> new ChangeDataCaptureResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + String ifNoneMatch, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, factoryName, changeDataCaptureName, ifNoneMatch, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ChangeDataCaptureResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ChangeDataCaptureResource get(String resourceGroupName, String factoryName, String changeDataCaptureName) { + ChangeDataCaptureResourceInner inner = + this.serviceClient().get(resourceGroupName, factoryName, changeDataCaptureName); + if (inner != null) { + return new ChangeDataCaptureResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, factoryName, changeDataCaptureName, context); + } + + public void delete(String resourceGroupName, String factoryName, String changeDataCaptureName) { + this.serviceClient().delete(resourceGroupName, factoryName, changeDataCaptureName); + } + + public Response startWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + return this.serviceClient().startWithResponse(resourceGroupName, factoryName, changeDataCaptureName, context); + } + + public void start(String resourceGroupName, String factoryName, String changeDataCaptureName) { + this.serviceClient().start(resourceGroupName, factoryName, changeDataCaptureName); + } + + public Response stopWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + return this.serviceClient().stopWithResponse(resourceGroupName, factoryName, changeDataCaptureName, context); + } + + public void stop(String resourceGroupName, String factoryName, String changeDataCaptureName) { + this.serviceClient().stop(resourceGroupName, factoryName, changeDataCaptureName); + } + + public Response statusWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context) { + return this.serviceClient().statusWithResponse(resourceGroupName, factoryName, changeDataCaptureName, context); + } + + public String status(String resourceGroupName, String factoryName, String changeDataCaptureName) { + return this.serviceClient().status(resourceGroupName, factoryName, changeDataCaptureName); + } + + public ChangeDataCaptureResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String factoryName = Utils.getValueFromIdByName(id, "factories"); + if (factoryName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id))); + } + String changeDataCaptureName = Utils.getValueFromIdByName(id, "adfcdcs"); + if (changeDataCaptureName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'adfcdcs'.", id))); + } + String localIfNoneMatch = null; + return this + .getWithResponse(resourceGroupName, factoryName, changeDataCaptureName, localIfNoneMatch, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String ifNoneMatch, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String factoryName = Utils.getValueFromIdByName(id, "factories"); + if (factoryName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id))); + } + String changeDataCaptureName = Utils.getValueFromIdByName(id, "adfcdcs"); + if (changeDataCaptureName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'adfcdcs'.", id))); + } + return this.getWithResponse(resourceGroupName, factoryName, changeDataCaptureName, ifNoneMatch, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String factoryName = Utils.getValueFromIdByName(id, "factories"); + if (factoryName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id))); + } + String changeDataCaptureName = Utils.getValueFromIdByName(id, "adfcdcs"); + if (changeDataCaptureName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'adfcdcs'.", id))); + } + this.deleteWithResponse(resourceGroupName, factoryName, changeDataCaptureName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String factoryName = Utils.getValueFromIdByName(id, "factories"); + if (factoryName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'factories'.", id))); + } + String changeDataCaptureName = Utils.getValueFromIdByName(id, "adfcdcs"); + if (changeDataCaptureName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'adfcdcs'.", id))); + } + return this.deleteWithResponse(resourceGroupName, factoryName, changeDataCaptureName, context); + } + + private ChangeDataCapturesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.datafactory.DataFactoryManager manager() { + return this.serviceManager; + } + + public ChangeDataCaptureResourceImpl define(String name) { + return new ChangeDataCaptureResourceImpl(name, this.manager()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/CredentialOperationsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/CredentialOperationsClientImpl.java index 97bb8c75856c..27030ee45678 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/CredentialOperationsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/CredentialOperationsClientImpl.java @@ -62,8 +62,7 @@ public final class CredentialOperationsClientImpl implements CredentialOperation public interface CredentialOperationsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/credentials") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/credentials") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( @@ -77,8 +76,7 @@ Mono> listByFactory( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/credentials/{credentialName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/credentials/{credentialName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -95,8 +93,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/credentials/{credentialName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/credentials/{credentialName}") @ExpectedResponses({200, 304}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -112,8 +109,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/credentials/{credentialName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/credentials/{credentialName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFactoryManagementClientBuilder.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFactoryManagementClientBuilder.java index 00027b9a085b..2e785c6dcc07 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFactoryManagementClientBuilder.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFactoryManagementClientBuilder.java @@ -137,7 +137,7 @@ public DataFactoryManagementClientImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFactoryManagementClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFactoryManagementClientImpl.java index 815b8e875ce7..f6b86d5fd457 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFactoryManagementClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFactoryManagementClientImpl.java @@ -23,6 +23,7 @@ import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.datafactory.fluent.ActivityRunsClient; +import com.azure.resourcemanager.datafactory.fluent.ChangeDataCapturesClient; import com.azure.resourcemanager.datafactory.fluent.CredentialOperationsClient; import com.azure.resourcemanager.datafactory.fluent.DataFactoryManagementClient; import com.azure.resourcemanager.datafactory.fluent.DataFlowDebugSessionsClient; @@ -393,6 +394,18 @@ public GlobalParametersClient getGlobalParameters() { return this.globalParameters; } + /** The ChangeDataCapturesClient object to access its operations. */ + private final ChangeDataCapturesClient changeDataCaptures; + + /** + * Gets the ChangeDataCapturesClient object to access its operations. + * + * @return the ChangeDataCapturesClient object. + */ + public ChangeDataCapturesClient getChangeDataCaptures() { + return this.changeDataCaptures; + } + /** * Initializes an instance of DataFactoryManagementClient client. * @@ -438,6 +451,7 @@ public GlobalParametersClient getGlobalParameters() { this.privateEndpointConnectionOperations = new PrivateEndpointConnectionOperationsClientImpl(this); this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); this.globalParameters = new GlobalParametersClientImpl(this); + this.changeDataCaptures = new ChangeDataCapturesClientImpl(this); } /** diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFlowDebugSessionsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFlowDebugSessionsClientImpl.java index 44032621b4c6..7ca84b0b6820 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFlowDebugSessionsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFlowDebugSessionsClientImpl.java @@ -73,8 +73,7 @@ public final class DataFlowDebugSessionsClientImpl implements DataFlowDebugSessi public interface DataFlowDebugSessionsService { @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/createDataFlowDebugSession") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/createDataFlowDebugSession") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -89,8 +88,7 @@ Mono>> create( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/queryDataFlowDebugSessions") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/queryDataFlowDebugSessions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> queryByFactory( @@ -104,8 +102,7 @@ Mono> queryByFactory( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/addDataFlowToDebugSession") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/addDataFlowToDebugSession") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> addDataFlow( @@ -120,8 +117,7 @@ Mono> addDataFlow( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/deleteDataFlowDebugSession") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/deleteDataFlowDebugSession") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( @@ -136,8 +132,7 @@ Mono> delete( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/executeDataFlowDebugCommand") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/executeDataFlowDebugCommand") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> executeCommand( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFlowsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFlowsClientImpl.java index 0fcaf831179d..d7b26a4533af 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFlowsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DataFlowsClientImpl.java @@ -61,8 +61,7 @@ public final class DataFlowsClientImpl implements DataFlowsClient { public interface DataFlowsService { @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/dataflows/{dataFlowName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/dataflows/{dataFlowName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -79,8 +78,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/dataflows/{dataFlowName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/dataflows/{dataFlowName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -96,8 +94,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/dataflows/{dataFlowName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/dataflows/{dataFlowName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( @@ -112,8 +109,7 @@ Mono> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/dataflows") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/dataflows") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DatasetsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DatasetsClientImpl.java index f2b491250414..b2bcd5ff90e4 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DatasetsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/DatasetsClientImpl.java @@ -60,8 +60,7 @@ public final class DatasetsClientImpl implements DatasetsClient { public interface DatasetsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/datasets") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( @@ -75,8 +74,7 @@ Mono> listByFactory( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/datasets/{datasetName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -93,8 +91,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/datasets/{datasetName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}") @ExpectedResponses({200, 304}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -110,8 +107,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/datasets/{datasetName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ExposureControlsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ExposureControlsClientImpl.java index 3517c04e53cf..e9ba199edb5e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ExposureControlsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ExposureControlsClientImpl.java @@ -70,8 +70,7 @@ Mono> getFeatureValue( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/getFeatureValue") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/getFeatureValue") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getFeatureValueByFactory( @@ -86,8 +85,7 @@ Mono> getFeatureValueByFactory( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/queryFeaturesValue") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/queryFeaturesValue") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> queryFeatureValuesByFactory( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/FactoriesClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/FactoriesClientImpl.java index 4ee52904c94f..370b6d434661 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/FactoriesClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/FactoriesClientImpl.java @@ -80,8 +80,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}" - + "/configureFactoryRepo") + "/subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/configureFactoryRepo") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> configureFactoryRepo( @@ -95,8 +94,7 @@ Mono> configureFactoryRepo( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @@ -109,8 +107,7 @@ Mono> listByResourceGroup( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -126,8 +123,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> update( @@ -142,8 +138,7 @@ Mono> update( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}") @ExpectedResponses({200, 304}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @@ -158,8 +153,7 @@ Mono> getByResourceGroup( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( @@ -173,8 +167,7 @@ Mono> delete( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/getGitHubAccessToken") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/getGitHubAccessToken") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getGitHubAccessToken( @@ -189,8 +182,7 @@ Mono> getGitHubAccessToken( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/getDataPlaneAccess") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/getDataPlaneAccess") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getDataPlaneAccess( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/GlobalParametersClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/GlobalParametersClientImpl.java index da4ec73e4f8e..648498dfc679 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/GlobalParametersClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/GlobalParametersClientImpl.java @@ -61,8 +61,7 @@ public final class GlobalParametersClientImpl implements GlobalParametersClient public interface GlobalParametersService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/globalParameters") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/globalParameters") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( @@ -76,8 +75,7 @@ Mono> listByFactory( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/globalParameters/{globalParameterName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/globalParameters/{globalParameterName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -92,8 +90,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/globalParameters/{globalParameterName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/globalParameters/{globalParameterName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -109,8 +106,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/globalParameters/{globalParameterName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/globalParameters/{globalParameterName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimeNodesClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimeNodesClientImpl.java index ca0e79142247..b108ff26379c 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimeNodesClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimeNodesClientImpl.java @@ -60,8 +60,7 @@ public final class IntegrationRuntimeNodesClientImpl implements IntegrationRunti public interface IntegrationRuntimeNodesService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -77,8 +76,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( @@ -94,8 +92,7 @@ Mono> delete( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> update( @@ -112,8 +109,7 @@ Mono> update( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getIpAddress( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimeObjectMetadatasClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimeObjectMetadatasClientImpl.java index 7258cf33556a..6133aa8f0a3d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimeObjectMetadatasClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimeObjectMetadatasClientImpl.java @@ -67,8 +67,7 @@ public final class IntegrationRuntimeObjectMetadatasClientImpl implements Integr public interface IntegrationRuntimeObjectMetadatasService { @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> refresh( @@ -83,8 +82,7 @@ Mono>> refresh( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getObjectMetadata") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getObjectMetadata") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimesClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimesClientImpl.java index a84cb6976f4a..06ee9c6acd5e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimesClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimesClientImpl.java @@ -77,8 +77,7 @@ public final class IntegrationRuntimesClientImpl implements IntegrationRuntimesC public interface IntegrationRuntimesService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( @@ -92,8 +91,7 @@ Mono> listByFactory( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -110,8 +108,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") @ExpectedResponses({200, 304}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -127,8 +124,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> update( @@ -144,8 +140,7 @@ Mono> update( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( @@ -160,8 +155,7 @@ Mono> delete( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getStatus") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getStatus") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getStatus( @@ -176,9 +170,7 @@ Mono> getStatus( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}" - + "/outboundNetworkDependenciesEndpoints") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/outboundNetworkDependenciesEndpoints") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> @@ -194,8 +186,7 @@ Mono> getStatus( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getConnectionInfo( @@ -210,8 +201,7 @@ Mono> getConnectionInfo( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> regenerateAuthKey( @@ -227,8 +217,7 @@ Mono> regenerateAuthKey( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listAuthKeys( @@ -243,8 +232,7 @@ Mono> listAuthKeys( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/start") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/start") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> start( @@ -259,8 +247,7 @@ Mono>> start( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/stop") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/stop") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> stop( @@ -275,8 +262,7 @@ Mono>> stop( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> syncCredentials( @@ -291,8 +277,7 @@ Mono> syncCredentials( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/monitoringData") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/monitoringData") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getMonitoringData( @@ -307,8 +292,7 @@ Mono> getMonitoringData( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/upgrade") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/upgrade") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> upgrade( @@ -323,8 +307,7 @@ Mono> upgrade( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/removeLinks") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/removeLinks") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> removeLinks( @@ -340,8 +323,7 @@ Mono> removeLinks( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/linkedIntegrationRuntime") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/linkedIntegrationRuntime") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createLinkedIntegrationRuntime( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/LinkedServicesClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/LinkedServicesClientImpl.java index 1857becf276d..4e5a63403b27 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/LinkedServicesClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/LinkedServicesClientImpl.java @@ -61,8 +61,7 @@ public final class LinkedServicesClientImpl implements LinkedServicesClient { public interface LinkedServicesService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/linkedservices") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( @@ -76,8 +75,7 @@ Mono> listByFactory( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/linkedservices/{linkedServiceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices/{linkedServiceName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -94,8 +92,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/linkedservices/{linkedServiceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices/{linkedServiceName}") @ExpectedResponses({200, 304}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -111,8 +108,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/linkedservices/{linkedServiceName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices/{linkedServiceName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ManagedPrivateEndpointsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ManagedPrivateEndpointsClientImpl.java index dfea03654002..ba9877fbd3e7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ManagedPrivateEndpointsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ManagedPrivateEndpointsClientImpl.java @@ -62,8 +62,7 @@ public final class ManagedPrivateEndpointsClientImpl implements ManagedPrivateEn public interface ManagedPrivateEndpointsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( @@ -78,9 +77,7 @@ Mono> listByFactory( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints" - + "/{managedPrivateEndpointName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -98,9 +95,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints" - + "/{managedPrivateEndpointName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -117,9 +112,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints" - + "/{managedPrivateEndpointName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}/managedPrivateEndpoints/{managedPrivateEndpointName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ManagedVirtualNetworksClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ManagedVirtualNetworksClientImpl.java index a146685d2c10..6074976ec7a0 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ManagedVirtualNetworksClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/ManagedVirtualNetworksClientImpl.java @@ -61,8 +61,7 @@ public final class ManagedVirtualNetworksClientImpl implements ManagedVirtualNet public interface ManagedVirtualNetworksService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/managedVirtualNetworks") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( @@ -76,8 +75,7 @@ Mono> listByFactory( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -94,8 +92,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/managedVirtualNetworks/{managedVirtualNetworkName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PipelineRunsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PipelineRunsClientImpl.java index 9ab7da9137b7..a398a5aa3ea4 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PipelineRunsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PipelineRunsClientImpl.java @@ -57,8 +57,7 @@ public final class PipelineRunsClientImpl implements PipelineRunsClient { public interface PipelineRunsService { @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/queryPipelineRuns") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/queryPipelineRuns") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> queryByFactory( @@ -73,8 +72,7 @@ Mono> queryByFactory( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/pipelineruns/{runId}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelineruns/{runId}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -89,8 +87,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/pipelineruns/{runId}/cancel") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelineruns/{runId}/cancel") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> cancel( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PipelinesClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PipelinesClientImpl.java index 69ee14b74c28..f712230c2b96 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PipelinesClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PipelinesClientImpl.java @@ -64,8 +64,7 @@ public final class PipelinesClientImpl implements PipelinesClient { public interface PipelinesService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/pipelines") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( @@ -79,8 +78,7 @@ Mono> listByFactory( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/pipelines/{pipelineName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -97,8 +95,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/pipelines/{pipelineName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}") @ExpectedResponses({200, 304}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -114,8 +111,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/pipelines/{pipelineName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( @@ -130,8 +126,7 @@ Mono> delete( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/pipelines/{pipelineName}/createRun") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}/createRun") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createRun( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateEndPointConnectionsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateEndPointConnectionsClientImpl.java index b3bd1668f084..45198706d842 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateEndPointConnectionsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateEndPointConnectionsClientImpl.java @@ -60,8 +60,7 @@ public final class PrivateEndPointConnectionsClientImpl implements PrivateEndPoi public interface PrivateEndPointConnectionsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/privateEndPointConnections") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/privateEndPointConnections") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateEndpointConnectionOperationsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateEndpointConnectionOperationsClientImpl.java index 6d0d098cba81..8b78e880952a 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateEndpointConnectionOperationsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateEndpointConnectionOperationsClientImpl.java @@ -63,8 +63,7 @@ public final class PrivateEndpointConnectionOperationsClientImpl implements Priv public interface PrivateEndpointConnectionOperationsService { @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -81,8 +80,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -98,8 +96,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateLinkResourcesClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateLinkResourcesClientImpl.java index e19bb60c2612..a5b5c13ae3b1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateLinkResourcesClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/PrivateLinkResourcesClientImpl.java @@ -54,8 +54,7 @@ public final class PrivateLinkResourcesClientImpl implements PrivateLinkResource public interface PrivateLinkResourcesService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/privateLinkResources") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/privateLinkResources") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/TriggerRunsClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/TriggerRunsClientImpl.java index 54c0f60d32b2..6784bf269079 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/TriggerRunsClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/TriggerRunsClientImpl.java @@ -55,8 +55,7 @@ public final class TriggerRunsClientImpl implements TriggerRunsClient { public interface TriggerRunsService { @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}/triggerRuns/{runId}/rerun") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/triggerRuns/{runId}/rerun") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> rerun( @@ -72,8 +71,7 @@ Mono> rerun( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}/triggerRuns/{runId}/cancel") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/triggerRuns/{runId}/cancel") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> cancel( @@ -89,8 +87,7 @@ Mono> cancel( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/queryTriggerRuns") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/queryTriggerRuns") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> queryByFactory( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/TriggersClientImpl.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/TriggersClientImpl.java index d0e9f2d2ed78..d5fc6e439d28 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/TriggersClientImpl.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/TriggersClientImpl.java @@ -69,8 +69,7 @@ public final class TriggersClientImpl implements TriggersClient { public interface TriggersService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByFactory( @@ -84,8 +83,7 @@ Mono> listByFactory( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/querytriggers") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/querytriggers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> queryByFactory( @@ -100,8 +98,7 @@ Mono> queryByFactory( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> createOrUpdate( @@ -118,8 +115,7 @@ Mono> createOrUpdate( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}") @ExpectedResponses({200, 304}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -135,8 +131,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete( @@ -151,8 +146,7 @@ Mono> delete( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}/subscribeToEvents") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/subscribeToEvents") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> subscribeToEvents( @@ -167,8 +161,7 @@ Mono>> subscribeToEvents( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}/getEventSubscriptionStatus") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/getEventSubscriptionStatus") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getEventSubscriptionStatus( @@ -183,8 +176,7 @@ Mono> getEventSubscriptionStat @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}/unsubscribeFromEvents") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/unsubscribeFromEvents") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> unsubscribeFromEvents( @@ -199,8 +191,7 @@ Mono>> unsubscribeFromEvents( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}/start") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/start") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> start( @@ -215,8 +206,7 @@ Mono>> start( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory" - + "/factories/{factoryName}/triggers/{triggerName}/stop") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/stop") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> stop( diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Activity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Activity.java index 51f663930905..9c25b9747134 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Activity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Activity.java @@ -43,6 +43,19 @@ public class Activity { @JsonProperty(value = "description") private String description; + /* + * Activity state. This is an optional property and if not provided, the state will be Active by default. + */ + @JsonProperty(value = "state") + private ActivityState state; + + /* + * Status result of the activity when the state is set to Inactive. This is an optional property and if not + * provided when the activity is inactive, the status will be Succeeded by default. + */ + @JsonProperty(value = "onInactiveMarkAs") + private ActivityOnInactiveMarkAs onInactiveMarkAs; + /* * Activity depends on condition. */ @@ -104,6 +117,50 @@ public Activity withDescription(String description) { return this; } + /** + * Get the state property: Activity state. This is an optional property and if not provided, the state will be + * Active by default. + * + * @return the state value. + */ + public ActivityState state() { + return this.state; + } + + /** + * Set the state property: Activity state. This is an optional property and if not provided, the state will be + * Active by default. + * + * @param state the state value to set. + * @return the Activity object itself. + */ + public Activity withState(ActivityState state) { + this.state = state; + return this; + } + + /** + * Get the onInactiveMarkAs property: Status result of the activity when the state is set to Inactive. This is an + * optional property and if not provided when the activity is inactive, the status will be Succeeded by default. + * + * @return the onInactiveMarkAs value. + */ + public ActivityOnInactiveMarkAs onInactiveMarkAs() { + return this.onInactiveMarkAs; + } + + /** + * Set the onInactiveMarkAs property: Status result of the activity when the state is set to Inactive. This is an + * optional property and if not provided when the activity is inactive, the status will be Succeeded by default. + * + * @param onInactiveMarkAs the onInactiveMarkAs value to set. + * @return the Activity object itself. + */ + public Activity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + this.onInactiveMarkAs = onInactiveMarkAs; + return this; + } + /** * Get the dependsOn property: Activity depends on condition. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ActivityOnInactiveMarkAs.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ActivityOnInactiveMarkAs.java new file mode 100644 index 000000000000..9de5d43d0697 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ActivityOnInactiveMarkAs.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Status result of the activity when the state is set to Inactive. This is an optional property and if not provided + * when the activity is inactive, the status will be Succeeded by default. + */ +public final class ActivityOnInactiveMarkAs extends ExpandableStringEnum { + /** Static value Succeeded for ActivityOnInactiveMarkAs. */ + public static final ActivityOnInactiveMarkAs SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ActivityOnInactiveMarkAs. */ + public static final ActivityOnInactiveMarkAs FAILED = fromString("Failed"); + + /** Static value Skipped for ActivityOnInactiveMarkAs. */ + public static final ActivityOnInactiveMarkAs SKIPPED = fromString("Skipped"); + + /** + * Creates a new instance of ActivityOnInactiveMarkAs value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActivityOnInactiveMarkAs() { + } + + /** + * Creates or finds a ActivityOnInactiveMarkAs from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActivityOnInactiveMarkAs. + */ + @JsonCreator + public static ActivityOnInactiveMarkAs fromString(String name) { + return fromString(name, ActivityOnInactiveMarkAs.class); + } + + /** + * Gets known ActivityOnInactiveMarkAs values. + * + * @return known ActivityOnInactiveMarkAs values. + */ + public static Collection values() { + return values(ActivityOnInactiveMarkAs.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ActivityState.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ActivityState.java new file mode 100644 index 000000000000..c943c9e27764 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ActivityState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Activity state. This is an optional property and if not provided, the state will be Active by default. */ +public final class ActivityState extends ExpandableStringEnum { + /** Static value Active for ActivityState. */ + public static final ActivityState ACTIVE = fromString("Active"); + + /** Static value Inactive for ActivityState. */ + public static final ActivityState INACTIVE = fromString("Inactive"); + + /** + * Creates a new instance of ActivityState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActivityState() { + } + + /** + * Creates or finds a ActivityState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActivityState. + */ + @JsonCreator + public static ActivityState fromString(String name) { + return fromString(name, ActivityState.class); + } + + /** + * Gets known ActivityState values. + * + * @return known ActivityState values. + */ + public static Collection values() { + return values(ActivityState.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonMwsLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonMwsLinkedService.java index 6a2087fe1536..0916a0f67753 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonMwsLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonMwsLinkedService.java @@ -282,22 +282,22 @@ public AmazonMwsLinkedService withUsePeerVerification(Object usePeerVerification /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonMwsLinkedService object itself. */ - public AmazonMwsLinkedService withEncryptedCredential(Object encryptedCredential) { + public AmazonMwsLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AmazonMwsLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForOracleLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForOracleLinkedService.java index c783862acb04..55a71c4ca88b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForOracleLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForOracleLinkedService.java @@ -115,22 +115,22 @@ public AmazonRdsForOracleLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonRdsForOracleLinkedService object itself. */ - public AmazonRdsForOracleLinkedService withEncryptedCredential(Object encryptedCredential) { + public AmazonRdsForOracleLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AmazonRdsForLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForSqlServerLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForSqlServerLinkedService.java index 6a61dd6ec425..946a247c74d7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForSqlServerLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForSqlServerLinkedService.java @@ -141,22 +141,22 @@ public AmazonRdsForSqlServerLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonRdsForSqlServerLinkedService object itself. */ - public AmazonRdsForSqlServerLinkedService withEncryptedCredential(Object encryptedCredential) { + public AmazonRdsForSqlServerLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AmazonRdsForSqlServerLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForSqlServerSource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForSqlServerSource.java index 85691497948a..3cba697bb0de 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForSqlServerSource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRdsForSqlServerSource.java @@ -33,6 +33,14 @@ public final class AmazonRdsForSqlServerSource extends TabularSource { @JsonProperty(value = "storedProcedureParameters") private Object storedProcedureParameters; + /* + * Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "isolationLevel") + private Object isolationLevel; + /* * Which additional types to produce. */ @@ -120,6 +128,30 @@ public AmazonRdsForSqlServerSource withStoredProcedureParameters(Object storedPr return this; } + /** + * Get the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @return the isolationLevel value. + */ + public Object isolationLevel() { + return this.isolationLevel; + } + + /** + * Set the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @param isolationLevel the isolationLevel value to set. + * @return the AmazonRdsForSqlServerSource object itself. + */ + public AmazonRdsForSqlServerSource withIsolationLevel(Object isolationLevel) { + this.isolationLevel = isolationLevel; + return this; + } + /** * Get the produceAdditionalTypes property: Which additional types to produce. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRedshiftLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRedshiftLinkedService.java index 160c9a104aeb..cdf28241e9e3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRedshiftLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonRedshiftLinkedService.java @@ -191,22 +191,22 @@ public AmazonRedshiftLinkedService withPort(Object port) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonRedshiftLinkedService object itself. */ - public AmazonRedshiftLinkedService withEncryptedCredential(Object encryptedCredential) { + public AmazonRedshiftLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AmazonRedshiftLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3CompatibleLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3CompatibleLinkedService.java index e654e644bb25..0f4b57053734 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3CompatibleLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3CompatibleLinkedService.java @@ -170,22 +170,22 @@ public AmazonS3CompatibleLinkedService withForcePathStyle(Object forcePathStyle) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonS3CompatibleLinkedService object itself. */ - public AmazonS3CompatibleLinkedService withEncryptedCredential(Object encryptedCredential) { + public AmazonS3CompatibleLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AmazonS3CompatibleLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3CompatibleReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3CompatibleReadSettings.java index d6e62778730a..13428065a390 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3CompatibleReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3CompatibleReadSettings.java @@ -47,10 +47,10 @@ public final class AmazonS3CompatibleReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -193,21 +193,23 @@ public AmazonS3CompatibleReadSettings withFileListPath(Object fileListPath) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the AmazonS3CompatibleReadSettings object itself. */ - public AmazonS3CompatibleReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public AmazonS3CompatibleReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3LinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3LinkedService.java index 42eb1c432d67..64f09b26e09e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3LinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3LinkedService.java @@ -192,22 +192,22 @@ public AmazonS3LinkedService withSessionToken(SecretBase sessionToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AmazonS3LinkedService object itself. */ - public AmazonS3LinkedService withEncryptedCredential(Object encryptedCredential) { + public AmazonS3LinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AmazonS3LinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3ReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3ReadSettings.java index 30e567498ad4..dc7d9ada8e6d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3ReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AmazonS3ReadSettings.java @@ -47,10 +47,10 @@ public final class AmazonS3ReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -193,21 +193,23 @@ public AmazonS3ReadSettings withFileListPath(Object fileListPath) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the AmazonS3ReadSettings object itself. */ - public AmazonS3ReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public AmazonS3ReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AppFiguresLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AppFiguresLinkedService.java index 08165a88ba80..86ff8ee2bfe0 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AppFiguresLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AppFiguresLinkedService.java @@ -66,7 +66,8 @@ public AppFiguresLinkedService withAnnotations(List annotations) { } /** - * Get the username property: The username of the Appfigures source. + * Get the username property: The username of the Appfigures source. Type: string (or Expression with resultType + * string). * * @return the username value. */ @@ -75,7 +76,8 @@ public Object username() { } /** - * Set the username property: The username of the Appfigures source. + * Set the username property: The username of the Appfigures source. Type: string (or Expression with resultType + * string). * * @param username the username value to set. * @return the AppFiguresLinkedService object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AppendVariableActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AppendVariableActivity.java index 8b37755bf04a..82893c1b3706 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AppendVariableActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AppendVariableActivity.java @@ -50,6 +50,20 @@ public AppendVariableActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public AppendVariableActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public AppendVariableActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public AppendVariableActivity withDependsOn(List dependsOn) { @@ -88,7 +102,8 @@ public AppendVariableActivity withVariableName(String variableName) { } /** - * Get the value property: Value to be appended. Could be a static value or Expression. + * Get the value property: Value to be appended. Type: could be a static value matching type of the variable item or + * Expression with resultType matching type of the variable item. * * @return the value value. */ @@ -97,7 +112,8 @@ public Object value() { } /** - * Set the value property: Value to be appended. Could be a static value or Expression. + * Set the value property: Value to be appended. Type: could be a static value matching type of the variable item or + * Expression with resultType matching type of the variable item. * * @param value the value value to set. * @return the AppendVariableActivity object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AsanaLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AsanaLinkedService.java index 086c287c20ea..658e0c5fc9dd 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AsanaLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AsanaLinkedService.java @@ -90,22 +90,22 @@ public AsanaLinkedService withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AsanaLinkedService object itself. */ - public AsanaLinkedService withEncryptedCredential(Object encryptedCredential) { + public AsanaLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AsanaLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBatchLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBatchLinkedService.java index 6a490a34dca3..1f9dc3e3b4f6 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBatchLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBatchLinkedService.java @@ -182,22 +182,22 @@ public AzureBatchLinkedService withLinkedServiceName(LinkedServiceReference link /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureBatchLinkedService object itself. */ - public AzureBatchLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureBatchLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureBatchLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSLinkedService.java index 6888052e42ec..373fb7ea5f44 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSLinkedService.java @@ -219,22 +219,22 @@ public AzureBlobFSLinkedService withAzureCloudType(Object azureCloudType) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureBlobFSLinkedService object itself. */ - public AzureBlobFSLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureBlobFSLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureBlobFSLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSReadSettings.java index cb28f7f1f76c..2807210b4cf3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSReadSettings.java @@ -41,10 +41,10 @@ public final class AzureBlobFSReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -165,21 +165,23 @@ public AzureBlobFSReadSettings withFileListPath(Object fileListPath) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the AzureBlobFSReadSettings object itself. */ - public AzureBlobFSReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public AzureBlobFSReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSSink.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSSink.java index 5fed7a14020d..48e04393332b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSSink.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobFSSink.java @@ -16,7 +16,7 @@ @Fluent public final class AzureBlobFSSink extends CopySink { /* - * The type of copy behavior for copy sink. + * The type of copy behavior for copy sink. Type: string (or Expression with resultType string). */ @JsonProperty(value = "copyBehavior") private Object copyBehavior; @@ -33,7 +33,8 @@ public AzureBlobFSSink() { } /** - * Get the copyBehavior property: The type of copy behavior for copy sink. + * Get the copyBehavior property: The type of copy behavior for copy sink. Type: string (or Expression with + * resultType string). * * @return the copyBehavior value. */ @@ -42,7 +43,8 @@ public Object copyBehavior() { } /** - * Set the copyBehavior property: The type of copy behavior for copy sink. + * Set the copyBehavior property: The type of copy behavior for copy sink. Type: string (or Expression with + * resultType string). * * @param copyBehavior the copyBehavior value to set. * @return the AzureBlobFSSink object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobStorageLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobStorageLinkedService.java index 1c11c9947859..fad3e8b83a3b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobStorageLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobStorageLinkedService.java @@ -168,7 +168,7 @@ public AzureBlobStorageLinkedService withSasToken(AzureKeyVaultSecretReference s * * @return the serviceEndpoint value. */ - public String serviceEndpoint() { + public Object serviceEndpoint() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().serviceEndpoint(); } @@ -179,7 +179,7 @@ public String serviceEndpoint() { * @param serviceEndpoint the serviceEndpoint value to set. * @return the AzureBlobStorageLinkedService object itself. */ - public AzureBlobStorageLinkedService withServiceEndpoint(String serviceEndpoint) { + public AzureBlobStorageLinkedService withServiceEndpoint(Object serviceEndpoint) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureBlobStorageLinkedServiceTypeProperties(); } @@ -296,7 +296,7 @@ public AzureBlobStorageLinkedService withAzureCloudType(Object azureCloudType) { * * @return the accountKind value. */ - public String accountKind() { + public Object accountKind() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().accountKind(); } @@ -308,7 +308,7 @@ public String accountKind() { * @param accountKind the accountKind value to set. * @return the AzureBlobStorageLinkedService object itself. */ - public AzureBlobStorageLinkedService withAccountKind(String accountKind) { + public AzureBlobStorageLinkedService withAccountKind(Object accountKind) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureBlobStorageLinkedServiceTypeProperties(); } @@ -318,7 +318,7 @@ public AzureBlobStorageLinkedService withAccountKind(String accountKind) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ @@ -328,7 +328,7 @@ public String encryptedCredential() { /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureBlobStorageLinkedService object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobStorageReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobStorageReadSettings.java index 1342f0bd876b..3ef99ae6a0f1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobStorageReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureBlobStorageReadSettings.java @@ -47,10 +47,10 @@ public final class AzureBlobStorageReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -193,21 +193,23 @@ public AzureBlobStorageReadSettings withFileListPath(Object fileListPath) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the AzureBlobStorageReadSettings object itself. */ - public AzureBlobStorageReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public AzureBlobStorageReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataExplorerCommandActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataExplorerCommandActivity.java index e66b32af33fe..5ed7a9e34ad7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataExplorerCommandActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataExplorerCommandActivity.java @@ -65,6 +65,20 @@ public AzureDataExplorerCommandActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public AzureDataExplorerCommandActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureDataExplorerCommandActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public AzureDataExplorerCommandActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeAnalyticsLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeAnalyticsLinkedService.java index 5c08ec732851..3c63561d13b8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeAnalyticsLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeAnalyticsLinkedService.java @@ -243,22 +243,22 @@ public AzureDataLakeAnalyticsLinkedService withDataLakeAnalyticsUri(Object dataL /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureDataLakeAnalyticsLinkedService object itself. */ - public AzureDataLakeAnalyticsLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureDataLakeAnalyticsLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureDataLakeAnalyticsLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreLinkedService.java index 87a0d07828fe..e7f78d77827f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreLinkedService.java @@ -268,22 +268,22 @@ public AzureDataLakeStoreLinkedService withResourceGroupName(Object resourceGrou /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureDataLakeStoreLinkedService object itself. */ - public AzureDataLakeStoreLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureDataLakeStoreLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureDataLakeStoreLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreReadSettings.java index e077d6e58edd..7886ea5b52f9 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreReadSettings.java @@ -57,10 +57,10 @@ public final class AzureDataLakeStoreReadSettings extends StoreReadSettings { private Object listBefore; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -227,21 +227,23 @@ public AzureDataLakeStoreReadSettings withListBefore(Object listBefore) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the AzureDataLakeStoreReadSettings object itself. */ - public AzureDataLakeStoreReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public AzureDataLakeStoreReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreSink.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreSink.java index 79ae114a6857..261e78864b5e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreSink.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreSink.java @@ -15,7 +15,7 @@ @Fluent public final class AzureDataLakeStoreSink extends CopySink { /* - * The type of copy behavior for copy sink. + * The type of copy behavior for copy sink. Type: string (or Expression with resultType string). */ @JsonProperty(value = "copyBehavior") private Object copyBehavior; @@ -31,7 +31,8 @@ public AzureDataLakeStoreSink() { } /** - * Get the copyBehavior property: The type of copy behavior for copy sink. + * Get the copyBehavior property: The type of copy behavior for copy sink. Type: string (or Expression with + * resultType string). * * @return the copyBehavior value. */ @@ -40,7 +41,8 @@ public Object copyBehavior() { } /** - * Set the copyBehavior property: The type of copy behavior for copy sink. + * Set the copyBehavior property: The type of copy behavior for copy sink. Type: string (or Expression with + * resultType string). * * @param copyBehavior the copyBehavior value to set. * @return the AzureDataLakeStoreSink object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreWriteSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreWriteSettings.java index 221a68357fc7..ff2f99504823 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreWriteSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDataLakeStoreWriteSettings.java @@ -16,7 +16,7 @@ public final class AzureDataLakeStoreWriteSettings extends StoreWriteSettings { /* * Specifies the expiry time of the written files. The time is applied to the UTC time zone in the format of - * "2018-12-01T05:00:00Z". Default value is NULL. Type: integer (or Expression with resultType integer). + * "2018-12-01T05:00:00Z". Default value is NULL. Type: string (or Expression with resultType string). */ @JsonProperty(value = "expiryDateTime") private Object expiryDateTime; @@ -27,8 +27,8 @@ public AzureDataLakeStoreWriteSettings() { /** * Get the expiryDateTime property: Specifies the expiry time of the written files. The time is applied to the UTC - * time zone in the format of "2018-12-01T05:00:00Z". Default value is NULL. Type: integer (or Expression with - * resultType integer). + * time zone in the format of "2018-12-01T05:00:00Z". Default value is NULL. Type: string (or Expression with + * resultType string). * * @return the expiryDateTime value. */ @@ -38,8 +38,8 @@ public Object expiryDateTime() { /** * Set the expiryDateTime property: Specifies the expiry time of the written files. The time is applied to the UTC - * time zone in the format of "2018-12-01T05:00:00Z". Default value is NULL. Type: integer (or Expression with - * resultType integer). + * time zone in the format of "2018-12-01T05:00:00Z". Default value is NULL. Type: string (or Expression with + * resultType string). * * @param expiryDateTime the expiryDateTime value to set. * @return the AzureDataLakeStoreWriteSettings object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDatabricksDeltaLakeLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDatabricksDeltaLakeLinkedService.java index 67bcaaba186c..8201fc9812c1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDatabricksDeltaLakeLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDatabricksDeltaLakeLinkedService.java @@ -145,22 +145,22 @@ public AzureDatabricksDeltaLakeLinkedService withClusterId(Object clusterId) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureDatabricksDeltaLakeLinkedService object itself. */ - public AzureDatabricksDeltaLakeLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureDatabricksDeltaLakeLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureDatabricksDetltaLakeLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDatabricksLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDatabricksLinkedService.java index e0299ddd90ce..b9f4e02a2a77 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDatabricksLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureDatabricksLinkedService.java @@ -480,22 +480,22 @@ public AzureDatabricksLinkedService withNewClusterEnableElasticDisk(Object newCl /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureDatabricksLinkedService object itself. */ - public AzureDatabricksLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureDatabricksLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureDatabricksLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFileStorageLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFileStorageLinkedService.java index 2f7661e11814..11fe68df9e35 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFileStorageLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFileStorageLinkedService.java @@ -283,22 +283,22 @@ public AzureFileStorageLinkedService withSnapshot(Object snapshot) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureFileStorageLinkedService object itself. */ - public AzureFileStorageLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureFileStorageLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureFileStorageLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFileStorageReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFileStorageReadSettings.java index c56c0cf57e3f..d8f674e7faa8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFileStorageReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFileStorageReadSettings.java @@ -48,10 +48,10 @@ public final class AzureFileStorageReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -194,21 +194,23 @@ public AzureFileStorageReadSettings withFileListPath(Object fileListPath) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the AzureFileStorageReadSettings object itself. */ - public AzureFileStorageReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public AzureFileStorageReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFunctionActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFunctionActivity.java index d2bd98cddb1c..709e890f6b9f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFunctionActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFunctionActivity.java @@ -64,6 +64,20 @@ public AzureFunctionActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public AzureFunctionActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureFunctionActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public AzureFunctionActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFunctionLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFunctionLinkedService.java index 77d79d3d3b4b..9f5d4e6f569b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFunctionLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureFunctionLinkedService.java @@ -116,22 +116,22 @@ public AzureFunctionLinkedService withFunctionKey(SecretBase functionKey) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureFunctionLinkedService object itself. */ - public AzureFunctionLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureFunctionLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureFunctionLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLBatchExecutionActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLBatchExecutionActivity.java index 3356c342efa2..7ecd8252ba66 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLBatchExecutionActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLBatchExecutionActivity.java @@ -66,6 +66,20 @@ public AzureMLBatchExecutionActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public AzureMLBatchExecutionActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureMLBatchExecutionActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public AzureMLBatchExecutionActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLExecutePipelineActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLExecutePipelineActivity.java index ca477591ad06..3d2ebf21b842 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLExecutePipelineActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLExecutePipelineActivity.java @@ -65,6 +65,20 @@ public AzureMLExecutePipelineActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public AzureMLExecutePipelineActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureMLExecutePipelineActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public AzureMLExecutePipelineActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLLinkedService.java index 02fe1eeb4d89..c467ed771459 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLLinkedService.java @@ -215,22 +215,22 @@ public AzureMLLinkedService withTenant(Object tenant) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureMLLinkedService object itself. */ - public AzureMLLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureMLLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureMLLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLServiceLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLServiceLinkedService.java index ffb58af5887d..1c5c1cbb5dc1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLServiceLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLServiceLinkedService.java @@ -141,6 +141,31 @@ public AzureMLServiceLinkedService withMlWorkspaceName(Object mlWorkspaceName) { return this; } + /** + * Get the authentication property: Type of authentication (Required to specify MSI) used to connect to AzureML. + * Type: string (or Expression with resultType string). + * + * @return the authentication value. + */ + public Object authentication() { + return this.innerTypeProperties() == null ? null : this.innerTypeProperties().authentication(); + } + + /** + * Set the authentication property: Type of authentication (Required to specify MSI) used to connect to AzureML. + * Type: string (or Expression with resultType string). + * + * @param authentication the authentication value to set. + * @return the AzureMLServiceLinkedService object itself. + */ + public AzureMLServiceLinkedService withAuthentication(Object authentication) { + if (this.innerTypeProperties() == null) { + this.innerTypeProperties = new AzureMLServiceLinkedServiceTypeProperties(); + } + this.innerTypeProperties().withAuthentication(authentication); + return this; + } + /** * Get the servicePrincipalId property: The ID of the service principal used to authenticate against the endpoint of * a published Azure ML Service pipeline. Type: string (or Expression with resultType string). @@ -218,22 +243,22 @@ public AzureMLServiceLinkedService withTenant(Object tenant) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureMLServiceLinkedService object itself. */ - public AzureMLServiceLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureMLServiceLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureMLServiceLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLUpdateResourceActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLUpdateResourceActivity.java index 1549b4c31086..06a3fe68c082 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLUpdateResourceActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMLUpdateResourceActivity.java @@ -65,6 +65,20 @@ public AzureMLUpdateResourceActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public AzureMLUpdateResourceActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureMLUpdateResourceActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public AzureMLUpdateResourceActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMariaDBLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMariaDBLinkedService.java index ca0e2e931572..3ed3957a2dbe 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMariaDBLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMariaDBLinkedService.java @@ -115,22 +115,22 @@ public AzureMariaDBLinkedService withPwd(AzureKeyVaultSecretReference pwd) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureMariaDBLinkedService object itself. */ - public AzureMariaDBLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureMariaDBLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureMariaDBLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMySqlLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMySqlLinkedService.java index 031ea72be149..894c3fd3328e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMySqlLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureMySqlLinkedService.java @@ -115,22 +115,22 @@ public AzureMySqlLinkedService withPassword(AzureKeyVaultSecretReference passwor /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureMySqlLinkedService object itself. */ - public AzureMySqlLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureMySqlLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureMySqlLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzurePostgreSqlLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzurePostgreSqlLinkedService.java index 19d88ce28569..91a8ec6676c5 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzurePostgreSqlLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzurePostgreSqlLinkedService.java @@ -116,22 +116,22 @@ public AzurePostgreSqlLinkedService withPassword(AzureKeyVaultSecretReference pa /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzurePostgreSqlLinkedService object itself. */ - public AzurePostgreSqlLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzurePostgreSqlLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzurePostgreSqlLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSearchLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSearchLinkedService.java index d18c3497b2c7..af429ddc4c19 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSearchLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSearchLinkedService.java @@ -113,22 +113,22 @@ public AzureSearchLinkedService withKey(SecretBase key) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureSearchLinkedService object itself. */ - public AzureSearchLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureSearchLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureSearchLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlDWLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlDWLinkedService.java index c5b75a329daf..dc839fc5f338 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlDWLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlDWLinkedService.java @@ -217,22 +217,22 @@ public AzureSqlDWLinkedService withAzureCloudType(Object azureCloudType) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureSqlDWLinkedService object itself. */ - public AzureSqlDWLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureSqlDWLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureSqlDWLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlDatabaseLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlDatabaseLinkedService.java index 5e42e39f2b1f..d8687397ff71 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlDatabaseLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlDatabaseLinkedService.java @@ -218,22 +218,22 @@ public AzureSqlDatabaseLinkedService withAzureCloudType(Object azureCloudType) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureSqlDatabaseLinkedService object itself. */ - public AzureSqlDatabaseLinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureSqlDatabaseLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureSqlDatabaseLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlMILinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlMILinkedService.java index 368c018a39e6..a03a23f3b0eb 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlMILinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlMILinkedService.java @@ -217,22 +217,22 @@ public AzureSqlMILinkedService withAzureCloudType(Object azureCloudType) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureSqlMILinkedService object itself. */ - public AzureSqlMILinkedService withEncryptedCredential(Object encryptedCredential) { + public AzureSqlMILinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new AzureSqlMILinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlSource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlSource.java index 36dd564bbcff..cd1e072e4394 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlSource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureSqlSource.java @@ -33,6 +33,14 @@ public final class AzureSqlSource extends TabularSource { @JsonProperty(value = "storedProcedureParameters") private Object storedProcedureParameters; + /* + * Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "isolationLevel") + private Object isolationLevel; + /* * Which additional types to produce. */ @@ -120,6 +128,30 @@ public AzureSqlSource withStoredProcedureParameters(Object storedProcedureParame return this; } + /** + * Get the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @return the isolationLevel value. + */ + public Object isolationLevel() { + return this.isolationLevel; + } + + /** + * Set the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @param isolationLevel the isolationLevel value to set. + * @return the AzureSqlSource object itself. + */ + public AzureSqlSource withIsolationLevel(Object isolationLevel) { + this.isolationLevel = isolationLevel; + return this; + } + /** * Get the produceAdditionalTypes property: Which additional types to produce. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureStorageLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureStorageLinkedService.java index 4fedc99a8fdc..64762633b0f4 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureStorageLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureStorageLinkedService.java @@ -163,7 +163,7 @@ public AzureStorageLinkedService withSasToken(AzureKeyVaultSecretReference sasTo /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ @@ -173,7 +173,7 @@ public String encryptedCredential() { /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureStorageLinkedService object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureTableStorageLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureTableStorageLinkedService.java index 2e710399308a..fe386d567f0c 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureTableStorageLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/AzureTableStorageLinkedService.java @@ -163,7 +163,7 @@ public AzureTableStorageLinkedService withSasToken(AzureKeyVaultSecretReference /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ @@ -173,7 +173,7 @@ public String encryptedCredential() { /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the AzureTableStorageLinkedService object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CassandraLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CassandraLinkedService.java index 7eca5914f903..c0ac1bb11395 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CassandraLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CassandraLinkedService.java @@ -184,22 +184,22 @@ public CassandraLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the CassandraLinkedService object itself. */ - public CassandraLinkedService withEncryptedCredential(Object encryptedCredential) { + public CassandraLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new CassandraLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptureFolder.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptureFolder.java new file mode 100644 index 000000000000..807ec01aa45f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptureFolder.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The folder that this CDC is in. If not specified, CDC will appear at the root level. */ +@Fluent +public final class ChangeDataCaptureFolder { + /* + * The name of the folder that this CDC is in. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of ChangeDataCaptureFolder class. */ + public ChangeDataCaptureFolder() { + } + + /** + * Get the name property: The name of the folder that this CDC is in. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the folder that this CDC is in. + * + * @param name the name value to set. + * @return the ChangeDataCaptureFolder object itself. + */ + public ChangeDataCaptureFolder withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptureListResponse.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptureListResponse.java new file mode 100644 index 000000000000..e55eb16d0a50 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptureListResponse.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCaptureResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of change data capture resources. */ +@Fluent +public final class ChangeDataCaptureListResponse { + /* + * Lists all resources of type change data capture. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of results, if any remaining results exist. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of ChangeDataCaptureListResponse class. */ + public ChangeDataCaptureListResponse() { + } + + /** + * Get the value property: Lists all resources of type change data capture. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Lists all resources of type change data capture. + * + * @param value the value value to set. + * @return the ChangeDataCaptureListResponse object itself. + */ + public ChangeDataCaptureListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of results, if any remaining results exist. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of results, if any remaining results exist. + * + * @param nextLink the nextLink value to set. + * @return the ChangeDataCaptureListResponse object itself. + */ + public ChangeDataCaptureListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ChangeDataCaptureListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ChangeDataCaptureListResponse.class); +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptureResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptureResource.java new file mode 100644 index 000000000000..948823c6b33b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptureResource.java @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCaptureResourceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ChangeDataCaptureResource. */ +public interface ChangeDataCaptureResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Etag identifies change in the resource. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the additionalProperties property: Change data capture resource type. + * + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * Gets the folder property: The folder that this CDC is in. If not specified, CDC will appear at the root level. + * + * @return the folder value. + */ + ChangeDataCaptureFolder folder(); + + /** + * Gets the description property: The description of the change data capture. + * + * @return the description value. + */ + String description(); + + /** + * Gets the sourceConnectionsInfo property: List of sources connections that can be used as sources in the CDC. + * + * @return the sourceConnectionsInfo value. + */ + List sourceConnectionsInfo(); + + /** + * Gets the targetConnectionsInfo property: List of target connections that can be used as sources in the CDC. + * + * @return the targetConnectionsInfo value. + */ + List targetConnectionsInfo(); + + /** + * Gets the policy property: CDC policy. + * + * @return the policy value. + */ + MapperPolicy policy(); + + /** + * Gets the allowVNetOverride property: A boolean to determine if the vnet configuration needs to be overwritten. + * + * @return the allowVNetOverride value. + */ + Boolean allowVNetOverride(); + + /** + * Gets the status property: Status of the CDC as to if it is running or stopped. + * + * @return the status value. + */ + String status(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCaptureResourceInner object. + * + * @return the inner object. + */ + ChangeDataCaptureResourceInner innerModel(); + + /** The entirety of the ChangeDataCaptureResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithSourceConnectionsInfo, + DefinitionStages.WithTargetConnectionsInfo, + DefinitionStages.WithPolicy, + DefinitionStages.WithCreate { + } + + /** The ChangeDataCaptureResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ChangeDataCaptureResource definition. */ + interface Blank extends WithParentResource { + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, factoryName. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @return the next definition stage. + */ + WithSourceConnectionsInfo withExistingFactory(String resourceGroupName, String factoryName); + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify sourceConnectionsInfo. */ + interface WithSourceConnectionsInfo { + /** + * Specifies the sourceConnectionsInfo property: List of sources connections that can be used as sources in + * the CDC.. + * + * @param sourceConnectionsInfo List of sources connections that can be used as sources in the CDC. + * @return the next definition stage. + */ + WithTargetConnectionsInfo withSourceConnectionsInfo( + List sourceConnectionsInfo); + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify targetConnectionsInfo. */ + interface WithTargetConnectionsInfo { + /** + * Specifies the targetConnectionsInfo property: List of target connections that can be used as sources in + * the CDC.. + * + * @param targetConnectionsInfo List of target connections that can be used as sources in the CDC. + * @return the next definition stage. + */ + WithPolicy withTargetConnectionsInfo(List targetConnectionsInfo); + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify policy. */ + interface WithPolicy { + /** + * Specifies the policy property: CDC policy. + * + * @param policy CDC policy. + * @return the next definition stage. + */ + WithCreate withPolicy(MapperPolicy policy); + } + + /** + * The stage of the ChangeDataCaptureResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithAdditionalProperties, + DefinitionStages.WithFolder, + DefinitionStages.WithDescription, + DefinitionStages.WithAllowVNetOverride, + DefinitionStages.WithStatus, + DefinitionStages.WithIfMatch { + /** + * Executes the create request. + * + * @return the created resource. + */ + ChangeDataCaptureResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ChangeDataCaptureResource create(Context context); + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify additionalProperties. */ + interface WithAdditionalProperties { + /** + * Specifies the additionalProperties property: Change data capture resource type.. + * + * @param additionalProperties Change data capture resource type. + * @return the next definition stage. + */ + WithCreate withAdditionalProperties(Map additionalProperties); + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify folder. */ + interface WithFolder { + /** + * Specifies the folder property: The folder that this CDC is in. If not specified, CDC will appear at the + * root level.. + * + * @param folder The folder that this CDC is in. If not specified, CDC will appear at the root level. + * @return the next definition stage. + */ + WithCreate withFolder(ChangeDataCaptureFolder folder); + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of the change data capture.. + * + * @param description The description of the change data capture. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify allowVNetOverride. */ + interface WithAllowVNetOverride { + /** + * Specifies the allowVNetOverride property: A boolean to determine if the vnet configuration needs to be + * overwritten.. + * + * @param allowVNetOverride A boolean to determine if the vnet configuration needs to be overwritten. + * @return the next definition stage. + */ + WithCreate withAllowVNetOverride(Boolean allowVNetOverride); + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: Status of the CDC as to if it is running or stopped.. + * + * @param status Status of the CDC as to if it is running or stopped. + * @return the next definition stage. + */ + WithCreate withStatus(String status); + } + + /** The stage of the ChangeDataCaptureResource definition allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: ETag of the change data capture entity. Should only be specified for + * update, for which it should match existing entity or can be * for unconditional update.. + * + * @param ifMatch ETag of the change data capture entity. Should only be specified for update, for which it + * should match existing entity or can be * for unconditional update. + * @return the next definition stage. + */ + WithCreate withIfMatch(String ifMatch); + } + } + + /** + * Begins update for the ChangeDataCaptureResource resource. + * + * @return the stage of resource update. + */ + ChangeDataCaptureResource.Update update(); + + /** The template for ChangeDataCaptureResource update. */ + interface Update + extends UpdateStages.WithAdditionalProperties, + UpdateStages.WithFolder, + UpdateStages.WithDescription, + UpdateStages.WithSourceConnectionsInfo, + UpdateStages.WithTargetConnectionsInfo, + UpdateStages.WithPolicy, + UpdateStages.WithAllowVNetOverride, + UpdateStages.WithStatus, + UpdateStages.WithIfMatch { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ChangeDataCaptureResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ChangeDataCaptureResource apply(Context context); + } + + /** The ChangeDataCaptureResource update stages. */ + interface UpdateStages { + /** The stage of the ChangeDataCaptureResource update allowing to specify additionalProperties. */ + interface WithAdditionalProperties { + /** + * Specifies the additionalProperties property: Change data capture resource type.. + * + * @param additionalProperties Change data capture resource type. + * @return the next definition stage. + */ + Update withAdditionalProperties(Map additionalProperties); + } + + /** The stage of the ChangeDataCaptureResource update allowing to specify folder. */ + interface WithFolder { + /** + * Specifies the folder property: The folder that this CDC is in. If not specified, CDC will appear at the + * root level.. + * + * @param folder The folder that this CDC is in. If not specified, CDC will appear at the root level. + * @return the next definition stage. + */ + Update withFolder(ChangeDataCaptureFolder folder); + } + + /** The stage of the ChangeDataCaptureResource update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of the change data capture.. + * + * @param description The description of the change data capture. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** The stage of the ChangeDataCaptureResource update allowing to specify sourceConnectionsInfo. */ + interface WithSourceConnectionsInfo { + /** + * Specifies the sourceConnectionsInfo property: List of sources connections that can be used as sources in + * the CDC.. + * + * @param sourceConnectionsInfo List of sources connections that can be used as sources in the CDC. + * @return the next definition stage. + */ + Update withSourceConnectionsInfo(List sourceConnectionsInfo); + } + + /** The stage of the ChangeDataCaptureResource update allowing to specify targetConnectionsInfo. */ + interface WithTargetConnectionsInfo { + /** + * Specifies the targetConnectionsInfo property: List of target connections that can be used as sources in + * the CDC.. + * + * @param targetConnectionsInfo List of target connections that can be used as sources in the CDC. + * @return the next definition stage. + */ + Update withTargetConnectionsInfo(List targetConnectionsInfo); + } + + /** The stage of the ChangeDataCaptureResource update allowing to specify policy. */ + interface WithPolicy { + /** + * Specifies the policy property: CDC policy. + * + * @param policy CDC policy. + * @return the next definition stage. + */ + Update withPolicy(MapperPolicy policy); + } + + /** The stage of the ChangeDataCaptureResource update allowing to specify allowVNetOverride. */ + interface WithAllowVNetOverride { + /** + * Specifies the allowVNetOverride property: A boolean to determine if the vnet configuration needs to be + * overwritten.. + * + * @param allowVNetOverride A boolean to determine if the vnet configuration needs to be overwritten. + * @return the next definition stage. + */ + Update withAllowVNetOverride(Boolean allowVNetOverride); + } + + /** The stage of the ChangeDataCaptureResource update allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: Status of the CDC as to if it is running or stopped.. + * + * @param status Status of the CDC as to if it is running or stopped. + * @return the next definition stage. + */ + Update withStatus(String status); + } + + /** The stage of the ChangeDataCaptureResource update allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: ETag of the change data capture entity. Should only be specified for + * update, for which it should match existing entity or can be * for unconditional update.. + * + * @param ifMatch ETag of the change data capture entity. Should only be specified for update, for which it + * should match existing entity or can be * for unconditional update. + * @return the next definition stage. + */ + Update withIfMatch(String ifMatch); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ChangeDataCaptureResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ChangeDataCaptureResource refresh(Context context); + + /** + * Starts a change data capture. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response startWithResponse(Context context); + + /** + * Starts a change data capture. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * Stops a change data capture. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response stopWithResponse(Context context); + + /** + * Stops a change data capture. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(); +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptures.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptures.java new file mode 100644 index 000000000000..ef8c3363215b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ChangeDataCaptures.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ChangeDataCaptures. */ +public interface ChangeDataCaptures { + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFactory(String resourceGroupName, String factoryName); + + /** + * Lists all resources of type change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of change data capture resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFactory( + String resourceGroupName, String factoryName, Context context); + + /** + * Gets a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param ifNoneMatch ETag of the change data capture entity. Should only be specified for get. If the ETag matches + * the existing entity tag, or if * was provided, then no content will be returned. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String factoryName, + String changeDataCaptureName, + String ifNoneMatch, + Context context); + + /** + * Gets a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture. + */ + ChangeDataCaptureResource get(String resourceGroupName, String factoryName, String changeDataCaptureName); + + /** + * Deletes a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context); + + /** + * Deletes a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String factoryName, String changeDataCaptureName); + + /** + * Starts a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response startWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context); + + /** + * Starts a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String factoryName, String changeDataCaptureName); + + /** + * Stops a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response stopWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context); + + /** + * Stops a change data capture. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String factoryName, String changeDataCaptureName); + + /** + * Gets the current status for the change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status for the change data capture resource along with {@link Response}. + */ + Response statusWithResponse( + String resourceGroupName, String factoryName, String changeDataCaptureName, Context context); + + /** + * Gets the current status for the change data capture resource. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param changeDataCaptureName The change data capture name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status for the change data capture resource. + */ + String status(String resourceGroupName, String factoryName, String changeDataCaptureName); + + /** + * Gets a change data capture. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture along with {@link Response}. + */ + ChangeDataCaptureResource getById(String id); + + /** + * Gets a change data capture. + * + * @param id the resource ID. + * @param ifNoneMatch ETag of the change data capture entity. Should only be specified for get. If the ETag matches + * the existing entity tag, or if * was provided, then no content will be returned. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a change data capture along with {@link Response}. + */ + Response getByIdWithResponse(String id, String ifNoneMatch, Context context); + + /** + * Deletes a change data capture. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a change data capture. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ChangeDataCaptureResource resource. + * + * @param name resource name. + * @return the first stage of the new ChangeDataCaptureResource definition. + */ + ChangeDataCaptureResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CommonDataServiceForAppsLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CommonDataServiceForAppsLinkedService.java index 4f08ed50cb66..41cd5eaa3bbc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CommonDataServiceForAppsLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CommonDataServiceForAppsLinkedService.java @@ -356,22 +356,22 @@ public CommonDataServiceForAppsLinkedService withServicePrincipalCredential(Secr /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the CommonDataServiceForAppsLinkedService object itself. */ - public CommonDataServiceForAppsLinkedService withEncryptedCredential(Object encryptedCredential) { + public CommonDataServiceForAppsLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new CommonDataServiceForAppsLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ConcurLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ConcurLinkedService.java index 20bbf38c0397..ffeddcbf3906 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ConcurLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ConcurLinkedService.java @@ -236,22 +236,22 @@ public ConcurLinkedService withUsePeerVerification(Object usePeerVerification) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ConcurLinkedService object itself. */ - public ConcurLinkedService withEncryptedCredential(Object encryptedCredential) { + public ConcurLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new ConcurLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ConnectionType.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ConnectionType.java new file mode 100644 index 000000000000..b453bd1c84ff --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ConnectionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of connection via linked service or dataset. */ +public final class ConnectionType extends ExpandableStringEnum { + /** Static value linkedservicetype for ConnectionType. */ + public static final ConnectionType LINKEDSERVICETYPE = fromString("linkedservicetype"); + + /** + * Creates a new instance of ConnectionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConnectionType() { + } + + /** + * Creates or finds a ConnectionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectionType. + */ + @JsonCreator + public static ConnectionType fromString(String name) { + return fromString(name, ConnectionType.class); + } + + /** + * Gets known ConnectionType values. + * + * @return known ConnectionType values. + */ + public static Collection values() { + return values(ConnectionType.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ControlActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ControlActivity.java index 4e84d8885179..3162d9bc6c64 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ControlActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ControlActivity.java @@ -51,6 +51,20 @@ public ControlActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public ControlActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public ControlActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public ControlActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CopyActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CopyActivity.java index 000fae65d27b..13aeeb05ff17 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CopyActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CopyActivity.java @@ -116,6 +116,20 @@ public CopyActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public CopyActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public CopyActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public CopyActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbConnectionMode.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbConnectionMode.java index e4796c502f30..ea74231a560b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbConnectionMode.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbConnectionMode.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** The connection mode used to access CosmosDB account. Type: string (or Expression with resultType string). */ +/** The connection mode used to access CosmosDB account. Type: string. */ public final class CosmosDbConnectionMode extends ExpandableStringEnum { /** Static value Gateway for CosmosDbConnectionMode. */ public static final CosmosDbConnectionMode GATEWAY = fromString("Gateway"); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbLinkedService.java index 398530326252..b74b27ed7bec 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbLinkedService.java @@ -190,25 +190,22 @@ public CosmosDbLinkedService withServicePrincipalId(Object servicePrincipalId) { /** * Get the servicePrincipalCredentialType property: The service principal credential type to use in Server-To-Server - * authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string (or - * Expression with resultType string). + * authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string. * * @return the servicePrincipalCredentialType value. */ - public CosmosDbServicePrincipalCredentialType servicePrincipalCredentialType() { + public Object servicePrincipalCredentialType() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().servicePrincipalCredentialType(); } /** * Set the servicePrincipalCredentialType property: The service principal credential type to use in Server-To-Server - * authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string (or - * Expression with resultType string). + * authentication. 'ServicePrincipalKey' for key/secret, 'ServicePrincipalCert' for certificate. Type: string. * * @param servicePrincipalCredentialType the servicePrincipalCredentialType value to set. * @return the CosmosDbLinkedService object itself. */ - public CosmosDbLinkedService withServicePrincipalCredentialType( - CosmosDbServicePrincipalCredentialType servicePrincipalCredentialType) { + public CosmosDbLinkedService withServicePrincipalCredentialType(Object servicePrincipalCredentialType) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new CosmosDbLinkedServiceTypeProperties(); } @@ -298,8 +295,7 @@ public CosmosDbLinkedService withAzureCloudType(Object azureCloudType) { } /** - * Get the connectionMode property: The connection mode used to access CosmosDB account. Type: string (or Expression - * with resultType string). + * Get the connectionMode property: The connection mode used to access CosmosDB account. Type: string. * * @return the connectionMode value. */ @@ -308,8 +304,7 @@ public CosmosDbConnectionMode connectionMode() { } /** - * Set the connectionMode property: The connection mode used to access CosmosDB account. Type: string (or Expression - * with resultType string). + * Set the connectionMode property: The connection mode used to access CosmosDB account. Type: string. * * @param connectionMode the connectionMode value to set. * @return the CosmosDbLinkedService object itself. @@ -324,22 +319,22 @@ public CosmosDbLinkedService withConnectionMode(CosmosDbConnectionMode connectio /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the CosmosDbLinkedService object itself. */ - public CosmosDbLinkedService withEncryptedCredential(Object encryptedCredential) { + public CosmosDbLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new CosmosDbLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbServicePrincipalCredentialType.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbServicePrincipalCredentialType.java deleted file mode 100644 index 448a9ca37383..000000000000 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CosmosDbServicePrincipalCredentialType.java +++ /dev/null @@ -1,53 +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.resourcemanager.datafactory.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * The service principal credential type to use in Server-To-Server authentication. 'ServicePrincipalKey' for - * key/secret, 'ServicePrincipalCert' for certificate. Type: string (or Expression with resultType string). - */ -public final class CosmosDbServicePrincipalCredentialType - extends ExpandableStringEnum { - /** Static value ServicePrincipalKey for CosmosDbServicePrincipalCredentialType. */ - public static final CosmosDbServicePrincipalCredentialType SERVICE_PRINCIPAL_KEY = - fromString("ServicePrincipalKey"); - - /** Static value ServicePrincipalCert for CosmosDbServicePrincipalCredentialType. */ - public static final CosmosDbServicePrincipalCredentialType SERVICE_PRINCIPAL_CERT = - fromString("ServicePrincipalCert"); - - /** - * Creates a new instance of CosmosDbServicePrincipalCredentialType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public CosmosDbServicePrincipalCredentialType() { - } - - /** - * Creates or finds a CosmosDbServicePrincipalCredentialType from its string representation. - * - * @param name a name to look for. - * @return the corresponding CosmosDbServicePrincipalCredentialType. - */ - @JsonCreator - public static CosmosDbServicePrincipalCredentialType fromString(String name) { - return fromString(name, CosmosDbServicePrincipalCredentialType.class); - } - - /** - * Gets known CosmosDbServicePrincipalCredentialType values. - * - * @return known CosmosDbServicePrincipalCredentialType values. - */ - public static Collection values() { - return values(CosmosDbServicePrincipalCredentialType.class); - } -} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CouchbaseLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CouchbaseLinkedService.java index 973bf846c38b..8cc678106dc9 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CouchbaseLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CouchbaseLinkedService.java @@ -115,22 +115,22 @@ public CouchbaseLinkedService withCredString(AzureKeyVaultSecretReference credSt /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the CouchbaseLinkedService object itself. */ - public CouchbaseLinkedService withEncryptedCredential(Object encryptedCredential) { + public CouchbaseLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new CouchbaseLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CustomActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CustomActivity.java index 68e198198d01..dc3bf7291126 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CustomActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CustomActivity.java @@ -65,6 +65,20 @@ public CustomActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public CustomActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public CustomActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataFlowResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataFlowResource.java index a08edfe17997..25975f509c20 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataFlowResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataFlowResource.java @@ -65,11 +65,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The DataFlowResource definition stages. */ interface DefinitionStages { /** The first stage of the DataFlowResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the DataFlowResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -81,6 +83,7 @@ interface WithParentResource { */ WithProperties withExistingFactory(String resourceGroupName, String factoryName); } + /** The stage of the DataFlowResource definition allowing to specify properties. */ interface WithProperties { /** @@ -91,6 +94,7 @@ interface WithProperties { */ WithCreate withProperties(DataFlow properties); } + /** * The stage of the DataFlowResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -111,6 +115,7 @@ interface WithCreate extends DefinitionStages.WithIfMatch { */ DataFlowResource create(Context context); } + /** The stage of the DataFlowResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -124,6 +129,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the DataFlowResource resource. * @@ -148,6 +154,7 @@ interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { */ DataFlowResource apply(Context context); } + /** The DataFlowResource update stages. */ interface UpdateStages { /** The stage of the DataFlowResource update allowing to specify properties. */ @@ -160,6 +167,7 @@ interface WithProperties { */ Update withProperties(DataFlow properties); } + /** The stage of the DataFlowResource update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -173,6 +181,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataLakeAnalyticsUsqlActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataLakeAnalyticsUsqlActivity.java index 6f3619f2ae4d..d016b2640ee3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataLakeAnalyticsUsqlActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataLakeAnalyticsUsqlActivity.java @@ -66,6 +66,20 @@ public DataLakeAnalyticsUsqlActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public DataLakeAnalyticsUsqlActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataLakeAnalyticsUsqlActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public DataLakeAnalyticsUsqlActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataMapperMapping.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataMapperMapping.java new file mode 100644 index 000000000000..fedf454ef16e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataMapperMapping.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Source and target table mapping details. */ +@Fluent +public final class DataMapperMapping { + /* + * Name of the target table + */ + @JsonProperty(value = "targetEntityName") + private String targetEntityName; + + /* + * Name of the source table + */ + @JsonProperty(value = "sourceEntityName") + private String sourceEntityName; + + /* + * The connection reference for the source connection. + */ + @JsonProperty(value = "sourceConnectionReference") + private MapperConnectionReference sourceConnectionReference; + + /* + * This holds the user provided attribute mapping information. + */ + @JsonProperty(value = "attributeMappingInfo") + private MapperAttributeMappings attributeMappingInfo; + + /* + * This holds the source denormalization information used while joining multiple sources. + */ + @JsonProperty(value = "sourceDenormalizeInfo") + private Object sourceDenormalizeInfo; + + /** Creates an instance of DataMapperMapping class. */ + public DataMapperMapping() { + } + + /** + * Get the targetEntityName property: Name of the target table. + * + * @return the targetEntityName value. + */ + public String targetEntityName() { + return this.targetEntityName; + } + + /** + * Set the targetEntityName property: Name of the target table. + * + * @param targetEntityName the targetEntityName value to set. + * @return the DataMapperMapping object itself. + */ + public DataMapperMapping withTargetEntityName(String targetEntityName) { + this.targetEntityName = targetEntityName; + return this; + } + + /** + * Get the sourceEntityName property: Name of the source table. + * + * @return the sourceEntityName value. + */ + public String sourceEntityName() { + return this.sourceEntityName; + } + + /** + * Set the sourceEntityName property: Name of the source table. + * + * @param sourceEntityName the sourceEntityName value to set. + * @return the DataMapperMapping object itself. + */ + public DataMapperMapping withSourceEntityName(String sourceEntityName) { + this.sourceEntityName = sourceEntityName; + return this; + } + + /** + * Get the sourceConnectionReference property: The connection reference for the source connection. + * + * @return the sourceConnectionReference value. + */ + public MapperConnectionReference sourceConnectionReference() { + return this.sourceConnectionReference; + } + + /** + * Set the sourceConnectionReference property: The connection reference for the source connection. + * + * @param sourceConnectionReference the sourceConnectionReference value to set. + * @return the DataMapperMapping object itself. + */ + public DataMapperMapping withSourceConnectionReference(MapperConnectionReference sourceConnectionReference) { + this.sourceConnectionReference = sourceConnectionReference; + return this; + } + + /** + * Get the attributeMappingInfo property: This holds the user provided attribute mapping information. + * + * @return the attributeMappingInfo value. + */ + public MapperAttributeMappings attributeMappingInfo() { + return this.attributeMappingInfo; + } + + /** + * Set the attributeMappingInfo property: This holds the user provided attribute mapping information. + * + * @param attributeMappingInfo the attributeMappingInfo value to set. + * @return the DataMapperMapping object itself. + */ + public DataMapperMapping withAttributeMappingInfo(MapperAttributeMappings attributeMappingInfo) { + this.attributeMappingInfo = attributeMappingInfo; + return this; + } + + /** + * Get the sourceDenormalizeInfo property: This holds the source denormalization information used while joining + * multiple sources. + * + * @return the sourceDenormalizeInfo value. + */ + public Object sourceDenormalizeInfo() { + return this.sourceDenormalizeInfo; + } + + /** + * Set the sourceDenormalizeInfo property: This holds the source denormalization information used while joining + * multiple sources. + * + * @param sourceDenormalizeInfo the sourceDenormalizeInfo value to set. + * @return the DataMapperMapping object itself. + */ + public DataMapperMapping withSourceDenormalizeInfo(Object sourceDenormalizeInfo) { + this.sourceDenormalizeInfo = sourceDenormalizeInfo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceConnectionReference() != null) { + sourceConnectionReference().validate(); + } + if (attributeMappingInfo() != null) { + attributeMappingInfo().validate(); + } + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksNotebookActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksNotebookActivity.java index 7baf3619f797..aba9c71eaa96 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksNotebookActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksNotebookActivity.java @@ -66,6 +66,20 @@ public DatabricksNotebookActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public DatabricksNotebookActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabricksNotebookActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public DatabricksNotebookActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksSparkJarActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksSparkJarActivity.java index 19cb7feaab10..ded91fdd0b7f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksSparkJarActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksSparkJarActivity.java @@ -66,6 +66,20 @@ public DatabricksSparkJarActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public DatabricksSparkJarActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabricksSparkJarActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public DatabricksSparkJarActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksSparkPythonActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksSparkPythonActivity.java index df87ddcc228d..b4350bc1e191 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksSparkPythonActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatabricksSparkPythonActivity.java @@ -66,6 +66,20 @@ public DatabricksSparkPythonActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public DatabricksSparkPythonActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabricksSparkPythonActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public DatabricksSparkPythonActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatasetResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatasetResource.java index c4b763ea8dc4..140c9e0ca27e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatasetResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DatasetResource.java @@ -65,11 +65,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The DatasetResource definition stages. */ interface DefinitionStages { /** The first stage of the DatasetResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the DatasetResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -81,6 +83,7 @@ interface WithParentResource { */ WithProperties withExistingFactory(String resourceGroupName, String factoryName); } + /** The stage of the DatasetResource definition allowing to specify properties. */ interface WithProperties { /** @@ -91,6 +94,7 @@ interface WithProperties { */ WithCreate withProperties(Dataset properties); } + /** * The stage of the DatasetResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -111,6 +115,7 @@ interface WithCreate extends DefinitionStages.WithIfMatch { */ DatasetResource create(Context context); } + /** The stage of the DatasetResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -124,6 +129,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the DatasetResource resource. * @@ -148,6 +154,7 @@ interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { */ DatasetResource apply(Context context); } + /** The DatasetResource update stages. */ interface UpdateStages { /** The stage of the DatasetResource update allowing to specify properties. */ @@ -160,6 +167,7 @@ interface WithProperties { */ Update withProperties(Dataset properties); } + /** The stage of the DatasetResource update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -173,6 +181,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataworldLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataworldLinkedService.java index 647447e60718..7e659387bfd8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataworldLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DataworldLinkedService.java @@ -90,22 +90,22 @@ public DataworldLinkedService withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DataworldLinkedService object itself. */ - public DataworldLinkedService withEncryptedCredential(Object encryptedCredential) { + public DataworldLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new DataworldLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Db2LinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Db2LinkedService.java index dc9aca7dd0e1..2b531f6a09d0 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Db2LinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Db2LinkedService.java @@ -268,23 +268,23 @@ public Db2LinkedService withCertificateCommonName(Object certificateCommonName) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. It is mutually exclusive with connectionString property. Type: - * string (or Expression with resultType string). + * string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. It is mutually exclusive with connectionString property. Type: - * string (or Expression with resultType string). + * string. * * @param encryptedCredential the encryptedCredential value to set. * @return the Db2LinkedService object itself. */ - public Db2LinkedService withEncryptedCredential(Object encryptedCredential) { + public Db2LinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new Db2LinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DeleteActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DeleteActivity.java index e2f91b7c1a31..d1ac8a3b08d8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DeleteActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DeleteActivity.java @@ -64,6 +64,20 @@ public DeleteActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public DeleteActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public DeleteActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public DeleteActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DrillLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DrillLinkedService.java index e6426515af14..e37d2e6054c8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DrillLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DrillLinkedService.java @@ -115,22 +115,22 @@ public DrillLinkedService withPwd(AzureKeyVaultSecretReference pwd) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DrillLinkedService object itself. */ - public DrillLinkedService withEncryptedCredential(Object encryptedCredential) { + public DrillLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new DrillLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsAXLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsAXLinkedService.java index 2f0c97c8fced..9f7f8e470bdf 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsAXLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsAXLinkedService.java @@ -194,22 +194,22 @@ public DynamicsAXLinkedService withAadResourceId(Object aadResourceId) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DynamicsAXLinkedService object itself. */ - public DynamicsAXLinkedService withEncryptedCredential(Object encryptedCredential) { + public DynamicsAXLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new DynamicsAXLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsCrmLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsCrmLinkedService.java index 0c3099ebf6e1..c0339de8fe3c 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsCrmLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsCrmLinkedService.java @@ -352,22 +352,22 @@ public DynamicsCrmLinkedService withServicePrincipalCredential(SecretBase servic /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DynamicsCrmLinkedService object itself. */ - public DynamicsCrmLinkedService withEncryptedCredential(Object encryptedCredential) { + public DynamicsCrmLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new DynamicsCrmLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsLinkedService.java index 3bd5380d471c..b3ab2a3e0dfa 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/DynamicsLinkedService.java @@ -350,22 +350,22 @@ public DynamicsLinkedService withServicePrincipalCredential(SecretBase servicePr /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the DynamicsLinkedService object itself. */ - public DynamicsLinkedService withEncryptedCredential(Object encryptedCredential) { + public DynamicsLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new DynamicsLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/EloquaLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/EloquaLinkedService.java index 6fe5a106b65c..6aed59ae04f0 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/EloquaLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/EloquaLinkedService.java @@ -213,22 +213,22 @@ public EloquaLinkedService withUsePeerVerification(Object usePeerVerification) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the EloquaLinkedService object itself. */ - public EloquaLinkedService withEncryptedCredential(Object encryptedCredential) { + public EloquaLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new EloquaLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteDataFlowActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteDataFlowActivity.java index 050bc796c4d8..999b508ee63f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteDataFlowActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteDataFlowActivity.java @@ -64,6 +64,20 @@ public ExecuteDataFlowActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public ExecuteDataFlowActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public ExecuteDataFlowActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public ExecuteDataFlowActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecutePipelineActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecutePipelineActivity.java index babf94b0d714..595f2172de27 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecutePipelineActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecutePipelineActivity.java @@ -77,6 +77,20 @@ public ExecutePipelineActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public ExecutePipelineActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public ExecutePipelineActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public ExecutePipelineActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteSsisPackageActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteSsisPackageActivity.java index c883c6bc1799..69b372f90633 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteSsisPackageActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteSsisPackageActivity.java @@ -66,6 +66,20 @@ public ExecuteSsisPackageActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public ExecuteSsisPackageActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public ExecuteSsisPackageActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public ExecuteSsisPackageActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteWranglingDataflowActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteWranglingDataflowActivity.java index 6b3648416704..541c69476ebf 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteWranglingDataflowActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecuteWranglingDataflowActivity.java @@ -77,6 +77,20 @@ public ExecuteWranglingDataflowActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public ExecuteWranglingDataflowActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public ExecuteWranglingDataflowActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public ExecuteWranglingDataflowActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecutionActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecutionActivity.java index 8f2de0776d87..bb18a6982a5f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecutionActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ExecutionActivity.java @@ -118,6 +118,20 @@ public ExecutionActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public ExecutionActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public ExecutionActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public ExecutionActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Factory.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Factory.java index 8da152f531b5..7d2d782064dd 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Factory.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Factory.java @@ -160,11 +160,13 @@ interface Definition DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } + /** The Factory definition stages. */ interface DefinitionStages { /** The first stage of the Factory definition. */ interface Blank extends WithLocation { } + /** The stage of the Factory definition allowing to specify location. */ interface WithLocation { /** @@ -183,6 +185,7 @@ interface WithLocation { */ WithResourceGroup withRegion(String location); } + /** The stage of the Factory definition allowing to specify parent resource. */ interface WithResourceGroup { /** @@ -193,6 +196,7 @@ interface WithResourceGroup { */ WithCreate withExistingResourceGroup(String resourceGroupName); } + /** * The stage of the Factory definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. @@ -222,6 +226,7 @@ interface WithCreate */ Factory create(Context context); } + /** The stage of the Factory definition allowing to specify tags. */ interface WithTags { /** @@ -232,6 +237,7 @@ interface WithTags { */ WithCreate withTags(Map tags); } + /** The stage of the Factory definition allowing to specify identity. */ interface WithIdentity { /** @@ -242,6 +248,7 @@ interface WithIdentity { */ WithCreate withIdentity(FactoryIdentity identity); } + /** The stage of the Factory definition allowing to specify additionalProperties. */ interface WithAdditionalProperties { /** @@ -252,6 +259,7 @@ interface WithAdditionalProperties { */ WithCreate withAdditionalProperties(Map additionalProperties); } + /** The stage of the Factory definition allowing to specify purviewConfiguration. */ interface WithPurviewConfiguration { /** @@ -262,6 +270,7 @@ interface WithPurviewConfiguration { */ WithCreate withPurviewConfiguration(PurviewConfiguration purviewConfiguration); } + /** The stage of the Factory definition allowing to specify repoConfiguration. */ interface WithRepoConfiguration { /** @@ -272,6 +281,7 @@ interface WithRepoConfiguration { */ WithCreate withRepoConfiguration(FactoryRepoConfiguration repoConfiguration); } + /** The stage of the Factory definition allowing to specify globalParameters. */ interface WithGlobalParameters { /** @@ -282,6 +292,7 @@ interface WithGlobalParameters { */ WithCreate withGlobalParameters(Map globalParameters); } + /** The stage of the Factory definition allowing to specify encryption. */ interface WithEncryption { /** @@ -292,6 +303,7 @@ interface WithEncryption { */ WithCreate withEncryption(EncryptionConfiguration encryption); } + /** The stage of the Factory definition allowing to specify publicNetworkAccess. */ interface WithPublicNetworkAccess { /** @@ -303,6 +315,7 @@ interface WithPublicNetworkAccess { */ WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); } + /** The stage of the Factory definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -316,6 +329,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the Factory resource. * @@ -340,6 +354,7 @@ interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, Updat */ Factory apply(Context context); } + /** The Factory update stages. */ interface UpdateStages { /** The stage of the Factory update allowing to specify tags. */ @@ -352,6 +367,7 @@ interface WithTags { */ Update withTags(Map tags); } + /** The stage of the Factory update allowing to specify identity. */ interface WithIdentity { /** @@ -362,6 +378,7 @@ interface WithIdentity { */ Update withIdentity(FactoryIdentity identity); } + /** The stage of the Factory update allowing to specify publicNetworkAccess. */ interface WithPublicNetworkAccess { /** @@ -374,6 +391,7 @@ interface WithPublicNetworkAccess { Update withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FactoryIdentity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FactoryIdentity.java index 950a13e96a61..67dc4a5aa07b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FactoryIdentity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FactoryIdentity.java @@ -13,7 +13,7 @@ /** Identity properties of the factory resource. */ @Fluent -public class FactoryIdentity { +public final class FactoryIdentity { /* * The identity type. */ diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FailActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FailActivity.java index 09e31da01d42..d6a6963a5e73 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FailActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FailActivity.java @@ -55,6 +55,20 @@ public FailActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public FailActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public FailActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public FailActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FileServerLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FileServerLinkedService.java index f7d89be149d2..e09693ed297d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FileServerLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FileServerLinkedService.java @@ -136,22 +136,22 @@ public FileServerLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the FileServerLinkedService object itself. */ - public FileServerLinkedService withEncryptedCredential(Object encryptedCredential) { + public FileServerLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new FileServerLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FileServerReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FileServerReadSettings.java index f1f59990ab64..3f5856a62b58 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FileServerReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FileServerReadSettings.java @@ -41,10 +41,10 @@ public final class FileServerReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -172,21 +172,23 @@ public FileServerReadSettings withFileListPath(Object fileListPath) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the FileServerReadSettings object itself. */ - public FileServerReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public FileServerReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FilterActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FilterActivity.java index b0a943d774cb..d59157a6379b 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FilterActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FilterActivity.java @@ -50,6 +50,20 @@ public FilterActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public FilterActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public FilterActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public FilterActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ForEachActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ForEachActivity.java index 6dedfe0d94f3..f12c3d00f09f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ForEachActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ForEachActivity.java @@ -50,6 +50,20 @@ public ForEachActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public ForEachActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public ForEachActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public ForEachActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FrequencyType.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FrequencyType.java new file mode 100644 index 000000000000..66fa75b69b99 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FrequencyType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Frequency of period in terms of 'Hour', 'Minute' or 'Second'. */ +public final class FrequencyType extends ExpandableStringEnum { + /** Static value Hour for FrequencyType. */ + public static final FrequencyType HOUR = fromString("Hour"); + + /** Static value Minute for FrequencyType. */ + public static final FrequencyType MINUTE = fromString("Minute"); + + /** Static value Second for FrequencyType. */ + public static final FrequencyType SECOND = fromString("Second"); + + /** + * Creates a new instance of FrequencyType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FrequencyType() { + } + + /** + * Creates or finds a FrequencyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding FrequencyType. + */ + @JsonCreator + public static FrequencyType fromString(String name) { + return fromString(name, FrequencyType.class); + } + + /** + * Gets known FrequencyType values. + * + * @return known FrequencyType values. + */ + public static Collection values() { + return values(FrequencyType.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FtpReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FtpReadSettings.java index 1715e2b6a122..0d328e494a56 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FtpReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FtpReadSettings.java @@ -34,10 +34,10 @@ public final class FtpReadSettings extends StoreReadSettings { private Object wildcardFileName; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -61,10 +61,11 @@ public final class FtpReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Specify whether to use binary transfer mode for FTP stores. + * Specify whether to use binary transfer mode for FTP stores. Type: boolean (or Expression with resultType + * boolean). */ @JsonProperty(value = "useBinaryTransfer") - private Boolean useBinaryTransfer; + private Object useBinaryTransfer; /* * If true, disable parallel reading within each file. Default is false. Type: boolean (or Expression with @@ -140,21 +141,23 @@ public FtpReadSettings withWildcardFileName(Object wildcardFileName) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the FtpReadSettings object itself. */ - public FtpReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public FtpReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } @@ -226,21 +229,23 @@ public FtpReadSettings withFileListPath(Object fileListPath) { } /** - * Get the useBinaryTransfer property: Specify whether to use binary transfer mode for FTP stores. + * Get the useBinaryTransfer property: Specify whether to use binary transfer mode for FTP stores. Type: boolean (or + * Expression with resultType boolean). * * @return the useBinaryTransfer value. */ - public Boolean useBinaryTransfer() { + public Object useBinaryTransfer() { return this.useBinaryTransfer; } /** - * Set the useBinaryTransfer property: Specify whether to use binary transfer mode for FTP stores. + * Set the useBinaryTransfer property: Specify whether to use binary transfer mode for FTP stores. Type: boolean (or + * Expression with resultType boolean). * * @param useBinaryTransfer the useBinaryTransfer value to set. * @return the FtpReadSettings object itself. */ - public FtpReadSettings withUseBinaryTransfer(Boolean useBinaryTransfer) { + public FtpReadSettings withUseBinaryTransfer(Object useBinaryTransfer) { this.useBinaryTransfer = useBinaryTransfer; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FtpServerLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FtpServerLinkedService.java index 2d4d3f6c7b17..1a3c7d57f0ba 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FtpServerLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FtpServerLinkedService.java @@ -184,22 +184,22 @@ public FtpServerLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the FtpServerLinkedService object itself. */ - public FtpServerLinkedService withEncryptedCredential(Object encryptedCredential) { + public FtpServerLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new FtpServerLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GetMetadataActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GetMetadataActivity.java index 625fada46fee..146c6556dcc6 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GetMetadataActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GetMetadataActivity.java @@ -64,6 +64,20 @@ public GetMetadataActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public GetMetadataActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public GetMetadataActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public GetMetadataActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GlobalParameterResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GlobalParameterResource.java index ba2abe03a691..0958ad837e15 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GlobalParameterResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GlobalParameterResource.java @@ -66,11 +66,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The GlobalParameterResource definition stages. */ interface DefinitionStages { /** The first stage of the GlobalParameterResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the GlobalParameterResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -82,6 +84,7 @@ interface WithParentResource { */ WithProperties withExistingFactory(String resourceGroupName, String factoryName); } + /** The stage of the GlobalParameterResource definition allowing to specify properties. */ interface WithProperties { /** @@ -92,6 +95,7 @@ interface WithProperties { */ WithCreate withProperties(Map properties); } + /** * The stage of the GlobalParameterResource definition which contains all the minimum required properties for * the resource to be created, but also allows for any other optional properties to be specified. @@ -113,6 +117,7 @@ interface WithCreate { GlobalParameterResource create(Context context); } } + /** * Begins update for the GlobalParameterResource resource. * @@ -137,6 +142,7 @@ interface Update extends UpdateStages.WithProperties { */ GlobalParameterResource apply(Context context); } + /** The GlobalParameterResource update stages. */ interface UpdateStages { /** The stage of the GlobalParameterResource update allowing to specify properties. */ @@ -150,6 +156,7 @@ interface WithProperties { Update withProperties(Map properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleAdWordsLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleAdWordsLinkedService.java index 8e8b987d8964..bd35c8de7c84 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleAdWordsLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleAdWordsLinkedService.java @@ -93,7 +93,7 @@ public GoogleAdWordsLinkedService withConnectionProperties(Object connectionProp /** * Get the clientCustomerId property: The Client customer ID of the AdWords account that you want to fetch report - * data for. + * data for. Type: string (or Expression with resultType string). * * @return the clientCustomerId value. */ @@ -103,7 +103,7 @@ public Object clientCustomerId() { /** * Set the clientCustomerId property: The Client customer ID of the AdWords account that you want to fetch report - * data for. + * data for. Type: string (or Expression with resultType string). * * @param clientCustomerId the clientCustomerId value to set. * @return the GoogleAdWordsLinkedService object itself. @@ -241,7 +241,7 @@ public GoogleAdWordsLinkedService withClientSecret(SecretBase clientSecret) { /** * Get the email property: The service account email ID that is used for ServiceAuthentication and can only be used - * on self-hosted IR. + * on self-hosted IR. Type: string (or Expression with resultType string). * * @return the email value. */ @@ -251,7 +251,7 @@ public Object email() { /** * Set the email property: The service account email ID that is used for ServiceAuthentication and can only be used - * on self-hosted IR. + * on self-hosted IR. Type: string (or Expression with resultType string). * * @param email the email value to set. * @return the GoogleAdWordsLinkedService object itself. @@ -266,7 +266,7 @@ public GoogleAdWordsLinkedService withEmail(Object email) { /** * Get the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account - * email address and can only be used on self-hosted IR. + * email address and can only be used on self-hosted IR. Type: string (or Expression with resultType string). * * @return the keyFilePath value. */ @@ -276,7 +276,7 @@ public Object keyFilePath() { /** * Set the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account - * email address and can only be used on self-hosted IR. + * email address and can only be used on self-hosted IR. Type: string (or Expression with resultType string). * * @param keyFilePath the keyFilePath value to set. * @return the GoogleAdWordsLinkedService object itself. @@ -292,7 +292,7 @@ public GoogleAdWordsLinkedService withKeyFilePath(Object keyFilePath) { /** * Get the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying * the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default - * value is the cacerts.pem file installed with the IR. + * value is the cacerts.pem file installed with the IR. Type: string (or Expression with resultType string). * * @return the trustedCertPath value. */ @@ -303,7 +303,7 @@ public Object trustedCertPath() { /** * Set the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying * the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default - * value is the cacerts.pem file installed with the IR. + * value is the cacerts.pem file installed with the IR. Type: string (or Expression with resultType string). * * @param trustedCertPath the trustedCertPath value to set. * @return the GoogleAdWordsLinkedService object itself. @@ -318,7 +318,7 @@ public GoogleAdWordsLinkedService withTrustedCertPath(Object trustedCertPath) { /** * Get the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or - * from a specified PEM file. The default value is false. + * from a specified PEM file. The default value is false. Type: boolean (or Expression with resultType boolean). * * @return the useSystemTrustStore value. */ @@ -328,7 +328,7 @@ public Object useSystemTrustStore() { /** * Set the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or - * from a specified PEM file. The default value is false. + * from a specified PEM file. The default value is false. Type: boolean (or Expression with resultType boolean). * * @param useSystemTrustStore the useSystemTrustStore value to set. * @return the GoogleAdWordsLinkedService object itself. @@ -343,22 +343,22 @@ public GoogleAdWordsLinkedService withUseSystemTrustStore(Object useSystemTrustS /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GoogleAdWordsLinkedService object itself. */ - public GoogleAdWordsLinkedService withEncryptedCredential(Object encryptedCredential) { + public GoogleAdWordsLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new GoogleAdWordsLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleBigQueryLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleBigQueryLinkedService.java index accbd940e831..6ddff477344d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleBigQueryLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleBigQueryLinkedService.java @@ -67,7 +67,8 @@ public GoogleBigQueryLinkedService withAnnotations(List annotations) { } /** - * Get the project property: The default BigQuery project to query against. + * Get the project property: The default BigQuery project to query against. Type: string (or Expression with + * resultType string). * * @return the project value. */ @@ -76,7 +77,8 @@ public Object project() { } /** - * Set the project property: The default BigQuery project to query against. + * Set the project property: The default BigQuery project to query against. Type: string (or Expression with + * resultType string). * * @param project the project value to set. * @return the GoogleBigQueryLinkedService object itself. @@ -90,7 +92,8 @@ public GoogleBigQueryLinkedService withProject(Object project) { } /** - * Get the additionalProjects property: A comma-separated list of public BigQuery projects to access. + * Get the additionalProjects property: A comma-separated list of public BigQuery projects to access. Type: string + * (or Expression with resultType string). * * @return the additionalProjects value. */ @@ -99,7 +102,8 @@ public Object additionalProjects() { } /** - * Set the additionalProjects property: A comma-separated list of public BigQuery projects to access. + * Set the additionalProjects property: A comma-separated list of public BigQuery projects to access. Type: string + * (or Expression with resultType string). * * @param additionalProjects the additionalProjects value to set. * @return the GoogleBigQueryLinkedService object itself. @@ -115,7 +119,7 @@ public GoogleBigQueryLinkedService withAdditionalProjects(Object additionalProje /** * Get the requestGoogleDriveScope property: Whether to request access to Google Drive. Allowing Google Drive access * enables support for federated tables that combine BigQuery data with data from Google Drive. The default value is - * false. + * false. Type: string (or Expression with resultType string). * * @return the requestGoogleDriveScope value. */ @@ -126,7 +130,7 @@ public Object requestGoogleDriveScope() { /** * Set the requestGoogleDriveScope property: Whether to request access to Google Drive. Allowing Google Drive access * enables support for federated tables that combine BigQuery data with data from Google Drive. The default value is - * false. + * false. Type: string (or Expression with resultType string). * * @param requestGoogleDriveScope the requestGoogleDriveScope value to set. * @return the GoogleBigQueryLinkedService object itself. @@ -239,7 +243,7 @@ public GoogleBigQueryLinkedService withClientSecret(SecretBase clientSecret) { /** * Get the email property: The service account email ID that is used for ServiceAuthentication and can only be used - * on self-hosted IR. + * on self-hosted IR. Type: string (or Expression with resultType string). * * @return the email value. */ @@ -249,7 +253,7 @@ public Object email() { /** * Set the email property: The service account email ID that is used for ServiceAuthentication and can only be used - * on self-hosted IR. + * on self-hosted IR. Type: string (or Expression with resultType string). * * @param email the email value to set. * @return the GoogleBigQueryLinkedService object itself. @@ -264,7 +268,7 @@ public GoogleBigQueryLinkedService withEmail(Object email) { /** * Get the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account - * email address and can only be used on self-hosted IR. + * email address and can only be used on self-hosted IR. Type: string (or Expression with resultType string). * * @return the keyFilePath value. */ @@ -274,7 +278,7 @@ public Object keyFilePath() { /** * Set the keyFilePath property: The full path to the .p12 key file that is used to authenticate the service account - * email address and can only be used on self-hosted IR. + * email address and can only be used on self-hosted IR. Type: string (or Expression with resultType string). * * @param keyFilePath the keyFilePath value to set. * @return the GoogleBigQueryLinkedService object itself. @@ -290,7 +294,7 @@ public GoogleBigQueryLinkedService withKeyFilePath(Object keyFilePath) { /** * Get the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying * the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default - * value is the cacerts.pem file installed with the IR. + * value is the cacerts.pem file installed with the IR. Type: string (or Expression with resultType string). * * @return the trustedCertPath value. */ @@ -301,7 +305,7 @@ public Object trustedCertPath() { /** * Set the trustedCertPath property: The full path of the .pem file containing trusted CA certificates for verifying * the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default - * value is the cacerts.pem file installed with the IR. + * value is the cacerts.pem file installed with the IR. Type: string (or Expression with resultType string). * * @param trustedCertPath the trustedCertPath value to set. * @return the GoogleBigQueryLinkedService object itself. @@ -316,7 +320,7 @@ public GoogleBigQueryLinkedService withTrustedCertPath(Object trustedCertPath) { /** * Get the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or - * from a specified PEM file. The default value is false. + * from a specified PEM file. The default value is false.Type: boolean (or Expression with resultType boolean). * * @return the useSystemTrustStore value. */ @@ -326,7 +330,7 @@ public Object useSystemTrustStore() { /** * Set the useSystemTrustStore property: Specifies whether to use a CA certificate from the system trust store or - * from a specified PEM file. The default value is false. + * from a specified PEM file. The default value is false.Type: boolean (or Expression with resultType boolean). * * @param useSystemTrustStore the useSystemTrustStore value to set. * @return the GoogleBigQueryLinkedService object itself. @@ -341,22 +345,22 @@ public GoogleBigQueryLinkedService withUseSystemTrustStore(Object useSystemTrust /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GoogleBigQueryLinkedService object itself. */ - public GoogleBigQueryLinkedService withEncryptedCredential(Object encryptedCredential) { + public GoogleBigQueryLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new GoogleBigQueryLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleCloudStorageLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleCloudStorageLinkedService.java index 4ce68ac96e35..c746f2e98878 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleCloudStorageLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleCloudStorageLinkedService.java @@ -145,22 +145,22 @@ public GoogleCloudStorageLinkedService withServiceUrl(Object serviceUrl) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GoogleCloudStorageLinkedService object itself. */ - public GoogleCloudStorageLinkedService withEncryptedCredential(Object encryptedCredential) { + public GoogleCloudStorageLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new GoogleCloudStorageLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleCloudStorageReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleCloudStorageReadSettings.java index 40e1fe564116..d8fa91a026fc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleCloudStorageReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleCloudStorageReadSettings.java @@ -47,10 +47,10 @@ public final class GoogleCloudStorageReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -193,21 +193,23 @@ public GoogleCloudStorageReadSettings withFileListPath(Object fileListPath) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the GoogleCloudStorageReadSettings object itself. */ - public GoogleCloudStorageReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public GoogleCloudStorageReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleSheetsLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleSheetsLinkedService.java index c7dfd7169064..4ddfbb808e36 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleSheetsLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GoogleSheetsLinkedService.java @@ -90,22 +90,22 @@ public GoogleSheetsLinkedService withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GoogleSheetsLinkedService object itself. */ - public GoogleSheetsLinkedService withEncryptedCredential(Object encryptedCredential) { + public GoogleSheetsLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new GoogleSheetsLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GreenplumLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GreenplumLinkedService.java index a910e534c3c0..c34d27c1e7d5 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GreenplumLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/GreenplumLinkedService.java @@ -115,22 +115,22 @@ public GreenplumLinkedService withPwd(AzureKeyVaultSecretReference pwd) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the GreenplumLinkedService object itself. */ - public GreenplumLinkedService withEncryptedCredential(Object encryptedCredential) { + public GreenplumLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new GreenplumLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HBaseLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HBaseLinkedService.java index 1782907b016f..f2791ae14554 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HBaseLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HBaseLinkedService.java @@ -311,22 +311,22 @@ public HBaseLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedSe /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HBaseLinkedService object itself. */ - public HBaseLinkedService withEncryptedCredential(Object encryptedCredential) { + public HBaseLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new HBaseLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightHiveActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightHiveActivity.java index 3d17edc45e20..5b58d2781203 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightHiveActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightHiveActivity.java @@ -65,6 +65,20 @@ public HDInsightHiveActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public HDInsightHiveActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public HDInsightHiveActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public HDInsightHiveActivity withDependsOn(List dependsOn) { @@ -222,7 +236,7 @@ public HDInsightHiveActivity withDefines(Map defines) { * * @return the variables value. */ - public List variables() { + public Map variables() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().variables(); } @@ -232,7 +246,7 @@ public List variables() { * @param variables the variables value to set. * @return the HDInsightHiveActivity object itself. */ - public HDInsightHiveActivity withVariables(List variables) { + public HDInsightHiveActivity withVariables(Map variables) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new HDInsightHiveActivityTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightLinkedService.java index c903e0e6a6bb..f616906152a7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightLinkedService.java @@ -184,22 +184,22 @@ public HDInsightLinkedService withHcatalogLinkedServiceName(LinkedServiceReferen /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HDInsightLinkedService object itself. */ - public HDInsightLinkedService withEncryptedCredential(Object encryptedCredential) { + public HDInsightLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new HDInsightLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightMapReduceActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightMapReduceActivity.java index 2a383f31ad3c..9187fc914e92 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightMapReduceActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightMapReduceActivity.java @@ -66,6 +66,20 @@ public HDInsightMapReduceActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public HDInsightMapReduceActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public HDInsightMapReduceActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public HDInsightMapReduceActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightOnDemandLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightOnDemandLinkedService.java index 479b91c37d63..b507b96f5899 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightOnDemandLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightOnDemandLinkedService.java @@ -712,22 +712,22 @@ public HDInsightOnDemandLinkedService withYarnConfiguration(Object yarnConfigura /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HDInsightOnDemandLinkedService object itself. */ - public HDInsightOnDemandLinkedService withEncryptedCredential(Object encryptedCredential) { + public HDInsightOnDemandLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new HDInsightOnDemandLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightPigActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightPigActivity.java index d7425fc59cc7..bbf65fba7a20 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightPigActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightPigActivity.java @@ -65,6 +65,20 @@ public HDInsightPigActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public HDInsightPigActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public HDInsightPigActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public HDInsightPigActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightSparkActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightSparkActivity.java index c6bcf8a82b5f..ebdcf390d4f2 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightSparkActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightSparkActivity.java @@ -65,6 +65,20 @@ public HDInsightSparkActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public HDInsightSparkActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public HDInsightSparkActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public HDInsightSparkActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightStreamingActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightStreamingActivity.java index f3260572e632..8a3cc14f0b49 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightStreamingActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HDInsightStreamingActivity.java @@ -66,6 +66,20 @@ public HDInsightStreamingActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public HDInsightStreamingActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public HDInsightStreamingActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public HDInsightStreamingActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HdfsLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HdfsLinkedService.java index d5af5086aba8..65fc74f6c868 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HdfsLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HdfsLinkedService.java @@ -117,22 +117,22 @@ public HdfsLinkedService withAuthenticationType(Object authenticationType) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HdfsLinkedService object itself. */ - public HdfsLinkedService withEncryptedCredential(Object encryptedCredential) { + public HdfsLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new HdfsLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HdfsReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HdfsReadSettings.java index 7464ac4413ef..5657384d17be 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HdfsReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HdfsReadSettings.java @@ -41,10 +41,10 @@ public final class HdfsReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -169,21 +169,23 @@ public HdfsReadSettings withFileListPath(Object fileListPath) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the HdfsReadSettings object itself. */ - public HdfsReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public HdfsReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HiveLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HiveLinkedService.java index 33a8874e085b..d805453802bc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HiveLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HiveLinkedService.java @@ -451,22 +451,22 @@ public HiveLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedSer /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HiveLinkedService object itself. */ - public HiveLinkedService withEncryptedCredential(Object encryptedCredential) { + public HiveLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new HiveLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HttpLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HttpLinkedService.java index 80260e9c48ad..15308bec4def 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HttpLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HttpLinkedService.java @@ -244,22 +244,22 @@ public HttpLinkedService withCertThumbprint(Object certThumbprint) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HttpLinkedService object itself. */ - public HttpLinkedService withEncryptedCredential(Object encryptedCredential) { + public HttpLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new HttpLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HttpReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HttpReadSettings.java index 09b86532d2bf..222a90ecaea1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HttpReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HttpReadSettings.java @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; -/** Sftp read settings. */ +/** Http read settings. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("HttpReadSettings") @Fluent @@ -36,23 +36,18 @@ public final class HttpReadSettings extends StoreReadSettings { private Object additionalHeaders; /* - * Specifies the timeout for a HTTP client to get HTTP response from HTTP server. + * Specifies the timeout for a HTTP client to get HTTP response from HTTP server. Type: string (or Expression with + * resultType string). */ @JsonProperty(value = "requestTimeout") private Object requestTimeout; /* - * Indicates whether to enable partition discovery. + * Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or + * Expression with resultType array of objects). */ - @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; - - /* - * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType - * string). - */ - @JsonProperty(value = "partitionRootPath") - private Object partitionRootPath; + @JsonProperty(value = "additionalColumns") + private Object additionalColumns; /** Creates an instance of HttpReadSettings class. */ public HttpReadSettings() { @@ -126,6 +121,7 @@ public HttpReadSettings withAdditionalHeaders(Object additionalHeaders) { /** * Get the requestTimeout property: Specifies the timeout for a HTTP client to get HTTP response from HTTP server. + * Type: string (or Expression with resultType string). * * @return the requestTimeout value. */ @@ -135,6 +131,7 @@ public Object requestTimeout() { /** * Set the requestTimeout property: Specifies the timeout for a HTTP client to get HTTP response from HTTP server. + * Type: string (or Expression with resultType string). * * @param requestTimeout the requestTimeout value to set. * @return the HttpReadSettings object itself. @@ -145,44 +142,24 @@ public HttpReadSettings withRequestTimeout(Object requestTimeout) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. - * - * @return the enablePartitionDiscovery value. - */ - public Boolean enablePartitionDiscovery() { - return this.enablePartitionDiscovery; - } - - /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. - * - * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. - * @return the HttpReadSettings object itself. - */ - public HttpReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { - this.enablePartitionDiscovery = enablePartitionDiscovery; - return this; - } - - /** - * Get the partitionRootPath property: Specify the root path where partition discovery starts from. Type: string (or - * Expression with resultType string). + * Get the additionalColumns property: Specifies the additional columns to be added to source data. Type: array of + * objects(AdditionalColumns) (or Expression with resultType array of objects). * - * @return the partitionRootPath value. + * @return the additionalColumns value. */ - public Object partitionRootPath() { - return this.partitionRootPath; + public Object additionalColumns() { + return this.additionalColumns; } /** - * Set the partitionRootPath property: Specify the root path where partition discovery starts from. Type: string (or - * Expression with resultType string). + * Set the additionalColumns property: Specifies the additional columns to be added to source data. Type: array of + * objects(AdditionalColumns) (or Expression with resultType array of objects). * - * @param partitionRootPath the partitionRootPath value to set. + * @param additionalColumns the additionalColumns value to set. * @return the HttpReadSettings object itself. */ - public HttpReadSettings withPartitionRootPath(Object partitionRootPath) { - this.partitionRootPath = partitionRootPath; + public HttpReadSettings withAdditionalColumns(Object additionalColumns) { + this.additionalColumns = additionalColumns; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HubspotLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HubspotLinkedService.java index bb6e940347b8..3c70e3e84f31 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HubspotLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/HubspotLinkedService.java @@ -234,22 +234,22 @@ public HubspotLinkedService withUsePeerVerification(Object usePeerVerification) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the HubspotLinkedService object itself. */ - public HubspotLinkedService withEncryptedCredential(Object encryptedCredential) { + public HubspotLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new HubspotLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IfConditionActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IfConditionActivity.java index 28030a3ee3ff..c5faa0e7c650 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IfConditionActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IfConditionActivity.java @@ -53,6 +53,20 @@ public IfConditionActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public IfConditionActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public IfConditionActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public IfConditionActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ImpalaLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ImpalaLinkedService.java index ec4e11bbcdb4..91c64f66e29a 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ImpalaLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ImpalaLinkedService.java @@ -313,22 +313,22 @@ public ImpalaLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedS /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ImpalaLinkedService object itself. */ - public ImpalaLinkedService withEncryptedCredential(Object encryptedCredential) { + public ImpalaLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new ImpalaLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/InformixLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/InformixLinkedService.java index c32e0485c795..0fe4a2707295 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/InformixLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/InformixLinkedService.java @@ -67,7 +67,8 @@ public InformixLinkedService withAnnotations(List annotations) { /** * Get the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @return the connectionString value. */ @@ -77,7 +78,8 @@ public Object connectionString() { /** * Set the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @param connectionString the connectionString value to set. * @return the InformixLinkedService object itself. @@ -190,22 +192,22 @@ public InformixLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the InformixLinkedService object itself. */ - public InformixLinkedService withEncryptedCredential(Object encryptedCredential) { + public InformixLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new InformixLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeDataFlowProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeDataFlowProperties.java index c2bf6564726a..1e9f2054470f 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeDataFlowProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeDataFlowProperties.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.HashMap; +import java.util.List; import java.util.Map; /** Data flow properties for managed integration runtime. */ @@ -41,6 +42,12 @@ public final class IntegrationRuntimeDataFlowProperties { @JsonProperty(value = "cleanup") private Boolean cleanup; + /* + * Custom properties are used to tune the data flow runtime performance. + */ + @JsonProperty(value = "customProperties") + private List customProperties; + /* * Data flow properties for managed integration runtime. */ @@ -134,6 +141,27 @@ public IntegrationRuntimeDataFlowProperties withCleanup(Boolean cleanup) { return this; } + /** + * Get the customProperties property: Custom properties are used to tune the data flow runtime performance. + * + * @return the customProperties value. + */ + public List customProperties() { + return this.customProperties; + } + + /** + * Set the customProperties property: Custom properties are used to tune the data flow runtime performance. + * + * @param customProperties the customProperties value to set. + * @return the IntegrationRuntimeDataFlowProperties object itself. + */ + public IntegrationRuntimeDataFlowProperties withCustomProperties( + List customProperties) { + this.customProperties = customProperties; + return this; + } + /** * Get the additionalProperties property: Data flow properties for managed integration runtime. * @@ -169,5 +197,8 @@ void withAdditionalProperties(String key, Object value) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (customProperties() != null) { + customProperties().forEach(e -> e.validate()); + } } } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem.java new file mode 100644 index 000000000000..a434f6fc50ff --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem model. */ +@Fluent +public final class IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem { + /* + * Name of custom property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Value of custom property. + */ + @JsonProperty(value = "value") + private String value; + + /** Creates an instance of IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem class. */ + public IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem() { + } + + /** + * Get the name property: Name of custom property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of custom property. + * + * @param name the name value to set. + * @return the IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem object itself. + */ + public IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: Value of custom property. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Value of custom property. + * + * @param value the value value to set. + * @return the IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem object itself. + */ + public IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeResource.java index 0c689b313b4f..1ae18f48c2e7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/IntegrationRuntimeResource.java @@ -66,11 +66,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The IntegrationRuntimeResource definition stages. */ interface DefinitionStages { /** The first stage of the IntegrationRuntimeResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the IntegrationRuntimeResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -82,6 +84,7 @@ interface WithParentResource { */ WithProperties withExistingFactory(String resourceGroupName, String factoryName); } + /** The stage of the IntegrationRuntimeResource definition allowing to specify properties. */ interface WithProperties { /** @@ -92,6 +95,7 @@ interface WithProperties { */ WithCreate withProperties(IntegrationRuntime properties); } + /** * The stage of the IntegrationRuntimeResource definition which contains all the minimum required properties for * the resource to be created, but also allows for any other optional properties to be specified. @@ -112,6 +116,7 @@ interface WithCreate extends DefinitionStages.WithIfMatch { */ IntegrationRuntimeResource create(Context context); } + /** The stage of the IntegrationRuntimeResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -125,6 +130,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the IntegrationRuntimeResource resource. * @@ -149,6 +155,7 @@ interface Update extends UpdateStages.WithAutoUpdate, UpdateStages.WithUpdateDel */ IntegrationRuntimeResource apply(Context context); } + /** The IntegrationRuntimeResource update stages. */ interface UpdateStages { /** The stage of the IntegrationRuntimeResource update allowing to specify autoUpdate. */ @@ -163,6 +170,7 @@ interface WithAutoUpdate { */ Update withAutoUpdate(IntegrationRuntimeAutoUpdate autoUpdate); } + /** The stage of the IntegrationRuntimeResource update allowing to specify updateDelayOffset. */ interface WithUpdateDelayOffset { /** @@ -176,6 +184,7 @@ interface WithUpdateDelayOffset { Update withUpdateDelayOffset(String updateDelayOffset); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/JiraLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/JiraLinkedService.java index cbc0b0645d5e..b48042ba1a43 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/JiraLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/JiraLinkedService.java @@ -236,22 +236,22 @@ public JiraLinkedService withUsePeerVerification(Object usePeerVerification) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the JiraLinkedService object itself. */ - public JiraLinkedService withEncryptedCredential(Object encryptedCredential) { + public JiraLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new JiraLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/LinkedServiceResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/LinkedServiceResource.java index 53de401adf1c..da9aab51bcf3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/LinkedServiceResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/LinkedServiceResource.java @@ -65,11 +65,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The LinkedServiceResource definition stages. */ interface DefinitionStages { /** The first stage of the LinkedServiceResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the LinkedServiceResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -81,6 +83,7 @@ interface WithParentResource { */ WithProperties withExistingFactory(String resourceGroupName, String factoryName); } + /** The stage of the LinkedServiceResource definition allowing to specify properties. */ interface WithProperties { /** @@ -91,6 +94,7 @@ interface WithProperties { */ WithCreate withProperties(LinkedService properties); } + /** * The stage of the LinkedServiceResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -111,6 +115,7 @@ interface WithCreate extends DefinitionStages.WithIfMatch { */ LinkedServiceResource create(Context context); } + /** The stage of the LinkedServiceResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -124,6 +129,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the LinkedServiceResource resource. * @@ -148,6 +154,7 @@ interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { */ LinkedServiceResource apply(Context context); } + /** The LinkedServiceResource update stages. */ interface UpdateStages { /** The stage of the LinkedServiceResource update allowing to specify properties. */ @@ -160,6 +167,7 @@ interface WithProperties { */ Update withProperties(LinkedService properties); } + /** The stage of the LinkedServiceResource update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -173,6 +181,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/LookupActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/LookupActivity.java index e9ea9d50a2f3..fd373ee88ee7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/LookupActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/LookupActivity.java @@ -64,6 +64,20 @@ public LookupActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public LookupActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public LookupActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public LookupActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MagentoLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MagentoLinkedService.java index dece753a5e97..8d4af48c5b1d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MagentoLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MagentoLinkedService.java @@ -188,22 +188,22 @@ public MagentoLinkedService withUsePeerVerification(Object usePeerVerification) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MagentoLinkedService object itself. */ - public MagentoLinkedService withEncryptedCredential(Object encryptedCredential) { + public MagentoLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new MagentoLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedIdentityCredentialResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedIdentityCredentialResource.java index 8803e5935a6f..6d2199b1da47 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedIdentityCredentialResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedIdentityCredentialResource.java @@ -65,11 +65,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The ManagedIdentityCredentialResource definition stages. */ interface DefinitionStages { /** The first stage of the ManagedIdentityCredentialResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the ManagedIdentityCredentialResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -81,6 +83,7 @@ interface WithParentResource { */ WithProperties withExistingFactory(String resourceGroupName, String factoryName); } + /** The stage of the ManagedIdentityCredentialResource definition allowing to specify properties. */ interface WithProperties { /** @@ -91,6 +94,7 @@ interface WithProperties { */ WithCreate withProperties(ManagedIdentityCredential properties); } + /** * The stage of the ManagedIdentityCredentialResource definition which contains all the minimum required * properties for the resource to be created, but also allows for any other optional properties to be specified. @@ -111,6 +115,7 @@ interface WithCreate extends DefinitionStages.WithIfMatch { */ ManagedIdentityCredentialResource create(Context context); } + /** The stage of the ManagedIdentityCredentialResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -124,6 +129,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the ManagedIdentityCredentialResource resource. * @@ -148,6 +154,7 @@ interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { */ ManagedIdentityCredentialResource apply(Context context); } + /** The ManagedIdentityCredentialResource update stages. */ interface UpdateStages { /** The stage of the ManagedIdentityCredentialResource update allowing to specify properties. */ @@ -160,6 +167,7 @@ interface WithProperties { */ Update withProperties(ManagedIdentityCredential properties); } + /** The stage of the ManagedIdentityCredentialResource update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -173,6 +181,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedPrivateEndpointResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedPrivateEndpointResource.java index 9b804a106711..e43ebd801296 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedPrivateEndpointResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedPrivateEndpointResource.java @@ -65,11 +65,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The ManagedPrivateEndpointResource definition stages. */ interface DefinitionStages { /** The first stage of the ManagedPrivateEndpointResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the ManagedPrivateEndpointResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -83,6 +85,7 @@ interface WithParentResource { WithProperties withExistingManagedVirtualNetwork( String resourceGroupName, String factoryName, String managedVirtualNetworkName); } + /** The stage of the ManagedPrivateEndpointResource definition allowing to specify properties. */ interface WithProperties { /** @@ -93,6 +96,7 @@ interface WithProperties { */ WithCreate withProperties(ManagedPrivateEndpoint properties); } + /** * The stage of the ManagedPrivateEndpointResource definition which contains all the minimum required properties * for the resource to be created, but also allows for any other optional properties to be specified. @@ -113,6 +117,7 @@ interface WithCreate extends DefinitionStages.WithIfMatch { */ ManagedPrivateEndpointResource create(Context context); } + /** The stage of the ManagedPrivateEndpointResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -126,6 +131,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the ManagedPrivateEndpointResource resource. * @@ -150,6 +156,7 @@ interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { */ ManagedPrivateEndpointResource apply(Context context); } + /** The ManagedPrivateEndpointResource update stages. */ interface UpdateStages { /** The stage of the ManagedPrivateEndpointResource update allowing to specify properties. */ @@ -162,6 +169,7 @@ interface WithProperties { */ Update withProperties(ManagedPrivateEndpoint properties); } + /** The stage of the ManagedPrivateEndpointResource update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -175,6 +183,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedVirtualNetworkResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedVirtualNetworkResource.java index fb7e8d79218e..0ad2504f4d57 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedVirtualNetworkResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ManagedVirtualNetworkResource.java @@ -65,11 +65,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The ManagedVirtualNetworkResource definition stages. */ interface DefinitionStages { /** The first stage of the ManagedVirtualNetworkResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the ManagedVirtualNetworkResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -81,6 +83,7 @@ interface WithParentResource { */ WithProperties withExistingFactory(String resourceGroupName, String factoryName); } + /** The stage of the ManagedVirtualNetworkResource definition allowing to specify properties. */ interface WithProperties { /** @@ -91,6 +94,7 @@ interface WithProperties { */ WithCreate withProperties(ManagedVirtualNetwork properties); } + /** * The stage of the ManagedVirtualNetworkResource definition which contains all the minimum required properties * for the resource to be created, but also allows for any other optional properties to be specified. @@ -111,6 +115,7 @@ interface WithCreate extends DefinitionStages.WithIfMatch { */ ManagedVirtualNetworkResource create(Context context); } + /** The stage of the ManagedVirtualNetworkResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -124,6 +129,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the ManagedVirtualNetworkResource resource. * @@ -148,6 +154,7 @@ interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { */ ManagedVirtualNetworkResource apply(Context context); } + /** The ManagedVirtualNetworkResource update stages. */ interface UpdateStages { /** The stage of the ManagedVirtualNetworkResource update allowing to specify properties. */ @@ -160,6 +167,7 @@ interface WithProperties { */ Update withProperties(ManagedVirtualNetwork properties); } + /** The stage of the ManagedVirtualNetworkResource update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -173,6 +181,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperAttributeMapping.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperAttributeMapping.java new file mode 100644 index 000000000000..99202168f364 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperAttributeMapping.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Source and target column mapping details. */ +@Fluent +public final class MapperAttributeMapping { + /* + * Name of the target column. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Type of the CDC attribute mapping. Note: 'Advanced' mapping type is also saved as 'Derived'. + */ + @JsonProperty(value = "type") + private MappingType type; + + /* + * Name of the function used for 'Aggregate' and 'Derived' (except 'Advanced') type mapping. + */ + @JsonProperty(value = "functionName") + private String functionName; + + /* + * Expression used for 'Aggregate' and 'Derived' type mapping. + */ + @JsonProperty(value = "expression") + private String expression; + + /* + * Reference of the source column used in the mapping. It is used for 'Direct' mapping type only. + */ + @JsonProperty(value = "attributeReference") + private MapperAttributeReference attributeReference; + + /* + * List of references for source columns. It is used for 'Derived' and 'Aggregate' type mappings only. + */ + @JsonProperty(value = "attributeReferences") + private List attributeReferences; + + /** Creates an instance of MapperAttributeMapping class. */ + public MapperAttributeMapping() { + } + + /** + * Get the name property: Name of the target column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the target column. + * + * @param name the name value to set. + * @return the MapperAttributeMapping object itself. + */ + public MapperAttributeMapping withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Type of the CDC attribute mapping. Note: 'Advanced' mapping type is also saved as + * 'Derived'. + * + * @return the type value. + */ + public MappingType type() { + return this.type; + } + + /** + * Set the type property: Type of the CDC attribute mapping. Note: 'Advanced' mapping type is also saved as + * 'Derived'. + * + * @param type the type value to set. + * @return the MapperAttributeMapping object itself. + */ + public MapperAttributeMapping withType(MappingType type) { + this.type = type; + return this; + } + + /** + * Get the functionName property: Name of the function used for 'Aggregate' and 'Derived' (except 'Advanced') type + * mapping. + * + * @return the functionName value. + */ + public String functionName() { + return this.functionName; + } + + /** + * Set the functionName property: Name of the function used for 'Aggregate' and 'Derived' (except 'Advanced') type + * mapping. + * + * @param functionName the functionName value to set. + * @return the MapperAttributeMapping object itself. + */ + public MapperAttributeMapping withFunctionName(String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Get the expression property: Expression used for 'Aggregate' and 'Derived' type mapping. + * + * @return the expression value. + */ + public String expression() { + return this.expression; + } + + /** + * Set the expression property: Expression used for 'Aggregate' and 'Derived' type mapping. + * + * @param expression the expression value to set. + * @return the MapperAttributeMapping object itself. + */ + public MapperAttributeMapping withExpression(String expression) { + this.expression = expression; + return this; + } + + /** + * Get the attributeReference property: Reference of the source column used in the mapping. It is used for 'Direct' + * mapping type only. + * + * @return the attributeReference value. + */ + public MapperAttributeReference attributeReference() { + return this.attributeReference; + } + + /** + * Set the attributeReference property: Reference of the source column used in the mapping. It is used for 'Direct' + * mapping type only. + * + * @param attributeReference the attributeReference value to set. + * @return the MapperAttributeMapping object itself. + */ + public MapperAttributeMapping withAttributeReference(MapperAttributeReference attributeReference) { + this.attributeReference = attributeReference; + return this; + } + + /** + * Get the attributeReferences property: List of references for source columns. It is used for 'Derived' and + * 'Aggregate' type mappings only. + * + * @return the attributeReferences value. + */ + public List attributeReferences() { + return this.attributeReferences; + } + + /** + * Set the attributeReferences property: List of references for source columns. It is used for 'Derived' and + * 'Aggregate' type mappings only. + * + * @param attributeReferences the attributeReferences value to set. + * @return the MapperAttributeMapping object itself. + */ + public MapperAttributeMapping withAttributeReferences(List attributeReferences) { + this.attributeReferences = attributeReferences; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (attributeReference() != null) { + attributeReference().validate(); + } + if (attributeReferences() != null) { + attributeReferences().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperAttributeMappings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperAttributeMappings.java new file mode 100644 index 000000000000..a74556a54ffd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperAttributeMappings.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Attribute mapping details. */ +@Fluent +public final class MapperAttributeMappings { + /* + * List of attribute mappings. + */ + @JsonProperty(value = "attributeMappings") + private List attributeMappings; + + /** Creates an instance of MapperAttributeMappings class. */ + public MapperAttributeMappings() { + } + + /** + * Get the attributeMappings property: List of attribute mappings. + * + * @return the attributeMappings value. + */ + public List attributeMappings() { + return this.attributeMappings; + } + + /** + * Set the attributeMappings property: List of attribute mappings. + * + * @param attributeMappings the attributeMappings value to set. + * @return the MapperAttributeMappings object itself. + */ + public MapperAttributeMappings withAttributeMappings(List attributeMappings) { + this.attributeMappings = attributeMappings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (attributeMappings() != null) { + attributeMappings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperAttributeReference.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperAttributeReference.java new file mode 100644 index 000000000000..fc0a3b10e710 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperAttributeReference.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Attribute reference details for the referred column. */ +@Fluent +public final class MapperAttributeReference { + /* + * Name of the column. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Name of the table. + */ + @JsonProperty(value = "entity") + private String entity; + + /* + * The connection reference for the connection. + */ + @JsonProperty(value = "entityConnectionReference") + private MapperConnectionReference entityConnectionReference; + + /** Creates an instance of MapperAttributeReference class. */ + public MapperAttributeReference() { + } + + /** + * Get the name property: Name of the column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the column. + * + * @param name the name value to set. + * @return the MapperAttributeReference object itself. + */ + public MapperAttributeReference withName(String name) { + this.name = name; + return this; + } + + /** + * Get the entity property: Name of the table. + * + * @return the entity value. + */ + public String entity() { + return this.entity; + } + + /** + * Set the entity property: Name of the table. + * + * @param entity the entity value to set. + * @return the MapperAttributeReference object itself. + */ + public MapperAttributeReference withEntity(String entity) { + this.entity = entity; + return this; + } + + /** + * Get the entityConnectionReference property: The connection reference for the connection. + * + * @return the entityConnectionReference value. + */ + public MapperConnectionReference entityConnectionReference() { + return this.entityConnectionReference; + } + + /** + * Set the entityConnectionReference property: The connection reference for the connection. + * + * @param entityConnectionReference the entityConnectionReference value to set. + * @return the MapperAttributeReference object itself. + */ + public MapperAttributeReference withEntityConnectionReference(MapperConnectionReference entityConnectionReference) { + this.entityConnectionReference = entityConnectionReference; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (entityConnectionReference() != null) { + entityConnectionReference().validate(); + } + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperConnection.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperConnection.java new file mode 100644 index 000000000000..7967e63b5213 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperConnection.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Source connection details. */ +@Fluent +public final class MapperConnection { + /* + * Linked service reference. + */ + @JsonProperty(value = "linkedService") + private LinkedServiceReference linkedService; + + /* + * Type of the linked service e.g.: AzureBlobFS. + */ + @JsonProperty(value = "linkedServiceType") + private String linkedServiceType; + + /* + * Type of connection via linked service or dataset. + */ + @JsonProperty(value = "type", required = true) + private ConnectionType type; + + /* + * A boolean indicating whether linked service is of type inline dataset. Currently only inline datasets are + * supported. + */ + @JsonProperty(value = "isInlineDataset") + private Boolean isInlineDataset; + + /* + * List of name/value pairs for connection properties. + */ + @JsonProperty(value = "commonDslConnectorProperties") + private List commonDslConnectorProperties; + + /** Creates an instance of MapperConnection class. */ + public MapperConnection() { + } + + /** + * Get the linkedService property: Linked service reference. + * + * @return the linkedService value. + */ + public LinkedServiceReference linkedService() { + return this.linkedService; + } + + /** + * Set the linkedService property: Linked service reference. + * + * @param linkedService the linkedService value to set. + * @return the MapperConnection object itself. + */ + public MapperConnection withLinkedService(LinkedServiceReference linkedService) { + this.linkedService = linkedService; + return this; + } + + /** + * Get the linkedServiceType property: Type of the linked service e.g.: AzureBlobFS. + * + * @return the linkedServiceType value. + */ + public String linkedServiceType() { + return this.linkedServiceType; + } + + /** + * Set the linkedServiceType property: Type of the linked service e.g.: AzureBlobFS. + * + * @param linkedServiceType the linkedServiceType value to set. + * @return the MapperConnection object itself. + */ + public MapperConnection withLinkedServiceType(String linkedServiceType) { + this.linkedServiceType = linkedServiceType; + return this; + } + + /** + * Get the type property: Type of connection via linked service or dataset. + * + * @return the type value. + */ + public ConnectionType type() { + return this.type; + } + + /** + * Set the type property: Type of connection via linked service or dataset. + * + * @param type the type value to set. + * @return the MapperConnection object itself. + */ + public MapperConnection withType(ConnectionType type) { + this.type = type; + return this; + } + + /** + * Get the isInlineDataset property: A boolean indicating whether linked service is of type inline dataset. + * Currently only inline datasets are supported. + * + * @return the isInlineDataset value. + */ + public Boolean isInlineDataset() { + return this.isInlineDataset; + } + + /** + * Set the isInlineDataset property: A boolean indicating whether linked service is of type inline dataset. + * Currently only inline datasets are supported. + * + * @param isInlineDataset the isInlineDataset value to set. + * @return the MapperConnection object itself. + */ + public MapperConnection withIsInlineDataset(Boolean isInlineDataset) { + this.isInlineDataset = isInlineDataset; + return this; + } + + /** + * Get the commonDslConnectorProperties property: List of name/value pairs for connection properties. + * + * @return the commonDslConnectorProperties value. + */ + public List commonDslConnectorProperties() { + return this.commonDslConnectorProperties; + } + + /** + * Set the commonDslConnectorProperties property: List of name/value pairs for connection properties. + * + * @param commonDslConnectorProperties the commonDslConnectorProperties value to set. + * @return the MapperConnection object itself. + */ + public MapperConnection withCommonDslConnectorProperties( + List commonDslConnectorProperties) { + this.commonDslConnectorProperties = commonDslConnectorProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (linkedService() != null) { + linkedService().validate(); + } + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model MapperConnection")); + } + if (commonDslConnectorProperties() != null) { + commonDslConnectorProperties().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MapperConnection.class); +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperConnectionReference.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperConnectionReference.java new file mode 100644 index 000000000000..90bc80610331 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperConnectionReference.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Source or target connection reference details. */ +@Fluent +public final class MapperConnectionReference { + /* + * Name of the connection + */ + @JsonProperty(value = "connectionName") + private String connectionName; + + /* + * Type of connection via linked service or dataset. + */ + @JsonProperty(value = "type") + private ConnectionType type; + + /** Creates an instance of MapperConnectionReference class. */ + public MapperConnectionReference() { + } + + /** + * Get the connectionName property: Name of the connection. + * + * @return the connectionName value. + */ + public String connectionName() { + return this.connectionName; + } + + /** + * Set the connectionName property: Name of the connection. + * + * @param connectionName the connectionName value to set. + * @return the MapperConnectionReference object itself. + */ + public MapperConnectionReference withConnectionName(String connectionName) { + this.connectionName = connectionName; + return this; + } + + /** + * Get the type property: Type of connection via linked service or dataset. + * + * @return the type value. + */ + public ConnectionType type() { + return this.type; + } + + /** + * Set the type property: Type of connection via linked service or dataset. + * + * @param type the type value to set. + * @return the MapperConnectionReference object itself. + */ + public MapperConnectionReference withType(ConnectionType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperDslConnectorProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperDslConnectorProperties.java new file mode 100644 index 000000000000..ec0da7444545 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperDslConnectorProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Connector properties of a CDC table in terms of name / value pairs. */ +@Fluent +public final class MapperDslConnectorProperties { + /* + * Name of the property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Value of the property. + */ + @JsonProperty(value = "value") + private Object value; + + /** Creates an instance of MapperDslConnectorProperties class. */ + public MapperDslConnectorProperties() { + } + + /** + * Get the name property: Name of the property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the property. + * + * @param name the name value to set. + * @return the MapperDslConnectorProperties object itself. + */ + public MapperDslConnectorProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: Value of the property. + * + * @return the value value. + */ + public Object value() { + return this.value; + } + + /** + * Set the value property: Value of the property. + * + * @param value the value value to set. + * @return the MapperDslConnectorProperties object itself. + */ + public MapperDslConnectorProperties withValue(Object value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperPolicy.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperPolicy.java new file mode 100644 index 000000000000..0bc8933d4f9b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperPolicy.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** CDC Policy. */ +@Fluent +public final class MapperPolicy { + /* + * Mode of running the CDC: batch vs continuous. + */ + @JsonProperty(value = "mode") + private String mode; + + /* + * Defines the frequency and interval for running the CDC for batch mode. + */ + @JsonProperty(value = "recurrence") + private MapperPolicyRecurrence recurrence; + + /** Creates an instance of MapperPolicy class. */ + public MapperPolicy() { + } + + /** + * Get the mode property: Mode of running the CDC: batch vs continuous. + * + * @return the mode value. + */ + public String mode() { + return this.mode; + } + + /** + * Set the mode property: Mode of running the CDC: batch vs continuous. + * + * @param mode the mode value to set. + * @return the MapperPolicy object itself. + */ + public MapperPolicy withMode(String mode) { + this.mode = mode; + return this; + } + + /** + * Get the recurrence property: Defines the frequency and interval for running the CDC for batch mode. + * + * @return the recurrence value. + */ + public MapperPolicyRecurrence recurrence() { + return this.recurrence; + } + + /** + * Set the recurrence property: Defines the frequency and interval for running the CDC for batch mode. + * + * @param recurrence the recurrence value to set. + * @return the MapperPolicy object itself. + */ + public MapperPolicy withRecurrence(MapperPolicyRecurrence recurrence) { + this.recurrence = recurrence; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recurrence() != null) { + recurrence().validate(); + } + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperPolicyRecurrence.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperPolicyRecurrence.java new file mode 100644 index 000000000000..5fd77c70aa37 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperPolicyRecurrence.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** CDC policy recurrence details. */ +@Fluent +public final class MapperPolicyRecurrence { + /* + * Frequency of period in terms of 'Hour', 'Minute' or 'Second'. + */ + @JsonProperty(value = "frequency") + private FrequencyType frequency; + + /* + * Actual interval value as per chosen frequency. + */ + @JsonProperty(value = "interval") + private Integer interval; + + /** Creates an instance of MapperPolicyRecurrence class. */ + public MapperPolicyRecurrence() { + } + + /** + * Get the frequency property: Frequency of period in terms of 'Hour', 'Minute' or 'Second'. + * + * @return the frequency value. + */ + public FrequencyType frequency() { + return this.frequency; + } + + /** + * Set the frequency property: Frequency of period in terms of 'Hour', 'Minute' or 'Second'. + * + * @param frequency the frequency value to set. + * @return the MapperPolicyRecurrence object itself. + */ + public MapperPolicyRecurrence withFrequency(FrequencyType frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the interval property: Actual interval value as per chosen frequency. + * + * @return the interval value. + */ + public Integer interval() { + return this.interval; + } + + /** + * Set the interval property: Actual interval value as per chosen frequency. + * + * @param interval the interval value to set. + * @return the MapperPolicyRecurrence object itself. + */ + public MapperPolicyRecurrence withInterval(Integer interval) { + this.interval = interval; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperSourceConnectionsInfo.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperSourceConnectionsInfo.java new file mode 100644 index 000000000000..93e9a290ace6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperSourceConnectionsInfo.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A object which contains list of tables and connection details for a source connection. */ +@Fluent +public final class MapperSourceConnectionsInfo { + /* + * List of source tables for a source connection. + */ + @JsonProperty(value = "sourceEntities") + private List sourceEntities; + + /* + * Source connection details. + */ + @JsonProperty(value = "connection") + private MapperConnection connection; + + /** Creates an instance of MapperSourceConnectionsInfo class. */ + public MapperSourceConnectionsInfo() { + } + + /** + * Get the sourceEntities property: List of source tables for a source connection. + * + * @return the sourceEntities value. + */ + public List sourceEntities() { + return this.sourceEntities; + } + + /** + * Set the sourceEntities property: List of source tables for a source connection. + * + * @param sourceEntities the sourceEntities value to set. + * @return the MapperSourceConnectionsInfo object itself. + */ + public MapperSourceConnectionsInfo withSourceEntities(List sourceEntities) { + this.sourceEntities = sourceEntities; + return this; + } + + /** + * Get the connection property: Source connection details. + * + * @return the connection value. + */ + public MapperConnection connection() { + return this.connection; + } + + /** + * Set the connection property: Source connection details. + * + * @param connection the connection value to set. + * @return the MapperSourceConnectionsInfo object itself. + */ + public MapperSourceConnectionsInfo withConnection(MapperConnection connection) { + this.connection = connection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceEntities() != null) { + sourceEntities().forEach(e -> e.validate()); + } + if (connection() != null) { + connection().validate(); + } + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperTable.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperTable.java new file mode 100644 index 000000000000..4ac30812316f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperTable.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.datafactory.fluent.models.MapperTableProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** CDC table details. */ +@Fluent +public final class MapperTable { + /* + * Name of the table. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Table properties. + */ + @JsonProperty(value = "properties") + private MapperTableProperties innerProperties; + + /** Creates an instance of MapperTable class. */ + public MapperTable() { + } + + /** + * Get the name property: Name of the table. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the table. + * + * @param name the name value to set. + * @return the MapperTable object itself. + */ + public MapperTable withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Table properties. + * + * @return the innerProperties value. + */ + private MapperTableProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the schema property: List of columns for the source table. + * + * @return the schema value. + */ + public List schema() { + return this.innerProperties() == null ? null : this.innerProperties().schema(); + } + + /** + * Set the schema property: List of columns for the source table. + * + * @param schema the schema value to set. + * @return the MapperTable object itself. + */ + public MapperTable withSchema(List schema) { + if (this.innerProperties() == null) { + this.innerProperties = new MapperTableProperties(); + } + this.innerProperties().withSchema(schema); + return this; + } + + /** + * Get the dslConnectorProperties property: List of name/value pairs for connection properties. + * + * @return the dslConnectorProperties value. + */ + public List dslConnectorProperties() { + return this.innerProperties() == null ? null : this.innerProperties().dslConnectorProperties(); + } + + /** + * Set the dslConnectorProperties property: List of name/value pairs for connection properties. + * + * @param dslConnectorProperties the dslConnectorProperties value to set. + * @return the MapperTable object itself. + */ + public MapperTable withDslConnectorProperties(List dslConnectorProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new MapperTableProperties(); + } + this.innerProperties().withDslConnectorProperties(dslConnectorProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperTableSchema.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperTableSchema.java new file mode 100644 index 000000000000..fc6ac60a47df --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperTableSchema.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Schema of a CDC table in terms of column names and their corresponding data types. */ +@Fluent +public final class MapperTableSchema { + /* + * Name of the column. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Data type of the column. + */ + @JsonProperty(value = "dataType") + private String dataType; + + /** Creates an instance of MapperTableSchema class. */ + public MapperTableSchema() { + } + + /** + * Get the name property: Name of the column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the column. + * + * @param name the name value to set. + * @return the MapperTableSchema object itself. + */ + public MapperTableSchema withName(String name) { + this.name = name; + return this; + } + + /** + * Get the dataType property: Data type of the column. + * + * @return the dataType value. + */ + public String dataType() { + return this.dataType; + } + + /** + * Set the dataType property: Data type of the column. + * + * @param dataType the dataType value to set. + * @return the MapperTableSchema object itself. + */ + public MapperTableSchema withDataType(String dataType) { + this.dataType = dataType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperTargetConnectionsInfo.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperTargetConnectionsInfo.java new file mode 100644 index 000000000000..b3dbe7b1a695 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MapperTargetConnectionsInfo.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A object which contains list of tables and connection details for a target connection. */ +@Fluent +public final class MapperTargetConnectionsInfo { + /* + * List of source tables for a target connection. + */ + @JsonProperty(value = "targetEntities") + private List targetEntities; + + /* + * Source connection details. + */ + @JsonProperty(value = "connection") + private MapperConnection connection; + + /* + * List of table mappings. + */ + @JsonProperty(value = "dataMapperMappings") + private List dataMapperMappings; + + /* + * List of relationship info among the tables. + */ + @JsonProperty(value = "relationships") + private List relationships; + + /** Creates an instance of MapperTargetConnectionsInfo class. */ + public MapperTargetConnectionsInfo() { + } + + /** + * Get the targetEntities property: List of source tables for a target connection. + * + * @return the targetEntities value. + */ + public List targetEntities() { + return this.targetEntities; + } + + /** + * Set the targetEntities property: List of source tables for a target connection. + * + * @param targetEntities the targetEntities value to set. + * @return the MapperTargetConnectionsInfo object itself. + */ + public MapperTargetConnectionsInfo withTargetEntities(List targetEntities) { + this.targetEntities = targetEntities; + return this; + } + + /** + * Get the connection property: Source connection details. + * + * @return the connection value. + */ + public MapperConnection connection() { + return this.connection; + } + + /** + * Set the connection property: Source connection details. + * + * @param connection the connection value to set. + * @return the MapperTargetConnectionsInfo object itself. + */ + public MapperTargetConnectionsInfo withConnection(MapperConnection connection) { + this.connection = connection; + return this; + } + + /** + * Get the dataMapperMappings property: List of table mappings. + * + * @return the dataMapperMappings value. + */ + public List dataMapperMappings() { + return this.dataMapperMappings; + } + + /** + * Set the dataMapperMappings property: List of table mappings. + * + * @param dataMapperMappings the dataMapperMappings value to set. + * @return the MapperTargetConnectionsInfo object itself. + */ + public MapperTargetConnectionsInfo withDataMapperMappings(List dataMapperMappings) { + this.dataMapperMappings = dataMapperMappings; + return this; + } + + /** + * Get the relationships property: List of relationship info among the tables. + * + * @return the relationships value. + */ + public List relationships() { + return this.relationships; + } + + /** + * Set the relationships property: List of relationship info among the tables. + * + * @param relationships the relationships value to set. + * @return the MapperTargetConnectionsInfo object itself. + */ + public MapperTargetConnectionsInfo withRelationships(List relationships) { + this.relationships = relationships; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetEntities() != null) { + targetEntities().forEach(e -> e.validate()); + } + if (connection() != null) { + connection().validate(); + } + if (dataMapperMappings() != null) { + dataMapperMappings().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MappingType.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MappingType.java new file mode 100644 index 000000000000..f3eb1eb7ff59 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MappingType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of the CDC attribute mapping. Note: 'Advanced' mapping type is also saved as 'Derived'. */ +public final class MappingType extends ExpandableStringEnum { + /** Static value Direct for MappingType. */ + public static final MappingType DIRECT = fromString("Direct"); + + /** Static value Derived for MappingType. */ + public static final MappingType DERIVED = fromString("Derived"); + + /** Static value Aggregate for MappingType. */ + public static final MappingType AGGREGATE = fromString("Aggregate"); + + /** + * Creates a new instance of MappingType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MappingType() { + } + + /** + * Creates or finds a MappingType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MappingType. + */ + @JsonCreator + public static MappingType fromString(String name) { + return fromString(name, MappingType.class); + } + + /** + * Gets known MappingType values. + * + * @return known MappingType values. + */ + public static Collection values() { + return values(MappingType.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MariaDBLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MariaDBLinkedService.java index cee1758f2162..5905b3a652c8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MariaDBLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MariaDBLinkedService.java @@ -115,22 +115,22 @@ public MariaDBLinkedService withPwd(AzureKeyVaultSecretReference pwd) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MariaDBLinkedService object itself. */ - public MariaDBLinkedService withEncryptedCredential(Object encryptedCredential) { + public MariaDBLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new MariaDBLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MarketoLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MarketoLinkedService.java index 690a3f397241..ba8373865ba8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MarketoLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MarketoLinkedService.java @@ -211,22 +211,22 @@ public MarketoLinkedService withUsePeerVerification(Object usePeerVerification) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MarketoLinkedService object itself. */ - public MarketoLinkedService withEncryptedCredential(Object encryptedCredential) { + public MarketoLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new MarketoLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MicrosoftAccessLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MicrosoftAccessLinkedService.java index 7daa2d230872..9d543c4c2377 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MicrosoftAccessLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MicrosoftAccessLinkedService.java @@ -68,7 +68,8 @@ public MicrosoftAccessLinkedService withAnnotations(List annotations) { /** * Get the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @return the connectionString value. */ @@ -78,7 +79,8 @@ public Object connectionString() { /** * Set the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @param connectionString the connectionString value to set. * @return the MicrosoftAccessLinkedService object itself. @@ -191,22 +193,22 @@ public MicrosoftAccessLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MicrosoftAccessLinkedService object itself. */ - public MicrosoftAccessLinkedService withEncryptedCredential(Object encryptedCredential) { + public MicrosoftAccessLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new MicrosoftAccessLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MongoDbAtlasLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MongoDbAtlasLinkedService.java index a93577a8138e..b6051966f119 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MongoDbAtlasLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MongoDbAtlasLinkedService.java @@ -115,6 +115,31 @@ public MongoDbAtlasLinkedService withDatabase(Object database) { return this; } + /** + * Get the driverVersion property: The driver version that you want to choose. Allowed value are v1 and v2. Type: + * string (or Expression with resultType string). + * + * @return the driverVersion value. + */ + public Object driverVersion() { + return this.innerTypeProperties() == null ? null : this.innerTypeProperties().driverVersion(); + } + + /** + * Set the driverVersion property: The driver version that you want to choose. Allowed value are v1 and v2. Type: + * string (or Expression with resultType string). + * + * @param driverVersion the driverVersion value to set. + * @return the MongoDbAtlasLinkedService object itself. + */ + public MongoDbAtlasLinkedService withDriverVersion(Object driverVersion) { + if (this.innerTypeProperties() == null) { + this.innerTypeProperties = new MongoDbAtlasLinkedServiceTypeProperties(); + } + this.innerTypeProperties().withDriverVersion(driverVersion); + return this; + } + /** * Validates the instance. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MongoDbLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MongoDbLinkedService.java index 570265d292f4..b882bcdf14cf 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MongoDbLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MongoDbLinkedService.java @@ -286,22 +286,22 @@ public MongoDbLinkedService withAllowSelfSignedServerCert(Object allowSelfSigned /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MongoDbLinkedService object itself. */ - public MongoDbLinkedService withEncryptedCredential(Object encryptedCredential) { + public MongoDbLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new MongoDbLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MySqlLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MySqlLinkedService.java index 69e1cf5bdc65..37aa79cc23bc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MySqlLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/MySqlLinkedService.java @@ -66,7 +66,8 @@ public MySqlLinkedService withAnnotations(List annotations) { } /** - * Get the connectionString property: The connection string. + * Get the connectionString property: The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. * * @return the connectionString value. */ @@ -75,7 +76,8 @@ public Object connectionString() { } /** - * Set the connectionString property: The connection string. + * Set the connectionString property: The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. * * @param connectionString the connectionString value to set. * @return the MySqlLinkedService object itself. @@ -113,22 +115,22 @@ public MySqlLinkedService withPassword(AzureKeyVaultSecretReference password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the MySqlLinkedService object itself. */ - public MySqlLinkedService withEncryptedCredential(Object encryptedCredential) { + public MySqlLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new MySqlLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/NetezzaLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/NetezzaLinkedService.java index baff29e148a9..12d6ae10b0ea 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/NetezzaLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/NetezzaLinkedService.java @@ -115,22 +115,22 @@ public NetezzaLinkedService withPwd(AzureKeyVaultSecretReference pwd) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the NetezzaLinkedService object itself. */ - public NetezzaLinkedService withEncryptedCredential(Object encryptedCredential) { + public NetezzaLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new NetezzaLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ODataLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ODataLinkedService.java index c50751bbe48b..0726cab4b2da 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ODataLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ODataLinkedService.java @@ -394,22 +394,22 @@ public ODataLinkedService withServicePrincipalEmbeddedCertPassword( /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ODataLinkedService object itself. */ - public ODataLinkedService withEncryptedCredential(Object encryptedCredential) { + public ODataLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new ODataLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OdbcLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OdbcLinkedService.java index 77f5129bf7cd..0386a3480bce 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OdbcLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OdbcLinkedService.java @@ -67,7 +67,8 @@ public OdbcLinkedService withAnnotations(List annotations) { /** * Get the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @return the connectionString value. */ @@ -77,7 +78,8 @@ public Object connectionString() { /** * Set the connectionString property: The non-access credential portion of the connection string as well as an - * optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * optional encrypted credential. Type: string, or SecureString, or AzureKeyVaultSecretReference, or Expression with + * resultType string. * * @param connectionString the connectionString value to set. * @return the OdbcLinkedService object itself. @@ -190,22 +192,22 @@ public OdbcLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the OdbcLinkedService object itself. */ - public OdbcLinkedService withEncryptedCredential(Object encryptedCredential) { + public OdbcLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new OdbcLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Office365LinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Office365LinkedService.java index 041764d92076..a79adbfc3760 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Office365LinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Office365LinkedService.java @@ -165,22 +165,22 @@ public Office365LinkedService withServicePrincipalKey(SecretBase servicePrincipa /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the Office365LinkedService object itself. */ - public Office365LinkedService withEncryptedCredential(Object encryptedCredential) { + public Office365LinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new Office365LinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Office365Source.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Office365Source.java index 7a7117ed9b8d..177c408c98f3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Office365Source.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/Office365Source.java @@ -47,7 +47,7 @@ public final class Office365Source extends CopySource { /* * The columns to be read out from the Office 365 table. Type: array of objects (or Expression with resultType - * array of objects). Example: [ { "name": "Id" }, { "name": "CreatedDateTime" } ] + * array of objects). itemType: OutputColumn. Example: [ { "name": "Id" }, { "name": "CreatedDateTime" } ] */ @JsonProperty(value = "outputColumns") private Object outputColumns; @@ -166,7 +166,8 @@ public Office365Source withEndTime(Object endTime) { /** * Get the outputColumns property: The columns to be read out from the Office 365 table. Type: array of objects (or - * Expression with resultType array of objects). Example: [ { "name": "Id" }, { "name": "CreatedDateTime" } ]. + * Expression with resultType array of objects). itemType: OutputColumn. Example: [ { "name": "Id" }, { "name": + * "CreatedDateTime" } ]. * * @return the outputColumns value. */ @@ -176,7 +177,8 @@ public Object outputColumns() { /** * Set the outputColumns property: The columns to be read out from the Office 365 table. Type: array of objects (or - * Expression with resultType array of objects). Example: [ { "name": "Id" }, { "name": "CreatedDateTime" } ]. + * Expression with resultType array of objects). itemType: OutputColumn. Example: [ { "name": "Id" }, { "name": + * "CreatedDateTime" } ]. * * @param outputColumns the outputColumns value to set. * @return the Office365Source object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleCloudStorageLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleCloudStorageLinkedService.java index 6eed1447bee3..e005e5c575c8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleCloudStorageLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleCloudStorageLinkedService.java @@ -145,22 +145,22 @@ public OracleCloudStorageLinkedService withServiceUrl(Object serviceUrl) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the OracleCloudStorageLinkedService object itself. */ - public OracleCloudStorageLinkedService withEncryptedCredential(Object encryptedCredential) { + public OracleCloudStorageLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new OracleCloudStorageLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleCloudStorageReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleCloudStorageReadSettings.java index ccd2c3242f95..abe910e0e33e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleCloudStorageReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleCloudStorageReadSettings.java @@ -47,10 +47,10 @@ public final class OracleCloudStorageReadSettings extends StoreReadSettings { private Object fileListPath; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -193,21 +193,23 @@ public OracleCloudStorageReadSettings withFileListPath(Object fileListPath) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the OracleCloudStorageReadSettings object itself. */ - public OracleCloudStorageReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public OracleCloudStorageReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleLinkedService.java index d3ce64429310..b9f63fbbff06 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleLinkedService.java @@ -115,22 +115,22 @@ public OracleLinkedService withPassword(AzureKeyVaultSecretReference password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the OracleLinkedService object itself. */ - public OracleLinkedService withEncryptedCredential(Object encryptedCredential) { + public OracleLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new OracleLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleServiceCloudLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleServiceCloudLinkedService.java index 94c75b40892c..978648aefedc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleServiceCloudLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/OracleServiceCloudLinkedService.java @@ -214,22 +214,22 @@ public OracleServiceCloudLinkedService withUsePeerVerification(Object usePeerVer /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the OracleServiceCloudLinkedService object itself. */ - public OracleServiceCloudLinkedService withEncryptedCredential(Object encryptedCredential) { + public OracleServiceCloudLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new OracleServiceCloudLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PaypalLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PaypalLinkedService.java index db52f8c4712e..41504b6cfdcb 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PaypalLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PaypalLinkedService.java @@ -66,7 +66,7 @@ public PaypalLinkedService withAnnotations(List annotations) { } /** - * Get the host property: The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). + * Get the host property: The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). * * @return the host value. */ @@ -75,7 +75,7 @@ public Object host() { } /** - * Set the host property: The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). + * Set the host property: The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). * * @param host the host value to set. * @return the PaypalLinkedService object itself. @@ -211,22 +211,22 @@ public PaypalLinkedService withUsePeerVerification(Object usePeerVerification) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the PaypalLinkedService object itself. */ - public PaypalLinkedService withEncryptedCredential(Object encryptedCredential) { + public PaypalLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new PaypalLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PhoenixLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PhoenixLinkedService.java index 755bd6344a48..1508bd04ba2d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PhoenixLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PhoenixLinkedService.java @@ -336,22 +336,22 @@ public PhoenixLinkedService withAllowSelfSignedServerCert(Object allowSelfSigned /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the PhoenixLinkedService object itself. */ - public PhoenixLinkedService withEncryptedCredential(Object encryptedCredential) { + public PhoenixLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new PhoenixLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PipelineExternalComputeScaleProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PipelineExternalComputeScaleProperties.java index 22c7ea4d11a3..588ced6f8ccd 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PipelineExternalComputeScaleProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PipelineExternalComputeScaleProperties.java @@ -21,6 +21,18 @@ public final class PipelineExternalComputeScaleProperties { @JsonProperty(value = "timeToLive") private Integer timeToLive; + /* + * Number of the pipeline nodes, which should be greater than 0 and less than 11. + */ + @JsonProperty(value = "numberOfPipelineNodes") + private Integer numberOfPipelineNodes; + + /* + * Number of the the external nodes, which should be greater than 0 and less than 11. + */ + @JsonProperty(value = "numberOfExternalNodes") + private Integer numberOfExternalNodes; + /* * PipelineExternalComputeScale properties for managed integration runtime. */ @@ -52,6 +64,50 @@ public PipelineExternalComputeScaleProperties withTimeToLive(Integer timeToLive) return this; } + /** + * Get the numberOfPipelineNodes property: Number of the pipeline nodes, which should be greater than 0 and less + * than 11. + * + * @return the numberOfPipelineNodes value. + */ + public Integer numberOfPipelineNodes() { + return this.numberOfPipelineNodes; + } + + /** + * Set the numberOfPipelineNodes property: Number of the pipeline nodes, which should be greater than 0 and less + * than 11. + * + * @param numberOfPipelineNodes the numberOfPipelineNodes value to set. + * @return the PipelineExternalComputeScaleProperties object itself. + */ + public PipelineExternalComputeScaleProperties withNumberOfPipelineNodes(Integer numberOfPipelineNodes) { + this.numberOfPipelineNodes = numberOfPipelineNodes; + return this; + } + + /** + * Get the numberOfExternalNodes property: Number of the the external nodes, which should be greater than 0 and less + * than 11. + * + * @return the numberOfExternalNodes value. + */ + public Integer numberOfExternalNodes() { + return this.numberOfExternalNodes; + } + + /** + * Set the numberOfExternalNodes property: Number of the the external nodes, which should be greater than 0 and less + * than 11. + * + * @param numberOfExternalNodes the numberOfExternalNodes value to set. + * @return the PipelineExternalComputeScaleProperties object itself. + */ + public PipelineExternalComputeScaleProperties withNumberOfExternalNodes(Integer numberOfExternalNodes) { + this.numberOfExternalNodes = numberOfExternalNodes; + return this; + } + /** * Get the additionalProperties property: PipelineExternalComputeScale properties for managed integration runtime. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PipelineResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PipelineResource.java index be716274439d..9ad16712adf7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PipelineResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PipelineResource.java @@ -129,11 +129,13 @@ public interface PipelineResource { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The PipelineResource definition stages. */ interface DefinitionStages { /** The first stage of the PipelineResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the PipelineResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -145,6 +147,7 @@ interface WithParentResource { */ WithCreate withExistingFactory(String resourceGroupName, String factoryName); } + /** * The stage of the PipelineResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -176,6 +179,7 @@ interface WithCreate */ PipelineResource create(Context context); } + /** The stage of the PipelineResource definition allowing to specify additionalProperties. */ interface WithAdditionalProperties { /** @@ -186,6 +190,7 @@ interface WithAdditionalProperties { */ WithCreate withAdditionalProperties(Map additionalProperties); } + /** The stage of the PipelineResource definition allowing to specify description. */ interface WithDescription { /** @@ -196,6 +201,7 @@ interface WithDescription { */ WithCreate withDescription(String description); } + /** The stage of the PipelineResource definition allowing to specify activities. */ interface WithActivities { /** @@ -206,6 +212,7 @@ interface WithActivities { */ WithCreate withActivities(List activities); } + /** The stage of the PipelineResource definition allowing to specify parameters. */ interface WithParameters { /** @@ -216,6 +223,7 @@ interface WithParameters { */ WithCreate withParameters(Map parameters); } + /** The stage of the PipelineResource definition allowing to specify variables. */ interface WithVariables { /** @@ -226,6 +234,7 @@ interface WithVariables { */ WithCreate withVariables(Map variables); } + /** The stage of the PipelineResource definition allowing to specify concurrency. */ interface WithConcurrency { /** @@ -236,6 +245,7 @@ interface WithConcurrency { */ WithCreate withConcurrency(Integer concurrency); } + /** The stage of the PipelineResource definition allowing to specify annotations. */ interface WithAnnotations { /** @@ -246,6 +256,7 @@ interface WithAnnotations { */ WithCreate withAnnotations(List annotations); } + /** The stage of the PipelineResource definition allowing to specify runDimensions. */ interface WithRunDimensions { /** @@ -256,6 +267,7 @@ interface WithRunDimensions { */ WithCreate withRunDimensions(Map runDimensions); } + /** The stage of the PipelineResource definition allowing to specify folder. */ interface WithFolder { /** @@ -268,6 +280,7 @@ interface WithFolder { */ WithCreate withFolder(PipelineFolder folder); } + /** The stage of the PipelineResource definition allowing to specify policy. */ interface WithPolicy { /** @@ -278,6 +291,7 @@ interface WithPolicy { */ WithCreate withPolicy(PipelinePolicy policy); } + /** The stage of the PipelineResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -291,6 +305,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the PipelineResource resource. * @@ -326,6 +341,7 @@ interface Update */ PipelineResource apply(Context context); } + /** The PipelineResource update stages. */ interface UpdateStages { /** The stage of the PipelineResource update allowing to specify additionalProperties. */ @@ -338,6 +354,7 @@ interface WithAdditionalProperties { */ Update withAdditionalProperties(Map additionalProperties); } + /** The stage of the PipelineResource update allowing to specify description. */ interface WithDescription { /** @@ -348,6 +365,7 @@ interface WithDescription { */ Update withDescription(String description); } + /** The stage of the PipelineResource update allowing to specify activities. */ interface WithActivities { /** @@ -358,6 +376,7 @@ interface WithActivities { */ Update withActivities(List activities); } + /** The stage of the PipelineResource update allowing to specify parameters. */ interface WithParameters { /** @@ -368,6 +387,7 @@ interface WithParameters { */ Update withParameters(Map parameters); } + /** The stage of the PipelineResource update allowing to specify variables. */ interface WithVariables { /** @@ -378,6 +398,7 @@ interface WithVariables { */ Update withVariables(Map variables); } + /** The stage of the PipelineResource update allowing to specify concurrency. */ interface WithConcurrency { /** @@ -388,6 +409,7 @@ interface WithConcurrency { */ Update withConcurrency(Integer concurrency); } + /** The stage of the PipelineResource update allowing to specify annotations. */ interface WithAnnotations { /** @@ -398,6 +420,7 @@ interface WithAnnotations { */ Update withAnnotations(List annotations); } + /** The stage of the PipelineResource update allowing to specify runDimensions. */ interface WithRunDimensions { /** @@ -408,6 +431,7 @@ interface WithRunDimensions { */ Update withRunDimensions(Map runDimensions); } + /** The stage of the PipelineResource update allowing to specify folder. */ interface WithFolder { /** @@ -420,6 +444,7 @@ interface WithFolder { */ Update withFolder(PipelineFolder folder); } + /** The stage of the PipelineResource update allowing to specify policy. */ interface WithPolicy { /** @@ -430,6 +455,7 @@ interface WithPolicy { */ Update withPolicy(PipelinePolicy policy); } + /** The stage of the PipelineResource update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -443,6 +469,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PostgreSqlLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PostgreSqlLinkedService.java index eeeb718ca127..d778e3462471 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PostgreSqlLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PostgreSqlLinkedService.java @@ -66,7 +66,8 @@ public PostgreSqlLinkedService withAnnotations(List annotations) { } /** - * Get the connectionString property: The connection string. + * Get the connectionString property: The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. * * @return the connectionString value. */ @@ -75,7 +76,8 @@ public Object connectionString() { } /** - * Set the connectionString property: The connection string. + * Set the connectionString property: The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. * * @param connectionString the connectionString value to set. * @return the PostgreSqlLinkedService object itself. @@ -113,22 +115,22 @@ public PostgreSqlLinkedService withPassword(AzureKeyVaultSecretReference passwor /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the PostgreSqlLinkedService object itself. */ - public PostgreSqlLinkedService withEncryptedCredential(Object encryptedCredential) { + public PostgreSqlLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new PostgreSqlLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PrestoLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PrestoLinkedService.java index 1d2552114a21..c775e66fd124 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PrestoLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PrestoLinkedService.java @@ -382,22 +382,22 @@ public PrestoLinkedService withTimeZoneId(Object timeZoneId) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the PrestoLinkedService object itself. */ - public PrestoLinkedService withEncryptedCredential(Object encryptedCredential) { + public PrestoLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new PrestoLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PrivateEndpointConnectionResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PrivateEndpointConnectionResource.java index da80e12fb271..a8a11a83053c 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PrivateEndpointConnectionResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PrivateEndpointConnectionResource.java @@ -62,11 +62,13 @@ public interface PrivateEndpointConnectionResource { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The PrivateEndpointConnectionResource definition stages. */ interface DefinitionStages { /** The first stage of the PrivateEndpointConnectionResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the PrivateEndpointConnectionResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -78,6 +80,7 @@ interface WithParentResource { */ WithCreate withExistingFactory(String resourceGroupName, String factoryName); } + /** * The stage of the PrivateEndpointConnectionResource definition which contains all the minimum required * properties for the resource to be created, but also allows for any other optional properties to be specified. @@ -98,6 +101,7 @@ interface WithCreate extends DefinitionStages.WithProperties, DefinitionStages.W */ PrivateEndpointConnectionResource create(Context context); } + /** The stage of the PrivateEndpointConnectionResource definition allowing to specify properties. */ interface WithProperties { /** @@ -108,6 +112,7 @@ interface WithProperties { */ WithCreate withProperties(PrivateLinkConnectionApprovalRequest properties); } + /** The stage of the PrivateEndpointConnectionResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -121,6 +126,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the PrivateEndpointConnectionResource resource. * @@ -145,6 +151,7 @@ interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { */ PrivateEndpointConnectionResource apply(Context context); } + /** The PrivateEndpointConnectionResource update stages. */ interface UpdateStages { /** The stage of the PrivateEndpointConnectionResource update allowing to specify properties. */ @@ -157,6 +164,7 @@ interface WithProperties { */ Update withProperties(PrivateLinkConnectionApprovalRequest properties); } + /** The stage of the PrivateEndpointConnectionResource update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -170,6 +178,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/QuickBooksLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/QuickBooksLinkedService.java index c1d5a1e321a0..49832dbcd728 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/QuickBooksLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/QuickBooksLinkedService.java @@ -255,22 +255,22 @@ public QuickBooksLinkedService withUseEncryptedEndpoints(Object useEncryptedEndp /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the QuickBooksLinkedService object itself. */ - public QuickBooksLinkedService withEncryptedCredential(Object encryptedCredential) { + public QuickBooksLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new QuickBooksLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/QuickbaseLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/QuickbaseLinkedService.java index f44441f80d7b..25129b21a4fb 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/QuickbaseLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/QuickbaseLinkedService.java @@ -113,22 +113,22 @@ public QuickbaseLinkedService withUserToken(SecretBase userToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the QuickbaseLinkedService object itself. */ - public QuickbaseLinkedService withEncryptedCredential(Object encryptedCredential) { + public QuickbaseLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new QuickbaseLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ResponsysLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ResponsysLinkedService.java index 9ee52cf4b546..ee639a66e70a 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ResponsysLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ResponsysLinkedService.java @@ -217,22 +217,22 @@ public ResponsysLinkedService withUsePeerVerification(Object usePeerVerification /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ResponsysLinkedService object itself. */ - public ResponsysLinkedService withEncryptedCredential(Object encryptedCredential) { + public ResponsysLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new ResponsysLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/RestResourceDataset.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/RestResourceDataset.java index 1e5064b92bb1..05bae8075383 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/RestResourceDataset.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/RestResourceDataset.java @@ -161,23 +161,21 @@ public RestResourceDataset withRequestBody(Object requestBody) { } /** - * Get the additionalHeaders property: The additional HTTP headers in the request to the RESTful API. Type: string - * (or Expression with resultType string). + * Get the additionalHeaders property: The additional HTTP headers in the request to the RESTful API. * * @return the additionalHeaders value. */ - public Object additionalHeaders() { + public Map additionalHeaders() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().additionalHeaders(); } /** - * Set the additionalHeaders property: The additional HTTP headers in the request to the RESTful API. Type: string - * (or Expression with resultType string). + * Set the additionalHeaders property: The additional HTTP headers in the request to the RESTful API. * * @param additionalHeaders the additionalHeaders value to set. * @return the RestResourceDataset object itself. */ - public RestResourceDataset withAdditionalHeaders(Object additionalHeaders) { + public RestResourceDataset withAdditionalHeaders(Map additionalHeaders) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new RestResourceDatasetTypeProperties(); } @@ -186,23 +184,21 @@ public RestResourceDataset withAdditionalHeaders(Object additionalHeaders) { } /** - * Get the paginationRules property: The pagination rules to compose next page requests. Type: string (or Expression - * with resultType string). + * Get the paginationRules property: The pagination rules to compose next page requests. * * @return the paginationRules value. */ - public Object paginationRules() { + public Map paginationRules() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().paginationRules(); } /** - * Set the paginationRules property: The pagination rules to compose next page requests. Type: string (or Expression - * with resultType string). + * Set the paginationRules property: The pagination rules to compose next page requests. * * @param paginationRules the paginationRules value to set. * @return the RestResourceDataset object itself. */ - public RestResourceDataset withPaginationRules(Object paginationRules) { + public RestResourceDataset withPaginationRules(Map paginationRules) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new RestResourceDatasetTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/RestServiceLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/RestServiceLinkedService.java index 9f4c15421eaf..4471a52f1247 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/RestServiceLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/RestServiceLinkedService.java @@ -66,7 +66,7 @@ public RestServiceLinkedService withAnnotations(List annotations) { } /** - * Get the url property: The base URL of the REST service. + * Get the url property: The base URL of the REST service. Type: string (or Expression with resultType string). * * @return the url value. */ @@ -75,7 +75,7 @@ public Object url() { } /** - * Set the url property: The base URL of the REST service. + * Set the url property: The base URL of the REST service. Type: string (or Expression with resultType string). * * @param url the url value to set. * @return the RestServiceLinkedService object itself. @@ -139,7 +139,8 @@ public RestServiceLinkedService withAuthenticationType(RestServiceAuthentication } /** - * Get the username property: The user name used in Basic authentication type. + * Get the username property: The user name used in Basic authentication type. Type: string (or Expression with + * resultType string). * * @return the username value. */ @@ -148,7 +149,8 @@ public Object username() { } /** - * Set the username property: The user name used in Basic authentication type. + * Set the username property: The user name used in Basic authentication type. Type: string (or Expression with + * resultType string). * * @param username the username value to set. * @return the RestServiceLinkedService object itself. @@ -211,6 +213,7 @@ public RestServiceLinkedService withAuthHeaders(Object authHeaders) { /** * Get the servicePrincipalId property: The application's client ID used in AadServicePrincipal authentication type. + * Type: string (or Expression with resultType string). * * @return the servicePrincipalId value. */ @@ -220,6 +223,7 @@ public Object servicePrincipalId() { /** * Set the servicePrincipalId property: The application's client ID used in AadServicePrincipal authentication type. + * Type: string (or Expression with resultType string). * * @param servicePrincipalId the servicePrincipalId value to set. * @return the RestServiceLinkedService object itself. @@ -257,7 +261,7 @@ public RestServiceLinkedService withServicePrincipalKey(SecretBase servicePrinci /** * Get the tenant property: The tenant information (domain name or tenant ID) used in AadServicePrincipal - * authentication type under which your application resides. + * authentication type under which your application resides. Type: string (or Expression with resultType string). * * @return the tenant value. */ @@ -267,7 +271,7 @@ public Object tenant() { /** * Set the tenant property: The tenant information (domain name or tenant ID) used in AadServicePrincipal - * authentication type under which your application resides. + * authentication type under which your application resides. Type: string (or Expression with resultType string). * * @param tenant the tenant value to set. * @return the RestServiceLinkedService object itself. @@ -308,7 +312,8 @@ public RestServiceLinkedService withAzureCloudType(Object azureCloudType) { } /** - * Get the aadResourceId property: The resource you are requesting authorization to use. + * Get the aadResourceId property: The resource you are requesting authorization to use. Type: string (or Expression + * with resultType string). * * @return the aadResourceId value. */ @@ -317,7 +322,8 @@ public Object aadResourceId() { } /** - * Set the aadResourceId property: The resource you are requesting authorization to use. + * Set the aadResourceId property: The resource you are requesting authorization to use. Type: string (or Expression + * with resultType string). * * @param aadResourceId the aadResourceId value to set. * @return the RestServiceLinkedService object itself. @@ -332,22 +338,22 @@ public RestServiceLinkedService withAadResourceId(Object aadResourceId) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the RestServiceLinkedService object itself. */ - public RestServiceLinkedService withEncryptedCredential(Object encryptedCredential) { + public RestServiceLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new RestServiceLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceLinkedService.java index 5fe9ed9b8f72..37db64478747 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceLinkedService.java @@ -190,22 +190,22 @@ public SalesforceLinkedService withApiVersion(Object apiVersion) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SalesforceLinkedService object itself. */ - public SalesforceLinkedService withEncryptedCredential(Object encryptedCredential) { + public SalesforceLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SalesforceLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceMarketingCloudLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceMarketingCloudLinkedService.java index d1f1701e0f55..a1ead9cf8643 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceMarketingCloudLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceMarketingCloudLinkedService.java @@ -220,22 +220,22 @@ public SalesforceMarketingCloudLinkedService withUsePeerVerification(Object useP /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SalesforceMarketingCloudLinkedService object itself. */ - public SalesforceMarketingCloudLinkedService withEncryptedCredential(Object encryptedCredential) { + public SalesforceMarketingCloudLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SalesforceMarketingCloudLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceServiceCloudLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceServiceCloudLinkedService.java index 383752e4a01c..e9b246cf35a3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceServiceCloudLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceServiceCloudLinkedService.java @@ -218,22 +218,22 @@ public SalesforceServiceCloudLinkedService withExtendedProperties(Object extende /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SalesforceServiceCloudLinkedService object itself. */ - public SalesforceServiceCloudLinkedService withEncryptedCredential(Object encryptedCredential) { + public SalesforceServiceCloudLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SalesforceServiceCloudLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceServiceCloudSource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceServiceCloudSource.java index 5edd5bd8e8a3..0ca7277fe590 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceServiceCloudSource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceServiceCloudSource.java @@ -21,10 +21,11 @@ public final class SalesforceServiceCloudSource extends CopySource { private Object query; /* - * The read behavior for the operation. Default is Query. + * The read behavior for the operation. Default is Query. Allowed values: Query/QueryAll. Type: string (or + * Expression with resultType string). */ @JsonProperty(value = "readBehavior") - private SalesforceSourceReadBehavior readBehavior; + private Object readBehavior; /* * Specifies the additional columns to be added to source data. Type: array of objects(AdditionalColumns) (or @@ -58,21 +59,23 @@ public SalesforceServiceCloudSource withQuery(Object query) { } /** - * Get the readBehavior property: The read behavior for the operation. Default is Query. + * Get the readBehavior property: The read behavior for the operation. Default is Query. Allowed values: + * Query/QueryAll. Type: string (or Expression with resultType string). * * @return the readBehavior value. */ - public SalesforceSourceReadBehavior readBehavior() { + public Object readBehavior() { return this.readBehavior; } /** - * Set the readBehavior property: The read behavior for the operation. Default is Query. + * Set the readBehavior property: The read behavior for the operation. Default is Query. Allowed values: + * Query/QueryAll. Type: string (or Expression with resultType string). * * @param readBehavior the readBehavior value to set. * @return the SalesforceServiceCloudSource object itself. */ - public SalesforceServiceCloudSource withReadBehavior(SalesforceSourceReadBehavior readBehavior) { + public SalesforceServiceCloudSource withReadBehavior(Object readBehavior) { this.readBehavior = readBehavior; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceSource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceSource.java index 12d77668c0b7..d6afb08cdd20 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceSource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceSource.java @@ -21,10 +21,11 @@ public final class SalesforceSource extends TabularSource { private Object query; /* - * The read behavior for the operation. Default is Query. + * The read behavior for the operation. Default is Query. Allowed values: Query/QueryAll. Type: string (or + * Expression with resultType string). */ @JsonProperty(value = "readBehavior") - private SalesforceSourceReadBehavior readBehavior; + private Object readBehavior; /** Creates an instance of SalesforceSource class. */ public SalesforceSource() { @@ -51,21 +52,23 @@ public SalesforceSource withQuery(Object query) { } /** - * Get the readBehavior property: The read behavior for the operation. Default is Query. + * Get the readBehavior property: The read behavior for the operation. Default is Query. Allowed values: + * Query/QueryAll. Type: string (or Expression with resultType string). * * @return the readBehavior value. */ - public SalesforceSourceReadBehavior readBehavior() { + public Object readBehavior() { return this.readBehavior; } /** - * Set the readBehavior property: The read behavior for the operation. Default is Query. + * Set the readBehavior property: The read behavior for the operation. Default is Query. Allowed values: + * Query/QueryAll. Type: string (or Expression with resultType string). * * @param readBehavior the readBehavior value to set. * @return the SalesforceSource object itself. */ - public SalesforceSource withReadBehavior(SalesforceSourceReadBehavior readBehavior) { + public SalesforceSource withReadBehavior(Object readBehavior) { this.readBehavior = readBehavior; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceSourceReadBehavior.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceSourceReadBehavior.java deleted file mode 100644 index 3634a3776737..000000000000 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SalesforceSourceReadBehavior.java +++ /dev/null @@ -1,47 +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.resourcemanager.datafactory.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** The read behavior for the operation. Default is Query. */ -public final class SalesforceSourceReadBehavior extends ExpandableStringEnum { - /** Static value Query for SalesforceSourceReadBehavior. */ - public static final SalesforceSourceReadBehavior QUERY = fromString("Query"); - - /** Static value QueryAll for SalesforceSourceReadBehavior. */ - public static final SalesforceSourceReadBehavior QUERY_ALL = fromString("QueryAll"); - - /** - * Creates a new instance of SalesforceSourceReadBehavior value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public SalesforceSourceReadBehavior() { - } - - /** - * Creates or finds a SalesforceSourceReadBehavior from its string representation. - * - * @param name a name to look for. - * @return the corresponding SalesforceSourceReadBehavior. - */ - @JsonCreator - public static SalesforceSourceReadBehavior fromString(String name) { - return fromString(name, SalesforceSourceReadBehavior.class); - } - - /** - * Gets known SalesforceSourceReadBehavior values. - * - * @return known SalesforceSourceReadBehavior values. - */ - public static Collection values() { - return values(SalesforceSourceReadBehavior.class); - } -} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapBWLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapBWLinkedService.java index a98382cb5a93..39e7bed54672 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapBWLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapBWLinkedService.java @@ -188,22 +188,22 @@ public SapBWLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapBWLinkedService object itself. */ - public SapBWLinkedService withEncryptedCredential(Object encryptedCredential) { + public SapBWLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SapBWLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapCloudForCustomerLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapCloudForCustomerLinkedService.java index d2d8fa73d29e..c0730067edd5 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapCloudForCustomerLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapCloudForCustomerLinkedService.java @@ -142,23 +142,23 @@ public SapCloudForCustomerLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. Either encryptedCredential or username/password must be - * provided. Type: string (or Expression with resultType string). + * provided. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. Either encryptedCredential or username/password must be - * provided. Type: string (or Expression with resultType string). + * provided. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapCloudForCustomerLinkedService object itself. */ - public SapCloudForCustomerLinkedService withEncryptedCredential(Object encryptedCredential) { + public SapCloudForCustomerLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SapCloudForCustomerLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapEccLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapEccLinkedService.java index 50ad01a8251f..3e3f6a6a50f1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapEccLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapEccLinkedService.java @@ -71,7 +71,7 @@ public SapEccLinkedService withAnnotations(List annotations) { * * @return the url value. */ - public String url() { + public Object url() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().url(); } @@ -82,7 +82,7 @@ public String url() { * @param url the url value to set. * @return the SapEccLinkedService object itself. */ - public SapEccLinkedService withUrl(String url) { + public SapEccLinkedService withUrl(Object url) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SapEccLinkedServiceTypeProperties(); } @@ -96,7 +96,7 @@ public SapEccLinkedService withUrl(String url) { * * @return the username value. */ - public String username() { + public Object username() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().username(); } @@ -107,7 +107,7 @@ public String username() { * @param username the username value to set. * @return the SapEccLinkedService object itself. */ - public SapEccLinkedService withUsername(String username) { + public SapEccLinkedService withUsername(Object username) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SapEccLinkedServiceTypeProperties(); } @@ -141,7 +141,7 @@ public SapEccLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. Either encryptedCredential or username/password must be - * provided. Type: string (or Expression with resultType string). + * provided. Type: string. * * @return the encryptedCredential value. */ @@ -152,7 +152,7 @@ public String encryptedCredential() { /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted * using the integration runtime credential manager. Either encryptedCredential or username/password must be - * provided. Type: string (or Expression with resultType string). + * provided. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapEccLinkedService object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapHanaLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapHanaLinkedService.java index fdb8fe73aab6..15223dbba5dc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapHanaLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapHanaLinkedService.java @@ -186,22 +186,22 @@ public SapHanaLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapHanaLinkedService object itself. */ - public SapHanaLinkedService withEncryptedCredential(Object encryptedCredential) { + public SapHanaLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SapHanaLinkedServiceProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapOdpLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapOdpLinkedService.java index 81ae10762d29..e14ad461b487 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapOdpLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapOdpLinkedService.java @@ -488,22 +488,22 @@ public SapOdpLinkedService withSubscriberName(Object subscriberName) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapOdpLinkedService object itself. */ - public SapOdpLinkedService withEncryptedCredential(Object encryptedCredential) { + public SapOdpLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SapOdpLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapOpenHubLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapOpenHubLinkedService.java index 1b6062e96cab..14df19432ca4 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapOpenHubLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapOpenHubLinkedService.java @@ -318,22 +318,22 @@ public SapOpenHubLinkedService withLogonGroup(Object logonGroup) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapOpenHubLinkedService object itself. */ - public SapOpenHubLinkedService withEncryptedCredential(Object encryptedCredential) { + public SapOpenHubLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SapOpenHubLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapTableLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapTableLinkedService.java index 6b9ac5d7dd38..d0c83ca6256d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapTableLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SapTableLinkedService.java @@ -440,22 +440,22 @@ public SapTableLinkedService withLogonGroup(Object logonGroup) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SapTableLinkedService object itself. */ - public SapTableLinkedService withEncryptedCredential(Object encryptedCredential) { + public SapTableLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SapTableLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ScriptActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ScriptActivity.java index c4245ab74857..e48d890428a9 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ScriptActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ScriptActivity.java @@ -64,6 +64,20 @@ public ScriptActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public ScriptActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScriptActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public ScriptActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ScriptActivityParameter.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ScriptActivityParameter.java index 59479b82d42f..5ce97a1ea126 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ScriptActivityParameter.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ScriptActivityParameter.java @@ -23,7 +23,7 @@ public final class ScriptActivityParameter { private ScriptActivityParameterType type; /* - * The value of the parameter. + * The value of the parameter. Type: string (or Expression with resultType string). */ @JsonProperty(value = "value") private Object value; @@ -85,7 +85,7 @@ public ScriptActivityParameter withType(ScriptActivityParameterType type) { } /** - * Get the value property: The value of the parameter. + * Get the value property: The value of the parameter. Type: string (or Expression with resultType string). * * @return the value value. */ @@ -94,7 +94,7 @@ public Object value() { } /** - * Set the value property: The value of the parameter. + * Set the value property: The value of the parameter. Type: string (or Expression with resultType string). * * @param value the value value to set. * @return the ScriptActivityParameter object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SecureInputOutputPolicy.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SecureInputOutputPolicy.java new file mode 100644 index 000000000000..1059d28dc968 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SecureInputOutputPolicy.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Execution policy for an activity that supports secure input and output. */ +@Fluent +public final class SecureInputOutputPolicy { + /* + * When set to true, Input from activity is considered as secure and will not be logged to monitoring. + */ + @JsonProperty(value = "secureInput") + private Boolean secureInput; + + /* + * When set to true, Output from activity is considered as secure and will not be logged to monitoring. + */ + @JsonProperty(value = "secureOutput") + private Boolean secureOutput; + + /** Creates an instance of SecureInputOutputPolicy class. */ + public SecureInputOutputPolicy() { + } + + /** + * Get the secureInput property: When set to true, Input from activity is considered as secure and will not be + * logged to monitoring. + * + * @return the secureInput value. + */ + public Boolean secureInput() { + return this.secureInput; + } + + /** + * Set the secureInput property: When set to true, Input from activity is considered as secure and will not be + * logged to monitoring. + * + * @param secureInput the secureInput value to set. + * @return the SecureInputOutputPolicy object itself. + */ + public SecureInputOutputPolicy withSecureInput(Boolean secureInput) { + this.secureInput = secureInput; + return this; + } + + /** + * Get the secureOutput property: When set to true, Output from activity is considered as secure and will not be + * logged to monitoring. + * + * @return the secureOutput value. + */ + public Boolean secureOutput() { + return this.secureOutput; + } + + /** + * Set the secureOutput property: When set to true, Output from activity is considered as secure and will not be + * logged to monitoring. + * + * @param secureOutput the secureOutput value to set. + * @return the SecureInputOutputPolicy object itself. + */ + public SecureInputOutputPolicy withSecureOutput(Boolean secureOutput) { + this.secureOutput = secureOutput; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SelfHostedIntegrationRuntime.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SelfHostedIntegrationRuntime.java index 69bbff1d1350..c636cc147118 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SelfHostedIntegrationRuntime.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SelfHostedIntegrationRuntime.java @@ -66,6 +66,36 @@ public SelfHostedIntegrationRuntime withLinkedInfo(LinkedIntegrationRuntimeType return this; } + /** + * Get the selfContainedInteractiveAuthoringEnabled property: An alternative option to ensure interactive authoring + * function when your self-hosted integration runtime is unable to establish a connection with Azure Relay. + * + * @return the selfContainedInteractiveAuthoringEnabled value. + */ + public Boolean selfContainedInteractiveAuthoringEnabled() { + return this.innerTypeProperties() == null + ? null + : this.innerTypeProperties().selfContainedInteractiveAuthoringEnabled(); + } + + /** + * Set the selfContainedInteractiveAuthoringEnabled property: An alternative option to ensure interactive authoring + * function when your self-hosted integration runtime is unable to establish a connection with Azure Relay. + * + * @param selfContainedInteractiveAuthoringEnabled the selfContainedInteractiveAuthoringEnabled value to set. + * @return the SelfHostedIntegrationRuntime object itself. + */ + public SelfHostedIntegrationRuntime withSelfContainedInteractiveAuthoringEnabled( + Boolean selfContainedInteractiveAuthoringEnabled) { + if (this.innerTypeProperties() == null) { + this.innerTypeProperties = new SelfHostedIntegrationRuntimeTypeProperties(); + } + this + .innerTypeProperties() + .withSelfContainedInteractiveAuthoringEnabled(selfContainedInteractiveAuthoringEnabled); + return this; + } + /** * Validates the instance. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SelfHostedIntegrationRuntimeStatus.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SelfHostedIntegrationRuntimeStatus.java index a0bd7904cd01..4df03f450fd9 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SelfHostedIntegrationRuntimeStatus.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SelfHostedIntegrationRuntimeStatus.java @@ -217,6 +217,18 @@ public OffsetDateTime autoUpdateEta() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().autoUpdateEta(); } + /** + * Get the selfContainedInteractiveAuthoringEnabled property: An alternative option to ensure interactive authoring + * function when your self-hosted integration runtime is unable to establish a connection with Azure Relay. + * + * @return the selfContainedInteractiveAuthoringEnabled value. + */ + public Boolean selfContainedInteractiveAuthoringEnabled() { + return this.innerTypeProperties() == null + ? null + : this.innerTypeProperties().selfContainedInteractiveAuthoringEnabled(); + } + /** * Validates the instance. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ServiceNowLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ServiceNowLinkedService.java index 2534752b9754..9dc3815b48c1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ServiceNowLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ServiceNowLinkedService.java @@ -282,22 +282,22 @@ public ServiceNowLinkedService withUsePeerVerification(Object usePeerVerificatio /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ServiceNowLinkedService object itself. */ - public ServiceNowLinkedService withEncryptedCredential(Object encryptedCredential) { + public ServiceNowLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new ServiceNowLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SetVariableActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SetVariableActivity.java index 5de2209926fa..33c0d611ec92 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SetVariableActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SetVariableActivity.java @@ -23,6 +23,12 @@ public final class SetVariableActivity extends ControlActivity { @JsonProperty(value = "typeProperties", required = true) private SetVariableActivityTypeProperties innerTypeProperties = new SetVariableActivityTypeProperties(); + /* + * Activity policy. + */ + @JsonProperty(value = "policy") + private SecureInputOutputPolicy policy; + /** Creates an instance of SetVariableActivity class. */ public SetVariableActivity() { } @@ -36,6 +42,26 @@ private SetVariableActivityTypeProperties innerTypeProperties() { return this.innerTypeProperties; } + /** + * Get the policy property: Activity policy. + * + * @return the policy value. + */ + public SecureInputOutputPolicy policy() { + return this.policy; + } + + /** + * Set the policy property: Activity policy. + * + * @param policy the policy value to set. + * @return the SetVariableActivity object itself. + */ + public SetVariableActivity withPolicy(SecureInputOutputPolicy policy) { + this.policy = policy; + return this; + } + /** {@inheritDoc} */ @Override public SetVariableActivity withName(String name) { @@ -50,6 +76,20 @@ public SetVariableActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public SetVariableActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public SetVariableActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public SetVariableActivity withDependsOn(List dependsOn) { @@ -110,6 +150,29 @@ public SetVariableActivity withValue(Object value) { return this; } + /** + * Get the setSystemVariable property: If set to true, it sets the pipeline run return value. + * + * @return the setSystemVariable value. + */ + public Boolean setSystemVariable() { + return this.innerTypeProperties() == null ? null : this.innerTypeProperties().setSystemVariable(); + } + + /** + * Set the setSystemVariable property: If set to true, it sets the pipeline run return value. + * + * @param setSystemVariable the setSystemVariable value to set. + * @return the SetVariableActivity object itself. + */ + public SetVariableActivity withSetSystemVariable(Boolean setSystemVariable) { + if (this.innerTypeProperties() == null) { + this.innerTypeProperties = new SetVariableActivityTypeProperties(); + } + this.innerTypeProperties().withSetSystemVariable(setSystemVariable); + return this; + } + /** * Validates the instance. * @@ -126,6 +189,9 @@ public void validate() { } else { innerTypeProperties().validate(); } + if (policy() != null) { + policy().validate(); + } } private static final ClientLogger LOGGER = new ClientLogger(SetVariableActivity.class); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SftpReadSettings.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SftpReadSettings.java index 0659c1b38a7f..87e2e1e4c1f7 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SftpReadSettings.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SftpReadSettings.java @@ -34,10 +34,10 @@ public final class SftpReadSettings extends StoreReadSettings { private Object wildcardFileName; /* - * Indicates whether to enable partition discovery. + * Indicates whether to enable partition discovery. Type: boolean (or Expression with resultType boolean). */ @JsonProperty(value = "enablePartitionDiscovery") - private Boolean enablePartitionDiscovery; + private Object enablePartitionDiscovery; /* * Specify the root path where partition discovery starts from. Type: string (or Expression with resultType @@ -148,21 +148,23 @@ public SftpReadSettings withWildcardFileName(Object wildcardFileName) { } /** - * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Get the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @return the enablePartitionDiscovery value. */ - public Boolean enablePartitionDiscovery() { + public Object enablePartitionDiscovery() { return this.enablePartitionDiscovery; } /** - * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. + * Set the enablePartitionDiscovery property: Indicates whether to enable partition discovery. Type: boolean (or + * Expression with resultType boolean). * * @param enablePartitionDiscovery the enablePartitionDiscovery value to set. * @return the SftpReadSettings object itself. */ - public SftpReadSettings withEnablePartitionDiscovery(Boolean enablePartitionDiscovery) { + public SftpReadSettings withEnablePartitionDiscovery(Object enablePartitionDiscovery) { this.enablePartitionDiscovery = enablePartitionDiscovery; return this; } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SftpServerLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SftpServerLinkedService.java index 88128e0e391b..01a1e268ccbe 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SftpServerLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SftpServerLinkedService.java @@ -186,22 +186,22 @@ public SftpServerLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SftpServerLinkedService object itself. */ - public SftpServerLinkedService withEncryptedCredential(Object encryptedCredential) { + public SftpServerLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SftpServerLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SharePointOnlineListLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SharePointOnlineListLinkedService.java index 8ac2ea7062c5..2cbcc7eff4e0 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SharePointOnlineListLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SharePointOnlineListLinkedService.java @@ -170,22 +170,22 @@ public SharePointOnlineListLinkedService withServicePrincipalKey(SecretBase serv /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SharePointOnlineListLinkedService object itself. */ - public SharePointOnlineListLinkedService withEncryptedCredential(Object encryptedCredential) { + public SharePointOnlineListLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SharePointOnlineListLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ShopifyLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ShopifyLinkedService.java index fd5a464285b8..7058a5de624e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ShopifyLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ShopifyLinkedService.java @@ -190,22 +190,22 @@ public ShopifyLinkedService withUsePeerVerification(Object usePeerVerification) /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ShopifyLinkedService object itself. */ - public ShopifyLinkedService withEncryptedCredential(Object encryptedCredential) { + public ShopifyLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new ShopifyLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SmartsheetLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SmartsheetLinkedService.java index 6cbf010f1803..f158372828e4 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SmartsheetLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SmartsheetLinkedService.java @@ -90,22 +90,22 @@ public SmartsheetLinkedService withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SmartsheetLinkedService object itself. */ - public SmartsheetLinkedService withEncryptedCredential(Object encryptedCredential) { + public SmartsheetLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SmartsheetLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SnowflakeLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SnowflakeLinkedService.java index 03dd9663f691..01b2d20aa666 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SnowflakeLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SnowflakeLinkedService.java @@ -113,22 +113,22 @@ public SnowflakeLinkedService withPassword(AzureKeyVaultSecretReference password /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SnowflakeLinkedService object itself. */ - public SnowflakeLinkedService withEncryptedCredential(Object encryptedCredential) { + public SnowflakeLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SnowflakeLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SparkLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SparkLinkedService.java index e7889ae9fb6f..f5d330ff2ce6 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SparkLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SparkLinkedService.java @@ -378,22 +378,22 @@ public SparkLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedSe /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SparkLinkedService object itself. */ - public SparkLinkedService withEncryptedCredential(Object encryptedCredential) { + public SparkLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SparkLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlAlwaysEncryptedAkvAuthType.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlAlwaysEncryptedAkvAuthType.java index 74d66c345f75..205191b45719 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlAlwaysEncryptedAkvAuthType.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlAlwaysEncryptedAkvAuthType.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Sql always encrypted AKV authentication type. Type: string (or Expression with resultType string). */ +/** Sql always encrypted AKV authentication type. Type: string. */ public final class SqlAlwaysEncryptedAkvAuthType extends ExpandableStringEnum { /** Static value ServicePrincipal for SqlAlwaysEncryptedAkvAuthType. */ public static final SqlAlwaysEncryptedAkvAuthType SERVICE_PRINCIPAL = fromString("ServicePrincipal"); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlAlwaysEncryptedProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlAlwaysEncryptedProperties.java index 993c7d2d7d61..8873ea52b2aa 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlAlwaysEncryptedProperties.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlAlwaysEncryptedProperties.java @@ -12,7 +12,7 @@ @Fluent public final class SqlAlwaysEncryptedProperties { /* - * Sql always encrypted AKV authentication type. Type: string (or Expression with resultType string). + * Sql always encrypted AKV authentication type. Type: string. */ @JsonProperty(value = "alwaysEncryptedAkvAuthType", required = true) private SqlAlwaysEncryptedAkvAuthType alwaysEncryptedAkvAuthType; @@ -41,8 +41,7 @@ public SqlAlwaysEncryptedProperties() { } /** - * Get the alwaysEncryptedAkvAuthType property: Sql always encrypted AKV authentication type. Type: string (or - * Expression with resultType string). + * Get the alwaysEncryptedAkvAuthType property: Sql always encrypted AKV authentication type. Type: string. * * @return the alwaysEncryptedAkvAuthType value. */ @@ -51,8 +50,7 @@ public SqlAlwaysEncryptedAkvAuthType alwaysEncryptedAkvAuthType() { } /** - * Set the alwaysEncryptedAkvAuthType property: Sql always encrypted AKV authentication type. Type: string (or - * Expression with resultType string). + * Set the alwaysEncryptedAkvAuthType property: Sql always encrypted AKV authentication type. Type: string. * * @param alwaysEncryptedAkvAuthType the alwaysEncryptedAkvAuthType value to set. * @return the SqlAlwaysEncryptedProperties object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlDWSource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlDWSource.java index ff748e5057ce..7f1bbaffabfb 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlDWSource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlDWSource.java @@ -34,6 +34,14 @@ public final class SqlDWSource extends TabularSource { @JsonProperty(value = "storedProcedureParameters") private Object storedProcedureParameters; + /* + * Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "isolationLevel") + private Object isolationLevel; + /* * The partition mechanism that will be used for Sql read in parallel. Possible values include: "None", * "PhysicalPartitionsOfTable", "DynamicRange". @@ -119,6 +127,30 @@ public SqlDWSource withStoredProcedureParameters(Object storedProcedureParameter return this; } + /** + * Get the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @return the isolationLevel value. + */ + public Object isolationLevel() { + return this.isolationLevel; + } + + /** + * Set the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @param isolationLevel the isolationLevel value to set. + * @return the SqlDWSource object itself. + */ + public SqlDWSource withIsolationLevel(Object isolationLevel) { + this.isolationLevel = isolationLevel; + return this; + } + /** * Get the partitionOption property: The partition mechanism that will be used for Sql read in parallel. Possible * values include: "None", "PhysicalPartitionsOfTable", "DynamicRange". diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlMISource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlMISource.java index e4b85afed7f3..6b58f098b8d8 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlMISource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlMISource.java @@ -33,6 +33,14 @@ public final class SqlMISource extends TabularSource { @JsonProperty(value = "storedProcedureParameters") private Object storedProcedureParameters; + /* + * Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "isolationLevel") + private Object isolationLevel; + /* * Which additional types to produce. */ @@ -122,6 +130,30 @@ public SqlMISource withStoredProcedureParameters(Object storedProcedureParameter return this; } + /** + * Get the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @return the isolationLevel value. + */ + public Object isolationLevel() { + return this.isolationLevel; + } + + /** + * Set the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @param isolationLevel the isolationLevel value to set. + * @return the SqlMISource object itself. + */ + public SqlMISource withIsolationLevel(Object isolationLevel) { + this.isolationLevel = isolationLevel; + return this; + } + /** * Get the produceAdditionalTypes property: Which additional types to produce. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerLinkedService.java index 3d11571a9d63..116243f47044 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerLinkedService.java @@ -140,22 +140,22 @@ public SqlServerLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SqlServerLinkedService object itself. */ - public SqlServerLinkedService withEncryptedCredential(Object encryptedCredential) { + public SqlServerLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SqlServerLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerSource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerSource.java index 3ecde0df125e..fd90966012f9 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerSource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerSource.java @@ -33,6 +33,14 @@ public final class SqlServerSource extends TabularSource { @JsonProperty(value = "storedProcedureParameters") private Object storedProcedureParameters; + /* + * Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "isolationLevel") + private Object isolationLevel; + /* * Which additional types to produce. */ @@ -120,6 +128,30 @@ public SqlServerSource withStoredProcedureParameters(Object storedProcedureParam return this; } + /** + * Get the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @return the isolationLevel value. + */ + public Object isolationLevel() { + return this.isolationLevel; + } + + /** + * Set the isolationLevel property: Specifies the transaction locking behavior for the SQL source. Allowed values: + * ReadCommitted/ReadUncommitted/RepeatableRead/Serializable/Snapshot. The default value is ReadCommitted. Type: + * string (or Expression with resultType string). + * + * @param isolationLevel the isolationLevel value to set. + * @return the SqlServerSource object itself. + */ + public SqlServerSource withIsolationLevel(Object isolationLevel) { + this.isolationLevel = isolationLevel; + return this; + } + /** * Get the produceAdditionalTypes property: Which additional types to produce. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerStoredProcedureActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerStoredProcedureActivity.java index 256df1077972..5ae7a8083e23 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerStoredProcedureActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SqlServerStoredProcedureActivity.java @@ -65,6 +65,20 @@ public SqlServerStoredProcedureActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public SqlServerStoredProcedureActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public SqlServerStoredProcedureActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public SqlServerStoredProcedureActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SquareLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SquareLinkedService.java index 16edbc3cdfa5..71b2ba47f4ac 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SquareLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SquareLinkedService.java @@ -91,7 +91,7 @@ public SquareLinkedService withConnectionProperties(Object connectionProperties) } /** - * Get the host property: The URL of the Square instance. (i.e. mystore.mysquare.com). + * Get the host property: The URL of the Square instance. (i.e. mystore.mysquare.com). * * @return the host value. */ @@ -100,7 +100,7 @@ public Object host() { } /** - * Set the host property: The URL of the Square instance. (i.e. mystore.mysquare.com). + * Set the host property: The URL of the Square instance. (i.e. mystore.mysquare.com). * * @param host the host value to set. * @return the SquareLinkedService object itself. @@ -261,22 +261,22 @@ public SquareLinkedService withUsePeerVerification(Object usePeerVerification) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SquareLinkedService object itself. */ - public SquareLinkedService withEncryptedCredential(Object encryptedCredential) { + public SquareLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SquareLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SsisAccessCredential.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SsisAccessCredential.java index b8d115b9132f..4e7c75ae9a69 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SsisAccessCredential.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SsisAccessCredential.java @@ -12,13 +12,13 @@ @Fluent public final class SsisAccessCredential { /* - * Domain for windows authentication. + * Domain for windows authentication. Type: string (or Expression with resultType string). */ @JsonProperty(value = "domain", required = true) private Object domain; /* - * UseName for windows authentication. + * UseName for windows authentication. Type: string (or Expression with resultType string). */ @JsonProperty(value = "userName", required = true) private Object username; @@ -34,7 +34,7 @@ public SsisAccessCredential() { } /** - * Get the domain property: Domain for windows authentication. + * Get the domain property: Domain for windows authentication. Type: string (or Expression with resultType string). * * @return the domain value. */ @@ -43,7 +43,7 @@ public Object domain() { } /** - * Set the domain property: Domain for windows authentication. + * Set the domain property: Domain for windows authentication. Type: string (or Expression with resultType string). * * @param domain the domain value to set. * @return the SsisAccessCredential object itself. @@ -54,7 +54,8 @@ public SsisAccessCredential withDomain(Object domain) { } /** - * Get the username property: UseName for windows authentication. + * Get the username property: UseName for windows authentication. Type: string (or Expression with resultType + * string). * * @return the username value. */ @@ -63,7 +64,8 @@ public Object username() { } /** - * Set the username property: UseName for windows authentication. + * Set the username property: UseName for windows authentication. Type: string (or Expression with resultType + * string). * * @param username the username value to set. * @return the SsisAccessCredential object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SsisExecutionCredential.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SsisExecutionCredential.java index 677402c560d6..a5b40dbe9be3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SsisExecutionCredential.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SsisExecutionCredential.java @@ -12,13 +12,13 @@ @Fluent public final class SsisExecutionCredential { /* - * Domain for windows authentication. + * Domain for windows authentication. Type: string (or Expression with resultType string). */ @JsonProperty(value = "domain", required = true) private Object domain; /* - * UseName for windows authentication. + * UseName for windows authentication. Type: string (or Expression with resultType string). */ @JsonProperty(value = "userName", required = true) private Object username; @@ -34,7 +34,7 @@ public SsisExecutionCredential() { } /** - * Get the domain property: Domain for windows authentication. + * Get the domain property: Domain for windows authentication. Type: string (or Expression with resultType string). * * @return the domain value. */ @@ -43,7 +43,7 @@ public Object domain() { } /** - * Set the domain property: Domain for windows authentication. + * Set the domain property: Domain for windows authentication. Type: string (or Expression with resultType string). * * @param domain the domain value to set. * @return the SsisExecutionCredential object itself. @@ -54,7 +54,8 @@ public SsisExecutionCredential withDomain(Object domain) { } /** - * Get the username property: UseName for windows authentication. + * Get the username property: UseName for windows authentication. Type: string (or Expression with resultType + * string). * * @return the username value. */ @@ -63,7 +64,8 @@ public Object username() { } /** - * Set the username property: UseName for windows authentication. + * Set the username property: UseName for windows authentication. Type: string (or Expression with resultType + * string). * * @param username the username value to set. * @return the SsisExecutionCredential object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SwitchActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SwitchActivity.java index 5edb6bc72f9a..c3d6a6efdaf5 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SwitchActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SwitchActivity.java @@ -53,6 +53,20 @@ public SwitchActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public SwitchActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public SwitchActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public SwitchActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SybaseLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SybaseLinkedService.java index 4304cc89ee96..ca1c06b0a6ed 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SybaseLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SybaseLinkedService.java @@ -205,22 +205,22 @@ public SybaseLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the SybaseLinkedService object itself. */ - public SybaseLinkedService withEncryptedCredential(Object encryptedCredential) { + public SybaseLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SybaseLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SynapseNotebookActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SynapseNotebookActivity.java index 8093f468fe46..d31a85eb3eb9 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SynapseNotebookActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SynapseNotebookActivity.java @@ -65,6 +65,20 @@ public SynapseNotebookActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public SynapseNotebookActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public SynapseNotebookActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public SynapseNotebookActivity withDependsOn(List dependsOn) { @@ -229,22 +243,22 @@ public SynapseNotebookActivity withDriverSize(Object driverSize) { /** * Get the numExecutors property: Number of executors to launch for this session, which will override the - * 'numExecutors' of the notebook you provide. + * 'numExecutors' of the notebook you provide. Type: integer (or Expression with resultType integer). * * @return the numExecutors value. */ - public Integer numExecutors() { + public Object numExecutors() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().numExecutors(); } /** * Set the numExecutors property: Number of executors to launch for this session, which will override the - * 'numExecutors' of the notebook you provide. + * 'numExecutors' of the notebook you provide. Type: integer (or Expression with resultType integer). * * @param numExecutors the numExecutors value to set. * @return the SynapseNotebookActivity object itself. */ - public SynapseNotebookActivity withNumExecutors(Integer numExecutors) { + public SynapseNotebookActivity withNumExecutors(Object numExecutors) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SynapseNotebookActivityTypeProperties(); } @@ -252,6 +266,76 @@ public SynapseNotebookActivity withNumExecutors(Integer numExecutors) { return this; } + /** + * Get the configurationType property: The type of the spark config. + * + * @return the configurationType value. + */ + public ConfigurationType configurationType() { + return this.innerTypeProperties() == null ? null : this.innerTypeProperties().configurationType(); + } + + /** + * Set the configurationType property: The type of the spark config. + * + * @param configurationType the configurationType value to set. + * @return the SynapseNotebookActivity object itself. + */ + public SynapseNotebookActivity withConfigurationType(ConfigurationType configurationType) { + if (this.innerTypeProperties() == null) { + this.innerTypeProperties = new SynapseNotebookActivityTypeProperties(); + } + this.innerTypeProperties().withConfigurationType(configurationType); + return this; + } + + /** + * Get the targetSparkConfiguration property: The spark configuration of the spark job. + * + * @return the targetSparkConfiguration value. + */ + public SparkConfigurationParametrizationReference targetSparkConfiguration() { + return this.innerTypeProperties() == null ? null : this.innerTypeProperties().targetSparkConfiguration(); + } + + /** + * Set the targetSparkConfiguration property: The spark configuration of the spark job. + * + * @param targetSparkConfiguration the targetSparkConfiguration value to set. + * @return the SynapseNotebookActivity object itself. + */ + public SynapseNotebookActivity withTargetSparkConfiguration( + SparkConfigurationParametrizationReference targetSparkConfiguration) { + if (this.innerTypeProperties() == null) { + this.innerTypeProperties = new SynapseNotebookActivityTypeProperties(); + } + this.innerTypeProperties().withTargetSparkConfiguration(targetSparkConfiguration); + return this; + } + + /** + * Get the sparkConfig property: Spark configuration property. + * + * @return the sparkConfig value. + */ + public Map sparkConfig() { + return this.innerTypeProperties() == null ? null : this.innerTypeProperties().sparkConfig(); + } + + /** + * Set the sparkConfig property: Spark configuration property. + * + * @param sparkConfig the sparkConfig value to set. + * @return the SynapseNotebookActivity object itself. + */ + public SynapseNotebookActivity withSparkConfig(Map sparkConfig) { + if (this.innerTypeProperties() == null) { + this.innerTypeProperties = new SynapseNotebookActivityTypeProperties(); + } + this.innerTypeProperties().withSparkConfig(sparkConfig); + return this; + } + /** * Validates the instance. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SynapseSparkJobDefinitionActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SynapseSparkJobDefinitionActivity.java index 21ae566aa65f..e4ca263b6116 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SynapseSparkJobDefinitionActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SynapseSparkJobDefinitionActivity.java @@ -65,6 +65,20 @@ public SynapseSparkJobDefinitionActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public SynapseSparkJobDefinitionActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public SynapseSparkJobDefinitionActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public SynapseSparkJobDefinitionActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TabularTranslator.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TabularTranslator.java index badce7e3669e..796062cd57f2 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TabularTranslator.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TabularTranslator.java @@ -45,12 +45,9 @@ public final class TabularTranslator extends CopyTranslator { /* * Column mappings with logical types. Tabular->tabular example: - * [{"source":{"name":"CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}}" - + ",{"source":{"name":"CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. + * [{"source":{"name":"CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}},{"source":{"name":"CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. * Hierarchical->tabular example: - * [{"source":{"path":"$" - + ".CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}},{"source":{"path":"$" - + ".CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. + * [{"source":{"path":"$.CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}},{"source":{"path":"$.CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. * Type: object (or Expression with resultType object). */ @JsonProperty(value = "mappings") @@ -165,12 +162,9 @@ public TabularTranslator withMapComplexValuesToString(Object mapComplexValuesToS /** * Get the mappings property: Column mappings with logical types. Tabular->tabular example: - * [{"source":{"name":"CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}}" - + ",{"source":{"name":"CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. + * [{"source":{"name":"CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}},{"source":{"name":"CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. * Hierarchical->tabular example: - * [{"source":{"path":"$" - + ".CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}},{"source":{"path":"$" - + ".CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. + * [{"source":{"path":"$.CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}},{"source":{"path":"$.CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. * Type: object (or Expression with resultType object). * * @return the mappings value. @@ -181,12 +175,9 @@ public Object mappings() { /** * Set the mappings property: Column mappings with logical types. Tabular->tabular example: - * [{"source":{"name":"CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}}" - + ",{"source":{"name":"CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. + * [{"source":{"name":"CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}},{"source":{"name":"CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. * Hierarchical->tabular example: - * [{"source":{"path":"$" - + ".CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}},{"source":{"path":"$" - + ".CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. + * [{"source":{"path":"$.CustomerName","type":"String"},"sink":{"name":"ClientName","type":"String"}},{"source":{"path":"$.CustomerAddress","type":"String"},"sink":{"name":"ClientAddress","type":"String"}}]. * Type: object (or Expression with resultType object). * * @param mappings the mappings value to set. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TeamDeskLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TeamDeskLinkedService.java index 8554c90f366d..8f0832e709bc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TeamDeskLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TeamDeskLinkedService.java @@ -184,22 +184,22 @@ public TeamDeskLinkedService withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the TeamDeskLinkedService object itself. */ - public TeamDeskLinkedService withEncryptedCredential(Object encryptedCredential) { + public TeamDeskLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new TeamDeskLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TeradataLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TeradataLinkedService.java index aa79812dbffe..a4ed2c0dcde6 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TeradataLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TeradataLinkedService.java @@ -184,22 +184,22 @@ public TeradataLinkedService withPassword(SecretBase password) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the TeradataLinkedService object itself. */ - public TeradataLinkedService withEncryptedCredential(Object encryptedCredential) { + public TeradataLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new TeradataLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TriggerResource.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TriggerResource.java index d8518e95e0e3..5a40b70a5b0e 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TriggerResource.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TriggerResource.java @@ -66,11 +66,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The TriggerResource definition stages. */ interface DefinitionStages { /** The first stage of the TriggerResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the TriggerResource definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -82,6 +84,7 @@ interface WithParentResource { */ WithProperties withExistingFactory(String resourceGroupName, String factoryName); } + /** The stage of the TriggerResource definition allowing to specify properties. */ interface WithProperties { /** @@ -92,6 +95,7 @@ interface WithProperties { */ WithCreate withProperties(Trigger properties); } + /** * The stage of the TriggerResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -112,6 +116,7 @@ interface WithCreate extends DefinitionStages.WithIfMatch { */ TriggerResource create(Context context); } + /** The stage of the TriggerResource definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -125,6 +130,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the TriggerResource resource. * @@ -149,6 +155,7 @@ interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { */ TriggerResource apply(Context context); } + /** The TriggerResource update stages. */ interface UpdateStages { /** The stage of the TriggerResource update allowing to specify properties. */ @@ -161,6 +168,7 @@ interface WithProperties { */ Update withProperties(Trigger properties); } + /** The stage of the TriggerResource update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -174,6 +182,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TwilioLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TwilioLinkedService.java index 8b62018c37c7..6533954c65f1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TwilioLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/TwilioLinkedService.java @@ -66,7 +66,8 @@ public TwilioLinkedService withAnnotations(List annotations) { } /** - * Get the username property: The Account SID of Twilio service. + * Get the username property: The Account SID of Twilio service. Type: string (or Expression with resultType + * string). * * @return the username value. */ @@ -75,7 +76,8 @@ public Object username() { } /** - * Set the username property: The Account SID of Twilio service. + * Set the username property: The Account SID of Twilio service. Type: string (or Expression with resultType + * string). * * @param username the username value to set. * @return the TwilioLinkedService object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/UntilActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/UntilActivity.java index 871c07cd08bb..96bf79ebc707 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/UntilActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/UntilActivity.java @@ -53,6 +53,20 @@ public UntilActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public UntilActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public UntilActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public UntilActivity withDependsOn(List dependsOn) { @@ -95,8 +109,7 @@ public UntilActivity withExpression(Expression expression) { /** * Get the timeout property: Specifies the timeout for the activity to run. If there is no value specified, it takes * the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or Expression with resultType - * string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). Type: string (or Expression with - * resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). * * @return the timeout value. */ @@ -107,8 +120,7 @@ public Object timeout() { /** * Set the timeout property: Specifies the timeout for the activity to run. If there is no value specified, it takes * the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or Expression with resultType - * string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). Type: string (or Expression with - * resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). * * @param timeout the timeout value to set. * @return the UntilActivity object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ValidationActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ValidationActivity.java index ed4a530b433e..a560ab991eae 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ValidationActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ValidationActivity.java @@ -50,6 +50,20 @@ public ValidationActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public ValidationActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public ValidationActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public ValidationActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/VerticaLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/VerticaLinkedService.java index e85dd516d7ab..d4a9efadbc00 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/VerticaLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/VerticaLinkedService.java @@ -115,22 +115,22 @@ public VerticaLinkedService withPwd(AzureKeyVaultSecretReference pwd) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the VerticaLinkedService object itself. */ - public VerticaLinkedService withEncryptedCredential(Object encryptedCredential) { + public VerticaLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new VerticaLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WaitActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WaitActivity.java index 25bd9866eb55..1d6926acb4c4 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WaitActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WaitActivity.java @@ -50,6 +50,20 @@ public WaitActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public WaitActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public WaitActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public WaitActivity withDependsOn(List dependsOn) { @@ -65,7 +79,7 @@ public WaitActivity withUserProperties(List userProperties) { } /** - * Get the waitTimeInSeconds property: Duration in seconds. + * Get the waitTimeInSeconds property: Duration in seconds. Type: integer (or Expression with resultType integer). * * @return the waitTimeInSeconds value. */ @@ -74,7 +88,7 @@ public Object waitTimeInSeconds() { } /** - * Set the waitTimeInSeconds property: Duration in seconds. + * Set the waitTimeInSeconds property: Duration in seconds. Type: integer (or Expression with resultType integer). * * @param waitTimeInSeconds the waitTimeInSeconds value to set. * @return the WaitActivity object itself. diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WebActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WebActivity.java index acd55e973257..b3cedc246c04 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WebActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WebActivity.java @@ -64,6 +64,20 @@ public WebActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public WebActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public WebActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public WebActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WebhookActivity.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WebhookActivity.java index db9c398fbbd1..c472ee502cc6 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WebhookActivity.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/WebhookActivity.java @@ -50,6 +50,20 @@ public WebhookActivity withDescription(String description) { return this; } + /** {@inheritDoc} */ + @Override + public WebhookActivity withState(ActivityState state) { + super.withState(state); + return this; + } + + /** {@inheritDoc} */ + @Override + public WebhookActivity withOnInactiveMarkAs(ActivityOnInactiveMarkAs onInactiveMarkAs) { + super.withOnInactiveMarkAs(onInactiveMarkAs); + return this; + } + /** {@inheritDoc} */ @Override public WebhookActivity withDependsOn(List dependsOn) { diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/XeroLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/XeroLinkedService.java index 4fd0992adbf4..7a33e8dc1d99 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/XeroLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/XeroLinkedService.java @@ -238,22 +238,22 @@ public XeroLinkedService withUsePeerVerification(Object usePeerVerification) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the XeroLinkedService object itself. */ - public XeroLinkedService withEncryptedCredential(Object encryptedCredential) { + public XeroLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new XeroLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ZendeskLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ZendeskLinkedService.java index 2fa7c1fc6c7f..e73eb39b8105 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ZendeskLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ZendeskLinkedService.java @@ -184,22 +184,22 @@ public ZendeskLinkedService withApiToken(SecretBase apiToken) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ZendeskLinkedService object itself. */ - public ZendeskLinkedService withEncryptedCredential(Object encryptedCredential) { + public ZendeskLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new ZendeskLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ZohoLinkedService.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ZohoLinkedService.java index cc5509bb9fff..a48c1533c5ab 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ZohoLinkedService.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/ZohoLinkedService.java @@ -213,22 +213,22 @@ public ZohoLinkedService withUsePeerVerification(Object usePeerVerification) { /** * Get the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @return the encryptedCredential value. */ - public Object encryptedCredential() { + public String encryptedCredential() { return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encryptedCredential(); } /** * Set the encryptedCredential property: The encrypted credential used for authentication. Credentials are encrypted - * using the integration runtime credential manager. Type: string (or Expression with resultType string). + * using the integration runtime credential manager. Type: string. * * @param encryptedCredential the encryptedCredential value to set. * @return the ZohoLinkedService object itself. */ - public ZohoLinkedService withEncryptedCredential(Object encryptedCredential) { + public ZohoLinkedService withEncryptedCredential(String encryptedCredential) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new ZohoLinkedServiceTypeProperties(); } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureCreateOrUpdateSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureCreateOrUpdateSamples.java new file mode 100644 index 000000000000..0e2ff6ecb066 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureCreateOrUpdateSamples.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureResource; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import java.util.List; + +/** Samples for ChangeDataCapture CreateOrUpdate. */ +public final class ChangeDataCaptureCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Create.json + */ + /** + * Sample code: ChangeDataCapture_Create. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureCreate(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .define("exampleChangeDataCapture") + .withExistingFactory("exampleResourceGroup", "exampleFactoryName") + .withSourceConnectionsInfo((List) null) + .withTargetConnectionsInfo((List) null) + .withPolicy((MapperPolicy) null) + .withDescription( + "Sample demo change data capture to transfer data from delimited (csv) to Azure SQL Database with" + + " automapped and non-automapped mappings.") + .withAllowVNetOverride(false) + .create(); + } + + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Update.json + */ + /** + * Sample code: ChangeDataCapture_Update. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureUpdate(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + ChangeDataCaptureResource resource = + manager + .changeDataCaptures() + .getWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + null, + com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withDescription( + "Sample demo change data capture to transfer data from delimited (csv) to Azure SQL Database. Updating" + + " table mappings.") + .withAllowVNetOverride(false) + .withStatus("Stopped") + .apply(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureDeleteSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureDeleteSamples.java new file mode 100644 index 000000000000..e1aecb090ab9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +/** Samples for ChangeDataCapture Delete. */ +public final class ChangeDataCaptureDeleteSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Delete.json + */ + /** + * Sample code: ChangeDataCapture_Delete. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureDelete(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .deleteWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureGetSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureGetSamples.java new file mode 100644 index 000000000000..13fe5bf1582b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +/** Samples for ChangeDataCapture Get. */ +public final class ChangeDataCaptureGetSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Get.json + */ + /** + * Sample code: ChangeDataCapture_Get. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureGet(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .getWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureListByFactorySamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureListByFactorySamples.java new file mode 100644 index 000000000000..b133005a02d7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureListByFactorySamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +/** Samples for ChangeDataCapture ListByFactory. */ +public final class ChangeDataCaptureListByFactorySamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_ListByFactory.json + */ + /** + * Sample code: ChangeDataCapture_ListByFactory. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureListByFactory( + com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .listByFactory("exampleResourceGroup", "exampleFactoryName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureStartSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureStartSamples.java new file mode 100644 index 000000000000..962d708e7b45 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureStartSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +/** Samples for ChangeDataCapture Start. */ +public final class ChangeDataCaptureStartSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Start.json + */ + /** + * Sample code: ChangeDataCapture_Start. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureStart(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .startWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureStatusSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureStatusSamples.java new file mode 100644 index 000000000000..362f5fba7caa --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureStatusSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +/** Samples for ChangeDataCapture Status. */ +public final class ChangeDataCaptureStatusSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Status.json + */ + /** + * Sample code: ChangeDataCapture_Start. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureStart(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .statusWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureStopSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureStopSamples.java new file mode 100644 index 000000000000..c23081a53352 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureStopSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +/** Samples for ChangeDataCapture Stop. */ +public final class ChangeDataCaptureStopSamples { + /* + * x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/ChangeDataCapture_Stop.json + */ + /** + * Sample code: ChangeDataCapture_Stop. + * + * @param manager Entry point to DataFactoryManager. + */ + public static void changeDataCaptureStop(com.azure.resourcemanager.datafactory.DataFactoryManager manager) { + manager + .changeDataCaptures() + .stopWithResponse( + "exampleResourceGroup", + "exampleFactoryName", + "exampleChangeDataCapture", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionAddDataFlowSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionAddDataFlowSamples.java index 81cf9cf413ba..da09461c3fb1 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionAddDataFlowSamples.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionAddDataFlowSamples.java @@ -125,6 +125,7 @@ public static void dataFlowDebugSessionAddDataFlow(com.azure.resourcemanager.dat com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionCreateSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionCreateSamples.java index 46201410680b..58943a0a58be 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionCreateSamples.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionCreateSamples.java @@ -49,6 +49,7 @@ public static void dataFlowDebugSessionCreate(com.azure.resourcemanager.datafact com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DatasetsCreateOrUpdateSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DatasetsCreateOrUpdateSamples.java index f244e017c0e6..e50891648c05 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DatasetsCreateOrUpdateSamples.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/DatasetsCreateOrUpdateSamples.java @@ -109,6 +109,7 @@ public static void datasetsUpdate(com.azure.resourcemanager.datafactory.DataFact .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/FactoriesUpdateSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/FactoriesUpdateSamples.java index 07702da612e0..7e30786f58fc 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/FactoriesUpdateSamples.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/FactoriesUpdateSamples.java @@ -28,6 +28,7 @@ public static void factoriesUpdate(com.azure.resourcemanager.datafactory.DataFac resource.update().withTags(mapOf("exampleTag", "exampleValue")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsCreateOrUpdateSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsCreateOrUpdateSamples.java index 8c53bf50f39b..034b475e652c 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsCreateOrUpdateSamples.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsCreateOrUpdateSamples.java @@ -35,6 +35,7 @@ public static void managedVirtualNetworksCreate(com.azure.resourcemanager.datafa .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksCreateOrUpdateSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksCreateOrUpdateSamples.java index 31004ccbc33e..dd6603f78e11 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksCreateOrUpdateSamples.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksCreateOrUpdateSamples.java @@ -27,6 +27,7 @@ public static void managedVirtualNetworksCreate(com.azure.resourcemanager.datafa .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateOrUpdateSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateOrUpdateSamples.java index fb164d2e03f0..c90203366544 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateOrUpdateSamples.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateOrUpdateSamples.java @@ -176,6 +176,7 @@ public static void pipelinesUpdate(com.azure.resourcemanager.datafactory.DataFac .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateRunSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateRunSamples.java index 7c73f8ce0f6e..f4b771060f96 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateRunSamples.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateRunSamples.java @@ -40,6 +40,7 @@ public static void pipelinesCreateRun(com.azure.resourcemanager.datafactory.Data com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/TriggersCreateOrUpdateSamples.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/TriggersCreateOrUpdateSamples.java index 6c566285b2e1..c8d5735b8b89 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/TriggersCreateOrUpdateSamples.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/samples/java/com/azure/resourcemanager/datafactory/generated/TriggersCreateOrUpdateSamples.java @@ -111,6 +111,7 @@ public static void triggersUpdate(com.azure.resourcemanager.datafactory.DataFact .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityDependencyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityDependencyTests.java new file mode 100644 index 000000000000..ec704e2201b7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityDependencyTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ActivityDependencyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActivityDependency model = + BinaryData + .fromString( + "{\"activity\":\"wcoezbrhub\",\"dependencyConditions\":[\"Succeeded\"],\"\":{\"okkqfqjbvleo\":\"dataygo\"}}") + .toObject(ActivityDependency.class); + Assertions.assertEquals("wcoezbrhub", model.activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependencyConditions().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActivityDependency model = + new ActivityDependency() + .withActivity("wcoezbrhub") + .withDependencyConditions(Arrays.asList(DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(ActivityDependency.class); + Assertions.assertEquals("wcoezbrhub", model.activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependencyConditions().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityPolicyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityPolicyTests.java new file mode 100644 index 000000000000..a148622d58a2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityPolicyTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ActivityPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActivityPolicy model = + BinaryData + .fromString( + "{\"timeout\":\"datamsgg\",\"retry\":\"datacmazilq\",\"retryIntervalInSeconds\":840058407,\"secureInput\":false,\"secureOutput\":false,\"\":{\"zykmdklwbqkmtwua\":\"datay\"}}") + .toObject(ActivityPolicy.class); + Assertions.assertEquals(840058407, model.retryIntervalInSeconds()); + Assertions.assertEquals(false, model.secureInput()); + Assertions.assertEquals(false, model.secureOutput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActivityPolicy model = + new ActivityPolicy() + .withTimeout("datamsgg") + .withRetry("datacmazilq") + .withRetryIntervalInSeconds(840058407) + .withSecureInput(false) + .withSecureOutput(false) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(ActivityPolicy.class); + Assertions.assertEquals(840058407, model.retryIntervalInSeconds()); + Assertions.assertEquals(false, model.secureInput()); + Assertions.assertEquals(false, model.secureOutput()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityRunTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityRunTests.java new file mode 100644 index 000000000000..4d770c5e1f45 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityRunTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityRun; +import java.util.HashMap; +import java.util.Map; + +public final class ActivityRunTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ActivityRun model = + BinaryData + .fromString( + "{\"pipelineName\":\"tj\",\"pipelineRunId\":\"ysdzhez\",\"activityName\":\"vaiqyuvvf\",\"activityType\":\"kphhq\",\"activityRunId\":\"kvylauyavl\",\"linkedServiceName\":\"mncsttijfybvp\",\"status\":\"krsgsgb\",\"activityRunStart\":\"2021-08-14T00:34:57Z\",\"activityRunEnd\":\"2021-08-27T04:01:57Z\",\"durationInMs\":1030277029,\"input\":\"datadgkynscliqhzvhxn\",\"output\":\"datamtk\",\"error\":\"dataotppnv\",\"\":{\"dhlfkqojpykvgt\":\"dataxhihfrbbcevqagtl\"}}") + .toObject(ActivityRun.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ActivityRun model = + new ActivityRun() + .withAdditionalProperties( + mapOf( + "durationInMs", + 1030277029, + "linkedServiceName", + "mncsttijfybvp", + "activityRunStart", + "2021-08-14T00:34:57Z", + "activityRunEnd", + "2021-08-27T04:01:57Z", + "activityName", + "vaiqyuvvf", + "error", + "dataotppnv", + "pipelineName", + "tj", + "output", + "datamtk", + "activityRunId", + "kvylauyavl", + "input", + "datadgkynscliqhzvhxn", + "pipelineRunId", + "ysdzhez", + "activityType", + "kphhq", + "status", + "krsgsgb")); + model = BinaryData.fromObject(model).toObject(ActivityRun.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityTests.java new file mode 100644 index 000000000000..624a0caf0bb9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ActivityTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Activity model = + BinaryData + .fromString( + "{\"type\":\"Activity\",\"name\":\"volvtn\",\"description\":\"qfzgemjdftul\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"amtmcz\",\"dependencyConditions\":[\"Succeeded\"],\"\":{\"qioknssxmojm\":\"datawcw\"}},{\"activity\":\"vpkjpr\",\"dependencyConditions\":[\"Skipped\"],\"\":{\"ydbsd\":\"datazqljyxgtczh\"}}],\"userProperties\":[{\"name\":\"kx\",\"value\":\"dataaehvbbxuri\"}],\"\":{\"ckpyklyhplu\":\"datafnhtbaxkgxyw\",\"gzibthostgktstv\":\"datadpvruud\",\"odqkdlwwqfb\":\"dataxeclzedqbcvhzlhp\",\"lmbtxhwgfwsrt\":\"datamlkxtrqjfs\"}}") + .toObject(Activity.class); + Assertions.assertEquals("volvtn", model.name()); + Assertions.assertEquals("qfzgemjdftul", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("amtmcz", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("kx", model.userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Activity model = + new Activity() + .withName("volvtn") + .withDescription("qfzgemjdftul") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("amtmcz") + .withDependencyConditions(Arrays.asList(DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("vpkjpr") + .withDependencyConditions(Arrays.asList(DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties(Arrays.asList(new UserProperty().withName("kx").withValue("dataaehvbbxuri"))) + .withAdditionalProperties(mapOf("type", "Activity")); + model = BinaryData.fromObject(model).toObject(Activity.class); + Assertions.assertEquals("volvtn", model.name()); + Assertions.assertEquals("qfzgemjdftul", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("amtmcz", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("kx", model.userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AddDataFlowToDebugSessionResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AddDataFlowToDebugSessionResponseInnerTests.java new file mode 100644 index 000000000000..14c98f2d13a5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AddDataFlowToDebugSessionResponseInnerTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AddDataFlowToDebugSessionResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class AddDataFlowToDebugSessionResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AddDataFlowToDebugSessionResponseInner model = + BinaryData + .fromString("{\"jobVersion\":\"fbcgwgcloxoebqin\"}") + .toObject(AddDataFlowToDebugSessionResponseInner.class); + Assertions.assertEquals("fbcgwgcloxoebqin", model.jobVersion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AddDataFlowToDebugSessionResponseInner model = + new AddDataFlowToDebugSessionResponseInner().withJobVersion("fbcgwgcloxoebqin"); + model = BinaryData.fromObject(model).toObject(AddDataFlowToDebugSessionResponseInner.class); + Assertions.assertEquals("fbcgwgcloxoebqin", model.jobVersion()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonMwsObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonMwsObjectDatasetTests.java new file mode 100644 index 000000000000..372f913c13de --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonMwsObjectDatasetTests.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonMwsObjectDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AmazonMwsObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonMwsObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"AmazonMWSObject\",\"typeProperties\":{\"tableName\":\"datan\"},\"description\":\"lxcltjhbcycg\",\"structure\":\"datakcsihxvta\",\"schema\":\"datawf\",\"linkedServiceName\":{\"referenceName\":\"pxpry\",\"parameters\":{\"gugwlux\":\"databubwhzq\",\"mkdhwqcqweba\":\"datahtq\",\"phujeucosvk\":\"datamfpk\",\"llgnueezfpffb\":\"dataeergvypaxpjpy\"}},\"parameters\":{\"gzyojfchicpare\":{\"type\":\"Array\",\"defaultValue\":\"datavmcgm\"},\"ojuxil\":{\"type\":\"Bool\",\"defaultValue\":\"dataksgqhb\"},\"fldfljwt\":{\"type\":\"Object\",\"defaultValue\":\"datalkc\"}},\"annotations\":[\"datatsflotumbm\",\"datagftshfgmuxuqiags\",\"dataoikuqirhsk\",\"datapaowkgvnlfueyxfz\"],\"folder\":{\"name\":\"lrjugcfebpiucenb\"},\"\":{\"lsxr\":\"datalldfknbdzw\"}}") + .toObject(AmazonMwsObjectDataset.class); + Assertions.assertEquals("lxcltjhbcycg", model.description()); + Assertions.assertEquals("pxpry", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("gzyojfchicpare").type()); + Assertions.assertEquals("lrjugcfebpiucenb", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonMwsObjectDataset model = + new AmazonMwsObjectDataset() + .withDescription("lxcltjhbcycg") + .withStructure("datakcsihxvta") + .withSchema("datawf") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("pxpry") + .withParameters( + mapOf( + "gugwlux", + "databubwhzq", + "mkdhwqcqweba", + "datahtq", + "phujeucosvk", + "datamfpk", + "llgnueezfpffb", + "dataeergvypaxpjpy"))) + .withParameters( + mapOf( + "gzyojfchicpare", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datavmcgm"), + "ojuxil", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataksgqhb"), + "fldfljwt", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datalkc"))) + .withAnnotations( + Arrays.asList("datatsflotumbm", "datagftshfgmuxuqiags", "dataoikuqirhsk", "datapaowkgvnlfueyxfz")) + .withFolder(new DatasetFolder().withName("lrjugcfebpiucenb")) + .withTableName("datan"); + model = BinaryData.fromObject(model).toObject(AmazonMwsObjectDataset.class); + Assertions.assertEquals("lxcltjhbcycg", model.description()); + Assertions.assertEquals("pxpry", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("gzyojfchicpare").type()); + Assertions.assertEquals("lrjugcfebpiucenb", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonMwsSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonMwsSourceTests.java new file mode 100644 index 000000000000..573eb9a440bc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonMwsSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonMwsSource; + +public final class AmazonMwsSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonMwsSource model = + BinaryData + .fromString( + "{\"type\":\"AmazonMWSSource\",\"query\":\"dataexhimvlocdxvh\",\"queryTimeout\":\"databidhhipntrdd\",\"additionalColumns\":\"dataiwanvydgmqscijlf\",\"sourceRetryCount\":\"dataxgnzasvpm\",\"sourceRetryWait\":\"dataooqyp\",\"maxConcurrentConnections\":\"datalm\",\"disableMetricsCollection\":\"dataebv\",\"\":{\"bvbexrbynnl\":\"dataoyde\",\"bosacrnpscfkef\":\"dataddhdklwzzsic\",\"gecehennledhouk\":\"dataltxefamimgjuvjv\"}}") + .toObject(AmazonMwsSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonMwsSource model = + new AmazonMwsSource() + .withSourceRetryCount("dataxgnzasvpm") + .withSourceRetryWait("dataooqyp") + .withMaxConcurrentConnections("datalm") + .withDisableMetricsCollection("dataebv") + .withQueryTimeout("databidhhipntrdd") + .withAdditionalColumns("dataiwanvydgmqscijlf") + .withQuery("dataexhimvlocdxvh"); + model = BinaryData.fromObject(model).toObject(AmazonMwsSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOraclePartitionSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOraclePartitionSettingsTests.java new file mode 100644 index 000000000000..c4c78815e441 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOraclePartitionSettingsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonRdsForOraclePartitionSettings; + +public final class AmazonRdsForOraclePartitionSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRdsForOraclePartitionSettings model = + BinaryData + .fromString( + "{\"partitionNames\":\"datacyhfubzixqxxgra\",\"partitionColumnName\":\"dataftzn\",\"partitionUpperBound\":\"datarfhj\",\"partitionLowerBound\":\"dataiutbrnr\"}") + .toObject(AmazonRdsForOraclePartitionSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRdsForOraclePartitionSettings model = + new AmazonRdsForOraclePartitionSettings() + .withPartitionNames("datacyhfubzixqxxgra") + .withPartitionColumnName("dataftzn") + .withPartitionUpperBound("datarfhj") + .withPartitionLowerBound("dataiutbrnr"); + model = BinaryData.fromObject(model).toObject(AmazonRdsForOraclePartitionSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOracleSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOracleSourceTests.java new file mode 100644 index 000000000000..98fb3496cb4e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOracleSourceTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonRdsForOraclePartitionSettings; +import com.azure.resourcemanager.datafactory.models.AmazonRdsForOracleSource; + +public final class AmazonRdsForOracleSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRdsForOracleSource model = + BinaryData + .fromString( + "{\"type\":\"AmazonRdsForOracleSource\",\"oracleReaderQuery\":\"datatjbldgikokjwgej\",\"queryTimeout\":\"datauzezwnqhcpkjgsy\",\"partitionOption\":\"datadt\",\"partitionSettings\":{\"partitionNames\":\"dataqcutk\",\"partitionColumnName\":\"datarourtmccdejtoypl\",\"partitionUpperBound\":\"datavjutckfhmdcvlb\",\"partitionLowerBound\":\"dataezvujpbmz\"},\"additionalColumns\":\"datalgm\",\"sourceRetryCount\":\"dataxwkkbnhmdtj\",\"sourceRetryWait\":\"datapfoispchhvvmvs\",\"maxConcurrentConnections\":\"datayqdhaz\",\"disableMetricsCollection\":\"dataug\",\"\":{\"ubobqqnwhcmvdow\":\"dataovozyepkrncjrqhu\"}}") + .toObject(AmazonRdsForOracleSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRdsForOracleSource model = + new AmazonRdsForOracleSource() + .withSourceRetryCount("dataxwkkbnhmdtj") + .withSourceRetryWait("datapfoispchhvvmvs") + .withMaxConcurrentConnections("datayqdhaz") + .withDisableMetricsCollection("dataug") + .withOracleReaderQuery("datatjbldgikokjwgej") + .withQueryTimeout("datauzezwnqhcpkjgsy") + .withPartitionOption("datadt") + .withPartitionSettings( + new AmazonRdsForOraclePartitionSettings() + .withPartitionNames("dataqcutk") + .withPartitionColumnName("datarourtmccdejtoypl") + .withPartitionUpperBound("datavjutckfhmdcvlb") + .withPartitionLowerBound("dataezvujpbmz")) + .withAdditionalColumns("datalgm"); + model = BinaryData.fromObject(model).toObject(AmazonRdsForOracleSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOracleTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOracleTableDatasetTests.java new file mode 100644 index 000000000000..b6d35e5f686d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOracleTableDatasetTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonRdsForOracleTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AmazonRdsForOracleTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRdsForOracleTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AmazonRdsForOracleTable\",\"typeProperties\":{\"schema\":\"dataipvwkauj\",\"table\":\"dataw\"},\"description\":\"ox\",\"structure\":\"datawofxxdplrel\",\"schema\":\"datavga\",\"linkedServiceName\":{\"referenceName\":\"cbtuxlbpxrhrfjen\",\"parameters\":{\"jixy\":\"datawefiktlhqashtos\",\"acfvvtdpcbpzf\":\"datasecigzzdwj\",\"fiwltkfysu\":\"datamcsaugbr\"}},\"parameters\":{\"hcvasyy\":{\"type\":\"Array\",\"defaultValue\":\"dataklx\"},\"ixyxxhwrlqomaqs\":{\"type\":\"Array\",\"defaultValue\":\"dataokjbmsr\"},\"zozsxag\":{\"type\":\"Bool\",\"defaultValue\":\"datapzzbrwn\"}},\"annotations\":[\"datak\"],\"folder\":{\"name\":\"ksybvrrbnhylsb\"},\"\":{\"stizsyqag\":\"datacydyllmxv\",\"dylkyhtr\":\"datallcbrva\",\"ogykugdlavsav\":\"dataqwfyybptmjjr\"}}") + .toObject(AmazonRdsForOracleTableDataset.class); + Assertions.assertEquals("ox", model.description()); + Assertions.assertEquals("cbtuxlbpxrhrfjen", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("hcvasyy").type()); + Assertions.assertEquals("ksybvrrbnhylsb", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRdsForOracleTableDataset model = + new AmazonRdsForOracleTableDataset() + .withDescription("ox") + .withStructure("datawofxxdplrel") + .withSchema("datavga") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("cbtuxlbpxrhrfjen") + .withParameters( + mapOf( + "jixy", + "datawefiktlhqashtos", + "acfvvtdpcbpzf", + "datasecigzzdwj", + "fiwltkfysu", + "datamcsaugbr"))) + .withParameters( + mapOf( + "hcvasyy", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataklx"), + "ixyxxhwrlqomaqs", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataokjbmsr"), + "zozsxag", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datapzzbrwn"))) + .withAnnotations(Arrays.asList("datak")) + .withFolder(new DatasetFolder().withName("ksybvrrbnhylsb")) + .withSchemaTypePropertiesSchema("dataipvwkauj") + .withTable("dataw"); + model = BinaryData.fromObject(model).toObject(AmazonRdsForOracleTableDataset.class); + Assertions.assertEquals("ox", model.description()); + Assertions.assertEquals("cbtuxlbpxrhrfjen", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("hcvasyy").type()); + Assertions.assertEquals("ksybvrrbnhylsb", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOracleTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOracleTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..c4520b97b1bc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForOracleTableDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AmazonRdsForOracleTableDatasetTypeProperties; + +public final class AmazonRdsForOracleTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRdsForOracleTableDatasetTypeProperties model = + BinaryData + .fromString("{\"schema\":\"datahk\",\"table\":\"datageuufkb\"}") + .toObject(AmazonRdsForOracleTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRdsForOracleTableDatasetTypeProperties model = + new AmazonRdsForOracleTableDatasetTypeProperties().withSchema("datahk").withTable("datageuufkb"); + model = BinaryData.fromObject(model).toObject(AmazonRdsForOracleTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForSqlServerSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForSqlServerSourceTests.java new file mode 100644 index 000000000000..5f22b459f163 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForSqlServerSourceTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonRdsForSqlServerSource; +import com.azure.resourcemanager.datafactory.models.SqlPartitionSettings; + +public final class AmazonRdsForSqlServerSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRdsForSqlServerSource model = + BinaryData + .fromString( + "{\"type\":\"AmazonRdsForSqlServerSource\",\"sqlReaderQuery\":\"datajzpvckhbutmxtijs\",\"sqlReaderStoredProcedureName\":\"datatdp\",\"storedProcedureParameters\":\"datajtwibwcd\",\"isolationLevel\":\"datamnswxq\",\"produceAdditionalTypes\":\"datahffcanvrdtdl\",\"partitionOption\":\"datamgghutl\",\"partitionSettings\":{\"partitionColumnName\":\"datazljyogcpw\",\"partitionUpperBound\":\"datagpbi\",\"partitionLowerBound\":\"datanxhq\"},\"queryTimeout\":\"datajmfolqdikuv\",\"additionalColumns\":\"datalsp\",\"sourceRetryCount\":\"dataghkflwnl\",\"sourceRetryWait\":\"dataawtpwnk\",\"maxConcurrentConnections\":\"dataxl\",\"disableMetricsCollection\":\"dataqnil\",\"\":{\"rfdml\":\"dataygvsfafc\",\"cufc\":\"dataeqdw\",\"clcnxfofwqd\":\"datahq\"}}") + .toObject(AmazonRdsForSqlServerSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRdsForSqlServerSource model = + new AmazonRdsForSqlServerSource() + .withSourceRetryCount("dataghkflwnl") + .withSourceRetryWait("dataawtpwnk") + .withMaxConcurrentConnections("dataxl") + .withDisableMetricsCollection("dataqnil") + .withQueryTimeout("datajmfolqdikuv") + .withAdditionalColumns("datalsp") + .withSqlReaderQuery("datajzpvckhbutmxtijs") + .withSqlReaderStoredProcedureName("datatdp") + .withStoredProcedureParameters("datajtwibwcd") + .withIsolationLevel("datamnswxq") + .withProduceAdditionalTypes("datahffcanvrdtdl") + .withPartitionOption("datamgghutl") + .withPartitionSettings( + new SqlPartitionSettings() + .withPartitionColumnName("datazljyogcpw") + .withPartitionUpperBound("datagpbi") + .withPartitionLowerBound("datanxhq")); + model = BinaryData.fromObject(model).toObject(AmazonRdsForSqlServerSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForSqlServerTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForSqlServerTableDatasetTests.java new file mode 100644 index 000000000000..89a2af02087b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForSqlServerTableDatasetTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonRdsForSqlServerTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AmazonRdsForSqlServerTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRdsForSqlServerTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AmazonRdsForSqlServerTable\",\"typeProperties\":{\"schema\":\"datamhbtqyzycgcmbkyg\",\"table\":\"datajdqosxzmdzlybqfu\"},\"description\":\"ekzfkicx\",\"structure\":\"dataevmnk\",\"schema\":\"datahvsr\",\"linkedServiceName\":{\"referenceName\":\"jokvlwvbjsa\",\"parameters\":{\"a\":\"datavmf\",\"dhgxgiea\":\"datawbpzgfgqp\"}},\"parameters\":{\"uhwyxjsfmaxcebn\":{\"type\":\"Object\",\"defaultValue\":\"dataxavlozukgs\"},\"xpjpvemdf\":{\"type\":\"Bool\",\"defaultValue\":\"dataskemqqerw\"}},\"annotations\":[\"datatu\",\"databrxz\",\"datahyt\"],\"folder\":{\"name\":\"kjgeecwtfma\"},\"\":{\"sl\":\"datamnhtwofxfmhlvyq\",\"iekhjgqq\":\"dataqrmlq\",\"luwozf\":\"dataugwespscvsmsp\"}}") + .toObject(AmazonRdsForSqlServerTableDataset.class); + Assertions.assertEquals("ekzfkicx", model.description()); + Assertions.assertEquals("jokvlwvbjsa", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("uhwyxjsfmaxcebn").type()); + Assertions.assertEquals("kjgeecwtfma", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRdsForSqlServerTableDataset model = + new AmazonRdsForSqlServerTableDataset() + .withDescription("ekzfkicx") + .withStructure("dataevmnk") + .withSchema("datahvsr") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("jokvlwvbjsa") + .withParameters(mapOf("a", "datavmf", "dhgxgiea", "datawbpzgfgqp"))) + .withParameters( + mapOf( + "uhwyxjsfmaxcebn", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("dataxavlozukgs"), + "xpjpvemdf", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataskemqqerw"))) + .withAnnotations(Arrays.asList("datatu", "databrxz", "datahyt")) + .withFolder(new DatasetFolder().withName("kjgeecwtfma")) + .withSchemaTypePropertiesSchema("datamhbtqyzycgcmbkyg") + .withTable("datajdqosxzmdzlybqfu"); + model = BinaryData.fromObject(model).toObject(AmazonRdsForSqlServerTableDataset.class); + Assertions.assertEquals("ekzfkicx", model.description()); + Assertions.assertEquals("jokvlwvbjsa", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("uhwyxjsfmaxcebn").type()); + Assertions.assertEquals("kjgeecwtfma", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForSqlServerTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForSqlServerTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..364870fcd8d0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRdsForSqlServerTableDatasetTypePropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AmazonRdsForSqlServerTableDatasetTypeProperties; + +public final class AmazonRdsForSqlServerTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRdsForSqlServerTableDatasetTypeProperties model = + BinaryData + .fromString("{\"schema\":\"dataasupcvqgxcvwio\",\"table\":\"datacmcgmlmpnvq\"}") + .toObject(AmazonRdsForSqlServerTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRdsForSqlServerTableDatasetTypeProperties model = + new AmazonRdsForSqlServerTableDatasetTypeProperties() + .withSchema("dataasupcvqgxcvwio") + .withTable("datacmcgmlmpnvq"); + model = BinaryData.fromObject(model).toObject(AmazonRdsForSqlServerTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRedshiftSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRedshiftSourceTests.java new file mode 100644 index 000000000000..8ea64cc84bb8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRedshiftSourceTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonRedshiftSource; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.RedshiftUnloadSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AmazonRedshiftSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRedshiftSource model = + BinaryData + .fromString( + "{\"type\":\"AmazonRedshiftSource\",\"query\":\"datafcxdldhhkdeviw\",\"redshiftUnloadSettings\":{\"s3LinkedServiceName\":{\"referenceName\":\"hfxvl\",\"parameters\":{\"tuujcuavctxyrmws\":\"datarhsmghh\",\"cnn\":\"datarzmy\"}},\"bucketName\":\"dataajxv\"},\"queryTimeout\":\"dataidlwmewrgu\",\"additionalColumns\":\"dataugpkunvygupgnnvm\",\"sourceRetryCount\":\"datazqmxwwmekms\",\"sourceRetryWait\":\"datafjbefszfrxfy\",\"maxConcurrentConnections\":\"dataypxcqmdeecd\",\"disableMetricsCollection\":\"datajsizyhp\",\"\":{\"kqtfyuy\":\"datakgrtwhmadhismw\",\"tzgew\":\"dataybshchxuea\",\"fsewusqupkrr\":\"dataqwibtkrhcgbzr\"}}") + .toObject(AmazonRedshiftSource.class); + Assertions.assertEquals("hfxvl", model.redshiftUnloadSettings().s3LinkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRedshiftSource model = + new AmazonRedshiftSource() + .withSourceRetryCount("datazqmxwwmekms") + .withSourceRetryWait("datafjbefszfrxfy") + .withMaxConcurrentConnections("dataypxcqmdeecd") + .withDisableMetricsCollection("datajsizyhp") + .withQueryTimeout("dataidlwmewrgu") + .withAdditionalColumns("dataugpkunvygupgnnvm") + .withQuery("datafcxdldhhkdeviw") + .withRedshiftUnloadSettings( + new RedshiftUnloadSettings() + .withS3LinkedServiceName( + new LinkedServiceReference() + .withReferenceName("hfxvl") + .withParameters(mapOf("tuujcuavctxyrmws", "datarhsmghh", "cnn", "datarzmy"))) + .withBucketName("dataajxv")); + model = BinaryData.fromObject(model).toObject(AmazonRedshiftSource.class); + Assertions.assertEquals("hfxvl", model.redshiftUnloadSettings().s3LinkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRedshiftTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRedshiftTableDatasetTests.java new file mode 100644 index 000000000000..5b41660d8e13 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRedshiftTableDatasetTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonRedshiftTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AmazonRedshiftTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRedshiftTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AmazonRedshiftTable\",\"typeProperties\":{\"tableName\":\"datamhidyliuajkln\",\"table\":\"datagdnxqeon\",\"schema\":\"datarjjaojpz\"},\"description\":\"d\",\"structure\":\"dataigecwsadsqyuddkh\",\"schema\":\"datadmohheuyu\",\"linkedServiceName\":{\"referenceName\":\"nxmyevyigde\",\"parameters\":{\"ejwli\":\"datafi\"}},\"parameters\":{\"pqokhdyncra\":{\"type\":\"Bool\",\"defaultValue\":\"datajzwhajod\"},\"m\":{\"type\":\"Int\",\"defaultValue\":\"dataewb\"},\"clmslnunkqvz\":{\"type\":\"Int\",\"defaultValue\":\"datapmqnmelyksygih\"}},\"annotations\":[\"databajdexquawexi\",\"databfzetjizwh\",\"datanbmajvvyxtvvx\",\"dataakzixb\"],\"folder\":{\"name\":\"bfmlngfwhrmvlakn\"},\"\":{\"zblxna\":\"datawxn\",\"kovohwvpr\":\"datahsmfndcbsyhludzj\",\"cntjna\":\"datafdvtdurmdt\"}}") + .toObject(AmazonRedshiftTableDataset.class); + Assertions.assertEquals("d", model.description()); + Assertions.assertEquals("nxmyevyigde", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("pqokhdyncra").type()); + Assertions.assertEquals("bfmlngfwhrmvlakn", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRedshiftTableDataset model = + new AmazonRedshiftTableDataset() + .withDescription("d") + .withStructure("dataigecwsadsqyuddkh") + .withSchema("datadmohheuyu") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("nxmyevyigde") + .withParameters(mapOf("ejwli", "datafi"))) + .withParameters( + mapOf( + "pqokhdyncra", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datajzwhajod"), + "m", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataewb"), + "clmslnunkqvz", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datapmqnmelyksygih"))) + .withAnnotations( + Arrays.asList("databajdexquawexi", "databfzetjizwh", "datanbmajvvyxtvvx", "dataakzixb")) + .withFolder(new DatasetFolder().withName("bfmlngfwhrmvlakn")) + .withTableName("datamhidyliuajkln") + .withTable("datagdnxqeon") + .withSchemaTypePropertiesSchema("datarjjaojpz"); + model = BinaryData.fromObject(model).toObject(AmazonRedshiftTableDataset.class); + Assertions.assertEquals("d", model.description()); + Assertions.assertEquals("nxmyevyigde", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("pqokhdyncra").type()); + Assertions.assertEquals("bfmlngfwhrmvlakn", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRedshiftTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRedshiftTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..779a174ba4e2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonRedshiftTableDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AmazonRedshiftTableDatasetTypeProperties; + +public final class AmazonRedshiftTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonRedshiftTableDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"datahvqiiasbtwskkf\",\"table\":\"datayikmxhhqsxjbjk\",\"schema\":\"datariglb\"}") + .toObject(AmazonRedshiftTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonRedshiftTableDatasetTypeProperties model = + new AmazonRedshiftTableDatasetTypeProperties() + .withTableName("datahvqiiasbtwskkf") + .withTable("datayikmxhhqsxjbjk") + .withSchema("datariglb"); + model = BinaryData.fromObject(model).toObject(AmazonRedshiftTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3CompatibleLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3CompatibleLocationTests.java new file mode 100644 index 000000000000..4eb44a13b7b0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3CompatibleLocationTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonS3CompatibleLocation; + +public final class AmazonS3CompatibleLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonS3CompatibleLocation model = + BinaryData + .fromString( + "{\"type\":\"AmazonS3CompatibleLocation\",\"bucketName\":\"dataxtpzdlyse\",\"version\":\"datatoakatprytgrhz\",\"folderPath\":\"datafdpfawrptvcsht\",\"fileName\":\"datatzc\",\"\":{\"m\":\"dataqgdirda\",\"bwjjirmuydgf\":\"datazjgcfjfx\"}}") + .toObject(AmazonS3CompatibleLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonS3CompatibleLocation model = + new AmazonS3CompatibleLocation() + .withFolderPath("datafdpfawrptvcsht") + .withFileName("datatzc") + .withBucketName("dataxtpzdlyse") + .withVersion("datatoakatprytgrhz"); + model = BinaryData.fromObject(model).toObject(AmazonS3CompatibleLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3CompatibleReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3CompatibleReadSettingsTests.java new file mode 100644 index 000000000000..69710ad4c39b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3CompatibleReadSettingsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonS3CompatibleReadSettings; + +public final class AmazonS3CompatibleReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonS3CompatibleReadSettings model = + BinaryData + .fromString( + "{\"type\":\"AmazonS3CompatibleReadSettings\",\"recursive\":\"datagd\",\"wildcardFolderPath\":\"datajkoxlccjdooy\",\"wildcardFileName\":\"dataozzo\",\"prefix\":\"datadjhqqlbwid\",\"fileListPath\":\"datadftbxruu\",\"enablePartitionDiscovery\":\"dataaarrrgjnqkuca\",\"partitionRootPath\":\"datanpwgchl\",\"deleteFilesAfterCompletion\":\"datattxfitt\",\"modifiedDatetimeStart\":\"dataaxq\",\"modifiedDatetimeEnd\":\"dataflnl\",\"maxConcurrentConnections\":\"dataacss\",\"disableMetricsCollection\":\"datallfukqurrtcfgq\",\"\":{\"vymo\":\"datayrsleghozsmjj\",\"sxv\":\"dataryyyvlxmspjqa\"}}") + .toObject(AmazonS3CompatibleReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonS3CompatibleReadSettings model = + new AmazonS3CompatibleReadSettings() + .withMaxConcurrentConnections("dataacss") + .withDisableMetricsCollection("datallfukqurrtcfgq") + .withRecursive("datagd") + .withWildcardFolderPath("datajkoxlccjdooy") + .withWildcardFileName("dataozzo") + .withPrefix("datadjhqqlbwid") + .withFileListPath("datadftbxruu") + .withEnablePartitionDiscovery("dataaarrrgjnqkuca") + .withPartitionRootPath("datanpwgchl") + .withDeleteFilesAfterCompletion("datattxfitt") + .withModifiedDatetimeStart("dataaxq") + .withModifiedDatetimeEnd("dataflnl"); + model = BinaryData.fromObject(model).toObject(AmazonS3CompatibleReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3LocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3LocationTests.java new file mode 100644 index 000000000000..53ff872a3cfe --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3LocationTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonS3Location; + +public final class AmazonS3LocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonS3Location model = + BinaryData + .fromString( + "{\"type\":\"AmazonS3Location\",\"bucketName\":\"dataae\",\"version\":\"datacflwtjdtlr\",\"folderPath\":\"datafooy\",\"fileName\":\"datauxdtzcq\",\"\":{\"lantolamlb\":\"datadudgcozzomeh\",\"z\":\"datajuxkqll\"}}") + .toObject(AmazonS3Location.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonS3Location model = + new AmazonS3Location() + .withFolderPath("datafooy") + .withFileName("datauxdtzcq") + .withBucketName("dataae") + .withVersion("datacflwtjdtlr"); + model = BinaryData.fromObject(model).toObject(AmazonS3Location.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3ReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3ReadSettingsTests.java new file mode 100644 index 000000000000..0b497e3654e6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AmazonS3ReadSettingsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AmazonS3ReadSettings; + +public final class AmazonS3ReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AmazonS3ReadSettings model = + BinaryData + .fromString( + "{\"type\":\"AmazonS3ReadSettings\",\"recursive\":\"datawkqztqrnreyj\",\"wildcardFolderPath\":\"datanrweevtu\",\"wildcardFileName\":\"datadclugvs\",\"prefix\":\"datapsy\",\"fileListPath\":\"datagaaymfkexhiwmklj\",\"enablePartitionDiscovery\":\"datagxcewz\",\"partitionRootPath\":\"dataxz\",\"deleteFilesAfterCompletion\":\"datatcrccttedzyz\",\"modifiedDatetimeStart\":\"datasjuthsy\",\"modifiedDatetimeEnd\":\"datafilnc\",\"maxConcurrentConnections\":\"datankpxefmpzdwer\",\"disableMetricsCollection\":\"datakzxdlu\",\"\":{\"avpglntnsiuxyit\":\"dataptmndzbfo\",\"gomhenqnov\":\"datawsdxyzgrrllzx\"}}") + .toObject(AmazonS3ReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AmazonS3ReadSettings model = + new AmazonS3ReadSettings() + .withMaxConcurrentConnections("datankpxefmpzdwer") + .withDisableMetricsCollection("datakzxdlu") + .withRecursive("datawkqztqrnreyj") + .withWildcardFolderPath("datanrweevtu") + .withWildcardFileName("datadclugvs") + .withPrefix("datapsy") + .withFileListPath("datagaaymfkexhiwmklj") + .withEnablePartitionDiscovery("datagxcewz") + .withPartitionRootPath("dataxz") + .withDeleteFilesAfterCompletion("datatcrccttedzyz") + .withModifiedDatetimeStart("datasjuthsy") + .withModifiedDatetimeEnd("datafilnc"); + model = BinaryData.fromObject(model).toObject(AmazonS3ReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AppendVariableActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AppendVariableActivityTests.java new file mode 100644 index 000000000000..1f41e1947658 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AppendVariableActivityTests.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.AppendVariableActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AppendVariableActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AppendVariableActivity model = + BinaryData + .fromString( + "{\"type\":\"AppendVariable\",\"typeProperties\":{\"variableName\":\"ubsaskgi\",\"value\":\"datailbiwacxldho\"},\"name\":\"cdpwxh\",\"description\":\"vtbgznpxa\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"hikmfzdlhp\",\"dependencyConditions\":[\"Skipped\",\"Completed\",\"Skipped\"],\"\":{\"pfku\":\"dataiaztmxwmjaevwidn\",\"y\":\"datahwdirt\",\"dykxgcfhv\":\"dataaqya\"}},{\"activity\":\"ynsyhz\",\"dependencyConditions\":[\"Completed\",\"Skipped\",\"Failed\"],\"\":{\"ujhjbfoemmj\":\"dataycraryxrtt\",\"vvpxhdefydit\":\"datastlg\",\"a\":\"datajm\"}},{\"activity\":\"jyqhcowouoih\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Completed\",\"Failed\"],\"\":{\"hjpsgprlmpz\":\"datab\",\"hvphkdciyidzb\":\"dataaiakyflr\"}},{\"activity\":\"fwlxxwpyzbgstml\",\"dependencyConditions\":[\"Succeeded\"],\"\":{\"kkengowcut\":\"datagcazyni\",\"ouichoiimennxvqj\":\"datahmxmjm\",\"efszuu\":\"datakqdqn\"}}],\"userProperties\":[{\"name\":\"esfggheqllrpcqy\",\"value\":\"dataq\"},{\"name\":\"krvmvdqhag\",\"value\":\"datahohqe\"},{\"name\":\"tlsipedgtupkm\",\"value\":\"dataxeubngwidgxypdo\"}],\"\":{\"ivybl\":\"datahmcmfvyh\",\"k\":\"datao\"}}") + .toObject(AppendVariableActivity.class); + Assertions.assertEquals("cdpwxh", model.name()); + Assertions.assertEquals("vtbgznpxa", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("hikmfzdlhp", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("esfggheqllrpcqy", model.userProperties().get(0).name()); + Assertions.assertEquals("ubsaskgi", model.variableName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AppendVariableActivity model = + new AppendVariableActivity() + .withName("cdpwxh") + .withDescription("vtbgznpxa") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("hikmfzdlhp") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ynsyhz") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("jyqhcowouoih") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("fwlxxwpyzbgstml") + .withDependencyConditions(Arrays.asList(DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("esfggheqllrpcqy").withValue("dataq"), + new UserProperty().withName("krvmvdqhag").withValue("datahohqe"), + new UserProperty().withName("tlsipedgtupkm").withValue("dataxeubngwidgxypdo"))) + .withVariableName("ubsaskgi") + .withValue("datailbiwacxldho"); + model = BinaryData.fromObject(model).toObject(AppendVariableActivity.class); + Assertions.assertEquals("cdpwxh", model.name()); + Assertions.assertEquals("vtbgznpxa", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("hikmfzdlhp", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("esfggheqllrpcqy", model.userProperties().get(0).name()); + Assertions.assertEquals("ubsaskgi", model.variableName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AppendVariableActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AppendVariableActivityTypePropertiesTests.java new file mode 100644 index 000000000000..be1c4348f717 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AppendVariableActivityTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AppendVariableActivityTypeProperties; +import org.junit.jupiter.api.Assertions; + +public final class AppendVariableActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AppendVariableActivityTypeProperties model = + BinaryData + .fromString("{\"variableName\":\"voprgcsjycor\",\"value\":\"databwsfxkudicw\"}") + .toObject(AppendVariableActivityTypeProperties.class); + Assertions.assertEquals("voprgcsjycor", model.variableName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AppendVariableActivityTypeProperties model = + new AppendVariableActivityTypeProperties().withVariableName("voprgcsjycor").withValue("databwsfxkudicw"); + model = BinaryData.fromObject(model).toObject(AppendVariableActivityTypeProperties.class); + Assertions.assertEquals("voprgcsjycor", model.variableName()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ArmIdWrapperTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ArmIdWrapperTests.java new file mode 100644 index 000000000000..2ad9684df250 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ArmIdWrapperTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ArmIdWrapper; + +public final class ArmIdWrapperTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ArmIdWrapper model = BinaryData.fromString("{\"id\":\"z\"}").toObject(ArmIdWrapper.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ArmIdWrapper model = new ArmIdWrapper(); + model = BinaryData.fromObject(model).toObject(ArmIdWrapper.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroFormatTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroFormatTests.java new file mode 100644 index 000000000000..d01d18af5137 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroFormatTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AvroFormat; + +public final class AvroFormatTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvroFormat model = + BinaryData + .fromString( + "{\"type\":\"AvroFormat\",\"serializer\":\"dataugxwjwilmqrslaat\",\"deserializer\":\"datatwujjzgx\",\"\":{\"hvtqqykbkk\":\"datawlxrhgt\",\"vmcofn\":\"dataeozejogmkorvv\"}}") + .toObject(AvroFormat.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvroFormat model = new AvroFormat().withSerializer("dataugxwjwilmqrslaat").withDeserializer("datatwujjzgx"); + model = BinaryData.fromObject(model).toObject(AvroFormat.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroSinkTests.java new file mode 100644 index 000000000000..761d2dfd0ab5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroSinkTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AvroSink; +import com.azure.resourcemanager.datafactory.models.AvroWriteSettings; +import com.azure.resourcemanager.datafactory.models.StoreWriteSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AvroSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvroSink model = + BinaryData + .fromString( + "{\"type\":\"AvroSink\",\"storeSettings\":{\"type\":\"StoreWriteSettings\",\"maxConcurrentConnections\":\"dataaeiepvjr\",\"disableMetricsCollection\":\"dataksx\",\"copyBehavior\":\"datakb\",\"\":{\"hjyahrmuwvsdyruo\":\"dataawokr\",\"qgpldrn\":\"dataidtxmbnmjimggz\",\"sbetzufkvxerbd\":\"datajhdbnfb\"}},\"formatSettings\":{\"type\":\"AvroWriteSettings\",\"recordName\":\"ngdctmjz\",\"recordNamespace\":\"aeu\",\"maxRowsPerFile\":\"datagvheqzlqevas\",\"fileNamePrefix\":\"datagoodfh\",\"\":{\"jlizlzxh\":\"dataegdynydd\",\"sjwawl\":\"datacuglgmfznholaf\",\"yk\":\"dataqmznkcwiok\"}},\"writeBatchSize\":\"dataxmobnehbbchtcoel\",\"writeBatchTimeout\":\"datafnpxumgnjmsk\",\"sinkRetryCount\":\"dataeuogjiowande\",\"sinkRetryWait\":\"dataebpalz\",\"maxConcurrentConnections\":\"dataptg\",\"disableMetricsCollection\":\"datarz\",\"\":{\"rzilvcncdazw\":\"datafdsvmpt\",\"gvfgme\":\"datalgoravovqpnxpufv\",\"dkqfjzgyzj\":\"datafyelfxlbkbh\"}}") + .toObject(AvroSink.class); + Assertions.assertEquals("ngdctmjz", model.formatSettings().recordName()); + Assertions.assertEquals("aeu", model.formatSettings().recordNamespace()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvroSink model = + new AvroSink() + .withWriteBatchSize("dataxmobnehbbchtcoel") + .withWriteBatchTimeout("datafnpxumgnjmsk") + .withSinkRetryCount("dataeuogjiowande") + .withSinkRetryWait("dataebpalz") + .withMaxConcurrentConnections("dataptg") + .withDisableMetricsCollection("datarz") + .withStoreSettings( + new StoreWriteSettings() + .withMaxConcurrentConnections("dataaeiepvjr") + .withDisableMetricsCollection("dataksx") + .withCopyBehavior("datakb") + .withAdditionalProperties(mapOf("type", "StoreWriteSettings"))) + .withFormatSettings( + new AvroWriteSettings() + .withRecordName("ngdctmjz") + .withRecordNamespace("aeu") + .withMaxRowsPerFile("datagvheqzlqevas") + .withFileNamePrefix("datagoodfh")); + model = BinaryData.fromObject(model).toObject(AvroSink.class); + Assertions.assertEquals("ngdctmjz", model.formatSettings().recordName()); + Assertions.assertEquals("aeu", model.formatSettings().recordNamespace()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroSourceTests.java new file mode 100644 index 000000000000..ad20c4f07f9a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroSourceTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AvroSource; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class AvroSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvroSource model = + BinaryData + .fromString( + "{\"type\":\"AvroSource\",\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datacjmsrorjbyyxkc\",\"disableMetricsCollection\":\"datahvb\",\"\":{\"ivwven\":\"datat\",\"gjyho\":\"dataicyctak\",\"chvskq\":\"datasmahb\"}},\"additionalColumns\":\"databigozrvlkl\",\"sourceRetryCount\":\"datarlysseo\",\"sourceRetryWait\":\"datapgs\",\"maxConcurrentConnections\":\"datanjgmogmc\",\"disableMetricsCollection\":\"dataqzukbwyp\",\"\":{\"lw\":\"datafzvyoxgeriz\",\"oqmwpmrlg\":\"datakovopqpfcdp\",\"vamvrejkvci\":\"datajqsxfp\"}}") + .toObject(AvroSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvroSource model = + new AvroSource() + .withSourceRetryCount("datarlysseo") + .withSourceRetryWait("datapgs") + .withMaxConcurrentConnections("datanjgmogmc") + .withDisableMetricsCollection("dataqzukbwyp") + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datacjmsrorjbyyxkc") + .withDisableMetricsCollection("datahvb") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withAdditionalColumns("databigozrvlkl"); + model = BinaryData.fromObject(model).toObject(AvroSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroWriteSettingsTests.java new file mode 100644 index 000000000000..71461c0b589b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AvroWriteSettingsTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AvroWriteSettings; +import org.junit.jupiter.api.Assertions; + +public final class AvroWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvroWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"AvroWriteSettings\",\"recordName\":\"gadrvxbcye\",\"recordNamespace\":\"jbcbrtiqpj\",\"maxRowsPerFile\":\"datakamhdqluicrqxqj\",\"fileNamePrefix\":\"dataosmlhcppfgtns\",\"\":{\"mfhde\":\"datahztnjpkpmdlt\",\"xpebsxcnhq\":\"dataliaaiqyxlro\",\"rdamyumr\":\"datacbtyor\",\"ygj\":\"databbaxnym\"}}") + .toObject(AvroWriteSettings.class); + Assertions.assertEquals("gadrvxbcye", model.recordName()); + Assertions.assertEquals("jbcbrtiqpj", model.recordNamespace()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AvroWriteSettings model = + new AvroWriteSettings() + .withRecordName("gadrvxbcye") + .withRecordNamespace("jbcbrtiqpj") + .withMaxRowsPerFile("datakamhdqluicrqxqj") + .withFileNamePrefix("dataosmlhcppfgtns"); + model = BinaryData.fromObject(model).toObject(AvroWriteSettings.class); + Assertions.assertEquals("gadrvxbcye", model.recordName()); + Assertions.assertEquals("jbcbrtiqpj", model.recordNamespace()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzPowerShellSetupTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzPowerShellSetupTests.java new file mode 100644 index 000000000000..5c5538a66e0a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzPowerShellSetupTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzPowerShellSetup; +import org.junit.jupiter.api.Assertions; + +public final class AzPowerShellSetupTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzPowerShellSetup model = + BinaryData + .fromString("{\"type\":\"AzPowerShellSetup\",\"typeProperties\":{\"version\":\"rjpjthiz\"}}") + .toObject(AzPowerShellSetup.class); + Assertions.assertEquals("rjpjthiz", model.version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzPowerShellSetup model = new AzPowerShellSetup().withVersion("rjpjthiz"); + model = BinaryData.fromObject(model).toObject(AzPowerShellSetup.class); + Assertions.assertEquals("rjpjthiz", model.version()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzPowerShellSetupTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzPowerShellSetupTypePropertiesTests.java new file mode 100644 index 000000000000..84f824d8671a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzPowerShellSetupTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzPowerShellSetupTypeProperties; +import org.junit.jupiter.api.Assertions; + +public final class AzPowerShellSetupTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzPowerShellSetupTypeProperties model = + BinaryData.fromString("{\"version\":\"abcylzzietu\"}").toObject(AzPowerShellSetupTypeProperties.class); + Assertions.assertEquals("abcylzzietu", model.version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzPowerShellSetupTypeProperties model = new AzPowerShellSetupTypeProperties().withVersion("abcylzzietu"); + model = BinaryData.fromObject(model).toObject(AzPowerShellSetupTypeProperties.class); + Assertions.assertEquals("abcylzzietu", model.version()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobDatasetTests.java new file mode 100644 index 000000000000..0150fbfd5d83 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobDatasetTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobDataset; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureBlobDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureBlob\",\"typeProperties\":{\"folderPath\":\"datayhssrlvkpkpkocm\",\"tableRootLocation\":\"datacebxx\",\"fileName\":\"datayicyvspeslhwy\",\"modifiedDatetimeStart\":\"datagvrccpu\",\"modifiedDatetimeEnd\":\"datadhg\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"datardyddtpfcudvaf\",\"deserializer\":\"datafbq\",\"\":{\"rdw\":\"dataqnxhgk\",\"zvcmbpwd\":\"dataejpec\",\"bvtzldzchub\":\"dataudayprldidwmtf\",\"zuvigvl\":\"datagwn\"}},\"compression\":{\"type\":\"datafrbzakp\",\"level\":\"datacqra\",\"\":{\"cw\":\"datajpsucmxi\",\"jgsatky\":\"dataxyn\"}}},\"description\":\"cb\",\"structure\":\"datagcru\",\"schema\":\"datahirc\",\"linkedServiceName\":{\"referenceName\":\"gcvsvkkjbjolpy\",\"parameters\":{\"igowxxbhtpsyioqe\":\"datakvuznadvhmlie\",\"wanvmwdvgjqcrbko\":\"dataqwtqszzgyksik\",\"gyweo\":\"datapnbn\"}},\"parameters\":{\"kchkapit\":{\"type\":\"String\",\"defaultValue\":\"datacmahiwfrya\"},\"t\":{\"type\":\"SecureString\",\"defaultValue\":\"datahfyf\"},\"wh\":{\"type\":\"Object\",\"defaultValue\":\"dataep\"}},\"annotations\":[\"datafdgbggcjxzhbl\"],\"folder\":{\"name\":\"eh\"},\"\":{\"mbhdo\":\"dataym\"}}") + .toObject(AzureBlobDataset.class); + Assertions.assertEquals("cb", model.description()); + Assertions.assertEquals("gcvsvkkjbjolpy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("kchkapit").type()); + Assertions.assertEquals("eh", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobDataset model = + new AzureBlobDataset() + .withDescription("cb") + .withStructure("datagcru") + .withSchema("datahirc") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("gcvsvkkjbjolpy") + .withParameters( + mapOf( + "igowxxbhtpsyioqe", + "datakvuznadvhmlie", + "wanvmwdvgjqcrbko", + "dataqwtqszzgyksik", + "gyweo", + "datapnbn"))) + .withParameters( + mapOf( + "kchkapit", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datacmahiwfrya"), + "t", + new ParameterSpecification().withType(ParameterType.SECURE_STRING).withDefaultValue("datahfyf"), + "wh", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("dataep"))) + .withAnnotations(Arrays.asList("datafdgbggcjxzhbl")) + .withFolder(new DatasetFolder().withName("eh")) + .withFolderPath("datayhssrlvkpkpkocm") + .withTableRootLocation("datacebxx") + .withFileName("datayicyvspeslhwy") + .withModifiedDatetimeStart("datagvrccpu") + .withModifiedDatetimeEnd("datadhg") + .withFormat( + new DatasetStorageFormat() + .withSerializer("datardyddtpfcudvaf") + .withDeserializer("datafbq") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withCompression( + new DatasetCompression() + .withType("datafrbzakp") + .withLevel("datacqra") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(AzureBlobDataset.class); + Assertions.assertEquals("cb", model.description()); + Assertions.assertEquals("gcvsvkkjbjolpy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("kchkapit").type()); + Assertions.assertEquals("eh", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..bd2c35eb5749 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobDatasetTypePropertiesTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureBlobDatasetTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import java.util.HashMap; +import java.util.Map; + +public final class AzureBlobDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobDatasetTypeProperties model = + BinaryData + .fromString( + "{\"folderPath\":\"databng\",\"tableRootLocation\":\"datalgxz\",\"fileName\":\"datavxd\",\"modifiedDatetimeStart\":\"dataexatmdmnrsen\",\"modifiedDatetimeEnd\":\"datairxyddmiploisj\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"datao\",\"deserializer\":\"datanntwg\",\"\":{\"s\":\"dataoh\",\"bdjzghximkg\":\"datapzupzwwy\",\"ot\":\"datamxpqkjnpyriwn\",\"jkyjrexw\":\"dataxmmqmt\"}},\"compression\":{\"type\":\"datanbexfted\",\"level\":\"databheeggzgrnqt\",\"\":{\"tgjqg\":\"datazuum\",\"syxzxjmkanbc\":\"datacant\"}}}") + .toObject(AzureBlobDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobDatasetTypeProperties model = + new AzureBlobDatasetTypeProperties() + .withFolderPath("databng") + .withTableRootLocation("datalgxz") + .withFileName("datavxd") + .withModifiedDatetimeStart("dataexatmdmnrsen") + .withModifiedDatetimeEnd("datairxyddmiploisj") + .withFormat( + new DatasetStorageFormat() + .withSerializer("datao") + .withDeserializer("datanntwg") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withCompression( + new DatasetCompression() + .withType("datanbexfted") + .withLevel("databheeggzgrnqt") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(AzureBlobDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSDatasetTests.java new file mode 100644 index 000000000000..f34a07d3e7d0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSDatasetTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobFSDataset; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureBlobFSDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobFSDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureBlobFSFile\",\"typeProperties\":{\"folderPath\":\"datagc\",\"fileName\":\"datayrhkvxzzmiem\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"datatgp\",\"deserializer\":\"datasw\",\"\":{\"ornfbm\":\"datavjmghpakbqyhl\"}},\"compression\":{\"type\":\"dataagkncjmybnyevz\",\"level\":\"datajawrhulemm\",\"\":{\"kitzm\":\"datawppxirx\",\"cltjl\":\"datahitaxj\"}}},\"description\":\"gcem\",\"structure\":\"datadzdvyljubv\",\"schema\":\"datayzufldifnivlutgg\",\"linkedServiceName\":{\"referenceName\":\"aacxauhvc\",\"parameters\":{\"oiyygkts\":\"datahklsqx\",\"xxoxwfzbkv\":\"dataj\"}},\"parameters\":{\"snbwutlvuwm\":{\"type\":\"Bool\",\"defaultValue\":\"dataxphsowbe\"}},\"annotations\":[\"dataustihtgrafjajvky\",\"datammjczvog\"],\"folder\":{\"name\":\"rjenn\"},\"\":{\"xnrp\":\"dataaeuwqdwxhhlbmyph\",\"ywbihqbtodjfyx\":\"datahewokyqsfkxf\",\"rugyozzzawnjdv\":\"datavkvwzdmvddqw\"}}") + .toObject(AzureBlobFSDataset.class); + Assertions.assertEquals("gcem", model.description()); + Assertions.assertEquals("aacxauhvc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("snbwutlvuwm").type()); + Assertions.assertEquals("rjenn", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobFSDataset model = + new AzureBlobFSDataset() + .withDescription("gcem") + .withStructure("datadzdvyljubv") + .withSchema("datayzufldifnivlutgg") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("aacxauhvc") + .withParameters(mapOf("oiyygkts", "datahklsqx", "xxoxwfzbkv", "dataj"))) + .withParameters( + mapOf( + "snbwutlvuwm", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataxphsowbe"))) + .withAnnotations(Arrays.asList("dataustihtgrafjajvky", "datammjczvog")) + .withFolder(new DatasetFolder().withName("rjenn")) + .withFolderPath("datagc") + .withFileName("datayrhkvxzzmiem") + .withFormat( + new DatasetStorageFormat() + .withSerializer("datatgp") + .withDeserializer("datasw") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withCompression( + new DatasetCompression() + .withType("dataagkncjmybnyevz") + .withLevel("datajawrhulemm") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(AzureBlobFSDataset.class); + Assertions.assertEquals("gcem", model.description()); + Assertions.assertEquals("aacxauhvc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("snbwutlvuwm").type()); + Assertions.assertEquals("rjenn", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..a7a6e7dc1c09 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSDatasetTypePropertiesTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureBlobFSDatasetTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import java.util.HashMap; +import java.util.Map; + +public final class AzureBlobFSDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobFSDatasetTypeProperties model = + BinaryData + .fromString( + "{\"folderPath\":\"datarho\",\"fileName\":\"datakkvxu\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"datazbvb\",\"deserializer\":\"datauvqhxtozfgdkw\",\"\":{\"utui\":\"datarklpiigfuzk\",\"xyll\":\"datajclzjwaqdzqydewu\"}},\"compression\":{\"type\":\"datazevtzqwczoc\",\"level\":\"databek\",\"\":{\"horkslhraqk\":\"datanfpkyvnhiys\",\"flteatnegef\":\"datawlwkfflaqwmwqog\",\"ibt\":\"datajxnjtqbgy\",\"kxunsaujqgbb\":\"datanvxwtdqtcbjdbtqy\"}}}") + .toObject(AzureBlobFSDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobFSDatasetTypeProperties model = + new AzureBlobFSDatasetTypeProperties() + .withFolderPath("datarho") + .withFileName("datakkvxu") + .withFormat( + new DatasetStorageFormat() + .withSerializer("datazbvb") + .withDeserializer("datauvqhxtozfgdkw") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withCompression( + new DatasetCompression() + .withType("datazevtzqwczoc") + .withLevel("databek") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(AzureBlobFSDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSLocationTests.java new file mode 100644 index 000000000000..de09b49094a9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSLocationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobFSLocation; + +public final class AzureBlobFSLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobFSLocation model = + BinaryData + .fromString( + "{\"type\":\"AzureBlobFSLocation\",\"fileSystem\":\"datadsiuorin\",\"folderPath\":\"datacedpksriwmmtmqrx\",\"fileName\":\"dataqvvyczyay\",\"\":{\"bxiqahragpxmibpl\":\"datag\"}}") + .toObject(AzureBlobFSLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobFSLocation model = + new AzureBlobFSLocation() + .withFolderPath("datacedpksriwmmtmqrx") + .withFileName("dataqvvyczyay") + .withFileSystem("datadsiuorin"); + model = BinaryData.fromObject(model).toObject(AzureBlobFSLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSReadSettingsTests.java new file mode 100644 index 000000000000..1d126a81c149 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSReadSettingsTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobFSReadSettings; + +public final class AzureBlobFSReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobFSReadSettings model = + BinaryData + .fromString( + "{\"type\":\"AzureBlobFSReadSettings\",\"recursive\":\"dataekyd\",\"wildcardFolderPath\":\"datadkzfkneck\",\"wildcardFileName\":\"datarvdszrizpejhy\",\"fileListPath\":\"datazxqtcgswmh\",\"enablePartitionDiscovery\":\"dataicitykzyirj\",\"partitionRootPath\":\"datangnfunhtzgxsyiwm\",\"deleteFilesAfterCompletion\":\"datakudhjztbwzjbqzqw\",\"modifiedDatetimeStart\":\"dataznhqzdbzlkds\",\"modifiedDatetimeEnd\":\"datakvprk\",\"maxConcurrentConnections\":\"datavxieqcnv\",\"disableMetricsCollection\":\"datashfafbeh\",\"\":{\"lpfrecrizkabafd\":\"dataiuexkpgrmwdwlrae\",\"sgpdbhbdxsjsox\":\"datasizao\",\"inlgttvon\":\"datauwuungdvvddrcpqu\",\"mitmtkcqixgqxs\":\"datarpeli\"}}") + .toObject(AzureBlobFSReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobFSReadSettings model = + new AzureBlobFSReadSettings() + .withMaxConcurrentConnections("datavxieqcnv") + .withDisableMetricsCollection("datashfafbeh") + .withRecursive("dataekyd") + .withWildcardFolderPath("datadkzfkneck") + .withWildcardFileName("datarvdszrizpejhy") + .withFileListPath("datazxqtcgswmh") + .withEnablePartitionDiscovery("dataicitykzyirj") + .withPartitionRootPath("datangnfunhtzgxsyiwm") + .withDeleteFilesAfterCompletion("datakudhjztbwzjbqzqw") + .withModifiedDatetimeStart("dataznhqzdbzlkds") + .withModifiedDatetimeEnd("datakvprk"); + model = BinaryData.fromObject(model).toObject(AzureBlobFSReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSSinkTests.java new file mode 100644 index 000000000000..d853a88c83bb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSSinkTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobFSSink; +import com.azure.resourcemanager.datafactory.models.MetadataItem; +import java.util.Arrays; + +public final class AzureBlobFSSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobFSSink model = + BinaryData + .fromString( + "{\"type\":\"AzureBlobFSSink\",\"copyBehavior\":\"datalkmgcxmkr\",\"metadata\":[{\"name\":\"dataidy\",\"value\":\"datawcgvyuusexenyw\"},{\"name\":\"datadxqqgysxpa\",\"value\":\"datamthdqvcifwknlyt\"},{\"name\":\"datartocadtnmqrpj\",\"value\":\"datajixcya\"},{\"name\":\"dataii\",\"value\":\"datadbtrkv\"}],\"writeBatchSize\":\"datauessuuzfrw\",\"writeBatchTimeout\":\"datatrngj\",\"sinkRetryCount\":\"dataks\",\"sinkRetryWait\":\"datak\",\"maxConcurrentConnections\":\"datapulpyeyqsinie\",\"disableMetricsCollection\":\"databvvvtxk\",\"\":{\"kbdtmr\":\"datatlbb\",\"hvbpvizuuluilgm\":\"datajtuz\",\"dntj\":\"datav\",\"aaruvbzcqgtz\":\"datamjxgqsbjc\"}}") + .toObject(AzureBlobFSSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobFSSink model = + new AzureBlobFSSink() + .withWriteBatchSize("datauessuuzfrw") + .withWriteBatchTimeout("datatrngj") + .withSinkRetryCount("dataks") + .withSinkRetryWait("datak") + .withMaxConcurrentConnections("datapulpyeyqsinie") + .withDisableMetricsCollection("databvvvtxk") + .withCopyBehavior("datalkmgcxmkr") + .withMetadata( + Arrays + .asList( + new MetadataItem().withName("dataidy").withValue("datawcgvyuusexenyw"), + new MetadataItem().withName("datadxqqgysxpa").withValue("datamthdqvcifwknlyt"), + new MetadataItem().withName("datartocadtnmqrpj").withValue("datajixcya"), + new MetadataItem().withName("dataii").withValue("datadbtrkv"))); + model = BinaryData.fromObject(model).toObject(AzureBlobFSSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSSourceTests.java new file mode 100644 index 000000000000..94c7d8b76c17 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobFSSource; + +public final class AzureBlobFSSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobFSSource model = + BinaryData + .fromString( + "{\"type\":\"AzureBlobFSSource\",\"treatEmptyAsNull\":\"datazlcfe\",\"skipHeaderLineCount\":\"dataryxnklfswzsyigx\",\"recursive\":\"dataxhygc\",\"sourceRetryCount\":\"databapeuqyz\",\"sourceRetryWait\":\"datasuopcdiaossp\",\"maxConcurrentConnections\":\"datatgkmrsqaqgllnhgi\",\"disableMetricsCollection\":\"datawzzk\",\"\":{\"wdkpadktsyywa\":\"datarnglgituae\",\"dajqpdvvzbejx\":\"datajrfqtfkkiup\"}}") + .toObject(AzureBlobFSSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobFSSource model = + new AzureBlobFSSource() + .withSourceRetryCount("databapeuqyz") + .withSourceRetryWait("datasuopcdiaossp") + .withMaxConcurrentConnections("datatgkmrsqaqgllnhgi") + .withDisableMetricsCollection("datawzzk") + .withTreatEmptyAsNull("datazlcfe") + .withSkipHeaderLineCount("dataryxnklfswzsyigx") + .withRecursive("dataxhygc"); + model = BinaryData.fromObject(model).toObject(AzureBlobFSSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSWriteSettingsTests.java new file mode 100644 index 000000000000..153a0dc2e5ce --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobFSWriteSettingsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobFSWriteSettings; + +public final class AzureBlobFSWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobFSWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"AzureBlobFSWriteSettings\",\"blockSizeInMB\":\"datacbwmvp\",\"maxConcurrentConnections\":\"datajyzicel\",\"disableMetricsCollection\":\"dataazcgwnibnduqgji\",\"copyBehavior\":\"dataxxiao\",\"\":{\"pugnvhtgwadu\":\"datauhumgw\"}}") + .toObject(AzureBlobFSWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobFSWriteSettings model = + new AzureBlobFSWriteSettings() + .withMaxConcurrentConnections("datajyzicel") + .withDisableMetricsCollection("dataazcgwnibnduqgji") + .withCopyBehavior("dataxxiao") + .withBlockSizeInMB("datacbwmvp"); + model = BinaryData.fromObject(model).toObject(AzureBlobFSWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobStorageLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobStorageLocationTests.java new file mode 100644 index 000000000000..72b19d1eccd2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobStorageLocationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobStorageLocation; + +public final class AzureBlobStorageLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobStorageLocation model = + BinaryData + .fromString( + "{\"type\":\"AzureBlobStorageLocation\",\"container\":\"dataovsfb\",\"folderPath\":\"datavzopaxmfmvsm\",\"fileName\":\"dataoxfaxdtn\",\"\":{\"oiauesugmocpcj\":\"databsat\",\"rgttw\":\"datacboe\"}}") + .toObject(AzureBlobStorageLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobStorageLocation model = + new AzureBlobStorageLocation() + .withFolderPath("datavzopaxmfmvsm") + .withFileName("dataoxfaxdtn") + .withContainer("dataovsfb"); + model = BinaryData.fromObject(model).toObject(AzureBlobStorageLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobStorageReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobStorageReadSettingsTests.java new file mode 100644 index 000000000000..b839ba85ed40 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobStorageReadSettingsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobStorageReadSettings; + +public final class AzureBlobStorageReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobStorageReadSettings model = + BinaryData + .fromString( + "{\"type\":\"AzureBlobStorageReadSettings\",\"recursive\":\"datan\",\"wildcardFolderPath\":\"datahrhcfeqjkac\",\"wildcardFileName\":\"datatnuckojqoxpw\",\"prefix\":\"datavfdosq\",\"fileListPath\":\"dataoyqbpzxushmlti\",\"enablePartitionDiscovery\":\"datacptvkbcykntdzze\",\"partitionRootPath\":\"datazpggsyeydctjnei\",\"deleteFilesAfterCompletion\":\"dataztlzbwbyvjispkgk\",\"modifiedDatetimeStart\":\"datapvbzmyo\",\"modifiedDatetimeEnd\":\"dataxstxsfztlvs\",\"maxConcurrentConnections\":\"datafshhc\",\"disableMetricsCollection\":\"datasowyhxwhdyfgtwx\",\"\":{\"im\":\"databzfiacmwmc\",\"tnolziohdxyuk\":\"datahrfmcjjxxwzdwmju\",\"sffpizef\":\"dataplfwykrpojen\",\"zcevf\":\"datajgblehxpeuahvxf\"}}") + .toObject(AzureBlobStorageReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobStorageReadSettings model = + new AzureBlobStorageReadSettings() + .withMaxConcurrentConnections("datafshhc") + .withDisableMetricsCollection("datasowyhxwhdyfgtwx") + .withRecursive("datan") + .withWildcardFolderPath("datahrhcfeqjkac") + .withWildcardFileName("datatnuckojqoxpw") + .withPrefix("datavfdosq") + .withFileListPath("dataoyqbpzxushmlti") + .withEnablePartitionDiscovery("datacptvkbcykntdzze") + .withPartitionRootPath("datazpggsyeydctjnei") + .withDeleteFilesAfterCompletion("dataztlzbwbyvjispkgk") + .withModifiedDatetimeStart("datapvbzmyo") + .withModifiedDatetimeEnd("dataxstxsfztlvs"); + model = BinaryData.fromObject(model).toObject(AzureBlobStorageReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobStorageWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobStorageWriteSettingsTests.java new file mode 100644 index 000000000000..1dd29e453cd0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureBlobStorageWriteSettingsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureBlobStorageWriteSettings; + +public final class AzureBlobStorageWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureBlobStorageWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"AzureBlobStorageWriteSettings\",\"blockSizeInMB\":\"datanisoorwfdtjpsjwl\",\"maxConcurrentConnections\":\"dataxl\",\"disableMetricsCollection\":\"datazcdrgtuaoouocaf\",\"copyBehavior\":\"datavhjrpbnrolge\",\"\":{\"lbyjahbzbtl\":\"datanenjtxuuwdmrqa\"}}") + .toObject(AzureBlobStorageWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureBlobStorageWriteSettings model = + new AzureBlobStorageWriteSettings() + .withMaxConcurrentConnections("dataxl") + .withDisableMetricsCollection("datazcdrgtuaoouocaf") + .withCopyBehavior("datavhjrpbnrolge") + .withBlockSizeInMB("datanisoorwfdtjpsjwl"); + model = BinaryData.fromObject(model).toObject(AzureBlobStorageWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerCommandActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerCommandActivityTests.java new file mode 100644 index 000000000000..9dfad2d49315 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerCommandActivityTests.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.AzureDataExplorerCommandActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureDataExplorerCommandActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataExplorerCommandActivity model = + BinaryData + .fromString( + "{\"type\":\"AzureDataExplorerCommand\",\"typeProperties\":{\"command\":\"dataxxhbrysnszsehoe\",\"commandTimeout\":\"datawbykrn\"},\"linkedServiceName\":{\"referenceName\":\"bkvzwqgmfhlnqy\",\"parameters\":{\"bsaaxstnziv\":\"datayfncwiyfzu\",\"cxygjhclnyoktc\":\"dataccgtujiwzbzed\"}},\"policy\":{\"timeout\":\"datathjgbrxmxqskem\",\"retry\":\"datajjf\",\"retryIntervalInSeconds\":354823036,\"secureInput\":true,\"secureOutput\":true,\"\":{\"vwalhawoptiq\":\"datacnidubocmjiib\"}},\"name\":\"u\",\"description\":\"vtapcxsm\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"ylrvztaelpux\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Failed\",\"Succeeded\"],\"\":{\"llewe\":\"dataumtnrcvovhyqexu\",\"cdckcpf\":\"datagvqbsyth\"}},{\"activity\":\"mmgfwxthr\",\"dependencyConditions\":[\"Succeeded\"],\"\":{\"ckkbnaseny\":\"datamgosclhj\",\"hgcchzu\":\"datahmwzgfankeoloros\"}},{\"activity\":\"pkhfh\",\"dependencyConditions\":[\"Completed\",\"Failed\"],\"\":{\"yjffpuuyky\":\"datayfkini\",\"yml\":\"databpn\",\"fijvaxuv\":\"datatnnsjc\"}}],\"userProperties\":[{\"name\":\"ptldaaxglxhbn\",\"value\":\"datay\"},{\"name\":\"winle\",\"value\":\"datahtykebtvn\"},{\"name\":\"dcclpbhntoiviue\",\"value\":\"datariehooxqkc\"},{\"name\":\"yydtnl\",\"value\":\"datakyiqjtx\"}],\"\":{\"zsr\":\"datarftidkjotvhivvo\"}}") + .toObject(AzureDataExplorerCommandActivity.class); + Assertions.assertEquals("u", model.name()); + Assertions.assertEquals("vtapcxsm", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("ylrvztaelpux", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("ptldaaxglxhbn", model.userProperties().get(0).name()); + Assertions.assertEquals("bkvzwqgmfhlnqy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(354823036, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataExplorerCommandActivity model = + new AzureDataExplorerCommandActivity() + .withName("u") + .withDescription("vtapcxsm") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ylrvztaelpux") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("mmgfwxthr") + .withDependencyConditions(Arrays.asList(DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("pkhfh") + .withDependencyConditions( + Arrays.asList(DependencyCondition.COMPLETED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("ptldaaxglxhbn").withValue("datay"), + new UserProperty().withName("winle").withValue("datahtykebtvn"), + new UserProperty().withName("dcclpbhntoiviue").withValue("datariehooxqkc"), + new UserProperty().withName("yydtnl").withValue("datakyiqjtx"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("bkvzwqgmfhlnqy") + .withParameters(mapOf("bsaaxstnziv", "datayfncwiyfzu", "cxygjhclnyoktc", "dataccgtujiwzbzed"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datathjgbrxmxqskem") + .withRetry("datajjf") + .withRetryIntervalInSeconds(354823036) + .withSecureInput(true) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withCommand("dataxxhbrysnszsehoe") + .withCommandTimeout("datawbykrn"); + model = BinaryData.fromObject(model).toObject(AzureDataExplorerCommandActivity.class); + Assertions.assertEquals("u", model.name()); + Assertions.assertEquals("vtapcxsm", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("ylrvztaelpux", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("ptldaaxglxhbn", model.userProperties().get(0).name()); + Assertions.assertEquals("bkvzwqgmfhlnqy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(354823036, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerCommandActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerCommandActivityTypePropertiesTests.java new file mode 100644 index 000000000000..d298dd1b6030 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerCommandActivityTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureDataExplorerCommandActivityTypeProperties; + +public final class AzureDataExplorerCommandActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataExplorerCommandActivityTypeProperties model = + BinaryData + .fromString("{\"command\":\"datapfviiw\",\"commandTimeout\":\"dataqp\"}") + .toObject(AzureDataExplorerCommandActivityTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataExplorerCommandActivityTypeProperties model = + new AzureDataExplorerCommandActivityTypeProperties().withCommand("datapfviiw").withCommandTimeout("dataqp"); + model = BinaryData.fromObject(model).toObject(AzureDataExplorerCommandActivityTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..ca598cc54d6a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerDatasetTypePropertiesTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureDataExplorerDatasetTypeProperties; + +public final class AzureDataExplorerDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataExplorerDatasetTypeProperties model = + BinaryData.fromString("{\"table\":\"dataysyajmm\"}").toObject(AzureDataExplorerDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataExplorerDatasetTypeProperties model = + new AzureDataExplorerDatasetTypeProperties().withTable("dataysyajmm"); + model = BinaryData.fromObject(model).toObject(AzureDataExplorerDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerSinkTests.java new file mode 100644 index 000000000000..241dcf6ba55b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerSinkTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDataExplorerSink; + +public final class AzureDataExplorerSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataExplorerSink model = + BinaryData + .fromString( + "{\"type\":\"AzureDataExplorerSink\",\"ingestionMappingName\":\"dataezlqwbgly\",\"ingestionMappingAsJson\":\"dataztt\",\"flushImmediately\":\"datayrwdsnpuo\",\"writeBatchSize\":\"datar\",\"writeBatchTimeout\":\"dataizybpjyp\",\"sinkRetryCount\":\"datatkzghwcywrbmxwls\",\"sinkRetryWait\":\"dataffwf\",\"maxConcurrentConnections\":\"dataiezbmhsqy\",\"disableMetricsCollection\":\"datawbzhafcoayuq\",\"\":{\"yfjtsem\":\"dataghjmmjmmjnx\",\"ocyo\":\"dataidbaykvlrsbrn\",\"mbch\":\"datap\",\"ybugojzcargsxmaw\":\"dataskwaffsjqnjp\"}}") + .toObject(AzureDataExplorerSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataExplorerSink model = + new AzureDataExplorerSink() + .withWriteBatchSize("datar") + .withWriteBatchTimeout("dataizybpjyp") + .withSinkRetryCount("datatkzghwcywrbmxwls") + .withSinkRetryWait("dataffwf") + .withMaxConcurrentConnections("dataiezbmhsqy") + .withDisableMetricsCollection("datawbzhafcoayuq") + .withIngestionMappingName("dataezlqwbgly") + .withIngestionMappingAsJson("dataztt") + .withFlushImmediately("datayrwdsnpuo"); + model = BinaryData.fromObject(model).toObject(AzureDataExplorerSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerSourceTests.java new file mode 100644 index 000000000000..967248cd5597 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerSourceTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDataExplorerSource; + +public final class AzureDataExplorerSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataExplorerSource model = + BinaryData + .fromString( + "{\"type\":\"AzureDataExplorerSource\",\"query\":\"datatasidityvvgxejh\",\"noTruncation\":\"dataswjwbhtawb\",\"queryTimeout\":\"dataybneuzueikadhusg\",\"additionalColumns\":\"databgljcy\",\"sourceRetryCount\":\"datarzxipxhlxxkviyj\",\"sourceRetryWait\":\"dataqyejyavxgm\",\"maxConcurrentConnections\":\"datacnwxkqqxpnj\",\"disableMetricsCollection\":\"datazdahvethn\",\"\":{\"tymbccmwsyfsg\":\"dataggyqlvnhmuutkw\",\"cbjclfbpfd\":\"datak\",\"q\":\"dataatr\",\"bifktnxugiorb\":\"datatuxwtdaz\"}}") + .toObject(AzureDataExplorerSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataExplorerSource model = + new AzureDataExplorerSource() + .withSourceRetryCount("datarzxipxhlxxkviyj") + .withSourceRetryWait("dataqyejyavxgm") + .withMaxConcurrentConnections("datacnwxkqqxpnj") + .withDisableMetricsCollection("datazdahvethn") + .withQuery("datatasidityvvgxejh") + .withNoTruncation("dataswjwbhtawb") + .withQueryTimeout("dataybneuzueikadhusg") + .withAdditionalColumns("databgljcy"); + model = BinaryData.fromObject(model).toObject(AzureDataExplorerSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerTableDatasetTests.java new file mode 100644 index 000000000000..b2f1eb471123 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataExplorerTableDatasetTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDataExplorerTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureDataExplorerTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataExplorerTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureDataExplorerTable\",\"typeProperties\":{\"table\":\"datarwxxqkwargcbgdg\"},\"description\":\"ijiqe\",\"structure\":\"datawqykmvugflh\",\"schema\":\"dataoxu\",\"linkedServiceName\":{\"referenceName\":\"hcnnkvthwtam\",\"parameters\":{\"cocdxvbeqzjd\":\"datagyvxhfmuhkezuucq\"}},\"parameters\":{\"my\":{\"type\":\"Array\",\"defaultValue\":\"datapdwnee\"},\"jrwvnffaofkvfru\":{\"type\":\"Bool\",\"defaultValue\":\"datau\"},\"tvymdqaymqmyrn\":{\"type\":\"Int\",\"defaultValue\":\"datafbvhgykzov\"}},\"annotations\":[\"databqkfnoxhvo\",\"datajdgfkr\"],\"folder\":{\"name\":\"rvpa\"},\"\":{\"ej\":\"datadeex\",\"nxbohpzurn\":\"datagu\",\"oijoxcbpkiwse\":\"dataoytkbeadyfenro\",\"ztdacrqcwkk\":\"datacbtaxdrpanhsxwhx\"}}") + .toObject(AzureDataExplorerTableDataset.class); + Assertions.assertEquals("ijiqe", model.description()); + Assertions.assertEquals("hcnnkvthwtam", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("my").type()); + Assertions.assertEquals("rvpa", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataExplorerTableDataset model = + new AzureDataExplorerTableDataset() + .withDescription("ijiqe") + .withStructure("datawqykmvugflh") + .withSchema("dataoxu") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("hcnnkvthwtam") + .withParameters(mapOf("cocdxvbeqzjd", "datagyvxhfmuhkezuucq"))) + .withParameters( + mapOf( + "my", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datapdwnee"), + "jrwvnffaofkvfru", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datau"), + "tvymdqaymqmyrn", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datafbvhgykzov"))) + .withAnnotations(Arrays.asList("databqkfnoxhvo", "datajdgfkr")) + .withFolder(new DatasetFolder().withName("rvpa")) + .withTable("datarwxxqkwargcbgdg"); + model = BinaryData.fromObject(model).toObject(AzureDataExplorerTableDataset.class); + Assertions.assertEquals("ijiqe", model.description()); + Assertions.assertEquals("hcnnkvthwtam", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("my").type()); + Assertions.assertEquals("rvpa", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreDatasetTests.java new file mode 100644 index 000000000000..fa79585b35de --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreDatasetTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDataLakeStoreDataset; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureDataLakeStoreDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataLakeStoreDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureDataLakeStoreFile\",\"typeProperties\":{\"folderPath\":\"datablwal\",\"fileName\":\"datassnqe\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"datatbptgcsma\",\"deserializer\":\"dataxrwqfmd\",\"\":{\"psibxovuqo\":\"datavtamqwzmnobfew\",\"qnzjcyqqz\":\"datajrkblndyclwgycv\",\"dpisjdl\":\"dataembtbwnalb\",\"eopsk\":\"dataajvmvvlooubsfxip\"}},\"compression\":{\"type\":\"datacjomlupf\",\"level\":\"datausjcd\",\"\":{\"j\":\"datalgdwzrgdqyx\",\"cwwsj\":\"datalgrcavqcwyzoqzkm\"}}},\"description\":\"iixepbntqqwwgfgs\",\"structure\":\"datailefej\",\"schema\":\"datawrznequ\",\"linkedServiceName\":{\"referenceName\":\"ynttwknhajk\",\"parameters\":{\"cydi\":\"datayogjmqjh\",\"vjbssfcriqxz\":\"datanm\",\"py\":\"dataxtdlxwmvcdkucp\",\"pnr\":\"datafrwrgorogeuvmkr\"}},\"parameters\":{\"snqpljpete\":{\"type\":\"Object\",\"defaultValue\":\"datalzof\"},\"ub\":{\"type\":\"Array\",\"defaultValue\":\"dataikelpmwgr\"},\"gjzscueza\":{\"type\":\"String\",\"defaultValue\":\"datahvo\"}},\"annotations\":[\"datadfwgqjhewcffrx\",\"datagezkhzpriqisse\",\"dataerrusyzaiv\",\"datapsjnpck\"],\"folder\":{\"name\":\"jy\"},\"\":{\"jarsbbdddwok\":\"datanbdawsaoplvvmnbk\"}}") + .toObject(AzureDataLakeStoreDataset.class); + Assertions.assertEquals("iixepbntqqwwgfgs", model.description()); + Assertions.assertEquals("ynttwknhajk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("snqpljpete").type()); + Assertions.assertEquals("jy", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataLakeStoreDataset model = + new AzureDataLakeStoreDataset() + .withDescription("iixepbntqqwwgfgs") + .withStructure("datailefej") + .withSchema("datawrznequ") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ynttwknhajk") + .withParameters( + mapOf( + "cydi", + "datayogjmqjh", + "vjbssfcriqxz", + "datanm", + "py", + "dataxtdlxwmvcdkucp", + "pnr", + "datafrwrgorogeuvmkr"))) + .withParameters( + mapOf( + "snqpljpete", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datalzof"), + "ub", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataikelpmwgr"), + "gjzscueza", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datahvo"))) + .withAnnotations( + Arrays.asList("datadfwgqjhewcffrx", "datagezkhzpriqisse", "dataerrusyzaiv", "datapsjnpck")) + .withFolder(new DatasetFolder().withName("jy")) + .withFolderPath("datablwal") + .withFileName("datassnqe") + .withFormat( + new DatasetStorageFormat() + .withSerializer("datatbptgcsma") + .withDeserializer("dataxrwqfmd") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withCompression( + new DatasetCompression() + .withType("datacjomlupf") + .withLevel("datausjcd") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(AzureDataLakeStoreDataset.class); + Assertions.assertEquals("iixepbntqqwwgfgs", model.description()); + Assertions.assertEquals("ynttwknhajk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("snqpljpete").type()); + Assertions.assertEquals("jy", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..1a1f85b45c03 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreDatasetTypePropertiesTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureDataLakeStoreDatasetTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import java.util.HashMap; +import java.util.Map; + +public final class AzureDataLakeStoreDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataLakeStoreDatasetTypeProperties model = + BinaryData + .fromString( + "{\"folderPath\":\"dataailxqkdyqjvzvcg\",\"fileName\":\"dataspzesfkqqxuhvz\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"datarouszxacdwukokgo\",\"deserializer\":\"dataj\",\"\":{\"h\":\"datatubcmu\",\"bcuufkrfn\":\"databtzvxxv\",\"wwp\":\"datacnihkswxmfurqmw\"}},\"compression\":{\"type\":\"dataum\",\"level\":\"dataahbqsvnkxm\",\"\":{\"edr\":\"datau\"}}}") + .toObject(AzureDataLakeStoreDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataLakeStoreDatasetTypeProperties model = + new AzureDataLakeStoreDatasetTypeProperties() + .withFolderPath("dataailxqkdyqjvzvcg") + .withFileName("dataspzesfkqqxuhvz") + .withFormat( + new DatasetStorageFormat() + .withSerializer("datarouszxacdwukokgo") + .withDeserializer("dataj") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withCompression( + new DatasetCompression() + .withType("dataum") + .withLevel("dataahbqsvnkxm") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(AzureDataLakeStoreDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreLocationTests.java new file mode 100644 index 000000000000..23c7f388306f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreLocationTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDataLakeStoreLocation; + +public final class AzureDataLakeStoreLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataLakeStoreLocation model = + BinaryData + .fromString( + "{\"type\":\"AzureDataLakeStoreLocation\",\"folderPath\":\"datapoyryefqmwovyzt\",\"fileName\":\"datanomfpbjceegvyiez\",\"\":{\"ehyh\":\"datatnjillukk\",\"fvulxfaryr\":\"datamjodu\",\"jqwahoyi\":\"datajlgdez\",\"ovbooqbmdqrxy\":\"dataaxqvjweiwtczkddn\"}}") + .toObject(AzureDataLakeStoreLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataLakeStoreLocation model = + new AzureDataLakeStoreLocation().withFolderPath("datapoyryefqmwovyzt").withFileName("datanomfpbjceegvyiez"); + model = BinaryData.fromObject(model).toObject(AzureDataLakeStoreLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreReadSettingsTests.java new file mode 100644 index 000000000000..49512344ab7b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreReadSettingsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDataLakeStoreReadSettings; + +public final class AzureDataLakeStoreReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataLakeStoreReadSettings model = + BinaryData + .fromString( + "{\"type\":\"AzureDataLakeStoreReadSettings\",\"recursive\":\"dataev\",\"wildcardFolderPath\":\"datauvupdsafqaghw\",\"wildcardFileName\":\"datamecqyi\",\"fileListPath\":\"datajmvvkodkqffhuxo\",\"listAfter\":\"datatgzvzcfmwfogj\",\"listBefore\":\"datamtbpnhjo\",\"enablePartitionDiscovery\":\"datavfz\",\"partitionRootPath\":\"datakrmptapyqees\",\"deleteFilesAfterCompletion\":\"datanpixhulfjl\",\"modifiedDatetimeStart\":\"datahv\",\"modifiedDatetimeEnd\":\"datakwrvtflotjizvi\",\"maxConcurrentConnections\":\"dataixlvnwznfx\",\"disableMetricsCollection\":\"dataylsl\",\"\":{\"llatbld\":\"datatrwkpelyglfwma\",\"nithxnainssv\":\"datacfh\",\"bmyghqtthsb\":\"datakzslylioguwshrmc\"}}") + .toObject(AzureDataLakeStoreReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataLakeStoreReadSettings model = + new AzureDataLakeStoreReadSettings() + .withMaxConcurrentConnections("dataixlvnwznfx") + .withDisableMetricsCollection("dataylsl") + .withRecursive("dataev") + .withWildcardFolderPath("datauvupdsafqaghw") + .withWildcardFileName("datamecqyi") + .withFileListPath("datajmvvkodkqffhuxo") + .withListAfter("datatgzvzcfmwfogj") + .withListBefore("datamtbpnhjo") + .withEnablePartitionDiscovery("datavfz") + .withPartitionRootPath("datakrmptapyqees") + .withDeleteFilesAfterCompletion("datanpixhulfjl") + .withModifiedDatetimeStart("datahv") + .withModifiedDatetimeEnd("datakwrvtflotjizvi"); + model = BinaryData.fromObject(model).toObject(AzureDataLakeStoreReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreSinkTests.java new file mode 100644 index 000000000000..499482abf467 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreSinkTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDataLakeStoreSink; + +public final class AzureDataLakeStoreSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataLakeStoreSink model = + BinaryData + .fromString( + "{\"type\":\"AzureDataLakeStoreSink\",\"copyBehavior\":\"datayipjzgmxqaupy\",\"enableAdlsSingleFileParallel\":\"datagoyp\",\"writeBatchSize\":\"dataooyyfysn\",\"writeBatchTimeout\":\"datajnl\",\"sinkRetryCount\":\"datacmhonojese\",\"sinkRetryWait\":\"dataxel\",\"maxConcurrentConnections\":\"dataxwmpziy\",\"disableMetricsCollection\":\"datasjswedkfof\",\"\":{\"utzlvx\":\"datapunwp\",\"vddwgozr\":\"dataolvedzrjkrpor\"}}") + .toObject(AzureDataLakeStoreSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataLakeStoreSink model = + new AzureDataLakeStoreSink() + .withWriteBatchSize("dataooyyfysn") + .withWriteBatchTimeout("datajnl") + .withSinkRetryCount("datacmhonojese") + .withSinkRetryWait("dataxel") + .withMaxConcurrentConnections("dataxwmpziy") + .withDisableMetricsCollection("datasjswedkfof") + .withCopyBehavior("datayipjzgmxqaupy") + .withEnableAdlsSingleFileParallel("datagoyp"); + model = BinaryData.fromObject(model).toObject(AzureDataLakeStoreSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreSourceTests.java new file mode 100644 index 000000000000..e35352c7789c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreSourceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDataLakeStoreSource; + +public final class AzureDataLakeStoreSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataLakeStoreSource model = + BinaryData + .fromString( + "{\"type\":\"AzureDataLakeStoreSource\",\"recursive\":\"dataphgimijzhrbsx\",\"sourceRetryCount\":\"dataublouelf\",\"sourceRetryWait\":\"datafb\",\"maxConcurrentConnections\":\"datablpdwckmnpzub\",\"disableMetricsCollection\":\"datad\",\"\":{\"bsh\":\"datafjrgngc\"}}") + .toObject(AzureDataLakeStoreSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataLakeStoreSource model = + new AzureDataLakeStoreSource() + .withSourceRetryCount("dataublouelf") + .withSourceRetryWait("datafb") + .withMaxConcurrentConnections("datablpdwckmnpzub") + .withDisableMetricsCollection("datad") + .withRecursive("dataphgimijzhrbsx"); + model = BinaryData.fromObject(model).toObject(AzureDataLakeStoreSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreWriteSettingsTests.java new file mode 100644 index 000000000000..d779ae4ede07 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDataLakeStoreWriteSettingsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDataLakeStoreWriteSettings; + +public final class AzureDataLakeStoreWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDataLakeStoreWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"AzureDataLakeStoreWriteSettings\",\"expiryDateTime\":\"datakoxqbozezx\",\"maxConcurrentConnections\":\"datainrguk\",\"disableMetricsCollection\":\"databov\",\"copyBehavior\":\"dataltqlqufkrnrbnjkc\",\"\":{\"qvv\":\"datazqlyputawdmdikuf\",\"hvfojcvnh\":\"dataujzofyldxk\",\"kysg\":\"dataebuiy\"}}") + .toObject(AzureDataLakeStoreWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDataLakeStoreWriteSettings model = + new AzureDataLakeStoreWriteSettings() + .withMaxConcurrentConnections("datainrguk") + .withDisableMetricsCollection("databov") + .withCopyBehavior("dataltqlqufkrnrbnjkc") + .withExpiryDateTime("datakoxqbozezx"); + model = BinaryData.fromObject(model).toObject(AzureDataLakeStoreWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeDatasetTests.java new file mode 100644 index 000000000000..9c48caad819e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeDatasetTests.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDatabricksDeltaLakeDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureDatabricksDeltaLakeDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDatabricksDeltaLakeDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureDatabricksDeltaLakeDataset\",\"typeProperties\":{\"table\":\"dataspllitxrrgkw\",\"database\":\"dataoyhqoivxcodwkwo\"},\"description\":\"cachhsizfuew\",\"structure\":\"datawfiikqcdnzsfiu\",\"schema\":\"dataneoodmcrxlyz\",\"linkedServiceName\":{\"referenceName\":\"ah\",\"parameters\":{\"brnlsyiaan\":\"datafakrxjjwnbrmdw\",\"lpphcstmrycpana\":\"datastcjhat\",\"izrinlpxngzzxqb\":\"datafa\",\"jkpi\":\"dataqnzmzctbx\"}},\"parameters\":{\"qmbinpxmiwt\":{\"type\":\"Bool\",\"defaultValue\":\"databdozwbskueafz\"},\"abux\":{\"type\":\"Array\",\"defaultValue\":\"datafpvrdukcdnzox\"}},\"annotations\":[\"databawshramqsugq\"],\"folder\":{\"name\":\"madfztofx\"},\"\":{\"feiqb\":\"dataauuagwayfmcerf\",\"hzwj\":\"datas\"}}") + .toObject(AzureDatabricksDeltaLakeDataset.class); + Assertions.assertEquals("cachhsizfuew", model.description()); + Assertions.assertEquals("ah", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("qmbinpxmiwt").type()); + Assertions.assertEquals("madfztofx", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDatabricksDeltaLakeDataset model = + new AzureDatabricksDeltaLakeDataset() + .withDescription("cachhsizfuew") + .withStructure("datawfiikqcdnzsfiu") + .withSchema("dataneoodmcrxlyz") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ah") + .withParameters( + mapOf( + "brnlsyiaan", + "datafakrxjjwnbrmdw", + "lpphcstmrycpana", + "datastcjhat", + "izrinlpxngzzxqb", + "datafa", + "jkpi", + "dataqnzmzctbx"))) + .withParameters( + mapOf( + "qmbinpxmiwt", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("databdozwbskueafz"), + "abux", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datafpvrdukcdnzox"))) + .withAnnotations(Arrays.asList("databawshramqsugq")) + .withFolder(new DatasetFolder().withName("madfztofx")) + .withTable("dataspllitxrrgkw") + .withDatabase("dataoyhqoivxcodwkwo"); + model = BinaryData.fromObject(model).toObject(AzureDatabricksDeltaLakeDataset.class); + Assertions.assertEquals("cachhsizfuew", model.description()); + Assertions.assertEquals("ah", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("qmbinpxmiwt").type()); + Assertions.assertEquals("madfztofx", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..698757acd1ab --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeDatasetTypePropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureDatabricksDeltaLakeDatasetTypeProperties; + +public final class AzureDatabricksDeltaLakeDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDatabricksDeltaLakeDatasetTypeProperties model = + BinaryData + .fromString("{\"table\":\"datassvnonijcqcjo\",\"database\":\"datajkugpdqqbt\"}") + .toObject(AzureDatabricksDeltaLakeDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDatabricksDeltaLakeDatasetTypeProperties model = + new AzureDatabricksDeltaLakeDatasetTypeProperties() + .withTable("datassvnonijcqcjo") + .withDatabase("datajkugpdqqbt"); + model = BinaryData.fromObject(model).toObject(AzureDatabricksDeltaLakeDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeExportCommandTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeExportCommandTests.java new file mode 100644 index 000000000000..e5d5d6d7b569 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeExportCommandTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDatabricksDeltaLakeExportCommand; + +public final class AzureDatabricksDeltaLakeExportCommandTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDatabricksDeltaLakeExportCommand model = + BinaryData + .fromString( + "{\"type\":\"AzureDatabricksDeltaLakeExportCommand\",\"dateFormat\":\"dataudk\",\"timestampFormat\":\"datasgop\",\"\":{\"rutoud\":\"datamn\",\"eyavldovpwrq\":\"datamdayqkgixfnr\",\"okplzliizbwfjumu\":\"dataf\",\"nchah\":\"datahfqd\"}}") + .toObject(AzureDatabricksDeltaLakeExportCommand.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDatabricksDeltaLakeExportCommand model = + new AzureDatabricksDeltaLakeExportCommand().withDateFormat("dataudk").withTimestampFormat("datasgop"); + model = BinaryData.fromObject(model).toObject(AzureDatabricksDeltaLakeExportCommand.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeImportCommandTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeImportCommandTests.java new file mode 100644 index 000000000000..ba528c113a95 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeImportCommandTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDatabricksDeltaLakeImportCommand; + +public final class AzureDatabricksDeltaLakeImportCommandTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDatabricksDeltaLakeImportCommand model = + BinaryData + .fromString( + "{\"type\":\"AzureDatabricksDeltaLakeImportCommand\",\"dateFormat\":\"datahyzez\",\"timestampFormat\":\"datavkzrvy\",\"\":{\"oelyjduzapn\":\"dataqgyui\",\"odprrqcagl\":\"datapo\"}}") + .toObject(AzureDatabricksDeltaLakeImportCommand.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDatabricksDeltaLakeImportCommand model = + new AzureDatabricksDeltaLakeImportCommand().withDateFormat("datahyzez").withTimestampFormat("datavkzrvy"); + model = BinaryData.fromObject(model).toObject(AzureDatabricksDeltaLakeImportCommand.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeSinkTests.java new file mode 100644 index 000000000000..365ee28a6396 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeSinkTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDatabricksDeltaLakeImportCommand; +import com.azure.resourcemanager.datafactory.models.AzureDatabricksDeltaLakeSink; + +public final class AzureDatabricksDeltaLakeSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDatabricksDeltaLakeSink model = + BinaryData + .fromString( + "{\"type\":\"AzureDatabricksDeltaLakeSink\",\"preCopyScript\":\"datanrptrqcap\",\"importSettings\":{\"type\":\"AzureDatabricksDeltaLakeImportCommand\",\"dateFormat\":\"datavowzbkrbqp\",\"timestampFormat\":\"datapujywjmohqzzkp\",\"\":{\"tjgfpqwwugfwpv\":\"datacamseiauveen\",\"ehdydyybz\":\"datacewbqaibkyeysf\"}},\"writeBatchSize\":\"dataylhdxcjqdvci\",\"writeBatchTimeout\":\"datazkui\",\"sinkRetryCount\":\"datavghvecjhbttmhne\",\"sinkRetryWait\":\"datarzieyxxidab\",\"maxConcurrentConnections\":\"dataakkn\",\"disableMetricsCollection\":\"datacseqo\",\"\":{\"jqtdjeydmeui\":\"datasfcryqrr\"}}") + .toObject(AzureDatabricksDeltaLakeSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDatabricksDeltaLakeSink model = + new AzureDatabricksDeltaLakeSink() + .withWriteBatchSize("dataylhdxcjqdvci") + .withWriteBatchTimeout("datazkui") + .withSinkRetryCount("datavghvecjhbttmhne") + .withSinkRetryWait("datarzieyxxidab") + .withMaxConcurrentConnections("dataakkn") + .withDisableMetricsCollection("datacseqo") + .withPreCopyScript("datanrptrqcap") + .withImportSettings( + new AzureDatabricksDeltaLakeImportCommand() + .withDateFormat("datavowzbkrbqp") + .withTimestampFormat("datapujywjmohqzzkp")); + model = BinaryData.fromObject(model).toObject(AzureDatabricksDeltaLakeSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeSourceTests.java new file mode 100644 index 000000000000..c2cc4a932b7e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureDatabricksDeltaLakeSourceTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureDatabricksDeltaLakeExportCommand; +import com.azure.resourcemanager.datafactory.models.AzureDatabricksDeltaLakeSource; + +public final class AzureDatabricksDeltaLakeSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureDatabricksDeltaLakeSource model = + BinaryData + .fromString( + "{\"type\":\"AzureDatabricksDeltaLakeSource\",\"query\":\"datal\",\"exportSettings\":{\"type\":\"AzureDatabricksDeltaLakeExportCommand\",\"dateFormat\":\"datatcljopivtwxvc\",\"timestampFormat\":\"datahokkcjjnqx\",\"\":{\"cxjmap\":\"dataayajdf\",\"xcgjuc\":\"datafbzbxeqzvokfrhfa\",\"efsrxqscdbbwej\":\"datauaxdulv\",\"lfscosf\":\"datamksgeqpai\"}},\"sourceRetryCount\":\"dataotvneteehndfpflf\",\"sourceRetryWait\":\"datagfnaoehkgpkss\",\"maxConcurrentConnections\":\"datawkwxdgcfcfkyyrj\",\"disableMetricsCollection\":\"datahslrbwwkbyw\",\"\":{\"sxj\":\"datasodo\",\"oggwc\":\"datakydsquhuixq\",\"dfahky\":\"datadmxhuw\"}}") + .toObject(AzureDatabricksDeltaLakeSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureDatabricksDeltaLakeSource model = + new AzureDatabricksDeltaLakeSource() + .withSourceRetryCount("dataotvneteehndfpflf") + .withSourceRetryWait("datagfnaoehkgpkss") + .withMaxConcurrentConnections("datawkwxdgcfcfkyyrj") + .withDisableMetricsCollection("datahslrbwwkbyw") + .withQuery("datal") + .withExportSettings( + new AzureDatabricksDeltaLakeExportCommand() + .withDateFormat("datatcljopivtwxvc") + .withTimestampFormat("datahokkcjjnqx")); + model = BinaryData.fromObject(model).toObject(AzureDatabricksDeltaLakeSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageLocationTests.java new file mode 100644 index 000000000000..f784b5b6bb91 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageLocationTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureFileStorageLocation; + +public final class AzureFileStorageLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureFileStorageLocation model = + BinaryData + .fromString( + "{\"type\":\"AzureFileStorageLocation\",\"folderPath\":\"datahuioaeoc\",\"fileName\":\"datajtfeyvkbdgddkr\",\"\":{\"uzy\":\"datacxbeuuqutkzwtjww\",\"deg\":\"dataijcxfno\",\"uckcatuqbhpow\":\"datadydhqkkkb\"}}") + .toObject(AzureFileStorageLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureFileStorageLocation model = + new AzureFileStorageLocation().withFolderPath("datahuioaeoc").withFileName("datajtfeyvkbdgddkr"); + model = BinaryData.fromObject(model).toObject(AzureFileStorageLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageReadSettingsTests.java new file mode 100644 index 000000000000..014a2408cc9f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageReadSettingsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureFileStorageReadSettings; + +public final class AzureFileStorageReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureFileStorageReadSettings model = + BinaryData + .fromString( + "{\"type\":\"AzureFileStorageReadSettings\",\"recursive\":\"datacpqboubeh\",\"wildcardFolderPath\":\"datapyiafsuuvoqq\",\"wildcardFileName\":\"dataoinxkothrnlgnwwj\",\"prefix\":\"datagpwdczzkz\",\"fileListPath\":\"datapjnhhiofcnyzqz\",\"enablePartitionDiscovery\":\"dataddngq\",\"partitionRootPath\":\"datallegucemags\",\"deleteFilesAfterCompletion\":\"datajwwpzq\",\"modifiedDatetimeStart\":\"datahlajmikqvnrj\",\"modifiedDatetimeEnd\":\"datao\",\"maxConcurrentConnections\":\"datagtzrgyrldoa\",\"disableMetricsCollection\":\"datadglzdk\",\"\":{\"ederkvbdv\":\"dataj\",\"kxau\":\"dataa\",\"ztghdwrvffjpw\":\"datajr\",\"cplxid\":\"datazlfyftgae\"}}") + .toObject(AzureFileStorageReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureFileStorageReadSettings model = + new AzureFileStorageReadSettings() + .withMaxConcurrentConnections("datagtzrgyrldoa") + .withDisableMetricsCollection("datadglzdk") + .withRecursive("datacpqboubeh") + .withWildcardFolderPath("datapyiafsuuvoqq") + .withWildcardFileName("dataoinxkothrnlgnwwj") + .withPrefix("datagpwdczzkz") + .withFileListPath("datapjnhhiofcnyzqz") + .withEnablePartitionDiscovery("dataddngq") + .withPartitionRootPath("datallegucemags") + .withDeleteFilesAfterCompletion("datajwwpzq") + .withModifiedDatetimeStart("datahlajmikqvnrj") + .withModifiedDatetimeEnd("datao"); + model = BinaryData.fromObject(model).toObject(AzureFileStorageReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageWriteSettingsTests.java new file mode 100644 index 000000000000..781add88e23b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFileStorageWriteSettingsTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureFileStorageWriteSettings; + +public final class AzureFileStorageWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureFileStorageWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"AzureFileStorageWriteSettings\",\"maxConcurrentConnections\":\"datagmjrvrsq\",\"disableMetricsCollection\":\"datacozrwrylcttvxkx\",\"copyBehavior\":\"datafpvvqwvvnx\",\"\":{\"jbl\":\"dataa\",\"tsztxoswvfrym\":\"dataqwwtevfeugc\",\"gkbaxygwvtkrq\":\"dataqfksqfcxdleohys\"}}") + .toObject(AzureFileStorageWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureFileStorageWriteSettings model = + new AzureFileStorageWriteSettings() + .withMaxConcurrentConnections("datagmjrvrsq") + .withDisableMetricsCollection("datacozrwrylcttvxkx") + .withCopyBehavior("datafpvvqwvvnx"); + model = BinaryData.fromObject(model).toObject(AzureFileStorageWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFunctionActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFunctionActivityTests.java new file mode 100644 index 000000000000..93ded225fdab --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFunctionActivityTests.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.AzureFunctionActivity; +import com.azure.resourcemanager.datafactory.models.AzureFunctionActivityMethod; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureFunctionActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureFunctionActivity model = + BinaryData + .fromString( + "{\"type\":\"AzureFunctionActivity\",\"typeProperties\":{\"method\":\"HEAD\",\"functionName\":\"dataxenmuev\",\"headers\":\"datassclgolbpw\",\"body\":\"datazdionlgn\"},\"linkedServiceName\":{\"referenceName\":\"pk\",\"parameters\":{\"xndrhlbxrqbicj\":\"datafdtzskvpq\",\"poczxmwbk\":\"dataaafvxxiizkehf\",\"inhqpq\":\"datawihbyufm\",\"huxzdgoto\":\"dataowxd\"}},\"policy\":{\"timeout\":\"dataduirjqxknaeuhxnp\",\"retry\":\"datadjaeqaolfy\",\"retryIntervalInSeconds\":900983791,\"secureInput\":false,\"secureOutput\":true,\"\":{\"mjwgrwvlzb\":\"dataaxtbn\",\"tieybi\":\"datafmhz\",\"et\":\"dataitgx\"}},\"name\":\"wloo\",\"description\":\"gkwabzr\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"ii\",\"dependencyConditions\":[\"Completed\",\"Failed\"],\"\":{\"kuzlfnbz\":\"dataez\",\"vckyhncqyogv\":\"datakwoajbkw\",\"tnx\":\"datapxs\",\"kovgxamhmqe\":\"datagwxmqyhtlnnpfta\"}},{\"activity\":\"yoylcwzkcreufdp\",\"dependencyConditions\":[\"Failed\",\"Completed\",\"Failed\"],\"\":{\"smiaru\":\"datahrpxsxyba\",\"yvxjelsjhgrvytlu\":\"databotqzypvcob\",\"elawdbkezfko\":\"datakhiycddonqikujjd\"}},{\"activity\":\"voszgcy\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Succeeded\"],\"\":{\"j\":\"dataqwvvferlqhfzzqqs\",\"skjqejkm\":\"datashwxy\",\"utcyjjbdgfrl\":\"datatwftlhsmtkxzio\",\"egqvusffzvpwzvh\":\"datah\"}}],\"userProperties\":[{\"name\":\"rvmpiw\",\"value\":\"dataoorrnssthninza\"},{\"name\":\"dmnc\",\"value\":\"dataltrxwab\"},{\"name\":\"d\",\"value\":\"dataclqgteoepdpx\"}],\"\":{\"qikeamymalvoy\":\"dataqwfpqixomonq\"}}") + .toObject(AzureFunctionActivity.class); + Assertions.assertEquals("wloo", model.name()); + Assertions.assertEquals("gkwabzr", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("ii", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("rvmpiw", model.userProperties().get(0).name()); + Assertions.assertEquals("pk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(900983791, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals(AzureFunctionActivityMethod.HEAD, model.method()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureFunctionActivity model = + new AzureFunctionActivity() + .withName("wloo") + .withDescription("gkwabzr") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ii") + .withDependencyConditions( + Arrays.asList(DependencyCondition.COMPLETED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("yoylcwzkcreufdp") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("voszgcy") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("rvmpiw").withValue("dataoorrnssthninza"), + new UserProperty().withName("dmnc").withValue("dataltrxwab"), + new UserProperty().withName("d").withValue("dataclqgteoepdpx"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("pk") + .withParameters( + mapOf( + "xndrhlbxrqbicj", + "datafdtzskvpq", + "poczxmwbk", + "dataaafvxxiizkehf", + "inhqpq", + "datawihbyufm", + "huxzdgoto", + "dataowxd"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("dataduirjqxknaeuhxnp") + .withRetry("datadjaeqaolfy") + .withRetryIntervalInSeconds(900983791) + .withSecureInput(false) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withMethod(AzureFunctionActivityMethod.HEAD) + .withFunctionName("dataxenmuev") + .withHeaders("datassclgolbpw") + .withBody("datazdionlgn"); + model = BinaryData.fromObject(model).toObject(AzureFunctionActivity.class); + Assertions.assertEquals("wloo", model.name()); + Assertions.assertEquals("gkwabzr", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("ii", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("rvmpiw", model.userProperties().get(0).name()); + Assertions.assertEquals("pk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(900983791, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals(AzureFunctionActivityMethod.HEAD, model.method()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFunctionActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFunctionActivityTypePropertiesTests.java new file mode 100644 index 000000000000..2729fce2e4c5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureFunctionActivityTypePropertiesTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureFunctionActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.AzureFunctionActivityMethod; +import org.junit.jupiter.api.Assertions; + +public final class AzureFunctionActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureFunctionActivityTypeProperties model = + BinaryData + .fromString( + "{\"method\":\"DELETE\",\"functionName\":\"datag\",\"headers\":\"dataccccccojnljz\",\"body\":\"dataevmzpoilh\"}") + .toObject(AzureFunctionActivityTypeProperties.class); + Assertions.assertEquals(AzureFunctionActivityMethod.DELETE, model.method()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureFunctionActivityTypeProperties model = + new AzureFunctionActivityTypeProperties() + .withMethod(AzureFunctionActivityMethod.DELETE) + .withFunctionName("datag") + .withHeaders("dataccccccojnljz") + .withBody("dataevmzpoilh"); + model = BinaryData.fromObject(model).toObject(AzureFunctionActivityTypeProperties.class); + Assertions.assertEquals(AzureFunctionActivityMethod.DELETE, model.method()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLBatchExecutionActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLBatchExecutionActivityTests.java new file mode 100644 index 000000000000..55b90014a7be --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLBatchExecutionActivityTests.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.AzureMLBatchExecutionActivity; +import com.azure.resourcemanager.datafactory.models.AzureMLWebServiceFile; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureMLBatchExecutionActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMLBatchExecutionActivity model = + BinaryData + .fromString( + "{\"type\":\"AzureMLBatchExecution\",\"typeProperties\":{\"globalParameters\":{\"zhyceteidf\":\"datangiaadgx\",\"ikyn\":\"dataofmcnnicmlomlnpr\"},\"webServiceOutputs\":{\"c\":{\"filePath\":\"datagquphqnuitumxhve\",\"linkedServiceName\":{\"referenceName\":\"ogabcwvibjfkc\",\"parameters\":{\"utjdmd\":\"datan\",\"qehgrjgvrawjom\":\"datatbdtrqiuohijjlax\",\"dwfyagvhe\":\"datagb\",\"ndapxxgvcsvtf\":\"dataptcuqzdwpcupejzo\"}}}},\"webServiceInputs\":{\"ixxiukghxde\":{\"filePath\":\"datateexapfypdfie\",\"linkedServiceName\":{\"referenceName\":\"utcedeygsrrg\",\"parameters\":{\"wo\":\"dataaqyesahvowlib\",\"okkagkaitihncysa\":\"datadwzzacyrkc\",\"ora\":\"datajlq\",\"ajlptydvebipkeo\":\"datatbiskkceb\"}}},\"gpqxiyllamdz\":{\"filePath\":\"dataqptvxibpzhkn\",\"linkedServiceName\":{\"referenceName\":\"uevzqawjnwj\",\"parameters\":{\"sjghfaldxsd\":\"dataubpfe\",\"jseftvwu\":\"datalbbp\",\"naqyeswinoecwabu\":\"datafmakn\",\"eqayvkmp\":\"dataqflwskb\"}}},\"glimacztkypyvz\":{\"filePath\":\"datazjrlm\",\"linkedServiceName\":{\"referenceName\":\"dboesxpc\",\"parameters\":{\"tbd\":\"databpahbcyggflos\",\"bd\":\"datapydc\"}}}}},\"linkedServiceName\":{\"referenceName\":\"h\",\"parameters\":{\"xdyyo\":\"datarcum\",\"vuemjcjeja\":\"databbtwpkg\"}},\"policy\":{\"timeout\":\"datavxumtxuvdotei\",\"retry\":\"datawrmdqqg\",\"retryIntervalInSeconds\":1560089068,\"secureInput\":false,\"secureOutput\":false,\"\":{\"yfszluzmzgat\":\"dataym\",\"ckmcukzwzgio\":\"dataagroejsaer\",\"iwbvyraazsc\":\"datazrxgqxddvuiu\",\"xmkmybo\":\"dataikjyjcshmtpdvu\"}},\"name\":\"ax\",\"description\":\"ckfivi\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"dqzg\",\"dependencyConditions\":[\"Failed\",\"Skipped\",\"Completed\"],\"\":{\"y\":\"datafraohiyeyfsvuy\"}}],\"userProperties\":[{\"name\":\"zpjnakqcsgoozyxu\",\"value\":\"dataieitp\"},{\"name\":\"kjyjhkrk\",\"value\":\"dataznifpxiqpjnqyylk\"},{\"name\":\"bkljj\",\"value\":\"datauirmcupbehqbmhqi\"}],\"\":{\"ocvctmpxnbnhogb\":\"datadhoagcu\",\"efgett\":\"datahaw\",\"kbvhd\":\"datazlokttpmbxn\"}}") + .toObject(AzureMLBatchExecutionActivity.class); + Assertions.assertEquals("ax", model.name()); + Assertions.assertEquals("ckfivi", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("dqzg", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("zpjnakqcsgoozyxu", model.userProperties().get(0).name()); + Assertions.assertEquals("h", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1560089068, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions + .assertEquals("ogabcwvibjfkc", model.webServiceOutputs().get("c").linkedServiceName().referenceName()); + Assertions + .assertEquals( + "utcedeygsrrg", model.webServiceInputs().get("ixxiukghxde").linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMLBatchExecutionActivity model = + new AzureMLBatchExecutionActivity() + .withName("ax") + .withDescription("ckfivi") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("dqzg") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("zpjnakqcsgoozyxu").withValue("dataieitp"), + new UserProperty().withName("kjyjhkrk").withValue("dataznifpxiqpjnqyylk"), + new UserProperty().withName("bkljj").withValue("datauirmcupbehqbmhqi"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("h") + .withParameters(mapOf("xdyyo", "datarcum", "vuemjcjeja", "databbtwpkg"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datavxumtxuvdotei") + .withRetry("datawrmdqqg") + .withRetryIntervalInSeconds(1560089068) + .withSecureInput(false) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withGlobalParameters(mapOf("zhyceteidf", "datangiaadgx", "ikyn", "dataofmcnnicmlomlnpr")) + .withWebServiceOutputs( + mapOf( + "c", + new AzureMLWebServiceFile() + .withFilePath("datagquphqnuitumxhve") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ogabcwvibjfkc") + .withParameters( + mapOf( + "utjdmd", + "datan", + "qehgrjgvrawjom", + "datatbdtrqiuohijjlax", + "dwfyagvhe", + "datagb", + "ndapxxgvcsvtf", + "dataptcuqzdwpcupejzo"))))) + .withWebServiceInputs( + mapOf( + "ixxiukghxde", + new AzureMLWebServiceFile() + .withFilePath("datateexapfypdfie") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("utcedeygsrrg") + .withParameters( + mapOf( + "wo", + "dataaqyesahvowlib", + "okkagkaitihncysa", + "datadwzzacyrkc", + "ora", + "datajlq", + "ajlptydvebipkeo", + "datatbiskkceb"))), + "gpqxiyllamdz", + new AzureMLWebServiceFile() + .withFilePath("dataqptvxibpzhkn") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("uevzqawjnwj") + .withParameters( + mapOf( + "sjghfaldxsd", + "dataubpfe", + "jseftvwu", + "datalbbp", + "naqyeswinoecwabu", + "datafmakn", + "eqayvkmp", + "dataqflwskb"))), + "glimacztkypyvz", + new AzureMLWebServiceFile() + .withFilePath("datazjrlm") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("dboesxpc") + .withParameters(mapOf("tbd", "databpahbcyggflos", "bd", "datapydc"))))); + model = BinaryData.fromObject(model).toObject(AzureMLBatchExecutionActivity.class); + Assertions.assertEquals("ax", model.name()); + Assertions.assertEquals("ckfivi", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("dqzg", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("zpjnakqcsgoozyxu", model.userProperties().get(0).name()); + Assertions.assertEquals("h", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1560089068, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions + .assertEquals("ogabcwvibjfkc", model.webServiceOutputs().get("c").linkedServiceName().referenceName()); + Assertions + .assertEquals( + "utcedeygsrrg", model.webServiceInputs().get("ixxiukghxde").linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLBatchExecutionActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLBatchExecutionActivityTypePropertiesTests.java new file mode 100644 index 000000000000..36d4546c3966 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLBatchExecutionActivityTypePropertiesTests.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureMLBatchExecutionActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.AzureMLWebServiceFile; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureMLBatchExecutionActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMLBatchExecutionActivityTypeProperties model = + BinaryData + .fromString( + "{\"globalParameters\":{\"vmixfqqm\":\"databcwfp\"},\"webServiceOutputs\":{\"pkevtofvqjrdyd\":{\"filePath\":\"datau\",\"linkedServiceName\":{\"referenceName\":\"fbrjmpdtzu\",\"parameters\":{\"qikouravdqe\":\"datarvpcwyn\",\"ma\":\"dataewgpmademlo\",\"hgdvgcgunqitzwn\":\"datakbmkkun\"}}}},\"webServiceInputs\":{\"krxajta\":{\"filePath\":\"datauppxdzpjewp\",\"linkedServiceName\":{\"referenceName\":\"lyszw\",\"parameters\":{\"tfgbxiao\":\"dataokgrnxly\",\"n\":\"datazrouwkkwtoxl\",\"keeeakzys\":\"datavealwdltstxronbz\"}}},\"zhiradklzg\":{\"filePath\":\"datadfqc\",\"linkedServiceName\":{\"referenceName\":\"jwkdwpcm\",\"parameters\":{\"gwxoreedor\":\"datarrkfhla\",\"qdmzsitrs\":\"dataiycvou\",\"mrjla\":\"datapucxigkpevtb\",\"z\":\"datadggwaldtelnvcfum\"}}},\"jfkuqvt\":{\"filePath\":\"dataqmmapxnoog\",\"linkedServiceName\":{\"referenceName\":\"fujecisicmez\",\"parameters\":{\"nljy\":\"datazpgy\",\"bcufhkrvxxzhqouo\":\"dataumpydk\",\"la\":\"datasczcksjwdwzfdfkg\",\"niybotuq\":\"datavmbsmxhsqdotbnf\"}}}}}") + .toObject(AzureMLBatchExecutionActivityTypeProperties.class); + Assertions + .assertEquals( + "fbrjmpdtzu", model.webServiceOutputs().get("pkevtofvqjrdyd").linkedServiceName().referenceName()); + Assertions.assertEquals("lyszw", model.webServiceInputs().get("krxajta").linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMLBatchExecutionActivityTypeProperties model = + new AzureMLBatchExecutionActivityTypeProperties() + .withGlobalParameters(mapOf("vmixfqqm", "databcwfp")) + .withWebServiceOutputs( + mapOf( + "pkevtofvqjrdyd", + new AzureMLWebServiceFile() + .withFilePath("datau") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("fbrjmpdtzu") + .withParameters( + mapOf( + "qikouravdqe", + "datarvpcwyn", + "ma", + "dataewgpmademlo", + "hgdvgcgunqitzwn", + "datakbmkkun"))))) + .withWebServiceInputs( + mapOf( + "krxajta", + new AzureMLWebServiceFile() + .withFilePath("datauppxdzpjewp") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("lyszw") + .withParameters( + mapOf( + "tfgbxiao", + "dataokgrnxly", + "n", + "datazrouwkkwtoxl", + "keeeakzys", + "datavealwdltstxronbz"))), + "zhiradklzg", + new AzureMLWebServiceFile() + .withFilePath("datadfqc") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("jwkdwpcm") + .withParameters( + mapOf( + "gwxoreedor", + "datarrkfhla", + "qdmzsitrs", + "dataiycvou", + "mrjla", + "datapucxigkpevtb", + "z", + "datadggwaldtelnvcfum"))), + "jfkuqvt", + new AzureMLWebServiceFile() + .withFilePath("dataqmmapxnoog") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("fujecisicmez") + .withParameters( + mapOf( + "nljy", + "datazpgy", + "bcufhkrvxxzhqouo", + "dataumpydk", + "la", + "datasczcksjwdwzfdfkg", + "niybotuq", + "datavmbsmxhsqdotbnf"))))); + model = BinaryData.fromObject(model).toObject(AzureMLBatchExecutionActivityTypeProperties.class); + Assertions + .assertEquals( + "fbrjmpdtzu", model.webServiceOutputs().get("pkevtofvqjrdyd").linkedServiceName().referenceName()); + Assertions.assertEquals("lyszw", model.webServiceInputs().get("krxajta").linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLExecutePipelineActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLExecutePipelineActivityTests.java new file mode 100644 index 000000000000..b63b8532f1fa --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLExecutePipelineActivityTests.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.AzureMLExecutePipelineActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureMLExecutePipelineActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMLExecutePipelineActivity model = + BinaryData + .fromString( + "{\"type\":\"AzureMLExecutePipeline\",\"typeProperties\":{\"mlPipelineId\":\"datakkraenzuufpd\",\"mlPipelineEndpointId\":\"datanxephwxdw\",\"version\":\"datawymeqi\",\"experimentName\":\"datajca\",\"mlPipelineParameters\":\"dataxuox\",\"dataPathAssignments\":\"datapleooom\",\"mlParentRunId\":\"datadjfldzvgog\",\"continueOnStepFailure\":\"datacgaofobjlqnaxfvs\"},\"linkedServiceName\":{\"referenceName\":\"strbje\",\"parameters\":{\"wbslrqbdtcjbxoc\":\"databknpzhfhibh\",\"ahbzdgwkim\":\"dataijwpskneprumhik\",\"ujxdnia\":\"datavatrvjkxcrxqpen\",\"qytppjdyikdykxh\":\"dataeterjerhwgiuduw\"}},\"policy\":{\"timeout\":\"datadtucyutrpdgm\",\"retry\":\"datammc\",\"retryIntervalInSeconds\":813552830,\"secureInput\":false,\"secureOutput\":false,\"\":{\"efxaed\":\"datacrjy\",\"vn\":\"datac\",\"jbahshyxhfe\":\"datayfzavs\"}},\"name\":\"tywluxysmq\",\"description\":\"odfp\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"ww\",\"dependencyConditions\":[\"Skipped\"],\"\":{\"vjefnlxq\":\"datamcaofxgw\",\"ambjqynwqcov\":\"datatedzxujxkxjrttzh\"}},{\"activity\":\"jvrsurqhhbddxko\",\"dependencyConditions\":[\"Skipped\",\"Completed\",\"Skipped\"],\"\":{\"vlfujsbcfoguub\":\"dataqasdvepldafxmp\",\"ri\":\"datacqnchdzyjugdknbl\",\"khugxtxxwb\":\"datavcpisvprumttr\"}}],\"userProperties\":[{\"name\":\"nlmpmvegxg\",\"value\":\"datamxplrtuegq\"}],\"\":{\"vjuowkt\":\"datalnjeybgpjy\",\"dkydqcgedip\":\"databpv\"}}") + .toObject(AzureMLExecutePipelineActivity.class); + Assertions.assertEquals("tywluxysmq", model.name()); + Assertions.assertEquals("odfp", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("ww", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("nlmpmvegxg", model.userProperties().get(0).name()); + Assertions.assertEquals("strbje", model.linkedServiceName().referenceName()); + Assertions.assertEquals(813552830, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMLExecutePipelineActivity model = + new AzureMLExecutePipelineActivity() + .withName("tywluxysmq") + .withDescription("odfp") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ww") + .withDependencyConditions(Arrays.asList(DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("jvrsurqhhbddxko") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("nlmpmvegxg").withValue("datamxplrtuegq"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("strbje") + .withParameters( + mapOf( + "wbslrqbdtcjbxoc", + "databknpzhfhibh", + "ahbzdgwkim", + "dataijwpskneprumhik", + "ujxdnia", + "datavatrvjkxcrxqpen", + "qytppjdyikdykxh", + "dataeterjerhwgiuduw"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datadtucyutrpdgm") + .withRetry("datammc") + .withRetryIntervalInSeconds(813552830) + .withSecureInput(false) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withMlPipelineId("datakkraenzuufpd") + .withMlPipelineEndpointId("datanxephwxdw") + .withVersion("datawymeqi") + .withExperimentName("datajca") + .withMlPipelineParameters("dataxuox") + .withDataPathAssignments("datapleooom") + .withMlParentRunId("datadjfldzvgog") + .withContinueOnStepFailure("datacgaofobjlqnaxfvs"); + model = BinaryData.fromObject(model).toObject(AzureMLExecutePipelineActivity.class); + Assertions.assertEquals("tywluxysmq", model.name()); + Assertions.assertEquals("odfp", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("ww", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("nlmpmvegxg", model.userProperties().get(0).name()); + Assertions.assertEquals("strbje", model.linkedServiceName().referenceName()); + Assertions.assertEquals(813552830, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLExecutePipelineActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLExecutePipelineActivityTypePropertiesTests.java new file mode 100644 index 000000000000..fcce156eb830 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLExecutePipelineActivityTypePropertiesTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureMLExecutePipelineActivityTypeProperties; + +public final class AzureMLExecutePipelineActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMLExecutePipelineActivityTypeProperties model = + BinaryData + .fromString( + "{\"mlPipelineId\":\"datazmvttttjmdtf\",\"mlPipelineEndpointId\":\"dataxaeekomiesg\",\"version\":\"datapcwpbtumttmixe\",\"experimentName\":\"dataarb\",\"mlPipelineParameters\":\"datagoushvqnkwjhjut\",\"dataPathAssignments\":\"dataggnldflgqsoi\",\"mlParentRunId\":\"datacmuvf\",\"continueOnStepFailure\":\"datalepetsxetneh\"}") + .toObject(AzureMLExecutePipelineActivityTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMLExecutePipelineActivityTypeProperties model = + new AzureMLExecutePipelineActivityTypeProperties() + .withMlPipelineId("datazmvttttjmdtf") + .withMlPipelineEndpointId("dataxaeekomiesg") + .withVersion("datapcwpbtumttmixe") + .withExperimentName("dataarb") + .withMlPipelineParameters("datagoushvqnkwjhjut") + .withDataPathAssignments("dataggnldflgqsoi") + .withMlParentRunId("datacmuvf") + .withContinueOnStepFailure("datalepetsxetneh"); + model = BinaryData.fromObject(model).toObject(AzureMLExecutePipelineActivityTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLUpdateResourceActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLUpdateResourceActivityTests.java new file mode 100644 index 000000000000..9736adec8f29 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLUpdateResourceActivityTests.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.AzureMLUpdateResourceActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureMLUpdateResourceActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMLUpdateResourceActivity model = + BinaryData + .fromString( + "{\"type\":\"AzureMLUpdateResource\",\"typeProperties\":{\"trainedModelName\":\"datasqovmtidmyc\",\"trainedModelLinkedServiceName\":{\"referenceName\":\"yajlnotmirgip\",\"parameters\":{\"hnj\":\"datanbfxmefymdmfrfz\",\"twmmvbahftkcey\":\"dataqzdzkyqqbqbwbw\"}},\"trainedModelFilePath\":\"datatdeyoxtlq\"},\"linkedServiceName\":{\"referenceName\":\"xftepzrcqnsjqrgt\",\"parameters\":{\"b\":\"datawpzphkm\",\"ondbvlqtpeba\":\"datarqk\",\"vqdwzyvxd\":\"datawzsxpyrbjt\"}},\"policy\":{\"timeout\":\"datanieqlikyc\",\"retry\":\"datanfukehxvktlrc\",\"retryIntervalInSeconds\":1149102333,\"secureInput\":true,\"secureOutput\":false,\"\":{\"zqamxxpfy\":\"datauwnrqf\",\"rtgww\":\"datampftwtepu\"}},\"name\":\"aolfdgjrgp\",\"description\":\"vohvcaqarppkzz\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"qou\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Skipped\",\"Completed\"],\"\":{\"znnpazbfrqotigxn\":\"datahtncadrmthhfx\"}}],\"userProperties\":[{\"name\":\"xnvwq\",\"value\":\"datahklhoss\"},{\"name\":\"pjtiu\",\"value\":\"datagjbfm\"},{\"name\":\"sjgmes\",\"value\":\"datamhxkjj\"}],\"\":{\"yafazwie\":\"datargxskghdadgqpbg\",\"rijcwnthtq\":\"datazzxjjdboxuinrs\",\"zbvdzjlkocjuajcl\":\"databcwtcqjsvlzdus\",\"iprjahgqzb\":\"datatssbkzdgwpyljn\"}}") + .toObject(AzureMLUpdateResourceActivity.class); + Assertions.assertEquals("aolfdgjrgp", model.name()); + Assertions.assertEquals("vohvcaqarppkzz", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("qou", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("xnvwq", model.userProperties().get(0).name()); + Assertions.assertEquals("xftepzrcqnsjqrgt", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1149102333, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("yajlnotmirgip", model.trainedModelLinkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMLUpdateResourceActivity model = + new AzureMLUpdateResourceActivity() + .withName("aolfdgjrgp") + .withDescription("vohvcaqarppkzz") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("qou") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("xnvwq").withValue("datahklhoss"), + new UserProperty().withName("pjtiu").withValue("datagjbfm"), + new UserProperty().withName("sjgmes").withValue("datamhxkjj"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("xftepzrcqnsjqrgt") + .withParameters( + mapOf("b", "datawpzphkm", "ondbvlqtpeba", "datarqk", "vqdwzyvxd", "datawzsxpyrbjt"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datanieqlikyc") + .withRetry("datanfukehxvktlrc") + .withRetryIntervalInSeconds(1149102333) + .withSecureInput(true) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withTrainedModelName("datasqovmtidmyc") + .withTrainedModelLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("yajlnotmirgip") + .withParameters(mapOf("hnj", "datanbfxmefymdmfrfz", "twmmvbahftkcey", "dataqzdzkyqqbqbwbw"))) + .withTrainedModelFilePath("datatdeyoxtlq"); + model = BinaryData.fromObject(model).toObject(AzureMLUpdateResourceActivity.class); + Assertions.assertEquals("aolfdgjrgp", model.name()); + Assertions.assertEquals("vohvcaqarppkzz", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("qou", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("xnvwq", model.userProperties().get(0).name()); + Assertions.assertEquals("xftepzrcqnsjqrgt", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1149102333, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("yajlnotmirgip", model.trainedModelLinkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLUpdateResourceActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLUpdateResourceActivityTypePropertiesTests.java new file mode 100644 index 000000000000..0d5eb77e0769 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLUpdateResourceActivityTypePropertiesTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureMLUpdateResourceActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureMLUpdateResourceActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMLUpdateResourceActivityTypeProperties model = + BinaryData + .fromString( + "{\"trainedModelName\":\"dataicyufnum\",\"trainedModelLinkedServiceName\":{\"referenceName\":\"e\",\"parameters\":{\"qhmuryajp\":\"datar\",\"ihbvfallpobzv\":\"datauflvazpizossqm\",\"h\":\"datantsfyntkfziitbw\",\"s\":\"datawwhml\"}},\"trainedModelFilePath\":\"databfg\"}") + .toObject(AzureMLUpdateResourceActivityTypeProperties.class); + Assertions.assertEquals("e", model.trainedModelLinkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMLUpdateResourceActivityTypeProperties model = + new AzureMLUpdateResourceActivityTypeProperties() + .withTrainedModelName("dataicyufnum") + .withTrainedModelLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("e") + .withParameters( + mapOf( + "qhmuryajp", + "datar", + "ihbvfallpobzv", + "datauflvazpizossqm", + "h", + "datantsfyntkfziitbw", + "s", + "datawwhml"))) + .withTrainedModelFilePath("databfg"); + model = BinaryData.fromObject(model).toObject(AzureMLUpdateResourceActivityTypeProperties.class); + Assertions.assertEquals("e", model.trainedModelLinkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLWebServiceFileTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLWebServiceFileTests.java new file mode 100644 index 000000000000..9afd29bdcbc0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMLWebServiceFileTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureMLWebServiceFile; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureMLWebServiceFileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMLWebServiceFile model = + BinaryData + .fromString( + "{\"filePath\":\"datarbsgwoykcvwqyfix\",\"linkedServiceName\":{\"referenceName\":\"gqmxmiwfzrhilyp\",\"parameters\":{\"quxut\":\"datan\",\"qwkaevbgjhmy\":\"datawbsttmvaijnzq\"}}}") + .toObject(AzureMLWebServiceFile.class); + Assertions.assertEquals("gqmxmiwfzrhilyp", model.linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMLWebServiceFile model = + new AzureMLWebServiceFile() + .withFilePath("datarbsgwoykcvwqyfix") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("gqmxmiwfzrhilyp") + .withParameters(mapOf("quxut", "datan", "qwkaevbgjhmy", "datawbsttmvaijnzq"))); + model = BinaryData.fromObject(model).toObject(AzureMLWebServiceFile.class); + Assertions.assertEquals("gqmxmiwfzrhilyp", model.linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMariaDBSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMariaDBSourceTests.java new file mode 100644 index 000000000000..fd1dfc3844e2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMariaDBSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureMariaDBSource; + +public final class AzureMariaDBSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMariaDBSource model = + BinaryData + .fromString( + "{\"type\":\"AzureMariaDBSource\",\"query\":\"dataybezmyjqpd\",\"queryTimeout\":\"datadsxvk\",\"additionalColumns\":\"datappxzgjysm\",\"sourceRetryCount\":\"dataktou\",\"sourceRetryWait\":\"databwddpjsokosugr\",\"maxConcurrentConnections\":\"datazfwdmae\",\"disableMetricsCollection\":\"datahq\",\"\":{\"mhfmognn\":\"datagzmonjqnienctwb\",\"byxygubvidpsk\":\"dataxrdllrqamfjyyrfp\",\"dctgsdxjx\":\"datazssxhvzgliu\",\"yvvlgsadpvmn\":\"dataddxoatlprsrkennn\"}}") + .toObject(AzureMariaDBSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMariaDBSource model = + new AzureMariaDBSource() + .withSourceRetryCount("dataktou") + .withSourceRetryWait("databwddpjsokosugr") + .withMaxConcurrentConnections("datazfwdmae") + .withDisableMetricsCollection("datahq") + .withQueryTimeout("datadsxvk") + .withAdditionalColumns("datappxzgjysm") + .withQuery("dataybezmyjqpd"); + model = BinaryData.fromObject(model).toObject(AzureMariaDBSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMariaDBTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMariaDBTableDatasetTests.java new file mode 100644 index 000000000000..53f49c8248ac --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMariaDBTableDatasetTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureMariaDBTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureMariaDBTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMariaDBTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureMariaDBTable\",\"typeProperties\":{\"tableName\":\"datatn\"},\"description\":\"jewihcigaahm\",\"structure\":\"dataspkdnx\",\"schema\":\"dataz\",\"linkedServiceName\":{\"referenceName\":\"tertnzrrwsc\",\"parameters\":{\"nvtolzj\":\"datahdwi\",\"haknklthqwppv\":\"datafkryxs\"}},\"parameters\":{\"bkabhvxjuaivx\":{\"type\":\"Int\",\"defaultValue\":\"datarvpvdrohul\"},\"kg\":{\"type\":\"Array\",\"defaultValue\":\"datarnygti\"},\"rxzpqditu\":{\"type\":\"Bool\",\"defaultValue\":\"datamkphvdl\"},\"e\":{\"type\":\"String\",\"defaultValue\":\"datatfcieil\"}},\"annotations\":[\"datakehldopjsxvbbwsg\",\"datakkmibnmdp\",\"datad\",\"datapwtgzwmzhcmrloqa\"],\"folder\":{\"name\":\"yzavky\"},\"\":{\"bngzldvvd\":\"dataudnmbj\",\"pmq\":\"dataoptythctoxo\",\"sfzsgzgus\":\"dataerwhemvids\"}}") + .toObject(AzureMariaDBTableDataset.class); + Assertions.assertEquals("jewihcigaahm", model.description()); + Assertions.assertEquals("tertnzrrwsc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("bkabhvxjuaivx").type()); + Assertions.assertEquals("yzavky", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMariaDBTableDataset model = + new AzureMariaDBTableDataset() + .withDescription("jewihcigaahm") + .withStructure("dataspkdnx") + .withSchema("dataz") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("tertnzrrwsc") + .withParameters(mapOf("nvtolzj", "datahdwi", "haknklthqwppv", "datafkryxs"))) + .withParameters( + mapOf( + "bkabhvxjuaivx", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datarvpvdrohul"), + "kg", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datarnygti"), + "rxzpqditu", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datamkphvdl"), + "e", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datatfcieil"))) + .withAnnotations( + Arrays.asList("datakehldopjsxvbbwsg", "datakkmibnmdp", "datad", "datapwtgzwmzhcmrloqa")) + .withFolder(new DatasetFolder().withName("yzavky")) + .withTableName("datatn"); + model = BinaryData.fromObject(model).toObject(AzureMariaDBTableDataset.class); + Assertions.assertEquals("jewihcigaahm", model.description()); + Assertions.assertEquals("tertnzrrwsc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("bkabhvxjuaivx").type()); + Assertions.assertEquals("yzavky", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlSinkTests.java new file mode 100644 index 000000000000..c7db76d8634d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureMySqlSink; + +public final class AzureMySqlSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMySqlSink model = + BinaryData + .fromString( + "{\"type\":\"AzureMySqlSink\",\"preCopyScript\":\"dataefvboxvwtln\",\"writeBatchSize\":\"datashtujaqpkupnr\",\"writeBatchTimeout\":\"datajeypdk\",\"sinkRetryCount\":\"datacxzsynbdrqi\",\"sinkRetryWait\":\"dataihg\",\"maxConcurrentConnections\":\"datahyebwg\",\"disableMetricsCollection\":\"dataovsvjxnsor\",\"\":{\"bo\":\"dataarhlyhgiisnfaxt\"}}") + .toObject(AzureMySqlSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMySqlSink model = + new AzureMySqlSink() + .withWriteBatchSize("datashtujaqpkupnr") + .withWriteBatchTimeout("datajeypdk") + .withSinkRetryCount("datacxzsynbdrqi") + .withSinkRetryWait("dataihg") + .withMaxConcurrentConnections("datahyebwg") + .withDisableMetricsCollection("dataovsvjxnsor") + .withPreCopyScript("dataefvboxvwtln"); + model = BinaryData.fromObject(model).toObject(AzureMySqlSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlSourceTests.java new file mode 100644 index 000000000000..f0a50643e1fa --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureMySqlSource; + +public final class AzureMySqlSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMySqlSource model = + BinaryData + .fromString( + "{\"type\":\"AzureMySqlSource\",\"query\":\"datawwzpbamcfrf\",\"queryTimeout\":\"datatcygoombnrm\",\"additionalColumns\":\"dataklfp\",\"sourceRetryCount\":\"datagfvvnkpwl\",\"sourceRetryWait\":\"datazxdzold\",\"maxConcurrentConnections\":\"datafnpn\",\"disableMetricsCollection\":\"dataterjjuzarege\",\"\":{\"uggdh\":\"datazpuda\",\"keculxvkuxvccpda\":\"datattg\"}}") + .toObject(AzureMySqlSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMySqlSource model = + new AzureMySqlSource() + .withSourceRetryCount("datagfvvnkpwl") + .withSourceRetryWait("datazxdzold") + .withMaxConcurrentConnections("datafnpn") + .withDisableMetricsCollection("dataterjjuzarege") + .withQueryTimeout("datatcygoombnrm") + .withAdditionalColumns("dataklfp") + .withQuery("datawwzpbamcfrf"); + model = BinaryData.fromObject(model).toObject(AzureMySqlSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlTableDatasetTests.java new file mode 100644 index 000000000000..60c2434ffab8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlTableDatasetTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureMySqlTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureMySqlTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMySqlTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureMySqlTable\",\"typeProperties\":{\"tableName\":\"dataw\",\"table\":\"datazyjj\"},\"description\":\"t\",\"structure\":\"datazql\",\"schema\":\"dataagwiijc\",\"linkedServiceName\":{\"referenceName\":\"qiywhxpsbapial\",\"parameters\":{\"zudegefxlieg\":\"dataydp\",\"smhssfnwh\":\"dataot\",\"nfmkcuft\":\"datakahhec\",\"dvhzfkdn\":\"datadgwuzron\"}},\"parameters\":{\"zfzdjekeb\":{\"type\":\"Object\",\"defaultValue\":\"datacikgxkk\"},\"jwyfi\":{\"type\":\"Array\",\"defaultValue\":\"dataxz\"}},\"annotations\":[\"datagcjf\",\"dataiwu\",\"datapjkakrxifqnf\"],\"folder\":{\"name\":\"xsqtzngxbs\"},\"\":{\"ly\":\"datawguxcmmhipbvskci\"}}") + .toObject(AzureMySqlTableDataset.class); + Assertions.assertEquals("t", model.description()); + Assertions.assertEquals("qiywhxpsbapial", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("zfzdjekeb").type()); + Assertions.assertEquals("xsqtzngxbs", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMySqlTableDataset model = + new AzureMySqlTableDataset() + .withDescription("t") + .withStructure("datazql") + .withSchema("dataagwiijc") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("qiywhxpsbapial") + .withParameters( + mapOf( + "zudegefxlieg", + "dataydp", + "smhssfnwh", + "dataot", + "nfmkcuft", + "datakahhec", + "dvhzfkdn", + "datadgwuzron"))) + .withParameters( + mapOf( + "zfzdjekeb", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datacikgxkk"), + "jwyfi", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataxz"))) + .withAnnotations(Arrays.asList("datagcjf", "dataiwu", "datapjkakrxifqnf")) + .withFolder(new DatasetFolder().withName("xsqtzngxbs")) + .withTableName("dataw") + .withTable("datazyjj"); + model = BinaryData.fromObject(model).toObject(AzureMySqlTableDataset.class); + Assertions.assertEquals("t", model.description()); + Assertions.assertEquals("qiywhxpsbapial", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("zfzdjekeb").type()); + Assertions.assertEquals("xsqtzngxbs", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..88d75029d496 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureMySqlTableDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureMySqlTableDatasetTypeProperties; + +public final class AzureMySqlTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMySqlTableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"datawfsaa\",\"table\":\"datafgb\"}") + .toObject(AzureMySqlTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMySqlTableDatasetTypeProperties model = + new AzureMySqlTableDatasetTypeProperties().withTableName("datawfsaa").withTable("datafgb"); + model = BinaryData.fromObject(model).toObject(AzureMySqlTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlSinkTests.java new file mode 100644 index 000000000000..14c49113b7ea --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzurePostgreSqlSink; + +public final class AzurePostgreSqlSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzurePostgreSqlSink model = + BinaryData + .fromString( + "{\"type\":\"AzurePostgreSqlSink\",\"preCopyScript\":\"datacownxiwpptvbud\",\"writeBatchSize\":\"dataujvmllyjelnhm\",\"writeBatchTimeout\":\"datahxkofzxkqsle\",\"sinkRetryCount\":\"databam\",\"sinkRetryWait\":\"datanwgccgblepam\",\"maxConcurrentConnections\":\"databaxdaoja\",\"disableMetricsCollection\":\"dataq\",\"\":{\"ljmj\":\"dataqlnxvnm\",\"vhjbzpohfej\":\"datayadafecwnufldzjc\"}}") + .toObject(AzurePostgreSqlSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzurePostgreSqlSink model = + new AzurePostgreSqlSink() + .withWriteBatchSize("dataujvmllyjelnhm") + .withWriteBatchTimeout("datahxkofzxkqsle") + .withSinkRetryCount("databam") + .withSinkRetryWait("datanwgccgblepam") + .withMaxConcurrentConnections("databaxdaoja") + .withDisableMetricsCollection("dataq") + .withPreCopyScript("datacownxiwpptvbud"); + model = BinaryData.fromObject(model).toObject(AzurePostgreSqlSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlSourceTests.java new file mode 100644 index 000000000000..10a83f70873c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzurePostgreSqlSource; + +public final class AzurePostgreSqlSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzurePostgreSqlSource model = + BinaryData + .fromString( + "{\"type\":\"AzurePostgreSqlSource\",\"query\":\"datawkctdnnqokq\",\"queryTimeout\":\"datazslnyjpuywi\",\"additionalColumns\":\"datalpe\",\"sourceRetryCount\":\"dataqbnmzkqydt\",\"sourceRetryWait\":\"datac\",\"maxConcurrentConnections\":\"datacmwvp\",\"disableMetricsCollection\":\"datawufnfovylis\",\"\":{\"hjdhlskeifw\":\"datak\"}}") + .toObject(AzurePostgreSqlSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzurePostgreSqlSource model = + new AzurePostgreSqlSource() + .withSourceRetryCount("dataqbnmzkqydt") + .withSourceRetryWait("datac") + .withMaxConcurrentConnections("datacmwvp") + .withDisableMetricsCollection("datawufnfovylis") + .withQueryTimeout("datazslnyjpuywi") + .withAdditionalColumns("datalpe") + .withQuery("datawkctdnnqokq"); + model = BinaryData.fromObject(model).toObject(AzurePostgreSqlSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlTableDatasetTests.java new file mode 100644 index 000000000000..28753be75123 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlTableDatasetTests.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzurePostgreSqlTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzurePostgreSqlTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzurePostgreSqlTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AzurePostgreSqlTable\",\"typeProperties\":{\"tableName\":\"dataj\",\"table\":\"datawrduxntpfxxgja\",\"schema\":\"dataxfwf\"},\"description\":\"qv\",\"structure\":\"datafbkqynlzxem\",\"schema\":\"dataupjckiehdm\",\"linkedServiceName\":{\"referenceName\":\"foyrxxxffgmcua\",\"parameters\":{\"csapvbcqpfus\":\"dataeervgc\",\"k\":\"datakijhmine\",\"rkvorlfqmljewyn\":\"dataivp\",\"vlnpbsotmynklnm\":\"datafvvcwvurkmjufa\"}},\"parameters\":{\"keipxutc\":{\"type\":\"Int\",\"defaultValue\":\"datavrkkfcwxizkstxne\"},\"tvsayyaeiiv\":{\"type\":\"Array\",\"defaultValue\":\"dataiuvnfaz\"},\"xqetxtdqius\":{\"type\":\"Float\",\"defaultValue\":\"dataqtjwrvewojoq\"},\"mjsisfqqhc\":{\"type\":\"Array\",\"defaultValue\":\"datazljvgjijzqjhljsa\"}},\"annotations\":[\"dataagsbfeiir\",\"datanjygllfkchhgsj\"],\"folder\":{\"name\":\"c\"},\"\":{\"khdhpmkxdujkxpuq\":\"datawmqcycabaam\",\"ezxiz\":\"datadyoqywsuarpzhry\",\"azccouhwivkd\":\"datasyxbfjilb\",\"pi\":\"datavjsknrbxz\"}}") + .toObject(AzurePostgreSqlTableDataset.class); + Assertions.assertEquals("qv", model.description()); + Assertions.assertEquals("foyrxxxffgmcua", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("keipxutc").type()); + Assertions.assertEquals("c", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzurePostgreSqlTableDataset model = + new AzurePostgreSqlTableDataset() + .withDescription("qv") + .withStructure("datafbkqynlzxem") + .withSchema("dataupjckiehdm") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("foyrxxxffgmcua") + .withParameters( + mapOf( + "csapvbcqpfus", + "dataeervgc", + "k", + "datakijhmine", + "rkvorlfqmljewyn", + "dataivp", + "vlnpbsotmynklnm", + "datafvvcwvurkmjufa"))) + .withParameters( + mapOf( + "keipxutc", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datavrkkfcwxizkstxne"), + "tvsayyaeiiv", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataiuvnfaz"), + "xqetxtdqius", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("dataqtjwrvewojoq"), + "mjsisfqqhc", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datazljvgjijzqjhljsa"))) + .withAnnotations(Arrays.asList("dataagsbfeiir", "datanjygllfkchhgsj")) + .withFolder(new DatasetFolder().withName("c")) + .withTableName("dataj") + .withTable("datawrduxntpfxxgja") + .withSchemaTypePropertiesSchema("dataxfwf"); + model = BinaryData.fromObject(model).toObject(AzurePostgreSqlTableDataset.class); + Assertions.assertEquals("qv", model.description()); + Assertions.assertEquals("foyrxxxffgmcua", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("keipxutc").type()); + Assertions.assertEquals("c", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..ef963afba3b4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzurePostgreSqlTableDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzurePostgreSqlTableDatasetTypeProperties; + +public final class AzurePostgreSqlTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzurePostgreSqlTableDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"datavcpi\",\"table\":\"dataqbvxqtolpwbopv\",\"schema\":\"databtzaprjxco\"}") + .toObject(AzurePostgreSqlTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzurePostgreSqlTableDatasetTypeProperties model = + new AzurePostgreSqlTableDatasetTypeProperties() + .withTableName("datavcpi") + .withTable("dataqbvxqtolpwbopv") + .withSchema("databtzaprjxco"); + model = BinaryData.fromObject(model).toObject(AzurePostgreSqlTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureQueueSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureQueueSinkTests.java new file mode 100644 index 000000000000..c360c8af4f2a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureQueueSinkTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureQueueSink; + +public final class AzureQueueSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureQueueSink model = + BinaryData + .fromString( + "{\"type\":\"AzureQueueSink\",\"writeBatchSize\":\"dataujbqrfwnpwvpnb\",\"writeBatchTimeout\":\"dataxomckzeaiayca\",\"sinkRetryCount\":\"datalfsctj\",\"sinkRetryWait\":\"datazqivfge\",\"maxConcurrentConnections\":\"datau\",\"disableMetricsCollection\":\"dataxwuyry\",\"\":{\"ndbrcdumkqhatcko\":\"datafnucgwfljjatj\"}}") + .toObject(AzureQueueSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureQueueSink model = + new AzureQueueSink() + .withWriteBatchSize("dataujbqrfwnpwvpnb") + .withWriteBatchTimeout("dataxomckzeaiayca") + .withSinkRetryCount("datalfsctj") + .withSinkRetryWait("datazqivfge") + .withMaxConcurrentConnections("datau") + .withDisableMetricsCollection("dataxwuyry"); + model = BinaryData.fromObject(model).toObject(AzureQueueSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSearchIndexDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSearchIndexDatasetTests.java new file mode 100644 index 000000000000..41dec826a9e8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSearchIndexDatasetTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureSearchIndexDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureSearchIndexDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSearchIndexDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureSearchIndex\",\"typeProperties\":{\"indexName\":\"dataryqycymzrlcfgdwz\"},\"description\":\"zfdhea\",\"structure\":\"datayciwzkil\",\"schema\":\"dataqadfgesv\",\"linkedServiceName\":{\"referenceName\":\"oha\",\"parameters\":{\"ovqmxqsxofx\":\"dataizmadjrsbgailj\",\"kgltsxooiobhieb\":\"datankiu\",\"tlsrvqzgaqsosrn\":\"datau\",\"npesw\":\"datalvgrghnhuoxrqhjn\"}},\"parameters\":{\"zdvmsnao\":{\"type\":\"Array\",\"defaultValue\":\"datagebzqzmcsviujo\"}},\"annotations\":[\"dataxoxvimdvetqh\",\"databitqsbyu\"],\"folder\":{\"name\":\"omr\"},\"\":{\"xbdpbcehwbd\":\"datamgrmsdbvqxgfygfk\"}}") + .toObject(AzureSearchIndexDataset.class); + Assertions.assertEquals("zfdhea", model.description()); + Assertions.assertEquals("oha", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("zdvmsnao").type()); + Assertions.assertEquals("omr", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSearchIndexDataset model = + new AzureSearchIndexDataset() + .withDescription("zfdhea") + .withStructure("datayciwzkil") + .withSchema("dataqadfgesv") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("oha") + .withParameters( + mapOf( + "ovqmxqsxofx", + "dataizmadjrsbgailj", + "kgltsxooiobhieb", + "datankiu", + "tlsrvqzgaqsosrn", + "datau", + "npesw", + "datalvgrghnhuoxrqhjn"))) + .withParameters( + mapOf( + "zdvmsnao", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datagebzqzmcsviujo"))) + .withAnnotations(Arrays.asList("dataxoxvimdvetqh", "databitqsbyu")) + .withFolder(new DatasetFolder().withName("omr")) + .withIndexName("dataryqycymzrlcfgdwz"); + model = BinaryData.fromObject(model).toObject(AzureSearchIndexDataset.class); + Assertions.assertEquals("zfdhea", model.description()); + Assertions.assertEquals("oha", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("zdvmsnao").type()); + Assertions.assertEquals("omr", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSearchIndexDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSearchIndexDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..269efa7b4489 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSearchIndexDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureSearchIndexDatasetTypeProperties; + +public final class AzureSearchIndexDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSearchIndexDatasetTypeProperties model = + BinaryData + .fromString("{\"indexName\":\"datasesboynpytporr\"}") + .toObject(AzureSearchIndexDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSearchIndexDatasetTypeProperties model = + new AzureSearchIndexDatasetTypeProperties().withIndexName("datasesboynpytporr"); + model = BinaryData.fromObject(model).toObject(AzureSearchIndexDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSearchIndexSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSearchIndexSinkTests.java new file mode 100644 index 000000000000..334ce694bdaa --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSearchIndexSinkTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureSearchIndexSink; +import com.azure.resourcemanager.datafactory.models.AzureSearchIndexWriteBehaviorType; +import org.junit.jupiter.api.Assertions; + +public final class AzureSearchIndexSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSearchIndexSink model = + BinaryData + .fromString( + "{\"type\":\"AzureSearchIndexSink\",\"writeBehavior\":\"Upload\",\"writeBatchSize\":\"datamrtdznvjgovy\",\"writeBatchTimeout\":\"datappswlept\",\"sinkRetryCount\":\"databrkntfwxkeuyxgpc\",\"sinkRetryWait\":\"datavmrdlckpznov\",\"maxConcurrentConnections\":\"databwpai\",\"disableMetricsCollection\":\"datakzysdhars\",\"\":{\"vtvtyqlthn\":\"datamrpdxnr\",\"diehrajbatgmxk\":\"datadfplk\"}}") + .toObject(AzureSearchIndexSink.class); + Assertions.assertEquals(AzureSearchIndexWriteBehaviorType.UPLOAD, model.writeBehavior()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSearchIndexSink model = + new AzureSearchIndexSink() + .withWriteBatchSize("datamrtdznvjgovy") + .withWriteBatchTimeout("datappswlept") + .withSinkRetryCount("databrkntfwxkeuyxgpc") + .withSinkRetryWait("datavmrdlckpznov") + .withMaxConcurrentConnections("databwpai") + .withDisableMetricsCollection("datakzysdhars") + .withWriteBehavior(AzureSearchIndexWriteBehaviorType.UPLOAD); + model = BinaryData.fromObject(model).toObject(AzureSearchIndexSink.class); + Assertions.assertEquals(AzureSearchIndexWriteBehaviorType.UPLOAD, model.writeBehavior()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlDWTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlDWTableDatasetTests.java new file mode 100644 index 000000000000..01a90f648d33 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlDWTableDatasetTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureSqlDWTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureSqlDWTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSqlDWTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureSqlDWTable\",\"typeProperties\":{\"tableName\":\"dataxjfsg\",\"schema\":\"dataspoebnx\",\"table\":\"datacowscuyfqlam\"},\"description\":\"qhsujkafuzp\",\"structure\":\"dataqpwnikxkcajgr\",\"schema\":\"datact\",\"linkedServiceName\":{\"referenceName\":\"vgoo\",\"parameters\":{\"tm\":\"dataazmzlpcx\",\"ic\":\"dataxxr\"}},\"parameters\":{\"hkvpyeyoa\":{\"type\":\"SecureString\",\"defaultValue\":\"datajd\"}},\"annotations\":[\"datampnqup\",\"datakjr\"],\"folder\":{\"name\":\"ky\"},\"\":{\"hqdcclcvqsr\":\"databdx\"}}") + .toObject(AzureSqlDWTableDataset.class); + Assertions.assertEquals("qhsujkafuzp", model.description()); + Assertions.assertEquals("vgoo", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("hkvpyeyoa").type()); + Assertions.assertEquals("ky", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSqlDWTableDataset model = + new AzureSqlDWTableDataset() + .withDescription("qhsujkafuzp") + .withStructure("dataqpwnikxkcajgr") + .withSchema("datact") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("vgoo") + .withParameters(mapOf("tm", "dataazmzlpcx", "ic", "dataxxr"))) + .withParameters( + mapOf( + "hkvpyeyoa", + new ParameterSpecification().withType(ParameterType.SECURE_STRING).withDefaultValue("datajd"))) + .withAnnotations(Arrays.asList("datampnqup", "datakjr")) + .withFolder(new DatasetFolder().withName("ky")) + .withTableName("dataxjfsg") + .withSchemaTypePropertiesSchema("dataspoebnx") + .withTable("datacowscuyfqlam"); + model = BinaryData.fromObject(model).toObject(AzureSqlDWTableDataset.class); + Assertions.assertEquals("qhsujkafuzp", model.description()); + Assertions.assertEquals("vgoo", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("hkvpyeyoa").type()); + Assertions.assertEquals("ky", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlDWTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlDWTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..164c68960070 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlDWTableDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureSqlDWTableDatasetTypeProperties; + +public final class AzureSqlDWTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSqlDWTableDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"dataay\",\"schema\":\"datavwbzmfxlrymf\",\"table\":\"datalpiywqnpfydrfbg\"}") + .toObject(AzureSqlDWTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSqlDWTableDatasetTypeProperties model = + new AzureSqlDWTableDatasetTypeProperties() + .withTableName("dataay") + .withSchema("datavwbzmfxlrymf") + .withTable("datalpiywqnpfydrfbg"); + model = BinaryData.fromObject(model).toObject(AzureSqlDWTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlMITableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlMITableDatasetTests.java new file mode 100644 index 000000000000..a038140b90c7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlMITableDatasetTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureSqlMITableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureSqlMITableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSqlMITableDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureSqlMITable\",\"typeProperties\":{\"tableName\":\"dataczygpmgfjcu\",\"schema\":\"datajhhy\",\"table\":\"datadevfi\"},\"description\":\"motuzbybwjmtf\",\"structure\":\"datavelni\",\"schema\":\"datapk\",\"linkedServiceName\":{\"referenceName\":\"nstp\",\"parameters\":{\"vswmehfxrtt\":\"dataibjg\",\"ectcxsfmbzdx\":\"databmsennqfabqcama\"}},\"parameters\":{\"zyq\":{\"type\":\"Bool\",\"defaultValue\":\"datakdnnyufxuzms\"},\"ara\":{\"type\":\"Int\",\"defaultValue\":\"datanxhjtlxfikjk\"},\"zpcjcnwjzbqblxr\":{\"type\":\"Bool\",\"defaultValue\":\"datauasnjeglhtrxb\"},\"wsdsorg\":{\"type\":\"Float\",\"defaultValue\":\"datadsvoqiza\"}},\"annotations\":[\"dataxsawooauff\",\"dataxfqk\",\"datawzrdqyoybm\"],\"folder\":{\"name\":\"to\"},\"\":{\"rpqphkvyyzad\":\"datazdaiovrb\",\"yzvelffo\":\"datarxylaypd\"}}") + .toObject(AzureSqlMITableDataset.class); + Assertions.assertEquals("motuzbybwjmtf", model.description()); + Assertions.assertEquals("nstp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("zyq").type()); + Assertions.assertEquals("to", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSqlMITableDataset model = + new AzureSqlMITableDataset() + .withDescription("motuzbybwjmtf") + .withStructure("datavelni") + .withSchema("datapk") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("nstp") + .withParameters(mapOf("vswmehfxrtt", "dataibjg", "ectcxsfmbzdx", "databmsennqfabqcama"))) + .withParameters( + mapOf( + "zyq", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datakdnnyufxuzms"), + "ara", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datanxhjtlxfikjk"), + "zpcjcnwjzbqblxr", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datauasnjeglhtrxb"), + "wsdsorg", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datadsvoqiza"))) + .withAnnotations(Arrays.asList("dataxsawooauff", "dataxfqk", "datawzrdqyoybm")) + .withFolder(new DatasetFolder().withName("to")) + .withTableName("dataczygpmgfjcu") + .withSchemaTypePropertiesSchema("datajhhy") + .withTable("datadevfi"); + model = BinaryData.fromObject(model).toObject(AzureSqlMITableDataset.class); + Assertions.assertEquals("motuzbybwjmtf", model.description()); + Assertions.assertEquals("nstp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("zyq").type()); + Assertions.assertEquals("to", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlMITableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlMITableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..f88d135b9b40 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlMITableDatasetTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureSqlMITableDatasetTypeProperties; + +public final class AzureSqlMITableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSqlMITableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"datariwhjdfrwp\",\"schema\":\"datah\",\"table\":\"datankcclpctuog\"}") + .toObject(AzureSqlMITableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSqlMITableDatasetTypeProperties model = + new AzureSqlMITableDatasetTypeProperties() + .withTableName("datariwhjdfrwp") + .withSchema("datah") + .withTable("datankcclpctuog"); + model = BinaryData.fromObject(model).toObject(AzureSqlMITableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlSourceTests.java new file mode 100644 index 000000000000..6d222b472ac5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlSourceTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureSqlSource; +import com.azure.resourcemanager.datafactory.models.SqlPartitionSettings; + +public final class AzureSqlSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSqlSource model = + BinaryData + .fromString( + "{\"type\":\"AzureSqlSource\",\"sqlReaderQuery\":\"dataq\",\"sqlReaderStoredProcedureName\":\"dataegilbkzctqbvntl\",\"storedProcedureParameters\":\"datagj\",\"isolationLevel\":\"dataxqoydyislepdbsi\",\"produceAdditionalTypes\":\"datantsp\",\"partitionOption\":\"dataumpyytbjbmjbmtx\",\"partitionSettings\":{\"partitionColumnName\":\"dataf\",\"partitionUpperBound\":\"datag\",\"partitionLowerBound\":\"dataotvocjk\"},\"queryTimeout\":\"datah\",\"additionalColumns\":\"datayvtrsgfdmtfn\",\"sourceRetryCount\":\"datatxqqlbmiq\",\"sourceRetryWait\":\"dataiahjxcd\",\"maxConcurrentConnections\":\"datadlxwsfddyqpfyn\",\"disableMetricsCollection\":\"datawmjsurhljjzsj\",\"\":{\"gadolepnglzjh\":\"datauwizq\",\"am\":\"dataqx\",\"s\":\"dataptc\"}}") + .toObject(AzureSqlSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSqlSource model = + new AzureSqlSource() + .withSourceRetryCount("datatxqqlbmiq") + .withSourceRetryWait("dataiahjxcd") + .withMaxConcurrentConnections("datadlxwsfddyqpfyn") + .withDisableMetricsCollection("datawmjsurhljjzsj") + .withQueryTimeout("datah") + .withAdditionalColumns("datayvtrsgfdmtfn") + .withSqlReaderQuery("dataq") + .withSqlReaderStoredProcedureName("dataegilbkzctqbvntl") + .withStoredProcedureParameters("datagj") + .withIsolationLevel("dataxqoydyislepdbsi") + .withProduceAdditionalTypes("datantsp") + .withPartitionOption("dataumpyytbjbmjbmtx") + .withPartitionSettings( + new SqlPartitionSettings() + .withPartitionColumnName("dataf") + .withPartitionUpperBound("datag") + .withPartitionLowerBound("dataotvocjk")); + model = BinaryData.fromObject(model).toObject(AzureSqlSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlTableDatasetTests.java new file mode 100644 index 000000000000..e32335c4a097 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlTableDatasetTests.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureSqlTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureSqlTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSqlTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureSqlTable\",\"typeProperties\":{\"tableName\":\"databs\",\"schema\":\"datalonbzaowcahdkmb\",\"table\":\"datamihrijezbfsj\"},\"description\":\"czglkvbgukbsvb\",\"structure\":\"dataotygnbknhjg\",\"schema\":\"dataxaxw\",\"linkedServiceName\":{\"referenceName\":\"ffaspsdzkucsz\",\"parameters\":{\"zrn\":\"dataoaqipmnxclfrs\",\"wvpu\":\"datau\",\"n\":\"datafddtbfmekjcng\",\"aoy\":\"datadv\"}},\"parameters\":{\"nofxlttxoqx\":{\"type\":\"SecureString\",\"defaultValue\":\"datayxzmx\"},\"kcjhmmofbnivd\":{\"type\":\"Float\",\"defaultValue\":\"datazujsjirkrp\"},\"caccptbzetxyg\":{\"type\":\"SecureString\",\"defaultValue\":\"dataykpaxnlsfgny\"},\"eoxmpzzw\":{\"type\":\"Int\",\"defaultValue\":\"dataceecvjwyu\"}},\"annotations\":[\"datardvhaztkxbi\",\"datazfgxmbry\"],\"folder\":{\"name\":\"ibio\"},\"\":{\"wdrtxtfdaglmrco\":\"datasykqfd\",\"hubymfp\":\"datazzertkounzsiy\"}}") + .toObject(AzureSqlTableDataset.class); + Assertions.assertEquals("czglkvbgukbsvb", model.description()); + Assertions.assertEquals("ffaspsdzkucsz", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("nofxlttxoqx").type()); + Assertions.assertEquals("ibio", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSqlTableDataset model = + new AzureSqlTableDataset() + .withDescription("czglkvbgukbsvb") + .withStructure("dataotygnbknhjg") + .withSchema("dataxaxw") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ffaspsdzkucsz") + .withParameters( + mapOf( + "zrn", + "dataoaqipmnxclfrs", + "wvpu", + "datau", + "n", + "datafddtbfmekjcng", + "aoy", + "datadv"))) + .withParameters( + mapOf( + "nofxlttxoqx", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datayxzmx"), + "kcjhmmofbnivd", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datazujsjirkrp"), + "caccptbzetxyg", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("dataykpaxnlsfgny"), + "eoxmpzzw", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataceecvjwyu"))) + .withAnnotations(Arrays.asList("datardvhaztkxbi", "datazfgxmbry")) + .withFolder(new DatasetFolder().withName("ibio")) + .withTableName("databs") + .withSchemaTypePropertiesSchema("datalonbzaowcahdkmb") + .withTable("datamihrijezbfsj"); + model = BinaryData.fromObject(model).toObject(AzureSqlTableDataset.class); + Assertions.assertEquals("czglkvbgukbsvb", model.description()); + Assertions.assertEquals("ffaspsdzkucsz", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("nofxlttxoqx").type()); + Assertions.assertEquals("ibio", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..d7b4399af629 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSqlTableDatasetTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureSqlTableDatasetTypeProperties; + +public final class AzureSqlTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSqlTableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"dataikze\",\"schema\":\"datannf\",\"table\":\"datatkqowsd\"}") + .toObject(AzureSqlTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSqlTableDatasetTypeProperties model = + new AzureSqlTableDatasetTypeProperties() + .withTableName("dataikze") + .withSchema("datannf") + .withTable("datatkqowsd"); + model = BinaryData.fromObject(model).toObject(AzureSqlTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSynapseArtifactsLinkedServiceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSynapseArtifactsLinkedServiceTests.java new file mode 100644 index 000000000000..4a7dca55d9ae --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSynapseArtifactsLinkedServiceTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureSynapseArtifactsLinkedService; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureSynapseArtifactsLinkedServiceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSynapseArtifactsLinkedService model = + BinaryData + .fromString( + "{\"type\":\"AzureSynapseArtifacts\",\"typeProperties\":{\"endpoint\":\"datavvb\",\"authentication\":\"datanpriyttiqdcjg\",\"workspaceResourceId\":\"datacwmq\"},\"connectVia\":{\"referenceName\":\"woetjrfruc\",\"parameters\":{\"expothtpaqm\":\"datawdxbpvbsibzmvdey\",\"kymqmgudvy\":\"datawieshqiel\",\"lcwdg\":\"dataecuve\"}},\"description\":\"kjvrr\",\"parameters\":{\"doxpvqpblqubfpe\":{\"type\":\"Int\",\"defaultValue\":\"dataehyirsvr\"}},\"annotations\":[\"datagynheamzlqvaj\"],\"\":{\"sythuioixpfgqlw\":\"datavc\"}}") + .toObject(AzureSynapseArtifactsLinkedService.class); + Assertions.assertEquals("woetjrfruc", model.connectVia().referenceName()); + Assertions.assertEquals("kjvrr", model.description()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("doxpvqpblqubfpe").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSynapseArtifactsLinkedService model = + new AzureSynapseArtifactsLinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("woetjrfruc") + .withParameters( + mapOf( + "expothtpaqm", + "datawdxbpvbsibzmvdey", + "kymqmgudvy", + "datawieshqiel", + "lcwdg", + "dataecuve"))) + .withDescription("kjvrr") + .withParameters( + mapOf( + "doxpvqpblqubfpe", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataehyirsvr"))) + .withAnnotations(Arrays.asList("datagynheamzlqvaj")) + .withEndpoint("datavvb") + .withAuthentication("datanpriyttiqdcjg") + .withWorkspaceResourceId("datacwmq"); + model = BinaryData.fromObject(model).toObject(AzureSynapseArtifactsLinkedService.class); + Assertions.assertEquals("woetjrfruc", model.connectVia().referenceName()); + Assertions.assertEquals("kjvrr", model.description()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("doxpvqpblqubfpe").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSynapseArtifactsLinkedServiceTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSynapseArtifactsLinkedServiceTypePropertiesTests.java new file mode 100644 index 000000000000..8ab731fd30a0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureSynapseArtifactsLinkedServiceTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureSynapseArtifactsLinkedServiceTypeProperties; + +public final class AzureSynapseArtifactsLinkedServiceTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureSynapseArtifactsLinkedServiceTypeProperties model = + BinaryData + .fromString( + "{\"endpoint\":\"dataojwvvqcjrmnverbf\",\"authentication\":\"datahuw\",\"workspaceResourceId\":\"dataitqeyonmoig\"}") + .toObject(AzureSynapseArtifactsLinkedServiceTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureSynapseArtifactsLinkedServiceTypeProperties model = + new AzureSynapseArtifactsLinkedServiceTypeProperties() + .withEndpoint("dataojwvvqcjrmnverbf") + .withAuthentication("datahuw") + .withWorkspaceResourceId("dataitqeyonmoig"); + model = BinaryData.fromObject(model).toObject(AzureSynapseArtifactsLinkedServiceTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureTableDatasetTests.java new file mode 100644 index 000000000000..65bae5b8fcc8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureTableDatasetTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureTableDataset model = + BinaryData + .fromString( + "{\"type\":\"AzureTable\",\"typeProperties\":{\"tableName\":\"dataazofm\"},\"description\":\"vtemaspmanydscdk\",\"structure\":\"datadpwjcbhaahntof\",\"schema\":\"datafh\",\"linkedServiceName\":{\"referenceName\":\"fixoskk\",\"parameters\":{\"ujybsrwz\":\"dataiv\",\"t\":\"datamr\",\"ikesmkwtzgfr\":\"datadhmfppinm\"}},\"parameters\":{\"btqhvmmniiqyhol\":{\"type\":\"String\",\"defaultValue\":\"dataerxlobk\"},\"nq\":{\"type\":\"String\",\"defaultValue\":\"dataskbggi\"}},\"annotations\":[\"datatmwpblxk\"],\"folder\":{\"name\":\"gvxrktjcjigc\"},\"\":{\"efpgeedyyb\":\"datapanbqxasevc\"}}") + .toObject(AzureTableDataset.class); + Assertions.assertEquals("vtemaspmanydscdk", model.description()); + Assertions.assertEquals("fixoskk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("btqhvmmniiqyhol").type()); + Assertions.assertEquals("gvxrktjcjigc", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureTableDataset model = + new AzureTableDataset() + .withDescription("vtemaspmanydscdk") + .withStructure("datadpwjcbhaahntof") + .withSchema("datafh") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("fixoskk") + .withParameters(mapOf("ujybsrwz", "dataiv", "t", "datamr", "ikesmkwtzgfr", "datadhmfppinm"))) + .withParameters( + mapOf( + "btqhvmmniiqyhol", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataerxlobk"), + "nq", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataskbggi"))) + .withAnnotations(Arrays.asList("datatmwpblxk")) + .withFolder(new DatasetFolder().withName("gvxrktjcjigc")) + .withTableName("dataazofm"); + model = BinaryData.fromObject(model).toObject(AzureTableDataset.class); + Assertions.assertEquals("vtemaspmanydscdk", model.description()); + Assertions.assertEquals("fixoskk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("btqhvmmniiqyhol").type()); + Assertions.assertEquals("gvxrktjcjigc", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..240d9e54b580 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureTableDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.AzureTableDatasetTypeProperties; + +public final class AzureTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureTableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"datauholaemwcgimmri\"}") + .toObject(AzureTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureTableDatasetTypeProperties model = + new AzureTableDatasetTypeProperties().withTableName("datauholaemwcgimmri"); + model = BinaryData.fromObject(model).toObject(AzureTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureTableSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureTableSourceTests.java new file mode 100644 index 000000000000..cf109b628aa5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/AzureTableSourceTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.AzureTableSource; + +public final class AzureTableSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureTableSource model = + BinaryData + .fromString( + "{\"type\":\"AzureTableSource\",\"azureTableSourceQuery\":\"datazgzscgs\",\"azureTableSourceIgnoreTableNotFound\":\"dataujkeytpmlrjnnbmo\",\"queryTimeout\":\"dataytqtvatujphqvfx\",\"additionalColumns\":\"dataogwghxoxwp\",\"sourceRetryCount\":\"datakkmpfnwd\",\"sourceRetryWait\":\"datazwmtsm\",\"maxConcurrentConnections\":\"dataciyp\",\"disableMetricsCollection\":\"datanrgmgnvcusv\",\"\":{\"sn\":\"datazbdbv\",\"fom\":\"datahym\"}}") + .toObject(AzureTableSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureTableSource model = + new AzureTableSource() + .withSourceRetryCount("datakkmpfnwd") + .withSourceRetryWait("datazwmtsm") + .withMaxConcurrentConnections("dataciyp") + .withDisableMetricsCollection("datanrgmgnvcusv") + .withQueryTimeout("dataytqtvatujphqvfx") + .withAdditionalColumns("dataogwghxoxwp") + .withAzureTableSourceQuery("datazgzscgs") + .withAzureTableSourceIgnoreTableNotFound("dataujkeytpmlrjnnbmo"); + model = BinaryData.fromObject(model).toObject(AzureTableSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BigDataPoolParametrizationReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BigDataPoolParametrizationReferenceTests.java new file mode 100644 index 000000000000..209a1db0b74b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BigDataPoolParametrizationReferenceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.BigDataPoolParametrizationReference; +import com.azure.resourcemanager.datafactory.models.BigDataPoolReferenceType; +import org.junit.jupiter.api.Assertions; + +public final class BigDataPoolParametrizationReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BigDataPoolParametrizationReference model = + BinaryData + .fromString("{\"type\":\"BigDataPoolReference\",\"referenceName\":\"datazxphhwn\"}") + .toObject(BigDataPoolParametrizationReference.class); + Assertions.assertEquals(BigDataPoolReferenceType.BIG_DATA_POOL_REFERENCE, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BigDataPoolParametrizationReference model = + new BigDataPoolParametrizationReference() + .withType(BigDataPoolReferenceType.BIG_DATA_POOL_REFERENCE) + .withReferenceName("datazxphhwn"); + model = BinaryData.fromObject(model).toObject(BigDataPoolParametrizationReference.class); + Assertions.assertEquals(BigDataPoolReferenceType.BIG_DATA_POOL_REFERENCE, model.type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinaryDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinaryDatasetTests.java new file mode 100644 index 000000000000..82ff1e74e36c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinaryDatasetTests.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.BinaryDataset; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetLocation; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class BinaryDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BinaryDataset model = + BinaryData + .fromString( + "{\"type\":\"Binary\",\"typeProperties\":{\"location\":{\"type\":\"DatasetLocation\",\"folderPath\":\"datapujzfl\",\"fileName\":\"datadsgxcelujiswlluu\",\"\":{\"fxzf\":\"datafw\",\"eupcknecexkgrv\":\"datau\",\"yt\":\"datapsjdmng\",\"yxcnwawox\":\"datapdz\"}},\"compression\":{\"type\":\"datazbejqfbifop\",\"level\":\"dataxdwdrpazqjkrfm\",\"\":{\"gp\":\"datatfcuuugtj\",\"nnzm\":\"dataayiawohfm\",\"idzr\":\"datacjjkmqenh\",\"lo\":\"datavs\"}}},\"description\":\"vslvivqsuvwten\",\"structure\":\"datapijpkhc\",\"schema\":\"dataaqxukuicjufte\",\"linkedServiceName\":{\"referenceName\":\"iooanduewfhv\",\"parameters\":{\"gvzua\":\"datahxzubfjzabbw\",\"gavkmv\":\"dataxcdckixspsa\",\"kpzjbyetjxryopt\":\"dataxzerej\",\"z\":\"dataeitwhlbecgi\"}},\"parameters\":{\"hspbo\":{\"type\":\"String\",\"defaultValue\":\"datarrabovrwwxywp\"},\"skpeswyhhmifjua\":{\"type\":\"String\",\"defaultValue\":\"datafp\"},\"cmlae\":{\"type\":\"Array\",\"defaultValue\":\"datawvcmmpeglyuq\"},\"rorh\":{\"type\":\"Bool\",\"defaultValue\":\"databqufpnezsjzayml\"}},\"annotations\":[\"datazmsimehtcu\",\"datawdhtqqhyhnimxtn\",\"dataugisnomwnwngho\"],\"folder\":{\"name\":\"keyymicjixxfs\"},\"\":{\"veywetkrhlolmcn\":\"datartnuguefxxijteb\",\"npetlrnrde\":\"dataepfgsvbbvaqdl\",\"vxehuekdxljzvdo\":\"dataaw\"}}") + .toObject(BinaryDataset.class); + Assertions.assertEquals("vslvivqsuvwten", model.description()); + Assertions.assertEquals("iooanduewfhv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("hspbo").type()); + Assertions.assertEquals("keyymicjixxfs", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BinaryDataset model = + new BinaryDataset() + .withDescription("vslvivqsuvwten") + .withStructure("datapijpkhc") + .withSchema("dataaqxukuicjufte") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("iooanduewfhv") + .withParameters( + mapOf( + "gvzua", + "datahxzubfjzabbw", + "gavkmv", + "dataxcdckixspsa", + "kpzjbyetjxryopt", + "dataxzerej", + "z", + "dataeitwhlbecgi"))) + .withParameters( + mapOf( + "hspbo", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datarrabovrwwxywp"), + "skpeswyhhmifjua", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datafp"), + "cmlae", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datawvcmmpeglyuq"), + "rorh", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("databqufpnezsjzayml"))) + .withAnnotations(Arrays.asList("datazmsimehtcu", "datawdhtqqhyhnimxtn", "dataugisnomwnwngho")) + .withFolder(new DatasetFolder().withName("keyymicjixxfs")) + .withLocation( + new DatasetLocation() + .withFolderPath("datapujzfl") + .withFileName("datadsgxcelujiswlluu") + .withAdditionalProperties(mapOf("type", "DatasetLocation"))) + .withCompression( + new DatasetCompression() + .withType("datazbejqfbifop") + .withLevel("dataxdwdrpazqjkrfm") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(BinaryDataset.class); + Assertions.assertEquals("vslvivqsuvwten", model.description()); + Assertions.assertEquals("iooanduewfhv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("hspbo").type()); + Assertions.assertEquals("keyymicjixxfs", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinaryDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinaryDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..8f6ec12141df --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinaryDatasetTypePropertiesTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.BinaryDatasetTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetLocation; +import java.util.HashMap; +import java.util.Map; + +public final class BinaryDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BinaryDatasetTypeProperties model = + BinaryData + .fromString( + "{\"location\":{\"type\":\"DatasetLocation\",\"folderPath\":\"datarblerlprdaqcc\",\"fileName\":\"datacbnygd\",\"\":{\"zlrz\":\"dataxwbpwyykdig\",\"mjqmv\":\"datadasdni\"}},\"compression\":{\"type\":\"datagkiqla\",\"level\":\"dataqtwvcazekdzdz\",\"\":{\"lgf\":\"datajwztsmpchggry\",\"gfrrkdknczgoryw\":\"dataatig\",\"ka\":\"datavojtvmdevdlhqv\"}}}") + .toObject(BinaryDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BinaryDatasetTypeProperties model = + new BinaryDatasetTypeProperties() + .withLocation( + new DatasetLocation() + .withFolderPath("datarblerlprdaqcc") + .withFileName("datacbnygd") + .withAdditionalProperties(mapOf("type", "DatasetLocation"))) + .withCompression( + new DatasetCompression() + .withType("datagkiqla") + .withLevel("dataqtwvcazekdzdz") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(BinaryDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinaryReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinaryReadSettingsTests.java new file mode 100644 index 000000000000..d1c9364d1a1c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinaryReadSettingsTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.BinaryReadSettings; +import com.azure.resourcemanager.datafactory.models.CompressionReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class BinaryReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BinaryReadSettings model = + BinaryData + .fromString( + "{\"type\":\"BinaryReadSettings\",\"compressionProperties\":{\"type\":\"CompressionReadSettings\",\"\":{\"lyznbbcimxznfoak\":\"datapjozgryocgwkph\",\"bbh\":\"datajwiswzn\",\"behv\":\"dataleiwfi\"}},\"\":{\"zgnyfhqyli\":\"datahltnds\",\"eninaf\":\"datagnbhz\",\"tzkcol\":\"dataagaocv\"}}") + .toObject(BinaryReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BinaryReadSettings model = + new BinaryReadSettings() + .withCompressionProperties( + new CompressionReadSettings().withAdditionalProperties(mapOf("type", "CompressionReadSettings"))); + model = BinaryData.fromObject(model).toObject(BinaryReadSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinarySinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinarySinkTests.java new file mode 100644 index 000000000000..7c577bb0222a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinarySinkTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.BinarySink; +import com.azure.resourcemanager.datafactory.models.StoreWriteSettings; +import java.util.HashMap; +import java.util.Map; + +public final class BinarySinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BinarySink model = + BinaryData + .fromString( + "{\"type\":\"BinarySink\",\"storeSettings\":{\"type\":\"StoreWriteSettings\",\"maxConcurrentConnections\":\"datax\",\"disableMetricsCollection\":\"datanmsfqntakroxkurf\",\"copyBehavior\":\"datawcmzpwkcagfqg\",\"\":{\"prdpvblonlh\":\"datamj\",\"zqavimxnhylwog\":\"datagexwjhic\",\"bgda\":\"datavl\",\"hdxlfntdclkmgg\":\"datat\"}},\"writeBatchSize\":\"datalfyxaiaf\",\"writeBatchTimeout\":\"datamxekfvycvhwduo\",\"sinkRetryCount\":\"dataapzzcxk\",\"sinkRetryWait\":\"datasbahcassqeybd\",\"maxConcurrentConnections\":\"dataeyakg\",\"disableMetricsCollection\":\"dataohfq\",\"\":{\"awctaarboxal\":\"datakicxtumqi\",\"xwevl\":\"dataoadmcvvkjnpe\",\"bo\":\"datahuahlqm\",\"xoyllx\":\"datagpmmz\"}}") + .toObject(BinarySink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BinarySink model = + new BinarySink() + .withWriteBatchSize("datalfyxaiaf") + .withWriteBatchTimeout("datamxekfvycvhwduo") + .withSinkRetryCount("dataapzzcxk") + .withSinkRetryWait("datasbahcassqeybd") + .withMaxConcurrentConnections("dataeyakg") + .withDisableMetricsCollection("dataohfq") + .withStoreSettings( + new StoreWriteSettings() + .withMaxConcurrentConnections("datax") + .withDisableMetricsCollection("datanmsfqntakroxkurf") + .withCopyBehavior("datawcmzpwkcagfqg") + .withAdditionalProperties(mapOf("type", "StoreWriteSettings"))); + model = BinaryData.fromObject(model).toObject(BinarySink.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinarySourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinarySourceTests.java new file mode 100644 index 000000000000..afa583d55620 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BinarySourceTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.BinaryReadSettings; +import com.azure.resourcemanager.datafactory.models.BinarySource; +import com.azure.resourcemanager.datafactory.models.CompressionReadSettings; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class BinarySourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BinarySource model = + BinaryData + .fromString( + "{\"type\":\"BinarySource\",\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datadnok\",\"disableMetricsCollection\":\"datagiecjyftsn\",\"\":{\"tjc\":\"dataz\",\"xxbkqmagpdsuyy\":\"dataa\"}},\"formatSettings\":{\"type\":\"BinaryReadSettings\",\"compressionProperties\":{\"type\":\"CompressionReadSettings\",\"\":{\"hhvgddfzcnylz\":\"dataoox\",\"degfhofo\":\"datalhufsgcpwrtg\"}},\"\":{\"otjj\":\"dataiuik\",\"snr\":\"dataecxvkqjpovjvvx\",\"flqwqcxyiqppacji\":\"datawrbmhjm\",\"jzgnla\":\"datarllacylbtkxe\"}},\"sourceRetryCount\":\"datattexaugoj\",\"sourceRetryWait\":\"datajezr\",\"maxConcurrentConnections\":\"datao\",\"disableMetricsCollection\":\"datawlntenhnqtvx\",\"\":{\"lceo\":\"dataehhehotqorrv\",\"gjir\":\"datalyugzl\"}}") + .toObject(BinarySource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BinarySource model = + new BinarySource() + .withSourceRetryCount("datattexaugoj") + .withSourceRetryWait("datajezr") + .withMaxConcurrentConnections("datao") + .withDisableMetricsCollection("datawlntenhnqtvx") + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datadnok") + .withDisableMetricsCollection("datagiecjyftsn") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withFormatSettings( + new BinaryReadSettings() + .withCompressionProperties( + new CompressionReadSettings() + .withAdditionalProperties(mapOf("type", "CompressionReadSettings")))); + model = BinaryData.fromObject(model).toObject(BinarySource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobEventsTriggerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobEventsTriggerTests.java new file mode 100644 index 000000000000..bdbf4f6d4d56 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobEventsTriggerTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.BlobEventTypes; +import com.azure.resourcemanager.datafactory.models.BlobEventsTrigger; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import com.azure.resourcemanager.datafactory.models.TriggerPipelineReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class BlobEventsTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BlobEventsTrigger model = + BinaryData + .fromString( + "{\"type\":\"BlobEventsTrigger\",\"typeProperties\":{\"blobPathBeginsWith\":\"bzjvzgyzenveiy\",\"blobPathEndsWith\":\"ngtylvdumpm\",\"ignoreEmptyBlobs\":true,\"events\":[\"Microsoft.Storage.BlobDeleted\",\"Microsoft.Storage.BlobDeleted\"],\"scope\":\"chdy\"},\"pipelines\":[{\"pipelineReference\":{\"referenceName\":\"m\",\"name\":\"gdjbl\"},\"parameters\":{\"auetzp\":\"dataeclf\"}}],\"description\":\"cfgrtgnvlrm\",\"runtimeState\":\"Stopped\",\"annotations\":[\"dataxsybnwogvkc\"],\"\":{\"lvinxwtxtetwqk\":\"datavrqkmpqs\",\"rvkneo\":\"datazauumzwlr\",\"zvugqwxslisgfx\":\"dataplng\",\"llgrckoxkpjzyc\":\"datayfeqajtzquhqrj\"}}") + .toObject(BlobEventsTrigger.class); + Assertions.assertEquals("cfgrtgnvlrm", model.description()); + Assertions.assertEquals("m", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("gdjbl", model.pipelines().get(0).pipelineReference().name()); + Assertions.assertEquals("bzjvzgyzenveiy", model.blobPathBeginsWith()); + Assertions.assertEquals("ngtylvdumpm", model.blobPathEndsWith()); + Assertions.assertEquals(true, model.ignoreEmptyBlobs()); + Assertions.assertEquals(BlobEventTypes.MICROSOFT_STORAGE_BLOB_DELETED, model.events().get(0)); + Assertions.assertEquals("chdy", model.scope()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BlobEventsTrigger model = + new BlobEventsTrigger() + .withDescription("cfgrtgnvlrm") + .withAnnotations(Arrays.asList("dataxsybnwogvkc")) + .withPipelines( + Arrays + .asList( + new TriggerPipelineReference() + .withPipelineReference(new PipelineReference().withReferenceName("m").withName("gdjbl")) + .withParameters(mapOf("auetzp", "dataeclf")))) + .withBlobPathBeginsWith("bzjvzgyzenveiy") + .withBlobPathEndsWith("ngtylvdumpm") + .withIgnoreEmptyBlobs(true) + .withEvents( + Arrays + .asList( + BlobEventTypes.MICROSOFT_STORAGE_BLOB_DELETED, + BlobEventTypes.MICROSOFT_STORAGE_BLOB_DELETED)) + .withScope("chdy"); + model = BinaryData.fromObject(model).toObject(BlobEventsTrigger.class); + Assertions.assertEquals("cfgrtgnvlrm", model.description()); + Assertions.assertEquals("m", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("gdjbl", model.pipelines().get(0).pipelineReference().name()); + Assertions.assertEquals("bzjvzgyzenveiy", model.blobPathBeginsWith()); + Assertions.assertEquals("ngtylvdumpm", model.blobPathEndsWith()); + Assertions.assertEquals(true, model.ignoreEmptyBlobs()); + Assertions.assertEquals(BlobEventTypes.MICROSOFT_STORAGE_BLOB_DELETED, model.events().get(0)); + Assertions.assertEquals("chdy", model.scope()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobEventsTriggerTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobEventsTriggerTypePropertiesTests.java new file mode 100644 index 000000000000..236432f59dc8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobEventsTriggerTypePropertiesTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.BlobEventsTriggerTypeProperties; +import com.azure.resourcemanager.datafactory.models.BlobEventTypes; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class BlobEventsTriggerTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BlobEventsTriggerTypeProperties model = + BinaryData + .fromString( + "{\"blobPathBeginsWith\":\"zjwugrjio\",\"blobPathEndsWith\":\"cuxgimfftvylfke\",\"ignoreEmptyBlobs\":true,\"events\":[\"Microsoft.Storage.BlobCreated\"],\"scope\":\"x\"}") + .toObject(BlobEventsTriggerTypeProperties.class); + Assertions.assertEquals("zjwugrjio", model.blobPathBeginsWith()); + Assertions.assertEquals("cuxgimfftvylfke", model.blobPathEndsWith()); + Assertions.assertEquals(true, model.ignoreEmptyBlobs()); + Assertions.assertEquals(BlobEventTypes.MICROSOFT_STORAGE_BLOB_CREATED, model.events().get(0)); + Assertions.assertEquals("x", model.scope()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BlobEventsTriggerTypeProperties model = + new BlobEventsTriggerTypeProperties() + .withBlobPathBeginsWith("zjwugrjio") + .withBlobPathEndsWith("cuxgimfftvylfke") + .withIgnoreEmptyBlobs(true) + .withEvents(Arrays.asList(BlobEventTypes.MICROSOFT_STORAGE_BLOB_CREATED)) + .withScope("x"); + model = BinaryData.fromObject(model).toObject(BlobEventsTriggerTypeProperties.class); + Assertions.assertEquals("zjwugrjio", model.blobPathBeginsWith()); + Assertions.assertEquals("cuxgimfftvylfke", model.blobPathEndsWith()); + Assertions.assertEquals(true, model.ignoreEmptyBlobs()); + Assertions.assertEquals(BlobEventTypes.MICROSOFT_STORAGE_BLOB_CREATED, model.events().get(0)); + Assertions.assertEquals("x", model.scope()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobSinkTests.java new file mode 100644 index 000000000000..c471df36db1a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobSinkTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.BlobSink; +import com.azure.resourcemanager.datafactory.models.MetadataItem; +import java.util.Arrays; + +public final class BlobSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BlobSink model = + BinaryData + .fromString( + "{\"type\":\"BlobSink\",\"blobWriterOverwriteFiles\":\"dataahzylspzcyrhynl\",\"blobWriterDateTimeFormat\":\"datariaecvagud\",\"blobWriterAddHeader\":\"dataadgyhqrasxe\",\"copyBehavior\":\"datajqqhbkxiu\",\"metadata\":[{\"name\":\"databhzdjvdyrzijggb\",\"value\":\"datapzgvq\"},{\"name\":\"datanxzaliicrut\",\"value\":\"datamflvxilaytjywf\"}],\"writeBatchSize\":\"datawnoghqdl\",\"writeBatchTimeout\":\"datawqngpvvnbuknvku\",\"sinkRetryCount\":\"datasz\",\"sinkRetryWait\":\"datauqbuvpbeswgkre\",\"maxConcurrentConnections\":\"datapufkcamzcbzgikl\",\"disableMetricsCollection\":\"dataegcg\",\"\":{\"mmcbiktetzvqtce\":\"datapbsie\",\"pdnbzqweohmlkzhx\":\"datavcsbyimygswdu\",\"haerhxd\":\"datadmauanxzrqt\",\"bqmoguy\":\"datahkbrkhjjbwelicrx\"}}") + .toObject(BlobSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BlobSink model = + new BlobSink() + .withWriteBatchSize("datawnoghqdl") + .withWriteBatchTimeout("datawqngpvvnbuknvku") + .withSinkRetryCount("datasz") + .withSinkRetryWait("datauqbuvpbeswgkre") + .withMaxConcurrentConnections("datapufkcamzcbzgikl") + .withDisableMetricsCollection("dataegcg") + .withBlobWriterOverwriteFiles("dataahzylspzcyrhynl") + .withBlobWriterDateTimeFormat("datariaecvagud") + .withBlobWriterAddHeader("dataadgyhqrasxe") + .withCopyBehavior("datajqqhbkxiu") + .withMetadata( + Arrays + .asList( + new MetadataItem().withName("databhzdjvdyrzijggb").withValue("datapzgvq"), + new MetadataItem().withName("datanxzaliicrut").withValue("datamflvxilaytjywf"))); + model = BinaryData.fromObject(model).toObject(BlobSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobSourceTests.java new file mode 100644 index 000000000000..149b4cbc1ecf --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.BlobSource; + +public final class BlobSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BlobSource model = + BinaryData + .fromString( + "{\"type\":\"BlobSource\",\"treatEmptyAsNull\":\"datakh\",\"skipHeaderLineCount\":\"datatecsmocqwey\",\"recursive\":\"dataakettmfcxviwf\",\"sourceRetryCount\":\"datajxxbsafqiwldu\",\"sourceRetryWait\":\"datasyjzdasgkfz\",\"maxConcurrentConnections\":\"datahqomuzohnpkofklb\",\"disableMetricsCollection\":\"dataln\",\"\":{\"mmvazvwzienij\":\"datafyvowl\",\"jxdnkgztfgcu\":\"datanmgdpxeivr\",\"tqggzahngn\":\"datavbreh\",\"z\":\"dataseiidfpwbybmxf\"}}") + .toObject(BlobSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BlobSource model = + new BlobSource() + .withSourceRetryCount("datajxxbsafqiwldu") + .withSourceRetryWait("datasyjzdasgkfz") + .withMaxConcurrentConnections("datahqomuzohnpkofklb") + .withDisableMetricsCollection("dataln") + .withTreatEmptyAsNull("datakh") + .withSkipHeaderLineCount("datatecsmocqwey") + .withRecursive("dataakettmfcxviwf"); + model = BinaryData.fromObject(model).toObject(BlobSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobTriggerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobTriggerTests.java new file mode 100644 index 000000000000..e16a23bbd7aa --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobTriggerTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.BlobTrigger; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import com.azure.resourcemanager.datafactory.models.TriggerPipelineReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class BlobTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BlobTrigger model = + BinaryData + .fromString( + "{\"type\":\"BlobTrigger\",\"typeProperties\":{\"folderPath\":\"bvgwylta\",\"maxConcurrency\":155779144,\"linkedService\":{\"referenceName\":\"gbelxmulyalupijq\",\"parameters\":{\"wetkrmqitmcxqahx\":\"datady\",\"dceimlu\":\"datanlor\",\"oxrj\":\"dataqxjxqqbkfdnski\"}}},\"pipelines\":[{\"pipelineReference\":{\"referenceName\":\"cicqaufhxe\",\"name\":\"bcxeecgf\"},\"parameters\":{\"ayybwxqryyltnfwl\":\"dataji\",\"mgijevfjnv\":\"datakukmdeqrpu\",\"f\":\"dataokwjmteh\"}},{\"pipelineReference\":{\"referenceName\":\"xtkvpejtdlqorcyp\",\"name\":\"wfalgzsg\"},\"parameters\":{\"ducvhhayqx\":\"dataclzmjhiqgi\",\"ujenobf\":\"datacrsho\",\"vtzrg\":\"dataiscauudxf\"}},{\"pipelineReference\":{\"referenceName\":\"xbrfqi\",\"name\":\"wfxmdotdgvsoyp\"},\"parameters\":{\"ypzcql\":\"dataqvczd\",\"hlipxkxhj\":\"datauhbkapbgmjodfs\"}}],\"description\":\"vsjuvjmnsgvf\",\"runtimeState\":\"Started\",\"annotations\":[\"dataplvglwx\",\"datapiwpi\",\"dataydxmplxzrofscib\",\"datatxyjq\"],\"\":{\"da\":\"datayzxzkpum\",\"rrpzcvg\":\"databoqeteavphup\"}}") + .toObject(BlobTrigger.class); + Assertions.assertEquals("vsjuvjmnsgvf", model.description()); + Assertions.assertEquals("cicqaufhxe", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("bcxeecgf", model.pipelines().get(0).pipelineReference().name()); + Assertions.assertEquals("bvgwylta", model.folderPath()); + Assertions.assertEquals(155779144, model.maxConcurrency()); + Assertions.assertEquals("gbelxmulyalupijq", model.linkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BlobTrigger model = + new BlobTrigger() + .withDescription("vsjuvjmnsgvf") + .withAnnotations(Arrays.asList("dataplvglwx", "datapiwpi", "dataydxmplxzrofscib", "datatxyjq")) + .withPipelines( + Arrays + .asList( + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("cicqaufhxe").withName("bcxeecgf")) + .withParameters( + mapOf( + "ayybwxqryyltnfwl", + "dataji", + "mgijevfjnv", + "datakukmdeqrpu", + "f", + "dataokwjmteh")), + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("xtkvpejtdlqorcyp").withName("wfalgzsg")) + .withParameters( + mapOf( + "ducvhhayqx", + "dataclzmjhiqgi", + "ujenobf", + "datacrsho", + "vtzrg", + "dataiscauudxf")), + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("xbrfqi").withName("wfxmdotdgvsoyp")) + .withParameters(mapOf("ypzcql", "dataqvczd", "hlipxkxhj", "datauhbkapbgmjodfs")))) + .withFolderPath("bvgwylta") + .withMaxConcurrency(155779144) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("gbelxmulyalupijq") + .withParameters( + mapOf("wetkrmqitmcxqahx", "datady", "dceimlu", "datanlor", "oxrj", "dataqxjxqqbkfdnski"))); + model = BinaryData.fromObject(model).toObject(BlobTrigger.class); + Assertions.assertEquals("vsjuvjmnsgvf", model.description()); + Assertions.assertEquals("cicqaufhxe", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("bcxeecgf", model.pipelines().get(0).pipelineReference().name()); + Assertions.assertEquals("bvgwylta", model.folderPath()); + Assertions.assertEquals(155779144, model.maxConcurrency()); + Assertions.assertEquals("gbelxmulyalupijq", model.linkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobTriggerTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobTriggerTypePropertiesTests.java new file mode 100644 index 000000000000..c4c1a91208f3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/BlobTriggerTypePropertiesTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.BlobTriggerTypeProperties; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class BlobTriggerTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BlobTriggerTypeProperties model = + BinaryData + .fromString( + "{\"folderPath\":\"hknnvjgc\",\"maxConcurrency\":1468097285,\"linkedService\":{\"referenceName\":\"efewofhjonqkbn\",\"parameters\":{\"uvr\":\"dataattzxvfsrufj\"}}}") + .toObject(BlobTriggerTypeProperties.class); + Assertions.assertEquals("hknnvjgc", model.folderPath()); + Assertions.assertEquals(1468097285, model.maxConcurrency()); + Assertions.assertEquals("efewofhjonqkbn", model.linkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BlobTriggerTypeProperties model = + new BlobTriggerTypeProperties() + .withFolderPath("hknnvjgc") + .withMaxConcurrency(1468097285) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("efewofhjonqkbn") + .withParameters(mapOf("uvr", "dataattzxvfsrufj"))); + model = BinaryData.fromObject(model).toObject(BlobTriggerTypeProperties.class); + Assertions.assertEquals("hknnvjgc", model.folderPath()); + Assertions.assertEquals(1468097285, model.maxConcurrency()); + Assertions.assertEquals("efewofhjonqkbn", model.linkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CassandraSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CassandraSourceTests.java new file mode 100644 index 000000000000..b4528a147136 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CassandraSourceTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CassandraSource; +import com.azure.resourcemanager.datafactory.models.CassandraSourceReadConsistencyLevels; +import org.junit.jupiter.api.Assertions; + +public final class CassandraSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CassandraSource model = + BinaryData + .fromString( + "{\"type\":\"CassandraSource\",\"query\":\"dataattaloomf\",\"consistencyLevel\":\"ALL\",\"queryTimeout\":\"datatwzslrprftq\",\"additionalColumns\":\"datavouyqzhoikemho\",\"sourceRetryCount\":\"dataabmxoo\",\"sourceRetryWait\":\"dataoogozerccz\",\"maxConcurrentConnections\":\"databnkgkuujeq\",\"disableMetricsCollection\":\"dataqafjkajlogvfn\",\"\":{\"wehjybboqyxi\":\"dataolvazkqkycgej\",\"vdgemymyddzjtx\":\"datac\",\"lys\":\"datavgslm\"}}") + .toObject(CassandraSource.class); + Assertions.assertEquals(CassandraSourceReadConsistencyLevels.ALL, model.consistencyLevel()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CassandraSource model = + new CassandraSource() + .withSourceRetryCount("dataabmxoo") + .withSourceRetryWait("dataoogozerccz") + .withMaxConcurrentConnections("databnkgkuujeq") + .withDisableMetricsCollection("dataqafjkajlogvfn") + .withQueryTimeout("datatwzslrprftq") + .withAdditionalColumns("datavouyqzhoikemho") + .withQuery("dataattaloomf") + .withConsistencyLevel(CassandraSourceReadConsistencyLevels.ALL); + model = BinaryData.fromObject(model).toObject(CassandraSource.class); + Assertions.assertEquals(CassandraSourceReadConsistencyLevels.ALL, model.consistencyLevel()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChainingTriggerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChainingTriggerTests.java new file mode 100644 index 000000000000..a3569b18c7a1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChainingTriggerTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ChainingTrigger; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import com.azure.resourcemanager.datafactory.models.TriggerPipelineReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ChainingTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChainingTrigger model = + BinaryData + .fromString( + "{\"type\":\"ChainingTrigger\",\"pipeline\":{\"pipelineReference\":{\"referenceName\":\"imcfmdh\",\"name\":\"lliscyxcluvjppuj\"},\"parameters\":{\"obltoargc\":\"datathshcjg\",\"gvfs\":\"datatgqyqwmzzcg\",\"ybxmuehfkbhymd\":\"dataabuurtuqw\"}},\"typeProperties\":{\"dependsOn\":[{\"referenceName\":\"s\",\"name\":\"j\"},{\"referenceName\":\"chhrnfa\",\"name\":\"e\"}],\"runDimension\":\"iww\"},\"description\":\"kxz\",\"runtimeState\":\"Started\",\"annotations\":[\"datalhmvc\",\"databiagwu\"],\"\":{\"ywtaufm\":\"datayi\"}}") + .toObject(ChainingTrigger.class); + Assertions.assertEquals("kxz", model.description()); + Assertions.assertEquals("imcfmdh", model.pipeline().pipelineReference().referenceName()); + Assertions.assertEquals("lliscyxcluvjppuj", model.pipeline().pipelineReference().name()); + Assertions.assertEquals("s", model.dependsOn().get(0).referenceName()); + Assertions.assertEquals("j", model.dependsOn().get(0).name()); + Assertions.assertEquals("iww", model.runDimension()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ChainingTrigger model = + new ChainingTrigger() + .withDescription("kxz") + .withAnnotations(Arrays.asList("datalhmvc", "databiagwu")) + .withPipeline( + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("imcfmdh").withName("lliscyxcluvjppuj")) + .withParameters( + mapOf( + "obltoargc", + "datathshcjg", + "gvfs", + "datatgqyqwmzzcg", + "ybxmuehfkbhymd", + "dataabuurtuqw"))) + .withDependsOn( + Arrays + .asList( + new PipelineReference().withReferenceName("s").withName("j"), + new PipelineReference().withReferenceName("chhrnfa").withName("e"))) + .withRunDimension("iww"); + model = BinaryData.fromObject(model).toObject(ChainingTrigger.class); + Assertions.assertEquals("kxz", model.description()); + Assertions.assertEquals("imcfmdh", model.pipeline().pipelineReference().referenceName()); + Assertions.assertEquals("lliscyxcluvjppuj", model.pipeline().pipelineReference().name()); + Assertions.assertEquals("s", model.dependsOn().get(0).referenceName()); + Assertions.assertEquals("j", model.dependsOn().get(0).name()); + Assertions.assertEquals("iww", model.runDimension()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChainingTriggerTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChainingTriggerTypePropertiesTests.java new file mode 100644 index 000000000000..ae823a51d66c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChainingTriggerTypePropertiesTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ChainingTriggerTypeProperties; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ChainingTriggerTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChainingTriggerTypeProperties model = + BinaryData + .fromString( + "{\"dependsOn\":[{\"referenceName\":\"fjno\",\"name\":\"ibcez\"},{\"referenceName\":\"tfyarlwl\",\"name\":\"jerqlbz\"},{\"referenceName\":\"sff\",\"name\":\"u\"}],\"runDimension\":\"ybteyht\"}") + .toObject(ChainingTriggerTypeProperties.class); + Assertions.assertEquals("fjno", model.dependsOn().get(0).referenceName()); + Assertions.assertEquals("ibcez", model.dependsOn().get(0).name()); + Assertions.assertEquals("ybteyht", model.runDimension()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ChainingTriggerTypeProperties model = + new ChainingTriggerTypeProperties() + .withDependsOn( + Arrays + .asList( + new PipelineReference().withReferenceName("fjno").withName("ibcez"), + new PipelineReference().withReferenceName("tfyarlwl").withName("jerqlbz"), + new PipelineReference().withReferenceName("sff").withName("u"))) + .withRunDimension("ybteyht"); + model = BinaryData.fromObject(model).toObject(ChainingTriggerTypeProperties.class); + Assertions.assertEquals("fjno", model.dependsOn().get(0).referenceName()); + Assertions.assertEquals("ibcez", model.dependsOn().get(0).name()); + Assertions.assertEquals("ybteyht", model.runDimension()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureFolderTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureFolderTests.java new file mode 100644 index 000000000000..4ad695abcb66 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureFolderTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureFolder; +import org.junit.jupiter.api.Assertions; + +public final class ChangeDataCaptureFolderTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChangeDataCaptureFolder model = + BinaryData.fromString("{\"name\":\"pkcvmwf\"}").toObject(ChangeDataCaptureFolder.class); + Assertions.assertEquals("pkcvmwf", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ChangeDataCaptureFolder model = new ChangeDataCaptureFolder().withName("pkcvmwf"); + model = BinaryData.fromObject(model).toObject(ChangeDataCaptureFolder.class); + Assertions.assertEquals("pkcvmwf", model.name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureListResponseTests.java new file mode 100644 index 000000000000..1d2b64212b6c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureListResponseTests.java @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCaptureResourceInner; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureFolder; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureListResponse; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.DataMapperMapping; +import com.azure.resourcemanager.datafactory.models.FrequencyType; +import com.azure.resourcemanager.datafactory.models.MapperConnection; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperPolicyRecurrence; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTable; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ChangeDataCaptureListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChangeDataCaptureListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"folder\":{\"name\":\"cgdz\"},\"description\":\"nr\",\"sourceConnectionsInfo\":[{\"sourceEntities\":[{},{}],\"connection\":{\"type\":\"linkedservicetype\"}},{\"sourceEntities\":[{},{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"}}],\"targetConnectionsInfo\":[{\"targetEntities\":[{},{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{}],\"relationships\":[\"datanamtuatmzw\"]},{\"targetEntities\":[{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{},{}],\"relationships\":[\"datamizvgbgatzuuvbx\"]},{\"targetEntities\":[{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{},{}],\"relationships\":[\"datahttzlswvajqfutlx\",\"dataoqza\",\"dataunwqr\",\"datazfrgqhaohcm\"]},{\"targetEntities\":[{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{}],\"relationships\":[\"datambpyryxamebly\",\"datayvk\",\"datakmrocxne\",\"datav\"]}],\"policy\":{\"mode\":\"tod\",\"recurrence\":{\"frequency\":\"Hour\",\"interval\":1443311872}},\"allowVNetOverride\":true,\"status\":\"gvoavyunssxlgh\"},\"name\":\"egjlgvvpa\",\"type\":\"ksgbuxan\",\"etag\":\"ygdhgaqipirpiwr\",\"\":{\"pibkephuu\":\"dataulopmjnlexwhcb\",\"qpbrlc\":\"dataerctatoyin\",\"uc\":\"datarduczkgofxyfs\",\"qnrmvvfko\":\"datacrrpcjttbstvje\"},\"id\":\"lghktuidvrm\"},{\"properties\":{\"folder\":{\"name\":\"pdwwexymzvlazi\"},\"description\":\"hpwvqsgnyyuu\",\"sourceConnectionsInfo\":[{\"sourceEntities\":[{}],\"connection\":{\"type\":\"linkedservicetype\"}},{\"sourceEntities\":[{},{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"}},{\"sourceEntities\":[{},{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"}},{\"sourceEntities\":[{},{}],\"connection\":{\"type\":\"linkedservicetype\"}}],\"targetConnectionsInfo\":[{\"targetEntities\":[{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{},{}],\"relationships\":[\"datasrfhf\"]},{\"targetEntities\":[{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{},{}],\"relationships\":[\"datawcdommpvfqaw\",\"datafgbrtt\"]},{\"targetEntities\":[{},{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{},{}],\"relationships\":[\"datahajlfn\",\"datahiqfyuttdiy\",\"datab\"]},{\"targetEntities\":[{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{}],\"relationships\":[\"datak\",\"datactwwgzw\",\"datajlmec\"]}],\"policy\":{\"mode\":\"gygzyvn\",\"recurrence\":{\"frequency\":\"Minute\",\"interval\":488658265}},\"allowVNetOverride\":true,\"status\":\"moqqtlffhzbk\"},\"name\":\"jjjavfqnvhnq\",\"type\":\"wdogiyetesyp\",\"etag\":\"dbztjhqtfbov\",\"\":{\"hpsprkzyaupiac\":\"datakbwetnj\"},\"id\":\"n\"},{\"properties\":{\"folder\":{\"name\":\"wqro\"},\"description\":\"tuovmaonurj\",\"sourceConnectionsInfo\":[{\"sourceEntities\":[{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"}},{\"sourceEntities\":[{}],\"connection\":{\"type\":\"linkedservicetype\"}},{\"sourceEntities\":[{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"}},{\"sourceEntities\":[{}],\"connection\":{\"type\":\"linkedservicetype\"}}],\"targetConnectionsInfo\":[{\"targetEntities\":[{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{},{},{},{}],\"relationships\":[\"datascvsfxigctm\"]},{\"targetEntities\":[{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{}],\"relationships\":[\"dataccyd\",\"datatce\",\"datakdqkkyihzt\",\"dataeq\"]},{\"targetEntities\":[{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{},{}],\"relationships\":[\"dataychillcecfe\",\"datauwaoaguhicqlli\",\"datastacsjvhrweftkwq\"]}],\"policy\":{\"mode\":\"pmvssehaep\",\"recurrence\":{\"frequency\":\"Hour\",\"interval\":1216217570}},\"allowVNetOverride\":true,\"status\":\"upeuknijduyye\"},\"name\":\"ydjfb\",\"type\":\"yv\",\"etag\":\"ulrtywikdmh\",\"\":{\"ufr\":\"datauflgbhgauacdixm\",\"ozo\":\"dataryjqgdkf\"},\"id\":\"qb\"},{\"properties\":{\"folder\":{\"name\":\"vefgwbmqjchntas\"},\"description\":\"ymxbulpzealb\",\"sourceConnectionsInfo\":[{\"sourceEntities\":[{},{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"}},{\"sourceEntities\":[{},{}],\"connection\":{\"type\":\"linkedservicetype\"}},{\"sourceEntities\":[{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"}}],\"targetConnectionsInfo\":[{\"targetEntities\":[{},{},{}],\"connection\":{\"type\":\"linkedservicetype\"},\"dataMapperMappings\":[{}],\"relationships\":[\"datacmmzrrs\",\"dataubiwsdrnpxq\",\"dataodiffjxcjrmmua\"]}],\"policy\":{\"mode\":\"ibvjogjonmcy\",\"recurrence\":{\"frequency\":\"Hour\",\"interval\":2103208222}},\"allowVNetOverride\":false,\"status\":\"in\"},\"name\":\"fvfkak\",\"type\":\"ldtve\",\"etag\":\"oclzhz\",\"\":{\"amrdixtrekidswys\":\"datayuxgvttxpnrupz\"},\"id\":\"ruffgllukk\"}],\"nextLink\":\"vlxhrpqhvmblc\"}") + .toObject(ChangeDataCaptureListResponse.class); + Assertions.assertEquals("lghktuidvrm", model.value().get(0).id()); + Assertions.assertEquals("cgdz", model.value().get(0).folder().name()); + Assertions.assertEquals("nr", model.value().get(0).description()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.value().get(0).sourceConnectionsInfo().get(0).connection().type()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.value().get(0).targetConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals("tod", model.value().get(0).policy().mode()); + Assertions.assertEquals(FrequencyType.HOUR, model.value().get(0).policy().recurrence().frequency()); + Assertions.assertEquals(1443311872, model.value().get(0).policy().recurrence().interval()); + Assertions.assertEquals(true, model.value().get(0).allowVNetOverride()); + Assertions.assertEquals("gvoavyunssxlgh", model.value().get(0).status()); + Assertions.assertEquals("vlxhrpqhvmblc", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ChangeDataCaptureListResponse model = + new ChangeDataCaptureListResponse() + .withValue( + Arrays + .asList( + new ChangeDataCaptureResourceInner() + .withId("lghktuidvrm") + .withFolder(new ChangeDataCaptureFolder().withName("cgdz")) + .withDescription("nr") + .withSourceConnectionsInfo( + Arrays + .asList( + new MapperSourceConnectionsInfo() + .withSourceEntities(Arrays.asList(new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable(), + new MapperTable(), + new MapperTable(), + new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)))) + .withTargetConnectionsInfo( + Arrays + .asList( + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable(), + new MapperTable(), + new MapperTable(), + new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings(Arrays.asList(new DataMapperMapping())) + .withRelationships(Arrays.asList("datanamtuatmzw")), + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable(), new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings( + Arrays.asList(new DataMapperMapping(), new DataMapperMapping())) + .withRelationships(Arrays.asList("datamizvgbgatzuuvbx")), + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable(), new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings( + Arrays.asList(new DataMapperMapping(), new DataMapperMapping())) + .withRelationships( + Arrays + .asList( + "datahttzlswvajqfutlx", + "dataoqza", + "dataunwqr", + "datazfrgqhaohcm")), + new MapperTargetConnectionsInfo() + .withTargetEntities(Arrays.asList(new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings(Arrays.asList(new DataMapperMapping())) + .withRelationships( + Arrays + .asList( + "datambpyryxamebly", "datayvk", "datakmrocxne", "datav")))) + .withPolicy( + new MapperPolicy() + .withMode("tod") + .withRecurrence( + new MapperPolicyRecurrence() + .withFrequency(FrequencyType.HOUR) + .withInterval(1443311872))) + .withAllowVNetOverride(true) + .withStatus("gvoavyunssxlgh") + .withAdditionalProperties( + mapOf("name", "egjlgvvpa", "etag", "ygdhgaqipirpiwr", "type", "ksgbuxan")), + new ChangeDataCaptureResourceInner() + .withId("n") + .withFolder(new ChangeDataCaptureFolder().withName("pdwwexymzvlazi")) + .withDescription("hpwvqsgnyyuu") + .withSourceConnectionsInfo( + Arrays + .asList( + new MapperSourceConnectionsInfo() + .withSourceEntities(Arrays.asList(new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable(), + new MapperTable(), + new MapperTable(), + new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable(), + new MapperTable(), + new MapperTable(), + new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperSourceConnectionsInfo() + .withSourceEntities(Arrays.asList(new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)))) + .withTargetConnectionsInfo( + Arrays + .asList( + new MapperTargetConnectionsInfo() + .withTargetEntities(Arrays.asList(new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings( + Arrays.asList(new DataMapperMapping(), new DataMapperMapping())) + .withRelationships(Arrays.asList("datasrfhf")), + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable(), new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings( + Arrays.asList(new DataMapperMapping(), new DataMapperMapping())) + .withRelationships(Arrays.asList("datawcdommpvfqaw", "datafgbrtt")), + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable(), + new MapperTable(), + new MapperTable(), + new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings( + Arrays.asList(new DataMapperMapping(), new DataMapperMapping())) + .withRelationships( + Arrays.asList("datahajlfn", "datahiqfyuttdiy", "datab")), + new MapperTargetConnectionsInfo() + .withTargetEntities(Arrays.asList(new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings(Arrays.asList(new DataMapperMapping())) + .withRelationships(Arrays.asList("datak", "datactwwgzw", "datajlmec")))) + .withPolicy( + new MapperPolicy() + .withMode("gygzyvn") + .withRecurrence( + new MapperPolicyRecurrence() + .withFrequency(FrequencyType.MINUTE) + .withInterval(488658265))) + .withAllowVNetOverride(true) + .withStatus("moqqtlffhzbk") + .withAdditionalProperties( + mapOf("name", "jjjavfqnvhnq", "etag", "dbztjhqtfbov", "type", "wdogiyetesyp")), + new ChangeDataCaptureResourceInner() + .withId("qb") + .withFolder(new ChangeDataCaptureFolder().withName("wqro")) + .withDescription("tuovmaonurj") + .withSourceConnectionsInfo( + Arrays + .asList( + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable(), new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperSourceConnectionsInfo() + .withSourceEntities(Arrays.asList(new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable(), new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperSourceConnectionsInfo() + .withSourceEntities(Arrays.asList(new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)))) + .withTargetConnectionsInfo( + Arrays + .asList( + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable(), new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings( + Arrays + .asList( + new DataMapperMapping(), + new DataMapperMapping(), + new DataMapperMapping(), + new DataMapperMapping())) + .withRelationships(Arrays.asList("datascvsfxigctm")), + new MapperTargetConnectionsInfo() + .withTargetEntities(Arrays.asList(new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings(Arrays.asList(new DataMapperMapping())) + .withRelationships( + Arrays.asList("dataccyd", "datatce", "datakdqkkyihzt", "dataeq")), + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable(), new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings( + Arrays.asList(new DataMapperMapping(), new DataMapperMapping())) + .withRelationships( + Arrays + .asList( + "dataychillcecfe", + "datauwaoaguhicqlli", + "datastacsjvhrweftkwq")))) + .withPolicy( + new MapperPolicy() + .withMode("pmvssehaep") + .withRecurrence( + new MapperPolicyRecurrence() + .withFrequency(FrequencyType.HOUR) + .withInterval(1216217570))) + .withAllowVNetOverride(true) + .withStatus("upeuknijduyye") + .withAdditionalProperties(mapOf("name", "ydjfb", "etag", "ulrtywikdmh", "type", "yv")), + new ChangeDataCaptureResourceInner() + .withId("ruffgllukk") + .withFolder(new ChangeDataCaptureFolder().withName("vefgwbmqjchntas")) + .withDescription("ymxbulpzealb") + .withSourceConnectionsInfo( + Arrays + .asList( + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable(), + new MapperTable(), + new MapperTable(), + new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperSourceConnectionsInfo() + .withSourceEntities(Arrays.asList(new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable(), new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)))) + .withTargetConnectionsInfo( + Arrays + .asList( + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable(), new MapperTable(), new MapperTable())) + .withConnection( + new MapperConnection().withType(ConnectionType.LINKEDSERVICETYPE)) + .withDataMapperMappings(Arrays.asList(new DataMapperMapping())) + .withRelationships( + Arrays + .asList( + "datacmmzrrs", "dataubiwsdrnpxq", "dataodiffjxcjrmmua")))) + .withPolicy( + new MapperPolicy() + .withMode("ibvjogjonmcy") + .withRecurrence( + new MapperPolicyRecurrence() + .withFrequency(FrequencyType.HOUR) + .withInterval(2103208222))) + .withAllowVNetOverride(false) + .withStatus("in") + .withAdditionalProperties(mapOf("name", "fvfkak", "etag", "oclzhz", "type", "ldtve")))) + .withNextLink("vlxhrpqhvmblc"); + model = BinaryData.fromObject(model).toObject(ChangeDataCaptureListResponse.class); + Assertions.assertEquals("lghktuidvrm", model.value().get(0).id()); + Assertions.assertEquals("cgdz", model.value().get(0).folder().name()); + Assertions.assertEquals("nr", model.value().get(0).description()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.value().get(0).sourceConnectionsInfo().get(0).connection().type()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.value().get(0).targetConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals("tod", model.value().get(0).policy().mode()); + Assertions.assertEquals(FrequencyType.HOUR, model.value().get(0).policy().recurrence().frequency()); + Assertions.assertEquals(1443311872, model.value().get(0).policy().recurrence().interval()); + Assertions.assertEquals(true, model.value().get(0).allowVNetOverride()); + Assertions.assertEquals("gvoavyunssxlgh", model.value().get(0).status()); + Assertions.assertEquals("vlxhrpqhvmblc", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureResourceInnerTests.java new file mode 100644 index 000000000000..023eb202855b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureResourceInnerTests.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCaptureResourceInner; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureFolder; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.DataMapperMapping; +import com.azure.resourcemanager.datafactory.models.FrequencyType; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMappings; +import com.azure.resourcemanager.datafactory.models.MapperConnection; +import com.azure.resourcemanager.datafactory.models.MapperConnectionReference; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperPolicyRecurrence; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTable; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ChangeDataCaptureResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChangeDataCaptureResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"folder\":{\"name\":\"ehbhb\"},\"description\":\"sziryrandoyp\",\"sourceConnectionsInfo\":[{\"sourceEntities\":[{\"name\":\"ormkfqlwxldyk\",\"properties\":{}}],\"connection\":{\"linkedService\":{\"referenceName\":\"g\",\"parameters\":{\"sibjgs\":\"datanjpnnbmj\",\"yqegx\":\"datajxxahmrnad\",\"inbmh\":\"dataiv\",\"bkezn\":\"databjijkgqxnh\"}},\"linkedServiceType\":\"ujvaannggi\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{},{}]}}],\"targetConnectionsInfo\":[{\"targetEntities\":[{\"name\":\"wfekaumrrqmb\",\"properties\":{}},{\"name\":\"kratbnxwbj\",\"properties\":{}},{\"name\":\"birkfpksokdg\",\"properties\":{}}],\"connection\":{\"linkedService\":{\"referenceName\":\"ijymrhbguzozky\",\"parameters\":{\"zhhh\":\"dataf\",\"mffjkutycyarn\":\"datao\"}},\"linkedServiceType\":\"ohguabz\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{}]},\"dataMapperMappings\":[{\"targetEntityName\":\"z\",\"sourceEntityName\":\"oeocnhzqrott\",\"sourceConnectionReference\":{},\"attributeMappingInfo\":{},\"sourceDenormalizeInfo\":\"datayjzp\"},{\"targetEntityName\":\"rl\",\"sourceEntityName\":\"apqinf\",\"sourceConnectionReference\":{},\"attributeMappingInfo\":{},\"sourceDenormalizeInfo\":\"dataglqdhm\"}],\"relationships\":[\"dataralcxpjbyypsj\",\"dataqcjenkyhf\",\"datazv\",\"dataqxfx\"]},{\"targetEntities\":[{\"name\":\"cmpzqjhhhqx\",\"properties\":{}}],\"connection\":{\"linkedService\":{\"referenceName\":\"cacoyvivbsiz\",\"parameters\":{\"lzijiufehgmvflnw\":\"dataszlbscm\",\"kxrerlniylylyfwx\":\"datav\"}},\"linkedServiceType\":\"tgqztwhghmup\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{}]},\"dataMapperMappings\":[{\"targetEntityName\":\"bb\",\"sourceEntityName\":\"ftabenbbklqp\",\"sourceConnectionReference\":{},\"attributeMappingInfo\":{},\"sourceDenormalizeInfo\":\"dataafeddwwnlza\"}],\"relationships\":[\"datau\"]},{\"targetEntities\":[{\"name\":\"gookrtalvnb\",\"properties\":{}},{\"name\":\"bemeluclvd\",\"properties\":{}},{\"name\":\"kyrdnqodx\",\"properties\":{}},{\"name\":\"xhqf\",\"properties\":{}}],\"connection\":{\"linkedService\":{\"referenceName\":\"zoqgyipemchga\",\"parameters\":{\"xptlghwzho\":\"datazuejd\",\"s\":\"dataewj\",\"vodrrslblxydkxr\":\"dataliuhqawmoaiancz\"}},\"linkedServiceType\":\"vbxiwkgfbqlj\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{},{},{}]},\"dataMapperMappings\":[{\"targetEntityName\":\"okulehurqlrqf\",\"sourceEntityName\":\"weyurkphyjd\",\"sourceConnectionReference\":{},\"attributeMappingInfo\":{},\"sourceDenormalizeInfo\":\"datajuqdbrx\"},{\"targetEntityName\":\"gchbapxkiy\",\"sourceEntityName\":\"j\",\"sourceConnectionReference\":{},\"attributeMappingInfo\":{},\"sourceDenormalizeInfo\":\"databuscgduus\"}],\"relationships\":[\"datacblevpmc\",\"dataujyxkyxlzgsj\",\"datakzzltafhbzf\"]}],\"policy\":{\"mode\":\"vwmbjlzqsczpg\",\"recurrence\":{\"frequency\":\"Hour\",\"interval\":1263601640}},\"allowVNetOverride\":false,\"status\":\"wow\"},\"name\":\"ptnuwjtkschgc\",\"type\":\"y\",\"etag\":\"eseyqr\",\"\":{\"kwiswskukjtas\":\"dataeldotjv\"},\"id\":\"wispkxk\"}") + .toObject(ChangeDataCaptureResourceInner.class); + Assertions.assertEquals("wispkxk", model.id()); + Assertions.assertEquals("ehbhb", model.folder().name()); + Assertions.assertEquals("sziryrandoyp", model.description()); + Assertions.assertEquals("ormkfqlwxldyk", model.sourceConnectionsInfo().get(0).sourceEntities().get(0).name()); + Assertions.assertEquals("g", model.sourceConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("ujvaannggi", model.sourceConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals(ConnectionType.LINKEDSERVICETYPE, model.sourceConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(false, model.sourceConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions.assertEquals("wfekaumrrqmb", model.targetConnectionsInfo().get(0).targetEntities().get(0).name()); + Assertions + .assertEquals( + "ijymrhbguzozky", model.targetConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("ohguabz", model.targetConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals(ConnectionType.LINKEDSERVICETYPE, model.targetConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(true, model.targetConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions + .assertEquals("z", model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).targetEntityName()); + Assertions + .assertEquals( + "oeocnhzqrott", model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).sourceEntityName()); + Assertions.assertEquals("vwmbjlzqsczpg", model.policy().mode()); + Assertions.assertEquals(FrequencyType.HOUR, model.policy().recurrence().frequency()); + Assertions.assertEquals(1263601640, model.policy().recurrence().interval()); + Assertions.assertEquals(false, model.allowVNetOverride()); + Assertions.assertEquals("wow", model.status()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ChangeDataCaptureResourceInner model = + new ChangeDataCaptureResourceInner() + .withId("wispkxk") + .withFolder(new ChangeDataCaptureFolder().withName("ehbhb")) + .withDescription("sziryrandoyp") + .withSourceConnectionsInfo( + Arrays + .asList( + new MapperSourceConnectionsInfo() + .withSourceEntities(Arrays.asList(new MapperTable().withName("ormkfqlwxldyk"))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("g") + .withParameters( + mapOf( + "sibjgs", + "datanjpnnbmj", + "yqegx", + "datajxxahmrnad", + "inbmh", + "dataiv", + "bkezn", + "databjijkgqxnh"))) + .withLinkedServiceType("ujvaannggi") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(false) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties()))))) + .withTargetConnectionsInfo( + Arrays + .asList( + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable().withName("wfekaumrrqmb"), + new MapperTable().withName("kratbnxwbj"), + new MapperTable().withName("birkfpksokdg"))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("ijymrhbguzozky") + .withParameters(mapOf("zhhh", "dataf", "mffjkutycyarn", "datao"))) + .withLinkedServiceType("ohguabz") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays.asList(new MapperDslConnectorProperties()))) + .withDataMapperMappings( + Arrays + .asList( + new DataMapperMapping() + .withTargetEntityName("z") + .withSourceEntityName("oeocnhzqrott") + .withSourceConnectionReference(new MapperConnectionReference()) + .withAttributeMappingInfo(new MapperAttributeMappings()) + .withSourceDenormalizeInfo("datayjzp"), + new DataMapperMapping() + .withTargetEntityName("rl") + .withSourceEntityName("apqinf") + .withSourceConnectionReference(new MapperConnectionReference()) + .withAttributeMappingInfo(new MapperAttributeMappings()) + .withSourceDenormalizeInfo("dataglqdhm"))) + .withRelationships( + Arrays.asList("dataralcxpjbyypsj", "dataqcjenkyhf", "datazv", "dataqxfx")), + new MapperTargetConnectionsInfo() + .withTargetEntities(Arrays.asList(new MapperTable().withName("cmpzqjhhhqx"))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("cacoyvivbsiz") + .withParameters( + mapOf( + "lzijiufehgmvflnw", + "dataszlbscm", + "kxrerlniylylyfwx", + "datav"))) + .withLinkedServiceType("tgqztwhghmup") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays.asList(new MapperDslConnectorProperties()))) + .withDataMapperMappings( + Arrays + .asList( + new DataMapperMapping() + .withTargetEntityName("bb") + .withSourceEntityName("ftabenbbklqp") + .withSourceConnectionReference(new MapperConnectionReference()) + .withAttributeMappingInfo(new MapperAttributeMappings()) + .withSourceDenormalizeInfo("dataafeddwwnlza"))) + .withRelationships(Arrays.asList("datau")), + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable().withName("gookrtalvnb"), + new MapperTable().withName("bemeluclvd"), + new MapperTable().withName("kyrdnqodx"), + new MapperTable().withName("xhqf"))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("zoqgyipemchga") + .withParameters( + mapOf( + "xptlghwzho", + "datazuejd", + "s", + "dataewj", + "vodrrslblxydkxr", + "dataliuhqawmoaiancz"))) + .withLinkedServiceType("vbxiwkgfbqlj") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties()))) + .withDataMapperMappings( + Arrays + .asList( + new DataMapperMapping() + .withTargetEntityName("okulehurqlrqf") + .withSourceEntityName("weyurkphyjd") + .withSourceConnectionReference(new MapperConnectionReference()) + .withAttributeMappingInfo(new MapperAttributeMappings()) + .withSourceDenormalizeInfo("datajuqdbrx"), + new DataMapperMapping() + .withTargetEntityName("gchbapxkiy") + .withSourceEntityName("j") + .withSourceConnectionReference(new MapperConnectionReference()) + .withAttributeMappingInfo(new MapperAttributeMappings()) + .withSourceDenormalizeInfo("databuscgduus"))) + .withRelationships( + Arrays.asList("datacblevpmc", "dataujyxkyxlzgsj", "datakzzltafhbzf")))) + .withPolicy( + new MapperPolicy() + .withMode("vwmbjlzqsczpg") + .withRecurrence( + new MapperPolicyRecurrence().withFrequency(FrequencyType.HOUR).withInterval(1263601640))) + .withAllowVNetOverride(false) + .withStatus("wow") + .withAdditionalProperties(mapOf("name", "ptnuwjtkschgc", "etag", "eseyqr", "type", "y")); + model = BinaryData.fromObject(model).toObject(ChangeDataCaptureResourceInner.class); + Assertions.assertEquals("wispkxk", model.id()); + Assertions.assertEquals("ehbhb", model.folder().name()); + Assertions.assertEquals("sziryrandoyp", model.description()); + Assertions.assertEquals("ormkfqlwxldyk", model.sourceConnectionsInfo().get(0).sourceEntities().get(0).name()); + Assertions.assertEquals("g", model.sourceConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("ujvaannggi", model.sourceConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals(ConnectionType.LINKEDSERVICETYPE, model.sourceConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(false, model.sourceConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions.assertEquals("wfekaumrrqmb", model.targetConnectionsInfo().get(0).targetEntities().get(0).name()); + Assertions + .assertEquals( + "ijymrhbguzozky", model.targetConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("ohguabz", model.targetConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals(ConnectionType.LINKEDSERVICETYPE, model.targetConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(true, model.targetConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions + .assertEquals("z", model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).targetEntityName()); + Assertions + .assertEquals( + "oeocnhzqrott", model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).sourceEntityName()); + Assertions.assertEquals("vwmbjlzqsczpg", model.policy().mode()); + Assertions.assertEquals(FrequencyType.HOUR, model.policy().recurrence().frequency()); + Assertions.assertEquals(1263601640, model.policy().recurrence().interval()); + Assertions.assertEquals(false, model.allowVNetOverride()); + Assertions.assertEquals("wow", model.status()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureTests.java new file mode 100644 index 000000000000..26a6f6e420d9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCaptureTests.java @@ -0,0 +1,643 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ChangeDataCapture; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureFolder; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.DataMapperMapping; +import com.azure.resourcemanager.datafactory.models.FrequencyType; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMapping; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMappings; +import com.azure.resourcemanager.datafactory.models.MapperConnection; +import com.azure.resourcemanager.datafactory.models.MapperConnectionReference; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperPolicyRecurrence; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTable; +import com.azure.resourcemanager.datafactory.models.MapperTableSchema; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ChangeDataCaptureTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChangeDataCapture model = + BinaryData + .fromString( + "{\"folder\":{\"name\":\"fkndl\"},\"description\":\"twknvgm\",\"sourceConnectionsInfo\":[{\"sourceEntities\":[{\"name\":\"yw\",\"properties\":{\"schema\":[{},{}],\"dslConnectorProperties\":[{},{},{},{}]}},{\"name\":\"ueatgroe\",\"properties\":{\"schema\":[{}],\"dslConnectorProperties\":[{},{}]}},{\"name\":\"byfqxkfaoy\",\"properties\":{\"schema\":[{},{}],\"dslConnectorProperties\":[{},{}]}},{\"name\":\"jmvqmtd\",\"properties\":{\"schema\":[{}],\"dslConnectorProperties\":[{},{}]}}],\"connection\":{\"linkedService\":{\"referenceName\":\"jn\",\"parameters\":{\"rreqynkceysfaqe\":\"datajdjusk\",\"ryshwddkvbxgk\":\"datapl\",\"vvlfntymtp\":\"datausybwptdaca\",\"zrsq\":\"dataiwenazero\"}},\"linkedServiceType\":\"sxkdnwqapfgsdpc\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{\"name\":\"h\",\"value\":\"datauipldqq\"},{\"name\":\"ekvalblhtjq\",\"value\":\"datayvwehtaemxh\"},{\"name\":\"ysev\",\"value\":\"dataxivzrrry\"},{\"name\":\"imipskdyzatvfuz\",\"value\":\"dataftjvvruxwigsye\"}]}},{\"sourceEntities\":[{\"name\":\"smjtgrqgdg\",\"properties\":{\"schema\":[{},{},{}],\"dslConnectorProperties\":[{},{}]}},{\"name\":\"kcsmk\",\"properties\":{\"schema\":[{},{},{},{}],\"dslConnectorProperties\":[{},{},{}]}}],\"connection\":{\"linkedService\":{\"referenceName\":\"dorvvmqfloy\",\"parameters\":{\"gdexjd\":\"datagwumgxdgdhpa\",\"wllcolsr\":\"datavjsaqwotm\",\"ljnhvlqj\":\"dataxaptefhexcgjok\"}},\"linkedServiceType\":\"kpeeksnbksdqhj\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{\"name\":\"lkhhu\",\"value\":\"datacpoq\"}]}},{\"sourceEntities\":[{\"name\":\"wqjwgok\",\"properties\":{\"schema\":[{},{},{}],\"dslConnectorProperties\":[{},{}]}},{\"name\":\"xybwfdbkjbzten\",\"properties\":{\"schema\":[{},{},{}],\"dslConnectorProperties\":[{},{}]}}],\"connection\":{\"linkedService\":{\"referenceName\":\"jknsxfwu\",\"parameters\":{\"pkuwxeoioj\":\"datadpkupnqrmgjf\"}},\"linkedServiceType\":\"zfav\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{\"name\":\"yay\",\"value\":\"datamfzsbf\"},{\"name\":\"rzx\",\"value\":\"dataewsrsxkrplbjaze\"},{\"name\":\"w\",\"value\":\"datayoyp\"}]}}],\"targetConnectionsInfo\":[{\"targetEntities\":[{\"name\":\"nnhj\",\"properties\":{\"schema\":[{}],\"dslConnectorProperties\":[{}]}},{\"name\":\"kbiwetpozyc\",\"properties\":{\"schema\":[{},{}],\"dslConnectorProperties\":[{}]}},{\"name\":\"fsetz\",\"properties\":{\"schema\":[{},{},{},{}],\"dslConnectorProperties\":[{},{},{}]}}],\"connection\":{\"linkedService\":{\"referenceName\":\"dynojpziuwfb\",\"parameters\":{\"qsyclj\":\"datadtn\",\"cbevxrhyzdfw\":\"dataelpkpbafvafhlbyl\",\"mairrh\":\"datasofpltd\"}},\"linkedServiceType\":\"fnrac\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{\"name\":\"uuj\",\"value\":\"datauhd\"}]},\"dataMapperMappings\":[{\"targetEntityName\":\"grbjbxsjybvitvqk\",\"sourceEntityName\":\"az\",\"sourceConnectionReference\":{\"connectionName\":\"tggmuwdchozfnkfe\",\"type\":\"linkedservicetype\"},\"attributeMappingInfo\":{\"attributeMappings\":[{},{},{}]},\"sourceDenormalizeInfo\":\"datakizvoa\"}],\"relationships\":[\"dataa\",\"datalnuwiguy\"]},{\"targetEntities\":[{\"name\":\"wphvxz\",\"properties\":{\"schema\":[{},{},{},{}],\"dslConnectorProperties\":[{},{}]}},{\"name\":\"jtlkexaonwivkcqh\",\"properties\":{\"schema\":[{}],\"dslConnectorProperties\":[{},{}]}},{\"name\":\"ccrmmk\",\"properties\":{\"schema\":[{},{},{},{}],\"dslConnectorProperties\":[{},{}]}},{\"name\":\"yqjf\",\"properties\":{\"schema\":[{},{},{},{}],\"dslConnectorProperties\":[{},{},{},{}]}}],\"connection\":{\"linkedService\":{\"referenceName\":\"em\",\"parameters\":{\"dxphlk\":\"datadudxjascowvfdjk\",\"dkz\":\"datasnmgzvyfi\",\"uqwqulsutrjbhxyk\":\"dataqnwsithuqolyah\"}},\"linkedServiceType\":\"y\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{\"name\":\"g\",\"value\":\"dataftbcvexreuquow\"},{\"name\":\"jv\",\"value\":\"datahreagk\"},{\"name\":\"xv\",\"value\":\"datatvbczsulm\"},{\"name\":\"glmep\",\"value\":\"datafs\"}]},\"dataMapperMappings\":[{\"targetEntityName\":\"sa\",\"sourceEntityName\":\"psznga\",\"sourceConnectionReference\":{\"connectionName\":\"ylkvecjuj\",\"type\":\"linkedservicetype\"},\"attributeMappingInfo\":{\"attributeMappings\":[{},{},{}]},\"sourceDenormalizeInfo\":\"dataedmzrgjfoknub\"},{\"targetEntityName\":\"itpkpztrgdg\",\"sourceEntityName\":\"coqra\",\"sourceConnectionReference\":{\"connectionName\":\"gyxpqit\",\"type\":\"linkedservicetype\"},\"attributeMappingInfo\":{\"attributeMappings\":[{},{},{},{}]},\"sourceDenormalizeInfo\":\"dataskbuhzaca\"},{\"targetEntityName\":\"yltcoqcuj\",\"sourceEntityName\":\"sxzakuejkm\",\"sourceConnectionReference\":{\"connectionName\":\"ztjofqcvovjufyc\",\"type\":\"linkedservicetype\"},\"attributeMappingInfo\":{\"attributeMappings\":[{}]},\"sourceDenormalizeInfo\":\"datayeji\"}],\"relationships\":[\"dataxeg\",\"datahortu\",\"dataawlpjfelqerpp\",\"datacbgqnzmnhiil\"]},{\"targetEntities\":[{\"name\":\"cjgckbbcccgzpra\",\"properties\":{\"schema\":[{},{},{}],\"dslConnectorProperties\":[{},{},{}]}},{\"name\":\"a\",\"properties\":{\"schema\":[{},{},{},{}],\"dslConnectorProperties\":[{},{}]}},{\"name\":\"wcxbyubhiqdxyurn\",\"properties\":{\"schema\":[{}],\"dslConnectorProperties\":[{}]}},{\"name\":\"ccnuhiig\",\"properties\":{\"schema\":[{}],\"dslConnectorProperties\":[{},{},{}]}}],\"connection\":{\"linkedService\":{\"referenceName\":\"xvatvcr\",\"parameters\":{\"bqxvhcsyhzlwxae\":\"datab\"}},\"linkedServiceType\":\"vurex\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{\"name\":\"ead\",\"value\":\"datazmwntopagt\"},{\"name\":\"v\",\"value\":\"dataagoaqylkjztji\"}]},\"dataMapperMappings\":[{\"targetEntityName\":\"cgm\",\"sourceEntityName\":\"tpfinzcpdltkr\",\"sourceConnectionReference\":{\"connectionName\":\"mtbdrvcqgu\",\"type\":\"linkedservicetype\"},\"attributeMappingInfo\":{\"attributeMappings\":[{},{}]},\"sourceDenormalizeInfo\":\"dataheqdurelyujlfyou\"}],\"relationships\":[\"datakyeclcdigpta\",\"databrzmqxucycijoclx\",\"datautgjcyz\",\"datazjd\"]}],\"policy\":{\"mode\":\"qjbtxjeaoqaqbzgy\",\"recurrence\":{\"frequency\":\"Minute\",\"interval\":1743289619}},\"allowVNetOverride\":true,\"status\":\"wbqamteuliy\"}") + .toObject(ChangeDataCapture.class); + Assertions.assertEquals("fkndl", model.folder().name()); + Assertions.assertEquals("twknvgm", model.description()); + Assertions.assertEquals("yw", model.sourceConnectionsInfo().get(0).sourceEntities().get(0).name()); + Assertions + .assertEquals("jn", model.sourceConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions + .assertEquals("sxkdnwqapfgsdpc", model.sourceConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals(ConnectionType.LINKEDSERVICETYPE, model.sourceConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(true, model.sourceConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions + .assertEquals( + "h", model.sourceConnectionsInfo().get(0).connection().commonDslConnectorProperties().get(0).name()); + Assertions.assertEquals("nnhj", model.targetConnectionsInfo().get(0).targetEntities().get(0).name()); + Assertions + .assertEquals( + "dynojpziuwfb", model.targetConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("fnrac", model.targetConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals(ConnectionType.LINKEDSERVICETYPE, model.targetConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(true, model.targetConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions + .assertEquals( + "uuj", model.targetConnectionsInfo().get(0).connection().commonDslConnectorProperties().get(0).name()); + Assertions + .assertEquals( + "grbjbxsjybvitvqk", + model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).targetEntityName()); + Assertions + .assertEquals("az", model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).sourceEntityName()); + Assertions + .assertEquals( + "tggmuwdchozfnkfe", + model + .targetConnectionsInfo() + .get(0) + .dataMapperMappings() + .get(0) + .sourceConnectionReference() + .connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).sourceConnectionReference().type()); + Assertions.assertEquals("qjbtxjeaoqaqbzgy", model.policy().mode()); + Assertions.assertEquals(FrequencyType.MINUTE, model.policy().recurrence().frequency()); + Assertions.assertEquals(1743289619, model.policy().recurrence().interval()); + Assertions.assertEquals(true, model.allowVNetOverride()); + Assertions.assertEquals("wbqamteuliy", model.status()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ChangeDataCapture model = + new ChangeDataCapture() + .withFolder(new ChangeDataCaptureFolder().withName("fkndl")) + .withDescription("twknvgm") + .withSourceConnectionsInfo( + Arrays + .asList( + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable() + .withName("yw") + .withSchema( + Arrays.asList(new MapperTableSchema(), new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("ueatgroe") + .withSchema(Arrays.asList(new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("byfqxkfaoy") + .withSchema( + Arrays.asList(new MapperTableSchema(), new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("jmvqmtd") + .withSchema(Arrays.asList(new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("jn") + .withParameters( + mapOf( + "rreqynkceysfaqe", + "datajdjusk", + "ryshwddkvbxgk", + "datapl", + "vvlfntymtp", + "datausybwptdaca", + "zrsq", + "dataiwenazero"))) + .withLinkedServiceType("sxkdnwqapfgsdpc") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties() + .withName("h") + .withValue("datauipldqq"), + new MapperDslConnectorProperties() + .withName("ekvalblhtjq") + .withValue("datayvwehtaemxh"), + new MapperDslConnectorProperties() + .withName("ysev") + .withValue("dataxivzrrry"), + new MapperDslConnectorProperties() + .withName("imipskdyzatvfuz") + .withValue("dataftjvvruxwigsye")))), + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable() + .withName("smjtgrqgdg") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("kcsmk") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("dorvvmqfloy") + .withParameters( + mapOf( + "gdexjd", + "datagwumgxdgdhpa", + "wllcolsr", + "datavjsaqwotm", + "ljnhvlqj", + "dataxaptefhexcgjok"))) + .withLinkedServiceType("kpeeksnbksdqhj") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(false) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties() + .withName("lkhhu") + .withValue("datacpoq")))), + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable() + .withName("wqjwgok") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("xybwfdbkjbzten") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("jknsxfwu") + .withParameters(mapOf("pkuwxeoioj", "datadpkupnqrmgjf"))) + .withLinkedServiceType("zfav") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties() + .withName("yay") + .withValue("datamfzsbf"), + new MapperDslConnectorProperties() + .withName("rzx") + .withValue("dataewsrsxkrplbjaze"), + new MapperDslConnectorProperties() + .withName("w") + .withValue("datayoyp")))))) + .withTargetConnectionsInfo( + Arrays + .asList( + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable() + .withName("nnhj") + .withSchema(Arrays.asList(new MapperTableSchema())) + .withDslConnectorProperties( + Arrays.asList(new MapperDslConnectorProperties())), + new MapperTable() + .withName("kbiwetpozyc") + .withSchema( + Arrays.asList(new MapperTableSchema(), new MapperTableSchema())) + .withDslConnectorProperties( + Arrays.asList(new MapperDslConnectorProperties())), + new MapperTable() + .withName("fsetz") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("dynojpziuwfb") + .withParameters( + mapOf( + "qsyclj", + "datadtn", + "cbevxrhyzdfw", + "dataelpkpbafvafhlbyl", + "mairrh", + "datasofpltd"))) + .withLinkedServiceType("fnrac") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties() + .withName("uuj") + .withValue("datauhd")))) + .withDataMapperMappings( + Arrays + .asList( + new DataMapperMapping() + .withTargetEntityName("grbjbxsjybvitvqk") + .withSourceEntityName("az") + .withSourceConnectionReference( + new MapperConnectionReference() + .withConnectionName("tggmuwdchozfnkfe") + .withType(ConnectionType.LINKEDSERVICETYPE)) + .withAttributeMappingInfo( + new MapperAttributeMappings() + .withAttributeMappings( + Arrays + .asList( + new MapperAttributeMapping(), + new MapperAttributeMapping(), + new MapperAttributeMapping()))) + .withSourceDenormalizeInfo("datakizvoa"))) + .withRelationships(Arrays.asList("dataa", "datalnuwiguy")), + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable() + .withName("wphvxz") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("jtlkexaonwivkcqh") + .withSchema(Arrays.asList(new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("ccrmmk") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("yqjf") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("em") + .withParameters( + mapOf( + "dxphlk", + "datadudxjascowvfdjk", + "dkz", + "datasnmgzvyfi", + "uqwqulsutrjbhxyk", + "dataqnwsithuqolyah"))) + .withLinkedServiceType("y") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties() + .withName("g") + .withValue("dataftbcvexreuquow"), + new MapperDslConnectorProperties() + .withName("jv") + .withValue("datahreagk"), + new MapperDslConnectorProperties() + .withName("xv") + .withValue("datatvbczsulm"), + new MapperDslConnectorProperties() + .withName("glmep") + .withValue("datafs")))) + .withDataMapperMappings( + Arrays + .asList( + new DataMapperMapping() + .withTargetEntityName("sa") + .withSourceEntityName("psznga") + .withSourceConnectionReference( + new MapperConnectionReference() + .withConnectionName("ylkvecjuj") + .withType(ConnectionType.LINKEDSERVICETYPE)) + .withAttributeMappingInfo( + new MapperAttributeMappings() + .withAttributeMappings( + Arrays + .asList( + new MapperAttributeMapping(), + new MapperAttributeMapping(), + new MapperAttributeMapping()))) + .withSourceDenormalizeInfo("dataedmzrgjfoknub"), + new DataMapperMapping() + .withTargetEntityName("itpkpztrgdg") + .withSourceEntityName("coqra") + .withSourceConnectionReference( + new MapperConnectionReference() + .withConnectionName("gyxpqit") + .withType(ConnectionType.LINKEDSERVICETYPE)) + .withAttributeMappingInfo( + new MapperAttributeMappings() + .withAttributeMappings( + Arrays + .asList( + new MapperAttributeMapping(), + new MapperAttributeMapping(), + new MapperAttributeMapping(), + new MapperAttributeMapping()))) + .withSourceDenormalizeInfo("dataskbuhzaca"), + new DataMapperMapping() + .withTargetEntityName("yltcoqcuj") + .withSourceEntityName("sxzakuejkm") + .withSourceConnectionReference( + new MapperConnectionReference() + .withConnectionName("ztjofqcvovjufyc") + .withType(ConnectionType.LINKEDSERVICETYPE)) + .withAttributeMappingInfo( + new MapperAttributeMappings() + .withAttributeMappings( + Arrays.asList(new MapperAttributeMapping()))) + .withSourceDenormalizeInfo("datayeji"))) + .withRelationships( + Arrays.asList("dataxeg", "datahortu", "dataawlpjfelqerpp", "datacbgqnzmnhiil")), + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable() + .withName("cjgckbbcccgzpra") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("a") + .withSchema( + Arrays + .asList( + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema(), + new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())), + new MapperTable() + .withName("wcxbyubhiqdxyurn") + .withSchema(Arrays.asList(new MapperTableSchema())) + .withDslConnectorProperties( + Arrays.asList(new MapperDslConnectorProperties())), + new MapperTable() + .withName("ccnuhiig") + .withSchema(Arrays.asList(new MapperTableSchema())) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties())))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("xvatvcr") + .withParameters(mapOf("bqxvhcsyhzlwxae", "datab"))) + .withLinkedServiceType("vurex") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties() + .withName("ead") + .withValue("datazmwntopagt"), + new MapperDslConnectorProperties() + .withName("v") + .withValue("dataagoaqylkjztji")))) + .withDataMapperMappings( + Arrays + .asList( + new DataMapperMapping() + .withTargetEntityName("cgm") + .withSourceEntityName("tpfinzcpdltkr") + .withSourceConnectionReference( + new MapperConnectionReference() + .withConnectionName("mtbdrvcqgu") + .withType(ConnectionType.LINKEDSERVICETYPE)) + .withAttributeMappingInfo( + new MapperAttributeMappings() + .withAttributeMappings( + Arrays + .asList( + new MapperAttributeMapping(), + new MapperAttributeMapping()))) + .withSourceDenormalizeInfo("dataheqdurelyujlfyou"))) + .withRelationships( + Arrays + .asList("datakyeclcdigpta", "databrzmqxucycijoclx", "datautgjcyz", "datazjd")))) + .withPolicy( + new MapperPolicy() + .withMode("qjbtxjeaoqaqbzgy") + .withRecurrence( + new MapperPolicyRecurrence().withFrequency(FrequencyType.MINUTE).withInterval(1743289619))) + .withAllowVNetOverride(true) + .withStatus("wbqamteuliy"); + model = BinaryData.fromObject(model).toObject(ChangeDataCapture.class); + Assertions.assertEquals("fkndl", model.folder().name()); + Assertions.assertEquals("twknvgm", model.description()); + Assertions.assertEquals("yw", model.sourceConnectionsInfo().get(0).sourceEntities().get(0).name()); + Assertions + .assertEquals("jn", model.sourceConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions + .assertEquals("sxkdnwqapfgsdpc", model.sourceConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals(ConnectionType.LINKEDSERVICETYPE, model.sourceConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(true, model.sourceConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions + .assertEquals( + "h", model.sourceConnectionsInfo().get(0).connection().commonDslConnectorProperties().get(0).name()); + Assertions.assertEquals("nnhj", model.targetConnectionsInfo().get(0).targetEntities().get(0).name()); + Assertions + .assertEquals( + "dynojpziuwfb", model.targetConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("fnrac", model.targetConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals(ConnectionType.LINKEDSERVICETYPE, model.targetConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(true, model.targetConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions + .assertEquals( + "uuj", model.targetConnectionsInfo().get(0).connection().commonDslConnectorProperties().get(0).name()); + Assertions + .assertEquals( + "grbjbxsjybvitvqk", + model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).targetEntityName()); + Assertions + .assertEquals("az", model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).sourceEntityName()); + Assertions + .assertEquals( + "tggmuwdchozfnkfe", + model + .targetConnectionsInfo() + .get(0) + .dataMapperMappings() + .get(0) + .sourceConnectionReference() + .connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.targetConnectionsInfo().get(0).dataMapperMappings().get(0).sourceConnectionReference().type()); + Assertions.assertEquals("qjbtxjeaoqaqbzgy", model.policy().mode()); + Assertions.assertEquals(FrequencyType.MINUTE, model.policy().recurrence().frequency()); + Assertions.assertEquals(1743289619, model.policy().recurrence().interval()); + Assertions.assertEquals(true, model.allowVNetOverride()); + Assertions.assertEquals("wbqamteuliy", model.status()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..462646ad52af --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureFolder; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureResource; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.DataMapperMapping; +import com.azure.resourcemanager.datafactory.models.FrequencyType; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MapperConnection; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperPolicyRecurrence; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTable; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChangeDataCapturesCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"folder\":{\"name\":\"ydct\"},\"description\":\"xwqs\",\"sourceConnectionsInfo\":[{\"sourceEntities\":[{},{},{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"gbzmcprtanag\"},\"linkedServiceType\":\"br\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{}]}},{\"sourceEntities\":[{}],\"connection\":{\"linkedService\":{\"referenceName\":\"bydusjlilpiccxe\"},\"linkedServiceType\":\"w\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{},{},{},{}]}},{\"sourceEntities\":[{},{},{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"rzoafxoyddus\"},\"linkedServiceType\":\"yjhhynlmxzdwpdw\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{},{}]}}],\"targetConnectionsInfo\":[{\"targetEntities\":[{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"hmfmuxdnckg\"},\"linkedServiceType\":\"s\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{},{},{}]},\"dataMapperMappings\":[{}],\"relationships\":[\"dataazv\",\"datadeqmfzyhikhnw\"]}],\"policy\":{\"mode\":\"ftlj\",\"recurrence\":{\"frequency\":\"Hour\",\"interval\":789801623}},\"allowVNetOverride\":false,\"status\":\"ezaxith\"},\"name\":\"jxtobeqgzcadoq\",\"type\":\"fllqmu\",\"etag\":\"olcgqjtv\",\"\":{\"ojpauiccja\":\"datakmwvgdfutdswjtuq\",\"gebqhbbqodyvvp\":\"dataa\",\"o\":\"dataoiaaagvaecwwdqg\"},\"id\":\"hfrgmpuyfhsk\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ChangeDataCaptureResource response = + manager + .changeDataCaptures() + .define("ycvc") + .withExistingFactory("fxc", "npyxlc") + .withSourceConnectionsInfo( + Arrays + .asList( + new MapperSourceConnectionsInfo() + .withSourceEntities(Arrays.asList(new MapperTable())) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference().withReferenceName("utsabuvuuweq")) + .withLinkedServiceType("ygnetuvsqvgj") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties()))))) + .withTargetConnectionsInfo( + Arrays + .asList( + new MapperTargetConnectionsInfo() + .withTargetEntities(Arrays.asList(new MapperTable())) + .withConnection( + new MapperConnection() + .withLinkedService(new LinkedServiceReference().withReferenceName("dm")) + .withLinkedServiceType("tl") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties(), + new MapperDslConnectorProperties()))) + .withDataMapperMappings( + Arrays + .asList( + new DataMapperMapping(), new DataMapperMapping(), new DataMapperMapping())) + .withRelationships(Arrays.asList("datalflwqdjz", "dataog", "databyks", "dataqxxy")))) + .withPolicy( + new MapperPolicy() + .withMode("rixkobm") + .withRecurrence( + new MapperPolicyRecurrence().withFrequency(FrequencyType.SECOND).withInterval(27520514))) + .withFolder(new ChangeDataCaptureFolder().withName("fxza")) + .withDescription("ioqtafmbxtn") + .withAllowVNetOverride(true) + .withStatus("hkj") + .withIfMatch("jpsbd") + .create(); + + Assertions.assertEquals("hfrgmpuyfhsk", response.id()); + Assertions.assertEquals("ydct", response.folder().name()); + Assertions.assertEquals("xwqs", response.description()); + Assertions + .assertEquals( + "gbzmcprtanag", response.sourceConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("br", response.sourceConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, response.sourceConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(true, response.sourceConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions + .assertEquals( + "hmfmuxdnckg", response.targetConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("s", response.targetConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, response.targetConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(true, response.targetConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions.assertEquals("ftlj", response.policy().mode()); + Assertions.assertEquals(FrequencyType.HOUR, response.policy().recurrence().frequency()); + Assertions.assertEquals(789801623, response.policy().recurrence().interval()); + Assertions.assertEquals(false, response.allowVNetOverride()); + Assertions.assertEquals("ezaxith", response.status()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..ca5a8cefd91f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesDeleteWithResponseMockTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChangeDataCapturesDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .changeDataCaptures() + .deleteWithResponse( + "oohzifbbsncorini", "dlxqjshyyrcr", "wzqsfaurmqpkgwfb", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesGetWithResponseMockTests.java new file mode 100644 index 000000000000..f571687a07f1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesGetWithResponseMockTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureResource; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.FrequencyType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChangeDataCapturesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"folder\":{\"name\":\"zcnlq\"},\"description\":\"mikbtzt\",\"sourceConnectionsInfo\":[{\"sourceEntities\":[{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"xarqtkzeopoxd\"},\"linkedServiceType\":\"xpnq\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{},{},{},{}]}},{\"sourceEntities\":[{},{},{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"fshaqpmly\"},\"linkedServiceType\":\"gotlbflbaxywojtr\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{}]}}],\"targetConnectionsInfo\":[{\"targetEntities\":[{},{},{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"mfnqwmavgdztdj\"},\"linkedServiceType\":\"wukbcwym\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{},{}]},\"dataMapperMappings\":[{}],\"relationships\":[\"datavuzqsvtcrk\",\"dataswasvey\"]},{\"targetEntities\":[{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"ffc\"},\"linkedServiceType\":\"yykwwhscubgwzm\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{},{}]},\"dataMapperMappings\":[{},{}],\"relationships\":[\"datahdrvkzzvhfogj\",\"dataocnse\",\"dataqcktqrvz\"]}],\"policy\":{\"mode\":\"beiqopjzzglgxvqd\",\"recurrence\":{\"frequency\":\"Hour\",\"interval\":464187305}},\"allowVNetOverride\":false,\"status\":\"ieeswbpbijtepr\"},\"name\":\"t\",\"type\":\"wapmtyfgswp\",\"etag\":\"nvxtvmbwydqo\",\"\":{\"i\":\"datayjebgveuazwkze\"},\"id\":\"drrgzguupw\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ChangeDataCaptureResource response = + manager + .changeDataCaptures() + .getWithResponse("kxa", "qgyhgzqkkwz", "g", "wwopssdws", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("drrgzguupw", response.id()); + Assertions.assertEquals("zcnlq", response.folder().name()); + Assertions.assertEquals("mikbtzt", response.description()); + Assertions + .assertEquals( + "xarqtkzeopoxd", response.sourceConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("xpnq", response.sourceConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, response.sourceConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(false, response.sourceConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions + .assertEquals( + "mfnqwmavgdztdj", response.targetConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions.assertEquals("wukbcwym", response.targetConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, response.targetConnectionsInfo().get(0).connection().type()); + Assertions.assertEquals(false, response.targetConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions.assertEquals("beiqopjzzglgxvqd", response.policy().mode()); + Assertions.assertEquals(FrequencyType.HOUR, response.policy().recurrence().frequency()); + Assertions.assertEquals(464187305, response.policy().recurrence().interval()); + Assertions.assertEquals(false, response.allowVNetOverride()); + Assertions.assertEquals("ieeswbpbijtepr", response.status()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesListByFactoryMockTests.java new file mode 100644 index 000000000000..434e3cf09f08 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesListByFactoryMockTests.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ChangeDataCaptureResource; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.FrequencyType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChangeDataCapturesListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"folder\":{\"name\":\"f\"},\"description\":\"nmzaih\",\"sourceConnectionsInfo\":[{\"sourceEntities\":[{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"euhhfoh\"},\"linkedServiceType\":\"vbwj\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{},{},{}]}}],\"targetConnectionsInfo\":[{\"targetEntities\":[{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"corydjsaki\"},\"linkedServiceType\":\"lmiglnqrmqefdq\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{},{}]},\"dataMapperMappings\":[{},{},{},{}],\"relationships\":[\"datapdiekylioagvij\"]},{\"targetEntities\":[{},{},{},{}],\"connection\":{\"linkedService\":{\"referenceName\":\"ejljdre\"},\"linkedServiceType\":\"jw\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{},{}]},\"dataMapperMappings\":[{},{}],\"relationships\":[\"datazbddcxfuiz\"]}],\"policy\":{\"mode\":\"zme\",\"recurrence\":{\"frequency\":\"Second\",\"interval\":1878878407}},\"allowVNetOverride\":false,\"status\":\"qot\"},\"name\":\"bi\",\"type\":\"s\",\"etag\":\"vuptretlau\",\"\":{\"egcogyctekaaju\":\"datatstpbinab\",\"cbjsyorsojv\":\"datakxbgfed\"},\"id\":\"qragqcmouxs\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.changeDataCaptures().listByFactory("da", "dneb", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qragqcmouxs", response.iterator().next().id()); + Assertions.assertEquals("f", response.iterator().next().folder().name()); + Assertions.assertEquals("nmzaih", response.iterator().next().description()); + Assertions + .assertEquals( + "euhhfoh", + response.iterator().next().sourceConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions + .assertEquals( + "vbwj", response.iterator().next().sourceConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + response.iterator().next().sourceConnectionsInfo().get(0).connection().type()); + Assertions + .assertEquals( + false, response.iterator().next().sourceConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions + .assertEquals( + "corydjsaki", + response.iterator().next().targetConnectionsInfo().get(0).connection().linkedService().referenceName()); + Assertions + .assertEquals( + "lmiglnqrmqefdq", + response.iterator().next().targetConnectionsInfo().get(0).connection().linkedServiceType()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + response.iterator().next().targetConnectionsInfo().get(0).connection().type()); + Assertions + .assertEquals( + false, response.iterator().next().targetConnectionsInfo().get(0).connection().isInlineDataset()); + Assertions.assertEquals("zme", response.iterator().next().policy().mode()); + Assertions.assertEquals(FrequencyType.SECOND, response.iterator().next().policy().recurrence().frequency()); + Assertions.assertEquals(1878878407, response.iterator().next().policy().recurrence().interval()); + Assertions.assertEquals(false, response.iterator().next().allowVNetOverride()); + Assertions.assertEquals("qot", response.iterator().next().status()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesStartWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesStartWithResponseMockTests.java new file mode 100644 index 000000000000..bc85d270f681 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesStartWithResponseMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChangeDataCapturesStartWithResponseMockTests { + @Test + public void testStartWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.changeDataCaptures().startWithResponse("t", "xhmrhhxlibd", "p", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesStatusWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesStatusWithResponseMockTests.java new file mode 100644 index 000000000000..bbce6f9d7055 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesStatusWithResponseMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChangeDataCapturesStatusWithResponseMockTests { + @Test + public void testStatusWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "\"dv\""; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + String response = + manager + .changeDataCaptures() + .statusWithResponse("qohvcv", "ebxgxgrphoabhkya", "pccwievj", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dv", response); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesStopWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesStopWithResponseMockTests.java new file mode 100644 index 000000000000..fdb43b1571e3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ChangeDataCapturesStopWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChangeDataCapturesStopWithResponseMockTests { + @Test + public void testStopWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .changeDataCaptures() + .stopWithResponse("amslvpxsy", "nifvwrd", "aauls", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CmkIdentityDefinitionTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CmkIdentityDefinitionTests.java new file mode 100644 index 000000000000..b72be33cf412 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CmkIdentityDefinitionTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CmkIdentityDefinition; +import org.junit.jupiter.api.Assertions; + +public final class CmkIdentityDefinitionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CmkIdentityDefinition model = + BinaryData.fromString("{\"userAssignedIdentity\":\"lexxbczwtru\"}").toObject(CmkIdentityDefinition.class); + Assertions.assertEquals("lexxbczwtru", model.userAssignedIdentity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CmkIdentityDefinition model = new CmkIdentityDefinition().withUserAssignedIdentity("lexxbczwtru"); + model = BinaryData.fromObject(model).toObject(CmkIdentityDefinition.class); + Assertions.assertEquals("lexxbczwtru", model.userAssignedIdentity()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CommonDataServiceForAppsEntityDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CommonDataServiceForAppsEntityDatasetTests.java new file mode 100644 index 000000000000..c20eecd7fc2e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CommonDataServiceForAppsEntityDatasetTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CommonDataServiceForAppsEntityDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CommonDataServiceForAppsEntityDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommonDataServiceForAppsEntityDataset model = + BinaryData + .fromString( + "{\"type\":\"CommonDataServiceForAppsEntity\",\"typeProperties\":{\"entityName\":\"datagxnwfmzvztau\"},\"description\":\"pamqxfcssanybz\",\"structure\":\"datahvdfe\",\"schema\":\"datayj\",\"linkedServiceName\":{\"referenceName\":\"v\",\"parameters\":{\"nzxezriwgo\":\"datalywkhookj\"}},\"parameters\":{\"ap\":{\"type\":\"Bool\",\"defaultValue\":\"dataqksa\"},\"benwsdfp\":{\"type\":\"SecureString\",\"defaultValue\":\"datacit\"},\"pmvzpireszya\":{\"type\":\"Int\",\"defaultValue\":\"dataahlfrcqk\"},\"cjjlwkyeahhhut\":{\"type\":\"Float\",\"defaultValue\":\"datamlbmfggeokfe\"}},\"annotations\":[\"datanrfcqu\",\"datam\",\"dataihpinow\"],\"folder\":{\"name\":\"jpxp\"},\"\":{\"lgbbfjmdgjvxlh\":\"datadwyqqidqi\",\"eftyaphqeofytl\":\"datapm\",\"qvjfdgfqpmquxpjh\":\"datanlowmcmcqixuanc\",\"dcio\":\"datafaar\"}}") + .toObject(CommonDataServiceForAppsEntityDataset.class); + Assertions.assertEquals("pamqxfcssanybz", model.description()); + Assertions.assertEquals("v", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("ap").type()); + Assertions.assertEquals("jpxp", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommonDataServiceForAppsEntityDataset model = + new CommonDataServiceForAppsEntityDataset() + .withDescription("pamqxfcssanybz") + .withStructure("datahvdfe") + .withSchema("datayj") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("v") + .withParameters(mapOf("nzxezriwgo", "datalywkhookj"))) + .withParameters( + mapOf( + "ap", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataqksa"), + "benwsdfp", + new ParameterSpecification().withType(ParameterType.SECURE_STRING).withDefaultValue("datacit"), + "pmvzpireszya", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataahlfrcqk"), + "cjjlwkyeahhhut", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datamlbmfggeokfe"))) + .withAnnotations(Arrays.asList("datanrfcqu", "datam", "dataihpinow")) + .withFolder(new DatasetFolder().withName("jpxp")) + .withEntityName("datagxnwfmzvztau"); + model = BinaryData.fromObject(model).toObject(CommonDataServiceForAppsEntityDataset.class); + Assertions.assertEquals("pamqxfcssanybz", model.description()); + Assertions.assertEquals("v", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("ap").type()); + Assertions.assertEquals("jpxp", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CommonDataServiceForAppsEntityDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CommonDataServiceForAppsEntityDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..ee737c9e8d62 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CommonDataServiceForAppsEntityDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.CommonDataServiceForAppsEntityDatasetTypeProperties; + +public final class CommonDataServiceForAppsEntityDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommonDataServiceForAppsEntityDatasetTypeProperties model = + BinaryData + .fromString("{\"entityName\":\"dataufzg\"}") + .toObject(CommonDataServiceForAppsEntityDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommonDataServiceForAppsEntityDatasetTypeProperties model = + new CommonDataServiceForAppsEntityDatasetTypeProperties().withEntityName("dataufzg"); + model = BinaryData.fromObject(model).toObject(CommonDataServiceForAppsEntityDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CommonDataServiceForAppsSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CommonDataServiceForAppsSourceTests.java new file mode 100644 index 000000000000..823a80da46c6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CommonDataServiceForAppsSourceTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CommonDataServiceForAppsSource; + +public final class CommonDataServiceForAppsSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommonDataServiceForAppsSource model = + BinaryData + .fromString( + "{\"type\":\"CommonDataServiceForAppsSource\",\"query\":\"datanxrjmilogcnzfg\",\"additionalColumns\":\"databbtplrtxhzt\",\"sourceRetryCount\":\"datawyrsfj\",\"sourceRetryWait\":\"dataoyusrbuydeyh\",\"maxConcurrentConnections\":\"datattkdrblehenj\",\"disableMetricsCollection\":\"dataiwdeosbijikjf\",\"\":{\"avfjx\":\"datauwhbpojujpifxtgr\",\"lauhr\":\"dataiwx\",\"r\":\"datachphovu\"}}") + .toObject(CommonDataServiceForAppsSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommonDataServiceForAppsSource model = + new CommonDataServiceForAppsSource() + .withSourceRetryCount("datawyrsfj") + .withSourceRetryWait("dataoyusrbuydeyh") + .withMaxConcurrentConnections("datattkdrblehenj") + .withDisableMetricsCollection("dataiwdeosbijikjf") + .withQuery("datanxrjmilogcnzfg") + .withAdditionalColumns("databbtplrtxhzt"); + model = BinaryData.fromObject(model).toObject(CommonDataServiceForAppsSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CompressionReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CompressionReadSettingsTests.java new file mode 100644 index 000000000000..5f9f437fcf62 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CompressionReadSettingsTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CompressionReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class CompressionReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CompressionReadSettings model = + BinaryData + .fromString( + "{\"type\":\"CompressionReadSettings\",\"\":{\"bc\":\"dataouxpdnlbp\",\"zekg\":\"dataohnroa\"}}") + .toObject(CompressionReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CompressionReadSettings model = + new CompressionReadSettings().withAdditionalProperties(mapOf("type", "CompressionReadSettings")); + model = BinaryData.fromObject(model).toObject(CompressionReadSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ConcurObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ConcurObjectDatasetTests.java new file mode 100644 index 000000000000..6cf408e219f6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ConcurObjectDatasetTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConcurObjectDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ConcurObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConcurObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"ConcurObject\",\"typeProperties\":{\"tableName\":\"datackfkithue\"},\"description\":\"sg\",\"structure\":\"dataqzgbjw\",\"schema\":\"dataudmpwewpmioleaj\",\"linkedServiceName\":{\"referenceName\":\"b\",\"parameters\":{\"ecmbaaj\":\"datayzwphbjks\"}},\"parameters\":{\"lvzkfekde\":{\"type\":\"SecureString\",\"defaultValue\":\"datak\"},\"b\":{\"type\":\"String\",\"defaultValue\":\"datajqtl\"},\"rqnneqryp\":{\"type\":\"SecureString\",\"defaultValue\":\"datapduibsr\"},\"cxybtdzy\":{\"type\":\"Int\",\"defaultValue\":\"datavshhovtuercpzhb\"}},\"annotations\":[\"dataaoegj\",\"datagpljbnwczsraz\",\"databybicqhxhj\"],\"folder\":{\"name\":\"pasizzfmugykwuy\"},\"\":{\"thdzitjzffph\":\"datatenndz\",\"zmzxvfybxmmrvnu\":\"datarwjqvswtwonad\"}}") + .toObject(ConcurObjectDataset.class); + Assertions.assertEquals("sg", model.description()); + Assertions.assertEquals("b", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("lvzkfekde").type()); + Assertions.assertEquals("pasizzfmugykwuy", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConcurObjectDataset model = + new ConcurObjectDataset() + .withDescription("sg") + .withStructure("dataqzgbjw") + .withSchema("dataudmpwewpmioleaj") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("b") + .withParameters(mapOf("ecmbaaj", "datayzwphbjks"))) + .withParameters( + mapOf( + "lvzkfekde", + new ParameterSpecification().withType(ParameterType.SECURE_STRING).withDefaultValue("datak"), + "b", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datajqtl"), + "rqnneqryp", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datapduibsr"), + "cxybtdzy", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datavshhovtuercpzhb"))) + .withAnnotations(Arrays.asList("dataaoegj", "datagpljbnwczsraz", "databybicqhxhj")) + .withFolder(new DatasetFolder().withName("pasizzfmugykwuy")) + .withTableName("datackfkithue"); + model = BinaryData.fromObject(model).toObject(ConcurObjectDataset.class); + Assertions.assertEquals("sg", model.description()); + Assertions.assertEquals("b", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("lvzkfekde").type()); + Assertions.assertEquals("pasizzfmugykwuy", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ConcurSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ConcurSourceTests.java new file mode 100644 index 000000000000..8970dcfecf9e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ConcurSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConcurSource; + +public final class ConcurSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConcurSource model = + BinaryData + .fromString( + "{\"type\":\"ConcurSource\",\"query\":\"datapyilojwcza\",\"queryTimeout\":\"datawtausk\",\"additionalColumns\":\"datahhmtypgrkdmezaun\",\"sourceRetryCount\":\"datacqtigav\",\"sourceRetryWait\":\"datasnrjhjlploaeppl\",\"maxConcurrentConnections\":\"datakcazuj\",\"disableMetricsCollection\":\"datauuzbsxhivncue\",\"\":{\"rtlnzdk\":\"dataexcn\"}}") + .toObject(ConcurSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConcurSource model = + new ConcurSource() + .withSourceRetryCount("datacqtigav") + .withSourceRetryWait("datasnrjhjlploaeppl") + .withMaxConcurrentConnections("datakcazuj") + .withDisableMetricsCollection("datauuzbsxhivncue") + .withQueryTimeout("datawtausk") + .withAdditionalColumns("datahhmtypgrkdmezaun") + .withQuery("datapyilojwcza"); + model = BinaryData.fromObject(model).toObject(ConcurSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ConnectionStatePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ConnectionStatePropertiesTests.java new file mode 100644 index 000000000000..172f0e25ba2c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ConnectionStatePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionStateProperties; + +public final class ConnectionStatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConnectionStateProperties model = + BinaryData + .fromString( + "{\"actionsRequired\":\"ppdbwnupgahxkum\",\"description\":\"jcaacfdmmcpugm\",\"status\":\"qepvufhbzeh\"}") + .toObject(ConnectionStateProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConnectionStateProperties model = new ConnectionStateProperties(); + model = BinaryData.fromObject(model).toObject(ConnectionStateProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ControlActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ControlActivityTests.java new file mode 100644 index 000000000000..6f161c7a4e04 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ControlActivityTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.ControlActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ControlActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ControlActivity model = + BinaryData + .fromString( + "{\"type\":\"Container\",\"name\":\"wlojwvrovjvj\",\"description\":\"ypcnbucb\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"f\",\"dependencyConditions\":[\"Succeeded\"],\"\":{\"epylmssdv\":\"datahfuwygssssjcp\",\"mmwkakyxyksde\":\"datavdcciyzrdj\",\"x\":\"datarwqmffvbhtuey\"}}],\"userProperties\":[{\"name\":\"nwcekqsbnca\",\"value\":\"datafapzebjeg\"},{\"name\":\"wgverbywu\",\"value\":\"dataveisjbpzdwhxputk\"},{\"name\":\"j\",\"value\":\"datasrwzvdfeya\"}],\"\":{\"bovtjmdymd\":\"datajqfxfiyjzuqg\",\"xkwwfyevhurklowm\":\"datap\",\"ei\":\"datarvzclilyoix\"}}") + .toObject(ControlActivity.class); + Assertions.assertEquals("wlojwvrovjvj", model.name()); + Assertions.assertEquals("ypcnbucb", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("f", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("nwcekqsbnca", model.userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ControlActivity model = + new ControlActivity() + .withName("wlojwvrovjvj") + .withDescription("ypcnbucb") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("f") + .withDependencyConditions(Arrays.asList(DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("nwcekqsbnca").withValue("datafapzebjeg"), + new UserProperty().withName("wgverbywu").withValue("dataveisjbpzdwhxputk"), + new UserProperty().withName("j").withValue("datasrwzvdfeya"))); + model = BinaryData.fromObject(model).toObject(ControlActivity.class); + Assertions.assertEquals("wlojwvrovjvj", model.name()); + Assertions.assertEquals("ypcnbucb", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("f", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("nwcekqsbnca", model.userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyActivityLogSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyActivityLogSettingsTests.java new file mode 100644 index 000000000000..abf906cb0852 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyActivityLogSettingsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CopyActivityLogSettings; + +public final class CopyActivityLogSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CopyActivityLogSettings model = + BinaryData + .fromString("{\"logLevel\":\"datavlyaprjzbx\",\"enableReliableLogging\":\"dataqfrntzbhmxl\"}") + .toObject(CopyActivityLogSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CopyActivityLogSettings model = + new CopyActivityLogSettings().withLogLevel("datavlyaprjzbx").withEnableReliableLogging("dataqfrntzbhmxl"); + model = BinaryData.fromObject(model).toObject(CopyActivityLogSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyActivityTests.java new file mode 100644 index 000000000000..ef47d536cbc2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyActivityTests.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.CopyActivity; +import com.azure.resourcemanager.datafactory.models.CopyActivityLogSettings; +import com.azure.resourcemanager.datafactory.models.CopySink; +import com.azure.resourcemanager.datafactory.models.CopySource; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogLocationSettings; +import com.azure.resourcemanager.datafactory.models.LogSettings; +import com.azure.resourcemanager.datafactory.models.LogStorageSettings; +import com.azure.resourcemanager.datafactory.models.RedirectIncompatibleRowSettings; +import com.azure.resourcemanager.datafactory.models.SkipErrorFile; +import com.azure.resourcemanager.datafactory.models.StagingSettings; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CopyActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CopyActivity model = + BinaryData + .fromString( + "{\"type\":\"Copy\",\"typeProperties\":{\"source\":{\"type\":\"CopySource\",\"sourceRetryCount\":\"dataingadkrkny\",\"sourceRetryWait\":\"datangdfzqcjfqmy\",\"maxConcurrentConnections\":\"datawbuxqzfwgbqsvexz\",\"disableMetricsCollection\":\"datafwiav\",\"\":{\"cbxrskylq\":\"datatgxdlznfo\",\"teikktret\":\"datapp\",\"nvb\":\"datatsygzjplaxxfnrlt\"}},\"sink\":{\"type\":\"CopySink\",\"writeBatchSize\":\"dataotghxkrrpmgdoli\",\"writeBatchTimeout\":\"datazsglavdtttyd\",\"sinkRetryCount\":\"dataomz\",\"sinkRetryWait\":\"datakjq\",\"maxConcurrentConnections\":\"datahbypwmveyrciked\",\"disableMetricsCollection\":\"dataufjuqow\",\"\":{\"sz\":\"datavjy\"}},\"translator\":\"dataeuqxhmri\",\"enableStaging\":\"datakcgusvpvtaulxx\",\"stagingSettings\":{\"linkedServiceName\":{\"referenceName\":\"fxdqqz\",\"parameters\":{\"odhaslpaae\":\"datagwqi\",\"ht\":\"datarzxvffq\",\"epssoqdibyg\":\"datamhrztbyulk\"}},\"path\":\"datacidiwkxi\",\"enableCompression\":\"dataiqxlxoksyypftrdi\",\"\":{\"ccetyyvxkwobb\":\"datarbqgatkliopgwpka\"}},\"parallelCopies\":\"datasdpyirtrlzkpje\",\"dataIntegrationUnits\":\"datazhhfnaqclepc\",\"enableSkipIncompatibleRow\":\"dataowuthfwphnmll\",\"redirectIncompatibleRowSettings\":{\"linkedServiceName\":\"datajehwhxxuo\",\"path\":\"dataeaqahzkvnapxhtqw\",\"\":{\"bziibuabpvdwhvn\":\"dataxaovubfllfke\",\"kgbkzqbo\":\"datacbuzudkqoeoukvi\",\"hclxwede\":\"datafhdyasklmy\",\"pduttqjtszq\":\"dataawljatvfddq\"}},\"logStorageSettings\":{\"linkedServiceName\":{\"referenceName\":\"cqcwbxx\",\"parameters\":{\"lvkdwwqhhlfvmwu\":\"dataekqjdru\",\"fbdanfexlawkeq\":\"dataarswsvtzotmwxq\",\"dyk\":\"datahzbwrtmjskbienjn\"}},\"path\":\"dataounbyvsfqurr\",\"logLevel\":\"dataqbknoxjhe\",\"enableReliableLogging\":\"datahmmwbvr\",\"\":{\"uzkwigifinoy\":\"databiigxxrez\",\"kooa\":\"datadtlpshxjhan\"}},\"logSettings\":{\"enableCopyActivityLog\":\"datakgqsqvfyo\",\"copyActivityLogSettings\":{\"logLevel\":\"datataljiqlxjjltuym\",\"enableReliableLogging\":\"dataaqhscaanddlvc\"},\"logLocationSettings\":{\"linkedServiceName\":{\"referenceName\":\"uv\",\"parameters\":{\"gdjvyclasdprknup\":\"dataflsby\",\"pvqczpk\":\"datateklgs\"}},\"path\":\"dataaolthowcsue\"}},\"preserveRules\":[\"datag\"],\"preserve\":[\"dataimtxmd\",\"dataexar\"],\"validateDataConsistency\":\"datakoir\",\"skipErrorFile\":{\"fileMissing\":\"dataftlbs\",\"dataInconsistency\":\"datanmxa\"}},\"inputs\":[{\"referenceName\":\"uadhi\",\"parameters\":{\"ujliti\":\"dataxstwaazeqjnou\",\"yqxipb\":\"datashmqxgjzslho\"}},{\"referenceName\":\"spvkcnggo\",\"parameters\":{\"itlam\":\"datanjm\",\"wqzsyetbff\":\"databklkhhjx\",\"l\":\"datahqzvwznwcqoapdtj\"}}],\"outputs\":[{\"referenceName\":\"fdpurvz\",\"parameters\":{\"kvq\":\"databesfumedsaa\",\"svivqkyaghfvubl\":\"datab\",\"nymbjrsd\":\"datazsveguxaxij\"}},{\"referenceName\":\"ufqxrlzi\",\"parameters\":{\"newrvjg\":\"datauzegmcmlzmfeti\"}},{\"referenceName\":\"nm\",\"parameters\":{\"orzozf\":\"datagowdavpqyhax\",\"ggoppmxcm\":\"datagkwpbnefabgt\",\"a\":\"dataugddycfyfau\",\"zcxxfwpjpgq\":\"datazqvawkesx\"}},{\"referenceName\":\"brzkmgylmyc\",\"parameters\":{\"cyhjhrkfpt\":\"dataorrecoiqwnqliz\",\"fmbvmajcmpohjdvf\":\"dataiommis\"}}],\"linkedServiceName\":{\"referenceName\":\"b\",\"parameters\":{\"gcjssqpk\":\"dataymahboindiuyqdjk\",\"zqwwttqjyiw\":\"databryhvshkvup\"}},\"policy\":{\"timeout\":\"datar\",\"retry\":\"datavbjvvcogupsho\",\"retryIntervalInSeconds\":1908676159,\"secureInput\":true,\"secureOutput\":true,\"\":{\"uuhbcckbcvtelmd\":\"datajoor\",\"mblnismv\":\"datamasvghphlbkqu\",\"glxljuy\":\"dataaasdexs\",\"npdjomd\":\"datakkpovzespdipdx\"}},\"name\":\"adwosjxywwvilkyh\",\"description\":\"riyhdbbj\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"rpwjenbxtkghrrxa\",\"dependencyConditions\":[\"Completed\"],\"\":{\"jwipfryivpe\":\"datahkizyxoyxnhu\",\"kpdmmowftfrqebr\":\"datazyrpdxygfpqxseme\",\"tefe\":\"dataop\",\"j\":\"datafxm\"}},{\"activity\":\"wwidnrds\",\"dependencyConditions\":[\"Succeeded\",\"Completed\",\"Failed\"],\"\":{\"hwbead\":\"datadyhodisypgapfd\"}}],\"userProperties\":[{\"name\":\"qnkoskflnjaysr\",\"value\":\"dataeevmb\"},{\"name\":\"emrhbzetss\",\"value\":\"datawwexbotbrepef\"},{\"name\":\"lie\",\"value\":\"dataocyarvsfz\"},{\"name\":\"cscootfsgilwis\",\"value\":\"dataxzpz\"}],\"\":{\"gknocshm\":\"datastrtrfv\",\"pxydpamctzmwrh\":\"datacjqtuzbirbrvzhfj\",\"jsgkouenpgkxyr\":\"datacdgunsjssre\"}}") + .toObject(CopyActivity.class); + Assertions.assertEquals("adwosjxywwvilkyh", model.name()); + Assertions.assertEquals("riyhdbbj", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("rpwjenbxtkghrrxa", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("qnkoskflnjaysr", model.userProperties().get(0).name()); + Assertions.assertEquals("b", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1908676159, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("uadhi", model.inputs().get(0).referenceName()); + Assertions.assertEquals("fdpurvz", model.outputs().get(0).referenceName()); + Assertions.assertEquals("fxdqqz", model.stagingSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("cqcwbxx", model.logStorageSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("uv", model.logSettings().logLocationSettings().linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CopyActivity model = + new CopyActivity() + .withName("adwosjxywwvilkyh") + .withDescription("riyhdbbj") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("rpwjenbxtkghrrxa") + .withDependencyConditions(Arrays.asList(DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("wwidnrds") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("qnkoskflnjaysr").withValue("dataeevmb"), + new UserProperty().withName("emrhbzetss").withValue("datawwexbotbrepef"), + new UserProperty().withName("lie").withValue("dataocyarvsfz"), + new UserProperty().withName("cscootfsgilwis").withValue("dataxzpz"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("b") + .withParameters(mapOf("gcjssqpk", "dataymahboindiuyqdjk", "zqwwttqjyiw", "databryhvshkvup"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datar") + .withRetry("datavbjvvcogupsho") + .withRetryIntervalInSeconds(1908676159) + .withSecureInput(true) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withInputs( + Arrays + .asList( + new DatasetReference() + .withReferenceName("uadhi") + .withParameters(mapOf("ujliti", "dataxstwaazeqjnou", "yqxipb", "datashmqxgjzslho")), + new DatasetReference() + .withReferenceName("spvkcnggo") + .withParameters( + mapOf( + "itlam", + "datanjm", + "wqzsyetbff", + "databklkhhjx", + "l", + "datahqzvwznwcqoapdtj")))) + .withOutputs( + Arrays + .asList( + new DatasetReference() + .withReferenceName("fdpurvz") + .withParameters( + mapOf( + "kvq", + "databesfumedsaa", + "svivqkyaghfvubl", + "datab", + "nymbjrsd", + "datazsveguxaxij")), + new DatasetReference() + .withReferenceName("ufqxrlzi") + .withParameters(mapOf("newrvjg", "datauzegmcmlzmfeti")), + new DatasetReference() + .withReferenceName("nm") + .withParameters( + mapOf( + "orzozf", + "datagowdavpqyhax", + "ggoppmxcm", + "datagkwpbnefabgt", + "a", + "dataugddycfyfau", + "zcxxfwpjpgq", + "datazqvawkesx")), + new DatasetReference() + .withReferenceName("brzkmgylmyc") + .withParameters( + mapOf("cyhjhrkfpt", "dataorrecoiqwnqliz", "fmbvmajcmpohjdvf", "dataiommis")))) + .withSource( + new CopySource() + .withSourceRetryCount("dataingadkrkny") + .withSourceRetryWait("datangdfzqcjfqmy") + .withMaxConcurrentConnections("datawbuxqzfwgbqsvexz") + .withDisableMetricsCollection("datafwiav") + .withAdditionalProperties(mapOf("type", "CopySource"))) + .withSink( + new CopySink() + .withWriteBatchSize("dataotghxkrrpmgdoli") + .withWriteBatchTimeout("datazsglavdtttyd") + .withSinkRetryCount("dataomz") + .withSinkRetryWait("datakjq") + .withMaxConcurrentConnections("datahbypwmveyrciked") + .withDisableMetricsCollection("dataufjuqow") + .withAdditionalProperties(mapOf("type", "CopySink"))) + .withTranslator("dataeuqxhmri") + .withEnableStaging("datakcgusvpvtaulxx") + .withStagingSettings( + new StagingSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("fxdqqz") + .withParameters( + mapOf( + "odhaslpaae", + "datagwqi", + "ht", + "datarzxvffq", + "epssoqdibyg", + "datamhrztbyulk"))) + .withPath("datacidiwkxi") + .withEnableCompression("dataiqxlxoksyypftrdi") + .withAdditionalProperties(mapOf())) + .withParallelCopies("datasdpyirtrlzkpje") + .withDataIntegrationUnits("datazhhfnaqclepc") + .withEnableSkipIncompatibleRow("dataowuthfwphnmll") + .withRedirectIncompatibleRowSettings( + new RedirectIncompatibleRowSettings() + .withLinkedServiceName("datajehwhxxuo") + .withPath("dataeaqahzkvnapxhtqw") + .withAdditionalProperties(mapOf())) + .withLogStorageSettings( + new LogStorageSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("cqcwbxx") + .withParameters( + mapOf( + "lvkdwwqhhlfvmwu", + "dataekqjdru", + "fbdanfexlawkeq", + "dataarswsvtzotmwxq", + "dyk", + "datahzbwrtmjskbienjn"))) + .withPath("dataounbyvsfqurr") + .withLogLevel("dataqbknoxjhe") + .withEnableReliableLogging("datahmmwbvr") + .withAdditionalProperties(mapOf())) + .withLogSettings( + new LogSettings() + .withEnableCopyActivityLog("datakgqsqvfyo") + .withCopyActivityLogSettings( + new CopyActivityLogSettings() + .withLogLevel("datataljiqlxjjltuym") + .withEnableReliableLogging("dataaqhscaanddlvc")) + .withLogLocationSettings( + new LogLocationSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("uv") + .withParameters( + mapOf("gdjvyclasdprknup", "dataflsby", "pvqczpk", "datateklgs"))) + .withPath("dataaolthowcsue"))) + .withPreserveRules(Arrays.asList("datag")) + .withPreserve(Arrays.asList("dataimtxmd", "dataexar")) + .withValidateDataConsistency("datakoir") + .withSkipErrorFile(new SkipErrorFile().withFileMissing("dataftlbs").withDataInconsistency("datanmxa")); + model = BinaryData.fromObject(model).toObject(CopyActivity.class); + Assertions.assertEquals("adwosjxywwvilkyh", model.name()); + Assertions.assertEquals("riyhdbbj", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("rpwjenbxtkghrrxa", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("qnkoskflnjaysr", model.userProperties().get(0).name()); + Assertions.assertEquals("b", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1908676159, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("uadhi", model.inputs().get(0).referenceName()); + Assertions.assertEquals("fdpurvz", model.outputs().get(0).referenceName()); + Assertions.assertEquals("fxdqqz", model.stagingSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("cqcwbxx", model.logStorageSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("uv", model.logSettings().logLocationSettings().linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyActivityTypePropertiesTests.java new file mode 100644 index 000000000000..c8d3e31ce8a7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyActivityTypePropertiesTests.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.CopyActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.CopyActivityLogSettings; +import com.azure.resourcemanager.datafactory.models.CopySink; +import com.azure.resourcemanager.datafactory.models.CopySource; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogLocationSettings; +import com.azure.resourcemanager.datafactory.models.LogSettings; +import com.azure.resourcemanager.datafactory.models.LogStorageSettings; +import com.azure.resourcemanager.datafactory.models.RedirectIncompatibleRowSettings; +import com.azure.resourcemanager.datafactory.models.SkipErrorFile; +import com.azure.resourcemanager.datafactory.models.StagingSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CopyActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CopyActivityTypeProperties model = + BinaryData + .fromString( + "{\"source\":{\"type\":\"CopySource\",\"sourceRetryCount\":\"datap\",\"sourceRetryWait\":\"datahyekggo\",\"maxConcurrentConnections\":\"datalqvuwsqmwqsg\",\"disableMetricsCollection\":\"dataz\",\"\":{\"ursumbci\":\"datatngxvrpkizjnkgd\",\"uyblo\":\"datakbkqpsvoxshxum\",\"samxyjqhwsoj\":\"datarufvmgblbqx\"}},\"sink\":{\"type\":\"CopySink\",\"writeBatchSize\":\"databbgvmowy\",\"writeBatchTimeout\":\"dataqhuhmldhnzsc\",\"sinkRetryCount\":\"datauzuchotdz\",\"sinkRetryWait\":\"datahqhwpuaermaww\",\"maxConcurrentConnections\":\"datasdazqcemcotwfuo\",\"disableMetricsCollection\":\"dataisxzhik\",\"\":{\"xbupsx\":\"datas\",\"gxcgqkhyvtajwkrx\":\"dataoj\",\"zbomjbyssprkbz\":\"datazlmwfncwlwov\"}},\"translator\":\"dataljwfncsaa\",\"enableStaging\":\"datacpgz\",\"stagingSettings\":{\"linkedServiceName\":{\"referenceName\":\"rgppqajdmju\",\"parameters\":{\"etbzfwfuxdtp\":\"dataqqguhvnwrzimi\",\"quyfftqomb\":\"datacsqkedlclx\",\"djbyfdfuaj\":\"datasgqxaciduobzz\",\"vzznyjqbwxpwjvf\":\"datahpyylekubiwv\"}},\"path\":\"dataloquttkb\",\"enableCompression\":\"datagjupjbdqmnk\",\"\":{\"p\":\"dataqssh\",\"womevqvv\":\"datajttnurkmerqzap\"}},\"parallelCopies\":\"datawdlduvimgtceor\",\"dataIntegrationUnits\":\"datao\",\"enableSkipIncompatibleRow\":\"dataapafbjvbk\",\"redirectIncompatibleRowSettings\":{\"linkedServiceName\":\"datagzkcpt\",\"path\":\"datacipy\",\"\":{\"vpuacajxdrgxpuxp\":\"datajgblskizp\",\"pzrycchqz\":\"dataslmfr\",\"dzgszjhekbmd\":\"datafge\"}},\"logStorageSettings\":{\"linkedServiceName\":{\"referenceName\":\"hioj\",\"parameters\":{\"tyeuvwysbme\":\"datagp\"}},\"path\":\"datag\",\"logLevel\":\"datanlihbku\",\"enableReliableLogging\":\"dataeywyftvy\",\"\":{\"scyzvv\":\"dataqzjfvbnyyjvz\",\"ssgbscq\":\"dataxmy\",\"qiparctshe\":\"dataeixazebmmjaigax\",\"fawhoosrsol\":\"datagtdvhokx\"}},\"logSettings\":{\"enableCopyActivityLog\":\"datamfoe\",\"copyActivityLogSettings\":{\"logLevel\":\"dataiq\",\"enableReliableLogging\":\"datapelnud\"},\"logLocationSettings\":{\"linkedServiceName\":{\"referenceName\":\"fie\",\"parameters\":{\"jllfgmdoaihl\":\"dataorsdvuirqfk\",\"cv\":\"datarsqcivmirybwga\"}},\"path\":\"datay\"}},\"preserveRules\":[\"dataazgtbynxsh\",\"dataawexgeqo\"],\"preserve\":[\"datauzxxkojjphbo\",\"datauovsv\",\"datanpcxdkmtvpa\"],\"validateDataConsistency\":\"dataubnyhm\",\"skipErrorFile\":{\"fileMissing\":\"datadevotucnzbpocum\",\"dataInconsistency\":\"dataftzoemzdnvnoo\"}}") + .toObject(CopyActivityTypeProperties.class); + Assertions.assertEquals("rgppqajdmju", model.stagingSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("hioj", model.logStorageSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("fie", model.logSettings().logLocationSettings().linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CopyActivityTypeProperties model = + new CopyActivityTypeProperties() + .withSource( + new CopySource() + .withSourceRetryCount("datap") + .withSourceRetryWait("datahyekggo") + .withMaxConcurrentConnections("datalqvuwsqmwqsg") + .withDisableMetricsCollection("dataz") + .withAdditionalProperties(mapOf("type", "CopySource"))) + .withSink( + new CopySink() + .withWriteBatchSize("databbgvmowy") + .withWriteBatchTimeout("dataqhuhmldhnzsc") + .withSinkRetryCount("datauzuchotdz") + .withSinkRetryWait("datahqhwpuaermaww") + .withMaxConcurrentConnections("datasdazqcemcotwfuo") + .withDisableMetricsCollection("dataisxzhik") + .withAdditionalProperties(mapOf("type", "CopySink"))) + .withTranslator("dataljwfncsaa") + .withEnableStaging("datacpgz") + .withStagingSettings( + new StagingSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("rgppqajdmju") + .withParameters( + mapOf( + "etbzfwfuxdtp", + "dataqqguhvnwrzimi", + "quyfftqomb", + "datacsqkedlclx", + "djbyfdfuaj", + "datasgqxaciduobzz", + "vzznyjqbwxpwjvf", + "datahpyylekubiwv"))) + .withPath("dataloquttkb") + .withEnableCompression("datagjupjbdqmnk") + .withAdditionalProperties(mapOf())) + .withParallelCopies("datawdlduvimgtceor") + .withDataIntegrationUnits("datao") + .withEnableSkipIncompatibleRow("dataapafbjvbk") + .withRedirectIncompatibleRowSettings( + new RedirectIncompatibleRowSettings() + .withLinkedServiceName("datagzkcpt") + .withPath("datacipy") + .withAdditionalProperties(mapOf())) + .withLogStorageSettings( + new LogStorageSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("hioj") + .withParameters(mapOf("tyeuvwysbme", "datagp"))) + .withPath("datag") + .withLogLevel("datanlihbku") + .withEnableReliableLogging("dataeywyftvy") + .withAdditionalProperties(mapOf())) + .withLogSettings( + new LogSettings() + .withEnableCopyActivityLog("datamfoe") + .withCopyActivityLogSettings( + new CopyActivityLogSettings() + .withLogLevel("dataiq") + .withEnableReliableLogging("datapelnud")) + .withLogLocationSettings( + new LogLocationSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("fie") + .withParameters( + mapOf("jllfgmdoaihl", "dataorsdvuirqfk", "cv", "datarsqcivmirybwga"))) + .withPath("datay"))) + .withPreserveRules(Arrays.asList("dataazgtbynxsh", "dataawexgeqo")) + .withPreserve(Arrays.asList("datauzxxkojjphbo", "datauovsv", "datanpcxdkmtvpa")) + .withValidateDataConsistency("dataubnyhm") + .withSkipErrorFile( + new SkipErrorFile() + .withFileMissing("datadevotucnzbpocum") + .withDataInconsistency("dataftzoemzdnvnoo")); + model = BinaryData.fromObject(model).toObject(CopyActivityTypeProperties.class); + Assertions.assertEquals("rgppqajdmju", model.stagingSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("hioj", model.logStorageSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("fie", model.logSettings().logLocationSettings().linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyComputeScalePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyComputeScalePropertiesTests.java new file mode 100644 index 000000000000..59ce5ebf02bc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyComputeScalePropertiesTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CopyComputeScaleProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CopyComputeScalePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CopyComputeScaleProperties model = + BinaryData + .fromString( + "{\"dataIntegrationUnit\":40126306,\"timeToLive\":1891599508,\"\":{\"adohsj\":\"datanssxylsui\",\"qqnzk\":\"dataiehkxgfu\"}}") + .toObject(CopyComputeScaleProperties.class); + Assertions.assertEquals(40126306, model.dataIntegrationUnit()); + Assertions.assertEquals(1891599508, model.timeToLive()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CopyComputeScaleProperties model = + new CopyComputeScaleProperties() + .withDataIntegrationUnit(40126306) + .withTimeToLive(1891599508) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(CopyComputeScaleProperties.class); + Assertions.assertEquals(40126306, model.dataIntegrationUnit()); + Assertions.assertEquals(1891599508, model.timeToLive()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopySinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopySinkTests.java new file mode 100644 index 000000000000..81f0d22f9b3a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopySinkTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CopySink; +import java.util.HashMap; +import java.util.Map; + +public final class CopySinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CopySink model = + BinaryData + .fromString( + "{\"type\":\"CopySink\",\"writeBatchSize\":\"datayajkdejpar\",\"writeBatchTimeout\":\"datasbozfjbdyyxhjf\",\"sinkRetryCount\":\"databwmrdl\",\"sinkRetryWait\":\"dataklhwrikrulj\",\"maxConcurrentConnections\":\"datagzffemryoia\",\"disableMetricsCollection\":\"databz\",\"\":{\"umvbhbli\":\"datacc\"}}") + .toObject(CopySink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CopySink model = + new CopySink() + .withWriteBatchSize("datayajkdejpar") + .withWriteBatchTimeout("datasbozfjbdyyxhjf") + .withSinkRetryCount("databwmrdl") + .withSinkRetryWait("dataklhwrikrulj") + .withMaxConcurrentConnections("datagzffemryoia") + .withDisableMetricsCollection("databz") + .withAdditionalProperties(mapOf("type", "CopySink")); + model = BinaryData.fromObject(model).toObject(CopySink.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopySourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopySourceTests.java new file mode 100644 index 000000000000..f368d311d399 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopySourceTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CopySource; +import java.util.HashMap; +import java.util.Map; + +public final class CopySourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CopySource model = + BinaryData + .fromString( + "{\"type\":\"CopySource\",\"sourceRetryCount\":\"databrdwfhhwt\",\"sourceRetryWait\":\"datagefaycbvgotbjnx\",\"maxConcurrentConnections\":\"dataiotxnp\",\"disableMetricsCollection\":\"dataflxluvmsgdis\",\"\":{\"uozdvokxuyhhrd\":\"dataxt\",\"ahgsibldxyaqdaa\":\"datakdbq\"}}") + .toObject(CopySource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CopySource model = + new CopySource() + .withSourceRetryCount("databrdwfhhwt") + .withSourceRetryWait("datagefaycbvgotbjnx") + .withMaxConcurrentConnections("dataiotxnp") + .withDisableMetricsCollection("dataflxluvmsgdis") + .withAdditionalProperties(mapOf("type", "CopySource")); + model = BinaryData.fromObject(model).toObject(CopySource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyTranslatorTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyTranslatorTests.java new file mode 100644 index 000000000000..4b8695229a57 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CopyTranslatorTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CopyTranslator; +import java.util.HashMap; +import java.util.Map; + +public final class CopyTranslatorTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CopyTranslator model = + BinaryData + .fromString( + "{\"type\":\"CopyTranslator\",\"\":{\"tctnqdcgobkceb\":\"datajmzpyukrwvvhc\",\"nqqiqc\":\"datartputmtjsklkw\",\"n\":\"datamfxldqtm\",\"p\":\"dataejnemrfqjhc\"}}") + .toObject(CopyTranslator.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CopyTranslator model = new CopyTranslator().withAdditionalProperties(mapOf("type", "CopyTranslator")); + model = BinaryData.fromObject(model).toObject(CopyTranslator.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiCollectionDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiCollectionDatasetTests.java new file mode 100644 index 000000000000..e09be190b08a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiCollectionDatasetTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CosmosDbMongoDbApiCollectionDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CosmosDbMongoDbApiCollectionDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbMongoDbApiCollectionDataset model = + BinaryData + .fromString( + "{\"type\":\"CosmosDbMongoDbApiCollection\",\"typeProperties\":{\"collection\":\"datadwhslxebaj\"},\"description\":\"knmstbdoprwkamp\",\"structure\":\"datawpbldz\",\"schema\":\"dataudrcycm\",\"linkedServiceName\":{\"referenceName\":\"huzymhlhihqk\",\"parameters\":{\"aiildcpud\":\"datakmnbzko\",\"drobujnjgy\":\"datahquxsyjofpgv\",\"njgcp\":\"datauxmqxigidul\",\"ghxhkyqzjsdkpvn\":\"datakgrhnytslgsazuqz\"}},\"parameters\":{\"hflyuvbgtz\":{\"type\":\"Array\",\"defaultValue\":\"dataffxsfybntmveh\"}},\"annotations\":[\"dataweuydyb\",\"dataairvhpqsv\"],\"folder\":{\"name\":\"ogeatrcnqnvn\"},\"\":{\"iznzs\":\"datafcsjvjnk\"}}") + .toObject(CosmosDbMongoDbApiCollectionDataset.class); + Assertions.assertEquals("knmstbdoprwkamp", model.description()); + Assertions.assertEquals("huzymhlhihqk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("hflyuvbgtz").type()); + Assertions.assertEquals("ogeatrcnqnvn", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbMongoDbApiCollectionDataset model = + new CosmosDbMongoDbApiCollectionDataset() + .withDescription("knmstbdoprwkamp") + .withStructure("datawpbldz") + .withSchema("dataudrcycm") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("huzymhlhihqk") + .withParameters( + mapOf( + "aiildcpud", + "datakmnbzko", + "drobujnjgy", + "datahquxsyjofpgv", + "njgcp", + "datauxmqxigidul", + "ghxhkyqzjsdkpvn", + "datakgrhnytslgsazuqz"))) + .withParameters( + mapOf( + "hflyuvbgtz", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("dataffxsfybntmveh"))) + .withAnnotations(Arrays.asList("dataweuydyb", "dataairvhpqsv")) + .withFolder(new DatasetFolder().withName("ogeatrcnqnvn")) + .withCollection("datadwhslxebaj"); + model = BinaryData.fromObject(model).toObject(CosmosDbMongoDbApiCollectionDataset.class); + Assertions.assertEquals("knmstbdoprwkamp", model.description()); + Assertions.assertEquals("huzymhlhihqk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("hflyuvbgtz").type()); + Assertions.assertEquals("ogeatrcnqnvn", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiCollectionDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiCollectionDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..6a5dd5cdd930 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiCollectionDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.CosmosDbMongoDbApiCollectionDatasetTypeProperties; + +public final class CosmosDbMongoDbApiCollectionDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbMongoDbApiCollectionDatasetTypeProperties model = + BinaryData + .fromString("{\"collection\":\"databiba\"}") + .toObject(CosmosDbMongoDbApiCollectionDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbMongoDbApiCollectionDatasetTypeProperties model = + new CosmosDbMongoDbApiCollectionDatasetTypeProperties().withCollection("databiba"); + model = BinaryData.fromObject(model).toObject(CosmosDbMongoDbApiCollectionDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiLinkedServiceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiLinkedServiceTests.java new file mode 100644 index 000000000000..6b69560965e7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiLinkedServiceTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CosmosDbMongoDbApiLinkedService; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CosmosDbMongoDbApiLinkedServiceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbMongoDbApiLinkedService model = + BinaryData + .fromString( + "{\"type\":\"CosmosDbMongoDbApi\",\"typeProperties\":{\"isServerVersionAbove32\":\"datastkdlyj\",\"connectionString\":\"dataijxefydckffkz\",\"database\":\"datachrkiwpadnhf\"},\"connectVia\":{\"referenceName\":\"nnitrugotfrdl\",\"parameters\":{\"igksni\":\"dataexbrvbdyriyray\",\"dprezqxzxeigydd\":\"datacl\",\"lwvcnm\":\"datafnmbxerzypcr\"}},\"description\":\"izxql\",\"parameters\":{\"mnyuh\":{\"type\":\"String\",\"defaultValue\":\"datacujdzlgyermj\"},\"fcbweabptkmkuquv\":{\"type\":\"Int\",\"defaultValue\":\"databf\"}},\"annotations\":[\"datan\",\"datam\",\"datacldoyohuafuclop\",\"dataemsylwsm\"],\"\":{\"om\":\"datawfrgdmbgbht\",\"tzbkeeohpf\":\"dataustkqywabhlgrrsk\"}}") + .toObject(CosmosDbMongoDbApiLinkedService.class); + Assertions.assertEquals("nnitrugotfrdl", model.connectVia().referenceName()); + Assertions.assertEquals("izxql", model.description()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("mnyuh").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbMongoDbApiLinkedService model = + new CosmosDbMongoDbApiLinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("nnitrugotfrdl") + .withParameters( + mapOf( + "igksni", + "dataexbrvbdyriyray", + "dprezqxzxeigydd", + "datacl", + "lwvcnm", + "datafnmbxerzypcr"))) + .withDescription("izxql") + .withParameters( + mapOf( + "mnyuh", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datacujdzlgyermj"), + "fcbweabptkmkuquv", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("databf"))) + .withAnnotations(Arrays.asList("datan", "datam", "datacldoyohuafuclop", "dataemsylwsm")) + .withIsServerVersionAbove32("datastkdlyj") + .withConnectionString("dataijxefydckffkz") + .withDatabase("datachrkiwpadnhf"); + model = BinaryData.fromObject(model).toObject(CosmosDbMongoDbApiLinkedService.class); + Assertions.assertEquals("nnitrugotfrdl", model.connectVia().referenceName()); + Assertions.assertEquals("izxql", model.description()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("mnyuh").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiLinkedServiceTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiLinkedServiceTypePropertiesTests.java new file mode 100644 index 000000000000..34fae50d9a60 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiLinkedServiceTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.CosmosDbMongoDbApiLinkedServiceTypeProperties; + +public final class CosmosDbMongoDbApiLinkedServiceTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbMongoDbApiLinkedServiceTypeProperties model = + BinaryData + .fromString( + "{\"isServerVersionAbove32\":\"dataxgdjudekmxhw\",\"connectionString\":\"datamehcdfd\",\"database\":\"datathqnztuki\"}") + .toObject(CosmosDbMongoDbApiLinkedServiceTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbMongoDbApiLinkedServiceTypeProperties model = + new CosmosDbMongoDbApiLinkedServiceTypeProperties() + .withIsServerVersionAbove32("dataxgdjudekmxhw") + .withConnectionString("datamehcdfd") + .withDatabase("datathqnztuki"); + model = BinaryData.fromObject(model).toObject(CosmosDbMongoDbApiLinkedServiceTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiSinkTests.java new file mode 100644 index 000000000000..7d7f8f1e668d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CosmosDbMongoDbApiSink; + +public final class CosmosDbMongoDbApiSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbMongoDbApiSink model = + BinaryData + .fromString( + "{\"type\":\"CosmosDbMongoDbApiSink\",\"writeBehavior\":\"datapk\",\"writeBatchSize\":\"dataxdmbx\",\"writeBatchTimeout\":\"dataxw\",\"sinkRetryCount\":\"dataqvhfyvkxgo\",\"sinkRetryWait\":\"dataveiucuxwnojvcr\",\"maxConcurrentConnections\":\"datambnfvygtt\",\"disableMetricsCollection\":\"datafjalpsycvcksz\",\"\":{\"fth\":\"dataguucpytsxnujw\",\"eoxlbccccrauabd\":\"datazi\",\"xqgsteeksbksvv\":\"datavjrbgc\",\"vvu\":\"datavoi\"}}") + .toObject(CosmosDbMongoDbApiSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbMongoDbApiSink model = + new CosmosDbMongoDbApiSink() + .withWriteBatchSize("dataxdmbx") + .withWriteBatchTimeout("dataxw") + .withSinkRetryCount("dataqvhfyvkxgo") + .withSinkRetryWait("dataveiucuxwnojvcr") + .withMaxConcurrentConnections("datambnfvygtt") + .withDisableMetricsCollection("datafjalpsycvcksz") + .withWriteBehavior("datapk"); + model = BinaryData.fromObject(model).toObject(CosmosDbMongoDbApiSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiSourceTests.java new file mode 100644 index 000000000000..d652e1811923 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbMongoDbApiSourceTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CosmosDbMongoDbApiSource; +import com.azure.resourcemanager.datafactory.models.MongoDbCursorMethodsProperties; +import java.util.HashMap; +import java.util.Map; + +public final class CosmosDbMongoDbApiSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbMongoDbApiSource model = + BinaryData + .fromString( + "{\"type\":\"CosmosDbMongoDbApiSource\",\"filter\":\"datagabsfjrjzdq\",\"cursorMethods\":{\"project\":\"dataor\",\"sort\":\"datadibepgfrbijoehh\",\"skip\":\"datawsgqziwooet\",\"limit\":\"datassyazmmbuxqtokck\",\"\":{\"yruh\":\"dataftqk\"}},\"batchSize\":\"datawucmqfurbtbogxly\",\"queryTimeout\":\"databvxjguwtsfi\",\"additionalColumns\":\"dataiznbif\",\"sourceRetryCount\":\"dataix\",\"sourceRetryWait\":\"datakj\",\"maxConcurrentConnections\":\"dataxl\",\"disableMetricsCollection\":\"datamvrblj\",\"\":{\"vhtzidzqrpfhzxk\":\"datasaskullvtsauj\",\"bnmthxcmxqdexnkp\":\"dataygkuidgwdhawjco\",\"pnjgiumuztbcjt\":\"dataoxcmsmzy\",\"ehmvrveurpzrysef\":\"datamcnrgwgcstozrv\"}}") + .toObject(CosmosDbMongoDbApiSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbMongoDbApiSource model = + new CosmosDbMongoDbApiSource() + .withSourceRetryCount("dataix") + .withSourceRetryWait("datakj") + .withMaxConcurrentConnections("dataxl") + .withDisableMetricsCollection("datamvrblj") + .withFilter("datagabsfjrjzdq") + .withCursorMethods( + new MongoDbCursorMethodsProperties() + .withProject("dataor") + .withSort("datadibepgfrbijoehh") + .withSkip("datawsgqziwooet") + .withLimit("datassyazmmbuxqtokck") + .withAdditionalProperties(mapOf())) + .withBatchSize("datawucmqfurbtbogxly") + .withQueryTimeout("databvxjguwtsfi") + .withAdditionalColumns("dataiznbif"); + model = BinaryData.fromObject(model).toObject(CosmosDbMongoDbApiSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiCollectionDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiCollectionDatasetTests.java new file mode 100644 index 000000000000..9dc97b7a39cf --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiCollectionDatasetTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CosmosDbSqlApiCollectionDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CosmosDbSqlApiCollectionDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbSqlApiCollectionDataset model = + BinaryData + .fromString( + "{\"type\":\"CosmosDbSqlApiCollection\",\"typeProperties\":{\"collectionName\":\"datalvsmfjihv\"},\"description\":\"cqrttjf\",\"structure\":\"datammfjew\",\"schema\":\"dataq\",\"linkedServiceName\":{\"referenceName\":\"avdostw\",\"parameters\":{\"elvxgwzz\":\"datafm\",\"zvzrbvgwxhlx\":\"datawdtlcjgpvc\"}},\"parameters\":{\"vhhplkhwwdk\":{\"type\":\"Array\",\"defaultValue\":\"datadrwynbgovazoym\"},\"yxryearmhpwbuk\":{\"type\":\"Object\",\"defaultValue\":\"dataeqmgkcswz\"}},\"annotations\":[\"datamfasgtlvhqpoilos\",\"dataaemcezevftmh\",\"datal\"],\"folder\":{\"name\":\"jy\"},\"\":{\"miwtpcflcez\":\"datatm\",\"fpf\":\"datawwvwiftdjtv\"}}") + .toObject(CosmosDbSqlApiCollectionDataset.class); + Assertions.assertEquals("cqrttjf", model.description()); + Assertions.assertEquals("avdostw", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("vhhplkhwwdk").type()); + Assertions.assertEquals("jy", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbSqlApiCollectionDataset model = + new CosmosDbSqlApiCollectionDataset() + .withDescription("cqrttjf") + .withStructure("datammfjew") + .withSchema("dataq") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("avdostw") + .withParameters(mapOf("elvxgwzz", "datafm", "zvzrbvgwxhlx", "datawdtlcjgpvc"))) + .withParameters( + mapOf( + "vhhplkhwwdk", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datadrwynbgovazoym"), + "yxryearmhpwbuk", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("dataeqmgkcswz"))) + .withAnnotations(Arrays.asList("datamfasgtlvhqpoilos", "dataaemcezevftmh", "datal")) + .withFolder(new DatasetFolder().withName("jy")) + .withCollectionName("datalvsmfjihv"); + model = BinaryData.fromObject(model).toObject(CosmosDbSqlApiCollectionDataset.class); + Assertions.assertEquals("cqrttjf", model.description()); + Assertions.assertEquals("avdostw", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("vhhplkhwwdk").type()); + Assertions.assertEquals("jy", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiCollectionDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiCollectionDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..7a7ad3592a40 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiCollectionDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.CosmosDbSqlApiCollectionDatasetTypeProperties; + +public final class CosmosDbSqlApiCollectionDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbSqlApiCollectionDatasetTypeProperties model = + BinaryData + .fromString("{\"collectionName\":\"dataruptsyqcjnq\"}") + .toObject(CosmosDbSqlApiCollectionDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbSqlApiCollectionDatasetTypeProperties model = + new CosmosDbSqlApiCollectionDatasetTypeProperties().withCollectionName("dataruptsyqcjnq"); + model = BinaryData.fromObject(model).toObject(CosmosDbSqlApiCollectionDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiSinkTests.java new file mode 100644 index 000000000000..ebd1d1cca72a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CosmosDbSqlApiSink; + +public final class CosmosDbSqlApiSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbSqlApiSink model = + BinaryData + .fromString( + "{\"type\":\"CosmosDbSqlApiSink\",\"writeBehavior\":\"datahbzbbjxkamitgv\",\"writeBatchSize\":\"datapdv\",\"writeBatchTimeout\":\"datayelrteunkwypu\",\"sinkRetryCount\":\"datafmsygt\",\"sinkRetryWait\":\"dataqlfdml\",\"maxConcurrentConnections\":\"datazdbrw\",\"disableMetricsCollection\":\"datawft\",\"\":{\"jsfgkwrcbgxypr\":\"dataxwi\",\"izabjb\":\"databpywecz\"}}") + .toObject(CosmosDbSqlApiSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbSqlApiSink model = + new CosmosDbSqlApiSink() + .withWriteBatchSize("datapdv") + .withWriteBatchTimeout("datayelrteunkwypu") + .withSinkRetryCount("datafmsygt") + .withSinkRetryWait("dataqlfdml") + .withMaxConcurrentConnections("datazdbrw") + .withDisableMetricsCollection("datawft") + .withWriteBehavior("datahbzbbjxkamitgv"); + model = BinaryData.fromObject(model).toObject(CosmosDbSqlApiSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiSourceTests.java new file mode 100644 index 000000000000..0180a8bb828b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CosmosDbSqlApiSourceTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CosmosDbSqlApiSource; + +public final class CosmosDbSqlApiSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CosmosDbSqlApiSource model = + BinaryData + .fromString( + "{\"type\":\"CosmosDbSqlApiSource\",\"query\":\"datatrgyyjea\",\"pageSize\":\"datavjdunbaets\",\"preferredRegions\":\"datafegbvv\",\"detectDatetime\":\"datazygzrzubdtzs\",\"additionalColumns\":\"datahmhzpurnpkk\",\"sourceRetryCount\":\"datakzcfiosralbx\",\"sourceRetryWait\":\"dataxnluvcwuafbh\",\"maxConcurrentConnections\":\"dataaqf\",\"disableMetricsCollection\":\"datafpk\",\"\":{\"efvnvscyut\":\"databkvqogzawfoqdnxu\"}}") + .toObject(CosmosDbSqlApiSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CosmosDbSqlApiSource model = + new CosmosDbSqlApiSource() + .withSourceRetryCount("datakzcfiosralbx") + .withSourceRetryWait("dataxnluvcwuafbh") + .withMaxConcurrentConnections("dataaqf") + .withDisableMetricsCollection("datafpk") + .withQuery("datatrgyyjea") + .withPageSize("datavjdunbaets") + .withPreferredRegions("datafegbvv") + .withDetectDatetime("datazygzrzubdtzs") + .withAdditionalColumns("datahmhzpurnpkk"); + model = BinaryData.fromObject(model).toObject(CosmosDbSqlApiSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CouchbaseSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CouchbaseSourceTests.java new file mode 100644 index 000000000000..e7b9e3e2638d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CouchbaseSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CouchbaseSource; + +public final class CouchbaseSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CouchbaseSource model = + BinaryData + .fromString( + "{\"type\":\"CouchbaseSource\",\"query\":\"datafeavz\",\"queryTimeout\":\"datammzisljxphwy\",\"additionalColumns\":\"datamcpfrakucgjreoac\",\"sourceRetryCount\":\"dataaboozxkdzmtkmn\",\"sourceRetryWait\":\"datafdemrc\",\"maxConcurrentConnections\":\"dataxgpkyetm\",\"disableMetricsCollection\":\"datahihixisdvyflkeqg\",\"\":{\"bwlxoczzzlf\":\"datasbtosiwcveqge\",\"thxswuomjdo\":\"datahwdaj\",\"niob\":\"dataufqhq\"}}") + .toObject(CouchbaseSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CouchbaseSource model = + new CouchbaseSource() + .withSourceRetryCount("dataaboozxkdzmtkmn") + .withSourceRetryWait("datafdemrc") + .withMaxConcurrentConnections("dataxgpkyetm") + .withDisableMetricsCollection("datahihixisdvyflkeqg") + .withQueryTimeout("datammzisljxphwy") + .withAdditionalColumns("datamcpfrakucgjreoac") + .withQuery("datafeavz"); + model = BinaryData.fromObject(model).toObject(CouchbaseSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CouchbaseTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CouchbaseTableDatasetTests.java new file mode 100644 index 000000000000..a890e95a0e1f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CouchbaseTableDatasetTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CouchbaseTableDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CouchbaseTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CouchbaseTableDataset model = + BinaryData + .fromString( + "{\"type\":\"CouchbaseTable\",\"typeProperties\":{\"tableName\":\"datarrsguogk\"},\"description\":\"rotpyabensjflw\",\"structure\":\"datatvvqtmvifgcvsim\",\"schema\":\"databmticxgosnxajp\",\"linkedServiceName\":{\"referenceName\":\"cdfmzxaoxlhmvjc\",\"parameters\":{\"xh\":\"datasbnuc\",\"nkleldk\":\"dataaqoqbvejoysoxovl\",\"qrykkxakruupti\":\"datadlqqhn\"}},\"parameters\":{\"tjekxsnnb\":{\"type\":\"Object\",\"defaultValue\":\"datazgyxccnpxiemacm\"},\"mocnqbbl\":{\"type\":\"Int\",\"defaultValue\":\"datagkt\"}},\"annotations\":[\"dataofzghfuifwxu\",\"dataynohocqxug\"],\"folder\":{\"name\":\"gdcrrfbpl\"},\"\":{\"qe\":\"datahurosdjlzbdmddg\",\"orservpvesors\":\"datay\",\"zydyvtuqvir\":\"dataegclmexafjqzy\",\"igtvjxsocsvjekej\":\"dataunssky\"}}") + .toObject(CouchbaseTableDataset.class); + Assertions.assertEquals("rotpyabensjflw", model.description()); + Assertions.assertEquals("cdfmzxaoxlhmvjc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("tjekxsnnb").type()); + Assertions.assertEquals("gdcrrfbpl", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CouchbaseTableDataset model = + new CouchbaseTableDataset() + .withDescription("rotpyabensjflw") + .withStructure("datatvvqtmvifgcvsim") + .withSchema("databmticxgosnxajp") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("cdfmzxaoxlhmvjc") + .withParameters( + mapOf( + "xh", "datasbnuc", "nkleldk", "dataaqoqbvejoysoxovl", "qrykkxakruupti", "datadlqqhn"))) + .withParameters( + mapOf( + "tjekxsnnb", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("datazgyxccnpxiemacm"), + "mocnqbbl", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datagkt"))) + .withAnnotations(Arrays.asList("dataofzghfuifwxu", "dataynohocqxug")) + .withFolder(new DatasetFolder().withName("gdcrrfbpl")) + .withTableName("datarrsguogk"); + model = BinaryData.fromObject(model).toObject(CouchbaseTableDataset.class); + Assertions.assertEquals("rotpyabensjflw", model.description()); + Assertions.assertEquals("cdfmzxaoxlhmvjc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("tjekxsnnb").type()); + Assertions.assertEquals("gdcrrfbpl", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateDataFlowDebugSessionRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateDataFlowDebugSessionRequestTests.java new file mode 100644 index 000000000000..31d8dff18df0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateDataFlowDebugSessionRequestTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CreateDataFlowDebugSessionRequest; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntime; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeDebugResource; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CreateDataFlowDebugSessionRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateDataFlowDebugSessionRequest model = + BinaryData + .fromString( + "{\"computeType\":\"foudor\",\"coreCount\":199814192,\"timeToLive\":1885072328,\"integrationRuntime\":{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"otwypundmb\",\"\":{\"or\":\"datagcmjkavl\",\"jltfvnzcyjtotpv\":\"datamftpmdtz\",\"qwthmky\":\"datapvpbdbzqgqqiheds\",\"gqcwdhohsdtmc\":\"databcysih\"}},\"name\":\"sufco\"}}") + .toObject(CreateDataFlowDebugSessionRequest.class); + Assertions.assertEquals("foudor", model.computeType()); + Assertions.assertEquals(199814192, model.coreCount()); + Assertions.assertEquals(1885072328, model.timeToLive()); + Assertions.assertEquals("sufco", model.integrationRuntime().name()); + Assertions.assertEquals("otwypundmb", model.integrationRuntime().properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateDataFlowDebugSessionRequest model = + new CreateDataFlowDebugSessionRequest() + .withComputeType("foudor") + .withCoreCount(199814192) + .withTimeToLive(1885072328) + .withIntegrationRuntime( + new IntegrationRuntimeDebugResource() + .withName("sufco") + .withProperties( + new IntegrationRuntime() + .withDescription("otwypundmb") + .withAdditionalProperties(mapOf("type", "IntegrationRuntime")))); + model = BinaryData.fromObject(model).toObject(CreateDataFlowDebugSessionRequest.class); + Assertions.assertEquals("foudor", model.computeType()); + Assertions.assertEquals(199814192, model.coreCount()); + Assertions.assertEquals(1885072328, model.timeToLive()); + Assertions.assertEquals("sufco", model.integrationRuntime().name()); + Assertions.assertEquals("otwypundmb", model.integrationRuntime().properties().description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateDataFlowDebugSessionResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateDataFlowDebugSessionResponseInnerTests.java new file mode 100644 index 000000000000..01cbced56cf9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateDataFlowDebugSessionResponseInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.CreateDataFlowDebugSessionResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class CreateDataFlowDebugSessionResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateDataFlowDebugSessionResponseInner model = + BinaryData + .fromString("{\"status\":\"zvd\",\"sessionId\":\"zdix\"}") + .toObject(CreateDataFlowDebugSessionResponseInner.class); + Assertions.assertEquals("zvd", model.status()); + Assertions.assertEquals("zdix", model.sessionId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateDataFlowDebugSessionResponseInner model = + new CreateDataFlowDebugSessionResponseInner().withStatus("zvd").withSessionId("zdix"); + model = BinaryData.fromObject(model).toObject(CreateDataFlowDebugSessionResponseInner.class); + Assertions.assertEquals("zvd", model.status()); + Assertions.assertEquals("zdix", model.sessionId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateLinkedIntegrationRuntimeRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateLinkedIntegrationRuntimeRequestTests.java new file mode 100644 index 000000000000..2cd62ba2228b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateLinkedIntegrationRuntimeRequestTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CreateLinkedIntegrationRuntimeRequest; +import org.junit.jupiter.api.Assertions; + +public final class CreateLinkedIntegrationRuntimeRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateLinkedIntegrationRuntimeRequest model = + BinaryData + .fromString( + "{\"name\":\"ni\",\"subscriptionId\":\"x\",\"dataFactoryName\":\"kpycgklwndnhjd\",\"dataFactoryLocation\":\"whvylw\"}") + .toObject(CreateLinkedIntegrationRuntimeRequest.class); + Assertions.assertEquals("ni", model.name()); + Assertions.assertEquals("x", model.subscriptionId()); + Assertions.assertEquals("kpycgklwndnhjd", model.dataFactoryName()); + Assertions.assertEquals("whvylw", model.dataFactoryLocation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateLinkedIntegrationRuntimeRequest model = + new CreateLinkedIntegrationRuntimeRequest() + .withName("ni") + .withSubscriptionId("x") + .withDataFactoryName("kpycgklwndnhjd") + .withDataFactoryLocation("whvylw"); + model = BinaryData.fromObject(model).toObject(CreateLinkedIntegrationRuntimeRequest.class); + Assertions.assertEquals("ni", model.name()); + Assertions.assertEquals("x", model.subscriptionId()); + Assertions.assertEquals("kpycgklwndnhjd", model.dataFactoryName()); + Assertions.assertEquals("whvylw", model.dataFactoryLocation()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateRunResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateRunResponseInnerTests.java new file mode 100644 index 000000000000..1dc320f0d49e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CreateRunResponseInnerTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.CreateRunResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class CreateRunResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateRunResponseInner model = + BinaryData.fromString("{\"runId\":\"vvhmxtdrj\"}").toObject(CreateRunResponseInner.class); + Assertions.assertEquals("vvhmxtdrj", model.runId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateRunResponseInner model = new CreateRunResponseInner().withRunId("vvhmxtdrj"); + model = BinaryData.fromObject(model).toObject(CreateRunResponseInner.class); + Assertions.assertEquals("vvhmxtdrj", model.runId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialListResponseTests.java new file mode 100644 index 000000000000..e0adbecea722 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialListResponseTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ManagedIdentityCredentialResourceInner; +import com.azure.resourcemanager.datafactory.models.CredentialListResponse; +import com.azure.resourcemanager.datafactory.models.ManagedIdentityCredential; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CredentialListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CredentialListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"type\":\"ManagedIdentity\",\"typeProperties\":{\"resourceId\":\"qhnlbqnbld\"},\"description\":\"aclgschorimk\",\"annotations\":[\"datarmoucsofl\"],\"\":{\"mxuq\":\"dataviyfcaabeolhbhlv\",\"owlkjxnqpv\":\"databsxtkcudfbsfarfs\",\"tmhqykiz\":\"datagf\"}},\"name\":\"ksaoafcluqvox\",\"type\":\"cjimryvwgcwwpbmz\",\"etag\":\"esyds\",\"id\":\"efoh\"},{\"properties\":{\"type\":\"ManagedIdentity\",\"typeProperties\":{\"resourceId\":\"vopwndyqleallk\"},\"description\":\"tkhlowkxxpvbr\",\"annotations\":[\"datamzsyzfhotl\",\"dataikcyyc\"],\"\":{\"uic\":\"datasjlpjrtwszhv\",\"ubhvj\":\"datahvtrrmhwrbfdpyf\",\"memhooclutnpq\":\"datalrocuyzlwh\"}},\"name\":\"mczjkm\",\"type\":\"kyujxsglhsrrr\",\"etag\":\"jylmbkzudnigr\",\"id\":\"hotj\"},{\"properties\":{\"type\":\"ManagedIdentity\",\"typeProperties\":{\"resourceId\":\"pxuzzjg\"},\"description\":\"efqyhqotoihiqaky\",\"annotations\":[\"datafb\"],\"\":{\"qaxsipietgbebjf\":\"datapzdqtvhcspod\",\"pnfpubntnbat\":\"datalbmoichd\",\"uhplrvkmjcwmjv\":\"dataviqsowsaaelcattc\"}},\"name\":\"fggc\",\"type\":\"yylizrz\",\"etag\":\"psfxsf\",\"id\":\"tl\"},{\"properties\":{\"type\":\"ManagedIdentity\",\"typeProperties\":{\"resourceId\":\"vagbwidqlvhukove\"},\"description\":\"i\",\"annotations\":[\"datajfnmjmvlwyz\"],\"\":{\"jpu\":\"datalkujrllfojui\",\"vtzejetjklnti\":\"datayjucejikzoeo\",\"zolxrzvhqjwtr\":\"datayjuzkdb\",\"rrkolawjmjs\":\"datatgvgzp\"}},\"name\":\"rokcdxfzzzwyjaf\",\"type\":\"lhguyn\",\"etag\":\"hlgmltxdwhmoz\",\"id\":\"gzvlnsnn\"}],\"nextLink\":\"fpafolpymwamxq\"}") + .toObject(CredentialListResponse.class); + Assertions.assertEquals("efoh", model.value().get(0).id()); + Assertions.assertEquals("aclgschorimk", model.value().get(0).properties().description()); + Assertions.assertEquals("qhnlbqnbld", model.value().get(0).properties().resourceId()); + Assertions.assertEquals("fpafolpymwamxq", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CredentialListResponse model = + new CredentialListResponse() + .withValue( + Arrays + .asList( + new ManagedIdentityCredentialResourceInner() + .withId("efoh") + .withProperties( + new ManagedIdentityCredential() + .withDescription("aclgschorimk") + .withAnnotations(Arrays.asList("datarmoucsofl")) + .withResourceId("qhnlbqnbld")), + new ManagedIdentityCredentialResourceInner() + .withId("hotj") + .withProperties( + new ManagedIdentityCredential() + .withDescription("tkhlowkxxpvbr") + .withAnnotations(Arrays.asList("datamzsyzfhotl", "dataikcyyc")) + .withResourceId("vopwndyqleallk")), + new ManagedIdentityCredentialResourceInner() + .withId("tl") + .withProperties( + new ManagedIdentityCredential() + .withDescription("efqyhqotoihiqaky") + .withAnnotations(Arrays.asList("datafb")) + .withResourceId("pxuzzjg")), + new ManagedIdentityCredentialResourceInner() + .withId("gzvlnsnn") + .withProperties( + new ManagedIdentityCredential() + .withDescription("i") + .withAnnotations(Arrays.asList("datajfnmjmvlwyz")) + .withResourceId("vagbwidqlvhukove")))) + .withNextLink("fpafolpymwamxq"); + model = BinaryData.fromObject(model).toObject(CredentialListResponse.class); + Assertions.assertEquals("efoh", model.value().get(0).id()); + Assertions.assertEquals("aclgschorimk", model.value().get(0).properties().description()); + Assertions.assertEquals("qhnlbqnbld", model.value().get(0).properties().resourceId()); + Assertions.assertEquals("fpafolpymwamxq", model.nextLink()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..4a16892832cc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ManagedIdentityCredential; +import com.azure.resourcemanager.datafactory.models.ManagedIdentityCredentialResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class CredentialOperationsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"ManagedIdentity\",\"typeProperties\":{\"resourceId\":\"cpwrgry\"},\"description\":\"lrqeqcdikc\",\"annotations\":[\"datazdtfthnjxid\"],\"\":{\"rrzuegindln\":\"datampyixgxtccmqzku\"}},\"name\":\"oapsz\",\"type\":\"n\",\"etag\":\"vyracqmfjihm\",\"id\":\"zwoijtlhxlsxxra\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ManagedIdentityCredentialResource response = + manager + .credentialOperations() + .define("kiupgmdsz") + .withExistingFactory("lbqdxvxdfkdwk", "mnoecfjw") + .withProperties( + new ManagedIdentityCredential() + .withDescription("ecr") + .withAnnotations(Arrays.asList("datamzqfisggoap", "datadmxwe")) + .withResourceId("djxltjsm")) + .withIfMatch("dxvl") + .create(); + + Assertions.assertEquals("zwoijtlhxlsxxra", response.id()); + Assertions.assertEquals("lrqeqcdikc", response.properties().description()); + Assertions.assertEquals("cpwrgry", response.properties().resourceId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..5adfc6cce856 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsDeleteWithResponseMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class CredentialOperationsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.credentialOperations().deleteWithResponse("ghppy", "ro", "ygtetmpw", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsGetWithResponseMockTests.java new file mode 100644 index 000000000000..84cef0ea8aee --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsGetWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ManagedIdentityCredentialResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class CredentialOperationsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"ManagedIdentity\",\"typeProperties\":{\"resourceId\":\"vaxyitnzpfdoete\"},\"description\":\"skqx\",\"annotations\":[\"datawl\",\"dataodrdnfmxomupdqp\",\"dataxivktdvwmefjpo\"],\"\":{\"trlo\":\"datayvbvxlrltr\",\"yr\":\"datarjvr\",\"trzlvfncph\":\"datahfrsyckqwefmq\",\"zg\":\"datalnbawff\"}},\"name\":\"bzmxzrai\",\"type\":\"zgrojpnxzj\",\"etag\":\"cyysyceyk\",\"id\":\"lxhymc\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ManagedIdentityCredentialResource response = + manager + .credentialOperations() + .getWithResponse("k", "udxvjr", "dbinqqrkkgawnae", "eui", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("lxhymc", response.id()); + Assertions.assertEquals("skqx", response.properties().description()); + Assertions.assertEquals("vaxyitnzpfdoete", response.properties().resourceId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsListByFactoryMockTests.java new file mode 100644 index 000000000000..49d20363f0eb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialOperationsListByFactoryMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ManagedIdentityCredentialResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class CredentialOperationsListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"type\":\"ManagedIdentity\",\"typeProperties\":{\"resourceId\":\"yqgfimllradqwpu\"},\"description\":\"uphizztkl\",\"annotations\":[\"datadeehtjmdefkph\",\"datakkivy\"],\"\":{\"curkf\":\"datapcnnpjulpwwmxwl\",\"vruxmpnugujiwi\":\"datazjazepbjukikd\",\"anxs\":\"dataunsvsjo\"}},\"name\":\"tfgh\",\"type\":\"qxruqrobk\",\"etag\":\"npyb\",\"id\":\"kvjbf\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .credentialOperations() + .listByFactory("plhfwqdvd", "cohjwzynbhltrmb", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("kvjbf", response.iterator().next().id()); + Assertions.assertEquals("uphizztkl", response.iterator().next().properties().description()); + Assertions.assertEquals("yqgfimllradqwpu", response.iterator().next().properties().resourceId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialReferenceTests.java new file mode 100644 index 000000000000..2501c54fa558 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialReferenceTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CredentialReference; +import com.azure.resourcemanager.datafactory.models.CredentialReferenceType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CredentialReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CredentialReference model = + BinaryData + .fromString( + "{\"type\":\"CredentialReference\",\"referenceName\":\"lhdyzmyckzex\",\"\":{\"wymxgaabjk\":\"datakck\",\"ogzvk\":\"datatfohf\"}}") + .toObject(CredentialReference.class); + Assertions.assertEquals(CredentialReferenceType.CREDENTIAL_REFERENCE, model.type()); + Assertions.assertEquals("lhdyzmyckzex", model.referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CredentialReference model = + new CredentialReference() + .withType(CredentialReferenceType.CREDENTIAL_REFERENCE) + .withReferenceName("lhdyzmyckzex") + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(CredentialReference.class); + Assertions.assertEquals(CredentialReferenceType.CREDENTIAL_REFERENCE, model.type()); + Assertions.assertEquals("lhdyzmyckzex", model.referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialTests.java new file mode 100644 index 000000000000..d43b9df28de4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CredentialTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Credential; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CredentialTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Credential model = + BinaryData + .fromString( + "{\"type\":\"Credential\",\"description\":\"pwpgddei\",\"annotations\":[\"datazovgkkumuikj\",\"datajcazt\"],\"\":{\"wxwcomli\":\"datansq\",\"yfdvlvhbwrnfxtgd\":\"dataytwvczcswkacve\",\"kcoeqswank\":\"datapqthehnmnaoya\"}}") + .toObject(Credential.class); + Assertions.assertEquals("pwpgddei", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Credential model = + new Credential() + .withDescription("pwpgddei") + .withAnnotations(Arrays.asList("datazovgkkumuikj", "datajcazt")) + .withAdditionalProperties(mapOf("type", "Credential")); + model = BinaryData.fromObject(model).toObject(Credential.class); + Assertions.assertEquals("pwpgddei", model.description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomActivityReferenceObjectTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomActivityReferenceObjectTests.java new file mode 100644 index 000000000000..cdf27d0d9d75 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomActivityReferenceObjectTests.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CustomActivityReferenceObject; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CustomActivityReferenceObjectTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CustomActivityReferenceObject model = + BinaryData + .fromString( + "{\"linkedServices\":[{\"referenceName\":\"ufjfordzwbskfex\",\"parameters\":{\"jzliaqpmowlsrxy\":\"datajwf\",\"pqlonz\":\"dataevzqxpmfheht\",\"qqrmck\":\"datahylzzu\",\"sueutby\":\"datam\"}},{\"referenceName\":\"lzgkzhbnbnjpie\",\"parameters\":{\"hsuhkik\":\"dataivsiwws\",\"znmj\":\"datauvpcjyh\"}},{\"referenceName\":\"anrirrnqloomsy\",\"parameters\":{\"kapgdvknquipi\":\"dataga\",\"y\":\"datagvfchzcp\",\"wzpf\":\"datazbo\"}},{\"referenceName\":\"kslvbrxlsbglbf\",\"parameters\":{\"dbhcfswpdarvca\":\"dataiirneop\",\"xucgvz\":\"datasmr\",\"jd\":\"datawvmhbizi\",\"sfyxdfeqrnawnqya\":\"dataeexdboat\"}}],\"datasets\":[{\"referenceName\":\"acojcaraxorqjb\",\"parameters\":{\"tn\":\"datagxogqvwchynr\",\"qvcjspj\":\"dataptwmawypkpbmid\",\"l\":\"datamtsgvvizaygtb\",\"ijpayvlnzwicqopw\":\"datayycgzvqpnjqpwxfk\"}},{\"referenceName\":\"bdleegwlhanyueiz\",\"parameters\":{\"mxbghxiotlf\":\"dataj\",\"icoaysargqkgaus\":\"databjsvuqkbs\",\"lkxvfejdgoj\":\"dataugdyfyjeex\",\"yyyo\":\"datavqezekkv\"}},{\"referenceName\":\"jpsmnxccasuh\",\"parameters\":{\"fhfjf\":\"datahmkqyfatdd\"}},{\"referenceName\":\"to\",\"parameters\":{\"nmxzu\":\"datawzkxaglwdntj\"}}]}") + .toObject(CustomActivityReferenceObject.class); + Assertions.assertEquals("ufjfordzwbskfex", model.linkedServices().get(0).referenceName()); + Assertions.assertEquals("acojcaraxorqjb", model.datasets().get(0).referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CustomActivityReferenceObject model = + new CustomActivityReferenceObject() + .withLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("ufjfordzwbskfex") + .withParameters( + mapOf( + "jzliaqpmowlsrxy", + "datajwf", + "pqlonz", + "dataevzqxpmfheht", + "qqrmck", + "datahylzzu", + "sueutby", + "datam")), + new LinkedServiceReference() + .withReferenceName("lzgkzhbnbnjpie") + .withParameters(mapOf("hsuhkik", "dataivsiwws", "znmj", "datauvpcjyh")), + new LinkedServiceReference() + .withReferenceName("anrirrnqloomsy") + .withParameters( + mapOf("kapgdvknquipi", "dataga", "y", "datagvfchzcp", "wzpf", "datazbo")), + new LinkedServiceReference() + .withReferenceName("kslvbrxlsbglbf") + .withParameters( + mapOf( + "dbhcfswpdarvca", + "dataiirneop", + "xucgvz", + "datasmr", + "jd", + "datawvmhbizi", + "sfyxdfeqrnawnqya", + "dataeexdboat")))) + .withDatasets( + Arrays + .asList( + new DatasetReference() + .withReferenceName("acojcaraxorqjb") + .withParameters( + mapOf( + "tn", + "datagxogqvwchynr", + "qvcjspj", + "dataptwmawypkpbmid", + "l", + "datamtsgvvizaygtb", + "ijpayvlnzwicqopw", + "datayycgzvqpnjqpwxfk")), + new DatasetReference() + .withReferenceName("bdleegwlhanyueiz") + .withParameters( + mapOf( + "mxbghxiotlf", + "dataj", + "icoaysargqkgaus", + "databjsvuqkbs", + "lkxvfejdgoj", + "dataugdyfyjeex", + "yyyo", + "datavqezekkv")), + new DatasetReference() + .withReferenceName("jpsmnxccasuh") + .withParameters(mapOf("fhfjf", "datahmkqyfatdd")), + new DatasetReference() + .withReferenceName("to") + .withParameters(mapOf("nmxzu", "datawzkxaglwdntj")))); + model = BinaryData.fromObject(model).toObject(CustomActivityReferenceObject.class); + Assertions.assertEquals("ufjfordzwbskfex", model.linkedServices().get(0).referenceName()); + Assertions.assertEquals("acojcaraxorqjb", model.datasets().get(0).referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomActivityTests.java new file mode 100644 index 000000000000..f17447590d5f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomActivityTests.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.CustomActivity; +import com.azure.resourcemanager.datafactory.models.CustomActivityReferenceObject; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CustomActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CustomActivity model = + BinaryData + .fromString( + "{\"type\":\"Custom\",\"typeProperties\":{\"command\":\"dataobhltmpay\",\"resourceLinkedService\":{\"referenceName\":\"qgrsytto\",\"parameters\":{\"ca\":\"databbxifacrhpu\",\"wtosuiguoemo\":\"datazpvp\",\"oxwyxodpcgdv\":\"datandbuexr\",\"xdafilaizcd\":\"datatnbk\"}},\"folderPath\":\"datanz\",\"referenceObjects\":{\"linkedServices\":[{\"referenceName\":\"gaykaqwnkxoq\",\"parameters\":{\"vmuewshhq\":\"dataznuqgl\",\"czzjfzjovwizjrak\":\"datajvchliezfb\"}},{\"referenceName\":\"ahwqpuklt\",\"parameters\":{\"bz\":\"dataroxmis\",\"fvqtvukcfesizkn\":\"dataz\",\"xflzhgr\":\"datac\"}}],\"datasets\":[{\"referenceName\":\"ysdmovbvnjyq\",\"parameters\":{\"rggytyvox\":\"datadgzlykczolnd\",\"ukfwmhzarrfttx\":\"datajbyjgobzj\"}},{\"referenceName\":\"ifrjgvhone\",\"parameters\":{\"lmkfvsol\":\"dataab\"}},{\"referenceName\":\"jowvzyoehlj\",\"parameters\":{\"othnucqktuaerg\":\"datag\",\"dlbahmivtuphwwy\":\"datatpriicte\",\"fxfteo\":\"dataxo\",\"qap\":\"datanrziwkcpxgjmyou\"}},{\"referenceName\":\"aypcdikkmyrs\",\"parameters\":{\"gg\":\"datat\",\"sxjzklqkgjukntkn\":\"datapohuv\"}}]},\"extendedProperties\":{\"ehptl\":\"datawgziqcwnef\",\"nes\":\"datawnlauw\",\"mgeuoihtik\":\"datax\",\"xyavcb\":\"dataiwp\"},\"retentionTimeInDays\":\"datauwctvbhcjfgxtljy\",\"autoUserSpecification\":\"datayhpbtwzrziv\"},\"linkedServiceName\":{\"referenceName\":\"kdcjymdoldbuy\",\"parameters\":{\"rsdoxhyiyag\":\"dataephviuexf\",\"uffkmtiuxynkh\":\"datax\"}},\"policy\":{\"timeout\":\"dataqlhzdbbitpgr\",\"retry\":\"datapmsdgmxwfodvzpxm\",\"retryIntervalInSeconds\":83893803,\"secureInput\":false,\"secureOutput\":true,\"\":{\"svjodgplagwvgb\":\"datayevhnqtb\"}},\"name\":\"xmqudnqcbbbhin\",\"description\":\"yszlbfzkvrmd\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"qdnrgnybp\",\"dependencyConditions\":[\"Failed\",\"Completed\",\"Skipped\"],\"\":{\"pmcl\":\"datahxunqrvqticgsd\",\"dabh\":\"datau\",\"y\":\"datadcqrssqwzndzuxlg\"}},{\"activity\":\"ngyqlzozmbapj\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Succeeded\"],\"\":{\"lzk\":\"datapnt\",\"bp\":\"datamcg\"}},{\"activity\":\"fbgfwjqw\",\"dependencyConditions\":[\"Skipped\"],\"\":{\"xxdrgbnq\":\"datav\",\"mexwg\":\"datahrw\",\"ugxudsmdglq\":\"dataflq\",\"tjd\":\"datak\"}}],\"userProperties\":[{\"name\":\"somxwsflylols\",\"value\":\"dataficzw\"},{\"name\":\"kglmcg\",\"value\":\"datazzeqd\"},{\"name\":\"xurbj\",\"value\":\"datakar\"}],\"\":{\"qxoqnvijhdcol\":\"datauzvtwf\"}}") + .toObject(CustomActivity.class); + Assertions.assertEquals("xmqudnqcbbbhin", model.name()); + Assertions.assertEquals("yszlbfzkvrmd", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("qdnrgnybp", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("somxwsflylols", model.userProperties().get(0).name()); + Assertions.assertEquals("kdcjymdoldbuy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(83893803, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("qgrsytto", model.resourceLinkedService().referenceName()); + Assertions.assertEquals("gaykaqwnkxoq", model.referenceObjects().linkedServices().get(0).referenceName()); + Assertions.assertEquals("ysdmovbvnjyq", model.referenceObjects().datasets().get(0).referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CustomActivity model = + new CustomActivity() + .withName("xmqudnqcbbbhin") + .withDescription("yszlbfzkvrmd") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("qdnrgnybp") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ngyqlzozmbapj") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("fbgfwjqw") + .withDependencyConditions(Arrays.asList(DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("somxwsflylols").withValue("dataficzw"), + new UserProperty().withName("kglmcg").withValue("datazzeqd"), + new UserProperty().withName("xurbj").withValue("datakar"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("kdcjymdoldbuy") + .withParameters(mapOf("rsdoxhyiyag", "dataephviuexf", "uffkmtiuxynkh", "datax"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("dataqlhzdbbitpgr") + .withRetry("datapmsdgmxwfodvzpxm") + .withRetryIntervalInSeconds(83893803) + .withSecureInput(false) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withCommand("dataobhltmpay") + .withResourceLinkedService( + new LinkedServiceReference() + .withReferenceName("qgrsytto") + .withParameters( + mapOf( + "ca", + "databbxifacrhpu", + "wtosuiguoemo", + "datazpvp", + "oxwyxodpcgdv", + "datandbuexr", + "xdafilaizcd", + "datatnbk"))) + .withFolderPath("datanz") + .withReferenceObjects( + new CustomActivityReferenceObject() + .withLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("gaykaqwnkxoq") + .withParameters( + mapOf("vmuewshhq", "dataznuqgl", "czzjfzjovwizjrak", "datajvchliezfb")), + new LinkedServiceReference() + .withReferenceName("ahwqpuklt") + .withParameters( + mapOf("bz", "dataroxmis", "fvqtvukcfesizkn", "dataz", "xflzhgr", "datac")))) + .withDatasets( + Arrays + .asList( + new DatasetReference() + .withReferenceName("ysdmovbvnjyq") + .withParameters( + mapOf("rggytyvox", "datadgzlykczolnd", "ukfwmhzarrfttx", "datajbyjgobzj")), + new DatasetReference() + .withReferenceName("ifrjgvhone") + .withParameters(mapOf("lmkfvsol", "dataab")), + new DatasetReference() + .withReferenceName("jowvzyoehlj") + .withParameters( + mapOf( + "othnucqktuaerg", + "datag", + "dlbahmivtuphwwy", + "datatpriicte", + "fxfteo", + "dataxo", + "qap", + "datanrziwkcpxgjmyou")), + new DatasetReference() + .withReferenceName("aypcdikkmyrs") + .withParameters(mapOf("gg", "datat", "sxjzklqkgjukntkn", "datapohuv"))))) + .withExtendedProperties( + mapOf("ehptl", "datawgziqcwnef", "nes", "datawnlauw", "mgeuoihtik", "datax", "xyavcb", "dataiwp")) + .withRetentionTimeInDays("datauwctvbhcjfgxtljy") + .withAutoUserSpecification("datayhpbtwzrziv"); + model = BinaryData.fromObject(model).toObject(CustomActivity.class); + Assertions.assertEquals("xmqudnqcbbbhin", model.name()); + Assertions.assertEquals("yszlbfzkvrmd", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("qdnrgnybp", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("somxwsflylols", model.userProperties().get(0).name()); + Assertions.assertEquals("kdcjymdoldbuy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(83893803, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("qgrsytto", model.resourceLinkedService().referenceName()); + Assertions.assertEquals("gaykaqwnkxoq", model.referenceObjects().linkedServices().get(0).referenceName()); + Assertions.assertEquals("ysdmovbvnjyq", model.referenceObjects().datasets().get(0).referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomActivityTypePropertiesTests.java new file mode 100644 index 000000000000..dcefea71450a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomActivityTypePropertiesTests.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.CustomActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.CustomActivityReferenceObject; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CustomActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CustomActivityTypeProperties model = + BinaryData + .fromString( + "{\"command\":\"dataxwdppiodnntol\",\"resourceLinkedService\":{\"referenceName\":\"zptngr\",\"parameters\":{\"u\":\"dataimxacxcaczcdkomr\",\"jnxdyskyrhsijxml\":\"dataytjxpdqwy\"}},\"folderPath\":\"dataymfxjsuwmbdt\",\"referenceObjects\":{\"linkedServices\":[{\"referenceName\":\"gzybp\",\"parameters\":{\"vnqszqkrsnxue\":\"datapghloemqa\",\"tmtgk\":\"datawrbqadtvpgu\",\"xxe\":\"dataiv\",\"odvzjkz\":\"dataplphkiyiqpi\"}},{\"referenceName\":\"lvxdpopubbwps\",\"parameters\":{\"w\":\"datab\",\"mmgf\":\"datahjqakacbcbrsnnv\",\"qmty\":\"datat\",\"jkbisjurilqc\":\"dataqut\"}}],\"datasets\":[{\"referenceName\":\"dorbufog\",\"parameters\":{\"qajsuauwojgvp\":\"databiz\",\"nbr\":\"datazvtgwlzqcyvrbg\",\"ubnnmzz\":\"dataekjbljfk\"}},{\"referenceName\":\"bcxbvnh\",\"parameters\":{\"asxak\":\"datadfxxaoyisky\",\"mqkgc\":\"dataqbwjtnfa\",\"s\":\"dataldxuweweeegsz\",\"hfcdhbcr\":\"dataryfap\"}}]},\"extendedProperties\":{\"nfrhbkn\":\"datadszuxhaqlywty\",\"xhfg\":\"dataagpnmcqud\"},\"retentionTimeInDays\":\"datazegm\",\"autoUserSpecification\":\"dataebzoujhijlduuvxk\"}") + .toObject(CustomActivityTypeProperties.class); + Assertions.assertEquals("zptngr", model.resourceLinkedService().referenceName()); + Assertions.assertEquals("gzybp", model.referenceObjects().linkedServices().get(0).referenceName()); + Assertions.assertEquals("dorbufog", model.referenceObjects().datasets().get(0).referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CustomActivityTypeProperties model = + new CustomActivityTypeProperties() + .withCommand("dataxwdppiodnntol") + .withResourceLinkedService( + new LinkedServiceReference() + .withReferenceName("zptngr") + .withParameters(mapOf("u", "dataimxacxcaczcdkomr", "jnxdyskyrhsijxml", "dataytjxpdqwy"))) + .withFolderPath("dataymfxjsuwmbdt") + .withReferenceObjects( + new CustomActivityReferenceObject() + .withLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("gzybp") + .withParameters( + mapOf( + "vnqszqkrsnxue", + "datapghloemqa", + "tmtgk", + "datawrbqadtvpgu", + "xxe", + "dataiv", + "odvzjkz", + "dataplphkiyiqpi")), + new LinkedServiceReference() + .withReferenceName("lvxdpopubbwps") + .withParameters( + mapOf( + "w", + "datab", + "mmgf", + "datahjqakacbcbrsnnv", + "qmty", + "datat", + "jkbisjurilqc", + "dataqut")))) + .withDatasets( + Arrays + .asList( + new DatasetReference() + .withReferenceName("dorbufog") + .withParameters( + mapOf( + "qajsuauwojgvp", + "databiz", + "nbr", + "datazvtgwlzqcyvrbg", + "ubnnmzz", + "dataekjbljfk")), + new DatasetReference() + .withReferenceName("bcxbvnh") + .withParameters( + mapOf( + "asxak", + "datadfxxaoyisky", + "mqkgc", + "dataqbwjtnfa", + "s", + "dataldxuweweeegsz", + "hfcdhbcr", + "dataryfap"))))) + .withExtendedProperties(mapOf("nfrhbkn", "datadszuxhaqlywty", "xhfg", "dataagpnmcqud")) + .withRetentionTimeInDays("datazegm") + .withAutoUserSpecification("dataebzoujhijlduuvxk"); + model = BinaryData.fromObject(model).toObject(CustomActivityTypeProperties.class); + Assertions.assertEquals("zptngr", model.resourceLinkedService().referenceName()); + Assertions.assertEquals("gzybp", model.referenceObjects().linkedServices().get(0).referenceName()); + Assertions.assertEquals("dorbufog", model.referenceObjects().datasets().get(0).referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomDataSourceLinkedServiceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomDataSourceLinkedServiceTests.java new file mode 100644 index 000000000000..f61d438e781a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomDataSourceLinkedServiceTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CustomDataSourceLinkedService; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CustomDataSourceLinkedServiceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CustomDataSourceLinkedService model = + BinaryData + .fromString( + "{\"type\":\"CustomDataSource\",\"typeProperties\":\"datadzpx\",\"connectVia\":{\"referenceName\":\"kqlvbk\",\"parameters\":{\"iviniyoizuwwzc\":\"datayrnww\",\"xajsiueai\":\"dataigbjbelnqalbso\",\"zbwxuypcuri\":\"dataqjb\"}},\"description\":\"lxtclveqdqt\",\"parameters\":{\"iysgh\":{\"type\":\"Bool\",\"defaultValue\":\"datawjxry\"},\"kw\":{\"type\":\"Bool\",\"defaultValue\":\"dataqdl\"}},\"annotations\":[\"datakbv\"],\"\":{\"atpialrqhwcxxccf\":\"datamkaadnxbs\"}}") + .toObject(CustomDataSourceLinkedService.class); + Assertions.assertEquals("kqlvbk", model.connectVia().referenceName()); + Assertions.assertEquals("lxtclveqdqt", model.description()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("iysgh").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CustomDataSourceLinkedService model = + new CustomDataSourceLinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("kqlvbk") + .withParameters( + mapOf( + "iviniyoizuwwzc", + "datayrnww", + "xajsiueai", + "dataigbjbelnqalbso", + "zbwxuypcuri", + "dataqjb"))) + .withDescription("lxtclveqdqt") + .withParameters( + mapOf( + "iysgh", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datawjxry"), + "kw", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataqdl"))) + .withAnnotations(Arrays.asList("datakbv")) + .withTypeProperties("datadzpx"); + model = BinaryData.fromObject(model).toObject(CustomDataSourceLinkedService.class); + Assertions.assertEquals("kqlvbk", model.connectVia().referenceName()); + Assertions.assertEquals("lxtclveqdqt", model.description()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("iysgh").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomDatasetTests.java new file mode 100644 index 000000000000..e2e837233f5c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomDatasetTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CustomDataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CustomDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CustomDataset model = + BinaryData + .fromString( + "{\"type\":\"CustomDataset\",\"typeProperties\":\"datafgufjnbx\",\"description\":\"mwdukinhl\",\"structure\":\"datagde\",\"schema\":\"datakzou\",\"linkedServiceName\":{\"referenceName\":\"vewwpzrdwcgldo\",\"parameters\":{\"dxfhhht\":\"dataa\",\"qtdn\":\"datast\",\"dshvvf\":\"datackkpl\"}},\"parameters\":{\"zrqnjxm\":{\"type\":\"Int\",\"defaultValue\":\"datayijjimhi\"},\"hqld\":{\"type\":\"String\",\"defaultValue\":\"dataduydwnwgru\"},\"i\":{\"type\":\"Array\",\"defaultValue\":\"datamnswxiexqwqnghx\"},\"qtny\":{\"type\":\"Array\",\"defaultValue\":\"dataujrxgunnqgyp\"}},\"annotations\":[\"datae\",\"dataqmvyumgmmuebsnzn\",\"datagsqufmjxcyo\"],\"folder\":{\"name\":\"cazisvbrqgcyjpg\"},\"\":{\"tbgblxbuibrvjzta\":\"datapkwonrzpghlr\"}}") + .toObject(CustomDataset.class); + Assertions.assertEquals("mwdukinhl", model.description()); + Assertions.assertEquals("vewwpzrdwcgldo", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("zrqnjxm").type()); + Assertions.assertEquals("cazisvbrqgcyjpg", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CustomDataset model = + new CustomDataset() + .withDescription("mwdukinhl") + .withStructure("datagde") + .withSchema("datakzou") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("vewwpzrdwcgldo") + .withParameters(mapOf("dxfhhht", "dataa", "qtdn", "datast", "dshvvf", "datackkpl"))) + .withParameters( + mapOf( + "zrqnjxm", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datayijjimhi"), + "hqld", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataduydwnwgru"), + "i", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datamnswxiexqwqnghx"), + "qtny", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("dataujrxgunnqgyp"))) + .withAnnotations(Arrays.asList("datae", "dataqmvyumgmmuebsnzn", "datagsqufmjxcyo")) + .withFolder(new DatasetFolder().withName("cazisvbrqgcyjpg")) + .withTypeProperties("datafgufjnbx"); + model = BinaryData.fromObject(model).toObject(CustomDataset.class); + Assertions.assertEquals("mwdukinhl", model.description()); + Assertions.assertEquals("vewwpzrdwcgldo", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("zrqnjxm").type()); + Assertions.assertEquals("cazisvbrqgcyjpg", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomEventsTriggerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomEventsTriggerTests.java new file mode 100644 index 000000000000..453322e821c9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomEventsTriggerTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CustomEventsTrigger; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import com.azure.resourcemanager.datafactory.models.TriggerPipelineReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CustomEventsTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CustomEventsTrigger model = + BinaryData + .fromString( + "{\"type\":\"CustomEventsTrigger\",\"typeProperties\":{\"subjectBeginsWith\":\"qdj\",\"subjectEndsWith\":\"u\",\"events\":[\"datayjmjvzpldhbapfrr\",\"datawrmdmrhsybvn\",\"dataaxmipkatjyxh\"],\"scope\":\"jjvsvlmdlysf\"},\"pipelines\":[{\"pipelineReference\":{\"referenceName\":\"floamgnpfiiv\",\"name\":\"snrknikpgjuk\"},\"parameters\":{\"ycl\":\"datayl\"}}],\"description\":\"epashmfbzkfehrs\",\"runtimeState\":\"Disabled\",\"annotations\":[\"datasuwsuroddohn\",\"databbxa\"],\"\":{\"soiekdmnva\":\"dataorsandslrndi\",\"fdextdarnhpxz\":\"databhxujgyzfsswezn\"}}") + .toObject(CustomEventsTrigger.class); + Assertions.assertEquals("epashmfbzkfehrs", model.description()); + Assertions.assertEquals("floamgnpfiiv", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("snrknikpgjuk", model.pipelines().get(0).pipelineReference().name()); + Assertions.assertEquals("qdj", model.subjectBeginsWith()); + Assertions.assertEquals("u", model.subjectEndsWith()); + Assertions.assertEquals("jjvsvlmdlysf", model.scope()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CustomEventsTrigger model = + new CustomEventsTrigger() + .withDescription("epashmfbzkfehrs") + .withAnnotations(Arrays.asList("datasuwsuroddohn", "databbxa")) + .withPipelines( + Arrays + .asList( + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("floamgnpfiiv").withName("snrknikpgjuk")) + .withParameters(mapOf("ycl", "datayl")))) + .withSubjectBeginsWith("qdj") + .withSubjectEndsWith("u") + .withEvents(Arrays.asList("datayjmjvzpldhbapfrr", "datawrmdmrhsybvn", "dataaxmipkatjyxh")) + .withScope("jjvsvlmdlysf"); + model = BinaryData.fromObject(model).toObject(CustomEventsTrigger.class); + Assertions.assertEquals("epashmfbzkfehrs", model.description()); + Assertions.assertEquals("floamgnpfiiv", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("snrknikpgjuk", model.pipelines().get(0).pipelineReference().name()); + Assertions.assertEquals("qdj", model.subjectBeginsWith()); + Assertions.assertEquals("u", model.subjectEndsWith()); + Assertions.assertEquals("jjvsvlmdlysf", model.scope()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomEventsTriggerTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomEventsTriggerTypePropertiesTests.java new file mode 100644 index 000000000000..cc91ce504f41 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomEventsTriggerTypePropertiesTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.CustomEventsTriggerTypeProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CustomEventsTriggerTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CustomEventsTriggerTypeProperties model = + BinaryData + .fromString( + "{\"subjectBeginsWith\":\"jbvz\",\"subjectEndsWith\":\"ecisnhtdskenigoh\",\"events\":[\"dataudteowep\"],\"scope\":\"eqgrcnfhcq\"}") + .toObject(CustomEventsTriggerTypeProperties.class); + Assertions.assertEquals("jbvz", model.subjectBeginsWith()); + Assertions.assertEquals("ecisnhtdskenigoh", model.subjectEndsWith()); + Assertions.assertEquals("eqgrcnfhcq", model.scope()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CustomEventsTriggerTypeProperties model = + new CustomEventsTriggerTypeProperties() + .withSubjectBeginsWith("jbvz") + .withSubjectEndsWith("ecisnhtdskenigoh") + .withEvents(Arrays.asList("dataudteowep")) + .withScope("eqgrcnfhcq"); + model = BinaryData.fromObject(model).toObject(CustomEventsTriggerTypeProperties.class); + Assertions.assertEquals("jbvz", model.subjectBeginsWith()); + Assertions.assertEquals("ecisnhtdskenigoh", model.subjectEndsWith()); + Assertions.assertEquals("eqgrcnfhcq", model.scope()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomSetupBaseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomSetupBaseTests.java new file mode 100644 index 000000000000..a748844197db --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/CustomSetupBaseTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CustomSetupBase; + +public final class CustomSetupBaseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CustomSetupBase model = BinaryData.fromString("{\"type\":\"CustomSetupBase\"}").toObject(CustomSetupBase.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CustomSetupBase model = new CustomSetupBase(); + model = BinaryData.fromObject(model).toObject(CustomSetupBase.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DWCopyCommandDefaultValueTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DWCopyCommandDefaultValueTests.java new file mode 100644 index 000000000000..fc5cfc0bb277 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DWCopyCommandDefaultValueTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DWCopyCommandDefaultValue; + +public final class DWCopyCommandDefaultValueTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DWCopyCommandDefaultValue model = + BinaryData + .fromString("{\"columnName\":\"datasyvryo\",\"defaultValue\":\"dataqikcork\"}") + .toObject(DWCopyCommandDefaultValue.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DWCopyCommandDefaultValue model = + new DWCopyCommandDefaultValue().withColumnName("datasyvryo").withDefaultValue("dataqikcork"); + model = BinaryData.fromObject(model).toObject(DWCopyCommandDefaultValue.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DWCopyCommandSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DWCopyCommandSettingsTests.java new file mode 100644 index 000000000000..cf78e6f9370d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DWCopyCommandSettingsTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DWCopyCommandDefaultValue; +import com.azure.resourcemanager.datafactory.models.DWCopyCommandSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DWCopyCommandSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DWCopyCommandSettings model = + BinaryData + .fromString( + "{\"defaultValues\":[{\"columnName\":\"datamcrhyoes\",\"defaultValue\":\"datalmytnhvy\"},{\"columnName\":\"datafe\",\"defaultValue\":\"dataxgstiawywppq\"},{\"columnName\":\"datajxbdyczplmljcisx\",\"defaultValue\":\"datas\"},{\"columnName\":\"datayt\",\"defaultValue\":\"datamufdynhqlzanta\"}],\"additionalOptions\":{\"oadwiqnsmpfeyjvl\":\"kxsjympsx\"}}") + .toObject(DWCopyCommandSettings.class); + Assertions.assertEquals("kxsjympsx", model.additionalOptions().get("oadwiqnsmpfeyjvl")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DWCopyCommandSettings model = + new DWCopyCommandSettings() + .withDefaultValues( + Arrays + .asList( + new DWCopyCommandDefaultValue() + .withColumnName("datamcrhyoes") + .withDefaultValue("datalmytnhvy"), + new DWCopyCommandDefaultValue() + .withColumnName("datafe") + .withDefaultValue("dataxgstiawywppq"), + new DWCopyCommandDefaultValue() + .withColumnName("datajxbdyczplmljcisx") + .withDefaultValue("datas"), + new DWCopyCommandDefaultValue() + .withColumnName("datayt") + .withDefaultValue("datamufdynhqlzanta"))) + .withAdditionalOptions(mapOf("oadwiqnsmpfeyjvl", "kxsjympsx")); + model = BinaryData.fromObject(model).toObject(DWCopyCommandSettings.class); + Assertions.assertEquals("kxsjympsx", model.additionalOptions().get("oadwiqnsmpfeyjvl")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugCommandPayloadTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugCommandPayloadTests.java new file mode 100644 index 000000000000..1b6a9939839f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugCommandPayloadTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugCommandPayload; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowDebugCommandPayloadTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowDebugCommandPayload model = + BinaryData + .fromString( + "{\"streamName\":\"uartvti\",\"rowLimits\":1848545940,\"columns\":[\"chnmna\",\"mnxhkxjqirwrweo\"],\"expression\":\"ffifhx\"}") + .toObject(DataFlowDebugCommandPayload.class); + Assertions.assertEquals("uartvti", model.streamName()); + Assertions.assertEquals(1848545940, model.rowLimits()); + Assertions.assertEquals("chnmna", model.columns().get(0)); + Assertions.assertEquals("ffifhx", model.expression()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowDebugCommandPayload model = + new DataFlowDebugCommandPayload() + .withStreamName("uartvti") + .withRowLimits(1848545940) + .withColumns(Arrays.asList("chnmna", "mnxhkxjqirwrweo")) + .withExpression("ffifhx"); + model = BinaryData.fromObject(model).toObject(DataFlowDebugCommandPayload.class); + Assertions.assertEquals("uartvti", model.streamName()); + Assertions.assertEquals(1848545940, model.rowLimits()); + Assertions.assertEquals("chnmna", model.columns().get(0)); + Assertions.assertEquals("ffifhx", model.expression()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugCommandRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugCommandRequestTests.java new file mode 100644 index 000000000000..b74fa0011b9e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugCommandRequestTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugCommandPayload; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugCommandRequest; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugCommandType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowDebugCommandRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowDebugCommandRequest model = + BinaryData + .fromString( + "{\"sessionId\":\"fcbahhp\",\"command\":\"executeExpressionQuery\",\"commandPayload\":{\"streamName\":\"o\",\"rowLimits\":2134608057,\"columns\":[\"filkmkkholv\"],\"expression\":\"dviauogp\"}}") + .toObject(DataFlowDebugCommandRequest.class); + Assertions.assertEquals("fcbahhp", model.sessionId()); + Assertions.assertEquals(DataFlowDebugCommandType.EXECUTE_EXPRESSION_QUERY, model.command()); + Assertions.assertEquals("o", model.commandPayload().streamName()); + Assertions.assertEquals(2134608057, model.commandPayload().rowLimits()); + Assertions.assertEquals("filkmkkholv", model.commandPayload().columns().get(0)); + Assertions.assertEquals("dviauogp", model.commandPayload().expression()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowDebugCommandRequest model = + new DataFlowDebugCommandRequest() + .withSessionId("fcbahhp") + .withCommand(DataFlowDebugCommandType.EXECUTE_EXPRESSION_QUERY) + .withCommandPayload( + new DataFlowDebugCommandPayload() + .withStreamName("o") + .withRowLimits(2134608057) + .withColumns(Arrays.asList("filkmkkholv")) + .withExpression("dviauogp")); + model = BinaryData.fromObject(model).toObject(DataFlowDebugCommandRequest.class); + Assertions.assertEquals("fcbahhp", model.sessionId()); + Assertions.assertEquals(DataFlowDebugCommandType.EXECUTE_EXPRESSION_QUERY, model.command()); + Assertions.assertEquals("o", model.commandPayload().streamName()); + Assertions.assertEquals(2134608057, model.commandPayload().rowLimits()); + Assertions.assertEquals("filkmkkholv", model.commandPayload().columns().get(0)); + Assertions.assertEquals("dviauogp", model.commandPayload().expression()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugCommandResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugCommandResponseInnerTests.java new file mode 100644 index 000000000000..d4183544aec9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugCommandResponseInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DataFlowDebugCommandResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowDebugCommandResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowDebugCommandResponseInner model = + BinaryData + .fromString("{\"status\":\"snewmozqvbub\",\"data\":\"amhsycxhxzgazt\"}") + .toObject(DataFlowDebugCommandResponseInner.class); + Assertions.assertEquals("snewmozqvbub", model.status()); + Assertions.assertEquals("amhsycxhxzgazt", model.data()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowDebugCommandResponseInner model = + new DataFlowDebugCommandResponseInner().withStatus("snewmozqvbub").withData("amhsycxhxzgazt"); + model = BinaryData.fromObject(model).toObject(DataFlowDebugCommandResponseInner.class); + Assertions.assertEquals("snewmozqvbub", model.status()); + Assertions.assertEquals("amhsycxhxzgazt", model.data()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugPackageDebugSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugPackageDebugSettingsTests.java new file mode 100644 index 000000000000..5ae625ba11ee --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugPackageDebugSettingsTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugPackageDebugSettings; +import com.azure.resourcemanager.datafactory.models.DataFlowSourceSetting; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowDebugPackageDebugSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowDebugPackageDebugSettings model = + BinaryData + .fromString( + "{\"sourceSettings\":[{\"sourceName\":\"cnqmxqpsw\",\"rowLimit\":2027239261,\"\":{\"gdhbe\":\"datahl\"}},{\"sourceName\":\"qkzszuwiwtglxxh\",\"rowLimit\":1438070602,\"\":{\"pqcbfrmbodthsq\":\"datapicrmnzhrgmqgjsx\",\"fr\":\"datagvriibakclac\"}},{\"sourceName\":\"ousxauzlwvsgmw\",\"rowLimit\":414245170,\"\":{\"mmkjsvthnwpztek\":\"dataizvu\",\"gplucfotangcfhny\":\"datavmribiat\",\"vtxnjmxmcuqud\":\"datazcugswvxwlmzqw\"}}],\"parameters\":{\"dkvgfabuiyjibuzp\":\"dataclxyn\"},\"datasetParameters\":\"dataugneikn\"}") + .toObject(DataFlowDebugPackageDebugSettings.class); + Assertions.assertEquals("cnqmxqpsw", model.sourceSettings().get(0).sourceName()); + Assertions.assertEquals(2027239261, model.sourceSettings().get(0).rowLimit()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowDebugPackageDebugSettings model = + new DataFlowDebugPackageDebugSettings() + .withSourceSettings( + Arrays + .asList( + new DataFlowSourceSetting() + .withSourceName("cnqmxqpsw") + .withRowLimit(2027239261) + .withAdditionalProperties(mapOf()), + new DataFlowSourceSetting() + .withSourceName("qkzszuwiwtglxxh") + .withRowLimit(1438070602) + .withAdditionalProperties(mapOf()), + new DataFlowSourceSetting() + .withSourceName("ousxauzlwvsgmw") + .withRowLimit(414245170) + .withAdditionalProperties(mapOf()))) + .withParameters(mapOf("dkvgfabuiyjibuzp", "dataclxyn")) + .withDatasetParameters("dataugneikn"); + model = BinaryData.fromObject(model).toObject(DataFlowDebugPackageDebugSettings.class); + Assertions.assertEquals("cnqmxqpsw", model.sourceSettings().get(0).sourceName()); + Assertions.assertEquals(2027239261, model.sourceSettings().get(0).rowLimit()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugPackageTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugPackageTests.java new file mode 100644 index 000000000000..ad4519dca067 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugPackageTests.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlow; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugPackage; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugPackageDebugSettings; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugResource; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import com.azure.resourcemanager.datafactory.models.DataFlowSourceSetting; +import com.azure.resourcemanager.datafactory.models.DataFlowStagingInfo; +import com.azure.resourcemanager.datafactory.models.Dataset; +import com.azure.resourcemanager.datafactory.models.DatasetDebugResource; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedService; +import com.azure.resourcemanager.datafactory.models.LinkedServiceDebugResource; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowDebugPackageTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowDebugPackage model = + BinaryData + .fromString( + "{\"sessionId\":\"ryxynqnzrd\",\"dataFlow\":{\"properties\":{\"type\":\"DataFlow\",\"description\":\"vwxzn\",\"annotations\":[\"dataoeiy\",\"datab\",\"databp\",\"datahv\"],\"folder\":{\"name\":\"kvntjlrigjkskyri\"}},\"name\":\"vzidsxwaab\"},\"dataFlows\":[{\"properties\":{\"type\":\"DataFlow\",\"description\":\"rygznmmaxriz\",\"annotations\":[\"databgopxlhslnel\",\"dataieixynllxe\"],\"folder\":{\"name\":\"rojphslhcawjutif\"}},\"name\":\"fmvigorqjbttzh\"},{\"properties\":{\"type\":\"DataFlow\",\"description\":\"glka\",\"annotations\":[\"datan\",\"datajuj\",\"dataickpz\",\"datacpopmxel\"],\"folder\":{\"name\":\"ltyjedexxmlfmk\"}},\"name\":\"cazuaw\"}],\"datasets\":[{\"properties\":{\"type\":\"Dataset\",\"description\":\"puamwabzxr\",\"structure\":\"datacush\",\"schema\":\"datahaivm\",\"linkedServiceName\":{\"referenceName\":\"yasflvgsgzwy\",\"parameters\":{\"knsmjblmljhlnymz\":\"dataoi\"}},\"parameters\":{\"gtayxonsupeujlz\":{\"type\":\"Bool\",\"defaultValue\":\"datayuzcbmqqvxmvw\"},\"nzoibgsxgnx\":{\"type\":\"SecureString\",\"defaultValue\":\"datacvsql\"},\"bxiqxeiiqbimht\":{\"type\":\"Int\",\"defaultValue\":\"dataonmpqoxwdof\"},\"qpofvwbc\":{\"type\":\"Float\",\"defaultValue\":\"datainheh\"}},\"annotations\":[\"datambnkb\",\"datavqvxk\"],\"folder\":{\"name\":\"qihebw\"},\"\":{\"gi\":\"databzuwfmdurag\",\"igkxkbsazga\":\"datavcjfelisdjubggb\",\"apvu\":\"datagacyrcmjdmspo\",\"zjedmstkvnlv\":\"datarylniofrzg\"}},\"name\":\"c\"}],\"linkedServices\":[{\"properties\":{\"type\":\"LinkedService\",\"connectVia\":{\"referenceName\":\"nktwfansnvpdibmi\",\"parameters\":{\"yls\":\"datatbzbkiwbuqnyophz\"}},\"description\":\"rpfbcunezz\",\"parameters\":{\"psihcla\":{\"type\":\"Bool\",\"defaultValue\":\"datafwyfwlwxjwet\"},\"rsqqwztcm\":{\"type\":\"SecureString\",\"defaultValue\":\"dataaylp\"},\"jexfdeqvhp\":{\"type\":\"Array\",\"defaultValue\":\"datachcxwaxfewzj\"}},\"annotations\":[\"datakkshkbffm\",\"datamxzjrgywwpgjx\",\"datanptfujgi\",\"datagaao\"],\"\":{\"swvr\":\"datataqutdewem\",\"kimrt\":\"dataunzzjgehk\",\"jqepqwhi\":\"dataxokffqyin\"}},\"name\":\"onsts\"}],\"staging\":{\"linkedService\":{\"referenceName\":\"xgvelfclduccbird\",\"parameters\":{\"stmninwjizcilng\":\"datawcobie\"}},\"folderPath\":\"datashejjtbxqm\"},\"debugSettings\":{\"sourceSettings\":[{\"sourceName\":\"xqzv\",\"rowLimit\":411885173,\"\":{\"qbsms\":\"dataycucrwnamikzeb\",\"kzruswh\":\"dataziqgfuh\",\"ycjsx\":\"datahczznvf\",\"xqhndvnoamlds\":\"datawwixzvumw\"}},{\"sourceName\":\"aohdjh\",\"rowLimit\":1043529198,\"\":{\"agltsxoa\":\"datakxcoxpelnje\",\"npbs\":\"dataftgz\"}}],\"parameters\":{\"ipgawtxx\":\"datafloccsrmozih\"},\"datasetParameters\":\"datay\"},\"\":{\"pcycilrmcaykg\":\"datacjxgrytf\",\"pndfcpfnznt\":\"datanoxuztrksx\",\"xuzvoamktcqi\":\"datajtwkjaos\",\"rtltla\":\"datasmgbzahgxqdl\"}}") + .toObject(DataFlowDebugPackage.class); + Assertions.assertEquals("ryxynqnzrd", model.sessionId()); + Assertions.assertEquals("vzidsxwaab", model.dataFlow().name()); + Assertions.assertEquals("vwxzn", model.dataFlow().properties().description()); + Assertions.assertEquals("kvntjlrigjkskyri", model.dataFlow().properties().folder().name()); + Assertions.assertEquals("fmvigorqjbttzh", model.dataFlows().get(0).name()); + Assertions.assertEquals("rygznmmaxriz", model.dataFlows().get(0).properties().description()); + Assertions.assertEquals("rojphslhcawjutif", model.dataFlows().get(0).properties().folder().name()); + Assertions.assertEquals("c", model.datasets().get(0).name()); + Assertions.assertEquals("puamwabzxr", model.datasets().get(0).properties().description()); + Assertions + .assertEquals("yasflvgsgzwy", model.datasets().get(0).properties().linkedServiceName().referenceName()); + Assertions + .assertEquals( + ParameterType.BOOL, model.datasets().get(0).properties().parameters().get("gtayxonsupeujlz").type()); + Assertions.assertEquals("qihebw", model.datasets().get(0).properties().folder().name()); + Assertions.assertEquals("onsts", model.linkedServices().get(0).name()); + Assertions + .assertEquals("nktwfansnvpdibmi", model.linkedServices().get(0).properties().connectVia().referenceName()); + Assertions.assertEquals("rpfbcunezz", model.linkedServices().get(0).properties().description()); + Assertions + .assertEquals( + ParameterType.BOOL, model.linkedServices().get(0).properties().parameters().get("psihcla").type()); + Assertions.assertEquals("xgvelfclduccbird", model.staging().linkedService().referenceName()); + Assertions.assertEquals("xqzv", model.debugSettings().sourceSettings().get(0).sourceName()); + Assertions.assertEquals(411885173, model.debugSettings().sourceSettings().get(0).rowLimit()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowDebugPackage model = + new DataFlowDebugPackage() + .withSessionId("ryxynqnzrd") + .withDataFlow( + new DataFlowDebugResource() + .withName("vzidsxwaab") + .withProperties( + new DataFlow() + .withDescription("vwxzn") + .withAnnotations(Arrays.asList("dataoeiy", "datab", "databp", "datahv")) + .withFolder(new DataFlowFolder().withName("kvntjlrigjkskyri")))) + .withDataFlows( + Arrays + .asList( + new DataFlowDebugResource() + .withName("fmvigorqjbttzh") + .withProperties( + new DataFlow() + .withDescription("rygznmmaxriz") + .withAnnotations(Arrays.asList("databgopxlhslnel", "dataieixynllxe")) + .withFolder(new DataFlowFolder().withName("rojphslhcawjutif"))), + new DataFlowDebugResource() + .withName("cazuaw") + .withProperties( + new DataFlow() + .withDescription("glka") + .withAnnotations(Arrays.asList("datan", "datajuj", "dataickpz", "datacpopmxel")) + .withFolder(new DataFlowFolder().withName("ltyjedexxmlfmk"))))) + .withDatasets( + Arrays + .asList( + new DatasetDebugResource() + .withName("c") + .withProperties( + new Dataset() + .withDescription("puamwabzxr") + .withStructure("datacush") + .withSchema("datahaivm") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("yasflvgsgzwy") + .withParameters(mapOf("knsmjblmljhlnymz", "dataoi"))) + .withParameters( + mapOf( + "gtayxonsupeujlz", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datayuzcbmqqvxmvw"), + "nzoibgsxgnx", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datacvsql"), + "bxiqxeiiqbimht", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("dataonmpqoxwdof"), + "qpofvwbc", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datainheh"))) + .withAnnotations(Arrays.asList("datambnkb", "datavqvxk")) + .withFolder(new DatasetFolder().withName("qihebw")) + .withAdditionalProperties(mapOf("type", "Dataset"))))) + .withLinkedServices( + Arrays + .asList( + new LinkedServiceDebugResource() + .withName("onsts") + .withProperties( + new LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("nktwfansnvpdibmi") + .withParameters(mapOf("yls", "datatbzbkiwbuqnyophz"))) + .withDescription("rpfbcunezz") + .withParameters( + mapOf( + "psihcla", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datafwyfwlwxjwet"), + "rsqqwztcm", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("dataaylp"), + "jexfdeqvhp", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datachcxwaxfewzj"))) + .withAnnotations( + Arrays + .asList( + "datakkshkbffm", "datamxzjrgywwpgjx", "datanptfujgi", "datagaao")) + .withAdditionalProperties(mapOf("type", "LinkedService"))))) + .withStaging( + new DataFlowStagingInfo() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("xgvelfclduccbird") + .withParameters(mapOf("stmninwjizcilng", "datawcobie"))) + .withFolderPath("datashejjtbxqm")) + .withDebugSettings( + new DataFlowDebugPackageDebugSettings() + .withSourceSettings( + Arrays + .asList( + new DataFlowSourceSetting() + .withSourceName("xqzv") + .withRowLimit(411885173) + .withAdditionalProperties(mapOf()), + new DataFlowSourceSetting() + .withSourceName("aohdjh") + .withRowLimit(1043529198) + .withAdditionalProperties(mapOf()))) + .withParameters(mapOf("ipgawtxx", "datafloccsrmozih")) + .withDatasetParameters("datay")) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(DataFlowDebugPackage.class); + Assertions.assertEquals("ryxynqnzrd", model.sessionId()); + Assertions.assertEquals("vzidsxwaab", model.dataFlow().name()); + Assertions.assertEquals("vwxzn", model.dataFlow().properties().description()); + Assertions.assertEquals("kvntjlrigjkskyri", model.dataFlow().properties().folder().name()); + Assertions.assertEquals("fmvigorqjbttzh", model.dataFlows().get(0).name()); + Assertions.assertEquals("rygznmmaxriz", model.dataFlows().get(0).properties().description()); + Assertions.assertEquals("rojphslhcawjutif", model.dataFlows().get(0).properties().folder().name()); + Assertions.assertEquals("c", model.datasets().get(0).name()); + Assertions.assertEquals("puamwabzxr", model.datasets().get(0).properties().description()); + Assertions + .assertEquals("yasflvgsgzwy", model.datasets().get(0).properties().linkedServiceName().referenceName()); + Assertions + .assertEquals( + ParameterType.BOOL, model.datasets().get(0).properties().parameters().get("gtayxonsupeujlz").type()); + Assertions.assertEquals("qihebw", model.datasets().get(0).properties().folder().name()); + Assertions.assertEquals("onsts", model.linkedServices().get(0).name()); + Assertions + .assertEquals("nktwfansnvpdibmi", model.linkedServices().get(0).properties().connectVia().referenceName()); + Assertions.assertEquals("rpfbcunezz", model.linkedServices().get(0).properties().description()); + Assertions + .assertEquals( + ParameterType.BOOL, model.linkedServices().get(0).properties().parameters().get("psihcla").type()); + Assertions.assertEquals("xgvelfclduccbird", model.staging().linkedService().referenceName()); + Assertions.assertEquals("xqzv", model.debugSettings().sourceSettings().get(0).sourceName()); + Assertions.assertEquals(411885173, model.debugSettings().sourceSettings().get(0).rowLimit()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugResourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugResourceTests.java new file mode 100644 index 000000000000..8e48c7e51243 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugResourceTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlow; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugResource; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowDebugResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowDebugResource model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"DataFlow\",\"description\":\"ltzkatbhjmznnb\",\"annotations\":[\"dataeq\",\"datalarvlagunbtg\"],\"folder\":{\"name\":\"wlnbm\"}},\"name\":\"reeudzqavb\"}") + .toObject(DataFlowDebugResource.class); + Assertions.assertEquals("reeudzqavb", model.name()); + Assertions.assertEquals("ltzkatbhjmznnb", model.properties().description()); + Assertions.assertEquals("wlnbm", model.properties().folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowDebugResource model = + new DataFlowDebugResource() + .withName("reeudzqavb") + .withProperties( + new DataFlow() + .withDescription("ltzkatbhjmznnb") + .withAnnotations(Arrays.asList("dataeq", "datalarvlagunbtg")) + .withFolder(new DataFlowFolder().withName("wlnbm"))); + model = BinaryData.fromObject(model).toObject(DataFlowDebugResource.class); + Assertions.assertEquals("reeudzqavb", model.name()); + Assertions.assertEquals("ltzkatbhjmznnb", model.properties().description()); + Assertions.assertEquals("wlnbm", model.properties().folder().name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionInfoInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionInfoInnerTests.java new file mode 100644 index 000000000000..47dcb8be77f7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionInfoInnerTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DataFlowDebugSessionInfoInner; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowDebugSessionInfoInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowDebugSessionInfoInner model = + BinaryData + .fromString( + "{\"dataFlowName\":\"bwefqsfapaqtfer\",\"computeType\":\"wexjkmfxapjwogq\",\"coreCount\":211935178,\"nodeCount\":775989398,\"integrationRuntimeName\":\"dcdab\",\"sessionId\":\"wpwyawbz\",\"startTime\":\"qbucljgkyexaoguy\",\"timeToLiveInMinutes\":166467616,\"lastActivityTime\":\"dsdaultxijjumf\",\"\":{\"nqnm\":\"dataz\",\"qdqx\":\"datajng\",\"zsvtuikzhajqgl\":\"databjwgnyfus\",\"l\":\"datafh\"}}") + .toObject(DataFlowDebugSessionInfoInner.class); + Assertions.assertEquals("bwefqsfapaqtfer", model.dataFlowName()); + Assertions.assertEquals("wexjkmfxapjwogq", model.computeType()); + Assertions.assertEquals(211935178, model.coreCount()); + Assertions.assertEquals(775989398, model.nodeCount()); + Assertions.assertEquals("dcdab", model.integrationRuntimeName()); + Assertions.assertEquals("wpwyawbz", model.sessionId()); + Assertions.assertEquals("qbucljgkyexaoguy", model.startTime()); + Assertions.assertEquals(166467616, model.timeToLiveInMinutes()); + Assertions.assertEquals("dsdaultxijjumf", model.lastActivityTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowDebugSessionInfoInner model = + new DataFlowDebugSessionInfoInner() + .withDataFlowName("bwefqsfapaqtfer") + .withComputeType("wexjkmfxapjwogq") + .withCoreCount(211935178) + .withNodeCount(775989398) + .withIntegrationRuntimeName("dcdab") + .withSessionId("wpwyawbz") + .withStartTime("qbucljgkyexaoguy") + .withTimeToLiveInMinutes(166467616) + .withLastActivityTime("dsdaultxijjumf") + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(DataFlowDebugSessionInfoInner.class); + Assertions.assertEquals("bwefqsfapaqtfer", model.dataFlowName()); + Assertions.assertEquals("wexjkmfxapjwogq", model.computeType()); + Assertions.assertEquals(211935178, model.coreCount()); + Assertions.assertEquals(775989398, model.nodeCount()); + Assertions.assertEquals("dcdab", model.integrationRuntimeName()); + Assertions.assertEquals("wpwyawbz", model.sessionId()); + Assertions.assertEquals("qbucljgkyexaoguy", model.startTime()); + Assertions.assertEquals(166467616, model.timeToLiveInMinutes()); + Assertions.assertEquals("dsdaultxijjumf", model.lastActivityTime()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsAddDataFlowWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsAddDataFlowWithResponseMockTests.java new file mode 100644 index 000000000000..a9f89f6a7d4f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsAddDataFlowWithResponseMockTests.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.AddDataFlowToDebugSessionResponse; +import com.azure.resourcemanager.datafactory.models.DataFlow; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugPackage; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugPackageDebugSettings; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugResource; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import com.azure.resourcemanager.datafactory.models.DataFlowSourceSetting; +import com.azure.resourcemanager.datafactory.models.DataFlowStagingInfo; +import com.azure.resourcemanager.datafactory.models.Dataset; +import com.azure.resourcemanager.datafactory.models.DatasetDebugResource; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedService; +import com.azure.resourcemanager.datafactory.models.LinkedServiceDebugResource; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +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 org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DataFlowDebugSessionsAddDataFlowWithResponseMockTests { + @Test + public void testAddDataFlowWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"jobVersion\":\"ssghafzdzdfxud\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + AddDataFlowToDebugSessionResponse response = + manager + .dataFlowDebugSessions() + .addDataFlowWithResponse( + "ewqwdglmfsjpl", + "dhzltmywy", + new DataFlowDebugPackage() + .withSessionId("uovkgqtzghtj") + .withDataFlow( + new DataFlowDebugResource() + .withName("squfsyih") + .withProperties( + new DataFlow() + .withDescription("ywoq") + .withAnnotations(Arrays.asList("datavx", "dataioasvykthxud")) + .withFolder(new DataFlowFolder().withName("wltegqzqdc")))) + .withDataFlows( + Arrays + .asList( + new DataFlowDebugResource() + .withName("v") + .withProperties( + new DataFlow() + .withDescription("joxu") + .withAnnotations( + Arrays + .asList( + "dataakexjzalhunbm", "datagstvnkshau", "dataltvlylboqyin")) + .withFolder(new DataFlowFolder().withName("xncoaiy"))), + new DataFlowDebugResource() + .withName("odselbcudxqlr") + .withProperties( + new DataFlow() + .withDescription("djz") + .withAnnotations(Arrays.asList("dataocxakuqyei")) + .withFolder(new DataFlowFolder().withName("nxli"))), + new DataFlowDebugResource() + .withName("vdqfkjg") + .withProperties( + new DataFlow() + .withDescription("mukxk") + .withAnnotations( + Arrays.asList("datasf", "datakjfrtaufrxxvz", "dataineqmjodvknxjt")) + .withFolder(new DataFlowFolder().withName("hmhqucasfqod"))), + new DataFlowDebugResource() + .withName("nzemisqunx") + .withProperties( + new DataFlow() + .withDescription("cfoaabltv") + .withAnnotations( + Arrays + .asList( + "dataoplxbxfrliy", + "datakcnlbehxoyoxjqy", + "datafejddiogwck")) + .withFolder(new DataFlowFolder().withName("lihfga"))))) + .withDatasets( + Arrays + .asList( + new DatasetDebugResource() + .withName("s") + .withProperties( + new Dataset() + .withDescription("nchrouvtbptdeum") + .withStructure("dataszx") + .withSchema("dataabknkeodg") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("qdcr") + .withParameters( + mapOf("hvwcsgczvuiprn", "datantowohtuiwsnccmu"))) + .withParameters( + mapOf( + "m", + new ParameterSpecification().withType(ParameterType.ARRAY), + "dayzfuvbnelm", + new ParameterSpecification().withType(ParameterType.STRING), + "mccevbpr", + new ParameterSpecification().withType(ParameterType.OBJECT), + "geregf", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING))) + .withAnnotations( + Arrays + .asList( + "datajmznp", + "dataevafczgi", + "dataegdeiynlcdqx", + "datawnbjkwgkgo")) + .withFolder(new DatasetFolder().withName("zmwrxsfej")) + .withAdditionalProperties(mapOf("type", "Dataset"))), + new DatasetDebugResource() + .withName("omuapyskwi") + .withProperties( + new Dataset() + .withDescription("dtme") + .withStructure("datadocqaptwkbis") + .withSchema("datanwhazalftta") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("z") + .withParameters( + mapOf( + "rduq", + "dataep", + "fibzvxqhzpjdbzhl", + "datarlltfecxxzh"))) + .withParameters( + mapOf( + "sydjr", + new ParameterSpecification().withType(ParameterType.OBJECT), + "j", + new ParameterSpecification().withType(ParameterType.INT), + "fuj", + new ParameterSpecification().withType(ParameterType.FLOAT), + "vrpearoohppupuc", + new ParameterSpecification().withType(ParameterType.INT))) + .withAnnotations(Arrays.asList("dataravelcbmmrhog")) + .withFolder(new DatasetFolder().withName("eaexweeifogvzm")) + .withAdditionalProperties(mapOf("type", "Dataset"))))) + .withLinkedServices( + Arrays + .asList( + new LinkedServiceDebugResource() + .withName("kuemotgkyfh") + .withProperties( + new LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("qvul") + .withParameters( + mapOf("vxfyqsfy", "datajdbcypv", "ql", "dataafhbfpzf"))) + .withDescription("pckxlcslmy") + .withParameters( + mapOf( + "qpjbar", + new ParameterSpecification().withType(ParameterType.FLOAT), + "xd", + new ParameterSpecification().withType(ParameterType.BOOL))) + .withAnnotations(Arrays.asList("datafulvmvalvcahy", "dataphdhtcopz")) + .withAdditionalProperties(mapOf("type", "LinkedService"))), + new LinkedServiceDebugResource() + .withName("dlhnkvipjinjik") + .withProperties( + new LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("mwqkfsvzczisiqns") + .withParameters( + mapOf( + "qbatdnufvzxosrst", "datajfu", "bmdoj", "datavdtssa"))) + .withDescription("faagpjslrf") + .withParameters( + mapOf( + "tfbhs", + new ParameterSpecification().withType(ParameterType.STRING), + "nfcbxta", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING))) + .withAnnotations(Arrays.asList("datakboyqescvcvu")) + .withAdditionalProperties(mapOf("type", "LinkedService"))))) + .withStaging( + new DataFlowStagingInfo() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("fmkcn") + .withParameters( + mapOf("ztxix", "dataezonrltewths", "vefldfwqnb", "datagweuxyc"))) + .withFolderPath("dataznlscfbwkh")) + .withDebugSettings( + new DataFlowDebugPackageDebugSettings() + .withSourceSettings( + Arrays + .asList( + new DataFlowSourceSetting() + .withSourceName("boprgxdcnbzpc") + .withRowLimit(1456979529) + .withAdditionalProperties(mapOf()))) + .withParameters( + mapOf( + "bptvvwfamhljhi", + "datalipoequjkhummrxx", + "bczwd", + "datamhccwmrckv", + "ohxmzpfptt", + "dataydbsrjofxoktokms")) + .withDatasetParameters("datawqrbtadsdkbndkof")) + .withAdditionalProperties(mapOf()), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ssghafzdzdfxud", response.jobVersion()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsCreateMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsCreateMockTests.java new file mode 100644 index 000000000000..056ca3b566ba --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsCreateMockTests.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.CreateDataFlowDebugSessionRequest; +import com.azure.resourcemanager.datafactory.models.CreateDataFlowDebugSessionResponse; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntime; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeDebugResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DataFlowDebugSessionsCreateMockTests { + @Test + public void testCreate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"status\":\"ygecly\",\"sessionId\":\"oshkzibbjbzdnkg\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + CreateDataFlowDebugSessionResponse response = + manager + .dataFlowDebugSessions() + .create( + "acurmmbunazlivvn", + "zcnqwisuh", + new CreateDataFlowDebugSessionRequest() + .withComputeType("eqyiadv") + .withCoreCount(1802611604) + .withTimeToLive(902558442) + .withIntegrationRuntime( + new IntegrationRuntimeDebugResource() + .withName("siflf") + .withProperties( + new IntegrationRuntime() + .withDescription("lpnlpnyyu") + .withAdditionalProperties(mapOf("type", "IntegrationRuntime")))), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ygecly", response.status()); + Assertions.assertEquals("oshkzibbjbzdnkg", response.sessionId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..457f12d189c6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsDeleteWithResponseMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.DeleteDataFlowDebugSessionRequest; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DataFlowDebugSessionsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .dataFlowDebugSessions() + .deleteWithResponse( + "iutzuriqlks", + "ay", + new DeleteDataFlowDebugSessionRequest().withSessionId("tiqzjrxhelqh"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsExecuteCommandMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsExecuteCommandMockTests.java new file mode 100644 index 000000000000..b57d3fc8187d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsExecuteCommandMockTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugCommandPayload; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugCommandRequest; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugCommandResponse; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugCommandType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DataFlowDebugSessionsExecuteCommandMockTests { + @Test + public void testExecuteCommand() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"status\":\"mdcoqwdmegkhjeu\",\"data\":\"vnwcvlmyr\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + DataFlowDebugCommandResponse response = + manager + .dataFlowDebugSessions() + .executeCommand( + "qzdxdal", + "tetg", + new DataFlowDebugCommandRequest() + .withSessionId("dywjzqmb") + .withCommand(DataFlowDebugCommandType.EXECUTE_STATISTICS_QUERY) + .withCommandPayload( + new DataFlowDebugCommandPayload() + .withStreamName("dnkgrxhpxsbhua") + .withRowLimits(1354403890) + .withColumns(Arrays.asList("uoweamnxzduydnv")) + .withExpression("o")), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("mdcoqwdmegkhjeu", response.status()); + Assertions.assertEquals("vnwcvlmyr", response.data()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsQueryByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsQueryByFactoryMockTests.java new file mode 100644 index 000000000000..fd370bb4df2c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowDebugSessionsQueryByFactoryMockTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.DataFlowDebugSessionInfo; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DataFlowDebugSessionsQueryByFactoryMockTests { + @Test + public void testQueryByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"dataFlowName\":\"nnmpnnq\",\"computeType\":\"ghpx\",\"coreCount\":672334852,\"nodeCount\":1025060148,\"integrationRuntimeName\":\"qugo\",\"sessionId\":\"ddxlrbs\",\"startTime\":\"rgjejabqvg\",\"timeToLiveInMinutes\":835453727,\"lastActivityTime\":\"yazpxlya\",\"\":{\"jfwurhkuxphbwmbg\":\"datazgs\",\"glnsnkylqdsyg\":\"datagm\",\"ufr\":\"dataz\"}}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .dataFlowDebugSessions() + .queryByFactory("vbvicwfrybvhg", "ltjghdfusphokcc", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nnmpnnq", response.iterator().next().dataFlowName()); + Assertions.assertEquals("ghpx", response.iterator().next().computeType()); + Assertions.assertEquals(672334852, response.iterator().next().coreCount()); + Assertions.assertEquals(1025060148, response.iterator().next().nodeCount()); + Assertions.assertEquals("qugo", response.iterator().next().integrationRuntimeName()); + Assertions.assertEquals("ddxlrbs", response.iterator().next().sessionId()); + Assertions.assertEquals("rgjejabqvg", response.iterator().next().startTime()); + Assertions.assertEquals(835453727, response.iterator().next().timeToLiveInMinutes()); + Assertions.assertEquals("yazpxlya", response.iterator().next().lastActivityTime()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowFolderTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowFolderTests.java new file mode 100644 index 000000000000..75447220b605 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowFolderTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowFolderTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowFolder model = BinaryData.fromString("{\"name\":\"nmfpp\"}").toObject(DataFlowFolder.class); + Assertions.assertEquals("nmfpp", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowFolder model = new DataFlowFolder().withName("nmfpp"); + model = BinaryData.fromObject(model).toObject(DataFlowFolder.class); + Assertions.assertEquals("nmfpp", model.name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowListResponseTests.java new file mode 100644 index 000000000000..c64f6517a833 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowListResponseTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DataFlowResourceInner; +import com.azure.resourcemanager.datafactory.models.DataFlow; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import com.azure.resourcemanager.datafactory.models.DataFlowListResponse; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"type\":\"DataFlow\",\"description\":\"eevy\",\"annotations\":[\"datasgzfczbg\"],\"folder\":{\"name\":\"gbeglqgleo\"}},\"name\":\"betnluankrrfxee\",\"type\":\"tijv\",\"etag\":\"vbmqzbqq\",\"id\":\"aj\"},{\"properties\":{\"type\":\"DataFlow\",\"description\":\"wxacevehj\",\"annotations\":[\"dataxoafgaoqltfae\",\"datalinmfgv\"],\"folder\":{\"name\":\"pghriypoqeyhl\"}},\"name\":\"ykprlpyznu\",\"type\":\"qdsmexiit\",\"etag\":\"uxtyasiibmi\",\"id\":\"nnust\"}],\"nextLink\":\"ljhnmgixhcmav\"}") + .toObject(DataFlowListResponse.class); + Assertions.assertEquals("aj", model.value().get(0).id()); + Assertions.assertEquals("eevy", model.value().get(0).properties().description()); + Assertions.assertEquals("gbeglqgleo", model.value().get(0).properties().folder().name()); + Assertions.assertEquals("ljhnmgixhcmav", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowListResponse model = + new DataFlowListResponse() + .withValue( + Arrays + .asList( + new DataFlowResourceInner() + .withId("aj") + .withProperties( + new DataFlow() + .withDescription("eevy") + .withAnnotations(Arrays.asList("datasgzfczbg")) + .withFolder(new DataFlowFolder().withName("gbeglqgleo"))), + new DataFlowResourceInner() + .withId("nnust") + .withProperties( + new DataFlow() + .withDescription("wxacevehj") + .withAnnotations(Arrays.asList("dataxoafgaoqltfae", "datalinmfgv")) + .withFolder(new DataFlowFolder().withName("pghriypoqeyhl"))))) + .withNextLink("ljhnmgixhcmav"); + model = BinaryData.fromObject(model).toObject(DataFlowListResponse.class); + Assertions.assertEquals("aj", model.value().get(0).id()); + Assertions.assertEquals("eevy", model.value().get(0).properties().description()); + Assertions.assertEquals("gbeglqgleo", model.value().get(0).properties().folder().name()); + Assertions.assertEquals("ljhnmgixhcmav", model.nextLink()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowReferenceTests.java new file mode 100644 index 000000000000..682c8f264a36 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowReferenceTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowReference model = + BinaryData + .fromString( + "{\"type\":\"DataFlowReference\",\"referenceName\":\"sbede\",\"datasetParameters\":\"dataexkxbhx\",\"parameters\":{\"mnhjevdyzn\":\"datanul\",\"kmq\":\"dataajsvk\",\"iizjixlqfhefkwa\":\"datazzkivyhjr\",\"nlqxsjxtele\":\"datasolronqqlm\"},\"\":{\"oolzqocarkuzl\":\"datauqbo\",\"t\":\"datacnn\"}}") + .toObject(DataFlowReference.class); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.type()); + Assertions.assertEquals("sbede", model.referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowReference model = + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("sbede") + .withDatasetParameters("dataexkxbhx") + .withParameters( + mapOf( + "mnhjevdyzn", + "datanul", + "kmq", + "dataajsvk", + "iizjixlqfhefkwa", + "datazzkivyhjr", + "nlqxsjxtele", + "datasolronqqlm")) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(DataFlowReference.class); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.type()); + Assertions.assertEquals("sbede", model.referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowResourceInnerTests.java new file mode 100644 index 000000000000..d314df772005 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowResourceInnerTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DataFlowResourceInner; +import com.azure.resourcemanager.datafactory.models.DataFlow; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"DataFlow\",\"description\":\"qspkcdqzhlctd\",\"annotations\":[\"dataqn\",\"datayfp\",\"datahrqbnjjrcg\",\"datagydcw\"],\"folder\":{\"name\":\"jumvqqolihrraio\"}},\"name\":\"ubrjtl\",\"type\":\"xfuojrn\",\"etag\":\"flrzpas\",\"id\":\"biuimzdlyjdfq\"}") + .toObject(DataFlowResourceInner.class); + Assertions.assertEquals("biuimzdlyjdfq", model.id()); + Assertions.assertEquals("qspkcdqzhlctd", model.properties().description()); + Assertions.assertEquals("jumvqqolihrraio", model.properties().folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowResourceInner model = + new DataFlowResourceInner() + .withId("biuimzdlyjdfq") + .withProperties( + new DataFlow() + .withDescription("qspkcdqzhlctd") + .withAnnotations(Arrays.asList("dataqn", "datayfp", "datahrqbnjjrcg", "datagydcw")) + .withFolder(new DataFlowFolder().withName("jumvqqolihrraio"))); + model = BinaryData.fromObject(model).toObject(DataFlowResourceInner.class); + Assertions.assertEquals("biuimzdlyjdfq", model.id()); + Assertions.assertEquals("qspkcdqzhlctd", model.properties().description()); + Assertions.assertEquals("jumvqqolihrraio", model.properties().folder().name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowSinkTests.java new file mode 100644 index 000000000000..8720217d479c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowSinkTests.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowSink; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowSink model = + BinaryData + .fromString( + "{\"schemaLinkedService\":{\"referenceName\":\"trqrejda\",\"parameters\":{\"lfxlmuifmuadj\":\"dataqimlda\",\"skiioshjgczetybn\":\"datafsn\",\"j\":\"datagztlcgc\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"fjvmy\",\"parameters\":{\"cljkxpyl\":\"dataebecuvlbefv\",\"eypdvrbk\":\"datawoxzgwpsyxji\"}},\"name\":\"rdkdkgaw\",\"description\":\"jxildfkcef\",\"dataset\":{\"referenceName\":\"gzqpjoi\",\"parameters\":{\"entq\":\"datanaybdjnxu\",\"towlhlsycoyb\":\"datantwhymxymulwiv\",\"j\":\"datajasqubf\",\"htfxcpupuki\":\"dataywhjqwmchq\"}},\"linkedService\":{\"referenceName\":\"j\",\"parameters\":{\"osaonhqnamppu\":\"datadlvwtiws\",\"eajbkajlcyizyddc\":\"datatassaekewna\",\"krvfsxxbydes\":\"dataxo\",\"nm\":\"datalvgecpwgoljtz\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"obygoo\",\"datasetParameters\":\"dataqa\",\"parameters\":{\"jfucsaodjnosdkv\":\"datavaz\"},\"\":{\"cd\":\"dataasgmatrnzpd\",\"jktzboimyfpq\":\"dataakt\"}}}") + .toObject(DataFlowSink.class); + Assertions.assertEquals("rdkdkgaw", model.name()); + Assertions.assertEquals("jxildfkcef", model.description()); + Assertions.assertEquals("gzqpjoi", model.dataset().referenceName()); + Assertions.assertEquals("j", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("obygoo", model.flowlet().referenceName()); + Assertions.assertEquals("trqrejda", model.schemaLinkedService().referenceName()); + Assertions.assertEquals("fjvmy", model.rejectedDataLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowSink model = + new DataFlowSink() + .withName("rdkdkgaw") + .withDescription("jxildfkcef") + .withDataset( + new DatasetReference() + .withReferenceName("gzqpjoi") + .withParameters( + mapOf( + "entq", + "datanaybdjnxu", + "towlhlsycoyb", + "datantwhymxymulwiv", + "j", + "datajasqubf", + "htfxcpupuki", + "dataywhjqwmchq"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("j") + .withParameters( + mapOf( + "osaonhqnamppu", + "datadlvwtiws", + "eajbkajlcyizyddc", + "datatassaekewna", + "krvfsxxbydes", + "dataxo", + "nm", + "datalvgecpwgoljtz"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("obygoo") + .withDatasetParameters("dataqa") + .withParameters(mapOf("jfucsaodjnosdkv", "datavaz")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("trqrejda") + .withParameters( + mapOf("lfxlmuifmuadj", "dataqimlda", "skiioshjgczetybn", "datafsn", "j", "datagztlcgc"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("fjvmy") + .withParameters(mapOf("cljkxpyl", "dataebecuvlbefv", "eypdvrbk", "datawoxzgwpsyxji"))); + model = BinaryData.fromObject(model).toObject(DataFlowSink.class); + Assertions.assertEquals("rdkdkgaw", model.name()); + Assertions.assertEquals("jxildfkcef", model.description()); + Assertions.assertEquals("gzqpjoi", model.dataset().referenceName()); + Assertions.assertEquals("j", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("obygoo", model.flowlet().referenceName()); + Assertions.assertEquals("trqrejda", model.schemaLinkedService().referenceName()); + Assertions.assertEquals("fjvmy", model.rejectedDataLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowSourceSettingTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowSourceSettingTests.java new file mode 100644 index 000000000000..6b0700834590 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowSourceSettingTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowSourceSetting; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowSourceSettingTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowSourceSetting model = + BinaryData + .fromString( + "{\"sourceName\":\"oxgjiuqhibt\",\"rowLimit\":645359051,\"\":{\"ktvqylkmqpzoy\":\"datawjedmurrxxgew\"}}") + .toObject(DataFlowSourceSetting.class); + Assertions.assertEquals("oxgjiuqhibt", model.sourceName()); + Assertions.assertEquals(645359051, model.rowLimit()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowSourceSetting model = + new DataFlowSourceSetting() + .withSourceName("oxgjiuqhibt") + .withRowLimit(645359051) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(DataFlowSourceSetting.class); + Assertions.assertEquals("oxgjiuqhibt", model.sourceName()); + Assertions.assertEquals(645359051, model.rowLimit()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowSourceTests.java new file mode 100644 index 000000000000..e314d56c8ecb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowSourceTests.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowSource; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowSource model = + BinaryData + .fromString( + "{\"schemaLinkedService\":{\"referenceName\":\"zlpzbtzuyky\",\"parameters\":{\"fp\":\"datafsdyepfnocmbeza\"}},\"name\":\"tga\",\"description\":\"yqejga\",\"dataset\":{\"referenceName\":\"kctgkp\",\"parameters\":{\"fngdyfcixr\":\"dataqzkcyzm\",\"mkahpqha\":\"datalcqvhoejgoiutgw\",\"mip\":\"datayntacihnco\"}},\"linkedService\":{\"referenceName\":\"liqmvlbhikeaq\",\"parameters\":{\"dtsdfjy\":\"datagpomxpu\",\"mpyzgleo\":\"dataesocwiqbuou\",\"bwwzvdajf\":\"datajsb\",\"lwixvtbou\":\"datanncfmaciqgjjrlhi\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"tnd\",\"datasetParameters\":\"datagjttbasualapdlnd\",\"parameters\":{\"ixv\":\"dataqb\",\"spugzfeuzjljmph\":\"datalwynpbbfqvzfj\",\"zolgjzmicuydocc\":\"dataky\",\"iadhbatec\":\"dataxshanzb\"},\"\":{\"iucbda\":\"datasdohz\",\"pow\":\"datambwiinjdllwktl\",\"g\":\"datavvqxua\",\"si\":\"dataqwulynkgfcfdru\"}}}") + .toObject(DataFlowSource.class); + Assertions.assertEquals("tga", model.name()); + Assertions.assertEquals("yqejga", model.description()); + Assertions.assertEquals("kctgkp", model.dataset().referenceName()); + Assertions.assertEquals("liqmvlbhikeaq", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("tnd", model.flowlet().referenceName()); + Assertions.assertEquals("zlpzbtzuyky", model.schemaLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowSource model = + new DataFlowSource() + .withName("tga") + .withDescription("yqejga") + .withDataset( + new DatasetReference() + .withReferenceName("kctgkp") + .withParameters( + mapOf( + "fngdyfcixr", + "dataqzkcyzm", + "mkahpqha", + "datalcqvhoejgoiutgw", + "mip", + "datayntacihnco"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("liqmvlbhikeaq") + .withParameters( + mapOf( + "dtsdfjy", + "datagpomxpu", + "mpyzgleo", + "dataesocwiqbuou", + "bwwzvdajf", + "datajsb", + "lwixvtbou", + "datanncfmaciqgjjrlhi"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("tnd") + .withDatasetParameters("datagjttbasualapdlnd") + .withParameters( + mapOf( + "ixv", + "dataqb", + "spugzfeuzjljmph", + "datalwynpbbfqvzfj", + "zolgjzmicuydocc", + "dataky", + "iadhbatec", + "dataxshanzb")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("zlpzbtzuyky") + .withParameters(mapOf("fp", "datafsdyepfnocmbeza"))); + model = BinaryData.fromObject(model).toObject(DataFlowSource.class); + Assertions.assertEquals("tga", model.name()); + Assertions.assertEquals("yqejga", model.description()); + Assertions.assertEquals("kctgkp", model.dataset().referenceName()); + Assertions.assertEquals("liqmvlbhikeaq", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("tnd", model.flowlet().referenceName()); + Assertions.assertEquals("zlpzbtzuyky", model.schemaLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowStagingInfoTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowStagingInfoTests.java new file mode 100644 index 000000000000..7dd44c6463b3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowStagingInfoTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowStagingInfo; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowStagingInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlowStagingInfo model = + BinaryData + .fromString( + "{\"linkedService\":{\"referenceName\":\"cpzgpxtiv\",\"parameters\":{\"n\":\"datanidibgqjxg\",\"kqmhhaowjr\":\"datahgovfgp\"}},\"folderPath\":\"datavuporqzdfuydzv\"}") + .toObject(DataFlowStagingInfo.class); + Assertions.assertEquals("cpzgpxtiv", model.linkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlowStagingInfo model = + new DataFlowStagingInfo() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("cpzgpxtiv") + .withParameters(mapOf("n", "datanidibgqjxg", "kqmhhaowjr", "datahgovfgp"))) + .withFolderPath("datavuporqzdfuydzv"); + model = BinaryData.fromObject(model).toObject(DataFlowStagingInfo.class); + Assertions.assertEquals("cpzgpxtiv", model.linkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowTests.java new file mode 100644 index 000000000000..fea1a18dad91 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlow; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DataFlowTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataFlow model = + BinaryData + .fromString( + "{\"type\":\"DataFlow\",\"description\":\"kyoqufdv\",\"annotations\":[\"dataslzojh\",\"datactfnmdxotng\"],\"folder\":{\"name\":\"ugeyzihgrkyuiza\"}}") + .toObject(DataFlow.class); + Assertions.assertEquals("kyoqufdv", model.description()); + Assertions.assertEquals("ugeyzihgrkyuiza", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataFlow model = + new DataFlow() + .withDescription("kyoqufdv") + .withAnnotations(Arrays.asList("dataslzojh", "datactfnmdxotng")) + .withFolder(new DataFlowFolder().withName("ugeyzihgrkyuiza")); + model = BinaryData.fromObject(model).toObject(DataFlow.class); + Assertions.assertEquals("kyoqufdv", model.description()); + Assertions.assertEquals("ugeyzihgrkyuiza", model.folder().name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..6ddd4b527982 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.DataFlow; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import com.azure.resourcemanager.datafactory.models.DataFlowResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DataFlowsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"DataFlow\",\"description\":\"ieyyfqhndjbyo\",\"annotations\":[\"dataxccrajxfhsgpymzr\",\"datasdj\"],\"folder\":{\"name\":\"p\"}},\"name\":\"bnnu\",\"type\":\"zyhoiufrqsmjgdd\",\"etag\":\"nxuf\",\"id\":\"aqsfphgdw\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + DataFlowResource response = + manager + .dataFlows() + .define("wuqgaa") + .withExistingFactory("udrclzro", "xirtt") + .withProperties( + new DataFlow() + .withDescription("fkdf") + .withAnnotations(Arrays.asList("databekmeeow")) + .withFolder(new DataFlowFolder().withName("pjaqfebt"))) + .withIfMatch("iwgrj") + .create(); + + Assertions.assertEquals("aqsfphgdw", response.id()); + Assertions.assertEquals("ieyyfqhndjbyo", response.properties().description()); + Assertions.assertEquals("p", response.properties().folder().name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..aa3316f4d674 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsDeleteWithResponseMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DataFlowsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.dataFlows().deleteWithResponse("nfy", "xkeavbezzpfldd", "vcwhodfwv", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsGetWithResponseMockTests.java similarity index 61% rename from sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsGetWithResponseMockTests.java rename to sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsGetWithResponseMockTests.java index 68ea7bc66b6c..0fef13cad147 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsGetWithResponseMockTests.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsGetWithResponseMockTests.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.communication.generated; +package com.azure.resourcemanager.datafactory.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; @@ -11,10 +11,8 @@ import com.azure.core.http.HttpResponse; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.DomainManagement; -import com.azure.resourcemanager.communication.models.DomainResource; -import com.azure.resourcemanager.communication.models.UserEngagementTracking; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.DataFlowResource; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -25,7 +23,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public final class DomainsGetWithResponseMockTests { +public final class DataFlowsGetWithResponseMockTests { @Test public void testGetWithResponse() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); @@ -33,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Moving\",\"dataLocation\":\"haquhcdh\",\"fromSenderDomain\":\"ualaexqpvfadmw\",\"mailFromSenderDomain\":\"crgvxpvgom\",\"domainManagement\":\"CustomerManagedInExchangeOnline\",\"verificationStates\":{},\"verificationRecords\":{},\"userEngagementTracking\":\"Disabled\"},\"location\":\"k\",\"tags\":{\"uhashsfwx\":\"liourqhak\"},\"id\":\"sowzxcugi\",\"name\":\"jooxdjebw\",\"type\":\"ucww\"}"; + "{\"properties\":{\"type\":\"DataFlow\",\"description\":\"cglfe\",\"annotations\":[\"datasyskivlz\"],\"folder\":{\"name\":\"qvlgcppnsiynz\"}},\"name\":\"dkurwgtypnj\",\"type\":\"ol\",\"etag\":\"sdgm\",\"id\":\"sktejcmhttiq\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -53,23 +51,27 @@ public void testGetWithResponse() throws Exception { return Mono.just(httpResponse); })); - CommunicationManager manager = - CommunicationManager + DataFactoryManager manager = + DataFactoryManager .configure() .withHttpClient(httpClient) .authenticate( tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - DomainResource response = + DataFlowResource response = manager - .domains() - .getWithResponse("hspkdeemao", "mx", "gkvtmelmqkrhah", com.azure.core.util.Context.NONE) + .dataFlows() + .getWithResponse( + "dfreyrgrgft", + "ehxddmaevcjtrw", + "cnwqeixyjlfobj", + "betsvnloduvcq", + com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("k", response.location()); - Assertions.assertEquals("liourqhak", response.tags().get("uhashsfwx")); - Assertions.assertEquals(DomainManagement.CUSTOMER_MANAGED_IN_EXCHANGE_ONLINE, response.domainManagement()); - Assertions.assertEquals(UserEngagementTracking.DISABLED, response.userEngagementTracking()); + Assertions.assertEquals("sktejcmhttiq", response.id()); + Assertions.assertEquals("cglfe", response.properties().description()); + Assertions.assertEquals("qvlgcppnsiynz", response.properties().folder().name()); } } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsListByFactoryMockTests.java new file mode 100644 index 000000000000..70240a6acdf1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataFlowsListByFactoryMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.DataFlowResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DataFlowsListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"type\":\"DataFlow\",\"description\":\"ktlofgpnswvcsekw\",\"annotations\":[\"datafpoqbekkqsaby\"],\"folder\":{\"name\":\"rwprbzfbdsncy\"}},\"name\":\"gtqrowtazqexwkk\",\"type\":\"cj\",\"etag\":\"nkeai\",\"id\":\"hzj\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.dataFlows().listByFactory("xrfr", "x", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("hzj", response.iterator().next().id()); + Assertions.assertEquals("ktlofgpnswvcsekw", response.iterator().next().properties().description()); + Assertions.assertEquals("rwprbzfbdsncy", response.iterator().next().properties().folder().name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataLakeAnalyticsUsqlActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataLakeAnalyticsUsqlActivityTests.java new file mode 100644 index 000000000000..063e835ccfc5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataLakeAnalyticsUsqlActivityTests.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DataLakeAnalyticsUsqlActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataLakeAnalyticsUsqlActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataLakeAnalyticsUsqlActivity model = + BinaryData + .fromString( + "{\"type\":\"DataLakeAnalyticsU-SQL\",\"typeProperties\":{\"scriptPath\":\"datarq\",\"scriptLinkedService\":{\"referenceName\":\"elmsxnxhkzcdnip\",\"parameters\":{\"mknzotm\":\"datauvsvgydtdt\"}},\"degreeOfParallelism\":\"datazkwpooaskflrqwf\",\"priority\":\"datakks\",\"parameters\":{\"fix\":\"datazvnouthbvvcbwudi\",\"rqivqzqcmrxh\":\"dataw\",\"fhijcetcystrs\":\"datalozg\",\"qoyoerlrqtqnx\":\"datayttxspaafs\"},\"runtimeVersion\":\"datalgt\",\"compilationMode\":\"datae\"},\"linkedServiceName\":{\"referenceName\":\"wbmqpbfjbsoljq\",\"parameters\":{\"xbkckam\":\"datajzbxmg\",\"bkmxohmrbjhyl\":\"datadoqfe\",\"f\":\"dataxnwcejczi\"}},\"policy\":{\"timeout\":\"dataqwnkj\",\"retry\":\"datayymb\",\"retryIntervalInSeconds\":1488637221,\"secureInput\":false,\"secureOutput\":true,\"\":{\"huvuokrkib\":\"datagryo\",\"jaxkby\":\"dataonuocmxt\"}},\"name\":\"v\",\"description\":\"pmyvasn\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"yz\",\"dependencyConditions\":[\"Succeeded\",\"Succeeded\",\"Failed\"],\"\":{\"lmfvqvyzacjxczj\":\"datapy\"}},{\"activity\":\"sixterpbjkhtmm\",\"dependencyConditions\":[\"Completed\",\"Succeeded\",\"Failed\"],\"\":{\"mziwxwwpi\":\"datatrqhncscaynh\"}},{\"activity\":\"wl\",\"dependencyConditions\":[\"Succeeded\",\"Completed\",\"Succeeded\",\"Failed\"],\"\":{\"txfzhvxqotwcfbqz\":\"datahotbsgkliu\",\"hyxxftrfwmxwjc\":\"datazchpjh\"}}],\"userProperties\":[{\"name\":\"kmona\",\"value\":\"dataleof\"},{\"name\":\"xznopk\",\"value\":\"dataoffeutvqgnugiiyc\"},{\"name\":\"jf\",\"value\":\"datakntdynbrf\"},{\"name\":\"crabrqdbxhg\",\"value\":\"datalz\"}],\"\":{\"fziixyxntuz\":\"datavnlubkb\",\"pcmnpo\":\"dataceuz\",\"fayophpudccaqhb\":\"datasqilmvx\",\"rgvzjtvjrrk\":\"datavbutesxufrwiive\"}}") + .toObject(DataLakeAnalyticsUsqlActivity.class); + Assertions.assertEquals("v", model.name()); + Assertions.assertEquals("pmyvasn", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("yz", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("kmona", model.userProperties().get(0).name()); + Assertions.assertEquals("wbmqpbfjbsoljq", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1488637221, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("elmsxnxhkzcdnip", model.scriptLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataLakeAnalyticsUsqlActivity model = + new DataLakeAnalyticsUsqlActivity() + .withName("v") + .withDescription("pmyvasn") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("yz") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("sixterpbjkhtmm") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("wl") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("kmona").withValue("dataleof"), + new UserProperty().withName("xznopk").withValue("dataoffeutvqgnugiiyc"), + new UserProperty().withName("jf").withValue("datakntdynbrf"), + new UserProperty().withName("crabrqdbxhg").withValue("datalz"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("wbmqpbfjbsoljq") + .withParameters( + mapOf("xbkckam", "datajzbxmg", "bkmxohmrbjhyl", "datadoqfe", "f", "dataxnwcejczi"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("dataqwnkj") + .withRetry("datayymb") + .withRetryIntervalInSeconds(1488637221) + .withSecureInput(false) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withScriptPath("datarq") + .withScriptLinkedService( + new LinkedServiceReference() + .withReferenceName("elmsxnxhkzcdnip") + .withParameters(mapOf("mknzotm", "datauvsvgydtdt"))) + .withDegreeOfParallelism("datazkwpooaskflrqwf") + .withPriority("datakks") + .withParameters( + mapOf( + "fix", + "datazvnouthbvvcbwudi", + "rqivqzqcmrxh", + "dataw", + "fhijcetcystrs", + "datalozg", + "qoyoerlrqtqnx", + "datayttxspaafs")) + .withRuntimeVersion("datalgt") + .withCompilationMode("datae"); + model = BinaryData.fromObject(model).toObject(DataLakeAnalyticsUsqlActivity.class); + Assertions.assertEquals("v", model.name()); + Assertions.assertEquals("pmyvasn", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("yz", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("kmona", model.userProperties().get(0).name()); + Assertions.assertEquals("wbmqpbfjbsoljq", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1488637221, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("elmsxnxhkzcdnip", model.scriptLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataLakeAnalyticsUsqlActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataLakeAnalyticsUsqlActivityTypePropertiesTests.java new file mode 100644 index 000000000000..effd48232624 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataLakeAnalyticsUsqlActivityTypePropertiesTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DataLakeAnalyticsUsqlActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DataLakeAnalyticsUsqlActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataLakeAnalyticsUsqlActivityTypeProperties model = + BinaryData + .fromString( + "{\"scriptPath\":\"datalweozccdo\",\"scriptLinkedService\":{\"referenceName\":\"tjnktheh\",\"parameters\":{\"ciklbnroxgwqgbv\":\"datajraeiavdh\"}},\"degreeOfParallelism\":\"datatcbmn\",\"priority\":\"dataozvxdbztwkzfpuw\",\"parameters\":{\"kuviuxtyvpvegxdz\":\"datauixb\",\"zn\":\"datapfkzjxjn\",\"ntqvlktqsb\":\"dataxcjkteu\",\"jiktwfjyl\":\"dataurblbtvsxnaothlr\"},\"runtimeVersion\":\"datamibao\",\"compilationMode\":\"datalbznwegy\"}") + .toObject(DataLakeAnalyticsUsqlActivityTypeProperties.class); + Assertions.assertEquals("tjnktheh", model.scriptLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataLakeAnalyticsUsqlActivityTypeProperties model = + new DataLakeAnalyticsUsqlActivityTypeProperties() + .withScriptPath("datalweozccdo") + .withScriptLinkedService( + new LinkedServiceReference() + .withReferenceName("tjnktheh") + .withParameters(mapOf("ciklbnroxgwqgbv", "datajraeiavdh"))) + .withDegreeOfParallelism("datatcbmn") + .withPriority("dataozvxdbztwkzfpuw") + .withParameters( + mapOf( + "kuviuxtyvpvegxdz", + "datauixb", + "zn", + "datapfkzjxjn", + "ntqvlktqsb", + "dataxcjkteu", + "jiktwfjyl", + "dataurblbtvsxnaothlr")) + .withRuntimeVersion("datamibao") + .withCompilationMode("datalbznwegy"); + model = BinaryData.fromObject(model).toObject(DataLakeAnalyticsUsqlActivityTypeProperties.class); + Assertions.assertEquals("tjnktheh", model.scriptLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataMapperMappingTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataMapperMappingTests.java new file mode 100644 index 000000000000..17e4cb09fa96 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DataMapperMappingTests.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.DataMapperMapping; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMapping; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMappings; +import com.azure.resourcemanager.datafactory.models.MapperAttributeReference; +import com.azure.resourcemanager.datafactory.models.MapperConnectionReference; +import com.azure.resourcemanager.datafactory.models.MappingType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DataMapperMappingTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataMapperMapping model = + BinaryData + .fromString( + "{\"targetEntityName\":\"mhklbnl\",\"sourceEntityName\":\"vcb\",\"sourceConnectionReference\":{\"connectionName\":\"zyqu\",\"type\":\"linkedservicetype\"},\"attributeMappingInfo\":{\"attributeMappings\":[{\"name\":\"rp\",\"type\":\"Aggregate\",\"functionName\":\"yuuatvlmbjwcolbm\",\"expression\":\"b\",\"attributeReference\":{\"name\":\"pcpahprzrvxhmtf\",\"entity\":\"cnxzcmj\",\"entityConnectionReference\":{\"connectionName\":\"xnoqrxtdisn\",\"type\":\"linkedservicetype\"}},\"attributeReferences\":[{\"name\":\"mydidwhepfw\",\"entity\":\"jfdoesxxhm\",\"entityConnectionReference\":{}}]},{\"name\":\"bckyoikxk\",\"type\":\"Direct\",\"functionName\":\"gknjzr\",\"expression\":\"t\",\"attributeReference\":{\"name\":\"lvukaobrlb\",\"entity\":\"snbagnchjhg\",\"entityConnectionReference\":{\"connectionName\":\"owa\",\"type\":\"linkedservicetype\"}},\"attributeReferences\":[{\"name\":\"jymxcgqt\",\"entity\":\"drclssoljome\",\"entityConnectionReference\":{}},{\"name\":\"ycnlbvgjcodk\",\"entity\":\"ji\",\"entityConnectionReference\":{}}]}]},\"sourceDenormalizeInfo\":\"datas\"}") + .toObject(DataMapperMapping.class); + Assertions.assertEquals("mhklbnl", model.targetEntityName()); + Assertions.assertEquals("vcb", model.sourceEntityName()); + Assertions.assertEquals("zyqu", model.sourceConnectionReference().connectionName()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.sourceConnectionReference().type()); + Assertions.assertEquals("rp", model.attributeMappingInfo().attributeMappings().get(0).name()); + Assertions.assertEquals(MappingType.AGGREGATE, model.attributeMappingInfo().attributeMappings().get(0).type()); + Assertions + .assertEquals("yuuatvlmbjwcolbm", model.attributeMappingInfo().attributeMappings().get(0).functionName()); + Assertions.assertEquals("b", model.attributeMappingInfo().attributeMappings().get(0).expression()); + Assertions + .assertEquals( + "pcpahprzrvxhmtf", model.attributeMappingInfo().attributeMappings().get(0).attributeReference().name()); + Assertions + .assertEquals( + "cnxzcmj", model.attributeMappingInfo().attributeMappings().get(0).attributeReference().entity()); + Assertions + .assertEquals( + "xnoqrxtdisn", + model + .attributeMappingInfo() + .attributeMappings() + .get(0) + .attributeReference() + .entityConnectionReference() + .connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model + .attributeMappingInfo() + .attributeMappings() + .get(0) + .attributeReference() + .entityConnectionReference() + .type()); + Assertions + .assertEquals( + "mydidwhepfw", + model.attributeMappingInfo().attributeMappings().get(0).attributeReferences().get(0).name()); + Assertions + .assertEquals( + "jfdoesxxhm", + model.attributeMappingInfo().attributeMappings().get(0).attributeReferences().get(0).entity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataMapperMapping model = + new DataMapperMapping() + .withTargetEntityName("mhklbnl") + .withSourceEntityName("vcb") + .withSourceConnectionReference( + new MapperConnectionReference() + .withConnectionName("zyqu") + .withType(ConnectionType.LINKEDSERVICETYPE)) + .withAttributeMappingInfo( + new MapperAttributeMappings() + .withAttributeMappings( + Arrays + .asList( + new MapperAttributeMapping() + .withName("rp") + .withType(MappingType.AGGREGATE) + .withFunctionName("yuuatvlmbjwcolbm") + .withExpression("b") + .withAttributeReference( + new MapperAttributeReference() + .withName("pcpahprzrvxhmtf") + .withEntity("cnxzcmj") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("xnoqrxtdisn") + .withType(ConnectionType.LINKEDSERVICETYPE))) + .withAttributeReferences( + Arrays + .asList( + new MapperAttributeReference() + .withName("mydidwhepfw") + .withEntity("jfdoesxxhm") + .withEntityConnectionReference( + new MapperConnectionReference()))), + new MapperAttributeMapping() + .withName("bckyoikxk") + .withType(MappingType.DIRECT) + .withFunctionName("gknjzr") + .withExpression("t") + .withAttributeReference( + new MapperAttributeReference() + .withName("lvukaobrlb") + .withEntity("snbagnchjhg") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("owa") + .withType(ConnectionType.LINKEDSERVICETYPE))) + .withAttributeReferences( + Arrays + .asList( + new MapperAttributeReference() + .withName("jymxcgqt") + .withEntity("drclssoljome") + .withEntityConnectionReference(new MapperConnectionReference()), + new MapperAttributeReference() + .withName("ycnlbvgjcodk") + .withEntity("ji") + .withEntityConnectionReference( + new MapperConnectionReference())))))) + .withSourceDenormalizeInfo("datas"); + model = BinaryData.fromObject(model).toObject(DataMapperMapping.class); + Assertions.assertEquals("mhklbnl", model.targetEntityName()); + Assertions.assertEquals("vcb", model.sourceEntityName()); + Assertions.assertEquals("zyqu", model.sourceConnectionReference().connectionName()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.sourceConnectionReference().type()); + Assertions.assertEquals("rp", model.attributeMappingInfo().attributeMappings().get(0).name()); + Assertions.assertEquals(MappingType.AGGREGATE, model.attributeMappingInfo().attributeMappings().get(0).type()); + Assertions + .assertEquals("yuuatvlmbjwcolbm", model.attributeMappingInfo().attributeMappings().get(0).functionName()); + Assertions.assertEquals("b", model.attributeMappingInfo().attributeMappings().get(0).expression()); + Assertions + .assertEquals( + "pcpahprzrvxhmtf", model.attributeMappingInfo().attributeMappings().get(0).attributeReference().name()); + Assertions + .assertEquals( + "cnxzcmj", model.attributeMappingInfo().attributeMappings().get(0).attributeReference().entity()); + Assertions + .assertEquals( + "xnoqrxtdisn", + model + .attributeMappingInfo() + .attributeMappings() + .get(0) + .attributeReference() + .entityConnectionReference() + .connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model + .attributeMappingInfo() + .attributeMappings() + .get(0) + .attributeReference() + .entityConnectionReference() + .type()); + Assertions + .assertEquals( + "mydidwhepfw", + model.attributeMappingInfo().attributeMappings().get(0).attributeReferences().get(0).name()); + Assertions + .assertEquals( + "jfdoesxxhm", + model.attributeMappingInfo().attributeMappings().get(0).attributeReferences().get(0).entity()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksNotebookActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksNotebookActivityTests.java new file mode 100644 index 000000000000..caa9bdeea6b9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksNotebookActivityTests.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DatabricksNotebookActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DatabricksNotebookActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabricksNotebookActivity model = + BinaryData + .fromString( + "{\"type\":\"DatabricksNotebook\",\"typeProperties\":{\"notebookPath\":\"datakheh\",\"baseParameters\":{\"hhhexgxnmfo\":\"dataaxgemspnzq\",\"tycfostzdxb\":\"dataxiyzvfo\",\"ihtxgj\":\"datapglcbhahxsjxurrh\"},\"libraries\":[{\"mz\":\"datahujgrb\",\"scrfbdttcfwjzquw\":\"datagxjoimozsef\",\"uorzb\":\"datagfihlol\",\"yajijzrt\":\"datafefxvggkjbhsnyy\"},{\"el\":\"datangonhmblk\",\"emneu\":\"datajk\",\"kqvcf\":\"datapynenca\",\"pmvxcrzpdqw\":\"datargwxgczwxyghs\"},{\"fiwbtfki\":\"datahygbe\",\"zsxjrafhdf\":\"datalmfh\",\"nqijphh\":\"dataukaaw\",\"gwgqh\":\"datavf\"}]},\"linkedServiceName\":{\"referenceName\":\"easmk\",\"parameters\":{\"pwqbotlvcpcxxp\":\"dataodou\",\"fqfvrqruympo\":\"datartajlyd\"}},\"policy\":{\"timeout\":\"databqdwbjhgjzv\",\"retry\":\"datayxvfoyuykrdgg\",\"retryIntervalInSeconds\":1801534087,\"secureInput\":true,\"secureOutput\":true,\"\":{\"bkblopemorfzuhvy\":\"datahndbutptyabd\",\"zmzsfv\":\"datadnd\",\"vkmkbtp\":\"dataiskplnddpqcqi\"}},\"name\":\"wthzmqab\",\"description\":\"bg\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"mbxshrae\",\"dependencyConditions\":[\"Failed\",\"Skipped\",\"Failed\"],\"\":{\"uuoluldjeq\":\"datagqtzhrzeib\",\"mcy\":\"datamo\"}},{\"activity\":\"aqkeuraylygclwb\",\"dependencyConditions\":[\"Skipped\",\"Completed\",\"Succeeded\",\"Skipped\"],\"\":{\"dll\":\"dataexqvthfnhzgt\",\"azyhhcqjahhc\":\"dataunoelknyopglgk\"}}],\"userProperties\":[{\"name\":\"aryhcxmf\",\"value\":\"datagmqlcooyxfrrdbd\"},{\"name\":\"h\",\"value\":\"datafmycgucccb\"}],\"\":{\"chqigjamozlh\":\"datadbxlturlnbmj\",\"tegxnguvjryfcxsc\":\"datat\"}}") + .toObject(DatabricksNotebookActivity.class); + Assertions.assertEquals("wthzmqab", model.name()); + Assertions.assertEquals("bg", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("mbxshrae", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("aryhcxmf", model.userProperties().get(0).name()); + Assertions.assertEquals("easmk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1801534087, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabricksNotebookActivity model = + new DatabricksNotebookActivity() + .withName("wthzmqab") + .withDescription("bg") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("mbxshrae") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SKIPPED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("aqkeuraylygclwb") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("aryhcxmf").withValue("datagmqlcooyxfrrdbd"), + new UserProperty().withName("h").withValue("datafmycgucccb"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("easmk") + .withParameters(mapOf("pwqbotlvcpcxxp", "dataodou", "fqfvrqruympo", "datartajlyd"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("databqdwbjhgjzv") + .withRetry("datayxvfoyuykrdgg") + .withRetryIntervalInSeconds(1801534087) + .withSecureInput(true) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withNotebookPath("datakheh") + .withBaseParameters( + mapOf( + "hhhexgxnmfo", + "dataaxgemspnzq", + "tycfostzdxb", + "dataxiyzvfo", + "ihtxgj", + "datapglcbhahxsjxurrh")) + .withLibraries( + Arrays + .asList( + mapOf( + "mz", + "datahujgrb", + "scrfbdttcfwjzquw", + "datagxjoimozsef", + "uorzb", + "datagfihlol", + "yajijzrt", + "datafefxvggkjbhsnyy"), + mapOf( + "el", + "datangonhmblk", + "emneu", + "datajk", + "kqvcf", + "datapynenca", + "pmvxcrzpdqw", + "datargwxgczwxyghs"), + mapOf( + "fiwbtfki", + "datahygbe", + "zsxjrafhdf", + "datalmfh", + "nqijphh", + "dataukaaw", + "gwgqh", + "datavf"))); + model = BinaryData.fromObject(model).toObject(DatabricksNotebookActivity.class); + Assertions.assertEquals("wthzmqab", model.name()); + Assertions.assertEquals("bg", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("mbxshrae", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("aryhcxmf", model.userProperties().get(0).name()); + Assertions.assertEquals("easmk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1801534087, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksNotebookActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksNotebookActivityTypePropertiesTests.java new file mode 100644 index 000000000000..454de92bad51 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksNotebookActivityTypePropertiesTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DatabricksNotebookActivityTypeProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public final class DatabricksNotebookActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabricksNotebookActivityTypeProperties model = + BinaryData + .fromString( + "{\"notebookPath\":\"dataswytnoirie\",\"baseParameters\":{\"q\":\"datam\",\"svweu\":\"dataimnfgfsjptb\",\"fnhmrawmchcdegw\":\"datatoe\"},\"libraries\":[{\"thpg\":\"dataiewfjwfkw\",\"xf\":\"datamtahnimkndujyw\"},{\"slytmttjducosxc\":\"dataymuwa\",\"wpmpapwmpdsvkiwj\":\"datahtovtn\"},{\"lkj\":\"datafz\"}]}") + .toObject(DatabricksNotebookActivityTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabricksNotebookActivityTypeProperties model = + new DatabricksNotebookActivityTypeProperties() + .withNotebookPath("dataswytnoirie") + .withBaseParameters(mapOf("q", "datam", "svweu", "dataimnfgfsjptb", "fnhmrawmchcdegw", "datatoe")) + .withLibraries( + Arrays + .asList( + mapOf("thpg", "dataiewfjwfkw", "xf", "datamtahnimkndujyw"), + mapOf("slytmttjducosxc", "dataymuwa", "wpmpapwmpdsvkiwj", "datahtovtn"), + mapOf("lkj", "datafz"))); + model = BinaryData.fromObject(model).toObject(DatabricksNotebookActivityTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkJarActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkJarActivityTests.java new file mode 100644 index 000000000000..8587da3e883a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkJarActivityTests.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DatabricksSparkJarActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DatabricksSparkJarActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabricksSparkJarActivity model = + BinaryData + .fromString( + "{\"type\":\"DatabricksSparkJar\",\"typeProperties\":{\"mainClassName\":\"datavudigwky\",\"parameters\":[\"dataedgapraa\"],\"libraries\":[{\"upjgebnsuiklnc\":\"dataojt\",\"xyfpcvbl\":\"dataoyghrbabxywoj\",\"u\":\"dataeoynthxkqczm\"},{\"hvmez\":\"dataupifgizkvokkhr\",\"drtokw\":\"dataf\",\"wxctdpjuwujxxs\":\"datambonureklgunpajw\",\"ulnntji\":\"dataookhobzisqpst\"},{\"niac\":\"datan\",\"llk\":\"datattdyvifltvwebzf\",\"cerqhp\":\"datanwinqywlvxuxztj\"},{\"ayhp\":\"datakxjlyjlkjhmug\",\"soi\":\"datastlsdgiqgeeqcgu\",\"wkkykaz\":\"dataevrglzx\"}]},\"linkedServiceName\":{\"referenceName\":\"aqxnkdqsy\",\"parameters\":{\"gvhwkw\":\"dataktwk\",\"wikqkxduhydxahj\":\"dataxjezystirrhbkzz\",\"lwofo\":\"datadazmmgsx\",\"wlwhtpykfcccaujg\":\"datamyludflf\"}},\"policy\":{\"timeout\":\"datakjqupjxdbgmgxbv\",\"retry\":\"datamblntdy\",\"retryIntervalInSeconds\":349718519,\"secureInput\":false,\"secureOutput\":true,\"\":{\"vliqgawen\":\"datafscsrwliuteusu\",\"q\":\"datatmvzzs\",\"oc\":\"datavwgizvvtdr\",\"qdostvx\":\"datazgfnphfppjzmpxam\"}},\"name\":\"kfnmnfndrbkkoocp\",\"description\":\"s\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"paivkgdrqkvnp\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Failed\",\"Skipped\"],\"\":{\"xwzixmv\":\"datafwslvsparvhzfyn\",\"gigepfokslcnsxh\":\"datakuvbesrawzxnwxsj\",\"hdjarfdfnq\":\"dataqeyzzydpvvc\"}},{\"activity\":\"vrs\",\"dependencyConditions\":[\"Failed\",\"Skipped\",\"Succeeded\"],\"\":{\"edfpub\":\"datavbdqmj\",\"ybbor\":\"dataxoohyesmlscvhra\",\"dkufqzuduq\":\"datadxhkdy\",\"u\":\"datadeigxtplpgft\"}},{\"activity\":\"kfa\",\"dependencyConditions\":[\"Failed\",\"Completed\"],\"\":{\"jvvtead\":\"datalibszcvceglvzh\",\"azaoytkubmv\":\"datac\",\"kjrqsp\":\"datanumvorosqesspwu\"}},{\"activity\":\"siitzbyue\",\"dependencyConditions\":[\"Skipped\",\"Failed\"],\"\":{\"lmwduisrv\":\"datarovps\",\"e\":\"dataunyqe\"}}],\"userProperties\":[{\"name\":\"zthcfnrlesg\",\"value\":\"datahcfqzmjm\"}],\"\":{\"kmtrrc\":\"datazz\",\"dprqjsmh\":\"dataulvauxkgklqucxew\",\"qydllhimvnvx\":\"dataqzvarq\",\"k\":\"dataxzabxhmdorxbuap\"}}") + .toObject(DatabricksSparkJarActivity.class); + Assertions.assertEquals("kfnmnfndrbkkoocp", model.name()); + Assertions.assertEquals("s", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("paivkgdrqkvnp", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("zthcfnrlesg", model.userProperties().get(0).name()); + Assertions.assertEquals("aqxnkdqsy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(349718519, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabricksSparkJarActivity model = + new DatabricksSparkJarActivity() + .withName("kfnmnfndrbkkoocp") + .withDescription("s") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("paivkgdrqkvnp") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("vrs") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("kfa") + .withDependencyConditions( + Arrays.asList(DependencyCondition.FAILED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("siitzbyue") + .withDependencyConditions( + Arrays.asList(DependencyCondition.SKIPPED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties(Arrays.asList(new UserProperty().withName("zthcfnrlesg").withValue("datahcfqzmjm"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("aqxnkdqsy") + .withParameters( + mapOf( + "gvhwkw", + "dataktwk", + "wikqkxduhydxahj", + "dataxjezystirrhbkzz", + "lwofo", + "datadazmmgsx", + "wlwhtpykfcccaujg", + "datamyludflf"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datakjqupjxdbgmgxbv") + .withRetry("datamblntdy") + .withRetryIntervalInSeconds(349718519) + .withSecureInput(false) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withMainClassName("datavudigwky") + .withParameters(Arrays.asList("dataedgapraa")) + .withLibraries( + Arrays + .asList( + mapOf( + "upjgebnsuiklnc", "dataojt", "xyfpcvbl", "dataoyghrbabxywoj", "u", "dataeoynthxkqczm"), + mapOf( + "hvmez", + "dataupifgizkvokkhr", + "drtokw", + "dataf", + "wxctdpjuwujxxs", + "datambonureklgunpajw", + "ulnntji", + "dataookhobzisqpst"), + mapOf("niac", "datan", "llk", "datattdyvifltvwebzf", "cerqhp", "datanwinqywlvxuxztj"), + mapOf( + "ayhp", "datakxjlyjlkjhmug", "soi", "datastlsdgiqgeeqcgu", "wkkykaz", "dataevrglzx"))); + model = BinaryData.fromObject(model).toObject(DatabricksSparkJarActivity.class); + Assertions.assertEquals("kfnmnfndrbkkoocp", model.name()); + Assertions.assertEquals("s", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("paivkgdrqkvnp", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("zthcfnrlesg", model.userProperties().get(0).name()); + Assertions.assertEquals("aqxnkdqsy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(349718519, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkJarActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkJarActivityTypePropertiesTests.java new file mode 100644 index 000000000000..fe49907f42ef --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkJarActivityTypePropertiesTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DatabricksSparkJarActivityTypeProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public final class DatabricksSparkJarActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabricksSparkJarActivityTypeProperties model = + BinaryData + .fromString( + "{\"mainClassName\":\"dataoe\",\"parameters\":[\"datart\",\"databadrcy\",\"dataxbjaktg\",\"dataw\"],\"libraries\":[{\"ragqcwcdbtopuyi\":\"datahghorgji\",\"imhjbxwr\":\"databqdsuaazkouvvgcw\",\"z\":\"datagaofwo\"},{\"bnx\":\"datap\"},{\"uxjh\":\"datalysfsh\"}]}") + .toObject(DatabricksSparkJarActivityTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabricksSparkJarActivityTypeProperties model = + new DatabricksSparkJarActivityTypeProperties() + .withMainClassName("dataoe") + .withParameters(Arrays.asList("datart", "databadrcy", "dataxbjaktg", "dataw")) + .withLibraries( + Arrays + .asList( + mapOf( + "ragqcwcdbtopuyi", + "datahghorgji", + "imhjbxwr", + "databqdsuaazkouvvgcw", + "z", + "datagaofwo"), + mapOf("bnx", "datap"), + mapOf("uxjh", "datalysfsh"))); + model = BinaryData.fromObject(model).toObject(DatabricksSparkJarActivityTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkPythonActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkPythonActivityTests.java new file mode 100644 index 000000000000..0ce272004952 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkPythonActivityTests.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DatabricksSparkPythonActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DatabricksSparkPythonActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabricksSparkPythonActivity model = + BinaryData + .fromString( + "{\"type\":\"DatabricksSparkPython\",\"typeProperties\":{\"pythonFile\":\"datauzirhcghnclfahr\",\"parameters\":[\"datateuegrd\"],\"libraries\":[{\"miwoisqlsxzfycnp\":\"datatpqoajgg\"},{\"uaxfjuzgslqpzdx\":\"datanjzaaoxwcptoihoy\",\"zzscepoggzppufu\":\"datadanlgczvf\"},{\"uhjqdwlxabtlms\":\"dataaiecexy\",\"ipfqn\":\"dataqaud\"}]},\"linkedServiceName\":{\"referenceName\":\"kopivszejbptr\",\"parameters\":{\"vlo\":\"databzjem\",\"nbqsjzncg\":\"datauca\"}},\"policy\":{\"timeout\":\"dataqgivyxoj\",\"retry\":\"dataussvurslwdx\",\"retryIntervalInSeconds\":304981374,\"secureInput\":false,\"secureOutput\":true,\"\":{\"ksoqrhwl\":\"dataaq\"}},\"name\":\"nwhtwsxliwpzu\",\"description\":\"tzissrvt\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"ubh\",\"dependencyConditions\":[\"Skipped\",\"Skipped\",\"Completed\"],\"\":{\"ehyvq\":\"datagpzyqivu\",\"jtuoy\":\"datajbqfclijec\",\"xn\":\"datadlzxuakbavpk\",\"vsgx\":\"datarbckfzb\"}},{\"activity\":\"ijnvsjgnbdhhqs\",\"dependencyConditions\":[\"Failed\",\"Failed\"],\"\":{\"fjmi\":\"dataaxdyxjicikzmvdd\"}},{\"activity\":\"b\",\"dependencyConditions\":[\"Skipped\",\"Failed\"],\"\":{\"ymrfpqyxlncwagia\":\"dataisvpfspfdf\"}},{\"activity\":\"hzotko\",\"dependencyConditions\":[\"Succeeded\"],\"\":{\"zyl\":\"datar\",\"emsl\":\"datawymrmuioepi\"}}],\"userProperties\":[{\"name\":\"vryszqzve\",\"value\":\"datawnewmpwj\"},{\"name\":\"gryolbqcftrywdg\",\"value\":\"dataskdl\"},{\"name\":\"cfzyijnxvmcx\",\"value\":\"datajlpyhdxvdj\"},{\"name\":\"cuewtnqbqgfqivm\",\"value\":\"dataxwevdjmxvvtuky\"}],\"\":{\"moidinbfbkwyvw\":\"dataj\"}}") + .toObject(DatabricksSparkPythonActivity.class); + Assertions.assertEquals("nwhtwsxliwpzu", model.name()); + Assertions.assertEquals("tzissrvt", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("ubh", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("vryszqzve", model.userProperties().get(0).name()); + Assertions.assertEquals("kopivszejbptr", model.linkedServiceName().referenceName()); + Assertions.assertEquals(304981374, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabricksSparkPythonActivity model = + new DatabricksSparkPythonActivity() + .withName("nwhtwsxliwpzu") + .withDescription("tzissrvt") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ubh") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ijnvsjgnbdhhqs") + .withDependencyConditions( + Arrays.asList(DependencyCondition.FAILED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("b") + .withDependencyConditions( + Arrays.asList(DependencyCondition.SKIPPED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("hzotko") + .withDependencyConditions(Arrays.asList(DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("vryszqzve").withValue("datawnewmpwj"), + new UserProperty().withName("gryolbqcftrywdg").withValue("dataskdl"), + new UserProperty().withName("cfzyijnxvmcx").withValue("datajlpyhdxvdj"), + new UserProperty().withName("cuewtnqbqgfqivm").withValue("dataxwevdjmxvvtuky"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("kopivszejbptr") + .withParameters(mapOf("vlo", "databzjem", "nbqsjzncg", "datauca"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("dataqgivyxoj") + .withRetry("dataussvurslwdx") + .withRetryIntervalInSeconds(304981374) + .withSecureInput(false) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withPythonFile("datauzirhcghnclfahr") + .withParameters(Arrays.asList("datateuegrd")) + .withLibraries( + Arrays + .asList( + mapOf("miwoisqlsxzfycnp", "datatpqoajgg"), + mapOf("uaxfjuzgslqpzdx", "datanjzaaoxwcptoihoy", "zzscepoggzppufu", "datadanlgczvf"), + mapOf("uhjqdwlxabtlms", "dataaiecexy", "ipfqn", "dataqaud"))); + model = BinaryData.fromObject(model).toObject(DatabricksSparkPythonActivity.class); + Assertions.assertEquals("nwhtwsxliwpzu", model.name()); + Assertions.assertEquals("tzissrvt", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("ubh", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("vryszqzve", model.userProperties().get(0).name()); + Assertions.assertEquals("kopivszejbptr", model.linkedServiceName().referenceName()); + Assertions.assertEquals(304981374, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkPythonActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkPythonActivityTypePropertiesTests.java new file mode 100644 index 000000000000..e3994aba65f5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatabricksSparkPythonActivityTypePropertiesTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DatabricksSparkPythonActivityTypeProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public final class DatabricksSparkPythonActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabricksSparkPythonActivityTypeProperties model = + BinaryData + .fromString( + "{\"pythonFile\":\"datacgmfklqswwdbs\",\"parameters\":[\"dataysedqrbevobqrwng\"],\"libraries\":[{\"ycou\":\"dataquzxmtmsyi\",\"sdjkrosq\":\"dataks\",\"jgyjoklngjsglz\":\"datavffrncsw\",\"wsqdnasjup\":\"datai\"},{\"zbdtvrg\":\"dataakks\",\"iotvfcbgffd\":\"dataebvqslikeuqv\"},{\"lixhapvwacwrc\":\"dataffatyqawtfyzqop\"}]}") + .toObject(DatabricksSparkPythonActivityTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabricksSparkPythonActivityTypeProperties model = + new DatabricksSparkPythonActivityTypeProperties() + .withPythonFile("datacgmfklqswwdbs") + .withParameters(Arrays.asList("dataysedqrbevobqrwng")) + .withLibraries( + Arrays + .asList( + mapOf( + "ycou", + "dataquzxmtmsyi", + "sdjkrosq", + "dataks", + "jgyjoklngjsglz", + "datavffrncsw", + "wsqdnasjup", + "datai"), + mapOf("zbdtvrg", "dataakks", "iotvfcbgffd", "dataebvqslikeuqv"), + mapOf("lixhapvwacwrc", "dataffatyqawtfyzqop"))); + model = BinaryData.fromObject(model).toObject(DatabricksSparkPythonActivityTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetCompressionTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetCompressionTests.java new file mode 100644 index 000000000000..38fa205aa298 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetCompressionTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import java.util.HashMap; +import java.util.Map; + +public final class DatasetCompressionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatasetCompression model = + BinaryData + .fromString( + "{\"type\":\"datalweeprne\",\"level\":\"datal\",\"\":{\"bduxapgrcq\":\"dataszfjsxs\",\"dls\":\"databmvrdjomlnwsbv\"}}") + .toObject(DatasetCompression.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatasetCompression model = + new DatasetCompression().withType("datalweeprne").withLevel("datal").withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(DatasetCompression.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetDebugResourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetDebugResourceTests.java new file mode 100644 index 000000000000..12332d702e8c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetDebugResourceTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Dataset; +import com.azure.resourcemanager.datafactory.models.DatasetDebugResource; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DatasetDebugResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatasetDebugResource model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"Dataset\",\"description\":\"qmjxlyyzglgouwtl\",\"structure\":\"datajyuojqtobaxkjeyt\",\"schema\":\"datalbfjkwr\",\"linkedServiceName\":{\"referenceName\":\"snkq\",\"parameters\":{\"qunjqh\":\"datay\"}},\"parameters\":{\"ifmjnn\":{\"type\":\"Float\",\"defaultValue\":\"dataulkpakd\"},\"yirdhlisngwflqq\":{\"type\":\"String\",\"defaultValue\":\"dataqabpxuckpggqow\"}},\"annotations\":[\"datazruwn\",\"dataqxpxiwfcngjsaa\",\"dataiixtmkzj\",\"datakv\"],\"folder\":{\"name\":\"hgfgrwsd\"},\"\":{\"bglbyvict\":\"dataatzv\"}},\"name\":\"brxkjzwr\"}") + .toObject(DatasetDebugResource.class); + Assertions.assertEquals("brxkjzwr", model.name()); + Assertions.assertEquals("qmjxlyyzglgouwtl", model.properties().description()); + Assertions.assertEquals("snkq", model.properties().linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.properties().parameters().get("ifmjnn").type()); + Assertions.assertEquals("hgfgrwsd", model.properties().folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatasetDebugResource model = + new DatasetDebugResource() + .withName("brxkjzwr") + .withProperties( + new Dataset() + .withDescription("qmjxlyyzglgouwtl") + .withStructure("datajyuojqtobaxkjeyt") + .withSchema("datalbfjkwr") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("snkq") + .withParameters(mapOf("qunjqh", "datay"))) + .withParameters( + mapOf( + "ifmjnn", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("dataulkpakd"), + "yirdhlisngwflqq", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("dataqabpxuckpggqow"))) + .withAnnotations(Arrays.asList("datazruwn", "dataqxpxiwfcngjsaa", "dataiixtmkzj", "datakv")) + .withFolder(new DatasetFolder().withName("hgfgrwsd")) + .withAdditionalProperties(mapOf("type", "Dataset"))); + model = BinaryData.fromObject(model).toObject(DatasetDebugResource.class); + Assertions.assertEquals("brxkjzwr", model.name()); + Assertions.assertEquals("qmjxlyyzglgouwtl", model.properties().description()); + Assertions.assertEquals("snkq", model.properties().linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.properties().parameters().get("ifmjnn").type()); + Assertions.assertEquals("hgfgrwsd", model.properties().folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetFolderTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetFolderTests.java new file mode 100644 index 000000000000..9a1b172e92b5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetFolderTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import org.junit.jupiter.api.Assertions; + +public final class DatasetFolderTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatasetFolder model = BinaryData.fromString("{\"name\":\"eyvpnqicvinvkj\"}").toObject(DatasetFolder.class); + Assertions.assertEquals("eyvpnqicvinvkj", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatasetFolder model = new DatasetFolder().withName("eyvpnqicvinvkj"); + model = BinaryData.fromObject(model).toObject(DatasetFolder.class); + Assertions.assertEquals("eyvpnqicvinvkj", model.name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetListResponseTests.java new file mode 100644 index 000000000000..e671c9d82915 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetListResponseTests.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DatasetResourceInner; +import com.azure.resourcemanager.datafactory.models.Dataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetListResponse; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DatasetListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatasetListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"type\":\"Dataset\",\"description\":\"uxvypomgkopkwh\",\"structure\":\"datav\",\"schema\":\"datajqg\",\"linkedServiceName\":{\"referenceName\":\"ysmocmbqfqvmkcxo\",\"parameters\":{\"kcbcue\":\"datavhelxprglyatdd\",\"hos\":\"datarjxgciqib\",\"ibahwflus\":\"datasdqrhzoymibmrq\"}},\"parameters\":{\"piexpbtgiw\":{\"type\":\"Object\",\"defaultValue\":\"datarkwofyyvoqa\"},\"tdtkcn\":{\"type\":\"Object\",\"defaultValue\":\"dataenwash\"},\"i\":{\"type\":\"Float\",\"defaultValue\":\"databpokulpiujwaasip\"},\"rpqlp\":{\"type\":\"Int\",\"defaultValue\":\"datayuq\"}},\"annotations\":[\"dataciuqgbdb\",\"datat\",\"datauvfbtkuwh\",\"datamhykojoxafnndl\"],\"folder\":{\"name\":\"hkoymkcdyhbp\"},\"\":{\"xywsuws\":\"datawdreqnovvqfovl\",\"aeneqnzarrwl\":\"datarsndsytgadgvra\",\"jfqka\":\"datauu\"}},\"name\":\"wiipfpub\",\"type\":\"bwwift\",\"etag\":\"qkvpuvksgplsakn\",\"id\":\"fsynljphuop\"},{\"properties\":{\"type\":\"Dataset\",\"description\":\"dlqiyntorzih\",\"structure\":\"dataosjswsr\",\"schema\":\"datalyzrpzbchckqqzqi\",\"linkedServiceName\":{\"referenceName\":\"xiy\",\"parameters\":{\"ynkedyatrwyhqmib\":\"datai\",\"mnzgmwznmabi\":\"datayhwitsmypyynpcdp\",\"wwrlkdmtncv\":\"datansorgjhxbldt\",\"xdy\":\"datakotl\"}},\"parameters\":{\"hadoocrk\":{\"type\":\"Array\",\"defaultValue\":\"datacogjltdtbn\"},\"gxqquezik\":{\"type\":\"Object\",\"defaultValue\":\"datakhnvpam\"},\"lla\":{\"type\":\"Int\",\"defaultValue\":\"datagxk\"},\"ccjzkzivgvv\":{\"type\":\"Bool\",\"defaultValue\":\"datalwuip\"}},\"annotations\":[\"datay\",\"datahyrnxxmu\"],\"folder\":{\"name\":\"ndrdvstkwq\"},\"\":{\"ygdvwv\":\"datahealmfmtda\"}},\"name\":\"iohgwxrtfud\",\"type\":\"pxgy\",\"etag\":\"gvr\",\"id\":\"npkukghimdblx\"}],\"nextLink\":\"imfnjhfjx\"}") + .toObject(DatasetListResponse.class); + Assertions.assertEquals("fsynljphuop", model.value().get(0).id()); + Assertions.assertEquals("uxvypomgkopkwh", model.value().get(0).properties().description()); + Assertions + .assertEquals("ysmocmbqfqvmkcxo", model.value().get(0).properties().linkedServiceName().referenceName()); + Assertions + .assertEquals( + ParameterType.OBJECT, model.value().get(0).properties().parameters().get("piexpbtgiw").type()); + Assertions.assertEquals("hkoymkcdyhbp", model.value().get(0).properties().folder().name()); + Assertions.assertEquals("imfnjhfjx", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatasetListResponse model = + new DatasetListResponse() + .withValue( + Arrays + .asList( + new DatasetResourceInner() + .withId("fsynljphuop") + .withProperties( + new Dataset() + .withDescription("uxvypomgkopkwh") + .withStructure("datav") + .withSchema("datajqg") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ysmocmbqfqvmkcxo") + .withParameters( + mapOf( + "kcbcue", + "datavhelxprglyatdd", + "hos", + "datarjxgciqib", + "ibahwflus", + "datasdqrhzoymibmrq"))) + .withParameters( + mapOf( + "piexpbtgiw", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("datarkwofyyvoqa"), + "tdtkcn", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("dataenwash"), + "i", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("databpokulpiujwaasip"), + "rpqlp", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datayuq"))) + .withAnnotations( + Arrays + .asList("dataciuqgbdb", "datat", "datauvfbtkuwh", "datamhykojoxafnndl")) + .withFolder(new DatasetFolder().withName("hkoymkcdyhbp")) + .withAdditionalProperties(mapOf("type", "Dataset"))), + new DatasetResourceInner() + .withId("npkukghimdblx") + .withProperties( + new Dataset() + .withDescription("dlqiyntorzih") + .withStructure("dataosjswsr") + .withSchema("datalyzrpzbchckqqzqi") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("xiy") + .withParameters( + mapOf( + "ynkedyatrwyhqmib", + "datai", + "mnzgmwznmabi", + "datayhwitsmypyynpcdp", + "wwrlkdmtncv", + "datansorgjhxbldt", + "xdy", + "datakotl"))) + .withParameters( + mapOf( + "hadoocrk", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datacogjltdtbn"), + "gxqquezik", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("datakhnvpam"), + "lla", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datagxk"), + "ccjzkzivgvv", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datalwuip"))) + .withAnnotations(Arrays.asList("datay", "datahyrnxxmu")) + .withFolder(new DatasetFolder().withName("ndrdvstkwq")) + .withAdditionalProperties(mapOf("type", "Dataset"))))) + .withNextLink("imfnjhfjx"); + model = BinaryData.fromObject(model).toObject(DatasetListResponse.class); + Assertions.assertEquals("fsynljphuop", model.value().get(0).id()); + Assertions.assertEquals("uxvypomgkopkwh", model.value().get(0).properties().description()); + Assertions + .assertEquals("ysmocmbqfqvmkcxo", model.value().get(0).properties().linkedServiceName().referenceName()); + Assertions + .assertEquals( + ParameterType.OBJECT, model.value().get(0).properties().parameters().get("piexpbtgiw").type()); + Assertions.assertEquals("hkoymkcdyhbp", model.value().get(0).properties().folder().name()); + Assertions.assertEquals("imfnjhfjx", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetLocationTests.java new file mode 100644 index 000000000000..06a466daf90e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetLocationTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetLocation; +import java.util.HashMap; +import java.util.Map; + +public final class DatasetLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatasetLocation model = + BinaryData + .fromString( + "{\"type\":\"DatasetLocation\",\"folderPath\":\"datasx\",\"fileName\":\"dataofuworimmovzwde\",\"\":{\"elgwewi\":\"datamvhzfovanyrvaprt\",\"j\":\"datafyaqandmymnqo\"}}") + .toObject(DatasetLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatasetLocation model = + new DatasetLocation() + .withFolderPath("datasx") + .withFileName("dataofuworimmovzwde") + .withAdditionalProperties(mapOf("type", "DatasetLocation")); + model = BinaryData.fromObject(model).toObject(DatasetLocation.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetReferenceTests.java new file mode 100644 index 000000000000..204e62f697ef --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetReferenceTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DatasetReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatasetReference model = + BinaryData + .fromString( + "{\"referenceName\":\"ezxlhdjzqdca\",\"parameters\":{\"iybmrzoep\":\"datapsozjiihj\",\"gv\":\"dataxwdvwnj\",\"ursqf\":\"datanmx\"}}") + .toObject(DatasetReference.class); + Assertions.assertEquals("ezxlhdjzqdca", model.referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatasetReference model = + new DatasetReference() + .withReferenceName("ezxlhdjzqdca") + .withParameters(mapOf("iybmrzoep", "datapsozjiihj", "gv", "dataxwdvwnj", "ursqf", "datanmx")); + model = BinaryData.fromObject(model).toObject(DatasetReference.class); + Assertions.assertEquals("ezxlhdjzqdca", model.referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetResourceInnerTests.java new file mode 100644 index 000000000000..4a8123493af1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetResourceInnerTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DatasetResourceInner; +import com.azure.resourcemanager.datafactory.models.Dataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DatasetResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatasetResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"Dataset\",\"description\":\"szkkfoqre\",\"structure\":\"datakzikfjawneaivxwc\",\"schema\":\"datalpcirelsf\",\"linkedServiceName\":{\"referenceName\":\"aenwabf\",\"parameters\":{\"nozj\":\"datalddxbjhwua\"}},\"parameters\":{\"ag\":{\"type\":\"Array\",\"defaultValue\":\"dataoulpjrv\"}},\"annotations\":[\"dataimjwosyt\",\"dataitc\"],\"folder\":{\"name\":\"cktqumiekkezzi\"},\"\":{\"hdgqggeb\":\"datayf\"}},\"name\":\"nyga\",\"type\":\"idb\",\"etag\":\"atpxl\",\"id\":\"xcyjmoadsuvarmy\"}") + .toObject(DatasetResourceInner.class); + Assertions.assertEquals("xcyjmoadsuvarmy", model.id()); + Assertions.assertEquals("szkkfoqre", model.properties().description()); + Assertions.assertEquals("aenwabf", model.properties().linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.properties().parameters().get("ag").type()); + Assertions.assertEquals("cktqumiekkezzi", model.properties().folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatasetResourceInner model = + new DatasetResourceInner() + .withId("xcyjmoadsuvarmy") + .withProperties( + new Dataset() + .withDescription("szkkfoqre") + .withStructure("datakzikfjawneaivxwc") + .withSchema("datalpcirelsf") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("aenwabf") + .withParameters(mapOf("nozj", "datalddxbjhwua"))) + .withParameters( + mapOf( + "ag", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("dataoulpjrv"))) + .withAnnotations(Arrays.asList("dataimjwosyt", "dataitc")) + .withFolder(new DatasetFolder().withName("cktqumiekkezzi")) + .withAdditionalProperties(mapOf("type", "Dataset"))); + model = BinaryData.fromObject(model).toObject(DatasetResourceInner.class); + Assertions.assertEquals("xcyjmoadsuvarmy", model.id()); + Assertions.assertEquals("szkkfoqre", model.properties().description()); + Assertions.assertEquals("aenwabf", model.properties().linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.properties().parameters().get("ag").type()); + Assertions.assertEquals("cktqumiekkezzi", model.properties().folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetSchemaDataElementTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetSchemaDataElementTests.java new file mode 100644 index 000000000000..37215445a55b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetSchemaDataElementTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetSchemaDataElement; +import java.util.HashMap; +import java.util.Map; + +public final class DatasetSchemaDataElementTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatasetSchemaDataElement model = + BinaryData + .fromString( + "{\"name\":\"datadivznl\",\"type\":\"dataslkskhjqjpvbai\",\"\":{\"ywbqgroigbsfsgs\":\"datatgzgta\",\"fmhl\":\"dataenwl\",\"tryldsxebuhsxr\":\"dataqlxspmrj\"}}") + .toObject(DatasetSchemaDataElement.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatasetSchemaDataElement model = + new DatasetSchemaDataElement() + .withName("datadivznl") + .withType("dataslkskhjqjpvbai") + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(DatasetSchemaDataElement.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetStorageFormatTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetStorageFormatTests.java new file mode 100644 index 000000000000..987dda71b3e3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetStorageFormatTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import java.util.HashMap; +import java.util.Map; + +public final class DatasetStorageFormatTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatasetStorageFormat model = + BinaryData + .fromString( + "{\"type\":\"DatasetStorageFormat\",\"serializer\":\"datamgsdaluyckhefrbh\",\"deserializer\":\"datauerbgpxebjl\",\"\":{\"tnsewou\":\"dataaytujraxdtpryjm\",\"s\":\"dataly\",\"lmpctwj\":\"datavyljurkeposehqq\",\"erxxxoteehkhowgo\":\"datadsdlzmk\"}}") + .toObject(DatasetStorageFormat.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatasetStorageFormat model = + new DatasetStorageFormat() + .withSerializer("datamgsdaluyckhefrbh") + .withDeserializer("datauerbgpxebjl") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat")); + model = BinaryData.fromObject(model).toObject(DatasetStorageFormat.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetTests.java new file mode 100644 index 000000000000..376708f5af65 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Dataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Dataset model = + BinaryData + .fromString( + "{\"type\":\"Dataset\",\"description\":\"mjsjqb\",\"structure\":\"datahyxxrwlycoduhpk\",\"schema\":\"datagymare\",\"linkedServiceName\":{\"referenceName\":\"n\",\"parameters\":{\"dgssofwqmzqal\":\"dataqugjhkycube\",\"cqqudf\":\"datarmnjijpx\",\"ayffim\":\"databyxbaaabjy\",\"gsexne\":\"datazrtuzq\"}},\"parameters\":{\"ewzsyyceuzsoib\":{\"type\":\"Int\",\"defaultValue\":\"datanw\"}},\"annotations\":[\"datapfrxtrthzvay\",\"datadwkqbrq\",\"databpaxhexiilivpdt\",\"datairqtdqoa\"],\"folder\":{\"name\":\"uzf\"},\"\":{\"zwl\":\"datauyfxrxxleptramxj\",\"tdooaoj\":\"datanwxuqlcvydyp\"}}") + .toObject(Dataset.class); + Assertions.assertEquals("mjsjqb", model.description()); + Assertions.assertEquals("n", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("ewzsyyceuzsoib").type()); + Assertions.assertEquals("uzf", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Dataset model = + new Dataset() + .withDescription("mjsjqb") + .withStructure("datahyxxrwlycoduhpk") + .withSchema("datagymare") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("n") + .withParameters( + mapOf( + "dgssofwqmzqal", + "dataqugjhkycube", + "cqqudf", + "datarmnjijpx", + "ayffim", + "databyxbaaabjy", + "gsexne", + "datazrtuzq"))) + .withParameters( + mapOf( + "ewzsyyceuzsoib", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datanw"))) + .withAnnotations( + Arrays.asList("datapfrxtrthzvay", "datadwkqbrq", "databpaxhexiilivpdt", "datairqtdqoa")) + .withFolder(new DatasetFolder().withName("uzf")) + .withAdditionalProperties(mapOf("type", "Dataset")); + model = BinaryData.fromObject(model).toObject(Dataset.class); + Assertions.assertEquals("mjsjqb", model.description()); + Assertions.assertEquals("n", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("ewzsyyceuzsoib").type()); + Assertions.assertEquals("uzf", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..7e247b8fbc38 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.Dataset; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetResource; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +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 org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DatasetsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"Dataset\",\"description\":\"eaotaakcyfsxosnb\",\"structure\":\"datacnfosjndbww\",\"schema\":\"datagaoubtehdccghdzq\",\"linkedServiceName\":{\"referenceName\":\"wlixh\",\"parameters\":{\"s\":\"dataqsprnhlsfhfjwa\",\"dj\":\"dataqytfvjvmjhuvuad\"}},\"parameters\":{\"w\":{\"type\":\"Bool\",\"defaultValue\":\"dataeij\"},\"kfslm\":{\"type\":\"Float\",\"defaultValue\":\"datauwaqiomdlp\"},\"vywbobgwvhd\":{\"type\":\"Float\",\"defaultValue\":\"datawmwrnkuwgr\"}},\"annotations\":[\"datavyyppayca\",\"datac\",\"datahf\",\"dataidkdywp\"],\"folder\":{\"name\":\"ssvmdoxxcvug\"},\"\":{\"yuukhssretugorc\":\"datak\",\"dwktogmcblwh\":\"datakcsevq\",\"kc\":\"datavnisin\"}},\"name\":\"pukabjaja\",\"type\":\"gaczggfiaqmupt\",\"etag\":\"uybtmt\",\"id\":\"ohyozxotwraln\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + DatasetResource response = + manager + .datasets() + .define("bzzyqbw") + .withExistingFactory("hzem", "jast") + .withProperties( + new Dataset() + .withDescription("zjhmg") + .withStructure("dataalgrakmwy") + .withSchema("datakfimonreukcrcsda") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("pnhpovrt") + .withParameters( + mapOf( + "rrlzdnc", + "databybcx", + "ikoiujsjngsfv", + "dataxtqqpfgjnynu", + "puclqtd", + "datav", + "jkczkcd", + "dataasjnzeckpg"))) + .withParameters( + mapOf( + "kzspwvlqinl", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datatwanabzycxvi"), + "vkwxbb", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("dataeevzelmmwmdhm"), + "no", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datakpn"), + "zrfonqjnpkofj", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("dataztpwujmuntvyeyeb"))) + .withAnnotations(Arrays.asList("dataneyuirr", "dataxrftfamozyv")) + .withFolder(new DatasetFolder().withName("cflp")) + .withAdditionalProperties(mapOf("type", "Dataset"))) + .withIfMatch("tmxyrsnmwiy") + .create(); + + Assertions.assertEquals("ohyozxotwraln", response.id()); + Assertions.assertEquals("eaotaakcyfsxosnb", response.properties().description()); + Assertions.assertEquals("wlixh", response.properties().linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, response.properties().parameters().get("w").type()); + Assertions.assertEquals("ssvmdoxxcvug", response.properties().folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..889f206c0615 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DatasetsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .datasets() + .deleteWithResponse("wntrqvlcun", "baijobcpruommt", "cazgrlvkda", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsGetWithResponseMockTests.java new file mode 100644 index 000000000000..e3f81c6448a7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsGetWithResponseMockTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.DatasetResource; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DatasetsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"Dataset\",\"description\":\"om\",\"structure\":\"dataioatzmr\",\"schema\":\"datasrjjajlr\",\"linkedServiceName\":{\"referenceName\":\"lmj\",\"parameters\":{\"pytfdzkbkyt\":\"datawqpnmcwes\",\"dkrmpljzrzvl\":\"dataztwwkvwpbdo\"}},\"parameters\":{\"rlug\":{\"type\":\"Bool\",\"defaultValue\":\"datalygy\"}},\"annotations\":[\"datawh\",\"dataeqzlvjlsyzzk\"],\"folder\":{\"name\":\"eydjagyks\"},\"\":{\"jbxh\":\"datagiwaaz\",\"lx\":\"dataahgbloeaewidum\",\"majirnqcbhviqwfc\":\"datacgbyx\"}},\"name\":\"y\",\"type\":\"afoor\",\"etag\":\"ktdgbombn\",\"id\":\"nxkcp\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + DatasetResource response = + manager + .datasets() + .getWithResponse("ccnubynr", "encgfz", "btzuddqt", "hxtbcqjvyzotxkhy", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("nxkcp", response.id()); + Assertions.assertEquals("om", response.properties().description()); + Assertions.assertEquals("lmj", response.properties().linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, response.properties().parameters().get("rlug").type()); + Assertions.assertEquals("eydjagyks", response.properties().folder().name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsListByFactoryMockTests.java new file mode 100644 index 000000000000..bb75bb88c8e8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DatasetsListByFactoryMockTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.DatasetResource; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DatasetsListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"type\":\"Dataset\",\"description\":\"mhewdfualgkfo\",\"structure\":\"dataqm\",\"schema\":\"datauyim\",\"linkedServiceName\":{\"referenceName\":\"oprkpdghqsatbebx\",\"parameters\":{\"xxvlss\":\"datayyengnhoxbpqzqaa\",\"vqtogkxdevkn\":\"dataptxdrajihqwfrt\"}},\"parameters\":{\"uizvvwyhs\":{\"type\":\"Bool\",\"defaultValue\":\"datasqobrentjyamijg\"},\"ibwkiwyt\":{\"type\":\"Bool\",\"defaultValue\":\"datahzaiu\"},\"xlhdindcttiq\":{\"type\":\"Array\",\"defaultValue\":\"databrejvwwbx\"}},\"annotations\":[\"datay\",\"datajli\"],\"folder\":{\"name\":\"xrevw\"},\"\":{\"ufzna\":\"datatfohcylvj\",\"dphyxlxvo\":\"datadzyuxrufwdbimj\",\"aufabtpcbnt\":\"datacuwdesytt\"}},\"name\":\"nkvsnsi\",\"type\":\"llwcedzodv\",\"etag\":\"xtzgxdxq\",\"id\":\"uzubntuimi\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.datasets().listByFactory("ahe", "lmiuprfqyrwtdnr", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("uzubntuimi", response.iterator().next().id()); + Assertions.assertEquals("mhewdfualgkfo", response.iterator().next().properties().description()); + Assertions + .assertEquals( + "oprkpdghqsatbebx", response.iterator().next().properties().linkedServiceName().referenceName()); + Assertions + .assertEquals( + ParameterType.BOOL, response.iterator().next().properties().parameters().get("uizvvwyhs").type()); + Assertions.assertEquals("xrevw", response.iterator().next().properties().folder().name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Db2SourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Db2SourceTests.java new file mode 100644 index 000000000000..f7f5abe7702d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Db2SourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Db2Source; + +public final class Db2SourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Db2Source model = + BinaryData + .fromString( + "{\"type\":\"Db2Source\",\"query\":\"dataz\",\"queryTimeout\":\"datanniarjezj\",\"additionalColumns\":\"dataxiqfoqwesqykqfs\",\"sourceRetryCount\":\"datalsaipshhet\",\"sourceRetryWait\":\"datawmzgvnojgmobkali\",\"maxConcurrentConnections\":\"dataikkehpdssvlubd\",\"disableMetricsCollection\":\"dataowxsxbxd\",\"\":{\"tghmtb\":\"dataxurcekcqmjqqau\",\"shlhe\":\"datafkcnkghkrbi\"}}") + .toObject(Db2Source.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Db2Source model = + new Db2Source() + .withSourceRetryCount("datalsaipshhet") + .withSourceRetryWait("datawmzgvnojgmobkali") + .withMaxConcurrentConnections("dataikkehpdssvlubd") + .withDisableMetricsCollection("dataowxsxbxd") + .withQueryTimeout("datanniarjezj") + .withAdditionalColumns("dataxiqfoqwesqykqfs") + .withQuery("dataz"); + model = BinaryData.fromObject(model).toObject(Db2Source.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Db2TableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Db2TableDatasetTests.java new file mode 100644 index 000000000000..8bd085a4cc76 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Db2TableDatasetTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.Db2TableDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class Db2TableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Db2TableDataset model = + BinaryData + .fromString( + "{\"type\":\"Db2Table\",\"typeProperties\":{\"tableName\":\"dataefeclflxcj\",\"schema\":\"datazwncvdefxonz\",\"table\":\"datacjptnn\"},\"description\":\"rcjqpzj\",\"structure\":\"datapjrrhpgsjbioag\",\"schema\":\"datai\",\"linkedServiceName\":{\"referenceName\":\"ehmdqvaolidxd\",\"parameters\":{\"rsvxphtjnhptj\":\"datavkjcim\",\"yzhimm\":\"datarkd\",\"izuzjd\":\"datadtdtft\",\"kqoyimxpggk\":\"datargyzcslazp\"}},\"parameters\":{\"deylpbyb\":{\"type\":\"Bool\",\"defaultValue\":\"databgacnqpjuytv\"},\"ifm\":{\"type\":\"Int\",\"defaultValue\":\"datab\"},\"au\":{\"type\":\"Array\",\"defaultValue\":\"datapwdj\"},\"aaaxx\":{\"type\":\"Int\",\"defaultValue\":\"datahznurttu\"}},\"annotations\":[\"datajmdkqtxfrm\",\"dataecxstowa\",\"dataehxuihwes\"],\"folder\":{\"name\":\"aqgblkkncyp\"},\"\":{\"piobnhrfbrjokjwq\":\"datavspsaneyvae\",\"zwfwlrfdjwlzseod\":\"datamraqnilppqcaig\",\"zy\":\"dataqfdrs\"}}") + .toObject(Db2TableDataset.class); + Assertions.assertEquals("rcjqpzj", model.description()); + Assertions.assertEquals("ehmdqvaolidxd", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("deylpbyb").type()); + Assertions.assertEquals("aqgblkkncyp", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Db2TableDataset model = + new Db2TableDataset() + .withDescription("rcjqpzj") + .withStructure("datapjrrhpgsjbioag") + .withSchema("datai") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ehmdqvaolidxd") + .withParameters( + mapOf( + "rsvxphtjnhptj", + "datavkjcim", + "yzhimm", + "datarkd", + "izuzjd", + "datadtdtft", + "kqoyimxpggk", + "datargyzcslazp"))) + .withParameters( + mapOf( + "deylpbyb", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("databgacnqpjuytv"), + "ifm", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datab"), + "au", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datapwdj"), + "aaaxx", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datahznurttu"))) + .withAnnotations(Arrays.asList("datajmdkqtxfrm", "dataecxstowa", "dataehxuihwes")) + .withFolder(new DatasetFolder().withName("aqgblkkncyp")) + .withTableName("dataefeclflxcj") + .withSchemaTypePropertiesSchema("datazwncvdefxonz") + .withTable("datacjptnn"); + model = BinaryData.fromObject(model).toObject(Db2TableDataset.class); + Assertions.assertEquals("rcjqpzj", model.description()); + Assertions.assertEquals("ehmdqvaolidxd", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("deylpbyb").type()); + Assertions.assertEquals("aqgblkkncyp", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Db2TableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Db2TableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..9136b9ab3662 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Db2TableDatasetTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.Db2TableDatasetTypeProperties; + +public final class Db2TableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Db2TableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"dataxserw\",\"schema\":\"datauhytjwgetfi\",\"table\":\"datan\"}") + .toObject(Db2TableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Db2TableDatasetTypeProperties model = + new Db2TableDatasetTypeProperties() + .withTableName("dataxserw") + .withSchema("datauhytjwgetfi") + .withTable("datan"); + model = BinaryData.fromObject(model).toObject(Db2TableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DeleteActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DeleteActivityTests.java new file mode 100644 index 000000000000..dd7124f3214f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DeleteActivityTests.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.DeleteActivity; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogStorageSettings; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DeleteActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DeleteActivity model = + BinaryData + .fromString( + "{\"type\":\"Delete\",\"typeProperties\":{\"recursive\":\"datajfkj\",\"maxConcurrentConnections\":1126063384,\"enableLogging\":\"datag\",\"logStorageSettings\":{\"linkedServiceName\":{\"referenceName\":\"ztcxyphdkxwst\",\"parameters\":{\"dgwezc\":\"dataejopvegmtgoeayho\",\"wqgkfxcdt\":\"datassmbdjzcfdpx\"}},\"path\":\"datayevvuddnwj\",\"logLevel\":\"datacsflemxbma\",\"enableReliableLogging\":\"datavopft\",\"\":{\"o\":\"dataevh\",\"sis\":\"datajpumpqlugzydylf\"}},\"dataset\":{\"referenceName\":\"dmfo\",\"parameters\":{\"tkprbm\":\"datasvfnxxkmrfz\"}},\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datarfhfjwikva\",\"disableMetricsCollection\":\"dataxd\",\"\":{\"fardjqwdrooooobs\":\"datailvajctpwlf\",\"qcme\":\"datadqv\"}}},\"linkedServiceName\":{\"referenceName\":\"ajjzxcqnlsxe\",\"parameters\":{\"adyelwol\":\"dataw\"}},\"policy\":{\"timeout\":\"datauhanfjrdca\",\"retry\":\"datazqldakbijcxctn\",\"retryIntervalInSeconds\":1648895814,\"secureInput\":true,\"secureOutput\":true,\"\":{\"lnuhocbbeoxoewp\":\"datawsidnqiavoyhno\",\"yuasstokzhmyayb\":\"datatzofcurnhujcu\",\"xksph\":\"datamcenjctcxamup\"}},\"name\":\"yubytslfmajswrf\",\"description\":\"tgvkqzul\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"hejualugyuxc\",\"dependencyConditions\":[\"Completed\",\"Completed\",\"Succeeded\",\"Succeeded\"],\"\":{\"jdmesoxjkp\":\"datassyzwtzdyzufgnns\",\"pbiou\":\"databgfhjwchv\"}},{\"activity\":\"qoxbxtwsreadg\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\",\"Succeeded\"],\"\":{\"onnfjg\":\"dataqzmheimsi\"}},{\"activity\":\"tkegrtvwffvbvuxp\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Failed\",\"Completed\"],\"\":{\"djkanizd\":\"databzykk\",\"frm\":\"datajxgzpmwx\"}}],\"userProperties\":[{\"name\":\"wbahi\",\"value\":\"datafosbr\"}],\"\":{\"hucawmhbqjllyzbq\":\"datawhlqydhhypu\"}}") + .toObject(DeleteActivity.class); + Assertions.assertEquals("yubytslfmajswrf", model.name()); + Assertions.assertEquals("tgvkqzul", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("hejualugyuxc", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("wbahi", model.userProperties().get(0).name()); + Assertions.assertEquals("ajjzxcqnlsxe", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1648895814, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals(1126063384, model.maxConcurrentConnections()); + Assertions.assertEquals("ztcxyphdkxwst", model.logStorageSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("dmfo", model.dataset().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DeleteActivity model = + new DeleteActivity() + .withName("yubytslfmajswrf") + .withDescription("tgvkqzul") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("hejualugyuxc") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("qoxbxtwsreadg") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("tkegrtvwffvbvuxp") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties(Arrays.asList(new UserProperty().withName("wbahi").withValue("datafosbr"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ajjzxcqnlsxe") + .withParameters(mapOf("adyelwol", "dataw"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datauhanfjrdca") + .withRetry("datazqldakbijcxctn") + .withRetryIntervalInSeconds(1648895814) + .withSecureInput(true) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withRecursive("datajfkj") + .withMaxConcurrentConnections(1126063384) + .withEnableLogging("datag") + .withLogStorageSettings( + new LogStorageSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ztcxyphdkxwst") + .withParameters( + mapOf("dgwezc", "dataejopvegmtgoeayho", "wqgkfxcdt", "datassmbdjzcfdpx"))) + .withPath("datayevvuddnwj") + .withLogLevel("datacsflemxbma") + .withEnableReliableLogging("datavopft") + .withAdditionalProperties(mapOf())) + .withDataset( + new DatasetReference().withReferenceName("dmfo").withParameters(mapOf("tkprbm", "datasvfnxxkmrfz"))) + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datarfhfjwikva") + .withDisableMetricsCollection("dataxd") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))); + model = BinaryData.fromObject(model).toObject(DeleteActivity.class); + Assertions.assertEquals("yubytslfmajswrf", model.name()); + Assertions.assertEquals("tgvkqzul", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("hejualugyuxc", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("wbahi", model.userProperties().get(0).name()); + Assertions.assertEquals("ajjzxcqnlsxe", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1648895814, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals(1126063384, model.maxConcurrentConnections()); + Assertions.assertEquals("ztcxyphdkxwst", model.logStorageSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("dmfo", model.dataset().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DeleteActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DeleteActivityTypePropertiesTests.java new file mode 100644 index 000000000000..4ade9a3155be --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DeleteActivityTypePropertiesTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DeleteActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogStorageSettings; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DeleteActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DeleteActivityTypeProperties model = + BinaryData + .fromString( + "{\"recursive\":\"databxgkudioumgv\",\"maxConcurrentConnections\":2061944926,\"enableLogging\":\"datazheqvzwumm\",\"logStorageSettings\":{\"linkedServiceName\":{\"referenceName\":\"ax\",\"parameters\":{\"iwkqr\":\"dataihgcdujhz\",\"l\":\"datatrmi\"}},\"path\":\"datazdukamt\",\"logLevel\":\"dataufvabci\",\"enableReliableLogging\":\"databyfs\",\"\":{\"sfrajpyuw\":\"datawgkozl\",\"lsungzvytbq\":\"dataggfgl\",\"qhugjeaetgmmf\":\"datamxkuyyrcqs\",\"upkpyzaenarfy\":\"datafdqoepwyy\"}},\"dataset\":{\"referenceName\":\"lqiykhoygfgchlc\",\"parameters\":{\"kl\":\"datacsskgug\",\"fawfeeatvnmm\":\"datahmymkcccl\",\"wtcllzwaz\":\"datagowfqrykikhf\"}},\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datah\",\"disableMetricsCollection\":\"datamkfy\",\"\":{\"znf\":\"dataavfsehbxbqionnq\",\"pvxcqj\":\"dataiboyexjcrwwdtey\",\"mv\":\"datawtiasfbp\"}}}") + .toObject(DeleteActivityTypeProperties.class); + Assertions.assertEquals(2061944926, model.maxConcurrentConnections()); + Assertions.assertEquals("ax", model.logStorageSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("lqiykhoygfgchlc", model.dataset().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DeleteActivityTypeProperties model = + new DeleteActivityTypeProperties() + .withRecursive("databxgkudioumgv") + .withMaxConcurrentConnections(2061944926) + .withEnableLogging("datazheqvzwumm") + .withLogStorageSettings( + new LogStorageSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ax") + .withParameters(mapOf("iwkqr", "dataihgcdujhz", "l", "datatrmi"))) + .withPath("datazdukamt") + .withLogLevel("dataufvabci") + .withEnableReliableLogging("databyfs") + .withAdditionalProperties(mapOf())) + .withDataset( + new DatasetReference() + .withReferenceName("lqiykhoygfgchlc") + .withParameters( + mapOf( + "kl", "datacsskgug", "fawfeeatvnmm", "datahmymkcccl", "wtcllzwaz", "datagowfqrykikhf"))) + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datah") + .withDisableMetricsCollection("datamkfy") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))); + model = BinaryData.fromObject(model).toObject(DeleteActivityTypeProperties.class); + Assertions.assertEquals(2061944926, model.maxConcurrentConnections()); + Assertions.assertEquals("ax", model.logStorageSettings().linkedServiceName().referenceName()); + Assertions.assertEquals("lqiykhoygfgchlc", model.dataset().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DeleteDataFlowDebugSessionRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DeleteDataFlowDebugSessionRequestTests.java new file mode 100644 index 000000000000..b72189cf1b84 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DeleteDataFlowDebugSessionRequestTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DeleteDataFlowDebugSessionRequest; +import org.junit.jupiter.api.Assertions; + +public final class DeleteDataFlowDebugSessionRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DeleteDataFlowDebugSessionRequest model = + BinaryData.fromString("{\"sessionId\":\"pnwjfujq\"}").toObject(DeleteDataFlowDebugSessionRequest.class); + Assertions.assertEquals("pnwjfujq", model.sessionId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DeleteDataFlowDebugSessionRequest model = new DeleteDataFlowDebugSessionRequest().withSessionId("pnwjfujq"); + model = BinaryData.fromObject(model).toObject(DeleteDataFlowDebugSessionRequest.class); + Assertions.assertEquals("pnwjfujq", model.sessionId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextReadSettingsTests.java new file mode 100644 index 000000000000..af2b42839bac --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextReadSettingsTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CompressionReadSettings; +import com.azure.resourcemanager.datafactory.models.DelimitedTextReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class DelimitedTextReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DelimitedTextReadSettings model = + BinaryData + .fromString( + "{\"type\":\"DelimitedTextReadSettings\",\"skipLineCount\":\"datahfuxu\",\"compressionProperties\":{\"type\":\"CompressionReadSettings\",\"\":{\"dshhhdixn\":\"dataebok\",\"ywspajakjhv\":\"dataapzibmstvzzkzv\",\"srvsbkn\":\"dataktbnmhxtmzzpau\",\"nwichjkwctlsoh\":\"dataouytsajjgvu\"}},\"\":{\"btegiw\":\"datapvv\"}}") + .toObject(DelimitedTextReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DelimitedTextReadSettings model = + new DelimitedTextReadSettings() + .withSkipLineCount("datahfuxu") + .withCompressionProperties( + new CompressionReadSettings().withAdditionalProperties(mapOf("type", "CompressionReadSettings"))); + model = BinaryData.fromObject(model).toObject(DelimitedTextReadSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextSinkTests.java new file mode 100644 index 000000000000..f97383bba187 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextSinkTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DelimitedTextSink; +import com.azure.resourcemanager.datafactory.models.DelimitedTextWriteSettings; +import com.azure.resourcemanager.datafactory.models.StoreWriteSettings; +import java.util.HashMap; +import java.util.Map; + +public final class DelimitedTextSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DelimitedTextSink model = + BinaryData + .fromString( + "{\"type\":\"DelimitedTextSink\",\"storeSettings\":{\"type\":\"StoreWriteSettings\",\"maxConcurrentConnections\":\"dataagzmyxsoxqarjt\",\"disableMetricsCollection\":\"datalllmtiyguuhylzbd\",\"copyBehavior\":\"datatdohjxfqyyu\",\"\":{\"znxhbttkkicxjxu\":\"datal\",\"jvkqj\":\"datailix\"}},\"formatSettings\":{\"type\":\"DelimitedTextWriteSettings\",\"quoteAllText\":\"datalhcmxxxp\",\"fileExtension\":\"datakxclj\",\"maxRowsPerFile\":\"datamsfsquxxqcimnchv\",\"fileNamePrefix\":\"datawrivagc\",\"\":{\"ysfjdcokbpbpq\":\"datatepsybdgtfo\",\"tnbyvbgrdrumu\":\"datalmszobtne\",\"wecdsybiazfvx\":\"datau\",\"eqly\":\"datakwv\"}},\"writeBatchSize\":\"datayqqonkre\",\"writeBatchTimeout\":\"dataojusmdod\",\"sinkRetryCount\":\"datak\",\"sinkRetryWait\":\"datantaovlyyk\",\"maxConcurrentConnections\":\"datafpkdsldyw\",\"disableMetricsCollection\":\"datavswlhj\",\"\":{\"kqzfwl\":\"dataqygszhpnatltj\",\"ayyuqecwrtr\":\"datayrnmgsbubz\",\"smvvfpkymqnvvwfa\":\"dataderzsnfgmohhcgh\",\"armtuprqtcxqkoh\":\"datarulboawzplwghfgq\"}}") + .toObject(DelimitedTextSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DelimitedTextSink model = + new DelimitedTextSink() + .withWriteBatchSize("datayqqonkre") + .withWriteBatchTimeout("dataojusmdod") + .withSinkRetryCount("datak") + .withSinkRetryWait("datantaovlyyk") + .withMaxConcurrentConnections("datafpkdsldyw") + .withDisableMetricsCollection("datavswlhj") + .withStoreSettings( + new StoreWriteSettings() + .withMaxConcurrentConnections("dataagzmyxsoxqarjt") + .withDisableMetricsCollection("datalllmtiyguuhylzbd") + .withCopyBehavior("datatdohjxfqyyu") + .withAdditionalProperties(mapOf("type", "StoreWriteSettings"))) + .withFormatSettings( + new DelimitedTextWriteSettings() + .withQuoteAllText("datalhcmxxxp") + .withFileExtension("datakxclj") + .withMaxRowsPerFile("datamsfsquxxqcimnchv") + .withFileNamePrefix("datawrivagc")); + model = BinaryData.fromObject(model).toObject(DelimitedTextSink.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextSourceTests.java new file mode 100644 index 000000000000..32d3f0baacca --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextSourceTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CompressionReadSettings; +import com.azure.resourcemanager.datafactory.models.DelimitedTextReadSettings; +import com.azure.resourcemanager.datafactory.models.DelimitedTextSource; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class DelimitedTextSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DelimitedTextSource model = + BinaryData + .fromString( + "{\"type\":\"DelimitedTextSource\",\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datayrwfh\",\"disableMetricsCollection\":\"dataoyxxszpa\",\"\":{\"veekhsmulv\":\"dataurfsofshfmgiixu\",\"iuwhcyckekm\":\"dataywoefkpuuu\",\"oycpotmaosongtbh\":\"datafipygt\",\"nrvwjxmwalh\":\"datahsqvubwwqgiyu\"}},\"formatSettings\":{\"type\":\"DelimitedTextReadSettings\",\"skipLineCount\":\"datansnbpiuvqhod\",\"compressionProperties\":{\"type\":\"CompressionReadSettings\",\"\":{\"zfbjucgbgzjyrd\":\"datatrsnpbsungnjkkm\",\"qvpjydwmaq\":\"dataiwhmrhz\",\"pqupdcsvzugiur\":\"dataytjpua\"}},\"\":{\"tnqbkpobjufksdd\":\"datalvlbjzscr\",\"wxlylxfpvoylf\":\"datakg\",\"ime\":\"datalsrguecbthauivg\",\"uvckpdpdcnrjqs\":\"dataedqgyrvulz\"}},\"additionalColumns\":\"datakqdqiybqtl\",\"sourceRetryCount\":\"datafjjsetiz\",\"sourceRetryWait\":\"datanadn\",\"maxConcurrentConnections\":\"datasbpxlserqgxnh\",\"disableMetricsCollection\":\"dataccd\",\"\":{\"jbhmpmeglo\":\"datayb\"}}") + .toObject(DelimitedTextSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DelimitedTextSource model = + new DelimitedTextSource() + .withSourceRetryCount("datafjjsetiz") + .withSourceRetryWait("datanadn") + .withMaxConcurrentConnections("datasbpxlserqgxnh") + .withDisableMetricsCollection("dataccd") + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datayrwfh") + .withDisableMetricsCollection("dataoyxxszpa") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withFormatSettings( + new DelimitedTextReadSettings() + .withSkipLineCount("datansnbpiuvqhod") + .withCompressionProperties( + new CompressionReadSettings() + .withAdditionalProperties(mapOf("type", "CompressionReadSettings")))) + .withAdditionalColumns("datakqdqiybqtl"); + model = BinaryData.fromObject(model).toObject(DelimitedTextSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextWriteSettingsTests.java new file mode 100644 index 000000000000..c09e983cc97c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DelimitedTextWriteSettingsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DelimitedTextWriteSettings; + +public final class DelimitedTextWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DelimitedTextWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"DelimitedTextWriteSettings\",\"quoteAllText\":\"dataxoign\",\"fileExtension\":\"dataumjmpgze\",\"maxRowsPerFile\":\"datavf\",\"fileNamePrefix\":\"dataijpmeptn\",\"\":{\"rvjwbeeol\":\"datapafksp\"}}") + .toObject(DelimitedTextWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DelimitedTextWriteSettings model = + new DelimitedTextWriteSettings() + .withQuoteAllText("dataxoign") + .withFileExtension("dataumjmpgze") + .withMaxRowsPerFile("datavf") + .withFileNamePrefix("dataijpmeptn"); + model = BinaryData.fromObject(model).toObject(DelimitedTextWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DependencyReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DependencyReferenceTests.java new file mode 100644 index 000000000000..080ead797f76 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DependencyReferenceTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DependencyReference; + +public final class DependencyReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DependencyReference model = + BinaryData.fromString("{\"type\":\"DependencyReference\"}").toObject(DependencyReference.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DependencyReference model = new DependencyReference(); + model = BinaryData.fromObject(model).toObject(DependencyReference.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DistcpSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DistcpSettingsTests.java new file mode 100644 index 000000000000..2d683bb80cdc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DistcpSettingsTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DistcpSettings; + +public final class DistcpSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DistcpSettings model = + BinaryData + .fromString( + "{\"resourceManagerEndpoint\":\"datae\",\"tempScriptPath\":\"datayiwzou\",\"distcpOptions\":\"dataamdgff\"}") + .toObject(DistcpSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DistcpSettings model = + new DistcpSettings() + .withResourceManagerEndpoint("datae") + .withTempScriptPath("datayiwzou") + .withDistcpOptions("dataamdgff"); + model = BinaryData.fromObject(model).toObject(DistcpSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionDatasetTests.java new file mode 100644 index 000000000000..021c5bcdfd85 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionDatasetTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DocumentDbCollectionDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DocumentDbCollectionDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DocumentDbCollectionDataset model = + BinaryData + .fromString( + "{\"type\":\"DocumentDbCollection\",\"typeProperties\":{\"collectionName\":\"datawxdowum\"},\"description\":\"ukrcdiohcl\",\"structure\":\"datadnhfknebwedd\",\"schema\":\"datayzcwy\",\"linkedServiceName\":{\"referenceName\":\"smkaqldqab\",\"parameters\":{\"qbqxfbbigcfd\":\"datap\",\"bmjyyrqaedwovoc\":\"dataofxn\",\"ayokrwfmihw\":\"datatjgo\"}},\"parameters\":{\"vothmkhjaoz\":{\"type\":\"Array\",\"defaultValue\":\"datadbfobdc\"},\"rhjvszfqbokndwpp\":{\"type\":\"Bool\",\"defaultValue\":\"datafcnjhbpoelhscmy\"},\"lynzlyvap\":{\"type\":\"SecureString\",\"defaultValue\":\"dataojoevzzufytdx\"},\"lcuhaizi\":{\"type\":\"Bool\",\"defaultValue\":\"databuoggtdl\"}},\"annotations\":[\"dataylzeohlpsftq\",\"datarvmhvbvvcpwt\",\"datasuspnhmzy\"],\"folder\":{\"name\":\"etevrntfknwacy\"},\"\":{\"atvcsxr\":\"dataotctkhfhf\",\"cubleh\":\"datahnmizhvprhqq\"}}") + .toObject(DocumentDbCollectionDataset.class); + Assertions.assertEquals("ukrcdiohcl", model.description()); + Assertions.assertEquals("smkaqldqab", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("vothmkhjaoz").type()); + Assertions.assertEquals("etevrntfknwacy", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DocumentDbCollectionDataset model = + new DocumentDbCollectionDataset() + .withDescription("ukrcdiohcl") + .withStructure("datadnhfknebwedd") + .withSchema("datayzcwy") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("smkaqldqab") + .withParameters( + mapOf("qbqxfbbigcfd", "datap", "bmjyyrqaedwovoc", "dataofxn", "ayokrwfmihw", "datatjgo"))) + .withParameters( + mapOf( + "vothmkhjaoz", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datadbfobdc"), + "rhjvszfqbokndwpp", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datafcnjhbpoelhscmy"), + "lynzlyvap", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("dataojoevzzufytdx"), + "lcuhaizi", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("databuoggtdl"))) + .withAnnotations(Arrays.asList("dataylzeohlpsftq", "datarvmhvbvvcpwt", "datasuspnhmzy")) + .withFolder(new DatasetFolder().withName("etevrntfknwacy")) + .withCollectionName("datawxdowum"); + model = BinaryData.fromObject(model).toObject(DocumentDbCollectionDataset.class); + Assertions.assertEquals("ukrcdiohcl", model.description()); + Assertions.assertEquals("smkaqldqab", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("vothmkhjaoz").type()); + Assertions.assertEquals("etevrntfknwacy", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..544dfd295297 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DocumentDbCollectionDatasetTypeProperties; + +public final class DocumentDbCollectionDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DocumentDbCollectionDatasetTypeProperties model = + BinaryData + .fromString("{\"collectionName\":\"datakplobzgottaksadz\"}") + .toObject(DocumentDbCollectionDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DocumentDbCollectionDatasetTypeProperties model = + new DocumentDbCollectionDatasetTypeProperties().withCollectionName("datakplobzgottaksadz"); + model = BinaryData.fromObject(model).toObject(DocumentDbCollectionDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionSinkTests.java new file mode 100644 index 000000000000..bfdfec68c28c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionSinkTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DocumentDbCollectionSink; + +public final class DocumentDbCollectionSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DocumentDbCollectionSink model = + BinaryData + .fromString( + "{\"type\":\"DocumentDbCollectionSink\",\"nestingSeparator\":\"datadtq\",\"writeBehavior\":\"datajbxol\",\"writeBatchSize\":\"datahquqihgibog\",\"writeBatchTimeout\":\"datajupenoupcolxc\",\"sinkRetryCount\":\"dataszwadesisd\",\"sinkRetryWait\":\"datauhqts\",\"maxConcurrentConnections\":\"datab\",\"disableMetricsCollection\":\"dataeeeucvvnbymrgel\",\"\":{\"vkqt\":\"datauexxfddfrze\",\"kaqracvcbrtlt\":\"datatqpwqzvqtnozwp\"}}") + .toObject(DocumentDbCollectionSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DocumentDbCollectionSink model = + new DocumentDbCollectionSink() + .withWriteBatchSize("datahquqihgibog") + .withWriteBatchTimeout("datajupenoupcolxc") + .withSinkRetryCount("dataszwadesisd") + .withSinkRetryWait("datauhqts") + .withMaxConcurrentConnections("datab") + .withDisableMetricsCollection("dataeeeucvvnbymrgel") + .withNestingSeparator("datadtq") + .withWriteBehavior("datajbxol"); + model = BinaryData.fromObject(model).toObject(DocumentDbCollectionSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionSourceTests.java new file mode 100644 index 000000000000..abe8042f9c3a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DocumentDbCollectionSourceTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DocumentDbCollectionSource; + +public final class DocumentDbCollectionSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DocumentDbCollectionSource model = + BinaryData + .fromString( + "{\"type\":\"DocumentDbCollectionSource\",\"query\":\"dataolfensibq\",\"nestingSeparator\":\"databpyjzvye\",\"queryTimeout\":\"dataf\",\"additionalColumns\":\"datavz\",\"sourceRetryCount\":\"datavvwroug\",\"sourceRetryWait\":\"dataywgqrevbobheyx\",\"maxConcurrentConnections\":\"datacsktvkwb\",\"disableMetricsCollection\":\"datakfvvxiikrja\",\"\":{\"gv\":\"datavnm\",\"mhksgouzvegtnph\":\"dataypuotmkbofu\"}}") + .toObject(DocumentDbCollectionSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DocumentDbCollectionSource model = + new DocumentDbCollectionSource() + .withSourceRetryCount("datavvwroug") + .withSourceRetryWait("dataywgqrevbobheyx") + .withMaxConcurrentConnections("datacsktvkwb") + .withDisableMetricsCollection("datakfvvxiikrja") + .withQuery("dataolfensibq") + .withNestingSeparator("databpyjzvye") + .withQueryTimeout("dataf") + .withAdditionalColumns("datavz"); + model = BinaryData.fromObject(model).toObject(DocumentDbCollectionSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DrillDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DrillDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..017871b5e245 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DrillDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DrillDatasetTypeProperties; + +public final class DrillDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DrillDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"dataoqejexfd\",\"table\":\"datauhdk\",\"schema\":\"datagywadrklpdyehjr\"}") + .toObject(DrillDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DrillDatasetTypeProperties model = + new DrillDatasetTypeProperties() + .withTableName("dataoqejexfd") + .withTable("datauhdk") + .withSchema("datagywadrklpdyehjr"); + model = BinaryData.fromObject(model).toObject(DrillDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DrillSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DrillSourceTests.java new file mode 100644 index 000000000000..a00719625fcc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DrillSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DrillSource; + +public final class DrillSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DrillSource model = + BinaryData + .fromString( + "{\"type\":\"DrillSource\",\"query\":\"dataxxbneiobub\",\"queryTimeout\":\"datayemppwkryz\",\"additionalColumns\":\"dataqpk\",\"sourceRetryCount\":\"datauv\",\"sourceRetryWait\":\"datai\",\"maxConcurrentConnections\":\"datazbhmyhjg\",\"disableMetricsCollection\":\"datayernckggwiquka\",\"\":{\"fttmjomuwl\":\"datakeolzizfbunzmx\",\"fzgpvdlx\":\"datavjwkpznsfbit\",\"clcuxzl\":\"datayo\",\"ggjeq\":\"datanwmgqc\"}}") + .toObject(DrillSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DrillSource model = + new DrillSource() + .withSourceRetryCount("datauv") + .withSourceRetryWait("datai") + .withMaxConcurrentConnections("datazbhmyhjg") + .withDisableMetricsCollection("datayernckggwiquka") + .withQueryTimeout("datayemppwkryz") + .withAdditionalColumns("dataqpk") + .withQuery("dataxxbneiobub"); + model = BinaryData.fromObject(model).toObject(DrillSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DrillTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DrillTableDatasetTests.java new file mode 100644 index 000000000000..7ba5ebdaf081 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DrillTableDatasetTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DrillTableDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DrillTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DrillTableDataset model = + BinaryData + .fromString( + "{\"type\":\"DrillTable\",\"typeProperties\":{\"tableName\":\"datazjdcwuzscyf\",\"table\":\"dataxecmasjnfgngxaoj\",\"schema\":\"datayvfx\"},\"description\":\"ckmoaljaxvwxt\",\"structure\":\"datazhvojyffwflbk\",\"schema\":\"datadzuiygtcyzcjef\",\"linkedServiceName\":{\"referenceName\":\"ubaldjcgldryvlr\",\"parameters\":{\"jbfomfbozpjyxe\":\"datahzirmxca\",\"jthp\":\"datappqcwdnn\"}},\"parameters\":{\"nsebcxnouspdyzs\":{\"type\":\"Float\",\"defaultValue\":\"dataycympohxubnn\"},\"jvgspj\":{\"type\":\"Object\",\"defaultValue\":\"datamykdy\"},\"ngwqxcrbcrgyoim\":{\"type\":\"Float\",\"defaultValue\":\"datah\"}},\"annotations\":[\"dataz\",\"datacctvkog\"],\"folder\":{\"name\":\"v\"},\"\":{\"jdkjvdr\":\"datannwcnvpnyl\",\"xhnrjl\":\"dataknkxi\"}}") + .toObject(DrillTableDataset.class); + Assertions.assertEquals("ckmoaljaxvwxt", model.description()); + Assertions.assertEquals("ubaldjcgldryvlr", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("nsebcxnouspdyzs").type()); + Assertions.assertEquals("v", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DrillTableDataset model = + new DrillTableDataset() + .withDescription("ckmoaljaxvwxt") + .withStructure("datazhvojyffwflbk") + .withSchema("datadzuiygtcyzcjef") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ubaldjcgldryvlr") + .withParameters(mapOf("jbfomfbozpjyxe", "datahzirmxca", "jthp", "datappqcwdnn"))) + .withParameters( + mapOf( + "nsebcxnouspdyzs", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("dataycympohxubnn"), + "jvgspj", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datamykdy"), + "ngwqxcrbcrgyoim", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datah"))) + .withAnnotations(Arrays.asList("dataz", "datacctvkog")) + .withFolder(new DatasetFolder().withName("v")) + .withTableName("datazjdcwuzscyf") + .withTable("dataxecmasjnfgngxaoj") + .withSchemaTypePropertiesSchema("datayvfx"); + model = BinaryData.fromObject(model).toObject(DrillTableDataset.class); + Assertions.assertEquals("ckmoaljaxvwxt", model.description()); + Assertions.assertEquals("ubaldjcgldryvlr", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("nsebcxnouspdyzs").type()); + Assertions.assertEquals("v", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsAXResourceDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsAXResourceDatasetTests.java new file mode 100644 index 000000000000..82b81ee502dc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsAXResourceDatasetTests.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DynamicsAXResourceDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DynamicsAXResourceDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DynamicsAXResourceDataset model = + BinaryData + .fromString( + "{\"type\":\"DynamicsAXResource\",\"typeProperties\":{\"path\":\"datahrau\"},\"description\":\"ovlx\",\"structure\":\"datavm\",\"schema\":\"datapniqwxmrgmnkgtlh\",\"linkedServiceName\":{\"referenceName\":\"krazkioiyecz\",\"parameters\":{\"qzhehgvmmnoyzg\":\"datamsvzngh\",\"pluzypkf\":\"databn\",\"xilzvxot\":\"datadf\",\"ytsqmbwcacwaaqa\":\"dataoilqcdvhyefqh\"}},\"parameters\":{\"qlreqbrcmmdts\":{\"type\":\"Int\",\"defaultValue\":\"dataaxxra\"},\"cznbabow\":{\"type\":\"Bool\",\"defaultValue\":\"datamx\"},\"ejh\":{\"type\":\"Int\",\"defaultValue\":\"datarnmjwkowxqzkkag\"}},\"annotations\":[\"dataphr\"],\"folder\":{\"name\":\"peajzzy\"},\"\":{\"eyrftxytjayp\":\"dataamzmzfnt\"}}") + .toObject(DynamicsAXResourceDataset.class); + Assertions.assertEquals("ovlx", model.description()); + Assertions.assertEquals("krazkioiyecz", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("qlreqbrcmmdts").type()); + Assertions.assertEquals("peajzzy", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DynamicsAXResourceDataset model = + new DynamicsAXResourceDataset() + .withDescription("ovlx") + .withStructure("datavm") + .withSchema("datapniqwxmrgmnkgtlh") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("krazkioiyecz") + .withParameters( + mapOf( + "qzhehgvmmnoyzg", + "datamsvzngh", + "pluzypkf", + "databn", + "xilzvxot", + "datadf", + "ytsqmbwcacwaaqa", + "dataoilqcdvhyefqh"))) + .withParameters( + mapOf( + "qlreqbrcmmdts", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataaxxra"), + "cznbabow", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datamx"), + "ejh", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datarnmjwkowxqzkkag"))) + .withAnnotations(Arrays.asList("dataphr")) + .withFolder(new DatasetFolder().withName("peajzzy")) + .withPath("datahrau"); + model = BinaryData.fromObject(model).toObject(DynamicsAXResourceDataset.class); + Assertions.assertEquals("ovlx", model.description()); + Assertions.assertEquals("krazkioiyecz", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("qlreqbrcmmdts").type()); + Assertions.assertEquals("peajzzy", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsAXResourceDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsAXResourceDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..f8f4ff363c66 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsAXResourceDatasetTypePropertiesTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DynamicsAXResourceDatasetTypeProperties; + +public final class DynamicsAXResourceDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DynamicsAXResourceDatasetTypeProperties model = + BinaryData.fromString("{\"path\":\"datadrj\"}").toObject(DynamicsAXResourceDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DynamicsAXResourceDatasetTypeProperties model = + new DynamicsAXResourceDatasetTypeProperties().withPath("datadrj"); + model = BinaryData.fromObject(model).toObject(DynamicsAXResourceDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsAXSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsAXSourceTests.java new file mode 100644 index 000000000000..2b99bc475ab5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsAXSourceTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DynamicsAXSource; + +public final class DynamicsAXSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DynamicsAXSource model = + BinaryData + .fromString( + "{\"type\":\"DynamicsAXSource\",\"query\":\"dataxjlvvvzpjj\",\"httpRequestTimeout\":\"dataintgkveogeld\",\"queryTimeout\":\"datab\",\"additionalColumns\":\"databii\",\"sourceRetryCount\":\"databkxiujaagfeiwuux\",\"sourceRetryWait\":\"datamzmsivqeg\",\"maxConcurrentConnections\":\"datafzbrha\",\"disableMetricsCollection\":\"dataptkr\",\"\":{\"yxyoyjasqdhbftt\":\"datapziievcttszca\"}}") + .toObject(DynamicsAXSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DynamicsAXSource model = + new DynamicsAXSource() + .withSourceRetryCount("databkxiujaagfeiwuux") + .withSourceRetryWait("datamzmsivqeg") + .withMaxConcurrentConnections("datafzbrha") + .withDisableMetricsCollection("dataptkr") + .withQueryTimeout("datab") + .withAdditionalColumns("databii") + .withQuery("dataxjlvvvzpjj") + .withHttpRequestTimeout("dataintgkveogeld"); + model = BinaryData.fromObject(model).toObject(DynamicsAXSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsCrmEntityDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsCrmEntityDatasetTests.java new file mode 100644 index 000000000000..f2168e9d8667 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsCrmEntityDatasetTests.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DynamicsCrmEntityDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DynamicsCrmEntityDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DynamicsCrmEntityDataset model = + BinaryData + .fromString( + "{\"type\":\"DynamicsCrmEntity\",\"typeProperties\":{\"entityName\":\"dataiwh\"},\"description\":\"cfjnc\",\"structure\":\"datadilo\",\"schema\":\"dataajwjuriarsbcll\",\"linkedServiceName\":{\"referenceName\":\"nhzcknjxizb\",\"parameters\":{\"mlxppdndzkfevuii\":\"dataygzkztxfexwacyy\",\"kcj\":\"dataiib\",\"nopm\":\"datatqdcizeqqfop\",\"xqlyoazyfbkmvl\":\"datatdsfh\"}},\"parameters\":{\"kvhyejth\":{\"type\":\"Bool\",\"defaultValue\":\"datajzsvmaigb\"},\"ergwlckihbam\":{\"type\":\"Float\",\"defaultValue\":\"datacb\"},\"zjwdizcr\":{\"type\":\"Array\",\"defaultValue\":\"dataokknpu\"},\"c\":{\"type\":\"Object\",\"defaultValue\":\"dataiujz\"}},\"annotations\":[\"datagkr\",\"dataw\",\"datasykkbxktxbbwl\",\"datanwzoknvu\"],\"folder\":{\"name\":\"lggbqaolgzub\"},\"\":{\"kmixwewzls\":\"datalkvggcmfnsffet\",\"bthhxmoevvude\":\"datagsmepnqvxgvoh\",\"nvwxqhpjhubohxv\":\"datapfhga\"}}") + .toObject(DynamicsCrmEntityDataset.class); + Assertions.assertEquals("cfjnc", model.description()); + Assertions.assertEquals("nhzcknjxizb", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("kvhyejth").type()); + Assertions.assertEquals("lggbqaolgzub", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DynamicsCrmEntityDataset model = + new DynamicsCrmEntityDataset() + .withDescription("cfjnc") + .withStructure("datadilo") + .withSchema("dataajwjuriarsbcll") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("nhzcknjxizb") + .withParameters( + mapOf( + "mlxppdndzkfevuii", + "dataygzkztxfexwacyy", + "kcj", + "dataiib", + "nopm", + "datatqdcizeqqfop", + "xqlyoazyfbkmvl", + "datatdsfh"))) + .withParameters( + mapOf( + "kvhyejth", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datajzsvmaigb"), + "ergwlckihbam", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datacb"), + "zjwdizcr", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataokknpu"), + "c", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("dataiujz"))) + .withAnnotations(Arrays.asList("datagkr", "dataw", "datasykkbxktxbbwl", "datanwzoknvu")) + .withFolder(new DatasetFolder().withName("lggbqaolgzub")) + .withEntityName("dataiwh"); + model = BinaryData.fromObject(model).toObject(DynamicsCrmEntityDataset.class); + Assertions.assertEquals("cfjnc", model.description()); + Assertions.assertEquals("nhzcknjxizb", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("kvhyejth").type()); + Assertions.assertEquals("lggbqaolgzub", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsCrmEntityDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsCrmEntityDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..fc9cc46f36bc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsCrmEntityDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DynamicsCrmEntityDatasetTypeProperties; + +public final class DynamicsCrmEntityDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DynamicsCrmEntityDatasetTypeProperties model = + BinaryData + .fromString("{\"entityName\":\"dataaybvrhho\"}") + .toObject(DynamicsCrmEntityDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DynamicsCrmEntityDatasetTypeProperties model = + new DynamicsCrmEntityDatasetTypeProperties().withEntityName("dataaybvrhho"); + model = BinaryData.fromObject(model).toObject(DynamicsCrmEntityDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsCrmSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsCrmSourceTests.java new file mode 100644 index 000000000000..40c88ea9c8d7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsCrmSourceTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DynamicsCrmSource; + +public final class DynamicsCrmSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DynamicsCrmSource model = + BinaryData + .fromString( + "{\"type\":\"DynamicsCrmSource\",\"query\":\"datakd\",\"additionalColumns\":\"datakdpn\",\"sourceRetryCount\":\"datadwcxjv\",\"sourceRetryWait\":\"datal\",\"maxConcurrentConnections\":\"dataxcmcccotqocnryyp\",\"disableMetricsCollection\":\"dataduldsolbz\",\"\":{\"pvaagrdfwvglqds\":\"dataufkeyl\",\"ucryhuohthzfotfr\":\"datahvo\",\"op\":\"datahrjkahdofshgmqx\",\"aittbmobrxhwpg\":\"datanitrmzvnrfkzn\"}}") + .toObject(DynamicsCrmSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DynamicsCrmSource model = + new DynamicsCrmSource() + .withSourceRetryCount("datadwcxjv") + .withSourceRetryWait("datal") + .withMaxConcurrentConnections("dataxcmcccotqocnryyp") + .withDisableMetricsCollection("dataduldsolbz") + .withQuery("datakd") + .withAdditionalColumns("datakdpn"); + model = BinaryData.fromObject(model).toObject(DynamicsCrmSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsEntityDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsEntityDatasetTests.java new file mode 100644 index 000000000000..e5135da78938 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsEntityDatasetTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DynamicsEntityDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DynamicsEntityDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DynamicsEntityDataset model = + BinaryData + .fromString( + "{\"type\":\"DynamicsEntity\",\"typeProperties\":{\"entityName\":\"datammtbt\"},\"description\":\"u\",\"structure\":\"datavvraabeurdeewlsu\",\"schema\":\"datacbwkdwjyj\",\"linkedServiceName\":{\"referenceName\":\"zni\",\"parameters\":{\"cr\":\"dataofmftasp\"}},\"parameters\":{\"nuwqxungro\":{\"type\":\"Float\",\"defaultValue\":\"datatrnighm\"}},\"annotations\":[\"datafmsxjwdy\",\"datawxm\"],\"folder\":{\"name\":\"ow\"},\"\":{\"chy\":\"dataeerclbltbhpw\",\"gpruccwme\":\"dataurjwmvwryvdifkii\"}}") + .toObject(DynamicsEntityDataset.class); + Assertions.assertEquals("u", model.description()); + Assertions.assertEquals("zni", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("nuwqxungro").type()); + Assertions.assertEquals("ow", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DynamicsEntityDataset model = + new DynamicsEntityDataset() + .withDescription("u") + .withStructure("datavvraabeurdeewlsu") + .withSchema("datacbwkdwjyj") + .withLinkedServiceName( + new LinkedServiceReference().withReferenceName("zni").withParameters(mapOf("cr", "dataofmftasp"))) + .withParameters( + mapOf( + "nuwqxungro", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datatrnighm"))) + .withAnnotations(Arrays.asList("datafmsxjwdy", "datawxm")) + .withFolder(new DatasetFolder().withName("ow")) + .withEntityName("datammtbt"); + model = BinaryData.fromObject(model).toObject(DynamicsEntityDataset.class); + Assertions.assertEquals("u", model.description()); + Assertions.assertEquals("zni", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("nuwqxungro").type()); + Assertions.assertEquals("ow", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsEntityDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsEntityDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..aa480f749761 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsEntityDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DynamicsEntityDatasetTypeProperties; + +public final class DynamicsEntityDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DynamicsEntityDatasetTypeProperties model = + BinaryData + .fromString("{\"entityName\":\"datatxsytrtexegwmrq\"}") + .toObject(DynamicsEntityDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DynamicsEntityDatasetTypeProperties model = + new DynamicsEntityDatasetTypeProperties().withEntityName("datatxsytrtexegwmrq"); + model = BinaryData.fromObject(model).toObject(DynamicsEntityDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsSourceTests.java new file mode 100644 index 000000000000..875dfd0cc98e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/DynamicsSourceTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DynamicsSource; + +public final class DynamicsSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DynamicsSource model = + BinaryData + .fromString( + "{\"type\":\"DynamicsSource\",\"query\":\"datasyntc\",\"additionalColumns\":\"dataluqaqnlygfvbfej\",\"sourceRetryCount\":\"datazklgpifv\",\"sourceRetryWait\":\"datamvk\",\"maxConcurrentConnections\":\"datauw\",\"disableMetricsCollection\":\"datanplqf\",\"\":{\"ov\":\"datafqmdjz\",\"rjkmpaxoe\":\"datakp\",\"mqzagrqcqhwfs\":\"datalpofaog\"}}") + .toObject(DynamicsSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DynamicsSource model = + new DynamicsSource() + .withSourceRetryCount("datazklgpifv") + .withSourceRetryWait("datamvk") + .withMaxConcurrentConnections("datauw") + .withDisableMetricsCollection("datanplqf") + .withQuery("datasyntc") + .withAdditionalColumns("dataluqaqnlygfvbfej"); + model = BinaryData.fromObject(model).toObject(DynamicsSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EloquaObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EloquaObjectDatasetTests.java new file mode 100644 index 000000000000..f522136799a8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EloquaObjectDatasetTests.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.EloquaObjectDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class EloquaObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EloquaObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"EloquaObject\",\"typeProperties\":{\"tableName\":\"datalvxboc\"},\"description\":\"wmfvuhzmolhveoln\",\"structure\":\"datafm\",\"schema\":\"datadxqupyml\",\"linkedServiceName\":{\"referenceName\":\"klmnjqzmqynhitr\",\"parameters\":{\"nrjocogwf\":\"datagqrbthbfpi\",\"pkhuvnlmdcnut\":\"datakywzrqeiad\",\"ioynctfqhhvv\":\"dataexmizunzbq\"}},\"parameters\":{\"vavlyaqtlocnwme\":{\"type\":\"Array\",\"defaultValue\":\"dataaaaiaib\"},\"v\":{\"type\":\"Int\",\"defaultValue\":\"datazuzqcrlko\"},\"ozf\":{\"type\":\"Bool\",\"defaultValue\":\"datayhenfsfyqncowmh\"},\"agwaakktbjort\":{\"type\":\"Float\",\"defaultValue\":\"datajiaaosla\"}},\"annotations\":[\"dataajqhsnsejplis\",\"dataxyljzbkdw\",\"datafjwxgvtkjctvrpea\",\"datazzkvfc\"],\"folder\":{\"name\":\"vq\"},\"\":{\"tgcptctxpoeg\":\"datahtraitrmsukxtu\"}}") + .toObject(EloquaObjectDataset.class); + Assertions.assertEquals("wmfvuhzmolhveoln", model.description()); + Assertions.assertEquals("klmnjqzmqynhitr", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("vavlyaqtlocnwme").type()); + Assertions.assertEquals("vq", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EloquaObjectDataset model = + new EloquaObjectDataset() + .withDescription("wmfvuhzmolhveoln") + .withStructure("datafm") + .withSchema("datadxqupyml") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("klmnjqzmqynhitr") + .withParameters( + mapOf( + "nrjocogwf", + "datagqrbthbfpi", + "pkhuvnlmdcnut", + "datakywzrqeiad", + "ioynctfqhhvv", + "dataexmizunzbq"))) + .withParameters( + mapOf( + "vavlyaqtlocnwme", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataaaaiaib"), + "v", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datazuzqcrlko"), + "ozf", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datayhenfsfyqncowmh"), + "agwaakktbjort", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datajiaaosla"))) + .withAnnotations( + Arrays.asList("dataajqhsnsejplis", "dataxyljzbkdw", "datafjwxgvtkjctvrpea", "datazzkvfc")) + .withFolder(new DatasetFolder().withName("vq")) + .withTableName("datalvxboc"); + model = BinaryData.fromObject(model).toObject(EloquaObjectDataset.class); + Assertions.assertEquals("wmfvuhzmolhveoln", model.description()); + Assertions.assertEquals("klmnjqzmqynhitr", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("vavlyaqtlocnwme").type()); + Assertions.assertEquals("vq", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EloquaSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EloquaSourceTests.java new file mode 100644 index 000000000000..b86eb0b342fa --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EloquaSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.EloquaSource; + +public final class EloquaSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EloquaSource model = + BinaryData + .fromString( + "{\"type\":\"EloquaSource\",\"query\":\"dataxmpgfspwhfhdgu\",\"queryTimeout\":\"datagav\",\"additionalColumns\":\"datavdfytqzx\",\"sourceRetryCount\":\"dataqnwpwrfe\",\"sourceRetryWait\":\"dataggrm\",\"maxConcurrentConnections\":\"datafhkoe\",\"disableMetricsCollection\":\"datarjmicha\",\"\":{\"pxydi\":\"datantaqjvddeiqvrjh\"}}") + .toObject(EloquaSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EloquaSource model = + new EloquaSource() + .withSourceRetryCount("dataqnwpwrfe") + .withSourceRetryWait("dataggrm") + .withMaxConcurrentConnections("datafhkoe") + .withDisableMetricsCollection("datarjmicha") + .withQueryTimeout("datagav") + .withAdditionalColumns("datavdfytqzx") + .withQuery("dataxmpgfspwhfhdgu"); + model = BinaryData.fromObject(model).toObject(EloquaSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EntityReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EntityReferenceTests.java new file mode 100644 index 000000000000..ac10d7bb774d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EntityReferenceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.EntityReference; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeEntityReferenceType; +import org.junit.jupiter.api.Assertions; + +public final class EntityReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EntityReference model = + BinaryData + .fromString("{\"type\":\"IntegrationRuntimeReference\",\"referenceName\":\"azlycx\"}") + .toObject(EntityReference.class); + Assertions.assertEquals(IntegrationRuntimeEntityReferenceType.INTEGRATION_RUNTIME_REFERENCE, model.type()); + Assertions.assertEquals("azlycx", model.referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EntityReference model = + new EntityReference() + .withType(IntegrationRuntimeEntityReferenceType.INTEGRATION_RUNTIME_REFERENCE) + .withReferenceName("azlycx"); + model = BinaryData.fromObject(model).toObject(EntityReference.class); + Assertions.assertEquals(IntegrationRuntimeEntityReferenceType.INTEGRATION_RUNTIME_REFERENCE, model.type()); + Assertions.assertEquals("azlycx", model.referenceName()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EnvironmentVariableSetupTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EnvironmentVariableSetupTests.java new file mode 100644 index 000000000000..041f9f4eefe3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EnvironmentVariableSetupTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.EnvironmentVariableSetup; +import org.junit.jupiter.api.Assertions; + +public final class EnvironmentVariableSetupTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnvironmentVariableSetup model = + BinaryData + .fromString( + "{\"type\":\"EnvironmentVariableSetup\",\"typeProperties\":{\"variableName\":\"fgefvwgwp\",\"variableValue\":\"wxiavwmixaqgfpu\"}}") + .toObject(EnvironmentVariableSetup.class); + Assertions.assertEquals("fgefvwgwp", model.variableName()); + Assertions.assertEquals("wxiavwmixaqgfpu", model.variableValue()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnvironmentVariableSetup model = + new EnvironmentVariableSetup().withVariableName("fgefvwgwp").withVariableValue("wxiavwmixaqgfpu"); + model = BinaryData.fromObject(model).toObject(EnvironmentVariableSetup.class); + Assertions.assertEquals("fgefvwgwp", model.variableName()); + Assertions.assertEquals("wxiavwmixaqgfpu", model.variableValue()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EnvironmentVariableSetupTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EnvironmentVariableSetupTypePropertiesTests.java new file mode 100644 index 000000000000..1d895c98b368 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/EnvironmentVariableSetupTypePropertiesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.EnvironmentVariableSetupTypeProperties; +import org.junit.jupiter.api.Assertions; + +public final class EnvironmentVariableSetupTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnvironmentVariableSetupTypeProperties model = + BinaryData + .fromString("{\"variableName\":\"hzwrsjumlkjsvkbt\",\"variableValue\":\"lixa\"}") + .toObject(EnvironmentVariableSetupTypeProperties.class); + Assertions.assertEquals("hzwrsjumlkjsvkbt", model.variableName()); + Assertions.assertEquals("lixa", model.variableValue()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnvironmentVariableSetupTypeProperties model = + new EnvironmentVariableSetupTypeProperties().withVariableName("hzwrsjumlkjsvkbt").withVariableValue("lixa"); + model = BinaryData.fromObject(model).toObject(EnvironmentVariableSetupTypeProperties.class); + Assertions.assertEquals("hzwrsjumlkjsvkbt", model.variableName()); + Assertions.assertEquals("lixa", model.variableValue()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExcelDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExcelDatasetTests.java new file mode 100644 index 000000000000..aa5c3e88dfd3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExcelDatasetTests.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetLocation; +import com.azure.resourcemanager.datafactory.models.ExcelDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ExcelDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExcelDataset model = + BinaryData + .fromString( + "{\"type\":\"Excel\",\"typeProperties\":{\"location\":{\"type\":\"DatasetLocation\",\"folderPath\":\"datarqpfzlp\",\"fileName\":\"datatznxlu\",\"\":{\"kbpjzobdwbcpra\":\"datajqbbgsimwejlw\",\"dtnaczkf\":\"datawkuh\",\"dwgtqcumecsaa\":\"datafatgawphnski\",\"iuycsbskowk\":\"datagoqb\"}},\"sheetName\":\"datahzhrbkhtm\",\"sheetIndex\":\"datawiuasfg\",\"range\":\"dataucyhfaimq\",\"firstRowAsHeader\":\"dataruozkgyfp\",\"compression\":{\"type\":\"datae\",\"level\":\"datafm\",\"\":{\"xvlzjxplhpevasyn\":\"datakk\"}},\"nullValue\":\"datazjyielbqrvv\"},\"description\":\"vknmpecqxgiqas\",\"structure\":\"dataubnsnstlpwq\",\"schema\":\"datanxjkhtupsvyouw\",\"linkedServiceName\":{\"referenceName\":\"uiyxfwkztsmsfb\",\"parameters\":{\"kqytkztadopgfzdg\":\"datallznf\",\"yhigqkzjuqwqaj\":\"datafcycrsvlo\",\"xhyoip\":\"datauzxp\",\"bgsosc\":\"dataf\"}},\"parameters\":{\"ekwwnthropmdudsy\":{\"type\":\"SecureString\",\"defaultValue\":\"datafvbennmfkbpjnr\"},\"youergaghp\":{\"type\":\"Float\",\"defaultValue\":\"dataztvktjhffecqko\"},\"yedzfzq\":{\"type\":\"String\",\"defaultValue\":\"datakpyehhfdyldh\"},\"jlwyxedzn\":{\"type\":\"Int\",\"defaultValue\":\"dataqhtdereunokakzwh\"}},\"annotations\":[\"datafomckewv\"],\"folder\":{\"name\":\"fopxf\"},\"\":{\"pt\":\"datapdyzoutx\",\"dgaaqwvkgjpy\":\"datafhgnuywezygv\",\"nogehlufbort\":\"datapmpv\",\"xyji\":\"datanukkfaxzsvb\"}}") + .toObject(ExcelDataset.class); + Assertions.assertEquals("vknmpecqxgiqas", model.description()); + Assertions.assertEquals("uiyxfwkztsmsfb", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("ekwwnthropmdudsy").type()); + Assertions.assertEquals("fopxf", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExcelDataset model = + new ExcelDataset() + .withDescription("vknmpecqxgiqas") + .withStructure("dataubnsnstlpwq") + .withSchema("datanxjkhtupsvyouw") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("uiyxfwkztsmsfb") + .withParameters( + mapOf( + "kqytkztadopgfzdg", + "datallznf", + "yhigqkzjuqwqaj", + "datafcycrsvlo", + "xhyoip", + "datauzxp", + "bgsosc", + "dataf"))) + .withParameters( + mapOf( + "ekwwnthropmdudsy", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datafvbennmfkbpjnr"), + "youergaghp", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("dataztvktjhffecqko"), + "yedzfzq", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datakpyehhfdyldh"), + "jlwyxedzn", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("dataqhtdereunokakzwh"))) + .withAnnotations(Arrays.asList("datafomckewv")) + .withFolder(new DatasetFolder().withName("fopxf")) + .withLocation( + new DatasetLocation() + .withFolderPath("datarqpfzlp") + .withFileName("datatznxlu") + .withAdditionalProperties(mapOf("type", "DatasetLocation"))) + .withSheetName("datahzhrbkhtm") + .withSheetIndex("datawiuasfg") + .withRange("dataucyhfaimq") + .withFirstRowAsHeader("dataruozkgyfp") + .withCompression( + new DatasetCompression().withType("datae").withLevel("datafm").withAdditionalProperties(mapOf())) + .withNullValue("datazjyielbqrvv"); + model = BinaryData.fromObject(model).toObject(ExcelDataset.class); + Assertions.assertEquals("vknmpecqxgiqas", model.description()); + Assertions.assertEquals("uiyxfwkztsmsfb", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("ekwwnthropmdudsy").type()); + Assertions.assertEquals("fopxf", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExcelDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExcelDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..8924192fe760 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExcelDatasetTypePropertiesTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ExcelDatasetTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetLocation; +import java.util.HashMap; +import java.util.Map; + +public final class ExcelDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExcelDatasetTypeProperties model = + BinaryData + .fromString( + "{\"location\":{\"type\":\"DatasetLocation\",\"folderPath\":\"datakobqoclflioe\",\"fileName\":\"datahxessmvrk\",\"\":{\"bdxmd\":\"dataqeq\"}},\"sheetName\":\"datasbrujbjpppktlpdi\",\"sheetIndex\":\"datamthieatnejrnmin\",\"range\":\"dataplgtkihonikzsrzf\",\"firstRowAsHeader\":\"datajilzfbpntogke\",\"compression\":{\"type\":\"datack\",\"level\":\"datamcarm\",\"\":{\"ykhkg\":\"dataxxkwykuqdndx\",\"t\":\"dataapvd\",\"rnrnjrcufmbgacnr\":\"datapeerscd\",\"eubkqiqmlf\":\"datafdtncmspsanma\"}},\"nullValue\":\"datalqcskkqjmxptueip\"}") + .toObject(ExcelDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExcelDatasetTypeProperties model = + new ExcelDatasetTypeProperties() + .withLocation( + new DatasetLocation() + .withFolderPath("datakobqoclflioe") + .withFileName("datahxessmvrk") + .withAdditionalProperties(mapOf("type", "DatasetLocation"))) + .withSheetName("datasbrujbjpppktlpdi") + .withSheetIndex("datamthieatnejrnmin") + .withRange("dataplgtkihonikzsrzf") + .withFirstRowAsHeader("datajilzfbpntogke") + .withCompression( + new DatasetCompression() + .withType("datack") + .withLevel("datamcarm") + .withAdditionalProperties(mapOf())) + .withNullValue("datalqcskkqjmxptueip"); + model = BinaryData.fromObject(model).toObject(ExcelDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExcelSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExcelSourceTests.java new file mode 100644 index 000000000000..6b97bda076d7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExcelSourceTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ExcelSource; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class ExcelSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExcelSource model = + BinaryData + .fromString( + "{\"type\":\"ExcelSource\",\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"dataaxzfhhhgyxk\",\"disableMetricsCollection\":\"dataryalkfdxauih\",\"\":{\"u\":\"datadhkdwyehqn\"}},\"additionalColumns\":\"datag\",\"sourceRetryCount\":\"datanmin\",\"sourceRetryWait\":\"datadkqigpp\",\"maxConcurrentConnections\":\"datasqsapweaxt\",\"disableMetricsCollection\":\"datahuruouqyota\",\"\":{\"qjpcuzexoymfku\":\"datakdb\",\"qzpgrv\":\"databysg\"}}") + .toObject(ExcelSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExcelSource model = + new ExcelSource() + .withSourceRetryCount("datanmin") + .withSourceRetryWait("datadkqigpp") + .withMaxConcurrentConnections("datasqsapweaxt") + .withDisableMetricsCollection("datahuruouqyota") + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("dataaxzfhhhgyxk") + .withDisableMetricsCollection("dataryalkfdxauih") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withAdditionalColumns("datag"); + model = BinaryData.fromObject(model).toObject(ExcelSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteDataFlowActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteDataFlowActivityTests.java new file mode 100644 index 000000000000..e1aa5f13a161 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteDataFlowActivityTests.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowStagingInfo; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.ExecuteDataFlowActivity; +import com.azure.resourcemanager.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ExecuteDataFlowActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExecuteDataFlowActivity model = + BinaryData + .fromString( + "{\"type\":\"ExecuteDataFlow\",\"typeProperties\":{\"dataFlow\":{\"type\":\"DataFlowReference\",\"referenceName\":\"pidb\",\"datasetParameters\":\"dataviplcowbxpvmnd\",\"parameters\":{\"dono\":\"datacgq\",\"whvqkeuiy\":\"dataw\",\"pvusigw\":\"dataeaahnkntldddk\"},\"\":{\"oodqnouwxkeqlbm\":\"datanxrrjihgigcozk\",\"udfixhxl\":\"dataoyapxnq\"}},\"staging\":{\"linkedService\":{\"referenceName\":\"qhtgtadtootkgxx\",\"parameters\":{\"petwgtmpytom\":\"datanlqwxskltz\",\"g\":\"datatubhvb\",\"zdazxfz\":\"datavpyjpaih\",\"sjnlekotqhd\":\"datallihwpsrdaoixgqt\"}},\"folderPath\":\"dataxknchyoimtfkjcdj\"},\"integrationRuntime\":{\"referenceName\":\"xe\",\"parameters\":{\"cxuntghwcb\":\"datav\",\"yfcbcakcq\":\"dataclg\",\"xbo\":\"datahwzeukumln\",\"ywzgvcmui\":\"datavgwa\"}},\"compute\":{\"computeType\":\"datajsznxze\",\"coreCount\":\"datanqmxirsp\"},\"traceLevel\":\"dataakrbew\",\"continueOnError\":\"datais\",\"runConcurrently\":\"databourw\",\"sourceStagingConcurrency\":\"datansdluq\"},\"linkedServiceName\":{\"referenceName\":\"xgmzyqftlafeco\",\"parameters\":{\"ynusqzai\":\"datax\",\"w\":\"dataz\",\"kwbwxcjf\":\"datay\",\"weguqzlmhpuqlsd\":\"datauzw\"}},\"policy\":{\"timeout\":\"datajxlzyyylyxujqp\",\"retry\":\"datapvychobshogja\",\"retryIntervalInSeconds\":1088491927,\"secureInput\":true,\"secureOutput\":false,\"\":{\"ujtnnd\":\"datafrwym\",\"yc\":\"datas\"}},\"name\":\"pljyt\",\"description\":\"btijybpfwg\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"xh\",\"dependencyConditions\":[\"Failed\",\"Failed\",\"Completed\"],\"\":{\"burrevuz\":\"datafaqgzakisipjgvm\"}},{\"activity\":\"xuubwjopkldubqfb\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Succeeded\",\"Skipped\"],\"\":{\"tnm\":\"dataydgnxsgy\"}},{\"activity\":\"lankosd\",\"dependencyConditions\":[\"Succeeded\",\"Succeeded\",\"Skipped\"],\"\":{\"ybdivxvxw\":\"dataefkhki\",\"czco\":\"datafmqzndlgqtuq\"}},{\"activity\":\"ctcwtxa\",\"dependencyConditions\":[\"Failed\"],\"\":{\"rzsninkhbm\":\"datahmsdod\",\"yt\":\"datalfo\"}}],\"userProperties\":[{\"name\":\"hzxmcpsep\",\"value\":\"datardgerqzxkpxr\"}],\"\":{\"jmel\":\"dataqhhmndbbpjdg\"}}") + .toObject(ExecuteDataFlowActivity.class); + Assertions.assertEquals("pljyt", model.name()); + Assertions.assertEquals("btijybpfwg", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("xh", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("hzxmcpsep", model.userProperties().get(0).name()); + Assertions.assertEquals("xgmzyqftlafeco", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1088491927, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataFlow().type()); + Assertions.assertEquals("pidb", model.dataFlow().referenceName()); + Assertions.assertEquals("qhtgtadtootkgxx", model.staging().linkedService().referenceName()); + Assertions.assertEquals("xe", model.integrationRuntime().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExecuteDataFlowActivity model = + new ExecuteDataFlowActivity() + .withName("pljyt") + .withDescription("btijybpfwg") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("xh") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("xuubwjopkldubqfb") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("lankosd") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ctcwtxa") + .withDependencyConditions(Arrays.asList(DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("hzxmcpsep").withValue("datardgerqzxkpxr"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("xgmzyqftlafeco") + .withParameters( + mapOf( + "ynusqzai", "datax", "w", "dataz", "kwbwxcjf", "datay", "weguqzlmhpuqlsd", "datauzw"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datajxlzyyylyxujqp") + .withRetry("datapvychobshogja") + .withRetryIntervalInSeconds(1088491927) + .withSecureInput(true) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withDataFlow( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("pidb") + .withDatasetParameters("dataviplcowbxpvmnd") + .withParameters(mapOf("dono", "datacgq", "whvqkeuiy", "dataw", "pvusigw", "dataeaahnkntldddk")) + .withAdditionalProperties(mapOf())) + .withStaging( + new DataFlowStagingInfo() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("qhtgtadtootkgxx") + .withParameters( + mapOf( + "petwgtmpytom", + "datanlqwxskltz", + "g", + "datatubhvb", + "zdazxfz", + "datavpyjpaih", + "sjnlekotqhd", + "datallihwpsrdaoixgqt"))) + .withFolderPath("dataxknchyoimtfkjcdj")) + .withIntegrationRuntime( + new IntegrationRuntimeReference() + .withReferenceName("xe") + .withParameters( + mapOf( + "cxuntghwcb", + "datav", + "yfcbcakcq", + "dataclg", + "xbo", + "datahwzeukumln", + "ywzgvcmui", + "datavgwa"))) + .withCompute( + new ExecuteDataFlowActivityTypePropertiesCompute() + .withComputeType("datajsznxze") + .withCoreCount("datanqmxirsp")) + .withTraceLevel("dataakrbew") + .withContinueOnError("datais") + .withRunConcurrently("databourw") + .withSourceStagingConcurrency("datansdluq"); + model = BinaryData.fromObject(model).toObject(ExecuteDataFlowActivity.class); + Assertions.assertEquals("pljyt", model.name()); + Assertions.assertEquals("btijybpfwg", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("xh", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("hzxmcpsep", model.userProperties().get(0).name()); + Assertions.assertEquals("xgmzyqftlafeco", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1088491927, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataFlow().type()); + Assertions.assertEquals("pidb", model.dataFlow().referenceName()); + Assertions.assertEquals("qhtgtadtootkgxx", model.staging().linkedService().referenceName()); + Assertions.assertEquals("xe", model.integrationRuntime().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteDataFlowActivityTypePropertiesComputeTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteDataFlowActivityTypePropertiesComputeTests.java new file mode 100644 index 000000000000..d310acfe83b6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteDataFlowActivityTypePropertiesComputeTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute; + +public final class ExecuteDataFlowActivityTypePropertiesComputeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExecuteDataFlowActivityTypePropertiesCompute model = + BinaryData + .fromString("{\"computeType\":\"datagnxepapm\",\"coreCount\":\"datakxshkyluqxndmtas\"}") + .toObject(ExecuteDataFlowActivityTypePropertiesCompute.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExecuteDataFlowActivityTypePropertiesCompute model = + new ExecuteDataFlowActivityTypePropertiesCompute() + .withComputeType("datagnxepapm") + .withCoreCount("datakxshkyluqxndmtas"); + model = BinaryData.fromObject(model).toObject(ExecuteDataFlowActivityTypePropertiesCompute.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteDataFlowActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteDataFlowActivityTypePropertiesTests.java new file mode 100644 index 000000000000..a9b84ed911d4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteDataFlowActivityTypePropertiesTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ExecuteDataFlowActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowStagingInfo; +import com.azure.resourcemanager.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ExecuteDataFlowActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExecuteDataFlowActivityTypeProperties model = + BinaryData + .fromString( + "{\"dataFlow\":{\"type\":\"DataFlowReference\",\"referenceName\":\"zmfmgboyliop\",\"datasetParameters\":\"dataogfaiy\",\"parameters\":{\"summysrxnneq\":\"datafe\",\"rskosbzvclzutvqk\":\"datasdupmrickuhgbrv\"},\"\":{\"fskqwjlohkaffyny\":\"datamv\"}},\"staging\":{\"linkedService\":{\"referenceName\":\"qbyty\",\"parameters\":{\"egiufjnjgupj\":\"datakucxpqpaxkayv\",\"wbdmunuv\":\"datappbalcft\"}},\"folderPath\":\"datamxxgocpzqrbtyz\"},\"integrationRuntime\":{\"referenceName\":\"wrufiouafxp\",\"parameters\":{\"oogixgnpl\":\"datamw\"}},\"compute\":{\"computeType\":\"datavpuigtnjye\",\"coreCount\":\"datavvitxoitnqmiwlri\"},\"traceLevel\":\"datax\",\"continueOnError\":\"datayyvebpykzhrq\",\"runConcurrently\":\"databt\",\"sourceStagingConcurrency\":\"datav\"}") + .toObject(ExecuteDataFlowActivityTypeProperties.class); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataFlow().type()); + Assertions.assertEquals("zmfmgboyliop", model.dataFlow().referenceName()); + Assertions.assertEquals("qbyty", model.staging().linkedService().referenceName()); + Assertions.assertEquals("wrufiouafxp", model.integrationRuntime().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExecuteDataFlowActivityTypeProperties model = + new ExecuteDataFlowActivityTypeProperties() + .withDataFlow( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("zmfmgboyliop") + .withDatasetParameters("dataogfaiy") + .withParameters(mapOf("summysrxnneq", "datafe", "rskosbzvclzutvqk", "datasdupmrickuhgbrv")) + .withAdditionalProperties(mapOf())) + .withStaging( + new DataFlowStagingInfo() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("qbyty") + .withParameters(mapOf("egiufjnjgupj", "datakucxpqpaxkayv", "wbdmunuv", "datappbalcft"))) + .withFolderPath("datamxxgocpzqrbtyz")) + .withIntegrationRuntime( + new IntegrationRuntimeReference() + .withReferenceName("wrufiouafxp") + .withParameters(mapOf("oogixgnpl", "datamw"))) + .withCompute( + new ExecuteDataFlowActivityTypePropertiesCompute() + .withComputeType("datavpuigtnjye") + .withCoreCount("datavvitxoitnqmiwlri")) + .withTraceLevel("datax") + .withContinueOnError("datayyvebpykzhrq") + .withRunConcurrently("databt") + .withSourceStagingConcurrency("datav"); + model = BinaryData.fromObject(model).toObject(ExecuteDataFlowActivityTypeProperties.class); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataFlow().type()); + Assertions.assertEquals("zmfmgboyliop", model.dataFlow().referenceName()); + Assertions.assertEquals("qbyty", model.staging().linkedService().referenceName()); + Assertions.assertEquals("wrufiouafxp", model.integrationRuntime().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePipelineActivityPolicyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePipelineActivityPolicyTests.java new file mode 100644 index 000000000000..f480ae2e5139 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePipelineActivityPolicyTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ExecutePipelineActivityPolicy; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ExecutePipelineActivityPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExecutePipelineActivityPolicy model = + BinaryData + .fromString("{\"secureInput\":true,\"\":{\"q\":\"datadhrgw\"}}") + .toObject(ExecutePipelineActivityPolicy.class); + Assertions.assertEquals(true, model.secureInput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExecutePipelineActivityPolicy model = + new ExecutePipelineActivityPolicy().withSecureInput(true).withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(ExecutePipelineActivityPolicy.class); + Assertions.assertEquals(true, model.secureInput()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePipelineActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePipelineActivityTests.java new file mode 100644 index 000000000000..38c0dfc15528 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePipelineActivityTests.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.ExecutePipelineActivity; +import com.azure.resourcemanager.datafactory.models.ExecutePipelineActivityPolicy; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ExecutePipelineActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExecutePipelineActivity model = + BinaryData + .fromString( + "{\"type\":\"ExecutePipeline\",\"policy\":{\"secureInput\":true,\"\":{\"xr\":\"datadixoflxvsu\",\"rwbcycwasmrfbwsi\":\"datatcozfjsfrbjrbqcb\",\"gd\":\"datamhhvbovblxfyle\",\"ezszlr\":\"dataiurfemnykfzsouo\"}},\"typeProperties\":{\"pipeline\":{\"referenceName\":\"z\",\"name\":\"dgiijnpkxprb\"},\"parameters\":{\"hbvlljkql\":\"datajfh\",\"btgm\":\"datauhhkkbfgrmscbmd\",\"qjyrqouyfcfdedeu\":\"datapdredcvwsbsdy\",\"elksghsowm\":\"datahgnfaanubjeb\"},\"waitOnCompletion\":false},\"name\":\"jdhw\",\"description\":\"b\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"c\",\"dependencyConditions\":[\"Skipped\"],\"\":{\"ovrsrtldijgrbit\":\"dataavdopecj\",\"hcjtwhwgbaj\":\"datadwuoxirziluzokx\"}},{\"activity\":\"gctwamjjwvmugis\",\"dependencyConditions\":[\"Completed\",\"Completed\",\"Completed\"],\"\":{\"tdyxzg\":\"dataopedmk\",\"rvkqxhkhj\":\"dataqtgfbmocvb\",\"yrqtu\":\"datarcqpxaajt\",\"ssbvlj\":\"datatzmubxngspazm\"}}],\"userProperties\":[{\"name\":\"be\",\"value\":\"datauhwcakkewgzao\"}],\"\":{\"vahqjdi\":\"datalqtjjewezcknpm\",\"ehudicxolmmhfd\":\"datajoldwa\",\"jqvmpzcjvogr\":\"datavxoiwb\",\"ydespwwkdmsnez\":\"dataipop\"}}") + .toObject(ExecutePipelineActivity.class); + Assertions.assertEquals("jdhw", model.name()); + Assertions.assertEquals("b", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("c", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("be", model.userProperties().get(0).name()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals("z", model.pipeline().referenceName()); + Assertions.assertEquals("dgiijnpkxprb", model.pipeline().name()); + Assertions.assertEquals(false, model.waitOnCompletion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExecutePipelineActivity model = + new ExecutePipelineActivity() + .withName("jdhw") + .withDescription("b") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("c") + .withDependencyConditions(Arrays.asList(DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("gctwamjjwvmugis") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties(Arrays.asList(new UserProperty().withName("be").withValue("datauhwcakkewgzao"))) + .withPolicy(new ExecutePipelineActivityPolicy().withSecureInput(true).withAdditionalProperties(mapOf())) + .withPipeline(new PipelineReference().withReferenceName("z").withName("dgiijnpkxprb")) + .withParameters( + mapOf( + "hbvlljkql", + "datajfh", + "btgm", + "datauhhkkbfgrmscbmd", + "qjyrqouyfcfdedeu", + "datapdredcvwsbsdy", + "elksghsowm", + "datahgnfaanubjeb")) + .withWaitOnCompletion(false); + model = BinaryData.fromObject(model).toObject(ExecutePipelineActivity.class); + Assertions.assertEquals("jdhw", model.name()); + Assertions.assertEquals("b", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("c", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("be", model.userProperties().get(0).name()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals("z", model.pipeline().referenceName()); + Assertions.assertEquals("dgiijnpkxprb", model.pipeline().name()); + Assertions.assertEquals(false, model.waitOnCompletion()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePipelineActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePipelineActivityTypePropertiesTests.java new file mode 100644 index 000000000000..649a56cc8064 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePipelineActivityTypePropertiesTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ExecutePipelineActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ExecutePipelineActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExecutePipelineActivityTypeProperties model = + BinaryData + .fromString( + "{\"pipeline\":{\"referenceName\":\"qmelm\",\"name\":\"bepi\"},\"parameters\":{\"er\":\"datave\",\"brnlbfnuppwqks\":\"datau\"},\"waitOnCompletion\":true}") + .toObject(ExecutePipelineActivityTypeProperties.class); + Assertions.assertEquals("qmelm", model.pipeline().referenceName()); + Assertions.assertEquals("bepi", model.pipeline().name()); + Assertions.assertEquals(true, model.waitOnCompletion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExecutePipelineActivityTypeProperties model = + new ExecutePipelineActivityTypeProperties() + .withPipeline(new PipelineReference().withReferenceName("qmelm").withName("bepi")) + .withParameters(mapOf("er", "datave", "brnlbfnuppwqks", "datau")) + .withWaitOnCompletion(true); + model = BinaryData.fromObject(model).toObject(ExecutePipelineActivityTypeProperties.class); + Assertions.assertEquals("qmelm", model.pipeline().referenceName()); + Assertions.assertEquals("bepi", model.pipeline().name()); + Assertions.assertEquals(true, model.waitOnCompletion()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePowerQueryActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePowerQueryActivityTypePropertiesTests.java new file mode 100644 index 000000000000..e8150fd7e9c9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutePowerQueryActivityTypePropertiesTests.java @@ -0,0 +1,596 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ExecutePowerQueryActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowStagingInfo; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.PowerQuerySink; +import com.azure.resourcemanager.datafactory.models.PowerQuerySinkMapping; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ExecutePowerQueryActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExecutePowerQueryActivityTypeProperties model = + BinaryData + .fromString( + "{\"sinks\":{\"fbweuazxtsgs\":{\"script\":\"abnwsgauwepojmx\",\"schemaLinkedService\":{\"referenceName\":\"viykwrffxo\",\"parameters\":{\"dyuoz\":\"datahcxpzjewoyqlcv\",\"npuquyatvsnkrxh\":\"datatsj\",\"ldtjzi\":\"dataegwvblrgrzlrnuy\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"wzpauwhfh\",\"parameters\":{\"wgsyi\":\"dataolojcaybukj\",\"ekxvlejh\":\"dataqlghrcctvlnnkvdr\",\"u\":\"databqzxqid\"}},\"name\":\"wrwjbanteeu\",\"description\":\"icaikfvj\",\"dataset\":{\"referenceName\":\"fpob\",\"parameters\":{\"dlp\":\"datarqjiol\",\"f\":\"datayksqnsrvgh\",\"wtucv\":\"datadrqmcgeqybord\",\"orsgc\":\"dataviymvgnqqfnv\"}},\"linkedService\":{\"referenceName\":\"kn\",\"parameters\":{\"bbzfcjmhp\":\"datacnezdplcbq\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"jpdyztqpszbt\",\"datasetParameters\":\"dataymbyltdnr\",\"parameters\":{\"iz\":\"datahxo\",\"jiyl\":\"datawihadcotfo\"},\"\":{\"bzs\":\"databco\",\"okwaxehxswe\":\"datage\",\"xffttfqlcxymcmo\":\"dataga\"}}},\"pfisyydoy\":{\"script\":\"adsbacemwn\",\"schemaLinkedService\":{\"referenceName\":\"dgimsbump\",\"parameters\":{\"w\":\"datacarcyrftcjxzmx\",\"vxrcmrdmyjcou\":\"datahdlrfyonnb\",\"zirkyxhqwoxm\":\"datazodolehchimzrc\",\"lwhpqnzpfpsppkq\":\"dataobuanybfm\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"dmgmfy\",\"parameters\":{\"fx\":\"datafkfgrdrilh\",\"gz\":\"datarqpickn\"}},\"name\":\"rdicwmueavawyw\",\"description\":\"gcc\",\"dataset\":{\"referenceName\":\"hjvvrrxclf\",\"parameters\":{\"wxxfkfthwxoss\":\"dataifqwyiuhhuftnuig\",\"stgsmeijgjbevts\":\"datakafym\",\"ywal\":\"datacsyjxdwvdklgw\",\"eelbcsyaohizfysa\":\"datafmenbaj\"}},\"linkedService\":{\"referenceName\":\"bupftkddohxvcso\",\"parameters\":{\"ywttdanu\":\"datadcqp\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"tkhcmoccgtmfu\",\"datasetParameters\":\"datakhmbks\",\"parameters\":{\"xdsnmhndcr\":\"datazt\"},\"\":{\"bahuu\":\"dataccmqenf\",\"kolfiigoxohjy\":\"datathden\"}}},\"btmh\":{\"script\":\"cwvcfayll\",\"schemaLinkedService\":{\"referenceName\":\"hqvmilpgxeaqwogp\",\"parameters\":{\"edfmc\":\"datamyfg\",\"ti\":\"datar\",\"voqsudtmkmg\":\"datadkypckhqooqni\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"pv\",\"parameters\":{\"kghugfdugqhmo\":\"datagvpsukkk\",\"tjtiidozfrgvqurr\":\"dataekoxylcbp\"}},\"name\":\"nijdr\",\"description\":\"ohjgdoi\",\"dataset\":{\"referenceName\":\"rylzsgpoi\",\"parameters\":{\"ja\":\"datazqko\",\"zkq\":\"datadm\"}},\"linkedService\":{\"referenceName\":\"zytazqsu\",\"parameters\":{\"osdizpgcq\":\"datapvtwgbf\",\"gwvvenmuenoq\":\"dataglzfgepblhe\",\"oixiduzrdvhgyj\":\"dataamrytrny\",\"fwlxkxlru\":\"datambj\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"olxlxlezzy\",\"datasetParameters\":\"datazz\",\"parameters\":{\"jiaycgxwacuu\":\"datadelmxbxbyx\",\"jbhuzybms\":\"datanygtsjafvzd\",\"uvbnmzjwhybsgz\":\"dataz\"},\"\":{\"qmwmwoggbxiasfi\":\"datafhkznl\",\"lfedwhvhlzpvpix\":\"dataucnp\",\"vc\":\"datajvycodfubnvdibb\"}}},\"plwyluvqp\":{\"script\":\"mpt\",\"schemaLinkedService\":{\"referenceName\":\"r\",\"parameters\":{\"gvksoxyk\":\"dataypauqyaisdiwo\",\"enl\":\"datama\",\"ebg\":\"datavahjlvbnl\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"opsgedsyykueifm\",\"parameters\":{\"b\":\"datatlfdiqzvazffz\"}},\"name\":\"el\",\"description\":\"lrdgpudbimehdx\",\"dataset\":{\"referenceName\":\"tyfhwkb\",\"parameters\":{\"ei\":\"datafnyoautebehjrmfe\",\"pyirngfujv\":\"datanhwgzunbcvfz\",\"rsxxcaxgr\":\"dataafrqqfgudobutkq\",\"wpuas\":\"dataikiuxvdnchrvsfnl\"}},\"linkedService\":{\"referenceName\":\"cblv\",\"parameters\":{\"xxt\":\"datadi\",\"iwvznffmxtmq\":\"datavoasdhd\",\"xpmtztvxfglil\":\"datartpdyhbpfxmr\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"owrzqy\",\"datasetParameters\":\"datajxsgrtnit\",\"parameters\":{\"ffexzzi\":\"datapgenyvpxpcjnb\"},\"\":{\"ewniwt\":\"datat\"}}}},\"queries\":[{\"queryName\":\"yqsnttwlxvezoald\",\"dataflowSinks\":[{\"script\":\"xcqto\",\"schemaLinkedService\":{\"referenceName\":\"anxinlmi\",\"parameters\":{\"uivzsjf\":\"datau\",\"ayk\":\"datanenhyhdu\",\"tzsltsxmdace\":\"datajhwybbdaedq\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"mapfieaumqjxd\",\"parameters\":{\"uiamr\":\"datac\",\"fpwjjtdzfyivv\":\"datalhfxjcq\",\"zfvysvudbj\":\"dataxqpemqogto\"}},\"name\":\"ihtxvmnyslpdqd\",\"description\":\"j\",\"dataset\":{\"referenceName\":\"blnervt\",\"parameters\":{\"si\":\"datadtnjxvtvyy\"}},\"linkedService\":{\"referenceName\":\"bqygnfxgzzq\",\"parameters\":{\"jsugkdv\":\"datavjhmqpjbk\",\"efdsgfztmhvu\":\"datagpeitfbgyznsh\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"poookhcurwgbjzz\",\"datasetParameters\":\"datajwqwyhh\",\"parameters\":{\"ywzpcxnbb\":\"datatseejtfnjrrxfb\",\"ywdckvcofstceehq\":\"datajgvalowmmhhu\",\"fujpo\":\"dataah\",\"edruumldunalog\":\"datatakijwk\"},\"\":{\"e\":\"datakfqc\",\"dvhqecqqiulwfz\":\"datansszu\"}}},{\"script\":\"z\",\"schemaLinkedService\":{\"referenceName\":\"gtwaquiuzsnjjgnm\",\"parameters\":{\"wt\":\"datasjfvdajmczlvcxm\",\"b\":\"datarpd\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"xzxwjzleeupqlszc\",\"parameters\":{\"fxnxtiwinn\":\"dataayraatrjpar\",\"zgmfnpeluvxs\":\"dataowihsgt\"}},\"name\":\"c\",\"description\":\"ukupngorw\",\"dataset\":{\"referenceName\":\"yrguxfjjgcfqfwgr\",\"parameters\":{\"rujdskkkz\":\"datafhkbjgxkrppxj\",\"zdakfxzhapcwhj\":\"dataladibsjirhaqedfu\",\"bdxsjceyyebgfffn\":\"datamjfr\",\"yfugk\":\"datarbnvwhqctq\"}},\"linkedService\":{\"referenceName\":\"xvevudywny\",\"parameters\":{\"xagtiyvdslrrtv\":\"datanaynlxwukpqcf\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"zmzbaqrxz\",\"datasetParameters\":\"dataxtmedoykekbdwqwh\",\"parameters\":{\"eisqkotbmhryri\":\"datayrfjzyiniuua\"},\"\":{\"rswnfakcchc\":\"datayavhesqnvsqte\",\"u\":\"datamzvh\",\"chgvwggylbmfrxof\":\"dataigadpq\"}}},{\"script\":\"yscwv\",\"schemaLinkedService\":{\"referenceName\":\"zfgdxyrpp\",\"parameters\":{\"tbpaircnupmz\":\"datadohiotgf\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"tziejoebzofmmce\",\"parameters\":{\"kpqnpdlcyjse\":\"datafhjrsxrmlxszx\",\"umlfdxetqknzev\":\"datadfhnhbktobeonl\"}},\"name\":\"y\",\"description\":\"nqneo\",\"dataset\":{\"referenceName\":\"crmng\",\"parameters\":{\"cxrxduxct\":\"datainl\",\"gm\":\"datajxtkmd\",\"ipabturkmk\":\"datavfuylpctlbuo\",\"zzsohcaet\":\"datacsqktgko\"}},\"linkedService\":{\"referenceName\":\"pm\",\"parameters\":{\"li\":\"dataqxlkya\",\"ubtykyz\":\"dataoodn\",\"tgbsdaruwv\":\"datargiyqzuhnbazd\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"oozyhucadeqslhz\",\"datasetParameters\":\"dataimqazolroqusrlkp\",\"parameters\":{\"mkbpdpk\":\"dataqydrnwsfa\",\"slqikocgzjmjdoq\":\"datalh\"},\"\":{\"ekbb\":\"datadc\",\"azhr\":\"datatcoxddgjdpyhe\"}}},{\"script\":\"jtjc\",\"schemaLinkedService\":{\"referenceName\":\"ynbs\",\"parameters\":{\"lgfecsreojs\":\"datareqvxzlwgaius\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"kxbbzi\",\"parameters\":{\"yg\":\"datavvgjxbmgheyamoe\"}},\"name\":\"vyiti\",\"description\":\"zxseyjqklaihqrbr\",\"dataset\":{\"referenceName\":\"hljqqbue\",\"parameters\":{\"tifbvcveomdl\":\"datadjsu\"}},\"linkedService\":{\"referenceName\":\"jguwdfn\",\"parameters\":{\"ojmynlvovjs\":\"datauqufaowuibujj\",\"h\":\"dataxewfqvlhjawm\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"zlrnfmmef\",\"datasetParameters\":\"datajxtgffwq\",\"parameters\":{\"t\":\"datagfgirrzyngdvdr\",\"kqaqfbimfpnpmkdg\":\"dataqfrxggvstyxv\",\"jeffpidwqr\":\"datandwtdorvxdwgpu\"},\"\":{\"gaupplcoqbouetf\":\"datajmj\",\"ldlok\":\"datazaja\"}}}]},{\"queryName\":\"mzfltxqpozqd\",\"dataflowSinks\":[{\"script\":\"fe\",\"schemaLinkedService\":{\"referenceName\":\"gjkkjwjn\",\"parameters\":{\"b\":\"dataswmwv\",\"sph\":\"dataazjmfq\",\"ifj\":\"datavthkgjaaqhd\",\"nquj\":\"datafrg\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"wpjpka\",\"parameters\":{\"btlmnrdkiqs\":\"dataafhvuy\"}},\"name\":\"bdv\",\"description\":\"qsmk\",\"dataset\":{\"referenceName\":\"qljxnkpdimexro\",\"parameters\":{\"wovl\":\"datadptsdlcsrhttmhj\"}},\"linkedService\":{\"referenceName\":\"zquckrcw\",\"parameters\":{\"sjawbnxcizeuifnd\":\"dataqqkknulrqpacusm\",\"nzjyghq\":\"datar\",\"ln\":\"datafs\",\"ems\":\"datavgec\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"rkgt\",\"datasetParameters\":\"dataxlaywkbuvedw\",\"parameters\":{\"dgtwx\":\"dataeyfdgnaoirru\"},\"\":{\"eeqelmrp\":\"datarhvgphfzdgs\"}}}]}],\"dataFlow\":{\"type\":\"DataFlowReference\",\"referenceName\":\"gxrgqskdk\",\"datasetParameters\":\"dataobegdxjxkxvgod\",\"parameters\":{\"nulrfeqefqdvooqj\":\"dataefa\"},\"\":{\"gadjllhz\":\"datan\"}},\"staging\":{\"linkedService\":{\"referenceName\":\"vr\",\"parameters\":{\"ttpvomxtosdbvu\":\"datag\",\"oheebzewbif\":\"dataoi\",\"vvuewrhkjmphfhm\":\"datayptlbadhdlrr\",\"uulhfdggsr\":\"dataao\"}},\"folderPath\":\"datalhhlg\"},\"integrationRuntime\":{\"referenceName\":\"bj\",\"parameters\":{\"hocrphzdkikjy\":\"datatgelfkhmgs\",\"lupmyq\":\"dataaqk\"}},\"compute\":{\"computeType\":\"dataararevvmmjwmldg\",\"coreCount\":\"dataglm\"},\"traceLevel\":\"dataatyry\",\"continueOnError\":\"dataon\",\"runConcurrently\":\"datanm\",\"sourceStagingConcurrency\":\"databgpgvliinueltcoi\"}") + .toObject(ExecutePowerQueryActivityTypeProperties.class); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataFlow().type()); + Assertions.assertEquals("gxrgqskdk", model.dataFlow().referenceName()); + Assertions.assertEquals("vr", model.staging().linkedService().referenceName()); + Assertions.assertEquals("bj", model.integrationRuntime().referenceName()); + Assertions.assertEquals("wrwjbanteeu", model.sinks().get("fbweuazxtsgs").name()); + Assertions.assertEquals("icaikfvj", model.sinks().get("fbweuazxtsgs").description()); + Assertions.assertEquals("fpob", model.sinks().get("fbweuazxtsgs").dataset().referenceName()); + Assertions.assertEquals("kn", model.sinks().get("fbweuazxtsgs").linkedService().referenceName()); + Assertions + .assertEquals( + DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get("fbweuazxtsgs").flowlet().type()); + Assertions.assertEquals("jpdyztqpszbt", model.sinks().get("fbweuazxtsgs").flowlet().referenceName()); + Assertions.assertEquals("viykwrffxo", model.sinks().get("fbweuazxtsgs").schemaLinkedService().referenceName()); + Assertions + .assertEquals("wzpauwhfh", model.sinks().get("fbweuazxtsgs").rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("abnwsgauwepojmx", model.sinks().get("fbweuazxtsgs").script()); + Assertions.assertEquals("yqsnttwlxvezoald", model.queries().get(0).queryName()); + Assertions.assertEquals("ihtxvmnyslpdqd", model.queries().get(0).dataflowSinks().get(0).name()); + Assertions.assertEquals("j", model.queries().get(0).dataflowSinks().get(0).description()); + Assertions.assertEquals("blnervt", model.queries().get(0).dataflowSinks().get(0).dataset().referenceName()); + Assertions + .assertEquals("bqygnfxgzzq", model.queries().get(0).dataflowSinks().get(0).linkedService().referenceName()); + Assertions + .assertEquals( + DataFlowReferenceType.DATA_FLOW_REFERENCE, + model.queries().get(0).dataflowSinks().get(0).flowlet().type()); + Assertions + .assertEquals("poookhcurwgbjzz", model.queries().get(0).dataflowSinks().get(0).flowlet().referenceName()); + Assertions + .assertEquals( + "anxinlmi", model.queries().get(0).dataflowSinks().get(0).schemaLinkedService().referenceName()); + Assertions + .assertEquals( + "mapfieaumqjxd", + model.queries().get(0).dataflowSinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("xcqto", model.queries().get(0).dataflowSinks().get(0).script()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExecutePowerQueryActivityTypeProperties model = + new ExecutePowerQueryActivityTypeProperties() + .withDataFlow( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("gxrgqskdk") + .withDatasetParameters("dataobegdxjxkxvgod") + .withParameters(mapOf("nulrfeqefqdvooqj", "dataefa")) + .withAdditionalProperties(mapOf())) + .withStaging( + new DataFlowStagingInfo() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("vr") + .withParameters( + mapOf( + "ttpvomxtosdbvu", + "datag", + "oheebzewbif", + "dataoi", + "vvuewrhkjmphfhm", + "datayptlbadhdlrr", + "uulhfdggsr", + "dataao"))) + .withFolderPath("datalhhlg")) + .withIntegrationRuntime( + new IntegrationRuntimeReference() + .withReferenceName("bj") + .withParameters(mapOf("hocrphzdkikjy", "datatgelfkhmgs", "lupmyq", "dataaqk"))) + .withCompute( + new ExecuteDataFlowActivityTypePropertiesCompute() + .withComputeType("dataararevvmmjwmldg") + .withCoreCount("dataglm")) + .withTraceLevel("dataatyry") + .withContinueOnError("dataon") + .withRunConcurrently("datanm") + .withSourceStagingConcurrency("databgpgvliinueltcoi") + .withSinks( + mapOf( + "fbweuazxtsgs", + new PowerQuerySink() + .withName("wrwjbanteeu") + .withDescription("icaikfvj") + .withDataset( + new DatasetReference() + .withReferenceName("fpob") + .withParameters( + mapOf( + "dlp", + "datarqjiol", + "f", + "datayksqnsrvgh", + "wtucv", + "datadrqmcgeqybord", + "orsgc", + "dataviymvgnqqfnv"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("kn") + .withParameters(mapOf("bbzfcjmhp", "datacnezdplcbq"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("jpdyztqpszbt") + .withDatasetParameters("dataymbyltdnr") + .withParameters(mapOf("iz", "datahxo", "jiyl", "datawihadcotfo")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("viykwrffxo") + .withParameters( + mapOf( + "dyuoz", + "datahcxpzjewoyqlcv", + "npuquyatvsnkrxh", + "datatsj", + "ldtjzi", + "dataegwvblrgrzlrnuy"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("wzpauwhfh") + .withParameters( + mapOf( + "wgsyi", + "dataolojcaybukj", + "ekxvlejh", + "dataqlghrcctvlnnkvdr", + "u", + "databqzxqid"))) + .withScript("abnwsgauwepojmx"), + "pfisyydoy", + new PowerQuerySink() + .withName("rdicwmueavawyw") + .withDescription("gcc") + .withDataset( + new DatasetReference() + .withReferenceName("hjvvrrxclf") + .withParameters( + mapOf( + "wxxfkfthwxoss", + "dataifqwyiuhhuftnuig", + "stgsmeijgjbevts", + "datakafym", + "ywal", + "datacsyjxdwvdklgw", + "eelbcsyaohizfysa", + "datafmenbaj"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("bupftkddohxvcso") + .withParameters(mapOf("ywttdanu", "datadcqp"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("tkhcmoccgtmfu") + .withDatasetParameters("datakhmbks") + .withParameters(mapOf("xdsnmhndcr", "datazt")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("dgimsbump") + .withParameters( + mapOf( + "w", + "datacarcyrftcjxzmx", + "vxrcmrdmyjcou", + "datahdlrfyonnb", + "zirkyxhqwoxm", + "datazodolehchimzrc", + "lwhpqnzpfpsppkq", + "dataobuanybfm"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("dmgmfy") + .withParameters(mapOf("fx", "datafkfgrdrilh", "gz", "datarqpickn"))) + .withScript("adsbacemwn"), + "btmh", + new PowerQuerySink() + .withName("nijdr") + .withDescription("ohjgdoi") + .withDataset( + new DatasetReference() + .withReferenceName("rylzsgpoi") + .withParameters(mapOf("ja", "datazqko", "zkq", "datadm"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("zytazqsu") + .withParameters( + mapOf( + "osdizpgcq", + "datapvtwgbf", + "gwvvenmuenoq", + "dataglzfgepblhe", + "oixiduzrdvhgyj", + "dataamrytrny", + "fwlxkxlru", + "datambj"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("olxlxlezzy") + .withDatasetParameters("datazz") + .withParameters( + mapOf( + "jiaycgxwacuu", + "datadelmxbxbyx", + "jbhuzybms", + "datanygtsjafvzd", + "uvbnmzjwhybsgz", + "dataz")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("hqvmilpgxeaqwogp") + .withParameters( + mapOf("edfmc", "datamyfg", "ti", "datar", "voqsudtmkmg", "datadkypckhqooqni"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("pv") + .withParameters( + mapOf("kghugfdugqhmo", "datagvpsukkk", "tjtiidozfrgvqurr", "dataekoxylcbp"))) + .withScript("cwvcfayll"), + "plwyluvqp", + new PowerQuerySink() + .withName("el") + .withDescription("lrdgpudbimehdx") + .withDataset( + new DatasetReference() + .withReferenceName("tyfhwkb") + .withParameters( + mapOf( + "ei", + "datafnyoautebehjrmfe", + "pyirngfujv", + "datanhwgzunbcvfz", + "rsxxcaxgr", + "dataafrqqfgudobutkq", + "wpuas", + "dataikiuxvdnchrvsfnl"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("cblv") + .withParameters( + mapOf( + "xxt", + "datadi", + "iwvznffmxtmq", + "datavoasdhd", + "xpmtztvxfglil", + "datartpdyhbpfxmr"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("owrzqy") + .withDatasetParameters("datajxsgrtnit") + .withParameters(mapOf("ffexzzi", "datapgenyvpxpcjnb")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("r") + .withParameters( + mapOf( + "gvksoxyk", "dataypauqyaisdiwo", "enl", "datama", "ebg", "datavahjlvbnl"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("opsgedsyykueifm") + .withParameters(mapOf("b", "datatlfdiqzvazffz"))) + .withScript("mpt"))) + .withQueries( + Arrays + .asList( + new PowerQuerySinkMapping() + .withQueryName("yqsnttwlxvezoald") + .withDataflowSinks( + Arrays + .asList( + new PowerQuerySink() + .withName("ihtxvmnyslpdqd") + .withDescription("j") + .withDataset( + new DatasetReference() + .withReferenceName("blnervt") + .withParameters(mapOf("si", "datadtnjxvtvyy"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("bqygnfxgzzq") + .withParameters( + mapOf( + "jsugkdv", + "datavjhmqpjbk", + "efdsgfztmhvu", + "datagpeitfbgyznsh"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("poookhcurwgbjzz") + .withDatasetParameters("datajwqwyhh") + .withParameters( + mapOf( + "ywzpcxnbb", + "datatseejtfnjrrxfb", + "ywdckvcofstceehq", + "datajgvalowmmhhu", + "fujpo", + "dataah", + "edruumldunalog", + "datatakijwk")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("anxinlmi") + .withParameters( + mapOf( + "uivzsjf", + "datau", + "ayk", + "datanenhyhdu", + "tzsltsxmdace", + "datajhwybbdaedq"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("mapfieaumqjxd") + .withParameters( + mapOf( + "uiamr", + "datac", + "fpwjjtdzfyivv", + "datalhfxjcq", + "zfvysvudbj", + "dataxqpemqogto"))) + .withScript("xcqto"), + new PowerQuerySink() + .withName("c") + .withDescription("ukupngorw") + .withDataset( + new DatasetReference() + .withReferenceName("yrguxfjjgcfqfwgr") + .withParameters( + mapOf( + "rujdskkkz", + "datafhkbjgxkrppxj", + "zdakfxzhapcwhj", + "dataladibsjirhaqedfu", + "bdxsjceyyebgfffn", + "datamjfr", + "yfugk", + "datarbnvwhqctq"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("xvevudywny") + .withParameters(mapOf("xagtiyvdslrrtv", "datanaynlxwukpqcf"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("zmzbaqrxz") + .withDatasetParameters("dataxtmedoykekbdwqwh") + .withParameters(mapOf("eisqkotbmhryri", "datayrfjzyiniuua")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("gtwaquiuzsnjjgnm") + .withParameters( + mapOf("wt", "datasjfvdajmczlvcxm", "b", "datarpd"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("xzxwjzleeupqlszc") + .withParameters( + mapOf( + "fxnxtiwinn", + "dataayraatrjpar", + "zgmfnpeluvxs", + "dataowihsgt"))) + .withScript("z"), + new PowerQuerySink() + .withName("y") + .withDescription("nqneo") + .withDataset( + new DatasetReference() + .withReferenceName("crmng") + .withParameters( + mapOf( + "cxrxduxct", + "datainl", + "gm", + "datajxtkmd", + "ipabturkmk", + "datavfuylpctlbuo", + "zzsohcaet", + "datacsqktgko"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("pm") + .withParameters( + mapOf( + "li", + "dataqxlkya", + "ubtykyz", + "dataoodn", + "tgbsdaruwv", + "datargiyqzuhnbazd"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("oozyhucadeqslhz") + .withDatasetParameters("dataimqazolroqusrlkp") + .withParameters( + mapOf( + "mkbpdpk", + "dataqydrnwsfa", + "slqikocgzjmjdoq", + "datalh")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("zfgdxyrpp") + .withParameters(mapOf("tbpaircnupmz", "datadohiotgf"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("tziejoebzofmmce") + .withParameters( + mapOf( + "kpqnpdlcyjse", + "datafhjrsxrmlxszx", + "umlfdxetqknzev", + "datadfhnhbktobeonl"))) + .withScript("yscwv"), + new PowerQuerySink() + .withName("vyiti") + .withDescription("zxseyjqklaihqrbr") + .withDataset( + new DatasetReference() + .withReferenceName("hljqqbue") + .withParameters(mapOf("tifbvcveomdl", "datadjsu"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("jguwdfn") + .withParameters( + mapOf( + "ojmynlvovjs", + "datauqufaowuibujj", + "h", + "dataxewfqvlhjawm"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("zlrnfmmef") + .withDatasetParameters("datajxtgffwq") + .withParameters( + mapOf( + "t", + "datagfgirrzyngdvdr", + "kqaqfbimfpnpmkdg", + "dataqfrxggvstyxv", + "jeffpidwqr", + "datandwtdorvxdwgpu")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("ynbs") + .withParameters(mapOf("lgfecsreojs", "datareqvxzlwgaius"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("kxbbzi") + .withParameters(mapOf("yg", "datavvgjxbmgheyamoe"))) + .withScript("jtjc"))), + new PowerQuerySinkMapping() + .withQueryName("mzfltxqpozqd") + .withDataflowSinks( + Arrays + .asList( + new PowerQuerySink() + .withName("bdv") + .withDescription("qsmk") + .withDataset( + new DatasetReference() + .withReferenceName("qljxnkpdimexro") + .withParameters(mapOf("wovl", "datadptsdlcsrhttmhj"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("zquckrcw") + .withParameters( + mapOf( + "sjawbnxcizeuifnd", + "dataqqkknulrqpacusm", + "nzjyghq", + "datar", + "ln", + "datafs", + "ems", + "datavgec"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("rkgt") + .withDatasetParameters("dataxlaywkbuvedw") + .withParameters(mapOf("dgtwx", "dataeyfdgnaoirru")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("gjkkjwjn") + .withParameters( + mapOf( + "b", + "dataswmwv", + "sph", + "dataazjmfq", + "ifj", + "datavthkgjaaqhd", + "nquj", + "datafrg"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("wpjpka") + .withParameters(mapOf("btlmnrdkiqs", "dataafhvuy"))) + .withScript("fe"))))); + model = BinaryData.fromObject(model).toObject(ExecutePowerQueryActivityTypeProperties.class); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataFlow().type()); + Assertions.assertEquals("gxrgqskdk", model.dataFlow().referenceName()); + Assertions.assertEquals("vr", model.staging().linkedService().referenceName()); + Assertions.assertEquals("bj", model.integrationRuntime().referenceName()); + Assertions.assertEquals("wrwjbanteeu", model.sinks().get("fbweuazxtsgs").name()); + Assertions.assertEquals("icaikfvj", model.sinks().get("fbweuazxtsgs").description()); + Assertions.assertEquals("fpob", model.sinks().get("fbweuazxtsgs").dataset().referenceName()); + Assertions.assertEquals("kn", model.sinks().get("fbweuazxtsgs").linkedService().referenceName()); + Assertions + .assertEquals( + DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get("fbweuazxtsgs").flowlet().type()); + Assertions.assertEquals("jpdyztqpszbt", model.sinks().get("fbweuazxtsgs").flowlet().referenceName()); + Assertions.assertEquals("viykwrffxo", model.sinks().get("fbweuazxtsgs").schemaLinkedService().referenceName()); + Assertions + .assertEquals("wzpauwhfh", model.sinks().get("fbweuazxtsgs").rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("abnwsgauwepojmx", model.sinks().get("fbweuazxtsgs").script()); + Assertions.assertEquals("yqsnttwlxvezoald", model.queries().get(0).queryName()); + Assertions.assertEquals("ihtxvmnyslpdqd", model.queries().get(0).dataflowSinks().get(0).name()); + Assertions.assertEquals("j", model.queries().get(0).dataflowSinks().get(0).description()); + Assertions.assertEquals("blnervt", model.queries().get(0).dataflowSinks().get(0).dataset().referenceName()); + Assertions + .assertEquals("bqygnfxgzzq", model.queries().get(0).dataflowSinks().get(0).linkedService().referenceName()); + Assertions + .assertEquals( + DataFlowReferenceType.DATA_FLOW_REFERENCE, + model.queries().get(0).dataflowSinks().get(0).flowlet().type()); + Assertions + .assertEquals("poookhcurwgbjzz", model.queries().get(0).dataflowSinks().get(0).flowlet().referenceName()); + Assertions + .assertEquals( + "anxinlmi", model.queries().get(0).dataflowSinks().get(0).schemaLinkedService().referenceName()); + Assertions + .assertEquals( + "mapfieaumqjxd", + model.queries().get(0).dataflowSinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("xcqto", model.queries().get(0).dataflowSinks().get(0).script()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteWranglingDataflowActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteWranglingDataflowActivityTests.java new file mode 100644 index 000000000000..8a6dc4bd31cc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecuteWranglingDataflowActivityTests.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowStagingInfo; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.ExecuteDataFlowActivityTypePropertiesCompute; +import com.azure.resourcemanager.datafactory.models.ExecuteWranglingDataflowActivity; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.PowerQuerySink; +import com.azure.resourcemanager.datafactory.models.PowerQuerySinkMapping; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ExecuteWranglingDataflowActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExecuteWranglingDataflowActivity model = + BinaryData + .fromString( + "{\"type\":\"ExecuteWranglingDataflow\",\"typeProperties\":{\"sinks\":{\"bsx\":{\"script\":\"ttefbbrklofkvsh\",\"schemaLinkedService\":{\"referenceName\":\"j\",\"parameters\":{\"acb\":\"datawvdohocsgktfzst\",\"exlhlkpie\":\"datakcxevitvbzy\",\"sibtdmg\":\"datacrtvdcbzpyned\",\"aawehxshamzfx\":\"dataxo\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"uvjbpyvoswgkbzrm\",\"parameters\":{\"uiags\":\"datagvfu\"}},\"name\":\"vzghnq\",\"description\":\"eykvgfhu\",\"dataset\":{\"referenceName\":\"otzygqdcai\",\"parameters\":{\"ynunrajtbumaid\":\"datarytkmfhbpcr\"}},\"linkedService\":{\"referenceName\":\"nyvyutcv\",\"parameters\":{\"j\":\"datagt\",\"xkdqqombiaoaqwwo\":\"datacgtlttnjpgxuxkce\",\"frau\":\"dataxnu\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"tjhtqb\",\"datasetParameters\":\"datadpnzqqti\",\"parameters\":{\"qfkiguk\":\"dataeanakk\",\"nwaymrlvhl\":\"dataximw\"},\"\":{\"aubi\":\"dataiqendtyccnghsz\",\"bqe\":\"dataizjbwufjogsw\",\"etaydhfgxyd\":\"databpypwrvnv\"}}},\"ywdtgz\":{\"script\":\"js\",\"schemaLinkedService\":{\"referenceName\":\"u\",\"parameters\":{\"rtgofpsrhou\":\"datafzyvx\",\"ksehtyxtgsurfnkt\":\"datakcpyerfsngtrijbo\",\"ltc\":\"datahtzrzdqqoydr\",\"kqwffcvahknvnfp\":\"datattjibognhuq\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"obhkqgbijzoixu\",\"parameters\":{\"vajbgpu\":\"datalscnknkukempa\"}},\"name\":\"kstkankzyqizxujl\",\"description\":\"htrgybfumo\",\"dataset\":{\"referenceName\":\"qrut\",\"parameters\":{\"pyrzazkalj\":\"dataynwwml\",\"oaepbfntg\":\"datavmknwlbz\"}},\"linkedService\":{\"referenceName\":\"ungueggphwgix\",\"parameters\":{\"vkoynjucmyjblafv\":\"datavwmvafhriuaaqg\",\"qenbgymgjneoh\":\"datandkvbc\",\"bhg\":\"datakis\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"jodskqyjsdxgefk\",\"datasetParameters\":\"datafihetor\",\"parameters\":{\"rqagpjociunndgp\":\"datafuw\"},\"\":{\"iqzagfkk\":\"datakwyzqnlqzymivjka\"}}},\"xnafojtqqqc\":{\"script\":\"qflpuxy\",\"schemaLinkedService\":{\"referenceName\":\"ofrsoeshqttkq\",\"parameters\":{\"smnyfahidlscdow\":\"datalootceit\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"rniyjqzjtdk\",\"parameters\":{\"odcopirgdsqcbxkw\":\"datax\",\"hyqj\":\"datanqsybwjvifgjztzh\",\"rbirv\":\"dataga\"}},\"name\":\"xubbnb\",\"description\":\"yeggaauubkr\",\"dataset\":{\"referenceName\":\"hkwwibxjpyt\",\"parameters\":{\"elujwcy\":\"datahva\"}},\"linkedService\":{\"referenceName\":\"xbqu\",\"parameters\":{\"c\":\"datarfxir\",\"hfzuraqpcs\":\"dataggwzvdqpxicpoz\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"rdkdomyqbeasbvz\",\"datasetParameters\":\"datakzu\",\"parameters\":{\"wbmfq\":\"dataudqgf\"},\"\":{\"ovqtvbusyqyfit\":\"dataaqltoxhfphaw\",\"ikdcjmbwrhpw\":\"dataprbmmfqteox\",\"dsrwhjhivgeran\":\"dataudegykzdspbjks\"}}}},\"queries\":[{\"queryName\":\"duspxijrr\",\"dataflowSinks\":[{\"script\":\"qcgyvzpvzsdu\",\"schemaLinkedService\":{\"referenceName\":\"ybjucfs\"},\"rejectedDataLinkedService\":{\"referenceName\":\"kq\"},\"name\":\"gfyjwxwpoywymt\",\"description\":\"zdgbgcxyzrzh\",\"dataset\":{\"referenceName\":\"mwcgiahrftpgqx\"},\"linkedService\":{\"referenceName\":\"oak\"},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"lzalsujezgzsekb\"}},{\"script\":\"dbmfejt\",\"schemaLinkedService\":{\"referenceName\":\"oacnyacjyp\"},\"rejectedDataLinkedService\":{\"referenceName\":\"hf\"},\"name\":\"ypykjorlrj\",\"description\":\"zxaamibhkaqz\",\"dataset\":{\"referenceName\":\"jqslshceyhalbxr\"},\"linkedService\":{\"referenceName\":\"snffcoatsupa\"},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"thojrtcdavlrifm\"}},{\"script\":\"ewez\",\"schemaLinkedService\":{\"referenceName\":\"parjrxi\"},\"rejectedDataLinkedService\":{\"referenceName\":\"v\"},\"name\":\"oze\",\"description\":\"zkcigykea\",\"dataset\":{\"referenceName\":\"umhzgdsjbla\"},\"linkedService\":{\"referenceName\":\"shdubqhafxl\"},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"wnkhiwqiq\"}}]},{\"queryName\":\"wbormfnntpocf\",\"dataflowSinks\":[{\"script\":\"sfdohytkhq\",\"schemaLinkedService\":{\"referenceName\":\"dyz\"},\"rejectedDataLinkedService\":{\"referenceName\":\"hqmttswpeaivbz\"},\"name\":\"msoe\",\"description\":\"wjimrzavcif\",\"dataset\":{\"referenceName\":\"ameccuqko\"},\"linkedService\":{\"referenceName\":\"fiomdiecrbcv\"},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"dsyxabddjbzoh\"}},{\"script\":\"qtxluqpzwlbccxj\",\"schemaLinkedService\":{\"referenceName\":\"loihj\"},\"rejectedDataLinkedService\":{\"referenceName\":\"nfvpav\"},\"name\":\"aeeiboqc\",\"description\":\"nxuiiprfijmilo\",\"dataset\":{\"referenceName\":\"dxsphfjzxeswzg\"},\"linkedService\":{\"referenceName\":\"lgggjt\"},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"olxbggojoemtwehv\"}},{\"script\":\"tngatglarczzguar\",\"schemaLinkedService\":{\"referenceName\":\"fab\"},\"rejectedDataLinkedService\":{\"referenceName\":\"eahypjqag\"},\"name\":\"eujuclff\",\"description\":\"djfwsib\",\"dataset\":{\"referenceName\":\"btmwaexybrh\"},\"linkedService\":{\"referenceName\":\"cxh\"},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"abnpdnbtymhheu\"}}]}],\"dataFlow\":{\"type\":\"DataFlowReference\",\"referenceName\":\"mwixyrvrpu\",\"datasetParameters\":\"datau\",\"parameters\":{\"gteihmvxupqfaww\":\"datay\",\"snynvgf\":\"dataxqjhmfyvgmdwv\"},\"\":{\"ndekpzgdr\":\"dataoki\",\"ot\":\"dataddzkkik\",\"tqoxethrxlpgrvtz\":\"datavxyeqdinwqse\"}},\"staging\":{\"linkedService\":{\"referenceName\":\"ns\",\"parameters\":{\"smhoviear\":\"dataqwylh\",\"ben\":\"datakdaomxyx\"}},\"folderPath\":\"datatxhx\"},\"integrationRuntime\":{\"referenceName\":\"knmrcel\",\"parameters\":{\"lfniislohftmf\":\"datadxwywdyqpkwbwo\"}},\"compute\":{\"computeType\":\"datax\",\"coreCount\":\"dataaicyvtsgopmatub\"},\"traceLevel\":\"datajipqynrlnq\",\"continueOnError\":\"dataoelqfsfxthcdzeu\",\"runConcurrently\":\"dataqkvfthbni\",\"sourceStagingConcurrency\":\"dataybrsofpwqmt\"},\"policy\":{\"timeout\":\"datakubymiszoxmzvl\",\"retry\":\"datazdnv\",\"retryIntervalInSeconds\":219796390,\"secureInput\":true,\"secureOutput\":true,\"\":{\"xtxgrh\":\"dataafcxpvxrqegkw\",\"sb\":\"dataqbstodeu\"}},\"name\":\"dcoqm\",\"description\":\"feqlwkpv\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"xccnfykn\",\"dependencyConditions\":[\"Skipped\",\"Failed\",\"Completed\"],\"\":{\"kqmlldeksgejmpkq\":\"dataeqse\",\"qhpkaamoovrb\":\"datajacnbep\",\"gxvkzhqpkckwaaf\":\"databuoqbclhnlqxuxr\"}},{\"activity\":\"yscjawqhpijur\",\"dependencyConditions\":[\"Completed\",\"Failed\"],\"\":{\"j\":\"databjivm\",\"jjzsijmsa\":\"datakvfur\",\"mnvukovxfkxnevc\":\"datacnbluxomzgq\"}}],\"userProperties\":[{\"name\":\"iopgyunfmoc\",\"value\":\"dataycgdkikpqmdi\"},{\"name\":\"hmpmfakinode\",\"value\":\"datappcpwcxfn\"},{\"name\":\"ys\",\"value\":\"datavxaymxldorqp\"},{\"name\":\"jevu\",\"value\":\"datayzglssogze\"}],\"\":{\"bguewtcq\":\"datavir\"}}") + .toObject(ExecuteWranglingDataflowActivity.class); + Assertions.assertEquals("dcoqm", model.name()); + Assertions.assertEquals("feqlwkpv", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("xccnfykn", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("iopgyunfmoc", model.userProperties().get(0).name()); + Assertions.assertEquals(219796390, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("vzghnq", model.sinks().get("bsx").name()); + Assertions.assertEquals("eykvgfhu", model.sinks().get("bsx").description()); + Assertions.assertEquals("otzygqdcai", model.sinks().get("bsx").dataset().referenceName()); + Assertions.assertEquals("nyvyutcv", model.sinks().get("bsx").linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get("bsx").flowlet().type()); + Assertions.assertEquals("tjhtqb", model.sinks().get("bsx").flowlet().referenceName()); + Assertions.assertEquals("j", model.sinks().get("bsx").schemaLinkedService().referenceName()); + Assertions + .assertEquals("uvjbpyvoswgkbzrm", model.sinks().get("bsx").rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("ttefbbrklofkvsh", model.sinks().get("bsx").script()); + Assertions.assertEquals("duspxijrr", model.queries().get(0).queryName()); + Assertions.assertEquals("gfyjwxwpoywymt", model.queries().get(0).dataflowSinks().get(0).name()); + Assertions.assertEquals("zdgbgcxyzrzh", model.queries().get(0).dataflowSinks().get(0).description()); + Assertions + .assertEquals("mwcgiahrftpgqx", model.queries().get(0).dataflowSinks().get(0).dataset().referenceName()); + Assertions.assertEquals("oak", model.queries().get(0).dataflowSinks().get(0).linkedService().referenceName()); + Assertions + .assertEquals( + DataFlowReferenceType.DATA_FLOW_REFERENCE, + model.queries().get(0).dataflowSinks().get(0).flowlet().type()); + Assertions + .assertEquals("lzalsujezgzsekb", model.queries().get(0).dataflowSinks().get(0).flowlet().referenceName()); + Assertions + .assertEquals( + "ybjucfs", model.queries().get(0).dataflowSinks().get(0).schemaLinkedService().referenceName()); + Assertions + .assertEquals( + "kq", model.queries().get(0).dataflowSinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("qcgyvzpvzsdu", model.queries().get(0).dataflowSinks().get(0).script()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataFlow().type()); + Assertions.assertEquals("mwixyrvrpu", model.dataFlow().referenceName()); + Assertions.assertEquals("ns", model.staging().linkedService().referenceName()); + Assertions.assertEquals("knmrcel", model.integrationRuntime().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExecuteWranglingDataflowActivity model = + new ExecuteWranglingDataflowActivity() + .withName("dcoqm") + .withDescription("feqlwkpv") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("xccnfykn") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("yscjawqhpijur") + .withDependencyConditions( + Arrays.asList(DependencyCondition.COMPLETED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("iopgyunfmoc").withValue("dataycgdkikpqmdi"), + new UserProperty().withName("hmpmfakinode").withValue("datappcpwcxfn"), + new UserProperty().withName("ys").withValue("datavxaymxldorqp"), + new UserProperty().withName("jevu").withValue("datayzglssogze"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datakubymiszoxmzvl") + .withRetry("datazdnv") + .withRetryIntervalInSeconds(219796390) + .withSecureInput(true) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withSinks( + mapOf( + "bsx", + new PowerQuerySink() + .withName("vzghnq") + .withDescription("eykvgfhu") + .withDataset( + new DatasetReference() + .withReferenceName("otzygqdcai") + .withParameters(mapOf("ynunrajtbumaid", "datarytkmfhbpcr"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("nyvyutcv") + .withParameters( + mapOf( + "j", + "datagt", + "xkdqqombiaoaqwwo", + "datacgtlttnjpgxuxkce", + "frau", + "dataxnu"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("tjhtqb") + .withDatasetParameters("datadpnzqqti") + .withParameters(mapOf("qfkiguk", "dataeanakk", "nwaymrlvhl", "dataximw")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("j") + .withParameters( + mapOf( + "acb", + "datawvdohocsgktfzst", + "exlhlkpie", + "datakcxevitvbzy", + "sibtdmg", + "datacrtvdcbzpyned", + "aawehxshamzfx", + "dataxo"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("uvjbpyvoswgkbzrm") + .withParameters(mapOf("uiags", "datagvfu"))) + .withScript("ttefbbrklofkvsh"), + "ywdtgz", + new PowerQuerySink() + .withName("kstkankzyqizxujl") + .withDescription("htrgybfumo") + .withDataset( + new DatasetReference() + .withReferenceName("qrut") + .withParameters(mapOf("pyrzazkalj", "dataynwwml", "oaepbfntg", "datavmknwlbz"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("ungueggphwgix") + .withParameters( + mapOf( + "vkoynjucmyjblafv", + "datavwmvafhriuaaqg", + "qenbgymgjneoh", + "datandkvbc", + "bhg", + "datakis"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("jodskqyjsdxgefk") + .withDatasetParameters("datafihetor") + .withParameters(mapOf("rqagpjociunndgp", "datafuw")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("u") + .withParameters( + mapOf( + "rtgofpsrhou", + "datafzyvx", + "ksehtyxtgsurfnkt", + "datakcpyerfsngtrijbo", + "ltc", + "datahtzrzdqqoydr", + "kqwffcvahknvnfp", + "datattjibognhuq"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("obhkqgbijzoixu") + .withParameters(mapOf("vajbgpu", "datalscnknkukempa"))) + .withScript("js"), + "xnafojtqqqc", + new PowerQuerySink() + .withName("xubbnb") + .withDescription("yeggaauubkr") + .withDataset( + new DatasetReference() + .withReferenceName("hkwwibxjpyt") + .withParameters(mapOf("elujwcy", "datahva"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("xbqu") + .withParameters(mapOf("c", "datarfxir", "hfzuraqpcs", "dataggwzvdqpxicpoz"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("rdkdomyqbeasbvz") + .withDatasetParameters("datakzu") + .withParameters(mapOf("wbmfq", "dataudqgf")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("ofrsoeshqttkq") + .withParameters(mapOf("smnyfahidlscdow", "datalootceit"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("rniyjqzjtdk") + .withParameters( + mapOf( + "odcopirgdsqcbxkw", + "datax", + "hyqj", + "datanqsybwjvifgjztzh", + "rbirv", + "dataga"))) + .withScript("qflpuxy"))) + .withQueries( + Arrays + .asList( + new PowerQuerySinkMapping() + .withQueryName("duspxijrr") + .withDataflowSinks( + Arrays + .asList( + new PowerQuerySink() + .withName("gfyjwxwpoywymt") + .withDescription("zdgbgcxyzrzh") + .withDataset(new DatasetReference().withReferenceName("mwcgiahrftpgqx")) + .withLinkedService( + new LinkedServiceReference().withReferenceName("oak")) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("lzalsujezgzsekb") + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference().withReferenceName("ybjucfs")) + .withRejectedDataLinkedService( + new LinkedServiceReference().withReferenceName("kq")) + .withScript("qcgyvzpvzsdu"), + new PowerQuerySink() + .withName("ypykjorlrj") + .withDescription("zxaamibhkaqz") + .withDataset( + new DatasetReference().withReferenceName("jqslshceyhalbxr")) + .withLinkedService( + new LinkedServiceReference().withReferenceName("snffcoatsupa")) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("thojrtcdavlrifm") + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference().withReferenceName("oacnyacjyp")) + .withRejectedDataLinkedService( + new LinkedServiceReference().withReferenceName("hf")) + .withScript("dbmfejt"), + new PowerQuerySink() + .withName("oze") + .withDescription("zkcigykea") + .withDataset(new DatasetReference().withReferenceName("umhzgdsjbla")) + .withLinkedService( + new LinkedServiceReference().withReferenceName("shdubqhafxl")) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("wnkhiwqiq") + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference().withReferenceName("parjrxi")) + .withRejectedDataLinkedService( + new LinkedServiceReference().withReferenceName("v")) + .withScript("ewez"))), + new PowerQuerySinkMapping() + .withQueryName("wbormfnntpocf") + .withDataflowSinks( + Arrays + .asList( + new PowerQuerySink() + .withName("msoe") + .withDescription("wjimrzavcif") + .withDataset(new DatasetReference().withReferenceName("ameccuqko")) + .withLinkedService( + new LinkedServiceReference().withReferenceName("fiomdiecrbcv")) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("dsyxabddjbzoh") + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference().withReferenceName("dyz")) + .withRejectedDataLinkedService( + new LinkedServiceReference().withReferenceName("hqmttswpeaivbz")) + .withScript("sfdohytkhq"), + new PowerQuerySink() + .withName("aeeiboqc") + .withDescription("nxuiiprfijmilo") + .withDataset(new DatasetReference().withReferenceName("dxsphfjzxeswzg")) + .withLinkedService( + new LinkedServiceReference().withReferenceName("lgggjt")) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("olxbggojoemtwehv") + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference().withReferenceName("loihj")) + .withRejectedDataLinkedService( + new LinkedServiceReference().withReferenceName("nfvpav")) + .withScript("qtxluqpzwlbccxj"), + new PowerQuerySink() + .withName("eujuclff") + .withDescription("djfwsib") + .withDataset(new DatasetReference().withReferenceName("btmwaexybrh")) + .withLinkedService( + new LinkedServiceReference().withReferenceName("cxh")) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("abnpdnbtymhheu") + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference().withReferenceName("fab")) + .withRejectedDataLinkedService( + new LinkedServiceReference().withReferenceName("eahypjqag")) + .withScript("tngatglarczzguar"))))) + .withDataFlow( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("mwixyrvrpu") + .withDatasetParameters("datau") + .withParameters(mapOf("gteihmvxupqfaww", "datay", "snynvgf", "dataxqjhmfyvgmdwv")) + .withAdditionalProperties(mapOf())) + .withStaging( + new DataFlowStagingInfo() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("ns") + .withParameters(mapOf("smhoviear", "dataqwylh", "ben", "datakdaomxyx"))) + .withFolderPath("datatxhx")) + .withIntegrationRuntime( + new IntegrationRuntimeReference() + .withReferenceName("knmrcel") + .withParameters(mapOf("lfniislohftmf", "datadxwywdyqpkwbwo"))) + .withCompute( + new ExecuteDataFlowActivityTypePropertiesCompute() + .withComputeType("datax") + .withCoreCount("dataaicyvtsgopmatub")) + .withTraceLevel("datajipqynrlnq") + .withContinueOnError("dataoelqfsfxthcdzeu") + .withRunConcurrently("dataqkvfthbni") + .withSourceStagingConcurrency("dataybrsofpwqmt"); + model = BinaryData.fromObject(model).toObject(ExecuteWranglingDataflowActivity.class); + Assertions.assertEquals("dcoqm", model.name()); + Assertions.assertEquals("feqlwkpv", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("xccnfykn", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("iopgyunfmoc", model.userProperties().get(0).name()); + Assertions.assertEquals(219796390, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("vzghnq", model.sinks().get("bsx").name()); + Assertions.assertEquals("eykvgfhu", model.sinks().get("bsx").description()); + Assertions.assertEquals("otzygqdcai", model.sinks().get("bsx").dataset().referenceName()); + Assertions.assertEquals("nyvyutcv", model.sinks().get("bsx").linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get("bsx").flowlet().type()); + Assertions.assertEquals("tjhtqb", model.sinks().get("bsx").flowlet().referenceName()); + Assertions.assertEquals("j", model.sinks().get("bsx").schemaLinkedService().referenceName()); + Assertions + .assertEquals("uvjbpyvoswgkbzrm", model.sinks().get("bsx").rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("ttefbbrklofkvsh", model.sinks().get("bsx").script()); + Assertions.assertEquals("duspxijrr", model.queries().get(0).queryName()); + Assertions.assertEquals("gfyjwxwpoywymt", model.queries().get(0).dataflowSinks().get(0).name()); + Assertions.assertEquals("zdgbgcxyzrzh", model.queries().get(0).dataflowSinks().get(0).description()); + Assertions + .assertEquals("mwcgiahrftpgqx", model.queries().get(0).dataflowSinks().get(0).dataset().referenceName()); + Assertions.assertEquals("oak", model.queries().get(0).dataflowSinks().get(0).linkedService().referenceName()); + Assertions + .assertEquals( + DataFlowReferenceType.DATA_FLOW_REFERENCE, + model.queries().get(0).dataflowSinks().get(0).flowlet().type()); + Assertions + .assertEquals("lzalsujezgzsekb", model.queries().get(0).dataflowSinks().get(0).flowlet().referenceName()); + Assertions + .assertEquals( + "ybjucfs", model.queries().get(0).dataflowSinks().get(0).schemaLinkedService().referenceName()); + Assertions + .assertEquals( + "kq", model.queries().get(0).dataflowSinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("qcgyvzpvzsdu", model.queries().get(0).dataflowSinks().get(0).script()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataFlow().type()); + Assertions.assertEquals("mwixyrvrpu", model.dataFlow().referenceName()); + Assertions.assertEquals("ns", model.staging().linkedService().referenceName()); + Assertions.assertEquals("knmrcel", model.integrationRuntime().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutionActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutionActivityTests.java new file mode 100644 index 000000000000..5fce2f64ec4c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExecutionActivityTests.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.ExecutionActivity; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ExecutionActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExecutionActivity model = + BinaryData + .fromString( + "{\"type\":\"Execution\",\"linkedServiceName\":{\"referenceName\":\"qizvsihsmtx\",\"parameters\":{\"ubodgouxkianpgu\":\"datajhsjuqqtzr\"}},\"policy\":{\"timeout\":\"dataxxdlgorvu\",\"retry\":\"datanb\",\"retryIntervalInSeconds\":958282428,\"secureInput\":false,\"secureOutput\":true,\"\":{\"kd\":\"datakprxypxti\",\"omev\":\"dataebafiq\",\"butytoainig\":\"dataetamdvncxt\",\"lack\":\"dataxhzqgbaqvqe\"}},\"name\":\"bkr\",\"description\":\"yfnbxw\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"xothfyifju\",\"dependencyConditions\":[\"Failed\"],\"\":{\"uzyycqsxy\":\"datajsmtghm\"}},{\"activity\":\"ywdez\",\"dependencyConditions\":[\"Skipped\",\"Failed\"],\"\":{\"pwwykfytjkzt\":\"datajgyamoc\",\"wqvckhmoudmca\":\"datac\",\"yvibnoeb\":\"datacojfuvmjtxwa\",\"zrkhptyh\":\"datafkgfiydlrjmwaa\"}},{\"activity\":\"iqeoajnaotavwmr\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\"],\"\":{\"yrwvo\":\"datafecjue\"}}],\"userProperties\":[{\"name\":\"cwxba\",\"value\":\"datazypslfqgfwo\"},{\"name\":\"btgpe\",\"value\":\"datazuzxoeouf\"}],\"\":{\"cwlcfcpzajgq\":\"datawgfhdfom\",\"ewfbllegezvwuwi\":\"databfgmeqhtngrxfqwo\"}}") + .toObject(ExecutionActivity.class); + Assertions.assertEquals("bkr", model.name()); + Assertions.assertEquals("yfnbxw", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("xothfyifju", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("cwxba", model.userProperties().get(0).name()); + Assertions.assertEquals("qizvsihsmtx", model.linkedServiceName().referenceName()); + Assertions.assertEquals(958282428, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExecutionActivity model = + new ExecutionActivity() + .withName("bkr") + .withDescription("yfnbxw") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("xothfyifju") + .withDependencyConditions(Arrays.asList(DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ywdez") + .withDependencyConditions( + Arrays.asList(DependencyCondition.SKIPPED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("iqeoajnaotavwmr") + .withDependencyConditions( + Arrays.asList(DependencyCondition.SKIPPED, DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("cwxba").withValue("datazypslfqgfwo"), + new UserProperty().withName("btgpe").withValue("datazuzxoeouf"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("qizvsihsmtx") + .withParameters(mapOf("ubodgouxkianpgu", "datajhsjuqqtzr"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("dataxxdlgorvu") + .withRetry("datanb") + .withRetryIntervalInSeconds(958282428) + .withSecureInput(false) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(ExecutionActivity.class); + Assertions.assertEquals("bkr", model.name()); + Assertions.assertEquals("yfnbxw", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("xothfyifju", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("cwxba", model.userProperties().get(0).name()); + Assertions.assertEquals("qizvsihsmtx", model.linkedServiceName().referenceName()); + Assertions.assertEquals(958282428, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExportSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExportSettingsTests.java new file mode 100644 index 000000000000..d1a73ae4eabb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExportSettingsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ExportSettings; +import java.util.HashMap; +import java.util.Map; + +public final class ExportSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExportSettings model = + BinaryData + .fromString( + "{\"type\":\"ExportSettings\",\"\":{\"l\":\"datani\",\"gyvwxubgul\":\"datadsdmacydqa\",\"pprohuabdufh\":\"datazjkas\",\"npuaptpuwek\":\"dataso\"}}") + .toObject(ExportSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExportSettings model = new ExportSettings().withAdditionalProperties(mapOf("type", "ExportSettings")); + model = BinaryData.fromObject(model).toObject(ExportSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlBatchRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlBatchRequestTests.java new file mode 100644 index 000000000000..f601dbf3e572 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlBatchRequestTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ExposureControlBatchRequest; +import com.azure.resourcemanager.datafactory.models.ExposureControlRequest; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ExposureControlBatchRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExposureControlBatchRequest model = + BinaryData + .fromString( + "{\"exposureControlRequests\":[{\"featureName\":\"fbuhfmvfaxkffe\",\"featureType\":\"th\"}]}") + .toObject(ExposureControlBatchRequest.class); + Assertions.assertEquals("fbuhfmvfaxkffe", model.exposureControlRequests().get(0).featureName()); + Assertions.assertEquals("th", model.exposureControlRequests().get(0).featureType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExposureControlBatchRequest model = + new ExposureControlBatchRequest() + .withExposureControlRequests( + Arrays + .asList(new ExposureControlRequest().withFeatureName("fbuhfmvfaxkffe").withFeatureType("th"))); + model = BinaryData.fromObject(model).toObject(ExposureControlBatchRequest.class); + Assertions.assertEquals("fbuhfmvfaxkffe", model.exposureControlRequests().get(0).featureName()); + Assertions.assertEquals("th", model.exposureControlRequests().get(0).featureType()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlBatchResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlBatchResponseInnerTests.java new file mode 100644 index 000000000000..87fb8d9add27 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlBatchResponseInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ExposureControlBatchResponseInner; +import com.azure.resourcemanager.datafactory.fluent.models.ExposureControlResponseInner; +import java.util.Arrays; + +public final class ExposureControlBatchResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExposureControlBatchResponseInner model = + BinaryData + .fromString( + "{\"exposureControlResponses\":[{\"featureName\":\"ez\",\"value\":\"shxmzsbbzoggigrx\"},{\"featureName\":\"ur\",\"value\":\"xxjnspydptk\"}]}") + .toObject(ExposureControlBatchResponseInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExposureControlBatchResponseInner model = + new ExposureControlBatchResponseInner() + .withExposureControlResponses( + Arrays.asList(new ExposureControlResponseInner(), new ExposureControlResponseInner())); + model = BinaryData.fromObject(model).toObject(ExposureControlBatchResponseInner.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlRequestTests.java new file mode 100644 index 000000000000..b86ea51e2489 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlRequestTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ExposureControlRequest; +import org.junit.jupiter.api.Assertions; + +public final class ExposureControlRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExposureControlRequest model = + BinaryData + .fromString("{\"featureName\":\"mvxi\",\"featureType\":\"uugidyjrrfby\"}") + .toObject(ExposureControlRequest.class); + Assertions.assertEquals("mvxi", model.featureName()); + Assertions.assertEquals("uugidyjrrfby", model.featureType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExposureControlRequest model = + new ExposureControlRequest().withFeatureName("mvxi").withFeatureType("uugidyjrrfby"); + model = BinaryData.fromObject(model).toObject(ExposureControlRequest.class); + Assertions.assertEquals("mvxi", model.featureName()); + Assertions.assertEquals("uugidyjrrfby", model.featureType()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlResponseInnerTests.java new file mode 100644 index 000000000000..ab5ec999e83b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlResponseInnerTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ExposureControlResponseInner; + +public final class ExposureControlResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExposureControlResponseInner model = + BinaryData + .fromString("{\"featureName\":\"svexcsonpclhoco\",\"value\":\"lkevle\"}") + .toObject(ExposureControlResponseInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExposureControlResponseInner model = new ExposureControlResponseInner(); + model = BinaryData.fromObject(model).toObject(ExposureControlResponseInner.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlsGetFeatureValueByFactoryWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlsGetFeatureValueByFactoryWithResponseMockTests.java new file mode 100644 index 000000000000..354878e233fb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlsGetFeatureValueByFactoryWithResponseMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ExposureControlRequest; +import com.azure.resourcemanager.datafactory.models.ExposureControlResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ExposureControlsGetFeatureValueByFactoryWithResponseMockTests { + @Test + public void testGetFeatureValueByFactoryWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"featureName\":\"oonej\",\"value\":\"zqbdutvnl\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ExposureControlResponse response = + manager + .exposureControls() + .getFeatureValueByFactoryWithResponse( + "nursandmusudhjos", + "mm", + new ExposureControlRequest().withFeatureName("tcpffmi").withFeatureType("difbeott"), + com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlsGetFeatureValueWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlsGetFeatureValueWithResponseMockTests.java new file mode 100644 index 000000000000..54d2996c6f49 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlsGetFeatureValueWithResponseMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ExposureControlRequest; +import com.azure.resourcemanager.datafactory.models.ExposureControlResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ExposureControlsGetFeatureValueWithResponseMockTests { + @Test + public void testGetFeatureValueWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"featureName\":\"gmyjmcwnkpbrr\",\"value\":\"zvinkktebl\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ExposureControlResponse response = + manager + .exposureControls() + .getFeatureValueWithResponse( + "naeefzlwohobaac", + new ExposureControlRequest().withFeatureName("lvixf").withFeatureType("noeiqhbr"), + com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlsQueryFeatureValuesByFactoryWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlsQueryFeatureValuesByFactoryWithResponseMockTests.java new file mode 100644 index 000000000000..f22a5de23adf --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExposureControlsQueryFeatureValuesByFactoryWithResponseMockTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ExposureControlBatchRequest; +import com.azure.resourcemanager.datafactory.models.ExposureControlBatchResponse; +import com.azure.resourcemanager.datafactory.models.ExposureControlRequest; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ExposureControlsQueryFeatureValuesByFactoryWithResponseMockTests { + @Test + public void testQueryFeatureValuesByFactoryWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"exposureControlResponses\":[{\"featureName\":\"odpm\",\"value\":\"sggneocqaejle\"},{\"featureName\":\"ydpqwucprpwsg\",\"value\":\"d\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ExposureControlBatchResponse response = + manager + .exposureControls() + .queryFeatureValuesByFactoryWithResponse( + "wvatfa", + "h", + new ExposureControlBatchRequest() + .withExposureControlRequests( + Arrays + .asList( + new ExposureControlRequest() + .withFeatureName("obdq") + .withFeatureType("ngjbeihcaxkivr"), + new ExposureControlRequest().withFeatureName("bcxnnirnfuv").withFeatureType("mep"), + new ExposureControlRequest().withFeatureName("k").withFeatureType("ptsvn"), + new ExposureControlRequest() + .withFeatureName("benfshfmwbt") + .withFeatureType("igmndtjcyvm"))), + com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExpressionTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExpressionTests.java new file mode 100644 index 000000000000..08022db1a875 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ExpressionTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Expression; +import org.junit.jupiter.api.Assertions; + +public final class ExpressionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Expression model = BinaryData.fromString("{\"value\":\"tny\"}").toObject(Expression.class); + Assertions.assertEquals("tny", model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Expression model = new Expression().withValue("tny"); + model = BinaryData.fromObject(model).toObject(Expression.class); + Assertions.assertEquals("tny", model.value()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoriesDeleteByResourceGroupWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoriesDeleteByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..c95ab34e8a04 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoriesDeleteByResourceGroupWithResponseMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class FactoriesDeleteByResourceGroupWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.factories().deleteByResourceGroupWithResponse("bpbbda", "cb", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryIdentityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryIdentityTests.java new file mode 100644 index 000000000000..0271d5f218dd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryIdentityTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FactoryIdentity; +import com.azure.resourcemanager.datafactory.models.FactoryIdentityType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FactoryIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FactoryIdentity model = + BinaryData + .fromString( + "{\"type\":\"SystemAssigned\",\"principalId\":\"b37fcaa7-64f2-4db7-a40e-e1e20fcb2f78\",\"tenantId\":\"28b3eacd-3b18-4dbe-ae5d-16c012a9972c\",\"userAssignedIdentities\":{\"qjpkcattpngjcrc\":\"dataleyyvx\"}}") + .toObject(FactoryIdentity.class); + Assertions.assertEquals(FactoryIdentityType.SYSTEM_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FactoryIdentity model = + new FactoryIdentity() + .withType(FactoryIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("qjpkcattpngjcrc", "dataleyyvx")); + model = BinaryData.fromObject(model).toObject(FactoryIdentity.class); + Assertions.assertEquals(FactoryIdentityType.SYSTEM_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryRepoConfigurationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryRepoConfigurationTests.java new file mode 100644 index 000000000000..683ec06eba51 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryRepoConfigurationTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FactoryRepoConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class FactoryRepoConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FactoryRepoConfiguration model = + BinaryData + .fromString( + "{\"type\":\"FactoryRepoConfiguration\",\"accountName\":\"o\",\"repositoryName\":\"rq\",\"collaborationBranch\":\"b\",\"rootFolder\":\"oczvy\",\"lastCommitId\":\"qrvkdv\",\"disablePublish\":false}") + .toObject(FactoryRepoConfiguration.class); + Assertions.assertEquals("o", model.accountName()); + Assertions.assertEquals("rq", model.repositoryName()); + Assertions.assertEquals("b", model.collaborationBranch()); + Assertions.assertEquals("oczvy", model.rootFolder()); + Assertions.assertEquals("qrvkdv", model.lastCommitId()); + Assertions.assertEquals(false, model.disablePublish()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FactoryRepoConfiguration model = + new FactoryRepoConfiguration() + .withAccountName("o") + .withRepositoryName("rq") + .withCollaborationBranch("b") + .withRootFolder("oczvy") + .withLastCommitId("qrvkdv") + .withDisablePublish(false); + model = BinaryData.fromObject(model).toObject(FactoryRepoConfiguration.class); + Assertions.assertEquals("o", model.accountName()); + Assertions.assertEquals("rq", model.repositoryName()); + Assertions.assertEquals("b", model.collaborationBranch()); + Assertions.assertEquals("oczvy", model.rootFolder()); + Assertions.assertEquals("qrvkdv", model.lastCommitId()); + Assertions.assertEquals(false, model.disablePublish()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryRepoUpdateTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryRepoUpdateTests.java new file mode 100644 index 000000000000..060978235b09 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryRepoUpdateTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FactoryRepoConfiguration; +import com.azure.resourcemanager.datafactory.models.FactoryRepoUpdate; +import org.junit.jupiter.api.Assertions; + +public final class FactoryRepoUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FactoryRepoUpdate model = + BinaryData + .fromString( + "{\"factoryResourceId\":\"qzbqjvsov\",\"repoConfiguration\":{\"type\":\"FactoryRepoConfiguration\",\"accountName\":\"okacspk\",\"repositoryName\":\"lhzdobp\",\"collaborationBranch\":\"jmflbvvnch\",\"rootFolder\":\"kcciwwzjuqkhr\",\"lastCommitId\":\"jiwkuofoskghsau\",\"disablePublish\":true}}") + .toObject(FactoryRepoUpdate.class); + Assertions.assertEquals("qzbqjvsov", model.factoryResourceId()); + Assertions.assertEquals("okacspk", model.repoConfiguration().accountName()); + Assertions.assertEquals("lhzdobp", model.repoConfiguration().repositoryName()); + Assertions.assertEquals("jmflbvvnch", model.repoConfiguration().collaborationBranch()); + Assertions.assertEquals("kcciwwzjuqkhr", model.repoConfiguration().rootFolder()); + Assertions.assertEquals("jiwkuofoskghsau", model.repoConfiguration().lastCommitId()); + Assertions.assertEquals(true, model.repoConfiguration().disablePublish()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FactoryRepoUpdate model = + new FactoryRepoUpdate() + .withFactoryResourceId("qzbqjvsov") + .withRepoConfiguration( + new FactoryRepoConfiguration() + .withAccountName("okacspk") + .withRepositoryName("lhzdobp") + .withCollaborationBranch("jmflbvvnch") + .withRootFolder("kcciwwzjuqkhr") + .withLastCommitId("jiwkuofoskghsau") + .withDisablePublish(true)); + model = BinaryData.fromObject(model).toObject(FactoryRepoUpdate.class); + Assertions.assertEquals("qzbqjvsov", model.factoryResourceId()); + Assertions.assertEquals("okacspk", model.repoConfiguration().accountName()); + Assertions.assertEquals("lhzdobp", model.repoConfiguration().repositoryName()); + Assertions.assertEquals("jmflbvvnch", model.repoConfiguration().collaborationBranch()); + Assertions.assertEquals("kcciwwzjuqkhr", model.repoConfiguration().rootFolder()); + Assertions.assertEquals("jiwkuofoskghsau", model.repoConfiguration().lastCommitId()); + Assertions.assertEquals(true, model.repoConfiguration().disablePublish()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryUpdateParametersTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryUpdateParametersTests.java new file mode 100644 index 000000000000..cfcca6d639ff --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryUpdateParametersTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FactoryIdentity; +import com.azure.resourcemanager.datafactory.models.FactoryIdentityType; +import com.azure.resourcemanager.datafactory.models.FactoryUpdateParameters; +import com.azure.resourcemanager.datafactory.models.PublicNetworkAccess; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FactoryUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FactoryUpdateParameters model = + BinaryData + .fromString( + "{\"tags\":{\"bldngkpoc\":\"kouknvudwtiu\",\"npiucgygevqznty\":\"pazyxoegukg\"},\"identity\":{\"type\":\"SystemAssigned\",\"principalId\":\"10f625b5-4311-42ec-a306-58132df8c701\",\"tenantId\":\"f8678525-59b4-4cfc-adb5-bf483baa0f2a\",\"userAssignedIdentities\":{\"r\":\"datac\",\"dpydn\":\"dataj\",\"sjttgzfbish\":\"datayhxdeoejzicwi\",\"jdeyeamdpha\":\"databkh\"}},\"properties\":{\"publicNetworkAccess\":\"Disabled\"}}") + .toObject(FactoryUpdateParameters.class); + Assertions.assertEquals("kouknvudwtiu", model.tags().get("bldngkpoc")); + Assertions.assertEquals(FactoryIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FactoryUpdateParameters model = + new FactoryUpdateParameters() + .withTags(mapOf("bldngkpoc", "kouknvudwtiu", "npiucgygevqznty", "pazyxoegukg")) + .withIdentity( + new FactoryIdentity() + .withType(FactoryIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "r", + "datac", + "dpydn", + "dataj", + "sjttgzfbish", + "datayhxdeoejzicwi", + "jdeyeamdpha", + "databkh"))) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED); + model = BinaryData.fromObject(model).toObject(FactoryUpdateParameters.class); + Assertions.assertEquals("kouknvudwtiu", model.tags().get("bldngkpoc")); + Assertions.assertEquals(FactoryIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryUpdatePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryUpdatePropertiesTests.java new file mode 100644 index 000000000000..309a4ed79f30 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryUpdatePropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.FactoryUpdateProperties; +import com.azure.resourcemanager.datafactory.models.PublicNetworkAccess; +import org.junit.jupiter.api.Assertions; + +public final class FactoryUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FactoryUpdateProperties model = + BinaryData.fromString("{\"publicNetworkAccess\":\"Disabled\"}").toObject(FactoryUpdateProperties.class); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FactoryUpdateProperties model = + new FactoryUpdateProperties().withPublicNetworkAccess(PublicNetworkAccess.DISABLED); + model = BinaryData.fromObject(model).toObject(FactoryUpdateProperties.class); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryVstsConfigurationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryVstsConfigurationTests.java new file mode 100644 index 000000000000..03c06cedf06f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FactoryVstsConfigurationTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FactoryVstsConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class FactoryVstsConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FactoryVstsConfiguration model = + BinaryData + .fromString( + "{\"type\":\"FactoryVSTSConfiguration\",\"projectName\":\"yeofltfnnxrkad\",\"tenantId\":\"ynnfmuiii\",\"accountName\":\"ipfohykfkx\",\"repositoryName\":\"bcbrwjiutgnjizbe\",\"collaborationBranch\":\"woiymrvz\",\"rootFolder\":\"juyrsrziuctixg\",\"lastCommitId\":\"suif\",\"disablePublish\":false}") + .toObject(FactoryVstsConfiguration.class); + Assertions.assertEquals("ipfohykfkx", model.accountName()); + Assertions.assertEquals("bcbrwjiutgnjizbe", model.repositoryName()); + Assertions.assertEquals("woiymrvz", model.collaborationBranch()); + Assertions.assertEquals("juyrsrziuctixg", model.rootFolder()); + Assertions.assertEquals("suif", model.lastCommitId()); + Assertions.assertEquals(false, model.disablePublish()); + Assertions.assertEquals("yeofltfnnxrkad", model.projectName()); + Assertions.assertEquals("ynnfmuiii", model.tenantId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FactoryVstsConfiguration model = + new FactoryVstsConfiguration() + .withAccountName("ipfohykfkx") + .withRepositoryName("bcbrwjiutgnjizbe") + .withCollaborationBranch("woiymrvz") + .withRootFolder("juyrsrziuctixg") + .withLastCommitId("suif") + .withDisablePublish(false) + .withProjectName("yeofltfnnxrkad") + .withTenantId("ynnfmuiii"); + model = BinaryData.fromObject(model).toObject(FactoryVstsConfiguration.class); + Assertions.assertEquals("ipfohykfkx", model.accountName()); + Assertions.assertEquals("bcbrwjiutgnjizbe", model.repositoryName()); + Assertions.assertEquals("woiymrvz", model.collaborationBranch()); + Assertions.assertEquals("juyrsrziuctixg", model.rootFolder()); + Assertions.assertEquals("suif", model.lastCommitId()); + Assertions.assertEquals(false, model.disablePublish()); + Assertions.assertEquals("yeofltfnnxrkad", model.projectName()); + Assertions.assertEquals("ynnfmuiii", model.tenantId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileServerLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileServerLocationTests.java new file mode 100644 index 000000000000..5f4f1cb99301 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileServerLocationTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FileServerLocation; + +public final class FileServerLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FileServerLocation model = + BinaryData + .fromString( + "{\"type\":\"FileServerLocation\",\"folderPath\":\"datavwdtgckzdqiqdl\",\"fileName\":\"datatrkwxo\",\"\":{\"lglh\":\"dataxsuykznhrfg\",\"f\":\"datary\"}}") + .toObject(FileServerLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FileServerLocation model = + new FileServerLocation().withFolderPath("datavwdtgckzdqiqdl").withFileName("datatrkwxo"); + model = BinaryData.fromObject(model).toObject(FileServerLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileServerReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileServerReadSettingsTests.java new file mode 100644 index 000000000000..3f8cd4601fbd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileServerReadSettingsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FileServerReadSettings; + +public final class FileServerReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FileServerReadSettings model = + BinaryData + .fromString( + "{\"type\":\"FileServerReadSettings\",\"recursive\":\"datakobxvexusjfjuphj\",\"wildcardFolderPath\":\"dataeksvj\",\"wildcardFileName\":\"datapyoatlp\",\"fileListPath\":\"datasxqmmxjdkvy\",\"enablePartitionDiscovery\":\"datalrlfgowvvxjqrus\",\"partitionRootPath\":\"databqyfecnsqeewf\",\"deleteFilesAfterCompletion\":\"datagmkc\",\"modifiedDatetimeStart\":\"dataazi\",\"modifiedDatetimeEnd\":\"datawybwmebmxzwcfd\",\"fileFilter\":\"datakurppwksixh\",\"maxConcurrentConnections\":\"datanvydxjkdsqe\",\"disableMetricsCollection\":\"datajd\",\"\":{\"vahbwhrguqet\":\"dataiqwixsdxxflw\",\"dciwxlgg\":\"databqhyszflzj\",\"cmsqznv\":\"datatpayfklbgshbkdp\",\"loeq\":\"datahjtrashnfofiy\"}}") + .toObject(FileServerReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FileServerReadSettings model = + new FileServerReadSettings() + .withMaxConcurrentConnections("datanvydxjkdsqe") + .withDisableMetricsCollection("datajd") + .withRecursive("datakobxvexusjfjuphj") + .withWildcardFolderPath("dataeksvj") + .withWildcardFileName("datapyoatlp") + .withFileListPath("datasxqmmxjdkvy") + .withEnablePartitionDiscovery("datalrlfgowvvxjqrus") + .withPartitionRootPath("databqyfecnsqeewf") + .withDeleteFilesAfterCompletion("datagmkc") + .withModifiedDatetimeStart("dataazi") + .withModifiedDatetimeEnd("datawybwmebmxzwcfd") + .withFileFilter("datakurppwksixh"); + model = BinaryData.fromObject(model).toObject(FileServerReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileServerWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileServerWriteSettingsTests.java new file mode 100644 index 000000000000..f7cec4064fdd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileServerWriteSettingsTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FileServerWriteSettings; + +public final class FileServerWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FileServerWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"FileServerWriteSettings\",\"maxConcurrentConnections\":\"datacbeauvld\",\"disableMetricsCollection\":\"datan\",\"copyBehavior\":\"datauifqj\",\"\":{\"auugdarfumitjai\":\"datazxbljp\",\"y\":\"datasmokfdyb\"}}") + .toObject(FileServerWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FileServerWriteSettings model = + new FileServerWriteSettings() + .withMaxConcurrentConnections("datacbeauvld") + .withDisableMetricsCollection("datan") + .withCopyBehavior("datauifqj"); + model = BinaryData.fromObject(model).toObject(FileServerWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileShareDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileShareDatasetTests.java new file mode 100644 index 000000000000..c70901535080 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileShareDatasetTests.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import com.azure.resourcemanager.datafactory.models.FileShareDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FileShareDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FileShareDataset model = + BinaryData + .fromString( + "{\"type\":\"FileShare\",\"typeProperties\":{\"folderPath\":\"dataqdonbzzs\",\"fileName\":\"datazyviiwsu\",\"modifiedDatetimeStart\":\"datazhw\",\"modifiedDatetimeEnd\":\"datauifkzqqhb\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"dataoilmkfbeoiipjpng\",\"deserializer\":\"datavuoikdlp\",\"\":{\"wimqnryclocfm\":\"datatug\",\"qhdxtwwulkryb\":\"dataswxvjelei\"}},\"fileFilter\":\"dataevy\",\"compression\":{\"type\":\"datayjecrqkwakkch\",\"level\":\"dataoulborcxuibsdqbd\",\"\":{\"bjqlqfbl\":\"datapectsmwpgweoq\"}}},\"description\":\"ufollcshjuc\",\"structure\":\"databymjjvtpne\",\"schema\":\"datavjeazrah\",\"linkedServiceName\":{\"referenceName\":\"lhbimyii\",\"parameters\":{\"dos\":\"datamcthtpqgf\"}},\"parameters\":{\"flgzh\":{\"type\":\"Bool\",\"defaultValue\":\"datau\"}},\"annotations\":[\"datagwahcrxo\"],\"folder\":{\"name\":\"u\"},\"\":{\"pmhz\":\"datapccxziv\",\"kvnnjdtujq\":\"datahh\",\"tqlfxolrwvtl\":\"datavhnjvpmxnhtmz\"}}") + .toObject(FileShareDataset.class); + Assertions.assertEquals("ufollcshjuc", model.description()); + Assertions.assertEquals("lhbimyii", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("flgzh").type()); + Assertions.assertEquals("u", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FileShareDataset model = + new FileShareDataset() + .withDescription("ufollcshjuc") + .withStructure("databymjjvtpne") + .withSchema("datavjeazrah") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("lhbimyii") + .withParameters(mapOf("dos", "datamcthtpqgf"))) + .withParameters( + mapOf("flgzh", new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datau"))) + .withAnnotations(Arrays.asList("datagwahcrxo")) + .withFolder(new DatasetFolder().withName("u")) + .withFolderPath("dataqdonbzzs") + .withFileName("datazyviiwsu") + .withModifiedDatetimeStart("datazhw") + .withModifiedDatetimeEnd("datauifkzqqhb") + .withFormat( + new DatasetStorageFormat() + .withSerializer("dataoilmkfbeoiipjpng") + .withDeserializer("datavuoikdlp") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withFileFilter("dataevy") + .withCompression( + new DatasetCompression() + .withType("datayjecrqkwakkch") + .withLevel("dataoulborcxuibsdqbd") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(FileShareDataset.class); + Assertions.assertEquals("ufollcshjuc", model.description()); + Assertions.assertEquals("lhbimyii", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("flgzh").type()); + Assertions.assertEquals("u", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileShareDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileShareDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..11b16f4ad56c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileShareDatasetTypePropertiesTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.FileShareDatasetTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import java.util.HashMap; +import java.util.Map; + +public final class FileShareDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FileShareDatasetTypeProperties model = + BinaryData + .fromString( + "{\"folderPath\":\"datayfjswequf\",\"fileName\":\"datayyopoaytwwgw\",\"modifiedDatetimeStart\":\"datab\",\"modifiedDatetimeEnd\":\"databvufrkwjiemimdtn\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"dataewjskreeedddrftf\",\"deserializer\":\"dataulpclhsiige\",\"\":{\"nqyxfedq\":\"datab\",\"dqw\":\"datae\",\"zp\":\"datanxoqgv\",\"meyobqajejirvavr\":\"datagp\"}},\"fileFilter\":\"datagpogpl\",\"compression\":{\"type\":\"datauvlnhxnrnjhinaeg\",\"level\":\"databx\",\"\":{\"fhsovadkrmjxmwq\":\"dataqmjmoplukfyk\"}}}") + .toObject(FileShareDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FileShareDatasetTypeProperties model = + new FileShareDatasetTypeProperties() + .withFolderPath("datayfjswequf") + .withFileName("datayyopoaytwwgw") + .withModifiedDatetimeStart("datab") + .withModifiedDatetimeEnd("databvufrkwjiemimdtn") + .withFormat( + new DatasetStorageFormat() + .withSerializer("dataewjskreeedddrftf") + .withDeserializer("dataulpclhsiige") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withFileFilter("datagpogpl") + .withCompression( + new DatasetCompression() + .withType("datauvlnhxnrnjhinaeg") + .withLevel("databx") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(FileShareDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileSystemSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileSystemSinkTests.java new file mode 100644 index 000000000000..122803c5ee16 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileSystemSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FileSystemSink; + +public final class FileSystemSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FileSystemSink model = + BinaryData + .fromString( + "{\"type\":\"FileSystemSink\",\"copyBehavior\":\"datagw\",\"writeBatchSize\":\"dataujshcsnk\",\"writeBatchTimeout\":\"datagpqxqevt\",\"sinkRetryCount\":\"datavyy\",\"sinkRetryWait\":\"datakjirvjogsalvjl\",\"maxConcurrentConnections\":\"dataimua\",\"disableMetricsCollection\":\"datakympwquu\",\"\":{\"iqeftgunropdpuf\":\"dataofuzthszjyanhs\"}}") + .toObject(FileSystemSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FileSystemSink model = + new FileSystemSink() + .withWriteBatchSize("dataujshcsnk") + .withWriteBatchTimeout("datagpqxqevt") + .withSinkRetryCount("datavyy") + .withSinkRetryWait("datakjirvjogsalvjl") + .withMaxConcurrentConnections("dataimua") + .withDisableMetricsCollection("datakympwquu") + .withCopyBehavior("datagw"); + model = BinaryData.fromObject(model).toObject(FileSystemSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileSystemSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileSystemSourceTests.java new file mode 100644 index 000000000000..b9532aead374 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FileSystemSourceTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FileSystemSource; + +public final class FileSystemSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FileSystemSource model = + BinaryData + .fromString( + "{\"type\":\"FileSystemSource\",\"recursive\":\"dataatcistdbe\",\"additionalColumns\":\"databuajkodpzqtg\",\"sourceRetryCount\":\"datazwx\",\"sourceRetryWait\":\"dataaask\",\"maxConcurrentConnections\":\"datasjbuhzucdljqj\",\"disableMetricsCollection\":\"datancjwzeatezlt\",\"\":{\"hhxivshju\":\"datadkjph\",\"xearlp\":\"datamcjyt\",\"uxbungmpnrytguc\":\"dataajjticlydo\",\"cjugoa\":\"datafxgl\"}}") + .toObject(FileSystemSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FileSystemSource model = + new FileSystemSource() + .withSourceRetryCount("datazwx") + .withSourceRetryWait("dataaask") + .withMaxConcurrentConnections("datasjbuhzucdljqj") + .withDisableMetricsCollection("datancjwzeatezlt") + .withRecursive("dataatcistdbe") + .withAdditionalColumns("databuajkodpzqtg"); + model = BinaryData.fromObject(model).toObject(FileSystemSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FilterActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FilterActivityTests.java new file mode 100644 index 000000000000..d3aa92785f38 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FilterActivityTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.Expression; +import com.azure.resourcemanager.datafactory.models.FilterActivity; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FilterActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FilterActivity model = + BinaryData + .fromString( + "{\"type\":\"Filter\",\"typeProperties\":{\"items\":{\"value\":\"rpxlfyytjm\"},\"condition\":{\"value\":\"roxvsclmt\"}},\"name\":\"kmlfcgk\",\"description\":\"itphzu\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"bbestyyml\",\"dependencyConditions\":[\"Succeeded\"],\"\":{\"grnyxri\":\"datapu\"}}],\"userProperties\":[{\"name\":\"kfudra\",\"value\":\"datamdcfwawzjhfa\"},{\"name\":\"ubcvnafxwhicac\",\"value\":\"datavi\"},{\"name\":\"lhommhaxt\",\"value\":\"datagrufbzgnrjfzba\"}],\"\":{\"wqstczpskzplbz\":\"datamkmqdfjeu\"}}") + .toObject(FilterActivity.class); + Assertions.assertEquals("kmlfcgk", model.name()); + Assertions.assertEquals("itphzu", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("bbestyyml", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("kfudra", model.userProperties().get(0).name()); + Assertions.assertEquals("rpxlfyytjm", model.items().value()); + Assertions.assertEquals("roxvsclmt", model.condition().value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FilterActivity model = + new FilterActivity() + .withName("kmlfcgk") + .withDescription("itphzu") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("bbestyyml") + .withDependencyConditions(Arrays.asList(DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("kfudra").withValue("datamdcfwawzjhfa"), + new UserProperty().withName("ubcvnafxwhicac").withValue("datavi"), + new UserProperty().withName("lhommhaxt").withValue("datagrufbzgnrjfzba"))) + .withItems(new Expression().withValue("rpxlfyytjm")) + .withCondition(new Expression().withValue("roxvsclmt")); + model = BinaryData.fromObject(model).toObject(FilterActivity.class); + Assertions.assertEquals("kmlfcgk", model.name()); + Assertions.assertEquals("itphzu", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("bbestyyml", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("kfudra", model.userProperties().get(0).name()); + Assertions.assertEquals("rpxlfyytjm", model.items().value()); + Assertions.assertEquals("roxvsclmt", model.condition().value()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FilterActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FilterActivityTypePropertiesTests.java new file mode 100644 index 000000000000..a7744bd93bbf --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FilterActivityTypePropertiesTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.FilterActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.Expression; +import org.junit.jupiter.api.Assertions; + +public final class FilterActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FilterActivityTypeProperties model = + BinaryData + .fromString("{\"items\":{\"value\":\"juqvywol\"},\"condition\":{\"value\":\"cxdc\"}}") + .toObject(FilterActivityTypeProperties.class); + Assertions.assertEquals("juqvywol", model.items().value()); + Assertions.assertEquals("cxdc", model.condition().value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FilterActivityTypeProperties model = + new FilterActivityTypeProperties() + .withItems(new Expression().withValue("juqvywol")) + .withCondition(new Expression().withValue("cxdc")); + model = BinaryData.fromObject(model).toObject(FilterActivityTypeProperties.class); + Assertions.assertEquals("juqvywol", model.items().value()); + Assertions.assertEquals("cxdc", model.condition().value()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FlowletTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FlowletTests.java new file mode 100644 index 000000000000..9cf40483cb87 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FlowletTests.java @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowSink; +import com.azure.resourcemanager.datafactory.models.DataFlowSource; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.Flowlet; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.Transformation; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FlowletTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Flowlet model = + BinaryData + .fromString( + "{\"type\":\"Flowlet\",\"typeProperties\":{\"sources\":[{\"schemaLinkedService\":{\"referenceName\":\"pnw\",\"parameters\":{\"ffffg\":\"datafvpctfji\",\"ejjk\":\"datauhznwhvuldbk\",\"azmxjqi\":\"dataigaw\"}},\"name\":\"h\",\"description\":\"jsbcml\",\"dataset\":{\"referenceName\":\"ahz\",\"parameters\":{\"hmojusuzg\":\"dataroolkolir\",\"aaxoialahfxwcc\":\"datajzc\",\"kczynuhhoqeqsh\":\"datakdxkuk\",\"q\":\"datavl\"}},\"linkedService\":{\"referenceName\":\"yrqolnthbbnkgz\",\"parameters\":{\"eyjncjmlfuy\":\"datadrnzkjthf\",\"rufzcqyjmq\":\"datajbpfiddh\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"iocuselqkr\",\"datasetParameters\":\"datazrhxuddqmdtf\",\"parameters\":{\"khmwdmd\":\"datajmr\",\"okwtjawhvagnqfqq\":\"datagyqi\"},\"\":{\"chtvsnvlaqd\":\"datavmyolcaym\",\"zawatuwqkokbc\":\"dataz\",\"msn\":\"dataothymgobl\",\"aaneakhtmhobcya\":\"datagwi\"}}}],\"sinks\":[{\"schemaLinkedService\":{\"referenceName\":\"qtvkh\",\"parameters\":{\"ymhcctopuo\":\"dataogxkfnaoa\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"rnskby\",\"parameters\":{\"xqnwhscoz\":\"datahczygxvhajpxe\",\"ljfewxqo\":\"datawmvgxsmpknpwir\"}},\"name\":\"oxudnmckap\",\"description\":\"knq\",\"dataset\":{\"referenceName\":\"jgencdgmoque\",\"parameters\":{\"ltjouwhldxwh\":\"datakkyo\",\"q\":\"dataepr\",\"cvprst\":\"datasmfx\"}},\"linkedService\":{\"referenceName\":\"itbfjtdy\",\"parameters\":{\"etjt\":\"dataplfacqoccqrqx\",\"oadtxopgehpadkmd\":\"datarhutf\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"szxvctkbbxuhar\",\"datasetParameters\":\"datair\",\"parameters\":{\"bmyqjog\":\"datalabvoyngsuxxc\",\"rntu\":\"datadsaidjanormovdxx\"},\"\":{\"nwemhdeeljslkyo\":\"datail\",\"fzjuegrhrhtsl\":\"datad\",\"j\":\"datajtv\"}}},{\"schemaLinkedService\":{\"referenceName\":\"vgjbfio\",\"parameters\":{\"cbjqqwmtqsm\":\"datajod\",\"cywnfyszza\":\"dataxsazuxejgw\",\"ozsyvrm\":\"datazsinqbdnddb\",\"eeih\":\"datajmyitrchwudl\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"mnoejhqlfmsib\",\"parameters\":{\"mypgfqvmty\":\"datarfgxkyd\",\"kxp\":\"datahl\"}},\"name\":\"jpewpyjlfx\",\"description\":\"pqcrzgeuqxbpiat\",\"dataset\":{\"referenceName\":\"aujegqdtadra\",\"parameters\":{\"gsq\":\"datadhjkrukizy\",\"qfpjb\":\"datanqskt\"}},\"linkedService\":{\"referenceName\":\"gweeiwd\",\"parameters\":{\"gbfzu\":\"datan\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"tunmlhxd\",\"datasetParameters\":\"dataklciichgjsysm\",\"parameters\":{\"bdujgcwxvecbb\":\"datadgwxfkzsifcu\"},\"\":{\"kpgdqxwabzrwiq\":\"datardxrizagbbgiarks\",\"kifmmainw\":\"dataxhaclcdosqkptjq\"}}},{\"schemaLinkedService\":{\"referenceName\":\"d\",\"parameters\":{\"gvydjufbnklblaxp\":\"databqwuntobuizazzel\",\"lfdxaglz\":\"datagjwdab\",\"siflikyypzkgxf\":\"dataytlbtlqhopxouvm\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"myrqsdbpokszan\",\"parameters\":{\"kirkskw\":\"datagpterdiu\",\"olzkgys\":\"datatsdetjygowifcq\",\"zoxlvoc\":\"datagzyy\"}},\"name\":\"tvdxxhe\",\"description\":\"mlil\",\"dataset\":{\"referenceName\":\"ghjhjvmabzzbwa\",\"parameters\":{\"apr\":\"datamdafbgymqt\",\"neychbjizq\":\"dataojxrjnbsconxavi\",\"rfbo\":\"datasgnwdxzedpq\",\"mlnfyz\":\"dataxi\"}},\"linkedService\":{\"referenceName\":\"frbypi\",\"parameters\":{\"aq\":\"datakpdj\",\"dgonjhxshthmgp\":\"datasmqaz\",\"pxtzhigqqbtimpk\":\"datazqulptkbv\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"o\",\"datasetParameters\":\"datas\",\"parameters\":{\"jakx\":\"datahudsmusuaa\",\"vqban\":\"datajnfczmnniixy\",\"gm\":\"datasjtgirnbgmgmddo\",\"yxwe\":\"datanltwmpftmfoeajog\"},\"\":{\"hdidrmuhkahmjedb\":\"datafddrvlkpzwbhnrec\"}}}],\"transformations\":[{\"name\":\"vkhhwm\",\"description\":\"jbweunxcqr\",\"dataset\":{\"referenceName\":\"hu\",\"parameters\":{\"gnzuzpbgkzcsc\":\"datahppiybx\",\"ti\":\"dataiuzvkunhdimju\"}},\"linkedService\":{\"referenceName\":\"kaugpucdocfqplwg\",\"parameters\":{\"jlvzklk\":\"datahxw\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"ikyjtkakvlb\",\"datasetParameters\":\"datahjvpzaptu\",\"parameters\":{\"fgcdiykkcxw\":\"dataaoizjix\",\"dmuqohhi\":\"dataujvqynvavit\",\"ddrwjcljbrhlhpvz\":\"dataraxq\"},\"\":{\"fhxrzfr\":\"datawennin\",\"rcqxgcbvzarmqc\":\"datavztiucwviqllukh\",\"stsinvag\":\"datapo\"}}},{\"name\":\"vjyhdrxbrdvc\",\"description\":\"qwh\",\"dataset\":{\"referenceName\":\"xnmxgnmguzb\",\"parameters\":{\"bkbdhlltqstqkqs\":\"dataorbalkj\",\"eubanlxunpqcc\":\"datagxiynecovagzk\",\"klaslga\":\"dataqiawzl\"}},\"linkedService\":{\"referenceName\":\"zuxlrarwpewsau\",\"parameters\":{\"ytnkqb\":\"datajtighsxj\",\"mehjnhjioti\":\"datalahovuuwx\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"bcngkegxc\",\"datasetParameters\":\"dataxbbfetwil\",\"parameters\":{\"frolq\":\"dataoxpdxq\"},\"\":{\"jew\":\"datakiu\",\"tnlmsoodtmvecdhd\":\"dataahwkxjjm\",\"zxvlgsrgkrfizrp\":\"dataswcrptveaj\"}}},{\"name\":\"wlp\",\"description\":\"uqhrlmcskykp\",\"dataset\":{\"referenceName\":\"ofix\",\"parameters\":{\"kkpyycpaw\":\"datacf\",\"cfpcfjfwzlgz\":\"datapjprdpwr\"}},\"linkedService\":{\"referenceName\":\"kgyepe\",\"parameters\":{\"rntmkctdhu\":\"datannidmdiawpzxk\",\"hqodv\":\"datasgwqpsqaz\",\"ti\":\"datagcnbhcbmjk\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"ynts\",\"datasetParameters\":\"datamfmeftvhkmoo\",\"parameters\":{\"gmjgrul\":\"datahskb\"},\"\":{\"z\":\"datagxhcxnwjtpfdzxco\",\"k\":\"datawofw\"}}},{\"name\":\"kzkdtzxsoednlwg\",\"description\":\"hezomucmqgisnion\",\"dataset\":{\"referenceName\":\"bzdrdpuenxkgt\",\"parameters\":{\"hzkbnbmx\":\"datamtrlxczn\",\"itoqcahfsg\":\"dataxmwtygeqzu\",\"lisolntfxxc\":\"datajmlreesrfwsszvlc\"}},\"linkedService\":{\"referenceName\":\"mipfjw\",\"parameters\":{\"nvgskjtoxjd\":\"datagizmshxxbaizabu\",\"xqqm\":\"datajsjznv\",\"aydhf\":\"datai\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"c\",\"datasetParameters\":\"datatfshksnyzm\",\"parameters\":{\"iqdktwtkvih\":\"datamwbwmbnlslce\",\"nguuzhwvla\":\"datapfliwo\",\"mhjhaus\":\"datap\",\"ekymffztsilscvqs\":\"datab\"},\"\":{\"fymkouih\":\"datai\",\"zhogsmgbvmtdw\":\"dataeseuugci\",\"jnfveg\":\"dataqbe\"}}}],\"script\":\"btvkbi\",\"scriptLines\":[\"htfgficudyhizpac\",\"muhbcakznho\"]},\"description\":\"oitwhrjsdmmazdnc\",\"annotations\":[\"datab\"],\"folder\":{\"name\":\"lhzqpxzbawkikcdg\"}}") + .toObject(Flowlet.class); + Assertions.assertEquals("oitwhrjsdmmazdnc", model.description()); + Assertions.assertEquals("lhzqpxzbawkikcdg", model.folder().name()); + Assertions.assertEquals("h", model.sources().get(0).name()); + Assertions.assertEquals("jsbcml", model.sources().get(0).description()); + Assertions.assertEquals("ahz", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("yrqolnthbbnkgz", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("iocuselqkr", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("pnw", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("oxudnmckap", model.sinks().get(0).name()); + Assertions.assertEquals("knq", model.sinks().get(0).description()); + Assertions.assertEquals("jgencdgmoque", model.sinks().get(0).dataset().referenceName()); + Assertions.assertEquals("itbfjtdy", model.sinks().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get(0).flowlet().type()); + Assertions.assertEquals("szxvctkbbxuhar", model.sinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("qtvkh", model.sinks().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("rnskby", model.sinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("vkhhwm", model.transformations().get(0).name()); + Assertions.assertEquals("jbweunxcqr", model.transformations().get(0).description()); + Assertions.assertEquals("hu", model.transformations().get(0).dataset().referenceName()); + Assertions.assertEquals("kaugpucdocfqplwg", model.transformations().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.transformations().get(0).flowlet().type()); + Assertions.assertEquals("ikyjtkakvlb", model.transformations().get(0).flowlet().referenceName()); + Assertions.assertEquals("btvkbi", model.script()); + Assertions.assertEquals("htfgficudyhizpac", model.scriptLines().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Flowlet model = + new Flowlet() + .withDescription("oitwhrjsdmmazdnc") + .withAnnotations(Arrays.asList("datab")) + .withFolder(new DataFlowFolder().withName("lhzqpxzbawkikcdg")) + .withSources( + Arrays + .asList( + new DataFlowSource() + .withName("h") + .withDescription("jsbcml") + .withDataset( + new DatasetReference() + .withReferenceName("ahz") + .withParameters( + mapOf( + "hmojusuzg", + "dataroolkolir", + "aaxoialahfxwcc", + "datajzc", + "kczynuhhoqeqsh", + "datakdxkuk", + "q", + "datavl"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("yrqolnthbbnkgz") + .withParameters( + mapOf("eyjncjmlfuy", "datadrnzkjthf", "rufzcqyjmq", "datajbpfiddh"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("iocuselqkr") + .withDatasetParameters("datazrhxuddqmdtf") + .withParameters(mapOf("khmwdmd", "datajmr", "okwtjawhvagnqfqq", "datagyqi")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("pnw") + .withParameters( + mapOf( + "ffffg", + "datafvpctfji", + "ejjk", + "datauhznwhvuldbk", + "azmxjqi", + "dataigaw"))))) + .withSinks( + Arrays + .asList( + new DataFlowSink() + .withName("oxudnmckap") + .withDescription("knq") + .withDataset( + new DatasetReference() + .withReferenceName("jgencdgmoque") + .withParameters( + mapOf("ltjouwhldxwh", "datakkyo", "q", "dataepr", "cvprst", "datasmfx"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("itbfjtdy") + .withParameters( + mapOf("etjt", "dataplfacqoccqrqx", "oadtxopgehpadkmd", "datarhutf"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("szxvctkbbxuhar") + .withDatasetParameters("datair") + .withParameters( + mapOf("bmyqjog", "datalabvoyngsuxxc", "rntu", "datadsaidjanormovdxx")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("qtvkh") + .withParameters(mapOf("ymhcctopuo", "dataogxkfnaoa"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("rnskby") + .withParameters( + mapOf("xqnwhscoz", "datahczygxvhajpxe", "ljfewxqo", "datawmvgxsmpknpwir"))), + new DataFlowSink() + .withName("jpewpyjlfx") + .withDescription("pqcrzgeuqxbpiat") + .withDataset( + new DatasetReference() + .withReferenceName("aujegqdtadra") + .withParameters(mapOf("gsq", "datadhjkrukizy", "qfpjb", "datanqskt"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("gweeiwd") + .withParameters(mapOf("gbfzu", "datan"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("tunmlhxd") + .withDatasetParameters("dataklciichgjsysm") + .withParameters(mapOf("bdujgcwxvecbb", "datadgwxfkzsifcu")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("vgjbfio") + .withParameters( + mapOf( + "cbjqqwmtqsm", + "datajod", + "cywnfyszza", + "dataxsazuxejgw", + "ozsyvrm", + "datazsinqbdnddb", + "eeih", + "datajmyitrchwudl"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("mnoejhqlfmsib") + .withParameters(mapOf("mypgfqvmty", "datarfgxkyd", "kxp", "datahl"))), + new DataFlowSink() + .withName("tvdxxhe") + .withDescription("mlil") + .withDataset( + new DatasetReference() + .withReferenceName("ghjhjvmabzzbwa") + .withParameters( + mapOf( + "apr", + "datamdafbgymqt", + "neychbjizq", + "dataojxrjnbsconxavi", + "rfbo", + "datasgnwdxzedpq", + "mlnfyz", + "dataxi"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("frbypi") + .withParameters( + mapOf( + "aq", + "datakpdj", + "dgonjhxshthmgp", + "datasmqaz", + "pxtzhigqqbtimpk", + "datazqulptkbv"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("o") + .withDatasetParameters("datas") + .withParameters( + mapOf( + "jakx", + "datahudsmusuaa", + "vqban", + "datajnfczmnniixy", + "gm", + "datasjtgirnbgmgmddo", + "yxwe", + "datanltwmpftmfoeajog")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("d") + .withParameters( + mapOf( + "gvydjufbnklblaxp", + "databqwuntobuizazzel", + "lfdxaglz", + "datagjwdab", + "siflikyypzkgxf", + "dataytlbtlqhopxouvm"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("myrqsdbpokszan") + .withParameters( + mapOf( + "kirkskw", + "datagpterdiu", + "olzkgys", + "datatsdetjygowifcq", + "zoxlvoc", + "datagzyy"))))) + .withTransformations( + Arrays + .asList( + new Transformation() + .withName("vkhhwm") + .withDescription("jbweunxcqr") + .withDataset( + new DatasetReference() + .withReferenceName("hu") + .withParameters( + mapOf("gnzuzpbgkzcsc", "datahppiybx", "ti", "dataiuzvkunhdimju"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("kaugpucdocfqplwg") + .withParameters(mapOf("jlvzklk", "datahxw"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("ikyjtkakvlb") + .withDatasetParameters("datahjvpzaptu") + .withParameters( + mapOf( + "fgcdiykkcxw", + "dataaoizjix", + "dmuqohhi", + "dataujvqynvavit", + "ddrwjcljbrhlhpvz", + "dataraxq")) + .withAdditionalProperties(mapOf())), + new Transformation() + .withName("vjyhdrxbrdvc") + .withDescription("qwh") + .withDataset( + new DatasetReference() + .withReferenceName("xnmxgnmguzb") + .withParameters( + mapOf( + "bkbdhlltqstqkqs", + "dataorbalkj", + "eubanlxunpqcc", + "datagxiynecovagzk", + "klaslga", + "dataqiawzl"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("zuxlrarwpewsau") + .withParameters( + mapOf("ytnkqb", "datajtighsxj", "mehjnhjioti", "datalahovuuwx"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("bcngkegxc") + .withDatasetParameters("dataxbbfetwil") + .withParameters(mapOf("frolq", "dataoxpdxq")) + .withAdditionalProperties(mapOf())), + new Transformation() + .withName("wlp") + .withDescription("uqhrlmcskykp") + .withDataset( + new DatasetReference() + .withReferenceName("ofix") + .withParameters(mapOf("kkpyycpaw", "datacf", "cfpcfjfwzlgz", "datapjprdpwr"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("kgyepe") + .withParameters( + mapOf( + "rntmkctdhu", + "datannidmdiawpzxk", + "hqodv", + "datasgwqpsqaz", + "ti", + "datagcnbhcbmjk"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("ynts") + .withDatasetParameters("datamfmeftvhkmoo") + .withParameters(mapOf("gmjgrul", "datahskb")) + .withAdditionalProperties(mapOf())), + new Transformation() + .withName("kzkdtzxsoednlwg") + .withDescription("hezomucmqgisnion") + .withDataset( + new DatasetReference() + .withReferenceName("bzdrdpuenxkgt") + .withParameters( + mapOf( + "hzkbnbmx", + "datamtrlxczn", + "itoqcahfsg", + "dataxmwtygeqzu", + "lisolntfxxc", + "datajmlreesrfwsszvlc"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("mipfjw") + .withParameters( + mapOf( + "nvgskjtoxjd", + "datagizmshxxbaizabu", + "xqqm", + "datajsjznv", + "aydhf", + "datai"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("c") + .withDatasetParameters("datatfshksnyzm") + .withParameters( + mapOf( + "iqdktwtkvih", + "datamwbwmbnlslce", + "nguuzhwvla", + "datapfliwo", + "mhjhaus", + "datap", + "ekymffztsilscvqs", + "datab")) + .withAdditionalProperties(mapOf())))) + .withScript("btvkbi") + .withScriptLines(Arrays.asList("htfgficudyhizpac", "muhbcakznho")); + model = BinaryData.fromObject(model).toObject(Flowlet.class); + Assertions.assertEquals("oitwhrjsdmmazdnc", model.description()); + Assertions.assertEquals("lhzqpxzbawkikcdg", model.folder().name()); + Assertions.assertEquals("h", model.sources().get(0).name()); + Assertions.assertEquals("jsbcml", model.sources().get(0).description()); + Assertions.assertEquals("ahz", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("yrqolnthbbnkgz", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("iocuselqkr", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("pnw", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("oxudnmckap", model.sinks().get(0).name()); + Assertions.assertEquals("knq", model.sinks().get(0).description()); + Assertions.assertEquals("jgencdgmoque", model.sinks().get(0).dataset().referenceName()); + Assertions.assertEquals("itbfjtdy", model.sinks().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get(0).flowlet().type()); + Assertions.assertEquals("szxvctkbbxuhar", model.sinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("qtvkh", model.sinks().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("rnskby", model.sinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("vkhhwm", model.transformations().get(0).name()); + Assertions.assertEquals("jbweunxcqr", model.transformations().get(0).description()); + Assertions.assertEquals("hu", model.transformations().get(0).dataset().referenceName()); + Assertions.assertEquals("kaugpucdocfqplwg", model.transformations().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.transformations().get(0).flowlet().type()); + Assertions.assertEquals("ikyjtkakvlb", model.transformations().get(0).flowlet().referenceName()); + Assertions.assertEquals("btvkbi", model.script()); + Assertions.assertEquals("htfgficudyhizpac", model.scriptLines().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FlowletTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FlowletTypePropertiesTests.java new file mode 100644 index 000000000000..154b6445fec7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FlowletTypePropertiesTests.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.FlowletTypeProperties; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowSink; +import com.azure.resourcemanager.datafactory.models.DataFlowSource; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.Transformation; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FlowletTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FlowletTypeProperties model = + BinaryData + .fromString( + "{\"sources\":[{\"schemaLinkedService\":{\"referenceName\":\"sd\",\"parameters\":{\"surejqrshzzbgu\":\"datayoqxdedecfiwhag\"}},\"name\":\"lcxiqqzjko\",\"description\":\"upnamglroui\",\"dataset\":{\"referenceName\":\"mfivjqterd\",\"parameters\":{\"d\":\"datagd\",\"tyhhmvfxlapja\":\"dataghpcvrwqirvt\"}},\"linkedService\":{\"referenceName\":\"dmkr\",\"parameters\":{\"qlujqgi\":\"datapgqvqo\",\"hpqvcts\":\"dataabwlyvx\",\"zhasupmlppdpgzvz\":\"dataaeuhwwsknstvz\",\"ptgongruat\":\"dataazvbkar\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"y\",\"datasetParameters\":\"dataqheni\",\"parameters\":{\"yjdeayscseyd\":\"dataqnguba\"},\"\":{\"muwrx\":\"datamexmnvk\",\"wmcpmrrdlhvdvm\":\"datan\",\"hkdcl\":\"dataphbeaeqjz\",\"unerke\":\"datacroczf\"}}},{\"schemaLinkedService\":{\"referenceName\":\"xzs\",\"parameters\":{\"udl\":\"dataezbzu\",\"cgwfsgqkstyecu\":\"datavzske\"}},\"name\":\"yu\",\"description\":\"p\",\"dataset\":{\"referenceName\":\"davsjcfmazpz\",\"parameters\":{\"izekuvfrj\":\"datauzvcmcok\",\"ajbvbn\":\"dataucaonz\",\"idgzwdydamis\":\"datardemdidack\",\"xkqejtpjfojiunr\":\"datapztdivyk\"}},\"linkedService\":{\"referenceName\":\"hxuk\",\"parameters\":{\"o\":\"datakdtoiboancdr\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"xu\",\"datasetParameters\":\"dataxonckbnlblfxlup\",\"parameters\":{\"izxzpzweghl\":\"dataq\",\"dve\":\"datawbogvgfklqiy\"},\"\":{\"vlrdsmovpi\":\"datasbfvdstrkzxsgtzn\"}}},{\"schemaLinkedService\":{\"referenceName\":\"ndnoxaxnrqaq\",\"parameters\":{\"usdvrgp\":\"datandxol\"}},\"name\":\"qmawzjdrpizfu\",\"description\":\"yctsdbtqgkuj\",\"dataset\":{\"referenceName\":\"ooxrqwoeurb\",\"parameters\":{\"wmmkfq\":\"dataapdyarikeejdpdfh\",\"qulw\":\"datar\",\"eqkvyhzokpoyu\":\"datatrj\"}},\"linkedService\":{\"referenceName\":\"uensn\",\"parameters\":{\"jsumxpezcoio\":\"dataphmpoejnglpwsada\",\"xkeedcnwmy\":\"datajrmfqzwqd\",\"czaqpqifdbmpt\":\"dataxfqzkvemyzd\",\"natnizexroqsqjg\":\"datawtxzuisam\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"thsplwsttxsr\",\"datasetParameters\":\"datafq\",\"parameters\":{\"sxyr\":\"dataiceovxgzw\",\"ik\":\"datajmtikes\",\"dseipnquwzxhrp\":\"dataohzixyqhfnkvycqq\"},\"\":{\"kfktltdds\":\"datadl\",\"ouhbq\":\"databjop\",\"yigfcvcew\":\"datazkqxsalu\"}}}],\"sinks\":[{\"schemaLinkedService\":{\"referenceName\":\"dgsjsat\",\"parameters\":{\"azdfsqxhyqmrej\":\"datac\",\"bwtdr\":\"dataarnpvgrsz\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"gz\",\"parameters\":{\"fi\":\"dataxzlh\"}},\"name\":\"acfculzjrmhpf\",\"description\":\"vyldqpzfzxsoxin\",\"dataset\":{\"referenceName\":\"jlzkdrocqsxy\",\"parameters\":{\"is\":\"datatcmiwd\",\"p\":\"datanmeylajamcajyhf\",\"ryklleynqa\":\"datac\"}},\"linkedService\":{\"referenceName\":\"kig\",\"parameters\":{\"hg\":\"datalwalhvu\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"etxdqcmyctajqzj\",\"datasetParameters\":\"datalecxbibiwks\",\"parameters\":{\"oikvntwcz\":\"datayxsbfpz\"},\"\":{\"ezpfki\":\"dataushlcxpblalh\",\"zsaaoqdsgptotxjq\":\"datasaid\",\"cnlrt\":\"dataia\"}}},{\"schemaLinkedService\":{\"referenceName\":\"ijzzcaoijolbuauk\",\"parameters\":{\"lxqdwr\":\"dataeopex\",\"pibkgxyxyaux\":\"datawyil\",\"ytkujsq\":\"dataeddobmcnltm\",\"oxfab\":\"datacm\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"gpwb\",\"parameters\":{\"li\":\"datari\"}},\"name\":\"rycgnwplrrbph\",\"description\":\"sbbi\",\"dataset\":{\"referenceName\":\"icuhqvumspb\",\"parameters\":{\"xmzrmtmvwitu\":\"dataeqbbewfcuqfpy\"}},\"linkedService\":{\"referenceName\":\"yyjshcybwfuppo\",\"parameters\":{\"zsvavlr\":\"datacmvouujxdiikmoxr\",\"oywlunpipcwyb\":\"dataikj\",\"npatpftsae\":\"datazfn\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"whxorpwaltz\",\"datasetParameters\":\"datagexojfccylhtrht\",\"parameters\":{\"zxezmnr\":\"datazjpwexcdrzprob\",\"hlokfpmijpdvzv\":\"datajgpjeuxs\",\"rwyambhbafebzxfk\":\"databhwbdqufvcgnrgla\",\"nntrvrkps\":\"dataqutibhl\"},\"\":{\"vzm\":\"datau\"}}},{\"schemaLinkedService\":{\"referenceName\":\"hnysvlpyeu\",\"parameters\":{\"hyqqegatxgr\":\"datapdixqbolxv\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"mg\",\"parameters\":{\"ibmg\":\"datatsdixchw\",\"gair\":\"dataymncjc\",\"fbhtleberp\":\"datacqzoofjnqjsve\"}},\"name\":\"ljekn\",\"description\":\"n\",\"dataset\":{\"referenceName\":\"j\",\"parameters\":{\"pnowawonoehrguql\":\"datawkdnjrxgkrhwiehy\",\"pyrgu\":\"datafwafbjz\"}},\"linkedService\":{\"referenceName\":\"azbkocbygvthrmxk\",\"parameters\":{\"keboo\":\"datawwdxomrawp\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"yacagae\",\"datasetParameters\":\"dataoiqclmgdtwgab\",\"parameters\":{\"wjecooyvhtuqbpe\":\"datakuz\"},\"\":{\"hftzbpyfao\":\"dataibncgagdvcd\",\"htncwmhjobzrfp\":\"datadf\",\"cqhyftcvbz\":\"dataiz\",\"orssatfyb\":\"datagwhgkgsoau\"}}}],\"transformations\":[{\"name\":\"fdmxuqb\",\"description\":\"nasttuxvzfqayop\",\"dataset\":{\"referenceName\":\"sixhgvbhx\",\"parameters\":{\"mar\":\"dataztgsqjay\",\"nh\":\"dataneibpgbrhbjdq\"}},\"linkedService\":{\"referenceName\":\"motpuwnnoh\",\"parameters\":{\"laynosugkf\":\"datangocfrjuypwyi\",\"hqucum\":\"dataaxttpfsmwgs\",\"uqmllfeothxu\":\"datadd\",\"vkrbzkuastaxklpr\":\"datarigrjdljlkq\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"hgltoizwxvs\",\"datasetParameters\":\"datasgfy\",\"parameters\":{\"vfcck\":\"datayekgafxc\"},\"\":{\"ynctaczcnjfmbbfn\":\"datawletyveszrtlhpdh\",\"itzovnkr\":\"dataj\"}}},{\"name\":\"iklsmni\",\"description\":\"lcoqksyiib\",\"dataset\":{\"referenceName\":\"xwbgbudavqd\",\"parameters\":{\"jvlirk\":\"dataccqcdhth\",\"agzlgpyai\":\"dataucosawrdt\",\"qfttkacybdueur\":\"dataihzqjjtsmuy\",\"jermhzic\":\"datamcdcpkshl\"}},\"linkedService\":{\"referenceName\":\"fdjhyaaknyukibxi\",\"parameters\":{\"piilhvtozy\":\"dataphzwxqte\",\"f\":\"datagjjnxkbylhyyx\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"vqzrwtrd\",\"datasetParameters\":\"datacnvqeons\",\"parameters\":{\"ezyohxpthceopv\":\"dataxlw\",\"lc\":\"datavtwfvesobpbokhm\"},\"\":{\"lqhxkasmcolmu\":\"datarnggcjfw\",\"ygz\":\"datapyvaosdkluwzx\",\"nobguqisqsqkpdmi\":\"datatyevjhu\",\"pnml\":\"datay\"}}}],\"script\":\"qcpszp\",\"scriptLines\":[\"qdvrdmvxyrxdh\",\"vqojbxaotcgbz\",\"mbtple\",\"oioyidoxznvgvd\"]}") + .toObject(FlowletTypeProperties.class); + Assertions.assertEquals("lcxiqqzjko", model.sources().get(0).name()); + Assertions.assertEquals("upnamglroui", model.sources().get(0).description()); + Assertions.assertEquals("mfivjqterd", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("dmkr", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("y", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("sd", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("acfculzjrmhpf", model.sinks().get(0).name()); + Assertions.assertEquals("vyldqpzfzxsoxin", model.sinks().get(0).description()); + Assertions.assertEquals("jlzkdrocqsxy", model.sinks().get(0).dataset().referenceName()); + Assertions.assertEquals("kig", model.sinks().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get(0).flowlet().type()); + Assertions.assertEquals("etxdqcmyctajqzj", model.sinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("dgsjsat", model.sinks().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("gz", model.sinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("fdmxuqb", model.transformations().get(0).name()); + Assertions.assertEquals("nasttuxvzfqayop", model.transformations().get(0).description()); + Assertions.assertEquals("sixhgvbhx", model.transformations().get(0).dataset().referenceName()); + Assertions.assertEquals("motpuwnnoh", model.transformations().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.transformations().get(0).flowlet().type()); + Assertions.assertEquals("hgltoizwxvs", model.transformations().get(0).flowlet().referenceName()); + Assertions.assertEquals("qcpszp", model.script()); + Assertions.assertEquals("qdvrdmvxyrxdh", model.scriptLines().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FlowletTypeProperties model = + new FlowletTypeProperties() + .withSources( + Arrays + .asList( + new DataFlowSource() + .withName("lcxiqqzjko") + .withDescription("upnamglroui") + .withDataset( + new DatasetReference() + .withReferenceName("mfivjqterd") + .withParameters(mapOf("d", "datagd", "tyhhmvfxlapja", "dataghpcvrwqirvt"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("dmkr") + .withParameters( + mapOf( + "qlujqgi", + "datapgqvqo", + "hpqvcts", + "dataabwlyvx", + "zhasupmlppdpgzvz", + "dataaeuhwwsknstvz", + "ptgongruat", + "dataazvbkar"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("y") + .withDatasetParameters("dataqheni") + .withParameters(mapOf("yjdeayscseyd", "dataqnguba")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("sd") + .withParameters(mapOf("surejqrshzzbgu", "datayoqxdedecfiwhag"))), + new DataFlowSource() + .withName("yu") + .withDescription("p") + .withDataset( + new DatasetReference() + .withReferenceName("davsjcfmazpz") + .withParameters( + mapOf( + "izekuvfrj", + "datauzvcmcok", + "ajbvbn", + "dataucaonz", + "idgzwdydamis", + "datardemdidack", + "xkqejtpjfojiunr", + "datapztdivyk"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("hxuk") + .withParameters(mapOf("o", "datakdtoiboancdr"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("xu") + .withDatasetParameters("dataxonckbnlblfxlup") + .withParameters(mapOf("izxzpzweghl", "dataq", "dve", "datawbogvgfklqiy")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("xzs") + .withParameters(mapOf("udl", "dataezbzu", "cgwfsgqkstyecu", "datavzske"))), + new DataFlowSource() + .withName("qmawzjdrpizfu") + .withDescription("yctsdbtqgkuj") + .withDataset( + new DatasetReference() + .withReferenceName("ooxrqwoeurb") + .withParameters( + mapOf( + "wmmkfq", + "dataapdyarikeejdpdfh", + "qulw", + "datar", + "eqkvyhzokpoyu", + "datatrj"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("uensn") + .withParameters( + mapOf( + "jsumxpezcoio", + "dataphmpoejnglpwsada", + "xkeedcnwmy", + "datajrmfqzwqd", + "czaqpqifdbmpt", + "dataxfqzkvemyzd", + "natnizexroqsqjg", + "datawtxzuisam"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("thsplwsttxsr") + .withDatasetParameters("datafq") + .withParameters( + mapOf( + "sxyr", + "dataiceovxgzw", + "ik", + "datajmtikes", + "dseipnquwzxhrp", + "dataohzixyqhfnkvycqq")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("ndnoxaxnrqaq") + .withParameters(mapOf("usdvrgp", "datandxol"))))) + .withSinks( + Arrays + .asList( + new DataFlowSink() + .withName("acfculzjrmhpf") + .withDescription("vyldqpzfzxsoxin") + .withDataset( + new DatasetReference() + .withReferenceName("jlzkdrocqsxy") + .withParameters( + mapOf( + "is", "datatcmiwd", "p", "datanmeylajamcajyhf", "ryklleynqa", "datac"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("kig") + .withParameters(mapOf("hg", "datalwalhvu"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("etxdqcmyctajqzj") + .withDatasetParameters("datalecxbibiwks") + .withParameters(mapOf("oikvntwcz", "datayxsbfpz")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("dgsjsat") + .withParameters(mapOf("azdfsqxhyqmrej", "datac", "bwtdr", "dataarnpvgrsz"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("gz") + .withParameters(mapOf("fi", "dataxzlh"))), + new DataFlowSink() + .withName("rycgnwplrrbph") + .withDescription("sbbi") + .withDataset( + new DatasetReference() + .withReferenceName("icuhqvumspb") + .withParameters(mapOf("xmzrmtmvwitu", "dataeqbbewfcuqfpy"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("yyjshcybwfuppo") + .withParameters( + mapOf( + "zsvavlr", + "datacmvouujxdiikmoxr", + "oywlunpipcwyb", + "dataikj", + "npatpftsae", + "datazfn"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("whxorpwaltz") + .withDatasetParameters("datagexojfccylhtrht") + .withParameters( + mapOf( + "zxezmnr", + "datazjpwexcdrzprob", + "hlokfpmijpdvzv", + "datajgpjeuxs", + "rwyambhbafebzxfk", + "databhwbdqufvcgnrgla", + "nntrvrkps", + "dataqutibhl")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("ijzzcaoijolbuauk") + .withParameters( + mapOf( + "lxqdwr", + "dataeopex", + "pibkgxyxyaux", + "datawyil", + "ytkujsq", + "dataeddobmcnltm", + "oxfab", + "datacm"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("gpwb") + .withParameters(mapOf("li", "datari"))), + new DataFlowSink() + .withName("ljekn") + .withDescription("n") + .withDataset( + new DatasetReference() + .withReferenceName("j") + .withParameters( + mapOf("pnowawonoehrguql", "datawkdnjrxgkrhwiehy", "pyrgu", "datafwafbjz"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("azbkocbygvthrmxk") + .withParameters(mapOf("keboo", "datawwdxomrawp"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("yacagae") + .withDatasetParameters("dataoiqclmgdtwgab") + .withParameters(mapOf("wjecooyvhtuqbpe", "datakuz")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("hnysvlpyeu") + .withParameters(mapOf("hyqqegatxgr", "datapdixqbolxv"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("mg") + .withParameters( + mapOf( + "ibmg", + "datatsdixchw", + "gair", + "dataymncjc", + "fbhtleberp", + "datacqzoofjnqjsve"))))) + .withTransformations( + Arrays + .asList( + new Transformation() + .withName("fdmxuqb") + .withDescription("nasttuxvzfqayop") + .withDataset( + new DatasetReference() + .withReferenceName("sixhgvbhx") + .withParameters(mapOf("mar", "dataztgsqjay", "nh", "dataneibpgbrhbjdq"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("motpuwnnoh") + .withParameters( + mapOf( + "laynosugkf", + "datangocfrjuypwyi", + "hqucum", + "dataaxttpfsmwgs", + "uqmllfeothxu", + "datadd", + "vkrbzkuastaxklpr", + "datarigrjdljlkq"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("hgltoizwxvs") + .withDatasetParameters("datasgfy") + .withParameters(mapOf("vfcck", "datayekgafxc")) + .withAdditionalProperties(mapOf())), + new Transformation() + .withName("iklsmni") + .withDescription("lcoqksyiib") + .withDataset( + new DatasetReference() + .withReferenceName("xwbgbudavqd") + .withParameters( + mapOf( + "jvlirk", + "dataccqcdhth", + "agzlgpyai", + "dataucosawrdt", + "qfttkacybdueur", + "dataihzqjjtsmuy", + "jermhzic", + "datamcdcpkshl"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("fdjhyaaknyukibxi") + .withParameters(mapOf("piilhvtozy", "dataphzwxqte", "f", "datagjjnxkbylhyyx"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("vqzrwtrd") + .withDatasetParameters("datacnvqeons") + .withParameters(mapOf("ezyohxpthceopv", "dataxlw", "lc", "datavtwfvesobpbokhm")) + .withAdditionalProperties(mapOf())))) + .withScript("qcpszp") + .withScriptLines(Arrays.asList("qdvrdmvxyrxdh", "vqojbxaotcgbz", "mbtple", "oioyidoxznvgvd")); + model = BinaryData.fromObject(model).toObject(FlowletTypeProperties.class); + Assertions.assertEquals("lcxiqqzjko", model.sources().get(0).name()); + Assertions.assertEquals("upnamglroui", model.sources().get(0).description()); + Assertions.assertEquals("mfivjqterd", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("dmkr", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("y", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("sd", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("acfculzjrmhpf", model.sinks().get(0).name()); + Assertions.assertEquals("vyldqpzfzxsoxin", model.sinks().get(0).description()); + Assertions.assertEquals("jlzkdrocqsxy", model.sinks().get(0).dataset().referenceName()); + Assertions.assertEquals("kig", model.sinks().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get(0).flowlet().type()); + Assertions.assertEquals("etxdqcmyctajqzj", model.sinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("dgsjsat", model.sinks().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("gz", model.sinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("fdmxuqb", model.transformations().get(0).name()); + Assertions.assertEquals("nasttuxvzfqayop", model.transformations().get(0).description()); + Assertions.assertEquals("sixhgvbhx", model.transformations().get(0).dataset().referenceName()); + Assertions.assertEquals("motpuwnnoh", model.transformations().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.transformations().get(0).flowlet().type()); + Assertions.assertEquals("hgltoizwxvs", model.transformations().get(0).flowlet().referenceName()); + Assertions.assertEquals("qcpszp", model.script()); + Assertions.assertEquals("qdvrdmvxyrxdh", model.scriptLines().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ForEachActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ForEachActivityTests.java new file mode 100644 index 000000000000..69af61761910 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ForEachActivityTests.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.Expression; +import com.azure.resourcemanager.datafactory.models.ForEachActivity; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ForEachActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ForEachActivity model = + BinaryData + .fromString( + "{\"type\":\"ForEach\",\"typeProperties\":{\"isSequential\":true,\"batchCount\":1012384732,\"items\":{\"value\":\"dbmuzpdjthpsyc\"},\"activities\":[{\"type\":\"Activity\",\"name\":\"xuhiwymmiipf\",\"description\":\"gjmysnfpx\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"ivsq\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\",\"Completed\",\"Failed\"],\"\":{\"itkfvdjgwzak\":\"dataade\"}}],\"userProperties\":[{\"name\":\"brbsuxgnw\",\"value\":\"dataykuloz\"},{\"name\":\"oilhrxjiwjivy\",\"value\":\"datarqlky\"},{\"name\":\"wnb\",\"value\":\"datalau\"}],\"\":{\"bvftqahjnsllfkcr\":\"datayriscio\",\"fxtendfp\":\"dataviimhdlmagdwi\",\"tklojlgsbystznwj\":\"dataoxtifosxxk\",\"ptvkjdowuzasd\":\"datasvllefliriq\"}},{\"type\":\"Activity\",\"name\":\"tufmujadippdntun\",\"description\":\"eeprmebvxmaacr\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"jcesm\",\"dependencyConditions\":[\"Failed\",\"Succeeded\",\"Completed\",\"Failed\"],\"\":{\"dbuz\":\"datajxyv\",\"asdrrfozz\":\"dataphogmrcmguel\"}},{\"activity\":\"ygolz\",\"dependencyConditions\":[\"Failed\",\"Succeeded\",\"Skipped\",\"Completed\"],\"\":{\"rjmzqnbwnloo\":\"datarysvcabr\"}},{\"activity\":\"ah\",\"dependencyConditions\":[\"Completed\",\"Completed\",\"Completed\",\"Skipped\"],\"\":{\"jorpcrgrjxitpp\":\"dataoqclypbr\",\"rdefhbzic\":\"databuvxxlo\",\"lzwvmwjuqchc\":\"datafdwgbgenwesxzu\"}}],\"userProperties\":[{\"name\":\"yscarjm\",\"value\":\"dataiewv\"},{\"name\":\"pyskhkvkwdtbvy\",\"value\":\"datalgkzbyxtprxtf\"},{\"name\":\"vng\",\"value\":\"datacsno\"},{\"name\":\"kglygeuo\",\"value\":\"datalywjvdr\"}],\"\":{\"nt\":\"datawzbrg\",\"n\":\"dataptrjtyhthfcpz\",\"g\":\"datavkhkubpojhdxcha\",\"vrnwxolfhiq\":\"dataw\"}}]},\"name\":\"iulfxgzyr\",\"description\":\"uxlt\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"catozsodpbsqcw\",\"dependencyConditions\":[\"Failed\"],\"\":{\"ribmeuukk\":\"datahuixczycifdrjry\",\"jmnxlf\":\"datanwtucmh\",\"wzgb\":\"datam\",\"mrpbmxmxshfh\":\"databwmiap\"}},{\"activity\":\"p\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\",\"Failed\"],\"\":{\"vxytmoqnytucuzy\":\"datap\",\"e\":\"dataigdebsinsoybe\",\"mqjcagxrozcfcxk\":\"datarpouhlhlud\",\"kgepmnxvahqvc\":\"datahjxbteakdr\"}},{\"activity\":\"lphlkxdanlycc\",\"dependencyConditions\":[\"Succeeded\",\"Completed\",\"Skipped\"],\"\":{\"qzdedizdmwndnsg\":\"dataa\"}}],\"userProperties\":[{\"name\":\"pstwmdmwsf\",\"value\":\"datardyrxloxa\"},{\"name\":\"mxnmx\",\"value\":\"datamdlynlhsdtc\"},{\"name\":\"flevndldhwrf\",\"value\":\"dataflhwfrjyuhuthqdf\"},{\"name\":\"bizloyqjrkt\",\"value\":\"datadvuqve\"}],\"\":{\"relbzwxxsowd\":\"dataogesrmahszxcfbp\",\"nhqfae\":\"datauwvupn\"}}") + .toObject(ForEachActivity.class); + Assertions.assertEquals("iulfxgzyr", model.name()); + Assertions.assertEquals("uxlt", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("catozsodpbsqcw", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("pstwmdmwsf", model.userProperties().get(0).name()); + Assertions.assertEquals(true, model.isSequential()); + Assertions.assertEquals(1012384732, model.batchCount()); + Assertions.assertEquals("dbmuzpdjthpsyc", model.items().value()); + Assertions.assertEquals("xuhiwymmiipf", model.activities().get(0).name()); + Assertions.assertEquals("gjmysnfpx", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("ivsq", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SKIPPED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("brbsuxgnw", model.activities().get(0).userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ForEachActivity model = + new ForEachActivity() + .withName("iulfxgzyr") + .withDescription("uxlt") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("catozsodpbsqcw") + .withDependencyConditions(Arrays.asList(DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("p") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("lphlkxdanlycc") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("pstwmdmwsf").withValue("datardyrxloxa"), + new UserProperty().withName("mxnmx").withValue("datamdlynlhsdtc"), + new UserProperty().withName("flevndldhwrf").withValue("dataflhwfrjyuhuthqdf"), + new UserProperty().withName("bizloyqjrkt").withValue("datadvuqve"))) + .withIsSequential(true) + .withBatchCount(1012384732) + .withItems(new Expression().withValue("dbmuzpdjthpsyc")) + .withActivities( + Arrays + .asList( + new Activity() + .withName("xuhiwymmiipf") + .withDescription("gjmysnfpx") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ivsq") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("brbsuxgnw").withValue("dataykuloz"), + new UserProperty().withName("oilhrxjiwjivy").withValue("datarqlky"), + new UserProperty().withName("wnb").withValue("datalau"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("tufmujadippdntun") + .withDescription("eeprmebvxmaacr") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("jcesm") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ygolz") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ah") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("yscarjm").withValue("dataiewv"), + new UserProperty() + .withName("pyskhkvkwdtbvy") + .withValue("datalgkzbyxtprxtf"), + new UserProperty().withName("vng").withValue("datacsno"), + new UserProperty().withName("kglygeuo").withValue("datalywjvdr"))) + .withAdditionalProperties(mapOf("type", "Activity")))); + model = BinaryData.fromObject(model).toObject(ForEachActivity.class); + Assertions.assertEquals("iulfxgzyr", model.name()); + Assertions.assertEquals("uxlt", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("catozsodpbsqcw", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("pstwmdmwsf", model.userProperties().get(0).name()); + Assertions.assertEquals(true, model.isSequential()); + Assertions.assertEquals(1012384732, model.batchCount()); + Assertions.assertEquals("dbmuzpdjthpsyc", model.items().value()); + Assertions.assertEquals("xuhiwymmiipf", model.activities().get(0).name()); + Assertions.assertEquals("gjmysnfpx", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("ivsq", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SKIPPED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("brbsuxgnw", model.activities().get(0).userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ForEachActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ForEachActivityTypePropertiesTests.java new file mode 100644 index 000000000000..973e7b836cdd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ForEachActivityTypePropertiesTests.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ForEachActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.Expression; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ForEachActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ForEachActivityTypeProperties model = + BinaryData + .fromString( + "{\"isSequential\":true,\"batchCount\":1006990717,\"items\":{\"value\":\"apsraydl\"},\"activities\":[{\"type\":\"Activity\",\"name\":\"okmakkwqrkaymdgz\",\"description\":\"lio\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"mavxorldubbbac\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Completed\",\"Succeeded\"],\"\":{\"po\":\"dataooldwdjermdzkik\",\"kcczb\":\"dataqgku\",\"kwjhkjvsvywnz\":\"dataobe\"}}],\"userProperties\":[{\"name\":\"vqbvfihnasa\",\"value\":\"dataukegkludfdh\"},{\"name\":\"orihqzfjyqadtq\",\"value\":\"datatsa\"},{\"name\":\"jjfa\",\"value\":\"dataplywtgilhxaa\"},{\"name\":\"nuufenp\",\"value\":\"datatoktnfeghc\"}],\"\":{\"ywuioi\":\"datagexqyroqklgvyce\",\"fskgxfmdpsreqor\":\"datatwhyznlhak\",\"zqjqbwjiqru\":\"dataku\"}},{\"type\":\"Activity\",\"name\":\"bjuakdsmwajalsen\",\"description\":\"oslvf\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"cceyobjsju\",\"dependencyConditions\":[\"Completed\"],\"\":{\"fukuht\":\"datayvxk\"}},{\"activity\":\"vxidmitmjccnjvg\",\"dependencyConditions\":[\"Skipped\",\"Failed\",\"Completed\"],\"\":{\"ahpyss\":\"datarqgliq\",\"iresixigpmcmequo\":\"datangduewevhcwtt\",\"ybtxzaaaveiad\":\"dataawcbknyljycpw\"}},{\"activity\":\"goadtdxdxrkrvmh\",\"dependencyConditions\":[\"Completed\",\"Skipped\",\"Completed\"],\"\":{\"xktncigwfgv\":\"datauwbvrbwafw\"}},{\"activity\":\"ftbwmuxc\",\"dependencyConditions\":[\"Succeeded\",\"Succeeded\"],\"\":{\"mxptkbehpywvgf\":\"datapmghh\",\"olpf\":\"datasrngyqvxzqwcm\",\"skuscdnneofta\":\"datavvksnnyk\"}}],\"userProperties\":[{\"name\":\"httj\",\"value\":\"dataqwwlaxhsjwpcjtw\"},{\"name\":\"whrzntmzzzavx\",\"value\":\"datadkexspoi\"},{\"name\":\"vuk\",\"value\":\"datatteaisywopkovl\"}],\"\":{\"mgvqthlimvyzrdq\":\"dataigdvcbyldsmy\",\"rpxwldktphnis\":\"datagyon\",\"xpk\":\"datajcjnbtgfit\"}},{\"type\":\"Activity\",\"name\":\"angjxbbyqvbdlfzk\",\"description\":\"geppxiyovg\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"ggame\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\"],\"\":{\"qnfdwrwscyblwj\":\"dataxhmaokkgvwvl\",\"bg\":\"datap\",\"ypqnshnbfd\":\"datalefjsgnxrgmvzcib\"}},{\"activity\":\"xs\",\"dependencyConditions\":[\"Skipped\"],\"\":{\"bowqmfh\":\"dataprgztzc\",\"g\":\"datahnbsxoebephohjo\",\"bmngkqej\":\"dataifchvr\",\"wcfxbywpwjvpg\":\"datahwyyzzdlfayic\"}},{\"activity\":\"stxznkbjkjezunrd\",\"dependencyConditions\":[\"Skipped\",\"Completed\"],\"\":{\"cwbcxwdbx\":\"datanvepb\"}}],\"userProperties\":[{\"name\":\"pummphb\",\"value\":\"datap\"},{\"name\":\"ive\",\"value\":\"datal\"},{\"name\":\"ppizyenajjxz\",\"value\":\"datadpnersmevhgs\"}],\"\":{\"rjqakb\":\"dataljl\",\"g\":\"datazsyqpkpvb\",\"gzeio\":\"datagyguqyxvzyi\"}}]}") + .toObject(ForEachActivityTypeProperties.class); + Assertions.assertEquals(true, model.isSequential()); + Assertions.assertEquals(1006990717, model.batchCount()); + Assertions.assertEquals("apsraydl", model.items().value()); + Assertions.assertEquals("okmakkwqrkaymdgz", model.activities().get(0).name()); + Assertions.assertEquals("lio", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("mavxorldubbbac", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SUCCEEDED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("vqbvfihnasa", model.activities().get(0).userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ForEachActivityTypeProperties model = + new ForEachActivityTypeProperties() + .withIsSequential(true) + .withBatchCount(1006990717) + .withItems(new Expression().withValue("apsraydl")) + .withActivities( + Arrays + .asList( + new Activity() + .withName("okmakkwqrkaymdgz") + .withDescription("lio") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("mavxorldubbbac") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("vqbvfihnasa").withValue("dataukegkludfdh"), + new UserProperty().withName("orihqzfjyqadtq").withValue("datatsa"), + new UserProperty().withName("jjfa").withValue("dataplywtgilhxaa"), + new UserProperty().withName("nuufenp").withValue("datatoktnfeghc"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("bjuakdsmwajalsen") + .withDescription("oslvf") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("cceyobjsju") + .withDependencyConditions(Arrays.asList(DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("vxidmitmjccnjvg") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("goadtdxdxrkrvmh") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ftbwmuxc") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("httj").withValue("dataqwwlaxhsjwpcjtw"), + new UserProperty().withName("whrzntmzzzavx").withValue("datadkexspoi"), + new UserProperty().withName("vuk").withValue("datatteaisywopkovl"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("angjxbbyqvbdlfzk") + .withDescription("geppxiyovg") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ggame") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("xs") + .withDependencyConditions(Arrays.asList(DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("stxznkbjkjezunrd") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("pummphb").withValue("datap"), + new UserProperty().withName("ive").withValue("datal"), + new UserProperty().withName("ppizyenajjxz").withValue("datadpnersmevhgs"))) + .withAdditionalProperties(mapOf("type", "Activity")))); + model = BinaryData.fromObject(model).toObject(ForEachActivityTypeProperties.class); + Assertions.assertEquals(true, model.isSequential()); + Assertions.assertEquals(1006990717, model.batchCount()); + Assertions.assertEquals("apsraydl", model.items().value()); + Assertions.assertEquals("okmakkwqrkaymdgz", model.activities().get(0).name()); + Assertions.assertEquals("lio", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("mavxorldubbbac", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SUCCEEDED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("vqbvfihnasa", model.activities().get(0).userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FormatReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FormatReadSettingsTests.java new file mode 100644 index 000000000000..b2f6519ca5ce --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FormatReadSettingsTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FormatReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class FormatReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FormatReadSettings model = + BinaryData + .fromString( + "{\"type\":\"FormatReadSettings\",\"\":{\"pf\":\"dataqdsjjqztrpjme\",\"xkloabc\":\"datataaq\",\"v\":\"dataxqa\",\"bvolivianklqclft\":\"datakrepqasviy\"}}") + .toObject(FormatReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FormatReadSettings model = + new FormatReadSettings().withAdditionalProperties(mapOf("type", "FormatReadSettings")); + model = BinaryData.fromObject(model).toObject(FormatReadSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FormatWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FormatWriteSettingsTests.java new file mode 100644 index 000000000000..7ee89b9d1b95 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FormatWriteSettingsTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FormatWriteSettings; +import java.util.HashMap; +import java.util.Map; + +public final class FormatWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FormatWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"FormatWriteSettings\",\"\":{\"pbvdlkpzd\":\"dataspqvxzicurufn\",\"nbtqejfq\":\"dataiywwenvxuhzixr\"}}") + .toObject(FormatWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FormatWriteSettings model = + new FormatWriteSettings().withAdditionalProperties(mapOf("type", "FormatWriteSettings")); + model = BinaryData.fromObject(model).toObject(FormatWriteSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FtpReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FtpReadSettingsTests.java new file mode 100644 index 000000000000..4920a8a8fcb2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FtpReadSettingsTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FtpReadSettings; + +public final class FtpReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FtpReadSettings model = + BinaryData + .fromString( + "{\"type\":\"FtpReadSettings\",\"recursive\":\"datapryutxasnigh\",\"wildcardFolderPath\":\"dataikhiihggzqh\",\"wildcardFileName\":\"datatt\",\"enablePartitionDiscovery\":\"dataipfudzntbzg\",\"partitionRootPath\":\"datawhkwypbqnxpohcr\",\"deleteFilesAfterCompletion\":\"databajyuegsbuqdp\",\"fileListPath\":\"dataqec\",\"useBinaryTransfer\":\"datautxtidsxrexba\",\"disableChunking\":\"databm\",\"maxConcurrentConnections\":\"dataopypcuom\",\"disableMetricsCollection\":\"dataucjznnowpvxuuvhw\",\"\":{\"dhlqtqjabwt\":\"dataegphwjyfk\"}}") + .toObject(FtpReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FtpReadSettings model = + new FtpReadSettings() + .withMaxConcurrentConnections("dataopypcuom") + .withDisableMetricsCollection("dataucjznnowpvxuuvhw") + .withRecursive("datapryutxasnigh") + .withWildcardFolderPath("dataikhiihggzqh") + .withWildcardFileName("datatt") + .withEnablePartitionDiscovery("dataipfudzntbzg") + .withPartitionRootPath("datawhkwypbqnxpohcr") + .withDeleteFilesAfterCompletion("databajyuegsbuqdp") + .withFileListPath("dataqec") + .withUseBinaryTransfer("datautxtidsxrexba") + .withDisableChunking("databm"); + model = BinaryData.fromObject(model).toObject(FtpReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FtpServerLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FtpServerLocationTests.java new file mode 100644 index 000000000000..049b3f224a42 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/FtpServerLocationTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FtpServerLocation; + +public final class FtpServerLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FtpServerLocation model = + BinaryData + .fromString( + "{\"type\":\"FtpServerLocation\",\"folderPath\":\"dataxfjwp\",\"fileName\":\"dataktpmbmxb\",\"\":{\"hxsdplaumydmhwe\":\"datawgzzxljb\",\"xydgtokvqbvwg\":\"datajf\"}}") + .toObject(FtpServerLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FtpServerLocation model = new FtpServerLocation().withFolderPath("dataxfjwp").withFileName("dataktpmbmxb"); + model = BinaryData.fromObject(model).toObject(FtpServerLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GenericDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GenericDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..b9ca25397d23 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GenericDatasetTypePropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.GenericDatasetTypeProperties; + +public final class GenericDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GenericDatasetTypeProperties model = + BinaryData.fromString("{\"tableName\":\"dataypkcpwsrqnn\"}").toObject(GenericDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GenericDatasetTypeProperties model = new GenericDatasetTypeProperties().withTableName("dataypkcpwsrqnn"); + model = BinaryData.fromObject(model).toObject(GenericDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetDataFactoryOperationStatusResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetDataFactoryOperationStatusResponseTests.java new file mode 100644 index 000000000000..faf096dddd94 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetDataFactoryOperationStatusResponseTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.GetDataFactoryOperationStatusResponse; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GetDataFactoryOperationStatusResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GetDataFactoryOperationStatusResponse model = + BinaryData + .fromString("{\"status\":\"btyi\",\"\":{\"fqjpnqno\":\"datavpi\"}}") + .toObject(GetDataFactoryOperationStatusResponse.class); + Assertions.assertEquals("btyi", model.status()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GetDataFactoryOperationStatusResponse model = + new GetDataFactoryOperationStatusResponse().withStatus("btyi").withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(GetDataFactoryOperationStatusResponse.class); + Assertions.assertEquals("btyi", model.status()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetMetadataActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetMetadataActivityTests.java new file mode 100644 index 000000000000..d9a2c9cc6e38 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetMetadataActivityTests.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.FormatReadSettings; +import com.azure.resourcemanager.datafactory.models.GetMetadataActivity; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GetMetadataActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GetMetadataActivity model = + BinaryData + .fromString( + "{\"type\":\"GetMetadata\",\"typeProperties\":{\"dataset\":{\"referenceName\":\"ljajz\",\"parameters\":{\"odgisfejs\":\"datawarbvblatvbjkqy\",\"wi\":\"datap\",\"jwktiyhiyk\":\"dataujyn\"}},\"fieldList\":[\"dataaodifupdafu\",\"datatwopsjrqhgnrxxh\",\"datawtrxpwuxy\",\"datapd\"],\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datahgbjukaswgvoa\",\"disableMetricsCollection\":\"datatdt\",\"\":{\"qdliptefdvj\":\"dataafhhiykatjsebcuy\",\"ethyhbnoyexu\":\"databemrjbovquxpdpr\"}},\"formatSettings\":{\"type\":\"FormatReadSettings\",\"\":{\"teklgiqo\":\"datazxo\",\"umo\":\"databl\",\"jmtpgkybdktyvr\":\"datauzxwmw\",\"psc\":\"datamrqbeqzhnpx\"}}},\"linkedServiceName\":{\"referenceName\":\"ygajqmpf\",\"parameters\":{\"nygathv\":\"datauwefz\",\"kwk\":\"datawhrjakdyqxjpzy\"}},\"policy\":{\"timeout\":\"datapbybh\",\"retry\":\"datailbsdgahehk\",\"retryIntervalInSeconds\":1450508499,\"secureInput\":false,\"secureOutput\":false,\"\":{\"phbcurth\":\"datan\"}},\"name\":\"bgavwbqjeto\",\"description\":\"jayvuymib\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"u\",\"dependencyConditions\":[\"Failed\",\"Failed\",\"Failed\"],\"\":{\"hltxtpgqqinkktay\":\"datajhmldvnoxj\",\"klx\":\"datafgbcwawblkkccixs\"}},{\"activity\":\"sqhczokuncqqhbjm\",\"dependencyConditions\":[\"Completed\",\"Skipped\",\"Skipped\",\"Skipped\"],\"\":{\"yfctfsdhmrughm\":\"dataeqzcbqvjejnwwq\"}},{\"activity\":\"ybbhktnuzorxati\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\",\"Succeeded\",\"Failed\"],\"\":{\"emcghorrjaw\":\"datautvitislcfxsgjdi\",\"cfnzpybrflqv\":\"dataczbbvrmvhtmzwgi\"}},{\"activity\":\"vl\",\"dependencyConditions\":[\"Failed\",\"Skipped\"],\"\":{\"qnc\":\"datahupvxthpsugebgb\",\"xypxmke\":\"dataiiwuufofgfqge\",\"fdsogl\":\"datajonasjdaxe\"}}],\"userProperties\":[{\"name\":\"wduwn\",\"value\":\"dataaifwogqwdxtpmfa\"}],\"\":{\"msfnigjoxhz\":\"datazznnk\",\"jyfbutqlotojfvba\":\"datamgmc\",\"jloehhhkxlquupb\":\"dataqwj\",\"eptejryvvuktc\":\"datahuinjymnq\"}}") + .toObject(GetMetadataActivity.class); + Assertions.assertEquals("bgavwbqjeto", model.name()); + Assertions.assertEquals("jayvuymib", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("u", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("wduwn", model.userProperties().get(0).name()); + Assertions.assertEquals("ygajqmpf", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1450508499, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("ljajz", model.dataset().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GetMetadataActivity model = + new GetMetadataActivity() + .withName("bgavwbqjeto") + .withDescription("jayvuymib") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("u") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.FAILED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("sqhczokuncqqhbjm") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ybbhktnuzorxati") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("vl") + .withDependencyConditions( + Arrays.asList(DependencyCondition.FAILED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("wduwn").withValue("dataaifwogqwdxtpmfa"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ygajqmpf") + .withParameters(mapOf("nygathv", "datauwefz", "kwk", "datawhrjakdyqxjpzy"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datapbybh") + .withRetry("datailbsdgahehk") + .withRetryIntervalInSeconds(1450508499) + .withSecureInput(false) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withDataset( + new DatasetReference() + .withReferenceName("ljajz") + .withParameters( + mapOf("odgisfejs", "datawarbvblatvbjkqy", "wi", "datap", "jwktiyhiyk", "dataujyn"))) + .withFieldList(Arrays.asList("dataaodifupdafu", "datatwopsjrqhgnrxxh", "datawtrxpwuxy", "datapd")) + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datahgbjukaswgvoa") + .withDisableMetricsCollection("datatdt") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withFormatSettings( + new FormatReadSettings().withAdditionalProperties(mapOf("type", "FormatReadSettings"))); + model = BinaryData.fromObject(model).toObject(GetMetadataActivity.class); + Assertions.assertEquals("bgavwbqjeto", model.name()); + Assertions.assertEquals("jayvuymib", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("u", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("wduwn", model.userProperties().get(0).name()); + Assertions.assertEquals("ygajqmpf", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1450508499, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("ljajz", model.dataset().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetMetadataActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetMetadataActivityTypePropertiesTests.java new file mode 100644 index 000000000000..d4bb9ef628dc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetMetadataActivityTypePropertiesTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.GetMetadataActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.FormatReadSettings; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GetMetadataActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GetMetadataActivityTypeProperties model = + BinaryData + .fromString( + "{\"dataset\":{\"referenceName\":\"xtpamwjbmrkcq\",\"parameters\":{\"tvovhuifbly\":\"datajj\",\"neusnncnnqifuhsj\":\"dataqycknqmbvssjb\",\"mplt\":\"datadu\"}},\"fieldList\":[\"datafndafrzi\",\"datajcyxzan\"],\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"dataeyvdrulhworh\",\"disableMetricsCollection\":\"datasqdvmxufrqpaw\",\"\":{\"wu\":\"datadohz\",\"hftlsfwpvflm\":\"datalae\",\"txbrj\":\"datajdu\",\"dmnymfvxfssh\":\"datapeypuq\"}},\"formatSettings\":{\"type\":\"FormatReadSettings\",\"\":{\"zdfjfnree\":\"dataeornzprdgmmgtq\",\"myuiq\":\"datapb\",\"rikdfacf\":\"datazfotfoif\"}}}") + .toObject(GetMetadataActivityTypeProperties.class); + Assertions.assertEquals("xtpamwjbmrkcq", model.dataset().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GetMetadataActivityTypeProperties model = + new GetMetadataActivityTypeProperties() + .withDataset( + new DatasetReference() + .withReferenceName("xtpamwjbmrkcq") + .withParameters( + mapOf("tvovhuifbly", "datajj", "neusnncnnqifuhsj", "dataqycknqmbvssjb", "mplt", "datadu"))) + .withFieldList(Arrays.asList("datafndafrzi", "datajcyxzan")) + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("dataeyvdrulhworh") + .withDisableMetricsCollection("datasqdvmxufrqpaw") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withFormatSettings( + new FormatReadSettings().withAdditionalProperties(mapOf("type", "FormatReadSettings"))); + model = BinaryData.fromObject(model).toObject(GetMetadataActivityTypeProperties.class); + Assertions.assertEquals("xtpamwjbmrkcq", model.dataset().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetSsisObjectMetadataRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetSsisObjectMetadataRequestTests.java new file mode 100644 index 000000000000..2ae16b8f6d8c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GetSsisObjectMetadataRequestTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.GetSsisObjectMetadataRequest; +import org.junit.jupiter.api.Assertions; + +public final class GetSsisObjectMetadataRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GetSsisObjectMetadataRequest model = + BinaryData + .fromString("{\"metadataPath\":\"jriplrbpbewtghf\"}") + .toObject(GetSsisObjectMetadataRequest.class); + Assertions.assertEquals("jriplrbpbewtghf", model.metadataPath()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GetSsisObjectMetadataRequest model = new GetSsisObjectMetadataRequest().withMetadataPath("jriplrbpbewtghf"); + model = BinaryData.fromObject(model).toObject(GetSsisObjectMetadataRequest.class); + Assertions.assertEquals("jriplrbpbewtghf", model.metadataPath()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParameterListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParameterListResponseTests.java new file mode 100644 index 000000000000..29a52b82a949 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParameterListResponseTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.GlobalParameterResourceInner; +import com.azure.resourcemanager.datafactory.models.GlobalParameterListResponse; +import com.azure.resourcemanager.datafactory.models.GlobalParameterSpecification; +import com.azure.resourcemanager.datafactory.models.GlobalParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GlobalParameterListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GlobalParameterListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"mg\":{\"type\":\"String\",\"value\":\"datayrrueqth\"},\"cbbxigdhxi\":{\"type\":\"String\",\"value\":\"datab\"}},\"name\":\"lopedbwdpyqyyb\",\"type\":\"bmdnafcbqwre\",\"etag\":\"ela\",\"id\":\"cigeleohdbvqvw\"}],\"nextLink\":\"jopwbeonrlkwz\"}") + .toObject(GlobalParameterListResponse.class); + Assertions.assertEquals("cigeleohdbvqvw", model.value().get(0).id()); + Assertions.assertEquals(GlobalParameterType.STRING, model.value().get(0).properties().get("mg").type()); + Assertions.assertEquals("jopwbeonrlkwz", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GlobalParameterListResponse model = + new GlobalParameterListResponse() + .withValue( + Arrays + .asList( + new GlobalParameterResourceInner() + .withId("cigeleohdbvqvw") + .withProperties( + mapOf( + "mg", + new GlobalParameterSpecification() + .withType(GlobalParameterType.STRING) + .withValue("datayrrueqth"), + "cbbxigdhxi", + new GlobalParameterSpecification() + .withType(GlobalParameterType.STRING) + .withValue("datab"))))) + .withNextLink("jopwbeonrlkwz"); + model = BinaryData.fromObject(model).toObject(GlobalParameterListResponse.class); + Assertions.assertEquals("cigeleohdbvqvw", model.value().get(0).id()); + Assertions.assertEquals(GlobalParameterType.STRING, model.value().get(0).properties().get("mg").type()); + Assertions.assertEquals("jopwbeonrlkwz", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParameterResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParameterResourceInnerTests.java new file mode 100644 index 000000000000..4949b5c54c0a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParameterResourceInnerTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.GlobalParameterResourceInner; +import com.azure.resourcemanager.datafactory.models.GlobalParameterSpecification; +import com.azure.resourcemanager.datafactory.models.GlobalParameterType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GlobalParameterResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GlobalParameterResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"xcptsoqfyiaseqc\":{\"type\":\"Object\",\"value\":\"databxcea\"},\"mvanbwzo\":{\"type\":\"Array\",\"value\":\"datarttzrazisgykiu\"},\"mdptys\":{\"type\":\"String\",\"value\":\"datanrxxbsojklin\"}},\"name\":\"qsgnzxojpsl\",\"type\":\"jgpliuf\",\"etag\":\"woyxqvapcohhou\",\"id\":\"pqojxcx\"}") + .toObject(GlobalParameterResourceInner.class); + Assertions.assertEquals("pqojxcx", model.id()); + Assertions.assertEquals(GlobalParameterType.OBJECT, model.properties().get("xcptsoqfyiaseqc").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GlobalParameterResourceInner model = + new GlobalParameterResourceInner() + .withId("pqojxcx") + .withProperties( + mapOf( + "xcptsoqfyiaseqc", + new GlobalParameterSpecification().withType(GlobalParameterType.OBJECT).withValue("databxcea"), + "mvanbwzo", + new GlobalParameterSpecification() + .withType(GlobalParameterType.ARRAY) + .withValue("datarttzrazisgykiu"), + "mdptys", + new GlobalParameterSpecification() + .withType(GlobalParameterType.STRING) + .withValue("datanrxxbsojklin"))); + model = BinaryData.fromObject(model).toObject(GlobalParameterResourceInner.class); + Assertions.assertEquals("pqojxcx", model.id()); + Assertions.assertEquals(GlobalParameterType.OBJECT, model.properties().get("xcptsoqfyiaseqc").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParameterSpecificationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParameterSpecificationTests.java new file mode 100644 index 000000000000..71d13b237958 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParameterSpecificationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.GlobalParameterSpecification; +import com.azure.resourcemanager.datafactory.models.GlobalParameterType; +import org.junit.jupiter.api.Assertions; + +public final class GlobalParameterSpecificationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GlobalParameterSpecification model = + BinaryData + .fromString("{\"type\":\"String\",\"value\":\"datarm\"}") + .toObject(GlobalParameterSpecification.class); + Assertions.assertEquals(GlobalParameterType.STRING, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GlobalParameterSpecification model = + new GlobalParameterSpecification().withType(GlobalParameterType.STRING).withValue("datarm"); + model = BinaryData.fromObject(model).toObject(GlobalParameterSpecification.class); + Assertions.assertEquals(GlobalParameterType.STRING, model.type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..3bd1fbe16e9f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.GlobalParameterResource; +import com.azure.resourcemanager.datafactory.models.GlobalParameterSpecification; +import com.azure.resourcemanager.datafactory.models.GlobalParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class GlobalParametersCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"ijyzhmf\":{\"type\":\"Float\",\"value\":\"datavjvwkzaqqkq\"},\"gxunldbku\":{\"type\":\"Bool\",\"value\":\"datasqiqz\"},\"t\":{\"type\":\"Object\",\"value\":\"datanjiwzqnbjk\"},\"wyyyjage\":{\"type\":\"Float\",\"value\":\"datamfnjuzvww\"}},\"name\":\"ghxjwiggcaim\",\"type\":\"xpaytzqgsaegaahw\",\"etag\":\"rdxhgrg\",\"id\":\"mwkykvoskjixb\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + GlobalParameterResource response = + manager + .globalParameters() + .define("f") + .withExistingFactory("spocutpnyz", "tgkdwvtmmvqliq") + .withProperties( + mapOf( + "puavxidytjmk", + new GlobalParameterSpecification().withType(GlobalParameterType.FLOAT).withValue("datarlji"), + "agfbreyvr", + new GlobalParameterSpecification().withType(GlobalParameterType.ARRAY).withValue("datazgopckm"), + "fryourlywxjvsqz", + new GlobalParameterSpecification() + .withType(GlobalParameterType.ARRAY) + .withValue("datacikwqtl"))) + .create(); + + Assertions.assertEquals("mwkykvoskjixb", response.id()); + Assertions.assertEquals(GlobalParameterType.FLOAT, response.properties().get("ijyzhmf").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..7af35edc1965 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class GlobalParametersDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .globalParameters() + .deleteWithResponse("hpfpvadyxjc", "khgstohzvrqbzlm", "wufhduniqum", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersGetWithResponseMockTests.java new file mode 100644 index 000000000000..d26f5d82645a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersGetWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.GlobalParameterResource; +import com.azure.resourcemanager.datafactory.models.GlobalParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class GlobalParametersGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"dewf\":{\"type\":\"Array\",\"value\":\"databmqgimwivqph\"},\"zzak\":{\"type\":\"Int\",\"value\":\"dataajpojz\"},\"vykysavevnerpyzu\":{\"type\":\"Object\",\"value\":\"datatwnhpcfsqdzi\"},\"ot\":{\"type\":\"Object\",\"value\":\"datavinvryxwzxj\"}},\"name\":\"iwm\",\"type\":\"dxw\",\"etag\":\"mda\",\"id\":\"giglkinsrysga\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + GlobalParameterResource response = + manager + .globalParameters() + .getWithResponse("wasktzrdxxsbbd", "okjnbcdnjexcyhs", "vairau", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("giglkinsrysga", response.id()); + Assertions.assertEquals(GlobalParameterType.ARRAY, response.properties().get("dewf").type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersListByFactoryMockTests.java new file mode 100644 index 000000000000..4bc4dd1ade81 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GlobalParametersListByFactoryMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.GlobalParameterResource; +import com.azure.resourcemanager.datafactory.models.GlobalParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class GlobalParametersListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"l\":{\"type\":\"Array\",\"value\":\"datahrs\"}},\"name\":\"wfpq\",\"type\":\"sxyugid\",\"etag\":\"sjivdtrtkqqdqxsl\",\"id\":\"tt\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.globalParameters().listByFactory("ucrynsqxyowwr", "xe", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("tt", response.iterator().next().id()); + Assertions.assertEquals(GlobalParameterType.ARRAY, response.iterator().next().properties().get("l").type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleAdWordsObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleAdWordsObjectDatasetTests.java new file mode 100644 index 000000000000..1191004eff88 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleAdWordsObjectDatasetTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.GoogleAdWordsObjectDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GoogleAdWordsObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GoogleAdWordsObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"GoogleAdWordsObject\",\"typeProperties\":{\"tableName\":\"datapdcbgrufsdbkuxkd\"},\"description\":\"m\",\"structure\":\"dataivxwkscwbshfih\",\"schema\":\"datamsceylaulpue\",\"linkedServiceName\":{\"referenceName\":\"yi\",\"parameters\":{\"xdslspgnndef\":\"datatye\",\"yltaprqtfkmvzrk\":\"datahsbyhwlvsv\"}},\"parameters\":{\"ukkmv\":{\"type\":\"Array\",\"defaultValue\":\"datadwfcuhbgftfv\"},\"hhxlsube\":{\"type\":\"Bool\",\"defaultValue\":\"dataegpdqrjylwqqsem\"},\"wyktdp\":{\"type\":\"Int\",\"defaultValue\":\"databejrd\"},\"jkykqf\":{\"type\":\"Object\",\"defaultValue\":\"dataufifnjwjh\"}},\"annotations\":[\"datacyk\"],\"folder\":{\"name\":\"smkb\"},\"\":{\"ejnoignyd\":\"datarihpjaxhcb\",\"bnmrmhkipjardvdp\":\"datakrnp\",\"pbie\":\"datagwdxmiael\",\"nddvjlpbj\":\"datal\"}}") + .toObject(GoogleAdWordsObjectDataset.class); + Assertions.assertEquals("m", model.description()); + Assertions.assertEquals("yi", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("ukkmv").type()); + Assertions.assertEquals("smkb", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GoogleAdWordsObjectDataset model = + new GoogleAdWordsObjectDataset() + .withDescription("m") + .withStructure("dataivxwkscwbshfih") + .withSchema("datamsceylaulpue") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("yi") + .withParameters(mapOf("xdslspgnndef", "datatye", "yltaprqtfkmvzrk", "datahsbyhwlvsv"))) + .withParameters( + mapOf( + "ukkmv", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datadwfcuhbgftfv"), + "hhxlsube", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("dataegpdqrjylwqqsem"), + "wyktdp", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("databejrd"), + "jkykqf", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("dataufifnjwjh"))) + .withAnnotations(Arrays.asList("datacyk")) + .withFolder(new DatasetFolder().withName("smkb")) + .withTableName("datapdcbgrufsdbkuxkd"); + model = BinaryData.fromObject(model).toObject(GoogleAdWordsObjectDataset.class); + Assertions.assertEquals("m", model.description()); + Assertions.assertEquals("yi", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("ukkmv").type()); + Assertions.assertEquals("smkb", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleAdWordsSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleAdWordsSourceTests.java new file mode 100644 index 000000000000..f6215ee0df62 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleAdWordsSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.GoogleAdWordsSource; + +public final class GoogleAdWordsSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GoogleAdWordsSource model = + BinaryData + .fromString( + "{\"type\":\"GoogleAdWordsSource\",\"query\":\"datahwfrmhook\",\"queryTimeout\":\"datadgfexakct\",\"additionalColumns\":\"datapszdn\",\"sourceRetryCount\":\"datao\",\"sourceRetryWait\":\"dataqxmdievkmrso\",\"maxConcurrentConnections\":\"datayiheheimuqqmd\",\"disableMetricsCollection\":\"datawxfmrm\",\"\":{\"sz\":\"dataypsypmthf\"}}") + .toObject(GoogleAdWordsSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GoogleAdWordsSource model = + new GoogleAdWordsSource() + .withSourceRetryCount("datao") + .withSourceRetryWait("dataqxmdievkmrso") + .withMaxConcurrentConnections("datayiheheimuqqmd") + .withDisableMetricsCollection("datawxfmrm") + .withQueryTimeout("datadgfexakct") + .withAdditionalColumns("datapszdn") + .withQuery("datahwfrmhook"); + model = BinaryData.fromObject(model).toObject(GoogleAdWordsSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleBigQueryDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleBigQueryDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..3fefdeec6d19 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleBigQueryDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.GoogleBigQueryDatasetTypeProperties; + +public final class GoogleBigQueryDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GoogleBigQueryDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"dataaqermnddlir\",\"table\":\"dataclsaqifepdu\",\"dataset\":\"dataevivkigliokl\"}") + .toObject(GoogleBigQueryDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GoogleBigQueryDatasetTypeProperties model = + new GoogleBigQueryDatasetTypeProperties() + .withTableName("dataaqermnddlir") + .withTable("dataclsaqifepdu") + .withDataset("dataevivkigliokl"); + model = BinaryData.fromObject(model).toObject(GoogleBigQueryDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleBigQueryObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleBigQueryObjectDatasetTests.java new file mode 100644 index 000000000000..b7f7ecef1f85 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleBigQueryObjectDatasetTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.GoogleBigQueryObjectDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GoogleBigQueryObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GoogleBigQueryObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"GoogleBigQueryObject\",\"typeProperties\":{\"tableName\":\"datamemfvrcclclfkfvy\",\"table\":\"datammw\",\"dataset\":\"datapoipjylxtebvse\"},\"description\":\"zvvpaysqwh\",\"structure\":\"datacyandb\",\"schema\":\"databntcvpvd\",\"linkedServiceName\":{\"referenceName\":\"moqqctfvxuosqp\",\"parameters\":{\"wyjzuakkiubeqk\":\"datapjpjmsbzzjsnyf\"}},\"parameters\":{\"hogsezre\":{\"type\":\"Int\",\"defaultValue\":\"dataglhxsoanguhb\"},\"itwkejmg\":{\"type\":\"Float\",\"defaultValue\":\"datagpdtyzpx\"},\"skvsdfvhryp\":{\"type\":\"Array\",\"defaultValue\":\"datadupe\"}},\"annotations\":[\"datammpkapvnpeukg\",\"datamfakeqn\",\"datatromlcsvk\",\"datafpsrowshvfxj\"],\"folder\":{\"name\":\"awmv\"},\"\":{\"znyjyu\":\"dataabjropxfqdml\",\"wgdp\":\"dataql\",\"iri\":\"datah\",\"dpkwdtobpgdcid\":\"dataamqtrhqdoxdegacd\"}}") + .toObject(GoogleBigQueryObjectDataset.class); + Assertions.assertEquals("zvvpaysqwh", model.description()); + Assertions.assertEquals("moqqctfvxuosqp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("hogsezre").type()); + Assertions.assertEquals("awmv", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GoogleBigQueryObjectDataset model = + new GoogleBigQueryObjectDataset() + .withDescription("zvvpaysqwh") + .withStructure("datacyandb") + .withSchema("databntcvpvd") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("moqqctfvxuosqp") + .withParameters(mapOf("wyjzuakkiubeqk", "datapjpjmsbzzjsnyf"))) + .withParameters( + mapOf( + "hogsezre", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataglhxsoanguhb"), + "itwkejmg", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datagpdtyzpx"), + "skvsdfvhryp", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datadupe"))) + .withAnnotations(Arrays.asList("datammpkapvnpeukg", "datamfakeqn", "datatromlcsvk", "datafpsrowshvfxj")) + .withFolder(new DatasetFolder().withName("awmv")) + .withTableName("datamemfvrcclclfkfvy") + .withTable("datammw") + .withDataset("datapoipjylxtebvse"); + model = BinaryData.fromObject(model).toObject(GoogleBigQueryObjectDataset.class); + Assertions.assertEquals("zvvpaysqwh", model.description()); + Assertions.assertEquals("moqqctfvxuosqp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("hogsezre").type()); + Assertions.assertEquals("awmv", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleBigQuerySourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleBigQuerySourceTests.java new file mode 100644 index 000000000000..30990b26fa63 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleBigQuerySourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.GoogleBigQuerySource; + +public final class GoogleBigQuerySourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GoogleBigQuerySource model = + BinaryData + .fromString( + "{\"type\":\"GoogleBigQuerySource\",\"query\":\"dataiupwktnsyrrybd\",\"queryTimeout\":\"dataivkssu\",\"additionalColumns\":\"datazihdkq\",\"sourceRetryCount\":\"datawthw\",\"sourceRetryWait\":\"dataijgasnafdjinw\",\"maxConcurrentConnections\":\"datarnjgs\",\"disableMetricsCollection\":\"datazbdhr\",\"\":{\"ygcahijbjj\":\"dataan\",\"jtyhe\":\"dataxsvjzbggsnan\",\"gaimktns\":\"datazxzazofronsxj\"}}") + .toObject(GoogleBigQuerySource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GoogleBigQuerySource model = + new GoogleBigQuerySource() + .withSourceRetryCount("datawthw") + .withSourceRetryWait("dataijgasnafdjinw") + .withMaxConcurrentConnections("datarnjgs") + .withDisableMetricsCollection("datazbdhr") + .withQueryTimeout("dataivkssu") + .withAdditionalColumns("datazihdkq") + .withQuery("dataiupwktnsyrrybd"); + model = BinaryData.fromObject(model).toObject(GoogleBigQuerySource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleCloudStorageLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleCloudStorageLocationTests.java new file mode 100644 index 000000000000..efe82d3a7cda --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleCloudStorageLocationTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.GoogleCloudStorageLocation; + +public final class GoogleCloudStorageLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GoogleCloudStorageLocation model = + BinaryData + .fromString( + "{\"type\":\"GoogleCloudStorageLocation\",\"bucketName\":\"datattnzqsaq\",\"version\":\"databgszplusdek\",\"folderPath\":\"datazzmssgpgv\",\"fileName\":\"datayejidbdqzsqun\",\"\":{\"snmr\":\"dataztlvv\",\"wfkcauxuvavcpf\":\"datakyjtrepw\",\"xlu\":\"datadofuckclb\",\"ngojfsqebuuxjx\":\"datavsolzwil\"}}") + .toObject(GoogleCloudStorageLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GoogleCloudStorageLocation model = + new GoogleCloudStorageLocation() + .withFolderPath("datazzmssgpgv") + .withFileName("datayejidbdqzsqun") + .withBucketName("datattnzqsaq") + .withVersion("databgszplusdek"); + model = BinaryData.fromObject(model).toObject(GoogleCloudStorageLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleCloudStorageReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleCloudStorageReadSettingsTests.java new file mode 100644 index 000000000000..a0a217fa0204 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GoogleCloudStorageReadSettingsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.GoogleCloudStorageReadSettings; + +public final class GoogleCloudStorageReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GoogleCloudStorageReadSettings model = + BinaryData + .fromString( + "{\"type\":\"GoogleCloudStorageReadSettings\",\"recursive\":\"dataijpjiudnustbmox\",\"wildcardFolderPath\":\"datagkdnhbhuepu\",\"wildcardFileName\":\"datal\",\"prefix\":\"dataqzjvfrhyxl\",\"fileListPath\":\"datayousqmernbjp\",\"enablePartitionDiscovery\":\"datamemkyouwmj\",\"partitionRootPath\":\"datamkchjdxrbbhukx\",\"deleteFilesAfterCompletion\":\"datahyr\",\"modifiedDatetimeStart\":\"dataqpgadesnesg\",\"modifiedDatetimeEnd\":\"datadvgxte\",\"maxConcurrentConnections\":\"datasictoq\",\"disableMetricsCollection\":\"datazmznoe\",\"\":{\"b\":\"datauyqbzjyzajd\",\"x\":\"databp\"}}") + .toObject(GoogleCloudStorageReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GoogleCloudStorageReadSettings model = + new GoogleCloudStorageReadSettings() + .withMaxConcurrentConnections("datasictoq") + .withDisableMetricsCollection("datazmznoe") + .withRecursive("dataijpjiudnustbmox") + .withWildcardFolderPath("datagkdnhbhuepu") + .withWildcardFileName("datal") + .withPrefix("dataqzjvfrhyxl") + .withFileListPath("datayousqmernbjp") + .withEnablePartitionDiscovery("datamemkyouwmj") + .withPartitionRootPath("datamkchjdxrbbhukx") + .withDeleteFilesAfterCompletion("datahyr") + .withModifiedDatetimeStart("dataqpgadesnesg") + .withModifiedDatetimeEnd("datadvgxte"); + model = BinaryData.fromObject(model).toObject(GoogleCloudStorageReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GreenplumDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GreenplumDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..abaab9d39083 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GreenplumDatasetTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.GreenplumDatasetTypeProperties; + +public final class GreenplumDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GreenplumDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"dataqicmdrgcuzjmvk\",\"table\":\"datar\",\"schema\":\"dataqhgcm\"}") + .toObject(GreenplumDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GreenplumDatasetTypeProperties model = + new GreenplumDatasetTypeProperties() + .withTableName("dataqicmdrgcuzjmvk") + .withTable("datar") + .withSchema("dataqhgcm"); + model = BinaryData.fromObject(model).toObject(GreenplumDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GreenplumSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GreenplumSourceTests.java new file mode 100644 index 000000000000..b3787dc0d142 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GreenplumSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.GreenplumSource; + +public final class GreenplumSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GreenplumSource model = + BinaryData + .fromString( + "{\"type\":\"GreenplumSource\",\"query\":\"dataszbe\",\"queryTimeout\":\"datahxikrgokyngarwz\",\"additionalColumns\":\"datazjxgassmna\",\"sourceRetryCount\":\"datapolueylqysgmiix\",\"sourceRetryWait\":\"dataekcwec\",\"maxConcurrentConnections\":\"datatkdginm\",\"disableMetricsCollection\":\"datagp\",\"\":{\"wrwvbqv\":\"dataqccey\",\"iqfaxtljpyzcgugs\":\"datacqgqrsopq\",\"vslocdkpvv\":\"datapvyktfuhfaabi\",\"xnzjzashhiz\":\"dataqlkh\"}}") + .toObject(GreenplumSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GreenplumSource model = + new GreenplumSource() + .withSourceRetryCount("datapolueylqysgmiix") + .withSourceRetryWait("dataekcwec") + .withMaxConcurrentConnections("datatkdginm") + .withDisableMetricsCollection("datagp") + .withQueryTimeout("datahxikrgokyngarwz") + .withAdditionalColumns("datazjxgassmna") + .withQuery("dataszbe"); + model = BinaryData.fromObject(model).toObject(GreenplumSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GreenplumTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GreenplumTableDatasetTests.java new file mode 100644 index 000000000000..44c198a96ad8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/GreenplumTableDatasetTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.GreenplumTableDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GreenplumTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GreenplumTableDataset model = + BinaryData + .fromString( + "{\"type\":\"GreenplumTable\",\"typeProperties\":{\"tableName\":\"datafpxeswctlfytb\",\"table\":\"dataytvnpbgcesfd\",\"schema\":\"dataclmowurofo\"},\"description\":\"b\",\"structure\":\"datazzwweoblb\",\"schema\":\"dataq\",\"linkedServiceName\":{\"referenceName\":\"hixcc\",\"parameters\":{\"xmyqzyqepgbb\":\"datasogvy\",\"dpwmgwxwukfjvqg\":\"datadsluokcevoxd\",\"gyphheovejkpalec\":\"dataaxseisvv\",\"pu\":\"datatlthrt\"}},\"parameters\":{\"oll\":{\"type\":\"Object\",\"defaultValue\":\"datagrqefnq\"}},\"annotations\":[\"datarmuzemb\",\"dataqieh\",\"datahjofy\"],\"folder\":{\"name\":\"axoxlorx\"},\"\":{\"glyyhrgmabspmlu\":\"dataqcxuthvp\",\"kedputocrb\":\"datayju\"}}") + .toObject(GreenplumTableDataset.class); + Assertions.assertEquals("b", model.description()); + Assertions.assertEquals("hixcc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("oll").type()); + Assertions.assertEquals("axoxlorx", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GreenplumTableDataset model = + new GreenplumTableDataset() + .withDescription("b") + .withStructure("datazzwweoblb") + .withSchema("dataq") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("hixcc") + .withParameters( + mapOf( + "xmyqzyqepgbb", + "datasogvy", + "dpwmgwxwukfjvqg", + "datadsluokcevoxd", + "gyphheovejkpalec", + "dataaxseisvv", + "pu", + "datatlthrt"))) + .withParameters( + mapOf( + "oll", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datagrqefnq"))) + .withAnnotations(Arrays.asList("datarmuzemb", "dataqieh", "datahjofy")) + .withFolder(new DatasetFolder().withName("axoxlorx")) + .withTableName("datafpxeswctlfytb") + .withTable("dataytvnpbgcesfd") + .withSchemaTypePropertiesSchema("dataclmowurofo"); + model = BinaryData.fromObject(model).toObject(GreenplumTableDataset.class); + Assertions.assertEquals("b", model.description()); + Assertions.assertEquals("hixcc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("oll").type()); + Assertions.assertEquals("axoxlorx", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HBaseObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HBaseObjectDatasetTests.java new file mode 100644 index 000000000000..a3068ac5225d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HBaseObjectDatasetTests.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.HBaseObjectDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HBaseObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HBaseObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"HBaseObject\",\"typeProperties\":{\"tableName\":\"dataksqimybq\"},\"description\":\"fiomhcaqpvhs\",\"structure\":\"datapeu\",\"schema\":\"datafdswbss\",\"linkedServiceName\":{\"referenceName\":\"g\",\"parameters\":{\"jbpwjwzqgipdz\":\"datamosqmf\",\"dq\":\"datamzkhxfpzcu\"}},\"parameters\":{\"ncoqxtvytzq\":{\"type\":\"Object\",\"defaultValue\":\"datavvlyibweuaugtxl\"},\"zbdbrlbo\":{\"type\":\"Object\",\"defaultValue\":\"datadjvzmxyrazzstjvc\"},\"upmwxdsokrlnrpey\":{\"type\":\"Float\",\"defaultValue\":\"datayolacbibtkeie\"},\"wvunknsgvx\":{\"type\":\"String\",\"defaultValue\":\"dataiulddgiqlnhcxw\"}},\"annotations\":[\"datameatrtcqyfjvifb\",\"dataojtehqyo\",\"datatrcoufk\",\"datambhukdfpknvk\"],\"folder\":{\"name\":\"zje\"},\"\":{\"hzjlrknckkfxm\":\"datameo\"}}") + .toObject(HBaseObjectDataset.class); + Assertions.assertEquals("fiomhcaqpvhs", model.description()); + Assertions.assertEquals("g", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("ncoqxtvytzq").type()); + Assertions.assertEquals("zje", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HBaseObjectDataset model = + new HBaseObjectDataset() + .withDescription("fiomhcaqpvhs") + .withStructure("datapeu") + .withSchema("datafdswbss") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("g") + .withParameters(mapOf("jbpwjwzqgipdz", "datamosqmf", "dq", "datamzkhxfpzcu"))) + .withParameters( + mapOf( + "ncoqxtvytzq", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("datavvlyibweuaugtxl"), + "zbdbrlbo", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("datadjvzmxyrazzstjvc"), + "upmwxdsokrlnrpey", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datayolacbibtkeie"), + "wvunknsgvx", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("dataiulddgiqlnhcxw"))) + .withAnnotations( + Arrays.asList("datameatrtcqyfjvifb", "dataojtehqyo", "datatrcoufk", "datambhukdfpknvk")) + .withFolder(new DatasetFolder().withName("zje")) + .withTableName("dataksqimybq"); + model = BinaryData.fromObject(model).toObject(HBaseObjectDataset.class); + Assertions.assertEquals("fiomhcaqpvhs", model.description()); + Assertions.assertEquals("g", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("ncoqxtvytzq").type()); + Assertions.assertEquals("zje", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HBaseSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HBaseSourceTests.java new file mode 100644 index 000000000000..eea16242ccd4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HBaseSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.HBaseSource; + +public final class HBaseSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HBaseSource model = + BinaryData + .fromString( + "{\"type\":\"HBaseSource\",\"query\":\"datamibwzuhyda\",\"queryTimeout\":\"datakgwtbfxxsfj\",\"additionalColumns\":\"dataascjighmkdsv\",\"sourceRetryCount\":\"datayhtiyxeh\",\"sourceRetryWait\":\"dataizoybtehky\",\"maxConcurrentConnections\":\"datanmmyznw\",\"disableMetricsCollection\":\"datafqwkqulkzovqohwi\",\"\":{\"nsjjjcddsv\":\"dataqxjxlssosndnyp\",\"jhpmajg\":\"datadbfniqxbc\",\"jwjhmtca\":\"datazpdioddtjylimz\"}}") + .toObject(HBaseSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HBaseSource model = + new HBaseSource() + .withSourceRetryCount("datayhtiyxeh") + .withSourceRetryWait("dataizoybtehky") + .withMaxConcurrentConnections("datanmmyznw") + .withDisableMetricsCollection("datafqwkqulkzovqohwi") + .withQueryTimeout("datakgwtbfxxsfj") + .withAdditionalColumns("dataascjighmkdsv") + .withQuery("datamibwzuhyda"); + model = BinaryData.fromObject(model).toObject(HBaseSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightHiveActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightHiveActivityTests.java new file mode 100644 index 000000000000..ea1b3c98fed2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightHiveActivityTests.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.HDInsightHiveActivity; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightHiveActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightHiveActivity model = + BinaryData + .fromString( + "{\"type\":\"HDInsightHive\",\"typeProperties\":{\"storageLinkedServices\":[{\"referenceName\":\"hyoigzwed\",\"parameters\":{\"zdmhepfjdiwzgw\":\"dataratvpkgawrmuj\",\"chvqwhscvaqdxgel\":\"dataum\"}},{\"referenceName\":\"j\",\"parameters\":{\"aylkrastbks\":\"dataqkgavgoullx\",\"dxdtxbrdb\":\"datakziebmwyodfmpl\",\"pf\":\"datawqt\",\"kdoukqsc\":\"datafrfvhbbnoevkkr\"}},{\"referenceName\":\"dsjgows\",\"parameters\":{\"cexpopqy\":\"datauapeqlhhmbyf\"}},{\"referenceName\":\"icesqpvmoxilh\",\"parameters\":{\"nrbngc\":\"dataiqsriubemxmuygmr\",\"mowvcnvfgqxq\":\"datafmophtkyzsgayn\",\"roqxrvycjdni\":\"dataysuapdns\"}}],\"arguments\":[\"datagyxmpmsacbamtoqs\",\"dataamoyxdigk\",\"datagz\",\"dataylqhqeosxdsxil\"],\"getDebugInfo\":\"None\",\"scriptPath\":\"datattd\",\"scriptLinkedService\":{\"referenceName\":\"gkaohhttty\",\"parameters\":{\"i\":\"dataidzjjjfcyskpnkkx\",\"hvtpmvppvgrigje\":\"databxsmfvltboc\",\"tfmfkuvybemo\":\"datarlgkoqbzrclar\",\"kzvzq\":\"dataamshqvku\"}},\"defines\":{\"dbeanigozjrcx\":\"datajdsnv\"},\"variables\":{\"almzpfylqevwwvz\":\"datag\",\"gjl\":\"datapdxcizrop\",\"q\":\"dataecffb\"},\"queryTimeout\":214972411},\"linkedServiceName\":{\"referenceName\":\"nstqwnpeg\",\"parameters\":{\"beekzyebpatwbbf\":\"datadqeflvdfaqcqlex\",\"nwohlcahhfuydgd\":\"datadfl\",\"bpduzeebde\":\"dataitavgayuspzlcv\"}},\"policy\":{\"timeout\":\"datawkhruzz\",\"retry\":\"databbozivfoy\",\"retryIntervalInSeconds\":945668794,\"secureInput\":false,\"secureOutput\":false,\"\":{\"vvscbpkmo\":\"datasxsqq\"}},\"name\":\"dukp\",\"description\":\"yibwuzvmors\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"zuboigorwpbbjz\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Skipped\"],\"\":{\"nnzpvjwegov\":\"datagk\"}},{\"activity\":\"ceqyrajdvvs\",\"dependencyConditions\":[\"Completed\",\"Skipped\",\"Succeeded\",\"Completed\"],\"\":{\"chvwwcha\":\"datacaz\",\"hayfx\":\"dataztvotf\"}}],\"userProperties\":[{\"name\":\"xxefzliguwqos\",\"value\":\"datacmfm\"},{\"name\":\"nlj\",\"value\":\"datagjcn\"},{\"name\":\"a\",\"value\":\"datam\"}],\"\":{\"wpnpunr\":\"datavskn\"}}") + .toObject(HDInsightHiveActivity.class); + Assertions.assertEquals("dukp", model.name()); + Assertions.assertEquals("yibwuzvmors", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("zuboigorwpbbjz", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("xxefzliguwqos", model.userProperties().get(0).name()); + Assertions.assertEquals("nstqwnpeg", model.linkedServiceName().referenceName()); + Assertions.assertEquals(945668794, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("hyoigzwed", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.NONE, model.getDebugInfo()); + Assertions.assertEquals("gkaohhttty", model.scriptLinkedService().referenceName()); + Assertions.assertEquals(214972411, model.queryTimeout()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightHiveActivity model = + new HDInsightHiveActivity() + .withName("dukp") + .withDescription("yibwuzvmors") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("zuboigorwpbbjz") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ceqyrajdvvs") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("xxefzliguwqos").withValue("datacmfm"), + new UserProperty().withName("nlj").withValue("datagjcn"), + new UserProperty().withName("a").withValue("datam"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("nstqwnpeg") + .withParameters( + mapOf( + "beekzyebpatwbbf", + "datadqeflvdfaqcqlex", + "nwohlcahhfuydgd", + "datadfl", + "bpduzeebde", + "dataitavgayuspzlcv"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datawkhruzz") + .withRetry("databbozivfoy") + .withRetryIntervalInSeconds(945668794) + .withSecureInput(false) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withStorageLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("hyoigzwed") + .withParameters( + mapOf("zdmhepfjdiwzgw", "dataratvpkgawrmuj", "chvqwhscvaqdxgel", "dataum")), + new LinkedServiceReference() + .withReferenceName("j") + .withParameters( + mapOf( + "aylkrastbks", + "dataqkgavgoullx", + "dxdtxbrdb", + "datakziebmwyodfmpl", + "pf", + "datawqt", + "kdoukqsc", + "datafrfvhbbnoevkkr")), + new LinkedServiceReference() + .withReferenceName("dsjgows") + .withParameters(mapOf("cexpopqy", "datauapeqlhhmbyf")), + new LinkedServiceReference() + .withReferenceName("icesqpvmoxilh") + .withParameters( + mapOf( + "nrbngc", + "dataiqsriubemxmuygmr", + "mowvcnvfgqxq", + "datafmophtkyzsgayn", + "roqxrvycjdni", + "dataysuapdns")))) + .withArguments(Arrays.asList("datagyxmpmsacbamtoqs", "dataamoyxdigk", "datagz", "dataylqhqeosxdsxil")) + .withGetDebugInfo(HDInsightActivityDebugInfoOption.NONE) + .withScriptPath("datattd") + .withScriptLinkedService( + new LinkedServiceReference() + .withReferenceName("gkaohhttty") + .withParameters( + mapOf( + "i", + "dataidzjjjfcyskpnkkx", + "hvtpmvppvgrigje", + "databxsmfvltboc", + "tfmfkuvybemo", + "datarlgkoqbzrclar", + "kzvzq", + "dataamshqvku"))) + .withDefines(mapOf("dbeanigozjrcx", "datajdsnv")) + .withVariables(mapOf("almzpfylqevwwvz", "datag", "gjl", "datapdxcizrop", "q", "dataecffb")) + .withQueryTimeout(214972411); + model = BinaryData.fromObject(model).toObject(HDInsightHiveActivity.class); + Assertions.assertEquals("dukp", model.name()); + Assertions.assertEquals("yibwuzvmors", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("zuboigorwpbbjz", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("xxefzliguwqos", model.userProperties().get(0).name()); + Assertions.assertEquals("nstqwnpeg", model.linkedServiceName().referenceName()); + Assertions.assertEquals(945668794, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("hyoigzwed", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.NONE, model.getDebugInfo()); + Assertions.assertEquals("gkaohhttty", model.scriptLinkedService().referenceName()); + Assertions.assertEquals(214972411, model.queryTimeout()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightHiveActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightHiveActivityTypePropertiesTests.java new file mode 100644 index 000000000000..ba4cc76f1fa4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightHiveActivityTypePropertiesTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.HDInsightHiveActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightHiveActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightHiveActivityTypeProperties model = + BinaryData + .fromString( + "{\"storageLinkedServices\":[{\"referenceName\":\"nhbxvvufq\",\"parameters\":{\"srcqdthmlqa\":\"datauosajq\",\"akc\":\"datadlcukdmrvr\",\"tqgabbx\":\"datalsnprda\",\"pkxbwobovexsnm\":\"dataxacgm\"}}],\"arguments\":[\"databmujlsztpygq\",\"datakdl\",\"datasn\"],\"getDebugInfo\":\"None\",\"scriptPath\":\"dataimksfejzmyvl\",\"scriptLinkedService\":{\"referenceName\":\"mngxzpdnbjov\",\"parameters\":{\"imyizdglzzaufin\":\"datavtnbtvlgkjfkaoe\",\"ntjgpyvjgsjyjn\":\"datavyxyrykn\"}},\"defines\":{\"vpamfpini\":\"databhwrncxwzuer\",\"kmfb\":\"datapb\",\"yl\":\"datauu\",\"vnlbjfsol\":\"datage\"},\"variables\":{\"lnhxr\":\"datau\",\"l\":\"datajshicvrmwbgpc\",\"pboaevtxi\":\"databxppvpgsrfshkjg\"},\"queryTimeout\":1275464615}") + .toObject(HDInsightHiveActivityTypeProperties.class); + Assertions.assertEquals("nhbxvvufq", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.NONE, model.getDebugInfo()); + Assertions.assertEquals("mngxzpdnbjov", model.scriptLinkedService().referenceName()); + Assertions.assertEquals(1275464615, model.queryTimeout()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightHiveActivityTypeProperties model = + new HDInsightHiveActivityTypeProperties() + .withStorageLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("nhbxvvufq") + .withParameters( + mapOf( + "srcqdthmlqa", + "datauosajq", + "akc", + "datadlcukdmrvr", + "tqgabbx", + "datalsnprda", + "pkxbwobovexsnm", + "dataxacgm")))) + .withArguments(Arrays.asList("databmujlsztpygq", "datakdl", "datasn")) + .withGetDebugInfo(HDInsightActivityDebugInfoOption.NONE) + .withScriptPath("dataimksfejzmyvl") + .withScriptLinkedService( + new LinkedServiceReference() + .withReferenceName("mngxzpdnbjov") + .withParameters( + mapOf("imyizdglzzaufin", "datavtnbtvlgkjfkaoe", "ntjgpyvjgsjyjn", "datavyxyrykn"))) + .withDefines( + mapOf("vpamfpini", "databhwrncxwzuer", "kmfb", "datapb", "yl", "datauu", "vnlbjfsol", "datage")) + .withVariables(mapOf("lnhxr", "datau", "l", "datajshicvrmwbgpc", "pboaevtxi", "databxppvpgsrfshkjg")) + .withQueryTimeout(1275464615); + model = BinaryData.fromObject(model).toObject(HDInsightHiveActivityTypeProperties.class); + Assertions.assertEquals("nhbxvvufq", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.NONE, model.getDebugInfo()); + Assertions.assertEquals("mngxzpdnbjov", model.scriptLinkedService().referenceName()); + Assertions.assertEquals(1275464615, model.queryTimeout()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightMapReduceActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightMapReduceActivityTests.java new file mode 100644 index 000000000000..bf266f929c9d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightMapReduceActivityTests.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.HDInsightMapReduceActivity; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightMapReduceActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightMapReduceActivity model = + BinaryData + .fromString( + "{\"type\":\"HDInsightMapReduce\",\"typeProperties\":{\"storageLinkedServices\":[{\"referenceName\":\"ljhgqqjmfrm\",\"parameters\":{\"hjhpxjlgiurmli\":\"datagcbrmmweeuy\"}},{\"referenceName\":\"nad\",\"parameters\":{\"wokefdeeppycwsy\":\"datafxzcxvpogrtkdit\",\"hmgv\":\"dataxfowfnsyyeytrwyo\"}},{\"referenceName\":\"eemjazq\",\"parameters\":{\"a\":\"datagkxtgs\",\"puds\":\"datanholkoyxm\",\"xs\":\"datawvzunrqvup\"}},{\"referenceName\":\"nqzdfjwofgzif\",\"parameters\":{\"ddir\":\"dataftilhoyemhwaep\",\"vorifcqmfvzu\":\"datadt\",\"sxtry\":\"datam\",\"hrizwmptsygqztn\":\"datarvwmmuovturdhnn\"}}],\"arguments\":[\"dataeizuapgqxe\",\"databvwxyumqoqw\"],\"getDebugInfo\":\"Failure\",\"className\":\"datayiyeigngrzve\",\"jarFilePath\":\"dataxmxlnhqxzewlww\",\"jarLinkedService\":{\"referenceName\":\"pvpc\",\"parameters\":{\"vfctsfujdapc\":\"dataovzkwhdtf\",\"tddydbat\":\"datagamgbnktg\",\"rwsdy\":\"dataxkwcolna\"}},\"jarLibs\":[\"datan\",\"datad\"],\"defines\":{\"gtkojrruhzvveer\":\"datamvnzhdsaqme\",\"cczkggbmzdnyrmo\":\"datalehsnlmdosiyzf\",\"umckcbsakoucss\":\"datamaekc\"}},\"linkedServiceName\":{\"referenceName\":\"dqilzogilgrqzwy\",\"parameters\":{\"ksghpsqvuisedeqr\":\"datafybflrpvcgqqx\",\"rqdxvbt\":\"datafjkxxn\"}},\"policy\":{\"timeout\":\"dataxvlsv\",\"retry\":\"datavpagwohkromzs\",\"retryIntervalInSeconds\":2037950340,\"secureInput\":true,\"secureOutput\":false,\"\":{\"lvhbg\":\"datavr\",\"gpsalynan\":\"datagjpiezthf\"}},\"name\":\"wzpfbiqjrz\",\"description\":\"xizorqliblyb\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"ffzdyoznidstof\",\"dependencyConditions\":[\"Failed\",\"Completed\"],\"\":{\"xmcsxidazslwh\":\"datawabfgfwebi\"}},{\"activity\":\"yikhdcilinbuok\",\"dependencyConditions\":[\"Failed\",\"Succeeded\",\"Skipped\"],\"\":{\"valoauuwoigofu\":\"dataiplzmswhqrdv\"}},{\"activity\":\"bpmzedmf\",\"dependencyConditions\":[\"Succeeded\",\"Failed\",\"Completed\",\"Succeeded\"],\"\":{\"wyinfywtqvjnoem\":\"dataavbotaoaixip\"}},{\"activity\":\"wutbyaeyyiw\",\"dependencyConditions\":[\"Completed\",\"Completed\"],\"\":{\"onridhwoyznjdd\":\"datamexugdjdmwcxvc\",\"ipuot\":\"datahazlomvx\",\"rhjh\":\"dataiqzqmpgvyydjww\",\"h\":\"datawcfftszswvyi\"}}],\"userProperties\":[{\"name\":\"hgyeoikxjpuwgg\",\"value\":\"datasaqfnbxuw\"}],\"\":{\"egtsqzkzworuhhv\":\"databus\",\"bkgp\":\"dataeodcdjhf\",\"tyuvuzqtrfziub\":\"dataxusylgpznbklhw\"}}") + .toObject(HDInsightMapReduceActivity.class); + Assertions.assertEquals("wzpfbiqjrz", model.name()); + Assertions.assertEquals("xizorqliblyb", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("ffzdyoznidstof", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("hgyeoikxjpuwgg", model.userProperties().get(0).name()); + Assertions.assertEquals("dqilzogilgrqzwy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(2037950340, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("ljhgqqjmfrm", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("pvpc", model.jarLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightMapReduceActivity model = + new HDInsightMapReduceActivity() + .withName("wzpfbiqjrz") + .withDescription("xizorqliblyb") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ffzdyoznidstof") + .withDependencyConditions( + Arrays.asList(DependencyCondition.FAILED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("yikhdcilinbuok") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("bpmzedmf") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("wutbyaeyyiw") + .withDependencyConditions( + Arrays.asList(DependencyCondition.COMPLETED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("hgyeoikxjpuwgg").withValue("datasaqfnbxuw"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("dqilzogilgrqzwy") + .withParameters(mapOf("ksghpsqvuisedeqr", "datafybflrpvcgqqx", "rqdxvbt", "datafjkxxn"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("dataxvlsv") + .withRetry("datavpagwohkromzs") + .withRetryIntervalInSeconds(2037950340) + .withSecureInput(true) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withStorageLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("ljhgqqjmfrm") + .withParameters(mapOf("hjhpxjlgiurmli", "datagcbrmmweeuy")), + new LinkedServiceReference() + .withReferenceName("nad") + .withParameters( + mapOf("wokefdeeppycwsy", "datafxzcxvpogrtkdit", "hmgv", "dataxfowfnsyyeytrwyo")), + new LinkedServiceReference() + .withReferenceName("eemjazq") + .withParameters( + mapOf("a", "datagkxtgs", "puds", "datanholkoyxm", "xs", "datawvzunrqvup")), + new LinkedServiceReference() + .withReferenceName("nqzdfjwofgzif") + .withParameters( + mapOf( + "ddir", + "dataftilhoyemhwaep", + "vorifcqmfvzu", + "datadt", + "sxtry", + "datam", + "hrizwmptsygqztn", + "datarvwmmuovturdhnn")))) + .withArguments(Arrays.asList("dataeizuapgqxe", "databvwxyumqoqw")) + .withGetDebugInfo(HDInsightActivityDebugInfoOption.FAILURE) + .withClassName("datayiyeigngrzve") + .withJarFilePath("dataxmxlnhqxzewlww") + .withJarLinkedService( + new LinkedServiceReference() + .withReferenceName("pvpc") + .withParameters( + mapOf( + "vfctsfujdapc", "dataovzkwhdtf", "tddydbat", "datagamgbnktg", "rwsdy", "dataxkwcolna"))) + .withJarLibs(Arrays.asList("datan", "datad")) + .withDefines( + mapOf( + "gtkojrruhzvveer", + "datamvnzhdsaqme", + "cczkggbmzdnyrmo", + "datalehsnlmdosiyzf", + "umckcbsakoucss", + "datamaekc")); + model = BinaryData.fromObject(model).toObject(HDInsightMapReduceActivity.class); + Assertions.assertEquals("wzpfbiqjrz", model.name()); + Assertions.assertEquals("xizorqliblyb", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("ffzdyoznidstof", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("hgyeoikxjpuwgg", model.userProperties().get(0).name()); + Assertions.assertEquals("dqilzogilgrqzwy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(2037950340, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("ljhgqqjmfrm", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("pvpc", model.jarLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightMapReduceActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightMapReduceActivityTypePropertiesTests.java new file mode 100644 index 000000000000..70d7360dea40 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightMapReduceActivityTypePropertiesTests.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.HDInsightMapReduceActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightMapReduceActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightMapReduceActivityTypeProperties model = + BinaryData + .fromString( + "{\"storageLinkedServices\":[{\"referenceName\":\"vkt\",\"parameters\":{\"vonuhv\":\"dataceplnukdawgzhbwh\",\"tjoxocothsg\":\"datagxck\"}},{\"referenceName\":\"jcjvdajxebm\",\"parameters\":{\"a\":\"datarctf\",\"nd\":\"datakukra\",\"dhjdwfnbiyxqr\":\"datahwdicntqsrhacjsb\",\"rqllugnxmbwdkz\":\"datauyffkayovljtrml\"}},{\"referenceName\":\"wwbqukjithx\",\"parameters\":{\"eiw\":\"datapkv\",\"vuxwuepjcugwku\":\"datafshhcktbfmtbprt\"}}],\"arguments\":[\"datawgmznvlwcnjhq\",\"dataieyqpu\",\"datawzzx\"],\"getDebugInfo\":\"Failure\",\"className\":\"datazcjrbsqcwnbxqkb\",\"jarFilePath\":\"dataoofoxfchune\",\"jarLinkedService\":{\"referenceName\":\"ssx\",\"parameters\":{\"kkgxi\":\"datahlhprjcfy\",\"fdfs\":\"dataxlonz\",\"dnrtydhqkariatxh\":\"datakgwdng\",\"sa\":\"dataxdvrajoghgxgzb\"}},\"jarLibs\":[\"datamcwetx\",\"datasgcwadv\"],\"defines\":{\"cqtmpzwwt\":\"dataageltffqal\",\"ctyvmizxkm\":\"datawbgmxwpyns\",\"tdgpmhzlla\":\"datahqwwtar\",\"pk\":\"dataozsdnf\"}}") + .toObject(HDInsightMapReduceActivityTypeProperties.class); + Assertions.assertEquals("vkt", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("ssx", model.jarLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightMapReduceActivityTypeProperties model = + new HDInsightMapReduceActivityTypeProperties() + .withStorageLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("vkt") + .withParameters(mapOf("vonuhv", "dataceplnukdawgzhbwh", "tjoxocothsg", "datagxck")), + new LinkedServiceReference() + .withReferenceName("jcjvdajxebm") + .withParameters( + mapOf( + "a", + "datarctf", + "nd", + "datakukra", + "dhjdwfnbiyxqr", + "datahwdicntqsrhacjsb", + "rqllugnxmbwdkz", + "datauyffkayovljtrml")), + new LinkedServiceReference() + .withReferenceName("wwbqukjithx") + .withParameters(mapOf("eiw", "datapkv", "vuxwuepjcugwku", "datafshhcktbfmtbprt")))) + .withArguments(Arrays.asList("datawgmznvlwcnjhq", "dataieyqpu", "datawzzx")) + .withGetDebugInfo(HDInsightActivityDebugInfoOption.FAILURE) + .withClassName("datazcjrbsqcwnbxqkb") + .withJarFilePath("dataoofoxfchune") + .withJarLinkedService( + new LinkedServiceReference() + .withReferenceName("ssx") + .withParameters( + mapOf( + "kkgxi", + "datahlhprjcfy", + "fdfs", + "dataxlonz", + "dnrtydhqkariatxh", + "datakgwdng", + "sa", + "dataxdvrajoghgxgzb"))) + .withJarLibs(Arrays.asList("datamcwetx", "datasgcwadv")) + .withDefines( + mapOf( + "cqtmpzwwt", + "dataageltffqal", + "ctyvmizxkm", + "datawbgmxwpyns", + "tdgpmhzlla", + "datahqwwtar", + "pk", + "dataozsdnf")); + model = BinaryData.fromObject(model).toObject(HDInsightMapReduceActivityTypeProperties.class); + Assertions.assertEquals("vkt", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("ssx", model.jarLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightPigActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightPigActivityTests.java new file mode 100644 index 000000000000..88c64bdfdf2b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightPigActivityTests.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.HDInsightPigActivity; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightPigActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightPigActivity model = + BinaryData + .fromString( + "{\"type\":\"HDInsightPig\",\"typeProperties\":{\"storageLinkedServices\":[{\"referenceName\":\"gijiqwxw\",\"parameters\":{\"qnprbvruhdjzivl\":\"datad\",\"mq\":\"dataxi\"}},{\"referenceName\":\"qmbfptzixmks\",\"parameters\":{\"n\":\"datadtjv\",\"kzulmqxficinw\":\"datanv\",\"x\":\"datajve\"}}],\"arguments\":\"dataer\",\"getDebugInfo\":\"Failure\",\"scriptPath\":\"databosjxbnytten\",\"scriptLinkedService\":{\"referenceName\":\"ditumyycvtya\",\"parameters\":{\"qvwhjgtbhre\":\"dataimhspjqhivxb\",\"btqibqbougcwzgd\":\"datautqoh\",\"tp\":\"datadrdxoutkgezuln\"}},\"defines\":{\"eoy\":\"dataejxjhlxoljbp\",\"havwhrivvzrc\":\"datayk\",\"eearbbxaneviqk\":\"datayfrxlsypwu\"}},\"linkedServiceName\":{\"referenceName\":\"pvidzhjcppqcgbp\",\"parameters\":{\"jbakpasuugcngdu\":\"datairjhdlxuptbtlha\"}},\"policy\":{\"timeout\":\"datae\",\"retry\":\"dataguvaimkoyrp\",\"retryIntervalInSeconds\":1099083192,\"secureInput\":true,\"secureOutput\":true,\"\":{\"xbjqiabitevv\":\"databozlmrhnghvlvd\",\"kdfyvgcftaqydcr\":\"datawiypyljzk\",\"r\":\"datalhmneykxewemtaz\",\"e\":\"datajzpxo\"}},\"name\":\"erxmlfnugl\",\"description\":\"rkrtdkp\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"n\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\",\"Skipped\",\"Completed\"],\"\":{\"jzq\":\"datajhwkl\",\"panwejbngojna\":\"datag\"}},{\"activity\":\"swytkwt\",\"dependencyConditions\":[\"Failed\",\"Succeeded\",\"Failed\"],\"\":{\"bhrvonea\":\"dataormfhruhwxmnrdfj\",\"rxtoxlx\":\"datapjmjigypbdfrtasa\",\"ycissh\":\"datajijttsyrxynnfsk\"}},{\"activity\":\"pxftyhfc\",\"dependencyConditions\":[\"Succeeded\",\"Succeeded\",\"Succeeded\",\"Failed\"],\"\":{\"ztpnrysxxajr\":\"dataqaawryctzslf\",\"ddvnobesowbtnfq\":\"datacighl\"}},{\"activity\":\"wcaxj\",\"dependencyConditions\":[\"Skipped\",\"Skipped\"],\"\":{\"cxofqjninrsk\":\"dataucmeuuuajiot\",\"ygwpwqux\":\"dataekqtiuveazuciwbi\"}}],\"userProperties\":[{\"name\":\"slspihux\",\"value\":\"datavviotvoolkm\"}],\"\":{\"frfwaehsso\":\"dataefbbrndaquxv\",\"avpy\":\"datao\"}}") + .toObject(HDInsightPigActivity.class); + Assertions.assertEquals("erxmlfnugl", model.name()); + Assertions.assertEquals("rkrtdkp", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("n", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("slspihux", model.userProperties().get(0).name()); + Assertions.assertEquals("pvidzhjcppqcgbp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1099083192, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("gijiqwxw", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("ditumyycvtya", model.scriptLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightPigActivity model = + new HDInsightPigActivity() + .withName("erxmlfnugl") + .withDescription("rkrtdkp") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("n") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("swytkwt") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("pxftyhfc") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("wcaxj") + .withDependencyConditions( + Arrays.asList(DependencyCondition.SKIPPED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties(Arrays.asList(new UserProperty().withName("slspihux").withValue("datavviotvoolkm"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("pvidzhjcppqcgbp") + .withParameters(mapOf("jbakpasuugcngdu", "datairjhdlxuptbtlha"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datae") + .withRetry("dataguvaimkoyrp") + .withRetryIntervalInSeconds(1099083192) + .withSecureInput(true) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withStorageLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("gijiqwxw") + .withParameters(mapOf("qnprbvruhdjzivl", "datad", "mq", "dataxi")), + new LinkedServiceReference() + .withReferenceName("qmbfptzixmks") + .withParameters(mapOf("n", "datadtjv", "kzulmqxficinw", "datanv", "x", "datajve")))) + .withArguments("dataer") + .withGetDebugInfo(HDInsightActivityDebugInfoOption.FAILURE) + .withScriptPath("databosjxbnytten") + .withScriptLinkedService( + new LinkedServiceReference() + .withReferenceName("ditumyycvtya") + .withParameters( + mapOf( + "qvwhjgtbhre", + "dataimhspjqhivxb", + "btqibqbougcwzgd", + "datautqoh", + "tp", + "datadrdxoutkgezuln"))) + .withDefines( + mapOf("eoy", "dataejxjhlxoljbp", "havwhrivvzrc", "datayk", "eearbbxaneviqk", "datayfrxlsypwu")); + model = BinaryData.fromObject(model).toObject(HDInsightPigActivity.class); + Assertions.assertEquals("erxmlfnugl", model.name()); + Assertions.assertEquals("rkrtdkp", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("n", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("slspihux", model.userProperties().get(0).name()); + Assertions.assertEquals("pvidzhjcppqcgbp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1099083192, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("gijiqwxw", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("ditumyycvtya", model.scriptLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightPigActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightPigActivityTypePropertiesTests.java new file mode 100644 index 000000000000..803e47a20abb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightPigActivityTypePropertiesTests.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.HDInsightPigActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightPigActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightPigActivityTypeProperties model = + BinaryData + .fromString( + "{\"storageLinkedServices\":[{\"referenceName\":\"yeblkgupgnstqs\",\"parameters\":{\"vkhufkt\":\"datamhioar\"}},{\"referenceName\":\"gt\",\"parameters\":{\"nbtnn\":\"datactreotzgkokfztrv\",\"wsbznjngerw\":\"dataamkegyskmh\",\"qzafjycfbdbzbabo\":\"datatlpsswoslqmft\"}},{\"referenceName\":\"egalecqyzdy\",\"parameters\":{\"hiaqegjvhy\":\"dataocnkbt\",\"ovvna\":\"datanqbhclbbksoqzzy\"}},{\"referenceName\":\"xmjmhclhcqcjn\",\"parameters\":{\"dasovlrjggvy\":\"databwqgs\",\"apxxbkxwh\":\"datatjebbacscirzt\"}}],\"arguments\":\"datahecpstfekbslyqml\",\"getDebugInfo\":\"None\",\"scriptPath\":\"datacnybhvzltbg\",\"scriptLinkedService\":{\"referenceName\":\"aepjmkruzogsszo\",\"parameters\":{\"mqe\":\"datanfaxcd\",\"ltugobscpt\":\"datahsirotj\",\"ifoznfdboumpks\":\"datakgqyuvhlpmjpzgjn\",\"hdlwlehhqxy\":\"datakdjpfsmdg\"}},\"defines\":{\"zgryf\":\"datakwvrrptblsata\",\"skuimv\":\"datawwqbeyvwdnjmji\",\"ucnpaesrairefif\":\"dataiyicxnxcimalvz\"}}") + .toObject(HDInsightPigActivityTypeProperties.class); + Assertions.assertEquals("yeblkgupgnstqs", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.NONE, model.getDebugInfo()); + Assertions.assertEquals("aepjmkruzogsszo", model.scriptLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightPigActivityTypeProperties model = + new HDInsightPigActivityTypeProperties() + .withStorageLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("yeblkgupgnstqs") + .withParameters(mapOf("vkhufkt", "datamhioar")), + new LinkedServiceReference() + .withReferenceName("gt") + .withParameters( + mapOf( + "nbtnn", + "datactreotzgkokfztrv", + "wsbznjngerw", + "dataamkegyskmh", + "qzafjycfbdbzbabo", + "datatlpsswoslqmft")), + new LinkedServiceReference() + .withReferenceName("egalecqyzdy") + .withParameters(mapOf("hiaqegjvhy", "dataocnkbt", "ovvna", "datanqbhclbbksoqzzy")), + new LinkedServiceReference() + .withReferenceName("xmjmhclhcqcjn") + .withParameters(mapOf("dasovlrjggvy", "databwqgs", "apxxbkxwh", "datatjebbacscirzt")))) + .withArguments("datahecpstfekbslyqml") + .withGetDebugInfo(HDInsightActivityDebugInfoOption.NONE) + .withScriptPath("datacnybhvzltbg") + .withScriptLinkedService( + new LinkedServiceReference() + .withReferenceName("aepjmkruzogsszo") + .withParameters( + mapOf( + "mqe", + "datanfaxcd", + "ltugobscpt", + "datahsirotj", + "ifoznfdboumpks", + "datakgqyuvhlpmjpzgjn", + "hdlwlehhqxy", + "datakdjpfsmdg"))) + .withDefines( + mapOf( + "zgryf", + "datakwvrrptblsata", + "skuimv", + "datawwqbeyvwdnjmji", + "ucnpaesrairefif", + "dataiyicxnxcimalvz")); + model = BinaryData.fromObject(model).toObject(HDInsightPigActivityTypeProperties.class); + Assertions.assertEquals("yeblkgupgnstqs", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.NONE, model.getDebugInfo()); + Assertions.assertEquals("aepjmkruzogsszo", model.scriptLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightSparkActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightSparkActivityTests.java new file mode 100644 index 000000000000..44157cb64f7e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightSparkActivityTests.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.HDInsightSparkActivity; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightSparkActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightSparkActivity model = + BinaryData + .fromString( + "{\"type\":\"HDInsightSpark\",\"typeProperties\":{\"rootPath\":\"dataebw\",\"entryFilePath\":\"dataqnluszilkrcpxl\",\"arguments\":[\"datafxtbvhmsvcmce\",\"datatrhwriihwxchy\"],\"getDebugInfo\":\"Failure\",\"sparkJobLinkedService\":{\"referenceName\":\"rpjonmins\",\"parameters\":{\"igfdpp\":\"datauiiytyarpe\",\"bgrtse\":\"datakkgdygjldljgd\",\"kofmtfwculsbnapz\":\"datanowzf\"}},\"className\":\"zmrlprbclj\",\"proxyUser\":\"datajaawnzzlfvefs\",\"sparkConfig\":{\"dpbmoq\":\"dataasm\"}},\"linkedServiceName\":{\"referenceName\":\"vukgfzbykapmeo\",\"parameters\":{\"ew\":\"datavmakdtgpnyubnwym\"}},\"policy\":{\"timeout\":\"dataxwv\",\"retry\":\"datatjsnjbahxyfd\",\"retryIntervalInSeconds\":1674480815,\"secureInput\":false,\"secureOutput\":false,\"\":{\"rmptj\":\"datahq\"}},\"name\":\"ixawipjracyx\",\"description\":\"adflvbkhgdz\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"oheminer\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Completed\",\"Failed\"],\"\":{\"qgqmitrp\":\"datavmxhztdcadbm\"}},{\"activity\":\"gmhh\",\"dependencyConditions\":[\"Skipped\",\"Completed\"],\"\":{\"ni\":\"dataiuhmtcihupoelj\",\"awbsdeqqbdcbnrg\":\"datayoxajit\",\"mtgtnb\":\"datapnor\"}},{\"activity\":\"sopuwesmxodyto\",\"dependencyConditions\":[\"Succeeded\",\"Succeeded\",\"Skipped\"],\"\":{\"nsdgmuaqtqn\":\"datan\"}}],\"userProperties\":[{\"name\":\"iptzg\",\"value\":\"datamujukenkuyom\"},{\"name\":\"kgkyobuihprvo\",\"value\":\"dataodrpyxkzxrmmo\"},{\"name\":\"cufkxygxoubekafd\",\"value\":\"datagtgcfkeae\"},{\"name\":\"pmhtlkjfp\",\"value\":\"dataeb\"}],\"\":{\"lwysrswzhciaz\":\"datatxsuxvjj\",\"zodnxlcdgkc\":\"dataebtskmqkanuxjudy\",\"rskzwuubaf\":\"datafancjl\"}}") + .toObject(HDInsightSparkActivity.class); + Assertions.assertEquals("ixawipjracyx", model.name()); + Assertions.assertEquals("adflvbkhgdz", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("oheminer", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("iptzg", model.userProperties().get(0).name()); + Assertions.assertEquals("vukgfzbykapmeo", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1674480815, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("rpjonmins", model.sparkJobLinkedService().referenceName()); + Assertions.assertEquals("zmrlprbclj", model.className()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightSparkActivity model = + new HDInsightSparkActivity() + .withName("ixawipjracyx") + .withDescription("adflvbkhgdz") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("oheminer") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("gmhh") + .withDependencyConditions( + Arrays.asList(DependencyCondition.SKIPPED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("sopuwesmxodyto") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("iptzg").withValue("datamujukenkuyom"), + new UserProperty().withName("kgkyobuihprvo").withValue("dataodrpyxkzxrmmo"), + new UserProperty().withName("cufkxygxoubekafd").withValue("datagtgcfkeae"), + new UserProperty().withName("pmhtlkjfp").withValue("dataeb"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("vukgfzbykapmeo") + .withParameters(mapOf("ew", "datavmakdtgpnyubnwym"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("dataxwv") + .withRetry("datatjsnjbahxyfd") + .withRetryIntervalInSeconds(1674480815) + .withSecureInput(false) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withRootPath("dataebw") + .withEntryFilePath("dataqnluszilkrcpxl") + .withArguments(Arrays.asList("datafxtbvhmsvcmce", "datatrhwriihwxchy")) + .withGetDebugInfo(HDInsightActivityDebugInfoOption.FAILURE) + .withSparkJobLinkedService( + new LinkedServiceReference() + .withReferenceName("rpjonmins") + .withParameters( + mapOf( + "igfdpp", + "datauiiytyarpe", + "bgrtse", + "datakkgdygjldljgd", + "kofmtfwculsbnapz", + "datanowzf"))) + .withClassName("zmrlprbclj") + .withProxyUser("datajaawnzzlfvefs") + .withSparkConfig(mapOf("dpbmoq", "dataasm")); + model = BinaryData.fromObject(model).toObject(HDInsightSparkActivity.class); + Assertions.assertEquals("ixawipjracyx", model.name()); + Assertions.assertEquals("adflvbkhgdz", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("oheminer", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("iptzg", model.userProperties().get(0).name()); + Assertions.assertEquals("vukgfzbykapmeo", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1674480815, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("rpjonmins", model.sparkJobLinkedService().referenceName()); + Assertions.assertEquals("zmrlprbclj", model.className()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightSparkActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightSparkActivityTypePropertiesTests.java new file mode 100644 index 000000000000..85ab71d28e53 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightSparkActivityTypePropertiesTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.HDInsightSparkActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightSparkActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightSparkActivityTypeProperties model = + BinaryData + .fromString( + "{\"rootPath\":\"datazi\",\"entryFilePath\":\"datamvwjq\",\"arguments\":[\"dataqiaho\",\"datajzviv\"],\"getDebugInfo\":\"Always\",\"sparkJobLinkedService\":{\"referenceName\":\"tcfulmzxhgwzbyst\",\"parameters\":{\"jssjbpna\":\"datawehn\",\"ichzcajityjz\":\"datapymv\",\"you\":\"datap\"}},\"className\":\"qyeyzoivi\",\"proxyUser\":\"datanihmwvhc\",\"sparkConfig\":{\"djc\":\"datauasutdhmilhzy\"}}") + .toObject(HDInsightSparkActivityTypeProperties.class); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.ALWAYS, model.getDebugInfo()); + Assertions.assertEquals("tcfulmzxhgwzbyst", model.sparkJobLinkedService().referenceName()); + Assertions.assertEquals("qyeyzoivi", model.className()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightSparkActivityTypeProperties model = + new HDInsightSparkActivityTypeProperties() + .withRootPath("datazi") + .withEntryFilePath("datamvwjq") + .withArguments(Arrays.asList("dataqiaho", "datajzviv")) + .withGetDebugInfo(HDInsightActivityDebugInfoOption.ALWAYS) + .withSparkJobLinkedService( + new LinkedServiceReference() + .withReferenceName("tcfulmzxhgwzbyst") + .withParameters(mapOf("jssjbpna", "datawehn", "ichzcajityjz", "datapymv", "you", "datap"))) + .withClassName("qyeyzoivi") + .withProxyUser("datanihmwvhc") + .withSparkConfig(mapOf("djc", "datauasutdhmilhzy")); + model = BinaryData.fromObject(model).toObject(HDInsightSparkActivityTypeProperties.class); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.ALWAYS, model.getDebugInfo()); + Assertions.assertEquals("tcfulmzxhgwzbyst", model.sparkJobLinkedService().referenceName()); + Assertions.assertEquals("qyeyzoivi", model.className()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightStreamingActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightStreamingActivityTests.java new file mode 100644 index 000000000000..f70c668ce0c5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightStreamingActivityTests.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.HDInsightStreamingActivity; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightStreamingActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightStreamingActivity model = + BinaryData + .fromString( + "{\"type\":\"HDInsightStreaming\",\"typeProperties\":{\"storageLinkedServices\":[{\"referenceName\":\"uy\",\"parameters\":{\"n\":\"dataubgnm\",\"i\":\"datada\"}},{\"referenceName\":\"hulvpnqvcutwngfd\",\"parameters\":{\"quycokpfyojf\":\"datam\",\"syxthdfqqz\":\"datavmsf\"}},{\"referenceName\":\"qgmoexgnyugsasgh\",\"parameters\":{\"ndxrofwctjhdbidl\":\"dataexdxhxpqkcstynjx\",\"kpx\":\"dataktiojitfa\",\"sorwtakny\":\"dataetdrcm\",\"oskwujhskxx\":\"dataxrrf\"}},{\"referenceName\":\"k\",\"parameters\":{\"t\":\"dataactfimcax\"}}],\"arguments\":[\"dataqtimqicsfaqypjc\",\"datadtktfpj\",\"dataxkujwn\"],\"getDebugInfo\":\"Failure\",\"mapper\":\"dataoqwuforaxbeamip\",\"reducer\":\"datasyed\",\"input\":\"datayrpipslc\",\"output\":\"datawgrzzqf\",\"filePaths\":[\"datadifghdgsyhncxoqx\",\"datajzdpl\",\"datagllvkor\",\"dataosoxxoqyikdjaog\"],\"fileLinkedService\":{\"referenceName\":\"txqxvmybqjlgrlfn\",\"parameters\":{\"lhzjiqibmiwrh\":\"datacmd\"}},\"combiner\":\"datakxrqzgshqx\",\"commandEnvironment\":[\"datanu\",\"datafslawimhoaqj\",\"datalhlpz\",\"datamdaiv\"],\"defines\":{\"nhbsvr\":\"datazbzdi\",\"noasyyadyfnxt\":\"datarccx\",\"gsva\":\"datalnzcm\"}},\"linkedServiceName\":{\"referenceName\":\"uov\",\"parameters\":{\"enfjhfsz\":\"datatykprrdd\"}},\"policy\":{\"timeout\":\"dataosmqscvyuldkpdle\",\"retry\":\"dataljujpsubxggknmvk\",\"retryIntervalInSeconds\":1332323921,\"secureInput\":false,\"secureOutput\":false,\"\":{\"z\":\"datasjea\",\"jwsddyq\":\"datajcsbkmaluchbfrt\",\"txsyufex\":\"dataxpnzpuknfpgg\"}},\"name\":\"vhjyxau\",\"description\":\"kqofrkfccqjenzl\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"jbvqaey\",\"dependencyConditions\":[\"Succeeded\",\"Failed\",\"Completed\"],\"\":{\"ledm\":\"datalxdwliitai\",\"dletjiudcoktsgc\":\"dataup\",\"grebecxuuzeuklu\":\"datapjlmsta\",\"ejamychwwrvvtj\":\"datak\"}}],\"userProperties\":[{\"name\":\"txvmbedvvmrtnmg\",\"value\":\"databfzaaiihyl\"},{\"name\":\"w\",\"value\":\"datahlbpmplethek\"},{\"name\":\"bnamtv\",\"value\":\"dataoaac\"}],\"\":{\"ytytyrvtuxv\":\"dataonsvjc\"}}") + .toObject(HDInsightStreamingActivity.class); + Assertions.assertEquals("vhjyxau", model.name()); + Assertions.assertEquals("kqofrkfccqjenzl", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("jbvqaey", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("txvmbedvvmrtnmg", model.userProperties().get(0).name()); + Assertions.assertEquals("uov", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1332323921, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("uy", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("txqxvmybqjlgrlfn", model.fileLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightStreamingActivity model = + new HDInsightStreamingActivity() + .withName("vhjyxau") + .withDescription("kqofrkfccqjenzl") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("jbvqaey") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("txvmbedvvmrtnmg").withValue("databfzaaiihyl"), + new UserProperty().withName("w").withValue("datahlbpmplethek"), + new UserProperty().withName("bnamtv").withValue("dataoaac"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("uov") + .withParameters(mapOf("enfjhfsz", "datatykprrdd"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("dataosmqscvyuldkpdle") + .withRetry("dataljujpsubxggknmvk") + .withRetryIntervalInSeconds(1332323921) + .withSecureInput(false) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withStorageLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("uy") + .withParameters(mapOf("n", "dataubgnm", "i", "datada")), + new LinkedServiceReference() + .withReferenceName("hulvpnqvcutwngfd") + .withParameters(mapOf("quycokpfyojf", "datam", "syxthdfqqz", "datavmsf")), + new LinkedServiceReference() + .withReferenceName("qgmoexgnyugsasgh") + .withParameters( + mapOf( + "ndxrofwctjhdbidl", + "dataexdxhxpqkcstynjx", + "kpx", + "dataktiojitfa", + "sorwtakny", + "dataetdrcm", + "oskwujhskxx", + "dataxrrf")), + new LinkedServiceReference() + .withReferenceName("k") + .withParameters(mapOf("t", "dataactfimcax")))) + .withArguments(Arrays.asList("dataqtimqicsfaqypjc", "datadtktfpj", "dataxkujwn")) + .withGetDebugInfo(HDInsightActivityDebugInfoOption.FAILURE) + .withMapper("dataoqwuforaxbeamip") + .withReducer("datasyed") + .withInput("datayrpipslc") + .withOutput("datawgrzzqf") + .withFilePaths(Arrays.asList("datadifghdgsyhncxoqx", "datajzdpl", "datagllvkor", "dataosoxxoqyikdjaog")) + .withFileLinkedService( + new LinkedServiceReference() + .withReferenceName("txqxvmybqjlgrlfn") + .withParameters(mapOf("lhzjiqibmiwrh", "datacmd"))) + .withCombiner("datakxrqzgshqx") + .withCommandEnvironment(Arrays.asList("datanu", "datafslawimhoaqj", "datalhlpz", "datamdaiv")) + .withDefines(mapOf("nhbsvr", "datazbzdi", "noasyyadyfnxt", "datarccx", "gsva", "datalnzcm")); + model = BinaryData.fromObject(model).toObject(HDInsightStreamingActivity.class); + Assertions.assertEquals("vhjyxau", model.name()); + Assertions.assertEquals("kqofrkfccqjenzl", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("jbvqaey", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("txvmbedvvmrtnmg", model.userProperties().get(0).name()); + Assertions.assertEquals("uov", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1332323921, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("uy", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.FAILURE, model.getDebugInfo()); + Assertions.assertEquals("txqxvmybqjlgrlfn", model.fileLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightStreamingActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightStreamingActivityTypePropertiesTests.java new file mode 100644 index 000000000000..1dba7054ccc7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HDInsightStreamingActivityTypePropertiesTests.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.HDInsightStreamingActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.HDInsightActivityDebugInfoOption; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HDInsightStreamingActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HDInsightStreamingActivityTypeProperties model = + BinaryData + .fromString( + "{\"storageLinkedServices\":[{\"referenceName\":\"immmmgbyn\",\"parameters\":{\"fqznvahpxdgyho\":\"datatdtv\"}},{\"referenceName\":\"x\",\"parameters\":{\"aszjrihca\":\"dataxvxfwwvmygcfazto\",\"xpmoadjooernzl\":\"datagjytvkttitebm\",\"ebpuoycawptxq\":\"datazmygout\"}},{\"referenceName\":\"pufdxpwjoajvsk\",\"parameters\":{\"cuk\":\"dataoc\"}},{\"referenceName\":\"tcuvwwfgjjcaa\",\"parameters\":{\"xpqxnlifhjymqwj\":\"datappwwil\"}}],\"arguments\":[\"datavyatyzwybgaycjph\",\"datazymcypdbuoqn\"],\"getDebugInfo\":\"None\",\"mapper\":\"datazngidgwsco\",\"reducer\":\"datamhgzapcgdk\",\"input\":\"datayavfc\",\"output\":\"dataohlfvsbaqdgzbjb\",\"filePaths\":[\"dataoudc\",\"datadlkucxtyufsouh\"],\"fileLinkedService\":{\"referenceName\":\"cumuo\",\"parameters\":{\"gro\":\"dataspsbgxpn\",\"yjox\":\"dataiaflxoxwndf\",\"ambzprhpwwarz\":\"dataalcyflzuztdwxr\"}},\"combiner\":\"databbwtagxhriru\",\"commandEnvironment\":[\"datazu\",\"datayxxwlyjdbsxjxl\",\"dataq\"],\"defines\":{\"pfbrsmy\":\"datarolagbellp\",\"hgowhnvcqhmuv\":\"datasndfr\",\"ktodeertyijlvc\":\"dataystohu\",\"bdkwzbkhvlsahj\":\"dataphnxxwble\"}}") + .toObject(HDInsightStreamingActivityTypeProperties.class); + Assertions.assertEquals("immmmgbyn", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.NONE, model.getDebugInfo()); + Assertions.assertEquals("cumuo", model.fileLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HDInsightStreamingActivityTypeProperties model = + new HDInsightStreamingActivityTypeProperties() + .withStorageLinkedServices( + Arrays + .asList( + new LinkedServiceReference() + .withReferenceName("immmmgbyn") + .withParameters(mapOf("fqznvahpxdgyho", "datatdtv")), + new LinkedServiceReference() + .withReferenceName("x") + .withParameters( + mapOf( + "aszjrihca", + "dataxvxfwwvmygcfazto", + "xpmoadjooernzl", + "datagjytvkttitebm", + "ebpuoycawptxq", + "datazmygout")), + new LinkedServiceReference() + .withReferenceName("pufdxpwjoajvsk") + .withParameters(mapOf("cuk", "dataoc")), + new LinkedServiceReference() + .withReferenceName("tcuvwwfgjjcaa") + .withParameters(mapOf("xpqxnlifhjymqwj", "datappwwil")))) + .withArguments(Arrays.asList("datavyatyzwybgaycjph", "datazymcypdbuoqn")) + .withGetDebugInfo(HDInsightActivityDebugInfoOption.NONE) + .withMapper("datazngidgwsco") + .withReducer("datamhgzapcgdk") + .withInput("datayavfc") + .withOutput("dataohlfvsbaqdgzbjb") + .withFilePaths(Arrays.asList("dataoudc", "datadlkucxtyufsouh")) + .withFileLinkedService( + new LinkedServiceReference() + .withReferenceName("cumuo") + .withParameters( + mapOf( + "gro", + "dataspsbgxpn", + "yjox", + "dataiaflxoxwndf", + "ambzprhpwwarz", + "dataalcyflzuztdwxr"))) + .withCombiner("databbwtagxhriru") + .withCommandEnvironment(Arrays.asList("datazu", "datayxxwlyjdbsxjxl", "dataq")) + .withDefines( + mapOf( + "pfbrsmy", + "datarolagbellp", + "hgowhnvcqhmuv", + "datasndfr", + "ktodeertyijlvc", + "dataystohu", + "bdkwzbkhvlsahj", + "dataphnxxwble")); + model = BinaryData.fromObject(model).toObject(HDInsightStreamingActivityTypeProperties.class); + Assertions.assertEquals("immmmgbyn", model.storageLinkedServices().get(0).referenceName()); + Assertions.assertEquals(HDInsightActivityDebugInfoOption.NONE, model.getDebugInfo()); + Assertions.assertEquals("cumuo", model.fileLinkedService().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HdfsLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HdfsLocationTests.java new file mode 100644 index 000000000000..597c8e7d53a9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HdfsLocationTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.HdfsLocation; + +public final class HdfsLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HdfsLocation model = + BinaryData + .fromString( + "{\"type\":\"HdfsLocation\",\"folderPath\":\"dataoxdjxldnaryy\",\"fileName\":\"datazkdolrndwdbvxvza\",\"\":{\"hmcxqqxmyzkl\":\"dataoyqxlunkf\",\"rqra\":\"dataoanpohrvm\"}}") + .toObject(HdfsLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HdfsLocation model = new HdfsLocation().withFolderPath("dataoxdjxldnaryy").withFileName("datazkdolrndwdbvxvza"); + model = BinaryData.fromObject(model).toObject(HdfsLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HdfsReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HdfsReadSettingsTests.java new file mode 100644 index 000000000000..4dccc107a3af --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HdfsReadSettingsTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DistcpSettings; +import com.azure.resourcemanager.datafactory.models.HdfsReadSettings; + +public final class HdfsReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HdfsReadSettings model = + BinaryData + .fromString( + "{\"type\":\"HdfsReadSettings\",\"recursive\":\"datakronxmt\",\"wildcardFolderPath\":\"datawwdfncqutyszhzlv\",\"wildcardFileName\":\"datairnvdbzarmepbmog\",\"fileListPath\":\"datapkskxsyohfrlyynk\",\"enablePartitionDiscovery\":\"dataych\",\"partitionRootPath\":\"datahngwtbhjgli\",\"modifiedDatetimeStart\":\"dataeodgnuoewf\",\"modifiedDatetimeEnd\":\"datawmm\",\"distcpSettings\":{\"resourceManagerEndpoint\":\"dataxtyavvexjqdj\",\"tempScriptPath\":\"datao\",\"distcpOptions\":\"datagegwxjgkrppmvno\"},\"deleteFilesAfterCompletion\":\"datawqci\",\"maxConcurrentConnections\":\"datawhkdkvaqs\",\"disableMetricsCollection\":\"datadscot\",\"\":{\"sqtirhabhhpcvs\":\"datakxmtmjkfmrjngr\",\"xvnmtjmuxrdmu\":\"datayjmbydr\",\"cxlllk\":\"datawruogmthfqcy\",\"uscm\":\"datajgjlwfssgiebq\"}}") + .toObject(HdfsReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HdfsReadSettings model = + new HdfsReadSettings() + .withMaxConcurrentConnections("datawhkdkvaqs") + .withDisableMetricsCollection("datadscot") + .withRecursive("datakronxmt") + .withWildcardFolderPath("datawwdfncqutyszhzlv") + .withWildcardFileName("datairnvdbzarmepbmog") + .withFileListPath("datapkskxsyohfrlyynk") + .withEnablePartitionDiscovery("dataych") + .withPartitionRootPath("datahngwtbhjgli") + .withModifiedDatetimeStart("dataeodgnuoewf") + .withModifiedDatetimeEnd("datawmm") + .withDistcpSettings( + new DistcpSettings() + .withResourceManagerEndpoint("dataxtyavvexjqdj") + .withTempScriptPath("datao") + .withDistcpOptions("datagegwxjgkrppmvno")) + .withDeleteFilesAfterCompletion("datawqci"); + model = BinaryData.fromObject(model).toObject(HdfsReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HdfsSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HdfsSourceTests.java new file mode 100644 index 000000000000..116ebd9bb124 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HdfsSourceTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DistcpSettings; +import com.azure.resourcemanager.datafactory.models.HdfsSource; + +public final class HdfsSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HdfsSource model = + BinaryData + .fromString( + "{\"type\":\"HdfsSource\",\"recursive\":\"datay\",\"distcpSettings\":{\"resourceManagerEndpoint\":\"datacwu\",\"tempScriptPath\":\"dataanpoy\",\"distcpOptions\":\"datajonilnyhze\"},\"sourceRetryCount\":\"datatdcloq\",\"sourceRetryWait\":\"datazdb\",\"maxConcurrentConnections\":\"datae\",\"disableMetricsCollection\":\"datahfmzeufjzqaqeqc\",\"\":{\"vaoazfkykkcq\":\"dataqcwzytomnqcthgq\",\"lllzsqolckwhg\":\"datafnvjgixsjhinpyek\",\"xzdohfvxavhfhl\":\"datafbnnhwpnloi\"}}") + .toObject(HdfsSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HdfsSource model = + new HdfsSource() + .withSourceRetryCount("datatdcloq") + .withSourceRetryWait("datazdb") + .withMaxConcurrentConnections("datae") + .withDisableMetricsCollection("datahfmzeufjzqaqeqc") + .withRecursive("datay") + .withDistcpSettings( + new DistcpSettings() + .withResourceManagerEndpoint("datacwu") + .withTempScriptPath("dataanpoy") + .withDistcpOptions("datajonilnyhze")); + model = BinaryData.fromObject(model).toObject(HdfsSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HiveDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HiveDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..40b93a684718 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HiveDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.HiveDatasetTypeProperties; + +public final class HiveDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HiveDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"datanocscygimizl\",\"table\":\"datajbwmgksrlmsppp\",\"schema\":\"dataszthjtryjskdiylg\"}") + .toObject(HiveDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HiveDatasetTypeProperties model = + new HiveDatasetTypeProperties() + .withTableName("datanocscygimizl") + .withTable("datajbwmgksrlmsppp") + .withSchema("dataszthjtryjskdiylg"); + model = BinaryData.fromObject(model).toObject(HiveDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HiveObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HiveObjectDatasetTests.java new file mode 100644 index 000000000000..951f66098563 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HiveObjectDatasetTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.HiveObjectDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HiveObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HiveObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"HiveObject\",\"typeProperties\":{\"tableName\":\"dataqkwqphfv\",\"table\":\"datatsstwl\",\"schema\":\"datacachdtezgfctu\"},\"description\":\"owqrzvuxn\",\"structure\":\"datauohshzultdbvm\",\"schema\":\"datahypngo\",\"linkedServiceName\":{\"referenceName\":\"bdxvrivptbczsuzg\",\"parameters\":{\"gpycei\":\"datakekytkzvtvmaatv\",\"s\":\"dataharhbdxsbyp\"}},\"parameters\":{\"sezsggdp\":{\"type\":\"Array\",\"defaultValue\":\"dataudapbq\"}},\"annotations\":[\"datacbrtsrdpl\",\"datadyzaciasfzrgu\",\"dataliyvsbf\"],\"folder\":{\"name\":\"vabd\"},\"\":{\"yaosthulzu\":\"datajgxotudamk\",\"xl\":\"dataifgs\"}}") + .toObject(HiveObjectDataset.class); + Assertions.assertEquals("owqrzvuxn", model.description()); + Assertions.assertEquals("bdxvrivptbczsuzg", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("sezsggdp").type()); + Assertions.assertEquals("vabd", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HiveObjectDataset model = + new HiveObjectDataset() + .withDescription("owqrzvuxn") + .withStructure("datauohshzultdbvm") + .withSchema("datahypngo") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("bdxvrivptbczsuzg") + .withParameters(mapOf("gpycei", "datakekytkzvtvmaatv", "s", "dataharhbdxsbyp"))) + .withParameters( + mapOf( + "sezsggdp", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataudapbq"))) + .withAnnotations(Arrays.asList("datacbrtsrdpl", "datadyzaciasfzrgu", "dataliyvsbf")) + .withFolder(new DatasetFolder().withName("vabd")) + .withTableName("dataqkwqphfv") + .withTable("datatsstwl") + .withSchemaTypePropertiesSchema("datacachdtezgfctu"); + model = BinaryData.fromObject(model).toObject(HiveObjectDataset.class); + Assertions.assertEquals("owqrzvuxn", model.description()); + Assertions.assertEquals("bdxvrivptbczsuzg", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("sezsggdp").type()); + Assertions.assertEquals("vabd", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HiveSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HiveSourceTests.java new file mode 100644 index 000000000000..4a71c1b7afbf --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HiveSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.HiveSource; + +public final class HiveSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HiveSource model = + BinaryData + .fromString( + "{\"type\":\"HiveSource\",\"query\":\"datamabehrfyskzwt\",\"queryTimeout\":\"datazvhz\",\"additionalColumns\":\"datac\",\"sourceRetryCount\":\"datasoxoavlwwpv\",\"sourceRetryWait\":\"datanjwvc\",\"maxConcurrentConnections\":\"datarqlceflgsndur\",\"disableMetricsCollection\":\"dataozjwm\",\"\":{\"wzzzimgbxjgx\":\"dataehjlozzcwokuxedp\",\"dfmdjnfeealp\":\"datahajrubcvucve\"}}") + .toObject(HiveSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HiveSource model = + new HiveSource() + .withSourceRetryCount("datasoxoavlwwpv") + .withSourceRetryWait("datanjwvc") + .withMaxConcurrentConnections("datarqlceflgsndur") + .withDisableMetricsCollection("dataozjwm") + .withQueryTimeout("datazvhz") + .withAdditionalColumns("datac") + .withQuery("datamabehrfyskzwt"); + model = BinaryData.fromObject(model).toObject(HiveSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpDatasetTests.java new file mode 100644 index 000000000000..8cfec6d3a7c1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpDatasetTests.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import com.azure.resourcemanager.datafactory.models.HttpDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HttpDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HttpDataset model = + BinaryData + .fromString( + "{\"type\":\"HttpFile\",\"typeProperties\":{\"relativeUrl\":\"datatfctanetinqxd\",\"requestMethod\":\"datapjnezjighduml\",\"requestBody\":\"datamrzwvwetqffux\",\"additionalHeaders\":\"datahuqhngqq\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"datasot\",\"deserializer\":\"datalmr\",\"\":{\"bboceksram\":\"datajydeatwxpxbxedh\"}},\"compression\":{\"type\":\"datahlugfnlvvk\",\"level\":\"dataurxdqhvhauimn\",\"\":{\"ivlqcwyzhndqkzst\":\"datakqpwqcnbn\",\"u\":\"datapzecdlceirtah\"}}},\"description\":\"imt\",\"structure\":\"dataumviudzpsjqrm\",\"schema\":\"datajmtunlo\",\"linkedServiceName\":{\"referenceName\":\"wuzebfqvm\",\"parameters\":{\"xeudwkhdl\":\"datahzyenfspe\"}},\"parameters\":{\"jcdevzpfreor\":{\"type\":\"Int\",\"defaultValue\":\"datao\"},\"x\":{\"type\":\"String\",\"defaultValue\":\"datayjmgvrlh\"},\"avuafanefic\":{\"type\":\"SecureString\",\"defaultValue\":\"datajnnhbcjywkdywks\"}},\"annotations\":[\"dataplkossjbzvxp\",\"datawdqzuhfgt\"],\"folder\":{\"name\":\"zhfjdccjny\"},\"\":{\"zthcdbszsbz\":\"datatcuhjcgjtjkntomn\"}}") + .toObject(HttpDataset.class); + Assertions.assertEquals("imt", model.description()); + Assertions.assertEquals("wuzebfqvm", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("jcdevzpfreor").type()); + Assertions.assertEquals("zhfjdccjny", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HttpDataset model = + new HttpDataset() + .withDescription("imt") + .withStructure("dataumviudzpsjqrm") + .withSchema("datajmtunlo") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("wuzebfqvm") + .withParameters(mapOf("xeudwkhdl", "datahzyenfspe"))) + .withParameters( + mapOf( + "jcdevzpfreor", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datao"), + "x", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datayjmgvrlh"), + "avuafanefic", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datajnnhbcjywkdywks"))) + .withAnnotations(Arrays.asList("dataplkossjbzvxp", "datawdqzuhfgt")) + .withFolder(new DatasetFolder().withName("zhfjdccjny")) + .withRelativeUrl("datatfctanetinqxd") + .withRequestMethod("datapjnezjighduml") + .withRequestBody("datamrzwvwetqffux") + .withAdditionalHeaders("datahuqhngqq") + .withFormat( + new DatasetStorageFormat() + .withSerializer("datasot") + .withDeserializer("datalmr") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withCompression( + new DatasetCompression() + .withType("datahlugfnlvvk") + .withLevel("dataurxdqhvhauimn") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(HttpDataset.class); + Assertions.assertEquals("imt", model.description()); + Assertions.assertEquals("wuzebfqvm", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("jcdevzpfreor").type()); + Assertions.assertEquals("zhfjdccjny", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..443bfa1068b0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpDatasetTypePropertiesTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.HttpDatasetTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetStorageFormat; +import java.util.HashMap; +import java.util.Map; + +public final class HttpDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HttpDatasetTypeProperties model = + BinaryData + .fromString( + "{\"relativeUrl\":\"dataxeyvidcowlrm\",\"requestMethod\":\"datactqxa\",\"requestBody\":\"datajoezvw\",\"additionalHeaders\":\"datayzgavplnd\",\"format\":{\"type\":\"DatasetStorageFormat\",\"serializer\":\"dataiekkiskyyyaekn\",\"deserializer\":\"datafys\",\"\":{\"hoajjylsyqy\":\"datawjlmlcufbbjiutfo\"}},\"compression\":{\"type\":\"dataufzvlqquy\",\"level\":\"dataceevogir\",\"\":{\"dssijuaxxf\":\"datanqtvuxeuj\"}}}") + .toObject(HttpDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HttpDatasetTypeProperties model = + new HttpDatasetTypeProperties() + .withRelativeUrl("dataxeyvidcowlrm") + .withRequestMethod("datactqxa") + .withRequestBody("datajoezvw") + .withAdditionalHeaders("datayzgavplnd") + .withFormat( + new DatasetStorageFormat() + .withSerializer("dataiekkiskyyyaekn") + .withDeserializer("datafys") + .withAdditionalProperties(mapOf("type", "DatasetStorageFormat"))) + .withCompression( + new DatasetCompression() + .withType("dataufzvlqquy") + .withLevel("dataceevogir") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(HttpDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpReadSettingsTests.java new file mode 100644 index 000000000000..1c82fa6089ad --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpReadSettingsTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.HttpReadSettings; + +public final class HttpReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HttpReadSettings model = + BinaryData + .fromString( + "{\"type\":\"HttpReadSettings\",\"requestMethod\":\"dataa\",\"requestBody\":\"dataveqowqodispa\",\"additionalHeaders\":\"datawiicfsbjhhadndo\",\"requestTimeout\":\"datax\",\"additionalColumns\":\"datawsaxpbieehpvq\",\"maxConcurrentConnections\":\"datafrrjp\",\"disableMetricsCollection\":\"datagjgyovcpgqiism\",\"\":{\"kkcxc\":\"dataktcoykr\"}}") + .toObject(HttpReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HttpReadSettings model = + new HttpReadSettings() + .withMaxConcurrentConnections("datafrrjp") + .withDisableMetricsCollection("datagjgyovcpgqiism") + .withRequestMethod("dataa") + .withRequestBody("dataveqowqodispa") + .withAdditionalHeaders("datawiicfsbjhhadndo") + .withRequestTimeout("datax") + .withAdditionalColumns("datawsaxpbieehpvq"); + model = BinaryData.fromObject(model).toObject(HttpReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpServerLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpServerLocationTests.java new file mode 100644 index 000000000000..fd953fd6b2ba --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpServerLocationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.HttpServerLocation; + +public final class HttpServerLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HttpServerLocation model = + BinaryData + .fromString( + "{\"type\":\"HttpServerLocation\",\"relativeUrl\":\"datauklajvcfoc\",\"folderPath\":\"dataapejovtkwx\",\"fileName\":\"datawhhnoyrzaa\",\"\":{\"envjeateaxxc\":\"datahpm\"}}") + .toObject(HttpServerLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HttpServerLocation model = + new HttpServerLocation() + .withFolderPath("dataapejovtkwx") + .withFileName("datawhhnoyrzaa") + .withRelativeUrl("datauklajvcfoc"); + model = BinaryData.fromObject(model).toObject(HttpServerLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpSourceTests.java new file mode 100644 index 000000000000..ef04f76dae6e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HttpSourceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.HttpSource; + +public final class HttpSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HttpSource model = + BinaryData + .fromString( + "{\"type\":\"HttpSource\",\"httpRequestTimeout\":\"datakiff\",\"sourceRetryCount\":\"datawdyzse\",\"sourceRetryWait\":\"datamvtqhn\",\"maxConcurrentConnections\":\"dataiju\",\"disableMetricsCollection\":\"datarkqywybxgayomse\",\"\":{\"polpsap\":\"dataxlisvqfblsiz\"}}") + .toObject(HttpSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HttpSource model = + new HttpSource() + .withSourceRetryCount("datawdyzse") + .withSourceRetryWait("datamvtqhn") + .withMaxConcurrentConnections("dataiju") + .withDisableMetricsCollection("datarkqywybxgayomse") + .withHttpRequestTimeout("datakiff"); + model = BinaryData.fromObject(model).toObject(HttpSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HubspotObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HubspotObjectDatasetTests.java new file mode 100644 index 000000000000..5918771bbeb8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HubspotObjectDatasetTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.HubspotObjectDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HubspotObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HubspotObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"HubspotObject\",\"typeProperties\":{\"tableName\":\"dataqixpsybq\"},\"description\":\"gvmxwbohxd\",\"structure\":\"dataoexb\",\"schema\":\"datagnaka\",\"linkedServiceName\":{\"referenceName\":\"wscmneev\",\"parameters\":{\"yhmgq\":\"dataqeumz\",\"gbzgfhzdzahktxv\":\"dataeivjqutxr\",\"pxjvtwk\":\"databicfecthotbkjwhz\",\"pqiwuzr\":\"datajdpayx\"}},\"parameters\":{\"qqjobsyn\":{\"type\":\"Float\",\"defaultValue\":\"datafkgb\"},\"q\":{\"type\":\"Object\",\"defaultValue\":\"dataion\"},\"sxjwfudmpfh\":{\"type\":\"Int\",\"defaultValue\":\"datae\"}},\"annotations\":[\"datap\",\"datatjtntc\",\"datagpdbbglaecc\",\"dataokfsp\"],\"folder\":{\"name\":\"ds\"},\"\":{\"prftyptwjwiyyeoh\":\"datar\"}}") + .toObject(HubspotObjectDataset.class); + Assertions.assertEquals("gvmxwbohxd", model.description()); + Assertions.assertEquals("wscmneev", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("qqjobsyn").type()); + Assertions.assertEquals("ds", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HubspotObjectDataset model = + new HubspotObjectDataset() + .withDescription("gvmxwbohxd") + .withStructure("dataoexb") + .withSchema("datagnaka") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("wscmneev") + .withParameters( + mapOf( + "yhmgq", + "dataqeumz", + "gbzgfhzdzahktxv", + "dataeivjqutxr", + "pxjvtwk", + "databicfecthotbkjwhz", + "pqiwuzr", + "datajdpayx"))) + .withParameters( + mapOf( + "qqjobsyn", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datafkgb"), + "q", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("dataion"), + "sxjwfudmpfh", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datae"))) + .withAnnotations(Arrays.asList("datap", "datatjtntc", "datagpdbbglaecc", "dataokfsp")) + .withFolder(new DatasetFolder().withName("ds")) + .withTableName("dataqixpsybq"); + model = BinaryData.fromObject(model).toObject(HubspotObjectDataset.class); + Assertions.assertEquals("gvmxwbohxd", model.description()); + Assertions.assertEquals("wscmneev", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("qqjobsyn").type()); + Assertions.assertEquals("ds", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HubspotSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HubspotSourceTests.java new file mode 100644 index 000000000000..3a1c43ea0a17 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/HubspotSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.HubspotSource; + +public final class HubspotSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HubspotSource model = + BinaryData + .fromString( + "{\"type\":\"HubspotSource\",\"query\":\"dataclkbwkmwdrvkb\",\"queryTimeout\":\"datavnnvk\",\"additionalColumns\":\"datazldzzjj\",\"sourceRetryCount\":\"datahjqengopdvnzn\",\"sourceRetryWait\":\"dataiodaj\",\"maxConcurrentConnections\":\"dataszdyv\",\"disableMetricsCollection\":\"dataiufbw\",\"\":{\"edbhnkl\":\"datawhnzhsmu\"}}") + .toObject(HubspotSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HubspotSource model = + new HubspotSource() + .withSourceRetryCount("datahjqengopdvnzn") + .withSourceRetryWait("dataiodaj") + .withMaxConcurrentConnections("dataszdyv") + .withDisableMetricsCollection("dataiufbw") + .withQueryTimeout("datavnnvk") + .withAdditionalColumns("datazldzzjj") + .withQuery("dataclkbwkmwdrvkb"); + model = BinaryData.fromObject(model).toObject(HubspotSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IfConditionActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IfConditionActivityTests.java new file mode 100644 index 000000000000..6ce88ad1bbdd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IfConditionActivityTests.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.Expression; +import com.azure.resourcemanager.datafactory.models.IfConditionActivity; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IfConditionActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IfConditionActivity model = + BinaryData + .fromString( + "{\"type\":\"IfCondition\",\"typeProperties\":{\"expression\":{\"value\":\"kbgohxbjizf\"},\"ifTrueActivities\":[{\"type\":\"Activity\",\"name\":\"bqdrjunigx\",\"description\":\"nnghgazdbv\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"jqswr\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Skipped\"],\"\":{\"mvrbdtvvtapwkw\":\"datangjepydjdpapn\",\"cdehskmfiudnpj\":\"datathmexid\"}},{\"activity\":\"xfhtsgyyrg\",\"dependencyConditions\":[\"Completed\"],\"\":{\"ytihhq\":\"datagqllgokznffqvtx\"}},{\"activity\":\"ncwgrwgdpfzdygt\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Failed\",\"Completed\"],\"\":{\"slaiu\":\"datamyolvg\",\"wvwzuetqcxoamxu\":\"datancr\",\"uzxsn\":\"datawzduhixomxvb\",\"eozgnwmcizclnqe\":\"dataxipgfkcodou\"}}],\"userProperties\":[{\"name\":\"pwp\",\"value\":\"datadfjsjkondrkncfoq\"}],\"\":{\"ikxs\":\"dataslcvpqwrsfd\"}},{\"type\":\"Activity\",\"name\":\"gaegrppwol\",\"description\":\"flj\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"dwvyjzokvycinm\",\"dependencyConditions\":[\"Failed\",\"Succeeded\",\"Completed\"],\"\":{\"exzxbiwnq\":\"datafoztwmvprnqjx\",\"ryesgalsparbjs\":\"datawqtbztogihpylf\",\"lvnosblc\":\"dataqybvgemkze\"}},{\"activity\":\"ctwac\",\"dependencyConditions\":[\"Failed\"],\"\":{\"fh\":\"datadcvjhykptcijuntm\",\"xxymtcwacavz\":\"dataccqhtlqrfsrfxr\",\"xid\":\"datadybhydlq\",\"ihnsaespzwgpjrix\":\"datast\"}}],\"userProperties\":[{\"name\":\"v\",\"value\":\"datawuttl\"},{\"name\":\"fcnht\",\"value\":\"dataaiypihqmmmbokdqk\"},{\"name\":\"bpfzxnivvuwrv\",\"value\":\"datahlz\"},{\"name\":\"lkgpipwt\",\"value\":\"datatrbfipbddhfk\"}],\"\":{\"awzkefz\":\"dataqqun\",\"yqiytrhhmld\":\"datauyhvaovoqonqjlpc\",\"nmstflk\":\"datatyz\",\"bbcsbcfecmcprggc\":\"datagzo\"}},{\"type\":\"Activity\",\"name\":\"fssbqwvragvxhwbq\",\"description\":\"frrv\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"fblkge\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\",\"Completed\",\"Succeeded\"],\"\":{\"upp\":\"datafcamdffoibxjg\"}}],\"userProperties\":[{\"name\":\"awqxrenjzlqbtef\",\"value\":\"datactpzhoxagayno\"},{\"name\":\"hjvtefevhedfzxs\",\"value\":\"dataypara\"},{\"name\":\"rgsfnjokrfpiqgqv\",\"value\":\"datarlbsglqiuqsqzumx\"},{\"name\":\"x\",\"value\":\"datamuosoziqcuiekuya\"}],\"\":{\"dpfxlkwyqoaejy\":\"datakxtgeejxwbredx\",\"e\":\"dataqgen\",\"oxvbwsa\":\"datapaiat\",\"udp\":\"datazvtinrortjtyls\"}}],\"ifFalseActivities\":[{\"type\":\"Activity\",\"name\":\"nngijnzlokxihf\",\"description\":\"mbljlrf\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"dhrfvbicd\",\"dependencyConditions\":[\"Skipped\",\"Completed\",\"Failed\"],\"\":{\"tqnq\":\"datazxbf\",\"jqfachfmvqnkgst\":\"datalmqeauizk\",\"ujvsc\":\"datae\",\"pwm\":\"datapwpqvg\"}},{\"activity\":\"efhburxnagvcsm\",\"dependencyConditions\":[\"Skipped\",\"Failed\",\"Completed\"],\"\":{\"zlfhn\":\"datatqnqbdxwyo\"}},{\"activity\":\"juuwmcugveiiegoo\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\"],\"\":{\"thohfqbeai\":\"datalbudf\"}}],\"userProperties\":[{\"name\":\"nhxgiydkrgdascm\",\"value\":\"datankabwpdvedmx\"},{\"name\":\"kbgxgykx\",\"value\":\"datazetaonkfbgwfkc\"},{\"name\":\"ldepzrsz\",\"value\":\"dataj\"},{\"name\":\"dcisceiauoy\",\"value\":\"dataudnxaw\"}],\"\":{\"paviu\":\"databmbvccui\",\"o\":\"datajizbjsu\",\"crtmebrssrlxenqp\":\"dataetl\",\"j\":\"datahc\"}},{\"type\":\"Activity\",\"name\":\"qmb\",\"description\":\"ensogdvhqqxggnc\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"xcjqrvpgukscr\",\"dependencyConditions\":[\"Completed\",\"Skipped\",\"Skipped\"],\"\":{\"oaj\":\"datama\",\"s\":\"datagkcac\"}},{\"activity\":\"jgageyxajk\",\"dependencyConditions\":[\"Skipped\",\"Completed\"],\"\":{\"zbeemlsrtgbgcmut\":\"datajqbmgfxwy\",\"lpuuf\":\"datakwd\",\"rxyejjqctq\":\"datahbdmmf\",\"gvpsmxfchnhjsa\":\"databahiiatpdxpox\"}},{\"activity\":\"pwx\",\"dependencyConditions\":[\"Succeeded\",\"Failed\",\"Failed\",\"Failed\"],\"\":{\"lvwtslzblgvezhim\":\"datalqgpskynkkezkv\",\"dzkovt\":\"dataiyqwlxkyoysyutnr\",\"ayupa\":\"datanmcaprxhixmybl\",\"ipxhghicw\":\"datagkrumpunwyfyvhcb\"}},{\"activity\":\"h\",\"dependencyConditions\":[\"Completed\",\"Succeeded\",\"Succeeded\",\"Completed\"],\"\":{\"m\":\"datapyanooytil\",\"wqljmmoquicrz\":\"datas\"}}],\"userProperties\":[{\"name\":\"qacebcnhz\",\"value\":\"datasaumjuruspflv\"},{\"name\":\"lvwkgcpfz\",\"value\":\"dataekbrqg\"},{\"name\":\"vxwq\",\"value\":\"datamvsrbmf\"}],\"\":{\"ob\":\"dataml\"}},{\"type\":\"Activity\",\"name\":\"uoyownygbra\",\"description\":\"whebyczwegtzdpr\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"sqi\",\"dependencyConditions\":[\"Failed\",\"Skipped\"],\"\":{\"dlt\":\"datavturdglecmegol\"}},{\"activity\":\"ryhztwxuizakejo\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Completed\",\"Completed\"],\"\":{\"qlg\":\"datazgnf\",\"we\":\"dataezgbqi\",\"znvyeuxd\":\"dataaceokrarzkza\"}}],\"userProperties\":[{\"name\":\"mt\",\"value\":\"datapukmxgslzbpnl\"},{\"name\":\"zqwmx\",\"value\":\"dataotwzes\"},{\"name\":\"j\",\"value\":\"datacpcpeur\"},{\"name\":\"ofzmvt\",\"value\":\"datayj\"}],\"\":{\"bqhe\":\"datarptlty\",\"wjlbygqfmeeuuurx\":\"datah\",\"ob\":\"dataslxzwvygquiwcfq\",\"mte\":\"datawwdev\"}}]},\"name\":\"hvgg\",\"description\":\"irqkskyyam\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"wcd\",\"dependencyConditions\":[\"Succeeded\"],\"\":{\"lvlfkwdtsbjmc\":\"datarxmlmibvczdjko\",\"n\":\"datasefezjyfaqdwfa\",\"hwlvh\":\"datadetslxe\",\"zil\":\"datalxxgelad\"}},{\"activity\":\"rsycujnsznjsk\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\",\"Succeeded\",\"Succeeded\"],\"\":{\"sonfxsfje\":\"dataxpixuyy\",\"ytedspkduhz\":\"datajnxicufxt\"}}],\"userProperties\":[{\"name\":\"gcfltte\",\"value\":\"dataqpjcuuyttuindp\"}],\"\":{\"bahtlopbns\":\"datajncaqgt\",\"shnoxrmabb\":\"datajzrnjcagagmgulln\",\"guau\":\"datatzcdbqzwutakbva\",\"ccd\":\"datamcwplloj\"}}") + .toObject(IfConditionActivity.class); + Assertions.assertEquals("hvgg", model.name()); + Assertions.assertEquals("irqkskyyam", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("wcd", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("gcfltte", model.userProperties().get(0).name()); + Assertions.assertEquals("kbgohxbjizf", model.expression().value()); + Assertions.assertEquals("bqdrjunigx", model.ifTrueActivities().get(0).name()); + Assertions.assertEquals("nnghgazdbv", model.ifTrueActivities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.ifTrueActivities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.ifTrueActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("jqswr", model.ifTrueActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.ifTrueActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("pwp", model.ifTrueActivities().get(0).userProperties().get(0).name()); + Assertions.assertEquals("nngijnzlokxihf", model.ifFalseActivities().get(0).name()); + Assertions.assertEquals("mbljlrf", model.ifFalseActivities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.ifFalseActivities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.ifFalseActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("dhrfvbicd", model.ifFalseActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SKIPPED, + model.ifFalseActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("nhxgiydkrgdascm", model.ifFalseActivities().get(0).userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IfConditionActivity model = + new IfConditionActivity() + .withName("hvgg") + .withDescription("irqkskyyam") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("wcd") + .withDependencyConditions(Arrays.asList(DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("rsycujnsznjsk") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("gcfltte").withValue("dataqpjcuuyttuindp"))) + .withExpression(new Expression().withValue("kbgohxbjizf")) + .withIfTrueActivities( + Arrays + .asList( + new Activity() + .withName("bqdrjunigx") + .withDescription("nnghgazdbv") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("jqswr") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("xfhtsgyyrg") + .withDependencyConditions(Arrays.asList(DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ncwgrwgdpfzdygt") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("pwp").withValue("datadfjsjkondrkncfoq"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("gaegrppwol") + .withDescription("flj") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("dwvyjzokvycinm") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ctwac") + .withDependencyConditions(Arrays.asList(DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("v").withValue("datawuttl"), + new UserProperty().withName("fcnht").withValue("dataaiypihqmmmbokdqk"), + new UserProperty().withName("bpfzxnivvuwrv").withValue("datahlz"), + new UserProperty().withName("lkgpipwt").withValue("datatrbfipbddhfk"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("fssbqwvragvxhwbq") + .withDescription("frrv") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("fblkge") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("awqxrenjzlqbtef") + .withValue("datactpzhoxagayno"), + new UserProperty().withName("hjvtefevhedfzxs").withValue("dataypara"), + new UserProperty() + .withName("rgsfnjokrfpiqgqv") + .withValue("datarlbsglqiuqsqzumx"), + new UserProperty().withName("x").withValue("datamuosoziqcuiekuya"))) + .withAdditionalProperties(mapOf("type", "Activity")))) + .withIfFalseActivities( + Arrays + .asList( + new Activity() + .withName("nngijnzlokxihf") + .withDescription("mbljlrf") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("dhrfvbicd") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("efhburxnagvcsm") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("juuwmcugveiiegoo") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("nhxgiydkrgdascm") + .withValue("datankabwpdvedmx"), + new UserProperty().withName("kbgxgykx").withValue("datazetaonkfbgwfkc"), + new UserProperty().withName("ldepzrsz").withValue("dataj"), + new UserProperty().withName("dcisceiauoy").withValue("dataudnxaw"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("qmb") + .withDescription("ensogdvhqqxggnc") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("xcjqrvpgukscr") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("jgageyxajk") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("pwx") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED, + DependencyCondition.FAILED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("h") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("qacebcnhz").withValue("datasaumjuruspflv"), + new UserProperty().withName("lvwkgcpfz").withValue("dataekbrqg"), + new UserProperty().withName("vxwq").withValue("datamvsrbmf"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("uoyownygbra") + .withDescription("whebyczwegtzdpr") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("sqi") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ryhztwxuizakejo") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("mt").withValue("datapukmxgslzbpnl"), + new UserProperty().withName("zqwmx").withValue("dataotwzes"), + new UserProperty().withName("j").withValue("datacpcpeur"), + new UserProperty().withName("ofzmvt").withValue("datayj"))) + .withAdditionalProperties(mapOf("type", "Activity")))); + model = BinaryData.fromObject(model).toObject(IfConditionActivity.class); + Assertions.assertEquals("hvgg", model.name()); + Assertions.assertEquals("irqkskyyam", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("wcd", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("gcfltte", model.userProperties().get(0).name()); + Assertions.assertEquals("kbgohxbjizf", model.expression().value()); + Assertions.assertEquals("bqdrjunigx", model.ifTrueActivities().get(0).name()); + Assertions.assertEquals("nnghgazdbv", model.ifTrueActivities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.ifTrueActivities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.ifTrueActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("jqswr", model.ifTrueActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.ifTrueActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("pwp", model.ifTrueActivities().get(0).userProperties().get(0).name()); + Assertions.assertEquals("nngijnzlokxihf", model.ifFalseActivities().get(0).name()); + Assertions.assertEquals("mbljlrf", model.ifFalseActivities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.ifFalseActivities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.ifFalseActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("dhrfvbicd", model.ifFalseActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SKIPPED, + model.ifFalseActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("nhxgiydkrgdascm", model.ifFalseActivities().get(0).userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IfConditionActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IfConditionActivityTypePropertiesTests.java new file mode 100644 index 000000000000..4a2b4b14d285 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IfConditionActivityTypePropertiesTests.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.IfConditionActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.Expression; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IfConditionActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IfConditionActivityTypeProperties model = + BinaryData + .fromString( + "{\"expression\":{\"value\":\"ewtddigmmjve\"},\"ifTrueActivities\":[{\"type\":\"Activity\",\"name\":\"crbkwcnvgx\",\"description\":\"ih\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"wcbvhqjpia\",\"dependencyConditions\":[\"Completed\",\"Completed\"],\"\":{\"q\":\"datamzntroafz\"}},{\"activity\":\"ogfo\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Failed\",\"Skipped\"],\"\":{\"oaxszuhuoj\":\"datak\"}},{\"activity\":\"b\",\"dependencyConditions\":[\"Completed\",\"Skipped\",\"Succeeded\",\"Failed\"],\"\":{\"betemam\":\"datahecq\",\"umxyqhctr\":\"datashnksupchzspgby\"}}],\"userProperties\":[{\"name\":\"hgchtaeac\",\"value\":\"dataqk\"},{\"name\":\"rzukajkihnlqf\",\"value\":\"dataawynslcfx\"}],\"\":{\"htfugppiudhylxq\":\"dataaviiriedf\"}},{\"type\":\"Activity\",\"name\":\"sumqdri\",\"description\":\"xzcrf\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"exmgcqlufo\",\"dependencyConditions\":[\"Completed\"],\"\":{\"snaklobc\":\"datakqhgfwyzv\",\"mltdgxiqrgr\":\"datay\"}},{\"activity\":\"xjfxu\",\"dependencyConditions\":[\"Succeeded\",\"Failed\",\"Succeeded\"],\"\":{\"buglalaazncnhzqn\":\"dataytgnycnklqipnzgn\",\"galodfsbhphwt\":\"dataxkscyykrzrjjernj\",\"ajh\":\"datagy\"}}],\"userProperties\":[{\"name\":\"arldsijcm\",\"value\":\"dataugpxgxjmwzkafuvb\"},{\"name\":\"cyarsbhjlcxvsmr\",\"value\":\"dataypbi\"}],\"\":{\"b\":\"dataznaixjsfasxfamn\",\"wco\":\"dataxbglqybfnxej\",\"cnuozjg\":\"datajmpsxot\",\"gnrrqvrxouoqte\":\"datacxbenwi\"}}],\"ifFalseActivities\":[{\"type\":\"Activity\",\"name\":\"aqeskmvrcy\",\"description\":\"aa\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"egsswijq\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Completed\"],\"\":{\"cu\":\"datatczxwqmundlegd\",\"utbtr\":\"datadrmqkw\",\"ppj\":\"datarygdpjufmvozqmtc\",\"qrvtwvyjprr\":\"datagctsatnrywouewrw\"}}],\"userProperties\":[{\"name\":\"qpmzznmnscs\",\"value\":\"dataadvbwewwdfeie\"},{\"name\":\"wmaxlppagkm\",\"value\":\"databeneqapll\"},{\"name\":\"dowsj\",\"value\":\"datavpvtyullivcymnpb\"}],\"\":{\"hcatp\":\"datal\",\"qnajmwpeaoeggi\":\"dataq\",\"ugru\":\"datalpglhlwu\"}},{\"type\":\"Activity\",\"name\":\"oprnbozvi\",\"description\":\"mhitqrpbwykee\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"pkodbquvftka\",\"dependencyConditions\":[\"Skipped\",\"Succeeded\"],\"\":{\"kzgwf\":\"dataogwfqtqbnakmgydf\",\"kankjkszudx\":\"datageqzkpergzscr\"}}],\"userProperties\":[{\"name\":\"vxvoqbruyma\",\"value\":\"dataj\"}],\"\":{\"vydjaxzstuhlwz\":\"datafxirjf\",\"ugbymnyfh\":\"datanf\",\"rpsl\":\"dataxcplhqzpwqpu\",\"cnfgtup\":\"datae\"}}]}") + .toObject(IfConditionActivityTypeProperties.class); + Assertions.assertEquals("ewtddigmmjve", model.expression().value()); + Assertions.assertEquals("crbkwcnvgx", model.ifTrueActivities().get(0).name()); + Assertions.assertEquals("ih", model.ifTrueActivities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.ifTrueActivities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.ifTrueActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("wcbvhqjpia", model.ifTrueActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.ifTrueActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("hgchtaeac", model.ifTrueActivities().get(0).userProperties().get(0).name()); + Assertions.assertEquals("aqeskmvrcy", model.ifFalseActivities().get(0).name()); + Assertions.assertEquals("aa", model.ifFalseActivities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.ifFalseActivities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.ifFalseActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("egsswijq", model.ifFalseActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.ifFalseActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("qpmzznmnscs", model.ifFalseActivities().get(0).userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IfConditionActivityTypeProperties model = + new IfConditionActivityTypeProperties() + .withExpression(new Expression().withValue("ewtddigmmjve")) + .withIfTrueActivities( + Arrays + .asList( + new Activity() + .withName("crbkwcnvgx") + .withDescription("ih") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("wcbvhqjpia") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ogfo") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("b") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("hgchtaeac").withValue("dataqk"), + new UserProperty().withName("rzukajkihnlqf").withValue("dataawynslcfx"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("sumqdri") + .withDescription("xzcrf") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("exmgcqlufo") + .withDependencyConditions(Arrays.asList(DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("xjfxu") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("arldsijcm").withValue("dataugpxgxjmwzkafuvb"), + new UserProperty().withName("cyarsbhjlcxvsmr").withValue("dataypbi"))) + .withAdditionalProperties(mapOf("type", "Activity")))) + .withIfFalseActivities( + Arrays + .asList( + new Activity() + .withName("aqeskmvrcy") + .withDescription("aa") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("egsswijq") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("qpmzznmnscs").withValue("dataadvbwewwdfeie"), + new UserProperty().withName("wmaxlppagkm").withValue("databeneqapll"), + new UserProperty().withName("dowsj").withValue("datavpvtyullivcymnpb"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("oprnbozvi") + .withDescription("mhitqrpbwykee") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("pkodbquvftka") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("vxvoqbruyma").withValue("dataj"))) + .withAdditionalProperties(mapOf("type", "Activity")))); + model = BinaryData.fromObject(model).toObject(IfConditionActivityTypeProperties.class); + Assertions.assertEquals("ewtddigmmjve", model.expression().value()); + Assertions.assertEquals("crbkwcnvgx", model.ifTrueActivities().get(0).name()); + Assertions.assertEquals("ih", model.ifTrueActivities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.ifTrueActivities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.ifTrueActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("wcbvhqjpia", model.ifTrueActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.ifTrueActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("hgchtaeac", model.ifTrueActivities().get(0).userProperties().get(0).name()); + Assertions.assertEquals("aqeskmvrcy", model.ifFalseActivities().get(0).name()); + Assertions.assertEquals("aa", model.ifFalseActivities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.ifFalseActivities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.ifFalseActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("egsswijq", model.ifFalseActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.ifFalseActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("qpmzznmnscs", model.ifFalseActivities().get(0).userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImpalaDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImpalaDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..51779b686b62 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImpalaDatasetTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ImpalaDatasetTypeProperties; + +public final class ImpalaDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImpalaDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"datauklx\",\"table\":\"datalmzpyq\",\"schema\":\"datahuecxhgs\"}") + .toObject(ImpalaDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ImpalaDatasetTypeProperties model = + new ImpalaDatasetTypeProperties() + .withTableName("datauklx") + .withTable("datalmzpyq") + .withSchema("datahuecxhgs"); + model = BinaryData.fromObject(model).toObject(ImpalaDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImpalaObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImpalaObjectDatasetTests.java new file mode 100644 index 000000000000..ecf44e65d70c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImpalaObjectDatasetTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.ImpalaObjectDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ImpalaObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImpalaObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"ImpalaObject\",\"typeProperties\":{\"tableName\":\"datamdjmvph\",\"table\":\"datanugslvfzzioxbg\",\"schema\":\"datavueprpmofxnwcgz\"},\"description\":\"xixtxxxajsehbknn\",\"structure\":\"datakyjfawpcbsog\",\"schema\":\"datahczbnivco\",\"linkedServiceName\":{\"referenceName\":\"sxvppkjealkdb\",\"parameters\":{\"qdkt\":\"dataotvbmyzuqf\",\"jndkvzmx\":\"datajtoqszhhqn\",\"nkqyipgkm\":\"dataffqgdo\",\"ftgdrfzjlflza\":\"datatdazmdzesim\"}},\"parameters\":{\"orzbidaebeznicew\":{\"type\":\"Object\",\"defaultValue\":\"dataabxief\"},\"wwsr\":{\"type\":\"Array\",\"defaultValue\":\"datajwiylciobb\"}},\"annotations\":[\"dataxuecuuue\"],\"folder\":{\"name\":\"nteevfgaxfez\"},\"\":{\"kyrxgmzzeglwd\":\"datasddkodkgxq\",\"kkraj\":\"datafsspfegaoksd\"}}") + .toObject(ImpalaObjectDataset.class); + Assertions.assertEquals("xixtxxxajsehbknn", model.description()); + Assertions.assertEquals("sxvppkjealkdb", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("orzbidaebeznicew").type()); + Assertions.assertEquals("nteevfgaxfez", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ImpalaObjectDataset model = + new ImpalaObjectDataset() + .withDescription("xixtxxxajsehbknn") + .withStructure("datakyjfawpcbsog") + .withSchema("datahczbnivco") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("sxvppkjealkdb") + .withParameters( + mapOf( + "qdkt", + "dataotvbmyzuqf", + "jndkvzmx", + "datajtoqszhhqn", + "nkqyipgkm", + "dataffqgdo", + "ftgdrfzjlflza", + "datatdazmdzesim"))) + .withParameters( + mapOf( + "orzbidaebeznicew", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("dataabxief"), + "wwsr", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datajwiylciobb"))) + .withAnnotations(Arrays.asList("dataxuecuuue")) + .withFolder(new DatasetFolder().withName("nteevfgaxfez")) + .withTableName("datamdjmvph") + .withTable("datanugslvfzzioxbg") + .withSchemaTypePropertiesSchema("datavueprpmofxnwcgz"); + model = BinaryData.fromObject(model).toObject(ImpalaObjectDataset.class); + Assertions.assertEquals("xixtxxxajsehbknn", model.description()); + Assertions.assertEquals("sxvppkjealkdb", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("orzbidaebeznicew").type()); + Assertions.assertEquals("nteevfgaxfez", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImpalaSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImpalaSourceTests.java new file mode 100644 index 000000000000..920b71d6417b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImpalaSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ImpalaSource; + +public final class ImpalaSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImpalaSource model = + BinaryData + .fromString( + "{\"type\":\"ImpalaSource\",\"query\":\"datavzd\",\"queryTimeout\":\"datakqajia\",\"additionalColumns\":\"datacyrdtrd\",\"sourceRetryCount\":\"datadmsktuvjh\",\"sourceRetryWait\":\"datatvyt\",\"maxConcurrentConnections\":\"datafbsgrzw\",\"disableMetricsCollection\":\"datadudxqebtrpsplwt\",\"\":{\"ckrnku\":\"dataseybvtgcoznnjq\",\"tuynugptfjpi\":\"dataotlymybmgmrkxk\",\"tqqshb\":\"datavfh\",\"zjsezgphip\":\"datapzhuhuj\"}}") + .toObject(ImpalaSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ImpalaSource model = + new ImpalaSource() + .withSourceRetryCount("datadmsktuvjh") + .withSourceRetryWait("datatvyt") + .withMaxConcurrentConnections("datafbsgrzw") + .withDisableMetricsCollection("datadudxqebtrpsplwt") + .withQueryTimeout("datakqajia") + .withAdditionalColumns("datacyrdtrd") + .withQuery("datavzd"); + model = BinaryData.fromObject(model).toObject(ImpalaSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImportSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImportSettingsTests.java new file mode 100644 index 000000000000..e21ba54e706e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ImportSettingsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ImportSettings; +import java.util.HashMap; +import java.util.Map; + +public final class ImportSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImportSettings model = + BinaryData + .fromString("{\"type\":\"ImportSettings\",\"\":{\"hfwce\":\"datajcbdpczmzuwrc\"}}") + .toObject(ImportSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ImportSettings model = new ImportSettings().withAdditionalProperties(mapOf("type", "ImportSettings")); + model = BinaryData.fromObject(model).toObject(ImportSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixSinkTests.java new file mode 100644 index 000000000000..1ea56f028314 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.InformixSink; + +public final class InformixSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InformixSink model = + BinaryData + .fromString( + "{\"type\":\"InformixSink\",\"preCopyScript\":\"dataoiumuxna\",\"writeBatchSize\":\"datavgmckxh\",\"writeBatchTimeout\":\"datazsmpoiu\",\"sinkRetryCount\":\"dataatv\",\"sinkRetryWait\":\"dataiojncgjogmvoyk\",\"maxConcurrentConnections\":\"datamg\",\"disableMetricsCollection\":\"dataeas\",\"\":{\"h\":\"datap\",\"f\":\"dataxwdo\"}}") + .toObject(InformixSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InformixSink model = + new InformixSink() + .withWriteBatchSize("datavgmckxh") + .withWriteBatchTimeout("datazsmpoiu") + .withSinkRetryCount("dataatv") + .withSinkRetryWait("dataiojncgjogmvoyk") + .withMaxConcurrentConnections("datamg") + .withDisableMetricsCollection("dataeas") + .withPreCopyScript("dataoiumuxna"); + model = BinaryData.fromObject(model).toObject(InformixSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixSourceTests.java new file mode 100644 index 000000000000..2221064edd37 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.InformixSource; + +public final class InformixSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InformixSource model = + BinaryData + .fromString( + "{\"type\":\"InformixSource\",\"query\":\"datalzk\",\"queryTimeout\":\"datajtapvqjebtdp\",\"additionalColumns\":\"datakeexso\",\"sourceRetryCount\":\"datakvy\",\"sourceRetryWait\":\"datatytwtfqpmpyww\",\"maxConcurrentConnections\":\"dataukqmjcwdo\",\"disableMetricsCollection\":\"datadqun\",\"\":{\"rbn\":\"datacocchdxjrrb\",\"p\":\"dataqpsquou\"}}") + .toObject(InformixSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InformixSource model = + new InformixSource() + .withSourceRetryCount("datakvy") + .withSourceRetryWait("datatytwtfqpmpyww") + .withMaxConcurrentConnections("dataukqmjcwdo") + .withDisableMetricsCollection("datadqun") + .withQueryTimeout("datajtapvqjebtdp") + .withAdditionalColumns("datakeexso") + .withQuery("datalzk"); + model = BinaryData.fromObject(model).toObject(InformixSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixTableDatasetTests.java new file mode 100644 index 000000000000..616194272a6d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixTableDatasetTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.InformixTableDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class InformixTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InformixTableDataset model = + BinaryData + .fromString( + "{\"type\":\"InformixTable\",\"typeProperties\":{\"tableName\":\"dataspth\"},\"description\":\"fmwtblgm\",\"structure\":\"datakqoikxiefwln\",\"schema\":\"datakffcnuestbsl\",\"linkedServiceName\":{\"referenceName\":\"e\",\"parameters\":{\"ikjiytehhxt\":\"dataccote\",\"n\":\"dataxqdwbymuq\"}},\"parameters\":{\"pek\":{\"type\":\"Bool\",\"defaultValue\":\"dataorctyse\"},\"tzcvimmwckoz\":{\"type\":\"Float\",\"defaultValue\":\"databyh\"},\"xup\":{\"type\":\"String\",\"defaultValue\":\"dataymtrts\"},\"rfrjschjxncqzahg\":{\"type\":\"String\",\"defaultValue\":\"datackjbcbkg\"}},\"annotations\":[\"datagdobimor\"],\"folder\":{\"name\":\"xosgihtrxue\"},\"\":{\"znjqswshe\":\"dataxqfg\"}}") + .toObject(InformixTableDataset.class); + Assertions.assertEquals("fmwtblgm", model.description()); + Assertions.assertEquals("e", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("pek").type()); + Assertions.assertEquals("xosgihtrxue", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InformixTableDataset model = + new InformixTableDataset() + .withDescription("fmwtblgm") + .withStructure("datakqoikxiefwln") + .withSchema("datakffcnuestbsl") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("e") + .withParameters(mapOf("ikjiytehhxt", "dataccote", "n", "dataxqdwbymuq"))) + .withParameters( + mapOf( + "pek", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataorctyse"), + "tzcvimmwckoz", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("databyh"), + "xup", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataymtrts"), + "rfrjschjxncqzahg", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datackjbcbkg"))) + .withAnnotations(Arrays.asList("datagdobimor")) + .withFolder(new DatasetFolder().withName("xosgihtrxue")) + .withTableName("dataspth"); + model = BinaryData.fromObject(model).toObject(InformixTableDataset.class); + Assertions.assertEquals("fmwtblgm", model.description()); + Assertions.assertEquals("e", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("pek").type()); + Assertions.assertEquals("xosgihtrxue", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..b1f81e5dcc77 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/InformixTableDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.InformixTableDatasetTypeProperties; + +public final class InformixTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InformixTableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"datacsqosecxlngo\"}") + .toObject(InformixTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InformixTableDatasetTypeProperties model = + new InformixTableDatasetTypeProperties().withTableName("datacsqosecxlngo"); + model = BinaryData.fromObject(model).toObject(InformixTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeComputePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeComputePropertiesTests.java new file mode 100644 index 000000000000..ad73e39aec63 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeComputePropertiesTests.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CopyComputeScaleProperties; +import com.azure.resourcemanager.datafactory.models.DataFlowComputeType; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeComputeProperties; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeDataFlowProperties; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeVNetProperties; +import com.azure.resourcemanager.datafactory.models.PipelineExternalComputeScaleProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeComputePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeComputeProperties model = + BinaryData + .fromString( + "{\"location\":\"xipe\",\"nodeSize\":\"plfmfvmjjfzi\",\"numberOfNodes\":1133899046,\"maxParallelExecutionsPerNode\":852753567,\"dataFlowProperties\":{\"computeType\":\"ComputeOptimized\",\"coreCount\":792243326,\"timeToLive\":20315238,\"cleanup\":true,\"customProperties\":[{\"name\":\"symagbahdbtjmku\",\"value\":\"nrk\"},{\"name\":\"izrxhuqfvpanlo\",\"value\":\"vvcxgqtquirgopgz\"},{\"name\":\"ucujtjuzvyjxuxch\",\"value\":\"oqhqrc\"},{\"name\":\"sxqfhlrvu\",\"value\":\"agvyjcdpncvfyeqy\"}],\"\":{\"ivnmev\":\"dataijcsapqhipajs\"}},\"vNetProperties\":{\"vNetId\":\"cuwrfgpjfv\",\"subnet\":\"kseodvlmdzgvc\",\"publicIPs\":[\"z\",\"gctygbbmu\",\"ljvvcrsmw\",\"jmxwcvumnrutqnke\"],\"subnetId\":\"f\",\"\":{\"opecvpkb\":\"datat\",\"zadzglmuu\":\"dataltnowpajfhxsmub\"}},\"copyComputeScaleProperties\":{\"dataIntegrationUnit\":1559370317,\"timeToLive\":1848363675,\"\":{\"xkbyws\":\"dataxmuldhfrerkqpyf\"}},\"pipelineExternalComputeScaleProperties\":{\"timeToLive\":2130928365,\"numberOfPipelineNodes\":1017885673,\"numberOfExternalNodes\":979697242,\"\":{\"xsggnowxhyvdb\":\"datam\"}},\"\":{\"iikhrct\":\"datasvghbtycvlkus\"}}") + .toObject(IntegrationRuntimeComputeProperties.class); + Assertions.assertEquals("xipe", model.location()); + Assertions.assertEquals("plfmfvmjjfzi", model.nodeSize()); + Assertions.assertEquals(1133899046, model.numberOfNodes()); + Assertions.assertEquals(852753567, model.maxParallelExecutionsPerNode()); + Assertions.assertEquals(DataFlowComputeType.COMPUTE_OPTIMIZED, model.dataFlowProperties().computeType()); + Assertions.assertEquals(792243326, model.dataFlowProperties().coreCount()); + Assertions.assertEquals(20315238, model.dataFlowProperties().timeToLive()); + Assertions.assertEquals(true, model.dataFlowProperties().cleanup()); + Assertions.assertEquals("symagbahdbtjmku", model.dataFlowProperties().customProperties().get(0).name()); + Assertions.assertEquals("nrk", model.dataFlowProperties().customProperties().get(0).value()); + Assertions.assertEquals("cuwrfgpjfv", model.vNetProperties().vNetId()); + Assertions.assertEquals("kseodvlmdzgvc", model.vNetProperties().subnet()); + Assertions.assertEquals("z", model.vNetProperties().publicIPs().get(0)); + Assertions.assertEquals("f", model.vNetProperties().subnetId()); + Assertions.assertEquals(1559370317, model.copyComputeScaleProperties().dataIntegrationUnit()); + Assertions.assertEquals(1848363675, model.copyComputeScaleProperties().timeToLive()); + Assertions.assertEquals(2130928365, model.pipelineExternalComputeScaleProperties().timeToLive()); + Assertions.assertEquals(1017885673, model.pipelineExternalComputeScaleProperties().numberOfPipelineNodes()); + Assertions.assertEquals(979697242, model.pipelineExternalComputeScaleProperties().numberOfExternalNodes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeComputeProperties model = + new IntegrationRuntimeComputeProperties() + .withLocation("xipe") + .withNodeSize("plfmfvmjjfzi") + .withNumberOfNodes(1133899046) + .withMaxParallelExecutionsPerNode(852753567) + .withDataFlowProperties( + new IntegrationRuntimeDataFlowProperties() + .withComputeType(DataFlowComputeType.COMPUTE_OPTIMIZED) + .withCoreCount(792243326) + .withTimeToLive(20315238) + .withCleanup(true) + .withCustomProperties( + Arrays + .asList( + new IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem() + .withName("symagbahdbtjmku") + .withValue("nrk"), + new IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem() + .withName("izrxhuqfvpanlo") + .withValue("vvcxgqtquirgopgz"), + new IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem() + .withName("ucujtjuzvyjxuxch") + .withValue("oqhqrc"), + new IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem() + .withName("sxqfhlrvu") + .withValue("agvyjcdpncvfyeqy"))) + .withAdditionalProperties(mapOf())) + .withVNetProperties( + new IntegrationRuntimeVNetProperties() + .withVNetId("cuwrfgpjfv") + .withSubnet("kseodvlmdzgvc") + .withPublicIPs(Arrays.asList("z", "gctygbbmu", "ljvvcrsmw", "jmxwcvumnrutqnke")) + .withSubnetId("f") + .withAdditionalProperties(mapOf())) + .withCopyComputeScaleProperties( + new CopyComputeScaleProperties() + .withDataIntegrationUnit(1559370317) + .withTimeToLive(1848363675) + .withAdditionalProperties(mapOf())) + .withPipelineExternalComputeScaleProperties( + new PipelineExternalComputeScaleProperties() + .withTimeToLive(2130928365) + .withNumberOfPipelineNodes(1017885673) + .withNumberOfExternalNodes(979697242) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeComputeProperties.class); + Assertions.assertEquals("xipe", model.location()); + Assertions.assertEquals("plfmfvmjjfzi", model.nodeSize()); + Assertions.assertEquals(1133899046, model.numberOfNodes()); + Assertions.assertEquals(852753567, model.maxParallelExecutionsPerNode()); + Assertions.assertEquals(DataFlowComputeType.COMPUTE_OPTIMIZED, model.dataFlowProperties().computeType()); + Assertions.assertEquals(792243326, model.dataFlowProperties().coreCount()); + Assertions.assertEquals(20315238, model.dataFlowProperties().timeToLive()); + Assertions.assertEquals(true, model.dataFlowProperties().cleanup()); + Assertions.assertEquals("symagbahdbtjmku", model.dataFlowProperties().customProperties().get(0).name()); + Assertions.assertEquals("nrk", model.dataFlowProperties().customProperties().get(0).value()); + Assertions.assertEquals("cuwrfgpjfv", model.vNetProperties().vNetId()); + Assertions.assertEquals("kseodvlmdzgvc", model.vNetProperties().subnet()); + Assertions.assertEquals("z", model.vNetProperties().publicIPs().get(0)); + Assertions.assertEquals("f", model.vNetProperties().subnetId()); + Assertions.assertEquals(1559370317, model.copyComputeScaleProperties().dataIntegrationUnit()); + Assertions.assertEquals(1848363675, model.copyComputeScaleProperties().timeToLive()); + Assertions.assertEquals(2130928365, model.pipelineExternalComputeScaleProperties().timeToLive()); + Assertions.assertEquals(1017885673, model.pipelineExternalComputeScaleProperties().numberOfPipelineNodes()); + Assertions.assertEquals(979697242, model.pipelineExternalComputeScaleProperties().numberOfExternalNodes()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeCustomerVirtualNetworkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeCustomerVirtualNetworkTests.java new file mode 100644 index 000000000000..55fdacab8e37 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeCustomerVirtualNetworkTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeCustomerVirtualNetwork; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeCustomerVirtualNetworkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeCustomerVirtualNetwork model = + BinaryData + .fromString("{\"subnetId\":\"vjmfjjf\"}") + .toObject(IntegrationRuntimeCustomerVirtualNetwork.class); + Assertions.assertEquals("vjmfjjf", model.subnetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeCustomerVirtualNetwork model = + new IntegrationRuntimeCustomerVirtualNetwork().withSubnetId("vjmfjjf"); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeCustomerVirtualNetwork.class); + Assertions.assertEquals("vjmfjjf", model.subnetId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDataFlowPropertiesCustomPropertiesItemTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDataFlowPropertiesCustomPropertiesItemTests.java new file mode 100644 index 000000000000..198d934397e6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDataFlowPropertiesCustomPropertiesItemTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeDataFlowPropertiesCustomPropertiesItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem model = + BinaryData + .fromString("{\"name\":\"kjd\",\"value\":\"odo\"}") + .toObject(IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem.class); + Assertions.assertEquals("kjd", model.name()); + Assertions.assertEquals("odo", model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem model = + new IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem().withName("kjd").withValue("odo"); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem.class); + Assertions.assertEquals("kjd", model.name()); + Assertions.assertEquals("odo", model.value()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDataFlowPropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDataFlowPropertiesTests.java new file mode 100644 index 000000000000..31b90a8bbe23 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDataFlowPropertiesTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowComputeType; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeDataFlowProperties; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeDataFlowPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeDataFlowProperties model = + BinaryData + .fromString( + "{\"computeType\":\"MemoryOptimized\",\"coreCount\":1804017472,\"timeToLive\":672092871,\"cleanup\":true,\"customProperties\":[{\"name\":\"scsd\",\"value\":\"ymktcwmiv\"}],\"\":{\"dcozwxux\":\"datazegnglafnfgazagh\",\"utuhvemg\":\"datar\",\"xlx\":\"datalssolqypv\",\"vgdojcvzfcmxmjp\":\"datahvrkqv\"}}") + .toObject(IntegrationRuntimeDataFlowProperties.class); + Assertions.assertEquals(DataFlowComputeType.MEMORY_OPTIMIZED, model.computeType()); + Assertions.assertEquals(1804017472, model.coreCount()); + Assertions.assertEquals(672092871, model.timeToLive()); + Assertions.assertEquals(true, model.cleanup()); + Assertions.assertEquals("scsd", model.customProperties().get(0).name()); + Assertions.assertEquals("ymktcwmiv", model.customProperties().get(0).value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeDataFlowProperties model = + new IntegrationRuntimeDataFlowProperties() + .withComputeType(DataFlowComputeType.MEMORY_OPTIMIZED) + .withCoreCount(1804017472) + .withTimeToLive(672092871) + .withCleanup(true) + .withCustomProperties( + Arrays + .asList( + new IntegrationRuntimeDataFlowPropertiesCustomPropertiesItem() + .withName("scsd") + .withValue("ymktcwmiv"))) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeDataFlowProperties.class); + Assertions.assertEquals(DataFlowComputeType.MEMORY_OPTIMIZED, model.computeType()); + Assertions.assertEquals(1804017472, model.coreCount()); + Assertions.assertEquals(672092871, model.timeToLive()); + Assertions.assertEquals(true, model.cleanup()); + Assertions.assertEquals("scsd", model.customProperties().get(0).name()); + Assertions.assertEquals("ymktcwmiv", model.customProperties().get(0).value()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDataProxyPropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDataProxyPropertiesTests.java new file mode 100644 index 000000000000..28c17abcf600 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDataProxyPropertiesTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.EntityReference; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeDataProxyProperties; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeEntityReferenceType; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeDataProxyPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeDataProxyProperties model = + BinaryData + .fromString( + "{\"connectVia\":{\"type\":\"LinkedServiceReference\",\"referenceName\":\"ihzqieo\"},\"stagingLinkedService\":{\"type\":\"LinkedServiceReference\",\"referenceName\":\"lxjs\"},\"path\":\"b\"}") + .toObject(IntegrationRuntimeDataProxyProperties.class); + Assertions + .assertEquals(IntegrationRuntimeEntityReferenceType.LINKED_SERVICE_REFERENCE, model.connectVia().type()); + Assertions.assertEquals("ihzqieo", model.connectVia().referenceName()); + Assertions + .assertEquals( + IntegrationRuntimeEntityReferenceType.LINKED_SERVICE_REFERENCE, model.stagingLinkedService().type()); + Assertions.assertEquals("lxjs", model.stagingLinkedService().referenceName()); + Assertions.assertEquals("b", model.path()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeDataProxyProperties model = + new IntegrationRuntimeDataProxyProperties() + .withConnectVia( + new EntityReference() + .withType(IntegrationRuntimeEntityReferenceType.LINKED_SERVICE_REFERENCE) + .withReferenceName("ihzqieo")) + .withStagingLinkedService( + new EntityReference() + .withType(IntegrationRuntimeEntityReferenceType.LINKED_SERVICE_REFERENCE) + .withReferenceName("lxjs")) + .withPath("b"); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeDataProxyProperties.class); + Assertions + .assertEquals(IntegrationRuntimeEntityReferenceType.LINKED_SERVICE_REFERENCE, model.connectVia().type()); + Assertions.assertEquals("ihzqieo", model.connectVia().referenceName()); + Assertions + .assertEquals( + IntegrationRuntimeEntityReferenceType.LINKED_SERVICE_REFERENCE, model.stagingLinkedService().type()); + Assertions.assertEquals("lxjs", model.stagingLinkedService().referenceName()); + Assertions.assertEquals("b", model.path()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDebugResourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDebugResourceTests.java new file mode 100644 index 000000000000..d688e91ac16d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeDebugResourceTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntime; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeDebugResource; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeDebugResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeDebugResource model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"xbzlmc\",\"\":{\"onqzinkfkbgbzbow\":\"datapcvhdbevwqqxeys\",\"qkjjeokbz\":\"dataeqocljmygvk\"}},\"name\":\"ezrxcczurtleipqx\"}") + .toObject(IntegrationRuntimeDebugResource.class); + Assertions.assertEquals("ezrxcczurtleipqx", model.name()); + Assertions.assertEquals("xbzlmc", model.properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeDebugResource model = + new IntegrationRuntimeDebugResource() + .withName("ezrxcczurtleipqx") + .withProperties( + new IntegrationRuntime() + .withDescription("xbzlmc") + .withAdditionalProperties(mapOf("type", "IntegrationRuntime"))); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeDebugResource.class); + Assertions.assertEquals("ezrxcczurtleipqx", model.name()); + Assertions.assertEquals("xbzlmc", model.properties().description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeListResponseTests.java new file mode 100644 index 000000000000..e123a9ff4f0d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeListResponseTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.IntegrationRuntimeResourceInner; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntime; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeListResponse; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"hkaetcktvfc\",\"\":{\"jf\":\"datasnkymuctq\",\"fuwutttxf\":\"dataebrjcxe\",\"hfnljkyq\":\"datajrbirphxepcyv\"}},\"name\":\"vuujq\",\"type\":\"dokgjl\",\"etag\":\"oxgvclt\",\"id\":\"sncghkjeszz\"},{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"ijhtxf\",\"\":{\"xnehmpvec\":\"databfs\"}},\"name\":\"odebfqkkrbmpu\",\"type\":\"riwflzlfb\",\"etag\":\"puz\",\"id\":\"ispnqzahmgkbrp\"},{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"dhibnuq\",\"\":{\"drgvtqagn\":\"dataik\",\"mebf\":\"datauynhijg\"}},\"name\":\"arbu\",\"type\":\"cvpnazzmhjrunmpx\",\"etag\":\"dbhrbnlankxm\",\"id\":\"k\"},{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"henbtkcxywnytn\",\"\":{\"lhaaxdbabp\":\"datanlqidybyxczf\"}},\"name\":\"wrqlfktsthsuco\",\"type\":\"nyyazttbtwwrqpue\",\"etag\":\"kzywbiex\",\"id\":\"eyueaxibxujwb\"}],\"nextLink\":\"walm\"}") + .toObject(IntegrationRuntimeListResponse.class); + Assertions.assertEquals("sncghkjeszz", model.value().get(0).id()); + Assertions.assertEquals("hkaetcktvfc", model.value().get(0).properties().description()); + Assertions.assertEquals("walm", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeListResponse model = + new IntegrationRuntimeListResponse() + .withValue( + Arrays + .asList( + new IntegrationRuntimeResourceInner() + .withId("sncghkjeszz") + .withProperties( + new IntegrationRuntime() + .withDescription("hkaetcktvfc") + .withAdditionalProperties(mapOf("type", "IntegrationRuntime"))), + new IntegrationRuntimeResourceInner() + .withId("ispnqzahmgkbrp") + .withProperties( + new IntegrationRuntime() + .withDescription("ijhtxf") + .withAdditionalProperties(mapOf("type", "IntegrationRuntime"))), + new IntegrationRuntimeResourceInner() + .withId("k") + .withProperties( + new IntegrationRuntime() + .withDescription("dhibnuq") + .withAdditionalProperties(mapOf("type", "IntegrationRuntime"))), + new IntegrationRuntimeResourceInner() + .withId("eyueaxibxujwb") + .withProperties( + new IntegrationRuntime() + .withDescription("henbtkcxywnytn") + .withAdditionalProperties(mapOf("type", "IntegrationRuntime"))))) + .withNextLink("walm"); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeListResponse.class); + Assertions.assertEquals("sncghkjeszz", model.value().get(0).id()); + Assertions.assertEquals("hkaetcktvfc", model.value().get(0).properties().description()); + Assertions.assertEquals("walm", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeMonitoringDataInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeMonitoringDataInnerTests.java new file mode 100644 index 000000000000..568dbe6b775c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeMonitoringDataInnerTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.IntegrationRuntimeMonitoringDataInner; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeNodeMonitoringData; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeMonitoringDataInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeMonitoringDataInner model = + BinaryData + .fromString( + "{\"name\":\"k\",\"nodes\":[{\"nodeName\":\"io\",\"availableMemoryInMB\":952194839,\"cpuUtilization\":1578257059,\"concurrentJobsLimit\":391809232,\"concurrentJobsRunning\":1039189909,\"maxConcurrentJobs\":1375924345,\"sentBytes\":68.58864,\"receivedBytes\":66.46081,\"\":{\"jooxdjebw\":\"datasowzxcugi\"}}]}") + .toObject(IntegrationRuntimeMonitoringDataInner.class); + Assertions.assertEquals("k", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeMonitoringDataInner model = + new IntegrationRuntimeMonitoringDataInner() + .withName("k") + .withNodes( + Arrays + .asList( + new IntegrationRuntimeNodeMonitoringData() + .withAdditionalProperties( + mapOf( + "nodeName", + "io", + "cpuUtilization", + 1578257059, + "receivedBytes", + 66.46081f, + "concurrentJobsLimit", + 391809232, + "concurrentJobsRunning", + 1039189909, + "maxConcurrentJobs", + 1375924345, + "availableMemoryInMB", + 952194839, + "sentBytes", + 68.58864f)))); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeMonitoringDataInner.class); + Assertions.assertEquals("k", model.name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodeIpAddressInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodeIpAddressInnerTests.java new file mode 100644 index 000000000000..f7da84cd170a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodeIpAddressInnerTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.IntegrationRuntimeNodeIpAddressInner; + +public final class IntegrationRuntimeNodeIpAddressInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeNodeIpAddressInner model = + BinaryData.fromString("{\"ipAddress\":\"nr\"}").toObject(IntegrationRuntimeNodeIpAddressInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeNodeIpAddressInner model = new IntegrationRuntimeNodeIpAddressInner(); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeNodeIpAddressInner.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodeMonitoringDataTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodeMonitoringDataTests.java new file mode 100644 index 000000000000..974ffd5f5dfd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodeMonitoringDataTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeNodeMonitoringData; +import java.util.HashMap; +import java.util.Map; + +public final class IntegrationRuntimeNodeMonitoringDataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeNodeMonitoringData model = + BinaryData + .fromString( + "{\"nodeName\":\"cwwfvovbvme\",\"availableMemoryInMB\":321338352,\"cpuUtilization\":1542315989,\"concurrentJobsLimit\":1560245881,\"concurrentJobsRunning\":343837467,\"maxConcurrentJobs\":1240635196,\"sentBytes\":81.17821,\"receivedBytes\":67.35784,\"\":{\"wit\":\"datajueiotwmcdytd\"}}") + .toObject(IntegrationRuntimeNodeMonitoringData.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeNodeMonitoringData model = + new IntegrationRuntimeNodeMonitoringData() + .withAdditionalProperties( + mapOf( + "nodeName", + "cwwfvovbvme", + "cpuUtilization", + 1542315989, + "receivedBytes", + 67.35784f, + "concurrentJobsLimit", + 1560245881, + "concurrentJobsRunning", + 343837467, + "maxConcurrentJobs", + 1240635196, + "availableMemoryInMB", + 321338352, + "sentBytes", + 81.17821f)); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeNodeMonitoringData.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..5f8cd9edbd64 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimeNodesDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .integrationRuntimeNodes() + .deleteWithResponse("suqps", "vxbdlraridiat", "hxqsbyy", "eyopgyygrnyfj", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesGetIpAddressWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesGetIpAddressWithResponseMockTests.java new file mode 100644 index 000000000000..e7649d8e71b6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesGetIpAddressWithResponseMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeNodeIpAddress; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimeNodesGetIpAddressWithResponseMockTests { + @Test + public void testGetIpAddressWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"ipAddress\":\"gvafbdzokpl\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + IntegrationRuntimeNodeIpAddress response = + manager + .integrationRuntimeNodes() + .getIpAddressWithResponse( + "a", "wofqnttbkjcgupxn", "vshg", "ubpmvppgui", com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesGetWithResponseMockTests.java new file mode 100644 index 000000000000..4bdccf78c535 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesGetWithResponseMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.SelfHostedIntegrationRuntimeNode; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimeNodesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"nodeName\":\"fppjunkh\",\"machineName\":\"hkqny\",\"hostServiceUri\":\"fvzrq\",\"status\":\"InitializeFailed\",\"capabilities\":{\"ia\":\"ceheeqqetasi\",\"gpmvl\":\"qwomkzcmwqfd\",\"d\":\"mvqumjmpsxzxbafs\"},\"versionStatus\":\"zporjhubzkzjazf\",\"version\":\"wvxq\",\"registerTime\":\"2021-10-16T11:38:02Z\",\"lastConnectTime\":\"2021-11-05T02:39:54Z\",\"expiryTime\":\"2021-11-03T20:33:22Z\",\"lastStartTime\":\"2021-12-08T01:27:04Z\",\"lastStopTime\":\"2021-10-08T15:53:52Z\",\"lastUpdateResult\":\"Fail\",\"lastStartUpdateTime\":\"2021-08-29T07:09:05Z\",\"lastEndUpdateTime\":\"2021-01-29T07:26:19Z\",\"isActiveDispatcher\":false,\"concurrentJobsLimit\":2104441921,\"maxConcurrentJobs\":680887094,\"\":{\"prgpm\":\"datafcsvipwahehuc\",\"fzcsklvtceaoi\":\"datatjvuhcw\",\"bjfhpaywwesa\":\"dataurqlcdh\"}}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + SelfHostedIntegrationRuntimeNode response = + manager + .integrationRuntimeNodes() + .getWithResponse( + "fmsaedglubqtf", "up", "mwtemirujiqmks", "fjhtlbrkgh", com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..8f38b5d5c6fe --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeNodesUpdateWithResponseMockTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.SelfHostedIntegrationRuntimeNode; +import com.azure.resourcemanager.datafactory.models.UpdateIntegrationRuntimeNodeRequest; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimeNodesUpdateWithResponseMockTests { + @Test + public void testUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"nodeName\":\"lvujbhwosz\",\"machineName\":\"fwcihkjjjbi\",\"hostServiceUri\":\"uriizyrgzxpr\",\"status\":\"Online\",\"capabilities\":{\"mjnrk\":\"sod\",\"i\":\"oomhrl\",\"qnaspjdahienk\":\"qxbrdhuw\",\"diybdoyykhi\":\"iyfgkzwkyqa\"},\"versionStatus\":\"an\",\"version\":\"tw\",\"registerTime\":\"2021-04-08T10:57:57Z\",\"lastConnectTime\":\"2021-07-28T12:27:25Z\",\"expiryTime\":\"2021-10-12T04:34:54Z\",\"lastStartTime\":\"2021-05-07T22:03:11Z\",\"lastStopTime\":\"2021-06-09T00:14:15Z\",\"lastUpdateResult\":\"Succeed\",\"lastStartUpdateTime\":\"2021-07-27T21:44:29Z\",\"lastEndUpdateTime\":\"2021-12-08T21:57:45Z\",\"isActiveDispatcher\":false,\"concurrentJobsLimit\":1149401060,\"maxConcurrentJobs\":56903388,\"\":{\"nqzvawfpuggyhsc\":\"dataqjcimo\"}}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + SelfHostedIntegrationRuntimeNode response = + manager + .integrationRuntimeNodes() + .updateWithResponse( + "oaomogkpcwffo", + "omxmvgj", + "zgqkxsoavbteaegy", + "jytoepcdhqjcz", + new UpdateIntegrationRuntimeNodeRequest().withConcurrentJobsLimit(701960170), + com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeObjectMetadatasGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeObjectMetadatasGetWithResponseMockTests.java new file mode 100644 index 000000000000..f6477ded0186 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeObjectMetadatasGetWithResponseMockTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.GetSsisObjectMetadataRequest; +import com.azure.resourcemanager.datafactory.models.SsisObjectMetadataListResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimeObjectMetadatasGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"type\":\"SsisObjectMetadata\",\"id\":1075337942816524885,\"name\":\"m\",\"description\":\"bodswgnglmllrxpx\"},{\"type\":\"SsisObjectMetadata\",\"id\":3298767872651639188,\"name\":\"yscjefapouwsyns\",\"description\":\"ndirdlehjz\"},{\"type\":\"SsisObjectMetadata\",\"id\":6434920934723993066,\"name\":\"hggvhco\",\"description\":\"eti\"}],\"nextLink\":\"tkeiram\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + SsisObjectMetadataListResponse response = + manager + .integrationRuntimeObjectMetadatas() + .getWithResponse( + "kd", + "gr", + "cltfkyqyiiujukc", + new GetSsisObjectMetadataRequest().withMetadataPath("vp"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(1075337942816524885L, response.value().get(0).id()); + Assertions.assertEquals("m", response.value().get(0).name()); + Assertions.assertEquals("bodswgnglmllrxpx", response.value().get(0).description()); + Assertions.assertEquals("tkeiram", response.nextLink()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeObjectMetadatasRefreshMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeObjectMetadatasRefreshMockTests.java new file mode 100644 index 000000000000..aa32edaf0e35 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeObjectMetadatasRefreshMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.SsisObjectMetadataStatusResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimeObjectMetadatasRefreshMockTests { + @Test + public void testRefresh() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"status\":\"inyursqf\",\"name\":\"zpyxmfipvgml\",\"properties\":\"bwfxssxarxvftlls\",\"error\":\"a\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + SsisObjectMetadataStatusResponse response = + manager + .integrationRuntimeObjectMetadatas() + .refresh("bdjxvcxepj", "xcmrhivwcmtretf", "irbvqkbxgz", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("inyursqf", response.status()); + Assertions.assertEquals("zpyxmfipvgml", response.name()); + Assertions.assertEquals("bwfxssxarxvftlls", response.properties()); + Assertions.assertEquals("a", response.error()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpointTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpointTests.java new file mode 100644 index 000000000000..1b26b843e3c9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpointTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesEndpoint; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint model = + BinaryData + .fromString( + "{\"category\":\"bmehh\",\"endpoints\":[{\"domainName\":\"jusrtslhspk\",\"endpointDetails\":[{\"port\":812184412},{\"port\":441408788},{\"port\":1351571833}]},{\"domainName\":\"gkvtmelmqkrhah\",\"endpointDetails\":[{\"port\":1468596781},{\"port\":1935710102},{\"port\":1520620796},{\"port\":27642330}]},{\"domainName\":\"hmdua\",\"endpointDetails\":[{\"port\":552039222}]}]}") + .toObject(IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.class); + Assertions.assertEquals("bmehh", model.category()); + Assertions.assertEquals("jusrtslhspk", model.endpoints().get(0).domainName()); + Assertions.assertEquals(812184412, model.endpoints().get(0).endpointDetails().get(0).port()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint model = + new IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint() + .withCategory("bmehh") + .withEndpoints( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpoint() + .withDomainName("jusrtslhspk") + .withEndpointDetails( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() + .withPort(812184412), + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() + .withPort(441408788), + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() + .withPort(1351571833))), + new IntegrationRuntimeOutboundNetworkDependenciesEndpoint() + .withDomainName("gkvtmelmqkrhah") + .withEndpointDetails( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() + .withPort(1468596781), + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() + .withPort(1935710102), + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() + .withPort(1520620796), + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() + .withPort(27642330))), + new IntegrationRuntimeOutboundNetworkDependenciesEndpoint() + .withDomainName("hmdua") + .withEndpointDetails( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails() + .withPort(552039222))))); + model = + BinaryData.fromObject(model).toObject(IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint.class); + Assertions.assertEquals("bmehh", model.category()); + Assertions.assertEquals("jusrtslhspk", model.endpoints().get(0).domainName()); + Assertions.assertEquals(812184412, model.endpoints().get(0).endpointDetails().get(0).port()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetailsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetailsTests.java new file mode 100644 index 000000000000..9e18dbb4bab7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesEndpointDetailsTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeOutboundNetworkDependenciesEndpointDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails model = + BinaryData + .fromString("{\"port\":434822175}") + .toObject(IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.class); + Assertions.assertEquals(434822175, model.port()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails model = + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails().withPort(434822175); + model = + BinaryData.fromObject(model).toObject(IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails.class); + Assertions.assertEquals(434822175, model.port()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesEndpointTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesEndpointTests.java new file mode 100644 index 000000000000..71432b73b756 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesEndpointTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesEndpoint; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeOutboundNetworkDependenciesEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeOutboundNetworkDependenciesEndpoint model = + BinaryData + .fromString("{\"domainName\":\"vfadmws\",\"endpointDetails\":[{\"port\":1913869945}]}") + .toObject(IntegrationRuntimeOutboundNetworkDependenciesEndpoint.class); + Assertions.assertEquals("vfadmws", model.domainName()); + Assertions.assertEquals(1913869945, model.endpointDetails().get(0).port()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeOutboundNetworkDependenciesEndpoint model = + new IntegrationRuntimeOutboundNetworkDependenciesEndpoint() + .withDomainName("vfadmws") + .withEndpointDetails( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails().withPort(1913869945))); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeOutboundNetworkDependenciesEndpoint.class); + Assertions.assertEquals("vfadmws", model.domainName()); + Assertions.assertEquals(1913869945, model.endpointDetails().get(0).port()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInnerTests.java new file mode 100644 index 000000000000..700653980f81 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInnerTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInner; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesEndpoint; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInner model = + BinaryData + .fromString( + "{\"value\":[{\"category\":\"frlh\",\"endpoints\":[{\"domainName\":\"kyv\",\"endpointDetails\":[{}]},{\"domainName\":\"n\",\"endpointDetails\":[{},{},{}]},{\"domainName\":\"zka\",\"endpointDetails\":[{}]},{\"domainName\":\"b\",\"endpointDetails\":[{},{}]}]}]}") + .toObject(IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInner.class); + Assertions.assertEquals("frlh", model.value().get(0).category()); + Assertions.assertEquals("kyv", model.value().get(0).endpoints().get(0).domainName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInner model = + new IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInner() + .withValue( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint() + .withCategory("frlh") + .withEndpoints( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpoint() + .withDomainName("kyv") + .withEndpointDetails( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails())), + new IntegrationRuntimeOutboundNetworkDependenciesEndpoint() + .withDomainName("n") + .withEndpointDetails( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(), + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(), + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails())), + new IntegrationRuntimeOutboundNetworkDependenciesEndpoint() + .withDomainName("zka") + .withEndpointDetails( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails())), + new IntegrationRuntimeOutboundNetworkDependenciesEndpoint() + .withDomainName("b") + .withEndpointDetails( + Arrays + .asList( + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(), + new IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails())))))); + model = + BinaryData + .fromObject(model) + .toObject(IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponseInner.class); + Assertions.assertEquals("frlh", model.value().get(0).category()); + Assertions.assertEquals("kyv", model.value().get(0).endpoints().get(0).domainName()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeReferenceTests.java new file mode 100644 index 000000000000..4244ad5d6f35 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeReferenceTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeReference model = + BinaryData + .fromString( + "{\"referenceName\":\"dggkzzlvmbmpa\",\"parameters\":{\"yw\":\"datadfvue\",\"yhrfouyftaakcpw\":\"databpfvm\",\"nubexk\":\"datayzvqt\"}}") + .toObject(IntegrationRuntimeReference.class); + Assertions.assertEquals("dggkzzlvmbmpa", model.referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeReference model = + new IntegrationRuntimeReference() + .withReferenceName("dggkzzlvmbmpa") + .withParameters(mapOf("yw", "datadfvue", "yhrfouyftaakcpw", "databpfvm", "nubexk", "datayzvqt")); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeReference.class); + Assertions.assertEquals("dggkzzlvmbmpa", model.referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeResourceInnerTests.java new file mode 100644 index 000000000000..fc4b41fff382 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeResourceInnerTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.IntegrationRuntimeResourceInner; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"yoxa\",\"\":{\"bniwdj\":\"datakzjancuxrhdwbav\",\"s\":\"datawz\",\"xytxhpzxbz\":\"databpg\"}},\"name\":\"zabglcuhxwt\",\"type\":\"yqiklbbovplwzb\",\"etag\":\"gy\",\"id\":\"uosvmkfssxqukk\"}") + .toObject(IntegrationRuntimeResourceInner.class); + Assertions.assertEquals("uosvmkfssxqukk", model.id()); + Assertions.assertEquals("yoxa", model.properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeResourceInner model = + new IntegrationRuntimeResourceInner() + .withId("uosvmkfssxqukk") + .withProperties( + new IntegrationRuntime() + .withDescription("yoxa") + .withAdditionalProperties(mapOf("type", "IntegrationRuntime"))); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeResourceInner.class); + Assertions.assertEquals("uosvmkfssxqukk", model.id()); + Assertions.assertEquals("yoxa", model.properties().description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeStatusResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeStatusResponseInnerTests.java new file mode 100644 index 000000000000..d990eef792c8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeStatusResponseInnerTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.IntegrationRuntimeStatusResponseInner; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeStatus; +import java.util.HashMap; +import java.util.Map; + +public final class IntegrationRuntimeStatusResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeStatusResponseInner model = + BinaryData + .fromString( + "{\"name\":\"ogtwrupqsxvnmi\",\"properties\":{\"type\":\"IntegrationRuntimeStatus\",\"dataFactoryName\":\"kvceoveilovnotyf\",\"state\":\"Limited\",\"\":{\"x\":\"databkc\",\"nv\":\"datahbttkphyw\",\"qnermclfplphoxu\":\"datat\",\"ye\":\"datacrpab\"}}}") + .toObject(IntegrationRuntimeStatusResponseInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeStatusResponseInner model = + new IntegrationRuntimeStatusResponseInner() + .withProperties( + new IntegrationRuntimeStatus() + .withAdditionalProperties( + mapOf( + "dataFactoryName", + "kvceoveilovnotyf", + "state", + "Limited", + "type", + "IntegrationRuntimeStatus"))); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeStatusResponseInner.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeStatusTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeStatusTests.java new file mode 100644 index 000000000000..57aeae084237 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeStatusTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeStatus; +import java.util.HashMap; +import java.util.Map; + +public final class IntegrationRuntimeStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeStatus model = + BinaryData + .fromString( + "{\"type\":\"IntegrationRuntimeStatus\",\"dataFactoryName\":\"bjtazqugxywpmu\",\"state\":\"Started\",\"\":{\"dsuyonobgla\":\"datawfqkquj\",\"tcc\":\"datacq\",\"udxytlmoyrx\":\"datag\",\"qj\":\"datawfudwpzntxhdzhl\"}}") + .toObject(IntegrationRuntimeStatus.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeStatus model = + new IntegrationRuntimeStatus() + .withAdditionalProperties( + mapOf("dataFactoryName", "bjtazqugxywpmu", "state", "Started", "type", "IntegrationRuntimeStatus")); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeStatus.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeTests.java new file mode 100644 index 000000000000..c01dec223ab1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntime model = + BinaryData + .fromString( + "{\"type\":\"IntegrationRuntime\",\"description\":\"l\",\"\":{\"wiyighxpkdw\":\"datasxnkjzkdeslpvlo\",\"upedeojnabckhs\":\"databaiuebbaumny\",\"ie\":\"datatxp\",\"jdhtldwkyzxu\":\"datatfhvpesapskrdqmh\"}}") + .toObject(IntegrationRuntime.class); + Assertions.assertEquals("l", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntime model = + new IntegrationRuntime().withDescription("l").withAdditionalProperties(mapOf("type", "IntegrationRuntime")); + model = BinaryData.fromObject(model).toObject(IntegrationRuntime.class); + Assertions.assertEquals("l", model.description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeVNetPropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeVNetPropertiesTests.java new file mode 100644 index 000000000000..7aec1b2d8bca --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimeVNetPropertiesTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeVNetProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IntegrationRuntimeVNetPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IntegrationRuntimeVNetProperties model = + BinaryData + .fromString( + "{\"vNetId\":\"q\",\"subnet\":\"xnyx\",\"publicIPs\":[\"dsqniiont\"],\"subnetId\":\"kdi\",\"\":{\"uzabrsoihataj\":\"datasq\"}}") + .toObject(IntegrationRuntimeVNetProperties.class); + Assertions.assertEquals("q", model.vNetId()); + Assertions.assertEquals("xnyx", model.subnet()); + Assertions.assertEquals("dsqniiont", model.publicIPs().get(0)); + Assertions.assertEquals("kdi", model.subnetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IntegrationRuntimeVNetProperties model = + new IntegrationRuntimeVNetProperties() + .withVNetId("q") + .withSubnet("xnyx") + .withPublicIPs(Arrays.asList("dsqniiont")) + .withSubnetId("kdi") + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(IntegrationRuntimeVNetProperties.class); + Assertions.assertEquals("q", model.vNetId()); + Assertions.assertEquals("xnyx", model.subnet()); + Assertions.assertEquals("dsqniiont", model.publicIPs().get(0)); + Assertions.assertEquals("kdi", model.subnetId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesCreateLinkedIntegrationRuntimeWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesCreateLinkedIntegrationRuntimeWithResponseMockTests.java new file mode 100644 index 000000000000..8720855449f3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesCreateLinkedIntegrationRuntimeWithResponseMockTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.CreateLinkedIntegrationRuntimeRequest; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeStatusResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesCreateLinkedIntegrationRuntimeWithResponseMockTests { + @Test + public void testCreateLinkedIntegrationRuntimeWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"name\":\"ngrdu\",\"properties\":{\"type\":\"IntegrationRuntimeStatus\",\"dataFactoryName\":\"zd\",\"state\":\"Starting\",\"\":{\"huimgdfohaeeuotf\":\"datamgpioxzhpbj\",\"cvwewognpu\":\"datavmdpepl\",\"rqvjwlritsxuxre\":\"datapaqj\"}}}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + IntegrationRuntimeStatusResponse response = + manager + .integrationRuntimes() + .createLinkedIntegrationRuntimeWithResponse( + "ip", + "szrr", + "q", + new CreateLinkedIntegrationRuntimeRequest() + .withName("xyawtdsnvxhx") + .withSubscriptionId("decryoffglwmkmb") + .withDataFactoryName("snxlqnzxs") + .withDataFactoryLocation("fbkqicehxmzt"), + com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..a6b2d55daac7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntime; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"kpo\",\"\":{\"hcvssmlw\":\"datagvtjrobo\",\"mu\":\"datadstlxrg\",\"ulwvezthgwqqtb\":\"datahxoldmhypptfpp\",\"yipzehitdqmb\":\"datab\"}},\"name\":\"wuaj\",\"type\":\"tgpz\",\"etag\":\"lkcvkme\",\"id\":\"kolpnebnrafvkskj\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + IntegrationRuntimeResource response = + manager + .integrationRuntimes() + .define("mjgtjckf") + .withExistingFactory("fb", "fkzpf") + .withProperties( + new IntegrationRuntime() + .withDescription("jrlrkvhgnmsx") + .withAdditionalProperties(mapOf("type", "IntegrationRuntime"))) + .withIfMatch("x") + .create(); + + Assertions.assertEquals("kolpnebnrafvkskj", response.id()); + Assertions.assertEquals("kpo", response.properties().description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..926f40cb5fe1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .integrationRuntimes() + .deleteWithResponse("bdhrkhfyaxiwcnzs", "mb", "vrks", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesGetMonitoringDataWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesGetMonitoringDataWithResponseMockTests.java new file mode 100644 index 000000000000..e0782b470ef2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesGetMonitoringDataWithResponseMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeMonitoringData; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesGetMonitoringDataWithResponseMockTests { + @Test + public void testGetMonitoringDataWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"name\":\"ygimohrllxj\",\"nodes\":[{\"nodeName\":\"vnyupszchqwnuddl\",\"availableMemoryInMB\":1536231346,\"cpuUtilization\":369062496,\"concurrentJobsLimit\":1868818718,\"concurrentJobsRunning\":679866047,\"maxConcurrentJobs\":119858132,\"sentBytes\":67.79936,\"receivedBytes\":63.317204,\"\":{\"meoxehynurbwv\":\"datawdxu\",\"rymklztorvwgpjxd\":\"dataiiuqmdaqoqjnvmf\",\"uavotfmgtxz\":\"dataiiutdzhkbc\"}},{\"nodeName\":\"dzqmlkrx\",\"availableMemoryInMB\":1365369416,\"cpuUtilization\":1361138327,\"concurrentJobsLimit\":1201070487,\"concurrentJobsRunning\":55729362,\"maxConcurrentJobs\":1590635251,\"sentBytes\":42.207695,\"receivedBytes\":31.539654,\"\":{\"kjirti\":\"datamy\",\"gonrrarznlrr\":\"databvyud\",\"udfhclssedxiigw\":\"datasexaejbmtoun\"}}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + IntegrationRuntimeMonitoringData response = + manager + .integrationRuntimes() + .getMonitoringDataWithResponse( + "pnsbbhdjeegllcy", "ihy", "dgukfmkqokzvx", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ygimohrllxj", response.name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesGetStatusWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesGetStatusWithResponseMockTests.java new file mode 100644 index 000000000000..67e9dc74a2d6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesGetStatusWithResponseMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeStatusResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesGetStatusWithResponseMockTests { + @Test + public void testGetStatusWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"name\":\"emgbkjxuxm\",\"properties\":{\"type\":\"IntegrationRuntimeStatus\",\"dataFactoryName\":\"gbyjf\",\"state\":\"Online\",\"\":{\"gllezvrvjwsffkzl\":\"datawfek\",\"vkijynvgu\":\"datacjb\"}}}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + IntegrationRuntimeStatusResponse response = + manager + .integrationRuntimes() + .getStatusWithResponse("jqqparbogzww", "ubkpp", "cjy", com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesGetWithResponseMockTests.java new file mode 100644 index 000000000000..224f5e85deb6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesGetWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"xiapts\",\"\":{\"vipxzzcxqdrqsu\":\"dataoybpwzniekedxvw\",\"ptzqazwybbewjvyr\":\"dataekzqybpoxqwcusl\",\"osmp\":\"dataownbwrnbmcblmzar\",\"abhpdkrjlwrqheh\":\"dataajx\"}},\"name\":\"zckgbpysgzgiv\",\"type\":\"hektw\",\"etag\":\"umccomjxx\",\"id\":\"af\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + IntegrationRuntimeResource response = + manager + .integrationRuntimes() + .getWithResponse( + "briykrxaevbur", "vswnnsbz", "um", "bcnkojynkhbtycfj", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("af", response.id()); + Assertions.assertEquals("xiapts", response.properties().description()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesListByFactoryMockTests.java new file mode 100644 index 000000000000..d72203c4c25f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesListByFactoryMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"type\":\"IntegrationRuntime\",\"description\":\"ebctoraocepjsfh\",\"\":{\"thydyzrrwlgueso\":\"datalrekroyjdnzrcjok\",\"yceksdatjtgmf\":\"datavaoryefgwo\",\"dhixd\":\"datazqvi\",\"yzjdrkcs\":\"datacocsmcqskrjnqaa\"}},\"name\":\"oxssf\",\"type\":\"lxqhyyxhzgxkwc\",\"etag\":\"vrrmlkr\",\"id\":\"qsdvxddsfylbo\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.integrationRuntimes().listByFactory("cik", "fwmqi", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qsdvxddsfylbo", response.iterator().next().id()); + Assertions.assertEquals("ebctoraocepjsfh", response.iterator().next().properties().description()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesListOutboundNetworkDependenciesEndpointsWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesListOutboundNetworkDependenciesEndpointsWithResponseMockTests.java new file mode 100644 index 000000000000..5f0d276f6292 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesListOutboundNetworkDependenciesEndpointsWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesListOutboundNetworkDependenciesEndpointsWithResponseMockTests { + @Test + public void testListOutboundNetworkDependenciesEndpointsWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"category\":\"usicnckdxflgjibt\",\"endpoints\":[{\"domainName\":\"l\",\"endpointDetails\":[{},{},{},{}]}]},{\"category\":\"palxmr\",\"endpoints\":[{\"domainName\":\"juhzfjmnabyv\",\"endpointDetails\":[{},{},{},{}]},{\"domainName\":\"kwlmittpbivhkdxh\",\"endpointDetails\":[{},{}]},{\"domainName\":\"xplbdazsjbg\",\"endpointDetails\":[{},{}]}]}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse response = + manager + .integrationRuntimes() + .listOutboundNetworkDependenciesEndpointsWithResponse( + "qugnqsclr", "quwhmncewcfi", "soimxxsybtpqgxz", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("usicnckdxflgjibt", response.value().get(0).category()); + Assertions.assertEquals("l", response.value().get(0).endpoints().get(0).domainName()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesRemoveLinksWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesRemoveLinksWithResponseMockTests.java new file mode 100644 index 000000000000..0d883656a70e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesRemoveLinksWithResponseMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.LinkedIntegrationRuntimeRequest; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesRemoveLinksWithResponseMockTests { + @Test + public void testRemoveLinksWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .integrationRuntimes() + .removeLinksWithResponse( + "siaszqhpel", + "ckwccpmsyh", + "vifurgnxhoqfvuqi", + new LinkedIntegrationRuntimeRequest().withLinkedFactoryName("dgkvfghcu"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesStartMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesStartMockTests.java new file mode 100644 index 000000000000..751052b938db --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesStartMockTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeStatusResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesStartMockTests { + @Test + public void testStart() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"name\":\"timy\",\"properties\":{\"type\":\"IntegrationRuntimeStatus\",\"dataFactoryName\":\"dogn\",\"state\":\"Online\",\"\":{\"zjiyk\":\"dataowkakdjn\",\"fe\":\"databytuzhcpxtdvyfxv\",\"lvea\":\"datalyoiyovcrmo\",\"ezrajpedowmh\":\"datauz\"}}}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + IntegrationRuntimeStatusResponse response = + manager.integrationRuntimes().start("azbgcbd", "q", "y", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesStopMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesStopMockTests.java new file mode 100644 index 000000000000..386e3ae8cd31 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesStopMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesStopMockTests { + @Test + public void testStop() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.integrationRuntimes().stop("zrrikvyu", "xnopdeqqf", "cwbupxfikiumhv", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesSyncCredentialsWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesSyncCredentialsWithResponseMockTests.java new file mode 100644 index 000000000000..78a4cf161095 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesSyncCredentialsWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesSyncCredentialsWithResponseMockTests { + @Test + public void testSyncCredentialsWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .integrationRuntimes() + .syncCredentialsWithResponse("xptqbwn", "ilgamxnj", "w", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesUpgradeWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesUpgradeWithResponseMockTests.java new file mode 100644 index 000000000000..cec05b02a325 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/IntegrationRuntimesUpgradeWithResponseMockTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class IntegrationRuntimesUpgradeWithResponseMockTests { + @Test + public void testUpgradeWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .integrationRuntimes() + .upgradeWithResponse( + "zwqjpudupishcvsj", "aedsqfdulndy", "ghnptfvoljnrom", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JiraObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JiraObjectDatasetTests.java new file mode 100644 index 000000000000..8e1a8f9a9754 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JiraObjectDatasetTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.JiraObjectDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class JiraObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JiraObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"JiraObject\",\"typeProperties\":{\"tableName\":\"datamhp\"},\"description\":\"sfgvrvq\",\"structure\":\"datawbdrwroqkljnzpqh\",\"schema\":\"datasarkyulfa\",\"linkedServiceName\":{\"referenceName\":\"ea\",\"parameters\":{\"geytlplslfc\":\"dataqenhekzaz\",\"ksuowt\":\"datae\",\"rhnxzmfvmw\":\"datalkyqfnjo\",\"rawwhyxf\":\"datanrtc\"}},\"parameters\":{\"uns\":{\"type\":\"String\",\"defaultValue\":\"datadmvwn\"}},\"annotations\":[\"dataevzshqykebmps\",\"dataaezc\",\"datadkckr\"],\"folder\":{\"name\":\"qdmhcejstfs\"},\"\":{\"wxqd\":\"datajakgk\",\"wdjox\":\"dataoqzh\",\"sobvcnsb\":\"datakbd\"}}") + .toObject(JiraObjectDataset.class); + Assertions.assertEquals("sfgvrvq", model.description()); + Assertions.assertEquals("ea", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("uns").type()); + Assertions.assertEquals("qdmhcejstfs", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JiraObjectDataset model = + new JiraObjectDataset() + .withDescription("sfgvrvq") + .withStructure("datawbdrwroqkljnzpqh") + .withSchema("datasarkyulfa") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ea") + .withParameters( + mapOf( + "geytlplslfc", + "dataqenhekzaz", + "ksuowt", + "datae", + "rhnxzmfvmw", + "datalkyqfnjo", + "rawwhyxf", + "datanrtc"))) + .withParameters( + mapOf( + "uns", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datadmvwn"))) + .withAnnotations(Arrays.asList("dataevzshqykebmps", "dataaezc", "datadkckr")) + .withFolder(new DatasetFolder().withName("qdmhcejstfs")) + .withTableName("datamhp"); + model = BinaryData.fromObject(model).toObject(JiraObjectDataset.class); + Assertions.assertEquals("sfgvrvq", model.description()); + Assertions.assertEquals("ea", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("uns").type()); + Assertions.assertEquals("qdmhcejstfs", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JiraSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JiraSourceTests.java new file mode 100644 index 000000000000..a823b8efb29d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JiraSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.JiraSource; + +public final class JiraSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JiraSource model = + BinaryData + .fromString( + "{\"type\":\"JiraSource\",\"query\":\"dataoqldnhwdfxgec\",\"queryTimeout\":\"datakkdbzbhsnimompxd\",\"additionalColumns\":\"datap\",\"sourceRetryCount\":\"databdmoawh\",\"sourceRetryWait\":\"dataxxnmyxzh\",\"maxConcurrentConnections\":\"datacqoyd\",\"disableMetricsCollection\":\"datazhfnylgbwdsa\",\"\":{\"jinlsktprnknnqlt\":\"datawa\",\"wgen\":\"datagyeyxmuwgnwxtm\",\"ew\":\"datamoswcxlgzquq\"}}") + .toObject(JiraSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JiraSource model = + new JiraSource() + .withSourceRetryCount("databdmoawh") + .withSourceRetryWait("dataxxnmyxzh") + .withMaxConcurrentConnections("datacqoyd") + .withDisableMetricsCollection("datazhfnylgbwdsa") + .withQueryTimeout("datakkdbzbhsnimompxd") + .withAdditionalColumns("datap") + .withQuery("dataoqldnhwdfxgec"); + model = BinaryData.fromObject(model).toObject(JiraSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonDatasetTests.java new file mode 100644 index 000000000000..6c915152f042 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonDatasetTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetLocation; +import com.azure.resourcemanager.datafactory.models.JsonDataset; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class JsonDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JsonDataset model = + BinaryData + .fromString( + "{\"type\":\"Json\",\"typeProperties\":{\"location\":{\"type\":\"DatasetLocation\",\"folderPath\":\"datax\",\"fileName\":\"datavynuqqkotauratn\",\"\":{\"tndqlmf\":\"datapfzsclefyrl\",\"evnoqayrehjuqwva\":\"dataggnbbuypwovvvsfl\",\"enqqzlxnqzu\":\"dataxrlzhpziha\"}},\"encodingName\":\"dataonfdbgmkfwmjc\",\"compression\":{\"type\":\"dataewfhxwyrkbre\",\"level\":\"datalrynjpchamk\",\"\":{\"jub\":\"datalr\",\"vtjr\":\"datawuyw\"}}},\"description\":\"ikmwlaok\",\"structure\":\"datani\",\"schema\":\"dataxgucbmtredscnn\",\"linkedServiceName\":{\"referenceName\":\"tjcyyuv\",\"parameters\":{\"wtzqzcloyhy\":\"dataxzhclec\"}},\"parameters\":{\"mwb\":{\"type\":\"Int\",\"defaultValue\":\"datahzgyresgzsd\"}},\"annotations\":[\"datajplbchych\"],\"folder\":{\"name\":\"yrfbqvumkxq\"},\"\":{\"xfnzlpq\":\"datauepm\",\"xef\":\"datapf\",\"rtux\":\"dataulbl\",\"ifq\":\"dataprhfcaeo\"}}") + .toObject(JsonDataset.class); + Assertions.assertEquals("ikmwlaok", model.description()); + Assertions.assertEquals("tjcyyuv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("mwb").type()); + Assertions.assertEquals("yrfbqvumkxq", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JsonDataset model = + new JsonDataset() + .withDescription("ikmwlaok") + .withStructure("datani") + .withSchema("dataxgucbmtredscnn") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("tjcyyuv") + .withParameters(mapOf("wtzqzcloyhy", "dataxzhclec"))) + .withParameters( + mapOf( + "mwb", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datahzgyresgzsd"))) + .withAnnotations(Arrays.asList("datajplbchych")) + .withFolder(new DatasetFolder().withName("yrfbqvumkxq")) + .withLocation( + new DatasetLocation() + .withFolderPath("datax") + .withFileName("datavynuqqkotauratn") + .withAdditionalProperties(mapOf("type", "DatasetLocation"))) + .withEncodingName("dataonfdbgmkfwmjc") + .withCompression( + new DatasetCompression() + .withType("dataewfhxwyrkbre") + .withLevel("datalrynjpchamk") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(JsonDataset.class); + Assertions.assertEquals("ikmwlaok", model.description()); + Assertions.assertEquals("tjcyyuv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("mwb").type()); + Assertions.assertEquals("yrfbqvumkxq", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..374ac3fee2ff --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonDatasetTypePropertiesTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.JsonDatasetTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetLocation; +import java.util.HashMap; +import java.util.Map; + +public final class JsonDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JsonDatasetTypeProperties model = + BinaryData + .fromString( + "{\"location\":{\"type\":\"DatasetLocation\",\"folderPath\":\"datawjflobh\",\"fileName\":\"dataqmomfe\",\"\":{\"j\":\"datakfrocgbmxl\",\"lslu\":\"datazezbjes\",\"pnyh\":\"databqfy\",\"yvouprsytq\":\"datadzuqscag\"}},\"encodingName\":\"dataslhmgw\",\"compression\":{\"type\":\"dataivrxpfduiol\",\"level\":\"datayqvpbfjpo\",\"\":{\"zdquurbo\":\"datacfzlu\",\"elbprn\":\"datamvhvz\",\"svhbngqiwyejto\":\"dataujywzcqyggmn\"}}}") + .toObject(JsonDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JsonDatasetTypeProperties model = + new JsonDatasetTypeProperties() + .withLocation( + new DatasetLocation() + .withFolderPath("datawjflobh") + .withFileName("dataqmomfe") + .withAdditionalProperties(mapOf("type", "DatasetLocation"))) + .withEncodingName("dataslhmgw") + .withCompression( + new DatasetCompression() + .withType("dataivrxpfduiol") + .withLevel("datayqvpbfjpo") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(JsonDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonFormatTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonFormatTests.java new file mode 100644 index 000000000000..8d0d7aa14241 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonFormatTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.JsonFormat; + +public final class JsonFormatTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JsonFormat model = + BinaryData + .fromString( + "{\"type\":\"JsonFormat\",\"filePattern\":\"datafcwrri\",\"nestingSeparator\":\"dataxeezwyhjmbjiqe\",\"encodingName\":\"dataxdbsohcw\",\"jsonNodeReference\":\"datayvdkgdetszw\",\"jsonPathDefinition\":\"datanzbjekwuycky\",\"serializer\":\"dataensmuffiwjbct\",\"deserializer\":\"datap\",\"\":{\"dxposcsl\":\"dataqjto\",\"uxidhhxomilddxj\":\"datawuusiecktybh\"}}") + .toObject(JsonFormat.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JsonFormat model = + new JsonFormat() + .withSerializer("dataensmuffiwjbct") + .withDeserializer("datap") + .withFilePattern("datafcwrri") + .withNestingSeparator("dataxeezwyhjmbjiqe") + .withEncodingName("dataxdbsohcw") + .withJsonNodeReference("datayvdkgdetszw") + .withJsonPathDefinition("datanzbjekwuycky"); + model = BinaryData.fromObject(model).toObject(JsonFormat.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonReadSettingsTests.java new file mode 100644 index 000000000000..cefa7dc1b5ee --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonReadSettingsTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CompressionReadSettings; +import com.azure.resourcemanager.datafactory.models.JsonReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class JsonReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JsonReadSettings model = + BinaryData + .fromString( + "{\"type\":\"JsonReadSettings\",\"compressionProperties\":{\"type\":\"CompressionReadSettings\",\"\":{\"xauimnabgrsn\":\"dataaoyzjfg\",\"p\":\"datazmthiecuflazfot\",\"ekh\":\"dataumamdorgl\"}},\"\":{\"iwvxmysc\":\"datagjbeybdukbgl\",\"ciacdloehsm\":\"datajivoexko\",\"niffajniwbyzyjuy\":\"datavxkctedhaf\",\"sigkinykjxq\":\"dataylbbugojdzcluy\"}}") + .toObject(JsonReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JsonReadSettings model = + new JsonReadSettings() + .withCompressionProperties( + new CompressionReadSettings().withAdditionalProperties(mapOf("type", "CompressionReadSettings"))); + model = BinaryData.fromObject(model).toObject(JsonReadSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonSinkTests.java new file mode 100644 index 000000000000..49ee3fd7bdef --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonSinkTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.JsonSink; +import com.azure.resourcemanager.datafactory.models.JsonWriteSettings; +import com.azure.resourcemanager.datafactory.models.StoreWriteSettings; +import java.util.HashMap; +import java.util.Map; + +public final class JsonSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JsonSink model = + BinaryData + .fromString( + "{\"type\":\"JsonSink\",\"storeSettings\":{\"type\":\"StoreWriteSettings\",\"maxConcurrentConnections\":\"dataolzinxx\",\"disableMetricsCollection\":\"dataixr\",\"copyBehavior\":\"datawxcaa\",\"\":{\"hacfiyrywfry\":\"dataqosgzgsgzlbunm\",\"iiarlldy\":\"datarreebjmslbxf\",\"wuebrvrh\":\"datafjdtykhsafrf\",\"ybwh\":\"dataqkfffvgbklei\"}},\"formatSettings\":{\"type\":\"JsonWriteSettings\",\"filePattern\":\"dataebvkmtljzilkyvyb\",\"\":{\"mxcukurkg\":\"datagirpitzq\"}},\"writeBatchSize\":\"dataxqanrk\",\"writeBatchTimeout\":\"datadjfsvfbjcnad\",\"sinkRetryCount\":\"databrntvhppykrlz\",\"sinkRetryWait\":\"datalsvxpolatorjm\",\"maxConcurrentConnections\":\"databnmuxlthyxryv\",\"disableMetricsCollection\":\"datazhsigddgbcnqv\",\"\":{\"lemzrw\":\"databffcvtij\",\"kmkwddgyqeni\":\"datagvgogczgcm\",\"rtcbvifcrnxst\":\"datarznam\"}}") + .toObject(JsonSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JsonSink model = + new JsonSink() + .withWriteBatchSize("dataxqanrk") + .withWriteBatchTimeout("datadjfsvfbjcnad") + .withSinkRetryCount("databrntvhppykrlz") + .withSinkRetryWait("datalsvxpolatorjm") + .withMaxConcurrentConnections("databnmuxlthyxryv") + .withDisableMetricsCollection("datazhsigddgbcnqv") + .withStoreSettings( + new StoreWriteSettings() + .withMaxConcurrentConnections("dataolzinxx") + .withDisableMetricsCollection("dataixr") + .withCopyBehavior("datawxcaa") + .withAdditionalProperties(mapOf("type", "StoreWriteSettings"))) + .withFormatSettings(new JsonWriteSettings().withFilePattern("dataebvkmtljzilkyvyb")); + model = BinaryData.fromObject(model).toObject(JsonSink.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonSourceTests.java new file mode 100644 index 000000000000..577bfc774df9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonSourceTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CompressionReadSettings; +import com.azure.resourcemanager.datafactory.models.JsonReadSettings; +import com.azure.resourcemanager.datafactory.models.JsonSource; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class JsonSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JsonSource model = + BinaryData + .fromString( + "{\"type\":\"JsonSource\",\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datatclmbkpqj\",\"disableMetricsCollection\":\"datatymfnojjhtnn\",\"\":{\"xytrafettwytavp\":\"dataqgovvivl\",\"nhhvp\":\"datailgyqluolgspyqsa\"}},\"formatSettings\":{\"type\":\"JsonReadSettings\",\"compressionProperties\":{\"type\":\"CompressionReadSettings\",\"\":{\"oujtcp\":\"datarqviyfksegwezgf\",\"y\":\"datatdz\",\"jckakikkkajmnvb\":\"datagzba\",\"yco\":\"datagmnkrq\"}},\"\":{\"klqr\":\"datakxx\",\"daypx\":\"databcgsa\"}},\"additionalColumns\":\"dataedftkigmj\",\"sourceRetryCount\":\"datattvzyvzixmu\",\"sourceRetryWait\":\"dataidivbbrtzf\",\"maxConcurrentConnections\":\"dataqntnoegxoqpucli\",\"disableMetricsCollection\":\"datatwdaiexi\",\"\":{\"oukaffzzf\":\"dataygi\",\"orvigrxmptu\":\"dataivfiypfvwyzjsi\",\"bpqghxdp\":\"datade\"}}") + .toObject(JsonSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JsonSource model = + new JsonSource() + .withSourceRetryCount("datattvzyvzixmu") + .withSourceRetryWait("dataidivbbrtzf") + .withMaxConcurrentConnections("dataqntnoegxoqpucli") + .withDisableMetricsCollection("datatwdaiexi") + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datatclmbkpqj") + .withDisableMetricsCollection("datatymfnojjhtnn") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withFormatSettings( + new JsonReadSettings() + .withCompressionProperties( + new CompressionReadSettings() + .withAdditionalProperties(mapOf("type", "CompressionReadSettings")))) + .withAdditionalColumns("dataedftkigmj"); + model = BinaryData.fromObject(model).toObject(JsonSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonWriteSettingsTests.java new file mode 100644 index 000000000000..815070952cd6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/JsonWriteSettingsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.JsonWriteSettings; + +public final class JsonWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JsonWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"JsonWriteSettings\",\"filePattern\":\"databaqolwfkb\",\"\":{\"vazf\":\"datavhtgfdygaphlwm\"}}") + .toObject(JsonWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JsonWriteSettings model = new JsonWriteSettings().withFilePattern("databaqolwfkb"); + model = BinaryData.fromObject(model).toObject(JsonWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedIntegrationRuntimeRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedIntegrationRuntimeRequestTests.java new file mode 100644 index 000000000000..d867133c04e9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedIntegrationRuntimeRequestTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.LinkedIntegrationRuntimeRequest; +import org.junit.jupiter.api.Assertions; + +public final class LinkedIntegrationRuntimeRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkedIntegrationRuntimeRequest model = + BinaryData.fromString("{\"factoryName\":\"nrjawgqwg\"}").toObject(LinkedIntegrationRuntimeRequest.class); + Assertions.assertEquals("nrjawgqwg", model.linkedFactoryName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkedIntegrationRuntimeRequest model = + new LinkedIntegrationRuntimeRequest().withLinkedFactoryName("nrjawgqwg"); + model = BinaryData.fromObject(model).toObject(LinkedIntegrationRuntimeRequest.class); + Assertions.assertEquals("nrjawgqwg", model.linkedFactoryName()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedIntegrationRuntimeTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedIntegrationRuntimeTests.java new file mode 100644 index 000000000000..4125f405496d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedIntegrationRuntimeTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.LinkedIntegrationRuntime; + +public final class LinkedIntegrationRuntimeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkedIntegrationRuntime model = + BinaryData + .fromString( + "{\"name\":\"yeeafdxs\",\"subscriptionId\":\"lynxzhgbspdxb\",\"dataFactoryName\":\"qu\",\"dataFactoryLocation\":\"zxqomzdfaupqvei\",\"createTime\":\"2021-11-15T09:39:55Z\"}") + .toObject(LinkedIntegrationRuntime.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkedIntegrationRuntime model = new LinkedIntegrationRuntime(); + model = BinaryData.fromObject(model).toObject(LinkedIntegrationRuntime.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceDebugResourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceDebugResourceTests.java new file mode 100644 index 000000000000..e69dbac667c9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceDebugResourceTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedService; +import com.azure.resourcemanager.datafactory.models.LinkedServiceDebugResource; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LinkedServiceDebugResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkedServiceDebugResource model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"LinkedService\",\"connectVia\":{\"referenceName\":\"ffm\",\"parameters\":{\"dby\":\"datawfbkgozxwo\",\"zqaclna\":\"datap\"}},\"description\":\"biygnugjknfsmfct\",\"parameters\":{\"jhvsujztczyt\":{\"type\":\"Float\",\"defaultValue\":\"datayilflqoiquvrehmr\"},\"auunfprnjletlx\":{\"type\":\"Bool\",\"defaultValue\":\"dataw\"},\"nlqwzdvpiwhx\":{\"type\":\"Object\",\"defaultValue\":\"datapddouifamowaziyn\"},\"quhuxylrj\":{\"type\":\"SecureString\",\"defaultValue\":\"datadtmaa\"}},\"annotations\":[\"dataygjbmzyospspsh\"],\"\":{\"df\":\"datakyjpmspbps\",\"vczkcnyxrxmunjd\":\"datapyogtieyuj\",\"nkvxlxpaglqi\":\"datavg\",\"khpzvuqdflv\":\"databgkc\"}},\"name\":\"iypfp\"}") + .toObject(LinkedServiceDebugResource.class); + Assertions.assertEquals("iypfp", model.name()); + Assertions.assertEquals("ffm", model.properties().connectVia().referenceName()); + Assertions.assertEquals("biygnugjknfsmfct", model.properties().description()); + Assertions.assertEquals(ParameterType.FLOAT, model.properties().parameters().get("jhvsujztczyt").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkedServiceDebugResource model = + new LinkedServiceDebugResource() + .withName("iypfp") + .withProperties( + new LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("ffm") + .withParameters(mapOf("dby", "datawfbkgozxwo", "zqaclna", "datap"))) + .withDescription("biygnugjknfsmfct") + .withParameters( + mapOf( + "jhvsujztczyt", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datayilflqoiquvrehmr"), + "auunfprnjletlx", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataw"), + "nlqwzdvpiwhx", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("datapddouifamowaziyn"), + "quhuxylrj", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datadtmaa"))) + .withAnnotations(Arrays.asList("dataygjbmzyospspsh")) + .withAdditionalProperties(mapOf("type", "LinkedService"))); + model = BinaryData.fromObject(model).toObject(LinkedServiceDebugResource.class); + Assertions.assertEquals("iypfp", model.name()); + Assertions.assertEquals("ffm", model.properties().connectVia().referenceName()); + Assertions.assertEquals("biygnugjknfsmfct", model.properties().description()); + Assertions.assertEquals(ParameterType.FLOAT, model.properties().parameters().get("jhvsujztczyt").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceListResponseTests.java new file mode 100644 index 000000000000..d3796982dca0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceListResponseTests.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.LinkedServiceResourceInner; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedService; +import com.azure.resourcemanager.datafactory.models.LinkedServiceListResponse; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LinkedServiceListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkedServiceListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"type\":\"LinkedService\",\"connectVia\":{\"referenceName\":\"o\",\"parameters\":{\"ggdtpnapnyiro\":\"datanxknalaulp\",\"ylgqgitxmedjvcsl\":\"datauhpigvp\",\"wwncwzzhxgk\":\"datan\",\"t\":\"datarmgucnap\"}},\"description\":\"ellwptfdy\",\"parameters\":{\"opppcqeq\":{\"type\":\"Object\",\"defaultValue\":\"datauaceopzfqrhhu\"},\"ahzxctobgbk\":{\"type\":\"String\",\"defaultValue\":\"dataz\"},\"grcfb\":{\"type\":\"String\",\"defaultValue\":\"dataizpost\"}},\"annotations\":[\"datamfqjhhkxbp\",\"datajy\",\"datajhxxjyn\",\"datau\"],\"\":{\"szjfauvjfdxxivet\":\"datakrtswbxqz\"}},\"name\":\"cqaqtdoqmcbx\",\"type\":\"vxysl\",\"etag\":\"hsfxoblytkb\",\"id\":\"pe\"},{\"properties\":{\"type\":\"LinkedService\",\"connectVia\":{\"referenceName\":\"wfbkrvrns\",\"parameters\":{\"ohxcrsbfova\":\"dataq\",\"sub\":\"datarruvwbhsq\",\"rxbpyb\":\"datagjb\",\"twss\":\"datarfbjf\"}},\"description\":\"ftpvjzbexil\",\"parameters\":{\"vwpm\":{\"type\":\"SecureString\",\"defaultValue\":\"dataq\"},\"jhwqytjrybnw\":{\"type\":\"String\",\"defaultValue\":\"dataruoujmk\"}},\"annotations\":[\"datagdrjervnaenqpe\",\"dataindoygmifthnzd\",\"datadslgnayqigynduh\",\"datavhqlkthumaqo\"],\"\":{\"gccymvaolpssl\":\"dataycduier\",\"d\":\"datalfmmdnbbglzpswi\"}},\"name\":\"wyhzdx\",\"type\":\"adbzmnvdfznud\",\"etag\":\"dvxzbncblylpst\",\"id\":\"hh\"}],\"nextLink\":\"rzdzucerscdnt\"}") + .toObject(LinkedServiceListResponse.class); + Assertions.assertEquals("pe", model.value().get(0).id()); + Assertions.assertEquals("o", model.value().get(0).properties().connectVia().referenceName()); + Assertions.assertEquals("ellwptfdy", model.value().get(0).properties().description()); + Assertions + .assertEquals(ParameterType.OBJECT, model.value().get(0).properties().parameters().get("opppcqeq").type()); + Assertions.assertEquals("rzdzucerscdnt", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkedServiceListResponse model = + new LinkedServiceListResponse() + .withValue( + Arrays + .asList( + new LinkedServiceResourceInner() + .withId("pe") + .withProperties( + new LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("o") + .withParameters( + mapOf( + "ggdtpnapnyiro", + "datanxknalaulp", + "ylgqgitxmedjvcsl", + "datauhpigvp", + "wwncwzzhxgk", + "datan", + "t", + "datarmgucnap"))) + .withDescription("ellwptfdy") + .withParameters( + mapOf( + "opppcqeq", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("datauaceopzfqrhhu"), + "ahzxctobgbk", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("dataz"), + "grcfb", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("dataizpost"))) + .withAnnotations( + Arrays.asList("datamfqjhhkxbp", "datajy", "datajhxxjyn", "datau")) + .withAdditionalProperties(mapOf("type", "LinkedService"))), + new LinkedServiceResourceInner() + .withId("hh") + .withProperties( + new LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("wfbkrvrns") + .withParameters( + mapOf( + "ohxcrsbfova", + "dataq", + "sub", + "datarruvwbhsq", + "rxbpyb", + "datagjb", + "twss", + "datarfbjf"))) + .withDescription("ftpvjzbexil") + .withParameters( + mapOf( + "vwpm", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("dataq"), + "jhwqytjrybnw", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("dataruoujmk"))) + .withAnnotations( + Arrays + .asList( + "datagdrjervnaenqpe", + "dataindoygmifthnzd", + "datadslgnayqigynduh", + "datavhqlkthumaqo")) + .withAdditionalProperties(mapOf("type", "LinkedService"))))) + .withNextLink("rzdzucerscdnt"); + model = BinaryData.fromObject(model).toObject(LinkedServiceListResponse.class); + Assertions.assertEquals("pe", model.value().get(0).id()); + Assertions.assertEquals("o", model.value().get(0).properties().connectVia().referenceName()); + Assertions.assertEquals("ellwptfdy", model.value().get(0).properties().description()); + Assertions + .assertEquals(ParameterType.OBJECT, model.value().get(0).properties().parameters().get("opppcqeq").type()); + Assertions.assertEquals("rzdzucerscdnt", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceReferenceTests.java new file mode 100644 index 000000000000..0486cdaf7d57 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceReferenceTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LinkedServiceReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkedServiceReference model = + BinaryData + .fromString( + "{\"referenceName\":\"niodkooeb\",\"parameters\":{\"vdkcrodtj\":\"datajhemms\",\"lfoakg\":\"datanfwjlfltkacjvefk\",\"pulpqblylsyxk\":\"datakfpagao\",\"zuempsbzkf\":\"datajnsjervtiagxsd\"}}") + .toObject(LinkedServiceReference.class); + Assertions.assertEquals("niodkooeb", model.referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkedServiceReference model = + new LinkedServiceReference() + .withReferenceName("niodkooeb") + .withParameters( + mapOf( + "vdkcrodtj", + "datajhemms", + "lfoakg", + "datanfwjlfltkacjvefk", + "pulpqblylsyxk", + "datakfpagao", + "zuempsbzkf", + "datajnsjervtiagxsd")); + model = BinaryData.fromObject(model).toObject(LinkedServiceReference.class); + Assertions.assertEquals("niodkooeb", model.referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceResourceInnerTests.java new file mode 100644 index 000000000000..6a6ac861b268 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceResourceInnerTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.LinkedServiceResourceInner; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedService; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LinkedServiceResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkedServiceResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"LinkedService\",\"connectVia\":{\"referenceName\":\"vfiwjmygtdss\",\"parameters\":{\"emwabnet\":\"datatmweriofzpyq\",\"d\":\"datahhszh\"}},\"description\":\"vwiwubmwmbesld\",\"parameters\":{\"flcxoga\":{\"type\":\"Float\",\"defaultValue\":\"datapp\"},\"qzeqqkdltfzxm\":{\"type\":\"SecureString\",\"defaultValue\":\"datanzmnsikvm\"}},\"annotations\":[\"datahgure\"],\"\":{\"xwak\":\"datawobdagxtibqdx\",\"lbpodxunk\":\"dataogqxndlkzgxhuri\",\"lrb\":\"dataebxmubyynt\"}},\"name\":\"koievseo\",\"type\":\"q\",\"etag\":\"ltmuwlauwzizx\",\"id\":\"pgcjefuzmuvp\"}") + .toObject(LinkedServiceResourceInner.class); + Assertions.assertEquals("pgcjefuzmuvp", model.id()); + Assertions.assertEquals("vfiwjmygtdss", model.properties().connectVia().referenceName()); + Assertions.assertEquals("vwiwubmwmbesld", model.properties().description()); + Assertions.assertEquals(ParameterType.FLOAT, model.properties().parameters().get("flcxoga").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkedServiceResourceInner model = + new LinkedServiceResourceInner() + .withId("pgcjefuzmuvp") + .withProperties( + new LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("vfiwjmygtdss") + .withParameters(mapOf("emwabnet", "datatmweriofzpyq", "d", "datahhszh"))) + .withDescription("vwiwubmwmbesld") + .withParameters( + mapOf( + "flcxoga", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datapp"), + "qzeqqkdltfzxm", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datanzmnsikvm"))) + .withAnnotations(Arrays.asList("datahgure")) + .withAdditionalProperties(mapOf("type", "LinkedService"))); + model = BinaryData.fromObject(model).toObject(LinkedServiceResourceInner.class); + Assertions.assertEquals("pgcjefuzmuvp", model.id()); + Assertions.assertEquals("vfiwjmygtdss", model.properties().connectVia().referenceName()); + Assertions.assertEquals("vwiwubmwmbesld", model.properties().description()); + Assertions.assertEquals(ParameterType.FLOAT, model.properties().parameters().get("flcxoga").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceTests.java new file mode 100644 index 000000000000..ca8ad0a1f22f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServiceTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedService; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LinkedServiceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkedService model = + BinaryData + .fromString( + "{\"type\":\"LinkedService\",\"connectVia\":{\"referenceName\":\"tdum\",\"parameters\":{\"hjpglkf\":\"datapxebmnzbt\"}},\"description\":\"hdneuelfph\",\"parameters\":{\"uvxzxclvi\":{\"type\":\"Array\",\"defaultValue\":\"dataozfikdowwq\"},\"dsjnka\":{\"type\":\"String\",\"defaultValue\":\"dataqzonosggbhcohf\"},\"k\":{\"type\":\"String\",\"defaultValue\":\"datatiiswacffg\"},\"ppfufl\":{\"type\":\"Bool\",\"defaultValue\":\"datawkfvhqcrailvp\"}},\"annotations\":[\"datamh\",\"datalxyjr\",\"datasag\"],\"\":{\"bcvkcvqvpkeq\":\"datanihgwqapnedg\",\"obzdopcjwvnhdl\":\"datacvdrhvoodsot\",\"mutwuoe\":\"datawmgxcxrsl\",\"yqsluic\":\"datarpkhjwn\"}}") + .toObject(LinkedService.class); + Assertions.assertEquals("tdum", model.connectVia().referenceName()); + Assertions.assertEquals("hdneuelfph", model.description()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("uvxzxclvi").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkedService model = + new LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("tdum") + .withParameters(mapOf("hjpglkf", "datapxebmnzbt"))) + .withDescription("hdneuelfph") + .withParameters( + mapOf( + "uvxzxclvi", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataozfikdowwq"), + "dsjnka", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("dataqzonosggbhcohf"), + "k", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datatiiswacffg"), + "ppfufl", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datawkfvhqcrailvp"))) + .withAnnotations(Arrays.asList("datamh", "datalxyjr", "datasag")) + .withAdditionalProperties(mapOf("type", "LinkedService")); + model = BinaryData.fromObject(model).toObject(LinkedService.class); + Assertions.assertEquals("tdum", model.connectVia().referenceName()); + Assertions.assertEquals("hdneuelfph", model.description()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("uvxzxclvi").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..46008cb0d94b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.LinkedService; +import com.azure.resourcemanager.datafactory.models.LinkedServiceResource; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +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 org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class LinkedServicesCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"LinkedService\",\"connectVia\":{\"referenceName\":\"idhkigs\",\"parameters\":{\"ztsgklu\":\"datakzl\",\"xbyedca\":\"dataaxcbfrnttlrumv\"}},\"description\":\"jpjnnh\",\"parameters\":{\"icp\":{\"type\":\"SecureString\",\"defaultValue\":\"datamqxbauzvxe\"},\"o\":{\"type\":\"Bool\",\"defaultValue\":\"datacvmuqx\"}},\"annotations\":[\"datajrtcifxledjpu\",\"dataai\",\"datacvsjcdmnvtpb\"],\"\":{\"fvplfywcbnmzshmq\":\"datacaaqvsda\",\"bvqsqwuwxtqdtv\":\"datan\"}},\"name\":\"ilqscjxpro\",\"type\":\"yddrs\",\"etag\":\"rxnweiytkeqjviaw\",\"id\":\"vbc\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + LinkedServiceResource response = + manager + .linkedServices() + .define("uqtjcyllpas") + .withExistingFactory("uwbnngcdtxxyz", "ybndiqpadhrij") + .withProperties( + new LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("qsfpctq") + .withParameters(mapOf("squ", "databjjde"))) + .withDescription("rnbdzvcabchdzxj") + .withParameters( + mapOf( + "lsak", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datawaadczwmnfavllbs"), + "ppzbdvawbtgvqt", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("dataxpofvhkceaxo"), + "guhsjlroaedswh", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datanaeclrjscdoqocdr"), + "yjtollugzsvzi", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datajuuboyrf"))) + .withAnnotations(Arrays.asList("datasbdaudsvdb", "datallmutwmarfbszlp", "datax")) + .withAdditionalProperties(mapOf("type", "LinkedService"))) + .withIfMatch("nbxgofiphlwyzd") + .create(); + + Assertions.assertEquals("vbc", response.id()); + Assertions.assertEquals("idhkigs", response.properties().connectVia().referenceName()); + Assertions.assertEquals("jpjnnh", response.properties().description()); + Assertions.assertEquals(ParameterType.SECURE_STRING, response.properties().parameters().get("icp").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..d76f53aed703 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class LinkedServicesDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .linkedServices() + .deleteWithResponse("mezdoyg", "ofhinehh", "rbgmxmvxbaaznu", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesGetWithResponseMockTests.java new file mode 100644 index 000000000000..f7cd72080f3a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesGetWithResponseMockTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.LinkedServiceResource; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class LinkedServicesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"LinkedService\",\"connectVia\":{\"referenceName\":\"tkzvti\",\"parameters\":{\"vfwwevyfz\":\"datarmgc\"}},\"description\":\"exivqaqztt\",\"parameters\":{\"ql\":{\"type\":\"Array\",\"defaultValue\":\"dataiznriqucolpos\"},\"ojpalnzrj\":{\"type\":\"String\",\"defaultValue\":\"datak\"},\"xjh\":{\"type\":\"Array\",\"defaultValue\":\"datahtyney\"},\"tcupo\":{\"type\":\"SecureString\",\"defaultValue\":\"datawsnqktbgudfcr\"}},\"annotations\":[\"datargcl\",\"dataqkufqjmylrtnzyos\",\"datavkqezeeeuligu\",\"dataw\"],\"\":{\"wxzxroht\":\"dataucvwz\",\"idspe\":\"datac\",\"cmcqslngmsip\":\"dataxdeaisk\"}},\"name\":\"jn\",\"type\":\"cotjdcxacge\",\"etag\":\"fpfaaahxphuplf\",\"id\":\"qgcadntzfjldnvf\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + LinkedServiceResource response = + manager + .linkedServices() + .getWithResponse("owubkiocjn", "rnwkt", "sckcnge", "xdxuzoxmajp", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("qgcadntzfjldnvf", response.id()); + Assertions.assertEquals("tkzvti", response.properties().connectVia().referenceName()); + Assertions.assertEquals("exivqaqztt", response.properties().description()); + Assertions.assertEquals(ParameterType.ARRAY, response.properties().parameters().get("ql").type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesListByFactoryMockTests.java new file mode 100644 index 000000000000..c5a5db276389 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LinkedServicesListByFactoryMockTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.LinkedServiceResource; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class LinkedServicesListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"type\":\"LinkedService\",\"connectVia\":{\"referenceName\":\"sqbyubswzafqrmwd\",\"parameters\":{\"uxwvjcdjvlwczw\":\"datafspzwad\",\"fckrmrbaoidt\":\"datakkscooqnvht\",\"cbvkoughjsxp\":\"datam\"}},\"description\":\"svppfdnih\",\"parameters\":{\"z\":{\"type\":\"Bool\",\"defaultValue\":\"datatsbpvyvsc\"},\"ohfvbgjn\":{\"type\":\"SecureString\",\"defaultValue\":\"dataddaqqklvyib\"},\"j\":{\"type\":\"Bool\",\"defaultValue\":\"datalsanglwnkkz\"},\"ajyrhrywucpdzbnt\":{\"type\":\"Int\",\"defaultValue\":\"datarhjj\"}},\"annotations\":[\"datawnpuyhqayls\",\"dataehlzplzrrhab\",\"datadqnefofujzwqpkhg\",\"datadgyilo\"],\"\":{\"etrglp\":\"datakvufnphbzssa\"}},\"name\":\"cqxdvleo\",\"type\":\"vuhagoqxfxje\",\"etag\":\"oqua\",\"id\":\"dnmhrymeynbi\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.linkedServices().listByFactory("lcalyvcxvcpxdeq", "tblt", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("dnmhrymeynbi", response.iterator().next().id()); + Assertions + .assertEquals("sqbyubswzafqrmwd", response.iterator().next().properties().connectVia().referenceName()); + Assertions.assertEquals("svppfdnih", response.iterator().next().properties().description()); + Assertions + .assertEquals(ParameterType.BOOL, response.iterator().next().properties().parameters().get("z").type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LogLocationSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LogLocationSettingsTests.java new file mode 100644 index 000000000000..55cc54c9ed85 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LogLocationSettingsTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogLocationSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LogLocationSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogLocationSettings model = + BinaryData + .fromString( + "{\"linkedServiceName\":{\"referenceName\":\"x\",\"parameters\":{\"fapfbmrwhknefcoo\":\"datavgtoinozsmyv\",\"pdd\":\"datatmd\",\"laxuybxjwny\":\"datagupiosibg\",\"fiksjpkig\":\"dataskyrttnrikss\"}},\"path\":\"datatoqtui\"}") + .toObject(LogLocationSettings.class); + Assertions.assertEquals("x", model.linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogLocationSettings model = + new LogLocationSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("x") + .withParameters( + mapOf( + "fapfbmrwhknefcoo", + "datavgtoinozsmyv", + "pdd", + "datatmd", + "laxuybxjwny", + "datagupiosibg", + "fiksjpkig", + "dataskyrttnrikss"))) + .withPath("datatoqtui"); + model = BinaryData.fromObject(model).toObject(LogLocationSettings.class); + Assertions.assertEquals("x", model.linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LogSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LogSettingsTests.java new file mode 100644 index 000000000000..3a1aababb04b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LogSettingsTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CopyActivityLogSettings; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogLocationSettings; +import com.azure.resourcemanager.datafactory.models.LogSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LogSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogSettings model = + BinaryData + .fromString( + "{\"enableCopyActivityLog\":\"datavhcbu\",\"copyActivityLogSettings\":{\"logLevel\":\"dataifzfjtock\",\"enableReliableLogging\":\"dataaawyy\"},\"logLocationSettings\":{\"linkedServiceName\":{\"referenceName\":\"zwoeqljlwfq\",\"parameters\":{\"sipkhqh\":\"dataww\"}},\"path\":\"datatcztmqdkhohspkgx\"}}") + .toObject(LogSettings.class); + Assertions.assertEquals("zwoeqljlwfq", model.logLocationSettings().linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogSettings model = + new LogSettings() + .withEnableCopyActivityLog("datavhcbu") + .withCopyActivityLogSettings( + new CopyActivityLogSettings().withLogLevel("dataifzfjtock").withEnableReliableLogging("dataaawyy")) + .withLogLocationSettings( + new LogLocationSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("zwoeqljlwfq") + .withParameters(mapOf("sipkhqh", "dataww"))) + .withPath("datatcztmqdkhohspkgx")); + model = BinaryData.fromObject(model).toObject(LogSettings.class); + Assertions.assertEquals("zwoeqljlwfq", model.logLocationSettings().linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LogStorageSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LogStorageSettingsTests.java new file mode 100644 index 000000000000..b529e81bbe3d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LogStorageSettingsTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogStorageSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LogStorageSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogStorageSettings model = + BinaryData + .fromString( + "{\"linkedServiceName\":{\"referenceName\":\"kqjzfzk\",\"parameters\":{\"lkaipfyvqua\":\"datapnmrxjdfk\"}},\"path\":\"dataywkbiek\",\"logLevel\":\"dataakqahopgnapkp\",\"enableReliableLogging\":\"dataedoxvoa\",\"\":{\"wclmz\":\"datae\",\"lrcdi\":\"datalrvlg\"}}") + .toObject(LogStorageSettings.class); + Assertions.assertEquals("kqjzfzk", model.linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogStorageSettings model = + new LogStorageSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("kqjzfzk") + .withParameters(mapOf("lkaipfyvqua", "datapnmrxjdfk"))) + .withPath("dataywkbiek") + .withLogLevel("dataakqahopgnapkp") + .withEnableReliableLogging("dataedoxvoa") + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(LogStorageSettings.class); + Assertions.assertEquals("kqjzfzk", model.linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LookupActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LookupActivityTests.java new file mode 100644 index 000000000000..151e07357c5c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LookupActivityTests.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.CopySource; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LookupActivity; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LookupActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LookupActivity model = + BinaryData + .fromString( + "{\"type\":\"Lookup\",\"typeProperties\":{\"source\":{\"type\":\"CopySource\",\"sourceRetryCount\":\"databx\",\"sourceRetryWait\":\"dataygmqnuyusnhnnek\",\"maxConcurrentConnections\":\"datadlbcucwfcbugtc\",\"disableMetricsCollection\":\"dataydldavozmibtk\",\"\":{\"xxwt\":\"datapgllsrran\",\"lkgzczjwizrulrk\":\"datarro\"}},\"dataset\":{\"referenceName\":\"yldtt\",\"parameters\":{\"myc\":\"datapqmkpobenaahdj\",\"qhpphjimo\":\"datatvpeirhstwpbvw\",\"js\":\"datacqpqkpnvsuaizxdl\",\"gfejiu\":\"dataxotyjgx\"}},\"firstRowOnly\":\"datadsftmllc\"},\"linkedServiceName\":{\"referenceName\":\"vunvnggqacforuw\",\"parameters\":{\"ruuscb\":\"datand\",\"vofo\":\"datattjdioevifzqq\",\"jxsofsiritp\":\"datappphwvduuzpiooa\",\"nrl\":\"dataqp\"}},\"policy\":{\"timeout\":\"dataxevizzcjnfyubctw\",\"retry\":\"datan\",\"retryIntervalInSeconds\":1577241932,\"secureInput\":true,\"secureOutput\":true,\"\":{\"riad\":\"datafpkleieafpvbslly\",\"uylsk\":\"datanbofeucctppbgzf\",\"trqsobusurxv\":\"datavvwd\",\"tknywxpmef\":\"datadxlbsnskcksf\"}},\"name\":\"nccbvchozkmifyxd\",\"description\":\"gbi\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"rkw\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Completed\",\"Failed\"],\"\":{\"syhnfqnek\":\"databulvk\",\"deahfg\":\"dataxd\",\"lq\":\"datajahnsmktk\",\"xnlaurviyntc\":\"dataxjdolobtzr\"}},{\"activity\":\"lpbzo\",\"dependencyConditions\":[\"Completed\",\"Succeeded\"],\"\":{\"daxttoenf\":\"databfktelblbungrkj\",\"jfywmmqzbznr\":\"datahip\"}},{\"activity\":\"w\",\"dependencyConditions\":[\"Skipped\",\"Skipped\",\"Succeeded\"],\"\":{\"wotpiaklefw\":\"datagnkxjdaxdiundz\",\"dcgd\":\"dataiabfntrmkeawmfe\",\"ngiuzbpgskg\":\"datajbnfwdff\"}},{\"activity\":\"wspxhhnvxpzjtik\",\"dependencyConditions\":[\"Failed\"],\"\":{\"akgzcmbgw\":\"datawefstize\",\"jpxpwxabvxwoa\":\"datalnmddflckum\",\"ozkm\":\"dataoeillszdgy\",\"yrwdmgrfhvew\":\"databzuilynbdvbuxlji\"}}],\"userProperties\":[{\"name\":\"mybokqpfhswbpjz\",\"value\":\"datayzydlys\"},{\"name\":\"thpnw\",\"value\":\"datapkisefygdaume\"},{\"name\":\"kgmgqynejqk\",\"value\":\"datasxiczvfxoihc\"}],\"\":{\"ecwyrtluujyespcg\":\"dataxbksaf\",\"iwiaqrc\":\"dataszwvooxieyyww\",\"w\":\"datafybktbviaqvzzszc\",\"vygdefpy\":\"datarxo\"}}") + .toObject(LookupActivity.class); + Assertions.assertEquals("nccbvchozkmifyxd", model.name()); + Assertions.assertEquals("gbi", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("rkw", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("mybokqpfhswbpjz", model.userProperties().get(0).name()); + Assertions.assertEquals("vunvnggqacforuw", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1577241932, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("yldtt", model.dataset().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LookupActivity model = + new LookupActivity() + .withName("nccbvchozkmifyxd") + .withDescription("gbi") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("rkw") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("lpbzo") + .withDependencyConditions( + Arrays.asList(DependencyCondition.COMPLETED, DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("w") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("wspxhhnvxpzjtik") + .withDependencyConditions(Arrays.asList(DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("mybokqpfhswbpjz").withValue("datayzydlys"), + new UserProperty().withName("thpnw").withValue("datapkisefygdaume"), + new UserProperty().withName("kgmgqynejqk").withValue("datasxiczvfxoihc"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("vunvnggqacforuw") + .withParameters( + mapOf( + "ruuscb", + "datand", + "vofo", + "datattjdioevifzqq", + "jxsofsiritp", + "datappphwvduuzpiooa", + "nrl", + "dataqp"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("dataxevizzcjnfyubctw") + .withRetry("datan") + .withRetryIntervalInSeconds(1577241932) + .withSecureInput(true) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withSource( + new CopySource() + .withSourceRetryCount("databx") + .withSourceRetryWait("dataygmqnuyusnhnnek") + .withMaxConcurrentConnections("datadlbcucwfcbugtc") + .withDisableMetricsCollection("dataydldavozmibtk") + .withAdditionalProperties(mapOf("type", "CopySource"))) + .withDataset( + new DatasetReference() + .withReferenceName("yldtt") + .withParameters( + mapOf( + "myc", + "datapqmkpobenaahdj", + "qhpphjimo", + "datatvpeirhstwpbvw", + "js", + "datacqpqkpnvsuaizxdl", + "gfejiu", + "dataxotyjgx"))) + .withFirstRowOnly("datadsftmllc"); + model = BinaryData.fromObject(model).toObject(LookupActivity.class); + Assertions.assertEquals("nccbvchozkmifyxd", model.name()); + Assertions.assertEquals("gbi", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("rkw", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("mybokqpfhswbpjz", model.userProperties().get(0).name()); + Assertions.assertEquals("vunvnggqacforuw", model.linkedServiceName().referenceName()); + Assertions.assertEquals(1577241932, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals("yldtt", model.dataset().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LookupActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LookupActivityTypePropertiesTests.java new file mode 100644 index 000000000000..1f0ddc4b20fc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/LookupActivityTypePropertiesTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.LookupActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.CopySource; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LookupActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LookupActivityTypeProperties model = + BinaryData + .fromString( + "{\"source\":{\"type\":\"CopySource\",\"sourceRetryCount\":\"datawwaxx\",\"sourceRetryWait\":\"datardsmra\",\"maxConcurrentConnections\":\"datat\",\"disableMetricsCollection\":\"datapxmdwdlboc\",\"\":{\"wbyrkxzebv\":\"datanqcgbijyp\",\"wzzeumadl\":\"datauzchegeogdkcrc\"}},\"dataset\":{\"referenceName\":\"xirewhuqk\",\"parameters\":{\"lbq\":\"datamyykmk\",\"dvksigxak\":\"datanrmgefxkattpkkw\",\"ooqobpnkvn\":\"dataoptb\"}},\"firstRowOnly\":\"datajrxbbxkh\"}") + .toObject(LookupActivityTypeProperties.class); + Assertions.assertEquals("xirewhuqk", model.dataset().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LookupActivityTypeProperties model = + new LookupActivityTypeProperties() + .withSource( + new CopySource() + .withSourceRetryCount("datawwaxx") + .withSourceRetryWait("datardsmra") + .withMaxConcurrentConnections("datat") + .withDisableMetricsCollection("datapxmdwdlboc") + .withAdditionalProperties(mapOf("type", "CopySource"))) + .withDataset( + new DatasetReference() + .withReferenceName("xirewhuqk") + .withParameters( + mapOf("lbq", "datamyykmk", "dvksigxak", "datanrmgefxkattpkkw", "ooqobpnkvn", "dataoptb"))) + .withFirstRowOnly("datajrxbbxkh"); + model = BinaryData.fromObject(model).toObject(LookupActivityTypeProperties.class); + Assertions.assertEquals("xirewhuqk", model.dataset().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MagentoObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MagentoObjectDatasetTests.java new file mode 100644 index 000000000000..4ede61e0d30d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MagentoObjectDatasetTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MagentoObjectDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MagentoObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MagentoObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"MagentoObject\",\"typeProperties\":{\"tableName\":\"dataznlf\"},\"description\":\"fzx\",\"structure\":\"dataz\",\"schema\":\"dataugtkxncwdytnlr\",\"linkedServiceName\":{\"referenceName\":\"cmwbejywwwvn\",\"parameters\":{\"dfyziruqvgnjxi\":\"datakrmqevrhhafqf\",\"gikyluyu\":\"datakgyjmzbm\",\"c\":\"datambrdcvoloxtv\"}},\"parameters\":{\"vokkyankxvcpt\":{\"type\":\"Object\",\"defaultValue\":\"datammglvnbenkp\"},\"rdxpcpautfzptr\":{\"type\":\"Int\",\"defaultValue\":\"databhnkxasomafegazh\"}},\"annotations\":[\"dataytrtffvpkdx\",\"datayuwenbq\"],\"folder\":{\"name\":\"awvoqatdjkal\"},\"\":{\"smxfzynfemqy\":\"datae\",\"wgssdquupirnb\":\"datakkp\",\"irzyudrq\":\"datalqyvdsqxkjwdzp\"}}") + .toObject(MagentoObjectDataset.class); + Assertions.assertEquals("fzx", model.description()); + Assertions.assertEquals("cmwbejywwwvn", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("vokkyankxvcpt").type()); + Assertions.assertEquals("awvoqatdjkal", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MagentoObjectDataset model = + new MagentoObjectDataset() + .withDescription("fzx") + .withStructure("dataz") + .withSchema("dataugtkxncwdytnlr") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("cmwbejywwwvn") + .withParameters( + mapOf( + "dfyziruqvgnjxi", + "datakrmqevrhhafqf", + "gikyluyu", + "datakgyjmzbm", + "c", + "datambrdcvoloxtv"))) + .withParameters( + mapOf( + "vokkyankxvcpt", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datammglvnbenkp"), + "rdxpcpautfzptr", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("databhnkxasomafegazh"))) + .withAnnotations(Arrays.asList("dataytrtffvpkdx", "datayuwenbq")) + .withFolder(new DatasetFolder().withName("awvoqatdjkal")) + .withTableName("dataznlf"); + model = BinaryData.fromObject(model).toObject(MagentoObjectDataset.class); + Assertions.assertEquals("fzx", model.description()); + Assertions.assertEquals("cmwbejywwwvn", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("vokkyankxvcpt").type()); + Assertions.assertEquals("awvoqatdjkal", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MagentoSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MagentoSourceTests.java new file mode 100644 index 000000000000..85183b0bb2f4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MagentoSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MagentoSource; + +public final class MagentoSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MagentoSource model = + BinaryData + .fromString( + "{\"type\":\"MagentoSource\",\"query\":\"dataqpifzavct\",\"queryTimeout\":\"dataappaczprz\",\"additionalColumns\":\"dataq\",\"sourceRetryCount\":\"datagvnpgsqlanuh\",\"sourceRetryWait\":\"datarnpsoagho\",\"maxConcurrentConnections\":\"dataiwpdx\",\"disableMetricsCollection\":\"datalsoaj\",\"\":{\"bwl\":\"dataplhstopy\",\"gqjdoglec\":\"datasvpi\"}}") + .toObject(MagentoSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MagentoSource model = + new MagentoSource() + .withSourceRetryCount("datagvnpgsqlanuh") + .withSourceRetryWait("datarnpsoagho") + .withMaxConcurrentConnections("dataiwpdx") + .withDisableMetricsCollection("datalsoaj") + .withQueryTimeout("dataappaczprz") + .withAdditionalColumns("dataq") + .withQuery("dataqpifzavct"); + model = BinaryData.fromObject(model).toObject(MagentoSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedIdentityCredentialResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedIdentityCredentialResourceInnerTests.java new file mode 100644 index 000000000000..cbe366011185 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedIdentityCredentialResourceInnerTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ManagedIdentityCredentialResourceInner; +import com.azure.resourcemanager.datafactory.models.ManagedIdentityCredential; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ManagedIdentityCredentialResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedIdentityCredentialResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"ManagedIdentity\",\"typeProperties\":{\"resourceId\":\"gpgdphtvdulaj\"},\"description\":\"ejchcsrlz\",\"annotations\":[\"datazlanrupdwvnph\",\"datanzqtpjhmqrhvt\"],\"\":{\"xetlgydlhqv\":\"dataiwdcxsmlzzhzd\",\"pxy\":\"datan\",\"klbyulidwcw\":\"dataafiqgeaarbgjekg\",\"hj\":\"datamzegjon\"}},\"name\":\"wgdnqzbr\",\"type\":\"spzhzmtksjc\",\"etag\":\"digsxcdgl\",\"id\":\"lkeuac\"}") + .toObject(ManagedIdentityCredentialResourceInner.class); + Assertions.assertEquals("lkeuac", model.id()); + Assertions.assertEquals("ejchcsrlz", model.properties().description()); + Assertions.assertEquals("gpgdphtvdulaj", model.properties().resourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedIdentityCredentialResourceInner model = + new ManagedIdentityCredentialResourceInner() + .withId("lkeuac") + .withProperties( + new ManagedIdentityCredential() + .withDescription("ejchcsrlz") + .withAnnotations(Arrays.asList("datazlanrupdwvnph", "datanzqtpjhmqrhvt")) + .withResourceId("gpgdphtvdulaj")); + model = BinaryData.fromObject(model).toObject(ManagedIdentityCredentialResourceInner.class); + Assertions.assertEquals("lkeuac", model.id()); + Assertions.assertEquals("ejchcsrlz", model.properties().description()); + Assertions.assertEquals("gpgdphtvdulaj", model.properties().resourceId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedIdentityCredentialTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedIdentityCredentialTests.java new file mode 100644 index 000000000000..348a2f5e8047 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedIdentityCredentialTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ManagedIdentityCredential; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ManagedIdentityCredentialTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedIdentityCredential model = + BinaryData + .fromString( + "{\"type\":\"ManagedIdentity\",\"typeProperties\":{\"resourceId\":\"mflrytswfpfmdgyc\"},\"description\":\"mskwhqjjysl\",\"annotations\":[\"datapshhkvpedwqslsr\",\"datampqvwwsk\",\"datandcbrwi\",\"datauvqejosovyrrle\"],\"\":{\"bbpihehcecy\":\"datainuqtljq\",\"kfrexcrseqwjks\":\"datamrqbrjbbmpxdlv\",\"zhxogjggsvo\":\"datahud\",\"hrkmdyomkxfbvfbh\":\"datajkxibda\"}}") + .toObject(ManagedIdentityCredential.class); + Assertions.assertEquals("mskwhqjjysl", model.description()); + Assertions.assertEquals("mflrytswfpfmdgyc", model.resourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedIdentityCredential model = + new ManagedIdentityCredential() + .withDescription("mskwhqjjysl") + .withAnnotations( + Arrays.asList("datapshhkvpedwqslsr", "datampqvwwsk", "datandcbrwi", "datauvqejosovyrrle")) + .withResourceId("mflrytswfpfmdgyc"); + model = BinaryData.fromObject(model).toObject(ManagedIdentityCredential.class); + Assertions.assertEquals("mskwhqjjysl", model.description()); + Assertions.assertEquals("mflrytswfpfmdgyc", model.resourceId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedIdentityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedIdentityTypePropertiesTests.java new file mode 100644 index 000000000000..2b443a5dd978 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedIdentityTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ManagedIdentityTypeProperties; +import org.junit.jupiter.api.Assertions; + +public final class ManagedIdentityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedIdentityTypeProperties model = + BinaryData.fromString("{\"resourceId\":\"i\"}").toObject(ManagedIdentityTypeProperties.class); + Assertions.assertEquals("i", model.resourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedIdentityTypeProperties model = new ManagedIdentityTypeProperties().withResourceId("i"); + model = BinaryData.fromObject(model).toObject(ManagedIdentityTypeProperties.class); + Assertions.assertEquals("i", model.resourceId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointListResponseTests.java new file mode 100644 index 000000000000..497b8c7c63f3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointListResponseTests.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ManagedPrivateEndpointResourceInner; +import com.azure.resourcemanager.datafactory.models.ConnectionStateProperties; +import com.azure.resourcemanager.datafactory.models.ManagedPrivateEndpoint; +import com.azure.resourcemanager.datafactory.models.ManagedPrivateEndpointListResponse; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedPrivateEndpointListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedPrivateEndpointListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"connectionState\":{\"actionsRequired\":\"wdkqzeqy\",\"description\":\"eziunjxdfzant\",\"status\":\"cegyamlbnseqacj\"},\"fqdns\":[\"ilguooqjagmditg\",\"eiookjbsah\",\"tdtpdelqacslmo\"],\"groupId\":\"ebnfxofvc\",\"isReserved\":false,\"privateLinkResourceId\":\"irazftxejwabmd\",\"provisioningState\":\"tmvcop\",\"\":{\"urbuhhlkyqltq\":\"datam\"}},\"name\":\"ogtu\",\"type\":\"ffdjktsysidfvclg\",\"etag\":\"n\",\"id\":\"ijtk\"},{\"properties\":{\"connectionState\":{\"actionsRequired\":\"qogsfikayian\",\"description\":\"arujt\",\"status\":\"qxfzyjqttvwk\"},\"fqdns\":[\"j\",\"enuygbq\",\"qqekewvnqvcdlgu\"],\"groupId\":\"cmfdjwnlax\",\"isReserved\":false,\"privateLinkResourceId\":\"qikczvvita\",\"provisioningState\":\"xmfcsserxhtv\",\"\":{\"sxypruuu\":\"datahlwntsjgq\"}},\"name\":\"nchrszizoyu\",\"type\":\"yetnd\",\"etag\":\"fqyggagflnlgmtr\",\"id\":\"hzjmucftbyrp\"},{\"properties\":{\"connectionState\":{\"actionsRequired\":\"hkpigqfusuckzmkw\",\"description\":\"snoxaxmqeqa\",\"status\":\"hjnhgwydyynfsvk\"},\"fqdns\":[\"vqtanarfdlpuk\"],\"groupId\":\"yrneizjcpeo\",\"isReserved\":true,\"privateLinkResourceId\":\"mgbro\",\"provisioningState\":\"ddbhf\",\"\":{\"zoyw\":\"datapaz\",\"htuevrhrljy\":\"dataxhpdulontacnpqwt\",\"reur\":\"dataogwxhnsduugwb\",\"fuarenlvhht\":\"dataq\"}},\"name\":\"nvnaf\",\"type\":\"kyfede\",\"etag\":\"bo\",\"id\":\"cqxypokkhminq\"}],\"nextLink\":\"mczngn\"}") + .toObject(ManagedPrivateEndpointListResponse.class); + Assertions.assertEquals("ijtk", model.value().get(0).id()); + Assertions.assertEquals("ilguooqjagmditg", model.value().get(0).properties().fqdns().get(0)); + Assertions.assertEquals("ebnfxofvc", model.value().get(0).properties().groupId()); + Assertions.assertEquals("irazftxejwabmd", model.value().get(0).properties().privateLinkResourceId()); + Assertions.assertEquals("mczngn", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedPrivateEndpointListResponse model = + new ManagedPrivateEndpointListResponse() + .withValue( + Arrays + .asList( + new ManagedPrivateEndpointResourceInner() + .withId("ijtk") + .withProperties( + new ManagedPrivateEndpoint() + .withConnectionState(new ConnectionStateProperties()) + .withFqdns(Arrays.asList("ilguooqjagmditg", "eiookjbsah", "tdtpdelqacslmo")) + .withGroupId("ebnfxofvc") + .withPrivateLinkResourceId("irazftxejwabmd") + .withAdditionalProperties( + mapOf("isReserved", false, "provisioningState", "tmvcop"))), + new ManagedPrivateEndpointResourceInner() + .withId("hzjmucftbyrp") + .withProperties( + new ManagedPrivateEndpoint() + .withConnectionState(new ConnectionStateProperties()) + .withFqdns(Arrays.asList("j", "enuygbq", "qqekewvnqvcdlgu")) + .withGroupId("cmfdjwnlax") + .withPrivateLinkResourceId("qikczvvita") + .withAdditionalProperties( + mapOf("isReserved", false, "provisioningState", "xmfcsserxhtv"))), + new ManagedPrivateEndpointResourceInner() + .withId("cqxypokkhminq") + .withProperties( + new ManagedPrivateEndpoint() + .withConnectionState(new ConnectionStateProperties()) + .withFqdns(Arrays.asList("vqtanarfdlpuk")) + .withGroupId("yrneizjcpeo") + .withPrivateLinkResourceId("mgbro") + .withAdditionalProperties( + mapOf("isReserved", true, "provisioningState", "ddbhf"))))) + .withNextLink("mczngn"); + model = BinaryData.fromObject(model).toObject(ManagedPrivateEndpointListResponse.class); + Assertions.assertEquals("ijtk", model.value().get(0).id()); + Assertions.assertEquals("ilguooqjagmditg", model.value().get(0).properties().fqdns().get(0)); + Assertions.assertEquals("ebnfxofvc", model.value().get(0).properties().groupId()); + Assertions.assertEquals("irazftxejwabmd", model.value().get(0).properties().privateLinkResourceId()); + Assertions.assertEquals("mczngn", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointResourceInnerTests.java new file mode 100644 index 000000000000..a2bd8c287044 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointResourceInnerTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ManagedPrivateEndpointResourceInner; +import com.azure.resourcemanager.datafactory.models.ConnectionStateProperties; +import com.azure.resourcemanager.datafactory.models.ManagedPrivateEndpoint; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedPrivateEndpointResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedPrivateEndpointResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"connectionState\":{\"actionsRequired\":\"x\",\"description\":\"unin\",\"status\":\"db\"},\"fqdns\":[\"qdtvqecrqctmxx\",\"tddmf\",\"huytxzvtzn\",\"pxbannovvoxc\"],\"groupId\":\"tprwnw\",\"isReserved\":true,\"privateLinkResourceId\":\"vytlyokrrrouuxvn\",\"provisioningState\":\"sbcrymodizrxklo\",\"\":{\"lmv\":\"datanazpmk\",\"zxlioh\":\"datavfxzopjh\",\"dtfgxqbawpcbb\":\"datad\"}},\"name\":\"qcy\",\"type\":\"apqofyuicdhz\",\"etag\":\"ybww\",\"id\":\"d\"}") + .toObject(ManagedPrivateEndpointResourceInner.class); + Assertions.assertEquals("d", model.id()); + Assertions.assertEquals("qdtvqecrqctmxx", model.properties().fqdns().get(0)); + Assertions.assertEquals("tprwnw", model.properties().groupId()); + Assertions.assertEquals("vytlyokrrrouuxvn", model.properties().privateLinkResourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedPrivateEndpointResourceInner model = + new ManagedPrivateEndpointResourceInner() + .withId("d") + .withProperties( + new ManagedPrivateEndpoint() + .withConnectionState(new ConnectionStateProperties()) + .withFqdns(Arrays.asList("qdtvqecrqctmxx", "tddmf", "huytxzvtzn", "pxbannovvoxc")) + .withGroupId("tprwnw") + .withPrivateLinkResourceId("vytlyokrrrouuxvn") + .withAdditionalProperties(mapOf("isReserved", true, "provisioningState", "sbcrymodizrxklo"))); + model = BinaryData.fromObject(model).toObject(ManagedPrivateEndpointResourceInner.class); + Assertions.assertEquals("d", model.id()); + Assertions.assertEquals("qdtvqecrqctmxx", model.properties().fqdns().get(0)); + Assertions.assertEquals("tprwnw", model.properties().groupId()); + Assertions.assertEquals("vytlyokrrrouuxvn", model.properties().privateLinkResourceId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointTests.java new file mode 100644 index 000000000000..19a660bd0511 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionStateProperties; +import com.azure.resourcemanager.datafactory.models.ManagedPrivateEndpoint; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedPrivateEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedPrivateEndpoint model = + BinaryData + .fromString( + "{\"connectionState\":{\"actionsRequired\":\"idmhmwf\",\"description\":\"lfmu\",\"status\":\"pckc\"},\"fqdns\":[\"vwe\"],\"groupId\":\"xoy\",\"isReserved\":false,\"privateLinkResourceId\":\"haim\",\"provisioningState\":\"iroqbosh\",\"\":{\"pavbo\":\"datagapyyrmfsv\"}}") + .toObject(ManagedPrivateEndpoint.class); + Assertions.assertEquals("vwe", model.fqdns().get(0)); + Assertions.assertEquals("xoy", model.groupId()); + Assertions.assertEquals("haim", model.privateLinkResourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedPrivateEndpoint model = + new ManagedPrivateEndpoint() + .withConnectionState(new ConnectionStateProperties()) + .withFqdns(Arrays.asList("vwe")) + .withGroupId("xoy") + .withPrivateLinkResourceId("haim") + .withAdditionalProperties(mapOf("isReserved", false, "provisioningState", "iroqbosh")); + model = BinaryData.fromObject(model).toObject(ManagedPrivateEndpoint.class); + Assertions.assertEquals("vwe", model.fqdns().get(0)); + Assertions.assertEquals("xoy", model.groupId()); + Assertions.assertEquals("haim", model.privateLinkResourceId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..c7aefb926588 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ConnectionStateProperties; +import com.azure.resourcemanager.datafactory.models.ManagedPrivateEndpoint; +import com.azure.resourcemanager.datafactory.models.ManagedPrivateEndpointResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +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 org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ManagedPrivateEndpointsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"connectionState\":{\"actionsRequired\":\"zzm\",\"description\":\"mh\",\"status\":\"caizxuiyuzufdms\"},\"fqdns\":[\"gnfljvra\",\"k\",\"ecozfauhnxxd\"],\"groupId\":\"hlgrz\",\"isReserved\":true,\"privateLinkResourceId\":\"zmh\",\"provisioningState\":\"twjimlfrkmy\",\"\":{\"wzc\":\"datamglbxoeghordccpk\",\"iqq\":\"datalvqlccaiphsart\",\"vq\":\"datadgyshpvva\",\"oxweuo\":\"datawrchwdxdkvqqtfjj\"}},\"name\":\"w\",\"type\":\"e\",\"etag\":\"ndheocjc\",\"id\":\"cunanwutve\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ManagedPrivateEndpointResource response = + manager + .managedPrivateEndpoints() + .define("bczlrewfrmq") + .withExistingManagedVirtualNetwork("lokn", "adqf", "nrdagmihxjpflzpu") + .withProperties( + new ManagedPrivateEndpoint() + .withConnectionState(new ConnectionStateProperties()) + .withFqdns(Arrays.asList("eelkv", "kig")) + .withGroupId("rkwgsq") + .withPrivateLinkResourceId("cxwthkljk") + .withAdditionalProperties(mapOf("isReserved", true, "provisioningState", "jfcr"))) + .withIfMatch("bmedzfo") + .create(); + + Assertions.assertEquals("cunanwutve", response.id()); + Assertions.assertEquals("gnfljvra", response.properties().fqdns().get(0)); + Assertions.assertEquals("hlgrz", response.properties().groupId()); + Assertions.assertEquals("zmh", response.properties().privateLinkResourceId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..9a5cbac93508 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ManagedPrivateEndpointsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .managedPrivateEndpoints() + .deleteWithResponse("orlaudemzr", "dnus", "jb", "bbg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsGetWithResponseMockTests.java new file mode 100644 index 000000000000..63976dc261fc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsGetWithResponseMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ManagedPrivateEndpointResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ManagedPrivateEndpointsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"connectionState\":{\"actionsRequired\":\"blomidvic\",\"description\":\"ufjahu\",\"status\":\"ebdtcklthsu\"},\"fqdns\":[\"xdhlovktrf\"],\"groupId\":\"p\",\"isReserved\":false,\"privateLinkResourceId\":\"xosbydr\",\"provisioningState\":\"svexpzsxb\",\"\":{\"uah\":\"datajjwtynpbirltz\",\"sdtysnlxw\":\"datalxcdpj\"}},\"name\":\"zezfhfjjjzcxtz\",\"type\":\"loosceuk\",\"etag\":\"oqhphjqkkacw\",\"id\":\"qmxkxfmwbrvsl\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ManagedPrivateEndpointResource response = + manager + .managedPrivateEndpoints() + .getWithResponse("il", "ixwx", "aquuvb", "hgxsfeslxwlmxzo", "bi", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("qmxkxfmwbrvsl", response.id()); + Assertions.assertEquals("xdhlovktrf", response.properties().fqdns().get(0)); + Assertions.assertEquals("p", response.properties().groupId()); + Assertions.assertEquals("xosbydr", response.properties().privateLinkResourceId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsListByFactoryMockTests.java new file mode 100644 index 000000000000..9dd52e58ffa5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedPrivateEndpointsListByFactoryMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ManagedPrivateEndpointResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ManagedPrivateEndpointsListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"connectionState\":{\"actionsRequired\":\"hinjnwpiv\",\"description\":\"lbajqecngw\",\"status\":\"uaxsrmadakjs\"},\"fqdns\":[\"vyvobkkek\"],\"groupId\":\"xc\",\"isReserved\":true,\"privateLinkResourceId\":\"nhotwqkgvrz\",\"provisioningState\":\"mzsutmsmdib\",\"\":{\"dcwtnzfleghnf\":\"datatempsaykcxu\"}},\"name\":\"jwwhsfjqxlbclvp\",\"type\":\"utyrsravsscb\",\"etag\":\"xmscafgdtuzcl\",\"id\":\"vvuy\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .managedPrivateEndpoints() + .listByFactory("pwf", "twgnmeq", "rxwkomjsfkdvb", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("vvuy", response.iterator().next().id()); + Assertions.assertEquals("vyvobkkek", response.iterator().next().properties().fqdns().get(0)); + Assertions.assertEquals("xc", response.iterator().next().properties().groupId()); + Assertions.assertEquals("nhotwqkgvrz", response.iterator().next().properties().privateLinkResourceId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkListResponseTests.java new file mode 100644 index 000000000000..aae823dad94f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkListResponseTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ManagedVirtualNetworkResourceInner; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetwork; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetworkListResponse; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedVirtualNetworkListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedVirtualNetworkListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"vNetId\":\"o\",\"alias\":\"vmfqhppubo\",\"\":{\"juahokqto\":\"datapdfgkmtdherngbt\",\"hfphwpnulaiywze\":\"datakauxof\",\"wrpqafgfugsnnf\":\"dataywhslwkojpllndnp\",\"coc\":\"datayetefyp\"}},\"name\":\"jgtixr\",\"type\":\"zuyt\",\"etag\":\"mlmuowol\",\"id\":\"uir\"}],\"nextLink\":\"ionszonwp\"}") + .toObject(ManagedVirtualNetworkListResponse.class); + Assertions.assertEquals("uir", model.value().get(0).id()); + Assertions.assertEquals("ionszonwp", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedVirtualNetworkListResponse model = + new ManagedVirtualNetworkListResponse() + .withValue( + Arrays + .asList( + new ManagedVirtualNetworkResourceInner() + .withId("uir") + .withProperties( + new ManagedVirtualNetwork() + .withAdditionalProperties(mapOf("vNetId", "o", "alias", "vmfqhppubo"))))) + .withNextLink("ionszonwp"); + model = BinaryData.fromObject(model).toObject(ManagedVirtualNetworkListResponse.class); + Assertions.assertEquals("uir", model.value().get(0).id()); + Assertions.assertEquals("ionszonwp", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkReferenceTests.java new file mode 100644 index 000000000000..c032021a8104 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkReferenceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetworkReference; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetworkReferenceType; +import org.junit.jupiter.api.Assertions; + +public final class ManagedVirtualNetworkReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedVirtualNetworkReference model = + BinaryData + .fromString("{\"type\":\"ManagedVirtualNetworkReference\",\"referenceName\":\"xawqy\"}") + .toObject(ManagedVirtualNetworkReference.class); + Assertions.assertEquals(ManagedVirtualNetworkReferenceType.MANAGED_VIRTUAL_NETWORK_REFERENCE, model.type()); + Assertions.assertEquals("xawqy", model.referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedVirtualNetworkReference model = + new ManagedVirtualNetworkReference() + .withType(ManagedVirtualNetworkReferenceType.MANAGED_VIRTUAL_NETWORK_REFERENCE) + .withReferenceName("xawqy"); + model = BinaryData.fromObject(model).toObject(ManagedVirtualNetworkReference.class); + Assertions.assertEquals(ManagedVirtualNetworkReferenceType.MANAGED_VIRTUAL_NETWORK_REFERENCE, model.type()); + Assertions.assertEquals("xawqy", model.referenceName()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkResourceInnerTests.java new file mode 100644 index 000000000000..04e3f2d8e2b3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkResourceInnerTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ManagedVirtualNetworkResourceInner; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetwork; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedVirtualNetworkResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedVirtualNetworkResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"vNetId\":\"ajinnixjawrtmjfj\",\"alias\":\"ccxlzhcoxovnek\",\"\":{\"jvidttge\":\"datalusfnrdtjxtxrdcq\",\"iesfuug\":\"datauslvyjtcvuwkasi\"}},\"name\":\"uqfecj\",\"type\":\"ygtuhx\",\"etag\":\"cbuewmrswnjlxuz\",\"id\":\"wpusxjbaqehg\"}") + .toObject(ManagedVirtualNetworkResourceInner.class); + Assertions.assertEquals("wpusxjbaqehg", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedVirtualNetworkResourceInner model = + new ManagedVirtualNetworkResourceInner() + .withId("wpusxjbaqehg") + .withProperties( + new ManagedVirtualNetwork() + .withAdditionalProperties(mapOf("vNetId", "ajinnixjawrtmjfj", "alias", "ccxlzhcoxovnek"))); + model = BinaryData.fromObject(model).toObject(ManagedVirtualNetworkResourceInner.class); + Assertions.assertEquals("wpusxjbaqehg", model.id()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkTests.java new file mode 100644 index 000000000000..8eff556045ec --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworkTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetwork; +import java.util.HashMap; +import java.util.Map; + +public final class ManagedVirtualNetworkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedVirtualNetwork model = + BinaryData + .fromString( + "{\"vNetId\":\"ohzjqatucoigeb\",\"alias\":\"cnwfepbnwgfmxjg\",\"\":{\"qbctqha\":\"datajbgdlfgtdysnaquf\"}}") + .toObject(ManagedVirtualNetwork.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedVirtualNetwork model = + new ManagedVirtualNetwork() + .withAdditionalProperties(mapOf("vNetId", "ohzjqatucoigeb", "alias", "cnwfepbnwgfmxjg")); + model = BinaryData.fromObject(model).toObject(ManagedVirtualNetwork.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..00f37d9c26cf --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetwork; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetworkResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ManagedVirtualNetworksCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"vNetId\":\"jxqintjhvcorobmq\",\"alias\":\"zipzkkleazkc\",\"\":{\"vofhpgu\":\"dataq\",\"wyfsqg\":\"dataibk\",\"cxazvrmu\":\"datass\"}},\"name\":\"jegohp\",\"type\":\"rmh\",\"etag\":\"tknbruszq\",\"id\":\"dmefsxmdmlowesi\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ManagedVirtualNetworkResource response = + manager + .managedVirtualNetworks() + .define("ncvnoqwgnllicovv") + .withExistingFactory("fm", "psvww") + .withProperties( + new ManagedVirtualNetwork() + .withAdditionalProperties(mapOf("vNetId", "obfnbdpaoijxqgf", "alias", "trvvhxjfkpu"))) + .withIfMatch("uxo") + .create(); + + Assertions.assertEquals("dmefsxmdmlowesi", response.id()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksGetWithResponseMockTests.java new file mode 100644 index 000000000000..f156b74c6d06 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksGetWithResponseMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetworkResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ManagedVirtualNetworksGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"vNetId\":\"xvndqh\",\"alias\":\"wxqaggb\",\"\":{\"lmdhuu\":\"datajhaicyu\",\"tjqjtoeaug\":\"datatiecnpka\"}},\"name\":\"srywpfcqleniaf\",\"type\":\"zdecgiomdcolwq\",\"etag\":\"rrjudgnph\",\"id\":\"dqt\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ManagedVirtualNetworkResource response = + manager + .managedVirtualNetworks() + .getWithResponse( + "trivif", "jjmtkwgdgfjvit", "payoesx", "mvslhncaspwvg", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dqt", response.id()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksListByFactoryMockTests.java new file mode 100644 index 000000000000..cacf930fbd1c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ManagedVirtualNetworksListByFactoryMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ManagedVirtualNetworkResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ManagedVirtualNetworksListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"vNetId\":\"ummwpqcdmfrj\",\"alias\":\"emgdkx\",\"\":{\"ompwtevqbcdjlnn\":\"datarvfyjvk\",\"typoqqakpb\":\"datahbejutupgmmt\",\"xdrgxhrtansjbo\":\"datawqavxljaybgxx\"}},\"name\":\"qixbf\",\"type\":\"vkttusyxz\",\"etag\":\"fw\",\"id\":\"qj\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.managedVirtualNetworks().listByFactory("uwrtubemp", "xmuejl", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qj", response.iterator().next().id()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperAttributeMappingTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperAttributeMappingTests.java new file mode 100644 index 000000000000..559d70cc2d50 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperAttributeMappingTests.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMapping; +import com.azure.resourcemanager.datafactory.models.MapperAttributeReference; +import com.azure.resourcemanager.datafactory.models.MapperConnectionReference; +import com.azure.resourcemanager.datafactory.models.MappingType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MapperAttributeMappingTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperAttributeMapping model = + BinaryData + .fromString( + "{\"name\":\"czwciidjsllfryvd\",\"type\":\"Derived\",\"functionName\":\"dqacfrgnawbabgf\",\"expression\":\"t\",\"attributeReference\":{\"name\":\"fczlfsyqkfrbzgow\",\"entity\":\"qmje\",\"entityConnectionReference\":{\"connectionName\":\"xnyqgxhlusr\",\"type\":\"linkedservicetype\"}},\"attributeReferences\":[{\"name\":\"jceagb\",\"entity\":\"vl\",\"entityConnectionReference\":{\"connectionName\":\"ywzash\",\"type\":\"linkedservicetype\"}}]}") + .toObject(MapperAttributeMapping.class); + Assertions.assertEquals("czwciidjsllfryvd", model.name()); + Assertions.assertEquals(MappingType.DERIVED, model.type()); + Assertions.assertEquals("dqacfrgnawbabgf", model.functionName()); + Assertions.assertEquals("t", model.expression()); + Assertions.assertEquals("fczlfsyqkfrbzgow", model.attributeReference().name()); + Assertions.assertEquals("qmje", model.attributeReference().entity()); + Assertions.assertEquals("xnyqgxhlusr", model.attributeReference().entityConnectionReference().connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, model.attributeReference().entityConnectionReference().type()); + Assertions.assertEquals("jceagb", model.attributeReferences().get(0).name()); + Assertions.assertEquals("vl", model.attributeReferences().get(0).entity()); + Assertions + .assertEquals("ywzash", model.attributeReferences().get(0).entityConnectionReference().connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.attributeReferences().get(0).entityConnectionReference().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperAttributeMapping model = + new MapperAttributeMapping() + .withName("czwciidjsllfryvd") + .withType(MappingType.DERIVED) + .withFunctionName("dqacfrgnawbabgf") + .withExpression("t") + .withAttributeReference( + new MapperAttributeReference() + .withName("fczlfsyqkfrbzgow") + .withEntity("qmje") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("xnyqgxhlusr") + .withType(ConnectionType.LINKEDSERVICETYPE))) + .withAttributeReferences( + Arrays + .asList( + new MapperAttributeReference() + .withName("jceagb") + .withEntity("vl") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("ywzash") + .withType(ConnectionType.LINKEDSERVICETYPE)))); + model = BinaryData.fromObject(model).toObject(MapperAttributeMapping.class); + Assertions.assertEquals("czwciidjsllfryvd", model.name()); + Assertions.assertEquals(MappingType.DERIVED, model.type()); + Assertions.assertEquals("dqacfrgnawbabgf", model.functionName()); + Assertions.assertEquals("t", model.expression()); + Assertions.assertEquals("fczlfsyqkfrbzgow", model.attributeReference().name()); + Assertions.assertEquals("qmje", model.attributeReference().entity()); + Assertions.assertEquals("xnyqgxhlusr", model.attributeReference().entityConnectionReference().connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, model.attributeReference().entityConnectionReference().type()); + Assertions.assertEquals("jceagb", model.attributeReferences().get(0).name()); + Assertions.assertEquals("vl", model.attributeReferences().get(0).entity()); + Assertions + .assertEquals("ywzash", model.attributeReferences().get(0).entityConnectionReference().connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.attributeReferences().get(0).entityConnectionReference().type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperAttributeMappingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperAttributeMappingsTests.java new file mode 100644 index 000000000000..5b5f6c041595 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperAttributeMappingsTests.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMapping; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMappings; +import com.azure.resourcemanager.datafactory.models.MapperAttributeReference; +import com.azure.resourcemanager.datafactory.models.MapperConnectionReference; +import com.azure.resourcemanager.datafactory.models.MappingType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MapperAttributeMappingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperAttributeMappings model = + BinaryData + .fromString( + "{\"attributeMappings\":[{\"name\":\"q\",\"type\":\"Direct\",\"functionName\":\"nrgmqsorhce\",\"expression\":\"gnlykm\",\"attributeReference\":{\"name\":\"wzvmdoksqd\",\"entity\":\"wlwxlboncqbazqic\",\"entityConnectionReference\":{\"connectionName\":\"ygtvxbyjanepub\",\"type\":\"linkedservicetype\"}},\"attributeReferences\":[{\"name\":\"vgxiaodetvo\",\"entity\":\"xdxuwsaifmc\",\"entityConnectionReference\":{\"connectionName\":\"s\",\"type\":\"linkedservicetype\"}},{\"name\":\"hg\",\"entity\":\"kb\",\"entityConnectionReference\":{\"connectionName\":\"jolgjyyxpvels\",\"type\":\"linkedservicetype\"}}]},{\"name\":\"zevxoqein\",\"type\":\"Derived\",\"functionName\":\"ljgl\",\"expression\":\"blqwaafrqulhmzy\",\"attributeReference\":{\"name\":\"dvaf\",\"entity\":\"qpjiyrqjcr\",\"entityConnectionReference\":{\"connectionName\":\"wmzwdfkbnrzorpdl\",\"type\":\"linkedservicetype\"}},\"attributeReferences\":[{\"name\":\"jfgxxsaetg\",\"entity\":\"gvpyigdaqqilzdc\",\"entityConnectionReference\":{\"connectionName\":\"joedx\",\"type\":\"linkedservicetype\"}},{\"name\":\"aifpaurwwgil\",\"entity\":\"qqa\",\"entityConnectionReference\":{\"connectionName\":\"kxwxdcvjwcyziake\",\"type\":\"linkedservicetype\"}},{\"name\":\"h\",\"entity\":\"tuicds\",\"entityConnectionReference\":{\"connectionName\":\"fmmp\",\"type\":\"linkedservicetype\"}}]},{\"name\":\"wvywr\",\"type\":\"Aggregate\",\"functionName\":\"ydg\",\"expression\":\"x\",\"attributeReference\":{\"name\":\"kiqaondjr\",\"entity\":\"lamgglvlmfejdo\",\"entityConnectionReference\":{\"connectionName\":\"kgltyg\",\"type\":\"linkedservicetype\"}},\"attributeReferences\":[{\"name\":\"ka\",\"entity\":\"jsxtlgflwfgziiuc\",\"entityConnectionReference\":{\"connectionName\":\"ceatlijjjrtvamca\",\"type\":\"linkedservicetype\"}},{\"name\":\"xk\",\"entity\":\"cxetyvkunmignoh\",\"entityConnectionReference\":{\"connectionName\":\"gqogjwpindedva\",\"type\":\"linkedservicetype\"}},{\"name\":\"hmedeilbjywfcfxz\",\"entity\":\"zzihvwy\",\"entityConnectionReference\":{\"connectionName\":\"u\",\"type\":\"linkedservicetype\"}}]}]}") + .toObject(MapperAttributeMappings.class); + Assertions.assertEquals("q", model.attributeMappings().get(0).name()); + Assertions.assertEquals(MappingType.DIRECT, model.attributeMappings().get(0).type()); + Assertions.assertEquals("nrgmqsorhce", model.attributeMappings().get(0).functionName()); + Assertions.assertEquals("gnlykm", model.attributeMappings().get(0).expression()); + Assertions.assertEquals("wzvmdoksqd", model.attributeMappings().get(0).attributeReference().name()); + Assertions.assertEquals("wlwxlboncqbazqic", model.attributeMappings().get(0).attributeReference().entity()); + Assertions + .assertEquals( + "ygtvxbyjanepub", + model.attributeMappings().get(0).attributeReference().entityConnectionReference().connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.attributeMappings().get(0).attributeReference().entityConnectionReference().type()); + Assertions.assertEquals("vgxiaodetvo", model.attributeMappings().get(0).attributeReferences().get(0).name()); + Assertions.assertEquals("xdxuwsaifmc", model.attributeMappings().get(0).attributeReferences().get(0).entity()); + Assertions + .assertEquals( + "s", + model + .attributeMappings() + .get(0) + .attributeReferences() + .get(0) + .entityConnectionReference() + .connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.attributeMappings().get(0).attributeReferences().get(0).entityConnectionReference().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperAttributeMappings model = + new MapperAttributeMappings() + .withAttributeMappings( + Arrays + .asList( + new MapperAttributeMapping() + .withName("q") + .withType(MappingType.DIRECT) + .withFunctionName("nrgmqsorhce") + .withExpression("gnlykm") + .withAttributeReference( + new MapperAttributeReference() + .withName("wzvmdoksqd") + .withEntity("wlwxlboncqbazqic") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("ygtvxbyjanepub") + .withType(ConnectionType.LINKEDSERVICETYPE))) + .withAttributeReferences( + Arrays + .asList( + new MapperAttributeReference() + .withName("vgxiaodetvo") + .withEntity("xdxuwsaifmc") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("s") + .withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperAttributeReference() + .withName("hg") + .withEntity("kb") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("jolgjyyxpvels") + .withType(ConnectionType.LINKEDSERVICETYPE)))), + new MapperAttributeMapping() + .withName("zevxoqein") + .withType(MappingType.DERIVED) + .withFunctionName("ljgl") + .withExpression("blqwaafrqulhmzy") + .withAttributeReference( + new MapperAttributeReference() + .withName("dvaf") + .withEntity("qpjiyrqjcr") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("wmzwdfkbnrzorpdl") + .withType(ConnectionType.LINKEDSERVICETYPE))) + .withAttributeReferences( + Arrays + .asList( + new MapperAttributeReference() + .withName("jfgxxsaetg") + .withEntity("gvpyigdaqqilzdc") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("joedx") + .withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperAttributeReference() + .withName("aifpaurwwgil") + .withEntity("qqa") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("kxwxdcvjwcyziake") + .withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperAttributeReference() + .withName("h") + .withEntity("tuicds") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("fmmp") + .withType(ConnectionType.LINKEDSERVICETYPE)))), + new MapperAttributeMapping() + .withName("wvywr") + .withType(MappingType.AGGREGATE) + .withFunctionName("ydg") + .withExpression("x") + .withAttributeReference( + new MapperAttributeReference() + .withName("kiqaondjr") + .withEntity("lamgglvlmfejdo") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("kgltyg") + .withType(ConnectionType.LINKEDSERVICETYPE))) + .withAttributeReferences( + Arrays + .asList( + new MapperAttributeReference() + .withName("ka") + .withEntity("jsxtlgflwfgziiuc") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("ceatlijjjrtvamca") + .withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperAttributeReference() + .withName("xk") + .withEntity("cxetyvkunmignoh") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("gqogjwpindedva") + .withType(ConnectionType.LINKEDSERVICETYPE)), + new MapperAttributeReference() + .withName("hmedeilbjywfcfxz") + .withEntity("zzihvwy") + .withEntityConnectionReference( + new MapperConnectionReference() + .withConnectionName("u") + .withType(ConnectionType.LINKEDSERVICETYPE)))))); + model = BinaryData.fromObject(model).toObject(MapperAttributeMappings.class); + Assertions.assertEquals("q", model.attributeMappings().get(0).name()); + Assertions.assertEquals(MappingType.DIRECT, model.attributeMappings().get(0).type()); + Assertions.assertEquals("nrgmqsorhce", model.attributeMappings().get(0).functionName()); + Assertions.assertEquals("gnlykm", model.attributeMappings().get(0).expression()); + Assertions.assertEquals("wzvmdoksqd", model.attributeMappings().get(0).attributeReference().name()); + Assertions.assertEquals("wlwxlboncqbazqic", model.attributeMappings().get(0).attributeReference().entity()); + Assertions + .assertEquals( + "ygtvxbyjanepub", + model.attributeMappings().get(0).attributeReference().entityConnectionReference().connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.attributeMappings().get(0).attributeReference().entityConnectionReference().type()); + Assertions.assertEquals("vgxiaodetvo", model.attributeMappings().get(0).attributeReferences().get(0).name()); + Assertions.assertEquals("xdxuwsaifmc", model.attributeMappings().get(0).attributeReferences().get(0).entity()); + Assertions + .assertEquals( + "s", + model + .attributeMappings() + .get(0) + .attributeReferences() + .get(0) + .entityConnectionReference() + .connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, + model.attributeMappings().get(0).attributeReferences().get(0).entityConnectionReference().type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperAttributeReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperAttributeReferenceTests.java new file mode 100644 index 000000000000..ae4f4c8439d2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperAttributeReferenceTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.MapperAttributeReference; +import com.azure.resourcemanager.datafactory.models.MapperConnectionReference; +import org.junit.jupiter.api.Assertions; + +public final class MapperAttributeReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperAttributeReference model = + BinaryData + .fromString( + "{\"name\":\"oyjfqipu\",\"entity\":\"znclkfkeebgv\",\"entityConnectionReference\":{\"connectionName\":\"m\",\"type\":\"linkedservicetype\"}}") + .toObject(MapperAttributeReference.class); + Assertions.assertEquals("oyjfqipu", model.name()); + Assertions.assertEquals("znclkfkeebgv", model.entity()); + Assertions.assertEquals("m", model.entityConnectionReference().connectionName()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.entityConnectionReference().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperAttributeReference model = + new MapperAttributeReference() + .withName("oyjfqipu") + .withEntity("znclkfkeebgv") + .withEntityConnectionReference( + new MapperConnectionReference().withConnectionName("m").withType(ConnectionType.LINKEDSERVICETYPE)); + model = BinaryData.fromObject(model).toObject(MapperAttributeReference.class); + Assertions.assertEquals("oyjfqipu", model.name()); + Assertions.assertEquals("znclkfkeebgv", model.entity()); + Assertions.assertEquals("m", model.entityConnectionReference().connectionName()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.entityConnectionReference().type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperConnectionReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperConnectionReferenceTests.java new file mode 100644 index 000000000000..a0bc3180a190 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperConnectionReferenceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.MapperConnectionReference; +import org.junit.jupiter.api.Assertions; + +public final class MapperConnectionReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperConnectionReference model = + BinaryData + .fromString("{\"connectionName\":\"k\",\"type\":\"linkedservicetype\"}") + .toObject(MapperConnectionReference.class); + Assertions.assertEquals("k", model.connectionName()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperConnectionReference model = + new MapperConnectionReference().withConnectionName("k").withType(ConnectionType.LINKEDSERVICETYPE); + model = BinaryData.fromObject(model).toObject(MapperConnectionReference.class); + Assertions.assertEquals("k", model.connectionName()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperConnectionTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperConnectionTests.java new file mode 100644 index 000000000000..8d7a3768ec53 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperConnectionTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MapperConnection; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MapperConnectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperConnection model = + BinaryData + .fromString( + "{\"linkedService\":{\"referenceName\":\"sdtcjbctvivuzqym\",\"parameters\":{\"zvbrzcdbanfzndsc\":\"datawogtgitsq\"}},\"linkedServiceType\":\"xeatkd\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{\"name\":\"yibqbnao\",\"value\":\"datajrmkuhmaxljalf\"},{\"name\":\"cjmobcanc\",\"value\":\"dataxxqcwgaxf\"},{\"name\":\"aknokzwjjzrl\",\"value\":\"dataxldzyyfytpqsix\"},{\"name\":\"m\",\"value\":\"datajivyqlkjuv\"}]}") + .toObject(MapperConnection.class); + Assertions.assertEquals("sdtcjbctvivuzqym", model.linkedService().referenceName()); + Assertions.assertEquals("xeatkd", model.linkedServiceType()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.type()); + Assertions.assertEquals(false, model.isInlineDataset()); + Assertions.assertEquals("yibqbnao", model.commonDslConnectorProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperConnection model = + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("sdtcjbctvivuzqym") + .withParameters(mapOf("zvbrzcdbanfzndsc", "datawogtgitsq"))) + .withLinkedServiceType("xeatkd") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(false) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties().withName("yibqbnao").withValue("datajrmkuhmaxljalf"), + new MapperDslConnectorProperties().withName("cjmobcanc").withValue("dataxxqcwgaxf"), + new MapperDslConnectorProperties().withName("aknokzwjjzrl").withValue("dataxldzyyfytpqsix"), + new MapperDslConnectorProperties().withName("m").withValue("datajivyqlkjuv"))); + model = BinaryData.fromObject(model).toObject(MapperConnection.class); + Assertions.assertEquals("sdtcjbctvivuzqym", model.linkedService().referenceName()); + Assertions.assertEquals("xeatkd", model.linkedServiceType()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.type()); + Assertions.assertEquals(false, model.isInlineDataset()); + Assertions.assertEquals("yibqbnao", model.commonDslConnectorProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperDslConnectorPropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperDslConnectorPropertiesTests.java new file mode 100644 index 000000000000..069fb943608c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperDslConnectorPropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import org.junit.jupiter.api.Assertions; + +public final class MapperDslConnectorPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperDslConnectorProperties model = + BinaryData + .fromString("{\"name\":\"lkwq\",\"value\":\"datatv\"}") + .toObject(MapperDslConnectorProperties.class); + Assertions.assertEquals("lkwq", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperDslConnectorProperties model = new MapperDslConnectorProperties().withName("lkwq").withValue("datatv"); + model = BinaryData.fromObject(model).toObject(MapperDslConnectorProperties.class); + Assertions.assertEquals("lkwq", model.name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperPolicyRecurrenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperPolicyRecurrenceTests.java new file mode 100644 index 000000000000..9c8027eec36e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperPolicyRecurrenceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FrequencyType; +import com.azure.resourcemanager.datafactory.models.MapperPolicyRecurrence; +import org.junit.jupiter.api.Assertions; + +public final class MapperPolicyRecurrenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperPolicyRecurrence model = + BinaryData + .fromString("{\"frequency\":\"Hour\",\"interval\":1799145797}") + .toObject(MapperPolicyRecurrence.class); + Assertions.assertEquals(FrequencyType.HOUR, model.frequency()); + Assertions.assertEquals(1799145797, model.interval()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperPolicyRecurrence model = + new MapperPolicyRecurrence().withFrequency(FrequencyType.HOUR).withInterval(1799145797); + model = BinaryData.fromObject(model).toObject(MapperPolicyRecurrence.class); + Assertions.assertEquals(FrequencyType.HOUR, model.frequency()); + Assertions.assertEquals(1799145797, model.interval()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperPolicyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperPolicyTests.java new file mode 100644 index 000000000000..d33cf2575b7d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperPolicyTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.FrequencyType; +import com.azure.resourcemanager.datafactory.models.MapperPolicy; +import com.azure.resourcemanager.datafactory.models.MapperPolicyRecurrence; +import org.junit.jupiter.api.Assertions; + +public final class MapperPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperPolicy model = + BinaryData + .fromString("{\"mode\":\"ujlyegq\",\"recurrence\":{\"frequency\":\"Second\",\"interval\":1397511481}}") + .toObject(MapperPolicy.class); + Assertions.assertEquals("ujlyegq", model.mode()); + Assertions.assertEquals(FrequencyType.SECOND, model.recurrence().frequency()); + Assertions.assertEquals(1397511481, model.recurrence().interval()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperPolicy model = + new MapperPolicy() + .withMode("ujlyegq") + .withRecurrence( + new MapperPolicyRecurrence().withFrequency(FrequencyType.SECOND).withInterval(1397511481)); + model = BinaryData.fromObject(model).toObject(MapperPolicy.class); + Assertions.assertEquals("ujlyegq", model.mode()); + Assertions.assertEquals(FrequencyType.SECOND, model.recurrence().frequency()); + Assertions.assertEquals(1397511481, model.recurrence().interval()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperSourceConnectionsInfoTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperSourceConnectionsInfoTests.java new file mode 100644 index 000000000000..99410ed58b65 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperSourceConnectionsInfoTests.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MapperConnection; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import com.azure.resourcemanager.datafactory.models.MapperSourceConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MapperTable; +import com.azure.resourcemanager.datafactory.models.MapperTableSchema; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MapperSourceConnectionsInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperSourceConnectionsInfo model = + BinaryData + .fromString( + "{\"sourceEntities\":[{\"name\":\"epmywbormcqm\",\"properties\":{\"schema\":[{\"name\":\"qpkzfbojxjmcsmy\",\"dataType\":\"ixvcpwnkwywzwo\"},{\"name\":\"lickduoi\",\"dataType\":\"amt\"},{\"name\":\"sknxrwzawnvsbcf\",\"dataType\":\"agxnvhycvdimw\"},{\"name\":\"regzgyufutrwpwer\",\"dataType\":\"kzkdhmeott\"}],\"dslConnectorProperties\":[{\"name\":\"osxw\",\"value\":\"datanhjtf\"},{\"name\":\"n\",\"value\":\"datamiljpnwynud\"}]}}],\"connection\":{\"linkedService\":{\"referenceName\":\"zsauzp\",\"parameters\":{\"ezxlskihm\":\"dataeehuxiqhzlray\"}},\"linkedServiceType\":\"fdsajred\",\"type\":\"linkedservicetype\",\"isInlineDataset\":true,\"commonDslConnectorProperties\":[{\"name\":\"uwg\",\"value\":\"datavuafpwzyifr\"},{\"name\":\"wltxeqipxgzdyims\",\"value\":\"datayorpr\"}]}}") + .toObject(MapperSourceConnectionsInfo.class); + Assertions.assertEquals("epmywbormcqm", model.sourceEntities().get(0).name()); + Assertions.assertEquals("qpkzfbojxjmcsmy", model.sourceEntities().get(0).schema().get(0).name()); + Assertions.assertEquals("ixvcpwnkwywzwo", model.sourceEntities().get(0).schema().get(0).dataType()); + Assertions.assertEquals("osxw", model.sourceEntities().get(0).dslConnectorProperties().get(0).name()); + Assertions.assertEquals("zsauzp", model.connection().linkedService().referenceName()); + Assertions.assertEquals("fdsajred", model.connection().linkedServiceType()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.connection().type()); + Assertions.assertEquals(true, model.connection().isInlineDataset()); + Assertions.assertEquals("uwg", model.connection().commonDslConnectorProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperSourceConnectionsInfo model = + new MapperSourceConnectionsInfo() + .withSourceEntities( + Arrays + .asList( + new MapperTable() + .withName("epmywbormcqm") + .withSchema( + Arrays + .asList( + new MapperTableSchema() + .withName("qpkzfbojxjmcsmy") + .withDataType("ixvcpwnkwywzwo"), + new MapperTableSchema().withName("lickduoi").withDataType("amt"), + new MapperTableSchema() + .withName("sknxrwzawnvsbcf") + .withDataType("agxnvhycvdimw"), + new MapperTableSchema() + .withName("regzgyufutrwpwer") + .withDataType("kzkdhmeott"))) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties().withName("osxw").withValue("datanhjtf"), + new MapperDslConnectorProperties() + .withName("n") + .withValue("datamiljpnwynud"))))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("zsauzp") + .withParameters(mapOf("ezxlskihm", "dataeehuxiqhzlray"))) + .withLinkedServiceType("fdsajred") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(true) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties().withName("uwg").withValue("datavuafpwzyifr"), + new MapperDslConnectorProperties() + .withName("wltxeqipxgzdyims") + .withValue("datayorpr")))); + model = BinaryData.fromObject(model).toObject(MapperSourceConnectionsInfo.class); + Assertions.assertEquals("epmywbormcqm", model.sourceEntities().get(0).name()); + Assertions.assertEquals("qpkzfbojxjmcsmy", model.sourceEntities().get(0).schema().get(0).name()); + Assertions.assertEquals("ixvcpwnkwywzwo", model.sourceEntities().get(0).schema().get(0).dataType()); + Assertions.assertEquals("osxw", model.sourceEntities().get(0).dslConnectorProperties().get(0).name()); + Assertions.assertEquals("zsauzp", model.connection().linkedService().referenceName()); + Assertions.assertEquals("fdsajred", model.connection().linkedServiceType()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.connection().type()); + Assertions.assertEquals(true, model.connection().isInlineDataset()); + Assertions.assertEquals("uwg", model.connection().commonDslConnectorProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTablePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTablePropertiesTests.java new file mode 100644 index 000000000000..89e02f2f818f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTablePropertiesTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.MapperTableProperties; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import com.azure.resourcemanager.datafactory.models.MapperTableSchema; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MapperTablePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperTableProperties model = + BinaryData + .fromString( + "{\"schema\":[{\"name\":\"toi\",\"dataType\":\"gygvfltgvdiho\"},{\"name\":\"krxwet\",\"dataType\":\"drcyrucpcun\"}],\"dslConnectorProperties\":[{\"name\":\"qumoeno\",\"value\":\"dataaienhqhsknd\"},{\"name\":\"lqkaadlknwf\",\"value\":\"datanniyopetxi\"}]}") + .toObject(MapperTableProperties.class); + Assertions.assertEquals("toi", model.schema().get(0).name()); + Assertions.assertEquals("gygvfltgvdiho", model.schema().get(0).dataType()); + Assertions.assertEquals("qumoeno", model.dslConnectorProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperTableProperties model = + new MapperTableProperties() + .withSchema( + Arrays + .asList( + new MapperTableSchema().withName("toi").withDataType("gygvfltgvdiho"), + new MapperTableSchema().withName("krxwet").withDataType("drcyrucpcun"))) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties().withName("qumoeno").withValue("dataaienhqhsknd"), + new MapperDslConnectorProperties().withName("lqkaadlknwf").withValue("datanniyopetxi"))); + model = BinaryData.fromObject(model).toObject(MapperTableProperties.class); + Assertions.assertEquals("toi", model.schema().get(0).name()); + Assertions.assertEquals("gygvfltgvdiho", model.schema().get(0).dataType()); + Assertions.assertEquals("qumoeno", model.dslConnectorProperties().get(0).name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTableSchemaTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTableSchemaTests.java new file mode 100644 index 000000000000..729187d32a0f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTableSchemaTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MapperTableSchema; +import org.junit.jupiter.api.Assertions; + +public final class MapperTableSchemaTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperTableSchema model = + BinaryData.fromString("{\"name\":\"nrlyxnuc\",\"dataType\":\"p\"}").toObject(MapperTableSchema.class); + Assertions.assertEquals("nrlyxnuc", model.name()); + Assertions.assertEquals("p", model.dataType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperTableSchema model = new MapperTableSchema().withName("nrlyxnuc").withDataType("p"); + model = BinaryData.fromObject(model).toObject(MapperTableSchema.class); + Assertions.assertEquals("nrlyxnuc", model.name()); + Assertions.assertEquals("p", model.dataType()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTableTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTableTests.java new file mode 100644 index 000000000000..013c3fcdccf3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTableTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import com.azure.resourcemanager.datafactory.models.MapperTable; +import com.azure.resourcemanager.datafactory.models.MapperTableSchema; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MapperTableTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperTable model = + BinaryData + .fromString( + "{\"name\":\"kj\",\"properties\":{\"schema\":[{\"name\":\"abnsmj\",\"dataType\":\"ynq\"}],\"dslConnectorProperties\":[{\"name\":\"qs\",\"value\":\"datavwjtqpkevmyltjc\"},{\"name\":\"pxklurccl\",\"value\":\"dataxa\"},{\"name\":\"noytzposewxigp\",\"value\":\"datakqma\"},{\"name\":\"xvpif\",\"value\":\"dataaifyzyzeyuubeids\"}]}}") + .toObject(MapperTable.class); + Assertions.assertEquals("kj", model.name()); + Assertions.assertEquals("abnsmj", model.schema().get(0).name()); + Assertions.assertEquals("ynq", model.schema().get(0).dataType()); + Assertions.assertEquals("qs", model.dslConnectorProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperTable model = + new MapperTable() + .withName("kj") + .withSchema(Arrays.asList(new MapperTableSchema().withName("abnsmj").withDataType("ynq"))) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties().withName("qs").withValue("datavwjtqpkevmyltjc"), + new MapperDslConnectorProperties().withName("pxklurccl").withValue("dataxa"), + new MapperDslConnectorProperties().withName("noytzposewxigp").withValue("datakqma"), + new MapperDslConnectorProperties().withName("xvpif").withValue("dataaifyzyzeyuubeids"))); + model = BinaryData.fromObject(model).toObject(MapperTable.class); + Assertions.assertEquals("kj", model.name()); + Assertions.assertEquals("abnsmj", model.schema().get(0).name()); + Assertions.assertEquals("ynq", model.schema().get(0).dataType()); + Assertions.assertEquals("qs", model.dslConnectorProperties().get(0).name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTargetConnectionsInfoTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTargetConnectionsInfoTests.java new file mode 100644 index 000000000000..1d9644fd238e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MapperTargetConnectionsInfoTests.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ConnectionType; +import com.azure.resourcemanager.datafactory.models.DataMapperMapping; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMapping; +import com.azure.resourcemanager.datafactory.models.MapperAttributeMappings; +import com.azure.resourcemanager.datafactory.models.MapperAttributeReference; +import com.azure.resourcemanager.datafactory.models.MapperConnection; +import com.azure.resourcemanager.datafactory.models.MapperConnectionReference; +import com.azure.resourcemanager.datafactory.models.MapperDslConnectorProperties; +import com.azure.resourcemanager.datafactory.models.MapperTable; +import com.azure.resourcemanager.datafactory.models.MapperTableSchema; +import com.azure.resourcemanager.datafactory.models.MapperTargetConnectionsInfo; +import com.azure.resourcemanager.datafactory.models.MappingType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MapperTargetConnectionsInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapperTargetConnectionsInfo model = + BinaryData + .fromString( + "{\"targetEntities\":[{\"name\":\"slzoyov\",\"properties\":{\"schema\":[{\"name\":\"qvybefg\",\"dataType\":\"x\"},{\"name\":\"kcvtl\",\"dataType\":\"seskvcuar\"},{\"name\":\"hunlpirykycnd\",\"dataType\":\"qi\"}],\"dslConnectorProperties\":[{\"name\":\"uykbbmn\",\"value\":\"datagltbxoeeo\"},{\"name\":\"lnf\",\"value\":\"datay\"},{\"name\":\"vqdbpbhfck\",\"value\":\"dataezcrcssbzhddubb\"},{\"name\":\"fblhkalehp\",\"value\":\"dataawugiqjti\"}]}},{\"name\":\"qgdm\",\"properties\":{\"schema\":[{\"name\":\"teajohiyg\",\"dataType\":\"n\"},{\"name\":\"n\",\"dataType\":\"czykmktpvw\"},{\"name\":\"csehchkhufm\",\"dataType\":\"umqy\"}],\"dslConnectorProperties\":[{\"name\":\"zulo\",\"value\":\"dataaeuzanh\"},{\"name\":\"nhsenwphpzfng\",\"value\":\"dataclid\"},{\"name\":\"u\",\"value\":\"datajj\"},{\"name\":\"wbeqrkuor\",\"value\":\"datassruqnmdvhazcvj\"}]}},{\"name\":\"iqswbqer\",\"properties\":{\"schema\":[{\"name\":\"txtd\",\"dataType\":\"kvlbpktgdstyoua\"},{\"name\":\"ewres\",\"dataType\":\"owegmmutey\"}],\"dslConnectorProperties\":[{\"name\":\"uqi\",\"value\":\"datajiitnspxlzdesygr\"},{\"name\":\"waiufanra\",\"value\":\"datafueqfrojs\"},{\"name\":\"grhydk\",\"value\":\"dataywezskiecafyg\"},{\"name\":\"xieqv\",\"value\":\"datamakli\"}]}}],\"connection\":{\"linkedService\":{\"referenceName\":\"ah\",\"parameters\":{\"tblxpkkwjdjodqhy\":\"dataalybxawoijpo\",\"mehllizhceu\":\"dataincnr\",\"ibngqladyw\":\"dataoqodkadpp\",\"ds\":\"dataxwhydtluvv\"}},\"linkedServiceType\":\"snuyemlowuowhl\",\"type\":\"linkedservicetype\",\"isInlineDataset\":false,\"commonDslConnectorProperties\":[{\"name\":\"ouvblgmo\",\"value\":\"datakltrfow\"},{\"name\":\"vrfmvlihcvjd\",\"value\":\"datacrjidhftukv\"}]},\"dataMapperMappings\":[{\"targetEntityName\":\"wyojbfqzdkfnjyi\",\"sourceEntityName\":\"afr\",\"sourceConnectionReference\":{\"connectionName\":\"xmbjroum\",\"type\":\"linkedservicetype\"},\"attributeMappingInfo\":{\"attributeMappings\":[{\"name\":\"jrhuzgf\",\"type\":\"Aggregate\",\"functionName\":\"tpusllywp\",\"expression\":\"iotzbpdbollgryfq\",\"attributeReference\":{},\"attributeReferences\":[{},{},{},{}]}]},\"sourceDenormalizeInfo\":\"datagrowsoc\"},{\"targetEntityName\":\"quygdjboqgrmtq\",\"sourceEntityName\":\"qevadrmmw\",\"sourceConnectionReference\":{\"connectionName\":\"wvcmj\",\"type\":\"linkedservicetype\"},\"attributeMappingInfo\":{\"attributeMappings\":[{\"name\":\"scz\",\"type\":\"Aggregate\",\"functionName\":\"woqiqazugamxzkrr\",\"expression\":\"iisb\",\"attributeReference\":{},\"attributeReferences\":[{}]},{\"name\":\"ccek\",\"type\":\"Derived\",\"functionName\":\"sbezaxyfukzxuizh\",\"expression\":\"nepk\",\"attributeReference\":{},\"attributeReferences\":[{},{},{},{}]},{\"name\":\"rx\",\"type\":\"Direct\",\"functionName\":\"xdukecpxd\",\"expression\":\"v\",\"attributeReference\":{},\"attributeReferences\":[{},{}]}]},\"sourceDenormalizeInfo\":\"datamkoszudbl\"}],\"relationships\":[\"datatrpc\",\"dataqkio\",\"datakb\"]}") + .toObject(MapperTargetConnectionsInfo.class); + Assertions.assertEquals("slzoyov", model.targetEntities().get(0).name()); + Assertions.assertEquals("qvybefg", model.targetEntities().get(0).schema().get(0).name()); + Assertions.assertEquals("x", model.targetEntities().get(0).schema().get(0).dataType()); + Assertions.assertEquals("uykbbmn", model.targetEntities().get(0).dslConnectorProperties().get(0).name()); + Assertions.assertEquals("ah", model.connection().linkedService().referenceName()); + Assertions.assertEquals("snuyemlowuowhl", model.connection().linkedServiceType()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.connection().type()); + Assertions.assertEquals(false, model.connection().isInlineDataset()); + Assertions.assertEquals("ouvblgmo", model.connection().commonDslConnectorProperties().get(0).name()); + Assertions.assertEquals("wyojbfqzdkfnjyi", model.dataMapperMappings().get(0).targetEntityName()); + Assertions.assertEquals("afr", model.dataMapperMappings().get(0).sourceEntityName()); + Assertions + .assertEquals("xmbjroum", model.dataMapperMappings().get(0).sourceConnectionReference().connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, model.dataMapperMappings().get(0).sourceConnectionReference().type()); + Assertions + .assertEquals( + "jrhuzgf", model.dataMapperMappings().get(0).attributeMappingInfo().attributeMappings().get(0).name()); + Assertions + .assertEquals( + MappingType.AGGREGATE, + model.dataMapperMappings().get(0).attributeMappingInfo().attributeMappings().get(0).type()); + Assertions + .assertEquals( + "tpusllywp", + model.dataMapperMappings().get(0).attributeMappingInfo().attributeMappings().get(0).functionName()); + Assertions + .assertEquals( + "iotzbpdbollgryfq", + model.dataMapperMappings().get(0).attributeMappingInfo().attributeMappings().get(0).expression()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapperTargetConnectionsInfo model = + new MapperTargetConnectionsInfo() + .withTargetEntities( + Arrays + .asList( + new MapperTable() + .withName("slzoyov") + .withSchema( + Arrays + .asList( + new MapperTableSchema().withName("qvybefg").withDataType("x"), + new MapperTableSchema().withName("kcvtl").withDataType("seskvcuar"), + new MapperTableSchema().withName("hunlpirykycnd").withDataType("qi"))) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties() + .withName("uykbbmn") + .withValue("datagltbxoeeo"), + new MapperDslConnectorProperties().withName("lnf").withValue("datay"), + new MapperDslConnectorProperties() + .withName("vqdbpbhfck") + .withValue("dataezcrcssbzhddubb"), + new MapperDslConnectorProperties() + .withName("fblhkalehp") + .withValue("dataawugiqjti"))), + new MapperTable() + .withName("qgdm") + .withSchema( + Arrays + .asList( + new MapperTableSchema().withName("teajohiyg").withDataType("n"), + new MapperTableSchema().withName("n").withDataType("czykmktpvw"), + new MapperTableSchema().withName("csehchkhufm").withDataType("umqy"))) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties() + .withName("zulo") + .withValue("dataaeuzanh"), + new MapperDslConnectorProperties() + .withName("nhsenwphpzfng") + .withValue("dataclid"), + new MapperDslConnectorProperties().withName("u").withValue("datajj"), + new MapperDslConnectorProperties() + .withName("wbeqrkuor") + .withValue("datassruqnmdvhazcvj"))), + new MapperTable() + .withName("iqswbqer") + .withSchema( + Arrays + .asList( + new MapperTableSchema().withName("txtd").withDataType("kvlbpktgdstyoua"), + new MapperTableSchema().withName("ewres").withDataType("owegmmutey"))) + .withDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties() + .withName("uqi") + .withValue("datajiitnspxlzdesygr"), + new MapperDslConnectorProperties() + .withName("waiufanra") + .withValue("datafueqfrojs"), + new MapperDslConnectorProperties() + .withName("grhydk") + .withValue("dataywezskiecafyg"), + new MapperDslConnectorProperties() + .withName("xieqv") + .withValue("datamakli"))))) + .withConnection( + new MapperConnection() + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("ah") + .withParameters( + mapOf( + "tblxpkkwjdjodqhy", + "dataalybxawoijpo", + "mehllizhceu", + "dataincnr", + "ibngqladyw", + "dataoqodkadpp", + "ds", + "dataxwhydtluvv"))) + .withLinkedServiceType("snuyemlowuowhl") + .withType(ConnectionType.LINKEDSERVICETYPE) + .withIsInlineDataset(false) + .withCommonDslConnectorProperties( + Arrays + .asList( + new MapperDslConnectorProperties().withName("ouvblgmo").withValue("datakltrfow"), + new MapperDslConnectorProperties() + .withName("vrfmvlihcvjd") + .withValue("datacrjidhftukv")))) + .withDataMapperMappings( + Arrays + .asList( + new DataMapperMapping() + .withTargetEntityName("wyojbfqzdkfnjyi") + .withSourceEntityName("afr") + .withSourceConnectionReference( + new MapperConnectionReference() + .withConnectionName("xmbjroum") + .withType(ConnectionType.LINKEDSERVICETYPE)) + .withAttributeMappingInfo( + new MapperAttributeMappings() + .withAttributeMappings( + Arrays + .asList( + new MapperAttributeMapping() + .withName("jrhuzgf") + .withType(MappingType.AGGREGATE) + .withFunctionName("tpusllywp") + .withExpression("iotzbpdbollgryfq") + .withAttributeReference(new MapperAttributeReference()) + .withAttributeReferences( + Arrays + .asList( + new MapperAttributeReference(), + new MapperAttributeReference(), + new MapperAttributeReference(), + new MapperAttributeReference()))))) + .withSourceDenormalizeInfo("datagrowsoc"), + new DataMapperMapping() + .withTargetEntityName("quygdjboqgrmtq") + .withSourceEntityName("qevadrmmw") + .withSourceConnectionReference( + new MapperConnectionReference() + .withConnectionName("wvcmj") + .withType(ConnectionType.LINKEDSERVICETYPE)) + .withAttributeMappingInfo( + new MapperAttributeMappings() + .withAttributeMappings( + Arrays + .asList( + new MapperAttributeMapping() + .withName("scz") + .withType(MappingType.AGGREGATE) + .withFunctionName("woqiqazugamxzkrr") + .withExpression("iisb") + .withAttributeReference(new MapperAttributeReference()) + .withAttributeReferences( + Arrays.asList(new MapperAttributeReference())), + new MapperAttributeMapping() + .withName("ccek") + .withType(MappingType.DERIVED) + .withFunctionName("sbezaxyfukzxuizh") + .withExpression("nepk") + .withAttributeReference(new MapperAttributeReference()) + .withAttributeReferences( + Arrays + .asList( + new MapperAttributeReference(), + new MapperAttributeReference(), + new MapperAttributeReference(), + new MapperAttributeReference())), + new MapperAttributeMapping() + .withName("rx") + .withType(MappingType.DIRECT) + .withFunctionName("xdukecpxd") + .withExpression("v") + .withAttributeReference(new MapperAttributeReference()) + .withAttributeReferences( + Arrays + .asList( + new MapperAttributeReference(), + new MapperAttributeReference()))))) + .withSourceDenormalizeInfo("datamkoszudbl"))) + .withRelationships(Arrays.asList("datatrpc", "dataqkio", "datakb")); + model = BinaryData.fromObject(model).toObject(MapperTargetConnectionsInfo.class); + Assertions.assertEquals("slzoyov", model.targetEntities().get(0).name()); + Assertions.assertEquals("qvybefg", model.targetEntities().get(0).schema().get(0).name()); + Assertions.assertEquals("x", model.targetEntities().get(0).schema().get(0).dataType()); + Assertions.assertEquals("uykbbmn", model.targetEntities().get(0).dslConnectorProperties().get(0).name()); + Assertions.assertEquals("ah", model.connection().linkedService().referenceName()); + Assertions.assertEquals("snuyemlowuowhl", model.connection().linkedServiceType()); + Assertions.assertEquals(ConnectionType.LINKEDSERVICETYPE, model.connection().type()); + Assertions.assertEquals(false, model.connection().isInlineDataset()); + Assertions.assertEquals("ouvblgmo", model.connection().commonDslConnectorProperties().get(0).name()); + Assertions.assertEquals("wyojbfqzdkfnjyi", model.dataMapperMappings().get(0).targetEntityName()); + Assertions.assertEquals("afr", model.dataMapperMappings().get(0).sourceEntityName()); + Assertions + .assertEquals("xmbjroum", model.dataMapperMappings().get(0).sourceConnectionReference().connectionName()); + Assertions + .assertEquals( + ConnectionType.LINKEDSERVICETYPE, model.dataMapperMappings().get(0).sourceConnectionReference().type()); + Assertions + .assertEquals( + "jrhuzgf", model.dataMapperMappings().get(0).attributeMappingInfo().attributeMappings().get(0).name()); + Assertions + .assertEquals( + MappingType.AGGREGATE, + model.dataMapperMappings().get(0).attributeMappingInfo().attributeMappings().get(0).type()); + Assertions + .assertEquals( + "tpusllywp", + model.dataMapperMappings().get(0).attributeMappingInfo().attributeMappings().get(0).functionName()); + Assertions + .assertEquals( + "iotzbpdbollgryfq", + model.dataMapperMappings().get(0).attributeMappingInfo().attributeMappings().get(0).expression()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MappingDataFlowTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MappingDataFlowTests.java new file mode 100644 index 000000000000..9d10004b2a49 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MappingDataFlowTests.java @@ -0,0 +1,498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowSink; +import com.azure.resourcemanager.datafactory.models.DataFlowSource; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MappingDataFlow; +import com.azure.resourcemanager.datafactory.models.Transformation; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MappingDataFlowTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MappingDataFlow model = + BinaryData + .fromString( + "{\"type\":\"MappingDataFlow\",\"typeProperties\":{\"sources\":[{\"schemaLinkedService\":{\"referenceName\":\"wdyjqurykcrrauee\",\"parameters\":{\"cbcbgydlqidy\":\"datauehogdd\"}},\"name\":\"mhmpty\",\"description\":\"lkfbnrqqxvztpb\",\"dataset\":{\"referenceName\":\"nqtxjtomalswbnf\",\"parameters\":{\"qjn\":\"datapld\"}},\"linkedService\":{\"referenceName\":\"zygleexahvm\",\"parameters\":{\"sjjzyvoaqajuveh\":\"datasbrcary\",\"be\":\"dataptdmkrrbhmpful\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"bpmfbfununmpzkrv\",\"datasetParameters\":\"dataifkdschlzvf\",\"parameters\":{\"rtogmhmj\":\"datankjjwgcwnphbkgf\",\"fp\":\"datajsc\",\"fv\":\"dataqwtygevgwmseharx\",\"x\":\"datan\"},\"\":{\"wjhrsidqpxlbtpa\":\"datapjptn\",\"ngatwmy\":\"dataf\",\"mfjhpycvjqdvdwkq\":\"datayutrymd\",\"n\":\"dataldrlefgnaavua\"}}},{\"schemaLinkedService\":{\"referenceName\":\"taoutnpdct\",\"parameters\":{\"y\":\"datapfe\",\"tybkcgs\":\"datahduyeuyldph\",\"x\":\"datathhllnmwyne\",\"fciatxtjrr\":\"datax\"}},\"name\":\"kmdskjhhxd\",\"description\":\"jfoxcxscvslxl\",\"dataset\":{\"referenceName\":\"a\",\"parameters\":{\"yjmkxettc\":\"datamuk\",\"xjhqxcsqhtkb\":\"datalojfkqidnqto\",\"dmbi\":\"datanqlrng\",\"qkzn\":\"datapsnaww\"}},\"linkedService\":{\"referenceName\":\"hllxricctkw\",\"parameters\":{\"xhdctrceqnk\":\"dataqoajxeiyglesrwva\",\"lj\":\"datarupobehd\",\"bibnzpphepifex\":\"dataacvumepj\",\"cjclykcgxv\":\"dataeqir\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"lvczu\",\"datasetParameters\":\"dataac\",\"parameters\":{\"koynuiylpckae\":\"dataettepdjxqe\",\"nzhctmjtsgh\":\"datasedveskwxegqphrg\",\"rpzeqac\":\"databcbcpz\",\"zshnuqndaizup\":\"dataldtzmpypefcp\"},\"\":{\"gw\":\"datauytuszxhmtvtv\",\"haokgkskjiv\":\"dataiukvzwydwt\"}}},{\"schemaLinkedService\":{\"referenceName\":\"shajqf\",\"parameters\":{\"hwu\":\"dataeexpgeumi\",\"dbzsx\":\"datatrdexyionofnin\",\"bzbcyksiv\":\"datawqqrsmpcbbprtuga\",\"rftsjcwjjxs\":\"datafogdrtbfcm\"}},\"name\":\"mb\",\"description\":\"vifdxkecifhocjx\",\"dataset\":{\"referenceName\":\"loozrvt\",\"parameters\":{\"cpxxvirye\":\"datamufun\",\"lpmcrdc\":\"datangjgvrquvpyg\",\"x\":\"dataeljtiahxmfqryarv\"}},\"linkedService\":{\"referenceName\":\"bglcjkayspthzodu\",\"parameters\":{\"djxyxgbkkqvjcteo\":\"datamjtgblioskkfmkm\",\"pxvjnzd\":\"datadlrslskk\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"cojhpcnabx\",\"datasetParameters\":\"datasnggytexvzilmhiv\",\"parameters\":{\"cknrzda\":\"dataww\",\"eucyrth\":\"datalskzptjxul\"},\"\":{\"n\":\"dataehmcgcje\",\"qnttmbq\":\"dataehokamvfej\",\"kpysthhzagjf\":\"dataabzfivf\",\"ejgvkvebaqszllrz\":\"datayyrlhgenu\"}}}],\"sinks\":[{\"schemaLinkedService\":{\"referenceName\":\"dqgmih\",\"parameters\":{\"inklogxs\":\"datamcqrhnxt\",\"bjwzzos\":\"datatzarhzvqnsqktc\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"kybtglwkzpgajsqj\",\"parameters\":{\"uqrebluimmbwx\":\"dataqbmfuvqarwz\",\"kraokq\":\"datafgtdmbvx\",\"aokbavlyttaaknwf\":\"databudbt\"}},\"name\":\"ke\",\"description\":\"mhpdu\",\"dataset\":{\"referenceName\":\"igatolekscbctna\",\"parameters\":{\"dpkawnsnl\":\"datamwbzxpdc\",\"bicziuswswj\":\"dataimouxwksqmudmfco\",\"fwbivqvo\":\"datakbqsjhbtqqvyfscy\",\"wvbhlimbyq\":\"datafuy\"}},\"linkedService\":{\"referenceName\":\"r\",\"parameters\":{\"asaxxo\":\"datalikcdrd\",\"kwiy\":\"datasm\",\"ukosrn\":\"datav\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"vzmlnkoywsxv\",\"datasetParameters\":\"databjqqaxuyvymcn\",\"parameters\":{\"wxqweuipmpvksmi\":\"datadoabhj\",\"krdpqgfhyrfr\":\"datansqxtltc\",\"rcwfcmfcnrjajq\":\"datakkld\",\"zqgxx\":\"dataatxjtiel\"},\"\":{\"prnzc\":\"databmtlpqagyno\",\"ryqxzxa\":\"datalin\",\"mqimiymqru\":\"datazi\",\"asvvoqsbpkfl\":\"dataguhfupe\"}}},{\"schemaLinkedService\":{\"referenceName\":\"fkg\",\"parameters\":{\"puohdkcprgukxrz\":\"dataaowuzo\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"ochlu\",\"parameters\":{\"izcbfzmcrunfhiuc\":\"datamqrud\",\"u\":\"datamfbcpaqktkrum\",\"kxiuxqggvqr\":\"datadkyzbfvxov\"}},\"name\":\"hyhlwcjsqg\",\"description\":\"hffbxrq\",\"dataset\":{\"referenceName\":\"ijpeuql\",\"parameters\":{\"swenawwa\":\"dataeqztvxwmwwm\"}},\"linkedService\":{\"referenceName\":\"cleqioulndhzyo\",\"parameters\":{\"llhsvidmyt\":\"dataht\",\"glxpnovyoanfbcsw\":\"datal\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"ywv\",\"datasetParameters\":\"dataigvjrktp\",\"parameters\":{\"mwhqnucsklh\":\"dataukyawoh\",\"sjt\":\"datai\"},\"\":{\"uoeedwjcci\":\"databninjgazlsvbzfc\",\"yehqbeivdlhydwb\":\"datalhsyekrdrenxolr\",\"mpathubtah\":\"databfgrlpunytjlkes\",\"niiwllbvgwz\":\"datae\"}}},{\"schemaLinkedService\":{\"referenceName\":\"ft\",\"parameters\":{\"ktjtgra\":\"dataus\",\"fkbebauzl\":\"dataaqo\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"txxwpfh\",\"parameters\":{\"oywhczzqrhmngqbe\":\"dataudrtpzkgme\",\"nykdi\":\"dataygisrz\"}},\"name\":\"jch\",\"description\":\"mpwctoflds\",\"dataset\":{\"referenceName\":\"cdhz\",\"parameters\":{\"ewhfjsrwqrxetf\":\"databrfgdrwji\",\"r\":\"datacwv\",\"ax\":\"datadqntycnawthv\"}},\"linkedService\":{\"referenceName\":\"u\",\"parameters\":{\"k\":\"datamcmhudfjeceh\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"qtwloes\",\"datasetParameters\":\"dataggvrbnyrukoilaci\",\"parameters\":{\"lh\":\"datajleip\",\"whbgxvellvul\":\"datayxpzruzythqk\"},\"\":{\"vm\":\"datamnitmujd\"}}},{\"schemaLinkedService\":{\"referenceName\":\"yymffhmjp\",\"parameters\":{\"zuvrzmzqmz\":\"datayx\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"rb\",\"parameters\":{\"tjpp\":\"datanmdyfoebo\",\"t\":\"datalaohoqkp\",\"lmhxdqaolfylnk\":\"dataqjilaywkdcwmqsyr\"}},\"name\":\"bjpjvlyw\",\"description\":\"mfwo\",\"dataset\":{\"referenceName\":\"jw\",\"parameters\":{\"nqzocrdzg\":\"datayj\",\"xdncaqtt\":\"datazeunt\",\"gyrihlgm\":\"dataekoifuvnyttzgi\",\"lkndrndpgfjodh\":\"databehlqtxnr\"}},\"linkedService\":{\"referenceName\":\"qotwfh\",\"parameters\":{\"zafczuumljci\":\"datawgsabvcipo\",\"veitit\":\"datavpefyc\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"xzajlnsjhwjuyxxb\",\"datasetParameters\":\"datavmv\",\"parameters\":{\"pntghyks\":\"datatuadxkxeqb\",\"t\":\"datarcdrnxsluvlzlad\",\"rhwzdanojisg\":\"datakpbqhvfdqqjw\",\"ztjctibpvbkae\":\"datalmvokat\"},\"\":{\"dfwakwseivmak\":\"datamzy\"}}}],\"transformations\":[{\"name\":\"so\",\"description\":\"juxlkbectvtfjm\",\"dataset\":{\"referenceName\":\"dchmaiubavlz\",\"parameters\":{\"jqafkmkro\":\"datagmfalkzazmgoked\",\"pqrtvaoznqni\":\"datazrthqet\",\"eituugedhfpjs\":\"dataiezeagm\",\"syjdeolctae\":\"datalzmb\"}},\"linkedService\":{\"referenceName\":\"syrled\",\"parameters\":{\"xzvsgeafgf\":\"datastbvtqig\",\"kkwa\":\"datasehxlzsxezp\",\"yfjlpzeqto\":\"dataes\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"lixlajmllpque\",\"datasetParameters\":\"dataam\",\"parameters\":{\"mkekxpkzwaqxo\":\"datagwb\"},\"\":{\"fidusztekxbyjgm\":\"datavchiqbpl\",\"hrdicxdwyjfo\":\"datafepxyihpqadag\",\"ukdveksbuhoduc\":\"dataxwyovcxjsgbip\",\"scrdp\":\"datav\"}}},{\"name\":\"bfdyjduss\",\"description\":\"szekbh\",\"dataset\":{\"referenceName\":\"kaaggkreh\",\"parameters\":{\"ybff\":\"datan\",\"sqtaadusrexxfa\":\"datajfiimreoa\",\"psimsf\":\"datasqwudohzilfmnli\"}},\"linkedService\":{\"referenceName\":\"pofqpmbhy\",\"parameters\":{\"erhsmvgohtw\":\"datadrmmttjxoph\",\"wwmhkruwae\":\"datamqilrixysfnimsqy\",\"in\":\"datarympmlq\",\"njdiqfliejhpcl\":\"datazduewihapfjii\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"dfsbwceivb\",\"datasetParameters\":\"dataipbwxgooo\",\"parameters\":{\"s\":\"datarad\",\"g\":\"dataxknpdgz\",\"wwnbafoctohz\":\"datasugswhgsaod\",\"hoadhrsxqvzv\":\"dataaquvwsxbgnvkervq\"},\"\":{\"klrxhjnltce\":\"databdsrgfajglzrsu\",\"ie\":\"datajdvqy\"}}}],\"script\":\"kw\",\"scriptLines\":[\"wdxvqzxoebwg\",\"xbibanbaupw\",\"zvpaklozkxbzrpej\",\"lssan\"]},\"description\":\"ttkgsux\",\"annotations\":[\"dataswgkpjhboyikebh\",\"datahkslgwlokhueoij\",\"datazcqypzqzufgsyf\",\"datajyvdwtfxptpqayam\"],\"folder\":{\"name\":\"fgybmxs\"}}") + .toObject(MappingDataFlow.class); + Assertions.assertEquals("ttkgsux", model.description()); + Assertions.assertEquals("fgybmxs", model.folder().name()); + Assertions.assertEquals("mhmpty", model.sources().get(0).name()); + Assertions.assertEquals("lkfbnrqqxvztpb", model.sources().get(0).description()); + Assertions.assertEquals("nqtxjtomalswbnf", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("zygleexahvm", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("bpmfbfununmpzkrv", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("wdyjqurykcrrauee", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("ke", model.sinks().get(0).name()); + Assertions.assertEquals("mhpdu", model.sinks().get(0).description()); + Assertions.assertEquals("igatolekscbctna", model.sinks().get(0).dataset().referenceName()); + Assertions.assertEquals("r", model.sinks().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get(0).flowlet().type()); + Assertions.assertEquals("vzmlnkoywsxv", model.sinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("dqgmih", model.sinks().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("kybtglwkzpgajsqj", model.sinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("so", model.transformations().get(0).name()); + Assertions.assertEquals("juxlkbectvtfjm", model.transformations().get(0).description()); + Assertions.assertEquals("dchmaiubavlz", model.transformations().get(0).dataset().referenceName()); + Assertions.assertEquals("syrled", model.transformations().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.transformations().get(0).flowlet().type()); + Assertions.assertEquals("lixlajmllpque", model.transformations().get(0).flowlet().referenceName()); + Assertions.assertEquals("kw", model.script()); + Assertions.assertEquals("wdxvqzxoebwg", model.scriptLines().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MappingDataFlow model = + new MappingDataFlow() + .withDescription("ttkgsux") + .withAnnotations( + Arrays + .asList( + "dataswgkpjhboyikebh", "datahkslgwlokhueoij", "datazcqypzqzufgsyf", "datajyvdwtfxptpqayam")) + .withFolder(new DataFlowFolder().withName("fgybmxs")) + .withSources( + Arrays + .asList( + new DataFlowSource() + .withName("mhmpty") + .withDescription("lkfbnrqqxvztpb") + .withDataset( + new DatasetReference() + .withReferenceName("nqtxjtomalswbnf") + .withParameters(mapOf("qjn", "datapld"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("zygleexahvm") + .withParameters( + mapOf("sjjzyvoaqajuveh", "datasbrcary", "be", "dataptdmkrrbhmpful"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("bpmfbfununmpzkrv") + .withDatasetParameters("dataifkdschlzvf") + .withParameters( + mapOf( + "rtogmhmj", + "datankjjwgcwnphbkgf", + "fp", + "datajsc", + "fv", + "dataqwtygevgwmseharx", + "x", + "datan")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("wdyjqurykcrrauee") + .withParameters(mapOf("cbcbgydlqidy", "datauehogdd"))), + new DataFlowSource() + .withName("kmdskjhhxd") + .withDescription("jfoxcxscvslxl") + .withDataset( + new DatasetReference() + .withReferenceName("a") + .withParameters( + mapOf( + "yjmkxettc", + "datamuk", + "xjhqxcsqhtkb", + "datalojfkqidnqto", + "dmbi", + "datanqlrng", + "qkzn", + "datapsnaww"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("hllxricctkw") + .withParameters( + mapOf( + "xhdctrceqnk", + "dataqoajxeiyglesrwva", + "lj", + "datarupobehd", + "bibnzpphepifex", + "dataacvumepj", + "cjclykcgxv", + "dataeqir"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("lvczu") + .withDatasetParameters("dataac") + .withParameters( + mapOf( + "koynuiylpckae", + "dataettepdjxqe", + "nzhctmjtsgh", + "datasedveskwxegqphrg", + "rpzeqac", + "databcbcpz", + "zshnuqndaizup", + "dataldtzmpypefcp")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("taoutnpdct") + .withParameters( + mapOf( + "y", + "datapfe", + "tybkcgs", + "datahduyeuyldph", + "x", + "datathhllnmwyne", + "fciatxtjrr", + "datax"))), + new DataFlowSource() + .withName("mb") + .withDescription("vifdxkecifhocjx") + .withDataset( + new DatasetReference() + .withReferenceName("loozrvt") + .withParameters( + mapOf( + "cpxxvirye", + "datamufun", + "lpmcrdc", + "datangjgvrquvpyg", + "x", + "dataeljtiahxmfqryarv"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("bglcjkayspthzodu") + .withParameters( + mapOf( + "djxyxgbkkqvjcteo", "datamjtgblioskkfmkm", "pxvjnzd", "datadlrslskk"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("cojhpcnabx") + .withDatasetParameters("datasnggytexvzilmhiv") + .withParameters(mapOf("cknrzda", "dataww", "eucyrth", "datalskzptjxul")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("shajqf") + .withParameters( + mapOf( + "hwu", + "dataeexpgeumi", + "dbzsx", + "datatrdexyionofnin", + "bzbcyksiv", + "datawqqrsmpcbbprtuga", + "rftsjcwjjxs", + "datafogdrtbfcm"))))) + .withSinks( + Arrays + .asList( + new DataFlowSink() + .withName("ke") + .withDescription("mhpdu") + .withDataset( + new DatasetReference() + .withReferenceName("igatolekscbctna") + .withParameters( + mapOf( + "dpkawnsnl", + "datamwbzxpdc", + "bicziuswswj", + "dataimouxwksqmudmfco", + "fwbivqvo", + "datakbqsjhbtqqvyfscy", + "wvbhlimbyq", + "datafuy"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("r") + .withParameters( + mapOf("asaxxo", "datalikcdrd", "kwiy", "datasm", "ukosrn", "datav"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("vzmlnkoywsxv") + .withDatasetParameters("databjqqaxuyvymcn") + .withParameters( + mapOf( + "wxqweuipmpvksmi", + "datadoabhj", + "krdpqgfhyrfr", + "datansqxtltc", + "rcwfcmfcnrjajq", + "datakkld", + "zqgxx", + "dataatxjtiel")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("dqgmih") + .withParameters( + mapOf("inklogxs", "datamcqrhnxt", "bjwzzos", "datatzarhzvqnsqktc"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("kybtglwkzpgajsqj") + .withParameters( + mapOf( + "uqrebluimmbwx", + "dataqbmfuvqarwz", + "kraokq", + "datafgtdmbvx", + "aokbavlyttaaknwf", + "databudbt"))), + new DataFlowSink() + .withName("hyhlwcjsqg") + .withDescription("hffbxrq") + .withDataset( + new DatasetReference() + .withReferenceName("ijpeuql") + .withParameters(mapOf("swenawwa", "dataeqztvxwmwwm"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("cleqioulndhzyo") + .withParameters(mapOf("llhsvidmyt", "dataht", "glxpnovyoanfbcsw", "datal"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("ywv") + .withDatasetParameters("dataigvjrktp") + .withParameters(mapOf("mwhqnucsklh", "dataukyawoh", "sjt", "datai")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("fkg") + .withParameters(mapOf("puohdkcprgukxrz", "dataaowuzo"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("ochlu") + .withParameters( + mapOf( + "izcbfzmcrunfhiuc", + "datamqrud", + "u", + "datamfbcpaqktkrum", + "kxiuxqggvqr", + "datadkyzbfvxov"))), + new DataFlowSink() + .withName("jch") + .withDescription("mpwctoflds") + .withDataset( + new DatasetReference() + .withReferenceName("cdhz") + .withParameters( + mapOf( + "ewhfjsrwqrxetf", + "databrfgdrwji", + "r", + "datacwv", + "ax", + "datadqntycnawthv"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("u") + .withParameters(mapOf("k", "datamcmhudfjeceh"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("qtwloes") + .withDatasetParameters("dataggvrbnyrukoilaci") + .withParameters(mapOf("lh", "datajleip", "whbgxvellvul", "datayxpzruzythqk")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("ft") + .withParameters(mapOf("ktjtgra", "dataus", "fkbebauzl", "dataaqo"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("txxwpfh") + .withParameters( + mapOf("oywhczzqrhmngqbe", "dataudrtpzkgme", "nykdi", "dataygisrz"))), + new DataFlowSink() + .withName("bjpjvlyw") + .withDescription("mfwo") + .withDataset( + new DatasetReference() + .withReferenceName("jw") + .withParameters( + mapOf( + "nqzocrdzg", + "datayj", + "xdncaqtt", + "datazeunt", + "gyrihlgm", + "dataekoifuvnyttzgi", + "lkndrndpgfjodh", + "databehlqtxnr"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("qotwfh") + .withParameters( + mapOf("zafczuumljci", "datawgsabvcipo", "veitit", "datavpefyc"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("xzajlnsjhwjuyxxb") + .withDatasetParameters("datavmv") + .withParameters( + mapOf( + "pntghyks", + "datatuadxkxeqb", + "t", + "datarcdrnxsluvlzlad", + "rhwzdanojisg", + "datakpbqhvfdqqjw", + "ztjctibpvbkae", + "datalmvokat")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("yymffhmjp") + .withParameters(mapOf("zuvrzmzqmz", "datayx"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("rb") + .withParameters( + mapOf( + "tjpp", + "datanmdyfoebo", + "t", + "datalaohoqkp", + "lmhxdqaolfylnk", + "dataqjilaywkdcwmqsyr"))))) + .withTransformations( + Arrays + .asList( + new Transformation() + .withName("so") + .withDescription("juxlkbectvtfjm") + .withDataset( + new DatasetReference() + .withReferenceName("dchmaiubavlz") + .withParameters( + mapOf( + "jqafkmkro", + "datagmfalkzazmgoked", + "pqrtvaoznqni", + "datazrthqet", + "eituugedhfpjs", + "dataiezeagm", + "syjdeolctae", + "datalzmb"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("syrled") + .withParameters( + mapOf( + "xzvsgeafgf", + "datastbvtqig", + "kkwa", + "datasehxlzsxezp", + "yfjlpzeqto", + "dataes"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("lixlajmllpque") + .withDatasetParameters("dataam") + .withParameters(mapOf("mkekxpkzwaqxo", "datagwb")) + .withAdditionalProperties(mapOf())), + new Transformation() + .withName("bfdyjduss") + .withDescription("szekbh") + .withDataset( + new DatasetReference() + .withReferenceName("kaaggkreh") + .withParameters( + mapOf( + "ybff", + "datan", + "sqtaadusrexxfa", + "datajfiimreoa", + "psimsf", + "datasqwudohzilfmnli"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("pofqpmbhy") + .withParameters( + mapOf( + "erhsmvgohtw", + "datadrmmttjxoph", + "wwmhkruwae", + "datamqilrixysfnimsqy", + "in", + "datarympmlq", + "njdiqfliejhpcl", + "datazduewihapfjii"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("dfsbwceivb") + .withDatasetParameters("dataipbwxgooo") + .withParameters( + mapOf( + "s", + "datarad", + "g", + "dataxknpdgz", + "wwnbafoctohz", + "datasugswhgsaod", + "hoadhrsxqvzv", + "dataaquvwsxbgnvkervq")) + .withAdditionalProperties(mapOf())))) + .withScript("kw") + .withScriptLines(Arrays.asList("wdxvqzxoebwg", "xbibanbaupw", "zvpaklozkxbzrpej", "lssan")); + model = BinaryData.fromObject(model).toObject(MappingDataFlow.class); + Assertions.assertEquals("ttkgsux", model.description()); + Assertions.assertEquals("fgybmxs", model.folder().name()); + Assertions.assertEquals("mhmpty", model.sources().get(0).name()); + Assertions.assertEquals("lkfbnrqqxvztpb", model.sources().get(0).description()); + Assertions.assertEquals("nqtxjtomalswbnf", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("zygleexahvm", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("bpmfbfununmpzkrv", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("wdyjqurykcrrauee", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("ke", model.sinks().get(0).name()); + Assertions.assertEquals("mhpdu", model.sinks().get(0).description()); + Assertions.assertEquals("igatolekscbctna", model.sinks().get(0).dataset().referenceName()); + Assertions.assertEquals("r", model.sinks().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get(0).flowlet().type()); + Assertions.assertEquals("vzmlnkoywsxv", model.sinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("dqgmih", model.sinks().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("kybtglwkzpgajsqj", model.sinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("so", model.transformations().get(0).name()); + Assertions.assertEquals("juxlkbectvtfjm", model.transformations().get(0).description()); + Assertions.assertEquals("dchmaiubavlz", model.transformations().get(0).dataset().referenceName()); + Assertions.assertEquals("syrled", model.transformations().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.transformations().get(0).flowlet().type()); + Assertions.assertEquals("lixlajmllpque", model.transformations().get(0).flowlet().referenceName()); + Assertions.assertEquals("kw", model.script()); + Assertions.assertEquals("wdxvqzxoebwg", model.scriptLines().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MappingDataFlowTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MappingDataFlowTypePropertiesTests.java new file mode 100644 index 000000000000..35fb89c683d9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MappingDataFlowTypePropertiesTests.java @@ -0,0 +1,524 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.MappingDataFlowTypeProperties; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DataFlowSink; +import com.azure.resourcemanager.datafactory.models.DataFlowSource; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.Transformation; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MappingDataFlowTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MappingDataFlowTypeProperties model = + BinaryData + .fromString( + "{\"sources\":[{\"schemaLinkedService\":{\"referenceName\":\"uullojkp\",\"parameters\":{\"wdjuxdbdljzgdy\":\"datag\"}},\"name\":\"cvuq\",\"description\":\"gzlrqhbj\",\"dataset\":{\"referenceName\":\"ogdxwbsfpyxxtjlf\",\"parameters\":{\"xdhilz\":\"dataominxojjlu\",\"za\":\"datadzzqjmu\",\"otokhtvwtaznk\":\"dataovribq\",\"wjyofgwhnkbtl\":\"dataqww\"}},\"linkedService\":{\"referenceName\":\"jssmctsnldkpwo\",\"parameters\":{\"bxbteogfgfiijry\":\"datas\",\"m\":\"datawlefksxqceazfpxg\",\"aiossscyvaifp\":\"datavzvluyq\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"cvfyeowpsfxtjdhs\",\"datasetParameters\":\"datamhpv\",\"parameters\":{\"pboujs\":\"dataftteh\",\"suenyg\":\"datakfvvdshxcde\",\"nquktrfnslnlrxs\":\"dataxcgjtf\",\"wntfmtbgwjdxwna\":\"dataylt\"},\"\":{\"wjwzzqseuzuukykc\":\"datarrdreyzjwhset\",\"tewfopazdazgbsq\":\"dataqhyqqzzdcykey\",\"c\":\"datapew\",\"qjbknl\":\"datautmdpvozg\"}}},{\"schemaLinkedService\":{\"referenceName\":\"lctzeyowmndcovd\",\"parameters\":{\"kvfruwkudr\":\"dataauxzanh\",\"udqyemeb\":\"datacpft\"}},\"name\":\"naucmcirtnee\",\"description\":\"jauwcgxefnohaitr\",\"dataset\":{\"referenceName\":\"izerw\",\"parameters\":{\"ocefhpriylfmpzt\":\"dataasmxubvfbngf\",\"vhl\":\"dataaud\"}},\"linkedService\":{\"referenceName\":\"culregpqt\",\"parameters\":{\"shqrdgrt\":\"datahvrztnvg\",\"fa\":\"datamewjzlpyk\",\"zrransyb\":\"datazwjcaye\",\"nkfscjfn\":\"datalpolwzrghsrle\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"vuagfqwtl\",\"datasetParameters\":\"datagvmreuptrklzmi\",\"parameters\":{\"xfsv\":\"datawo\",\"nwlslrcigtzjcvbx\":\"dataghmp\",\"yxpavidnie\":\"datalapsnsso\",\"slpuxgcbdsva\":\"datawffcvvye\"},\"\":{\"vnjobfelhldiuhzz\":\"dataptwtrkxgpazwugxy\"}}},{\"schemaLinkedService\":{\"referenceName\":\"lmfaewzgiudjp\",\"parameters\":{\"mhk\":\"datahttqh\",\"gcruxspinym\":\"dataezsdsuxheq\",\"zfbmjxuv\":\"dataqgwokmikp\"}},\"name\":\"ipfdvhaxdvwzaehp\",\"description\":\"thd\",\"dataset\":{\"referenceName\":\"mvetatlakfq\",\"parameters\":{\"rpogwphchg\":\"datawgiksbbvtoo\",\"htukfac\":\"datat\"}},\"linkedService\":{\"referenceName\":\"mbf\",\"parameters\":{\"wcgasgom\":\"datameezbxvqxbnu\",\"qgo\":\"datamjzwx\",\"gfredmlscg\":\"datasxpwwztjfmkkh\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"ccnaov\",\"datasetParameters\":\"datawazhpabaco\",\"parameters\":{\"nmvceb\":\"dataotgkwsxnsrqorcg\",\"dcqjkedwqurc\":\"dataeetqujxcxxq\",\"qqrsil\":\"dataojmrvvxwjongzse\",\"sbvr\":\"datachskxxka\"},\"\":{\"ojrulfuctejrt\":\"datagv\",\"ubqjro\":\"datacfjzhxl\",\"beqrztrx\":\"datatvrjeqmtz\"}}},{\"schemaLinkedService\":{\"referenceName\":\"xrd\",\"parameters\":{\"kkvyanxk\":\"datasrwrsnrhpqati\",\"qxetqmmlivrjjx\":\"datavcsemsvuvdj\",\"gfquwz\":\"datawxdchpojxlehzlx\",\"ibelwcerwkw\":\"dataw\"}},\"name\":\"pjxljtxb\",\"description\":\"qtbxxniuisdzh\",\"dataset\":{\"referenceName\":\"d\",\"parameters\":{\"r\":\"dataagsecnadbuw\",\"zoellnkkiiwvmtum\":\"dataxfllmqiyn\",\"oqvqpilr\":\"datapymdjfuax\"}},\"linkedService\":{\"referenceName\":\"ncanlduwzor\",\"parameters\":{\"kqv\":\"datamxaqklxym\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"pdxcltuubwy\",\"datasetParameters\":\"datajbowcpj\",\"parameters\":{\"exkydfb\":\"dataqgi\",\"vhuerkjddvrglieg\":\"datalj\"},\"\":{\"fgmwd\":\"datavbiiftksdwgdnk\",\"buvczldbglzoutb\":\"datac\",\"orbjg\":\"dataaqgzekajclyzgs\"}}}],\"sinks\":[{\"schemaLinkedService\":{\"referenceName\":\"otvmrxk\",\"parameters\":{\"yfluiyuosnuudte\":\"databvvjbhvhdiq\",\"buubpyrowt\":\"datavhyibdrqrsw\",\"czevjnn\":\"dataoxztfwfqch\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"agfyvrtpqpe\",\"parameters\":{\"wqwemvxqabckmze\":\"datacgkrepdqhqy\"}},\"name\":\"xin\",\"description\":\"re\",\"dataset\":{\"referenceName\":\"twhlpuzjpce\",\"parameters\":{\"phmsexroq\":\"datazangprbfaxyxzlbc\",\"nfee\":\"datandktxfv\",\"bgnixxoww\":\"datagpkrie\"}},\"linkedService\":{\"referenceName\":\"yfwnw\",\"parameters\":{\"icrmpepkldmaxxi\":\"dataxe\",\"ws\":\"datavs\",\"wrasekw\":\"datagkjgya\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"voinwo\",\"datasetParameters\":\"datartwy\",\"parameters\":{\"msfobjlquvj\":\"datacladvatdavuqmcb\"},\"\":{\"mvpsimioyo\":\"dataj\",\"clibbfqpsp\":\"dataglkmiqwnnr\"}}},{\"schemaLinkedService\":{\"referenceName\":\"adydg\",\"parameters\":{\"mnmabeddqil\":\"datautwukexzg\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"d\",\"parameters\":{\"vstclg\":\"dataqfp\"}},\"name\":\"rvwerfwxbsmtb\",\"description\":\"jehhci\",\"dataset\":{\"referenceName\":\"wdv\",\"parameters\":{\"hsqhtf\":\"datarek\",\"yejuwyqwdqigmghg\":\"datawpq\",\"jcmrnkfm\":\"datanztxlujkh\"}},\"linkedService\":{\"referenceName\":\"cqtwmlmhjnqtq\",\"parameters\":{\"dvragpokddxejhh\":\"dataj\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"uavt\",\"datasetParameters\":\"databkew\",\"parameters\":{\"pgb\":\"datan\"},\"\":{\"kmyrljialzbnobr\":\"datafbkkwvdxaexq\",\"yudivbxnhsqeaeo\":\"datalpbcjtrpz\",\"ogatmoljiy\":\"dataqelwgdhuruzytza\",\"knsjulugd\":\"datampinmzvfkneerzzt\"}}},{\"schemaLinkedService\":{\"referenceName\":\"nhrxlel\",\"parameters\":{\"izcpihtdmiw\":\"datak\",\"caydbjzcqymlcfnz\":\"dataekpt\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"hsurlgw\",\"parameters\":{\"tauolawiubmom\":\"datammzp\",\"ohewjj\":\"datagvvjhvvlr\"}},\"name\":\"ajnkdflqionswae\",\"description\":\"zfz\",\"dataset\":{\"referenceName\":\"jo\",\"parameters\":{\"otryegp\":\"datah\",\"rmexznlwkb\":\"datah\",\"fgjblcd\":\"dataokxkhupzer\"}},\"linkedService\":{\"referenceName\":\"yfcemftz\",\"parameters\":{\"ugekdfqn\":\"datakya\",\"owrczfjjnnuxxr\":\"datattw\",\"frhjulrsulwzp\":\"datakmhmnulwempdc\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"snawmhhgzotfri\",\"datasetParameters\":\"datagkoekvzwxxyxh\",\"parameters\":{\"y\":\"datactxbxmolpcqyd\",\"rjeizik\":\"datavskiczd\",\"ycqsxr\":\"dataqaboohxbms\",\"ewuyqa\":\"datad\"},\"\":{\"hhdau\":\"datapjhgejkb\",\"exbkhx\":\"dataghoox\"}}}],\"transformations\":[{\"name\":\"oez\",\"description\":\"xrkdknkobektm\",\"dataset\":{\"referenceName\":\"z\",\"parameters\":{\"gwcd\":\"datazamicb\",\"m\":\"datazseznuxkeuairaa\",\"ihzbdnpxpk\":\"datalqjbedpfixlhupmo\"}},\"linkedService\":{\"referenceName\":\"pre\",\"parameters\":{\"ssjyghsfx\":\"datalyicghflru\",\"ammgmqfmefgv\":\"datakb\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"dwj\",\"datasetParameters\":\"datauxweyslandkd\",\"parameters\":{\"hcgawn\":\"datahunh\",\"ireimseobf\":\"datarnquoxso\",\"xcjzlquze\":\"dataxstcyilbvzm\"},\"\":{\"b\":\"datajxebj\",\"v\":\"datainzabwmvoglj\"}}},{\"name\":\"pgidnw\",\"description\":\"haqidoyzltgiomqo\",\"dataset\":{\"referenceName\":\"epiaeapfsergd\",\"parameters\":{\"b\":\"dataqnacyheq\"}},\"linkedService\":{\"referenceName\":\"qncjubkhjozfymcw\",\"parameters\":{\"li\":\"datapyvqy\",\"hddzydisnuepy\":\"dataiipsejbsvsiaies\",\"dpxot\":\"datayjln\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"i\",\"datasetParameters\":\"datacqibzj\",\"parameters\":{\"iphryvcjwqwo\":\"dataee\",\"pijhfrzgdkk\":\"datasratjhdhzyb\",\"ukhsusmmorf\":\"datagv\"},\"\":{\"neyttl\":\"datawilzzhnijmriprlk\",\"bkut\":\"datacxiv\"}}},{\"name\":\"umltwjflu\",\"description\":\"nbpvzlq\",\"dataset\":{\"referenceName\":\"auyqnj\",\"parameters\":{\"u\":\"datamocgjshg\",\"xqqggljky\":\"datarhwv\",\"rbctbhpjhxpcvrd\":\"datasjrclrvtzq\"}},\"linkedService\":{\"referenceName\":\"eitaneqadynzjahw\",\"parameters\":{\"xwspcaxikhfjq\":\"dataomzczfkiceevsa\",\"ysemtmesrfsvpin\":\"databglcxkxgzzromvy\",\"swxspvckojaz\":\"datazpatqtd\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"spftesubzpv\",\"datasetParameters\":\"datadylytcovq\",\"parameters\":{\"lbmuos\":\"datasrfjbdxzfxnx\"},\"\":{\"yzlwhbwzjnufzrf\":\"datamdihdcy\",\"qgnnbz\":\"datam\",\"ubjtvgjsxmtyjjv\":\"datatftedz\",\"sffofwanmhksca\":\"datavdpwwobtdphti\"}}},{\"name\":\"w\",\"description\":\"cgwdfriwgybjp\",\"dataset\":{\"referenceName\":\"ok\",\"parameters\":{\"k\":\"datagllixdgbyfgwew\",\"xlcskltez\":\"datavxprwpxsoohu\",\"srtmdylperpiltt\":\"dataugggzlfbgrdcgu\"}},\"linkedService\":{\"referenceName\":\"gczfc\",\"parameters\":{\"uvftwaivmuqk\":\"datafbodetresrgvts\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"gjypanhxmpdxxze\",\"datasetParameters\":\"datawzjwotnxlkfhg\",\"parameters\":{\"pcs\":\"datafoxqwecrsn\"},\"\":{\"rmlccmet\":\"dataxovppqibukklvzr\",\"vfqbqna\":\"datascz\",\"yvdgxlyzk\":\"datadsyenzsieuscpl\"}}}],\"script\":\"tdsh\",\"scriptLines\":[\"vkolrupjovmo\",\"sayebra\"]}") + .toObject(MappingDataFlowTypeProperties.class); + Assertions.assertEquals("cvuq", model.sources().get(0).name()); + Assertions.assertEquals("gzlrqhbj", model.sources().get(0).description()); + Assertions.assertEquals("ogdxwbsfpyxxtjlf", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("jssmctsnldkpwo", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("cvfyeowpsfxtjdhs", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("uullojkp", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("xin", model.sinks().get(0).name()); + Assertions.assertEquals("re", model.sinks().get(0).description()); + Assertions.assertEquals("twhlpuzjpce", model.sinks().get(0).dataset().referenceName()); + Assertions.assertEquals("yfwnw", model.sinks().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get(0).flowlet().type()); + Assertions.assertEquals("voinwo", model.sinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("otvmrxk", model.sinks().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("agfyvrtpqpe", model.sinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("oez", model.transformations().get(0).name()); + Assertions.assertEquals("xrkdknkobektm", model.transformations().get(0).description()); + Assertions.assertEquals("z", model.transformations().get(0).dataset().referenceName()); + Assertions.assertEquals("pre", model.transformations().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.transformations().get(0).flowlet().type()); + Assertions.assertEquals("dwj", model.transformations().get(0).flowlet().referenceName()); + Assertions.assertEquals("tdsh", model.script()); + Assertions.assertEquals("vkolrupjovmo", model.scriptLines().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MappingDataFlowTypeProperties model = + new MappingDataFlowTypeProperties() + .withSources( + Arrays + .asList( + new DataFlowSource() + .withName("cvuq") + .withDescription("gzlrqhbj") + .withDataset( + new DatasetReference() + .withReferenceName("ogdxwbsfpyxxtjlf") + .withParameters( + mapOf( + "xdhilz", + "dataominxojjlu", + "za", + "datadzzqjmu", + "otokhtvwtaznk", + "dataovribq", + "wjyofgwhnkbtl", + "dataqww"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("jssmctsnldkpwo") + .withParameters( + mapOf( + "bxbteogfgfiijry", + "datas", + "m", + "datawlefksxqceazfpxg", + "aiossscyvaifp", + "datavzvluyq"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("cvfyeowpsfxtjdhs") + .withDatasetParameters("datamhpv") + .withParameters( + mapOf( + "pboujs", + "dataftteh", + "suenyg", + "datakfvvdshxcde", + "nquktrfnslnlrxs", + "dataxcgjtf", + "wntfmtbgwjdxwna", + "dataylt")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("uullojkp") + .withParameters(mapOf("wdjuxdbdljzgdy", "datag"))), + new DataFlowSource() + .withName("naucmcirtnee") + .withDescription("jauwcgxefnohaitr") + .withDataset( + new DatasetReference() + .withReferenceName("izerw") + .withParameters(mapOf("ocefhpriylfmpzt", "dataasmxubvfbngf", "vhl", "dataaud"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("culregpqt") + .withParameters( + mapOf( + "shqrdgrt", + "datahvrztnvg", + "fa", + "datamewjzlpyk", + "zrransyb", + "datazwjcaye", + "nkfscjfn", + "datalpolwzrghsrle"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("vuagfqwtl") + .withDatasetParameters("datagvmreuptrklzmi") + .withParameters( + mapOf( + "xfsv", + "datawo", + "nwlslrcigtzjcvbx", + "dataghmp", + "yxpavidnie", + "datalapsnsso", + "slpuxgcbdsva", + "datawffcvvye")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("lctzeyowmndcovd") + .withParameters(mapOf("kvfruwkudr", "dataauxzanh", "udqyemeb", "datacpft"))), + new DataFlowSource() + .withName("ipfdvhaxdvwzaehp") + .withDescription("thd") + .withDataset( + new DatasetReference() + .withReferenceName("mvetatlakfq") + .withParameters(mapOf("rpogwphchg", "datawgiksbbvtoo", "htukfac", "datat"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("mbf") + .withParameters( + mapOf( + "wcgasgom", + "datameezbxvqxbnu", + "qgo", + "datamjzwx", + "gfredmlscg", + "datasxpwwztjfmkkh"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("ccnaov") + .withDatasetParameters("datawazhpabaco") + .withParameters( + mapOf( + "nmvceb", + "dataotgkwsxnsrqorcg", + "dcqjkedwqurc", + "dataeetqujxcxxq", + "qqrsil", + "dataojmrvvxwjongzse", + "sbvr", + "datachskxxka")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("lmfaewzgiudjp") + .withParameters( + mapOf( + "mhk", + "datahttqh", + "gcruxspinym", + "dataezsdsuxheq", + "zfbmjxuv", + "dataqgwokmikp"))), + new DataFlowSource() + .withName("pjxljtxb") + .withDescription("qtbxxniuisdzh") + .withDataset( + new DatasetReference() + .withReferenceName("d") + .withParameters( + mapOf( + "r", + "dataagsecnadbuw", + "zoellnkkiiwvmtum", + "dataxfllmqiyn", + "oqvqpilr", + "datapymdjfuax"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("ncanlduwzor") + .withParameters(mapOf("kqv", "datamxaqklxym"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("pdxcltuubwy") + .withDatasetParameters("datajbowcpj") + .withParameters(mapOf("exkydfb", "dataqgi", "vhuerkjddvrglieg", "datalj")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("xrd") + .withParameters( + mapOf( + "kkvyanxk", + "datasrwrsnrhpqati", + "qxetqmmlivrjjx", + "datavcsemsvuvdj", + "gfquwz", + "datawxdchpojxlehzlx", + "ibelwcerwkw", + "dataw"))))) + .withSinks( + Arrays + .asList( + new DataFlowSink() + .withName("xin") + .withDescription("re") + .withDataset( + new DatasetReference() + .withReferenceName("twhlpuzjpce") + .withParameters( + mapOf( + "phmsexroq", + "datazangprbfaxyxzlbc", + "nfee", + "datandktxfv", + "bgnixxoww", + "datagpkrie"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("yfwnw") + .withParameters( + mapOf( + "icrmpepkldmaxxi", "dataxe", "ws", "datavs", "wrasekw", "datagkjgya"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("voinwo") + .withDatasetParameters("datartwy") + .withParameters(mapOf("msfobjlquvj", "datacladvatdavuqmcb")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("otvmrxk") + .withParameters( + mapOf( + "yfluiyuosnuudte", + "databvvjbhvhdiq", + "buubpyrowt", + "datavhyibdrqrsw", + "czevjnn", + "dataoxztfwfqch"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("agfyvrtpqpe") + .withParameters(mapOf("wqwemvxqabckmze", "datacgkrepdqhqy"))), + new DataFlowSink() + .withName("rvwerfwxbsmtb") + .withDescription("jehhci") + .withDataset( + new DatasetReference() + .withReferenceName("wdv") + .withParameters( + mapOf( + "hsqhtf", + "datarek", + "yejuwyqwdqigmghg", + "datawpq", + "jcmrnkfm", + "datanztxlujkh"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("cqtwmlmhjnqtq") + .withParameters(mapOf("dvragpokddxejhh", "dataj"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("uavt") + .withDatasetParameters("databkew") + .withParameters(mapOf("pgb", "datan")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("adydg") + .withParameters(mapOf("mnmabeddqil", "datautwukexzg"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("d") + .withParameters(mapOf("vstclg", "dataqfp"))), + new DataFlowSink() + .withName("ajnkdflqionswae") + .withDescription("zfz") + .withDataset( + new DatasetReference() + .withReferenceName("jo") + .withParameters( + mapOf( + "otryegp", + "datah", + "rmexznlwkb", + "datah", + "fgjblcd", + "dataokxkhupzer"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("yfcemftz") + .withParameters( + mapOf( + "ugekdfqn", + "datakya", + "owrczfjjnnuxxr", + "datattw", + "frhjulrsulwzp", + "datakmhmnulwempdc"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("snawmhhgzotfri") + .withDatasetParameters("datagkoekvzwxxyxh") + .withParameters( + mapOf( + "y", + "datactxbxmolpcqyd", + "rjeizik", + "datavskiczd", + "ycqsxr", + "dataqaboohxbms", + "ewuyqa", + "datad")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("nhrxlel") + .withParameters(mapOf("izcpihtdmiw", "datak", "caydbjzcqymlcfnz", "dataekpt"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("hsurlgw") + .withParameters( + mapOf("tauolawiubmom", "datammzp", "ohewjj", "datagvvjhvvlr"))))) + .withTransformations( + Arrays + .asList( + new Transformation() + .withName("oez") + .withDescription("xrkdknkobektm") + .withDataset( + new DatasetReference() + .withReferenceName("z") + .withParameters( + mapOf( + "gwcd", + "datazamicb", + "m", + "datazseznuxkeuairaa", + "ihzbdnpxpk", + "datalqjbedpfixlhupmo"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("pre") + .withParameters(mapOf("ssjyghsfx", "datalyicghflru", "ammgmqfmefgv", "datakb"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("dwj") + .withDatasetParameters("datauxweyslandkd") + .withParameters( + mapOf( + "hcgawn", + "datahunh", + "ireimseobf", + "datarnquoxso", + "xcjzlquze", + "dataxstcyilbvzm")) + .withAdditionalProperties(mapOf())), + new Transformation() + .withName("pgidnw") + .withDescription("haqidoyzltgiomqo") + .withDataset( + new DatasetReference() + .withReferenceName("epiaeapfsergd") + .withParameters(mapOf("b", "dataqnacyheq"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("qncjubkhjozfymcw") + .withParameters( + mapOf( + "li", + "datapyvqy", + "hddzydisnuepy", + "dataiipsejbsvsiaies", + "dpxot", + "datayjln"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("i") + .withDatasetParameters("datacqibzj") + .withParameters( + mapOf( + "iphryvcjwqwo", + "dataee", + "pijhfrzgdkk", + "datasratjhdhzyb", + "ukhsusmmorf", + "datagv")) + .withAdditionalProperties(mapOf())), + new Transformation() + .withName("umltwjflu") + .withDescription("nbpvzlq") + .withDataset( + new DatasetReference() + .withReferenceName("auyqnj") + .withParameters( + mapOf( + "u", + "datamocgjshg", + "xqqggljky", + "datarhwv", + "rbctbhpjhxpcvrd", + "datasjrclrvtzq"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("eitaneqadynzjahw") + .withParameters( + mapOf( + "xwspcaxikhfjq", + "dataomzczfkiceevsa", + "ysemtmesrfsvpin", + "databglcxkxgzzromvy", + "swxspvckojaz", + "datazpatqtd"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("spftesubzpv") + .withDatasetParameters("datadylytcovq") + .withParameters(mapOf("lbmuos", "datasrfjbdxzfxnx")) + .withAdditionalProperties(mapOf())), + new Transformation() + .withName("w") + .withDescription("cgwdfriwgybjp") + .withDataset( + new DatasetReference() + .withReferenceName("ok") + .withParameters( + mapOf( + "k", + "datagllixdgbyfgwew", + "xlcskltez", + "datavxprwpxsoohu", + "srtmdylperpiltt", + "dataugggzlfbgrdcgu"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("gczfc") + .withParameters(mapOf("uvftwaivmuqk", "datafbodetresrgvts"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("gjypanhxmpdxxze") + .withDatasetParameters("datawzjwotnxlkfhg") + .withParameters(mapOf("pcs", "datafoxqwecrsn")) + .withAdditionalProperties(mapOf())))) + .withScript("tdsh") + .withScriptLines(Arrays.asList("vkolrupjovmo", "sayebra")); + model = BinaryData.fromObject(model).toObject(MappingDataFlowTypeProperties.class); + Assertions.assertEquals("cvuq", model.sources().get(0).name()); + Assertions.assertEquals("gzlrqhbj", model.sources().get(0).description()); + Assertions.assertEquals("ogdxwbsfpyxxtjlf", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("jssmctsnldkpwo", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("cvfyeowpsfxtjdhs", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("uullojkp", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("xin", model.sinks().get(0).name()); + Assertions.assertEquals("re", model.sinks().get(0).description()); + Assertions.assertEquals("twhlpuzjpce", model.sinks().get(0).dataset().referenceName()); + Assertions.assertEquals("yfwnw", model.sinks().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sinks().get(0).flowlet().type()); + Assertions.assertEquals("voinwo", model.sinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("otvmrxk", model.sinks().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("agfyvrtpqpe", model.sinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("oez", model.transformations().get(0).name()); + Assertions.assertEquals("xrkdknkobektm", model.transformations().get(0).description()); + Assertions.assertEquals("z", model.transformations().get(0).dataset().referenceName()); + Assertions.assertEquals("pre", model.transformations().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.transformations().get(0).flowlet().type()); + Assertions.assertEquals("dwj", model.transformations().get(0).flowlet().referenceName()); + Assertions.assertEquals("tdsh", model.script()); + Assertions.assertEquals("vkolrupjovmo", model.scriptLines().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MariaDBSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MariaDBSourceTests.java new file mode 100644 index 000000000000..1afd3e97c069 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MariaDBSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MariaDBSource; + +public final class MariaDBSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MariaDBSource model = + BinaryData + .fromString( + "{\"type\":\"MariaDBSource\",\"query\":\"datagyivsiirx\",\"queryTimeout\":\"datappqpsiniidaxbesb\",\"additionalColumns\":\"dataizyjch\",\"sourceRetryCount\":\"dataasjrseqpo\",\"sourceRetryWait\":\"datahgksqwzuosyyxl\",\"maxConcurrentConnections\":\"dataxzudfarzayrdyrow\",\"disableMetricsCollection\":\"datakpdpudqiwhvxb\",\"\":{\"deffrbxzjedy\":\"dataoeuufws\",\"no\":\"datajisxspnmfydphls\",\"vjlqfzlbpe\":\"dataqb\",\"nlxstp\":\"datavjpgllr\"}}") + .toObject(MariaDBSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MariaDBSource model = + new MariaDBSource() + .withSourceRetryCount("dataasjrseqpo") + .withSourceRetryWait("datahgksqwzuosyyxl") + .withMaxConcurrentConnections("dataxzudfarzayrdyrow") + .withDisableMetricsCollection("datakpdpudqiwhvxb") + .withQueryTimeout("datappqpsiniidaxbesb") + .withAdditionalColumns("dataizyjch") + .withQuery("datagyivsiirx"); + model = BinaryData.fromObject(model).toObject(MariaDBSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MariaDBTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MariaDBTableDatasetTests.java new file mode 100644 index 000000000000..3fc5a0427b16 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MariaDBTableDatasetTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MariaDBTableDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MariaDBTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MariaDBTableDataset model = + BinaryData + .fromString( + "{\"type\":\"MariaDBTable\",\"typeProperties\":{\"tableName\":\"datax\"},\"description\":\"mlfouqpskva\",\"structure\":\"databpmr\",\"schema\":\"datayjxcqcaczzvw\",\"linkedServiceName\":{\"referenceName\":\"ezttqjqyfy\",\"parameters\":{\"lrzhshhkbchcazk\":\"datayyslgyfybdsvk\"}},\"parameters\":{\"fyyqjc\":{\"type\":\"Float\",\"defaultValue\":\"dataprgfwhfzhhrurm\"},\"sddcuqddlda\":{\"type\":\"Bool\",\"defaultValue\":\"datazq\"},\"ojesxjhtyzzwqocy\":{\"type\":\"Int\",\"defaultValue\":\"datafztqewq\"},\"trgu\":{\"type\":\"Bool\",\"defaultValue\":\"dataineuaxpmez\"}},\"annotations\":[\"dataeo\",\"dataxfoa\",\"datazdypz\"],\"folder\":{\"name\":\"mndhgwhlbpju\"},\"\":{\"mitnwlyhbujysvd\":\"dataqxa\",\"dbhatmabtpgn\":\"datayy\"}}") + .toObject(MariaDBTableDataset.class); + Assertions.assertEquals("mlfouqpskva", model.description()); + Assertions.assertEquals("ezttqjqyfy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("fyyqjc").type()); + Assertions.assertEquals("mndhgwhlbpju", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MariaDBTableDataset model = + new MariaDBTableDataset() + .withDescription("mlfouqpskva") + .withStructure("databpmr") + .withSchema("datayjxcqcaczzvw") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ezttqjqyfy") + .withParameters(mapOf("lrzhshhkbchcazk", "datayyslgyfybdsvk"))) + .withParameters( + mapOf( + "fyyqjc", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("dataprgfwhfzhhrurm"), + "sddcuqddlda", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datazq"), + "ojesxjhtyzzwqocy", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datafztqewq"), + "trgu", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataineuaxpmez"))) + .withAnnotations(Arrays.asList("dataeo", "dataxfoa", "datazdypz")) + .withFolder(new DatasetFolder().withName("mndhgwhlbpju")) + .withTableName("datax"); + model = BinaryData.fromObject(model).toObject(MariaDBTableDataset.class); + Assertions.assertEquals("mlfouqpskva", model.description()); + Assertions.assertEquals("ezttqjqyfy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("fyyqjc").type()); + Assertions.assertEquals("mndhgwhlbpju", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MarketoObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MarketoObjectDatasetTests.java new file mode 100644 index 000000000000..6360fe74c26e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MarketoObjectDatasetTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MarketoObjectDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MarketoObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketoObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"MarketoObject\",\"typeProperties\":{\"tableName\":\"dataomeqg\"},\"description\":\"wisp\",\"structure\":\"datagdblwj\",\"schema\":\"dataaqxaxtuxi\",\"linkedServiceName\":{\"referenceName\":\"ppbiichl\",\"parameters\":{\"zdxywabkitnipapt\":\"datavuixwonkrn\"}},\"parameters\":{\"ewltono\":{\"type\":\"Bool\",\"defaultValue\":\"datayjukkajn\"},\"di\":{\"type\":\"Int\",\"defaultValue\":\"dataemiwfhhawbabhzbf\"},\"zsuspaywvslq\":{\"type\":\"SecureString\",\"defaultValue\":\"dataxydgzfoi\"}},\"annotations\":[\"datanzea\",\"datakxfmu\",\"datadbvytq\"],\"folder\":{\"name\":\"uymkdeuqxlvzpfd\"},\"\":{\"rrmtrxgjmpdvrjz\":\"datagbiwpgopqlktthb\"}}") + .toObject(MarketoObjectDataset.class); + Assertions.assertEquals("wisp", model.description()); + Assertions.assertEquals("ppbiichl", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("ewltono").type()); + Assertions.assertEquals("uymkdeuqxlvzpfd", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MarketoObjectDataset model = + new MarketoObjectDataset() + .withDescription("wisp") + .withStructure("datagdblwj") + .withSchema("dataaqxaxtuxi") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ppbiichl") + .withParameters(mapOf("zdxywabkitnipapt", "datavuixwonkrn"))) + .withParameters( + mapOf( + "ewltono", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datayjukkajn"), + "di", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("dataemiwfhhawbabhzbf"), + "zsuspaywvslq", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("dataxydgzfoi"))) + .withAnnotations(Arrays.asList("datanzea", "datakxfmu", "datadbvytq")) + .withFolder(new DatasetFolder().withName("uymkdeuqxlvzpfd")) + .withTableName("dataomeqg"); + model = BinaryData.fromObject(model).toObject(MarketoObjectDataset.class); + Assertions.assertEquals("wisp", model.description()); + Assertions.assertEquals("ppbiichl", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("ewltono").type()); + Assertions.assertEquals("uymkdeuqxlvzpfd", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MarketoSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MarketoSourceTests.java new file mode 100644 index 000000000000..293eac7b6ff7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MarketoSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MarketoSource; + +public final class MarketoSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketoSource model = + BinaryData + .fromString( + "{\"type\":\"MarketoSource\",\"query\":\"datafplgxc\",\"queryTimeout\":\"datactbxpuisfjamgn\",\"additionalColumns\":\"dataosusiyycoflj\",\"sourceRetryCount\":\"datadmwa\",\"sourceRetryWait\":\"datapbuqkdieuopwsa\",\"maxConcurrentConnections\":\"datahmizcfk\",\"disableMetricsCollection\":\"datafmoonnria\",\"\":{\"dvbbuuipelo\":\"datagzkdbmjzob\",\"x\":\"dataptteojxhwgja\",\"sl\":\"datarpwjgkxvkjd\"}}") + .toObject(MarketoSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MarketoSource model = + new MarketoSource() + .withSourceRetryCount("datadmwa") + .withSourceRetryWait("datapbuqkdieuopwsa") + .withMaxConcurrentConnections("datahmizcfk") + .withDisableMetricsCollection("datafmoonnria") + .withQueryTimeout("datactbxpuisfjamgn") + .withAdditionalColumns("dataosusiyycoflj") + .withQuery("datafplgxc"); + model = BinaryData.fromObject(model).toObject(MarketoSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MetadataItemTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MetadataItemTests.java new file mode 100644 index 000000000000..fb85590e4c99 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MetadataItemTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MetadataItem; + +public final class MetadataItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataItem model = + BinaryData + .fromString("{\"name\":\"dataselwszqveakd\",\"value\":\"dataljjzdbzk\"}") + .toObject(MetadataItem.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataItem model = new MetadataItem().withName("dataselwszqveakd").withValue("dataljjzdbzk"); + model = BinaryData.fromObject(model).toObject(MetadataItem.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessSinkTests.java new file mode 100644 index 000000000000..91a96ce04af0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MicrosoftAccessSink; + +public final class MicrosoftAccessSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MicrosoftAccessSink model = + BinaryData + .fromString( + "{\"type\":\"MicrosoftAccessSink\",\"preCopyScript\":\"datavsozjfnpwx\",\"writeBatchSize\":\"dataciotlbpuemqetmo\",\"writeBatchTimeout\":\"datavhhedc\",\"sinkRetryCount\":\"datalycrldwccas\",\"sinkRetryWait\":\"databdvsorvhbygw\",\"maxConcurrentConnections\":\"dataxqlzzkbx\",\"disableMetricsCollection\":\"datacgg\",\"\":{\"hlexvqhbnwmokz\":\"databtqizydaiolnkk\",\"pqjfoujeiagny\":\"dataylt\",\"jssay\":\"datae\"}}") + .toObject(MicrosoftAccessSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MicrosoftAccessSink model = + new MicrosoftAccessSink() + .withWriteBatchSize("dataciotlbpuemqetmo") + .withWriteBatchTimeout("datavhhedc") + .withSinkRetryCount("datalycrldwccas") + .withSinkRetryWait("databdvsorvhbygw") + .withMaxConcurrentConnections("dataxqlzzkbx") + .withDisableMetricsCollection("datacgg") + .withPreCopyScript("datavsozjfnpwx"); + model = BinaryData.fromObject(model).toObject(MicrosoftAccessSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessSourceTests.java new file mode 100644 index 000000000000..d4baedcce886 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessSourceTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MicrosoftAccessSource; + +public final class MicrosoftAccessSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MicrosoftAccessSource model = + BinaryData + .fromString( + "{\"type\":\"MicrosoftAccessSource\",\"query\":\"datadtuhdoimojcm\",\"additionalColumns\":\"datacd\",\"sourceRetryCount\":\"datavorzhzfoc\",\"sourceRetryWait\":\"datayltornv\",\"maxConcurrentConnections\":\"datauy\",\"disableMetricsCollection\":\"datawifbdwyvvcywb\",\"\":{\"okeqeowbp\":\"datathrexzvejqzyuik\",\"tgwerbpobvj\":\"dataiehvgchsg\",\"vvmdtkllqhznutrx\":\"dataunicgrxce\"}}") + .toObject(MicrosoftAccessSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MicrosoftAccessSource model = + new MicrosoftAccessSource() + .withSourceRetryCount("datavorzhzfoc") + .withSourceRetryWait("datayltornv") + .withMaxConcurrentConnections("datauy") + .withDisableMetricsCollection("datawifbdwyvvcywb") + .withQuery("datadtuhdoimojcm") + .withAdditionalColumns("datacd"); + model = BinaryData.fromObject(model).toObject(MicrosoftAccessSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessTableDatasetTests.java new file mode 100644 index 000000000000..8b289217c55a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessTableDatasetTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MicrosoftAccessTableDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MicrosoftAccessTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MicrosoftAccessTableDataset model = + BinaryData + .fromString( + "{\"type\":\"MicrosoftAccessTable\",\"typeProperties\":{\"tableName\":\"dataxamqecjrzvlcivqx\"},\"description\":\"mklphxwww\",\"structure\":\"datajkbgnfbr\",\"schema\":\"datavfsunhaevla\",\"linkedServiceName\":{\"referenceName\":\"xczywywu\",\"parameters\":{\"rfgimomggewdqbxe\":\"datacorewcnnaaxqjfda\",\"sfx\":\"datafyznvussuqksl\",\"wpmohnrtlikffyd\":\"datayzqbye\",\"fwvzdteqjm\":\"datatkqrfbgyn\"}},\"parameters\":{\"jyoxxjxb\":{\"type\":\"Array\",\"defaultValue\":\"datagkaxnypr\"},\"emqom\":{\"type\":\"Int\",\"defaultValue\":\"datarrlccklyfpjmspa\"},\"hcaptkhjx\":{\"type\":\"Int\",\"defaultValue\":\"datalknuyapvibzicyvi\"}},\"annotations\":[\"databnvfccklzhznfgv\"],\"folder\":{\"name\":\"xmnctigpksywi\"},\"\":{\"efuhb\":\"dataktgkdprtqjytdc\",\"caytnpkvbpbltcws\":\"datawbvjsbgmlamoa\"}}") + .toObject(MicrosoftAccessTableDataset.class); + Assertions.assertEquals("mklphxwww", model.description()); + Assertions.assertEquals("xczywywu", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("jyoxxjxb").type()); + Assertions.assertEquals("xmnctigpksywi", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MicrosoftAccessTableDataset model = + new MicrosoftAccessTableDataset() + .withDescription("mklphxwww") + .withStructure("datajkbgnfbr") + .withSchema("datavfsunhaevla") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("xczywywu") + .withParameters( + mapOf( + "rfgimomggewdqbxe", + "datacorewcnnaaxqjfda", + "sfx", + "datafyznvussuqksl", + "wpmohnrtlikffyd", + "datayzqbye", + "fwvzdteqjm", + "datatkqrfbgyn"))) + .withParameters( + mapOf( + "jyoxxjxb", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datagkaxnypr"), + "emqom", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datarrlccklyfpjmspa"), + "hcaptkhjx", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datalknuyapvibzicyvi"))) + .withAnnotations(Arrays.asList("databnvfccklzhznfgv")) + .withFolder(new DatasetFolder().withName("xmnctigpksywi")) + .withTableName("dataxamqecjrzvlcivqx"); + model = BinaryData.fromObject(model).toObject(MicrosoftAccessTableDataset.class); + Assertions.assertEquals("mklphxwww", model.description()); + Assertions.assertEquals("xczywywu", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("jyoxxjxb").type()); + Assertions.assertEquals("xmnctigpksywi", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..3bf054d3a483 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MicrosoftAccessTableDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.MicrosoftAccessTableDatasetTypeProperties; + +public final class MicrosoftAccessTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MicrosoftAccessTableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"dataheeocnqoubve\"}") + .toObject(MicrosoftAccessTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MicrosoftAccessTableDatasetTypeProperties model = + new MicrosoftAccessTableDatasetTypeProperties().withTableName("dataheeocnqoubve"); + model = BinaryData.fromObject(model).toObject(MicrosoftAccessTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasCollectionDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasCollectionDatasetTests.java new file mode 100644 index 000000000000..402991ec5a26 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasCollectionDatasetTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MongoDbAtlasCollectionDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MongoDbAtlasCollectionDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbAtlasCollectionDataset model = + BinaryData + .fromString( + "{\"type\":\"MongoDbAtlasCollection\",\"typeProperties\":{\"collection\":\"datafpohimgckycjpeeb\"},\"description\":\"bznxsuloutnpbm\",\"structure\":\"dataoqohgp\",\"schema\":\"datadmwk\",\"linkedServiceName\":{\"referenceName\":\"upf\",\"parameters\":{\"dzauiunyev\":\"datad\",\"uynfxkcgsfcmvh\":\"datayzdsytcikswhcam\",\"atvyrkljqkqws\":\"datadrp\",\"bypnkteiidlbov\":\"datajtvjkowggxawwd\"}},\"parameters\":{\"rekyjulskwwn\":{\"type\":\"String\",\"defaultValue\":\"datargeganihkjcn\"}},\"annotations\":[\"datalqgpwxtvceba\"],\"folder\":{\"name\":\"vxwve\"},\"\":{\"csmwevguy\":\"datalr\",\"rj\":\"datalnxe\",\"owwe\":\"datafzcde\",\"sfqbirtybcelfjn\":\"datahyfkdilbwqlqa\"}}") + .toObject(MongoDbAtlasCollectionDataset.class); + Assertions.assertEquals("bznxsuloutnpbm", model.description()); + Assertions.assertEquals("upf", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("rekyjulskwwn").type()); + Assertions.assertEquals("vxwve", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbAtlasCollectionDataset model = + new MongoDbAtlasCollectionDataset() + .withDescription("bznxsuloutnpbm") + .withStructure("dataoqohgp") + .withSchema("datadmwk") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("upf") + .withParameters( + mapOf( + "dzauiunyev", + "datad", + "uynfxkcgsfcmvh", + "datayzdsytcikswhcam", + "atvyrkljqkqws", + "datadrp", + "bypnkteiidlbov", + "datajtvjkowggxawwd"))) + .withParameters( + mapOf( + "rekyjulskwwn", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datargeganihkjcn"))) + .withAnnotations(Arrays.asList("datalqgpwxtvceba")) + .withFolder(new DatasetFolder().withName("vxwve")) + .withCollection("datafpohimgckycjpeeb"); + model = BinaryData.fromObject(model).toObject(MongoDbAtlasCollectionDataset.class); + Assertions.assertEquals("bznxsuloutnpbm", model.description()); + Assertions.assertEquals("upf", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("rekyjulskwwn").type()); + Assertions.assertEquals("vxwve", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasCollectionDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasCollectionDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..c721458edb0b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasCollectionDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.MongoDbAtlasCollectionDatasetTypeProperties; + +public final class MongoDbAtlasCollectionDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbAtlasCollectionDatasetTypeProperties model = + BinaryData + .fromString("{\"collection\":\"dataodnjyhzfaxskdv\"}") + .toObject(MongoDbAtlasCollectionDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbAtlasCollectionDatasetTypeProperties model = + new MongoDbAtlasCollectionDatasetTypeProperties().withCollection("dataodnjyhzfaxskdv"); + model = BinaryData.fromObject(model).toObject(MongoDbAtlasCollectionDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasLinkedServiceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasLinkedServiceTests.java new file mode 100644 index 000000000000..c8c9f3f192a6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasLinkedServiceTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.MongoDbAtlasLinkedService; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MongoDbAtlasLinkedServiceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbAtlasLinkedService model = + BinaryData + .fromString( + "{\"type\":\"MongoDbAtlas\",\"typeProperties\":{\"connectionString\":\"datamu\",\"database\":\"datajabpnxohagcojgmy\",\"driverVersion\":\"datad\"},\"connectVia\":{\"referenceName\":\"qehrqtgdipb\",\"parameters\":{\"kbfykgmwurcx\":\"dataweyuigyzse\",\"vjgovbbn\":\"datajyxyunypf\",\"aqgmztlru\":\"datajxr\",\"ou\":\"datank\"}},\"description\":\"qffgjsqq\",\"parameters\":{\"bdqiuppavqov\":{\"type\":\"SecureString\",\"defaultValue\":\"dataoglwuj\"},\"tfbibtrwglj\":{\"type\":\"String\",\"defaultValue\":\"datamegnkr\"},\"phgimyomje\":{\"type\":\"String\",\"defaultValue\":\"dataezdxqhj\"},\"fxxx\":{\"type\":\"Object\",\"defaultValue\":\"datanieeqj\"}},\"annotations\":[\"datauxkepga\",\"datarijbiterqfu\"],\"\":{\"wpg\":\"datarcanlpfqdd\"}}") + .toObject(MongoDbAtlasLinkedService.class); + Assertions.assertEquals("qehrqtgdipb", model.connectVia().referenceName()); + Assertions.assertEquals("qffgjsqq", model.description()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("bdqiuppavqov").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbAtlasLinkedService model = + new MongoDbAtlasLinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("qehrqtgdipb") + .withParameters( + mapOf( + "kbfykgmwurcx", + "dataweyuigyzse", + "vjgovbbn", + "datajyxyunypf", + "aqgmztlru", + "datajxr", + "ou", + "datank"))) + .withDescription("qffgjsqq") + .withParameters( + mapOf( + "bdqiuppavqov", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("dataoglwuj"), + "tfbibtrwglj", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datamegnkr"), + "phgimyomje", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataezdxqhj"), + "fxxx", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datanieeqj"))) + .withAnnotations(Arrays.asList("datauxkepga", "datarijbiterqfu")) + .withConnectionString("datamu") + .withDatabase("datajabpnxohagcojgmy") + .withDriverVersion("datad"); + model = BinaryData.fromObject(model).toObject(MongoDbAtlasLinkedService.class); + Assertions.assertEquals("qehrqtgdipb", model.connectVia().referenceName()); + Assertions.assertEquals("qffgjsqq", model.description()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("bdqiuppavqov").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasLinkedServiceTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasLinkedServiceTypePropertiesTests.java new file mode 100644 index 000000000000..4bdcc7a3d0fd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasLinkedServiceTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.MongoDbAtlasLinkedServiceTypeProperties; + +public final class MongoDbAtlasLinkedServiceTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbAtlasLinkedServiceTypeProperties model = + BinaryData + .fromString( + "{\"connectionString\":\"dataqawupqkvmy\",\"database\":\"dataueefrxzwvcvtjd\",\"driverVersion\":\"dataagw\"}") + .toObject(MongoDbAtlasLinkedServiceTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbAtlasLinkedServiceTypeProperties model = + new MongoDbAtlasLinkedServiceTypeProperties() + .withConnectionString("dataqawupqkvmy") + .withDatabase("dataueefrxzwvcvtjd") + .withDriverVersion("dataagw"); + model = BinaryData.fromObject(model).toObject(MongoDbAtlasLinkedServiceTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasSinkTests.java new file mode 100644 index 000000000000..7568356ddbe8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MongoDbAtlasSink; + +public final class MongoDbAtlasSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbAtlasSink model = + BinaryData + .fromString( + "{\"type\":\"MongoDbAtlasSink\",\"writeBehavior\":\"datarvtaul\",\"writeBatchSize\":\"dataqvtpkodijcn\",\"writeBatchTimeout\":\"datao\",\"sinkRetryCount\":\"datavcyqjjxhijbfi\",\"sinkRetryWait\":\"datahoxule\",\"maxConcurrentConnections\":\"datadbirhgjmph\",\"disableMetricsCollection\":\"datacdhjmpnvgkx\",\"\":{\"b\":\"dataljtkuyvytfuqzst\",\"i\":\"datapyfawkj\",\"zvsc\":\"datakf\",\"cokafaqqipvnvdz\":\"datadbkl\"}}") + .toObject(MongoDbAtlasSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbAtlasSink model = + new MongoDbAtlasSink() + .withWriteBatchSize("dataqvtpkodijcn") + .withWriteBatchTimeout("datao") + .withSinkRetryCount("datavcyqjjxhijbfi") + .withSinkRetryWait("datahoxule") + .withMaxConcurrentConnections("datadbirhgjmph") + .withDisableMetricsCollection("datacdhjmpnvgkx") + .withWriteBehavior("datarvtaul"); + model = BinaryData.fromObject(model).toObject(MongoDbAtlasSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasSourceTests.java new file mode 100644 index 000000000000..1381f3bacd74 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbAtlasSourceTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MongoDbAtlasSource; +import com.azure.resourcemanager.datafactory.models.MongoDbCursorMethodsProperties; +import java.util.HashMap; +import java.util.Map; + +public final class MongoDbAtlasSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbAtlasSource model = + BinaryData + .fromString( + "{\"type\":\"MongoDbAtlasSource\",\"filter\":\"dataodwqzbiuk\",\"cursorMethods\":{\"project\":\"datayfvyzaofai\",\"sort\":\"datanfvexiuuqaf\",\"skip\":\"dataseyxpgkmlnj\",\"limit\":\"dataaywgc\",\"\":{\"wv\":\"datafafpyglnfwjs\"}},\"batchSize\":\"datablucpmqwkfgmkp\",\"queryTimeout\":\"datakstzqz\",\"additionalColumns\":\"datawrcajfers\",\"sourceRetryCount\":\"dataxlkcw\",\"sourceRetryWait\":\"dataejssksgxykdepqcy\",\"maxConcurrentConnections\":\"datahwsxpzkmotgmd\",\"disableMetricsCollection\":\"datawwqevbiuntp\",\"\":{\"qgywr\":\"datawjxlycelf\",\"ruldt\":\"datau\"}}") + .toObject(MongoDbAtlasSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbAtlasSource model = + new MongoDbAtlasSource() + .withSourceRetryCount("dataxlkcw") + .withSourceRetryWait("dataejssksgxykdepqcy") + .withMaxConcurrentConnections("datahwsxpzkmotgmd") + .withDisableMetricsCollection("datawwqevbiuntp") + .withFilter("dataodwqzbiuk") + .withCursorMethods( + new MongoDbCursorMethodsProperties() + .withProject("datayfvyzaofai") + .withSort("datanfvexiuuqaf") + .withSkip("dataseyxpgkmlnj") + .withLimit("dataaywgc") + .withAdditionalProperties(mapOf())) + .withBatchSize("datablucpmqwkfgmkp") + .withQueryTimeout("datakstzqz") + .withAdditionalColumns("datawrcajfers"); + model = BinaryData.fromObject(model).toObject(MongoDbAtlasSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbCollectionDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbCollectionDatasetTests.java new file mode 100644 index 000000000000..58aed86b4787 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbCollectionDatasetTests.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MongoDbCollectionDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MongoDbCollectionDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbCollectionDataset model = + BinaryData + .fromString( + "{\"type\":\"MongoDbCollection\",\"typeProperties\":{\"collectionName\":\"datad\"},\"description\":\"sjqb\",\"structure\":\"dataqmxv\",\"schema\":\"datariwbwggij\",\"linkedServiceName\":{\"referenceName\":\"spzjn\",\"parameters\":{\"htrgz\":\"dataikwsbzrhdugq\",\"jfhrjhiycbause\":\"dataru\",\"ihvtuwyjsqw\":\"datanczk\",\"oszjgz\":\"datas\"}},\"parameters\":{\"hczavojmsl\":{\"type\":\"String\",\"defaultValue\":\"datayskwwun\"},\"uqalpcufjjfxt\":{\"type\":\"Array\",\"defaultValue\":\"datacukvbljpxprrvchy\"},\"rcwbaae\":{\"type\":\"Object\",\"defaultValue\":\"dataqdstahhhsaaxxsri\"},\"xwoqotiiqbgpasr\":{\"type\":\"Bool\",\"defaultValue\":\"dataef\"}},\"annotations\":[\"datatistyikjhorlx\",\"datapypkennycntrq\",\"dataxwtdmbqjtsuhqh\"],\"folder\":{\"name\":\"tdyqav\"},\"\":{\"npaami\":\"dataqmzxsyaks\",\"hvwt\":\"datawb\",\"kiy\":\"datapbgchcgsfzhb\",\"cfferznzc\":\"dataqbjsdjpgxeysgw\"}}") + .toObject(MongoDbCollectionDataset.class); + Assertions.assertEquals("sjqb", model.description()); + Assertions.assertEquals("spzjn", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("hczavojmsl").type()); + Assertions.assertEquals("tdyqav", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbCollectionDataset model = + new MongoDbCollectionDataset() + .withDescription("sjqb") + .withStructure("dataqmxv") + .withSchema("datariwbwggij") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("spzjn") + .withParameters( + mapOf( + "htrgz", + "dataikwsbzrhdugq", + "jfhrjhiycbause", + "dataru", + "ihvtuwyjsqw", + "datanczk", + "oszjgz", + "datas"))) + .withParameters( + mapOf( + "hczavojmsl", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datayskwwun"), + "uqalpcufjjfxt", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datacukvbljpxprrvchy"), + "rcwbaae", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("dataqdstahhhsaaxxsri"), + "xwoqotiiqbgpasr", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataef"))) + .withAnnotations(Arrays.asList("datatistyikjhorlx", "datapypkennycntrq", "dataxwtdmbqjtsuhqh")) + .withFolder(new DatasetFolder().withName("tdyqav")) + .withCollectionName("datad"); + model = BinaryData.fromObject(model).toObject(MongoDbCollectionDataset.class); + Assertions.assertEquals("sjqb", model.description()); + Assertions.assertEquals("spzjn", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("hczavojmsl").type()); + Assertions.assertEquals("tdyqav", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbCollectionDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbCollectionDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..c1093cc123d9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbCollectionDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.MongoDbCollectionDatasetTypeProperties; + +public final class MongoDbCollectionDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbCollectionDatasetTypeProperties model = + BinaryData + .fromString("{\"collectionName\":\"dataivoveomkhfeqcoop\"}") + .toObject(MongoDbCollectionDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbCollectionDatasetTypeProperties model = + new MongoDbCollectionDatasetTypeProperties().withCollectionName("dataivoveomkhfeqcoop"); + model = BinaryData.fromObject(model).toObject(MongoDbCollectionDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbCursorMethodsPropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbCursorMethodsPropertiesTests.java new file mode 100644 index 000000000000..f48f23c21799 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbCursorMethodsPropertiesTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MongoDbCursorMethodsProperties; +import java.util.HashMap; +import java.util.Map; + +public final class MongoDbCursorMethodsPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbCursorMethodsProperties model = + BinaryData + .fromString( + "{\"project\":\"datacnk\",\"sort\":\"datamiecfmqc\",\"skip\":\"datapcdbvcxo\",\"limit\":\"datahefuhnbdl\",\"\":{\"cmpnk\":\"dataectzjjgvcbt\",\"ejytrvlg\":\"datavuj\"}}") + .toObject(MongoDbCursorMethodsProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbCursorMethodsProperties model = + new MongoDbCursorMethodsProperties() + .withProject("datacnk") + .withSort("datamiecfmqc") + .withSkip("datapcdbvcxo") + .withLimit("datahefuhnbdl") + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(MongoDbCursorMethodsProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbSourceTests.java new file mode 100644 index 000000000000..274832223ec0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbSourceTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MongoDbSource; + +public final class MongoDbSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbSource model = + BinaryData + .fromString( + "{\"type\":\"MongoDbSource\",\"query\":\"datav\",\"additionalColumns\":\"dataak\",\"sourceRetryCount\":\"datapaexllt\",\"sourceRetryWait\":\"datakkaei\",\"maxConcurrentConnections\":\"datahr\",\"disableMetricsCollection\":\"datasgvsrtqlta\",\"\":{\"ubx\":\"dataraleglpynsblnwiw\",\"lhbrwaltvkyl\":\"datayr\",\"baeghakssc\":\"datajopqtegkrjo\",\"lxt\":\"datasmrnneklfibnysf\"}}") + .toObject(MongoDbSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbSource model = + new MongoDbSource() + .withSourceRetryCount("datapaexllt") + .withSourceRetryWait("datakkaei") + .withMaxConcurrentConnections("datahr") + .withDisableMetricsCollection("datasgvsrtqlta") + .withQuery("datav") + .withAdditionalColumns("dataak"); + model = BinaryData.fromObject(model).toObject(MongoDbSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2CollectionDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2CollectionDatasetTests.java new file mode 100644 index 000000000000..517b02115f83 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2CollectionDatasetTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MongoDbV2CollectionDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MongoDbV2CollectionDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbV2CollectionDataset model = + BinaryData + .fromString( + "{\"type\":\"MongoDbV2Collection\",\"typeProperties\":{\"collection\":\"datael\"},\"description\":\"odpegq\",\"structure\":\"dataorchazrqoxzyh\",\"schema\":\"dataeqvhskbmpw\",\"linkedServiceName\":{\"referenceName\":\"slajgg\",\"parameters\":{\"hawkmibuydwi\":\"dataae\"}},\"parameters\":{\"u\":{\"type\":\"Int\",\"defaultValue\":\"dataupdyttqm\"},\"s\":{\"type\":\"Array\",\"defaultValue\":\"datal\"}},\"annotations\":[\"datahhtuqmtxynof\",\"dataqobfixngxebihe\"],\"folder\":{\"name\":\"kingiqcdolrpgu\"},\"\":{\"dafbncuy\":\"datalbsm\",\"fzxjzi\":\"dataeykcnhpplzh\",\"wnuwkkfzzetl\":\"dataucrln\",\"vwywjvrlgqpwwlzp\":\"datahdyxz\"}}") + .toObject(MongoDbV2CollectionDataset.class); + Assertions.assertEquals("odpegq", model.description()); + Assertions.assertEquals("slajgg", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("u").type()); + Assertions.assertEquals("kingiqcdolrpgu", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbV2CollectionDataset model = + new MongoDbV2CollectionDataset() + .withDescription("odpegq") + .withStructure("dataorchazrqoxzyh") + .withSchema("dataeqvhskbmpw") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("slajgg") + .withParameters(mapOf("hawkmibuydwi", "dataae"))) + .withParameters( + mapOf( + "u", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataupdyttqm"), + "s", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datal"))) + .withAnnotations(Arrays.asList("datahhtuqmtxynof", "dataqobfixngxebihe")) + .withFolder(new DatasetFolder().withName("kingiqcdolrpgu")) + .withCollection("datael"); + model = BinaryData.fromObject(model).toObject(MongoDbV2CollectionDataset.class); + Assertions.assertEquals("odpegq", model.description()); + Assertions.assertEquals("slajgg", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("u").type()); + Assertions.assertEquals("kingiqcdolrpgu", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2CollectionDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2CollectionDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..e2c7a034193c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2CollectionDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.MongoDbV2CollectionDatasetTypeProperties; + +public final class MongoDbV2CollectionDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbV2CollectionDatasetTypeProperties model = + BinaryData + .fromString("{\"collection\":\"datadarcb\"}") + .toObject(MongoDbV2CollectionDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbV2CollectionDatasetTypeProperties model = + new MongoDbV2CollectionDatasetTypeProperties().withCollection("datadarcb"); + model = BinaryData.fromObject(model).toObject(MongoDbV2CollectionDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2LinkedServiceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2LinkedServiceTests.java new file mode 100644 index 000000000000..397deaeae9a4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2LinkedServiceTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.MongoDbV2LinkedService; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MongoDbV2LinkedServiceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbV2LinkedService model = + BinaryData + .fromString( + "{\"type\":\"MongoDbV2\",\"typeProperties\":{\"connectionString\":\"datajafbdvpcdzdbjz\",\"database\":\"datarpxj\"},\"connectVia\":{\"referenceName\":\"aup\",\"parameters\":{\"nkaqngvgjgcww\":\"datad\",\"n\":\"datausjjhtcy\",\"svwq\":\"datahighnxhgmfrnk\"}},\"description\":\"r\",\"parameters\":{\"uksttxime\":{\"type\":\"String\",\"defaultValue\":\"dataujmmkni\"},\"weo\":{\"type\":\"Float\",\"defaultValue\":\"datasflgme\"},\"agigbpabacpleirj\":{\"type\":\"Bool\",\"defaultValue\":\"datarptjwvzapybde\"}},\"annotations\":[\"datak\"],\"\":{\"bdukid\":\"datadubmazlx\",\"kpardo\":\"dataqeyqrlgpkypb\",\"yhbzmgzsyt\":\"datadtedxz\",\"sqsbq\":\"datapfslrx\"}}") + .toObject(MongoDbV2LinkedService.class); + Assertions.assertEquals("aup", model.connectVia().referenceName()); + Assertions.assertEquals("r", model.description()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("uksttxime").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbV2LinkedService model = + new MongoDbV2LinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("aup") + .withParameters( + mapOf("nkaqngvgjgcww", "datad", "n", "datausjjhtcy", "svwq", "datahighnxhgmfrnk"))) + .withDescription("r") + .withParameters( + mapOf( + "uksttxime", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataujmmkni"), + "weo", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datasflgme"), + "agigbpabacpleirj", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datarptjwvzapybde"))) + .withAnnotations(Arrays.asList("datak")) + .withConnectionString("datajafbdvpcdzdbjz") + .withDatabase("datarpxj"); + model = BinaryData.fromObject(model).toObject(MongoDbV2LinkedService.class); + Assertions.assertEquals("aup", model.connectVia().referenceName()); + Assertions.assertEquals("r", model.description()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("uksttxime").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2LinkedServiceTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2LinkedServiceTypePropertiesTests.java new file mode 100644 index 000000000000..27879c2a084a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2LinkedServiceTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.MongoDbV2LinkedServiceTypeProperties; + +public final class MongoDbV2LinkedServiceTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbV2LinkedServiceTypeProperties model = + BinaryData + .fromString("{\"connectionString\":\"dataq\",\"database\":\"datapi\"}") + .toObject(MongoDbV2LinkedServiceTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbV2LinkedServiceTypeProperties model = + new MongoDbV2LinkedServiceTypeProperties().withConnectionString("dataq").withDatabase("datapi"); + model = BinaryData.fromObject(model).toObject(MongoDbV2LinkedServiceTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2SinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2SinkTests.java new file mode 100644 index 000000000000..6433f0f117fa --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2SinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MongoDbV2Sink; + +public final class MongoDbV2SinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbV2Sink model = + BinaryData + .fromString( + "{\"type\":\"MongoDbV2Sink\",\"writeBehavior\":\"datassncghgid\",\"writeBatchSize\":\"dataotx\",\"writeBatchTimeout\":\"databxzhad\",\"sinkRetryCount\":\"datajnnoot\",\"sinkRetryWait\":\"datayupaqdoodhnzkmj\",\"maxConcurrentConnections\":\"databyogwjr\",\"disableMetricsCollection\":\"datanrykkh\",\"\":{\"zv\":\"dataohsjewxphnlwe\",\"cjgjuopvkr\":\"dataixcveserltl\"}}") + .toObject(MongoDbV2Sink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbV2Sink model = + new MongoDbV2Sink() + .withWriteBatchSize("dataotx") + .withWriteBatchTimeout("databxzhad") + .withSinkRetryCount("datajnnoot") + .withSinkRetryWait("datayupaqdoodhnzkmj") + .withMaxConcurrentConnections("databyogwjr") + .withDisableMetricsCollection("datanrykkh") + .withWriteBehavior("datassncghgid"); + model = BinaryData.fromObject(model).toObject(MongoDbV2Sink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2SourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2SourceTests.java new file mode 100644 index 000000000000..85fab8bd23f3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MongoDbV2SourceTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MongoDbCursorMethodsProperties; +import com.azure.resourcemanager.datafactory.models.MongoDbV2Source; +import java.util.HashMap; +import java.util.Map; + +public final class MongoDbV2SourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MongoDbV2Source model = + BinaryData + .fromString( + "{\"type\":\"MongoDbV2Source\",\"filter\":\"datasbrngnbqhmuqyz\",\"cursorMethods\":{\"project\":\"datarmrcjshtcfnbffda\",\"sort\":\"datayhxp\",\"skip\":\"dataoehuboqozxn\",\"limit\":\"dataamxikhrxikglyn\",\"\":{\"nywgtsodnx\":\"dataeojecboggwtih\",\"htzgduvoaxq\":\"datairjtwjimcf\",\"zyqbggxcyram\":\"datacalptfp\"}},\"batchSize\":\"datauaxt\",\"queryTimeout\":\"dataqnyurxlpuwxslzql\",\"additionalColumns\":\"dataxbnrurtnwb\",\"sourceRetryCount\":\"dataysupck\",\"sourceRetryWait\":\"databm\",\"maxConcurrentConnections\":\"datamohlshmaaoofltbs\",\"disableMetricsCollection\":\"datavmwaejxzkqcmd\",\"\":{\"yrt\":\"datatn\"}}") + .toObject(MongoDbV2Source.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MongoDbV2Source model = + new MongoDbV2Source() + .withSourceRetryCount("dataysupck") + .withSourceRetryWait("databm") + .withMaxConcurrentConnections("datamohlshmaaoofltbs") + .withDisableMetricsCollection("datavmwaejxzkqcmd") + .withFilter("datasbrngnbqhmuqyz") + .withCursorMethods( + new MongoDbCursorMethodsProperties() + .withProject("datarmrcjshtcfnbffda") + .withSort("datayhxp") + .withSkip("dataoehuboqozxn") + .withLimit("dataamxikhrxikglyn") + .withAdditionalProperties(mapOf())) + .withBatchSize("datauaxt") + .withQueryTimeout("dataqnyurxlpuwxslzql") + .withAdditionalColumns("dataxbnrurtnwb"); + model = BinaryData.fromObject(model).toObject(MongoDbV2Source.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MultiplePipelineTriggerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MultiplePipelineTriggerTests.java new file mode 100644 index 000000000000..648656d95e65 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MultiplePipelineTriggerTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MultiplePipelineTrigger; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import com.azure.resourcemanager.datafactory.models.TriggerPipelineReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MultiplePipelineTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MultiplePipelineTrigger model = + BinaryData + .fromString( + "{\"type\":\"MultiplePipelineTrigger\",\"pipelines\":[{\"pipelineReference\":{\"referenceName\":\"knehpuhljmlu\",\"name\":\"tptpjabszqczig\"},\"parameters\":{\"scrpabaw\":\"dataqkoxbghp\",\"x\":\"datavawmrmwrzmfnjs\",\"vragr\":\"datanst\"}},{\"pipelineReference\":{\"referenceName\":\"munmgtkyzup\",\"name\":\"qmjmpx\"},\"parameters\":{\"mpydaxgwgbpbls\":\"dataxie\",\"lfxf\":\"datas\"}},{\"pipelineReference\":{\"referenceName\":\"fybpwzgwhntkmutt\",\"name\":\"obrx\"},\"parameters\":{\"scbgarfbx\":\"dataft\",\"nshlu\":\"dataalpig\"}},{\"pipelineReference\":{\"referenceName\":\"lm\",\"name\":\"ncats\"},\"parameters\":{\"gtxpbvmc\":\"datatxgtibmxhudpjn\"}}],\"description\":\"sahpswspyifg\",\"runtimeState\":\"Disabled\",\"annotations\":[\"datah\",\"datadybjgyxbwhuta\",\"datahmckzbuadoxlle\",\"datahvcyyvpobcxnrwaz\"],\"\":{\"xnbkcwee\":\"datahaajhllnkwquw\",\"rwospsok\":\"datakg\",\"ydywwjsqdchbuvi\":\"datatdrvihuifih\"}}") + .toObject(MultiplePipelineTrigger.class); + Assertions.assertEquals("sahpswspyifg", model.description()); + Assertions.assertEquals("knehpuhljmlu", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("tptpjabszqczig", model.pipelines().get(0).pipelineReference().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MultiplePipelineTrigger model = + new MultiplePipelineTrigger() + .withDescription("sahpswspyifg") + .withAnnotations( + Arrays.asList("datah", "datadybjgyxbwhuta", "datahmckzbuadoxlle", "datahvcyyvpobcxnrwaz")) + .withPipelines( + Arrays + .asList( + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference() + .withReferenceName("knehpuhljmlu") + .withName("tptpjabszqczig")) + .withParameters( + mapOf("scrpabaw", "dataqkoxbghp", "x", "datavawmrmwrzmfnjs", "vragr", "datanst")), + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("munmgtkyzup").withName("qmjmpx")) + .withParameters(mapOf("mpydaxgwgbpbls", "dataxie", "lfxf", "datas")), + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("fybpwzgwhntkmutt").withName("obrx")) + .withParameters(mapOf("scbgarfbx", "dataft", "nshlu", "dataalpig")), + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("lm").withName("ncats")) + .withParameters(mapOf("gtxpbvmc", "datatxgtibmxhudpjn")))); + model = BinaryData.fromObject(model).toObject(MultiplePipelineTrigger.class); + Assertions.assertEquals("sahpswspyifg", model.description()); + Assertions.assertEquals("knehpuhljmlu", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("tptpjabszqczig", model.pipelines().get(0).pipelineReference().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MySqlSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MySqlSourceTests.java new file mode 100644 index 000000000000..298c32280c40 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MySqlSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.MySqlSource; + +public final class MySqlSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MySqlSource model = + BinaryData + .fromString( + "{\"type\":\"MySqlSource\",\"query\":\"dataulslfiuzytxeaq\",\"queryTimeout\":\"datamqntutetdtgci\",\"additionalColumns\":\"datarjwiwou\",\"sourceRetryCount\":\"dataaqnfyhgrcm\",\"sourceRetryWait\":\"datappledxyect\",\"maxConcurrentConnections\":\"databtwelutr\",\"disableMetricsCollection\":\"datazhwpxpsc\",\"\":{\"yavysfmndrdqq\":\"datatslfc\",\"gbmldkcih\":\"datak\",\"h\":\"datarz\"}}") + .toObject(MySqlSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MySqlSource model = + new MySqlSource() + .withSourceRetryCount("dataaqnfyhgrcm") + .withSourceRetryWait("datappledxyect") + .withMaxConcurrentConnections("databtwelutr") + .withDisableMetricsCollection("datazhwpxpsc") + .withQueryTimeout("datamqntutetdtgci") + .withAdditionalColumns("datarjwiwou") + .withQuery("dataulslfiuzytxeaq"); + model = BinaryData.fromObject(model).toObject(MySqlSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MySqlTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MySqlTableDatasetTests.java new file mode 100644 index 000000000000..b544044bd287 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MySqlTableDatasetTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.MySqlTableDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MySqlTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MySqlTableDataset model = + BinaryData + .fromString( + "{\"type\":\"MySqlTable\",\"typeProperties\":{\"tableName\":\"databtownoljdkx\"},\"description\":\"ewy\",\"structure\":\"datalclzxkrdpuy\",\"schema\":\"databpkrpk\",\"linkedServiceName\":{\"referenceName\":\"qetp\",\"parameters\":{\"fpc\":\"dataefno\",\"yrxowv\":\"datarx\"}},\"parameters\":{\"ozfrfawtnnsv\":{\"type\":\"Int\",\"defaultValue\":\"datauajwblxph\"},\"gzqzhluc\":{\"type\":\"Array\",\"defaultValue\":\"datajynihtibu\"},\"cgyo\":{\"type\":\"Float\",\"defaultValue\":\"datafehb\"},\"ebldxagmdfjwc\":{\"type\":\"String\",\"defaultValue\":\"datameqljxdumhycxo\"}},\"annotations\":[\"datawxjsjquv\"],\"folder\":{\"name\":\"fzdtsrpjuvgz\"},\"\":{\"huqczouanbfulv\":\"datazhnsbylgmg\"}}") + .toObject(MySqlTableDataset.class); + Assertions.assertEquals("ewy", model.description()); + Assertions.assertEquals("qetp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("ozfrfawtnnsv").type()); + Assertions.assertEquals("fzdtsrpjuvgz", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MySqlTableDataset model = + new MySqlTableDataset() + .withDescription("ewy") + .withStructure("datalclzxkrdpuy") + .withSchema("databpkrpk") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("qetp") + .withParameters(mapOf("fpc", "dataefno", "yrxowv", "datarx"))) + .withParameters( + mapOf( + "ozfrfawtnnsv", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datauajwblxph"), + "gzqzhluc", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datajynihtibu"), + "cgyo", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datafehb"), + "ebldxagmdfjwc", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datameqljxdumhycxo"))) + .withAnnotations(Arrays.asList("datawxjsjquv")) + .withFolder(new DatasetFolder().withName("fzdtsrpjuvgz")) + .withTableName("databtownoljdkx"); + model = BinaryData.fromObject(model).toObject(MySqlTableDataset.class); + Assertions.assertEquals("ewy", model.description()); + Assertions.assertEquals("qetp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.INT, model.parameters().get("ozfrfawtnnsv").type()); + Assertions.assertEquals("fzdtsrpjuvgz", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MySqlTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MySqlTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..18b960e61218 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/MySqlTableDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.MySqlTableDatasetTypeProperties; + +public final class MySqlTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MySqlTableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"dataglxoqwbztilqb\"}") + .toObject(MySqlTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MySqlTableDatasetTypeProperties model = + new MySqlTableDatasetTypeProperties().withTableName("dataglxoqwbztilqb"); + model = BinaryData.fromObject(model).toObject(MySqlTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaPartitionSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaPartitionSettingsTests.java new file mode 100644 index 000000000000..bee066bb0f06 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaPartitionSettingsTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.NetezzaPartitionSettings; + +public final class NetezzaPartitionSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetezzaPartitionSettings model = + BinaryData + .fromString( + "{\"partitionColumnName\":\"datalferjwhonn\",\"partitionUpperBound\":\"datadexnicq\",\"partitionLowerBound\":\"datafqttfqgdoowgqooi\"}") + .toObject(NetezzaPartitionSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetezzaPartitionSettings model = + new NetezzaPartitionSettings() + .withPartitionColumnName("datalferjwhonn") + .withPartitionUpperBound("datadexnicq") + .withPartitionLowerBound("datafqttfqgdoowgqooi"); + model = BinaryData.fromObject(model).toObject(NetezzaPartitionSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaSourceTests.java new file mode 100644 index 000000000000..504951b68cbf --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaSourceTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.NetezzaPartitionSettings; +import com.azure.resourcemanager.datafactory.models.NetezzaSource; + +public final class NetezzaSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetezzaSource model = + BinaryData + .fromString( + "{\"type\":\"NetezzaSource\",\"query\":\"datatu\",\"partitionOption\":\"datazvlhibr\",\"partitionSettings\":{\"partitionColumnName\":\"datagwuv\",\"partitionUpperBound\":\"dataymoqv\",\"partitionLowerBound\":\"datakrynziudmhed\"},\"queryTimeout\":\"dataygwagvuioxjwztr\",\"additionalColumns\":\"datatll\",\"sourceRetryCount\":\"datacv\",\"sourceRetryWait\":\"datanbccffsbz\",\"maxConcurrentConnections\":\"datatfxq\",\"disableMetricsCollection\":\"dataj\",\"\":{\"vbchpzvq\":\"datadjctt\"}}") + .toObject(NetezzaSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetezzaSource model = + new NetezzaSource() + .withSourceRetryCount("datacv") + .withSourceRetryWait("datanbccffsbz") + .withMaxConcurrentConnections("datatfxq") + .withDisableMetricsCollection("dataj") + .withQueryTimeout("dataygwagvuioxjwztr") + .withAdditionalColumns("datatll") + .withQuery("datatu") + .withPartitionOption("datazvlhibr") + .withPartitionSettings( + new NetezzaPartitionSettings() + .withPartitionColumnName("datagwuv") + .withPartitionUpperBound("dataymoqv") + .withPartitionLowerBound("datakrynziudmhed")); + model = BinaryData.fromObject(model).toObject(NetezzaSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaTableDatasetTests.java new file mode 100644 index 000000000000..9e2654f51928 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaTableDatasetTests.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.NetezzaTableDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class NetezzaTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetezzaTableDataset model = + BinaryData + .fromString( + "{\"type\":\"NetezzaTable\",\"typeProperties\":{\"tableName\":\"datadvfjd\",\"table\":\"dataephtoshqtuar\",\"schema\":\"datagujrcnxaeypyq\"},\"description\":\"zfyasyddqbws\",\"structure\":\"datawyyeomiflrvfe\",\"schema\":\"datactshwfrhhasabvau\",\"linkedServiceName\":{\"referenceName\":\"nwwumkbpg\",\"parameters\":{\"rpdgitenyuksli\":\"databwtpwbjlpfwuq\",\"amrplanch\":\"datampnxg\",\"z\":\"dataotmmxlmxejwyv\",\"sbeqieiuxhj\":\"datajwvtuekbbypqsm\"}},\"parameters\":{\"zyxvta\":{\"type\":\"String\",\"defaultValue\":\"datalnjjhrgkjjpcpih\"},\"urdgc\":{\"type\":\"Float\",\"defaultValue\":\"dataatoidne\"}},\"annotations\":[\"datanaqve\",\"datagnpuelrnanbrpkoc\",\"dataxfbagegjtjltcki\"],\"folder\":{\"name\":\"gfagijxmdbo\"},\"\":{\"invzsod\":\"datahxhahuq\"}}") + .toObject(NetezzaTableDataset.class); + Assertions.assertEquals("zfyasyddqbws", model.description()); + Assertions.assertEquals("nwwumkbpg", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("zyxvta").type()); + Assertions.assertEquals("gfagijxmdbo", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetezzaTableDataset model = + new NetezzaTableDataset() + .withDescription("zfyasyddqbws") + .withStructure("datawyyeomiflrvfe") + .withSchema("datactshwfrhhasabvau") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("nwwumkbpg") + .withParameters( + mapOf( + "rpdgitenyuksli", + "databwtpwbjlpfwuq", + "amrplanch", + "datampnxg", + "z", + "dataotmmxlmxejwyv", + "sbeqieiuxhj", + "datajwvtuekbbypqsm"))) + .withParameters( + mapOf( + "zyxvta", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datalnjjhrgkjjpcpih"), + "urdgc", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("dataatoidne"))) + .withAnnotations(Arrays.asList("datanaqve", "datagnpuelrnanbrpkoc", "dataxfbagegjtjltcki")) + .withFolder(new DatasetFolder().withName("gfagijxmdbo")) + .withTableName("datadvfjd") + .withTable("dataephtoshqtuar") + .withSchemaTypePropertiesSchema("datagujrcnxaeypyq"); + model = BinaryData.fromObject(model).toObject(NetezzaTableDataset.class); + Assertions.assertEquals("zfyasyddqbws", model.description()); + Assertions.assertEquals("nwwumkbpg", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("zyxvta").type()); + Assertions.assertEquals("gfagijxmdbo", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..2c7453de677f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NetezzaTableDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.NetezzaTableDatasetTypeProperties; + +public final class NetezzaTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetezzaTableDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"datakrqdbsgkqy\",\"table\":\"dataotypcjxh\",\"schema\":\"datazlocjhzppdbr\"}") + .toObject(NetezzaTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetezzaTableDatasetTypeProperties model = + new NetezzaTableDatasetTypeProperties() + .withTableName("datakrqdbsgkqy") + .withTable("dataotypcjxh") + .withSchema("datazlocjhzppdbr"); + model = BinaryData.fromObject(model).toObject(NetezzaTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NotebookParameterTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NotebookParameterTests.java new file mode 100644 index 000000000000..a42fad61f816 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/NotebookParameterTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.NotebookParameter; +import com.azure.resourcemanager.datafactory.models.NotebookParameterType; +import org.junit.jupiter.api.Assertions; + +public final class NotebookParameterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NotebookParameter model = + BinaryData.fromString("{\"value\":\"datauhnwcqvel\",\"type\":\"float\"}").toObject(NotebookParameter.class); + Assertions.assertEquals(NotebookParameterType.FLOAT, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NotebookParameter model = + new NotebookParameter().withValue("datauhnwcqvel").withType(NotebookParameterType.FLOAT); + model = BinaryData.fromObject(model).toObject(NotebookParameter.class); + Assertions.assertEquals(NotebookParameterType.FLOAT, model.type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ODataResourceDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ODataResourceDatasetTests.java new file mode 100644 index 000000000000..2b3ca851ce92 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ODataResourceDatasetTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ODataResourceDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ODataResourceDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ODataResourceDataset model = + BinaryData + .fromString( + "{\"type\":\"ODataResource\",\"typeProperties\":{\"path\":\"dataicovj\"},\"description\":\"vwrmjx\",\"structure\":\"datauod\",\"schema\":\"dataczbassqfyylwpp\",\"linkedServiceName\":{\"referenceName\":\"ygkbzb\",\"parameters\":{\"pmhttuvsqjsrvjnq\":\"datasybxhqvov\",\"qbfkceincnrecjbi\":\"dataaqg\",\"sqsvzvmxtc\":\"datawevsfgdrmnszdosm\",\"hgsulwvgs\":\"dataghndae\"}},\"parameters\":{\"jjuzk\":{\"type\":\"Float\",\"defaultValue\":\"datav\"},\"vljlbzdlby\":{\"type\":\"Bool\",\"defaultValue\":\"dataciwuhyzekypy\"},\"ov\":{\"type\":\"String\",\"defaultValue\":\"dataxhpzy\"}},\"annotations\":[\"databhanz\"],\"folder\":{\"name\":\"fhsh\"},\"\":{\"zpbyfyvynpmggq\":\"dataahn\",\"izorbloejzs\":\"dataagenvqbugihcdvf\"}}") + .toObject(ODataResourceDataset.class); + Assertions.assertEquals("vwrmjx", model.description()); + Assertions.assertEquals("ygkbzb", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("jjuzk").type()); + Assertions.assertEquals("fhsh", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ODataResourceDataset model = + new ODataResourceDataset() + .withDescription("vwrmjx") + .withStructure("datauod") + .withSchema("dataczbassqfyylwpp") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ygkbzb") + .withParameters( + mapOf( + "pmhttuvsqjsrvjnq", + "datasybxhqvov", + "qbfkceincnrecjbi", + "dataaqg", + "sqsvzvmxtc", + "datawevsfgdrmnszdosm", + "hgsulwvgs", + "dataghndae"))) + .withParameters( + mapOf( + "jjuzk", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datav"), + "vljlbzdlby", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataciwuhyzekypy"), + "ov", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataxhpzy"))) + .withAnnotations(Arrays.asList("databhanz")) + .withFolder(new DatasetFolder().withName("fhsh")) + .withPath("dataicovj"); + model = BinaryData.fromObject(model).toObject(ODataResourceDataset.class); + Assertions.assertEquals("vwrmjx", model.description()); + Assertions.assertEquals("ygkbzb", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("jjuzk").type()); + Assertions.assertEquals("fhsh", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ODataResourceDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ODataResourceDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..6d05c7575703 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ODataResourceDatasetTypePropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ODataResourceDatasetTypeProperties; + +public final class ODataResourceDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ODataResourceDatasetTypeProperties model = + BinaryData.fromString("{\"path\":\"datazgkqwvde\"}").toObject(ODataResourceDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ODataResourceDatasetTypeProperties model = new ODataResourceDatasetTypeProperties().withPath("datazgkqwvde"); + model = BinaryData.fromObject(model).toObject(ODataResourceDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ODataSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ODataSourceTests.java new file mode 100644 index 000000000000..7b94da442295 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ODataSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ODataSource; + +public final class ODataSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ODataSource model = + BinaryData + .fromString( + "{\"type\":\"ODataSource\",\"query\":\"dataqjneszxte\",\"httpRequestTimeout\":\"datahxphxokdbv\",\"additionalColumns\":\"dataqttusuxxb\",\"sourceRetryCount\":\"datapvue\",\"sourceRetryWait\":\"datarnnwgrxzcn\",\"maxConcurrentConnections\":\"datauezxluimkwbwmg\",\"disableMetricsCollection\":\"dataqlsn\",\"\":{\"cfvinjxciun\":\"datahpcjztziuuuyv\",\"zbp\":\"datatcxgdgqkletlwav\",\"drqgionm\":\"dataxxvft\"}}") + .toObject(ODataSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ODataSource model = + new ODataSource() + .withSourceRetryCount("datapvue") + .withSourceRetryWait("datarnnwgrxzcn") + .withMaxConcurrentConnections("datauezxluimkwbwmg") + .withDisableMetricsCollection("dataqlsn") + .withQuery("dataqjneszxte") + .withHttpRequestTimeout("datahxphxokdbv") + .withAdditionalColumns("dataqttusuxxb"); + model = BinaryData.fromObject(model).toObject(ODataSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcSinkTests.java new file mode 100644 index 000000000000..11ce6266f4e5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OdbcSink; + +public final class OdbcSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OdbcSink model = + BinaryData + .fromString( + "{\"type\":\"OdbcSink\",\"preCopyScript\":\"datatsnqjcmk\",\"writeBatchSize\":\"databckjrfkwclqmyowd\",\"writeBatchTimeout\":\"datatwaxobdzatqocvrd\",\"sinkRetryCount\":\"datavsclwpsteuvjdnh\",\"sinkRetryWait\":\"datayvymvnlaehit\",\"maxConcurrentConnections\":\"dataibfomohcynorhhbv\",\"disableMetricsCollection\":\"dataxtktkeuapomoof\",\"\":{\"mathiydmkyvsxc\":\"datahptraljcqpu\",\"fmkp\":\"dataivghajpddgfozn\",\"mwptdrrruy\":\"dataoesozcuhunmfz\"}}") + .toObject(OdbcSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OdbcSink model = + new OdbcSink() + .withWriteBatchSize("databckjrfkwclqmyowd") + .withWriteBatchTimeout("datatwaxobdzatqocvrd") + .withSinkRetryCount("datavsclwpsteuvjdnh") + .withSinkRetryWait("datayvymvnlaehit") + .withMaxConcurrentConnections("dataibfomohcynorhhbv") + .withDisableMetricsCollection("dataxtktkeuapomoof") + .withPreCopyScript("datatsnqjcmk"); + model = BinaryData.fromObject(model).toObject(OdbcSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcSourceTests.java new file mode 100644 index 000000000000..552b579c504a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OdbcSource; + +public final class OdbcSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OdbcSource model = + BinaryData + .fromString( + "{\"type\":\"OdbcSource\",\"query\":\"dataodrvwnqbpxyofft\",\"queryTimeout\":\"dataovbhqelsslfxejp\",\"additionalColumns\":\"datasgigs\",\"sourceRetryCount\":\"datatx\",\"sourceRetryWait\":\"datayjwmglgstrzfh\",\"maxConcurrentConnections\":\"datadzovkbcbefohny\",\"disableMetricsCollection\":\"datahmlj\",\"\":{\"szxdbgl\":\"datagfvzvmtjcxig\",\"ivmbu\":\"dataeet\",\"wfhfptbdxtvl\":\"dataizw\"}}") + .toObject(OdbcSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OdbcSource model = + new OdbcSource() + .withSourceRetryCount("datatx") + .withSourceRetryWait("datayjwmglgstrzfh") + .withMaxConcurrentConnections("datadzovkbcbefohny") + .withDisableMetricsCollection("datahmlj") + .withQueryTimeout("dataovbhqelsslfxejp") + .withAdditionalColumns("datasgigs") + .withQuery("dataodrvwnqbpxyofft"); + model = BinaryData.fromObject(model).toObject(OdbcSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcTableDatasetTests.java new file mode 100644 index 000000000000..4493cc307ac5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcTableDatasetTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.OdbcTableDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class OdbcTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OdbcTableDataset model = + BinaryData + .fromString( + "{\"type\":\"OdbcTable\",\"typeProperties\":{\"tableName\":\"dataizp\"},\"description\":\"fxzspfyvslazippl\",\"structure\":\"datatdumjtycildrzn\",\"schema\":\"dataxozqthkwxfugfziz\",\"linkedServiceName\":{\"referenceName\":\"xduyjnqzbrqcakm\",\"parameters\":{\"nsbqoitwhmuc\":\"dataviyjuca\",\"xy\":\"dataiuh\",\"ycudus\":\"dataehyklelyqdvpqfbx\",\"vfopkyl\":\"datamtxqlefnohey\"}},\"parameters\":{\"w\":{\"type\":\"SecureString\",\"defaultValue\":\"datanj\"}},\"annotations\":[\"datafwtwrsvevc\",\"datae\",\"dataswxhqhgkhtbzv\"],\"folder\":{\"name\":\"evvjncpmyhtxg\"},\"\":{\"bcyjrtalqee\":\"dataghcmixmlwkfe\",\"tomsgoihlqwbywaa\":\"dataudfyimooaez\"}}") + .toObject(OdbcTableDataset.class); + Assertions.assertEquals("fxzspfyvslazippl", model.description()); + Assertions.assertEquals("xduyjnqzbrqcakm", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("w").type()); + Assertions.assertEquals("evvjncpmyhtxg", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OdbcTableDataset model = + new OdbcTableDataset() + .withDescription("fxzspfyvslazippl") + .withStructure("datatdumjtycildrzn") + .withSchema("dataxozqthkwxfugfziz") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("xduyjnqzbrqcakm") + .withParameters( + mapOf( + "nsbqoitwhmuc", + "dataviyjuca", + "xy", + "dataiuh", + "ycudus", + "dataehyklelyqdvpqfbx", + "vfopkyl", + "datamtxqlefnohey"))) + .withParameters( + mapOf( + "w", + new ParameterSpecification().withType(ParameterType.SECURE_STRING).withDefaultValue("datanj"))) + .withAnnotations(Arrays.asList("datafwtwrsvevc", "datae", "dataswxhqhgkhtbzv")) + .withFolder(new DatasetFolder().withName("evvjncpmyhtxg")) + .withTableName("dataizp"); + model = BinaryData.fromObject(model).toObject(OdbcTableDataset.class); + Assertions.assertEquals("fxzspfyvslazippl", model.description()); + Assertions.assertEquals("xduyjnqzbrqcakm", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("w").type()); + Assertions.assertEquals("evvjncpmyhtxg", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..61cb938d221b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OdbcTableDatasetTypePropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.OdbcTableDatasetTypeProperties; + +public final class OdbcTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OdbcTableDatasetTypeProperties model = + BinaryData.fromString("{\"tableName\":\"dataaeeekfztvna\"}").toObject(OdbcTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OdbcTableDatasetTypeProperties model = new OdbcTableDatasetTypeProperties().withTableName("dataaeeekfztvna"); + model = BinaryData.fromObject(model).toObject(OdbcTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Office365DatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Office365DatasetTests.java new file mode 100644 index 000000000000..8321bd46f6a2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Office365DatasetTests.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.Office365Dataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class Office365DatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Office365Dataset model = + BinaryData + .fromString( + "{\"type\":\"Office365Table\",\"typeProperties\":{\"tableName\":\"datavovoa\",\"predicate\":\"datagjsmbc\"},\"description\":\"oygsabdgdheronsd\",\"structure\":\"datarkzvz\",\"schema\":\"datatqhgz\",\"linkedServiceName\":{\"referenceName\":\"yxtrvfdbqsk\",\"parameters\":{\"ptpvsffavdhpiw\":\"databvi\",\"bwxyldqtmggcpd\":\"datamuwkgjwbyfdw\",\"zctwymzsk\":\"datamegaj\"}},\"parameters\":{\"gliupqscoob\":{\"type\":\"Object\",\"defaultValue\":\"dataeseip\"},\"incev\":{\"type\":\"Object\",\"defaultValue\":\"datacaxsqcomjiq\"},\"duvtvod\":{\"type\":\"Int\",\"defaultValue\":\"datadevpximziizmeq\"},\"hm\":{\"type\":\"SecureString\",\"defaultValue\":\"datap\"}},\"annotations\":[\"datab\",\"datablmcvrjaznotdof\",\"datavpbqsdqkpsbqs\",\"databmitaftazgcxsvq\"],\"folder\":{\"name\":\"ufylamxowbg\"},\"\":{\"xiknsgofuns\":\"datayutehlkarvtipquk\",\"xn\":\"datahpcekggvmfnnb\"}}") + .toObject(Office365Dataset.class); + Assertions.assertEquals("oygsabdgdheronsd", model.description()); + Assertions.assertEquals("yxtrvfdbqsk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("gliupqscoob").type()); + Assertions.assertEquals("ufylamxowbg", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Office365Dataset model = + new Office365Dataset() + .withDescription("oygsabdgdheronsd") + .withStructure("datarkzvz") + .withSchema("datatqhgz") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("yxtrvfdbqsk") + .withParameters( + mapOf( + "ptpvsffavdhpiw", + "databvi", + "bwxyldqtmggcpd", + "datamuwkgjwbyfdw", + "zctwymzsk", + "datamegaj"))) + .withParameters( + mapOf( + "gliupqscoob", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("dataeseip"), + "incev", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datacaxsqcomjiq"), + "duvtvod", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datadevpximziizmeq"), + "hm", + new ParameterSpecification().withType(ParameterType.SECURE_STRING).withDefaultValue("datap"))) + .withAnnotations( + Arrays.asList("datab", "datablmcvrjaznotdof", "datavpbqsdqkpsbqs", "databmitaftazgcxsvq")) + .withFolder(new DatasetFolder().withName("ufylamxowbg")) + .withTableName("datavovoa") + .withPredicate("datagjsmbc"); + model = BinaryData.fromObject(model).toObject(Office365Dataset.class); + Assertions.assertEquals("oygsabdgdheronsd", model.description()); + Assertions.assertEquals("yxtrvfdbqsk", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("gliupqscoob").type()); + Assertions.assertEquals("ufylamxowbg", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Office365DatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Office365DatasetTypePropertiesTests.java new file mode 100644 index 000000000000..0835ca25b043 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Office365DatasetTypePropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.Office365DatasetTypeProperties; + +public final class Office365DatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Office365DatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"datadfkkedeetxtpwcv\",\"predicate\":\"datafwsunjzijaciwmm\"}") + .toObject(Office365DatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Office365DatasetTypeProperties model = + new Office365DatasetTypeProperties() + .withTableName("datadfkkedeetxtpwcv") + .withPredicate("datafwsunjzijaciwmm"); + model = BinaryData.fromObject(model).toObject(Office365DatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Office365SourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Office365SourceTests.java new file mode 100644 index 000000000000..da07ade0b318 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/Office365SourceTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Office365Source; + +public final class Office365SourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Office365Source model = + BinaryData + .fromString( + "{\"type\":\"Office365Source\",\"allowedGroups\":\"datachkkwah\",\"userScopeFilterUri\":\"datayrdlvbomhfqsjz\",\"dateFilterColumn\":\"dataktk\",\"startTime\":\"dataxtee\",\"endTime\":\"datahxgnlpjytle\",\"outputColumns\":\"datamijhnjk\",\"sourceRetryCount\":\"dataohhuw\",\"sourceRetryWait\":\"datankzbdeyhw\",\"maxConcurrentConnections\":\"datahobdocfvajmmdmby\",\"disableMetricsCollection\":\"datandtqujfzxsazu\",\"\":{\"shsxhtvnqcmrr\":\"datawwtlerhpfrarqnj\",\"csddlcnwbijxf\":\"datamlwgomh\",\"rowh\":\"datangeffrghwd\",\"cwawlmsiklzomd\":\"datarguvdrgg\"}}") + .toObject(Office365Source.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Office365Source model = + new Office365Source() + .withSourceRetryCount("dataohhuw") + .withSourceRetryWait("datankzbdeyhw") + .withMaxConcurrentConnections("datahobdocfvajmmdmby") + .withDisableMetricsCollection("datandtqujfzxsazu") + .withAllowedGroups("datachkkwah") + .withUserScopeFilterUri("datayrdlvbomhfqsjz") + .withDateFilterColumn("dataktk") + .withStartTime("dataxtee") + .withEndTime("datahxgnlpjytle") + .withOutputColumns("datamijhnjk"); + model = BinaryData.fromObject(model).toObject(Office365Source.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationDisplayTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..dbd687953e59 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationDisplayTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OperationDisplay; +import org.junit.jupiter.api.Assertions; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = + BinaryData + .fromString( + "{\"description\":\"xinpmqnjaq\",\"provider\":\"xj\",\"resource\":\"r\",\"operation\":\"vcputegj\"}") + .toObject(OperationDisplay.class); + Assertions.assertEquals("xinpmqnjaq", model.description()); + Assertions.assertEquals("xj", model.provider()); + Assertions.assertEquals("r", model.resource()); + Assertions.assertEquals("vcputegj", model.operation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationDisplay model = + new OperationDisplay() + .withDescription("xinpmqnjaq") + .withProvider("xj") + .withResource("r") + .withOperation("vcputegj"); + model = BinaryData.fromObject(model).toObject(OperationDisplay.class); + Assertions.assertEquals("xinpmqnjaq", model.description()); + Assertions.assertEquals("xj", model.provider()); + Assertions.assertEquals("r", model.resource()); + Assertions.assertEquals("vcputegj", model.operation()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationInnerTests.java new file mode 100644 index 000000000000..499d1a67dbfa --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationInnerTests.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.OperationInner; +import com.azure.resourcemanager.datafactory.models.OperationDisplay; +import com.azure.resourcemanager.datafactory.models.OperationLogSpecification; +import com.azure.resourcemanager.datafactory.models.OperationMetricAvailability; +import com.azure.resourcemanager.datafactory.models.OperationMetricDimension; +import com.azure.resourcemanager.datafactory.models.OperationMetricSpecification; +import com.azure.resourcemanager.datafactory.models.OperationServiceSpecification; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = + BinaryData + .fromString( + "{\"name\":\"itjz\",\"origin\":\"lusarh\",\"display\":{\"description\":\"cqhsm\",\"provider\":\"rkdtmlxh\",\"resource\":\"uksjtxukcdmp\",\"operation\":\"cryuan\"},\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{\"name\":\"xtayr\",\"displayName\":\"m\",\"blobDuration\":\"fp\"},{\"name\":\"qobmtukk\",\"displayName\":\"yrtih\",\"blobDuration\":\"tijbpzvgnwzsymgl\"},{\"name\":\"fcyzkohdbihanufh\",\"displayName\":\"bj\",\"blobDuration\":\"a\"},{\"name\":\"th\",\"displayName\":\"hab\",\"blobDuration\":\"pikxwczbyscnpqxu\"}],\"metricSpecifications\":[{\"name\":\"qniwbybrkxvdumj\",\"displayName\":\"tfwvukxgaudc\",\"displayDescription\":\"nhsjcnyej\",\"unit\":\"ryhtnapczwlokjy\",\"aggregationType\":\"kkvnipjox\",\"enableRegionalMdmAccount\":\"nchgej\",\"sourceMdmAccount\":\"odmailzyd\",\"sourceMdmNamespace\":\"o\",\"availabilities\":[{},{}],\"dimensions\":[{},{},{}]}]}}}") + .toObject(OperationInner.class); + Assertions.assertEquals("itjz", model.name()); + Assertions.assertEquals("lusarh", model.origin()); + Assertions.assertEquals("cqhsm", model.display().description()); + Assertions.assertEquals("rkdtmlxh", model.display().provider()); + Assertions.assertEquals("uksjtxukcdmp", model.display().resource()); + Assertions.assertEquals("cryuan", model.display().operation()); + Assertions.assertEquals("xtayr", model.serviceSpecification().logSpecifications().get(0).name()); + Assertions.assertEquals("m", model.serviceSpecification().logSpecifications().get(0).displayName()); + Assertions.assertEquals("fp", model.serviceSpecification().logSpecifications().get(0).blobDuration()); + Assertions.assertEquals("qniwbybrkxvdumj", model.serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals("tfwvukxgaudc", model.serviceSpecification().metricSpecifications().get(0).displayName()); + Assertions + .assertEquals("nhsjcnyej", model.serviceSpecification().metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("ryhtnapczwlokjy", model.serviceSpecification().metricSpecifications().get(0).unit()); + Assertions + .assertEquals("kkvnipjox", model.serviceSpecification().metricSpecifications().get(0).aggregationType()); + Assertions + .assertEquals( + "nchgej", model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount()); + Assertions + .assertEquals("odmailzyd", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount()); + Assertions.assertEquals("o", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationInner model = + new OperationInner() + .withName("itjz") + .withOrigin("lusarh") + .withDisplay( + new OperationDisplay() + .withDescription("cqhsm") + .withProvider("rkdtmlxh") + .withResource("uksjtxukcdmp") + .withOperation("cryuan")) + .withServiceSpecification( + new OperationServiceSpecification() + .withLogSpecifications( + Arrays + .asList( + new OperationLogSpecification() + .withName("xtayr") + .withDisplayName("m") + .withBlobDuration("fp"), + new OperationLogSpecification() + .withName("qobmtukk") + .withDisplayName("yrtih") + .withBlobDuration("tijbpzvgnwzsymgl"), + new OperationLogSpecification() + .withName("fcyzkohdbihanufh") + .withDisplayName("bj") + .withBlobDuration("a"), + new OperationLogSpecification() + .withName("th") + .withDisplayName("hab") + .withBlobDuration("pikxwczbyscnpqxu"))) + .withMetricSpecifications( + Arrays + .asList( + new OperationMetricSpecification() + .withName("qniwbybrkxvdumj") + .withDisplayName("tfwvukxgaudc") + .withDisplayDescription("nhsjcnyej") + .withUnit("ryhtnapczwlokjy") + .withAggregationType("kkvnipjox") + .withEnableRegionalMdmAccount("nchgej") + .withSourceMdmAccount("odmailzyd") + .withSourceMdmNamespace("o") + .withAvailabilities( + Arrays + .asList( + new OperationMetricAvailability(), + new OperationMetricAvailability())) + .withDimensions( + Arrays + .asList( + new OperationMetricDimension(), + new OperationMetricDimension(), + new OperationMetricDimension()))))); + model = BinaryData.fromObject(model).toObject(OperationInner.class); + Assertions.assertEquals("itjz", model.name()); + Assertions.assertEquals("lusarh", model.origin()); + Assertions.assertEquals("cqhsm", model.display().description()); + Assertions.assertEquals("rkdtmlxh", model.display().provider()); + Assertions.assertEquals("uksjtxukcdmp", model.display().resource()); + Assertions.assertEquals("cryuan", model.display().operation()); + Assertions.assertEquals("xtayr", model.serviceSpecification().logSpecifications().get(0).name()); + Assertions.assertEquals("m", model.serviceSpecification().logSpecifications().get(0).displayName()); + Assertions.assertEquals("fp", model.serviceSpecification().logSpecifications().get(0).blobDuration()); + Assertions.assertEquals("qniwbybrkxvdumj", model.serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals("tfwvukxgaudc", model.serviceSpecification().metricSpecifications().get(0).displayName()); + Assertions + .assertEquals("nhsjcnyej", model.serviceSpecification().metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("ryhtnapczwlokjy", model.serviceSpecification().metricSpecifications().get(0).unit()); + Assertions + .assertEquals("kkvnipjox", model.serviceSpecification().metricSpecifications().get(0).aggregationType()); + Assertions + .assertEquals( + "nchgej", model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount()); + Assertions + .assertEquals("odmailzyd", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount()); + Assertions.assertEquals("o", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationListResponseTests.java new file mode 100644 index 000000000000..9e4fe9d60687 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationListResponseTests.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.OperationInner; +import com.azure.resourcemanager.datafactory.models.OperationDisplay; +import com.azure.resourcemanager.datafactory.models.OperationListResponse; +import com.azure.resourcemanager.datafactory.models.OperationLogSpecification; +import com.azure.resourcemanager.datafactory.models.OperationMetricSpecification; +import com.azure.resourcemanager.datafactory.models.OperationServiceSpecification; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"origin\":\"tzopbsphrupidgsy\",\"display\":{\"description\":\"jhphoyc\",\"provider\":\"xaobhdxbmtqioqjz\",\"resource\":\"tbmufpo\",\"operation\":\"oizh\"},\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{},{},{}],\"metricSpecifications\":[{},{},{}]}}},{\"name\":\"oqijgkdmbpaz\",\"origin\":\"bc\",\"display\":{\"description\":\"dznrbtcqq\",\"provider\":\"qglhq\",\"resource\":\"ufo\",\"operation\":\"jywif\"},\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{},{}],\"metricSpecifications\":[{}]}}},{\"name\":\"f\",\"origin\":\"lzl\",\"display\":{\"description\":\"rifkwm\",\"provider\":\"ktsizntocipaou\",\"resource\":\"psqucmpoyf\",\"operation\":\"fogknygjofjdde\"},\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{},{},{},{}],\"metricSpecifications\":[{},{}]}}}],\"nextLink\":\"wnw\"}") + .toObject(OperationListResponse.class); + Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); + Assertions.assertEquals("tzopbsphrupidgsy", model.value().get(0).origin()); + Assertions.assertEquals("jhphoyc", model.value().get(0).display().description()); + Assertions.assertEquals("xaobhdxbmtqioqjz", model.value().get(0).display().provider()); + Assertions.assertEquals("tbmufpo", model.value().get(0).display().resource()); + Assertions.assertEquals("oizh", model.value().get(0).display().operation()); + Assertions.assertEquals("wnw", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationListResponse model = + new OperationListResponse() + .withValue( + Arrays + .asList( + new OperationInner() + .withName("quvgjxpybczme") + .withOrigin("tzopbsphrupidgsy") + .withDisplay( + new OperationDisplay() + .withDescription("jhphoyc") + .withProvider("xaobhdxbmtqioqjz") + .withResource("tbmufpo") + .withOperation("oizh")) + .withServiceSpecification( + new OperationServiceSpecification() + .withLogSpecifications( + Arrays + .asList( + new OperationLogSpecification(), + new OperationLogSpecification(), + new OperationLogSpecification())) + .withMetricSpecifications( + Arrays + .asList( + new OperationMetricSpecification(), + new OperationMetricSpecification(), + new OperationMetricSpecification()))), + new OperationInner() + .withName("oqijgkdmbpaz") + .withOrigin("bc") + .withDisplay( + new OperationDisplay() + .withDescription("dznrbtcqq") + .withProvider("qglhq") + .withResource("ufo") + .withOperation("jywif")) + .withServiceSpecification( + new OperationServiceSpecification() + .withLogSpecifications( + Arrays + .asList( + new OperationLogSpecification(), new OperationLogSpecification())) + .withMetricSpecifications(Arrays.asList(new OperationMetricSpecification()))), + new OperationInner() + .withName("f") + .withOrigin("lzl") + .withDisplay( + new OperationDisplay() + .withDescription("rifkwm") + .withProvider("ktsizntocipaou") + .withResource("psqucmpoyf") + .withOperation("fogknygjofjdde")) + .withServiceSpecification( + new OperationServiceSpecification() + .withLogSpecifications( + Arrays + .asList( + new OperationLogSpecification(), + new OperationLogSpecification(), + new OperationLogSpecification(), + new OperationLogSpecification())) + .withMetricSpecifications( + Arrays + .asList( + new OperationMetricSpecification(), + new OperationMetricSpecification()))))) + .withNextLink("wnw"); + model = BinaryData.fromObject(model).toObject(OperationListResponse.class); + Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); + Assertions.assertEquals("tzopbsphrupidgsy", model.value().get(0).origin()); + Assertions.assertEquals("jhphoyc", model.value().get(0).display().description()); + Assertions.assertEquals("xaobhdxbmtqioqjz", model.value().get(0).display().provider()); + Assertions.assertEquals("tbmufpo", model.value().get(0).display().resource()); + Assertions.assertEquals("oizh", model.value().get(0).display().operation()); + Assertions.assertEquals("wnw", model.nextLink()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationLogSpecificationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationLogSpecificationTests.java new file mode 100644 index 000000000000..2e26ad226ade --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationLogSpecificationTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OperationLogSpecification; +import org.junit.jupiter.api.Assertions; + +public final class OperationLogSpecificationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationLogSpecification model = + BinaryData + .fromString( + "{\"name\":\"ifiyipjxsqwpgrj\",\"displayName\":\"norcjxvsnbyxqab\",\"blobDuration\":\"ocpcy\"}") + .toObject(OperationLogSpecification.class); + Assertions.assertEquals("ifiyipjxsqwpgrj", model.name()); + Assertions.assertEquals("norcjxvsnbyxqab", model.displayName()); + Assertions.assertEquals("ocpcy", model.blobDuration()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationLogSpecification model = + new OperationLogSpecification() + .withName("ifiyipjxsqwpgrj") + .withDisplayName("norcjxvsnbyxqab") + .withBlobDuration("ocpcy"); + model = BinaryData.fromObject(model).toObject(OperationLogSpecification.class); + Assertions.assertEquals("ifiyipjxsqwpgrj", model.name()); + Assertions.assertEquals("norcjxvsnbyxqab", model.displayName()); + Assertions.assertEquals("ocpcy", model.blobDuration()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationMetricAvailabilityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationMetricAvailabilityTests.java new file mode 100644 index 000000000000..c06e6c848750 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationMetricAvailabilityTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OperationMetricAvailability; +import org.junit.jupiter.api.Assertions; + +public final class OperationMetricAvailabilityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationMetricAvailability model = + BinaryData + .fromString("{\"timeGrain\":\"ddntwndei\",\"blobDuration\":\"twnpzaoqvuhrhcf\"}") + .toObject(OperationMetricAvailability.class); + Assertions.assertEquals("ddntwndei", model.timeGrain()); + Assertions.assertEquals("twnpzaoqvuhrhcf", model.blobDuration()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationMetricAvailability model = + new OperationMetricAvailability().withTimeGrain("ddntwndei").withBlobDuration("twnpzaoqvuhrhcf"); + model = BinaryData.fromObject(model).toObject(OperationMetricAvailability.class); + Assertions.assertEquals("ddntwndei", model.timeGrain()); + Assertions.assertEquals("twnpzaoqvuhrhcf", model.blobDuration()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationMetricDimensionTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationMetricDimensionTests.java new file mode 100644 index 000000000000..3c4fd8f66374 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationMetricDimensionTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OperationMetricDimension; +import org.junit.jupiter.api.Assertions; + +public final class OperationMetricDimensionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationMetricDimension model = + BinaryData + .fromString("{\"name\":\"yd\",\"displayName\":\"lmjthjq\",\"toBeExportedForShoebox\":false}") + .toObject(OperationMetricDimension.class); + Assertions.assertEquals("yd", model.name()); + Assertions.assertEquals("lmjthjq", model.displayName()); + Assertions.assertEquals(false, model.toBeExportedForShoebox()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationMetricDimension model = + new OperationMetricDimension().withName("yd").withDisplayName("lmjthjq").withToBeExportedForShoebox(false); + model = BinaryData.fromObject(model).toObject(OperationMetricDimension.class); + Assertions.assertEquals("yd", model.name()); + Assertions.assertEquals("lmjthjq", model.displayName()); + Assertions.assertEquals(false, model.toBeExportedForShoebox()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationMetricSpecificationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationMetricSpecificationTests.java new file mode 100644 index 000000000000..bdda3f473c4b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationMetricSpecificationTests.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OperationMetricAvailability; +import com.azure.resourcemanager.datafactory.models.OperationMetricDimension; +import com.azure.resourcemanager.datafactory.models.OperationMetricSpecification; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OperationMetricSpecificationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationMetricSpecification model = + BinaryData + .fromString( + "{\"name\":\"urzafb\",\"displayName\":\"j\",\"displayDescription\":\"btoqcjmkljavbqid\",\"unit\":\"ajzyul\",\"aggregationType\":\"u\",\"enableRegionalMdmAccount\":\"krlkhbzhfepg\",\"sourceMdmAccount\":\"qex\",\"sourceMdmNamespace\":\"ocxscpaierhhbcs\",\"availabilities\":[{\"timeGrain\":\"majtjaod\",\"blobDuration\":\"bnbdxkqpxokajion\"},{\"timeGrain\":\"mexgstxgcp\",\"blobDuration\":\"gmaajrm\"},{\"timeGrain\":\"jwzrl\",\"blobDuration\":\"mcl\"}],\"dimensions\":[{\"name\":\"coejctbzaqs\",\"displayName\":\"y\",\"toBeExportedForShoebox\":false},{\"name\":\"fkgukdkexxppof\",\"displayName\":\"axcfjpgddtocjjx\",\"toBeExportedForShoebox\":true},{\"name\":\"o\",\"displayName\":\"xhdzxibqeojnx\",\"toBeExportedForShoebox\":true}]}") + .toObject(OperationMetricSpecification.class); + Assertions.assertEquals("urzafb", model.name()); + Assertions.assertEquals("j", model.displayName()); + Assertions.assertEquals("btoqcjmkljavbqid", model.displayDescription()); + Assertions.assertEquals("ajzyul", model.unit()); + Assertions.assertEquals("u", model.aggregationType()); + Assertions.assertEquals("krlkhbzhfepg", model.enableRegionalMdmAccount()); + Assertions.assertEquals("qex", model.sourceMdmAccount()); + Assertions.assertEquals("ocxscpaierhhbcs", model.sourceMdmNamespace()); + Assertions.assertEquals("majtjaod", model.availabilities().get(0).timeGrain()); + Assertions.assertEquals("bnbdxkqpxokajion", model.availabilities().get(0).blobDuration()); + Assertions.assertEquals("coejctbzaqs", model.dimensions().get(0).name()); + Assertions.assertEquals("y", model.dimensions().get(0).displayName()); + Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForShoebox()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationMetricSpecification model = + new OperationMetricSpecification() + .withName("urzafb") + .withDisplayName("j") + .withDisplayDescription("btoqcjmkljavbqid") + .withUnit("ajzyul") + .withAggregationType("u") + .withEnableRegionalMdmAccount("krlkhbzhfepg") + .withSourceMdmAccount("qex") + .withSourceMdmNamespace("ocxscpaierhhbcs") + .withAvailabilities( + Arrays + .asList( + new OperationMetricAvailability() + .withTimeGrain("majtjaod") + .withBlobDuration("bnbdxkqpxokajion"), + new OperationMetricAvailability().withTimeGrain("mexgstxgcp").withBlobDuration("gmaajrm"), + new OperationMetricAvailability().withTimeGrain("jwzrl").withBlobDuration("mcl"))) + .withDimensions( + Arrays + .asList( + new OperationMetricDimension() + .withName("coejctbzaqs") + .withDisplayName("y") + .withToBeExportedForShoebox(false), + new OperationMetricDimension() + .withName("fkgukdkexxppof") + .withDisplayName("axcfjpgddtocjjx") + .withToBeExportedForShoebox(true), + new OperationMetricDimension() + .withName("o") + .withDisplayName("xhdzxibqeojnx") + .withToBeExportedForShoebox(true))); + model = BinaryData.fromObject(model).toObject(OperationMetricSpecification.class); + Assertions.assertEquals("urzafb", model.name()); + Assertions.assertEquals("j", model.displayName()); + Assertions.assertEquals("btoqcjmkljavbqid", model.displayDescription()); + Assertions.assertEquals("ajzyul", model.unit()); + Assertions.assertEquals("u", model.aggregationType()); + Assertions.assertEquals("krlkhbzhfepg", model.enableRegionalMdmAccount()); + Assertions.assertEquals("qex", model.sourceMdmAccount()); + Assertions.assertEquals("ocxscpaierhhbcs", model.sourceMdmNamespace()); + Assertions.assertEquals("majtjaod", model.availabilities().get(0).timeGrain()); + Assertions.assertEquals("bnbdxkqpxokajion", model.availabilities().get(0).blobDuration()); + Assertions.assertEquals("coejctbzaqs", model.dimensions().get(0).name()); + Assertions.assertEquals("y", model.dimensions().get(0).displayName()); + Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForShoebox()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationPropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationPropertiesTests.java new file mode 100644 index 000000000000..ac1aeab8fd7c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationPropertiesTests.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.OperationProperties; +import com.azure.resourcemanager.datafactory.models.OperationLogSpecification; +import com.azure.resourcemanager.datafactory.models.OperationMetricAvailability; +import com.azure.resourcemanager.datafactory.models.OperationMetricDimension; +import com.azure.resourcemanager.datafactory.models.OperationMetricSpecification; +import com.azure.resourcemanager.datafactory.models.OperationServiceSpecification; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OperationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationProperties model = + BinaryData + .fromString( + "{\"serviceSpecification\":{\"logSpecifications\":[{\"name\":\"atscmd\",\"displayName\":\"jhulsuuvmkjo\",\"blobDuration\":\"rwfndiod\"},{\"name\":\"slwejdpvw\",\"displayName\":\"oqpsoa\",\"blobDuration\":\"tazak\"}],\"metricSpecifications\":[{\"name\":\"hbcryffdfdosyge\",\"displayName\":\"aojakhmsbzjhcrz\",\"displayDescription\":\"dphlxaolt\",\"unit\":\"trg\",\"aggregationType\":\"bpf\",\"enableRegionalMdmAccount\":\"s\",\"sourceMdmAccount\":\"zgvfcjrwz\",\"sourceMdmNamespace\":\"xjtfelluwfzit\",\"availabilities\":[{\"timeGrain\":\"qfpjk\",\"blobDuration\":\"xofpdvhpfxxypi\"},{\"timeGrain\":\"nmayhuybb\",\"blobDuration\":\"odepoogin\"},{\"timeGrain\":\"amiheognarxz\",\"blobDuration\":\"heotusiv\"}],\"dimensions\":[{\"name\":\"ciqihnhung\",\"displayName\":\"jzrnf\",\"toBeExportedForShoebox\":true}]},{\"name\":\"ispe\",\"displayName\":\"tzfkufubl\",\"displayDescription\":\"fxqeof\",\"unit\":\"e\",\"aggregationType\":\"hqjbasvmsmj\",\"enableRegionalMdmAccount\":\"lngsntnbybkzgcwr\",\"sourceMdmAccount\":\"lxxwrljdouskc\",\"sourceMdmNamespace\":\"kocrcjdkwtnhx\",\"availabilities\":[{\"timeGrain\":\"iksqr\",\"blobDuration\":\"ssainqpjwnzll\"},{\"timeGrain\":\"mppeebvmgxs\",\"blobDuration\":\"kyqduujit\"},{\"timeGrain\":\"czdzev\",\"blobDuration\":\"hkr\"},{\"timeGrain\":\"d\",\"blobDuration\":\"p\"}],\"dimensions\":[{\"name\":\"kvwrwjfeu\",\"displayName\":\"hutje\",\"toBeExportedForShoebox\":false},{\"name\":\"ldhugjzzdatqxh\",\"displayName\":\"dgeablgphu\",\"toBeExportedForShoebox\":true},{\"name\":\"dvkaozw\",\"displayName\":\"ftyhxhurokf\",\"toBeExportedForShoebox\":true}]},{\"name\":\"lniwpwcukjfkgiaw\",\"displayName\":\"lryplwckbasyy\",\"displayDescription\":\"ddhsgcbacphe\",\"unit\":\"ot\",\"aggregationType\":\"qgoulznd\",\"enableRegionalMdmAccount\":\"kwy\",\"sourceMdmAccount\":\"gfgibm\",\"sourceMdmNamespace\":\"gakeqsr\",\"availabilities\":[{\"timeGrain\":\"qqedqytbciqfou\",\"blobDuration\":\"mmnkzsmodmgl\"},{\"timeGrain\":\"gpbkwtmut\",\"blobDuration\":\"qktapspwgcuert\"},{\"timeGrain\":\"kdosvqw\",\"blobDuration\":\"mdgbbjfdd\"},{\"timeGrain\":\"bmbexppbhtqqro\",\"blobDuration\":\"p\"}],\"dimensions\":[{\"name\":\"lgbquxig\",\"displayName\":\"jgzjaoyfhrtx\",\"toBeExportedForShoebox\":false}]}]}}") + .toObject(OperationProperties.class); + Assertions.assertEquals("atscmd", model.serviceSpecification().logSpecifications().get(0).name()); + Assertions.assertEquals("jhulsuuvmkjo", model.serviceSpecification().logSpecifications().get(0).displayName()); + Assertions.assertEquals("rwfndiod", model.serviceSpecification().logSpecifications().get(0).blobDuration()); + Assertions.assertEquals("hbcryffdfdosyge", model.serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals("aojakhmsbzjhcrz", model.serviceSpecification().metricSpecifications().get(0).displayName()); + Assertions + .assertEquals("dphlxaolt", model.serviceSpecification().metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("trg", model.serviceSpecification().metricSpecifications().get(0).unit()); + Assertions.assertEquals("bpf", model.serviceSpecification().metricSpecifications().get(0).aggregationType()); + Assertions + .assertEquals("s", model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount()); + Assertions + .assertEquals("zgvfcjrwz", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount()); + Assertions + .assertEquals( + "xjtfelluwfzit", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace()); + Assertions + .assertEquals( + "qfpjk", + model.serviceSpecification().metricSpecifications().get(0).availabilities().get(0).timeGrain()); + Assertions + .assertEquals( + "xofpdvhpfxxypi", + model.serviceSpecification().metricSpecifications().get(0).availabilities().get(0).blobDuration()); + Assertions + .assertEquals( + "ciqihnhung", model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).name()); + Assertions + .assertEquals( + "jzrnf", model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).displayName()); + Assertions + .assertEquals( + true, + model + .serviceSpecification() + .metricSpecifications() + .get(0) + .dimensions() + .get(0) + .toBeExportedForShoebox()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationProperties model = + new OperationProperties() + .withServiceSpecification( + new OperationServiceSpecification() + .withLogSpecifications( + Arrays + .asList( + new OperationLogSpecification() + .withName("atscmd") + .withDisplayName("jhulsuuvmkjo") + .withBlobDuration("rwfndiod"), + new OperationLogSpecification() + .withName("slwejdpvw") + .withDisplayName("oqpsoa") + .withBlobDuration("tazak"))) + .withMetricSpecifications( + Arrays + .asList( + new OperationMetricSpecification() + .withName("hbcryffdfdosyge") + .withDisplayName("aojakhmsbzjhcrz") + .withDisplayDescription("dphlxaolt") + .withUnit("trg") + .withAggregationType("bpf") + .withEnableRegionalMdmAccount("s") + .withSourceMdmAccount("zgvfcjrwz") + .withSourceMdmNamespace("xjtfelluwfzit") + .withAvailabilities( + Arrays + .asList( + new OperationMetricAvailability() + .withTimeGrain("qfpjk") + .withBlobDuration("xofpdvhpfxxypi"), + new OperationMetricAvailability() + .withTimeGrain("nmayhuybb") + .withBlobDuration("odepoogin"), + new OperationMetricAvailability() + .withTimeGrain("amiheognarxz") + .withBlobDuration("heotusiv"))) + .withDimensions( + Arrays + .asList( + new OperationMetricDimension() + .withName("ciqihnhung") + .withDisplayName("jzrnf") + .withToBeExportedForShoebox(true))), + new OperationMetricSpecification() + .withName("ispe") + .withDisplayName("tzfkufubl") + .withDisplayDescription("fxqeof") + .withUnit("e") + .withAggregationType("hqjbasvmsmj") + .withEnableRegionalMdmAccount("lngsntnbybkzgcwr") + .withSourceMdmAccount("lxxwrljdouskc") + .withSourceMdmNamespace("kocrcjdkwtnhx") + .withAvailabilities( + Arrays + .asList( + new OperationMetricAvailability() + .withTimeGrain("iksqr") + .withBlobDuration("ssainqpjwnzll"), + new OperationMetricAvailability() + .withTimeGrain("mppeebvmgxs") + .withBlobDuration("kyqduujit"), + new OperationMetricAvailability() + .withTimeGrain("czdzev") + .withBlobDuration("hkr"), + new OperationMetricAvailability() + .withTimeGrain("d") + .withBlobDuration("p"))) + .withDimensions( + Arrays + .asList( + new OperationMetricDimension() + .withName("kvwrwjfeu") + .withDisplayName("hutje") + .withToBeExportedForShoebox(false), + new OperationMetricDimension() + .withName("ldhugjzzdatqxh") + .withDisplayName("dgeablgphu") + .withToBeExportedForShoebox(true), + new OperationMetricDimension() + .withName("dvkaozw") + .withDisplayName("ftyhxhurokf") + .withToBeExportedForShoebox(true))), + new OperationMetricSpecification() + .withName("lniwpwcukjfkgiaw") + .withDisplayName("lryplwckbasyy") + .withDisplayDescription("ddhsgcbacphe") + .withUnit("ot") + .withAggregationType("qgoulznd") + .withEnableRegionalMdmAccount("kwy") + .withSourceMdmAccount("gfgibm") + .withSourceMdmNamespace("gakeqsr") + .withAvailabilities( + Arrays + .asList( + new OperationMetricAvailability() + .withTimeGrain("qqedqytbciqfou") + .withBlobDuration("mmnkzsmodmgl"), + new OperationMetricAvailability() + .withTimeGrain("gpbkwtmut") + .withBlobDuration("qktapspwgcuert"), + new OperationMetricAvailability() + .withTimeGrain("kdosvqw") + .withBlobDuration("mdgbbjfdd"), + new OperationMetricAvailability() + .withTimeGrain("bmbexppbhtqqro") + .withBlobDuration("p"))) + .withDimensions( + Arrays + .asList( + new OperationMetricDimension() + .withName("lgbquxig") + .withDisplayName("jgzjaoyfhrtx") + .withToBeExportedForShoebox(false)))))); + model = BinaryData.fromObject(model).toObject(OperationProperties.class); + Assertions.assertEquals("atscmd", model.serviceSpecification().logSpecifications().get(0).name()); + Assertions.assertEquals("jhulsuuvmkjo", model.serviceSpecification().logSpecifications().get(0).displayName()); + Assertions.assertEquals("rwfndiod", model.serviceSpecification().logSpecifications().get(0).blobDuration()); + Assertions.assertEquals("hbcryffdfdosyge", model.serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals("aojakhmsbzjhcrz", model.serviceSpecification().metricSpecifications().get(0).displayName()); + Assertions + .assertEquals("dphlxaolt", model.serviceSpecification().metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("trg", model.serviceSpecification().metricSpecifications().get(0).unit()); + Assertions.assertEquals("bpf", model.serviceSpecification().metricSpecifications().get(0).aggregationType()); + Assertions + .assertEquals("s", model.serviceSpecification().metricSpecifications().get(0).enableRegionalMdmAccount()); + Assertions + .assertEquals("zgvfcjrwz", model.serviceSpecification().metricSpecifications().get(0).sourceMdmAccount()); + Assertions + .assertEquals( + "xjtfelluwfzit", model.serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace()); + Assertions + .assertEquals( + "qfpjk", + model.serviceSpecification().metricSpecifications().get(0).availabilities().get(0).timeGrain()); + Assertions + .assertEquals( + "xofpdvhpfxxypi", + model.serviceSpecification().metricSpecifications().get(0).availabilities().get(0).blobDuration()); + Assertions + .assertEquals( + "ciqihnhung", model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).name()); + Assertions + .assertEquals( + "jzrnf", model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).displayName()); + Assertions + .assertEquals( + true, + model + .serviceSpecification() + .metricSpecifications() + .get(0) + .dimensions() + .get(0) + .toBeExportedForShoebox()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationServiceSpecificationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationServiceSpecificationTests.java new file mode 100644 index 000000000000..5a61e5cc7090 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationServiceSpecificationTests.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OperationLogSpecification; +import com.azure.resourcemanager.datafactory.models.OperationMetricAvailability; +import com.azure.resourcemanager.datafactory.models.OperationMetricDimension; +import com.azure.resourcemanager.datafactory.models.OperationMetricSpecification; +import com.azure.resourcemanager.datafactory.models.OperationServiceSpecification; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OperationServiceSpecificationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationServiceSpecification model = + BinaryData + .fromString( + "{\"logSpecifications\":[{\"name\":\"ujysvle\",\"displayName\":\"vfqawrlyxwjkcpr\",\"blobDuration\":\"wbxgjvt\"},{\"name\":\"p\",\"displayName\":\"szdnr\",\"blobDuration\":\"qguhmuo\"}],\"metricSpecifications\":[{\"name\":\"rwzwbng\",\"displayName\":\"tnwu\",\"displayDescription\":\"gazxuf\",\"unit\":\"uckyf\",\"aggregationType\":\"rfidfvzwdz\",\"enableRegionalMdmAccount\":\"tymw\",\"sourceMdmAccount\":\"dkfthwxmnt\",\"sourceMdmNamespace\":\"waopvkmijcmmxd\",\"availabilities\":[{\"timeGrain\":\"fsrpymzidnse\",\"blobDuration\":\"xtbzsgfyccsne\"},{\"timeGrain\":\"dwzjeiach\",\"blobDuration\":\"osfln\"},{\"timeGrain\":\"sfqpteehz\",\"blobDuration\":\"ypyqrimzinp\"}],\"dimensions\":[{\"name\":\"dkirsoodqxhcr\",\"displayName\":\"ohjtckw\",\"toBeExportedForShoebox\":true}]}]}") + .toObject(OperationServiceSpecification.class); + Assertions.assertEquals("ujysvle", model.logSpecifications().get(0).name()); + Assertions.assertEquals("vfqawrlyxwjkcpr", model.logSpecifications().get(0).displayName()); + Assertions.assertEquals("wbxgjvt", model.logSpecifications().get(0).blobDuration()); + Assertions.assertEquals("rwzwbng", model.metricSpecifications().get(0).name()); + Assertions.assertEquals("tnwu", model.metricSpecifications().get(0).displayName()); + Assertions.assertEquals("gazxuf", model.metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("uckyf", model.metricSpecifications().get(0).unit()); + Assertions.assertEquals("rfidfvzwdz", model.metricSpecifications().get(0).aggregationType()); + Assertions.assertEquals("tymw", model.metricSpecifications().get(0).enableRegionalMdmAccount()); + Assertions.assertEquals("dkfthwxmnt", model.metricSpecifications().get(0).sourceMdmAccount()); + Assertions.assertEquals("waopvkmijcmmxd", model.metricSpecifications().get(0).sourceMdmNamespace()); + Assertions + .assertEquals("fsrpymzidnse", model.metricSpecifications().get(0).availabilities().get(0).timeGrain()); + Assertions + .assertEquals("xtbzsgfyccsne", model.metricSpecifications().get(0).availabilities().get(0).blobDuration()); + Assertions.assertEquals("dkirsoodqxhcr", model.metricSpecifications().get(0).dimensions().get(0).name()); + Assertions.assertEquals("ohjtckw", model.metricSpecifications().get(0).dimensions().get(0).displayName()); + Assertions.assertEquals(true, model.metricSpecifications().get(0).dimensions().get(0).toBeExportedForShoebox()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationServiceSpecification model = + new OperationServiceSpecification() + .withLogSpecifications( + Arrays + .asList( + new OperationLogSpecification() + .withName("ujysvle") + .withDisplayName("vfqawrlyxwjkcpr") + .withBlobDuration("wbxgjvt"), + new OperationLogSpecification() + .withName("p") + .withDisplayName("szdnr") + .withBlobDuration("qguhmuo"))) + .withMetricSpecifications( + Arrays + .asList( + new OperationMetricSpecification() + .withName("rwzwbng") + .withDisplayName("tnwu") + .withDisplayDescription("gazxuf") + .withUnit("uckyf") + .withAggregationType("rfidfvzwdz") + .withEnableRegionalMdmAccount("tymw") + .withSourceMdmAccount("dkfthwxmnt") + .withSourceMdmNamespace("waopvkmijcmmxd") + .withAvailabilities( + Arrays + .asList( + new OperationMetricAvailability() + .withTimeGrain("fsrpymzidnse") + .withBlobDuration("xtbzsgfyccsne"), + new OperationMetricAvailability() + .withTimeGrain("dwzjeiach") + .withBlobDuration("osfln"), + new OperationMetricAvailability() + .withTimeGrain("sfqpteehz") + .withBlobDuration("ypyqrimzinp"))) + .withDimensions( + Arrays + .asList( + new OperationMetricDimension() + .withName("dkirsoodqxhcr") + .withDisplayName("ohjtckw") + .withToBeExportedForShoebox(true))))); + model = BinaryData.fromObject(model).toObject(OperationServiceSpecification.class); + Assertions.assertEquals("ujysvle", model.logSpecifications().get(0).name()); + Assertions.assertEquals("vfqawrlyxwjkcpr", model.logSpecifications().get(0).displayName()); + Assertions.assertEquals("wbxgjvt", model.logSpecifications().get(0).blobDuration()); + Assertions.assertEquals("rwzwbng", model.metricSpecifications().get(0).name()); + Assertions.assertEquals("tnwu", model.metricSpecifications().get(0).displayName()); + Assertions.assertEquals("gazxuf", model.metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("uckyf", model.metricSpecifications().get(0).unit()); + Assertions.assertEquals("rfidfvzwdz", model.metricSpecifications().get(0).aggregationType()); + Assertions.assertEquals("tymw", model.metricSpecifications().get(0).enableRegionalMdmAccount()); + Assertions.assertEquals("dkfthwxmnt", model.metricSpecifications().get(0).sourceMdmAccount()); + Assertions.assertEquals("waopvkmijcmmxd", model.metricSpecifications().get(0).sourceMdmNamespace()); + Assertions + .assertEquals("fsrpymzidnse", model.metricSpecifications().get(0).availabilities().get(0).timeGrain()); + Assertions + .assertEquals("xtbzsgfyccsne", model.metricSpecifications().get(0).availabilities().get(0).blobDuration()); + Assertions.assertEquals("dkirsoodqxhcr", model.metricSpecifications().get(0).dimensions().get(0).name()); + Assertions.assertEquals("ohjtckw", model.metricSpecifications().get(0).dimensions().get(0).displayName()); + Assertions.assertEquals(true, model.metricSpecifications().get(0).dimensions().get(0).toBeExportedForShoebox()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationsListMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..713c873aa9fb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OperationsListMockTests.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.Operation; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"name\":\"mjlkknw\",\"origin\":\"avmrnrhsvkj\",\"display\":{\"description\":\"rmiivk\",\"provider\":\"cqynvfekjvclbkk\",\"resource\":\"frbdlsjftqahfvpm\",\"operation\":\"mu\"},\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[{\"name\":\"wkyhn\",\"displayName\":\"tknpb\",\"blobDuration\":\"tkwstumjtg\"}],\"metricSpecifications\":[{\"name\":\"psnldjjg\",\"displayName\":\"bbon\",\"displayDescription\":\"m\",\"unit\":\"seykprgpqnesu\",\"aggregationType\":\"smtgzadpwhldx\",\"enableRegionalMdmAccount\":\"rytthzsgmugzssgz\",\"sourceMdmAccount\":\"vvqetvc\",\"sourceMdmNamespace\":\"bz\",\"availabilities\":[{},{}],\"dimensions\":[{}]},{\"name\":\"tmabrhiaomld\",\"displayName\":\"qoajpxtkraf\",\"displayDescription\":\"iquir\",\"unit\":\"qusdznnhhjdfy\",\"aggregationType\":\"iupdmbhaumpw\",\"enableRegionalMdmAccount\":\"ero\",\"sourceMdmAccount\":\"nvjouzjkjxbraqz\",\"sourceMdmNamespace\":\"vogfmpdlm\",\"availabilities\":[{},{},{},{}],\"dimensions\":[{},{},{},{}]}]}}}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("mjlkknw", response.iterator().next().name()); + Assertions.assertEquals("avmrnrhsvkj", response.iterator().next().origin()); + Assertions.assertEquals("rmiivk", response.iterator().next().display().description()); + Assertions.assertEquals("cqynvfekjvclbkk", response.iterator().next().display().provider()); + Assertions.assertEquals("frbdlsjftqahfvpm", response.iterator().next().display().resource()); + Assertions.assertEquals("mu", response.iterator().next().display().operation()); + Assertions + .assertEquals("wkyhn", response.iterator().next().serviceSpecification().logSpecifications().get(0).name()); + Assertions + .assertEquals( + "tknpb", response.iterator().next().serviceSpecification().logSpecifications().get(0).displayName()); + Assertions + .assertEquals( + "tkwstumjtg", + response.iterator().next().serviceSpecification().logSpecifications().get(0).blobDuration()); + Assertions + .assertEquals( + "psnldjjg", response.iterator().next().serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals( + "bbon", response.iterator().next().serviceSpecification().metricSpecifications().get(0).displayName()); + Assertions + .assertEquals( + "m", + response.iterator().next().serviceSpecification().metricSpecifications().get(0).displayDescription()); + Assertions + .assertEquals( + "seykprgpqnesu", + response.iterator().next().serviceSpecification().metricSpecifications().get(0).unit()); + Assertions + .assertEquals( + "smtgzadpwhldx", + response.iterator().next().serviceSpecification().metricSpecifications().get(0).aggregationType()); + Assertions + .assertEquals( + "rytthzsgmugzssgz", + response + .iterator() + .next() + .serviceSpecification() + .metricSpecifications() + .get(0) + .enableRegionalMdmAccount()); + Assertions + .assertEquals( + "vvqetvc", + response.iterator().next().serviceSpecification().metricSpecifications().get(0).sourceMdmAccount()); + Assertions + .assertEquals( + "bz", + response.iterator().next().serviceSpecification().metricSpecifications().get(0).sourceMdmNamespace()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleCloudStorageLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleCloudStorageLocationTests.java new file mode 100644 index 000000000000..5b070eae13c8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleCloudStorageLocationTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OracleCloudStorageLocation; + +public final class OracleCloudStorageLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OracleCloudStorageLocation model = + BinaryData + .fromString( + "{\"type\":\"OracleCloudStorageLocation\",\"bucketName\":\"datamdofgeoagfuoft\",\"version\":\"dataodwxmdajwiygmgs\",\"folderPath\":\"datamdmze\",\"fileName\":\"datarstgfczljdnc\",\"\":{\"cvucgytoxu\":\"datajvamyyznmrgcdo\"}}") + .toObject(OracleCloudStorageLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OracleCloudStorageLocation model = + new OracleCloudStorageLocation() + .withFolderPath("datamdmze") + .withFileName("datarstgfczljdnc") + .withBucketName("datamdofgeoagfuoft") + .withVersion("dataodwxmdajwiygmgs"); + model = BinaryData.fromObject(model).toObject(OracleCloudStorageLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleCloudStorageReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleCloudStorageReadSettingsTests.java new file mode 100644 index 000000000000..aa99b3f21c24 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleCloudStorageReadSettingsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OracleCloudStorageReadSettings; + +public final class OracleCloudStorageReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OracleCloudStorageReadSettings model = + BinaryData + .fromString( + "{\"type\":\"OracleCloudStorageReadSettings\",\"recursive\":\"datauazoblxxks\",\"wildcardFolderPath\":\"datatiz\",\"wildcardFileName\":\"datavihg\",\"prefix\":\"datadolodfodokh\",\"fileListPath\":\"datag\",\"enablePartitionDiscovery\":\"datadhlnar\",\"partitionRootPath\":\"datauoa\",\"deleteFilesAfterCompletion\":\"datairiccuyqtjvrz\",\"modifiedDatetimeStart\":\"datagmgfa\",\"modifiedDatetimeEnd\":\"datab\",\"maxConcurrentConnections\":\"dataaenvpzd\",\"disableMetricsCollection\":\"datapizgaujvc\",\"\":{\"trkdno\":\"dataybxorrceomsqar\"}}") + .toObject(OracleCloudStorageReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OracleCloudStorageReadSettings model = + new OracleCloudStorageReadSettings() + .withMaxConcurrentConnections("dataaenvpzd") + .withDisableMetricsCollection("datapizgaujvc") + .withRecursive("datauazoblxxks") + .withWildcardFolderPath("datatiz") + .withWildcardFileName("datavihg") + .withPrefix("datadolodfodokh") + .withFileListPath("datag") + .withEnablePartitionDiscovery("datadhlnar") + .withPartitionRootPath("datauoa") + .withDeleteFilesAfterCompletion("datairiccuyqtjvrz") + .withModifiedDatetimeStart("datagmgfa") + .withModifiedDatetimeEnd("datab"); + model = BinaryData.fromObject(model).toObject(OracleCloudStorageReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OraclePartitionSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OraclePartitionSettingsTests.java new file mode 100644 index 000000000000..209d5404890e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OraclePartitionSettingsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OraclePartitionSettings; + +public final class OraclePartitionSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OraclePartitionSettings model = + BinaryData + .fromString( + "{\"partitionNames\":\"datarjooepfb\",\"partitionColumnName\":\"databffxansgntjmnl\",\"partitionUpperBound\":\"datalrjdkyp\",\"partitionLowerBound\":\"datavilgn\"}") + .toObject(OraclePartitionSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OraclePartitionSettings model = + new OraclePartitionSettings() + .withPartitionNames("datarjooepfb") + .withPartitionColumnName("databffxansgntjmnl") + .withPartitionUpperBound("datalrjdkyp") + .withPartitionLowerBound("datavilgn"); + model = BinaryData.fromObject(model).toObject(OraclePartitionSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleServiceCloudObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleServiceCloudObjectDatasetTests.java new file mode 100644 index 000000000000..1825a6ce133d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleServiceCloudObjectDatasetTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.OracleServiceCloudObjectDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class OracleServiceCloudObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OracleServiceCloudObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"OracleServiceCloudObject\",\"typeProperties\":{\"tableName\":\"datakkv\"},\"description\":\"aehjjirvjq\",\"structure\":\"datavqmdmrac\",\"schema\":\"dataffdralihhs\",\"linkedServiceName\":{\"referenceName\":\"cygyzhcv\",\"parameters\":{\"dxrmyzvti\":\"datayrjl\"}},\"parameters\":{\"xoyjyhutwedigiv\":{\"type\":\"Float\",\"defaultValue\":\"datarubx\"},\"mcaxbqpmfhji\":{\"type\":\"Array\",\"defaultValue\":\"dataccxfnatn\"},\"lzvrchmy\":{\"type\":\"Array\",\"defaultValue\":\"datanbdqitghnm\"},\"h\":{\"type\":\"String\",\"defaultValue\":\"datarmwy\"}},\"annotations\":[\"dataplgqqqgrbr\",\"datahvipgt\"],\"folder\":{\"name\":\"aoylwhfm\"},\"\":{\"gypjixdmobadydw\":\"dataea\",\"wdvclsx\":\"datae\",\"xr\":\"dataqdchnzib\"}}") + .toObject(OracleServiceCloudObjectDataset.class); + Assertions.assertEquals("aehjjirvjq", model.description()); + Assertions.assertEquals("cygyzhcv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("xoyjyhutwedigiv").type()); + Assertions.assertEquals("aoylwhfm", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OracleServiceCloudObjectDataset model = + new OracleServiceCloudObjectDataset() + .withDescription("aehjjirvjq") + .withStructure("datavqmdmrac") + .withSchema("dataffdralihhs") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("cygyzhcv") + .withParameters(mapOf("dxrmyzvti", "datayrjl"))) + .withParameters( + mapOf( + "xoyjyhutwedigiv", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datarubx"), + "mcaxbqpmfhji", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataccxfnatn"), + "lzvrchmy", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datanbdqitghnm"), + "h", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datarmwy"))) + .withAnnotations(Arrays.asList("dataplgqqqgrbr", "datahvipgt")) + .withFolder(new DatasetFolder().withName("aoylwhfm")) + .withTableName("datakkv"); + model = BinaryData.fromObject(model).toObject(OracleServiceCloudObjectDataset.class); + Assertions.assertEquals("aehjjirvjq", model.description()); + Assertions.assertEquals("cygyzhcv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("xoyjyhutwedigiv").type()); + Assertions.assertEquals("aoylwhfm", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleServiceCloudSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleServiceCloudSourceTests.java new file mode 100644 index 000000000000..235b81f2ffa8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleServiceCloudSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OracleServiceCloudSource; + +public final class OracleServiceCloudSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OracleServiceCloudSource model = + BinaryData + .fromString( + "{\"type\":\"OracleServiceCloudSource\",\"query\":\"datasdeequovanag\",\"queryTimeout\":\"dataacsfbmb\",\"additionalColumns\":\"dataefqku\",\"sourceRetryCount\":\"datayumoamqxwluslxyt\",\"sourceRetryWait\":\"databjledjxblobknfpd\",\"maxConcurrentConnections\":\"datahzgj\",\"disableMetricsCollection\":\"dataomctbgoccypxsrh\",\"\":{\"kzexhbpyo\":\"databnuflfzaw\",\"clboi\":\"datafbj\",\"ythxzrvjfsmfk\":\"datajpjnhwwyhx\"}}") + .toObject(OracleServiceCloudSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OracleServiceCloudSource model = + new OracleServiceCloudSource() + .withSourceRetryCount("datayumoamqxwluslxyt") + .withSourceRetryWait("databjledjxblobknfpd") + .withMaxConcurrentConnections("datahzgj") + .withDisableMetricsCollection("dataomctbgoccypxsrh") + .withQueryTimeout("dataacsfbmb") + .withAdditionalColumns("dataefqku") + .withQuery("datasdeequovanag"); + model = BinaryData.fromObject(model).toObject(OracleServiceCloudSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleSinkTests.java new file mode 100644 index 000000000000..7d40caca3c97 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleSinkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OracleSink; + +public final class OracleSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OracleSink model = + BinaryData + .fromString( + "{\"type\":\"OracleSink\",\"preCopyScript\":\"datawiawbwzyvbuifh\",\"writeBatchSize\":\"dataatoplqc\",\"writeBatchTimeout\":\"datasrlzwuqkprf\",\"sinkRetryCount\":\"datacowtoqfwbsbkob\",\"sinkRetryWait\":\"datassj\",\"maxConcurrentConnections\":\"datahfcxwrjbrxm\",\"disableMetricsCollection\":\"dataetttul\",\"\":{\"mosiskihf\":\"datajbhespf\"}}") + .toObject(OracleSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OracleSink model = + new OracleSink() + .withWriteBatchSize("dataatoplqc") + .withWriteBatchTimeout("datasrlzwuqkprf") + .withSinkRetryCount("datacowtoqfwbsbkob") + .withSinkRetryWait("datassj") + .withMaxConcurrentConnections("datahfcxwrjbrxm") + .withDisableMetricsCollection("dataetttul") + .withPreCopyScript("datawiawbwzyvbuifh"); + model = BinaryData.fromObject(model).toObject(OracleSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleSourceTests.java new file mode 100644 index 000000000000..d46019e73223 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleSourceTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OraclePartitionSettings; +import com.azure.resourcemanager.datafactory.models.OracleSource; + +public final class OracleSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OracleSource model = + BinaryData + .fromString( + "{\"type\":\"OracleSource\",\"oracleReaderQuery\":\"dataeyrnbubyabtowbu\",\"queryTimeout\":\"datalwbgvzuxfsmf\",\"partitionOption\":\"datazuoq\",\"partitionSettings\":{\"partitionNames\":\"datafv\",\"partitionColumnName\":\"datayl\",\"partitionUpperBound\":\"datajylhv\",\"partitionLowerBound\":\"datajzrqwjtswemotj\"},\"additionalColumns\":\"datajyavkyjvctq\",\"sourceRetryCount\":\"datacz\",\"sourceRetryWait\":\"datapaeyklxsvcbr\",\"maxConcurrentConnections\":\"datalt\",\"disableMetricsCollection\":\"datamdsngoaofmrph\",\"\":{\"exibo\":\"datafrunkcgdnha\"}}") + .toObject(OracleSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OracleSource model = + new OracleSource() + .withSourceRetryCount("datacz") + .withSourceRetryWait("datapaeyklxsvcbr") + .withMaxConcurrentConnections("datalt") + .withDisableMetricsCollection("datamdsngoaofmrph") + .withOracleReaderQuery("dataeyrnbubyabtowbu") + .withQueryTimeout("datalwbgvzuxfsmf") + .withPartitionOption("datazuoq") + .withPartitionSettings( + new OraclePartitionSettings() + .withPartitionNames("datafv") + .withPartitionColumnName("datayl") + .withPartitionUpperBound("datajylhv") + .withPartitionLowerBound("datajzrqwjtswemotj")) + .withAdditionalColumns("datajyavkyjvctq"); + model = BinaryData.fromObject(model).toObject(OracleSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleTableDatasetTests.java new file mode 100644 index 000000000000..df5c1f24ecf1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleTableDatasetTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.OracleTableDataset; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class OracleTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OracleTableDataset model = + BinaryData + .fromString( + "{\"type\":\"OracleTable\",\"typeProperties\":{\"tableName\":\"datanaphifkfrpmpl\",\"schema\":\"datap\",\"table\":\"datarmj\"},\"description\":\"fpghtbttpkim\",\"structure\":\"datahnkkhbykrs\",\"schema\":\"datarcmelycpgokut\",\"linkedServiceName\":{\"referenceName\":\"rvybnz\",\"parameters\":{\"ixlvzcgul\":\"datamshfuzzlap\",\"wjt\":\"dataebxiauqsuptessj\",\"skxgxqaygas\":\"datatpvb\",\"wpvlcjbvyezjwjkq\":\"datakvc\"}},\"parameters\":{\"fpucwn\":{\"type\":\"Bool\",\"defaultValue\":\"dataiieyozvrc\"}},\"annotations\":[\"dataqefgzjvbx\",\"datacbgoarxtuuciagv\",\"datadlhuduklbjo\",\"datafmjfexulv\"],\"folder\":{\"name\":\"kna\"},\"\":{\"leqfgkxenvszg\":\"dataiancsqoacbuqdgsa\",\"eszsuuv\":\"datavya\",\"brveci\":\"datalaqcwggchxvlqg\"}}") + .toObject(OracleTableDataset.class); + Assertions.assertEquals("fpghtbttpkim", model.description()); + Assertions.assertEquals("rvybnz", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("fpucwn").type()); + Assertions.assertEquals("kna", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OracleTableDataset model = + new OracleTableDataset() + .withDescription("fpghtbttpkim") + .withStructure("datahnkkhbykrs") + .withSchema("datarcmelycpgokut") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("rvybnz") + .withParameters( + mapOf( + "ixlvzcgul", + "datamshfuzzlap", + "wjt", + "dataebxiauqsuptessj", + "skxgxqaygas", + "datatpvb", + "wpvlcjbvyezjwjkq", + "datakvc"))) + .withParameters( + mapOf( + "fpucwn", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataiieyozvrc"))) + .withAnnotations( + Arrays.asList("dataqefgzjvbx", "datacbgoarxtuuciagv", "datadlhuduklbjo", "datafmjfexulv")) + .withFolder(new DatasetFolder().withName("kna")) + .withTableName("datanaphifkfrpmpl") + .withSchemaTypePropertiesSchema("datap") + .withTable("datarmj"); + model = BinaryData.fromObject(model).toObject(OracleTableDataset.class); + Assertions.assertEquals("fpghtbttpkim", model.description()); + Assertions.assertEquals("rvybnz", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("fpucwn").type()); + Assertions.assertEquals("kna", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..72ba25102d6d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OracleTableDatasetTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.OracleTableDatasetTypeProperties; + +public final class OracleTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OracleTableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"dataov\",\"schema\":\"datairlzbipiunn\",\"table\":\"datakwzzzkueruwc\"}") + .toObject(OracleTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OracleTableDatasetTypeProperties model = + new OracleTableDatasetTypeProperties() + .withTableName("dataov") + .withSchema("datairlzbipiunn") + .withTable("datakwzzzkueruwc"); + model = BinaryData.fromObject(model).toObject(OracleTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcFormatTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcFormatTests.java new file mode 100644 index 000000000000..2fadbf3cd39b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcFormatTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OrcFormat; + +public final class OrcFormatTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrcFormat model = + BinaryData + .fromString( + "{\"type\":\"OrcFormat\",\"serializer\":\"datalbsnosnqliw\",\"deserializer\":\"dataz\",\"\":{\"mknazgbjbhrpgiq\":\"dataetyalht\",\"aixpqj\":\"datattcucrcm\"}}") + .toObject(OrcFormat.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrcFormat model = new OrcFormat().withSerializer("datalbsnosnqliw").withDeserializer("dataz"); + model = BinaryData.fromObject(model).toObject(OrcFormat.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcSinkTests.java new file mode 100644 index 000000000000..349df8f06306 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcSinkTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OrcSink; +import com.azure.resourcemanager.datafactory.models.OrcWriteSettings; +import com.azure.resourcemanager.datafactory.models.StoreWriteSettings; +import java.util.HashMap; +import java.util.Map; + +public final class OrcSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrcSink model = + BinaryData + .fromString( + "{\"type\":\"OrcSink\",\"storeSettings\":{\"type\":\"StoreWriteSettings\",\"maxConcurrentConnections\":\"datagwv\",\"disableMetricsCollection\":\"datasqlyahlaoqkcit\",\"copyBehavior\":\"datauzvaxltrznwh\",\"\":{\"ddkkoyzsyjvk\":\"datasauvprqzpfpbxl\",\"hczqm\":\"dataldonsekazxewnlpc\",\"zzcbohbbavode\":\"dataxmyfrmfclkyncjya\",\"bvhxnjorvpc\":\"dataduabqbverbjcts\"}},\"formatSettings\":{\"type\":\"OrcWriteSettings\",\"maxRowsPerFile\":\"datalppuknnmnp\",\"fileNamePrefix\":\"datanm\",\"\":{\"efivozrdzrik\":\"datadh\",\"gozoelamerpbctrw\":\"dataiucvvrkxpb\",\"ywq\":\"datavnscmacb\"}},\"writeBatchSize\":\"dataztlf\",\"writeBatchTimeout\":\"datalgxrsn\",\"sinkRetryCount\":\"datarooaahhvsf\",\"sinkRetryWait\":\"datawkinkhvtxngme\",\"maxConcurrentConnections\":\"dataninjhdkvkqjjouh\",\"disableMetricsCollection\":\"datakcttpcctvcjdrmkn\",\"\":{\"zbmyftzbxfgo\":\"datavcrj\",\"egursbzmixwaxtn\":\"datarbullqnfz\",\"gsuqmrkyaovcbds\":\"datavtzdvxsgdaajl\",\"j\":\"dataxhpqlxnb\"}}") + .toObject(OrcSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrcSink model = + new OrcSink() + .withWriteBatchSize("dataztlf") + .withWriteBatchTimeout("datalgxrsn") + .withSinkRetryCount("datarooaahhvsf") + .withSinkRetryWait("datawkinkhvtxngme") + .withMaxConcurrentConnections("dataninjhdkvkqjjouh") + .withDisableMetricsCollection("datakcttpcctvcjdrmkn") + .withStoreSettings( + new StoreWriteSettings() + .withMaxConcurrentConnections("datagwv") + .withDisableMetricsCollection("datasqlyahlaoqkcit") + .withCopyBehavior("datauzvaxltrznwh") + .withAdditionalProperties(mapOf("type", "StoreWriteSettings"))) + .withFormatSettings( + new OrcWriteSettings().withMaxRowsPerFile("datalppuknnmnp").withFileNamePrefix("datanm")); + model = BinaryData.fromObject(model).toObject(OrcSink.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcSourceTests.java new file mode 100644 index 000000000000..0e4da0a09e55 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcSourceTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OrcSource; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class OrcSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrcSource model = + BinaryData + .fromString( + "{\"type\":\"OrcSource\",\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datareiwdskie\",\"disableMetricsCollection\":\"dataaenalepta\",\"\":{\"aodbhgxbadbo\":\"dataol\"}},\"additionalColumns\":\"datakmihggv\",\"sourceRetryCount\":\"dataqwyxbatr\",\"sourceRetryWait\":\"dataynlslgxif\",\"maxConcurrentConnections\":\"datasclqwk\",\"disableMetricsCollection\":\"datage\",\"\":{\"ueq\":\"dataambzfxgshaq\"}}") + .toObject(OrcSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrcSource model = + new OrcSource() + .withSourceRetryCount("dataqwyxbatr") + .withSourceRetryWait("dataynlslgxif") + .withMaxConcurrentConnections("datasclqwk") + .withDisableMetricsCollection("datage") + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datareiwdskie") + .withDisableMetricsCollection("dataaenalepta") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withAdditionalColumns("datakmihggv"); + model = BinaryData.fromObject(model).toObject(OrcSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcWriteSettingsTests.java new file mode 100644 index 000000000000..a388319bd1ec --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/OrcWriteSettingsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.OrcWriteSettings; + +public final class OrcWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrcWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"OrcWriteSettings\",\"maxRowsPerFile\":\"datamkakgwl\",\"fileNamePrefix\":\"datano\",\"\":{\"oxe\":\"datagyheyayktutflhe\",\"jqzmqjhghih\":\"datasahmdcoeexwgzs\"}}") + .toObject(OrcWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrcWriteSettings model = new OrcWriteSettings().withMaxRowsPerFile("datamkakgwl").withFileNamePrefix("datano"); + model = BinaryData.fromObject(model).toObject(OrcWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PackageStoreTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PackageStoreTests.java new file mode 100644 index 000000000000..288c6ced198f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PackageStoreTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.EntityReference; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeEntityReferenceType; +import com.azure.resourcemanager.datafactory.models.PackageStore; +import org.junit.jupiter.api.Assertions; + +public final class PackageStoreTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PackageStore model = + BinaryData + .fromString( + "{\"name\":\"ubru\",\"packageStoreLinkedService\":{\"type\":\"IntegrationRuntimeReference\",\"referenceName\":\"uoyrbdkgqdm\"}}") + .toObject(PackageStore.class); + Assertions.assertEquals("ubru", model.name()); + Assertions + .assertEquals( + IntegrationRuntimeEntityReferenceType.INTEGRATION_RUNTIME_REFERENCE, + model.packageStoreLinkedService().type()); + Assertions.assertEquals("uoyrbdkgqdm", model.packageStoreLinkedService().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PackageStore model = + new PackageStore() + .withName("ubru") + .withPackageStoreLinkedService( + new EntityReference() + .withType(IntegrationRuntimeEntityReferenceType.INTEGRATION_RUNTIME_REFERENCE) + .withReferenceName("uoyrbdkgqdm")); + model = BinaryData.fromObject(model).toObject(PackageStore.class); + Assertions.assertEquals("ubru", model.name()); + Assertions + .assertEquals( + IntegrationRuntimeEntityReferenceType.INTEGRATION_RUNTIME_REFERENCE, + model.packageStoreLinkedService().type()); + Assertions.assertEquals("uoyrbdkgqdm", model.packageStoreLinkedService().referenceName()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParameterSpecificationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParameterSpecificationTests.java new file mode 100644 index 000000000000..9db9fa65845c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParameterSpecificationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import org.junit.jupiter.api.Assertions; + +public final class ParameterSpecificationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ParameterSpecification model = + BinaryData + .fromString("{\"type\":\"Int\",\"defaultValue\":\"datasmond\"}") + .toObject(ParameterSpecification.class); + Assertions.assertEquals(ParameterType.INT, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ParameterSpecification model = + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datasmond"); + model = BinaryData.fromObject(model).toObject(ParameterSpecification.class); + Assertions.assertEquals(ParameterType.INT, model.type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetFormatTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetFormatTests.java new file mode 100644 index 000000000000..14ef5a54aa54 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetFormatTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ParquetFormat; + +public final class ParquetFormatTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ParquetFormat model = + BinaryData + .fromString( + "{\"type\":\"ParquetFormat\",\"serializer\":\"dataifhb\",\"deserializer\":\"dataldtt\",\"\":{\"iqikvllr\":\"dataclnaihtg\",\"wrqkza\":\"datatpmglxkoikmtr\",\"paklw\":\"databun\"}}") + .toObject(ParquetFormat.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ParquetFormat model = new ParquetFormat().withSerializer("dataifhb").withDeserializer("dataldtt"); + model = BinaryData.fromObject(model).toObject(ParquetFormat.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetSinkTests.java new file mode 100644 index 000000000000..28acdd850a12 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetSinkTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ParquetSink; +import com.azure.resourcemanager.datafactory.models.ParquetWriteSettings; +import com.azure.resourcemanager.datafactory.models.StoreWriteSettings; +import java.util.HashMap; +import java.util.Map; + +public final class ParquetSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ParquetSink model = + BinaryData + .fromString( + "{\"type\":\"ParquetSink\",\"storeSettings\":{\"type\":\"StoreWriteSettings\",\"maxConcurrentConnections\":\"datakhgatynkih\",\"disableMetricsCollection\":\"dataixyb\",\"copyBehavior\":\"datawjzo\",\"\":{\"unvwvaolfg\":\"dataaenlzjxztgdu\",\"zht\":\"datatczzv\",\"chsrp\":\"dataeuiptud\",\"iokdrjdeyfnq\":\"datajkqfabjuaktshwup\"}},\"formatSettings\":{\"type\":\"ParquetWriteSettings\",\"maxRowsPerFile\":\"dataa\",\"fileNamePrefix\":\"datazpqctuplpkj\",\"\":{\"lu\":\"datanrnzl\",\"varfqverxelquqze\":\"dataoeftrbxomaa\"}},\"writeBatchSize\":\"datavjmllzykalbaum\",\"writeBatchTimeout\":\"datadwqiucpj\",\"sinkRetryCount\":\"datatbss\",\"sinkRetryWait\":\"datajw\",\"maxConcurrentConnections\":\"datal\",\"disableMetricsCollection\":\"dataftt\",\"\":{\"av\":\"datalvrofhhitjhh\",\"uahllmbllshkfdri\":\"datar\",\"r\":\"dataoopfrdfjjrhx\",\"evxbqyavcxjols\":\"datauoqpobwarsdxkwm\"}}") + .toObject(ParquetSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ParquetSink model = + new ParquetSink() + .withWriteBatchSize("datavjmllzykalbaum") + .withWriteBatchTimeout("datadwqiucpj") + .withSinkRetryCount("datatbss") + .withSinkRetryWait("datajw") + .withMaxConcurrentConnections("datal") + .withDisableMetricsCollection("dataftt") + .withStoreSettings( + new StoreWriteSettings() + .withMaxConcurrentConnections("datakhgatynkih") + .withDisableMetricsCollection("dataixyb") + .withCopyBehavior("datawjzo") + .withAdditionalProperties(mapOf("type", "StoreWriteSettings"))) + .withFormatSettings( + new ParquetWriteSettings().withMaxRowsPerFile("dataa").withFileNamePrefix("datazpqctuplpkj")); + model = BinaryData.fromObject(model).toObject(ParquetSink.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetSourceTests.java new file mode 100644 index 000000000000..a2c312a4dce0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetSourceTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ParquetSource; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class ParquetSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ParquetSource model = + BinaryData + .fromString( + "{\"type\":\"ParquetSource\",\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datayph\",\"disableMetricsCollection\":\"datarxrpahp\",\"\":{\"qllolnxhsupilhx\":\"datakfenmiflky\",\"y\":\"dataabli\",\"isydhardx\":\"dataomgse\"}},\"additionalColumns\":\"dataluqfffglf\",\"sourceRetryCount\":\"dataqakierxuvprbjxew\",\"sourceRetryWait\":\"datacuveljfarinu\",\"maxConcurrentConnections\":\"dataiztgddah\",\"disableMetricsCollection\":\"datavkkjtdhmigkwa\",\"\":{\"ylsijqygof\":\"datagie\",\"af\":\"datahdaehxvvifd\",\"uxs\":\"datakysym\",\"szrbttz\":\"datamllbpegcetezaap\"}}") + .toObject(ParquetSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ParquetSource model = + new ParquetSource() + .withSourceRetryCount("dataqakierxuvprbjxew") + .withSourceRetryWait("datacuveljfarinu") + .withMaxConcurrentConnections("dataiztgddah") + .withDisableMetricsCollection("datavkkjtdhmigkwa") + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datayph") + .withDisableMetricsCollection("datarxrpahp") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withAdditionalColumns("dataluqfffglf"); + model = BinaryData.fromObject(model).toObject(ParquetSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetWriteSettingsTests.java new file mode 100644 index 000000000000..30c35ebb53d3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ParquetWriteSettingsTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ParquetWriteSettings; + +public final class ParquetWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ParquetWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"ParquetWriteSettings\",\"maxRowsPerFile\":\"datajldwxdqt\",\"fileNamePrefix\":\"datatgn\",\"\":{\"dymlsuuhwuoxe\":\"datajvmdkgv\",\"izzjotmygzjr\":\"datai\",\"bjxxcruleim\":\"dataslqbaf\"}}") + .toObject(ParquetWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ParquetWriteSettings model = + new ParquetWriteSettings().withMaxRowsPerFile("datajldwxdqt").withFileNamePrefix("datatgn"); + model = BinaryData.fromObject(model).toObject(ParquetWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PaypalObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PaypalObjectDatasetTests.java new file mode 100644 index 000000000000..6ffcbd0efbf7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PaypalObjectDatasetTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PaypalObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PaypalObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PaypalObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"PaypalObject\",\"typeProperties\":{\"tableName\":\"datape\"},\"description\":\"j\",\"structure\":\"datasdjuzmuijtickzo\",\"schema\":\"datau\",\"linkedServiceName\":{\"referenceName\":\"p\",\"parameters\":{\"opq\":\"datahhboigzx\",\"atzw\":\"datarzhtocjzfppexu\",\"it\":\"datakjwg\"}},\"parameters\":{\"bjoypplodaqrbkpo\":{\"type\":\"Array\",\"defaultValue\":\"datambmswskb\"},\"crqaxlmbrtvtgolm\":{\"type\":\"SecureString\",\"defaultValue\":\"datasobggva\"},\"yxhxj\":{\"type\":\"Array\",\"defaultValue\":\"datagtla\"},\"bqnjcsbozvcdq\":{\"type\":\"SecureString\",\"defaultValue\":\"datasxaqqjhdfhfa\"}},\"annotations\":[\"dataydvwr\",\"databivyw\"],\"folder\":{\"name\":\"njuvtz\"},\"\":{\"tjfdzfmnpbdrc\":\"datadlxbaeyocpkv\",\"vdtuoamqobqeh\":\"databjxnnnoztn\",\"f\":\"datapshtisy\",\"zeb\":\"dataoctrzjwnzwc\"}}") + .toObject(PaypalObjectDataset.class); + Assertions.assertEquals("j", model.description()); + Assertions.assertEquals("p", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("bjoypplodaqrbkpo").type()); + Assertions.assertEquals("njuvtz", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PaypalObjectDataset model = + new PaypalObjectDataset() + .withDescription("j") + .withStructure("datasdjuzmuijtickzo") + .withSchema("datau") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("p") + .withParameters(mapOf("opq", "datahhboigzx", "atzw", "datarzhtocjzfppexu", "it", "datakjwg"))) + .withParameters( + mapOf( + "bjoypplodaqrbkpo", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datambmswskb"), + "crqaxlmbrtvtgolm", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datasobggva"), + "yxhxj", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datagtla"), + "bqnjcsbozvcdq", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datasxaqqjhdfhfa"))) + .withAnnotations(Arrays.asList("dataydvwr", "databivyw")) + .withFolder(new DatasetFolder().withName("njuvtz")) + .withTableName("datape"); + model = BinaryData.fromObject(model).toObject(PaypalObjectDataset.class); + Assertions.assertEquals("j", model.description()); + Assertions.assertEquals("p", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("bjoypplodaqrbkpo").type()); + Assertions.assertEquals("njuvtz", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PaypalSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PaypalSourceTests.java new file mode 100644 index 000000000000..bb5f9f279ed0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PaypalSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PaypalSource; + +public final class PaypalSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PaypalSource model = + BinaryData + .fromString( + "{\"type\":\"PaypalSource\",\"query\":\"datamm\",\"queryTimeout\":\"datatzxsvwqiwgjwrhu\",\"additionalColumns\":\"dataaaaxigafa\",\"sourceRetryCount\":\"datatoo\",\"sourceRetryWait\":\"datazdoblpdtcyv\",\"maxConcurrentConnections\":\"datahboplavgfbvro\",\"disableMetricsCollection\":\"datauexqweyslwlppoh\",\"\":{\"gb\":\"datagalexyiygkadtwd\",\"vxcjdobsgv\":\"dataxt\"}}") + .toObject(PaypalSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PaypalSource model = + new PaypalSource() + .withSourceRetryCount("datatoo") + .withSourceRetryWait("datazdoblpdtcyv") + .withMaxConcurrentConnections("datahboplavgfbvro") + .withDisableMetricsCollection("datauexqweyslwlppoh") + .withQueryTimeout("datatzxsvwqiwgjwrhu") + .withAdditionalColumns("dataaaaxigafa") + .withQuery("datamm"); + model = BinaryData.fromObject(model).toObject(PaypalSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PhoenixDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PhoenixDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..e009512183d0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PhoenixDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.PhoenixDatasetTypeProperties; + +public final class PhoenixDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PhoenixDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"datagvzlzjsbkpcu\",\"table\":\"dataaziydpoknse\",\"schema\":\"datambdqra\"}") + .toObject(PhoenixDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PhoenixDatasetTypeProperties model = + new PhoenixDatasetTypeProperties() + .withTableName("datagvzlzjsbkpcu") + .withTable("dataaziydpoknse") + .withSchema("datambdqra"); + model = BinaryData.fromObject(model).toObject(PhoenixDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PhoenixObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PhoenixObjectDatasetTests.java new file mode 100644 index 000000000000..9ccda1f508bc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PhoenixObjectDatasetTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PhoenixObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PhoenixObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PhoenixObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"PhoenixObject\",\"typeProperties\":{\"tableName\":\"datawdxgyypm\",\"table\":\"datazlmln\",\"schema\":\"datacatkuhs\"},\"description\":\"gdkvviilyeshoxf\",\"structure\":\"datajdmu\",\"schema\":\"datausx\",\"linkedServiceName\":{\"referenceName\":\"ugozwplxzgzumnot\",\"parameters\":{\"giq\":\"datakkbyg\",\"izonzsur\":\"datawyshybbnhtt\",\"asfzhzzcarc\":\"dataco\",\"nhwsgns\":\"datauoxyipdthjf\"}},\"parameters\":{\"fbbach\":{\"type\":\"Array\",\"defaultValue\":\"datalfchnufssjg\"},\"kbuxlepghcnuqhq\":{\"type\":\"Array\",\"defaultValue\":\"datazzunfnbphceei\"},\"fscl\":{\"type\":\"String\",\"defaultValue\":\"datawt\"}},\"annotations\":[\"datagygn\",\"databfytnhdnihuzzjuz\",\"datawgbzdtorbi\",\"datanyfzdpxct\"],\"folder\":{\"name\":\"rxdtej\"},\"\":{\"pjhltylyuud\":\"datazrlwtidcnzalgmp\"}}") + .toObject(PhoenixObjectDataset.class); + Assertions.assertEquals("gdkvviilyeshoxf", model.description()); + Assertions.assertEquals("ugozwplxzgzumnot", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("fbbach").type()); + Assertions.assertEquals("rxdtej", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PhoenixObjectDataset model = + new PhoenixObjectDataset() + .withDescription("gdkvviilyeshoxf") + .withStructure("datajdmu") + .withSchema("datausx") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ugozwplxzgzumnot") + .withParameters( + mapOf( + "giq", + "datakkbyg", + "izonzsur", + "datawyshybbnhtt", + "asfzhzzcarc", + "dataco", + "nhwsgns", + "datauoxyipdthjf"))) + .withParameters( + mapOf( + "fbbach", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datalfchnufssjg"), + "kbuxlepghcnuqhq", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datazzunfnbphceei"), + "fscl", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datawt"))) + .withAnnotations(Arrays.asList("datagygn", "databfytnhdnihuzzjuz", "datawgbzdtorbi", "datanyfzdpxct")) + .withFolder(new DatasetFolder().withName("rxdtej")) + .withTableName("datawdxgyypm") + .withTable("datazlmln") + .withSchemaTypePropertiesSchema("datacatkuhs"); + model = BinaryData.fromObject(model).toObject(PhoenixObjectDataset.class); + Assertions.assertEquals("gdkvviilyeshoxf", model.description()); + Assertions.assertEquals("ugozwplxzgzumnot", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("fbbach").type()); + Assertions.assertEquals("rxdtej", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PhoenixSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PhoenixSourceTests.java new file mode 100644 index 000000000000..be22eeebd4bc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PhoenixSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PhoenixSource; + +public final class PhoenixSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PhoenixSource model = + BinaryData + .fromString( + "{\"type\":\"PhoenixSource\",\"query\":\"datajkwltnsnhuvmok\",\"queryTimeout\":\"datasclpnbidnlodk\",\"additionalColumns\":\"dataqnkptixa\",\"sourceRetryCount\":\"datay\",\"sourceRetryWait\":\"dataaevry\",\"maxConcurrentConnections\":\"datagccpzmh\",\"disableMetricsCollection\":\"datalqtzgtpsbym\",\"\":{\"rqzbqy\":\"datat\",\"ahbynlbwcnnfp\":\"datagfqqrarolc\"}}") + .toObject(PhoenixSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PhoenixSource model = + new PhoenixSource() + .withSourceRetryCount("datay") + .withSourceRetryWait("dataaevry") + .withMaxConcurrentConnections("datagccpzmh") + .withDisableMetricsCollection("datalqtzgtpsbym") + .withQueryTimeout("datasclpnbidnlodk") + .withAdditionalColumns("dataqnkptixa") + .withQuery("datajkwltnsnhuvmok"); + model = BinaryData.fromObject(model).toObject(PhoenixSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineElapsedTimeMetricPolicyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineElapsedTimeMetricPolicyTests.java new file mode 100644 index 000000000000..4b4917dbfc18 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineElapsedTimeMetricPolicyTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PipelineElapsedTimeMetricPolicy; + +public final class PipelineElapsedTimeMetricPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PipelineElapsedTimeMetricPolicy model = + BinaryData + .fromString("{\"duration\":\"datahwagohbuffkmrqe\"}") + .toObject(PipelineElapsedTimeMetricPolicy.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PipelineElapsedTimeMetricPolicy model = + new PipelineElapsedTimeMetricPolicy().withDuration("datahwagohbuffkmrqe"); + model = BinaryData.fromObject(model).toObject(PipelineElapsedTimeMetricPolicy.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineExternalComputeScalePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineExternalComputeScalePropertiesTests.java new file mode 100644 index 000000000000..1c5d3d2925bd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineExternalComputeScalePropertiesTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PipelineExternalComputeScaleProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PipelineExternalComputeScalePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PipelineExternalComputeScaleProperties model = + BinaryData + .fromString( + "{\"timeToLive\":884089930,\"numberOfPipelineNodes\":1584028452,\"numberOfExternalNodes\":1614566160,\"\":{\"f\":\"datadnlbyi\"}}") + .toObject(PipelineExternalComputeScaleProperties.class); + Assertions.assertEquals(884089930, model.timeToLive()); + Assertions.assertEquals(1584028452, model.numberOfPipelineNodes()); + Assertions.assertEquals(1614566160, model.numberOfExternalNodes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PipelineExternalComputeScaleProperties model = + new PipelineExternalComputeScaleProperties() + .withTimeToLive(884089930) + .withNumberOfPipelineNodes(1584028452) + .withNumberOfExternalNodes(1614566160) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(PipelineExternalComputeScaleProperties.class); + Assertions.assertEquals(884089930, model.timeToLive()); + Assertions.assertEquals(1584028452, model.numberOfPipelineNodes()); + Assertions.assertEquals(1614566160, model.numberOfExternalNodes()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineFolderTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineFolderTests.java new file mode 100644 index 000000000000..9e9845015545 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineFolderTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PipelineFolder; +import org.junit.jupiter.api.Assertions; + +public final class PipelineFolderTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PipelineFolder model = BinaryData.fromString("{\"name\":\"rnntiewdjcv\"}").toObject(PipelineFolder.class); + Assertions.assertEquals("rnntiewdjcv", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PipelineFolder model = new PipelineFolder().withName("rnntiewdjcv"); + model = BinaryData.fromObject(model).toObject(PipelineFolder.class); + Assertions.assertEquals("rnntiewdjcv", model.name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineListResponseTests.java new file mode 100644 index 000000000000..d06b2942410e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineListResponseTests.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.PipelineResourceInner; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PipelineElapsedTimeMetricPolicy; +import com.azure.resourcemanager.datafactory.models.PipelineFolder; +import com.azure.resourcemanager.datafactory.models.PipelineListResponse; +import com.azure.resourcemanager.datafactory.models.PipelinePolicy; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import com.azure.resourcemanager.datafactory.models.VariableSpecification; +import com.azure.resourcemanager.datafactory.models.VariableType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PipelineListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PipelineListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"description\":\"xrbuukzclew\",\"activities\":[{\"type\":\"Activity\",\"name\":\"lw\",\"description\":\"ztzp\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"yfzqwhxxbu\",\"dependencyConditions\":[]},{\"activity\":\"qa\",\"dependencyConditions\":[]},{\"activity\":\"zfeqztppri\",\"dependencyConditions\":[]},{\"activity\":\"lxorjaltolmncws\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"wcsdbnwdcfhucq\",\"value\":\"datapfuvglsbjjca\"},{\"name\":\"vxb\",\"value\":\"datat\"},{\"name\":\"udutnco\",\"value\":\"datamr\"},{\"name\":\"xqtvcofu\",\"value\":\"dataf\"}],\"\":{\"bgdknnqv\":\"datagj\",\"sgsahmkycgr\":\"dataaznqntoru\",\"s\":\"datauwjuetaeburuvdmo\",\"tpuqujmq\":\"datazlxwabmqoefkifr\"}},{\"type\":\"Activity\",\"name\":\"gkfbtndoaong\",\"description\":\"cn\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"ed\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"waezkojvd\",\"value\":\"datapzfoqoui\"}],\"\":{\"p\":\"dataxarzgszufoxciq\",\"xkhnzbonlwnto\":\"datadoamciodhkha\",\"zcmrvexztvb\":\"datagokdwbwhks\",\"lmnguxaw\":\"dataqgsfraoyzkoow\"}}],\"parameters\":{\"bykutw\":{\"type\":\"Int\",\"defaultValue\":\"datayuuximerqfobwyzn\"},\"sd\":{\"type\":\"Float\",\"defaultValue\":\"datapagmhrskdsnf\"},\"zev\":{\"type\":\"String\",\"defaultValue\":\"datagtdlmk\"},\"ejdcngqqmoakuf\":{\"type\":\"String\",\"defaultValue\":\"dataewpusdsttwvogvb\"}},\"variables\":{\"grtwae\":{\"type\":\"Array\",\"defaultValue\":\"datawr\"},\"inrfdwoyu\":{\"type\":\"String\",\"defaultValue\":\"datazkopb\"},\"mzqhoftrmaequi\":{\"type\":\"Bool\",\"defaultValue\":\"dataiuiefozbhdmsm\"}},\"concurrency\":1964875083,\"annotations\":[\"dataslfaoqzpiyyl\",\"dataalnswhccsphk\",\"dataivwitqscywugg\",\"dataoluhczbwemh\"],\"runDimensions\":{\"wmsweypqwd\":\"datasbrgz\",\"mkttlstvlzywem\":\"dataggicccnxqhue\",\"lusiy\":\"datazrncsdt\"},\"folder\":{\"name\":\"fgytguslfeadcyg\"},\"policy\":{\"elapsedTimeMetric\":{\"duration\":\"datahejhzisx\"}}},\"name\":\"pelol\",\"type\":\"vk\",\"etag\":\"pqvujzraehtwdwrf\",\"\":{\"cdl\":\"dataiby\"},\"id\":\"shfwpracstwity\"}],\"nextLink\":\"evxccedcp\"}") + .toObject(PipelineListResponse.class); + Assertions.assertEquals("shfwpracstwity", model.value().get(0).id()); + Assertions.assertEquals("xrbuukzclew", model.value().get(0).description()); + Assertions.assertEquals("lw", model.value().get(0).activities().get(0).name()); + Assertions.assertEquals("ztzp", model.value().get(0).activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.value().get(0).activities().get(0).state()); + Assertions + .assertEquals( + ActivityOnInactiveMarkAs.SKIPPED, model.value().get(0).activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("yfzqwhxxbu", model.value().get(0).activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals("wcsdbnwdcfhucq", model.value().get(0).activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals(ParameterType.INT, model.value().get(0).parameters().get("bykutw").type()); + Assertions.assertEquals(VariableType.ARRAY, model.value().get(0).variables().get("grtwae").type()); + Assertions.assertEquals(1964875083, model.value().get(0).concurrency()); + Assertions.assertEquals("fgytguslfeadcyg", model.value().get(0).folder().name()); + Assertions.assertEquals("evxccedcp", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PipelineListResponse model = + new PipelineListResponse() + .withValue( + Arrays + .asList( + new PipelineResourceInner() + .withId("shfwpracstwity") + .withDescription("xrbuukzclew") + .withActivities( + Arrays + .asList( + new Activity() + .withName("lw") + .withDescription("ztzp") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("yfzqwhxxbu") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("qa") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("zfeqztppri") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("lxorjaltolmncws") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("wcsdbnwdcfhucq") + .withValue("datapfuvglsbjjca"), + new UserProperty().withName("vxb").withValue("datat"), + new UserProperty().withName("udutnco").withValue("datamr"), + new UserProperty().withName("xqtvcofu").withValue("dataf"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("gkfbtndoaong") + .withDescription("cn") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ed") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("waezkojvd") + .withValue("datapzfoqoui"))) + .withAdditionalProperties(mapOf("type", "Activity")))) + .withParameters( + mapOf( + "bykutw", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datayuuximerqfobwyzn"), + "sd", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datapagmhrskdsnf"), + "zev", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datagtdlmk"), + "ejdcngqqmoakuf", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("dataewpusdsttwvogvb"))) + .withVariables( + mapOf( + "grtwae", + new VariableSpecification() + .withType(VariableType.ARRAY) + .withDefaultValue("datawr"), + "inrfdwoyu", + new VariableSpecification() + .withType(VariableType.STRING) + .withDefaultValue("datazkopb"), + "mzqhoftrmaequi", + new VariableSpecification() + .withType(VariableType.BOOL) + .withDefaultValue("dataiuiefozbhdmsm"))) + .withConcurrency(1964875083) + .withAnnotations( + Arrays + .asList( + "dataslfaoqzpiyyl", + "dataalnswhccsphk", + "dataivwitqscywugg", + "dataoluhczbwemh")) + .withRunDimensions( + mapOf( + "wmsweypqwd", + "datasbrgz", + "mkttlstvlzywem", + "dataggicccnxqhue", + "lusiy", + "datazrncsdt")) + .withFolder(new PipelineFolder().withName("fgytguslfeadcyg")) + .withPolicy( + new PipelinePolicy() + .withElapsedTimeMetric( + new PipelineElapsedTimeMetricPolicy().withDuration("datahejhzisx"))) + .withAdditionalProperties( + mapOf("name", "pelol", "etag", "pqvujzraehtwdwrf", "type", "vk")))) + .withNextLink("evxccedcp"); + model = BinaryData.fromObject(model).toObject(PipelineListResponse.class); + Assertions.assertEquals("shfwpracstwity", model.value().get(0).id()); + Assertions.assertEquals("xrbuukzclew", model.value().get(0).description()); + Assertions.assertEquals("lw", model.value().get(0).activities().get(0).name()); + Assertions.assertEquals("ztzp", model.value().get(0).activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.value().get(0).activities().get(0).state()); + Assertions + .assertEquals( + ActivityOnInactiveMarkAs.SKIPPED, model.value().get(0).activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("yfzqwhxxbu", model.value().get(0).activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals("wcsdbnwdcfhucq", model.value().get(0).activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals(ParameterType.INT, model.value().get(0).parameters().get("bykutw").type()); + Assertions.assertEquals(VariableType.ARRAY, model.value().get(0).variables().get("grtwae").type()); + Assertions.assertEquals(1964875083, model.value().get(0).concurrency()); + Assertions.assertEquals("fgytguslfeadcyg", model.value().get(0).folder().name()); + Assertions.assertEquals("evxccedcp", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinePolicyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinePolicyTests.java new file mode 100644 index 000000000000..a96dff07663d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinePolicyTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PipelineElapsedTimeMetricPolicy; +import com.azure.resourcemanager.datafactory.models.PipelinePolicy; + +public final class PipelinePolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PipelinePolicy model = + BinaryData.fromString("{\"elapsedTimeMetric\":{\"duration\":\"datawr\"}}").toObject(PipelinePolicy.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PipelinePolicy model = + new PipelinePolicy().withElapsedTimeMetric(new PipelineElapsedTimeMetricPolicy().withDuration("datawr")); + model = BinaryData.fromObject(model).toObject(PipelinePolicy.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineReferenceTests.java new file mode 100644 index 000000000000..6b60fe18c12d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineReferenceTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import org.junit.jupiter.api.Assertions; + +public final class PipelineReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PipelineReference model = + BinaryData + .fromString("{\"referenceName\":\"pisqqzlgcndhzx\",\"name\":\"fcfsrhkhgsnx\"}") + .toObject(PipelineReference.class); + Assertions.assertEquals("pisqqzlgcndhzx", model.referenceName()); + Assertions.assertEquals("fcfsrhkhgsnx", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PipelineReference model = new PipelineReference().withReferenceName("pisqqzlgcndhzx").withName("fcfsrhkhgsnx"); + model = BinaryData.fromObject(model).toObject(PipelineReference.class); + Assertions.assertEquals("pisqqzlgcndhzx", model.referenceName()); + Assertions.assertEquals("fcfsrhkhgsnx", model.name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineResourceInnerTests.java new file mode 100644 index 000000000000..db10bda25eb6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineResourceInnerTests.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.PipelineResourceInner; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PipelineElapsedTimeMetricPolicy; +import com.azure.resourcemanager.datafactory.models.PipelineFolder; +import com.azure.resourcemanager.datafactory.models.PipelinePolicy; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import com.azure.resourcemanager.datafactory.models.VariableSpecification; +import com.azure.resourcemanager.datafactory.models.VariableType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PipelineResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PipelineResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"description\":\"dyodnwzxltj\",\"activities\":[{\"type\":\"Activity\",\"name\":\"hlt\",\"description\":\"gcxn\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"byqunyow\",\"dependencyConditions\":[\"Completed\",\"Completed\"],\"\":{\"acizsjqlhkrr\":\"datarkvfgbvfvpdbo\",\"hvxndzwmkrefajpj\":\"databdeibqipqk\",\"yhgbijtjivfx\":\"datarwkq\",\"stawfsdjpvkv\":\"datasjabibs\"}},{\"activity\":\"bjxbkzbzk\",\"dependencyConditions\":[\"Succeeded\",\"Completed\",\"Completed\"],\"\":{\"jjklff\":\"dataudurgkakmokz\",\"bizikayuhq\":\"datamouwqlgzrfzeey\",\"wrv\":\"databjbsybb\"}},{\"activity\":\"ldgmfpgvmpip\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\"],\"\":{\"dsrezpdrhneuyow\":\"dataqfxssmwutw\",\"t\":\"datakdw\"}},{\"activity\":\"sibircgpi\",\"dependencyConditions\":[\"Skipped\",\"Failed\",\"Skipped\",\"Failed\"],\"\":{\"nokixrjqcirgz\":\"dataanlfzxiavrmbz\"}}],\"userProperties\":[{\"name\":\"lazszrn\",\"value\":\"dataoiindfpwpjy\"},{\"name\":\"wbtlhflsjcdh\",\"value\":\"datazfjvfbgofe\"},{\"name\":\"jagrqmqhldvr\",\"value\":\"dataiiojnal\"}],\"\":{\"ueluqhhahhxvrhmz\":\"datakvtvsexso\"}},{\"type\":\"Activity\",\"name\":\"wpjgwws\",\"description\":\"ghftqsxhqxujxuk\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"jguufzdm\",\"dependencyConditions\":[\"Completed\",\"Succeeded\"],\"\":{\"phoszqz\":\"datahwhbotzingamv\",\"kfwynw\":\"datadphqamv\",\"tnvyqiatkzwp\":\"datavtbvkayh\",\"vvsccyajguq\":\"datanpwzcjaes\"}},{\"activity\":\"hwyg\",\"dependencyConditions\":[\"Skipped\",\"Failed\"],\"\":{\"uh\":\"datafxusemdwzr\"}},{\"activity\":\"pfcqdp\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Skipped\",\"Skipped\"],\"\":{\"qlmfeoker\":\"datauoymgccelvezry\"}},{\"activity\":\"wkyhkobopgxe\",\"dependencyConditions\":[\"Skipped\"],\"\":{\"vcdwxlpqekftn\":\"datapbqpcrfkbwccsn\",\"fq\":\"datahtjsying\",\"gszywk\":\"datatmtdhtmdvypgik\"}}],\"userProperties\":[{\"name\":\"ryuzh\",\"value\":\"datahkjoqr\"},{\"name\":\"qqaatjinrvgou\",\"value\":\"datamfiibfggj\"},{\"name\":\"ool\",\"value\":\"datarwxkvtkkgl\"}],\"\":{\"hvkzuh\":\"datajygvjayvbl\",\"gsopbyrqufegxu\":\"dataxvvy\",\"bnhlmc\":\"datawz\",\"dn\":\"datal\"}},{\"type\":\"Activity\",\"name\":\"itvgbmhrixkwm\",\"description\":\"jejveg\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"xexccbdreaxhcexd\",\"dependencyConditions\":[\"Skipped\",\"Completed\",\"Failed\",\"Succeeded\"],\"\":{\"jnhyjsvf\":\"dataghtpw\",\"mtg\":\"datacxzbfvoowvr\",\"y\":\"dataqp\"}},{\"activity\":\"s\",\"dependencyConditions\":[\"Succeeded\",\"Succeeded\",\"Succeeded\"],\"\":{\"ekrrjr\":\"datahgfipnsxkmcw\",\"jglikkxwslolb\":\"dataafxtsgum\",\"elfk\":\"datapvuzlmv\"}}],\"userProperties\":[{\"name\":\"lcrpw\",\"value\":\"dataxeznoi\"},{\"name\":\"brnjwmw\",\"value\":\"datapn\"},{\"name\":\"saz\",\"value\":\"datajjoqkagf\"},{\"name\":\"sxtta\",\"value\":\"datagzxnfaazpxdtnk\"}],\"\":{\"rkpyouaibrebqaay\":\"dataqjjlwuen\",\"ixqtn\":\"dataj\",\"ffiakp\":\"datattezlw\",\"tmmjihyeozph\":\"datapqqmted\"}}],\"parameters\":{\"mdscwxqupev\":{\"type\":\"Float\",\"defaultValue\":\"dataqncygupkvi\"},\"jujbypelmcuvhixb\":{\"type\":\"Float\",\"defaultValue\":\"datastotxh\"},\"yl\":{\"type\":\"Bool\",\"defaultValue\":\"datafw\"}},\"variables\":{\"iwkkbn\":{\"type\":\"Array\",\"defaultValue\":\"datasttp\"}},\"concurrency\":647346434,\"annotations\":[\"datavtylbfpncu\",\"datadoiwi\",\"datathtywub\",\"datacbihwqk\"],\"runDimensions\":{\"dgoihxumwctondzj\":\"datantwjch\",\"fdlwg\":\"datauu\",\"gseinq\":\"dataytsbwtovv\"},\"folder\":{\"name\":\"fxqknpirgneptt\"},\"policy\":{\"elapsedTimeMetric\":{\"duration\":\"dataniffcdmqnroj\"}}},\"name\":\"ijnkrxfrdd\",\"type\":\"ratiz\",\"etag\":\"onasxifto\",\"\":{\"tw\":\"datazh\",\"lgnyhmo\":\"datasgogczhonnxk\",\"h\":\"datasxkkg\",\"hqxvcxgfrpdsofbs\":\"datarghxjb\"},\"id\":\"nsvbuswdv\"}") + .toObject(PipelineResourceInner.class); + Assertions.assertEquals("nsvbuswdv", model.id()); + Assertions.assertEquals("dyodnwzxltj", model.description()); + Assertions.assertEquals("hlt", model.activities().get(0).name()); + Assertions.assertEquals("gcxn", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("byqunyow", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("lazszrn", model.activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("mdscwxqupev").type()); + Assertions.assertEquals(VariableType.ARRAY, model.variables().get("iwkkbn").type()); + Assertions.assertEquals(647346434, model.concurrency()); + Assertions.assertEquals("fxqknpirgneptt", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PipelineResourceInner model = + new PipelineResourceInner() + .withId("nsvbuswdv") + .withDescription("dyodnwzxltj") + .withActivities( + Arrays + .asList( + new Activity() + .withName("hlt") + .withDescription("gcxn") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("byqunyow") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("bjxbkzbzk") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ldgmfpgvmpip") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("sibircgpi") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.SKIPPED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("lazszrn").withValue("dataoiindfpwpjy"), + new UserProperty().withName("wbtlhflsjcdh").withValue("datazfjvfbgofe"), + new UserProperty().withName("jagrqmqhldvr").withValue("dataiiojnal"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("wpjgwws") + .withDescription("ghftqsxhqxujxuk") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("jguufzdm") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("hwyg") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("pfcqdp") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("wkyhkobopgxe") + .withDependencyConditions(Arrays.asList(DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("ryuzh").withValue("datahkjoqr"), + new UserProperty().withName("qqaatjinrvgou").withValue("datamfiibfggj"), + new UserProperty().withName("ool").withValue("datarwxkvtkkgl"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("itvgbmhrixkwm") + .withDescription("jejveg") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("xexccbdreaxhcexd") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("s") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("lcrpw").withValue("dataxeznoi"), + new UserProperty().withName("brnjwmw").withValue("datapn"), + new UserProperty().withName("saz").withValue("datajjoqkagf"), + new UserProperty().withName("sxtta").withValue("datagzxnfaazpxdtnk"))) + .withAdditionalProperties(mapOf("type", "Activity")))) + .withParameters( + mapOf( + "mdscwxqupev", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("dataqncygupkvi"), + "jujbypelmcuvhixb", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datastotxh"), + "yl", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datafw"))) + .withVariables( + mapOf( + "iwkkbn", + new VariableSpecification().withType(VariableType.ARRAY).withDefaultValue("datasttp"))) + .withConcurrency(647346434) + .withAnnotations(Arrays.asList("datavtylbfpncu", "datadoiwi", "datathtywub", "datacbihwqk")) + .withRunDimensions( + mapOf("dgoihxumwctondzj", "datantwjch", "fdlwg", "datauu", "gseinq", "dataytsbwtovv")) + .withFolder(new PipelineFolder().withName("fxqknpirgneptt")) + .withPolicy( + new PipelinePolicy() + .withElapsedTimeMetric(new PipelineElapsedTimeMetricPolicy().withDuration("dataniffcdmqnroj"))) + .withAdditionalProperties(mapOf("name", "ijnkrxfrdd", "etag", "onasxifto", "type", "ratiz")); + model = BinaryData.fromObject(model).toObject(PipelineResourceInner.class); + Assertions.assertEquals("nsvbuswdv", model.id()); + Assertions.assertEquals("dyodnwzxltj", model.description()); + Assertions.assertEquals("hlt", model.activities().get(0).name()); + Assertions.assertEquals("gcxn", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("byqunyow", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("lazszrn", model.activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("mdscwxqupev").type()); + Assertions.assertEquals(VariableType.ARRAY, model.variables().get("iwkkbn").type()); + Assertions.assertEquals(647346434, model.concurrency()); + Assertions.assertEquals("fxqknpirgneptt", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunInnerTests.java new file mode 100644 index 000000000000..27a25d678600 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunInnerTests.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.datafactory.fluent.models.PipelineRunInner; +import java.util.HashMap; +import java.util.Map; + +public final class PipelineRunInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PipelineRunInner model = + BinaryData + .fromString( + "{\"runId\":\"lqol\",\"runGroupId\":\"kcgxxlxsffgcvi\",\"isLatest\":true,\"pipelineName\":\"wlvwlyoupf\",\"parameters\":{\"ubdyhgk\":\"k\",\"tsttktlahbq\":\"minsgowzf\",\"mmqtgqqqxhr\":\"ctxtgzukxi\",\"juisavokqdzf\":\"xrxc\"},\"runDimensions\":{\"nwxyiop\":\"ivjlfrqttbajlka\"},\"invokedBy\":{\"name\":\"qqfkuv\",\"id\":\"xkdmligo\",\"invokedByType\":\"brxk\",\"pipelineName\":\"loazuruocbgoo\",\"pipelineRunId\":\"te\"},\"lastUpdated\":\"2021-05-01T19:42:34Z\",\"runStart\":\"2021-05-18T20:05:21Z\",\"runEnd\":\"2021-08-27T22:46:55Z\",\"durationInMs\":1900106080,\"status\":\"vjgsl\",\"message\":\"dilmyww\",\"\":{\"edabgyvudtjue\":\"datakxn\",\"yxccyb\":\"databcihxuuwhc\",\"px\":\"datapayakkud\"}}") + .toObject(PipelineRunInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PipelineRunInner model = + new PipelineRunInner() + .withAdditionalProperties( + mapOf( + "durationInMs", + 1900106080, + "runDimensions", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize("{\"nwxyiop\":\"ivjlfrqttbajlka\"}", Object.class, SerializerEncoding.JSON), + "invokedBy", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"name\":\"qqfkuv\",\"id\":\"xkdmligo\",\"invokedByType\":\"brxk\",\"pipelineName\":\"loazuruocbgoo\",\"pipelineRunId\":\"te\"}", + Object.class, + SerializerEncoding.JSON), + "runStart", + "2021-05-18T20:05:21Z", + "message", + "dilmyww", + "pipelineName", + "wlvwlyoupf", + "lastUpdated", + "2021-05-01T19:42:34Z", + "isLatest", + true, + "runId", + "lqol", + "runEnd", + "2021-08-27T22:46:55Z", + "runGroupId", + "kcgxxlxsffgcvi", + "parameters", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"ubdyhgk\":\"k\",\"tsttktlahbq\":\"minsgowzf\",\"mmqtgqqqxhr\":\"ctxtgzukxi\",\"juisavokqdzf\":\"xrxc\"}", + Object.class, + SerializerEncoding.JSON), + "status", + "vjgsl")); + model = BinaryData.fromObject(model).toObject(PipelineRunInner.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunInvokedByTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunInvokedByTests.java new file mode 100644 index 000000000000..92c95727bce2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunInvokedByTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PipelineRunInvokedBy; + +public final class PipelineRunInvokedByTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PipelineRunInvokedBy model = + BinaryData + .fromString( + "{\"name\":\"jplmagstcy\",\"id\":\"pfkyrkdbdgiogsj\",\"invokedByType\":\"nwqjnoba\",\"pipelineName\":\"hdd\",\"pipelineRunId\":\"acegfnmntf\"}") + .toObject(PipelineRunInvokedBy.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PipelineRunInvokedBy model = new PipelineRunInvokedBy(); + model = BinaryData.fromObject(model).toObject(PipelineRunInvokedBy.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunsCancelWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunsCancelWithResponseMockTests.java new file mode 100644 index 000000000000..5de2cf5acd3c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunsCancelWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PipelineRunsCancelWithResponseMockTests { + @Test + public void testCancelWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .pipelineRuns() + .cancelWithResponse("zvhxssnqqivv", "vuyxsnm", "innisuuakaadbwhs", false, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunsGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunsGetWithResponseMockTests.java new file mode 100644 index 000000000000..709cba5e17b4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineRunsGetWithResponseMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.PipelineRun; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PipelineRunsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"runId\":\"hs\",\"runGroupId\":\"seazgfdyess\",\"isLatest\":true,\"pipelineName\":\"btgexiwcqe\",\"parameters\":{\"pbvzbt\":\"yrzidoyvquufpl\",\"lqrxewdgzfqsr\":\"ftotpvoehsfwra\",\"phiqje\":\"yuillrrqw\"},\"runDimensions\":{\"jcblppnqosnvcw\":\"fgoqgl\",\"zmwbxautspnyutf\":\"iwgakghvaqbk\",\"birjnddaovgi\":\"qighnunptjm\"},\"invokedBy\":{\"name\":\"ztrln\",\"id\":\"vjdv\",\"invokedByType\":\"c\",\"pipelineName\":\"j\",\"pipelineRunId\":\"m\"},\"lastUpdated\":\"2021-06-22T02:16:24Z\",\"runStart\":\"2021-10-29T07:24:49Z\",\"runEnd\":\"2021-07-07T19:51:04Z\",\"durationInMs\":1616045807,\"status\":\"tfsciayclvaivsa\",\"message\":\"fjhcrqnwoahfa\",\"\":{\"nwvqifptvfsvrjd\":\"dataq\"}}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PipelineRun response = + manager + .pipelineRuns() + .getWithResponse("r", "kmanrowdqoj", "yabvvbsi", com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineTests.java new file mode 100644 index 000000000000..6887e7384987 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelineTests.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.Pipeline; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PipelineElapsedTimeMetricPolicy; +import com.azure.resourcemanager.datafactory.models.PipelineFolder; +import com.azure.resourcemanager.datafactory.models.PipelinePolicy; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import com.azure.resourcemanager.datafactory.models.VariableSpecification; +import com.azure.resourcemanager.datafactory.models.VariableType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PipelineTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Pipeline model = + BinaryData + .fromString( + "{\"description\":\"ybycnunvj\",\"activities\":[{\"type\":\"Activity\",\"name\":\"kfawnopqgikyz\",\"description\":\"txdyuxzejntpsew\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"kr\",\"dependencyConditions\":[\"Skipped\",\"Failed\",\"Succeeded\"],\"\":{\"tbghhavgrvkf\":\"dataeoxorggufhyao\",\"mv\":\"dataovjzhpjbibgjmfx\",\"zzxscyhwzdgiruj\":\"datacluyovwxnbkf\",\"ujviylwdshfs\":\"datazbomvzzbtdcqvpni\"}}],\"userProperties\":[{\"name\":\"bgye\",\"value\":\"datarymsgaojfmw\"},{\"name\":\"cotmr\",\"value\":\"datahirctymoxoftpipi\"}],\"\":{\"cpqjlihhyu\":\"datazuhx\",\"x\":\"datapskasdvlmfwdg\",\"sreuzvxurisjnh\":\"datalucvpam\",\"blwpcesutrgj\":\"dataytxifqjzgxmrh\"}}],\"parameters\":{\"w\":{\"type\":\"Float\",\"defaultValue\":\"datatpwoqhihejq\"},\"xjvfoimwksl\":{\"type\":\"SecureString\",\"defaultValue\":\"datafqntcyp\"},\"ydfce\":{\"type\":\"String\",\"defaultValue\":\"dataizjx\"}},\"variables\":{\"mrtwna\":{\"type\":\"String\",\"defaultValue\":\"datavygdyft\"}},\"concurrency\":951831262,\"annotations\":[\"dataiw\",\"dataojgcyzt\",\"datafmznba\"],\"runDimensions\":{\"huwrykqgaifm\":\"datahchqnrnrpx\"},\"folder\":{\"name\":\"lb\"},\"policy\":{\"elapsedTimeMetric\":{\"duration\":\"datahbejdznxcvdsrhnj\"}}}") + .toObject(Pipeline.class); + Assertions.assertEquals("ybycnunvj", model.description()); + Assertions.assertEquals("kfawnopqgikyz", model.activities().get(0).name()); + Assertions.assertEquals("txdyuxzejntpsew", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("kr", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SKIPPED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("bgye", model.activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("w").type()); + Assertions.assertEquals(VariableType.STRING, model.variables().get("mrtwna").type()); + Assertions.assertEquals(951831262, model.concurrency()); + Assertions.assertEquals("lb", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Pipeline model = + new Pipeline() + .withDescription("ybycnunvj") + .withActivities( + Arrays + .asList( + new Activity() + .withName("kfawnopqgikyz") + .withDescription("txdyuxzejntpsew") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("kr") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("bgye").withValue("datarymsgaojfmw"), + new UserProperty().withName("cotmr").withValue("datahirctymoxoftpipi"))) + .withAdditionalProperties(mapOf("type", "Activity")))) + .withParameters( + mapOf( + "w", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datatpwoqhihejq"), + "xjvfoimwksl", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datafqntcyp"), + "ydfce", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataizjx"))) + .withVariables( + mapOf( + "mrtwna", + new VariableSpecification().withType(VariableType.STRING).withDefaultValue("datavygdyft"))) + .withConcurrency(951831262) + .withAnnotations(Arrays.asList("dataiw", "dataojgcyzt", "datafmznba")) + .withRunDimensions(mapOf("huwrykqgaifm", "datahchqnrnrpx")) + .withFolder(new PipelineFolder().withName("lb")) + .withPolicy( + new PipelinePolicy() + .withElapsedTimeMetric( + new PipelineElapsedTimeMetricPolicy().withDuration("datahbejdznxcvdsrhnj"))); + model = BinaryData.fromObject(model).toObject(Pipeline.class); + Assertions.assertEquals("ybycnunvj", model.description()); + Assertions.assertEquals("kfawnopqgikyz", model.activities().get(0).name()); + Assertions.assertEquals("txdyuxzejntpsew", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("kr", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SKIPPED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("bgye", model.activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("w").type()); + Assertions.assertEquals(VariableType.STRING, model.variables().get("mrtwna").type()); + Assertions.assertEquals(951831262, model.concurrency()); + Assertions.assertEquals("lb", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..18f2538bdd9a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PipelineElapsedTimeMetricPolicy; +import com.azure.resourcemanager.datafactory.models.PipelineFolder; +import com.azure.resourcemanager.datafactory.models.PipelinePolicy; +import com.azure.resourcemanager.datafactory.models.PipelineResource; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import com.azure.resourcemanager.datafactory.models.VariableSpecification; +import com.azure.resourcemanager.datafactory.models.VariableType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +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 org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PipelinesCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"description\":\"mzlsg\",\"activities\":[{\"type\":\"Activity\",\"name\":\"vx\",\"description\":\"vwuhvpipaafvtk\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"hwipihoxpeyixbrs\",\"dependencyConditions\":[]},{\"activity\":\"grjtlwcdczmlbz\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"hcpdohvwyitc\",\"value\":\"dataybuu\"},{\"name\":\"btfxjpgjayno\",\"value\":\"datawyzpntapgwr\"},{\"name\":\"yxyelzmukharuc\",\"value\":\"datak\"},{\"name\":\"mzjnnwob\",\"value\":\"datafutohkrqbgx\"}],\"\":{\"pobtbtlmpdrkgt\":\"dataapflluyhivlsw\"}},{\"type\":\"Activity\",\"name\":\"rmmmsaujx\",\"description\":\"g\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"ghxmwfaehryo\",\"dependencyConditions\":[]},{\"activity\":\"dinfwnlifstx\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"uddtubzekfb\",\"value\":\"dataftyxmelzlssk\"},{\"name\":\"hwwnnjabeibgyq\",\"value\":\"datazofyeqruoanhj\"},{\"name\":\"lkoawocset\",\"value\":\"datartexjiiq\"}],\"\":{\"qqcdzmhydmyemvyi\":\"datacejlyhuyhq\",\"pgttvykzdl\":\"datavvbenchtklz\",\"ikhbkcvpubvmsz\":\"datatenbvpadoseqc\"}},{\"type\":\"Activity\",\"name\":\"zrs\",\"description\":\"xncykfqibwes\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"fpgtklcgwbavlgov\",\"dependencyConditions\":[]},{\"activity\":\"thppodd\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"a\",\"value\":\"datakkwphvimstbyak\"},{\"name\":\"fvcir\",\"value\":\"datacgap\"},{\"name\":\"yof\",\"value\":\"dataimnfvbfj\"},{\"name\":\"vspxxbfqlfkwjiui\",\"value\":\"datayjdwdaocwqkxwoq\"}],\"\":{\"c\":\"datanojiqtpbfcvnhre\",\"tsdgnhlp\":\"datao\",\"iafgbfkmqhzjsh\":\"datacctuxxytmxjpku\"}},{\"type\":\"Activity\",\"name\":\"yjnrjrtnk\",\"description\":\"eurjynezpe\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"nptmriqe\",\"dependencyConditions\":[]},{\"activity\":\"ugi\",\"dependencyConditions\":[]},{\"activity\":\"szgstqsrtz\",\"dependencyConditions\":[]},{\"activity\":\"vwhjf\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"pstvcqhzejbr\",\"value\":\"datakhlopy\"},{\"name\":\"rsvyjrqhpz\",\"value\":\"datavmxibpcnmps\"},{\"name\":\"zkaen\",\"value\":\"dataipr\"}],\"\":{\"grcjoycqndgbxtz\":\"datawftrjdyi\",\"gubsidwgyaz\":\"datateszohntch\",\"oodcmjfieydtnp\":\"datapefs\"}}],\"parameters\":{\"goaxtwtkkmuir\":{\"type\":\"Object\",\"defaultValue\":\"datafhsckecume\"},\"iudnmojjmim\":{\"type\":\"Object\",\"defaultValue\":\"dataaxstqqjqliyxzen\"},\"axluovzmijir\":{\"type\":\"Array\",\"defaultValue\":\"dataiaot\"},\"krwwchyqei\":{\"type\":\"Int\",\"defaultValue\":\"datatblmumbafcmsotud\"}},\"variables\":{\"mdn\":{\"type\":\"Array\",\"defaultValue\":\"datafeelymavin\"},\"rn\":{\"type\":\"String\",\"defaultValue\":\"datavz\"}},\"concurrency\":1106785884,\"annotations\":[\"databobagaigtpjj\",\"datazq\"],\"runDimensions\":{\"f\":\"datao\",\"qjvju\":\"datalibwdkjq\",\"tz\":\"datajqjxobmvf\"},\"folder\":{\"name\":\"tarneugbupk\"},\"policy\":{\"elapsedTimeMetric\":{\"duration\":\"dataqwcxedkkd\"}}},\"name\":\"frisreh\",\"type\":\"fiflpiq\",\"etag\":\"sjboghjdihtca\",\"\":{\"xbvyuarbycu\":\"datavdktba\",\"ilkm\":\"dataxgdadf\",\"mfersbktreih\":\"datatvmtnou\"},\"id\":\"zpusbfgjr\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PipelineResource response = + manager + .pipelines() + .define("qzrmlbd") + .withExistingFactory("uq", "tpwhicnna") + .withDescription("mz") + .withActivities( + Arrays + .asList( + new Activity() + .withName("xlst") + .withDescription("zxinwjuq") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("peauhldqbwkxe") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("nroewwrhvdwrowe") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ygoijhciynp") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("viivczupcl") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("vymfhkts").withValue("datans"))) + .withAdditionalProperties(mapOf("type", "Activity")))) + .withParameters( + mapOf( + "kpu", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datawqpcqyoujikv"))) + .withVariables( + mapOf( + "kzshvcalz", + new VariableSpecification().withType(VariableType.BOOL).withDefaultValue("datayxyrkpclvpnoay"))) + .withConcurrency(853202761) + .withAnnotations(Arrays.asList("datagnuhxae", "datapo", "datannwnzxikvje", "datajapsopjhaquxquyp")) + .withRunDimensions( + mapOf( + "tkdeyuowdpnaohhe", + "dataocusyqailqtq", + "sug", + "datalyrkbsrpruoyjbzy", + "eljbiupj", + "datareuhssrdugaxky", + "nyaeckzcbrxsq", + "datakyghsjcqqvl")) + .withFolder(new PipelineFolder().withName("sddjpeeqywngcvqh")) + .withPolicy( + new PipelinePolicy() + .withElapsedTimeMetric(new PipelineElapsedTimeMetricPolicy().withDuration("datacsspnfxwkjhzg"))) + .withIfMatch("pfgjzrdgnl") + .create(); + + Assertions.assertEquals("zpusbfgjr", response.id()); + Assertions.assertEquals("mzlsg", response.description()); + Assertions.assertEquals("vx", response.activities().get(0).name()); + Assertions.assertEquals("vwuhvpipaafvtk", response.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, response.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, response.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("hwipihoxpeyixbrs", response.activities().get(0).dependsOn().get(0).activity()); + Assertions.assertEquals("hcpdohvwyitc", response.activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals(ParameterType.OBJECT, response.parameters().get("goaxtwtkkmuir").type()); + Assertions.assertEquals(VariableType.ARRAY, response.variables().get("mdn").type()); + Assertions.assertEquals(1106785884, response.concurrency()); + Assertions.assertEquals("tarneugbupk", response.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateRunWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateRunWithResponseMockTests.java new file mode 100644 index 000000000000..87348170c2c8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesCreateRunWithResponseMockTests.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.CreateRunResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PipelinesCreateRunWithResponseMockTests { + @Test + public void testCreateRunWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"runId\":\"mebwcuf\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + CreateRunResponse response = + manager + .pipelines() + .createRunWithResponse( + "eofjoqjmlzlki", + "jssfwojfng", + "hzrjsbwdsit", + "pashvjrin", + false, + "tgaduslnrqykn", + false, + mapOf( + "idyansnunvgqtvg", + "datacxya", + "vrdsv", + "dataperbnbsd", + "mnmxspz", + "datajgtqqrmi", + "paw", + "datairvzbmhmkoxsavzn"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("mebwcuf", response.runId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..434695b9e235 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PipelinesDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .pipelines() + .deleteWithResponse("lwoozlfliiru", "nglfcrtkpfsjwtq", "o", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesGetWithResponseMockTests.java new file mode 100644 index 000000000000..f9349043b877 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesGetWithResponseMockTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PipelineResource; +import com.azure.resourcemanager.datafactory.models.VariableType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PipelinesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"description\":\"w\",\"activities\":[{\"type\":\"Activity\",\"name\":\"skyjlteiul\",\"description\":\"pvhivvlmzcvp\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"e\",\"dependencyConditions\":[]},{\"activity\":\"yzer\",\"dependencyConditions\":[]},{\"activity\":\"ezgi\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"sfmcxarhg\",\"value\":\"datauejtxxlkoktbcl\"},{\"name\":\"vwtwboxgrvsavo\",\"value\":\"databsqu\"},{\"name\":\"kuszllognledhvll\",\"value\":\"datanyg\"},{\"name\":\"mn\",\"value\":\"datavqaq\"}],\"\":{\"bvhflbchzob\":\"datapulwdh\",\"yqtyuywzccumk\":\"dataeeiakwdtuwbrw\"}}],\"parameters\":{\"tzvrgoxpayjs\":{\"type\":\"Int\",\"defaultValue\":\"datakcolvitbtloxrb\"},\"beyugggf\":{\"type\":\"Float\",\"defaultValue\":\"datafqstbfuqmlnef\"},\"vrkxyjsuappdmu\":{\"type\":\"SecureString\",\"defaultValue\":\"datatykenmjznjqrxyaa\"}},\"variables\":{\"dg\":{\"type\":\"String\",\"defaultValue\":\"datasbwmsyoybjt\"},\"lfovmc\":{\"type\":\"Array\",\"defaultValue\":\"datakqi\"},\"qvjfszvecedoptez\":{\"type\":\"Array\",\"defaultValue\":\"databofqd\"},\"dbkgxqsbwep\":{\"type\":\"String\",\"defaultValue\":\"dataerurcjgkauyzbrdi\"}},\"concurrency\":448070341,\"annotations\":[\"datavjxarddb\"],\"runDimensions\":{\"wgttpxbjihz\":\"dataayltyftwdprtp\",\"dnljpouz\":\"dataxndnbzhs\"},\"folder\":{\"name\":\"ytex\"},\"policy\":{\"elapsedTimeMetric\":{\"duration\":\"dataqllqn\"}}},\"name\":\"y\",\"type\":\"fleioyw\",\"etag\":\"lhbytshsathkt\",\"\":{\"aji\":\"dataljnuayptyzjqte\",\"gytquktcqggxdnpp\":\"datanpwomjlps\"},\"id\":\"fqag\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PipelineResource response = + manager + .pipelines() + .getWithResponse("eacpwsdir", "pr", "lgzpnr", "mjyvmxt", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("fqag", response.id()); + Assertions.assertEquals("w", response.description()); + Assertions.assertEquals("skyjlteiul", response.activities().get(0).name()); + Assertions.assertEquals("pvhivvlmzcvp", response.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, response.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, response.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("e", response.activities().get(0).dependsOn().get(0).activity()); + Assertions.assertEquals("sfmcxarhg", response.activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals(ParameterType.INT, response.parameters().get("tzvrgoxpayjs").type()); + Assertions.assertEquals(VariableType.STRING, response.variables().get("dg").type()); + Assertions.assertEquals(448070341, response.concurrency()); + Assertions.assertEquals("ytex", response.folder().name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesListByFactoryMockTests.java new file mode 100644 index 000000000000..49d4b2040ca9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PipelinesListByFactoryMockTests.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PipelineResource; +import com.azure.resourcemanager.datafactory.models.VariableType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PipelinesListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"description\":\"udromhhs\",\"activities\":[{\"type\":\"Activity\",\"name\":\"fvrakpq\",\"description\":\"toiudveoib\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"jxilbsbhaqsucwdc\",\"dependencyConditions\":[]},{\"activity\":\"dkwwuljv\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"gsxr\",\"value\":\"datax\"},{\"name\":\"ofmvau\",\"value\":\"datanhmnswlf\"}],\"\":{\"aytvi\":\"dataild\",\"dpssklm\":\"datavejwtzki\"}},{\"type\":\"Activity\",\"name\":\"taeallsxfzantssb\",\"description\":\"oqx\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"gxrfrmdpwpzuxoy\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"kloqpwsaqcre\",\"value\":\"datakgjdn\"}],\"\":{\"nmanrzjpr\":\"datapvrwecrvkiao\",\"szjb\":\"dataqwjwpej\"}},{\"type\":\"Activity\",\"name\":\"jcvwvycvnowzcli\",\"description\":\"dlhxwwhusrod\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"wqmocwkw\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"oqldacxo\",\"value\":\"dataaqassukv\"}],\"\":{\"mjzsjfca\":\"datazxznctxoczns\",\"a\":\"datapkpvdiirv\"}}],\"parameters\":{\"omakmi\":{\"type\":\"Float\",\"defaultValue\":\"datahxok\"},\"xyqprch\":{\"type\":\"String\",\"defaultValue\":\"dataduflajsgutgzcb\"}},\"variables\":{\"oaazvm\":{\"type\":\"Array\",\"defaultValue\":\"dataaoytkk\"},\"jtkpocqboyjjfx\":{\"type\":\"String\",\"defaultValue\":\"datadzfypdsrfpihvij\"},\"btux\":{\"type\":\"Bool\",\"defaultValue\":\"dataduyotqbfqt\"}},\"concurrency\":310896649,\"annotations\":[\"dataxolbzjl\",\"datarpsqp\"],\"runDimensions\":{\"xcahfoemcajj\":\"datacoibiodfybafenwv\",\"gnjhxydxicou\":\"datazoykw\",\"ejmjp\":\"datalgtbslagtmkiilc\"},\"folder\":{\"name\":\"bzlmztkzg\"},\"policy\":{\"elapsedTimeMetric\":{\"duration\":\"dataytq\"}}},\"name\":\"szdpto\",\"type\":\"cnxgqovfrtmwyez\",\"etag\":\"xmcawpbifzwo\",\"\":{\"l\":\"datacvjmyinplomejhxf\",\"ialsr\":\"datacbbabi\",\"wrpjoqc\":\"datazatl\"},\"id\":\"wzwshsg\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.pipelines().listByFactory("jzlnrellwf", "yabglsarfmjsch", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("wzwshsg", response.iterator().next().id()); + Assertions.assertEquals("udromhhs", response.iterator().next().description()); + Assertions.assertEquals("fvrakpq", response.iterator().next().activities().get(0).name()); + Assertions.assertEquals("toiudveoib", response.iterator().next().activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, response.iterator().next().activities().get(0).state()); + Assertions + .assertEquals( + ActivityOnInactiveMarkAs.FAILED, response.iterator().next().activities().get(0).onInactiveMarkAs()); + Assertions + .assertEquals( + "jxilbsbhaqsucwdc", response.iterator().next().activities().get(0).dependsOn().get(0).activity()); + Assertions.assertEquals("gsxr", response.iterator().next().activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals(ParameterType.FLOAT, response.iterator().next().parameters().get("omakmi").type()); + Assertions.assertEquals(VariableType.ARRAY, response.iterator().next().variables().get("oaazvm").type()); + Assertions.assertEquals(310896649, response.iterator().next().concurrency()); + Assertions.assertEquals("bzlmztkzg", response.iterator().next().folder().name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PolybaseSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PolybaseSettingsTests.java new file mode 100644 index 000000000000..0b2490d60b5b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PolybaseSettingsTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PolybaseSettings; +import com.azure.resourcemanager.datafactory.models.PolybaseSettingsRejectType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PolybaseSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PolybaseSettings model = + BinaryData + .fromString( + "{\"rejectType\":\"value\",\"rejectValue\":\"dataocrddqxhegcolh\",\"rejectSampleValue\":\"datacklqrunqwcrkkaby\",\"useTypeDefault\":\"datay\",\"\":{\"jypo\":\"datapywgjgfbsfsvayg\",\"ymf\":\"datakiptnwpwskckc\",\"plkpemxc\":\"dataxpgvqioqrebwarl\",\"earwtkrbscwb\":\"datareqaqvspsy\"}}") + .toObject(PolybaseSettings.class); + Assertions.assertEquals(PolybaseSettingsRejectType.VALUE, model.rejectType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PolybaseSettings model = + new PolybaseSettings() + .withRejectType(PolybaseSettingsRejectType.VALUE) + .withRejectValue("dataocrddqxhegcolh") + .withRejectSampleValue("datacklqrunqwcrkkaby") + .withUseTypeDefault("datay") + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(PolybaseSettings.class); + Assertions.assertEquals(PolybaseSettingsRejectType.VALUE, model.rejectType()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PostgreSqlSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PostgreSqlSourceTests.java new file mode 100644 index 000000000000..5ac58df54073 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PostgreSqlSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PostgreSqlSource; + +public final class PostgreSqlSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PostgreSqlSource model = + BinaryData + .fromString( + "{\"type\":\"PostgreSqlSource\",\"query\":\"datavhjkwfolpj\",\"queryTimeout\":\"datapahvoiranxqnz\",\"additionalColumns\":\"datavnldtqykz\",\"sourceRetryCount\":\"datadoqrejl\",\"sourceRetryWait\":\"datan\",\"maxConcurrentConnections\":\"dataicyozryoxmfrxf\",\"disableMetricsCollection\":\"datacjialvchfumlfgm\",\"\":{\"ipklfwn\":\"dataxko\",\"dkvljitbnhg\":\"datafkbqlrtffsw\",\"abgsdxtwqqukgo\":\"datarvlarozswmucr\",\"ksltunrwxsqvx\":\"datalvjgsk\"}}") + .toObject(PostgreSqlSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PostgreSqlSource model = + new PostgreSqlSource() + .withSourceRetryCount("datadoqrejl") + .withSourceRetryWait("datan") + .withMaxConcurrentConnections("dataicyozryoxmfrxf") + .withDisableMetricsCollection("datacjialvchfumlfgm") + .withQueryTimeout("datapahvoiranxqnz") + .withAdditionalColumns("datavnldtqykz") + .withQuery("datavhjkwfolpj"); + model = BinaryData.fromObject(model).toObject(PostgreSqlSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PostgreSqlTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PostgreSqlTableDatasetTests.java new file mode 100644 index 000000000000..d86720c04336 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PostgreSqlTableDatasetTests.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PostgreSqlTableDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PostgreSqlTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PostgreSqlTableDataset model = + BinaryData + .fromString( + "{\"type\":\"PostgreSqlTable\",\"typeProperties\":{\"tableName\":\"databgwzhbhflj\",\"table\":\"dataod\",\"schema\":\"dataovnlhrwya\"},\"description\":\"uafapwxsvdeatjio\",\"structure\":\"datairgoextqdn\",\"schema\":\"datagntimz\",\"linkedServiceName\":{\"referenceName\":\"upbmtbsetkods\",\"parameters\":{\"jyvdhdgdiwmlg\":\"dataedaakghcrzmm\",\"fkakhgkrvtyycvy\":\"datatmfetqjisjmolzca\",\"ejqaw\":\"datav\",\"pbbimh\":\"datausqpfzxkczbd\"}},\"parameters\":{\"zl\":{\"type\":\"Float\",\"defaultValue\":\"dataoortclnhbjcy\"},\"lkv\":{\"type\":\"SecureString\",\"defaultValue\":\"datascibv\"}},\"annotations\":[\"dataafnwqh\"],\"folder\":{\"name\":\"cnviulby\"},\"\":{\"umwhmxpuck\":\"datajzrycwpb\"}}") + .toObject(PostgreSqlTableDataset.class); + Assertions.assertEquals("uafapwxsvdeatjio", model.description()); + Assertions.assertEquals("upbmtbsetkods", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("zl").type()); + Assertions.assertEquals("cnviulby", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PostgreSqlTableDataset model = + new PostgreSqlTableDataset() + .withDescription("uafapwxsvdeatjio") + .withStructure("datairgoextqdn") + .withSchema("datagntimz") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("upbmtbsetkods") + .withParameters( + mapOf( + "jyvdhdgdiwmlg", + "dataedaakghcrzmm", + "fkakhgkrvtyycvy", + "datatmfetqjisjmolzca", + "ejqaw", + "datav", + "pbbimh", + "datausqpfzxkczbd"))) + .withParameters( + mapOf( + "zl", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("dataoortclnhbjcy"), + "lkv", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datascibv"))) + .withAnnotations(Arrays.asList("dataafnwqh")) + .withFolder(new DatasetFolder().withName("cnviulby")) + .withTableName("databgwzhbhflj") + .withTable("dataod") + .withSchemaTypePropertiesSchema("dataovnlhrwya"); + model = BinaryData.fromObject(model).toObject(PostgreSqlTableDataset.class); + Assertions.assertEquals("uafapwxsvdeatjio", model.description()); + Assertions.assertEquals("upbmtbsetkods", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("zl").type()); + Assertions.assertEquals("cnviulby", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PostgreSqlTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PostgreSqlTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..abe02bd679f5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PostgreSqlTableDatasetTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.PostgreSqlTableDatasetTypeProperties; + +public final class PostgreSqlTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PostgreSqlTableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"dataastlpsmgo\",\"table\":\"datac\",\"schema\":\"datarvlvvjmx\"}") + .toObject(PostgreSqlTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PostgreSqlTableDatasetTypeProperties model = + new PostgreSqlTableDatasetTypeProperties() + .withTableName("dataastlpsmgo") + .withTable("datac") + .withSchema("datarvlvvjmx"); + model = BinaryData.fromObject(model).toObject(PostgreSqlTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQuerySinkMappingTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQuerySinkMappingTests.java new file mode 100644 index 000000000000..24ad0a61c302 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQuerySinkMappingTests.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.PowerQuerySink; +import com.azure.resourcemanager.datafactory.models.PowerQuerySinkMapping; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PowerQuerySinkMappingTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PowerQuerySinkMapping model = + BinaryData + .fromString( + "{\"queryName\":\"qfzbiy\",\"dataflowSinks\":[{\"script\":\"yvsbjpyxlzxji\",\"schemaLinkedService\":{\"referenceName\":\"qprshtwdgoqxfb\",\"parameters\":{\"duwqovlqfz\":\"datatizroru\",\"kovubfugdgpmtzqp\":\"dataehagorbspotq\",\"vetuqi\":\"datavochmeximhmi\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"jamihnrulgypna\",\"parameters\":{\"eezii\":\"datasdwnanuqntx\",\"ntrynfo\":\"dataixfy\",\"gtodpuqilp\":\"dataoeuztpssmhdqcrig\"}},\"name\":\"zbybrvkx\",\"description\":\"fzs\",\"dataset\":{\"referenceName\":\"oumkeuc\",\"parameters\":{\"ktmsphcrn\":\"datauuzftd\"}},\"linkedService\":{\"referenceName\":\"xtzdspykcreuo\",\"parameters\":{\"kexcyw\":\"datasulejukackicrdr\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"dd\",\"datasetParameters\":\"dataljllypchqhci\",\"parameters\":{\"zpe\":\"datajt\"},\"\":{\"xicq\":\"datatkimmpgc\",\"nro\":\"datavwzxqmves\"}}},{\"script\":\"rqdgyttfzozrx\",\"schemaLinkedService\":{\"referenceName\":\"jjimfcgbdupslwl\",\"parameters\":{\"eqeabedfo\":\"dataezxcpxwqgmnq\",\"ahup\":\"datasiplhygp\",\"h\":\"datam\",\"pnrjsw\":\"datahrgeymspvgatzru\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"txrecwdleivmuq\",\"parameters\":{\"lpnyehhqy\":\"datarjv\",\"ka\":\"datajrmxazkqiqzaea\",\"xivhozhr\":\"datapokf\",\"azrbkhy\":\"databvfljxljgtirn\"}},\"name\":\"uf\",\"description\":\"qtvbyfyz\",\"dataset\":{\"referenceName\":\"uupeflk\",\"parameters\":{\"d\":\"dataxnja\",\"ydntupbrvdgtblx\":\"dataeayuowivpne\",\"ztlsnkwullvu\":\"datamdabpifygxuaidr\"}},\"linkedService\":{\"referenceName\":\"ymosj\",\"parameters\":{\"q\":\"datandjjqhins\",\"iwrfocbetlljqkgl\":\"dataudjrotqdiaxf\",\"xvl\":\"datavjaw\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"c\",\"datasetParameters\":\"dataseqmejerjyz\",\"parameters\":{\"ogykrmf\":\"datazbjieeivdrqtlcx\",\"w\":\"datalturxyvgro\",\"rxnlj\":\"datasnpcwymmgb\"},\"\":{\"dbhzcda\":\"datajsnzuebyzn\",\"eeqhjcwrrneor\":\"datanztzhqsbgksfjq\"}}},{\"script\":\"tlikbaumrqpon\",\"schemaLinkedService\":{\"referenceName\":\"comqlbjxpslvvg\",\"parameters\":{\"ytjsrboqamqqq\":\"dataqparqzygdko\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"kjtcdppdm\",\"parameters\":{\"ixbkvydvdjcgdh\":\"dataubcccltygxzit\",\"swlmxepygkfuwgkb\":\"datarlrfayd\"}},\"name\":\"jqtk\",\"description\":\"wmqzkjeczpzwfew\",\"dataset\":{\"referenceName\":\"acvmhp\",\"parameters\":{\"exnxxwafialipy\":\"datauhh\",\"iodyuuot\":\"datanukvfjbxvhui\",\"puxjhxsfb\":\"datapljwrahqqumozule\",\"kgxzi\":\"datawaaysmmzt\"}},\"linkedService\":{\"referenceName\":\"nkmjg\",\"parameters\":{\"smpgo\":\"datalnnxopixxciy\",\"we\":\"dataclstysirhnwseb\",\"ddcqteozayjim\":\"datasxrnji\",\"jtmdw\":\"datacb\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"jkqohcfnomwaoe\",\"datasetParameters\":\"datajmmsgukoq\",\"parameters\":{\"ztdzmei\":\"datakerztenzkbppgc\",\"mdzafdqqjds\":\"datacdybcor\",\"pqag\":\"dataztzhwbwrocuv\"},\"\":{\"afzvxbvkejrnmoek\":\"datartzusxhljexp\",\"trad\":\"datahxkgxydimopz\",\"tdhoxuxwvbsa\":\"dataihnpwsagebosbzyd\"}}},{\"script\":\"hs\",\"schemaLinkedService\":{\"referenceName\":\"ox\",\"parameters\":{\"lkygcg\":\"datahakhaechrjfpqem\",\"wnxpye\":\"datajdvabvsizmtmcteh\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"dablqollbvbohp\",\"parameters\":{\"tjjqcfzdfmqoe\":\"datasqavpu\",\"zymoqatga\":\"datafypuypztn\"}},\"name\":\"dzhi\",\"description\":\"aebaw\",\"dataset\":{\"referenceName\":\"ajdkjqznmzr\",\"parameters\":{\"pishjkovrqxojjm\":\"datayvxlnpvpcr\",\"gpnk\":\"datacfivr\"}},\"linkedService\":{\"referenceName\":\"axyyvxetgsdhwmbe\",\"parameters\":{\"rbrkqdbqhz\":\"datadorkchbnatr\",\"gut\":\"datavatypjk\",\"vrlbezhwsvoi\":\"datadlehcqbjjphuakpk\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"xjcjiqxybbby\",\"datasetParameters\":\"dataufzrjcbadnw\",\"parameters\":{\"cnhiamydw\":\"dataydcovspdmeea\"},\"\":{\"bmffzigfdh\":\"dataurqctlixnu\",\"crviobfuirwf\":\"dataw\",\"impxyurnmanbs\":\"datagupaz\",\"jorfrgbugprfiymp\":\"dataqarmijuld\"}}}]}") + .toObject(PowerQuerySinkMapping.class); + Assertions.assertEquals("qfzbiy", model.queryName()); + Assertions.assertEquals("zbybrvkx", model.dataflowSinks().get(0).name()); + Assertions.assertEquals("fzs", model.dataflowSinks().get(0).description()); + Assertions.assertEquals("oumkeuc", model.dataflowSinks().get(0).dataset().referenceName()); + Assertions.assertEquals("xtzdspykcreuo", model.dataflowSinks().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataflowSinks().get(0).flowlet().type()); + Assertions.assertEquals("dd", model.dataflowSinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("qprshtwdgoqxfb", model.dataflowSinks().get(0).schemaLinkedService().referenceName()); + Assertions + .assertEquals("jamihnrulgypna", model.dataflowSinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("yvsbjpyxlzxji", model.dataflowSinks().get(0).script()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PowerQuerySinkMapping model = + new PowerQuerySinkMapping() + .withQueryName("qfzbiy") + .withDataflowSinks( + Arrays + .asList( + new PowerQuerySink() + .withName("zbybrvkx") + .withDescription("fzs") + .withDataset( + new DatasetReference() + .withReferenceName("oumkeuc") + .withParameters(mapOf("ktmsphcrn", "datauuzftd"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("xtzdspykcreuo") + .withParameters(mapOf("kexcyw", "datasulejukackicrdr"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("dd") + .withDatasetParameters("dataljllypchqhci") + .withParameters(mapOf("zpe", "datajt")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("qprshtwdgoqxfb") + .withParameters( + mapOf( + "duwqovlqfz", + "datatizroru", + "kovubfugdgpmtzqp", + "dataehagorbspotq", + "vetuqi", + "datavochmeximhmi"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("jamihnrulgypna") + .withParameters( + mapOf( + "eezii", + "datasdwnanuqntx", + "ntrynfo", + "dataixfy", + "gtodpuqilp", + "dataoeuztpssmhdqcrig"))) + .withScript("yvsbjpyxlzxji"), + new PowerQuerySink() + .withName("uf") + .withDescription("qtvbyfyz") + .withDataset( + new DatasetReference() + .withReferenceName("uupeflk") + .withParameters( + mapOf( + "d", + "dataxnja", + "ydntupbrvdgtblx", + "dataeayuowivpne", + "ztlsnkwullvu", + "datamdabpifygxuaidr"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("ymosj") + .withParameters( + mapOf( + "q", + "datandjjqhins", + "iwrfocbetlljqkgl", + "dataudjrotqdiaxf", + "xvl", + "datavjaw"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("c") + .withDatasetParameters("dataseqmejerjyz") + .withParameters( + mapOf( + "ogykrmf", + "datazbjieeivdrqtlcx", + "w", + "datalturxyvgro", + "rxnlj", + "datasnpcwymmgb")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("jjimfcgbdupslwl") + .withParameters( + mapOf( + "eqeabedfo", + "dataezxcpxwqgmnq", + "ahup", + "datasiplhygp", + "h", + "datam", + "pnrjsw", + "datahrgeymspvgatzru"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("txrecwdleivmuq") + .withParameters( + mapOf( + "lpnyehhqy", + "datarjv", + "ka", + "datajrmxazkqiqzaea", + "xivhozhr", + "datapokf", + "azrbkhy", + "databvfljxljgtirn"))) + .withScript("rqdgyttfzozrx"), + new PowerQuerySink() + .withName("jqtk") + .withDescription("wmqzkjeczpzwfew") + .withDataset( + new DatasetReference() + .withReferenceName("acvmhp") + .withParameters( + mapOf( + "exnxxwafialipy", + "datauhh", + "iodyuuot", + "datanukvfjbxvhui", + "puxjhxsfb", + "datapljwrahqqumozule", + "kgxzi", + "datawaaysmmzt"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("nkmjg") + .withParameters( + mapOf( + "smpgo", + "datalnnxopixxciy", + "we", + "dataclstysirhnwseb", + "ddcqteozayjim", + "datasxrnji", + "jtmdw", + "datacb"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("jkqohcfnomwaoe") + .withDatasetParameters("datajmmsgukoq") + .withParameters( + mapOf( + "ztdzmei", + "datakerztenzkbppgc", + "mdzafdqqjds", + "datacdybcor", + "pqag", + "dataztzhwbwrocuv")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("comqlbjxpslvvg") + .withParameters(mapOf("ytjsrboqamqqq", "dataqparqzygdko"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("kjtcdppdm") + .withParameters( + mapOf( + "ixbkvydvdjcgdh", + "dataubcccltygxzit", + "swlmxepygkfuwgkb", + "datarlrfayd"))) + .withScript("tlikbaumrqpon"), + new PowerQuerySink() + .withName("dzhi") + .withDescription("aebaw") + .withDataset( + new DatasetReference() + .withReferenceName("ajdkjqznmzr") + .withParameters( + mapOf("pishjkovrqxojjm", "datayvxlnpvpcr", "gpnk", "datacfivr"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("axyyvxetgsdhwmbe") + .withParameters( + mapOf( + "rbrkqdbqhz", + "datadorkchbnatr", + "gut", + "datavatypjk", + "vrlbezhwsvoi", + "datadlehcqbjjphuakpk"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("xjcjiqxybbby") + .withDatasetParameters("dataufzrjcbadnw") + .withParameters(mapOf("cnhiamydw", "dataydcovspdmeea")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("ox") + .withParameters( + mapOf("lkygcg", "datahakhaechrjfpqem", "wnxpye", "datajdvabvsizmtmcteh"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("dablqollbvbohp") + .withParameters( + mapOf("tjjqcfzdfmqoe", "datasqavpu", "zymoqatga", "datafypuypztn"))) + .withScript("hs"))); + model = BinaryData.fromObject(model).toObject(PowerQuerySinkMapping.class); + Assertions.assertEquals("qfzbiy", model.queryName()); + Assertions.assertEquals("zbybrvkx", model.dataflowSinks().get(0).name()); + Assertions.assertEquals("fzs", model.dataflowSinks().get(0).description()); + Assertions.assertEquals("oumkeuc", model.dataflowSinks().get(0).dataset().referenceName()); + Assertions.assertEquals("xtzdspykcreuo", model.dataflowSinks().get(0).linkedService().referenceName()); + Assertions + .assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.dataflowSinks().get(0).flowlet().type()); + Assertions.assertEquals("dd", model.dataflowSinks().get(0).flowlet().referenceName()); + Assertions.assertEquals("qprshtwdgoqxfb", model.dataflowSinks().get(0).schemaLinkedService().referenceName()); + Assertions + .assertEquals("jamihnrulgypna", model.dataflowSinks().get(0).rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("yvsbjpyxlzxji", model.dataflowSinks().get(0).script()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQuerySinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQuerySinkTests.java new file mode 100644 index 000000000000..adc11bdc6353 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQuerySinkTests.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.PowerQuerySink; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PowerQuerySinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PowerQuerySink model = + BinaryData + .fromString( + "{\"script\":\"oykdno\",\"schemaLinkedService\":{\"referenceName\":\"axwmgzru\",\"parameters\":{\"cbgvsbt\":\"datacwnynlleiq\",\"xmnrqstjcmet\":\"dataertoxadhxuvj\"}},\"rejectedDataLinkedService\":{\"referenceName\":\"l\",\"parameters\":{\"gjnaqyqipsl\":\"datavnpvvd\",\"tfo\":\"datamvcdsvmwbitek\"}},\"name\":\"vfiybxqichgyb\",\"description\":\"dqekivycpzcvd\",\"dataset\":{\"referenceName\":\"ulrqtbht\",\"parameters\":{\"ryfmxmdu\":\"datapzl\",\"giln\":\"datazf\"}},\"linkedService\":{\"referenceName\":\"dccgndjgdpriggqq\",\"parameters\":{\"buu\":\"dataf\",\"igi\":\"datapyuflqjfshtujcyo\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"csklkqnq\",\"datasetParameters\":\"dataixnmbz\",\"parameters\":{\"mbzayspzvrietv\":\"datauyrzw\",\"dvatlzmgschn\":\"dataphmdzxplgtp\"},\"\":{\"vlzdmnfm\":\"databkkz\"}}}") + .toObject(PowerQuerySink.class); + Assertions.assertEquals("vfiybxqichgyb", model.name()); + Assertions.assertEquals("dqekivycpzcvd", model.description()); + Assertions.assertEquals("ulrqtbht", model.dataset().referenceName()); + Assertions.assertEquals("dccgndjgdpriggqq", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("csklkqnq", model.flowlet().referenceName()); + Assertions.assertEquals("axwmgzru", model.schemaLinkedService().referenceName()); + Assertions.assertEquals("l", model.rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("oykdno", model.script()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PowerQuerySink model = + new PowerQuerySink() + .withName("vfiybxqichgyb") + .withDescription("dqekivycpzcvd") + .withDataset( + new DatasetReference() + .withReferenceName("ulrqtbht") + .withParameters(mapOf("ryfmxmdu", "datapzl", "giln", "datazf"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("dccgndjgdpriggqq") + .withParameters(mapOf("buu", "dataf", "igi", "datapyuflqjfshtujcyo"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("csklkqnq") + .withDatasetParameters("dataixnmbz") + .withParameters(mapOf("mbzayspzvrietv", "datauyrzw", "dvatlzmgschn", "dataphmdzxplgtp")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("axwmgzru") + .withParameters(mapOf("cbgvsbt", "datacwnynlleiq", "xmnrqstjcmet", "dataertoxadhxuvj"))) + .withRejectedDataLinkedService( + new LinkedServiceReference() + .withReferenceName("l") + .withParameters(mapOf("gjnaqyqipsl", "datavnpvvd", "tfo", "datamvcdsvmwbitek"))) + .withScript("oykdno"); + model = BinaryData.fromObject(model).toObject(PowerQuerySink.class); + Assertions.assertEquals("vfiybxqichgyb", model.name()); + Assertions.assertEquals("dqekivycpzcvd", model.description()); + Assertions.assertEquals("ulrqtbht", model.dataset().referenceName()); + Assertions.assertEquals("dccgndjgdpriggqq", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("csklkqnq", model.flowlet().referenceName()); + Assertions.assertEquals("axwmgzru", model.schemaLinkedService().referenceName()); + Assertions.assertEquals("l", model.rejectedDataLinkedService().referenceName()); + Assertions.assertEquals("oykdno", model.script()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQuerySourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQuerySourceTests.java new file mode 100644 index 000000000000..bef744fbeddb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQuerySourceTests.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.PowerQuerySource; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PowerQuerySourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PowerQuerySource model = + BinaryData + .fromString( + "{\"script\":\"wqikwepwogggic\",\"schemaLinkedService\":{\"referenceName\":\"xhtfmcqbsudzpgch\",\"parameters\":{\"djxh\":\"datafqum\",\"v\":\"dataghgodkynrceq\",\"mmxjdnajuopj\":\"datadbd\",\"cwlo\":\"datayqmkwlh\"}},\"name\":\"dejkluxxrwzobuz\",\"description\":\"xga\",\"dataset\":{\"referenceName\":\"dtkwppth\",\"parameters\":{\"imrljdp\":\"datapr\",\"mhk\":\"dataqfxy\",\"loamfmxtllfltym\":\"datatbaewhte\",\"rfijhggabq\":\"datacn\"}},\"linkedService\":{\"referenceName\":\"amklilirwdv\",\"parameters\":{\"jxrdfd\":\"datasdpzouhktqrxqwq\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"llygta\",\"datasetParameters\":\"datazcxdfweapyfmlxrl\",\"parameters\":{\"x\":\"dataraspifleim\"},\"\":{\"cehfgsm\":\"databg\",\"mtznpaxwfqtyyqi\":\"datarjuqbpxtokl\",\"i\":\"datarcltungbsoljckm\",\"iiqqcqikclsmalns\":\"datazbkuckgkdsksw\"}}}") + .toObject(PowerQuerySource.class); + Assertions.assertEquals("dejkluxxrwzobuz", model.name()); + Assertions.assertEquals("xga", model.description()); + Assertions.assertEquals("dtkwppth", model.dataset().referenceName()); + Assertions.assertEquals("amklilirwdv", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("llygta", model.flowlet().referenceName()); + Assertions.assertEquals("xhtfmcqbsudzpgch", model.schemaLinkedService().referenceName()); + Assertions.assertEquals("wqikwepwogggic", model.script()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PowerQuerySource model = + new PowerQuerySource() + .withName("dejkluxxrwzobuz") + .withDescription("xga") + .withDataset( + new DatasetReference() + .withReferenceName("dtkwppth") + .withParameters( + mapOf( + "imrljdp", + "datapr", + "mhk", + "dataqfxy", + "loamfmxtllfltym", + "datatbaewhte", + "rfijhggabq", + "datacn"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("amklilirwdv") + .withParameters(mapOf("jxrdfd", "datasdpzouhktqrxqwq"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("llygta") + .withDatasetParameters("datazcxdfweapyfmlxrl") + .withParameters(mapOf("x", "dataraspifleim")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("xhtfmcqbsudzpgch") + .withParameters( + mapOf( + "djxh", + "datafqum", + "v", + "dataghgodkynrceq", + "mmxjdnajuopj", + "datadbd", + "cwlo", + "datayqmkwlh"))) + .withScript("wqikwepwogggic"); + model = BinaryData.fromObject(model).toObject(PowerQuerySource.class); + Assertions.assertEquals("dejkluxxrwzobuz", model.name()); + Assertions.assertEquals("xga", model.description()); + Assertions.assertEquals("dtkwppth", model.dataset().referenceName()); + Assertions.assertEquals("amklilirwdv", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("llygta", model.flowlet().referenceName()); + Assertions.assertEquals("xhtfmcqbsudzpgch", model.schemaLinkedService().referenceName()); + Assertions.assertEquals("wqikwepwogggic", model.script()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQueryTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQueryTypePropertiesTests.java new file mode 100644 index 000000000000..5c33f0df3e59 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PowerQueryTypePropertiesTests.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.PowerQueryTypeProperties; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.PowerQuerySource; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PowerQueryTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PowerQueryTypeProperties model = + BinaryData + .fromString( + "{\"sources\":[{\"script\":\"zkn\",\"schemaLinkedService\":{\"referenceName\":\"kmjqncfvdsc\",\"parameters\":{\"vndrwbgodtg\":\"datamvwfnqqwy\",\"ai\":\"datarssgwjf\"}},\"name\":\"jmu\",\"description\":\"vecvzts\",\"dataset\":{\"referenceName\":\"gmusaictdscnkzzo\",\"parameters\":{\"hlbzqixbnjrqvzy\":\"dataddclzeqozr\",\"me\":\"dataexozonynp\",\"jxvcvaso\":\"datadpabcreuwzosg\",\"xzv\":\"datamr\"}},\"linkedService\":{\"referenceName\":\"b\",\"parameters\":{\"uvecovsd\":\"datazygba\",\"akrlimzfvppkeqsi\":\"datahzrtd\",\"gygnhrkombc\":\"datajmcl\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"jdopggorwjo\",\"datasetParameters\":\"datarotpvclpof\",\"parameters\":{\"kptskwxjgvhxc\":\"datam\",\"kmkook\":\"databmk\",\"wk\":\"dataputmgvmuyakm\"},\"\":{\"qjimejtgzjxxlfej\":\"datawzkroyrdurxfl\"}}},{\"script\":\"uqloiwyayyzivrmi\",\"schemaLinkedService\":{\"referenceName\":\"dql\",\"parameters\":{\"xfns\":\"datawhrktjleifibfipl\",\"mhn\":\"dataycjowlyeyzmudsq\"}},\"name\":\"lzbuwodmachbkvn\",\"description\":\"bjrmvgo\",\"dataset\":{\"referenceName\":\"lehmum\",\"parameters\":{\"prwnhkgqggoxsst\":\"datallcz\"}},\"linkedService\":{\"referenceName\":\"vrak\",\"parameters\":{\"emjpequ\":\"dataynjcwmhlymgnukxr\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"zaudgjtfbclakkuc\",\"datasetParameters\":\"datawnhczbutou\",\"parameters\":{\"cqqwwvgwkslvlize\":\"datatirjwayh\",\"v\":\"datavbia\",\"wkhojqttbspvkhg\":\"datasrgekzyqxadyfhb\",\"xrk\":\"dataaqjsgyzstujr\"},\"\":{\"lduyehiiittugyuq\":\"datad\",\"csozjv\":\"datarldaxurfqa\"}}},{\"script\":\"zciggbnvtxofwa\",\"schemaLinkedService\":{\"referenceName\":\"yxwhoeamo\",\"parameters\":{\"fpnimtwuuhaueg\":\"datadoey\",\"zjy\":\"datakwmnfeub\"}},\"name\":\"kwfugiphrrkuu\",\"description\":\"qdurhzzfopue\",\"dataset\":{\"referenceName\":\"usvwluj\",\"parameters\":{\"fmwc\":\"datanibittoztjdqumq\",\"rbelfnzz\":\"dataddtgctxegtvgwy\",\"unomir\":\"datayizwbxgdebxla\"}},\"linkedService\":{\"referenceName\":\"fabenqla\",\"parameters\":{\"bcpjstbhem\":\"datagewayxfl\",\"eapdrbzyv\":\"datacucsqsnxfbxu\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"adulpodkaxp\",\"datasetParameters\":\"databkzhmhjd\",\"parameters\":{\"hfzt\":\"datadeluqroja\",\"bkuwpzqxlc\":\"dataraysrkgzkyhu\",\"ecjvxf\":\"dataeak\",\"ppwooaj\":\"dataqufqizj\"},\"\":{\"xpxhnzlslekc\":\"datajmjjxi\",\"adeghztldsvc\":\"datatgzkjtyqpd\",\"qymjzucwwmejjqhd\":\"datadjiah\",\"ookyfoz\":\"datawvmqxi\"}}}],\"script\":\"nzxbyp\",\"documentLocale\":\"pgaixwrgrkkderf\"}") + .toObject(PowerQueryTypeProperties.class); + Assertions.assertEquals("jmu", model.sources().get(0).name()); + Assertions.assertEquals("vecvzts", model.sources().get(0).description()); + Assertions.assertEquals("gmusaictdscnkzzo", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("b", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("jdopggorwjo", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("kmjqncfvdsc", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("zkn", model.sources().get(0).script()); + Assertions.assertEquals("nzxbyp", model.script()); + Assertions.assertEquals("pgaixwrgrkkderf", model.documentLocale()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PowerQueryTypeProperties model = + new PowerQueryTypeProperties() + .withSources( + Arrays + .asList( + new PowerQuerySource() + .withName("jmu") + .withDescription("vecvzts") + .withDataset( + new DatasetReference() + .withReferenceName("gmusaictdscnkzzo") + .withParameters( + mapOf( + "hlbzqixbnjrqvzy", + "dataddclzeqozr", + "me", + "dataexozonynp", + "jxvcvaso", + "datadpabcreuwzosg", + "xzv", + "datamr"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("b") + .withParameters( + mapOf( + "uvecovsd", + "datazygba", + "akrlimzfvppkeqsi", + "datahzrtd", + "gygnhrkombc", + "datajmcl"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("jdopggorwjo") + .withDatasetParameters("datarotpvclpof") + .withParameters( + mapOf( + "kptskwxjgvhxc", + "datam", + "kmkook", + "databmk", + "wk", + "dataputmgvmuyakm")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("kmjqncfvdsc") + .withParameters(mapOf("vndrwbgodtg", "datamvwfnqqwy", "ai", "datarssgwjf"))) + .withScript("zkn"), + new PowerQuerySource() + .withName("lzbuwodmachbkvn") + .withDescription("bjrmvgo") + .withDataset( + new DatasetReference() + .withReferenceName("lehmum") + .withParameters(mapOf("prwnhkgqggoxsst", "datallcz"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("vrak") + .withParameters(mapOf("emjpequ", "dataynjcwmhlymgnukxr"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("zaudgjtfbclakkuc") + .withDatasetParameters("datawnhczbutou") + .withParameters( + mapOf( + "cqqwwvgwkslvlize", + "datatirjwayh", + "v", + "datavbia", + "wkhojqttbspvkhg", + "datasrgekzyqxadyfhb", + "xrk", + "dataaqjsgyzstujr")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("dql") + .withParameters( + mapOf("xfns", "datawhrktjleifibfipl", "mhn", "dataycjowlyeyzmudsq"))) + .withScript("uqloiwyayyzivrmi"), + new PowerQuerySource() + .withName("kwfugiphrrkuu") + .withDescription("qdurhzzfopue") + .withDataset( + new DatasetReference() + .withReferenceName("usvwluj") + .withParameters( + mapOf( + "fmwc", + "datanibittoztjdqumq", + "rbelfnzz", + "dataddtgctxegtvgwy", + "unomir", + "datayizwbxgdebxla"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("fabenqla") + .withParameters( + mapOf("bcpjstbhem", "datagewayxfl", "eapdrbzyv", "datacucsqsnxfbxu"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("adulpodkaxp") + .withDatasetParameters("databkzhmhjd") + .withParameters( + mapOf( + "hfzt", + "datadeluqroja", + "bkuwpzqxlc", + "dataraysrkgzkyhu", + "ecjvxf", + "dataeak", + "ppwooaj", + "dataqufqizj")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("yxwhoeamo") + .withParameters(mapOf("fpnimtwuuhaueg", "datadoey", "zjy", "datakwmnfeub"))) + .withScript("zciggbnvtxofwa"))) + .withScript("nzxbyp") + .withDocumentLocale("pgaixwrgrkkderf"); + model = BinaryData.fromObject(model).toObject(PowerQueryTypeProperties.class); + Assertions.assertEquals("jmu", model.sources().get(0).name()); + Assertions.assertEquals("vecvzts", model.sources().get(0).description()); + Assertions.assertEquals("gmusaictdscnkzzo", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("b", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("jdopggorwjo", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("kmjqncfvdsc", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("zkn", model.sources().get(0).script()); + Assertions.assertEquals("nzxbyp", model.script()); + Assertions.assertEquals("pgaixwrgrkkderf", model.documentLocale()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrestoDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrestoDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..306c5fdfb3f9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrestoDatasetTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.PrestoDatasetTypeProperties; + +public final class PrestoDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrestoDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"datawb\",\"table\":\"dataiwtwfgoc\",\"schema\":\"datalvemnnzugabk\"}") + .toObject(PrestoDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrestoDatasetTypeProperties model = + new PrestoDatasetTypeProperties() + .withTableName("datawb") + .withTable("dataiwtwfgoc") + .withSchema("datalvemnnzugabk"); + model = BinaryData.fromObject(model).toObject(PrestoDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrestoObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrestoObjectDatasetTests.java new file mode 100644 index 000000000000..fbd92dfc3656 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrestoObjectDatasetTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.PrestoObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PrestoObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrestoObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"PrestoObject\",\"typeProperties\":{\"tableName\":\"dataarluobbvalq\",\"table\":\"dataknyujxysvclfjy\",\"schema\":\"datavildlfflle\"},\"description\":\"mtxfqpfi\",\"structure\":\"datacgbfou\",\"schema\":\"databpgcryvidbz\",\"linkedServiceName\":{\"referenceName\":\"ylbvj\",\"parameters\":{\"xjftecgprz\":\"datangw\",\"dq\":\"dataqm\"}},\"parameters\":{\"xoyxuuco\":{\"type\":\"String\",\"defaultValue\":\"datayqhaat\"}},\"annotations\":[\"datayruxrzhhlh\",\"datavmgsbpgmncrv\",\"datapi\",\"dataoromppzsauqmeu\"],\"folder\":{\"name\":\"fcmpuaiugoceqtl\"},\"\":{\"ncfunlakgixhqjqh\":\"datajymwiccu\"}}") + .toObject(PrestoObjectDataset.class); + Assertions.assertEquals("mtxfqpfi", model.description()); + Assertions.assertEquals("ylbvj", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("xoyxuuco").type()); + Assertions.assertEquals("fcmpuaiugoceqtl", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrestoObjectDataset model = + new PrestoObjectDataset() + .withDescription("mtxfqpfi") + .withStructure("datacgbfou") + .withSchema("databpgcryvidbz") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ylbvj") + .withParameters(mapOf("xjftecgprz", "datangw", "dq", "dataqm"))) + .withParameters( + mapOf( + "xoyxuuco", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datayqhaat"))) + .withAnnotations(Arrays.asList("datayruxrzhhlh", "datavmgsbpgmncrv", "datapi", "dataoromppzsauqmeu")) + .withFolder(new DatasetFolder().withName("fcmpuaiugoceqtl")) + .withTableName("dataarluobbvalq") + .withTable("dataknyujxysvclfjy") + .withSchemaTypePropertiesSchema("datavildlfflle"); + model = BinaryData.fromObject(model).toObject(PrestoObjectDataset.class); + Assertions.assertEquals("mtxfqpfi", model.description()); + Assertions.assertEquals("ylbvj", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("xoyxuuco").type()); + Assertions.assertEquals("fcmpuaiugoceqtl", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrestoSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrestoSourceTests.java new file mode 100644 index 000000000000..6ce250b6e4b6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrestoSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PrestoSource; + +public final class PrestoSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrestoSource model = + BinaryData + .fromString( + "{\"type\":\"PrestoSource\",\"query\":\"datast\",\"queryTimeout\":\"datafbyfjslehgee\",\"additionalColumns\":\"datasoj\",\"sourceRetryCount\":\"dataarliig\",\"sourceRetryWait\":\"datav\",\"maxConcurrentConnections\":\"datai\",\"disableMetricsCollection\":\"datajhxxxuuqcmunhfa\",\"\":{\"oxh\":\"datanyvypu\",\"gejytqnzrcbh\":\"datawwerwywlxhiuwvq\",\"zgzf\":\"datayhctjvlwf\",\"fuhsmuclxgcedus\":\"datafyvytydrdcwbaiaq\"}}") + .toObject(PrestoSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrestoSource model = + new PrestoSource() + .withSourceRetryCount("dataarliig") + .withSourceRetryWait("datav") + .withMaxConcurrentConnections("datai") + .withDisableMetricsCollection("datajhxxxuuqcmunhfa") + .withQueryTimeout("datafbyfjslehgee") + .withAdditionalColumns("datasoj") + .withQuery("datast"); + model = BinaryData.fromObject(model).toObject(PrestoSource.class); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndPointConnectionsListByFactoryMockTests.java similarity index 59% rename from sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceMockTests.java rename to sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndPointConnectionsListByFactoryMockTests.java index 3517d71c7da7..5074bcb7772d 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsListByEmailServiceResourceMockTests.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndPointConnectionsListByFactoryMockTests.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.communication.generated; +package com.azure.resourcemanager.datafactory.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; @@ -12,10 +12,8 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.DomainManagement; -import com.azure.resourcemanager.communication.models.DomainResource; -import com.azure.resourcemanager.communication.models.UserEngagementTracking; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.PrivateEndpointConnectionResource; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -26,15 +24,15 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public final class DomainsListByEmailServiceResourceMockTests { +public final class PrivateEndPointConnectionsListByFactoryMockTests { @Test - public void testListByEmailServiceResource() throws Exception { + public void testListByFactory() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Moving\",\"dataLocation\":\"rjaw\",\"fromSenderDomain\":\"wgxhn\",\"mailFromSenderDomain\":\"kxfbkpycgklwndn\",\"domainManagement\":\"AzureManaged\",\"verificationStates\":{},\"verificationRecords\":{},\"userEngagementTracking\":\"Disabled\"},\"location\":\"ujznb\",\"tags\":{\"ualupjmkh\":\"wuwprzqlv\"},\"id\":\"xobbcswsrt\",\"name\":\"riplrbpbewtg\",\"type\":\"fgb\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"rdfxqhnwh\",\"privateEndpoint\":{\"id\":\"nfdqlz\"},\"privateLinkServiceConnectionState\":{\"status\":\"ocxiiumrdbqujyi\",\"description\":\"ciaznpsvgupqwqs\",\"actionsRequired\":\"ntl\"}},\"name\":\"knxzcsuvjbfryort\",\"type\":\"esxccpbtvgio\",\"etag\":\"ytpvswd\",\"id\":\"womkzussgj\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -54,20 +52,30 @@ public void testListByEmailServiceResource() throws Exception { return Mono.just(httpResponse); })); - CommunicationManager manager = - CommunicationManager + DataFactoryManager manager = + DataFactoryManager .configure() .withHttpClient(httpClient) .authenticate( tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - PagedIterable response = - manager.domains().listByEmailServiceResource("ueiotwmcdyt", "x", com.azure.core.util.Context.NONE); + PagedIterable response = + manager + .privateEndPointConnections() + .listByFactory("gaicgqgafkrtsa", "agvq", com.azure.core.util.Context.NONE); - Assertions.assertEquals("ujznb", response.iterator().next().location()); - Assertions.assertEquals("wuwprzqlv", response.iterator().next().tags().get("ualupjmkh")); - Assertions.assertEquals(DomainManagement.AZURE_MANAGED, response.iterator().next().domainManagement()); - Assertions.assertEquals(UserEngagementTracking.DISABLED, response.iterator().next().userEngagementTracking()); + Assertions.assertEquals("womkzussgj", response.iterator().next().id()); + Assertions + .assertEquals( + "ocxiiumrdbqujyi", + response.iterator().next().properties().privateLinkServiceConnectionState().status()); + Assertions + .assertEquals( + "ciaznpsvgupqwqs", + response.iterator().next().properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals( + "ntl", response.iterator().next().properties().privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionListResponseTests.java new file mode 100644 index 000000000000..74233dd0a018 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionListResponseTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.datafactory.models.ArmIdWrapper; +import com.azure.resourcemanager.datafactory.models.PrivateEndpointConnectionListResponse; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionState; +import com.azure.resourcemanager.datafactory.models.RemotePrivateEndpointConnection; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"mhdroznnhdrlktg\",\"privateEndpoint\":{\"id\":\"gguxhemlwyw\"},\"privateLinkServiceConnectionState\":{\"status\":\"czg\",\"description\":\"ukklelss\",\"actionsRequired\":\"lycsxz\"}},\"name\":\"ksrl\",\"type\":\"desqplpvmjcdo\",\"etag\":\"bidyv\",\"id\":\"owx\"}],\"nextLink\":\"piudeugfsxzecpa\"}") + .toObject(PrivateEndpointConnectionListResponse.class); + Assertions.assertEquals("owx", model.value().get(0).id()); + Assertions.assertEquals("czg", model.value().get(0).properties().privateLinkServiceConnectionState().status()); + Assertions + .assertEquals( + "ukklelss", model.value().get(0).properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals( + "lycsxz", model.value().get(0).properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("piudeugfsxzecpa", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointConnectionListResponse model = + new PrivateEndpointConnectionListResponse() + .withValue( + Arrays + .asList( + new PrivateEndpointConnectionResourceInner() + .withId("owx") + .withProperties( + new RemotePrivateEndpointConnection() + .withPrivateEndpoint(new ArmIdWrapper()) + .withPrivateLinkServiceConnectionState( + new PrivateLinkConnectionState() + .withStatus("czg") + .withDescription("ukklelss") + .withActionsRequired("lycsxz"))))) + .withNextLink("piudeugfsxzecpa"); + model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionListResponse.class); + Assertions.assertEquals("owx", model.value().get(0).id()); + Assertions.assertEquals("czg", model.value().get(0).properties().privateLinkServiceConnectionState().status()); + Assertions + .assertEquals( + "ukklelss", model.value().get(0).properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals( + "lycsxz", model.value().get(0).properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("piudeugfsxzecpa", model.nextLink()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionOperationsCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionOperationsCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..1e5bb7968df9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionOperationsCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.PrivateEndpoint; +import com.azure.resourcemanager.datafactory.models.PrivateEndpointConnectionResource; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionApprovalRequest; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionState; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionOperationsCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"provisioningState\":\"jrh\",\"privateEndpoint\":{\"id\":\"fstmbbjil\"},\"privateLinkServiceConnectionState\":{\"status\":\"ctykc\",\"description\":\"svflurrfnl\",\"actionsRequired\":\"fvjrohyecb\"}},\"name\":\"p\",\"type\":\"qqvmfuuhmftshgc\",\"etag\":\"x\",\"id\":\"gvipzvvr\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PrivateEndpointConnectionResource response = + manager + .privateEndpointConnectionOperations() + .define("z") + .withExistingFactory("zqbvdlhcyoykmpxt", "crugitjnwaj") + .withProperties( + new PrivateLinkConnectionApprovalRequest() + .withPrivateLinkServiceConnectionState( + new PrivateLinkConnectionState() + .withStatus("eaqnbkcqoyqmbu") + .withDescription("fb") + .withActionsRequired("czyhtj")) + .withPrivateEndpoint(new PrivateEndpoint().withId("lflqpanceowvq"))) + .withIfMatch("fefyggbacmn") + .create(); + + Assertions.assertEquals("gvipzvvr", response.id()); + Assertions.assertEquals("ctykc", response.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("svflurrfnl", response.properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("fvjrohyecb", response.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionOperationsDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionOperationsDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..ff8f7237e81a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionOperationsDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionOperationsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .privateEndpointConnectionOperations() + .deleteWithResponse("gyvpfyjlfnj", "wbtoq", "yprpwk", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionOperationsGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionOperationsGetWithResponseMockTests.java new file mode 100644 index 000000000000..4add267b29ba --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionOperationsGetWithResponseMockTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.PrivateEndpointConnectionResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionOperationsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"provisioningState\":\"qxhtc\",\"privateEndpoint\":{\"id\":\"hwxvvomcjpj\"},\"privateLinkServiceConnectionState\":{\"status\":\"sggaub\",\"description\":\"rfvlqwijeoenpih\",\"actionsRequired\":\"igaeeqgpvi\"}},\"name\":\"zlfccpgeqix\",\"type\":\"gltqld\",\"etag\":\"hqptpldamac\",\"id\":\"hnnbpsn\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PrivateEndpointConnectionResource response = + manager + .privateEndpointConnectionOperations() + .getWithResponse( + "ubggjdluwbmwu", "bekzcmfibboz", "ptwvamymswfwc", "ucsop", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("hnnbpsn", response.id()); + Assertions.assertEquals("sggaub", response.properties().privateLinkServiceConnectionState().status()); + Assertions + .assertEquals("rfvlqwijeoenpih", response.properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("igaeeqgpvi", response.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionResourceInnerTests.java new file mode 100644 index 000000000000..e960c51193e5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointConnectionResourceInnerTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.PrivateEndpointConnectionResourceInner; +import com.azure.resourcemanager.datafactory.models.ArmIdWrapper; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionState; +import com.azure.resourcemanager.datafactory.models.RemotePrivateEndpointConnection; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"provisioningState\":\"ufykhvuhxepmru\",\"privateEndpoint\":{\"id\":\"abaobnslujdjltym\"},\"privateLinkServiceConnectionState\":{\"status\":\"guihywar\",\"description\":\"pphkixkykxds\",\"actionsRequired\":\"pemmucfxhik\"}},\"name\":\"lrmymyincqlhri\",\"type\":\"sl\",\"etag\":\"iiovgqcgxu\",\"id\":\"qkctotiowlxte\"}") + .toObject(PrivateEndpointConnectionResourceInner.class); + Assertions.assertEquals("qkctotiowlxte", model.id()); + Assertions.assertEquals("guihywar", model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("pphkixkykxds", model.properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("pemmucfxhik", model.properties().privateLinkServiceConnectionState().actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointConnectionResourceInner model = + new PrivateEndpointConnectionResourceInner() + .withId("qkctotiowlxte") + .withProperties( + new RemotePrivateEndpointConnection() + .withPrivateEndpoint(new ArmIdWrapper()) + .withPrivateLinkServiceConnectionState( + new PrivateLinkConnectionState() + .withStatus("guihywar") + .withDescription("pphkixkykxds") + .withActionsRequired("pemmucfxhik"))); + model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionResourceInner.class); + Assertions.assertEquals("qkctotiowlxte", model.id()); + Assertions.assertEquals("guihywar", model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("pphkixkykxds", model.properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("pemmucfxhik", model.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointTests.java new file mode 100644 index 000000000000..8c22c4feedb2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateEndpointTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PrivateEndpoint; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpoint model = BinaryData.fromString("{\"id\":\"vedwcgyeewx\"}").toObject(PrivateEndpoint.class); + Assertions.assertEquals("vedwcgyeewx", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpoint model = new PrivateEndpoint().withId("vedwcgyeewx"); + model = BinaryData.fromObject(model).toObject(PrivateEndpoint.class); + Assertions.assertEquals("vedwcgyeewx", model.id()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkConnectionApprovalRequestResourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkConnectionApprovalRequestResourceTests.java new file mode 100644 index 000000000000..d82c5dd1febc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkConnectionApprovalRequestResourceTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PrivateEndpoint; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionApprovalRequest; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionApprovalRequestResource; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionState; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkConnectionApprovalRequestResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkConnectionApprovalRequestResource model = + BinaryData + .fromString( + "{\"properties\":{\"privateLinkServiceConnectionState\":{\"status\":\"vpbbt\",\"description\":\"fjoknss\",\"actionsRequired\":\"zqedikdfrdbi\"},\"privateEndpoint\":{\"id\":\"jgeihfqlggwfi\"}},\"name\":\"cxmjpbyephmg\",\"type\":\"ljvrcmyfqipgxhnp\",\"etag\":\"yqwcabvnuil\",\"id\":\"yaswlpaugmr\"}") + .toObject(PrivateLinkConnectionApprovalRequestResource.class); + Assertions.assertEquals("yaswlpaugmr", model.id()); + Assertions.assertEquals("vpbbt", model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("fjoknss", model.properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("zqedikdfrdbi", model.properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("jgeihfqlggwfi", model.properties().privateEndpoint().id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkConnectionApprovalRequestResource model = + new PrivateLinkConnectionApprovalRequestResource() + .withId("yaswlpaugmr") + .withProperties( + new PrivateLinkConnectionApprovalRequest() + .withPrivateLinkServiceConnectionState( + new PrivateLinkConnectionState() + .withStatus("vpbbt") + .withDescription("fjoknss") + .withActionsRequired("zqedikdfrdbi")) + .withPrivateEndpoint(new PrivateEndpoint().withId("jgeihfqlggwfi"))); + model = BinaryData.fromObject(model).toObject(PrivateLinkConnectionApprovalRequestResource.class); + Assertions.assertEquals("yaswlpaugmr", model.id()); + Assertions.assertEquals("vpbbt", model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("fjoknss", model.properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("zqedikdfrdbi", model.properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("jgeihfqlggwfi", model.properties().privateEndpoint().id()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkConnectionApprovalRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkConnectionApprovalRequestTests.java new file mode 100644 index 000000000000..3df350c0baa8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkConnectionApprovalRequestTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PrivateEndpoint; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionApprovalRequest; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionState; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkConnectionApprovalRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkConnectionApprovalRequest model = + BinaryData + .fromString( + "{\"privateLinkServiceConnectionState\":{\"status\":\"lrxw\",\"description\":\"aukhfkvcisiz\",\"actionsRequired\":\"a\"},\"privateEndpoint\":{\"id\":\"xjw\"}}") + .toObject(PrivateLinkConnectionApprovalRequest.class); + Assertions.assertEquals("lrxw", model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("aukhfkvcisiz", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("a", model.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("xjw", model.privateEndpoint().id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkConnectionApprovalRequest model = + new PrivateLinkConnectionApprovalRequest() + .withPrivateLinkServiceConnectionState( + new PrivateLinkConnectionState() + .withStatus("lrxw") + .withDescription("aukhfkvcisiz") + .withActionsRequired("a")) + .withPrivateEndpoint(new PrivateEndpoint().withId("xjw")); + model = BinaryData.fromObject(model).toObject(PrivateLinkConnectionApprovalRequest.class); + Assertions.assertEquals("lrxw", model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("aukhfkvcisiz", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("a", model.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("xjw", model.privateEndpoint().id()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkConnectionStateTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkConnectionStateTests.java new file mode 100644 index 000000000000..ba4195709d41 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkConnectionStateTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionState; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkConnectionStateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkConnectionState model = + BinaryData + .fromString( + "{\"status\":\"fypiv\",\"description\":\"bbjpmcubkmif\",\"actionsRequired\":\"xkubvphavpmhbrbq\"}") + .toObject(PrivateLinkConnectionState.class); + Assertions.assertEquals("fypiv", model.status()); + Assertions.assertEquals("bbjpmcubkmif", model.description()); + Assertions.assertEquals("xkubvphavpmhbrbq", model.actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkConnectionState model = + new PrivateLinkConnectionState() + .withStatus("fypiv") + .withDescription("bbjpmcubkmif") + .withActionsRequired("xkubvphavpmhbrbq"); + model = BinaryData.fromObject(model).toObject(PrivateLinkConnectionState.class); + Assertions.assertEquals("fypiv", model.status()); + Assertions.assertEquals("bbjpmcubkmif", model.description()); + Assertions.assertEquals("xkubvphavpmhbrbq", model.actionsRequired()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourcePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourcePropertiesTests.java new file mode 100644 index 000000000000..5d04ee5a075d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourcePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkResourceProperties model = + BinaryData + .fromString( + "{\"groupId\":\"klsbsbqqqagw\",\"requiredMembers\":[\"ao\",\"zisglrrczezkhh\",\"tnjadhq\"],\"requiredZoneNames\":[\"jqoyueayfbpcm\"]}") + .toObject(PrivateLinkResourceProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkResourceProperties model = new PrivateLinkResourceProperties(); + model = BinaryData.fromObject(model).toObject(PrivateLinkResourceProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourceTests.java new file mode 100644 index 000000000000..ceddeee13d60 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourceTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PrivateLinkResource; +import com.azure.resourcemanager.datafactory.models.PrivateLinkResourceProperties; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkResource model = + BinaryData + .fromString( + "{\"properties\":{\"groupId\":\"efxrdcoxnbk\",\"requiredMembers\":[\"nurnnq\",\"nqbpi\"],\"requiredZoneNames\":[\"ltgrdogypxrxv\",\"fihwu\"]},\"name\":\"ctafsrbxrblm\",\"type\":\"owxih\",\"etag\":\"nxw\",\"id\":\"gnepz\"}") + .toObject(PrivateLinkResource.class); + Assertions.assertEquals("gnepz", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkResource model = + new PrivateLinkResource().withId("gnepz").withProperties(new PrivateLinkResourceProperties()); + model = BinaryData.fromObject(model).toObject(PrivateLinkResource.class); + Assertions.assertEquals("gnepz", model.id()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourcesGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourcesGetWithResponseMockTests.java new file mode 100644 index 000000000000..2baf82064a6c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourcesGetWithResponseMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.PrivateLinkResourcesWrapper; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateLinkResourcesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"groupId\":\"yvqofpemcf\",\"requiredMembers\":[\"ifjvi\",\"azo\",\"wudbewb\",\"aufowhmdpggaktu\"],\"requiredZoneNames\":[\"hqdoctgno\",\"qw\",\"wtwjzzyi\"]},\"name\":\"bklyaelvhxutct\",\"type\":\"kdjusasfjwty\",\"etag\":\"knbucjybt\",\"id\":\"dlfg\"},{\"properties\":{\"groupId\":\"jnikwzlowus\",\"requiredMembers\":[\"mjiz\",\"tdf\"],\"requiredZoneNames\":[\"gjcepx\",\"yswvpavutiszwy\",\"lehagbjmwe\"]},\"name\":\"mpzamq\",\"type\":\"it\",\"etag\":\"yphtdwhmwxhvs\",\"id\":\"mokmymspatpvebxe\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PrivateLinkResourcesWrapper response = + manager + .privateLinkResources() + .getWithResponse("plkemvvlg", "zyishipl", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dlfg", response.value().get(0).id()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourcesWrapperInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourcesWrapperInnerTests.java new file mode 100644 index 000000000000..f4951affb67e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PrivateLinkResourcesWrapperInnerTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.PrivateLinkResourcesWrapperInner; +import com.azure.resourcemanager.datafactory.models.PrivateLinkResource; +import com.azure.resourcemanager.datafactory.models.PrivateLinkResourceProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkResourcesWrapperInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkResourcesWrapperInner model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"groupId\":\"psmgo\",\"requiredMembers\":[\"amljdlrgmsplzgau\"],\"requiredZoneNames\":[\"hhvnewgnxkymp\",\"anxrj\",\"ixt\"]},\"name\":\"taoypnyghshxc\",\"type\":\"hkgmnsg\",\"etag\":\"xycphdrwjjkh\",\"id\":\"omacluzvxnqmhr\"},{\"properties\":{\"groupId\":\"df\",\"requiredMembers\":[\"oi\"],\"requiredZoneNames\":[\"ssffxuifmc\"]},\"name\":\"p\",\"type\":\"kdqzrdzsylo\",\"etag\":\"gtrczzydmxzjijpv\",\"id\":\"urkihci\"}]}") + .toObject(PrivateLinkResourcesWrapperInner.class); + Assertions.assertEquals("omacluzvxnqmhr", model.value().get(0).id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkResourcesWrapperInner model = + new PrivateLinkResourcesWrapperInner() + .withValue( + Arrays + .asList( + new PrivateLinkResource() + .withId("omacluzvxnqmhr") + .withProperties(new PrivateLinkResourceProperties()), + new PrivateLinkResource() + .withId("urkihci") + .withProperties(new PrivateLinkResourceProperties()))); + model = BinaryData.fromObject(model).toObject(PrivateLinkResourcesWrapperInner.class); + Assertions.assertEquals("omacluzvxnqmhr", model.value().get(0).id()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PurviewConfigurationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PurviewConfigurationTests.java new file mode 100644 index 000000000000..4ccd273ccba5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/PurviewConfigurationTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PurviewConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class PurviewConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PurviewConfiguration model = + BinaryData.fromString("{\"purviewResourceId\":\"stkiiuxhqyud\"}").toObject(PurviewConfiguration.class); + Assertions.assertEquals("stkiiuxhqyud", model.purviewResourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PurviewConfiguration model = new PurviewConfiguration().withPurviewResourceId("stkiiuxhqyud"); + model = BinaryData.fromObject(model).toObject(PurviewConfiguration.class); + Assertions.assertEquals("stkiiuxhqyud", model.purviewResourceId()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/QueryDataFlowDebugSessionsResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/QueryDataFlowDebugSessionsResponseTests.java new file mode 100644 index 000000000000..a438b6dd225f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/QueryDataFlowDebugSessionsResponseTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.DataFlowDebugSessionInfoInner; +import com.azure.resourcemanager.datafactory.models.QueryDataFlowDebugSessionsResponse; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class QueryDataFlowDebugSessionsResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + QueryDataFlowDebugSessionsResponse model = + BinaryData + .fromString( + "{\"value\":[{\"dataFlowName\":\"noda\",\"computeType\":\"pqhe\",\"coreCount\":1635095275,\"nodeCount\":1244000330,\"integrationRuntimeName\":\"gsbos\",\"sessionId\":\"eln\",\"startTime\":\"atutmzlbiojlvfhr\",\"timeToLiveInMinutes\":438246123,\"lastActivityTime\":\"eqvcwwyyurmoch\",\"\":{\"lbkpb\":\"dataprsnmokayzejn\",\"hahzvechndbnwi\":\"datapcpil\"}}],\"nextLink\":\"olewjwi\"}") + .toObject(QueryDataFlowDebugSessionsResponse.class); + Assertions.assertEquals("noda", model.value().get(0).dataFlowName()); + Assertions.assertEquals("pqhe", model.value().get(0).computeType()); + Assertions.assertEquals(1635095275, model.value().get(0).coreCount()); + Assertions.assertEquals(1244000330, model.value().get(0).nodeCount()); + Assertions.assertEquals("gsbos", model.value().get(0).integrationRuntimeName()); + Assertions.assertEquals("eln", model.value().get(0).sessionId()); + Assertions.assertEquals("atutmzlbiojlvfhr", model.value().get(0).startTime()); + Assertions.assertEquals(438246123, model.value().get(0).timeToLiveInMinutes()); + Assertions.assertEquals("eqvcwwyyurmoch", model.value().get(0).lastActivityTime()); + Assertions.assertEquals("olewjwi", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + QueryDataFlowDebugSessionsResponse model = + new QueryDataFlowDebugSessionsResponse() + .withValue( + Arrays + .asList( + new DataFlowDebugSessionInfoInner() + .withDataFlowName("noda") + .withComputeType("pqhe") + .withCoreCount(1635095275) + .withNodeCount(1244000330) + .withIntegrationRuntimeName("gsbos") + .withSessionId("eln") + .withStartTime("atutmzlbiojlvfhr") + .withTimeToLiveInMinutes(438246123) + .withLastActivityTime("eqvcwwyyurmoch") + .withAdditionalProperties(mapOf()))) + .withNextLink("olewjwi"); + model = BinaryData.fromObject(model).toObject(QueryDataFlowDebugSessionsResponse.class); + Assertions.assertEquals("noda", model.value().get(0).dataFlowName()); + Assertions.assertEquals("pqhe", model.value().get(0).computeType()); + Assertions.assertEquals(1635095275, model.value().get(0).coreCount()); + Assertions.assertEquals(1244000330, model.value().get(0).nodeCount()); + Assertions.assertEquals("gsbos", model.value().get(0).integrationRuntimeName()); + Assertions.assertEquals("eln", model.value().get(0).sessionId()); + Assertions.assertEquals("atutmzlbiojlvfhr", model.value().get(0).startTime()); + Assertions.assertEquals(438246123, model.value().get(0).timeToLiveInMinutes()); + Assertions.assertEquals("eqvcwwyyurmoch", model.value().get(0).lastActivityTime()); + Assertions.assertEquals("olewjwi", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/QuickBooksObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/QuickBooksObjectDatasetTests.java new file mode 100644 index 000000000000..6ce05b72721c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/QuickBooksObjectDatasetTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.QuickBooksObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class QuickBooksObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + QuickBooksObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"QuickBooksObject\",\"typeProperties\":{\"tableName\":\"datasyweohlmtsnvon\"},\"description\":\"ftswcd\",\"structure\":\"datanseptvdtic\",\"schema\":\"datafl\",\"linkedServiceName\":{\"referenceName\":\"zwkopxd\",\"parameters\":{\"kfzrxxf\":\"datawoqhgppwxn\",\"jzrfx\":\"dataduvqzjnnuww\"}},\"parameters\":{\"rxrjwyzrieitq\":{\"type\":\"Bool\",\"defaultValue\":\"dataqjkbkjc\"},\"pebfhlgeeh\":{\"type\":\"String\",\"defaultValue\":\"datauwtbdzqajxk\"}},\"annotations\":[\"datagplnl\",\"datarfe\",\"datazunbua\",\"datamoub\"],\"folder\":{\"name\":\"mi\"},\"\":{\"yt\":\"datarnobvvequ\"}}") + .toObject(QuickBooksObjectDataset.class); + Assertions.assertEquals("ftswcd", model.description()); + Assertions.assertEquals("zwkopxd", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("rxrjwyzrieitq").type()); + Assertions.assertEquals("mi", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + QuickBooksObjectDataset model = + new QuickBooksObjectDataset() + .withDescription("ftswcd") + .withStructure("datanseptvdtic") + .withSchema("datafl") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("zwkopxd") + .withParameters(mapOf("kfzrxxf", "datawoqhgppwxn", "jzrfx", "dataduvqzjnnuww"))) + .withParameters( + mapOf( + "rxrjwyzrieitq", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataqjkbkjc"), + "pebfhlgeeh", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datauwtbdzqajxk"))) + .withAnnotations(Arrays.asList("datagplnl", "datarfe", "datazunbua", "datamoub")) + .withFolder(new DatasetFolder().withName("mi")) + .withTableName("datasyweohlmtsnvon"); + model = BinaryData.fromObject(model).toObject(QuickBooksObjectDataset.class); + Assertions.assertEquals("ftswcd", model.description()); + Assertions.assertEquals("zwkopxd", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("rxrjwyzrieitq").type()); + Assertions.assertEquals("mi", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/QuickBooksSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/QuickBooksSourceTests.java new file mode 100644 index 000000000000..d16e19af4336 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/QuickBooksSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.QuickBooksSource; + +public final class QuickBooksSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + QuickBooksSource model = + BinaryData + .fromString( + "{\"type\":\"QuickBooksSource\",\"query\":\"dataq\",\"queryTimeout\":\"dataykagsx\",\"additionalColumns\":\"datahervvlibrolqxloe\",\"sourceRetryCount\":\"datazrvf\",\"sourceRetryWait\":\"datasyqbfgwujw\",\"maxConcurrentConnections\":\"datathvue\",\"disableMetricsCollection\":\"datazznvdjnspy\",\"\":{\"nmavf\":\"dataygutqtjwiv\",\"nx\":\"datajwdw\",\"nd\":\"datae\"}}") + .toObject(QuickBooksSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + QuickBooksSource model = + new QuickBooksSource() + .withSourceRetryCount("datazrvf") + .withSourceRetryWait("datasyqbfgwujw") + .withMaxConcurrentConnections("datathvue") + .withDisableMetricsCollection("datazznvdjnspy") + .withQueryTimeout("dataykagsx") + .withAdditionalColumns("datahervvlibrolqxloe") + .withQuery("dataq"); + model = BinaryData.fromObject(model).toObject(QuickBooksSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RecurrenceScheduleOccurrenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RecurrenceScheduleOccurrenceTests.java new file mode 100644 index 000000000000..2b309310347b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RecurrenceScheduleOccurrenceTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DayOfWeek; +import com.azure.resourcemanager.datafactory.models.RecurrenceScheduleOccurrence; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class RecurrenceScheduleOccurrenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecurrenceScheduleOccurrence model = + BinaryData + .fromString("{\"day\":\"Monday\",\"occurrence\":30318410,\"\":{\"dumhpbcixday\":\"datakvsnfnkfsfga\"}}") + .toObject(RecurrenceScheduleOccurrence.class); + Assertions.assertEquals(DayOfWeek.MONDAY, model.day()); + Assertions.assertEquals(30318410, model.occurrence()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecurrenceScheduleOccurrence model = + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.MONDAY) + .withOccurrence(30318410) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(RecurrenceScheduleOccurrence.class); + Assertions.assertEquals(DayOfWeek.MONDAY, model.day()); + Assertions.assertEquals(30318410, model.occurrence()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RecurrenceScheduleTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RecurrenceScheduleTests.java new file mode 100644 index 000000000000..c116b1b0aa77 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RecurrenceScheduleTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DayOfWeek; +import com.azure.resourcemanager.datafactory.models.DaysOfWeek; +import com.azure.resourcemanager.datafactory.models.RecurrenceSchedule; +import com.azure.resourcemanager.datafactory.models.RecurrenceScheduleOccurrence; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class RecurrenceScheduleTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecurrenceSchedule model = + BinaryData + .fromString( + "{\"minutes\":[717518329],\"hours\":[1118044091,660441110,1722243594],\"weekDays\":[\"Thursday\"],\"monthDays\":[878999614],\"monthlyOccurrences\":[{\"day\":\"Monday\",\"occurrence\":580139874,\"\":{\"kidiujfpu\":\"databp\"}},{\"day\":\"Sunday\",\"occurrence\":567692310,\"\":{\"crouakmwvqt\":\"datapksjwaglhwnnfgy\",\"ozvfeljytshjjbo\":\"dataf\",\"yhwo\":\"datauugoujsvhezhe\",\"x\":\"dataayyshf\"}},{\"day\":\"Tuesday\",\"occurrence\":1488114471,\"\":{\"dblredxfcckticwg\":\"dataylthdrnze\",\"bvgcebutskdgsuht\":\"dataivq\",\"ulia\":\"datazomsqebmfopely\"}},{\"day\":\"Wednesday\",\"occurrence\":1030677140,\"\":{\"gmshuyqehbpr\":\"dataxeozgjtuh\",\"mtlfbzlziduq\":\"dataptoentuve\",\"hetrqudxzrbg\":\"dataxwrets\",\"iwpaeumely\":\"datatjjiearyzzxk\"}}],\"\":{\"trnwwwwlvvrditg\":\"datahurzazcukg\",\"nosizerzygkdl\":\"databaqumql\",\"sjlkjvoeuiwyptze\":\"datayltqryaahlttomlp\"}}") + .toObject(RecurrenceSchedule.class); + Assertions.assertEquals(717518329, model.minutes().get(0)); + Assertions.assertEquals(1118044091, model.hours().get(0)); + Assertions.assertEquals(DaysOfWeek.THURSDAY, model.weekDays().get(0)); + Assertions.assertEquals(878999614, model.monthDays().get(0)); + Assertions.assertEquals(DayOfWeek.MONDAY, model.monthlyOccurrences().get(0).day()); + Assertions.assertEquals(580139874, model.monthlyOccurrences().get(0).occurrence()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecurrenceSchedule model = + new RecurrenceSchedule() + .withMinutes(Arrays.asList(717518329)) + .withHours(Arrays.asList(1118044091, 660441110, 1722243594)) + .withWeekDays(Arrays.asList(DaysOfWeek.THURSDAY)) + .withMonthDays(Arrays.asList(878999614)) + .withMonthlyOccurrences( + Arrays + .asList( + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.MONDAY) + .withOccurrence(580139874) + .withAdditionalProperties(mapOf()), + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.SUNDAY) + .withOccurrence(567692310) + .withAdditionalProperties(mapOf()), + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.TUESDAY) + .withOccurrence(1488114471) + .withAdditionalProperties(mapOf()), + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.WEDNESDAY) + .withOccurrence(1030677140) + .withAdditionalProperties(mapOf()))) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(RecurrenceSchedule.class); + Assertions.assertEquals(717518329, model.minutes().get(0)); + Assertions.assertEquals(1118044091, model.hours().get(0)); + Assertions.assertEquals(DaysOfWeek.THURSDAY, model.weekDays().get(0)); + Assertions.assertEquals(878999614, model.monthDays().get(0)); + Assertions.assertEquals(DayOfWeek.MONDAY, model.monthlyOccurrences().get(0).day()); + Assertions.assertEquals(580139874, model.monthlyOccurrences().get(0).occurrence()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RedirectIncompatibleRowSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RedirectIncompatibleRowSettingsTests.java new file mode 100644 index 000000000000..2a0cbf5fb86a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RedirectIncompatibleRowSettingsTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.RedirectIncompatibleRowSettings; +import java.util.HashMap; +import java.util.Map; + +public final class RedirectIncompatibleRowSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RedirectIncompatibleRowSettings model = + BinaryData + .fromString( + "{\"linkedServiceName\":\"dataqhzs\",\"path\":\"datamgvygmtyw\",\"\":{\"rsxykw\":\"datauiteedjnklv\",\"dudj\":\"datahz\",\"qxpsnnn\":\"datat\",\"sdxylndbgaic\":\"datahgd\"}}") + .toObject(RedirectIncompatibleRowSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RedirectIncompatibleRowSettings model = + new RedirectIncompatibleRowSettings() + .withLinkedServiceName("dataqhzs") + .withPath("datamgvygmtyw") + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(RedirectIncompatibleRowSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RedshiftUnloadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RedshiftUnloadSettingsTests.java new file mode 100644 index 000000000000..75cebdd13950 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RedshiftUnloadSettingsTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.RedshiftUnloadSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class RedshiftUnloadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RedshiftUnloadSettings model = + BinaryData + .fromString( + "{\"s3LinkedServiceName\":{\"referenceName\":\"pmwo\",\"parameters\":{\"rtecfvzslttkp\":\"datainx\"}},\"bucketName\":\"datarkujceeczhsdpf\"}") + .toObject(RedshiftUnloadSettings.class); + Assertions.assertEquals("pmwo", model.s3LinkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RedshiftUnloadSettings model = + new RedshiftUnloadSettings() + .withS3LinkedServiceName( + new LinkedServiceReference() + .withReferenceName("pmwo") + .withParameters(mapOf("rtecfvzslttkp", "datainx"))) + .withBucketName("datarkujceeczhsdpf"); + model = BinaryData.fromObject(model).toObject(RedshiftUnloadSettings.class); + Assertions.assertEquals("pmwo", model.s3LinkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RelationalSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RelationalSourceTests.java new file mode 100644 index 000000000000..30d01258c639 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RelationalSourceTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.RelationalSource; + +public final class RelationalSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RelationalSource model = + BinaryData + .fromString( + "{\"type\":\"RelationalSource\",\"query\":\"datazwcxlncohywfvy\",\"additionalColumns\":\"dataawfwws\",\"sourceRetryCount\":\"datakbdozsspfwmf\",\"sourceRetryWait\":\"datartoxsthjyyiryb\",\"maxConcurrentConnections\":\"datamkmwdok\",\"disableMetricsCollection\":\"datayilho\",\"\":{\"hxoyrgvrtcct\":\"datadioxgs\",\"rarukdepsxu\":\"datazglbplqh\",\"xgxbgochpxps\":\"datayqcqfouhye\",\"ugbdkxlwck\":\"datapwwsiooz\"}}") + .toObject(RelationalSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RelationalSource model = + new RelationalSource() + .withSourceRetryCount("datakbdozsspfwmf") + .withSourceRetryWait("datartoxsthjyyiryb") + .withMaxConcurrentConnections("datamkmwdok") + .withDisableMetricsCollection("datayilho") + .withQuery("datazwcxlncohywfvy") + .withAdditionalColumns("dataawfwws"); + model = BinaryData.fromObject(model).toObject(RelationalSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RelationalTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RelationalTableDatasetTests.java new file mode 100644 index 000000000000..fb4d9b7b3a8e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RelationalTableDatasetTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.RelationalTableDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class RelationalTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RelationalTableDataset model = + BinaryData + .fromString( + "{\"type\":\"RelationalTable\",\"typeProperties\":{\"tableName\":\"dataxzizebjr\"},\"description\":\"gdstubw\",\"structure\":\"dataxzsshxliqmsckwh\",\"schema\":\"datadoi\",\"linkedServiceName\":{\"referenceName\":\"yobqzwjalwrsofxc\",\"parameters\":{\"mrs\":\"datamvj\",\"prel\":\"dataydl\",\"ztirjvqxvwkiocxo\":\"dataxfkz\"}},\"parameters\":{\"lrlqxbctatezyozd\":{\"type\":\"Float\",\"defaultValue\":\"datauocqflm\"}},\"annotations\":[\"dataqnl\",\"datajxcscnitodmrah\",\"datajido\",\"datanvlt\"],\"folder\":{\"name\":\"ahpuwkupbbnhic\"},\"\":{\"nhlsforsimtfcqm\":\"datazhrcqdfwbif\",\"pelpfijtezgxmpe\":\"dataynb\",\"f\":\"datazamadlerzi\",\"mirmnrijefmrt\":\"dataivczktllxswtdap\"}}") + .toObject(RelationalTableDataset.class); + Assertions.assertEquals("gdstubw", model.description()); + Assertions.assertEquals("yobqzwjalwrsofxc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("lrlqxbctatezyozd").type()); + Assertions.assertEquals("ahpuwkupbbnhic", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RelationalTableDataset model = + new RelationalTableDataset() + .withDescription("gdstubw") + .withStructure("dataxzsshxliqmsckwh") + .withSchema("datadoi") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("yobqzwjalwrsofxc") + .withParameters(mapOf("mrs", "datamvj", "prel", "dataydl", "ztirjvqxvwkiocxo", "dataxfkz"))) + .withParameters( + mapOf( + "lrlqxbctatezyozd", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datauocqflm"))) + .withAnnotations(Arrays.asList("dataqnl", "datajxcscnitodmrah", "datajido", "datanvlt")) + .withFolder(new DatasetFolder().withName("ahpuwkupbbnhic")) + .withTableName("dataxzizebjr"); + model = BinaryData.fromObject(model).toObject(RelationalTableDataset.class); + Assertions.assertEquals("gdstubw", model.description()); + Assertions.assertEquals("yobqzwjalwrsofxc", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("lrlqxbctatezyozd").type()); + Assertions.assertEquals("ahpuwkupbbnhic", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RelationalTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RelationalTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..0c3f701c760d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RelationalTableDatasetTypePropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.RelationalTableDatasetTypeProperties; + +public final class RelationalTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RelationalTableDatasetTypeProperties model = + BinaryData.fromString("{\"tableName\":\"datac\"}").toObject(RelationalTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RelationalTableDatasetTypeProperties model = new RelationalTableDatasetTypeProperties().withTableName("datac"); + model = BinaryData.fromObject(model).toObject(RelationalTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RemotePrivateEndpointConnectionTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RemotePrivateEndpointConnectionTests.java new file mode 100644 index 000000000000..dcc545b771ee --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RemotePrivateEndpointConnectionTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ArmIdWrapper; +import com.azure.resourcemanager.datafactory.models.PrivateLinkConnectionState; +import com.azure.resourcemanager.datafactory.models.RemotePrivateEndpointConnection; +import org.junit.jupiter.api.Assertions; + +public final class RemotePrivateEndpointConnectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RemotePrivateEndpointConnection model = + BinaryData + .fromString( + "{\"provisioningState\":\"ptjgwdt\",\"privateEndpoint\":{\"id\":\"ranblwphqlkccu\"},\"privateLinkServiceConnectionState\":{\"status\":\"gqwa\",\"description\":\"iul\",\"actionsRequired\":\"niiprglvaw\"}}") + .toObject(RemotePrivateEndpointConnection.class); + Assertions.assertEquals("gqwa", model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("iul", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("niiprglvaw", model.privateLinkServiceConnectionState().actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RemotePrivateEndpointConnection model = + new RemotePrivateEndpointConnection() + .withPrivateEndpoint(new ArmIdWrapper()) + .withPrivateLinkServiceConnectionState( + new PrivateLinkConnectionState() + .withStatus("gqwa") + .withDescription("iul") + .withActionsRequired("niiprglvaw")); + model = BinaryData.fromObject(model).toObject(RemotePrivateEndpointConnection.class); + Assertions.assertEquals("gqwa", model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("iul", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("niiprglvaw", model.privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RerunTumblingWindowTriggerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RerunTumblingWindowTriggerTests.java new file mode 100644 index 000000000000..db66043c362f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RerunTumblingWindowTriggerTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.RerunTumblingWindowTrigger; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RerunTumblingWindowTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RerunTumblingWindowTrigger model = + BinaryData + .fromString( + "{\"type\":\"RerunTumblingWindowTrigger\",\"typeProperties\":{\"parentTrigger\":\"datarvfxcbatmvxrj\",\"requestedStartTime\":\"2021-08-29T02:58:30Z\",\"requestedEndTime\":\"2021-10-29T20:21:25Z\",\"rerunConcurrency\":990377643},\"description\":\"sypevfrbujlt\",\"runtimeState\":\"Stopped\",\"annotations\":[\"datallaswwhbm\"],\"\":{\"yqsds\":\"datahknsknnnpyobyi\",\"rijd\":\"dataewf\",\"iwebmcizmggvsxv\":\"datakmcrtmvtfeyopg\"}}") + .toObject(RerunTumblingWindowTrigger.class); + Assertions.assertEquals("sypevfrbujlt", model.description()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-29T02:58:30Z"), model.requestedStartTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T20:21:25Z"), model.requestedEndTime()); + Assertions.assertEquals(990377643, model.rerunConcurrency()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RerunTumblingWindowTrigger model = + new RerunTumblingWindowTrigger() + .withDescription("sypevfrbujlt") + .withAnnotations(Arrays.asList("datallaswwhbm")) + .withParentTrigger("datarvfxcbatmvxrj") + .withRequestedStartTime(OffsetDateTime.parse("2021-08-29T02:58:30Z")) + .withRequestedEndTime(OffsetDateTime.parse("2021-10-29T20:21:25Z")) + .withRerunConcurrency(990377643); + model = BinaryData.fromObject(model).toObject(RerunTumblingWindowTrigger.class); + Assertions.assertEquals("sypevfrbujlt", model.description()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-29T02:58:30Z"), model.requestedStartTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T20:21:25Z"), model.requestedEndTime()); + Assertions.assertEquals(990377643, model.rerunConcurrency()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RerunTumblingWindowTriggerTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RerunTumblingWindowTriggerTypePropertiesTests.java new file mode 100644 index 000000000000..270f57e69214 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RerunTumblingWindowTriggerTypePropertiesTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.RerunTumblingWindowTriggerTypeProperties; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class RerunTumblingWindowTriggerTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RerunTumblingWindowTriggerTypeProperties model = + BinaryData + .fromString( + "{\"parentTrigger\":\"datawrqywaagzaxqh\",\"requestedStartTime\":\"2021-07-31T01:48:53Z\",\"requestedEndTime\":\"2021-04-25T14:25:18Z\",\"rerunConcurrency\":370253583}") + .toObject(RerunTumblingWindowTriggerTypeProperties.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T01:48:53Z"), model.requestedStartTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-25T14:25:18Z"), model.requestedEndTime()); + Assertions.assertEquals(370253583, model.rerunConcurrency()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RerunTumblingWindowTriggerTypeProperties model = + new RerunTumblingWindowTriggerTypeProperties() + .withParentTrigger("datawrqywaagzaxqh") + .withRequestedStartTime(OffsetDateTime.parse("2021-07-31T01:48:53Z")) + .withRequestedEndTime(OffsetDateTime.parse("2021-04-25T14:25:18Z")) + .withRerunConcurrency(370253583); + model = BinaryData.fromObject(model).toObject(RerunTumblingWindowTriggerTypeProperties.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T01:48:53Z"), model.requestedStartTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-25T14:25:18Z"), model.requestedEndTime()); + Assertions.assertEquals(370253583, model.rerunConcurrency()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ResponsysObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ResponsysObjectDatasetTests.java new file mode 100644 index 000000000000..9963a9a4e17e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ResponsysObjectDatasetTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.ResponsysObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ResponsysObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResponsysObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"ResponsysObject\",\"typeProperties\":{\"tableName\":\"dataxcsdqoxhdenmj\"},\"description\":\"xgrggyciw\",\"structure\":\"dataqinr\",\"schema\":\"datavvmrn\",\"linkedServiceName\":{\"referenceName\":\"rdijox\",\"parameters\":{\"b\":\"datasychdcjggcmpncj\",\"owvfxe\":\"databnoq\",\"irvcpol\":\"datatzgwjeky\",\"ilbdvxlfhlzzgap\":\"datavgppp\"}},\"parameters\":{\"xnroyhthesyw\":{\"type\":\"SecureString\",\"defaultValue\":\"datablscrmzquuzywkgo\"}},\"annotations\":[\"datavg\"],\"folder\":{\"name\":\"c\"},\"\":{\"zyrgrlh\":\"datazcwuejmxlfzl\"}}") + .toObject(ResponsysObjectDataset.class); + Assertions.assertEquals("xgrggyciw", model.description()); + Assertions.assertEquals("rdijox", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("xnroyhthesyw").type()); + Assertions.assertEquals("c", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResponsysObjectDataset model = + new ResponsysObjectDataset() + .withDescription("xgrggyciw") + .withStructure("dataqinr") + .withSchema("datavvmrn") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("rdijox") + .withParameters( + mapOf( + "b", + "datasychdcjggcmpncj", + "owvfxe", + "databnoq", + "irvcpol", + "datatzgwjeky", + "ilbdvxlfhlzzgap", + "datavgppp"))) + .withParameters( + mapOf( + "xnroyhthesyw", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datablscrmzquuzywkgo"))) + .withAnnotations(Arrays.asList("datavg")) + .withFolder(new DatasetFolder().withName("c")) + .withTableName("dataxcsdqoxhdenmj"); + model = BinaryData.fromObject(model).toObject(ResponsysObjectDataset.class); + Assertions.assertEquals("xgrggyciw", model.description()); + Assertions.assertEquals("rdijox", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("xnroyhthesyw").type()); + Assertions.assertEquals("c", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ResponsysSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ResponsysSourceTests.java new file mode 100644 index 000000000000..e2de09cb2617 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ResponsysSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ResponsysSource; + +public final class ResponsysSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResponsysSource model = + BinaryData + .fromString( + "{\"type\":\"ResponsysSource\",\"query\":\"datacrejt\",\"queryTimeout\":\"dataqqoz\",\"additionalColumns\":\"datasbpqwnmfjktdvdh\",\"sourceRetryCount\":\"dataztaluuup\",\"sourceRetryWait\":\"dataaoatzvajwvxh\",\"maxConcurrentConnections\":\"datamotulhilmazgp\",\"disableMetricsCollection\":\"datarppsoeo\",\"\":{\"ln\":\"datawtye\",\"dxsgwd\":\"datagqeplyos\"}}") + .toObject(ResponsysSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResponsysSource model = + new ResponsysSource() + .withSourceRetryCount("dataztaluuup") + .withSourceRetryWait("dataaoatzvajwvxh") + .withMaxConcurrentConnections("datamotulhilmazgp") + .withDisableMetricsCollection("datarppsoeo") + .withQueryTimeout("dataqqoz") + .withAdditionalColumns("datasbpqwnmfjktdvdh") + .withQuery("datacrejt"); + model = BinaryData.fromObject(model).toObject(ResponsysSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestResourceDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestResourceDatasetTests.java new file mode 100644 index 000000000000..657e3a6cf816 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestResourceDatasetTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.RestResourceDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class RestResourceDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RestResourceDataset model = + BinaryData + .fromString( + "{\"type\":\"RestResource\",\"typeProperties\":{\"relativeUrl\":\"dataiarz\",\"requestMethod\":\"datadqseypdlmajpuy\",\"requestBody\":\"dataa\",\"additionalHeaders\":{\"uvmsie\":\"datazgccyn\",\"parxtzayq\":\"dataedmmvoneeyr\"},\"paginationRules\":{\"z\":\"dataigeblsp\",\"eozbj\":\"datassiwwv\"}},\"description\":\"qpizdnuehxw\",\"structure\":\"datassjdywbnklg\",\"schema\":\"dataxa\",\"linkedServiceName\":{\"referenceName\":\"tsawv\",\"parameters\":{\"jrmplzmsl\":\"datampt\",\"vrrllfswarmyb\":\"databnknyfuysj\"}},\"parameters\":{\"cbfnxiajuv\":{\"type\":\"Float\",\"defaultValue\":\"datageysyqnipehfw\"},\"zguaxfhvjixgofqd\":{\"type\":\"Bool\",\"defaultValue\":\"datafjisosfzlnraxnf\"},\"uvrqpbxdoicqp\":{\"type\":\"Array\",\"defaultValue\":\"datajmi\"}},\"annotations\":[\"datalydp\"],\"folder\":{\"name\":\"nsbmzjritukoym\"},\"\":{\"ndu\":\"dataexmizzjxwjoqfzw\"}}") + .toObject(RestResourceDataset.class); + Assertions.assertEquals("qpizdnuehxw", model.description()); + Assertions.assertEquals("tsawv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("cbfnxiajuv").type()); + Assertions.assertEquals("nsbmzjritukoym", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RestResourceDataset model = + new RestResourceDataset() + .withDescription("qpizdnuehxw") + .withStructure("datassjdywbnklg") + .withSchema("dataxa") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("tsawv") + .withParameters(mapOf("jrmplzmsl", "datampt", "vrrllfswarmyb", "databnknyfuysj"))) + .withParameters( + mapOf( + "cbfnxiajuv", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datageysyqnipehfw"), + "zguaxfhvjixgofqd", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datafjisosfzlnraxnf"), + "uvrqpbxdoicqp", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datajmi"))) + .withAnnotations(Arrays.asList("datalydp")) + .withFolder(new DatasetFolder().withName("nsbmzjritukoym")) + .withRelativeUrl("dataiarz") + .withRequestMethod("datadqseypdlmajpuy") + .withRequestBody("dataa") + .withAdditionalHeaders(mapOf("uvmsie", "datazgccyn", "parxtzayq", "dataedmmvoneeyr")) + .withPaginationRules(mapOf("z", "dataigeblsp", "eozbj", "datassiwwv")); + model = BinaryData.fromObject(model).toObject(RestResourceDataset.class); + Assertions.assertEquals("qpizdnuehxw", model.description()); + Assertions.assertEquals("tsawv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("cbfnxiajuv").type()); + Assertions.assertEquals("nsbmzjritukoym", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestResourceDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestResourceDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..41e81e241429 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestResourceDatasetTypePropertiesTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.RestResourceDatasetTypeProperties; +import java.util.HashMap; +import java.util.Map; + +public final class RestResourceDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RestResourceDatasetTypeProperties model = + BinaryData + .fromString( + "{\"relativeUrl\":\"datauwdvolxt\",\"requestMethod\":\"dataricdsflzbkiumj\",\"requestBody\":\"dataoxedrmrazhvch\",\"additionalHeaders\":{\"ntnwzruzso\":\"datayiog\",\"lcappnvcebspci\":\"datawxcsmx\",\"mzkwhjjsqwhae\":\"datayomhkdwuwedupb\"},\"paginationRules\":{\"a\":\"datavvkxdbnmc\"}}") + .toObject(RestResourceDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RestResourceDatasetTypeProperties model = + new RestResourceDatasetTypeProperties() + .withRelativeUrl("datauwdvolxt") + .withRequestMethod("dataricdsflzbkiumj") + .withRequestBody("dataoxedrmrazhvch") + .withAdditionalHeaders( + mapOf( + "ntnwzruzso", + "datayiog", + "lcappnvcebspci", + "datawxcsmx", + "mzkwhjjsqwhae", + "datayomhkdwuwedupb")) + .withPaginationRules(mapOf("a", "datavvkxdbnmc")); + model = BinaryData.fromObject(model).toObject(RestResourceDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestSinkTests.java new file mode 100644 index 000000000000..a3a7955852bc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestSinkTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.RestSink; + +public final class RestSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RestSink model = + BinaryData + .fromString( + "{\"type\":\"RestSink\",\"requestMethod\":\"datamroadutogbkdcts\",\"additionalHeaders\":\"dataalh\",\"httpRequestTimeout\":\"dataneclphmjsqcubyjr\",\"requestInterval\":\"datalliteenah\",\"httpCompressionType\":\"datacsfttsub\",\"writeBatchSize\":\"datauhj\",\"writeBatchTimeout\":\"datadcyrbzyjhqgvtzdx\",\"sinkRetryCount\":\"datayxpkwwdkkvdevdvk\",\"sinkRetryWait\":\"dataqxj\",\"maxConcurrentConnections\":\"datadnlxeiluexvm\",\"disableMetricsCollection\":\"dataxqpsqpfxjwt\",\"\":{\"kiqtzubgdd\":\"dataqkguchdyxrjjdj\",\"yyqtjcrpaxwxlfx\":\"dataujvqzcuqculwnx\"}}") + .toObject(RestSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RestSink model = + new RestSink() + .withWriteBatchSize("datauhj") + .withWriteBatchTimeout("datadcyrbzyjhqgvtzdx") + .withSinkRetryCount("datayxpkwwdkkvdevdvk") + .withSinkRetryWait("dataqxj") + .withMaxConcurrentConnections("datadnlxeiluexvm") + .withDisableMetricsCollection("dataxqpsqpfxjwt") + .withRequestMethod("datamroadutogbkdcts") + .withAdditionalHeaders("dataalh") + .withHttpRequestTimeout("dataneclphmjsqcubyjr") + .withRequestInterval("datalliteenah") + .withHttpCompressionType("datacsfttsub"); + model = BinaryData.fromObject(model).toObject(RestSink.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestSourceTests.java new file mode 100644 index 000000000000..15b6362d83a2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RestSourceTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.RestSource; + +public final class RestSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RestSource model = + BinaryData + .fromString( + "{\"type\":\"RestSource\",\"requestMethod\":\"datatvdzidldmxf\",\"requestBody\":\"datatywb\",\"additionalHeaders\":\"datan\",\"paginationRules\":\"datadci\",\"httpRequestTimeout\":\"dataotbvflgkk\",\"requestInterval\":\"dataqhopafobpyeobr\",\"additionalColumns\":\"dataevqafdhpk\",\"sourceRetryCount\":\"dataunyro\",\"sourceRetryWait\":\"datakelow\",\"maxConcurrentConnections\":\"datarvdt\",\"disableMetricsCollection\":\"datartnqssqynupskit\",\"\":{\"dpn\":\"datahamefzzgwjoaued\",\"uknzhmza\":\"dataouylfcfgqinaokx\"}}") + .toObject(RestSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RestSource model = + new RestSource() + .withSourceRetryCount("dataunyro") + .withSourceRetryWait("datakelow") + .withMaxConcurrentConnections("datarvdt") + .withDisableMetricsCollection("datartnqssqynupskit") + .withRequestMethod("datatvdzidldmxf") + .withRequestBody("datatywb") + .withAdditionalHeaders("datan") + .withPaginationRules("datadci") + .withHttpRequestTimeout("dataotbvflgkk") + .withRequestInterval("dataqhopafobpyeobr") + .withAdditionalColumns("dataevqafdhpk"); + model = BinaryData.fromObject(model).toObject(RestSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RetryPolicyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RetryPolicyTests.java new file mode 100644 index 000000000000..40209ad5e1da --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RetryPolicyTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.RetryPolicy; +import org.junit.jupiter.api.Assertions; + +public final class RetryPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RetryPolicy model = + BinaryData + .fromString("{\"count\":\"datakdwagnyahurxtpu\",\"intervalInSeconds\":1445981696}") + .toObject(RetryPolicy.class); + Assertions.assertEquals(1445981696, model.intervalInSeconds()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RetryPolicy model = new RetryPolicy().withCount("datakdwagnyahurxtpu").withIntervalInSeconds(1445981696); + model = BinaryData.fromObject(model).toObject(RetryPolicy.class); + Assertions.assertEquals(1445981696, model.intervalInSeconds()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RunQueryFilterTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RunQueryFilterTests.java new file mode 100644 index 000000000000..3beb2c951f18 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RunQueryFilterTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.RunQueryFilter; +import com.azure.resourcemanager.datafactory.models.RunQueryFilterOperand; +import com.azure.resourcemanager.datafactory.models.RunQueryFilterOperator; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RunQueryFilterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RunQueryFilter model = + BinaryData + .fromString( + "{\"operand\":\"TriggerName\",\"operator\":\"Equals\",\"values\":[\"vewzcj\",\"nmwcpmgu\",\"adraufactkahzo\",\"ajjziuxxpshne\"]}") + .toObject(RunQueryFilter.class); + Assertions.assertEquals(RunQueryFilterOperand.TRIGGER_NAME, model.operand()); + Assertions.assertEquals(RunQueryFilterOperator.EQUALS, model.operator()); + Assertions.assertEquals("vewzcj", model.values().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RunQueryFilter model = + new RunQueryFilter() + .withOperand(RunQueryFilterOperand.TRIGGER_NAME) + .withOperator(RunQueryFilterOperator.EQUALS) + .withValues(Arrays.asList("vewzcj", "nmwcpmgu", "adraufactkahzo", "ajjziuxxpshne")); + model = BinaryData.fromObject(model).toObject(RunQueryFilter.class); + Assertions.assertEquals(RunQueryFilterOperand.TRIGGER_NAME, model.operand()); + Assertions.assertEquals(RunQueryFilterOperator.EQUALS, model.operator()); + Assertions.assertEquals("vewzcj", model.values().get(0)); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RunQueryOrderByTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RunQueryOrderByTests.java new file mode 100644 index 000000000000..dfb57c6d7f5b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/RunQueryOrderByTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.RunQueryOrder; +import com.azure.resourcemanager.datafactory.models.RunQueryOrderBy; +import com.azure.resourcemanager.datafactory.models.RunQueryOrderByField; +import org.junit.jupiter.api.Assertions; + +public final class RunQueryOrderByTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RunQueryOrderBy model = + BinaryData.fromString("{\"orderBy\":\"ActivityName\",\"order\":\"ASC\"}").toObject(RunQueryOrderBy.class); + Assertions.assertEquals(RunQueryOrderByField.ACTIVITY_NAME, model.orderBy()); + Assertions.assertEquals(RunQueryOrder.ASC, model.order()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RunQueryOrderBy model = + new RunQueryOrderBy().withOrderBy(RunQueryOrderByField.ACTIVITY_NAME).withOrder(RunQueryOrder.ASC); + model = BinaryData.fromObject(model).toObject(RunQueryOrderBy.class); + Assertions.assertEquals(RunQueryOrderByField.ACTIVITY_NAME, model.orderBy()); + Assertions.assertEquals(RunQueryOrder.ASC, model.order()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceMarketingCloudObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceMarketingCloudObjectDatasetTests.java new file mode 100644 index 000000000000..766caf73df14 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceMarketingCloudObjectDatasetTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SalesforceMarketingCloudObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SalesforceMarketingCloudObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceMarketingCloudObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"SalesforceMarketingCloudObject\",\"typeProperties\":{\"tableName\":\"dataktwomlpczlqboomz\"},\"description\":\"rolhsfddk\",\"structure\":\"datavevwxmnbw\",\"schema\":\"dataa\",\"linkedServiceName\":{\"referenceName\":\"xgnpyhtu\",\"parameters\":{\"aokex\":\"datapqild\"}},\"parameters\":{\"gtz\":{\"type\":\"String\",\"defaultValue\":\"datatkqjarlazb\"},\"oujfgtgxuupczegq\":{\"type\":\"Object\",\"defaultValue\":\"datatrm\"}},\"annotations\":[\"datadvssvg\",\"dataoggkztzttjnknpb\",\"datagzkuobclobn\",\"dataqe\"],\"folder\":{\"name\":\"liqlyugp\"},\"\":{\"yiqywlpxmli\":\"datazjmkffeonmnvmu\",\"ekbirhyvsyuv\":\"datatdegcrunbkilxs\",\"gio\":\"dataiemorszffiukltr\"}}") + .toObject(SalesforceMarketingCloudObjectDataset.class); + Assertions.assertEquals("rolhsfddk", model.description()); + Assertions.assertEquals("xgnpyhtu", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("gtz").type()); + Assertions.assertEquals("liqlyugp", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceMarketingCloudObjectDataset model = + new SalesforceMarketingCloudObjectDataset() + .withDescription("rolhsfddk") + .withStructure("datavevwxmnbw") + .withSchema("dataa") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("xgnpyhtu") + .withParameters(mapOf("aokex", "datapqild"))) + .withParameters( + mapOf( + "gtz", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datatkqjarlazb"), + "oujfgtgxuupczegq", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datatrm"))) + .withAnnotations(Arrays.asList("datadvssvg", "dataoggkztzttjnknpb", "datagzkuobclobn", "dataqe")) + .withFolder(new DatasetFolder().withName("liqlyugp")) + .withTableName("dataktwomlpczlqboomz"); + model = BinaryData.fromObject(model).toObject(SalesforceMarketingCloudObjectDataset.class); + Assertions.assertEquals("rolhsfddk", model.description()); + Assertions.assertEquals("xgnpyhtu", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("gtz").type()); + Assertions.assertEquals("liqlyugp", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceMarketingCloudSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceMarketingCloudSourceTests.java new file mode 100644 index 000000000000..2c8059f77455 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceMarketingCloudSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SalesforceMarketingCloudSource; + +public final class SalesforceMarketingCloudSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceMarketingCloudSource model = + BinaryData + .fromString( + "{\"type\":\"SalesforceMarketingCloudSource\",\"query\":\"datafarqxjoazyxmumfb\",\"queryTimeout\":\"dataxzrycvacspzj\",\"additionalColumns\":\"datayphxeoqma\",\"sourceRetryCount\":\"dataikceiyuv\",\"sourceRetryWait\":\"databbawrbqoox\",\"maxConcurrentConnections\":\"datarqlxqhqgip\",\"disableMetricsCollection\":\"datatnkngjnhxufo\",\"\":{\"pfsesi\":\"dataifijdtpedvh\"}}") + .toObject(SalesforceMarketingCloudSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceMarketingCloudSource model = + new SalesforceMarketingCloudSource() + .withSourceRetryCount("dataikceiyuv") + .withSourceRetryWait("databbawrbqoox") + .withMaxConcurrentConnections("datarqlxqhqgip") + .withDisableMetricsCollection("datatnkngjnhxufo") + .withQueryTimeout("dataxzrycvacspzj") + .withAdditionalColumns("datayphxeoqma") + .withQuery("datafarqxjoazyxmumfb"); + model = BinaryData.fromObject(model).toObject(SalesforceMarketingCloudSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceObjectDatasetTests.java new file mode 100644 index 000000000000..344a5c33c132 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceObjectDatasetTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SalesforceObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SalesforceObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"SalesforceObject\",\"typeProperties\":{\"objectApiName\":\"dataryszfhdxyfh\"},\"description\":\"hzbzhhavz\",\"structure\":\"dataxnvkdslcofuvtfue\",\"schema\":\"datauisaklhjfddxqfu\",\"linkedServiceName\":{\"referenceName\":\"subzsspmj\",\"parameters\":{\"wbztrt\":\"datalfauyvxpqwlkqd\",\"ffjdhgslormhbt\":\"dataldwvog\",\"sdylmnq\":\"datafcvxkylhc\"}},\"parameters\":{\"bgbh\":{\"type\":\"Object\",\"defaultValue\":\"databptmsgkwedwlxtzh\"},\"pkwmamrlfizjud\":{\"type\":\"SecureString\",\"defaultValue\":\"datarpjimvrrqfi\"},\"pngyhylqyafe\":{\"type\":\"String\",\"defaultValue\":\"dataih\"},\"u\":{\"type\":\"Int\",\"defaultValue\":\"dataodx\"}},\"annotations\":[\"dataxnxrqxrtzeargv\"],\"folder\":{\"name\":\"hbjhmvpjxsd\"},\"\":{\"ynepkt\":\"dataignybffqcw\",\"conyse\":\"datamwg\",\"ouoxfalo\":\"datajijfhpxni\"}}") + .toObject(SalesforceObjectDataset.class); + Assertions.assertEquals("hzbzhhavz", model.description()); + Assertions.assertEquals("subzsspmj", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("bgbh").type()); + Assertions.assertEquals("hbjhmvpjxsd", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceObjectDataset model = + new SalesforceObjectDataset() + .withDescription("hzbzhhavz") + .withStructure("dataxnvkdslcofuvtfue") + .withSchema("datauisaklhjfddxqfu") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("subzsspmj") + .withParameters( + mapOf( + "wbztrt", + "datalfauyvxpqwlkqd", + "ffjdhgslormhbt", + "dataldwvog", + "sdylmnq", + "datafcvxkylhc"))) + .withParameters( + mapOf( + "bgbh", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("databptmsgkwedwlxtzh"), + "pkwmamrlfizjud", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datarpjimvrrqfi"), + "pngyhylqyafe", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataih"), + "u", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataodx"))) + .withAnnotations(Arrays.asList("dataxnxrqxrtzeargv")) + .withFolder(new DatasetFolder().withName("hbjhmvpjxsd")) + .withObjectApiName("dataryszfhdxyfh"); + model = BinaryData.fromObject(model).toObject(SalesforceObjectDataset.class); + Assertions.assertEquals("hzbzhhavz", model.description()); + Assertions.assertEquals("subzsspmj", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("bgbh").type()); + Assertions.assertEquals("hbjhmvpjxsd", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceObjectDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceObjectDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..7d8caeb7aabe --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceObjectDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SalesforceObjectDatasetTypeProperties; + +public final class SalesforceObjectDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceObjectDatasetTypeProperties model = + BinaryData + .fromString("{\"objectApiName\":\"dataskk\"}") + .toObject(SalesforceObjectDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceObjectDatasetTypeProperties model = + new SalesforceObjectDatasetTypeProperties().withObjectApiName("dataskk"); + model = BinaryData.fromObject(model).toObject(SalesforceObjectDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudObjectDatasetTests.java new file mode 100644 index 000000000000..10f20f0f1f12 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudObjectDatasetTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SalesforceServiceCloudObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SalesforceServiceCloudObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceServiceCloudObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"SalesforceServiceCloudObject\",\"typeProperties\":{\"objectApiName\":\"datar\"},\"description\":\"nieu\",\"structure\":\"dataydlgfap\",\"schema\":\"datauubwts\",\"linkedServiceName\":{\"referenceName\":\"yn\",\"parameters\":{\"vqjmrnblihs\":\"datajfqreeo\",\"divixzhpjgqzmiao\":\"databfb\",\"ruetcnx\":\"dataweacfxaubu\",\"nowobwx\":\"dataiqzzdckhsqdrrjsu\"}},\"parameters\":{\"zheahuv\":{\"type\":\"String\",\"defaultValue\":\"datakohlsfjfouqj\"}},\"annotations\":[\"dataqkvadmjhymud\",\"datamaajzd\",\"databhsermclyqwwu\",\"datayqkaaptb\"],\"folder\":{\"name\":\"kb\"},\"\":{\"shvqnpszbeuyb\":\"datatwybloccuhplxzbn\",\"zjfjtvpey\":\"datatc\",\"jgpqfk\":\"datadyuxurxrltqmm\",\"xgwpq\":\"datanaeikczscymqf\"}}") + .toObject(SalesforceServiceCloudObjectDataset.class); + Assertions.assertEquals("nieu", model.description()); + Assertions.assertEquals("yn", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("zheahuv").type()); + Assertions.assertEquals("kb", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceServiceCloudObjectDataset model = + new SalesforceServiceCloudObjectDataset() + .withDescription("nieu") + .withStructure("dataydlgfap") + .withSchema("datauubwts") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("yn") + .withParameters( + mapOf( + "vqjmrnblihs", + "datajfqreeo", + "divixzhpjgqzmiao", + "databfb", + "ruetcnx", + "dataweacfxaubu", + "nowobwx", + "dataiqzzdckhsqdrrjsu"))) + .withParameters( + mapOf( + "zheahuv", + new ParameterSpecification() + .withType(ParameterType.STRING) + .withDefaultValue("datakohlsfjfouqj"))) + .withAnnotations(Arrays.asList("dataqkvadmjhymud", "datamaajzd", "databhsermclyqwwu", "datayqkaaptb")) + .withFolder(new DatasetFolder().withName("kb")) + .withObjectApiName("datar"); + model = BinaryData.fromObject(model).toObject(SalesforceServiceCloudObjectDataset.class); + Assertions.assertEquals("nieu", model.description()); + Assertions.assertEquals("yn", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("zheahuv").type()); + Assertions.assertEquals("kb", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudObjectDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudObjectDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..eae83ea7150c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudObjectDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SalesforceServiceCloudObjectDatasetTypeProperties; + +public final class SalesforceServiceCloudObjectDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceServiceCloudObjectDatasetTypeProperties model = + BinaryData + .fromString("{\"objectApiName\":\"dataumz\"}") + .toObject(SalesforceServiceCloudObjectDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceServiceCloudObjectDatasetTypeProperties model = + new SalesforceServiceCloudObjectDatasetTypeProperties().withObjectApiName("dataumz"); + model = BinaryData.fromObject(model).toObject(SalesforceServiceCloudObjectDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudSinkTests.java new file mode 100644 index 000000000000..98477f59b6da --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudSinkTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SalesforceServiceCloudSink; +import com.azure.resourcemanager.datafactory.models.SalesforceSinkWriteBehavior; +import org.junit.jupiter.api.Assertions; + +public final class SalesforceServiceCloudSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceServiceCloudSink model = + BinaryData + .fromString( + "{\"type\":\"SalesforceServiceCloudSink\",\"writeBehavior\":\"Insert\",\"externalIdFieldName\":\"datamaaxzcdlnvu\",\"ignoreNullValues\":\"datascbzyhtb\",\"writeBatchSize\":\"dataycacoelvoy\",\"writeBatchTimeout\":\"datamxqalqqrymjwwox\",\"sinkRetryCount\":\"dataefellhdsgo\",\"sinkRetryWait\":\"datau\",\"maxConcurrentConnections\":\"datamalthcbvuvwdp\",\"disableMetricsCollection\":\"dataphnag\",\"\":{\"ml\":\"dataaxjmnbm\",\"vlrsfmtrmod\":\"dataqatswvtddpicwnb\",\"pqrke\":\"datanxerkaiikbpfaq\",\"uaez\":\"datah\"}}") + .toObject(SalesforceServiceCloudSink.class); + Assertions.assertEquals(SalesforceSinkWriteBehavior.INSERT, model.writeBehavior()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceServiceCloudSink model = + new SalesforceServiceCloudSink() + .withWriteBatchSize("dataycacoelvoy") + .withWriteBatchTimeout("datamxqalqqrymjwwox") + .withSinkRetryCount("dataefellhdsgo") + .withSinkRetryWait("datau") + .withMaxConcurrentConnections("datamalthcbvuvwdp") + .withDisableMetricsCollection("dataphnag") + .withWriteBehavior(SalesforceSinkWriteBehavior.INSERT) + .withExternalIdFieldName("datamaaxzcdlnvu") + .withIgnoreNullValues("datascbzyhtb"); + model = BinaryData.fromObject(model).toObject(SalesforceServiceCloudSink.class); + Assertions.assertEquals(SalesforceSinkWriteBehavior.INSERT, model.writeBehavior()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudSourceTests.java new file mode 100644 index 000000000000..c3b47599df94 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceServiceCloudSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SalesforceServiceCloudSource; + +public final class SalesforceServiceCloudSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceServiceCloudSource model = + BinaryData + .fromString( + "{\"type\":\"SalesforceServiceCloudSource\",\"query\":\"dataouppgp\",\"readBehavior\":\"datamg\",\"additionalColumns\":\"datatn\",\"sourceRetryCount\":\"datanp\",\"sourceRetryWait\":\"dataxnbogxkid\",\"maxConcurrentConnections\":\"dataxbgfwwcfwlwnj\",\"disableMetricsCollection\":\"datanmop\",\"\":{\"gimviefbjes\":\"datatdru\",\"juqwn\":\"dataiyjkhjuuep\",\"pxqs\":\"datajb\",\"isdwtug\":\"dataaxvq\"}}") + .toObject(SalesforceServiceCloudSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceServiceCloudSource model = + new SalesforceServiceCloudSource() + .withSourceRetryCount("datanp") + .withSourceRetryWait("dataxnbogxkid") + .withMaxConcurrentConnections("dataxbgfwwcfwlwnj") + .withDisableMetricsCollection("datanmop") + .withQuery("dataouppgp") + .withReadBehavior("datamg") + .withAdditionalColumns("datatn"); + model = BinaryData.fromObject(model).toObject(SalesforceServiceCloudSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceSinkTests.java new file mode 100644 index 000000000000..b1a3c22d79e5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceSinkTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SalesforceSink; +import com.azure.resourcemanager.datafactory.models.SalesforceSinkWriteBehavior; +import org.junit.jupiter.api.Assertions; + +public final class SalesforceSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceSink model = + BinaryData + .fromString( + "{\"type\":\"SalesforceSink\",\"writeBehavior\":\"Upsert\",\"externalIdFieldName\":\"datagazryyjjwggpcdu\",\"ignoreNullValues\":\"dataddo\",\"writeBatchSize\":\"datacsjw\",\"writeBatchTimeout\":\"dataedzm\",\"sinkRetryCount\":\"datag\",\"sinkRetryWait\":\"datafhyhzugwk\",\"maxConcurrentConnections\":\"datamhfm\",\"disableMetricsCollection\":\"dataorvhthxcrwe\",\"\":{\"tnfdcj\":\"datadmpfmcrcelsnj\",\"wxysut\":\"dataveibntwikm\",\"dgrzkeuplorn\":\"dataofdhrifekstrmsb\"}}") + .toObject(SalesforceSink.class); + Assertions.assertEquals(SalesforceSinkWriteBehavior.UPSERT, model.writeBehavior()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceSink model = + new SalesforceSink() + .withWriteBatchSize("datacsjw") + .withWriteBatchTimeout("dataedzm") + .withSinkRetryCount("datag") + .withSinkRetryWait("datafhyhzugwk") + .withMaxConcurrentConnections("datamhfm") + .withDisableMetricsCollection("dataorvhthxcrwe") + .withWriteBehavior(SalesforceSinkWriteBehavior.UPSERT) + .withExternalIdFieldName("datagazryyjjwggpcdu") + .withIgnoreNullValues("dataddo"); + model = BinaryData.fromObject(model).toObject(SalesforceSink.class); + Assertions.assertEquals(SalesforceSinkWriteBehavior.UPSERT, model.writeBehavior()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceSourceTests.java new file mode 100644 index 000000000000..f7aa9df81f94 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SalesforceSourceTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SalesforceSource; + +public final class SalesforceSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SalesforceSource model = + BinaryData + .fromString( + "{\"type\":\"SalesforceSource\",\"query\":\"datayjm\",\"readBehavior\":\"datanymbeeyskbql\",\"queryTimeout\":\"datakles\",\"additionalColumns\":\"dataxdh\",\"sourceRetryCount\":\"datazyhphaok\",\"sourceRetryWait\":\"dataqm\",\"maxConcurrentConnections\":\"dataglkqitpbyn\",\"disableMetricsCollection\":\"datayx\",\"\":{\"gg\":\"datapoclef\",\"z\":\"datag\",\"rvswcpspaoxigp\":\"databouhmngccnkgiu\"}}") + .toObject(SalesforceSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SalesforceSource model = + new SalesforceSource() + .withSourceRetryCount("datazyhphaok") + .withSourceRetryWait("dataqm") + .withMaxConcurrentConnections("dataglkqitpbyn") + .withDisableMetricsCollection("datayx") + .withQueryTimeout("datakles") + .withAdditionalColumns("dataxdh") + .withQuery("datayjm") + .withReadBehavior("datanymbeeyskbql"); + model = BinaryData.fromObject(model).toObject(SalesforceSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapBwCubeDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapBwCubeDatasetTests.java new file mode 100644 index 000000000000..0a3e1753fc74 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapBwCubeDatasetTests.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SapBwCubeDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SapBwCubeDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapBwCubeDataset model = + BinaryData + .fromString( + "{\"type\":\"SapBwCube\",\"description\":\"efqckievyrejyo\",\"structure\":\"datakqf\",\"schema\":\"datasdwmnrtvvbuc\",\"linkedServiceName\":{\"referenceName\":\"nrovome\",\"parameters\":{\"hennmsgpywdib\":\"datasicvwqzocsf\",\"ibrbknuubxc\":\"datagvnrgalvwrhr\",\"qdvnpyeevff\":\"dataojtu\"}},\"parameters\":{\"chrtczwjcu\":{\"type\":\"Array\",\"defaultValue\":\"datatdowlxmwefcbyb\"},\"jqdjlgkuirxxeuwi\":{\"type\":\"Int\",\"defaultValue\":\"datanvy\"},\"viwxohktxagfuj\":{\"type\":\"String\",\"defaultValue\":\"datacvnfgb\"},\"asfeooq\":{\"type\":\"Object\",\"defaultValue\":\"datajnyexbvxgxqq\"}},\"annotations\":[\"datavev\",\"dataarp\",\"dataklqlii\",\"dataeanuwg\"],\"folder\":{\"name\":\"fgijydgs\"},\"\":{\"mwywhrjkejva\":\"datauymtevaeb\",\"gcphivfhrmte\":\"datadogzougxbxxgj\",\"usrjzhdtrsyfezf\":\"datafdvdoeary\"}}") + .toObject(SapBwCubeDataset.class); + Assertions.assertEquals("efqckievyrejyo", model.description()); + Assertions.assertEquals("nrovome", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("chrtczwjcu").type()); + Assertions.assertEquals("fgijydgs", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapBwCubeDataset model = + new SapBwCubeDataset() + .withDescription("efqckievyrejyo") + .withStructure("datakqf") + .withSchema("datasdwmnrtvvbuc") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("nrovome") + .withParameters( + mapOf( + "hennmsgpywdib", + "datasicvwqzocsf", + "ibrbknuubxc", + "datagvnrgalvwrhr", + "qdvnpyeevff", + "dataojtu"))) + .withParameters( + mapOf( + "chrtczwjcu", + new ParameterSpecification() + .withType(ParameterType.ARRAY) + .withDefaultValue("datatdowlxmwefcbyb"), + "jqdjlgkuirxxeuwi", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datanvy"), + "viwxohktxagfuj", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datacvnfgb"), + "asfeooq", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("datajnyexbvxgxqq"))) + .withAnnotations(Arrays.asList("datavev", "dataarp", "dataklqlii", "dataeanuwg")) + .withFolder(new DatasetFolder().withName("fgijydgs")); + model = BinaryData.fromObject(model).toObject(SapBwCubeDataset.class); + Assertions.assertEquals("efqckievyrejyo", model.description()); + Assertions.assertEquals("nrovome", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("chrtczwjcu").type()); + Assertions.assertEquals("fgijydgs", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapBwSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapBwSourceTests.java new file mode 100644 index 000000000000..cf40b8fedd2e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapBwSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapBwSource; + +public final class SapBwSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapBwSource model = + BinaryData + .fromString( + "{\"type\":\"SapBwSource\",\"query\":\"datajthmibqgld\",\"queryTimeout\":\"datatkalp\",\"additionalColumns\":\"datanny\",\"sourceRetryCount\":\"datajea\",\"sourceRetryWait\":\"datalewlwbxufq\",\"maxConcurrentConnections\":\"datakkvij\",\"disableMetricsCollection\":\"dataf\",\"\":{\"aqoaopzqpf\":\"datadzowdqvqfl\",\"ee\":\"datanjdyoxform\"}}") + .toObject(SapBwSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapBwSource model = + new SapBwSource() + .withSourceRetryCount("datajea") + .withSourceRetryWait("datalewlwbxufq") + .withMaxConcurrentConnections("datakkvij") + .withDisableMetricsCollection("dataf") + .withQueryTimeout("datatkalp") + .withAdditionalColumns("datanny") + .withQuery("datajthmibqgld"); + model = BinaryData.fromObject(model).toObject(SapBwSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerResourceDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerResourceDatasetTests.java new file mode 100644 index 000000000000..1e3ef6305cc0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerResourceDatasetTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SapCloudForCustomerResourceDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SapCloudForCustomerResourceDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapCloudForCustomerResourceDataset model = + BinaryData + .fromString( + "{\"type\":\"SapCloudForCustomerResource\",\"typeProperties\":{\"path\":\"datamy\"},\"description\":\"dzyyrwnmwtqil\",\"structure\":\"datannkynkstd\",\"schema\":\"datawhjfp\",\"linkedServiceName\":{\"referenceName\":\"fxaqjyihjcwwv\",\"parameters\":{\"spwweifdyfa\":\"datackfavhkh\",\"a\":\"dataexnguwnrdpuz\"}},\"parameters\":{\"bszam\":{\"type\":\"Array\",\"defaultValue\":\"datatgg\"},\"lrnhhjtvhqsz\":{\"type\":\"SecureString\",\"defaultValue\":\"dataejpdcliqwzutiy\"}},\"annotations\":[\"dataovqmqcudptoqwr\",\"datafckjthlokmx\",\"dataawfubkngejjxu\",\"dataowynj\"],\"folder\":{\"name\":\"zmxuktdrsjtmnk\"},\"\":{\"nuhcfhepisq\":\"datauwfzcfdtstiaxty\"}}") + .toObject(SapCloudForCustomerResourceDataset.class); + Assertions.assertEquals("dzyyrwnmwtqil", model.description()); + Assertions.assertEquals("fxaqjyihjcwwv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("bszam").type()); + Assertions.assertEquals("zmxuktdrsjtmnk", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapCloudForCustomerResourceDataset model = + new SapCloudForCustomerResourceDataset() + .withDescription("dzyyrwnmwtqil") + .withStructure("datannkynkstd") + .withSchema("datawhjfp") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("fxaqjyihjcwwv") + .withParameters(mapOf("spwweifdyfa", "datackfavhkh", "a", "dataexnguwnrdpuz"))) + .withParameters( + mapOf( + "bszam", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datatgg"), + "lrnhhjtvhqsz", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("dataejpdcliqwzutiy"))) + .withAnnotations( + Arrays.asList("dataovqmqcudptoqwr", "datafckjthlokmx", "dataawfubkngejjxu", "dataowynj")) + .withFolder(new DatasetFolder().withName("zmxuktdrsjtmnk")) + .withPath("datamy"); + model = BinaryData.fromObject(model).toObject(SapCloudForCustomerResourceDataset.class); + Assertions.assertEquals("dzyyrwnmwtqil", model.description()); + Assertions.assertEquals("fxaqjyihjcwwv", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("bszam").type()); + Assertions.assertEquals("zmxuktdrsjtmnk", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerResourceDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerResourceDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..5d6bf94c3e39 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerResourceDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SapCloudForCustomerResourceDatasetTypeProperties; + +public final class SapCloudForCustomerResourceDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapCloudForCustomerResourceDatasetTypeProperties model = + BinaryData + .fromString("{\"path\":\"datacmlroiommemso\"}") + .toObject(SapCloudForCustomerResourceDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapCloudForCustomerResourceDatasetTypeProperties model = + new SapCloudForCustomerResourceDatasetTypeProperties().withPath("datacmlroiommemso"); + model = BinaryData.fromObject(model).toObject(SapCloudForCustomerResourceDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerSinkTests.java new file mode 100644 index 000000000000..945268a4907f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerSinkTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapCloudForCustomerSink; +import com.azure.resourcemanager.datafactory.models.SapCloudForCustomerSinkWriteBehavior; +import org.junit.jupiter.api.Assertions; + +public final class SapCloudForCustomerSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapCloudForCustomerSink model = + BinaryData + .fromString( + "{\"type\":\"SapCloudForCustomerSink\",\"writeBehavior\":\"Insert\",\"httpRequestTimeout\":\"dataqaviqs\",\"writeBatchSize\":\"datalw\",\"writeBatchTimeout\":\"datarc\",\"sinkRetryCount\":\"dataccnwmdpbsotknhfx\",\"sinkRetryWait\":\"dataeruuc\",\"maxConcurrentConnections\":\"datazwraqapt\",\"disableMetricsCollection\":\"datarnlyuyopw\",\"\":{\"cxeosylgjpp\":\"dataoubwbssvfzjjf\"}}") + .toObject(SapCloudForCustomerSink.class); + Assertions.assertEquals(SapCloudForCustomerSinkWriteBehavior.INSERT, model.writeBehavior()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapCloudForCustomerSink model = + new SapCloudForCustomerSink() + .withWriteBatchSize("datalw") + .withWriteBatchTimeout("datarc") + .withSinkRetryCount("dataccnwmdpbsotknhfx") + .withSinkRetryWait("dataeruuc") + .withMaxConcurrentConnections("datazwraqapt") + .withDisableMetricsCollection("datarnlyuyopw") + .withWriteBehavior(SapCloudForCustomerSinkWriteBehavior.INSERT) + .withHttpRequestTimeout("dataqaviqs"); + model = BinaryData.fromObject(model).toObject(SapCloudForCustomerSink.class); + Assertions.assertEquals(SapCloudForCustomerSinkWriteBehavior.INSERT, model.writeBehavior()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerSourceTests.java new file mode 100644 index 000000000000..4aa24f26ea24 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapCloudForCustomerSourceTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapCloudForCustomerSource; + +public final class SapCloudForCustomerSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapCloudForCustomerSource model = + BinaryData + .fromString( + "{\"type\":\"SapCloudForCustomerSource\",\"query\":\"dataxup\",\"httpRequestTimeout\":\"datagcbwiw\",\"queryTimeout\":\"datajoxxllhkzunnw\",\"additionalColumns\":\"datawxyawxkdvev\",\"sourceRetryCount\":\"datauuihapcqmcvur\",\"sourceRetryWait\":\"dataubljnizwztlcrxfi\",\"maxConcurrentConnections\":\"datafgxn\",\"disableMetricsCollection\":\"datarmficqrdervtru\",\"\":{\"xb\":\"datarmrtcsmpmhl\"}}") + .toObject(SapCloudForCustomerSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapCloudForCustomerSource model = + new SapCloudForCustomerSource() + .withSourceRetryCount("datauuihapcqmcvur") + .withSourceRetryWait("dataubljnizwztlcrxfi") + .withMaxConcurrentConnections("datafgxn") + .withDisableMetricsCollection("datarmficqrdervtru") + .withQueryTimeout("datajoxxllhkzunnw") + .withAdditionalColumns("datawxyawxkdvev") + .withQuery("dataxup") + .withHttpRequestTimeout("datagcbwiw"); + model = BinaryData.fromObject(model).toObject(SapCloudForCustomerSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapEccResourceDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapEccResourceDatasetTests.java new file mode 100644 index 000000000000..caa60c27b06a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapEccResourceDatasetTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SapEccResourceDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SapEccResourceDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapEccResourceDataset model = + BinaryData + .fromString( + "{\"type\":\"SapEccResource\",\"typeProperties\":{\"path\":\"datagblcyeqdobobaq\"},\"description\":\"bebckce\",\"structure\":\"datasixwnlpjcxbjgf\",\"schema\":\"dataqyyfrridzfpsfyak\",\"linkedServiceName\":{\"referenceName\":\"dfhmlx\",\"parameters\":{\"mkqafzvptriy\":\"dataekn\",\"dvvoydwedggwgcl\":\"datajrgtruwpuqpsrce\",\"drjbjngoars\":\"databwatz\"}},\"parameters\":{\"rqw\":{\"type\":\"Float\",\"defaultValue\":\"dataemzcyniapypimrx\"},\"stuinytkmlfupjzc\":{\"type\":\"Object\",\"defaultValue\":\"datae\"},\"yxjg\":{\"type\":\"Array\",\"defaultValue\":\"datazj\"}},\"annotations\":[\"datauerrdaktnytkbc\",\"datarfcvcp\"],\"folder\":{\"name\":\"j\"},\"\":{\"vlhnhhcikhleb\":\"datapw\",\"giflr\":\"datajgylsac\"}}") + .toObject(SapEccResourceDataset.class); + Assertions.assertEquals("bebckce", model.description()); + Assertions.assertEquals("dfhmlx", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("rqw").type()); + Assertions.assertEquals("j", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapEccResourceDataset model = + new SapEccResourceDataset() + .withDescription("bebckce") + .withStructure("datasixwnlpjcxbjgf") + .withSchema("dataqyyfrridzfpsfyak") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("dfhmlx") + .withParameters( + mapOf( + "mkqafzvptriy", + "dataekn", + "dvvoydwedggwgcl", + "datajrgtruwpuqpsrce", + "drjbjngoars", + "databwatz"))) + .withParameters( + mapOf( + "rqw", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("dataemzcyniapypimrx"), + "stuinytkmlfupjzc", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datae"), + "yxjg", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datazj"))) + .withAnnotations(Arrays.asList("datauerrdaktnytkbc", "datarfcvcp")) + .withFolder(new DatasetFolder().withName("j")) + .withPath("datagblcyeqdobobaq"); + model = BinaryData.fromObject(model).toObject(SapEccResourceDataset.class); + Assertions.assertEquals("bebckce", model.description()); + Assertions.assertEquals("dfhmlx", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("rqw").type()); + Assertions.assertEquals("j", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapEccResourceDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapEccResourceDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..9b9228f0859a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapEccResourceDatasetTypePropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SapEccResourceDatasetTypeProperties; + +public final class SapEccResourceDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapEccResourceDatasetTypeProperties model = + BinaryData.fromString("{\"path\":\"dataygotoh\"}").toObject(SapEccResourceDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapEccResourceDatasetTypeProperties model = new SapEccResourceDatasetTypeProperties().withPath("dataygotoh"); + model = BinaryData.fromObject(model).toObject(SapEccResourceDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapEccSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapEccSourceTests.java new file mode 100644 index 000000000000..ca7b01e69c2a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapEccSourceTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapEccSource; + +public final class SapEccSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapEccSource model = + BinaryData + .fromString( + "{\"type\":\"SapEccSource\",\"query\":\"datacgcdfelvap\",\"httpRequestTimeout\":\"databicjzntiblxeygo\",\"queryTimeout\":\"datahroi\",\"additionalColumns\":\"datatg\",\"sourceRetryCount\":\"dataymoanpkcmdixiu\",\"sourceRetryWait\":\"databc\",\"maxConcurrentConnections\":\"datagspzoafprzlvho\",\"disableMetricsCollection\":\"datakc\",\"\":{\"e\":\"datadzposmnmky\",\"avxea\":\"datamuueoxmkru\",\"pjaekbwbxvsyt\":\"datamflchwpfunptsr\"}}") + .toObject(SapEccSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapEccSource model = + new SapEccSource() + .withSourceRetryCount("dataymoanpkcmdixiu") + .withSourceRetryWait("databc") + .withMaxConcurrentConnections("datagspzoafprzlvho") + .withDisableMetricsCollection("datakc") + .withQueryTimeout("datahroi") + .withAdditionalColumns("datatg") + .withQuery("datacgcdfelvap") + .withHttpRequestTimeout("databicjzntiblxeygo"); + model = BinaryData.fromObject(model).toObject(SapEccSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaPartitionSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaPartitionSettingsTests.java new file mode 100644 index 000000000000..1d1fd8711aa5 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaPartitionSettingsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapHanaPartitionSettings; + +public final class SapHanaPartitionSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapHanaPartitionSettings model = + BinaryData + .fromString("{\"partitionColumnName\":\"datarelokxklgluareg\"}") + .toObject(SapHanaPartitionSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapHanaPartitionSettings model = new SapHanaPartitionSettings().withPartitionColumnName("datarelokxklgluareg"); + model = BinaryData.fromObject(model).toObject(SapHanaPartitionSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaSourceTests.java new file mode 100644 index 000000000000..063189ded1e0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaSourceTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapHanaPartitionSettings; +import com.azure.resourcemanager.datafactory.models.SapHanaSource; + +public final class SapHanaSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapHanaSource model = + BinaryData + .fromString( + "{\"type\":\"SapHanaSource\",\"query\":\"datacjubaddlmjquli\",\"packetSize\":\"datarc\",\"partitionOption\":\"datathluzey\",\"partitionSettings\":{\"partitionColumnName\":\"dataezkyfy\"},\"queryTimeout\":\"datanreasuwepqegty\",\"additionalColumns\":\"datayc\",\"sourceRetryCount\":\"dataufutfqffw\",\"sourceRetryWait\":\"datajgjrykshiz\",\"maxConcurrentConnections\":\"datasw\",\"disableMetricsCollection\":\"dataye\",\"\":{\"meftlgjrfkqf\":\"datakzwqzwsguipqq\"}}") + .toObject(SapHanaSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapHanaSource model = + new SapHanaSource() + .withSourceRetryCount("dataufutfqffw") + .withSourceRetryWait("datajgjrykshiz") + .withMaxConcurrentConnections("datasw") + .withDisableMetricsCollection("dataye") + .withQueryTimeout("datanreasuwepqegty") + .withAdditionalColumns("datayc") + .withQuery("datacjubaddlmjquli") + .withPacketSize("datarc") + .withPartitionOption("datathluzey") + .withPartitionSettings(new SapHanaPartitionSettings().withPartitionColumnName("dataezkyfy")); + model = BinaryData.fromObject(model).toObject(SapHanaSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaTableDatasetTests.java new file mode 100644 index 000000000000..fa75c5432c89 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaTableDatasetTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SapHanaTableDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SapHanaTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapHanaTableDataset model = + BinaryData + .fromString( + "{\"type\":\"SapHanaTable\",\"typeProperties\":{\"schema\":\"dataoidhbxitrapwzhlu\",\"table\":\"datasj\"},\"description\":\"l\",\"structure\":\"dataiemv\",\"schema\":\"datameakosy\",\"linkedServiceName\":{\"referenceName\":\"ycvldeehcbsaip\",\"parameters\":{\"vsluazzxfjv\":\"dataofkegbvbbdledffl\",\"scboxra\":\"dataugpxzeempup\"}},\"parameters\":{\"fdr\":{\"type\":\"Float\",\"defaultValue\":\"datarjgobekxeheowsec\"},\"seesacuicnvq\":{\"type\":\"Int\",\"defaultValue\":\"dataskiwrjsbdb\"},\"vmrfaptndrmmn\":{\"type\":\"Array\",\"defaultValue\":\"datau\"}},\"annotations\":[\"datak\",\"dataxrqkekcdavi\",\"dataebeqrfza\",\"dataqymcwt\"],\"folder\":{\"name\":\"ceplbrzgkuorwpq\"},\"\":{\"ykk\":\"dataweobptscr\",\"sbnlyoifgdfzjqth\":\"dataelayynoyjyfls\",\"kxxlwwo\":\"datakcvoevcwfzo\",\"ubdmg\":\"dataxgbsdzcgcvypj\"}}") + .toObject(SapHanaTableDataset.class); + Assertions.assertEquals("l", model.description()); + Assertions.assertEquals("ycvldeehcbsaip", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("fdr").type()); + Assertions.assertEquals("ceplbrzgkuorwpq", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapHanaTableDataset model = + new SapHanaTableDataset() + .withDescription("l") + .withStructure("dataiemv") + .withSchema("datameakosy") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ycvldeehcbsaip") + .withParameters(mapOf("vsluazzxfjv", "dataofkegbvbbdledffl", "scboxra", "dataugpxzeempup"))) + .withParameters( + mapOf( + "fdr", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datarjgobekxeheowsec"), + "seesacuicnvq", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataskiwrjsbdb"), + "vmrfaptndrmmn", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datau"))) + .withAnnotations(Arrays.asList("datak", "dataxrqkekcdavi", "dataebeqrfza", "dataqymcwt")) + .withFolder(new DatasetFolder().withName("ceplbrzgkuorwpq")) + .withSchemaTypePropertiesSchema("dataoidhbxitrapwzhlu") + .withTable("datasj"); + model = BinaryData.fromObject(model).toObject(SapHanaTableDataset.class); + Assertions.assertEquals("l", model.description()); + Assertions.assertEquals("ycvldeehcbsaip", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("fdr").type()); + Assertions.assertEquals("ceplbrzgkuorwpq", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..a4004e163d7d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapHanaTableDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SapHanaTableDatasetTypeProperties; + +public final class SapHanaTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapHanaTableDatasetTypeProperties model = + BinaryData + .fromString("{\"schema\":\"dataxehujcqgzwv\",\"table\":\"dataiuaoibmjklqrljd\"}") + .toObject(SapHanaTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapHanaTableDatasetTypeProperties model = + new SapHanaTableDatasetTypeProperties().withSchema("dataxehujcqgzwv").withTable("dataiuaoibmjklqrljd"); + model = BinaryData.fromObject(model).toObject(SapHanaTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOdpResourceDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOdpResourceDatasetTests.java new file mode 100644 index 000000000000..53313d1b9587 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOdpResourceDatasetTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SapOdpResourceDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SapOdpResourceDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapOdpResourceDataset model = + BinaryData + .fromString( + "{\"type\":\"SapOdpResource\",\"typeProperties\":{\"context\":\"datadwrgavtfyzse\",\"objectName\":\"dataf\"},\"description\":\"ukryxpi\",\"structure\":\"dataapeakfdmcedl\",\"schema\":\"datalxkyoddoq\",\"linkedServiceName\":{\"referenceName\":\"a\",\"parameters\":{\"whqy\":\"datarki\",\"fqeqf\":\"datagqmndkrwwmurhv\",\"lwgebylpzjeldaqw\":\"datarnacki\"}},\"parameters\":{\"potnpkbvzpkod\":{\"type\":\"Array\",\"defaultValue\":\"datanijhwcbrds\"},\"dxuczl\":{\"type\":\"Float\",\"defaultValue\":\"datanqdjgsbtwgn\"},\"iiuv\":{\"type\":\"Int\",\"defaultValue\":\"dataqycznrir\"}},\"annotations\":[\"dataqkqwucqsdgb\"],\"folder\":{\"name\":\"tvmijccpk\"},\"\":{\"ihtnnlbhxjppcbqe\":\"dataamyvwprjm\",\"zayjwdu\":\"datafzfppvo\",\"prklatwiuujxsuj\":\"datajh\",\"pc\":\"datarwgxeegxbnjnczep\"}}") + .toObject(SapOdpResourceDataset.class); + Assertions.assertEquals("ukryxpi", model.description()); + Assertions.assertEquals("a", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("potnpkbvzpkod").type()); + Assertions.assertEquals("tvmijccpk", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapOdpResourceDataset model = + new SapOdpResourceDataset() + .withDescription("ukryxpi") + .withStructure("dataapeakfdmcedl") + .withSchema("datalxkyoddoq") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("a") + .withParameters( + mapOf("whqy", "datarki", "fqeqf", "datagqmndkrwwmurhv", "lwgebylpzjeldaqw", "datarnacki"))) + .withParameters( + mapOf( + "potnpkbvzpkod", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datanijhwcbrds"), + "dxuczl", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datanqdjgsbtwgn"), + "iiuv", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("dataqycznrir"))) + .withAnnotations(Arrays.asList("dataqkqwucqsdgb")) + .withFolder(new DatasetFolder().withName("tvmijccpk")) + .withContext("datadwrgavtfyzse") + .withObjectName("dataf"); + model = BinaryData.fromObject(model).toObject(SapOdpResourceDataset.class); + Assertions.assertEquals("ukryxpi", model.description()); + Assertions.assertEquals("a", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("potnpkbvzpkod").type()); + Assertions.assertEquals("tvmijccpk", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOdpResourceDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOdpResourceDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..ec84a2798bc8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOdpResourceDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SapOdpResourceDatasetTypeProperties; + +public final class SapOdpResourceDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapOdpResourceDatasetTypeProperties model = + BinaryData + .fromString("{\"context\":\"datamgbf\",\"objectName\":\"datadquyyaes\"}") + .toObject(SapOdpResourceDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapOdpResourceDatasetTypeProperties model = + new SapOdpResourceDatasetTypeProperties().withContext("datamgbf").withObjectName("datadquyyaes"); + model = BinaryData.fromObject(model).toObject(SapOdpResourceDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOdpSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOdpSourceTests.java new file mode 100644 index 000000000000..8848528aa389 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOdpSourceTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapOdpSource; + +public final class SapOdpSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapOdpSource model = + BinaryData + .fromString( + "{\"type\":\"SapOdpSource\",\"extractionMode\":\"datalug\",\"subscriberProcess\":\"datau\",\"selection\":\"dataypliotgtlan\",\"projection\":\"datakvlxsycqqdoxooxu\",\"queryTimeout\":\"datafqoobwxctkveq\",\"additionalColumns\":\"dataedw\",\"sourceRetryCount\":\"dataqcjreryp\",\"sourceRetryWait\":\"datayqxeyzqnupsi\",\"maxConcurrentConnections\":\"datalxvaovssibnv\",\"disableMetricsCollection\":\"datavi\",\"\":{\"iyo\":\"databmzwlej\",\"xzdbntop\":\"datanbualr\",\"lgsxkyboysquyg\":\"dataabndwcfmzmqmg\",\"stwcyigrhfevxy\":\"datakh\"}}") + .toObject(SapOdpSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapOdpSource model = + new SapOdpSource() + .withSourceRetryCount("dataqcjreryp") + .withSourceRetryWait("datayqxeyzqnupsi") + .withMaxConcurrentConnections("datalxvaovssibnv") + .withDisableMetricsCollection("datavi") + .withQueryTimeout("datafqoobwxctkveq") + .withAdditionalColumns("dataedw") + .withExtractionMode("datalug") + .withSubscriberProcess("datau") + .withSelection("dataypliotgtlan") + .withProjection("datakvlxsycqqdoxooxu"); + model = BinaryData.fromObject(model).toObject(SapOdpSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOpenHubSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOpenHubSourceTests.java new file mode 100644 index 000000000000..7b8628f61167 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOpenHubSourceTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapOpenHubSource; + +public final class SapOpenHubSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapOpenHubSource model = + BinaryData + .fromString( + "{\"type\":\"SapOpenHubSource\",\"excludeLastRequest\":\"datay\",\"baseRequestId\":\"dataoisbmv\",\"customRfcReadTableFunctionModule\":\"dataenrcqickhvps\",\"sapDataColumnDelimiter\":\"datauiuvingmonq\",\"queryTimeout\":\"datatyuqdz\",\"additionalColumns\":\"dataojz\",\"sourceRetryCount\":\"dataykfjga\",\"sourceRetryWait\":\"datayscky\",\"maxConcurrentConnections\":\"datayj\",\"disableMetricsCollection\":\"datamfwrqzizggvmuotc\",\"\":{\"rlt\":\"databfyjampvwxlkh\",\"yw\":\"dataipmnqrbyq\",\"wgylolvxw\":\"databowcjkarggvyu\"}}") + .toObject(SapOpenHubSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapOpenHubSource model = + new SapOpenHubSource() + .withSourceRetryCount("dataykfjga") + .withSourceRetryWait("datayscky") + .withMaxConcurrentConnections("datayj") + .withDisableMetricsCollection("datamfwrqzizggvmuotc") + .withQueryTimeout("datatyuqdz") + .withAdditionalColumns("dataojz") + .withExcludeLastRequest("datay") + .withBaseRequestId("dataoisbmv") + .withCustomRfcReadTableFunctionModule("dataenrcqickhvps") + .withSapDataColumnDelimiter("datauiuvingmonq"); + model = BinaryData.fromObject(model).toObject(SapOpenHubSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOpenHubTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOpenHubTableDatasetTests.java new file mode 100644 index 000000000000..1a9fd7595828 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOpenHubTableDatasetTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SapOpenHubTableDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SapOpenHubTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapOpenHubTableDataset model = + BinaryData + .fromString( + "{\"type\":\"SapOpenHubTable\",\"typeProperties\":{\"openHubDestinationName\":\"datauky\",\"excludeLastRequest\":\"dataxrjiqoqovqhg\",\"baseRequestId\":\"datagxuwudgcyqru\"},\"description\":\"mryddnqivahfcq\",\"structure\":\"datajzebp\",\"schema\":\"dataciyoypoedk\",\"linkedServiceName\":{\"referenceName\":\"pwwibpybqeig\",\"parameters\":{\"nhcgn\":\"dataxsxteuikhznff\"}},\"parameters\":{\"rkrgsdc\":{\"type\":\"SecureString\",\"defaultValue\":\"datarfqd\"},\"zfutgpbygbnb\":{\"type\":\"Int\",\"defaultValue\":\"datamgqlwyqznbbyzpo\"},\"ewflwzhxzuxe\":{\"type\":\"Array\",\"defaultValue\":\"dataiqgtzpv\"},\"ajdqxymxx\":{\"type\":\"Float\",\"defaultValue\":\"dataywlrkqsqvvdkfpfj\"}},\"annotations\":[\"datadjidcetfvgwfws\",\"datadigwoup\"],\"folder\":{\"name\":\"ddqsvclrsnxfrp\"},\"\":{\"tfxxepzpxzxlcqz\":\"dataqclmd\",\"jbsmkirpqni\":\"dataxaitiqm\",\"uzltenlb\":\"dataudmhkcomeobwk\",\"uomtxj\":\"dataxlmxozesndo\"}}") + .toObject(SapOpenHubTableDataset.class); + Assertions.assertEquals("mryddnqivahfcq", model.description()); + Assertions.assertEquals("pwwibpybqeig", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("rkrgsdc").type()); + Assertions.assertEquals("ddqsvclrsnxfrp", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapOpenHubTableDataset model = + new SapOpenHubTableDataset() + .withDescription("mryddnqivahfcq") + .withStructure("datajzebp") + .withSchema("dataciyoypoedk") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("pwwibpybqeig") + .withParameters(mapOf("nhcgn", "dataxsxteuikhznff"))) + .withParameters( + mapOf( + "rkrgsdc", + new ParameterSpecification().withType(ParameterType.SECURE_STRING).withDefaultValue("datarfqd"), + "zfutgpbygbnb", + new ParameterSpecification() + .withType(ParameterType.INT) + .withDefaultValue("datamgqlwyqznbbyzpo"), + "ewflwzhxzuxe", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("dataiqgtzpv"), + "ajdqxymxx", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("dataywlrkqsqvvdkfpfj"))) + .withAnnotations(Arrays.asList("datadjidcetfvgwfws", "datadigwoup")) + .withFolder(new DatasetFolder().withName("ddqsvclrsnxfrp")) + .withOpenHubDestinationName("datauky") + .withExcludeLastRequest("dataxrjiqoqovqhg") + .withBaseRequestId("datagxuwudgcyqru"); + model = BinaryData.fromObject(model).toObject(SapOpenHubTableDataset.class); + Assertions.assertEquals("mryddnqivahfcq", model.description()); + Assertions.assertEquals("pwwibpybqeig", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("rkrgsdc").type()); + Assertions.assertEquals("ddqsvclrsnxfrp", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOpenHubTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOpenHubTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..d8d737fcc7ec --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapOpenHubTableDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SapOpenHubTableDatasetTypeProperties; + +public final class SapOpenHubTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapOpenHubTableDatasetTypeProperties model = + BinaryData + .fromString( + "{\"openHubDestinationName\":\"datari\",\"excludeLastRequest\":\"datamckik\",\"baseRequestId\":\"datayvurhwishy\"}") + .toObject(SapOpenHubTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapOpenHubTableDatasetTypeProperties model = + new SapOpenHubTableDatasetTypeProperties() + .withOpenHubDestinationName("datari") + .withExcludeLastRequest("datamckik") + .withBaseRequestId("datayvurhwishy"); + model = BinaryData.fromObject(model).toObject(SapOpenHubTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTablePartitionSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTablePartitionSettingsTests.java new file mode 100644 index 000000000000..1717b70ec736 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTablePartitionSettingsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapTablePartitionSettings; + +public final class SapTablePartitionSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapTablePartitionSettings model = + BinaryData + .fromString( + "{\"partitionColumnName\":\"datada\",\"partitionUpperBound\":\"datahtwhh\",\"partitionLowerBound\":\"databomf\",\"maxPartitionsNumber\":\"datajkerdujfnb\"}") + .toObject(SapTablePartitionSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapTablePartitionSettings model = + new SapTablePartitionSettings() + .withPartitionColumnName("datada") + .withPartitionUpperBound("datahtwhh") + .withPartitionLowerBound("databomf") + .withMaxPartitionsNumber("datajkerdujfnb"); + model = BinaryData.fromObject(model).toObject(SapTablePartitionSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTableResourceDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTableResourceDatasetTests.java new file mode 100644 index 000000000000..c2aff588161d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTableResourceDatasetTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SapTableResourceDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SapTableResourceDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapTableResourceDataset model = + BinaryData + .fromString( + "{\"type\":\"SapTableResource\",\"typeProperties\":{\"tableName\":\"dataycdzdob\"},\"description\":\"sdyvfxnzpfd\",\"structure\":\"datapk\",\"schema\":\"datapdpsegiv\",\"linkedServiceName\":{\"referenceName\":\"tabvbbkflewgsl\",\"parameters\":{\"vedwuu\":\"datab\",\"wclykcr\":\"databmenxcqs\",\"bnjrevmpted\":\"datadek\",\"shnfiygpgpkkhp\":\"datauent\"}},\"parameters\":{\"ihnmtrdlpxiwwg\":{\"type\":\"Float\",\"defaultValue\":\"dataql\"},\"fivxdifb\":{\"type\":\"Float\",\"defaultValue\":\"datavfpnrzikvoxloeoh\"}},\"annotations\":[\"dataijhpxukxgoyxontb\",\"datadqrxro\",\"datauqr\"],\"folder\":{\"name\":\"xfuaefewx\"},\"\":{\"mdcizhvk\":\"datatwjrppifeyrqvel\",\"pzwyncwksmpyeyzo\":\"databojklw\",\"uduiqoom\":\"databfnflytf\",\"opwsnliyznghuq\":\"dataswkq\"}}") + .toObject(SapTableResourceDataset.class); + Assertions.assertEquals("sdyvfxnzpfd", model.description()); + Assertions.assertEquals("tabvbbkflewgsl", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("ihnmtrdlpxiwwg").type()); + Assertions.assertEquals("xfuaefewx", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapTableResourceDataset model = + new SapTableResourceDataset() + .withDescription("sdyvfxnzpfd") + .withStructure("datapk") + .withSchema("datapdpsegiv") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("tabvbbkflewgsl") + .withParameters( + mapOf( + "vedwuu", + "datab", + "wclykcr", + "databmenxcqs", + "bnjrevmpted", + "datadek", + "shnfiygpgpkkhp", + "datauent"))) + .withParameters( + mapOf( + "ihnmtrdlpxiwwg", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("dataql"), + "fivxdifb", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datavfpnrzikvoxloeoh"))) + .withAnnotations(Arrays.asList("dataijhpxukxgoyxontb", "datadqrxro", "datauqr")) + .withFolder(new DatasetFolder().withName("xfuaefewx")) + .withTableName("dataycdzdob"); + model = BinaryData.fromObject(model).toObject(SapTableResourceDataset.class); + Assertions.assertEquals("sdyvfxnzpfd", model.description()); + Assertions.assertEquals("tabvbbkflewgsl", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("ihnmtrdlpxiwwg").type()); + Assertions.assertEquals("xfuaefewx", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTableResourceDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTableResourceDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..813c5bf691b3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTableResourceDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SapTableResourceDatasetTypeProperties; + +public final class SapTableResourceDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapTableResourceDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"datagpdglkf\"}") + .toObject(SapTableResourceDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapTableResourceDatasetTypeProperties model = + new SapTableResourceDatasetTypeProperties().withTableName("datagpdglkf"); + model = BinaryData.fromObject(model).toObject(SapTableResourceDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTableSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTableSourceTests.java new file mode 100644 index 000000000000..bcf536de3c21 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SapTableSourceTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SapTablePartitionSettings; +import com.azure.resourcemanager.datafactory.models.SapTableSource; + +public final class SapTableSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SapTableSource model = + BinaryData + .fromString( + "{\"type\":\"SapTableSource\",\"rowCount\":\"dataukcojyx\",\"rowSkips\":\"datavoowrtcsucot\",\"rfcTableFields\":\"datayiqz\",\"rfcTableOptions\":\"dataxzvjnmpv\",\"batchSize\":\"dataludfbhzu\",\"customRfcReadTableFunctionModule\":\"datapfbhihddiiuex\",\"sapDataColumnDelimiter\":\"datayfku\",\"partitionOption\":\"datalq\",\"partitionSettings\":{\"partitionColumnName\":\"datardpw\",\"partitionUpperBound\":\"datalvfisk\",\"partitionLowerBound\":\"datasp\",\"maxPartitionsNumber\":\"datasxnyo\"},\"queryTimeout\":\"datapcssusdrgzmmrz\",\"additionalColumns\":\"dataibtkcvolaxnukgo\",\"sourceRetryCount\":\"datau\",\"sourceRetryWait\":\"datadcqoxyxiyhmj\",\"maxConcurrentConnections\":\"datanw\",\"disableMetricsCollection\":\"datazgvaeqiygbo\",\"\":{\"laj\":\"datajodidgudar\",\"ojikffczwaewp\":\"dataenfyuuf\",\"wfnapgagvhsix\":\"datalsuhsghdovcp\"}}") + .toObject(SapTableSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SapTableSource model = + new SapTableSource() + .withSourceRetryCount("datau") + .withSourceRetryWait("datadcqoxyxiyhmj") + .withMaxConcurrentConnections("datanw") + .withDisableMetricsCollection("datazgvaeqiygbo") + .withQueryTimeout("datapcssusdrgzmmrz") + .withAdditionalColumns("dataibtkcvolaxnukgo") + .withRowCount("dataukcojyx") + .withRowSkips("datavoowrtcsucot") + .withRfcTableFields("datayiqz") + .withRfcTableOptions("dataxzvjnmpv") + .withBatchSize("dataludfbhzu") + .withCustomRfcReadTableFunctionModule("datapfbhihddiiuex") + .withSapDataColumnDelimiter("datayfku") + .withPartitionOption("datalq") + .withPartitionSettings( + new SapTablePartitionSettings() + .withPartitionColumnName("datardpw") + .withPartitionUpperBound("datalvfisk") + .withPartitionLowerBound("datasp") + .withMaxPartitionsNumber("datasxnyo")); + model = BinaryData.fromObject(model).toObject(SapTableSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScheduleTriggerRecurrenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScheduleTriggerRecurrenceTests.java new file mode 100644 index 000000000000..e2beff79c2cb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScheduleTriggerRecurrenceTests.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DayOfWeek; +import com.azure.resourcemanager.datafactory.models.DaysOfWeek; +import com.azure.resourcemanager.datafactory.models.RecurrenceFrequency; +import com.azure.resourcemanager.datafactory.models.RecurrenceSchedule; +import com.azure.resourcemanager.datafactory.models.RecurrenceScheduleOccurrence; +import com.azure.resourcemanager.datafactory.models.ScheduleTriggerRecurrence; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ScheduleTriggerRecurrenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScheduleTriggerRecurrence model = + BinaryData + .fromString( + "{\"frequency\":\"Year\",\"interval\":463962573,\"startTime\":\"2021-10-01T11:15:04Z\",\"endTime\":\"2021-01-20T06:37:59Z\",\"timeZone\":\"nqcvdrpwcki\",\"schedule\":{\"minutes\":[309795046],\"hours\":[917084258,556900627,1450446378,1949873692],\"weekDays\":[\"Friday\",\"Tuesday\",\"Tuesday\"],\"monthDays\":[1221018605,1595161632],\"monthlyOccurrences\":[{\"day\":\"Friday\",\"occurrence\":598249890,\"\":{\"mqymgiydg\":\"datanrdbixoudmaniwkw\"}},{\"day\":\"Saturday\",\"occurrence\":1406768615,\"\":{\"p\":\"dataowcwehjqyullep\"}},{\"day\":\"Monday\",\"occurrence\":900809533,\"\":{\"pimmwirixczxkxv\":\"datasnxcayyvriuvmmef\",\"sc\":\"dataiglutxz\",\"jbpbdusa\":\"datalwfefygnafpi\",\"xjnkbe\":\"datapsvedxphfoomqq\"}}],\"\":{\"ujhmdpey\":\"datamitvviqsgq\",\"rjqnciwybj\":\"datasqwjqevwt\",\"dtin\":\"datangrr\"}},\"\":{\"yhtkyqfynvt\":\"datakgllmpkuxbluc\",\"vojrkfc\":\"datampgusroqkjw\",\"omqf\":\"datatjqhfkwsmg\"}}") + .toObject(ScheduleTriggerRecurrence.class); + Assertions.assertEquals(RecurrenceFrequency.YEAR, model.frequency()); + Assertions.assertEquals(463962573, model.interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-01T11:15:04Z"), model.startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-20T06:37:59Z"), model.endTime()); + Assertions.assertEquals("nqcvdrpwcki", model.timeZone()); + Assertions.assertEquals(309795046, model.schedule().minutes().get(0)); + Assertions.assertEquals(917084258, model.schedule().hours().get(0)); + Assertions.assertEquals(DaysOfWeek.FRIDAY, model.schedule().weekDays().get(0)); + Assertions.assertEquals(1221018605, model.schedule().monthDays().get(0)); + Assertions.assertEquals(DayOfWeek.FRIDAY, model.schedule().monthlyOccurrences().get(0).day()); + Assertions.assertEquals(598249890, model.schedule().monthlyOccurrences().get(0).occurrence()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScheduleTriggerRecurrence model = + new ScheduleTriggerRecurrence() + .withFrequency(RecurrenceFrequency.YEAR) + .withInterval(463962573) + .withStartTime(OffsetDateTime.parse("2021-10-01T11:15:04Z")) + .withEndTime(OffsetDateTime.parse("2021-01-20T06:37:59Z")) + .withTimeZone("nqcvdrpwcki") + .withSchedule( + new RecurrenceSchedule() + .withMinutes(Arrays.asList(309795046)) + .withHours(Arrays.asList(917084258, 556900627, 1450446378, 1949873692)) + .withWeekDays(Arrays.asList(DaysOfWeek.FRIDAY, DaysOfWeek.TUESDAY, DaysOfWeek.TUESDAY)) + .withMonthDays(Arrays.asList(1221018605, 1595161632)) + .withMonthlyOccurrences( + Arrays + .asList( + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.FRIDAY) + .withOccurrence(598249890) + .withAdditionalProperties(mapOf()), + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.SATURDAY) + .withOccurrence(1406768615) + .withAdditionalProperties(mapOf()), + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.MONDAY) + .withOccurrence(900809533) + .withAdditionalProperties(mapOf()))) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(ScheduleTriggerRecurrence.class); + Assertions.assertEquals(RecurrenceFrequency.YEAR, model.frequency()); + Assertions.assertEquals(463962573, model.interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-01T11:15:04Z"), model.startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-20T06:37:59Z"), model.endTime()); + Assertions.assertEquals("nqcvdrpwcki", model.timeZone()); + Assertions.assertEquals(309795046, model.schedule().minutes().get(0)); + Assertions.assertEquals(917084258, model.schedule().hours().get(0)); + Assertions.assertEquals(DaysOfWeek.FRIDAY, model.schedule().weekDays().get(0)); + Assertions.assertEquals(1221018605, model.schedule().monthDays().get(0)); + Assertions.assertEquals(DayOfWeek.FRIDAY, model.schedule().monthlyOccurrences().get(0).day()); + Assertions.assertEquals(598249890, model.schedule().monthlyOccurrences().get(0).occurrence()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScheduleTriggerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScheduleTriggerTests.java new file mode 100644 index 000000000000..7bf3b2cd56ff --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScheduleTriggerTests.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DayOfWeek; +import com.azure.resourcemanager.datafactory.models.DaysOfWeek; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import com.azure.resourcemanager.datafactory.models.RecurrenceFrequency; +import com.azure.resourcemanager.datafactory.models.RecurrenceSchedule; +import com.azure.resourcemanager.datafactory.models.RecurrenceScheduleOccurrence; +import com.azure.resourcemanager.datafactory.models.ScheduleTrigger; +import com.azure.resourcemanager.datafactory.models.ScheduleTriggerRecurrence; +import com.azure.resourcemanager.datafactory.models.TriggerPipelineReference; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ScheduleTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScheduleTrigger model = + BinaryData + .fromString( + "{\"type\":\"ScheduleTrigger\",\"typeProperties\":{\"recurrence\":{\"frequency\":\"Year\",\"interval\":1236275141,\"startTime\":\"2021-02-06T22:43:21Z\",\"endTime\":\"2021-10-20T04:45:39Z\",\"timeZone\":\"jcaqeorv\",\"schedule\":{\"minutes\":[1266177512,189144055,1891096518],\"hours\":[415292522,770664216,334743435],\"weekDays\":[\"Monday\",\"Tuesday\",\"Saturday\",\"Saturday\"],\"monthDays\":[1728235865,1813263959,1579619430,694727070],\"monthlyOccurrences\":[{\"day\":\"Thursday\",\"occurrence\":364845375,\"\":{\"nywfyoimw\":\"datarinwtvsb\",\"mtddkyyrpbnqi\":\"dataeoutztlnhg\"}}],\"\":{\"xcepn\":\"datacyiuiwkrwpishc\",\"yy\":\"datapiicnwt\",\"yjbenzw\":\"dataskujnzxhoty\"}},\"\":{\"zv\":\"datavslpythqgziplac\",\"mqyg\":\"datadh\",\"c\":\"dataefsnlob\"}}},\"pipelines\":[{\"pipelineReference\":{\"referenceName\":\"xjgok\",\"name\":\"ixwebjykafii\"},\"parameters\":{\"j\":\"datavtsmcn\",\"lfetlmmdgeb\":\"dataovhcelw\",\"weryzgkcwwndole\":\"dataoqxattthazq\"}},{\"pipelineReference\":{\"referenceName\":\"yaszuoheuifshs\",\"name\":\"pl\"},\"parameters\":{\"qkwg\":\"datakztc\"}},{\"pipelineReference\":{\"referenceName\":\"aeby\",\"name\":\"ckfapzfq\"},\"parameters\":{\"rpm\":\"dataor\",\"iq\":\"datahekxmj\",\"wbdk\":\"dataqtm\"}}],\"description\":\"xdaehpfre\",\"runtimeState\":\"Started\",\"annotations\":[\"datajmsogzcuzdjtw\",\"dataiawjevdnpkdm\"],\"\":{\"bqaqbae\":\"datarzvjvlnafpfo\",\"klurxwtfpe\":\"datahjwcdjxqxf\",\"orvsypjytgzfmm\":\"dataftpjldlj\",\"ebmiko\":\"dataxkbtberyqlq\"}}") + .toObject(ScheduleTrigger.class); + Assertions.assertEquals("xdaehpfre", model.description()); + Assertions.assertEquals("xjgok", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("ixwebjykafii", model.pipelines().get(0).pipelineReference().name()); + Assertions.assertEquals(RecurrenceFrequency.YEAR, model.recurrence().frequency()); + Assertions.assertEquals(1236275141, model.recurrence().interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-06T22:43:21Z"), model.recurrence().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-20T04:45:39Z"), model.recurrence().endTime()); + Assertions.assertEquals("jcaqeorv", model.recurrence().timeZone()); + Assertions.assertEquals(1266177512, model.recurrence().schedule().minutes().get(0)); + Assertions.assertEquals(415292522, model.recurrence().schedule().hours().get(0)); + Assertions.assertEquals(DaysOfWeek.MONDAY, model.recurrence().schedule().weekDays().get(0)); + Assertions.assertEquals(1728235865, model.recurrence().schedule().monthDays().get(0)); + Assertions.assertEquals(DayOfWeek.THURSDAY, model.recurrence().schedule().monthlyOccurrences().get(0).day()); + Assertions.assertEquals(364845375, model.recurrence().schedule().monthlyOccurrences().get(0).occurrence()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScheduleTrigger model = + new ScheduleTrigger() + .withDescription("xdaehpfre") + .withAnnotations(Arrays.asList("datajmsogzcuzdjtw", "dataiawjevdnpkdm")) + .withPipelines( + Arrays + .asList( + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("xjgok").withName("ixwebjykafii")) + .withParameters( + mapOf( + "j", + "datavtsmcn", + "lfetlmmdgeb", + "dataovhcelw", + "weryzgkcwwndole", + "dataoqxattthazq")), + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("yaszuoheuifshs").withName("pl")) + .withParameters(mapOf("qkwg", "datakztc")), + new TriggerPipelineReference() + .withPipelineReference( + new PipelineReference().withReferenceName("aeby").withName("ckfapzfq")) + .withParameters(mapOf("rpm", "dataor", "iq", "datahekxmj", "wbdk", "dataqtm")))) + .withRecurrence( + new ScheduleTriggerRecurrence() + .withFrequency(RecurrenceFrequency.YEAR) + .withInterval(1236275141) + .withStartTime(OffsetDateTime.parse("2021-02-06T22:43:21Z")) + .withEndTime(OffsetDateTime.parse("2021-10-20T04:45:39Z")) + .withTimeZone("jcaqeorv") + .withSchedule( + new RecurrenceSchedule() + .withMinutes(Arrays.asList(1266177512, 189144055, 1891096518)) + .withHours(Arrays.asList(415292522, 770664216, 334743435)) + .withWeekDays( + Arrays + .asList( + DaysOfWeek.MONDAY, + DaysOfWeek.TUESDAY, + DaysOfWeek.SATURDAY, + DaysOfWeek.SATURDAY)) + .withMonthDays(Arrays.asList(1728235865, 1813263959, 1579619430, 694727070)) + .withMonthlyOccurrences( + Arrays + .asList( + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.THURSDAY) + .withOccurrence(364845375) + .withAdditionalProperties(mapOf()))) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(ScheduleTrigger.class); + Assertions.assertEquals("xdaehpfre", model.description()); + Assertions.assertEquals("xjgok", model.pipelines().get(0).pipelineReference().referenceName()); + Assertions.assertEquals("ixwebjykafii", model.pipelines().get(0).pipelineReference().name()); + Assertions.assertEquals(RecurrenceFrequency.YEAR, model.recurrence().frequency()); + Assertions.assertEquals(1236275141, model.recurrence().interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-06T22:43:21Z"), model.recurrence().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-20T04:45:39Z"), model.recurrence().endTime()); + Assertions.assertEquals("jcaqeorv", model.recurrence().timeZone()); + Assertions.assertEquals(1266177512, model.recurrence().schedule().minutes().get(0)); + Assertions.assertEquals(415292522, model.recurrence().schedule().hours().get(0)); + Assertions.assertEquals(DaysOfWeek.MONDAY, model.recurrence().schedule().weekDays().get(0)); + Assertions.assertEquals(1728235865, model.recurrence().schedule().monthDays().get(0)); + Assertions.assertEquals(DayOfWeek.THURSDAY, model.recurrence().schedule().monthlyOccurrences().get(0).day()); + Assertions.assertEquals(364845375, model.recurrence().schedule().monthlyOccurrences().get(0).occurrence()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScheduleTriggerTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScheduleTriggerTypePropertiesTests.java new file mode 100644 index 000000000000..b1fa88050e6b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScheduleTriggerTypePropertiesTests.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ScheduleTriggerTypeProperties; +import com.azure.resourcemanager.datafactory.models.DayOfWeek; +import com.azure.resourcemanager.datafactory.models.DaysOfWeek; +import com.azure.resourcemanager.datafactory.models.RecurrenceFrequency; +import com.azure.resourcemanager.datafactory.models.RecurrenceSchedule; +import com.azure.resourcemanager.datafactory.models.RecurrenceScheduleOccurrence; +import com.azure.resourcemanager.datafactory.models.ScheduleTriggerRecurrence; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ScheduleTriggerTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScheduleTriggerTypeProperties model = + BinaryData + .fromString( + "{\"recurrence\":{\"frequency\":\"Day\",\"interval\":665115764,\"startTime\":\"2021-06-20T22:00:28Z\",\"endTime\":\"2021-02-19T00:10:50Z\",\"timeZone\":\"mlgmgcnllqfbeuug\",\"schedule\":{\"minutes\":[1684959388,468220489,595739482,1958046175],\"hours\":[648581162],\"weekDays\":[\"Wednesday\",\"Thursday\",\"Thursday\"],\"monthDays\":[828575448],\"monthlyOccurrences\":[{\"day\":\"Sunday\",\"occurrence\":1247863559,\"\":{\"ecmjgbzhdonyle\":\"dataozdcth\"}}],\"\":{\"r\":\"datawvdwmuytkkfoton\"}},\"\":{\"udkyzyiyvhgdkb\":\"datazuoopo\"}}}") + .toObject(ScheduleTriggerTypeProperties.class); + Assertions.assertEquals(RecurrenceFrequency.DAY, model.recurrence().frequency()); + Assertions.assertEquals(665115764, model.recurrence().interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-20T22:00:28Z"), model.recurrence().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-19T00:10:50Z"), model.recurrence().endTime()); + Assertions.assertEquals("mlgmgcnllqfbeuug", model.recurrence().timeZone()); + Assertions.assertEquals(1684959388, model.recurrence().schedule().minutes().get(0)); + Assertions.assertEquals(648581162, model.recurrence().schedule().hours().get(0)); + Assertions.assertEquals(DaysOfWeek.WEDNESDAY, model.recurrence().schedule().weekDays().get(0)); + Assertions.assertEquals(828575448, model.recurrence().schedule().monthDays().get(0)); + Assertions.assertEquals(DayOfWeek.SUNDAY, model.recurrence().schedule().monthlyOccurrences().get(0).day()); + Assertions.assertEquals(1247863559, model.recurrence().schedule().monthlyOccurrences().get(0).occurrence()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScheduleTriggerTypeProperties model = + new ScheduleTriggerTypeProperties() + .withRecurrence( + new ScheduleTriggerRecurrence() + .withFrequency(RecurrenceFrequency.DAY) + .withInterval(665115764) + .withStartTime(OffsetDateTime.parse("2021-06-20T22:00:28Z")) + .withEndTime(OffsetDateTime.parse("2021-02-19T00:10:50Z")) + .withTimeZone("mlgmgcnllqfbeuug") + .withSchedule( + new RecurrenceSchedule() + .withMinutes(Arrays.asList(1684959388, 468220489, 595739482, 1958046175)) + .withHours(Arrays.asList(648581162)) + .withWeekDays( + Arrays.asList(DaysOfWeek.WEDNESDAY, DaysOfWeek.THURSDAY, DaysOfWeek.THURSDAY)) + .withMonthDays(Arrays.asList(828575448)) + .withMonthlyOccurrences( + Arrays + .asList( + new RecurrenceScheduleOccurrence() + .withDay(DayOfWeek.SUNDAY) + .withOccurrence(1247863559) + .withAdditionalProperties(mapOf()))) + .withAdditionalProperties(mapOf())) + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(ScheduleTriggerTypeProperties.class); + Assertions.assertEquals(RecurrenceFrequency.DAY, model.recurrence().frequency()); + Assertions.assertEquals(665115764, model.recurrence().interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-20T22:00:28Z"), model.recurrence().startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-19T00:10:50Z"), model.recurrence().endTime()); + Assertions.assertEquals("mlgmgcnllqfbeuug", model.recurrence().timeZone()); + Assertions.assertEquals(1684959388, model.recurrence().schedule().minutes().get(0)); + Assertions.assertEquals(648581162, model.recurrence().schedule().hours().get(0)); + Assertions.assertEquals(DaysOfWeek.WEDNESDAY, model.recurrence().schedule().weekDays().get(0)); + Assertions.assertEquals(828575448, model.recurrence().schedule().monthDays().get(0)); + Assertions.assertEquals(DayOfWeek.SUNDAY, model.recurrence().schedule().monthlyOccurrences().get(0).day()); + Assertions.assertEquals(1247863559, model.recurrence().schedule().monthlyOccurrences().get(0).occurrence()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActionTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActionTests.java new file mode 100644 index 000000000000..2ce5432a8364 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActionTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ScriptAction; +import org.junit.jupiter.api.Assertions; + +public final class ScriptActionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScriptAction model = + BinaryData + .fromString( + "{\"name\":\"zoxhoiogpbogpbw\",\"uri\":\"foxlzr\",\"roles\":\"datajpkbrvmzu\",\"parameters\":\"krqeqjtzaw\"}") + .toObject(ScriptAction.class); + Assertions.assertEquals("zoxhoiogpbogpbw", model.name()); + Assertions.assertEquals("foxlzr", model.uri()); + Assertions.assertEquals("krqeqjtzaw", model.parameters()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScriptAction model = + new ScriptAction() + .withName("zoxhoiogpbogpbw") + .withUri("foxlzr") + .withRoles("datajpkbrvmzu") + .withParameters("krqeqjtzaw"); + model = BinaryData.fromObject(model).toObject(ScriptAction.class); + Assertions.assertEquals("zoxhoiogpbogpbw", model.name()); + Assertions.assertEquals("foxlzr", model.uri()); + Assertions.assertEquals("krqeqjtzaw", model.parameters()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityParameterTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityParameterTests.java new file mode 100644 index 000000000000..0d5d2abb2fbc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityParameterTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameter; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameterDirection; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameterType; +import org.junit.jupiter.api.Assertions; + +public final class ScriptActivityParameterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScriptActivityParameter model = + BinaryData + .fromString( + "{\"name\":\"datahl\",\"type\":\"Guid\",\"value\":\"datagbcroltddifyw\",\"direction\":\"Output\",\"size\":1798739332}") + .toObject(ScriptActivityParameter.class); + Assertions.assertEquals(ScriptActivityParameterType.GUID, model.type()); + Assertions.assertEquals(ScriptActivityParameterDirection.OUTPUT, model.direction()); + Assertions.assertEquals(1798739332, model.size()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScriptActivityParameter model = + new ScriptActivityParameter() + .withName("datahl") + .withType(ScriptActivityParameterType.GUID) + .withValue("datagbcroltddifyw") + .withDirection(ScriptActivityParameterDirection.OUTPUT) + .withSize(1798739332); + model = BinaryData.fromObject(model).toObject(ScriptActivityParameter.class); + Assertions.assertEquals(ScriptActivityParameterType.GUID, model.type()); + Assertions.assertEquals(ScriptActivityParameterDirection.OUTPUT, model.direction()); + Assertions.assertEquals(1798739332, model.size()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityScriptBlockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityScriptBlockTests.java new file mode 100644 index 000000000000..490afa179def --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityScriptBlockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameter; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameterDirection; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameterType; +import com.azure.resourcemanager.datafactory.models.ScriptActivityScriptBlock; +import com.azure.resourcemanager.datafactory.models.ScriptType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ScriptActivityScriptBlockTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScriptActivityScriptBlock model = + BinaryData + .fromString( + "{\"text\":\"datanvjhoshinljquq\",\"type\":\"NonQuery\",\"parameters\":[{\"name\":\"datagvco\",\"type\":\"Int32\",\"value\":\"datapvursmeumyxpsov\",\"direction\":\"Input\",\"size\":1077659067},{\"name\":\"dataskkgsfmgypqm\",\"type\":\"DateTimeOffset\",\"value\":\"dataqzmixw\",\"direction\":\"Input\",\"size\":343668067},{\"name\":\"datasehtzjbuzl\",\"type\":\"Single\",\"value\":\"datakzbsbcddhl\",\"direction\":\"Output\",\"size\":1461764775},{\"name\":\"dataqnyjjfjqgs\",\"type\":\"Double\",\"value\":\"datanxexafql\",\"direction\":\"Input\",\"size\":1093869610}]}") + .toObject(ScriptActivityScriptBlock.class); + Assertions.assertEquals(ScriptType.NON_QUERY, model.type()); + Assertions.assertEquals(ScriptActivityParameterType.INT32, model.parameters().get(0).type()); + Assertions.assertEquals(ScriptActivityParameterDirection.INPUT, model.parameters().get(0).direction()); + Assertions.assertEquals(1077659067, model.parameters().get(0).size()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScriptActivityScriptBlock model = + new ScriptActivityScriptBlock() + .withText("datanvjhoshinljquq") + .withType(ScriptType.NON_QUERY) + .withParameters( + Arrays + .asList( + new ScriptActivityParameter() + .withName("datagvco") + .withType(ScriptActivityParameterType.INT32) + .withValue("datapvursmeumyxpsov") + .withDirection(ScriptActivityParameterDirection.INPUT) + .withSize(1077659067), + new ScriptActivityParameter() + .withName("dataskkgsfmgypqm") + .withType(ScriptActivityParameterType.DATE_TIME_OFFSET) + .withValue("dataqzmixw") + .withDirection(ScriptActivityParameterDirection.INPUT) + .withSize(343668067), + new ScriptActivityParameter() + .withName("datasehtzjbuzl") + .withType(ScriptActivityParameterType.SINGLE) + .withValue("datakzbsbcddhl") + .withDirection(ScriptActivityParameterDirection.OUTPUT) + .withSize(1461764775), + new ScriptActivityParameter() + .withName("dataqnyjjfjqgs") + .withType(ScriptActivityParameterType.DOUBLE) + .withValue("datanxexafql") + .withDirection(ScriptActivityParameterDirection.INPUT) + .withSize(1093869610))); + model = BinaryData.fromObject(model).toObject(ScriptActivityScriptBlock.class); + Assertions.assertEquals(ScriptType.NON_QUERY, model.type()); + Assertions.assertEquals(ScriptActivityParameterType.INT32, model.parameters().get(0).type()); + Assertions.assertEquals(ScriptActivityParameterDirection.INPUT, model.parameters().get(0).direction()); + Assertions.assertEquals(1077659067, model.parameters().get(0).size()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityTests.java new file mode 100644 index 000000000000..2dc62be32533 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityTests.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogLocationSettings; +import com.azure.resourcemanager.datafactory.models.ScriptActivity; +import com.azure.resourcemanager.datafactory.models.ScriptActivityLogDestination; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameter; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameterDirection; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameterType; +import com.azure.resourcemanager.datafactory.models.ScriptActivityScriptBlock; +import com.azure.resourcemanager.datafactory.models.ScriptActivityTypePropertiesLogSettings; +import com.azure.resourcemanager.datafactory.models.ScriptType; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ScriptActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScriptActivity model = + BinaryData + .fromString( + "{\"type\":\"Script\",\"typeProperties\":{\"scriptBlockExecutionTimeout\":\"databcpieiqolym\",\"scripts\":[{\"text\":\"databcyed\",\"type\":\"NonQuery\",\"parameters\":[{\"name\":\"datakhg\",\"type\":\"Int16\",\"value\":\"dataylukpjdmdykjh\",\"direction\":\"Output\",\"size\":1828814533},{\"name\":\"dataispwpfjxljrrgvyu\",\"type\":\"Int16\",\"value\":\"datavckpdlkvi\",\"direction\":\"Input\",\"size\":968622084}]},{\"text\":\"datadkgicbkijyv\",\"type\":\"NonQuery\",\"parameters\":[{\"name\":\"datahn\",\"type\":\"Single\",\"value\":\"datasul\",\"direction\":\"Input\",\"size\":1712156327}]}],\"logSettings\":{\"logDestination\":\"ExternalStore\",\"logLocationSettings\":{\"linkedServiceName\":{\"referenceName\":\"nanrcqetrtvy\",\"parameters\":{\"u\":\"datatpqjgblco\"}},\"path\":\"datastjwlnt\"}}},\"linkedServiceName\":{\"referenceName\":\"iltuypncdebpe\",\"parameters\":{\"zpscz\":\"dataagulymouwnnh\",\"jydrhwnnuxv\":\"datasatfunfq\",\"vekbknrr\":\"dataietzovbu\"}},\"policy\":{\"timeout\":\"datapnxdzp\",\"retry\":\"datamdslygqbyo\",\"retryIntervalInSeconds\":852509750,\"secureInput\":true,\"secureOutput\":false,\"\":{\"volqprhnchpet\":\"datay\"}},\"name\":\"dbfmttpzwnrmpu\",\"description\":\"usizsnhekpc\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"iee\",\"dependencyConditions\":[\"Completed\",\"Skipped\",\"Completed\",\"Succeeded\"],\"\":{\"tdkzphudagrgxrs\":\"datam\",\"sbjoh\":\"datavzwnuibdr\"}},{\"activity\":\"vkpnmaaw\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Skipped\"],\"\":{\"yfjzy\":\"datarxooqqdlmbuzk\",\"fgjxmgwkhrln\":\"dataogwjp\",\"fvsvwauqxhqcv\":\"datasq\"}},{\"activity\":\"ibzbvkoxljtvef\",\"dependencyConditions\":[\"Skipped\",\"Skipped\",\"Failed\"],\"\":{\"e\":\"dataiylpxoaall\"}}],\"userProperties\":[{\"name\":\"sdnrlkzzlok\",\"value\":\"datarudepzlvuz\"},{\"name\":\"wlb\",\"value\":\"datafjhwvgp\"}],\"\":{\"gfpyffmgu\":\"dataxttahso\",\"bihgpnkw\":\"datakfo\",\"iwm\":\"dataatkkuf\"}}") + .toObject(ScriptActivity.class); + Assertions.assertEquals("dbfmttpzwnrmpu", model.name()); + Assertions.assertEquals("usizsnhekpc", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("iee", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("sdnrlkzzlok", model.userProperties().get(0).name()); + Assertions.assertEquals("iltuypncdebpe", model.linkedServiceName().referenceName()); + Assertions.assertEquals(852509750, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals(ScriptType.NON_QUERY, model.scripts().get(0).type()); + Assertions.assertEquals(ScriptActivityParameterType.INT16, model.scripts().get(0).parameters().get(0).type()); + Assertions + .assertEquals( + ScriptActivityParameterDirection.OUTPUT, model.scripts().get(0).parameters().get(0).direction()); + Assertions.assertEquals(1828814533, model.scripts().get(0).parameters().get(0).size()); + Assertions.assertEquals(ScriptActivityLogDestination.EXTERNAL_STORE, model.logSettings().logDestination()); + Assertions + .assertEquals( + "nanrcqetrtvy", model.logSettings().logLocationSettings().linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScriptActivity model = + new ScriptActivity() + .withName("dbfmttpzwnrmpu") + .withDescription("usizsnhekpc") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("iee") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("vkpnmaaw") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ibzbvkoxljtvef") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("sdnrlkzzlok").withValue("datarudepzlvuz"), + new UserProperty().withName("wlb").withValue("datafjhwvgp"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("iltuypncdebpe") + .withParameters( + mapOf( + "zpscz", + "dataagulymouwnnh", + "jydrhwnnuxv", + "datasatfunfq", + "vekbknrr", + "dataietzovbu"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datapnxdzp") + .withRetry("datamdslygqbyo") + .withRetryIntervalInSeconds(852509750) + .withSecureInput(true) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withScriptBlockExecutionTimeout("databcpieiqolym") + .withScripts( + Arrays + .asList( + new ScriptActivityScriptBlock() + .withText("databcyed") + .withType(ScriptType.NON_QUERY) + .withParameters( + Arrays + .asList( + new ScriptActivityParameter() + .withName("datakhg") + .withType(ScriptActivityParameterType.INT16) + .withValue("dataylukpjdmdykjh") + .withDirection(ScriptActivityParameterDirection.OUTPUT) + .withSize(1828814533), + new ScriptActivityParameter() + .withName("dataispwpfjxljrrgvyu") + .withType(ScriptActivityParameterType.INT16) + .withValue("datavckpdlkvi") + .withDirection(ScriptActivityParameterDirection.INPUT) + .withSize(968622084))), + new ScriptActivityScriptBlock() + .withText("datadkgicbkijyv") + .withType(ScriptType.NON_QUERY) + .withParameters( + Arrays + .asList( + new ScriptActivityParameter() + .withName("datahn") + .withType(ScriptActivityParameterType.SINGLE) + .withValue("datasul") + .withDirection(ScriptActivityParameterDirection.INPUT) + .withSize(1712156327))))) + .withLogSettings( + new ScriptActivityTypePropertiesLogSettings() + .withLogDestination(ScriptActivityLogDestination.EXTERNAL_STORE) + .withLogLocationSettings( + new LogLocationSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("nanrcqetrtvy") + .withParameters(mapOf("u", "datatpqjgblco"))) + .withPath("datastjwlnt"))); + model = BinaryData.fromObject(model).toObject(ScriptActivity.class); + Assertions.assertEquals("dbfmttpzwnrmpu", model.name()); + Assertions.assertEquals("usizsnhekpc", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("iee", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("sdnrlkzzlok", model.userProperties().get(0).name()); + Assertions.assertEquals("iltuypncdebpe", model.linkedServiceName().referenceName()); + Assertions.assertEquals(852509750, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals(ScriptType.NON_QUERY, model.scripts().get(0).type()); + Assertions.assertEquals(ScriptActivityParameterType.INT16, model.scripts().get(0).parameters().get(0).type()); + Assertions + .assertEquals( + ScriptActivityParameterDirection.OUTPUT, model.scripts().get(0).parameters().get(0).direction()); + Assertions.assertEquals(1828814533, model.scripts().get(0).parameters().get(0).size()); + Assertions.assertEquals(ScriptActivityLogDestination.EXTERNAL_STORE, model.logSettings().logDestination()); + Assertions + .assertEquals( + "nanrcqetrtvy", model.logSettings().logLocationSettings().linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityTypePropertiesLogSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityTypePropertiesLogSettingsTests.java new file mode 100644 index 000000000000..1b0f29ec9dc7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityTypePropertiesLogSettingsTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogLocationSettings; +import com.azure.resourcemanager.datafactory.models.ScriptActivityLogDestination; +import com.azure.resourcemanager.datafactory.models.ScriptActivityTypePropertiesLogSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ScriptActivityTypePropertiesLogSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScriptActivityTypePropertiesLogSettings model = + BinaryData + .fromString( + "{\"logDestination\":\"ExternalStore\",\"logLocationSettings\":{\"linkedServiceName\":{\"referenceName\":\"jaqyiy\",\"parameters\":{\"upyivq\":\"dataejufack\",\"bperkeyhybc\":\"dataczxyzlxowgzt\",\"jqrnuo\":\"dataxurdfzynfm\",\"tzeauifc\":\"datam\"}},\"path\":\"datarutfvzdo\"}}") + .toObject(ScriptActivityTypePropertiesLogSettings.class); + Assertions.assertEquals(ScriptActivityLogDestination.EXTERNAL_STORE, model.logDestination()); + Assertions.assertEquals("jaqyiy", model.logLocationSettings().linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScriptActivityTypePropertiesLogSettings model = + new ScriptActivityTypePropertiesLogSettings() + .withLogDestination(ScriptActivityLogDestination.EXTERNAL_STORE) + .withLogLocationSettings( + new LogLocationSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("jaqyiy") + .withParameters( + mapOf( + "upyivq", + "dataejufack", + "bperkeyhybc", + "dataczxyzlxowgzt", + "jqrnuo", + "dataxurdfzynfm", + "tzeauifc", + "datam"))) + .withPath("datarutfvzdo")); + model = BinaryData.fromObject(model).toObject(ScriptActivityTypePropertiesLogSettings.class); + Assertions.assertEquals(ScriptActivityLogDestination.EXTERNAL_STORE, model.logDestination()); + Assertions.assertEquals("jaqyiy", model.logLocationSettings().linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityTypePropertiesTests.java new file mode 100644 index 000000000000..5f7c316a6183 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ScriptActivityTypePropertiesTests.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ScriptActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.LogLocationSettings; +import com.azure.resourcemanager.datafactory.models.ScriptActivityLogDestination; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameter; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameterDirection; +import com.azure.resourcemanager.datafactory.models.ScriptActivityParameterType; +import com.azure.resourcemanager.datafactory.models.ScriptActivityScriptBlock; +import com.azure.resourcemanager.datafactory.models.ScriptActivityTypePropertiesLogSettings; +import com.azure.resourcemanager.datafactory.models.ScriptType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ScriptActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScriptActivityTypeProperties model = + BinaryData + .fromString( + "{\"scriptBlockExecutionTimeout\":\"datavfubriom\",\"scripts\":[{\"text\":\"datarnggwujyukjfsb\",\"type\":\"Query\",\"parameters\":[{\"name\":\"datarni\",\"type\":\"Single\",\"value\":\"datamuwhg\",\"direction\":\"Output\",\"size\":221400137},{\"name\":\"datafqsislaubijvavq\",\"type\":\"Single\",\"value\":\"datahdikdratzgxt\",\"direction\":\"Output\",\"size\":73057217},{\"name\":\"datalfb\",\"type\":\"DateTimeOffset\",\"value\":\"datamvhpic\",\"direction\":\"InputOutput\",\"size\":839306026},{\"name\":\"dataifa\",\"type\":\"Int32\",\"value\":\"dataswzkz\",\"direction\":\"Input\",\"size\":774721696}]},{\"text\":\"datanbhwtagfe\",\"type\":\"NonQuery\",\"parameters\":[{\"name\":\"dataewjnzlq\",\"type\":\"DateTimeOffset\",\"value\":\"datajna\",\"direction\":\"Output\",\"size\":1674347848},{\"name\":\"datawmnsapgalwpajrt\",\"type\":\"Decimal\",\"value\":\"datatpqvhkjbgcqqeyt\",\"direction\":\"Output\",\"size\":1752438457},{\"name\":\"dataaijnahelfqh\",\"type\":\"String\",\"value\":\"dataakqg\",\"direction\":\"InputOutput\",\"size\":1124111647},{\"name\":\"datatxzekidjbs\",\"type\":\"Int32\",\"value\":\"datamlgynaz\",\"direction\":\"InputOutput\",\"size\":1962463741}]},{\"text\":\"datapypsjokjjrj\",\"type\":\"Query\",\"parameters\":[{\"name\":\"datajt\",\"type\":\"Single\",\"value\":\"datajimsge\",\"direction\":\"Input\",\"size\":1612152665},{\"name\":\"datadbcrkepjnyrtlini\",\"type\":\"String\",\"value\":\"dataq\",\"direction\":\"InputOutput\",\"size\":1315001028}]}],\"logSettings\":{\"logDestination\":\"ExternalStore\",\"logLocationSettings\":{\"linkedServiceName\":{\"referenceName\":\"na\",\"parameters\":{\"kqx\":\"databkzqassnwvwluzs\",\"twv\":\"datatkw\",\"swwgrqiqlopb\":\"datajtudn\"}},\"path\":\"dataokmwnrwu\"}}}") + .toObject(ScriptActivityTypeProperties.class); + Assertions.assertEquals(ScriptType.QUERY, model.scripts().get(0).type()); + Assertions.assertEquals(ScriptActivityParameterType.SINGLE, model.scripts().get(0).parameters().get(0).type()); + Assertions + .assertEquals( + ScriptActivityParameterDirection.OUTPUT, model.scripts().get(0).parameters().get(0).direction()); + Assertions.assertEquals(221400137, model.scripts().get(0).parameters().get(0).size()); + Assertions.assertEquals(ScriptActivityLogDestination.EXTERNAL_STORE, model.logSettings().logDestination()); + Assertions.assertEquals("na", model.logSettings().logLocationSettings().linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScriptActivityTypeProperties model = + new ScriptActivityTypeProperties() + .withScriptBlockExecutionTimeout("datavfubriom") + .withScripts( + Arrays + .asList( + new ScriptActivityScriptBlock() + .withText("datarnggwujyukjfsb") + .withType(ScriptType.QUERY) + .withParameters( + Arrays + .asList( + new ScriptActivityParameter() + .withName("datarni") + .withType(ScriptActivityParameterType.SINGLE) + .withValue("datamuwhg") + .withDirection(ScriptActivityParameterDirection.OUTPUT) + .withSize(221400137), + new ScriptActivityParameter() + .withName("datafqsislaubijvavq") + .withType(ScriptActivityParameterType.SINGLE) + .withValue("datahdikdratzgxt") + .withDirection(ScriptActivityParameterDirection.OUTPUT) + .withSize(73057217), + new ScriptActivityParameter() + .withName("datalfb") + .withType(ScriptActivityParameterType.DATE_TIME_OFFSET) + .withValue("datamvhpic") + .withDirection(ScriptActivityParameterDirection.INPUT_OUTPUT) + .withSize(839306026), + new ScriptActivityParameter() + .withName("dataifa") + .withType(ScriptActivityParameterType.INT32) + .withValue("dataswzkz") + .withDirection(ScriptActivityParameterDirection.INPUT) + .withSize(774721696))), + new ScriptActivityScriptBlock() + .withText("datanbhwtagfe") + .withType(ScriptType.NON_QUERY) + .withParameters( + Arrays + .asList( + new ScriptActivityParameter() + .withName("dataewjnzlq") + .withType(ScriptActivityParameterType.DATE_TIME_OFFSET) + .withValue("datajna") + .withDirection(ScriptActivityParameterDirection.OUTPUT) + .withSize(1674347848), + new ScriptActivityParameter() + .withName("datawmnsapgalwpajrt") + .withType(ScriptActivityParameterType.DECIMAL) + .withValue("datatpqvhkjbgcqqeyt") + .withDirection(ScriptActivityParameterDirection.OUTPUT) + .withSize(1752438457), + new ScriptActivityParameter() + .withName("dataaijnahelfqh") + .withType(ScriptActivityParameterType.STRING) + .withValue("dataakqg") + .withDirection(ScriptActivityParameterDirection.INPUT_OUTPUT) + .withSize(1124111647), + new ScriptActivityParameter() + .withName("datatxzekidjbs") + .withType(ScriptActivityParameterType.INT32) + .withValue("datamlgynaz") + .withDirection(ScriptActivityParameterDirection.INPUT_OUTPUT) + .withSize(1962463741))), + new ScriptActivityScriptBlock() + .withText("datapypsjokjjrj") + .withType(ScriptType.QUERY) + .withParameters( + Arrays + .asList( + new ScriptActivityParameter() + .withName("datajt") + .withType(ScriptActivityParameterType.SINGLE) + .withValue("datajimsge") + .withDirection(ScriptActivityParameterDirection.INPUT) + .withSize(1612152665), + new ScriptActivityParameter() + .withName("datadbcrkepjnyrtlini") + .withType(ScriptActivityParameterType.STRING) + .withValue("dataq") + .withDirection(ScriptActivityParameterDirection.INPUT_OUTPUT) + .withSize(1315001028))))) + .withLogSettings( + new ScriptActivityTypePropertiesLogSettings() + .withLogDestination(ScriptActivityLogDestination.EXTERNAL_STORE) + .withLogLocationSettings( + new LogLocationSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("na") + .withParameters( + mapOf( + "kqx", + "databkzqassnwvwluzs", + "twv", + "datatkw", + "swwgrqiqlopb", + "datajtudn"))) + .withPath("dataokmwnrwu"))); + model = BinaryData.fromObject(model).toObject(ScriptActivityTypeProperties.class); + Assertions.assertEquals(ScriptType.QUERY, model.scripts().get(0).type()); + Assertions.assertEquals(ScriptActivityParameterType.SINGLE, model.scripts().get(0).parameters().get(0).type()); + Assertions + .assertEquals( + ScriptActivityParameterDirection.OUTPUT, model.scripts().get(0).parameters().get(0).direction()); + Assertions.assertEquals(221400137, model.scripts().get(0).parameters().get(0).size()); + Assertions.assertEquals(ScriptActivityLogDestination.EXTERNAL_STORE, model.logSettings().logDestination()); + Assertions.assertEquals("na", model.logSettings().logLocationSettings().linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SecretBaseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SecretBaseTests.java new file mode 100644 index 000000000000..e1268f0b1eae --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SecretBaseTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SecretBase; + +public final class SecretBaseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SecretBase model = BinaryData.fromString("{\"type\":\"SecretBase\"}").toObject(SecretBase.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SecretBase model = new SecretBase(); + model = BinaryData.fromObject(model).toObject(SecretBase.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SecureInputOutputPolicyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SecureInputOutputPolicyTests.java new file mode 100644 index 000000000000..82dcc426c197 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SecureInputOutputPolicyTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SecureInputOutputPolicy; +import org.junit.jupiter.api.Assertions; + +public final class SecureInputOutputPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SecureInputOutputPolicy model = + BinaryData + .fromString("{\"secureInput\":true,\"secureOutput\":false}") + .toObject(SecureInputOutputPolicy.class); + Assertions.assertEquals(true, model.secureInput()); + Assertions.assertEquals(false, model.secureOutput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SecureInputOutputPolicy model = new SecureInputOutputPolicy().withSecureInput(true).withSecureOutput(false); + model = BinaryData.fromObject(model).toObject(SecureInputOutputPolicy.class); + Assertions.assertEquals(true, model.secureInput()); + Assertions.assertEquals(false, model.secureOutput()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SecureStringTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SecureStringTests.java new file mode 100644 index 000000000000..3a30314ce0ae --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SecureStringTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SecureString; +import org.junit.jupiter.api.Assertions; + +public final class SecureStringTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SecureString model = + BinaryData.fromString("{\"type\":\"SecureString\",\"value\":\"pylx\"}").toObject(SecureString.class); + Assertions.assertEquals("pylx", model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SecureString model = new SecureString().withValue("pylx"); + model = BinaryData.fromObject(model).toObject(SecureString.class); + Assertions.assertEquals("pylx", model.value()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfDependencyTumblingWindowTriggerReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfDependencyTumblingWindowTriggerReferenceTests.java new file mode 100644 index 000000000000..29065a6ad562 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfDependencyTumblingWindowTriggerReferenceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SelfDependencyTumblingWindowTriggerReference; +import org.junit.jupiter.api.Assertions; + +public final class SelfDependencyTumblingWindowTriggerReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SelfDependencyTumblingWindowTriggerReference model = + BinaryData + .fromString( + "{\"type\":\"SelfDependencyTumblingWindowTriggerReference\",\"offset\":\"b\",\"size\":\"tllkpkcqzbv\"}") + .toObject(SelfDependencyTumblingWindowTriggerReference.class); + Assertions.assertEquals("b", model.offset()); + Assertions.assertEquals("tllkpkcqzbv", model.size()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SelfDependencyTumblingWindowTriggerReference model = + new SelfDependencyTumblingWindowTriggerReference().withOffset("b").withSize("tllkpkcqzbv"); + model = BinaryData.fromObject(model).toObject(SelfDependencyTumblingWindowTriggerReference.class); + Assertions.assertEquals("b", model.offset()); + Assertions.assertEquals("tllkpkcqzbv", model.size()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfHostedIntegrationRuntimeNodeInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfHostedIntegrationRuntimeNodeInnerTests.java new file mode 100644 index 000000000000..63c59cb66043 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfHostedIntegrationRuntimeNodeInnerTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.datafactory.fluent.models.SelfHostedIntegrationRuntimeNodeInner; +import java.util.HashMap; +import java.util.Map; + +public final class SelfHostedIntegrationRuntimeNodeInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SelfHostedIntegrationRuntimeNodeInner model = + BinaryData + .fromString( + "{\"nodeName\":\"e\",\"machineName\":\"sgzvahapjyzhpv\",\"hostServiceUri\":\"zcjrvxdjzlmwlx\",\"status\":\"Online\",\"capabilities\":{\"nnprn\":\"hzovawjvzunlut\",\"eilpjzuaejxdu\":\"i\",\"pwo\":\"tskzbbtdzumveek\",\"fpbsjyofdxl\":\"uh\"},\"versionStatus\":\"sd\",\"version\":\"ouwaboekqvkeln\",\"registerTime\":\"2021-02-02T03:25:54Z\",\"lastConnectTime\":\"2020-12-28T23:28:21Z\",\"expiryTime\":\"2021-07-06T07:16:14Z\",\"lastStartTime\":\"2021-03-30T06:11:19Z\",\"lastStopTime\":\"2021-08-23T09:42:03Z\",\"lastUpdateResult\":\"Fail\",\"lastStartUpdateTime\":\"2021-01-31T17:20:46Z\",\"lastEndUpdateTime\":\"2021-07-31T18:32:18Z\",\"isActiveDispatcher\":true,\"concurrentJobsLimit\":1744629944,\"maxConcurrentJobs\":923639125,\"\":{\"iidzyexzne\":\"dataawjoyaqcslyjp\"}}") + .toObject(SelfHostedIntegrationRuntimeNodeInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SelfHostedIntegrationRuntimeNodeInner model = + new SelfHostedIntegrationRuntimeNodeInner() + .withAdditionalProperties( + mapOf( + "nodeName", + "e", + "lastStartUpdateTime", + "2021-01-31T17:20:46Z", + "lastConnectTime", + "2020-12-28T23:28:21Z", + "capabilities", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"nnprn\":\"hzovawjvzunlut\",\"eilpjzuaejxdu\":\"i\",\"pwo\":\"tskzbbtdzumveek\",\"fpbsjyofdxl\":\"uh\"}", + Object.class, + SerializerEncoding.JSON), + "hostServiceUri", + "zcjrvxdjzlmwlx", + "registerTime", + "2021-02-02T03:25:54Z", + "maxConcurrentJobs", + 923639125, + "lastStopTime", + "2021-08-23T09:42:03Z", + "version", + "ouwaboekqvkeln", + "machineName", + "sgzvahapjyzhpv", + "versionStatus", + "sd", + "concurrentJobsLimit", + 1744629944, + "lastEndUpdateTime", + "2021-07-31T18:32:18Z", + "expiryTime", + "2021-07-06T07:16:14Z", + "lastStartTime", + "2021-03-30T06:11:19Z", + "lastUpdateResult", + "Fail", + "isActiveDispatcher", + true, + "status", + "Online")); + model = BinaryData.fromObject(model).toObject(SelfHostedIntegrationRuntimeNodeInner.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfHostedIntegrationRuntimeStatusTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfHostedIntegrationRuntimeStatusTests.java new file mode 100644 index 000000000000..22b77badb6a9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfHostedIntegrationRuntimeStatusTests.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.datafactory.fluent.models.SelfHostedIntegrationRuntimeNodeInner; +import com.azure.resourcemanager.datafactory.models.LinkedIntegrationRuntime; +import com.azure.resourcemanager.datafactory.models.SelfHostedIntegrationRuntimeStatus; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public final class SelfHostedIntegrationRuntimeStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SelfHostedIntegrationRuntimeStatus model = + BinaryData + .fromString( + "{\"type\":\"SelfHosted\",\"typeProperties\":{\"createTime\":\"2021-10-25T13:01:31Z\",\"taskQueueId\":\"zqkeb\",\"internalChannelEncryption\":\"SslEncrypted\",\"version\":\"euecokyduqzuscol\",\"nodes\":[{\"nodeName\":\"htekxnvkdvc\",\"machineName\":\"wrd\",\"hostServiceUri\":\"dddwzd\",\"status\":\"NeedRegistration\",\"capabilities\":{\"th\":\"tamkyrkw\",\"jbfyroswnfqdfwv\":\"ivocffxhvnodqq\"},\"versionStatus\":\"frwv\",\"version\":\"pztuskpncdocloe\",\"registerTime\":\"2021-07-10T09:56:33Z\",\"lastConnectTime\":\"2021-12-01T16:50:08Z\",\"expiryTime\":\"2021-02-26T17:40:53Z\",\"lastStartTime\":\"2021-12-01T08:38:07Z\",\"lastStopTime\":\"2021-01-01T00:19:44Z\",\"lastUpdateResult\":\"None\",\"lastStartUpdateTime\":\"2021-01-22T09:30:22Z\",\"lastEndUpdateTime\":\"2021-02-18T06:02:30Z\",\"isActiveDispatcher\":true,\"concurrentJobsLimit\":1255010418,\"maxConcurrentJobs\":1505679455,\"\":{\"wqsni\":\"dataunngjoasnzlaw\",\"vukszkmxbh\":\"dataxwdqzu\",\"vaeg\":\"datap\"}},{\"nodeName\":\"mqonxvnmcyze\",\"machineName\":\"vw\",\"hostServiceUri\":\"esswbrnbox\",\"status\":\"Limited\",\"capabilities\":{\"mhmifhfutjyx\":\"qfvbksksmqmwow\"},\"versionStatus\":\"mgt\",\"version\":\"qaemo\",\"registerTime\":\"2021-02-27T17:53:42Z\",\"lastConnectTime\":\"2021-04-04T14:18:04Z\",\"expiryTime\":\"2021-03-07T22:35:11Z\",\"lastStartTime\":\"2021-01-16T10:07:16Z\",\"lastStopTime\":\"2021-09-10T19:37:52Z\",\"lastUpdateResult\":\"None\",\"lastStartUpdateTime\":\"2021-04-09T12:09:36Z\",\"lastEndUpdateTime\":\"2021-08-08T17:12:18Z\",\"isActiveDispatcher\":false,\"concurrentJobsLimit\":1357414966,\"maxConcurrentJobs\":1990441761,\"\":{\"xgdpivjkhcoscol\":\"dataydksvjf\",\"qkaqdvwojvx\":\"datajhcsgzooefzsdtt\",\"hrqxrqghotingzi\":\"dataf\"}},{\"nodeName\":\"gygawyhpwmdk\",\"machineName\":\"gyelvyh\",\"hostServiceUri\":\"puqyrpubbkhcidc\",\"status\":\"NeedRegistration\",\"capabilities\":{\"zowgmmixf\":\"ku\",\"jnpahzhpqscuyil\":\"aupgblna\",\"ebmuiongmndwohoe\":\"qjzri\",\"uxfvbjimzwynsm\":\"s\"},\"versionStatus\":\"hvkyezwseyuo\",\"version\":\"mjw\",\"registerTime\":\"2021-01-09T04:00:09Z\",\"lastConnectTime\":\"2021-08-26T03:52:19Z\",\"expiryTime\":\"2021-05-27T13:05:43Z\",\"lastStartTime\":\"2021-07-09T20:27:44Z\",\"lastStopTime\":\"2021-08-19T10:17:05Z\",\"lastUpdateResult\":\"Succeed\",\"lastStartUpdateTime\":\"2021-03-27T21:52:11Z\",\"lastEndUpdateTime\":\"2021-06-14T00:28:05Z\",\"isActiveDispatcher\":false,\"concurrentJobsLimit\":579396297,\"maxConcurrentJobs\":939575126,\"\":{\"ymnrtvq\":\"datawax\",\"kvyqpvz\":\"dataimavyotpcvpahh\",\"wtominrufqqa\":\"dataxzn\"}},{\"nodeName\":\"gasfmhbxv\",\"machineName\":\"kqnatxvuzc\",\"hostServiceUri\":\"lirybytcaqp\",\"status\":\"Initializing\",\"capabilities\":{\"vxyyhhsisz\":\"bn\",\"uukaamimkjz\":\"qfrpanteqiw\",\"xvksij\":\"xysjd\"},\"versionStatus\":\"gyindexijovu\",\"version\":\"uupzeadd\",\"registerTime\":\"2021-06-23T09:58:27Z\",\"lastConnectTime\":\"2021-06-04T16:21:17Z\",\"expiryTime\":\"2021-02-03T05:13:03Z\",\"lastStartTime\":\"2021-02-27T19:33:05Z\",\"lastStopTime\":\"2021-10-01T21:16:03Z\",\"lastUpdateResult\":\"None\",\"lastStartUpdateTime\":\"2021-12-01T18:49:21Z\",\"lastEndUpdateTime\":\"2021-06-17T04:35:24Z\",\"isActiveDispatcher\":true,\"concurrentJobsLimit\":1693962581,\"maxConcurrentJobs\":1798638813,\"\":{\"oabfcvefb\":\"dataxbthtnyzpuonrmdl\",\"uy\":\"dataxpmgyqshsasmr\"}}],\"scheduledUpdateDate\":\"2021-10-28T22:40:11Z\",\"updateDelayOffset\":\"xrgrztkyqgu\",\"localTimeZoneOffset\":\"uih\",\"capabilities\":{\"rpfivypm\":\"gkyncyzjndfeemxi\",\"cr\":\"dzaj\"},\"serviceUrls\":[\"poqimy\",\"xnpdggllyduyu\",\"dmzu\",\"xvzvwlxd\"],\"autoUpdate\":\"Off\",\"versionStatus\":\"zeurdoxkl\",\"links\":[{\"name\":\"siznymwz\",\"subscriptionId\":\"pkihqhnfubevwa\",\"dataFactoryName\":\"c\",\"dataFactoryLocation\":\"xevlt\",\"createTime\":\"2021-03-14T00:40:42Z\"},{\"name\":\"oqiaklqakpstifm\",\"subscriptionId\":\"wrphmriipz\",\"dataFactoryName\":\"ofuadcj\",\"dataFactoryLocation\":\"eaqkg\",\"createTime\":\"2021-03-25T15:46:49Z\"},{\"name\":\"r\",\"subscriptionId\":\"eynqlsnrgaxoyv\",\"dataFactoryName\":\"jpf\",\"dataFactoryLocation\":\"hsppvjsduouoqte\",\"createTime\":\"2021-09-10T05:04:14Z\"}],\"pushedVersion\":\"muogeq\",\"latestVersion\":\"paseqcp\",\"autoUpdateETA\":\"2021-03-07T20:06:56Z\",\"selfContainedInteractiveAuthoringEnabled\":false},\"dataFactoryName\":\"uwvzh\",\"state\":\"Limited\",\"\":{\"f\":\"dataoiq\",\"lwyoxzuhellitpqv\":\"datattqgt\",\"bzvtvxx\":\"dataivrsgqbmolxeom\"}}") + .toObject(SelfHostedIntegrationRuntimeStatus.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SelfHostedIntegrationRuntimeStatus model = + new SelfHostedIntegrationRuntimeStatus() + .withNodes( + Arrays + .asList( + new SelfHostedIntegrationRuntimeNodeInner() + .withAdditionalProperties( + mapOf( + "nodeName", + "htekxnvkdvc", + "lastStartUpdateTime", + "2021-01-22T09:30:22Z", + "lastConnectTime", + "2021-12-01T16:50:08Z", + "capabilities", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"th\":\"tamkyrkw\",\"jbfyroswnfqdfwv\":\"ivocffxhvnodqq\"}", + Object.class, + SerializerEncoding.JSON), + "hostServiceUri", + "dddwzd", + "registerTime", + "2021-07-10T09:56:33Z", + "maxConcurrentJobs", + 1505679455, + "lastStopTime", + "2021-01-01T00:19:44Z", + "version", + "pztuskpncdocloe", + "machineName", + "wrd", + "versionStatus", + "frwv", + "concurrentJobsLimit", + 1255010418, + "lastEndUpdateTime", + "2021-02-18T06:02:30Z", + "expiryTime", + "2021-02-26T17:40:53Z", + "lastStartTime", + "2021-12-01T08:38:07Z", + "lastUpdateResult", + "None", + "isActiveDispatcher", + true, + "status", + "NeedRegistration")), + new SelfHostedIntegrationRuntimeNodeInner() + .withAdditionalProperties( + mapOf( + "nodeName", + "mqonxvnmcyze", + "lastStartUpdateTime", + "2021-04-09T12:09:36Z", + "lastConnectTime", + "2021-04-04T14:18:04Z", + "capabilities", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"mhmifhfutjyx\":\"qfvbksksmqmwow\"}", + Object.class, + SerializerEncoding.JSON), + "hostServiceUri", + "esswbrnbox", + "registerTime", + "2021-02-27T17:53:42Z", + "maxConcurrentJobs", + 1990441761, + "lastStopTime", + "2021-09-10T19:37:52Z", + "version", + "qaemo", + "machineName", + "vw", + "versionStatus", + "mgt", + "concurrentJobsLimit", + 1357414966, + "lastEndUpdateTime", + "2021-08-08T17:12:18Z", + "expiryTime", + "2021-03-07T22:35:11Z", + "lastStartTime", + "2021-01-16T10:07:16Z", + "lastUpdateResult", + "None", + "isActiveDispatcher", + false, + "status", + "Limited")), + new SelfHostedIntegrationRuntimeNodeInner() + .withAdditionalProperties( + mapOf( + "nodeName", + "gygawyhpwmdk", + "lastStartUpdateTime", + "2021-03-27T21:52:11Z", + "lastConnectTime", + "2021-08-26T03:52:19Z", + "capabilities", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"zowgmmixf\":\"ku\",\"jnpahzhpqscuyil\":\"aupgblna\",\"ebmuiongmndwohoe\":\"qjzri\",\"uxfvbjimzwynsm\":\"s\"}", + Object.class, + SerializerEncoding.JSON), + "hostServiceUri", + "puqyrpubbkhcidc", + "registerTime", + "2021-01-09T04:00:09Z", + "maxConcurrentJobs", + 939575126, + "lastStopTime", + "2021-08-19T10:17:05Z", + "version", + "mjw", + "machineName", + "gyelvyh", + "versionStatus", + "hvkyezwseyuo", + "concurrentJobsLimit", + 579396297, + "lastEndUpdateTime", + "2021-06-14T00:28:05Z", + "expiryTime", + "2021-05-27T13:05:43Z", + "lastStartTime", + "2021-07-09T20:27:44Z", + "lastUpdateResult", + "Succeed", + "isActiveDispatcher", + false, + "status", + "NeedRegistration")), + new SelfHostedIntegrationRuntimeNodeInner() + .withAdditionalProperties( + mapOf( + "nodeName", + "gasfmhbxv", + "lastStartUpdateTime", + "2021-12-01T18:49:21Z", + "lastConnectTime", + "2021-06-04T16:21:17Z", + "capabilities", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"vxyyhhsisz\":\"bn\",\"uukaamimkjz\":\"qfrpanteqiw\",\"xvksij\":\"xysjd\"}", + Object.class, + SerializerEncoding.JSON), + "hostServiceUri", + "lirybytcaqp", + "registerTime", + "2021-06-23T09:58:27Z", + "maxConcurrentJobs", + 1798638813, + "lastStopTime", + "2021-10-01T21:16:03Z", + "version", + "uupzeadd", + "machineName", + "kqnatxvuzc", + "versionStatus", + "gyindexijovu", + "concurrentJobsLimit", + 1693962581, + "lastEndUpdateTime", + "2021-06-17T04:35:24Z", + "expiryTime", + "2021-02-03T05:13:03Z", + "lastStartTime", + "2021-02-27T19:33:05Z", + "lastUpdateResult", + "None", + "isActiveDispatcher", + true, + "status", + "Initializing")))) + .withLinks( + Arrays + .asList( + new LinkedIntegrationRuntime(), + new LinkedIntegrationRuntime(), + new LinkedIntegrationRuntime())); + model = BinaryData.fromObject(model).toObject(SelfHostedIntegrationRuntimeStatus.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfHostedIntegrationRuntimeStatusTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfHostedIntegrationRuntimeStatusTypePropertiesTests.java new file mode 100644 index 000000000000..e66a43489865 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SelfHostedIntegrationRuntimeStatusTypePropertiesTests.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.datafactory.fluent.models.SelfHostedIntegrationRuntimeNodeInner; +import com.azure.resourcemanager.datafactory.fluent.models.SelfHostedIntegrationRuntimeStatusTypeProperties; +import com.azure.resourcemanager.datafactory.models.LinkedIntegrationRuntime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public final class SelfHostedIntegrationRuntimeStatusTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SelfHostedIntegrationRuntimeStatusTypeProperties model = + BinaryData + .fromString( + "{\"createTime\":\"2021-02-13T03:04:12Z\",\"taskQueueId\":\"yacgih\",\"internalChannelEncryption\":\"NotSet\",\"version\":\"cuedybkbgdwbmi\",\"nodes\":[{\"nodeName\":\"a\",\"machineName\":\"wedbpirbz\",\"hostServiceUri\":\"uzbbhxncs\",\"status\":\"InitializeFailed\",\"capabilities\":{\"ltniuiimerffhgvc\":\"veuxgmigsoeb\",\"feudbobmoljirch\":\"mddoeilhgga\",\"vccquajpoipdjxyo\":\"wlzi\"},\"versionStatus\":\"vraxhnto\",\"version\":\"fszkrlkosjwrrets\",\"registerTime\":\"2021-10-13T01:30:26Z\",\"lastConnectTime\":\"2021-06-28T14:03:07Z\",\"expiryTime\":\"2021-04-17T06:24:34Z\",\"lastStartTime\":\"2021-06-06T15:54:39Z\",\"lastStopTime\":\"2021-06-16T13:23:22Z\",\"lastUpdateResult\":\"Succeed\",\"lastStartUpdateTime\":\"2021-09-19T12:13:02Z\",\"lastEndUpdateTime\":\"2021-09-13T03:41:11Z\",\"isActiveDispatcher\":false,\"concurrentJobsLimit\":1049765252,\"maxConcurrentJobs\":1561686443,\"\":{\"bmggnqx\":\"datauwhdqngqam\",\"kvomdqxnoy\":\"dataexqzaffzqodoks\",\"nqnttrwocb\":\"dataqipapifccydbjgh\"}},{\"nodeName\":\"vxdvphxmw\",\"machineName\":\"xcaicb\",\"hostServiceUri\":\"bogsfov\",\"status\":\"Initializing\",\"capabilities\":{\"gunrukcyyaa\":\"y\"},\"versionStatus\":\"kubzq\",\"version\":\"dlrkvitzk\",\"registerTime\":\"2021-11-08T06:32:59Z\",\"lastConnectTime\":\"2021-04-07T03:33:39Z\",\"expiryTime\":\"2021-02-19T10:39:22Z\",\"lastStartTime\":\"2021-11-26T11:08:51Z\",\"lastStopTime\":\"2021-01-21T13:21:41Z\",\"lastUpdateResult\":\"Fail\",\"lastStartUpdateTime\":\"2021-04-13T20:26:39Z\",\"lastEndUpdateTime\":\"2021-08-26T10:49:52Z\",\"isActiveDispatcher\":false,\"concurrentJobsLimit\":1165715853,\"maxConcurrentJobs\":201253191,\"\":{\"ulqfpqqll\":\"datahpvarumvuwj\",\"raczvtniwfcubw\":\"datavzlhjgmrodblap\",\"ceg\":\"dataxmyibx\"}},{\"nodeName\":\"tgxkxtcxb\",\"machineName\":\"beyqohvi\",\"hostServiceUri\":\"pjfkr\",\"status\":\"InitializeFailed\",\"capabilities\":{\"ocjasuame\":\"lgbvtpxowgoww\",\"esloblit\":\"jkfiszhexumfav\",\"trztogujg\":\"rrsjscosanjso\"},\"versionStatus\":\"clxhwkzfggs\",\"version\":\"kvdantpzuiwa\",\"registerTime\":\"2021-08-04T05:42:18Z\",\"lastConnectTime\":\"2021-08-22T07:40:35Z\",\"expiryTime\":\"2021-06-25T02:31:13Z\",\"lastStartTime\":\"2021-07-21T07:45:13Z\",\"lastStopTime\":\"2021-06-24T14:20:53Z\",\"lastUpdateResult\":\"Fail\",\"lastStartUpdateTime\":\"2021-06-22T12:30:30Z\",\"lastEndUpdateTime\":\"2021-12-06T12:52:42Z\",\"isActiveDispatcher\":true,\"concurrentJobsLimit\":1481970214,\"maxConcurrentJobs\":347395039,\"\":{\"juwgw\":\"datakpoidfzwegvu\",\"cfsssmyaemkrh\":\"dataccvufjqv\",\"qcpenob\":\"datasdgktluifiqg\",\"ufzsautbric\":\"dataysbeespqbvvaersz\"}},{\"nodeName\":\"ofenin\",\"machineName\":\"unhy\",\"hostServiceUri\":\"xckdlxjpisrdn\",\"status\":\"Initializing\",\"capabilities\":{\"fvijnu\":\"be\",\"lghkvoxdpor\":\"xfiiytqxewjsyute\",\"vbkutogecyqoy\":\"k\"},\"versionStatus\":\"ssbvqnpwdwdmu\",\"version\":\"a\",\"registerTime\":\"2021-11-15T19:44:59Z\",\"lastConnectTime\":\"2021-11-27T10:02:18Z\",\"expiryTime\":\"2021-07-18T23:19:26Z\",\"lastStartTime\":\"2021-08-07T10:40:29Z\",\"lastStopTime\":\"2021-04-19T19:41:17Z\",\"lastUpdateResult\":\"Fail\",\"lastStartUpdateTime\":\"2021-01-22T09:48:44Z\",\"lastEndUpdateTime\":\"2021-01-24T12:50:02Z\",\"isActiveDispatcher\":false,\"concurrentJobsLimit\":1160702084,\"maxConcurrentJobs\":1043840923,\"\":{\"cjni\":\"datahdhfrvsizfwgn\",\"wuuogdkpnmwrfu\":\"dataffwcgjjio\",\"l\":\"datajdebyxqucnbgib\"}}],\"scheduledUpdateDate\":\"2021-03-03T09:06:06Z\",\"updateDelayOffset\":\"kouzyv\",\"localTimeZoneOffset\":\"evbfvxmtsmgkret\",\"capabilities\":{\"oy\":\"rceulbyzzcxsyg\"},\"serviceUrls\":[\"kdpzbrxbmlj\"],\"autoUpdate\":\"On\",\"versionStatus\":\"jleuxixkps\",\"links\":[{\"name\":\"nimqoa\",\"subscriptionId\":\"qzxjziqcsotwqtk\",\"dataFactoryName\":\"cdefqoermgmg\",\"dataFactoryLocation\":\"daxao\",\"createTime\":\"2021-11-20T12:07:58Z\"},{\"name\":\"cmmmbipysehyybo\",\"subscriptionId\":\"jcvmkkbp\",\"dataFactoryName\":\"iwdyyhdt\",\"dataFactoryLocation\":\"mbrwqwvcwc\",\"createTime\":\"2021-05-19T23:17:23Z\"},{\"name\":\"trgpd\",\"subscriptionId\":\"t\",\"dataFactoryName\":\"hyfwjfqktuzr\",\"dataFactoryLocation\":\"pecsdk\",\"createTime\":\"2021-03-28T12:44:10Z\"}],\"pushedVersion\":\"bvttqjntvhnj\",\"latestVersion\":\"hjlugcupcyfrhoo\",\"autoUpdateETA\":\"2021-09-05T04:43:39Z\",\"selfContainedInteractiveAuthoringEnabled\":true}") + .toObject(SelfHostedIntegrationRuntimeStatusTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SelfHostedIntegrationRuntimeStatusTypeProperties model = + new SelfHostedIntegrationRuntimeStatusTypeProperties() + .withNodes( + Arrays + .asList( + new SelfHostedIntegrationRuntimeNodeInner() + .withAdditionalProperties( + mapOf( + "nodeName", + "a", + "lastStartUpdateTime", + "2021-09-19T12:13:02Z", + "lastConnectTime", + "2021-06-28T14:03:07Z", + "capabilities", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"ltniuiimerffhgvc\":\"veuxgmigsoeb\",\"feudbobmoljirch\":\"mddoeilhgga\",\"vccquajpoipdjxyo\":\"wlzi\"}", + Object.class, + SerializerEncoding.JSON), + "hostServiceUri", + "uzbbhxncs", + "registerTime", + "2021-10-13T01:30:26Z", + "maxConcurrentJobs", + 1561686443, + "lastStopTime", + "2021-06-16T13:23:22Z", + "version", + "fszkrlkosjwrrets", + "machineName", + "wedbpirbz", + "versionStatus", + "vraxhnto", + "concurrentJobsLimit", + 1049765252, + "lastEndUpdateTime", + "2021-09-13T03:41:11Z", + "expiryTime", + "2021-04-17T06:24:34Z", + "lastStartTime", + "2021-06-06T15:54:39Z", + "lastUpdateResult", + "Succeed", + "isActiveDispatcher", + false, + "status", + "InitializeFailed")), + new SelfHostedIntegrationRuntimeNodeInner() + .withAdditionalProperties( + mapOf( + "nodeName", + "vxdvphxmw", + "lastStartUpdateTime", + "2021-04-13T20:26:39Z", + "lastConnectTime", + "2021-04-07T03:33:39Z", + "capabilities", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"gunrukcyyaa\":\"y\"}", Object.class, SerializerEncoding.JSON), + "hostServiceUri", + "bogsfov", + "registerTime", + "2021-11-08T06:32:59Z", + "maxConcurrentJobs", + 201253191, + "lastStopTime", + "2021-01-21T13:21:41Z", + "version", + "dlrkvitzk", + "machineName", + "xcaicb", + "versionStatus", + "kubzq", + "concurrentJobsLimit", + 1165715853, + "lastEndUpdateTime", + "2021-08-26T10:49:52Z", + "expiryTime", + "2021-02-19T10:39:22Z", + "lastStartTime", + "2021-11-26T11:08:51Z", + "lastUpdateResult", + "Fail", + "isActiveDispatcher", + false, + "status", + "Initializing")), + new SelfHostedIntegrationRuntimeNodeInner() + .withAdditionalProperties( + mapOf( + "nodeName", + "tgxkxtcxb", + "lastStartUpdateTime", + "2021-06-22T12:30:30Z", + "lastConnectTime", + "2021-08-22T07:40:35Z", + "capabilities", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"ocjasuame\":\"lgbvtpxowgoww\",\"esloblit\":\"jkfiszhexumfav\",\"trztogujg\":\"rrsjscosanjso\"}", + Object.class, + SerializerEncoding.JSON), + "hostServiceUri", + "pjfkr", + "registerTime", + "2021-08-04T05:42:18Z", + "maxConcurrentJobs", + 347395039, + "lastStopTime", + "2021-06-24T14:20:53Z", + "version", + "kvdantpzuiwa", + "machineName", + "beyqohvi", + "versionStatus", + "clxhwkzfggs", + "concurrentJobsLimit", + 1481970214, + "lastEndUpdateTime", + "2021-12-06T12:52:42Z", + "expiryTime", + "2021-06-25T02:31:13Z", + "lastStartTime", + "2021-07-21T07:45:13Z", + "lastUpdateResult", + "Fail", + "isActiveDispatcher", + true, + "status", + "InitializeFailed")), + new SelfHostedIntegrationRuntimeNodeInner() + .withAdditionalProperties( + mapOf( + "nodeName", + "ofenin", + "lastStartUpdateTime", + "2021-01-22T09:48:44Z", + "lastConnectTime", + "2021-11-27T10:02:18Z", + "capabilities", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"fvijnu\":\"be\",\"lghkvoxdpor\":\"xfiiytqxewjsyute\",\"vbkutogecyqoy\":\"k\"}", + Object.class, + SerializerEncoding.JSON), + "hostServiceUri", + "xckdlxjpisrdn", + "registerTime", + "2021-11-15T19:44:59Z", + "maxConcurrentJobs", + 1043840923, + "lastStopTime", + "2021-04-19T19:41:17Z", + "version", + "a", + "machineName", + "unhy", + "versionStatus", + "ssbvqnpwdwdmu", + "concurrentJobsLimit", + 1160702084, + "lastEndUpdateTime", + "2021-01-24T12:50:02Z", + "expiryTime", + "2021-07-18T23:19:26Z", + "lastStartTime", + "2021-08-07T10:40:29Z", + "lastUpdateResult", + "Fail", + "isActiveDispatcher", + false, + "status", + "Initializing")))) + .withLinks( + Arrays + .asList( + new LinkedIntegrationRuntime(), + new LinkedIntegrationRuntime(), + new LinkedIntegrationRuntime())); + model = BinaryData.fromObject(model).toObject(SelfHostedIntegrationRuntimeStatusTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ServiceNowObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ServiceNowObjectDatasetTests.java new file mode 100644 index 000000000000..93b42e7cdc8d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ServiceNowObjectDatasetTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.ServiceNowObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ServiceNowObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServiceNowObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"ServiceNowObject\",\"typeProperties\":{\"tableName\":\"datazd\"},\"description\":\"bj\",\"structure\":\"datadsysx\",\"schema\":\"datauhvhnlse\",\"linkedServiceName\":{\"referenceName\":\"zcrrwnkkgdwqym\",\"parameters\":{\"eluvmsa\":\"dataqeaxd\",\"hvvzfznfgpbc\":\"datahviawgqrw\"}},\"parameters\":{\"djieask\":{\"type\":\"Object\",\"defaultValue\":\"datam\"}},\"annotations\":[\"dataclnfusrgnos\",\"datakhb\",\"datajphlyyuahvy\",\"dataikbvqzrurgbqaucp\"],\"folder\":{\"name\":\"jnohafwm\"},\"\":{\"tugpeametsdwxfa\":\"datajly\",\"fegs\":\"datatxc\",\"hooimazkmqfwbgd\":\"datavbghoucvkan\"}}") + .toObject(ServiceNowObjectDataset.class); + Assertions.assertEquals("bj", model.description()); + Assertions.assertEquals("zcrrwnkkgdwqym", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("djieask").type()); + Assertions.assertEquals("jnohafwm", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServiceNowObjectDataset model = + new ServiceNowObjectDataset() + .withDescription("bj") + .withStructure("datadsysx") + .withSchema("datauhvhnlse") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("zcrrwnkkgdwqym") + .withParameters(mapOf("eluvmsa", "dataqeaxd", "hvvzfznfgpbc", "datahviawgqrw"))) + .withParameters( + mapOf( + "djieask", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datam"))) + .withAnnotations(Arrays.asList("dataclnfusrgnos", "datakhb", "datajphlyyuahvy", "dataikbvqzrurgbqaucp")) + .withFolder(new DatasetFolder().withName("jnohafwm")) + .withTableName("datazd"); + model = BinaryData.fromObject(model).toObject(ServiceNowObjectDataset.class); + Assertions.assertEquals("bj", model.description()); + Assertions.assertEquals("zcrrwnkkgdwqym", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("djieask").type()); + Assertions.assertEquals("jnohafwm", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ServiceNowSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ServiceNowSourceTests.java new file mode 100644 index 000000000000..13b5b4156fed --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ServiceNowSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ServiceNowSource; + +public final class ServiceNowSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServiceNowSource model = + BinaryData + .fromString( + "{\"type\":\"ServiceNowSource\",\"query\":\"dataiwcgcwmshlpq\",\"queryTimeout\":\"dataxhdwjfxopzclka\",\"additionalColumns\":\"datauomga\",\"sourceRetryCount\":\"datac\",\"sourceRetryWait\":\"datajjfmzv\",\"maxConcurrentConnections\":\"databflyzc\",\"disableMetricsCollection\":\"datamlybsy\",\"\":{\"bt\":\"datanvtvbfpuml\"}}") + .toObject(ServiceNowSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServiceNowSource model = + new ServiceNowSource() + .withSourceRetryCount("datac") + .withSourceRetryWait("datajjfmzv") + .withMaxConcurrentConnections("databflyzc") + .withDisableMetricsCollection("datamlybsy") + .withQueryTimeout("dataxhdwjfxopzclka") + .withAdditionalColumns("datauomga") + .withQuery("dataiwcgcwmshlpq"); + model = BinaryData.fromObject(model).toObject(ServiceNowSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SetVariableActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SetVariableActivityTests.java new file mode 100644 index 000000000000..d219939eb425 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SetVariableActivityTests.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.SecureInputOutputPolicy; +import com.azure.resourcemanager.datafactory.models.SetVariableActivity; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SetVariableActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SetVariableActivity model = + BinaryData + .fromString( + "{\"type\":\"SetVariable\",\"typeProperties\":{\"variableName\":\"apucnkn\",\"value\":\"datacoxeoptb\",\"setSystemVariable\":false},\"policy\":{\"secureInput\":true,\"secureOutput\":false},\"name\":\"xeqwgaeiceo\",\"description\":\"cdc\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"ypztssqbcla\",\"dependencyConditions\":[\"Completed\",\"Failed\"],\"\":{\"qyinfdmqjqjk\":\"datavttkha\",\"xpiczaqgevsnn\":\"dataq\"}}],\"userProperties\":[{\"name\":\"ufezwgwmdv\",\"value\":\"dataskffqqaobbq\"},{\"name\":\"dkjusqhr\",\"value\":\"dataadffdr\"},{\"name\":\"ykhtsycct\",\"value\":\"datarvn\"}],\"\":{\"m\":\"dataembcat\",\"vzhacorqbm\":\"datadwhixjk\"}}") + .toObject(SetVariableActivity.class); + Assertions.assertEquals("xeqwgaeiceo", model.name()); + Assertions.assertEquals("cdc", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("ypztssqbcla", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("ufezwgwmdv", model.userProperties().get(0).name()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("apucnkn", model.variableName()); + Assertions.assertEquals(false, model.setSystemVariable()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SetVariableActivity model = + new SetVariableActivity() + .withName("xeqwgaeiceo") + .withDescription("cdc") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ypztssqbcla") + .withDependencyConditions( + Arrays.asList(DependencyCondition.COMPLETED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("ufezwgwmdv").withValue("dataskffqqaobbq"), + new UserProperty().withName("dkjusqhr").withValue("dataadffdr"), + new UserProperty().withName("ykhtsycct").withValue("datarvn"))) + .withPolicy(new SecureInputOutputPolicy().withSecureInput(true).withSecureOutput(false)) + .withVariableName("apucnkn") + .withValue("datacoxeoptb") + .withSetSystemVariable(false); + model = BinaryData.fromObject(model).toObject(SetVariableActivity.class); + Assertions.assertEquals("xeqwgaeiceo", model.name()); + Assertions.assertEquals("cdc", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("ypztssqbcla", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("ufezwgwmdv", model.userProperties().get(0).name()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + Assertions.assertEquals("apucnkn", model.variableName()); + Assertions.assertEquals(false, model.setSystemVariable()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SetVariableActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SetVariableActivityTypePropertiesTests.java new file mode 100644 index 000000000000..e68843dddfec --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SetVariableActivityTypePropertiesTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SetVariableActivityTypeProperties; +import org.junit.jupiter.api.Assertions; + +public final class SetVariableActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SetVariableActivityTypeProperties model = + BinaryData + .fromString("{\"variableName\":\"oa\",\"value\":\"dataaqfqgmwdo\",\"setSystemVariable\":true}") + .toObject(SetVariableActivityTypeProperties.class); + Assertions.assertEquals("oa", model.variableName()); + Assertions.assertEquals(true, model.setSystemVariable()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SetVariableActivityTypeProperties model = + new SetVariableActivityTypeProperties() + .withVariableName("oa") + .withValue("dataaqfqgmwdo") + .withSetSystemVariable(true); + model = BinaryData.fromObject(model).toObject(SetVariableActivityTypeProperties.class); + Assertions.assertEquals("oa", model.variableName()); + Assertions.assertEquals(true, model.setSystemVariable()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SftpLocationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SftpLocationTests.java new file mode 100644 index 000000000000..9b9d50effceb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SftpLocationTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SftpLocation; + +public final class SftpLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SftpLocation model = + BinaryData + .fromString( + "{\"type\":\"SftpLocation\",\"folderPath\":\"dataw\",\"fileName\":\"datavxakglh\",\"\":{\"qiy\":\"datasrfga\",\"yqyxyjrcbqpbis\":\"datavxcgdhyhgoqgs\",\"yjz\":\"dataglqjoxtdahneaoov\",\"fsr\":\"dataivfwjlofze\"}}") + .toObject(SftpLocation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SftpLocation model = new SftpLocation().withFolderPath("dataw").withFileName("datavxakglh"); + model = BinaryData.fromObject(model).toObject(SftpLocation.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SftpReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SftpReadSettingsTests.java new file mode 100644 index 000000000000..fe87056c1057 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SftpReadSettingsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SftpReadSettings; + +public final class SftpReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SftpReadSettings model = + BinaryData + .fromString( + "{\"type\":\"SftpReadSettings\",\"recursive\":\"datajytvq\",\"wildcardFolderPath\":\"datarupsuyqvmxnavx\",\"wildcardFileName\":\"datayaptexzylqhewhcc\",\"enablePartitionDiscovery\":\"dataxczrmyniwggmi\",\"partitionRootPath\":\"datawolfmfazxwcaic\",\"fileListPath\":\"datajttzfswohddliikk\",\"deleteFilesAfterCompletion\":\"dataqpliegemtnbkev\",\"modifiedDatetimeStart\":\"datak\",\"modifiedDatetimeEnd\":\"dataiksncr\",\"disableChunking\":\"datatlrbzqtu\",\"maxConcurrentConnections\":\"dataajfay\",\"disableMetricsCollection\":\"dataohdlpcix\",\"\":{\"azylaya\":\"datanyhivhyujqxyfb\",\"gcn\":\"datardnovuduwwjo\",\"hwwhyejhwbdf\":\"datakmci\",\"zwkmrjfsqbc\":\"dataf\"}}") + .toObject(SftpReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SftpReadSettings model = + new SftpReadSettings() + .withMaxConcurrentConnections("dataajfay") + .withDisableMetricsCollection("dataohdlpcix") + .withRecursive("datajytvq") + .withWildcardFolderPath("datarupsuyqvmxnavx") + .withWildcardFileName("datayaptexzylqhewhcc") + .withEnablePartitionDiscovery("dataxczrmyniwggmi") + .withPartitionRootPath("datawolfmfazxwcaic") + .withFileListPath("datajttzfswohddliikk") + .withDeleteFilesAfterCompletion("dataqpliegemtnbkev") + .withModifiedDatetimeStart("datak") + .withModifiedDatetimeEnd("dataiksncr") + .withDisableChunking("datatlrbzqtu"); + model = BinaryData.fromObject(model).toObject(SftpReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SftpWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SftpWriteSettingsTests.java new file mode 100644 index 000000000000..952bab1aa331 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SftpWriteSettingsTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SftpWriteSettings; + +public final class SftpWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SftpWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"SftpWriteSettings\",\"operationTimeout\":\"dataxzzhldaxvir\",\"useTempFileRename\":\"datawacfqnw\",\"maxConcurrentConnections\":\"datab\",\"disableMetricsCollection\":\"datagi\",\"copyBehavior\":\"datazrpqe\",\"\":{\"a\":\"dataldvxcjjhjnpa\"}}") + .toObject(SftpWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SftpWriteSettings model = + new SftpWriteSettings() + .withMaxConcurrentConnections("datab") + .withDisableMetricsCollection("datagi") + .withCopyBehavior("datazrpqe") + .withOperationTimeout("dataxzzhldaxvir") + .withUseTempFileRename("datawacfqnw"); + model = BinaryData.fromObject(model).toObject(SftpWriteSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SharePointOnlineListDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SharePointOnlineListDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..252d50b29d3c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SharePointOnlineListDatasetTypePropertiesTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SharePointOnlineListDatasetTypeProperties; + +public final class SharePointOnlineListDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SharePointOnlineListDatasetTypeProperties model = + BinaryData.fromString("{\"listName\":\"datak\"}").toObject(SharePointOnlineListDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SharePointOnlineListDatasetTypeProperties model = + new SharePointOnlineListDatasetTypeProperties().withListName("datak"); + model = BinaryData.fromObject(model).toObject(SharePointOnlineListDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SharePointOnlineListResourceDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SharePointOnlineListResourceDatasetTests.java new file mode 100644 index 000000000000..bcb07e2a56b4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SharePointOnlineListResourceDatasetTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SharePointOnlineListResourceDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SharePointOnlineListResourceDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SharePointOnlineListResourceDataset model = + BinaryData + .fromString( + "{\"type\":\"SharePointOnlineListResource\",\"typeProperties\":{\"listName\":\"datazgi\"},\"description\":\"kjkngzfsulaybhoz\",\"structure\":\"databuf\",\"schema\":\"databvcntpoeeytrsl\",\"linkedServiceName\":{\"referenceName\":\"zmzuicsggsxznbp\",\"parameters\":{\"njl\":\"dataqbylb\",\"nitvkyahfoyfzo\":\"dataicqomanefwl\"}},\"parameters\":{\"jukfalwceechcayv\":{\"type\":\"Float\",\"defaultValue\":\"dataprev\"},\"iybfbyd\":{\"type\":\"Float\",\"defaultValue\":\"dataqpucnusnylfhicrj\"},\"brhxgiknrlugs\":{\"type\":\"String\",\"defaultValue\":\"datallbofsnqoc\"}},\"annotations\":[\"databro\",\"datajf\",\"dataamzkuxdgpksgotbu\",\"datavnjql\"],\"folder\":{\"name\":\"qvcugusqlxlx\"},\"\":{\"nlmpuyypaggpaih\":\"datahfwlnvqacbyfisb\",\"ymipvlxty\":\"dataaeyzwloqrmgd\"}}") + .toObject(SharePointOnlineListResourceDataset.class); + Assertions.assertEquals("kjkngzfsulaybhoz", model.description()); + Assertions.assertEquals("zmzuicsggsxznbp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("jukfalwceechcayv").type()); + Assertions.assertEquals("qvcugusqlxlx", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SharePointOnlineListResourceDataset model = + new SharePointOnlineListResourceDataset() + .withDescription("kjkngzfsulaybhoz") + .withStructure("databuf") + .withSchema("databvcntpoeeytrsl") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("zmzuicsggsxznbp") + .withParameters(mapOf("njl", "dataqbylb", "nitvkyahfoyfzo", "dataicqomanefwl"))) + .withParameters( + mapOf( + "jukfalwceechcayv", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("dataprev"), + "iybfbyd", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("dataqpucnusnylfhicrj"), + "brhxgiknrlugs", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("datallbofsnqoc"))) + .withAnnotations(Arrays.asList("databro", "datajf", "dataamzkuxdgpksgotbu", "datavnjql")) + .withFolder(new DatasetFolder().withName("qvcugusqlxlx")) + .withListName("datazgi"); + model = BinaryData.fromObject(model).toObject(SharePointOnlineListResourceDataset.class); + Assertions.assertEquals("kjkngzfsulaybhoz", model.description()); + Assertions.assertEquals("zmzuicsggsxznbp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("jukfalwceechcayv").type()); + Assertions.assertEquals("qvcugusqlxlx", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SharePointOnlineListSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SharePointOnlineListSourceTests.java new file mode 100644 index 000000000000..081dad2a798b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SharePointOnlineListSourceTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SharePointOnlineListSource; + +public final class SharePointOnlineListSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SharePointOnlineListSource model = + BinaryData + .fromString( + "{\"type\":\"SharePointOnlineListSource\",\"query\":\"dataejjbx\",\"httpRequestTimeout\":\"datat\",\"sourceRetryCount\":\"datajpwbxann\",\"sourceRetryWait\":\"dataxvthqjvoydegg\",\"maxConcurrentConnections\":\"datalbxnypkppnzalu\",\"disableMetricsCollection\":\"dataxwazf\",\"\":{\"fmbser\":\"dataxg\"}}") + .toObject(SharePointOnlineListSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SharePointOnlineListSource model = + new SharePointOnlineListSource() + .withSourceRetryCount("datajpwbxann") + .withSourceRetryWait("dataxvthqjvoydegg") + .withMaxConcurrentConnections("datalbxnypkppnzalu") + .withDisableMetricsCollection("dataxwazf") + .withQuery("dataejjbx") + .withHttpRequestTimeout("datat"); + model = BinaryData.fromObject(model).toObject(SharePointOnlineListSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ShopifyObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ShopifyObjectDatasetTests.java new file mode 100644 index 000000000000..e3f5245d4e39 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ShopifyObjectDatasetTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.ShopifyObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ShopifyObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ShopifyObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"ShopifyObject\",\"typeProperties\":{\"tableName\":\"dataybfmpotal\"},\"description\":\"figrxxtrco\",\"structure\":\"dataqe\",\"schema\":\"dataldmxxbjh\",\"linkedServiceName\":{\"referenceName\":\"pvamsxrwqlwdf\",\"parameters\":{\"bboffgxtae\":\"datarplzeqzv\",\"fcyatbxdwr\":\"dataxt\",\"fbpeigkflvovriq\":\"datayvtkmxvztshnu\"}},\"parameters\":{\"txur\":{\"type\":\"Float\",\"defaultValue\":\"datakqcgzygtdjhtbar\"}},\"annotations\":[\"datayyumhzpst\",\"datacqacvttyh\",\"databilnszyjbuw\"],\"folder\":{\"name\":\"sydsci\"},\"\":{\"l\":\"dataayioxpqgqs\",\"akqsjymcfv\":\"datalefeombodvdgf\",\"nbpkfnxrlncmlzvv\":\"datazceuyuqktck\",\"cjqzrevfwcba\":\"datamesfhqs\"}}") + .toObject(ShopifyObjectDataset.class); + Assertions.assertEquals("figrxxtrco", model.description()); + Assertions.assertEquals("pvamsxrwqlwdf", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("txur").type()); + Assertions.assertEquals("sydsci", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ShopifyObjectDataset model = + new ShopifyObjectDataset() + .withDescription("figrxxtrco") + .withStructure("dataqe") + .withSchema("dataldmxxbjh") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("pvamsxrwqlwdf") + .withParameters( + mapOf( + "bboffgxtae", + "datarplzeqzv", + "fcyatbxdwr", + "dataxt", + "fbpeigkflvovriq", + "datayvtkmxvztshnu"))) + .withParameters( + mapOf( + "txur", + new ParameterSpecification() + .withType(ParameterType.FLOAT) + .withDefaultValue("datakqcgzygtdjhtbar"))) + .withAnnotations(Arrays.asList("datayyumhzpst", "datacqacvttyh", "databilnszyjbuw")) + .withFolder(new DatasetFolder().withName("sydsci")) + .withTableName("dataybfmpotal"); + model = BinaryData.fromObject(model).toObject(ShopifyObjectDataset.class); + Assertions.assertEquals("figrxxtrco", model.description()); + Assertions.assertEquals("pvamsxrwqlwdf", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("txur").type()); + Assertions.assertEquals("sydsci", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ShopifySourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ShopifySourceTests.java new file mode 100644 index 000000000000..8c0df6fc55c7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ShopifySourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ShopifySource; + +public final class ShopifySourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ShopifySource model = + BinaryData + .fromString( + "{\"type\":\"ShopifySource\",\"query\":\"dataumuuqwcka\",\"queryTimeout\":\"datae\",\"additionalColumns\":\"datafzjwjefcli\",\"sourceRetryCount\":\"datanawipdqozv\",\"sourceRetryWait\":\"dataq\",\"maxConcurrentConnections\":\"datapvhwmtd\",\"disableMetricsCollection\":\"datarjvqvuvipsnfeago\",\"\":{\"wijxkxlto\":\"datasascnt\",\"mbpgcbltthsuzx\":\"datadwiffagfeq\",\"k\":\"datalviflzs\",\"vpokvhobygffuzh\":\"datascobhhblj\"}}") + .toObject(ShopifySource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ShopifySource model = + new ShopifySource() + .withSourceRetryCount("datanawipdqozv") + .withSourceRetryWait("dataq") + .withMaxConcurrentConnections("datapvhwmtd") + .withDisableMetricsCollection("datarjvqvuvipsnfeago") + .withQueryTimeout("datae") + .withAdditionalColumns("datafzjwjefcli") + .withQuery("dataumuuqwcka"); + model = BinaryData.fromObject(model).toObject(ShopifySource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SkipErrorFileTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SkipErrorFileTests.java new file mode 100644 index 000000000000..de91c1ed911a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SkipErrorFileTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SkipErrorFile; + +public final class SkipErrorFileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkipErrorFile model = + BinaryData + .fromString("{\"fileMissing\":\"datapbfsxps\",\"dataInconsistency\":\"dataevz\"}") + .toObject(SkipErrorFile.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SkipErrorFile model = new SkipErrorFile().withFileMissing("datapbfsxps").withDataInconsistency("dataevz"); + model = BinaryData.fromObject(model).toObject(SkipErrorFile.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeDatasetTests.java new file mode 100644 index 000000000000..4914a499e163 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeDatasetTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SnowflakeDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SnowflakeDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SnowflakeDataset model = + BinaryData + .fromString( + "{\"type\":\"SnowflakeTable\",\"typeProperties\":{\"schema\":\"dataqjfskjva\",\"table\":\"dataxrwkns\"},\"description\":\"hypbrzwiypz\",\"structure\":\"datahkecebtpgvutb\",\"schema\":\"datasfd\",\"linkedServiceName\":{\"referenceName\":\"wq\",\"parameters\":{\"dgrcifflxqqn\":\"dataowke\",\"ujticwmlf\":\"datagtcuyuwgnyjd\"}},\"parameters\":{\"ufpvvdgnmeiomn\":{\"type\":\"Float\",\"defaultValue\":\"datafmcoxbktuaj\"},\"i\":{\"type\":\"Float\",\"defaultValue\":\"dataaibcfbfyqz\"}},\"annotations\":[\"datafgvmrkmgifmy\",\"databuhdnhhcmtslptbd\",\"dataonhbl\"],\"folder\":{\"name\":\"cnuqfpzjz\"},\"\":{\"mruawqesqsqmiekx\":\"datacwtwtrchk\",\"qchf\":\"datap\",\"cu\":\"datatykkvjjlba\"}}") + .toObject(SnowflakeDataset.class); + Assertions.assertEquals("hypbrzwiypz", model.description()); + Assertions.assertEquals("wq", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("ufpvvdgnmeiomn").type()); + Assertions.assertEquals("cnuqfpzjz", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SnowflakeDataset model = + new SnowflakeDataset() + .withDescription("hypbrzwiypz") + .withStructure("datahkecebtpgvutb") + .withSchema("datasfd") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("wq") + .withParameters(mapOf("dgrcifflxqqn", "dataowke", "ujticwmlf", "datagtcuyuwgnyjd"))) + .withParameters( + mapOf( + "ufpvvdgnmeiomn", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datafmcoxbktuaj"), + "i", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("dataaibcfbfyqz"))) + .withAnnotations(Arrays.asList("datafgvmrkmgifmy", "databuhdnhhcmtslptbd", "dataonhbl")) + .withFolder(new DatasetFolder().withName("cnuqfpzjz")) + .withSchemaTypePropertiesSchema("dataqjfskjva") + .withTable("dataxrwkns"); + model = BinaryData.fromObject(model).toObject(SnowflakeDataset.class); + Assertions.assertEquals("hypbrzwiypz", model.description()); + Assertions.assertEquals("wq", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.FLOAT, model.parameters().get("ufpvvdgnmeiomn").type()); + Assertions.assertEquals("cnuqfpzjz", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..b359dec4ac05 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SnowflakeDatasetTypeProperties; + +public final class SnowflakeDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SnowflakeDatasetTypeProperties model = + BinaryData + .fromString("{\"schema\":\"datayqokbgumuejxxpx\",\"table\":\"datazch\"}") + .toObject(SnowflakeDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SnowflakeDatasetTypeProperties model = + new SnowflakeDatasetTypeProperties().withSchema("datayqokbgumuejxxpx").withTable("datazch"); + model = BinaryData.fromObject(model).toObject(SnowflakeDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeExportCopyCommandTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeExportCopyCommandTests.java new file mode 100644 index 000000000000..18716a11d802 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeExportCopyCommandTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SnowflakeExportCopyCommand; +import java.util.HashMap; +import java.util.Map; + +public final class SnowflakeExportCopyCommandTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SnowflakeExportCopyCommand model = + BinaryData + .fromString( + "{\"type\":\"SnowflakeExportCopyCommand\",\"additionalCopyOptions\":{\"fqyqvh\":\"dataqsohehhtltwvijd\"},\"additionalFormatOptions\":{\"xqfghlos\":\"datayvhrenozl\",\"esa\":\"dataopmkpcmtsban\"},\"\":{\"eog\":\"dataewrljmlodstzvtfy\",\"xhcygfg\":\"databsyni\",\"aosttbwap\":\"datamdbazggr\"}}") + .toObject(SnowflakeExportCopyCommand.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SnowflakeExportCopyCommand model = + new SnowflakeExportCopyCommand() + .withAdditionalCopyOptions(mapOf("fqyqvh", "dataqsohehhtltwvijd")) + .withAdditionalFormatOptions(mapOf("xqfghlos", "datayvhrenozl", "esa", "dataopmkpcmtsban")); + model = BinaryData.fromObject(model).toObject(SnowflakeExportCopyCommand.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeImportCopyCommandTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeImportCopyCommandTests.java new file mode 100644 index 000000000000..ba684372aa97 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeImportCopyCommandTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SnowflakeImportCopyCommand; +import java.util.HashMap; +import java.util.Map; + +public final class SnowflakeImportCopyCommandTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SnowflakeImportCopyCommand model = + BinaryData + .fromString( + "{\"type\":\"SnowflakeImportCopyCommand\",\"additionalCopyOptions\":{\"wpsxygrni\":\"datavllbbdfulvh\"},\"additionalFormatOptions\":{\"tyrj\":\"datapsebaz\",\"t\":\"dataoqgnsfzrrapi\",\"yymyy\":\"dataojqz\",\"dhz\":\"datahfdkjykvezsozt\"},\"\":{\"ljrnveqleoz\":\"datazldplamcc\"}}") + .toObject(SnowflakeImportCopyCommand.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SnowflakeImportCopyCommand model = + new SnowflakeImportCopyCommand() + .withAdditionalCopyOptions(mapOf("wpsxygrni", "datavllbbdfulvh")) + .withAdditionalFormatOptions( + mapOf( + "tyrj", + "datapsebaz", + "t", + "dataoqgnsfzrrapi", + "yymyy", + "dataojqz", + "dhz", + "datahfdkjykvezsozt")); + model = BinaryData.fromObject(model).toObject(SnowflakeImportCopyCommand.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeSinkTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeSinkTests.java new file mode 100644 index 000000000000..570b8e458bfc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeSinkTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SnowflakeImportCopyCommand; +import com.azure.resourcemanager.datafactory.models.SnowflakeSink; +import java.util.HashMap; +import java.util.Map; + +public final class SnowflakeSinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SnowflakeSink model = + BinaryData + .fromString( + "{\"type\":\"SnowflakeSink\",\"preCopyScript\":\"datax\",\"importSettings\":{\"type\":\"SnowflakeImportCopyCommand\",\"additionalCopyOptions\":{\"chysnmyuvfml\":\"datanghtknr\",\"pxoelfobehr\":\"datanrapxwt\",\"lojjcz\":\"dataf\"},\"additionalFormatOptions\":{\"gnqa\":\"datafwkvirmbrd\",\"ybh\":\"datankms\",\"enazjvyiiezd\":\"datadzvuhw\"},\"\":{\"y\":\"dataxtqzdbrmyutzttr\",\"ztz\":\"dataivkkuzrvceg\",\"lro\":\"datacfuwmxezzum\"}},\"writeBatchSize\":\"dataflh\",\"writeBatchTimeout\":\"dataspxblyokjwsszye\",\"sinkRetryCount\":\"dataoukdhnf\",\"sinkRetryWait\":\"datadggjihnzvoehgw\",\"maxConcurrentConnections\":\"datagcnkghgczjx\",\"disableMetricsCollection\":\"dataxigdwpgmhqhvne\",\"\":{\"aqlymmhzvnetecfy\":\"dataxqwc\",\"zxqwvvfkqbgkss\":\"datasfkcwfpoaflgkz\"}}") + .toObject(SnowflakeSink.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SnowflakeSink model = + new SnowflakeSink() + .withWriteBatchSize("dataflh") + .withWriteBatchTimeout("dataspxblyokjwsszye") + .withSinkRetryCount("dataoukdhnf") + .withSinkRetryWait("datadggjihnzvoehgw") + .withMaxConcurrentConnections("datagcnkghgczjx") + .withDisableMetricsCollection("dataxigdwpgmhqhvne") + .withPreCopyScript("datax") + .withImportSettings( + new SnowflakeImportCopyCommand() + .withAdditionalCopyOptions( + mapOf("chysnmyuvfml", "datanghtknr", "pxoelfobehr", "datanrapxwt", "lojjcz", "dataf")) + .withAdditionalFormatOptions( + mapOf("gnqa", "datafwkvirmbrd", "ybh", "datankms", "enazjvyiiezd", "datadzvuhw"))); + model = BinaryData.fromObject(model).toObject(SnowflakeSink.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeSourceTests.java new file mode 100644 index 000000000000..a037f9624ce1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SnowflakeSourceTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SnowflakeExportCopyCommand; +import com.azure.resourcemanager.datafactory.models.SnowflakeSource; +import java.util.HashMap; +import java.util.Map; + +public final class SnowflakeSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SnowflakeSource model = + BinaryData + .fromString( + "{\"type\":\"SnowflakeSource\",\"query\":\"databmahuwxodddqzew\",\"exportSettings\":{\"type\":\"SnowflakeExportCopyCommand\",\"additionalCopyOptions\":{\"s\":\"datatgsocqkdclbzqnao\",\"cbhezau\":\"datamp\"},\"additionalFormatOptions\":{\"aywmcipu\":\"dataysxhfupvqjkqlaf\",\"aifgyxkgqwmp\":\"dataefhhdrm\",\"nkxhc\":\"datahxpcxqc\",\"bxllfwxdou\":\"datadhx\"},\"\":{\"ofhk\":\"datapaqjahjxgedtmz\",\"rfassiii\":\"dataywtacgukierd\",\"ayyxgcgb\":\"datacmrgahs\",\"vqopxun\":\"dataieqonsbukznxd\"}},\"sourceRetryCount\":\"dataxtkmknacnfzcy\",\"sourceRetryWait\":\"datahdjpagwszm\",\"maxConcurrentConnections\":\"datagzfeyexbg\",\"disableMetricsCollection\":\"datayo\",\"\":{\"edxpbpjw\":\"dataigvqgceacqj\",\"baodi\":\"datannvd\"}}") + .toObject(SnowflakeSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SnowflakeSource model = + new SnowflakeSource() + .withSourceRetryCount("dataxtkmknacnfzcy") + .withSourceRetryWait("datahdjpagwszm") + .withMaxConcurrentConnections("datagzfeyexbg") + .withDisableMetricsCollection("datayo") + .withQuery("databmahuwxodddqzew") + .withExportSettings( + new SnowflakeExportCopyCommand() + .withAdditionalCopyOptions(mapOf("s", "datatgsocqkdclbzqnao", "cbhezau", "datamp")) + .withAdditionalFormatOptions( + mapOf( + "aywmcipu", + "dataysxhfupvqjkqlaf", + "aifgyxkgqwmp", + "dataefhhdrm", + "nkxhc", + "datahxpcxqc", + "bxllfwxdou", + "datadhx"))); + model = BinaryData.fromObject(model).toObject(SnowflakeSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkConfigurationParametrizationReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkConfigurationParametrizationReferenceTests.java new file mode 100644 index 000000000000..cff69ea925b4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkConfigurationParametrizationReferenceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SparkConfigurationParametrizationReference; +import com.azure.resourcemanager.datafactory.models.SparkConfigurationReferenceType; +import org.junit.jupiter.api.Assertions; + +public final class SparkConfigurationParametrizationReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SparkConfigurationParametrizationReference model = + BinaryData + .fromString("{\"type\":\"SparkConfigurationReference\",\"referenceName\":\"datadd\"}") + .toObject(SparkConfigurationParametrizationReference.class); + Assertions.assertEquals(SparkConfigurationReferenceType.SPARK_CONFIGURATION_REFERENCE, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SparkConfigurationParametrizationReference model = + new SparkConfigurationParametrizationReference() + .withType(SparkConfigurationReferenceType.SPARK_CONFIGURATION_REFERENCE) + .withReferenceName("datadd"); + model = BinaryData.fromObject(model).toObject(SparkConfigurationParametrizationReference.class); + Assertions.assertEquals(SparkConfigurationReferenceType.SPARK_CONFIGURATION_REFERENCE, model.type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..711c47e4f933 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SparkDatasetTypeProperties; + +public final class SparkDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SparkDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"datau\",\"table\":\"dataodincfbaoboiahk\",\"schema\":\"datasvaxmksaxyeedvp\"}") + .toObject(SparkDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SparkDatasetTypeProperties model = + new SparkDatasetTypeProperties() + .withTableName("datau") + .withTable("dataodincfbaoboiahk") + .withSchema("datasvaxmksaxyeedvp"); + model = BinaryData.fromObject(model).toObject(SparkDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkObjectDatasetTests.java new file mode 100644 index 000000000000..39f44ab8bf80 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkObjectDatasetTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SparkObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SparkObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SparkObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"SparkObject\",\"typeProperties\":{\"tableName\":\"datandmtqvmkmzvag\",\"table\":\"datafblsxyfqgtodg\",\"schema\":\"datalefmizdcsr\"},\"description\":\"bnasgfyxhsxcg\",\"structure\":\"datam\",\"schema\":\"datapqcnxs\",\"linkedServiceName\":{\"referenceName\":\"ehojvmazu\",\"parameters\":{\"hpdnc\":\"datapiuu\",\"h\":\"datakqrgiv\"}},\"parameters\":{\"uyrgcaygumqeo\":{\"type\":\"Bool\",\"defaultValue\":\"datalyhbjfnmmibgwc\"},\"sawha\":{\"type\":\"Float\",\"defaultValue\":\"datareud\"},\"zmfk\":{\"type\":\"Float\",\"defaultValue\":\"datas\"},\"k\":{\"type\":\"Int\",\"defaultValue\":\"datag\"}},\"annotations\":[\"datakcge\",\"datanubr\"],\"folder\":{\"name\":\"fkxnwt\"},\"\":{\"iwap\":\"dataoeqcrjvcjskqsfn\",\"nh\":\"dataunhdikatzmtuv\",\"ibxl\":\"datatjk\",\"u\":\"datazlvkcm\"}}") + .toObject(SparkObjectDataset.class); + Assertions.assertEquals("bnasgfyxhsxcg", model.description()); + Assertions.assertEquals("ehojvmazu", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("uyrgcaygumqeo").type()); + Assertions.assertEquals("fkxnwt", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SparkObjectDataset model = + new SparkObjectDataset() + .withDescription("bnasgfyxhsxcg") + .withStructure("datam") + .withSchema("datapqcnxs") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ehojvmazu") + .withParameters(mapOf("hpdnc", "datapiuu", "h", "datakqrgiv"))) + .withParameters( + mapOf( + "uyrgcaygumqeo", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("datalyhbjfnmmibgwc"), + "sawha", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datareud"), + "zmfk", + new ParameterSpecification().withType(ParameterType.FLOAT).withDefaultValue("datas"), + "k", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datag"))) + .withAnnotations(Arrays.asList("datakcge", "datanubr")) + .withFolder(new DatasetFolder().withName("fkxnwt")) + .withTableName("datandmtqvmkmzvag") + .withTable("datafblsxyfqgtodg") + .withSchemaTypePropertiesSchema("datalefmizdcsr"); + model = BinaryData.fromObject(model).toObject(SparkObjectDataset.class); + Assertions.assertEquals("bnasgfyxhsxcg", model.description()); + Assertions.assertEquals("ehojvmazu", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("uyrgcaygumqeo").type()); + Assertions.assertEquals("fkxnwt", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkSourceTests.java new file mode 100644 index 000000000000..ab90a8e313f4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SparkSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SparkSource; + +public final class SparkSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SparkSource model = + BinaryData + .fromString( + "{\"type\":\"SparkSource\",\"query\":\"datasr\",\"queryTimeout\":\"datafagoov\",\"additionalColumns\":\"datazysvnvrfjgbxu\",\"sourceRetryCount\":\"datahgonovwu\",\"sourceRetryWait\":\"dataarowrm\",\"maxConcurrentConnections\":\"dataziubkyvcgkoufwk\",\"disableMetricsCollection\":\"datamytlxrwdjby\",\"\":{\"makxyhuetztorh\":\"datafmsxamncuhxz\",\"jqgzloorhxdu\":\"dataeuuysszhse\",\"akgd\":\"dataegljqpyxi\",\"qwgoomapc\":\"dataanmhvwgchgpbd\"}}") + .toObject(SparkSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SparkSource model = + new SparkSource() + .withSourceRetryCount("datahgonovwu") + .withSourceRetryWait("dataarowrm") + .withMaxConcurrentConnections("dataziubkyvcgkoufwk") + .withDisableMetricsCollection("datamytlxrwdjby") + .withQueryTimeout("datafagoov") + .withAdditionalColumns("datazysvnvrfjgbxu") + .withQuery("datasr"); + model = BinaryData.fromObject(model).toObject(SparkSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlDWSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlDWSourceTests.java new file mode 100644 index 000000000000..5d18a1c20d58 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlDWSourceTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SqlDWSource; +import com.azure.resourcemanager.datafactory.models.SqlPartitionSettings; + +public final class SqlDWSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlDWSource model = + BinaryData + .fromString( + "{\"type\":\"SqlDWSource\",\"sqlReaderQuery\":\"datajunqwkjfmtuybdzr\",\"sqlReaderStoredProcedureName\":\"datackxennzowguirh\",\"storedProcedureParameters\":\"datajpw\",\"isolationLevel\":\"datamktpykoicpk\",\"partitionOption\":\"datamqfdtbaobjaof\",\"partitionSettings\":{\"partitionColumnName\":\"datahhrgvku\",\"partitionUpperBound\":\"datak\",\"partitionLowerBound\":\"dataielrwsjvdxenxjva\"},\"queryTimeout\":\"dataqgfvy\",\"additionalColumns\":\"datafyyknxuacfmb\",\"sourceRetryCount\":\"datalcimjm\",\"sourceRetryWait\":\"dataocryf\",\"maxConcurrentConnections\":\"datakt\",\"disableMetricsCollection\":\"datazuzvbqbroyrw\",\"\":{\"wc\":\"databfweozkbokffsu\",\"p\":\"datalzcavodcvfwkp\",\"txlkioviklxsgstu\":\"datasgfn\"}}") + .toObject(SqlDWSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlDWSource model = + new SqlDWSource() + .withSourceRetryCount("datalcimjm") + .withSourceRetryWait("dataocryf") + .withMaxConcurrentConnections("datakt") + .withDisableMetricsCollection("datazuzvbqbroyrw") + .withQueryTimeout("dataqgfvy") + .withAdditionalColumns("datafyyknxuacfmb") + .withSqlReaderQuery("datajunqwkjfmtuybdzr") + .withSqlReaderStoredProcedureName("datackxennzowguirh") + .withStoredProcedureParameters("datajpw") + .withIsolationLevel("datamktpykoicpk") + .withPartitionOption("datamqfdtbaobjaof") + .withPartitionSettings( + new SqlPartitionSettings() + .withPartitionColumnName("datahhrgvku") + .withPartitionUpperBound("datak") + .withPartitionLowerBound("dataielrwsjvdxenxjva")); + model = BinaryData.fromObject(model).toObject(SqlDWSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlMISourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlMISourceTests.java new file mode 100644 index 000000000000..0adaf0a8e8b3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlMISourceTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SqlMISource; +import com.azure.resourcemanager.datafactory.models.SqlPartitionSettings; + +public final class SqlMISourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlMISource model = + BinaryData + .fromString( + "{\"type\":\"SqlMISource\",\"sqlReaderQuery\":\"datarabbyfhz\",\"sqlReaderStoredProcedureName\":\"datajrxenpkxanlbrcy\",\"storedProcedureParameters\":\"datarc\",\"isolationLevel\":\"dataanbw\",\"produceAdditionalTypes\":\"datalqioq\",\"partitionOption\":\"dataxcg\",\"partitionSettings\":{\"partitionColumnName\":\"datal\",\"partitionUpperBound\":\"datalzgpghjakz\",\"partitionLowerBound\":\"dataxjnq\"},\"queryTimeout\":\"datajslwmjlpb\",\"additionalColumns\":\"datapfyup\",\"sourceRetryCount\":\"datajrwpoxuy\",\"sourceRetryWait\":\"datayoyjptkyfrkzg\",\"maxConcurrentConnections\":\"datawyqkkd\",\"disableMetricsCollection\":\"dataxdrgim\",\"\":{\"nl\":\"dataffybo\",\"hhgnu\":\"datavfundkhdmyxmsbt\",\"u\":\"datacbjxgjudgbwr\",\"mgsm\":\"datauzlfqhzihlzljqc\"}}") + .toObject(SqlMISource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlMISource model = + new SqlMISource() + .withSourceRetryCount("datajrwpoxuy") + .withSourceRetryWait("datayoyjptkyfrkzg") + .withMaxConcurrentConnections("datawyqkkd") + .withDisableMetricsCollection("dataxdrgim") + .withQueryTimeout("datajslwmjlpb") + .withAdditionalColumns("datapfyup") + .withSqlReaderQuery("datarabbyfhz") + .withSqlReaderStoredProcedureName("datajrxenpkxanlbrcy") + .withStoredProcedureParameters("datarc") + .withIsolationLevel("dataanbw") + .withProduceAdditionalTypes("datalqioq") + .withPartitionOption("dataxcg") + .withPartitionSettings( + new SqlPartitionSettings() + .withPartitionColumnName("datal") + .withPartitionUpperBound("datalzgpghjakz") + .withPartitionLowerBound("dataxjnq")); + model = BinaryData.fromObject(model).toObject(SqlMISource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlPartitionSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlPartitionSettingsTests.java new file mode 100644 index 000000000000..ffe0b76e9e6e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlPartitionSettingsTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SqlPartitionSettings; + +public final class SqlPartitionSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlPartitionSettings model = + BinaryData + .fromString( + "{\"partitionColumnName\":\"databsspexejhwpnjc\",\"partitionUpperBound\":\"datacj\",\"partitionLowerBound\":\"dataovuvmdzdqtir\"}") + .toObject(SqlPartitionSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlPartitionSettings model = + new SqlPartitionSettings() + .withPartitionColumnName("databsspexejhwpnjc") + .withPartitionUpperBound("datacj") + .withPartitionLowerBound("dataovuvmdzdqtir"); + model = BinaryData.fromObject(model).toObject(SqlPartitionSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerSourceTests.java new file mode 100644 index 000000000000..af791ca14f01 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerSourceTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SqlPartitionSettings; +import com.azure.resourcemanager.datafactory.models.SqlServerSource; + +public final class SqlServerSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerSource model = + BinaryData + .fromString( + "{\"type\":\"SqlServerSource\",\"sqlReaderQuery\":\"dataajsrdecbowkhmaff\",\"sqlReaderStoredProcedureName\":\"datapdnnsujx\",\"storedProcedureParameters\":\"dataeqljzkhncaeyk\",\"isolationLevel\":\"dataatztnprnsh\",\"produceAdditionalTypes\":\"dataiahvlzgsqwiubgbl\",\"partitionOption\":\"datayisjscuw\",\"partitionSettings\":{\"partitionColumnName\":\"dataktzcuxuxaihhegu\",\"partitionUpperBound\":\"dataziryxrpj\",\"partitionLowerBound\":\"datatmxq\"},\"queryTimeout\":\"dataepoftsapfwusf\",\"additionalColumns\":\"datanjvzlynvje\",\"sourceRetryCount\":\"datavu\",\"sourceRetryWait\":\"datalwzn\",\"maxConcurrentConnections\":\"dataie\",\"disableMetricsCollection\":\"datafg\",\"\":{\"kpswwutduchcfn\":\"dataftgbupu\"}}") + .toObject(SqlServerSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerSource model = + new SqlServerSource() + .withSourceRetryCount("datavu") + .withSourceRetryWait("datalwzn") + .withMaxConcurrentConnections("dataie") + .withDisableMetricsCollection("datafg") + .withQueryTimeout("dataepoftsapfwusf") + .withAdditionalColumns("datanjvzlynvje") + .withSqlReaderQuery("dataajsrdecbowkhmaff") + .withSqlReaderStoredProcedureName("datapdnnsujx") + .withStoredProcedureParameters("dataeqljzkhncaeyk") + .withIsolationLevel("dataatztnprnsh") + .withProduceAdditionalTypes("dataiahvlzgsqwiubgbl") + .withPartitionOption("datayisjscuw") + .withPartitionSettings( + new SqlPartitionSettings() + .withPartitionColumnName("dataktzcuxuxaihhegu") + .withPartitionUpperBound("dataziryxrpj") + .withPartitionLowerBound("datatmxq")); + model = BinaryData.fromObject(model).toObject(SqlServerSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerStoredProcedureActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerStoredProcedureActivityTests.java new file mode 100644 index 000000000000..9d5ec11bec5f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerStoredProcedureActivityTests.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.SqlServerStoredProcedureActivity; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerStoredProcedureActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerStoredProcedureActivity model = + BinaryData + .fromString( + "{\"type\":\"SqlServerStoredProcedure\",\"typeProperties\":{\"storedProcedureName\":\"datahvioccszdaxafu\",\"storedProcedureParameters\":\"datacnqfwob\"},\"linkedServiceName\":{\"referenceName\":\"luutmfimlo\",\"parameters\":{\"ljr\":\"datadxjirfye\",\"i\":\"datacgeorm\",\"twiocuha\":\"datawcqhaonmfnf\",\"eimwhot\":\"dataqielhtuk\"}},\"policy\":{\"timeout\":\"datadpqkfxdqm\",\"retry\":\"datarglqlv\",\"retryIntervalInSeconds\":634174133,\"secureInput\":false,\"secureOutput\":false,\"\":{\"hmzlet\":\"datamjuqq\",\"uefjbmowqwodm\":\"datackjuwkkvarff\"}},\"name\":\"rdtywajqwa\",\"description\":\"ia\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"rpcpg\",\"dependencyConditions\":[\"Completed\",\"Completed\",\"Skipped\",\"Skipped\"],\"\":{\"ab\":\"datarimletjvzptf\",\"zxupwrizkqnbiia\":\"datablhzfglpswg\",\"qhaskuio\":\"datadhsj\",\"hmrcxhn\":\"dataltchcuhvdr\"}},{\"activity\":\"jfdiijchtaaabt\",\"dependencyConditions\":[\"Skipped\",\"Skipped\",\"Failed\",\"Completed\"],\"\":{\"qhjpze\":\"datakvruomwyoktzffpc\",\"i\":\"dataqvkuvy\"}},{\"activity\":\"rfok\",\"dependencyConditions\":[\"Failed\",\"Succeeded\",\"Skipped\"],\"\":{\"gkugwtgfktwayh\":\"datatapkbdhyrm\",\"htkdcufzxxqdntvf\":\"datauhqvxeyliisatbs\"}}],\"userProperties\":[{\"name\":\"ernq\",\"value\":\"dataeiyyysvt\"},{\"name\":\"oxwugdzwo\",\"value\":\"datazfiz\"}],\"\":{\"ev\":\"datapddzzdw\",\"luwuns\":\"dataocnfzmuyykxlfl\",\"mgpomcre\":\"datayqpmnyvn\",\"lilzv\":\"datataz\"}}") + .toObject(SqlServerStoredProcedureActivity.class); + Assertions.assertEquals("rdtywajqwa", model.name()); + Assertions.assertEquals("ia", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("rpcpg", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("ernq", model.userProperties().get(0).name()); + Assertions.assertEquals("luutmfimlo", model.linkedServiceName().referenceName()); + Assertions.assertEquals(634174133, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerStoredProcedureActivity model = + new SqlServerStoredProcedureActivity() + .withName("rdtywajqwa") + .withDescription("ia") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("rpcpg") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("jfdiijchtaaabt") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("rfok") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("ernq").withValue("dataeiyyysvt"), + new UserProperty().withName("oxwugdzwo").withValue("datazfiz"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("luutmfimlo") + .withParameters( + mapOf( + "ljr", + "datadxjirfye", + "i", + "datacgeorm", + "twiocuha", + "datawcqhaonmfnf", + "eimwhot", + "dataqielhtuk"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datadpqkfxdqm") + .withRetry("datarglqlv") + .withRetryIntervalInSeconds(634174133) + .withSecureInput(false) + .withSecureOutput(false) + .withAdditionalProperties(mapOf())) + .withStoredProcedureName("datahvioccszdaxafu") + .withStoredProcedureParameters("datacnqfwob"); + model = BinaryData.fromObject(model).toObject(SqlServerStoredProcedureActivity.class); + Assertions.assertEquals("rdtywajqwa", model.name()); + Assertions.assertEquals("ia", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("rpcpg", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("ernq", model.userProperties().get(0).name()); + Assertions.assertEquals("luutmfimlo", model.linkedServiceName().referenceName()); + Assertions.assertEquals(634174133, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(false, model.policy().secureInput()); + Assertions.assertEquals(false, model.policy().secureOutput()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerStoredProcedureActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerStoredProcedureActivityTypePropertiesTests.java new file mode 100644 index 000000000000..4fb4890ea4e6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerStoredProcedureActivityTypePropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SqlServerStoredProcedureActivityTypeProperties; + +public final class SqlServerStoredProcedureActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerStoredProcedureActivityTypeProperties model = + BinaryData + .fromString("{\"storedProcedureName\":\"datai\",\"storedProcedureParameters\":\"datanobxcdx\"}") + .toObject(SqlServerStoredProcedureActivityTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerStoredProcedureActivityTypeProperties model = + new SqlServerStoredProcedureActivityTypeProperties() + .withStoredProcedureName("datai") + .withStoredProcedureParameters("datanobxcdx"); + model = BinaryData.fromObject(model).toObject(SqlServerStoredProcedureActivityTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerTableDatasetTests.java new file mode 100644 index 000000000000..2c93cec44a3f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerTableDatasetTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SqlServerTableDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SqlServerTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerTableDataset model = + BinaryData + .fromString( + "{\"type\":\"SqlServerTable\",\"typeProperties\":{\"tableName\":\"datazcq\",\"schema\":\"datavnkyakck\",\"table\":\"datah\"},\"description\":\"nsddjkkd\",\"structure\":\"dataesu\",\"schema\":\"dataogfcnxcxgxum\",\"linkedServiceName\":{\"referenceName\":\"cqxmyvkxixy\",\"parameters\":{\"g\":\"dataifjc\"}},\"parameters\":{\"chmxczbyfkoc\":{\"type\":\"Bool\",\"defaultValue\":\"datauw\"}},\"annotations\":[\"datadctsnlwscrngt\"],\"folder\":{\"name\":\"rolwv\"},\"\":{\"cucti\":\"datasdksut\",\"ux\":\"dataavishbvjhxvpmqqu\",\"lexoweorocr\":\"dataphngr\",\"gbq\":\"dataicgym\"}}") + .toObject(SqlServerTableDataset.class); + Assertions.assertEquals("nsddjkkd", model.description()); + Assertions.assertEquals("cqxmyvkxixy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("chmxczbyfkoc").type()); + Assertions.assertEquals("rolwv", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerTableDataset model = + new SqlServerTableDataset() + .withDescription("nsddjkkd") + .withStructure("dataesu") + .withSchema("dataogfcnxcxgxum") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("cqxmyvkxixy") + .withParameters(mapOf("g", "dataifjc"))) + .withParameters( + mapOf( + "chmxczbyfkoc", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datauw"))) + .withAnnotations(Arrays.asList("datadctsnlwscrngt")) + .withFolder(new DatasetFolder().withName("rolwv")) + .withTableName("datazcq") + .withSchemaTypePropertiesSchema("datavnkyakck") + .withTable("datah"); + model = BinaryData.fromObject(model).toObject(SqlServerTableDataset.class); + Assertions.assertEquals("nsddjkkd", model.description()); + Assertions.assertEquals("cqxmyvkxixy", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("chmxczbyfkoc").type()); + Assertions.assertEquals("rolwv", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..a3c3fa254c13 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlServerTableDatasetTypePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SqlServerTableDatasetTypeProperties; + +public final class SqlServerTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlServerTableDatasetTypeProperties model = + BinaryData + .fromString("{\"tableName\":\"datayrvhtv\",\"schema\":\"datavwmrgcnzhrplc\",\"table\":\"datambzquu\"}") + .toObject(SqlServerTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlServerTableDatasetTypeProperties model = + new SqlServerTableDatasetTypeProperties() + .withTableName("datayrvhtv") + .withSchema("datavwmrgcnzhrplc") + .withTable("datambzquu"); + model = BinaryData.fromObject(model).toObject(SqlServerTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlSourceTests.java new file mode 100644 index 000000000000..8b3f00e241d6 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SqlSourceTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SqlPartitionSettings; +import com.azure.resourcemanager.datafactory.models.SqlSource; + +public final class SqlSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SqlSource model = + BinaryData + .fromString( + "{\"type\":\"SqlSource\",\"sqlReaderQuery\":\"datarsqzuknbtxtdm\",\"sqlReaderStoredProcedureName\":\"datadrrqqajhk\",\"storedProcedureParameters\":\"datatliuw\",\"isolationLevel\":\"datatwqjft\",\"partitionOption\":\"dataqdswfno\",\"partitionSettings\":{\"partitionColumnName\":\"datawhumngihfndsj\",\"partitionUpperBound\":\"datailfvrpbcgd\",\"partitionLowerBound\":\"datafxoffckejxomngu\"},\"queryTimeout\":\"dataxxynt\",\"additionalColumns\":\"datanksvximgn\",\"sourceRetryCount\":\"dataycxuyzrnn\",\"sourceRetryWait\":\"datamfhmwfoummdo\",\"maxConcurrentConnections\":\"dataditpyqalwlirap\",\"disableMetricsCollection\":\"datasidfhsfnoczefg\",\"\":{\"jntiqbxzeiudogqf\":\"datae\",\"cwzbe\":\"datarbroeomufaz\"}}") + .toObject(SqlSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SqlSource model = + new SqlSource() + .withSourceRetryCount("dataycxuyzrnn") + .withSourceRetryWait("datamfhmwfoummdo") + .withMaxConcurrentConnections("dataditpyqalwlirap") + .withDisableMetricsCollection("datasidfhsfnoczefg") + .withQueryTimeout("dataxxynt") + .withAdditionalColumns("datanksvximgn") + .withSqlReaderQuery("datarsqzuknbtxtdm") + .withSqlReaderStoredProcedureName("datadrrqqajhk") + .withStoredProcedureParameters("datatliuw") + .withIsolationLevel("datatwqjft") + .withPartitionOption("dataqdswfno") + .withPartitionSettings( + new SqlPartitionSettings() + .withPartitionColumnName("datawhumngihfndsj") + .withPartitionUpperBound("datailfvrpbcgd") + .withPartitionLowerBound("datafxoffckejxomngu")); + model = BinaryData.fromObject(model).toObject(SqlSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SquareObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SquareObjectDatasetTests.java new file mode 100644 index 000000000000..c5f87f7f6567 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SquareObjectDatasetTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SquareObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SquareObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SquareObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"SquareObject\",\"typeProperties\":{\"tableName\":\"dataktdutydvvgkmo\"},\"description\":\"pcjes\",\"structure\":\"datavuztnsvmsh\",\"schema\":\"datagygfohrm\",\"linkedServiceName\":{\"referenceName\":\"hhlclpkr\",\"parameters\":{\"utivrfnztxtmrm\":\"databmjjv\",\"ii\":\"dataftj\",\"hfh\":\"dataohlgrjcx\"}},\"parameters\":{\"ylyumb\":{\"type\":\"Object\",\"defaultValue\":\"datawfogbv\"}},\"annotations\":[\"datarlnuom\",\"dataxhdkhmemx\"],\"folder\":{\"name\":\"apesnbyoullyfz\"},\"\":{\"g\":\"datarmxxjvwbat\",\"ommdzphxulx\":\"datakmwfwzlmpxfmdjs\"}}") + .toObject(SquareObjectDataset.class); + Assertions.assertEquals("pcjes", model.description()); + Assertions.assertEquals("hhlclpkr", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("ylyumb").type()); + Assertions.assertEquals("apesnbyoullyfz", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SquareObjectDataset model = + new SquareObjectDataset() + .withDescription("pcjes") + .withStructure("datavuztnsvmsh") + .withSchema("datagygfohrm") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("hhlclpkr") + .withParameters(mapOf("utivrfnztxtmrm", "databmjjv", "ii", "dataftj", "hfh", "dataohlgrjcx"))) + .withParameters( + mapOf( + "ylyumb", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datawfogbv"))) + .withAnnotations(Arrays.asList("datarlnuom", "dataxhdkhmemx")) + .withFolder(new DatasetFolder().withName("apesnbyoullyfz")) + .withTableName("dataktdutydvvgkmo"); + model = BinaryData.fromObject(model).toObject(SquareObjectDataset.class); + Assertions.assertEquals("pcjes", model.description()); + Assertions.assertEquals("hhlclpkr", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("ylyumb").type()); + Assertions.assertEquals("apesnbyoullyfz", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SquareSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SquareSourceTests.java new file mode 100644 index 000000000000..eefc55119d0d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SquareSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SquareSource; + +public final class SquareSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SquareSource model = + BinaryData + .fromString( + "{\"type\":\"SquareSource\",\"query\":\"datan\",\"queryTimeout\":\"datanjfvjqvectoo\",\"additionalColumns\":\"datazttalsnmxvsrvk\",\"sourceRetryCount\":\"dataxl\",\"sourceRetryWait\":\"datatmdybxeh\",\"maxConcurrentConnections\":\"dataqogtnfla\",\"disableMetricsCollection\":\"datapghfvkqijmyqo\",\"\":{\"ocrr\":\"dataf\",\"dpyohnmru\":\"datarr\"}}") + .toObject(SquareSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SquareSource model = + new SquareSource() + .withSourceRetryCount("dataxl") + .withSourceRetryWait("datatmdybxeh") + .withMaxConcurrentConnections("dataqogtnfla") + .withDisableMetricsCollection("datapghfvkqijmyqo") + .withQueryTimeout("datanjfvjqvectoo") + .withAdditionalColumns("datazttalsnmxvsrvk") + .withQuery("datan"); + model = BinaryData.fromObject(model).toObject(SquareSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisChildPackageTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisChildPackageTests.java new file mode 100644 index 000000000000..1c655b904eac --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisChildPackageTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisChildPackage; +import org.junit.jupiter.api.Assertions; + +public final class SsisChildPackageTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisChildPackage model = + BinaryData + .fromString( + "{\"packagePath\":\"dataozfaj\",\"packageName\":\"bswwbrllvva\",\"packageContent\":\"dataujcqz\",\"packageLastModifiedDate\":\"wlxz\"}") + .toObject(SsisChildPackage.class); + Assertions.assertEquals("bswwbrllvva", model.packageName()); + Assertions.assertEquals("wlxz", model.packageLastModifiedDate()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisChildPackage model = + new SsisChildPackage() + .withPackagePath("dataozfaj") + .withPackageName("bswwbrllvva") + .withPackageContent("dataujcqz") + .withPackageLastModifiedDate("wlxz"); + model = BinaryData.fromObject(model).toObject(SsisChildPackage.class); + Assertions.assertEquals("bswwbrllvva", model.packageName()); + Assertions.assertEquals("wlxz", model.packageLastModifiedDate()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisEnvironmentReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisEnvironmentReferenceTests.java new file mode 100644 index 000000000000..12f67590d2a0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisEnvironmentReferenceTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisEnvironmentReference; +import org.junit.jupiter.api.Assertions; + +public final class SsisEnvironmentReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisEnvironmentReference model = + BinaryData + .fromString( + "{\"id\":94915420419847556,\"environmentFolderName\":\"dpnkzimqax\",\"environmentName\":\"vmycvjpa\",\"referenceType\":\"dqvv\"}") + .toObject(SsisEnvironmentReference.class); + Assertions.assertEquals(94915420419847556L, model.id()); + Assertions.assertEquals("dpnkzimqax", model.environmentFolderName()); + Assertions.assertEquals("vmycvjpa", model.environmentName()); + Assertions.assertEquals("dqvv", model.referenceType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisEnvironmentReference model = + new SsisEnvironmentReference() + .withId(94915420419847556L) + .withEnvironmentFolderName("dpnkzimqax") + .withEnvironmentName("vmycvjpa") + .withReferenceType("dqvv"); + model = BinaryData.fromObject(model).toObject(SsisEnvironmentReference.class); + Assertions.assertEquals(94915420419847556L, model.id()); + Assertions.assertEquals("dpnkzimqax", model.environmentFolderName()); + Assertions.assertEquals("vmycvjpa", model.environmentName()); + Assertions.assertEquals("dqvv", model.referenceType()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisEnvironmentTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisEnvironmentTests.java new file mode 100644 index 000000000000..3f72527d4964 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisEnvironmentTests.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisEnvironment; +import com.azure.resourcemanager.datafactory.models.SsisVariable; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SsisEnvironmentTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisEnvironment model = + BinaryData + .fromString( + "{\"type\":\"Environment\",\"folderId\":1678450059385779698,\"variables\":[{\"id\":2837772907871210553,\"name\":\"plcsinbulolx\",\"description\":\"cynnmvaizv\",\"dataType\":\"qqpwcids\",\"sensitive\":true,\"value\":\"yzm\",\"sensitiveValue\":\"fdlgpryy\"},{\"id\":1556916616326570809,\"name\":\"lbcyuwahwzagvaid\",\"description\":\"ephnhnuhgyfzkh\",\"dataType\":\"mrwpe\",\"sensitive\":true,\"value\":\"jbpe\",\"sensitiveValue\":\"jpairp\"},{\"id\":1939370380088796252,\"name\":\"iwsywp\",\"description\":\"tvqopugrse\",\"dataType\":\"iuztqefzy\",\"sensitive\":true,\"value\":\"dmcbc\",\"sensitiveValue\":\"didhuepikwc\"},{\"id\":6306841199848283429,\"name\":\"ukqmkiynbfvk\",\"description\":\"mq\",\"dataType\":\"mytcctirgyut\",\"sensitive\":false,\"value\":\"hdmcgvjbrybfa\",\"sensitiveValue\":\"hkoqcudnwmoyhdpj\"}],\"id\":2601554573080808461,\"name\":\"cbjfpxoygnm\",\"description\":\"iqw\"}") + .toObject(SsisEnvironment.class); + Assertions.assertEquals(2601554573080808461L, model.id()); + Assertions.assertEquals("cbjfpxoygnm", model.name()); + Assertions.assertEquals("iqw", model.description()); + Assertions.assertEquals(1678450059385779698L, model.folderId()); + Assertions.assertEquals(2837772907871210553L, model.variables().get(0).id()); + Assertions.assertEquals("plcsinbulolx", model.variables().get(0).name()); + Assertions.assertEquals("cynnmvaizv", model.variables().get(0).description()); + Assertions.assertEquals("qqpwcids", model.variables().get(0).dataType()); + Assertions.assertEquals(true, model.variables().get(0).sensitive()); + Assertions.assertEquals("yzm", model.variables().get(0).value()); + Assertions.assertEquals("fdlgpryy", model.variables().get(0).sensitiveValue()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisEnvironment model = + new SsisEnvironment() + .withId(2601554573080808461L) + .withName("cbjfpxoygnm") + .withDescription("iqw") + .withFolderId(1678450059385779698L) + .withVariables( + Arrays + .asList( + new SsisVariable() + .withId(2837772907871210553L) + .withName("plcsinbulolx") + .withDescription("cynnmvaizv") + .withDataType("qqpwcids") + .withSensitive(true) + .withValue("yzm") + .withSensitiveValue("fdlgpryy"), + new SsisVariable() + .withId(1556916616326570809L) + .withName("lbcyuwahwzagvaid") + .withDescription("ephnhnuhgyfzkh") + .withDataType("mrwpe") + .withSensitive(true) + .withValue("jbpe") + .withSensitiveValue("jpairp"), + new SsisVariable() + .withId(1939370380088796252L) + .withName("iwsywp") + .withDescription("tvqopugrse") + .withDataType("iuztqefzy") + .withSensitive(true) + .withValue("dmcbc") + .withSensitiveValue("didhuepikwc"), + new SsisVariable() + .withId(6306841199848283429L) + .withName("ukqmkiynbfvk") + .withDescription("mq") + .withDataType("mytcctirgyut") + .withSensitive(false) + .withValue("hdmcgvjbrybfa") + .withSensitiveValue("hkoqcudnwmoyhdpj"))); + model = BinaryData.fromObject(model).toObject(SsisEnvironment.class); + Assertions.assertEquals(2601554573080808461L, model.id()); + Assertions.assertEquals("cbjfpxoygnm", model.name()); + Assertions.assertEquals("iqw", model.description()); + Assertions.assertEquals(1678450059385779698L, model.folderId()); + Assertions.assertEquals(2837772907871210553L, model.variables().get(0).id()); + Assertions.assertEquals("plcsinbulolx", model.variables().get(0).name()); + Assertions.assertEquals("cynnmvaizv", model.variables().get(0).description()); + Assertions.assertEquals("qqpwcids", model.variables().get(0).dataType()); + Assertions.assertEquals(true, model.variables().get(0).sensitive()); + Assertions.assertEquals("yzm", model.variables().get(0).value()); + Assertions.assertEquals("fdlgpryy", model.variables().get(0).sensitiveValue()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisExecutionParameterTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisExecutionParameterTests.java new file mode 100644 index 000000000000..0b805b3b1f78 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisExecutionParameterTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisExecutionParameter; + +public final class SsisExecutionParameterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisExecutionParameter model = + BinaryData.fromString("{\"value\":\"datadqvdivzjyxsjbl\"}").toObject(SsisExecutionParameter.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisExecutionParameter model = new SsisExecutionParameter().withValue("datadqvdivzjyxsjbl"); + model = BinaryData.fromObject(model).toObject(SsisExecutionParameter.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisFolderTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisFolderTests.java new file mode 100644 index 000000000000..09abf09968f4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisFolderTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisFolder; +import org.junit.jupiter.api.Assertions; + +public final class SsisFolderTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisFolder model = + BinaryData + .fromString( + "{\"type\":\"Folder\",\"id\":273426490491628940,\"name\":\"qpzmodwhqu\",\"description\":\"ochtuxapewzwqlb\"}") + .toObject(SsisFolder.class); + Assertions.assertEquals(273426490491628940L, model.id()); + Assertions.assertEquals("qpzmodwhqu", model.name()); + Assertions.assertEquals("ochtuxapewzwqlb", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisFolder model = + new SsisFolder().withId(273426490491628940L).withName("qpzmodwhqu").withDescription("ochtuxapewzwqlb"); + model = BinaryData.fromObject(model).toObject(SsisFolder.class); + Assertions.assertEquals(273426490491628940L, model.id()); + Assertions.assertEquals("qpzmodwhqu", model.name()); + Assertions.assertEquals("ochtuxapewzwqlb", model.description()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisObjectMetadataListResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisObjectMetadataListResponseInnerTests.java new file mode 100644 index 000000000000..57b3aaf0f50b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisObjectMetadataListResponseInnerTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SsisObjectMetadataListResponseInner; +import com.azure.resourcemanager.datafactory.models.SsisObjectMetadata; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SsisObjectMetadataListResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisObjectMetadataListResponseInner model = + BinaryData + .fromString( + "{\"value\":[{\"type\":\"SsisObjectMetadata\",\"id\":1248291372184779781,\"name\":\"zvlvqhjkbegib\",\"description\":\"mxiebw\"},{\"type\":\"SsisObjectMetadata\",\"id\":9167362709610232735,\"name\":\"yqcgwrtzjuzgwy\",\"description\":\"htxongmtsavjc\"},{\"type\":\"SsisObjectMetadata\",\"id\":7752304449285326809,\"name\":\"p\",\"description\":\"knftguvriuh\"}],\"nextLink\":\"wmdyvxqtay\"}") + .toObject(SsisObjectMetadataListResponseInner.class); + Assertions.assertEquals(1248291372184779781L, model.value().get(0).id()); + Assertions.assertEquals("zvlvqhjkbegib", model.value().get(0).name()); + Assertions.assertEquals("mxiebw", model.value().get(0).description()); + Assertions.assertEquals("wmdyvxqtay", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisObjectMetadataListResponseInner model = + new SsisObjectMetadataListResponseInner() + .withValue( + Arrays + .asList( + new SsisObjectMetadata() + .withId(1248291372184779781L) + .withName("zvlvqhjkbegib") + .withDescription("mxiebw"), + new SsisObjectMetadata() + .withId(9167362709610232735L) + .withName("yqcgwrtzjuzgwy") + .withDescription("htxongmtsavjc"), + new SsisObjectMetadata() + .withId(7752304449285326809L) + .withName("p") + .withDescription("knftguvriuh"))) + .withNextLink("wmdyvxqtay"); + model = BinaryData.fromObject(model).toObject(SsisObjectMetadataListResponseInner.class); + Assertions.assertEquals(1248291372184779781L, model.value().get(0).id()); + Assertions.assertEquals("zvlvqhjkbegib", model.value().get(0).name()); + Assertions.assertEquals("mxiebw", model.value().get(0).description()); + Assertions.assertEquals("wmdyvxqtay", model.nextLink()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisObjectMetadataStatusResponseInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisObjectMetadataStatusResponseInnerTests.java new file mode 100644 index 000000000000..452aa52341c4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisObjectMetadataStatusResponseInnerTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SsisObjectMetadataStatusResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class SsisObjectMetadataStatusResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisObjectMetadataStatusResponseInner model = + BinaryData + .fromString( + "{\"status\":\"tdhxujznbmpowuwp\",\"name\":\"qlveualupjmkh\",\"properties\":\"obbc\",\"error\":\"s\"}") + .toObject(SsisObjectMetadataStatusResponseInner.class); + Assertions.assertEquals("tdhxujznbmpowuwp", model.status()); + Assertions.assertEquals("qlveualupjmkh", model.name()); + Assertions.assertEquals("obbc", model.properties()); + Assertions.assertEquals("s", model.error()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisObjectMetadataStatusResponseInner model = + new SsisObjectMetadataStatusResponseInner() + .withStatus("tdhxujznbmpowuwp") + .withName("qlveualupjmkh") + .withProperties("obbc") + .withError("s"); + model = BinaryData.fromObject(model).toObject(SsisObjectMetadataStatusResponseInner.class); + Assertions.assertEquals("tdhxujznbmpowuwp", model.status()); + Assertions.assertEquals("qlveualupjmkh", model.name()); + Assertions.assertEquals("obbc", model.properties()); + Assertions.assertEquals("s", model.error()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisObjectMetadataTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisObjectMetadataTests.java new file mode 100644 index 000000000000..8fbbbb8e6867 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisObjectMetadataTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisObjectMetadata; +import org.junit.jupiter.api.Assertions; + +public final class SsisObjectMetadataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisObjectMetadata model = + BinaryData + .fromString( + "{\"type\":\"SsisObjectMetadata\",\"id\":1536045625796396557,\"name\":\"oyq\",\"description\":\"xrmcqibycnojvk\"}") + .toObject(SsisObjectMetadata.class); + Assertions.assertEquals(1536045625796396557L, model.id()); + Assertions.assertEquals("oyq", model.name()); + Assertions.assertEquals("xrmcqibycnojvk", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisObjectMetadata model = + new SsisObjectMetadata().withId(1536045625796396557L).withName("oyq").withDescription("xrmcqibycnojvk"); + model = BinaryData.fromObject(model).toObject(SsisObjectMetadata.class); + Assertions.assertEquals(1536045625796396557L, model.id()); + Assertions.assertEquals("oyq", model.name()); + Assertions.assertEquals("xrmcqibycnojvk", model.description()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisPackageTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisPackageTests.java new file mode 100644 index 000000000000..9211a966554d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisPackageTests.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisPackage; +import com.azure.resourcemanager.datafactory.models.SsisParameter; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SsisPackageTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisPackage model = + BinaryData + .fromString( + "{\"type\":\"Package\",\"folderId\":8840596202186352259,\"projectVersion\":8413150626448269128,\"projectId\":3815968071675012064,\"parameters\":[{\"id\":7252305858739380777,\"name\":\"wqieyxjkctyq\",\"description\":\"tampq\",\"dataType\":\"eftmub\",\"required\":true,\"sensitive\":true,\"designDefaultValue\":\"eql\",\"defaultValue\":\"tysyizeqlctpqn\",\"sensitiveDefaultValue\":\"k\",\"valueType\":\"gyzwfyfdbvoo\",\"valueSet\":false,\"variable\":\"kd\"}],\"id\":2515540147851548589,\"name\":\"gjjsmvsiyqml\",\"description\":\"jwsmnwbmacvemmr\"}") + .toObject(SsisPackage.class); + Assertions.assertEquals(2515540147851548589L, model.id()); + Assertions.assertEquals("gjjsmvsiyqml", model.name()); + Assertions.assertEquals("jwsmnwbmacvemmr", model.description()); + Assertions.assertEquals(8840596202186352259L, model.folderId()); + Assertions.assertEquals(8413150626448269128L, model.projectVersion()); + Assertions.assertEquals(3815968071675012064L, model.projectId()); + Assertions.assertEquals(7252305858739380777L, model.parameters().get(0).id()); + Assertions.assertEquals("wqieyxjkctyq", model.parameters().get(0).name()); + Assertions.assertEquals("tampq", model.parameters().get(0).description()); + Assertions.assertEquals("eftmub", model.parameters().get(0).dataType()); + Assertions.assertEquals(true, model.parameters().get(0).required()); + Assertions.assertEquals(true, model.parameters().get(0).sensitive()); + Assertions.assertEquals("eql", model.parameters().get(0).designDefaultValue()); + Assertions.assertEquals("tysyizeqlctpqn", model.parameters().get(0).defaultValue()); + Assertions.assertEquals("k", model.parameters().get(0).sensitiveDefaultValue()); + Assertions.assertEquals("gyzwfyfdbvoo", model.parameters().get(0).valueType()); + Assertions.assertEquals(false, model.parameters().get(0).valueSet()); + Assertions.assertEquals("kd", model.parameters().get(0).variable()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisPackage model = + new SsisPackage() + .withId(2515540147851548589L) + .withName("gjjsmvsiyqml") + .withDescription("jwsmnwbmacvemmr") + .withFolderId(8840596202186352259L) + .withProjectVersion(8413150626448269128L) + .withProjectId(3815968071675012064L) + .withParameters( + Arrays + .asList( + new SsisParameter() + .withId(7252305858739380777L) + .withName("wqieyxjkctyq") + .withDescription("tampq") + .withDataType("eftmub") + .withRequired(true) + .withSensitive(true) + .withDesignDefaultValue("eql") + .withDefaultValue("tysyizeqlctpqn") + .withSensitiveDefaultValue("k") + .withValueType("gyzwfyfdbvoo") + .withValueSet(false) + .withVariable("kd"))); + model = BinaryData.fromObject(model).toObject(SsisPackage.class); + Assertions.assertEquals(2515540147851548589L, model.id()); + Assertions.assertEquals("gjjsmvsiyqml", model.name()); + Assertions.assertEquals("jwsmnwbmacvemmr", model.description()); + Assertions.assertEquals(8840596202186352259L, model.folderId()); + Assertions.assertEquals(8413150626448269128L, model.projectVersion()); + Assertions.assertEquals(3815968071675012064L, model.projectId()); + Assertions.assertEquals(7252305858739380777L, model.parameters().get(0).id()); + Assertions.assertEquals("wqieyxjkctyq", model.parameters().get(0).name()); + Assertions.assertEquals("tampq", model.parameters().get(0).description()); + Assertions.assertEquals("eftmub", model.parameters().get(0).dataType()); + Assertions.assertEquals(true, model.parameters().get(0).required()); + Assertions.assertEquals(true, model.parameters().get(0).sensitive()); + Assertions.assertEquals("eql", model.parameters().get(0).designDefaultValue()); + Assertions.assertEquals("tysyizeqlctpqn", model.parameters().get(0).defaultValue()); + Assertions.assertEquals("k", model.parameters().get(0).sensitiveDefaultValue()); + Assertions.assertEquals("gyzwfyfdbvoo", model.parameters().get(0).valueType()); + Assertions.assertEquals(false, model.parameters().get(0).valueSet()); + Assertions.assertEquals("kd", model.parameters().get(0).variable()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisParameterTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisParameterTests.java new file mode 100644 index 000000000000..2c912822df8c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisParameterTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisParameter; +import org.junit.jupiter.api.Assertions; + +public final class SsisParameterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisParameter model = + BinaryData + .fromString( + "{\"id\":3549610144167513440,\"name\":\"vnfjng\",\"description\":\"mrdvhbgtuhwhx\",\"dataType\":\"we\",\"required\":false,\"sensitive\":false,\"designDefaultValue\":\"nuzgzrxxduseb\",\"defaultValue\":\"fetxpuntermasuiq\",\"sensitiveDefaultValue\":\"n\",\"valueType\":\"tubqwxv\",\"valueSet\":false,\"variable\":\"iyzjlgrwjbsyc\"}") + .toObject(SsisParameter.class); + Assertions.assertEquals(3549610144167513440L, model.id()); + Assertions.assertEquals("vnfjng", model.name()); + Assertions.assertEquals("mrdvhbgtuhwhx", model.description()); + Assertions.assertEquals("we", model.dataType()); + Assertions.assertEquals(false, model.required()); + Assertions.assertEquals(false, model.sensitive()); + Assertions.assertEquals("nuzgzrxxduseb", model.designDefaultValue()); + Assertions.assertEquals("fetxpuntermasuiq", model.defaultValue()); + Assertions.assertEquals("n", model.sensitiveDefaultValue()); + Assertions.assertEquals("tubqwxv", model.valueType()); + Assertions.assertEquals(false, model.valueSet()); + Assertions.assertEquals("iyzjlgrwjbsyc", model.variable()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisParameter model = + new SsisParameter() + .withId(3549610144167513440L) + .withName("vnfjng") + .withDescription("mrdvhbgtuhwhx") + .withDataType("we") + .withRequired(false) + .withSensitive(false) + .withDesignDefaultValue("nuzgzrxxduseb") + .withDefaultValue("fetxpuntermasuiq") + .withSensitiveDefaultValue("n") + .withValueType("tubqwxv") + .withValueSet(false) + .withVariable("iyzjlgrwjbsyc"); + model = BinaryData.fromObject(model).toObject(SsisParameter.class); + Assertions.assertEquals(3549610144167513440L, model.id()); + Assertions.assertEquals("vnfjng", model.name()); + Assertions.assertEquals("mrdvhbgtuhwhx", model.description()); + Assertions.assertEquals("we", model.dataType()); + Assertions.assertEquals(false, model.required()); + Assertions.assertEquals(false, model.sensitive()); + Assertions.assertEquals("nuzgzrxxduseb", model.designDefaultValue()); + Assertions.assertEquals("fetxpuntermasuiq", model.defaultValue()); + Assertions.assertEquals("n", model.sensitiveDefaultValue()); + Assertions.assertEquals("tubqwxv", model.valueType()); + Assertions.assertEquals(false, model.valueSet()); + Assertions.assertEquals("iyzjlgrwjbsyc", model.variable()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisProjectTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisProjectTests.java new file mode 100644 index 000000000000..f7bb279565e4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisProjectTests.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisEnvironmentReference; +import com.azure.resourcemanager.datafactory.models.SsisParameter; +import com.azure.resourcemanager.datafactory.models.SsisProject; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SsisProjectTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisProject model = + BinaryData + .fromString( + "{\"type\":\"Project\",\"folderId\":8822312186246834389,\"version\":4558617045398857403,\"environmentRefs\":[{\"id\":7306014430374048733,\"environmentFolderName\":\"tttsmczrodd\",\"environmentName\":\"qimodnbjmj\",\"referenceType\":\"hbuc\"}],\"parameters\":[{\"id\":2056373800985950587,\"name\":\"jacktav\",\"description\":\"bgodjfyplavbvs\",\"dataType\":\"edsoqwe\",\"required\":false,\"sensitive\":true,\"designDefaultValue\":\"oteik\",\"defaultValue\":\"jqdfadgywyla\",\"sensitiveDefaultValue\":\"tqj\",\"valueType\":\"hyst\",\"valueSet\":true,\"variable\":\"pbtkogfggyl\"},{\"id\":3781049177007619900,\"name\":\"vwsgseqjteoax\",\"description\":\"mg\",\"dataType\":\"wrjybpv\",\"required\":true,\"sensitive\":true,\"designDefaultValue\":\"arirdzdg\",\"defaultValue\":\"oflzuk\",\"sensitiveDefaultValue\":\"ougxpyp\",\"valueType\":\"zqsxblmnxrxkul\",\"valueSet\":false,\"variable\":\"vi\"}],\"id\":9029580315490008772,\"name\":\"xxyfo\",\"description\":\"godywxjikfrx\"}") + .toObject(SsisProject.class); + Assertions.assertEquals(9029580315490008772L, model.id()); + Assertions.assertEquals("xxyfo", model.name()); + Assertions.assertEquals("godywxjikfrx", model.description()); + Assertions.assertEquals(8822312186246834389L, model.folderId()); + Assertions.assertEquals(4558617045398857403L, model.version()); + Assertions.assertEquals(7306014430374048733L, model.environmentRefs().get(0).id()); + Assertions.assertEquals("tttsmczrodd", model.environmentRefs().get(0).environmentFolderName()); + Assertions.assertEquals("qimodnbjmj", model.environmentRefs().get(0).environmentName()); + Assertions.assertEquals("hbuc", model.environmentRefs().get(0).referenceType()); + Assertions.assertEquals(2056373800985950587L, model.parameters().get(0).id()); + Assertions.assertEquals("jacktav", model.parameters().get(0).name()); + Assertions.assertEquals("bgodjfyplavbvs", model.parameters().get(0).description()); + Assertions.assertEquals("edsoqwe", model.parameters().get(0).dataType()); + Assertions.assertEquals(false, model.parameters().get(0).required()); + Assertions.assertEquals(true, model.parameters().get(0).sensitive()); + Assertions.assertEquals("oteik", model.parameters().get(0).designDefaultValue()); + Assertions.assertEquals("jqdfadgywyla", model.parameters().get(0).defaultValue()); + Assertions.assertEquals("tqj", model.parameters().get(0).sensitiveDefaultValue()); + Assertions.assertEquals("hyst", model.parameters().get(0).valueType()); + Assertions.assertEquals(true, model.parameters().get(0).valueSet()); + Assertions.assertEquals("pbtkogfggyl", model.parameters().get(0).variable()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisProject model = + new SsisProject() + .withId(9029580315490008772L) + .withName("xxyfo") + .withDescription("godywxjikfrx") + .withFolderId(8822312186246834389L) + .withVersion(4558617045398857403L) + .withEnvironmentRefs( + Arrays + .asList( + new SsisEnvironmentReference() + .withId(7306014430374048733L) + .withEnvironmentFolderName("tttsmczrodd") + .withEnvironmentName("qimodnbjmj") + .withReferenceType("hbuc"))) + .withParameters( + Arrays + .asList( + new SsisParameter() + .withId(2056373800985950587L) + .withName("jacktav") + .withDescription("bgodjfyplavbvs") + .withDataType("edsoqwe") + .withRequired(false) + .withSensitive(true) + .withDesignDefaultValue("oteik") + .withDefaultValue("jqdfadgywyla") + .withSensitiveDefaultValue("tqj") + .withValueType("hyst") + .withValueSet(true) + .withVariable("pbtkogfggyl"), + new SsisParameter() + .withId(3781049177007619900L) + .withName("vwsgseqjteoax") + .withDescription("mg") + .withDataType("wrjybpv") + .withRequired(true) + .withSensitive(true) + .withDesignDefaultValue("arirdzdg") + .withDefaultValue("oflzuk") + .withSensitiveDefaultValue("ougxpyp") + .withValueType("zqsxblmnxrxkul") + .withValueSet(false) + .withVariable("vi"))); + model = BinaryData.fromObject(model).toObject(SsisProject.class); + Assertions.assertEquals(9029580315490008772L, model.id()); + Assertions.assertEquals("xxyfo", model.name()); + Assertions.assertEquals("godywxjikfrx", model.description()); + Assertions.assertEquals(8822312186246834389L, model.folderId()); + Assertions.assertEquals(4558617045398857403L, model.version()); + Assertions.assertEquals(7306014430374048733L, model.environmentRefs().get(0).id()); + Assertions.assertEquals("tttsmczrodd", model.environmentRefs().get(0).environmentFolderName()); + Assertions.assertEquals("qimodnbjmj", model.environmentRefs().get(0).environmentName()); + Assertions.assertEquals("hbuc", model.environmentRefs().get(0).referenceType()); + Assertions.assertEquals(2056373800985950587L, model.parameters().get(0).id()); + Assertions.assertEquals("jacktav", model.parameters().get(0).name()); + Assertions.assertEquals("bgodjfyplavbvs", model.parameters().get(0).description()); + Assertions.assertEquals("edsoqwe", model.parameters().get(0).dataType()); + Assertions.assertEquals(false, model.parameters().get(0).required()); + Assertions.assertEquals(true, model.parameters().get(0).sensitive()); + Assertions.assertEquals("oteik", model.parameters().get(0).designDefaultValue()); + Assertions.assertEquals("jqdfadgywyla", model.parameters().get(0).defaultValue()); + Assertions.assertEquals("tqj", model.parameters().get(0).sensitiveDefaultValue()); + Assertions.assertEquals("hyst", model.parameters().get(0).valueType()); + Assertions.assertEquals(true, model.parameters().get(0).valueSet()); + Assertions.assertEquals("pbtkogfggyl", model.parameters().get(0).variable()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisPropertyOverrideTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisPropertyOverrideTests.java new file mode 100644 index 000000000000..2fc71ef04d82 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisPropertyOverrideTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisPropertyOverride; +import org.junit.jupiter.api.Assertions; + +public final class SsisPropertyOverrideTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisPropertyOverride model = + BinaryData + .fromString("{\"value\":\"datalxjbrqbut\",\"isSensitive\":false}") + .toObject(SsisPropertyOverride.class); + Assertions.assertEquals(false, model.isSensitive()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisPropertyOverride model = new SsisPropertyOverride().withValue("datalxjbrqbut").withIsSensitive(false); + model = BinaryData.fromObject(model).toObject(SsisPropertyOverride.class); + Assertions.assertEquals(false, model.isSensitive()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisVariableTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisVariableTests.java new file mode 100644 index 000000000000..126591f732a2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SsisVariableTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SsisVariable; +import org.junit.jupiter.api.Assertions; + +public final class SsisVariableTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SsisVariable model = + BinaryData + .fromString( + "{\"id\":3924573771796741823,\"name\":\"fknjqsstnwvravn\",\"description\":\"klkwqisnlpa\",\"dataType\":\"ketotktdmewwlk\",\"sensitive\":false,\"value\":\"pgqqdhtctx\",\"sensitiveValue\":\"egykjmpadbzjo\"}") + .toObject(SsisVariable.class); + Assertions.assertEquals(3924573771796741823L, model.id()); + Assertions.assertEquals("fknjqsstnwvravn", model.name()); + Assertions.assertEquals("klkwqisnlpa", model.description()); + Assertions.assertEquals("ketotktdmewwlk", model.dataType()); + Assertions.assertEquals(false, model.sensitive()); + Assertions.assertEquals("pgqqdhtctx", model.value()); + Assertions.assertEquals("egykjmpadbzjo", model.sensitiveValue()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SsisVariable model = + new SsisVariable() + .withId(3924573771796741823L) + .withName("fknjqsstnwvravn") + .withDescription("klkwqisnlpa") + .withDataType("ketotktdmewwlk") + .withSensitive(false) + .withValue("pgqqdhtctx") + .withSensitiveValue("egykjmpadbzjo"); + model = BinaryData.fromObject(model).toObject(SsisVariable.class); + Assertions.assertEquals(3924573771796741823L, model.id()); + Assertions.assertEquals("fknjqsstnwvravn", model.name()); + Assertions.assertEquals("klkwqisnlpa", model.description()); + Assertions.assertEquals("ketotktdmewwlk", model.dataType()); + Assertions.assertEquals(false, model.sensitive()); + Assertions.assertEquals("pgqqdhtctx", model.value()); + Assertions.assertEquals("egykjmpadbzjo", model.sensitiveValue()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/StagingSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/StagingSettingsTests.java new file mode 100644 index 000000000000..769a623a0a29 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/StagingSettingsTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.StagingSettings; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class StagingSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StagingSettings model = + BinaryData + .fromString( + "{\"linkedServiceName\":{\"referenceName\":\"lgrenuqsgertx\",\"parameters\":{\"aedbsl\":\"datamgsncbbdokp\",\"k\":\"datanunpxswmcc\"}},\"path\":\"dataiaaepxlxbofdc\",\"enableCompression\":\"dataoacfskzw\",\"\":{\"j\":\"datatutqjs\",\"v\":\"dataoixtrnakytzcma\",\"kaarqhpx\":\"datal\"}}") + .toObject(StagingSettings.class); + Assertions.assertEquals("lgrenuqsgertx", model.linkedServiceName().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StagingSettings model = + new StagingSettings() + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("lgrenuqsgertx") + .withParameters(mapOf("aedbsl", "datamgsncbbdokp", "k", "datanunpxswmcc"))) + .withPath("dataiaaepxlxbofdc") + .withEnableCompression("dataoacfskzw") + .withAdditionalProperties(mapOf()); + model = BinaryData.fromObject(model).toObject(StagingSettings.class); + Assertions.assertEquals("lgrenuqsgertx", model.linkedServiceName().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/StoreReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/StoreReadSettingsTests.java new file mode 100644 index 000000000000..41725dddafae --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/StoreReadSettingsTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class StoreReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StoreReadSettings model = + BinaryData + .fromString( + "{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"dataqtmpgrzciltw\",\"disableMetricsCollection\":\"datallp\",\"\":{\"oggxszmyxg\":\"databolhyiohcjugd\",\"mwzplcrzdwe\":\"dataykrpz\",\"k\":\"datasvs\",\"jeddn\":\"dataxrai\"}}") + .toObject(StoreReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StoreReadSettings model = + new StoreReadSettings() + .withMaxConcurrentConnections("dataqtmpgrzciltw") + .withDisableMetricsCollection("datallp") + .withAdditionalProperties(mapOf("type", "StoreReadSettings")); + model = BinaryData.fromObject(model).toObject(StoreReadSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/StoreWriteSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/StoreWriteSettingsTests.java new file mode 100644 index 000000000000..c975e26805d7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/StoreWriteSettingsTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.StoreWriteSettings; +import java.util.HashMap; +import java.util.Map; + +public final class StoreWriteSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StoreWriteSettings model = + BinaryData + .fromString( + "{\"type\":\"StoreWriteSettings\",\"maxConcurrentConnections\":\"datayxegklywdlxmyoqm\",\"disableMetricsCollection\":\"dataascqqtqzwn\",\"copyBehavior\":\"datalyrpbmdwiaxs\",\"\":{\"knybfsoayatqk\":\"dataorgcufiphnroizz\",\"djsa\":\"datazuxpldzkvbe\"}}") + .toObject(StoreWriteSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StoreWriteSettings model = + new StoreWriteSettings() + .withMaxConcurrentConnections("datayxegklywdlxmyoqm") + .withDisableMetricsCollection("dataascqqtqzwn") + .withCopyBehavior("datalyrpbmdwiaxs") + .withAdditionalProperties(mapOf("type", "StoreWriteSettings")); + model = BinaryData.fromObject(model).toObject(StoreWriteSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SubResourceDebugResourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SubResourceDebugResourceTests.java new file mode 100644 index 000000000000..e499b703c6c0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SubResourceDebugResourceTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SubResourceDebugResource; +import org.junit.jupiter.api.Assertions; + +public final class SubResourceDebugResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubResourceDebugResource model = + BinaryData.fromString("{\"name\":\"wvz\"}").toObject(SubResourceDebugResource.class); + Assertions.assertEquals("wvz", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubResourceDebugResource model = new SubResourceDebugResource().withName("wvz"); + model = BinaryData.fromObject(model).toObject(SubResourceDebugResource.class); + Assertions.assertEquals("wvz", model.name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SwitchActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SwitchActivityTests.java new file mode 100644 index 000000000000..3ae91bd39441 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SwitchActivityTests.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.Expression; +import com.azure.resourcemanager.datafactory.models.SwitchActivity; +import com.azure.resourcemanager.datafactory.models.SwitchCase; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SwitchActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchActivity model = + BinaryData + .fromString( + "{\"type\":\"Switch\",\"typeProperties\":{\"on\":{\"value\":\"qfupoamc\"},\"cases\":[{\"value\":\"xkgrecnqipskpyn\",\"activities\":[{\"type\":\"Activity\",\"name\":\"cd\",\"description\":\"wutahl\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"scirgqjnfdehhke\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"njifuucoj\",\"value\":\"dataikgbhkvhldnscxw\"},{\"name\":\"wsrdzmbz\",\"value\":\"datafzydwexoyfseehvm\"}],\"\":{\"hbadbbweaajgok\":\"databvdoufwkhipaod\",\"mhskhjjxesm\":\"datan\"}}]},{\"value\":\"hkcshyhgahmtevi\",\"activities\":[{\"type\":\"Activity\",\"name\":\"ijeppnpftwg\",\"description\":\"cccyiuehsne\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"xnmqm\",\"dependencyConditions\":[]},{\"activity\":\"tvqrjutyfnmwmgha\",\"dependencyConditions\":[]},{\"activity\":\"edqakhcc\",\"dependencyConditions\":[]},{\"activity\":\"jntnlbsvt\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"dvzafpvwrbqbyx\",\"value\":\"dataupqkbb\"},{\"name\":\"mhwtmeqtsf\",\"value\":\"datajpv\"},{\"name\":\"wbxlgpepxbjjnxd\",\"value\":\"datanegkltlpbbepmmi\"},{\"name\":\"mvada\",\"value\":\"datauev\"}],\"\":{\"hgfojdbov\":\"datadzgngnuuz\",\"vqmxzdi\":\"datamnelqlqn\",\"nrpqsj\":\"datan\"}}]},{\"value\":\"ncyksblreq\",\"activities\":[{\"type\":\"Activity\",\"name\":\"k\",\"description\":\"biylkfnedxdemc\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"zyrugstbzpozql\",\"dependencyConditions\":[]},{\"activity\":\"uau\",\"dependencyConditions\":[]},{\"activity\":\"kttlpwxola\",\"dependencyConditions\":[]},{\"activity\":\"evwwblqd\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"egu\",\"value\":\"datanteucaojjbb\"},{\"name\":\"ftcnzokdademqp\",\"value\":\"dataxekmdkbtmupm\"},{\"name\":\"ay\",\"value\":\"datajocsq\"},{\"name\":\"ibu\",\"value\":\"datalppnevujkzb\"}],\"\":{\"myfajygnh\":\"datavwkdgsr\",\"gpmjfwmtxfau\":\"dataoeoxsobljzodcx\"}},{\"type\":\"Activity\",\"name\":\"ihqs\",\"description\":\"tqaoacnl\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"vgpidrtbcxiwfkd\",\"dependencyConditions\":[]},{\"activity\":\"lvbwueytxlujvm\",\"dependencyConditions\":[]},{\"activity\":\"ooagaqnekwen\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"iqlnwfbjo\",\"value\":\"dataxsmhvjogvq\"},{\"name\":\"cpsufcdgc\",\"value\":\"datafxsvxkcyhkh\"},{\"name\":\"qwvwfombcgr\",\"value\":\"datalenrcovqty\"}],\"\":{\"gzslnnc\":\"datactkrgagxzmrxx\",\"vni\":\"datawrhoma\"}},{\"type\":\"Activity\",\"name\":\"up\",\"description\":\"neoqyetfxyx\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"nqcuprlrzfafek\",\"dependencyConditions\":[]},{\"activity\":\"ueovsqmzeel\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"v\",\"value\":\"datay\"}],\"\":{\"mccf\":\"dataf\",\"y\":\"datak\",\"vatnfdhyrhfvaap\":\"datazmnamesdcmg\"}}]}],\"defaultActivities\":[{\"type\":\"Activity\",\"name\":\"yufhcfeggyl\",\"description\":\"nbdvazqsbrqspvl\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"xvl\",\"dependencyConditions\":[\"Completed\"],\"\":{\"weoobb\":\"datacinjcrayoaskull\",\"wtzxq\":\"datagymbzaw\",\"pwvhiaxkm\":\"dataqzplzyjktc\",\"fhlwgka\":\"dataitczuscqobujfx\"}},{\"activity\":\"xp\",\"dependencyConditions\":[\"Skipped\",\"Skipped\"],\"\":{\"ccbduwsw\":\"dataccmjo\",\"gmewdmlk\":\"databqycubmeih\",\"pts\":\"datawchslb\"}},{\"activity\":\"qcwaobuimfdaq\",\"dependencyConditions\":[\"Succeeded\",\"Failed\"],\"\":{\"ablknqnqqcgiyff\":\"datamegmazdg\"}}],\"userProperties\":[{\"name\":\"g\",\"value\":\"datawlpopjlg\"}],\"\":{\"vaz\":\"datawqx\",\"skpgnagncguqfnh\":\"dataoxmxtcnmo\"}}]},\"name\":\"mvedjwdezmtpbe\",\"description\":\"ucxbudajfl\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"nrgm\",\"dependencyConditions\":[\"Failed\",\"Succeeded\",\"Skipped\"],\"\":{\"fvk\":\"datalhfmkllxoa\",\"thqzvfzxseqscoy\":\"datahf\",\"isbhkeskgnj\":\"dataxbaw\",\"ytdmrqravpxwze\":\"dataavoqcyl\"}}],\"userProperties\":[{\"name\":\"gcocbo\",\"value\":\"datamsj\"},{\"name\":\"bzvsugentr\",\"value\":\"datazbw\"},{\"name\":\"ivgdc\",\"value\":\"datarbswbxizmxvd\"},{\"name\":\"kmwyikoanep\",\"value\":\"dataknyvnbzglia\"}],\"\":{\"sg\":\"datajdhbqwcu\",\"kzwijqxwmjl\":\"dataefna\",\"fsqruyqaqemozj\":\"dataosqhnwbqc\",\"pclmkeswtkhfcnce\":\"datahixcivjokauj\"}}") + .toObject(SwitchActivity.class); + Assertions.assertEquals("mvedjwdezmtpbe", model.name()); + Assertions.assertEquals("ucxbudajfl", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("nrgm", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("gcocbo", model.userProperties().get(0).name()); + Assertions.assertEquals("qfupoamc", model.on().value()); + Assertions.assertEquals("xkgrecnqipskpyn", model.cases().get(0).value()); + Assertions.assertEquals("cd", model.cases().get(0).activities().get(0).name()); + Assertions.assertEquals("wutahl", model.cases().get(0).activities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.cases().get(0).activities().get(0).state()); + Assertions + .assertEquals( + ActivityOnInactiveMarkAs.SUCCEEDED, model.cases().get(0).activities().get(0).onInactiveMarkAs()); + Assertions + .assertEquals("scirgqjnfdehhke", model.cases().get(0).activities().get(0).dependsOn().get(0).activity()); + Assertions.assertEquals("njifuucoj", model.cases().get(0).activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals("yufhcfeggyl", model.defaultActivities().get(0).name()); + Assertions.assertEquals("nbdvazqsbrqspvl", model.defaultActivities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.defaultActivities().get(0).state()); + Assertions + .assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.defaultActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("xvl", model.defaultActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.defaultActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("g", model.defaultActivities().get(0).userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchActivity model = + new SwitchActivity() + .withName("mvedjwdezmtpbe") + .withDescription("ucxbudajfl") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("nrgm") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("gcocbo").withValue("datamsj"), + new UserProperty().withName("bzvsugentr").withValue("datazbw"), + new UserProperty().withName("ivgdc").withValue("datarbswbxizmxvd"), + new UserProperty().withName("kmwyikoanep").withValue("dataknyvnbzglia"))) + .withOn(new Expression().withValue("qfupoamc")) + .withCases( + Arrays + .asList( + new SwitchCase() + .withValue("xkgrecnqipskpyn") + .withActivities( + Arrays + .asList( + new Activity() + .withName("cd") + .withDescription("wutahl") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("scirgqjnfdehhke") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("njifuucoj") + .withValue("dataikgbhkvhldnscxw"), + new UserProperty() + .withName("wsrdzmbz") + .withValue("datafzydwexoyfseehvm"))) + .withAdditionalProperties(mapOf("type", "Activity")))), + new SwitchCase() + .withValue("hkcshyhgahmtevi") + .withActivities( + Arrays + .asList( + new Activity() + .withName("ijeppnpftwg") + .withDescription("cccyiuehsne") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("xnmqm") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("tvqrjutyfnmwmgha") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("edqakhcc") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("jntnlbsvt") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("dvzafpvwrbqbyx") + .withValue("dataupqkbb"), + new UserProperty() + .withName("mhwtmeqtsf") + .withValue("datajpv"), + new UserProperty() + .withName("wbxlgpepxbjjnxd") + .withValue("datanegkltlpbbepmmi"), + new UserProperty().withName("mvada").withValue("datauev"))) + .withAdditionalProperties(mapOf("type", "Activity")))), + new SwitchCase() + .withValue("ncyksblreq") + .withActivities( + Arrays + .asList( + new Activity() + .withName("k") + .withDescription("biylkfnedxdemc") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("zyrugstbzpozql") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("uau") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("kttlpwxola") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("evwwblqd") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("egu") + .withValue("datanteucaojjbb"), + new UserProperty() + .withName("ftcnzokdademqp") + .withValue("dataxekmdkbtmupm"), + new UserProperty().withName("ay").withValue("datajocsq"), + new UserProperty() + .withName("ibu") + .withValue("datalppnevujkzb"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("ihqs") + .withDescription("tqaoacnl") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("vgpidrtbcxiwfkd") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("lvbwueytxlujvm") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ooagaqnekwen") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("iqlnwfbjo") + .withValue("dataxsmhvjogvq"), + new UserProperty() + .withName("cpsufcdgc") + .withValue("datafxsvxkcyhkh"), + new UserProperty() + .withName("qwvwfombcgr") + .withValue("datalenrcovqty"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("up") + .withDescription("neoqyetfxyx") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("nqcuprlrzfafek") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ueovsqmzeel") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("v").withValue("datay"))) + .withAdditionalProperties(mapOf("type", "Activity")))))) + .withDefaultActivities( + Arrays + .asList( + new Activity() + .withName("yufhcfeggyl") + .withDescription("nbdvazqsbrqspvl") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("xvl") + .withDependencyConditions(Arrays.asList(DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("xp") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("qcwaobuimfdaq") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("g").withValue("datawlpopjlg"))) + .withAdditionalProperties(mapOf("type", "Activity")))); + model = BinaryData.fromObject(model).toObject(SwitchActivity.class); + Assertions.assertEquals("mvedjwdezmtpbe", model.name()); + Assertions.assertEquals("ucxbudajfl", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("nrgm", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.FAILED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("gcocbo", model.userProperties().get(0).name()); + Assertions.assertEquals("qfupoamc", model.on().value()); + Assertions.assertEquals("xkgrecnqipskpyn", model.cases().get(0).value()); + Assertions.assertEquals("cd", model.cases().get(0).activities().get(0).name()); + Assertions.assertEquals("wutahl", model.cases().get(0).activities().get(0).description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.cases().get(0).activities().get(0).state()); + Assertions + .assertEquals( + ActivityOnInactiveMarkAs.SUCCEEDED, model.cases().get(0).activities().get(0).onInactiveMarkAs()); + Assertions + .assertEquals("scirgqjnfdehhke", model.cases().get(0).activities().get(0).dependsOn().get(0).activity()); + Assertions.assertEquals("njifuucoj", model.cases().get(0).activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals("yufhcfeggyl", model.defaultActivities().get(0).name()); + Assertions.assertEquals("nbdvazqsbrqspvl", model.defaultActivities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.defaultActivities().get(0).state()); + Assertions + .assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.defaultActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("xvl", model.defaultActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.defaultActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("g", model.defaultActivities().get(0).userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SwitchActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SwitchActivityTypePropertiesTests.java new file mode 100644 index 000000000000..92078eb0e077 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SwitchActivityTypePropertiesTests.java @@ -0,0 +1,404 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SwitchActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.Expression; +import com.azure.resourcemanager.datafactory.models.SwitchCase; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SwitchActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchActivityTypeProperties model = + BinaryData + .fromString( + "{\"on\":{\"value\":\"wvirbshyulkhep\"},\"cases\":[{\"value\":\"cz\",\"activities\":[{\"type\":\"Activity\",\"name\":\"ydaifx\",\"description\":\"xqzczccml\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"daoi\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"knsqdr\",\"value\":\"datagvanpjv\"},{\"name\":\"rwlseeuyxxrwo\",\"value\":\"datagwq\"},{\"name\":\"zugsbwqrotpvytrz\",\"value\":\"dataqbckqgt\"}],\"\":{\"yicjzkgyuvi\":\"datanznk\",\"buvyuzzwph\":\"dataeskindgmk\",\"ikwvcogq\":\"dataliflxrnsyvmu\"}},{\"type\":\"Activity\",\"name\":\"im\",\"description\":\"thrrxr\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"bmizbev\",\"dependencyConditions\":[]},{\"activity\":\"ezufxuugvdbpjo\",\"dependencyConditions\":[]},{\"activity\":\"cpystc\",\"dependencyConditions\":[]},{\"activity\":\"avlnk\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"nvfgwgoxfd\",\"value\":\"datakezoxhazafmq\"},{\"name\":\"bifpc\",\"value\":\"dataammpeakdhebzquq\"},{\"name\":\"gjxklojdydha\",\"value\":\"datafjwm\"},{\"name\":\"sxgjih\",\"value\":\"dataxoxjghumvpt\"}],\"\":{\"fealcjuzzz\":\"datagll\"}},{\"type\":\"Activity\",\"name\":\"lkucrno\",\"description\":\"gdbaorn\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"qojdmzej\",\"dependencyConditions\":[]},{\"activity\":\"pzzq\",\"dependencyConditions\":[]},{\"activity\":\"inrymzlq\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"ivxaqzmvgx\",\"value\":\"datatkcvnyik\"},{\"name\":\"exw\",\"value\":\"datas\"},{\"name\":\"vgxelzuvdyz\",\"value\":\"datansutesqkklzy\"},{\"name\":\"avtivefsrlt\",\"value\":\"dataxhpntewv\"}],\"\":{\"dervnnfieaqbvg\":\"dataidmcoxobrv\",\"ubqemrxmr\":\"dataehggeeagbrslbzc\",\"axusww\":\"databe\",\"agdnzvohrnqnuru\":\"datanwxohbmv\"}}]},{\"value\":\"yuzcp\",\"activities\":[{\"type\":\"Activity\",\"name\":\"s\",\"description\":\"dtiocsf\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"scv\",\"dependencyConditions\":[]},{\"activity\":\"mthukboryn\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"tyhmophoemhv\",\"value\":\"dataqwdphncftbqij\"},{\"name\":\"qfoatqnhr\",\"value\":\"dataxhmtxpxdtmrwjk\"},{\"name\":\"tiznvijdtmjy\",\"value\":\"databkdhwadnccunrviq\"}],\"\":{\"a\":\"datasliou\",\"jw\":\"dataxqnpnpggbu\"}}]},{\"value\":\"gqudnmuirt\",\"activities\":[{\"type\":\"Activity\",\"name\":\"tk\",\"description\":\"hixfuuzaczmejf\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"itytketwdskoc\",\"dependencyConditions\":[]},{\"activity\":\"qhzyswchbvejg\",\"dependencyConditions\":[]},{\"activity\":\"xvjqevmzhkocyngd\",\"dependencyConditions\":[]},{\"activity\":\"kapnxylhr\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"hd\",\"value\":\"datalndlvcbc\"},{\"name\":\"biisnh\",\"value\":\"dataqqaedgwghqq\"},{\"name\":\"uuetmqzuen\",\"value\":\"datallqvroopk\"},{\"name\":\"mj\",\"value\":\"dataopibaxkywqs\"}],\"\":{\"cahlsavinoora\":\"datacuvlfzdkpfeup\",\"lbd\":\"dataspfinyijmwqgmhf\",\"fpucwmdmbys\":\"datadhedmfidro\"}},{\"type\":\"Activity\",\"name\":\"qbgndfzheyxccx\",\"description\":\"sioawro\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"quppkzuxsbbmxfut\",\"dependencyConditions\":[]},{\"activity\":\"y\",\"dependencyConditions\":[]}],\"userProperties\":[{\"name\":\"lyopobgzluuki\",\"value\":\"datajezadkf\"},{\"name\":\"piffgtqhghygzaya\",\"value\":\"datargmlaerx\"},{\"name\":\"ucxmybuqjpgbi\",\"value\":\"dataaxga\"},{\"name\":\"zfyin\",\"value\":\"datapvbmbf\"}],\"\":{\"wwgzyvo\":\"datauamdydkdcvowasl\",\"haqqavhfdezom\":\"dataotief\"}}]}],\"defaultActivities\":[{\"type\":\"Activity\",\"name\":\"blmypuonuv\",\"description\":\"mf\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"ha\",\"dependencyConditions\":[\"Failed\",\"Completed\",\"Failed\",\"Completed\"],\"\":{\"wipaucl\":\"dataabyzdaroe\"}},{\"activity\":\"typzziavg\",\"dependencyConditions\":[\"Succeeded\",\"Succeeded\",\"Skipped\",\"Succeeded\"],\"\":{\"djkk\":\"dataghboqeuezyf\",\"daejn\":\"dataaci\",\"wyfuqqbafrbhr\":\"datab\",\"kvok\":\"datap\"}},{\"activity\":\"mere\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Skipped\",\"Failed\"],\"\":{\"decxbiknf\":\"datakcn\",\"fxdntpksb\":\"datapixfdojxby\",\"svahbqoojdnmrxj\":\"dataigegwaidqzfl\"}},{\"activity\":\"umrzfdbo\",\"dependencyConditions\":[\"Failed\",\"Failed\"],\"\":{\"hql\":\"datan\"}}],\"userProperties\":[{\"name\":\"gia\",\"value\":\"dataxpfkozvcxxezurh\"},{\"name\":\"ucnssp\",\"value\":\"dataleazvyftklbbribg\"},{\"name\":\"zkkmrlptdk\",\"value\":\"dataib\"},{\"name\":\"rivedshuxlhecz\",\"value\":\"datamwwm\"}],\"\":{\"ysjglponkrhp\":\"dataiwkrj\"}},{\"type\":\"Activity\",\"name\":\"ediu\",\"description\":\"kcad\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"pcjrbfayduzzyxly\",\"dependencyConditions\":[\"Completed\",\"Skipped\"],\"\":{\"ec\":\"datafmya\"}}],\"userProperties\":[{\"name\":\"bfgmgho\",\"value\":\"dataox\"}],\"\":{\"lqlib\":\"datatsrvqcxrrkcv\"}},{\"type\":\"Activity\",\"name\":\"mfn\",\"description\":\"sihkkk\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"zmfpgzljgrt\",\"dependencyConditions\":[\"Skipped\",\"Failed\"],\"\":{\"etpk\":\"datamzbasxapcegtcdu\"}}],\"userProperties\":[{\"name\":\"nneynmgvqysgh\",\"value\":\"datahxgxqdmvfdocjafc\"}],\"\":{\"qhyq\":\"datadnktutwczdwmtfjz\",\"owverhtyc\":\"datamobsjudpeed\",\"mdsisll\":\"dataigtsrrlelpobm\",\"imojozhdcptxxb\":\"dataqgluhr\"}}]}") + .toObject(SwitchActivityTypeProperties.class); + Assertions.assertEquals("wvirbshyulkhep", model.on().value()); + Assertions.assertEquals("cz", model.cases().get(0).value()); + Assertions.assertEquals("ydaifx", model.cases().get(0).activities().get(0).name()); + Assertions.assertEquals("xqzczccml", model.cases().get(0).activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.cases().get(0).activities().get(0).state()); + Assertions + .assertEquals( + ActivityOnInactiveMarkAs.SKIPPED, model.cases().get(0).activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("daoi", model.cases().get(0).activities().get(0).dependsOn().get(0).activity()); + Assertions.assertEquals("knsqdr", model.cases().get(0).activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals("blmypuonuv", model.defaultActivities().get(0).name()); + Assertions.assertEquals("mf", model.defaultActivities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.defaultActivities().get(0).state()); + Assertions + .assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.defaultActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("ha", model.defaultActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.FAILED, + model.defaultActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("gia", model.defaultActivities().get(0).userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchActivityTypeProperties model = + new SwitchActivityTypeProperties() + .withOn(new Expression().withValue("wvirbshyulkhep")) + .withCases( + Arrays + .asList( + new SwitchCase() + .withValue("cz") + .withActivities( + Arrays + .asList( + new Activity() + .withName("ydaifx") + .withDescription("xqzczccml") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("daoi") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("knsqdr") + .withValue("datagvanpjv"), + new UserProperty() + .withName("rwlseeuyxxrwo") + .withValue("datagwq"), + new UserProperty() + .withName("zugsbwqrotpvytrz") + .withValue("dataqbckqgt"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("im") + .withDescription("thrrxr") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("bmizbev") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ezufxuugvdbpjo") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("cpystc") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("avlnk") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("nvfgwgoxfd") + .withValue("datakezoxhazafmq"), + new UserProperty() + .withName("bifpc") + .withValue("dataammpeakdhebzquq"), + new UserProperty() + .withName("gjxklojdydha") + .withValue("datafjwm"), + new UserProperty() + .withName("sxgjih") + .withValue("dataxoxjghumvpt"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("lkucrno") + .withDescription("gdbaorn") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("qojdmzej") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("pzzq") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("inrymzlq") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("ivxaqzmvgx") + .withValue("datatkcvnyik"), + new UserProperty().withName("exw").withValue("datas"), + new UserProperty() + .withName("vgxelzuvdyz") + .withValue("datansutesqkklzy"), + new UserProperty() + .withName("avtivefsrlt") + .withValue("dataxhpntewv"))) + .withAdditionalProperties(mapOf("type", "Activity")))), + new SwitchCase() + .withValue("yuzcp") + .withActivities( + Arrays + .asList( + new Activity() + .withName("s") + .withDescription("dtiocsf") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("scv") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("mthukboryn") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("tyhmophoemhv") + .withValue("dataqwdphncftbqij"), + new UserProperty() + .withName("qfoatqnhr") + .withValue("dataxhmtxpxdtmrwjk"), + new UserProperty() + .withName("tiznvijdtmjy") + .withValue("databkdhwadnccunrviq"))) + .withAdditionalProperties(mapOf("type", "Activity")))), + new SwitchCase() + .withValue("gqudnmuirt") + .withActivities( + Arrays + .asList( + new Activity() + .withName("tk") + .withDescription("hixfuuzaczmejf") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("itytketwdskoc") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("qhzyswchbvejg") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("xvjqevmzhkocyngd") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("kapnxylhr") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("hd").withValue("datalndlvcbc"), + new UserProperty() + .withName("biisnh") + .withValue("dataqqaedgwghqq"), + new UserProperty() + .withName("uuetmqzuen") + .withValue("datallqvroopk"), + new UserProperty() + .withName("mj") + .withValue("dataopibaxkywqs"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("qbgndfzheyxccx") + .withDescription("sioawro") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("quppkzuxsbbmxfut") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("y") + .withDependencyConditions(Arrays.asList()) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("lyopobgzluuki") + .withValue("datajezadkf"), + new UserProperty() + .withName("piffgtqhghygzaya") + .withValue("datargmlaerx"), + new UserProperty() + .withName("ucxmybuqjpgbi") + .withValue("dataaxga"), + new UserProperty() + .withName("zfyin") + .withValue("datapvbmbf"))) + .withAdditionalProperties(mapOf("type", "Activity")))))) + .withDefaultActivities( + Arrays + .asList( + new Activity() + .withName("blmypuonuv") + .withDescription("mf") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ha") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("typzziavg") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("mere") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.SKIPPED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("umrzfdbo") + .withDependencyConditions( + Arrays + .asList(DependencyCondition.FAILED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("gia").withValue("dataxpfkozvcxxezurh"), + new UserProperty().withName("ucnssp").withValue("dataleazvyftklbbribg"), + new UserProperty().withName("zkkmrlptdk").withValue("dataib"), + new UserProperty().withName("rivedshuxlhecz").withValue("datamwwm"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("ediu") + .withDescription("kcad") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("pcjrbfayduzzyxly") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("bfgmgho").withValue("dataox"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("mfn") + .withDescription("sihkkk") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("zmfpgzljgrt") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty() + .withName("nneynmgvqysgh") + .withValue("datahxgxqdmvfdocjafc"))) + .withAdditionalProperties(mapOf("type", "Activity")))); + model = BinaryData.fromObject(model).toObject(SwitchActivityTypeProperties.class); + Assertions.assertEquals("wvirbshyulkhep", model.on().value()); + Assertions.assertEquals("cz", model.cases().get(0).value()); + Assertions.assertEquals("ydaifx", model.cases().get(0).activities().get(0).name()); + Assertions.assertEquals("xqzczccml", model.cases().get(0).activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.cases().get(0).activities().get(0).state()); + Assertions + .assertEquals( + ActivityOnInactiveMarkAs.SKIPPED, model.cases().get(0).activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("daoi", model.cases().get(0).activities().get(0).dependsOn().get(0).activity()); + Assertions.assertEquals("knsqdr", model.cases().get(0).activities().get(0).userProperties().get(0).name()); + Assertions.assertEquals("blmypuonuv", model.defaultActivities().get(0).name()); + Assertions.assertEquals("mf", model.defaultActivities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.defaultActivities().get(0).state()); + Assertions + .assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.defaultActivities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("ha", model.defaultActivities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.FAILED, + model.defaultActivities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("gia", model.defaultActivities().get(0).userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SwitchCaseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SwitchCaseTests.java new file mode 100644 index 000000000000..5256b5191d75 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SwitchCaseTests.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.SwitchCase; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SwitchCaseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchCase model = + BinaryData + .fromString( + "{\"value\":\"qbzc\",\"activities\":[{\"type\":\"Activity\",\"name\":\"yudc\",\"description\":\"eowepv\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"sntopfqgu\",\"dependencyConditions\":[\"Succeeded\",\"Succeeded\"],\"\":{\"gurg\":\"datayeumwvz\",\"hkefowncudcrwo\":\"datarpcguwyu\"}},{\"activity\":\"qsrqebjgo\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\"],\"\":{\"gchkmqfkm\":\"datad\"}},{\"activity\":\"eaomqqbslwxcf\",\"dependencyConditions\":[\"Skipped\",\"Completed\"],\"\":{\"mnxpp\":\"dataebarw\",\"nedjvataeao\":\"datafep\"}}],\"userProperties\":[{\"name\":\"zynvvkfbmrp\",\"value\":\"datajfceabgpwzs\"},{\"name\":\"ewi\",\"value\":\"datan\"},{\"name\":\"vdjmvzcycg\",\"value\":\"datatelimqxwih\"}],\"\":{\"guziglrihzrmrvgc\":\"dataexj\",\"twnppstpqws\":\"datafciskl\"}},{\"type\":\"Activity\",\"name\":\"eawolhlfffe\",\"description\":\"bmhqy\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"coqtvxhipchdpdev\",\"dependencyConditions\":[\"Succeeded\",\"Failed\"],\"\":{\"eshxomt\":\"datacik\",\"pypzgdet\":\"datakxpsx\",\"gyhu\":\"datad\",\"zmziiftjig\":\"datasutspocrskkraap\"}},{\"activity\":\"qyzocfyywcfl\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\",\"Succeeded\"],\"\":{\"pwtjoku\":\"datamktbwdfjcepy\",\"bbccbqxwojve\":\"datartqnbdgcnickn\"}},{\"activity\":\"xhf\",\"dependencyConditions\":[\"Succeeded\",\"Skipped\"],\"\":{\"hzwyyyerzbmlhg\":\"datafyjcenkidlpml\",\"wsyx\":\"datatkthevodddne\",\"ohdifbhtxtcqjg\":\"datafdjftcr\"}},{\"activity\":\"d\",\"dependencyConditions\":[\"Completed\",\"Skipped\"],\"\":{\"tnej\":\"dataurjxkpha\",\"vuvh\":\"datafljqzbixlzaa\",\"bneepfjibtsp\":\"dataerjrcxyxepl\",\"eigywj\":\"dataiwfqj\"}}],\"userProperties\":[{\"name\":\"gncscwsefdqnsu\",\"value\":\"dataomln\"}],\"\":{\"crllecquo\":\"datajdcvnanej\",\"wvcyprpog\":\"datagyhkvtofxke\",\"ochpzcgs\":\"dataqvuftkiyghcmpyki\"}},{\"type\":\"Activity\",\"name\":\"pklfnst\",\"description\":\"bpwwo\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"rsgfpds\",\"dependencyConditions\":[\"Succeeded\"],\"\":{\"kcji\":\"dataepmttrfun\",\"jjfne\":\"dataoczoiduk\",\"mdffyv\":\"datauqalwjcqbnvbz\"}},{\"activity\":\"d\",\"dependencyConditions\":[\"Completed\"],\"\":{\"okirxyffttsdt\":\"dataryvkubfotgivpor\",\"gtrjzimxz\":\"dataql\",\"uladdujzenagmh\":\"datauqcinjejyinlys\"}},{\"activity\":\"mgtbqzftmpgibm\",\"dependencyConditions\":[\"Completed\"],\"\":{\"yjvjyxueuqc\":\"datacprbwsndloldxm\",\"gxak\":\"datagbs\",\"uyokctymsbhdi\":\"datakbryolzbmdntajgg\",\"s\":\"datazao\"}},{\"activity\":\"nxgk\",\"dependencyConditions\":[\"Completed\",\"Skipped\"],\"\":{\"euwpivsltlyqc\":\"dataukbpwwfeixm\",\"qcmsrzrcddlzga\":\"datapwndcjr\",\"optrudpm\":\"dataptwqfgqccond\"}}],\"userProperties\":[{\"name\":\"loflcilrafkrvv\",\"value\":\"datawknymqzmui\"},{\"name\":\"uvtgjgpcvdjin\",\"value\":\"dataoslzrbz\"},{\"name\":\"f\",\"value\":\"datavwcjrbjgdvwa\"}],\"\":{\"svximqkuyflzx\":\"datacnevkfkmena\"}},{\"type\":\"Activity\",\"name\":\"suuapktfvemwfwc\",\"description\":\"qyqvy\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"wcojxpkpsq\",\"dependencyConditions\":[\"Failed\",\"Completed\",\"Completed\"],\"\":{\"zpgn\":\"dataybkhyqou\"}},{\"activity\":\"dzsnv\",\"dependencyConditions\":[\"Completed\",\"Skipped\",\"Skipped\",\"Completed\"],\"\":{\"w\":\"datahgfd\",\"nrfpzl\":\"datahcczyqnfs\",\"momvvrkdsqf\":\"dataaeojnskek\"}},{\"activity\":\"z\",\"dependencyConditions\":[\"Skipped\",\"Completed\",\"Completed\"],\"\":{\"cacdyajyiwvqlrz\":\"dataaxjhaetyeafjlism\",\"avnkyqrjbzrzfht\":\"databvkgfpjb\",\"abbxkldtwrrycl\":\"dataukuypyeofsa\",\"bguaxilcdbu\":\"datarld\"}}],\"userProperties\":[{\"name\":\"lpgpxyrfkslgpl\",\"value\":\"datad\"},{\"name\":\"cmkdhgpzqibqilc\",\"value\":\"datatmu\"},{\"name\":\"emex\",\"value\":\"datarjxaawentkok\"}],\"\":{\"wxicbvwnn\":\"datawpxeanjq\",\"grk\":\"datatlbc\",\"eayowzp\":\"datawof\"}}]}") + .toObject(SwitchCase.class); + Assertions.assertEquals("qbzc", model.value()); + Assertions.assertEquals("yudc", model.activities().get(0).name()); + Assertions.assertEquals("eowepv", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("sntopfqgu", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SUCCEEDED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("zynvvkfbmrp", model.activities().get(0).userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchCase model = + new SwitchCase() + .withValue("qbzc") + .withActivities( + Arrays + .asList( + new Activity() + .withName("yudc") + .withDescription("eowepv") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("sntopfqgu") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("qsrqebjgo") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("eaomqqbslwxcf") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("zynvvkfbmrp").withValue("datajfceabgpwzs"), + new UserProperty().withName("ewi").withValue("datan"), + new UserProperty().withName("vdjmvzcycg").withValue("datatelimqxwih"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("eawolhlfffe") + .withDescription("bmhqy") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("coqtvxhipchdpdev") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("qyzocfyywcfl") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("xhf") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("d") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("gncscwsefdqnsu").withValue("dataomln"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("pklfnst") + .withDescription("bpwwo") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("rsgfpds") + .withDependencyConditions(Arrays.asList(DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("d") + .withDependencyConditions(Arrays.asList(DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("mgtbqzftmpgibm") + .withDependencyConditions(Arrays.asList(DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("nxgk") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("loflcilrafkrvv").withValue("datawknymqzmui"), + new UserProperty().withName("uvtgjgpcvdjin").withValue("dataoslzrbz"), + new UserProperty().withName("f").withValue("datavwcjrbjgdvwa"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("suuapktfvemwfwc") + .withDescription("qyqvy") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("wcojxpkpsq") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("dzsnv") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("z") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("lpgpxyrfkslgpl").withValue("datad"), + new UserProperty().withName("cmkdhgpzqibqilc").withValue("datatmu"), + new UserProperty().withName("emex").withValue("datarjxaawentkok"))) + .withAdditionalProperties(mapOf("type", "Activity")))); + model = BinaryData.fromObject(model).toObject(SwitchCase.class); + Assertions.assertEquals("qbzc", model.value()); + Assertions.assertEquals("yudc", model.activities().get(0).name()); + Assertions.assertEquals("eowepv", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("sntopfqgu", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SUCCEEDED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("zynvvkfbmrp", model.activities().get(0).userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SybaseSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SybaseSourceTests.java new file mode 100644 index 000000000000..9967be41a9b3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SybaseSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SybaseSource; + +public final class SybaseSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SybaseSource model = + BinaryData + .fromString( + "{\"type\":\"SybaseSource\",\"query\":\"datapccfwq\",\"queryTimeout\":\"dataouqyzxzjehdklvqt\",\"additionalColumns\":\"dataoc\",\"sourceRetryCount\":\"dataetctjh\",\"sourceRetryWait\":\"datamoazsjsuevfvnn\",\"maxConcurrentConnections\":\"dataccvxqbxgq\",\"disableMetricsCollection\":\"datawnriwxe\",\"\":{\"xsvzwbktalobxl\":\"datavwqldil\"}}") + .toObject(SybaseSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SybaseSource model = + new SybaseSource() + .withSourceRetryCount("dataetctjh") + .withSourceRetryWait("datamoazsjsuevfvnn") + .withMaxConcurrentConnections("dataccvxqbxgq") + .withDisableMetricsCollection("datawnriwxe") + .withQueryTimeout("dataouqyzxzjehdklvqt") + .withAdditionalColumns("dataoc") + .withQuery("datapccfwq"); + model = BinaryData.fromObject(model).toObject(SybaseSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SybaseTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SybaseTableDatasetTests.java new file mode 100644 index 000000000000..edc51b82a5cd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SybaseTableDatasetTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.SybaseTableDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SybaseTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SybaseTableDataset model = + BinaryData + .fromString( + "{\"type\":\"SybaseTable\",\"typeProperties\":{\"tableName\":\"dataokez\"},\"description\":\"ezknfzqnzbflbqmh\",\"structure\":\"datayxxvwedhagqbbse\",\"schema\":\"dataayuflmsyz\",\"linkedServiceName\":{\"referenceName\":\"dcrolrze\",\"parameters\":{\"ivt\":\"datamphzkymunw\",\"wdalisd\":\"datauszbdjrdfeuj\",\"dz\":\"dataqngca\",\"p\":\"datanloou\"}},\"parameters\":{\"iaffj\":{\"type\":\"Object\",\"defaultValue\":\"datahyclxrsidoebldp\"},\"x\":{\"type\":\"Bool\",\"defaultValue\":\"datanhrevimxm\"}},\"annotations\":[\"datapitygv\",\"datawdsoqtbfkvuozbzc\"],\"folder\":{\"name\":\"ekwanklp\"},\"\":{\"kjse\":\"datacydjh\",\"rdonkgobx\":\"datawiynd\",\"olenrswknpdr\":\"datalr\"}}") + .toObject(SybaseTableDataset.class); + Assertions.assertEquals("ezknfzqnzbflbqmh", model.description()); + Assertions.assertEquals("dcrolrze", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("iaffj").type()); + Assertions.assertEquals("ekwanklp", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SybaseTableDataset model = + new SybaseTableDataset() + .withDescription("ezknfzqnzbflbqmh") + .withStructure("datayxxvwedhagqbbse") + .withSchema("dataayuflmsyz") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("dcrolrze") + .withParameters( + mapOf( + "ivt", + "datamphzkymunw", + "wdalisd", + "datauszbdjrdfeuj", + "dz", + "dataqngca", + "p", + "datanloou"))) + .withParameters( + mapOf( + "iaffj", + new ParameterSpecification() + .withType(ParameterType.OBJECT) + .withDefaultValue("datahyclxrsidoebldp"), + "x", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datanhrevimxm"))) + .withAnnotations(Arrays.asList("datapitygv", "datawdsoqtbfkvuozbzc")) + .withFolder(new DatasetFolder().withName("ekwanklp")) + .withTableName("dataokez"); + model = BinaryData.fromObject(model).toObject(SybaseTableDataset.class); + Assertions.assertEquals("ezknfzqnzbflbqmh", model.description()); + Assertions.assertEquals("dcrolrze", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("iaffj").type()); + Assertions.assertEquals("ekwanklp", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SybaseTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SybaseTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..85d85083875c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SybaseTableDatasetTypePropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SybaseTableDatasetTypeProperties; + +public final class SybaseTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SybaseTableDatasetTypeProperties model = + BinaryData.fromString("{\"tableName\":\"datamzaof\"}").toObject(SybaseTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SybaseTableDatasetTypeProperties model = new SybaseTableDatasetTypeProperties().withTableName("datamzaof"); + model = BinaryData.fromObject(model).toObject(SybaseTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseNotebookActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseNotebookActivityTests.java new file mode 100644 index 000000000000..e79d5183c84c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseNotebookActivityTests.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityPolicy; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.BigDataPoolParametrizationReference; +import com.azure.resourcemanager.datafactory.models.BigDataPoolReferenceType; +import com.azure.resourcemanager.datafactory.models.ConfigurationType; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.NotebookParameter; +import com.azure.resourcemanager.datafactory.models.NotebookParameterType; +import com.azure.resourcemanager.datafactory.models.NotebookReferenceType; +import com.azure.resourcemanager.datafactory.models.SparkConfigurationParametrizationReference; +import com.azure.resourcemanager.datafactory.models.SparkConfigurationReferenceType; +import com.azure.resourcemanager.datafactory.models.SynapseNotebookActivity; +import com.azure.resourcemanager.datafactory.models.SynapseNotebookReference; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SynapseNotebookActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SynapseNotebookActivity model = + BinaryData + .fromString( + "{\"type\":\"SynapseNotebook\",\"typeProperties\":{\"notebook\":{\"type\":\"NotebookReference\",\"referenceName\":\"datalntvfqrjf\"},\"sparkPool\":{\"type\":\"BigDataPoolReference\",\"referenceName\":\"dataspdsrax\"},\"parameters\":{\"kzcfxzcpew\":{\"value\":\"datan\",\"type\":\"float\"},\"reonsqqcqgnfdimg\":{\"value\":\"datapwe\",\"type\":\"bool\"},\"lssqv\":{\"value\":\"datapmftzira\",\"type\":\"string\"}},\"executorSize\":\"datahznltjxstjgey\",\"conf\":\"dataswnjonipjqw\",\"driverSize\":\"dataxswineyjerf\",\"numExecutors\":\"datamlppnmrftnf\",\"configurationType\":\"Artifact\",\"targetSparkConfiguration\":{\"type\":\"SparkConfigurationReference\",\"referenceName\":\"dataftklpbgk\"},\"sparkConfig\":{\"iyktsi\":\"datafnszeemsfpm\",\"seqlvqkkcebj\":\"datasnikmwnzcen\"}},\"linkedServiceName\":{\"referenceName\":\"cuj\",\"parameters\":{\"lkvaiolfrceoc\":\"dataoeqpvkkpgif\",\"mwrb\":\"datasreicpsviajk\",\"ccr\":\"dataejh\",\"ufupadtpbbzjev\":\"dataayqskkp\"}},\"policy\":{\"timeout\":\"datanyzhbtnagkn\",\"retry\":\"dataeno\",\"retryIntervalInSeconds\":622563068,\"secureInput\":true,\"secureOutput\":true,\"\":{\"tlnrtwrnuklsh\":\"datah\",\"httbdxjtvpadr\":\"dataqrht\",\"adxnrtkdte\":\"dataxqud\"}},\"name\":\"un\",\"description\":\"pv\",\"state\":\"Inactive\",\"onInactiveMarkAs\":\"Skipped\",\"dependsOn\":[{\"activity\":\"bgvyztoqdzw\",\"dependencyConditions\":[\"Skipped\",\"Skipped\",\"Skipped\"],\"\":{\"qortxeuwbf\":\"datacrsr\",\"zbuhqmmady\":\"datazwisxsasgfmrz\"}},{\"activity\":\"c\",\"dependencyConditions\":[\"Failed\"],\"\":{\"cgkikbuaqdopxbnr\":\"datanlabogmfetq\",\"dbpuy\":\"datangtssoiiyp\",\"s\":\"dataxygztlqszwcwan\"}}],\"userProperties\":[{\"name\":\"qeomagoqfmkslbes\",\"value\":\"datadlskwfiwvdqmqq\"}],\"\":{\"ptmpcpiros\":\"dataotogo\",\"h\":\"dataxiwmwrbruuw\",\"hdvqgaa\":\"datakynfxxldmxms\"}}") + .toObject(SynapseNotebookActivity.class); + Assertions.assertEquals("un", model.name()); + Assertions.assertEquals("pv", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("bgvyztoqdzw", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("qeomagoqfmkslbes", model.userProperties().get(0).name()); + Assertions.assertEquals("cuj", model.linkedServiceName().referenceName()); + Assertions.assertEquals(622563068, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals(NotebookReferenceType.NOTEBOOK_REFERENCE, model.notebook().type()); + Assertions.assertEquals(BigDataPoolReferenceType.BIG_DATA_POOL_REFERENCE, model.sparkPool().type()); + Assertions.assertEquals(NotebookParameterType.FLOAT, model.parameters().get("kzcfxzcpew").type()); + Assertions.assertEquals(ConfigurationType.ARTIFACT, model.configurationType()); + Assertions + .assertEquals( + SparkConfigurationReferenceType.SPARK_CONFIGURATION_REFERENCE, model.targetSparkConfiguration().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SynapseNotebookActivity model = + new SynapseNotebookActivity() + .withName("un") + .withDescription("pv") + .withState(ActivityState.INACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SKIPPED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("bgvyztoqdzw") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("c") + .withDependencyConditions(Arrays.asList(DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("qeomagoqfmkslbes").withValue("datadlskwfiwvdqmqq"))) + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("cuj") + .withParameters( + mapOf( + "lkvaiolfrceoc", + "dataoeqpvkkpgif", + "mwrb", + "datasreicpsviajk", + "ccr", + "dataejh", + "ufupadtpbbzjev", + "dataayqskkp"))) + .withPolicy( + new ActivityPolicy() + .withTimeout("datanyzhbtnagkn") + .withRetry("dataeno") + .withRetryIntervalInSeconds(622563068) + .withSecureInput(true) + .withSecureOutput(true) + .withAdditionalProperties(mapOf())) + .withNotebook( + new SynapseNotebookReference() + .withType(NotebookReferenceType.NOTEBOOK_REFERENCE) + .withReferenceName("datalntvfqrjf")) + .withSparkPool( + new BigDataPoolParametrizationReference() + .withType(BigDataPoolReferenceType.BIG_DATA_POOL_REFERENCE) + .withReferenceName("dataspdsrax")) + .withParameters( + mapOf( + "kzcfxzcpew", + new NotebookParameter().withValue("datan").withType(NotebookParameterType.FLOAT), + "reonsqqcqgnfdimg", + new NotebookParameter().withValue("datapwe").withType(NotebookParameterType.BOOL), + "lssqv", + new NotebookParameter().withValue("datapmftzira").withType(NotebookParameterType.STRING))) + .withExecutorSize("datahznltjxstjgey") + .withConf("dataswnjonipjqw") + .withDriverSize("dataxswineyjerf") + .withNumExecutors("datamlppnmrftnf") + .withConfigurationType(ConfigurationType.ARTIFACT) + .withTargetSparkConfiguration( + new SparkConfigurationParametrizationReference() + .withType(SparkConfigurationReferenceType.SPARK_CONFIGURATION_REFERENCE) + .withReferenceName("dataftklpbgk")) + .withSparkConfig(mapOf("iyktsi", "datafnszeemsfpm", "seqlvqkkcebj", "datasnikmwnzcen")); + model = BinaryData.fromObject(model).toObject(SynapseNotebookActivity.class); + Assertions.assertEquals("un", model.name()); + Assertions.assertEquals("pv", model.description()); + Assertions.assertEquals(ActivityState.INACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SKIPPED, model.onInactiveMarkAs()); + Assertions.assertEquals("bgvyztoqdzw", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("qeomagoqfmkslbes", model.userProperties().get(0).name()); + Assertions.assertEquals("cuj", model.linkedServiceName().referenceName()); + Assertions.assertEquals(622563068, model.policy().retryIntervalInSeconds()); + Assertions.assertEquals(true, model.policy().secureInput()); + Assertions.assertEquals(true, model.policy().secureOutput()); + Assertions.assertEquals(NotebookReferenceType.NOTEBOOK_REFERENCE, model.notebook().type()); + Assertions.assertEquals(BigDataPoolReferenceType.BIG_DATA_POOL_REFERENCE, model.sparkPool().type()); + Assertions.assertEquals(NotebookParameterType.FLOAT, model.parameters().get("kzcfxzcpew").type()); + Assertions.assertEquals(ConfigurationType.ARTIFACT, model.configurationType()); + Assertions + .assertEquals( + SparkConfigurationReferenceType.SPARK_CONFIGURATION_REFERENCE, model.targetSparkConfiguration().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseNotebookActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseNotebookActivityTypePropertiesTests.java new file mode 100644 index 000000000000..e6fbddcb5777 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseNotebookActivityTypePropertiesTests.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.SynapseNotebookActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.BigDataPoolParametrizationReference; +import com.azure.resourcemanager.datafactory.models.BigDataPoolReferenceType; +import com.azure.resourcemanager.datafactory.models.ConfigurationType; +import com.azure.resourcemanager.datafactory.models.NotebookParameter; +import com.azure.resourcemanager.datafactory.models.NotebookParameterType; +import com.azure.resourcemanager.datafactory.models.NotebookReferenceType; +import com.azure.resourcemanager.datafactory.models.SparkConfigurationParametrizationReference; +import com.azure.resourcemanager.datafactory.models.SparkConfigurationReferenceType; +import com.azure.resourcemanager.datafactory.models.SynapseNotebookReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SynapseNotebookActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SynapseNotebookActivityTypeProperties model = + BinaryData + .fromString( + "{\"notebook\":{\"type\":\"NotebookReference\",\"referenceName\":\"datamfbesyhpzr\"},\"sparkPool\":{\"type\":\"BigDataPoolReference\",\"referenceName\":\"dataawdls\"},\"parameters\":{\"fjbzosyttu\":{\"value\":\"datanksovvbt\",\"type\":\"bool\"},\"sagp\":{\"value\":\"datahkpdkwvwxrxmu\",\"type\":\"float\"},\"entudpvsnllijbbd\":{\"value\":\"datag\",\"type\":\"string\"}},\"executorSize\":\"datamtlwrw\",\"conf\":\"datayqwfpxpfk\",\"driverSize\":\"datatxgtcovpbcpgzgq\",\"numExecutors\":\"datap\",\"configurationType\":\"Default\",\"targetSparkConfiguration\":{\"type\":\"SparkConfigurationReference\",\"referenceName\":\"databjgtascxmnben\"},\"sparkConfig\":{\"fwcqcxyju\":\"datazxzw\",\"dngh\":\"datakfwokzizlaha\"}}") + .toObject(SynapseNotebookActivityTypeProperties.class); + Assertions.assertEquals(NotebookReferenceType.NOTEBOOK_REFERENCE, model.notebook().type()); + Assertions.assertEquals(BigDataPoolReferenceType.BIG_DATA_POOL_REFERENCE, model.sparkPool().type()); + Assertions.assertEquals(NotebookParameterType.BOOL, model.parameters().get("fjbzosyttu").type()); + Assertions.assertEquals(ConfigurationType.DEFAULT, model.configurationType()); + Assertions + .assertEquals( + SparkConfigurationReferenceType.SPARK_CONFIGURATION_REFERENCE, model.targetSparkConfiguration().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SynapseNotebookActivityTypeProperties model = + new SynapseNotebookActivityTypeProperties() + .withNotebook( + new SynapseNotebookReference() + .withType(NotebookReferenceType.NOTEBOOK_REFERENCE) + .withReferenceName("datamfbesyhpzr")) + .withSparkPool( + new BigDataPoolParametrizationReference() + .withType(BigDataPoolReferenceType.BIG_DATA_POOL_REFERENCE) + .withReferenceName("dataawdls")) + .withParameters( + mapOf( + "fjbzosyttu", + new NotebookParameter().withValue("datanksovvbt").withType(NotebookParameterType.BOOL), + "sagp", + new NotebookParameter().withValue("datahkpdkwvwxrxmu").withType(NotebookParameterType.FLOAT), + "entudpvsnllijbbd", + new NotebookParameter().withValue("datag").withType(NotebookParameterType.STRING))) + .withExecutorSize("datamtlwrw") + .withConf("datayqwfpxpfk") + .withDriverSize("datatxgtcovpbcpgzgq") + .withNumExecutors("datap") + .withConfigurationType(ConfigurationType.DEFAULT) + .withTargetSparkConfiguration( + new SparkConfigurationParametrizationReference() + .withType(SparkConfigurationReferenceType.SPARK_CONFIGURATION_REFERENCE) + .withReferenceName("databjgtascxmnben")) + .withSparkConfig(mapOf("fwcqcxyju", "datazxzw", "dngh", "datakfwokzizlaha")); + model = BinaryData.fromObject(model).toObject(SynapseNotebookActivityTypeProperties.class); + Assertions.assertEquals(NotebookReferenceType.NOTEBOOK_REFERENCE, model.notebook().type()); + Assertions.assertEquals(BigDataPoolReferenceType.BIG_DATA_POOL_REFERENCE, model.sparkPool().type()); + Assertions.assertEquals(NotebookParameterType.BOOL, model.parameters().get("fjbzosyttu").type()); + Assertions.assertEquals(ConfigurationType.DEFAULT, model.configurationType()); + Assertions + .assertEquals( + SparkConfigurationReferenceType.SPARK_CONFIGURATION_REFERENCE, model.targetSparkConfiguration().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseNotebookReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseNotebookReferenceTests.java new file mode 100644 index 000000000000..0439f55d8121 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseNotebookReferenceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.NotebookReferenceType; +import com.azure.resourcemanager.datafactory.models.SynapseNotebookReference; +import org.junit.jupiter.api.Assertions; + +public final class SynapseNotebookReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SynapseNotebookReference model = + BinaryData + .fromString("{\"type\":\"NotebookReference\",\"referenceName\":\"datazmpk\"}") + .toObject(SynapseNotebookReference.class); + Assertions.assertEquals(NotebookReferenceType.NOTEBOOK_REFERENCE, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SynapseNotebookReference model = + new SynapseNotebookReference() + .withType(NotebookReferenceType.NOTEBOOK_REFERENCE) + .withReferenceName("datazmpk"); + model = BinaryData.fromObject(model).toObject(SynapseNotebookReference.class); + Assertions.assertEquals(NotebookReferenceType.NOTEBOOK_REFERENCE, model.type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseSparkJobReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseSparkJobReferenceTests.java new file mode 100644 index 000000000000..41d3b367a167 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/SynapseSparkJobReferenceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.SparkJobReferenceType; +import com.azure.resourcemanager.datafactory.models.SynapseSparkJobReference; +import org.junit.jupiter.api.Assertions; + +public final class SynapseSparkJobReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SynapseSparkJobReference model = + BinaryData + .fromString("{\"type\":\"SparkJobDefinitionReference\",\"referenceName\":\"datacnvrbhqxewdc\"}") + .toObject(SynapseSparkJobReference.class); + Assertions.assertEquals(SparkJobReferenceType.SPARK_JOB_DEFINITION_REFERENCE, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SynapseSparkJobReference model = + new SynapseSparkJobReference() + .withType(SparkJobReferenceType.SPARK_JOB_DEFINITION_REFERENCE) + .withReferenceName("datacnvrbhqxewdc"); + model = BinaryData.fromObject(model).toObject(SynapseSparkJobReference.class); + Assertions.assertEquals(SparkJobReferenceType.SPARK_JOB_DEFINITION_REFERENCE, model.type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TabularSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TabularSourceTests.java new file mode 100644 index 000000000000..8ca27625943a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TabularSourceTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TabularSource; + +public final class TabularSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TabularSource model = + BinaryData + .fromString( + "{\"type\":\"TabularSource\",\"queryTimeout\":\"datakrsyfdsg\",\"additionalColumns\":\"datake\",\"sourceRetryCount\":\"datamrupgevjma\",\"sourceRetryWait\":\"datarvvjoklb\",\"maxConcurrentConnections\":\"datat\",\"disableMetricsCollection\":\"datatwxfjlpk\",\"\":{\"uvwlfzjrjgla\":\"dataexfmqfuflu\"}}") + .toObject(TabularSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TabularSource model = + new TabularSource() + .withSourceRetryCount("datamrupgevjma") + .withSourceRetryWait("datarvvjoklb") + .withMaxConcurrentConnections("datat") + .withDisableMetricsCollection("datatwxfjlpk") + .withQueryTimeout("datakrsyfdsg") + .withAdditionalColumns("datake"); + model = BinaryData.fromObject(model).toObject(TabularSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TabularTranslatorTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TabularTranslatorTests.java new file mode 100644 index 000000000000..2c3c7efab8cd --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TabularTranslatorTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TabularTranslator; +import com.azure.resourcemanager.datafactory.models.TypeConversionSettings; + +public final class TabularTranslatorTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TabularTranslator model = + BinaryData + .fromString( + "{\"type\":\"TabularTranslator\",\"columnMappings\":\"dataezb\",\"schemaMapping\":\"dataullqpcijyx\",\"collectionReference\":\"dataqcggksr\",\"mapComplexValuesToString\":\"datax\",\"mappings\":\"datafhar\",\"typeConversion\":\"dataltlftraylxz\",\"typeConversionSettings\":{\"allowDataTruncation\":\"datapuhbao\",\"treatBooleanAsNumber\":\"datawbkxdhavegy\",\"dateTimeFormat\":\"datasmlbz\",\"dateTimeOffsetFormat\":\"datapdatvndvwwejvqpw\",\"timeSpanFormat\":\"dataioqwmhcpujygnt\",\"culture\":\"datae\"},\"\":{\"rso\":\"datasqthcywyoqx\",\"lr\":\"dataf\",\"ffl\":\"dataj\",\"ljf\":\"datazm\"}}") + .toObject(TabularTranslator.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TabularTranslator model = + new TabularTranslator() + .withColumnMappings("dataezb") + .withSchemaMapping("dataullqpcijyx") + .withCollectionReference("dataqcggksr") + .withMapComplexValuesToString("datax") + .withMappings("datafhar") + .withTypeConversion("dataltlftraylxz") + .withTypeConversionSettings( + new TypeConversionSettings() + .withAllowDataTruncation("datapuhbao") + .withTreatBooleanAsNumber("datawbkxdhavegy") + .withDateTimeFormat("datasmlbz") + .withDateTimeOffsetFormat("datapdatvndvwwejvqpw") + .withTimeSpanFormat("dataioqwmhcpujygnt") + .withCulture("datae")); + model = BinaryData.fromObject(model).toObject(TabularTranslator.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TarGZipReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TarGZipReadSettingsTests.java new file mode 100644 index 000000000000..0bdf9c74fbe3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TarGZipReadSettingsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TarGZipReadSettings; + +public final class TarGZipReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TarGZipReadSettings model = + BinaryData + .fromString( + "{\"type\":\"TarGZipReadSettings\",\"preserveCompressionFileNameAsFolder\":\"dataljcauegymc\",\"\":{\"wodayipg\":\"datamnjitxughlbi\",\"byoxpvbv\":\"datahkioec\"}}") + .toObject(TarGZipReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TarGZipReadSettings model = new TarGZipReadSettings().withPreserveCompressionFileNameAsFolder("dataljcauegymc"); + model = BinaryData.fromObject(model).toObject(TarGZipReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TarReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TarReadSettingsTests.java new file mode 100644 index 000000000000..e417813e7037 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TarReadSettingsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TarReadSettings; + +public final class TarReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TarReadSettings model = + BinaryData + .fromString( + "{\"type\":\"TarReadSettings\",\"preserveCompressionFileNameAsFolder\":\"datanzot\",\"\":{\"qsylkkqvmmm\":\"datahuidlod\"}}") + .toObject(TarReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TarReadSettings model = new TarReadSettings().withPreserveCompressionFileNameAsFolder("datanzot"); + model = BinaryData.fromObject(model).toObject(TarReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataPartitionSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataPartitionSettingsTests.java new file mode 100644 index 000000000000..b3edff2bdf28 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataPartitionSettingsTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TeradataPartitionSettings; + +public final class TeradataPartitionSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TeradataPartitionSettings model = + BinaryData + .fromString( + "{\"partitionColumnName\":\"datauxypvuazaj\",\"partitionUpperBound\":\"datanekhjzbfbuqe\",\"partitionLowerBound\":\"datauozarrqppyzryj\"}") + .toObject(TeradataPartitionSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TeradataPartitionSettings model = + new TeradataPartitionSettings() + .withPartitionColumnName("datauxypvuazaj") + .withPartitionUpperBound("datanekhjzbfbuqe") + .withPartitionLowerBound("datauozarrqppyzryj"); + model = BinaryData.fromObject(model).toObject(TeradataPartitionSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataSourceTests.java new file mode 100644 index 000000000000..b4b4ba0ee347 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataSourceTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TeradataPartitionSettings; +import com.azure.resourcemanager.datafactory.models.TeradataSource; + +public final class TeradataSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TeradataSource model = + BinaryData + .fromString( + "{\"type\":\"TeradataSource\",\"query\":\"dataljucodrbkdieismd\",\"partitionOption\":\"datafim\",\"partitionSettings\":{\"partitionColumnName\":\"dataijrlmnkvp\",\"partitionUpperBound\":\"dataoe\",\"partitionLowerBound\":\"datacsk\"},\"queryTimeout\":\"datawzmji\",\"additionalColumns\":\"dataqyllcckgfo\",\"sourceRetryCount\":\"datarbfyjmenq\",\"sourceRetryWait\":\"datajfxqtvsfsvqy\",\"maxConcurrentConnections\":\"dataaweixnoblazwhda\",\"disableMetricsCollection\":\"dataixfdu\",\"\":{\"bh\":\"dataovitpcsmaxzdx\"}}") + .toObject(TeradataSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TeradataSource model = + new TeradataSource() + .withSourceRetryCount("datarbfyjmenq") + .withSourceRetryWait("datajfxqtvsfsvqy") + .withMaxConcurrentConnections("dataaweixnoblazwhda") + .withDisableMetricsCollection("dataixfdu") + .withQueryTimeout("datawzmji") + .withAdditionalColumns("dataqyllcckgfo") + .withQuery("dataljucodrbkdieismd") + .withPartitionOption("datafim") + .withPartitionSettings( + new TeradataPartitionSettings() + .withPartitionColumnName("dataijrlmnkvp") + .withPartitionUpperBound("dataoe") + .withPartitionLowerBound("datacsk")); + model = BinaryData.fromObject(model).toObject(TeradataSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataTableDatasetTests.java new file mode 100644 index 000000000000..07a826dbb3a9 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataTableDatasetTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.TeradataTableDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TeradataTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TeradataTableDataset model = + BinaryData + .fromString( + "{\"type\":\"TeradataTable\",\"typeProperties\":{\"database\":\"databxjblajybdnb\",\"table\":\"datasbtoisazdjmo\"},\"description\":\"vpz\",\"structure\":\"datanywxuy\",\"schema\":\"datafj\",\"linkedServiceName\":{\"referenceName\":\"mgwtmszcfyzqp\",\"parameters\":{\"gihlnzffewvqky\":\"dataegfurdpagknxmaov\"}},\"parameters\":{\"abhgclejqzhpvh\":{\"type\":\"Bool\",\"defaultValue\":\"dataipqxxsdyafwtydsm\"},\"eullgfyog\":{\"type\":\"String\",\"defaultValue\":\"dataadj\"},\"mwdz\":{\"type\":\"Int\",\"defaultValue\":\"datacjpvqerqxk\"},\"x\":{\"type\":\"SecureString\",\"defaultValue\":\"datahcu\"}},\"annotations\":[\"datawwvmbjec\",\"datawlbg\",\"datankfrwxo\"],\"folder\":{\"name\":\"dsnjzpchiypb\"},\"\":{\"iktqozewbrsrj\":\"datai\",\"qbjxgjwsrerukbuu\":\"datagkbrauxboufqn\",\"wkwkjxlaacedikqe\":\"datari\"}}") + .toObject(TeradataTableDataset.class); + Assertions.assertEquals("vpz", model.description()); + Assertions.assertEquals("mgwtmszcfyzqp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("abhgclejqzhpvh").type()); + Assertions.assertEquals("dsnjzpchiypb", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TeradataTableDataset model = + new TeradataTableDataset() + .withDescription("vpz") + .withStructure("datanywxuy") + .withSchema("datafj") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("mgwtmszcfyzqp") + .withParameters(mapOf("gihlnzffewvqky", "dataegfurdpagknxmaov"))) + .withParameters( + mapOf( + "abhgclejqzhpvh", + new ParameterSpecification() + .withType(ParameterType.BOOL) + .withDefaultValue("dataipqxxsdyafwtydsm"), + "eullgfyog", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataadj"), + "mwdz", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("datacjpvqerqxk"), + "x", + new ParameterSpecification().withType(ParameterType.SECURE_STRING).withDefaultValue("datahcu"))) + .withAnnotations(Arrays.asList("datawwvmbjec", "datawlbg", "datankfrwxo")) + .withFolder(new DatasetFolder().withName("dsnjzpchiypb")) + .withDatabase("databxjblajybdnb") + .withTable("datasbtoisazdjmo"); + model = BinaryData.fromObject(model).toObject(TeradataTableDataset.class); + Assertions.assertEquals("vpz", model.description()); + Assertions.assertEquals("mgwtmszcfyzqp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("abhgclejqzhpvh").type()); + Assertions.assertEquals("dsnjzpchiypb", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..0819330b433d --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TeradataTableDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.TeradataTableDatasetTypeProperties; + +public final class TeradataTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TeradataTableDatasetTypeProperties model = + BinaryData + .fromString("{\"database\":\"datas\",\"table\":\"datazbevgbnrommkiqh\"}") + .toObject(TeradataTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TeradataTableDatasetTypeProperties model = + new TeradataTableDatasetTypeProperties().withDatabase("datas").withTable("datazbevgbnrommkiqh"); + model = BinaryData.fromObject(model).toObject(TeradataTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TextFormatTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TextFormatTests.java new file mode 100644 index 000000000000..6d5e7a007d27 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TextFormatTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TextFormat; + +public final class TextFormatTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TextFormat model = + BinaryData + .fromString( + "{\"type\":\"TextFormat\",\"columnDelimiter\":\"datavhxowpcbapnpxra\",\"rowDelimiter\":\"datawbmpspfeylqloc\",\"escapeChar\":\"dataujexayglxrk\",\"quoteChar\":\"datanmzpas\",\"nullValue\":\"datavxjfiuofpieidzlv\",\"encodingName\":\"dataqywjopa\",\"treatEmptyAsNull\":\"datayhydvikmfn\",\"skipLineCount\":\"datamillxgjs\",\"firstRowAsHeader\":\"datazwgsoriobije\",\"serializer\":\"datadye\",\"deserializer\":\"datanhbokayrgwybrio\",\"\":{\"s\":\"dataeoftnorwai\",\"f\":\"dataoctqkmvjanxvzf\",\"wosstfjxtvlxx\":\"datatj\"}}") + .toObject(TextFormat.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TextFormat model = + new TextFormat() + .withSerializer("datadye") + .withDeserializer("datanhbokayrgwybrio") + .withColumnDelimiter("datavhxowpcbapnpxra") + .withRowDelimiter("datawbmpspfeylqloc") + .withEscapeChar("dataujexayglxrk") + .withQuoteChar("datanmzpas") + .withNullValue("datavxjfiuofpieidzlv") + .withEncodingName("dataqywjopa") + .withTreatEmptyAsNull("datayhydvikmfn") + .withSkipLineCount("datamillxgjs") + .withFirstRowAsHeader("datazwgsoriobije"); + model = BinaryData.fromObject(model).toObject(TextFormat.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TransformationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TransformationTests.java new file mode 100644 index 000000000000..7c9e6dcac563 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TransformationTests.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.Transformation; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TransformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Transformation model = + BinaryData + .fromString( + "{\"name\":\"xxtclhuulri\",\"description\":\"yokvjgbzsxebr\",\"dataset\":{\"referenceName\":\"ttfyhcdjwsuoard\",\"parameters\":{\"bfwxiplkys\":\"datattpufpbpgnrholhu\",\"yjprxslw\":\"datal\",\"hfvhuwzbxpcqz\":\"datadmcvhtbbz\",\"lrrskap\":\"dataihotjecohmxv\"}},\"linkedService\":{\"referenceName\":\"wie\",\"parameters\":{\"imyc\":\"datayaderltfokyks\",\"rsejegprkj\":\"datagrvkcxzznnuif\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"rjmwvvbtuqkxxi\",\"datasetParameters\":\"datagxql\",\"parameters\":{\"vjaqu\":\"dataotjgxieqfkyfhi\"},\"\":{\"mj\":\"dataynvskpajbmgeume\",\"apeqiscrpil\":\"dataxcbccwkqmt\"}}}") + .toObject(Transformation.class); + Assertions.assertEquals("xxtclhuulri", model.name()); + Assertions.assertEquals("yokvjgbzsxebr", model.description()); + Assertions.assertEquals("ttfyhcdjwsuoard", model.dataset().referenceName()); + Assertions.assertEquals("wie", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("rjmwvvbtuqkxxi", model.flowlet().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Transformation model = + new Transformation() + .withName("xxtclhuulri") + .withDescription("yokvjgbzsxebr") + .withDataset( + new DatasetReference() + .withReferenceName("ttfyhcdjwsuoard") + .withParameters( + mapOf( + "bfwxiplkys", + "datattpufpbpgnrholhu", + "yjprxslw", + "datal", + "hfvhuwzbxpcqz", + "datadmcvhtbbz", + "lrrskap", + "dataihotjecohmxv"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("wie") + .withParameters(mapOf("imyc", "datayaderltfokyks", "rsejegprkj", "datagrvkcxzznnuif"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("rjmwvvbtuqkxxi") + .withDatasetParameters("datagxql") + .withParameters(mapOf("vjaqu", "dataotjgxieqfkyfhi")) + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(Transformation.class); + Assertions.assertEquals("xxtclhuulri", model.name()); + Assertions.assertEquals("yokvjgbzsxebr", model.description()); + Assertions.assertEquals("ttfyhcdjwsuoard", model.dataset().referenceName()); + Assertions.assertEquals("wie", model.linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.flowlet().type()); + Assertions.assertEquals("rjmwvvbtuqkxxi", model.flowlet().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerDependencyReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerDependencyReferenceTests.java new file mode 100644 index 000000000000..3874a2ac67bc --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerDependencyReferenceTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TriggerDependencyReference; +import com.azure.resourcemanager.datafactory.models.TriggerReference; +import com.azure.resourcemanager.datafactory.models.TriggerReferenceType; +import org.junit.jupiter.api.Assertions; + +public final class TriggerDependencyReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TriggerDependencyReference model = + BinaryData + .fromString( + "{\"type\":\"TriggerDependencyReference\",\"referenceTrigger\":{\"type\":\"TriggerReference\",\"referenceName\":\"n\"}}") + .toObject(TriggerDependencyReference.class); + Assertions.assertEquals(TriggerReferenceType.TRIGGER_REFERENCE, model.referenceTrigger().type()); + Assertions.assertEquals("n", model.referenceTrigger().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TriggerDependencyReference model = + new TriggerDependencyReference() + .withReferenceTrigger( + new TriggerReference().withType(TriggerReferenceType.TRIGGER_REFERENCE).withReferenceName("n")); + model = BinaryData.fromObject(model).toObject(TriggerDependencyReference.class); + Assertions.assertEquals(TriggerReferenceType.TRIGGER_REFERENCE, model.referenceTrigger().type()); + Assertions.assertEquals("n", model.referenceTrigger().referenceName()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerListResponseTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerListResponseTests.java new file mode 100644 index 000000000000..e147f2fc171a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerListResponseTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.TriggerResourceInner; +import com.azure.resourcemanager.datafactory.models.Trigger; +import com.azure.resourcemanager.datafactory.models.TriggerListResponse; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TriggerListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TriggerListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"type\":\"Trigger\",\"description\":\"nifmzzsdymbrnysu\",\"runtimeState\":\"Stopped\",\"annotations\":[\"datafwgckhocxvdfffw\"],\"\":{\"spave\":\"dataroud\",\"bunzozudh\":\"datahrv\"}},\"name\":\"gkmoyxcdyuibhmfd\",\"type\":\"zydvfvf\",\"etag\":\"naeo\",\"id\":\"rvhmgor\"},{\"properties\":{\"type\":\"Trigger\",\"description\":\"ukiscvwmzhw\",\"runtimeState\":\"Disabled\",\"annotations\":[\"dataxvxilcbtg\"],\"\":{\"vodggxdbee\":\"datazeyqxtjjfzqlqhyc\",\"wiuagydwqf\":\"datamieknlraria\",\"ocqwogfnzjvus\":\"dataylyrfgiagtco\"}},\"name\":\"ld\",\"type\":\"zuxylfsbtkadpyso\",\"etag\":\"btgkbugrjqctoj\",\"id\":\"isofieypefojyqd\"}],\"nextLink\":\"u\"}") + .toObject(TriggerListResponse.class); + Assertions.assertEquals("rvhmgor", model.value().get(0).id()); + Assertions.assertEquals("nifmzzsdymbrnysu", model.value().get(0).properties().description()); + Assertions.assertEquals("u", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TriggerListResponse model = + new TriggerListResponse() + .withValue( + Arrays + .asList( + new TriggerResourceInner() + .withId("rvhmgor") + .withProperties( + new Trigger() + .withDescription("nifmzzsdymbrnysu") + .withAnnotations(Arrays.asList("datafwgckhocxvdfffw")) + .withAdditionalProperties(mapOf("type", "Trigger", "runtimeState", "Stopped"))), + new TriggerResourceInner() + .withId("isofieypefojyqd") + .withProperties( + new Trigger() + .withDescription("ukiscvwmzhw") + .withAnnotations(Arrays.asList("dataxvxilcbtg")) + .withAdditionalProperties( + mapOf("type", "Trigger", "runtimeState", "Disabled"))))) + .withNextLink("u"); + model = BinaryData.fromObject(model).toObject(TriggerListResponse.class); + Assertions.assertEquals("rvhmgor", model.value().get(0).id()); + Assertions.assertEquals("nifmzzsdymbrnysu", model.value().get(0).properties().description()); + Assertions.assertEquals("u", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerPipelineReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerPipelineReferenceTests.java new file mode 100644 index 000000000000..207b358d8656 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerPipelineReferenceTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import com.azure.resourcemanager.datafactory.models.TriggerPipelineReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TriggerPipelineReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TriggerPipelineReference model = + BinaryData + .fromString( + "{\"pipelineReference\":{\"referenceName\":\"wkpphefsb\",\"name\":\"lbzxomeikjc\"},\"parameters\":{\"qbxyxoyfpuqqi\":\"dataacnmwpfsuqtaaz\"}}") + .toObject(TriggerPipelineReference.class); + Assertions.assertEquals("wkpphefsb", model.pipelineReference().referenceName()); + Assertions.assertEquals("lbzxomeikjc", model.pipelineReference().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TriggerPipelineReference model = + new TriggerPipelineReference() + .withPipelineReference(new PipelineReference().withReferenceName("wkpphefsb").withName("lbzxomeikjc")) + .withParameters(mapOf("qbxyxoyfpuqqi", "dataacnmwpfsuqtaaz")); + model = BinaryData.fromObject(model).toObject(TriggerPipelineReference.class); + Assertions.assertEquals("wkpphefsb", model.pipelineReference().referenceName()); + Assertions.assertEquals("lbzxomeikjc", model.pipelineReference().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerReferenceTests.java new file mode 100644 index 000000000000..c97d3380ea92 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerReferenceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TriggerReference; +import com.azure.resourcemanager.datafactory.models.TriggerReferenceType; +import org.junit.jupiter.api.Assertions; + +public final class TriggerReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TriggerReference model = + BinaryData + .fromString("{\"type\":\"TriggerReference\",\"referenceName\":\"dfiwj\"}") + .toObject(TriggerReference.class); + Assertions.assertEquals(TriggerReferenceType.TRIGGER_REFERENCE, model.type()); + Assertions.assertEquals("dfiwj", model.referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TriggerReference model = + new TriggerReference().withType(TriggerReferenceType.TRIGGER_REFERENCE).withReferenceName("dfiwj"); + model = BinaryData.fromObject(model).toObject(TriggerReference.class); + Assertions.assertEquals(TriggerReferenceType.TRIGGER_REFERENCE, model.type()); + Assertions.assertEquals("dfiwj", model.referenceName()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerResourceInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerResourceInnerTests.java new file mode 100644 index 000000000000..6013dc2f16b8 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerResourceInnerTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.TriggerResourceInner; +import com.azure.resourcemanager.datafactory.models.Trigger; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TriggerResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TriggerResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"type\":\"Trigger\",\"description\":\"cp\",\"runtimeState\":\"Started\",\"annotations\":[\"dataihih\",\"datahzdsqtzbsrgnow\",\"datajhf\",\"datamvec\"],\"\":{\"ekqvgqouwif\":\"dataxmwoteyowcluqo\",\"ivqikfxcvhr\":\"datampjw\",\"c\":\"datasphuagrttikteus\"}},\"name\":\"vyklxuby\",\"type\":\"ff\",\"etag\":\"fblcq\",\"id\":\"ubgq\"}") + .toObject(TriggerResourceInner.class); + Assertions.assertEquals("ubgq", model.id()); + Assertions.assertEquals("cp", model.properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TriggerResourceInner model = + new TriggerResourceInner() + .withId("ubgq") + .withProperties( + new Trigger() + .withDescription("cp") + .withAnnotations(Arrays.asList("dataihih", "datahzdsqtzbsrgnow", "datajhf", "datamvec")) + .withAdditionalProperties(mapOf("type", "Trigger", "runtimeState", "Started"))); + model = BinaryData.fromObject(model).toObject(TriggerResourceInner.class); + Assertions.assertEquals("ubgq", model.id()); + Assertions.assertEquals("cp", model.properties().description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerRunTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerRunTests.java new file mode 100644 index 000000000000..0b69708fa752 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerRunTests.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.datafactory.models.TriggerRun; +import java.util.HashMap; +import java.util.Map; + +public final class TriggerRunTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TriggerRun model = + BinaryData + .fromString( + "{\"triggerRunId\":\"hcz\",\"triggerName\":\"rxzbujr\",\"triggerType\":\"hqvwrevkhgnlnzon\",\"triggerRunTimestamp\":\"2021-07-02T07:36:09Z\",\"status\":\"Inprogress\",\"message\":\"yw\",\"properties\":{\"zehtdhgb\":\"jtszcof\",\"reljeamur\":\"k\",\"xlpm\":\"zmlovuanash\"},\"triggeredPipelines\":{\"sdbccxjmonfdgnwn\":\"bdkelvidizo\",\"keifzzhmkdasv\":\"ypuuwwltvuqjctze\",\"cu\":\"lyhb\"},\"runDimension\":{\"lvizb\":\"xgsrboldforobw\",\"dxe\":\"hfovvacqpbtu\",\"elawumu\":\"zab\"},\"dependencyStatus\":{\"ucwyhahno\":\"datazkwrrwoyc\",\"fuurutlwexx\":\"datadrkywuhps\",\"srzpgepqtybbww\":\"datalalniex\"},\"\":{\"xkjibnxmy\":\"dataakchzyvlixqnrk\",\"ijpstte\":\"datauxswqrntvl\",\"wcyyufmhruncu\":\"dataoqq\"}}") + .toObject(TriggerRun.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TriggerRun model = + new TriggerRun() + .withAdditionalProperties( + mapOf( + "triggerRunId", + "hcz", + "triggerName", + "rxzbujr", + "runDimension", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"lvizb\":\"xgsrboldforobw\",\"dxe\":\"hfovvacqpbtu\",\"elawumu\":\"zab\"}", + Object.class, + SerializerEncoding.JSON), + "dependencyStatus", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"ucwyhahno\":\"datazkwrrwoyc\",\"fuurutlwexx\":\"datadrkywuhps\",\"srzpgepqtybbww\":\"datalalniex\"}", + Object.class, + SerializerEncoding.JSON), + "triggeredPipelines", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"sdbccxjmonfdgnwn\":\"bdkelvidizo\",\"keifzzhmkdasv\":\"ypuuwwltvuqjctze\",\"cu\":\"lyhb\"}", + Object.class, + SerializerEncoding.JSON), + "triggerType", + "hqvwrevkhgnlnzon", + "triggerRunTimestamp", + "2021-07-02T07:36:09Z", + "message", + "yw", + "properties", + JacksonAdapter + .createDefaultSerializerAdapter() + .deserialize( + "{\"zehtdhgb\":\"jtszcof\",\"reljeamur\":\"k\",\"xlpm\":\"zmlovuanash\"}", + Object.class, + SerializerEncoding.JSON), + "status", + "Inprogress")); + model = BinaryData.fromObject(model).toObject(TriggerRun.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerRunsCancelWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerRunsCancelWithResponseMockTests.java new file mode 100644 index 000000000000..64f4b1e98464 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerRunsCancelWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggerRunsCancelWithResponseMockTests { + @Test + public void testCancelWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .triggerRuns() + .cancelWithResponse("cobp", "phxhvbfekxbcbu", "jysukezqohth", "md", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerRunsRerunWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerRunsRerunWithResponseMockTests.java new file mode 100644 index 000000000000..7ee46e5d21f7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerRunsRerunWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggerRunsRerunWithResponseMockTests { + @Test + public void testRerunWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .triggerRuns() + .rerunWithResponse("nctkqbvtdeou", "ixgtpykbjevj", "juwdvfaulbfrc", "h", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerSubscriptionOperationStatusInnerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerSubscriptionOperationStatusInnerTests.java new file mode 100644 index 000000000000..cba54e6a761a --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerSubscriptionOperationStatusInnerTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.TriggerSubscriptionOperationStatusInner; + +public final class TriggerSubscriptionOperationStatusInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TriggerSubscriptionOperationStatusInner model = + BinaryData + .fromString("{\"triggerName\":\"n\",\"status\":\"Provisioning\"}") + .toObject(TriggerSubscriptionOperationStatusInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TriggerSubscriptionOperationStatusInner model = new TriggerSubscriptionOperationStatusInner(); + model = BinaryData.fromObject(model).toObject(TriggerSubscriptionOperationStatusInner.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerTests.java new file mode 100644 index 000000000000..f95b2ffc7e8b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggerTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Trigger; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Trigger model = + BinaryData + .fromString( + "{\"type\":\"Trigger\",\"description\":\"rtalmet\",\"runtimeState\":\"Started\",\"annotations\":[\"dataslqxi\",\"datahrmooi\",\"dataqseypxiutcxa\",\"datazhyrpeto\"],\"\":{\"rqnkkzjcjbtr\":\"datajoxslhvnhla\",\"eitpkxztmo\":\"dataaehvvibrxjjstoq\"}}") + .toObject(Trigger.class); + Assertions.assertEquals("rtalmet", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Trigger model = + new Trigger() + .withDescription("rtalmet") + .withAnnotations(Arrays.asList("dataslqxi", "datahrmooi", "dataqseypxiutcxa", "datazhyrpeto")) + .withAdditionalProperties(mapOf("type", "Trigger", "runtimeState", "Started")); + model = BinaryData.fromObject(model).toObject(Trigger.class); + Assertions.assertEquals("rtalmet", model.description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersCreateOrUpdateWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..2a911676b179 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.Trigger; +import com.azure.resourcemanager.datafactory.models.TriggerResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +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 org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggersCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"Trigger\",\"description\":\"vskdvqyfubwxca\",\"runtimeState\":\"Stopped\",\"annotations\":[\"datapfojhvqmdoqyohzh\",\"datandfkp\"],\"\":{\"usuw\":\"datavjd\",\"pgarhf\":\"dataht\",\"cxvqpmwqsd\":\"dataadedivad\"}},\"name\":\"lexkfsgrhea\",\"type\":\"lcukmnuivpb\",\"etag\":\"lihfzriig\",\"id\":\"qyptmjqjoamzdsa\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + TriggerResource response = + manager + .triggers() + .define("ogfxbv") + .withExistingFactory("mv", "qismvo") + .withProperties( + new Trigger() + .withDescription("cf") + .withAnnotations(Arrays.asList("datace", "dataqnh")) + .withAdditionalProperties(mapOf("type", "Trigger", "runtimeState", "Disabled"))) + .withIfMatch("bkzchc") + .create(); + + Assertions.assertEquals("qyptmjqjoamzdsa", response.id()); + Assertions.assertEquals("vskdvqyfubwxca", response.properties().description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersDeleteWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..8c55b55765a1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggersDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .triggers() + .deleteWithResponse("jkysolmzrfhlynk", "usb", "ysbjtsqfhnqxqte", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersGetEventSubscriptionStatusWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersGetEventSubscriptionStatusWithResponseMockTests.java new file mode 100644 index 000000000000..e487f438ff61 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersGetEventSubscriptionStatusWithResponseMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.TriggerSubscriptionOperationStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggersGetEventSubscriptionStatusWithResponseMockTests { + @Test + public void testGetEventSubscriptionStatusWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"triggerName\":\"xaqvrazthdua\",\"status\":\"Deprovisioning\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + TriggerSubscriptionOperationStatus response = + manager + .triggers() + .getEventSubscriptionStatusWithResponse( + "pposgimtoucls", "bjzhhjgvuvjsnb", "nuujkjkqyewtlom", com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersGetWithResponseMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersGetWithResponseMockTests.java new file mode 100644 index 000000000000..3425c8655c06 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersGetWithResponseMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.TriggerResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggersGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"type\":\"Trigger\",\"description\":\"ub\",\"runtimeState\":\"Stopped\",\"annotations\":[\"dataqmydpoj\",\"dataifixdgkvlze\",\"datadqop\",\"dataabrzrhdezlhsdcp\"],\"\":{\"cdemfatftzxtrjr\":\"datalczhyqdvxqoajfo\",\"qq\":\"datawljfdcyq\"}},\"name\":\"lydywbnerygsi\",\"type\":\"a\",\"etag\":\"ccsvajn\",\"id\":\"uxbyrvgu\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + TriggerResource response = + manager + .triggers() + .getWithResponse("govnrkyb", "tcrxcnuyfvri", "zqoi", "onnvay", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("uxbyrvgu", response.id()); + Assertions.assertEquals("ub", response.properties().description()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersListByFactoryMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersListByFactoryMockTests.java new file mode 100644 index 000000000000..99cde7493e9b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersListByFactoryMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.TriggerResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggersListByFactoryMockTests { + @Test + public void testListByFactory() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"type\":\"Trigger\",\"description\":\"gesbteqfenhlitc\",\"runtimeState\":\"Disabled\",\"annotations\":[\"dataflnzibguwrdhxa\"],\"\":{\"fjpefirjkinofw\":\"datap\"}},\"name\":\"il\",\"type\":\"qesyifdrbkprblw\",\"etag\":\"js\",\"id\":\"qqts\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.triggers().listByFactory("wahfnlksyqpksk", "idmzzjpb", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qqts", response.iterator().next().id()); + Assertions.assertEquals("gesbteqfenhlitc", response.iterator().next().properties().description()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersStartMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersStartMockTests.java new file mode 100644 index 000000000000..91d2912fc6fb --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersStartMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggersStartMockTests { + @Test + public void testStart() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.triggers().start("cjrfjxisypkif", "tynhulefltub", "pebblndlahr", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersStopMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersStopMockTests.java new file mode 100644 index 000000000000..f2bb74fc9cb4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersStopMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggersStopMockTests { + @Test + public void testStop() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.triggers().stop("x", "tkehfoephipho", "gmcuqjouk", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersSubscribeToEventsMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersSubscribeToEventsMockTests.java new file mode 100644 index 000000000000..564030baa698 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersSubscribeToEventsMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.TriggerSubscriptionOperationStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggersSubscribeToEventsMockTests { + @Test + public void testSubscribeToEvents() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"triggerName\":\"xjk\",\"status\":\"Provisioning\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + TriggerSubscriptionOperationStatus response = + manager.triggers().subscribeToEvents("vqxxuwsa", "ui", "cjylkdby", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersUnsubscribeFromEventsMockTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersUnsubscribeFromEventsMockTests.java new file mode 100644 index 000000000000..2eea46ea9415 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TriggersUnsubscribeFromEventsMockTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.datafactory.DataFactoryManager; +import com.azure.resourcemanager.datafactory.models.TriggerSubscriptionOperationStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TriggersUnsubscribeFromEventsMockTests { + @Test + public void testUnsubscribeFromEvents() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"triggerName\":\"patodfyrf\",\"status\":\"Unknown\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + DataFactoryManager manager = + DataFactoryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + TriggerSubscriptionOperationStatus response = + manager + .triggers() + .unsubscribeFromEvents( + "zzhlnhgngqciiopo", "mgheamxidjdpt", "uiegrauyphugwa", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TumblingWindowTriggerDependencyReferenceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TumblingWindowTriggerDependencyReferenceTests.java new file mode 100644 index 000000000000..c465984e62c3 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TumblingWindowTriggerDependencyReferenceTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TriggerReference; +import com.azure.resourcemanager.datafactory.models.TriggerReferenceType; +import com.azure.resourcemanager.datafactory.models.TumblingWindowTriggerDependencyReference; +import org.junit.jupiter.api.Assertions; + +public final class TumblingWindowTriggerDependencyReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TumblingWindowTriggerDependencyReference model = + BinaryData + .fromString( + "{\"type\":\"TumblingWindowTriggerDependencyReference\",\"offset\":\"qyknivkmdfw\",\"size\":\"ko\",\"referenceTrigger\":{\"type\":\"TriggerReference\",\"referenceName\":\"jwjm\"}}") + .toObject(TumblingWindowTriggerDependencyReference.class); + Assertions.assertEquals(TriggerReferenceType.TRIGGER_REFERENCE, model.referenceTrigger().type()); + Assertions.assertEquals("jwjm", model.referenceTrigger().referenceName()); + Assertions.assertEquals("qyknivkmdfw", model.offset()); + Assertions.assertEquals("ko", model.size()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TumblingWindowTriggerDependencyReference model = + new TumblingWindowTriggerDependencyReference() + .withReferenceTrigger( + new TriggerReference().withType(TriggerReferenceType.TRIGGER_REFERENCE).withReferenceName("jwjm")) + .withOffset("qyknivkmdfw") + .withSize("ko"); + model = BinaryData.fromObject(model).toObject(TumblingWindowTriggerDependencyReference.class); + Assertions.assertEquals(TriggerReferenceType.TRIGGER_REFERENCE, model.referenceTrigger().type()); + Assertions.assertEquals("jwjm", model.referenceTrigger().referenceName()); + Assertions.assertEquals("qyknivkmdfw", model.offset()); + Assertions.assertEquals("ko", model.size()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TumblingWindowTriggerTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TumblingWindowTriggerTests.java new file mode 100644 index 000000000000..b9f7bfbcc0a0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TumblingWindowTriggerTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DependencyReference; +import com.azure.resourcemanager.datafactory.models.PipelineReference; +import com.azure.resourcemanager.datafactory.models.RetryPolicy; +import com.azure.resourcemanager.datafactory.models.TriggerPipelineReference; +import com.azure.resourcemanager.datafactory.models.TumblingWindowFrequency; +import com.azure.resourcemanager.datafactory.models.TumblingWindowTrigger; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TumblingWindowTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TumblingWindowTrigger model = + BinaryData + .fromString( + "{\"type\":\"TumblingWindowTrigger\",\"pipeline\":{\"pipelineReference\":{\"referenceName\":\"vlnv\",\"name\":\"l\"},\"parameters\":{\"d\":\"dataxpugetwgjlx\",\"tzkdqi\":\"datavfnqazvavspjdxa\",\"yredzhnylir\":\"dataumaijcullkyrss\",\"jrrolwrv\":\"datarxykplvjsqazecdo\"}},\"typeProperties\":{\"frequency\":\"Minute\",\"interval\":243301845,\"startTime\":\"2021-10-01T16:23:36Z\",\"endTime\":\"2021-02-01T07:00:41Z\",\"delay\":\"dataykusfqmgjexiqejv\",\"maxConcurrency\":408948443,\"retryPolicy\":{\"count\":\"datanoexwarqazfsrv\",\"intervalInSeconds\":425533184},\"dependsOn\":[{\"type\":\"DependencyReference\"},{\"type\":\"DependencyReference\"},{\"type\":\"DependencyReference\"},{\"type\":\"DependencyReference\"}]},\"description\":\"hazwewh\",\"runtimeState\":\"Started\",\"annotations\":[\"datadycspidc\",\"dataxjfgxynuxvya\",\"datakcuozwowwmulq\",\"dataaeq\"],\"\":{\"cxkrzuzepdvx\":\"datatqlbjezcwf\"}}") + .toObject(TumblingWindowTrigger.class); + Assertions.assertEquals("hazwewh", model.description()); + Assertions.assertEquals("vlnv", model.pipeline().pipelineReference().referenceName()); + Assertions.assertEquals("l", model.pipeline().pipelineReference().name()); + Assertions.assertEquals(TumblingWindowFrequency.MINUTE, model.frequency()); + Assertions.assertEquals(243301845, model.interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-01T16:23:36Z"), model.startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-01T07:00:41Z"), model.endTime()); + Assertions.assertEquals(408948443, model.maxConcurrency()); + Assertions.assertEquals(425533184, model.retryPolicy().intervalInSeconds()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TumblingWindowTrigger model = + new TumblingWindowTrigger() + .withDescription("hazwewh") + .withAnnotations(Arrays.asList("datadycspidc", "dataxjfgxynuxvya", "datakcuozwowwmulq", "dataaeq")) + .withPipeline( + new TriggerPipelineReference() + .withPipelineReference(new PipelineReference().withReferenceName("vlnv").withName("l")) + .withParameters( + mapOf( + "d", + "dataxpugetwgjlx", + "tzkdqi", + "datavfnqazvavspjdxa", + "yredzhnylir", + "dataumaijcullkyrss", + "jrrolwrv", + "datarxykplvjsqazecdo"))) + .withFrequency(TumblingWindowFrequency.MINUTE) + .withInterval(243301845) + .withStartTime(OffsetDateTime.parse("2021-10-01T16:23:36Z")) + .withEndTime(OffsetDateTime.parse("2021-02-01T07:00:41Z")) + .withDelay("dataykusfqmgjexiqejv") + .withMaxConcurrency(408948443) + .withRetryPolicy(new RetryPolicy().withCount("datanoexwarqazfsrv").withIntervalInSeconds(425533184)) + .withDependsOn( + Arrays + .asList( + new DependencyReference(), + new DependencyReference(), + new DependencyReference(), + new DependencyReference())); + model = BinaryData.fromObject(model).toObject(TumblingWindowTrigger.class); + Assertions.assertEquals("hazwewh", model.description()); + Assertions.assertEquals("vlnv", model.pipeline().pipelineReference().referenceName()); + Assertions.assertEquals("l", model.pipeline().pipelineReference().name()); + Assertions.assertEquals(TumblingWindowFrequency.MINUTE, model.frequency()); + Assertions.assertEquals(243301845, model.interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-01T16:23:36Z"), model.startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-01T07:00:41Z"), model.endTime()); + Assertions.assertEquals(408948443, model.maxConcurrency()); + Assertions.assertEquals(425533184, model.retryPolicy().intervalInSeconds()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TumblingWindowTriggerTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TumblingWindowTriggerTypePropertiesTests.java new file mode 100644 index 000000000000..7934dbffc19c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TumblingWindowTriggerTypePropertiesTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.TumblingWindowTriggerTypeProperties; +import com.azure.resourcemanager.datafactory.models.DependencyReference; +import com.azure.resourcemanager.datafactory.models.RetryPolicy; +import com.azure.resourcemanager.datafactory.models.TumblingWindowFrequency; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class TumblingWindowTriggerTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TumblingWindowTriggerTypeProperties model = + BinaryData + .fromString( + "{\"frequency\":\"Month\",\"interval\":2031433893,\"startTime\":\"2021-07-13T04:21:03Z\",\"endTime\":\"2021-06-28T17:38:49Z\",\"delay\":\"datarko\",\"maxConcurrency\":1137580538,\"retryPolicy\":{\"count\":\"databwdvuvqgupl\",\"intervalInSeconds\":1886264335},\"dependsOn\":[{\"type\":\"DependencyReference\"},{\"type\":\"DependencyReference\"},{\"type\":\"DependencyReference\"},{\"type\":\"DependencyReference\"}]}") + .toObject(TumblingWindowTriggerTypeProperties.class); + Assertions.assertEquals(TumblingWindowFrequency.MONTH, model.frequency()); + Assertions.assertEquals(2031433893, model.interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-13T04:21:03Z"), model.startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-28T17:38:49Z"), model.endTime()); + Assertions.assertEquals(1137580538, model.maxConcurrency()); + Assertions.assertEquals(1886264335, model.retryPolicy().intervalInSeconds()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TumblingWindowTriggerTypeProperties model = + new TumblingWindowTriggerTypeProperties() + .withFrequency(TumblingWindowFrequency.MONTH) + .withInterval(2031433893) + .withStartTime(OffsetDateTime.parse("2021-07-13T04:21:03Z")) + .withEndTime(OffsetDateTime.parse("2021-06-28T17:38:49Z")) + .withDelay("datarko") + .withMaxConcurrency(1137580538) + .withRetryPolicy(new RetryPolicy().withCount("databwdvuvqgupl").withIntervalInSeconds(1886264335)) + .withDependsOn( + Arrays + .asList( + new DependencyReference(), + new DependencyReference(), + new DependencyReference(), + new DependencyReference())); + model = BinaryData.fromObject(model).toObject(TumblingWindowTriggerTypeProperties.class); + Assertions.assertEquals(TumblingWindowFrequency.MONTH, model.frequency()); + Assertions.assertEquals(2031433893, model.interval()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-13T04:21:03Z"), model.startTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-28T17:38:49Z"), model.endTime()); + Assertions.assertEquals(1137580538, model.maxConcurrency()); + Assertions.assertEquals(1886264335, model.retryPolicy().intervalInSeconds()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TypeConversionSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TypeConversionSettingsTests.java new file mode 100644 index 000000000000..410f5dc3eb15 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/TypeConversionSettingsTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.TypeConversionSettings; + +public final class TypeConversionSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TypeConversionSettings model = + BinaryData + .fromString( + "{\"allowDataTruncation\":\"datalwlzekygnep\",\"treatBooleanAsNumber\":\"datauxqdrph\",\"dateTimeFormat\":\"dataxjqranpztlach\",\"dateTimeOffsetFormat\":\"datazsfutaapbrwv\",\"timeSpanFormat\":\"datav\",\"culture\":\"datahsorca\"}") + .toObject(TypeConversionSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TypeConversionSettings model = + new TypeConversionSettings() + .withAllowDataTruncation("datalwlzekygnep") + .withTreatBooleanAsNumber("datauxqdrph") + .withDateTimeFormat("dataxjqranpztlach") + .withDateTimeOffsetFormat("datazsfutaapbrwv") + .withTimeSpanFormat("datav") + .withCulture("datahsorca"); + model = BinaryData.fromObject(model).toObject(TypeConversionSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UntilActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UntilActivityTests.java new file mode 100644 index 000000000000..6d2d5635dcde --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UntilActivityTests.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.Expression; +import com.azure.resourcemanager.datafactory.models.UntilActivity; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class UntilActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UntilActivity model = + BinaryData + .fromString( + "{\"type\":\"Until\",\"typeProperties\":{\"expression\":{\"value\":\"vyeckbudepulbxgd\"},\"timeout\":\"datahywmezoiywm\",\"activities\":[{\"type\":\"Activity\",\"name\":\"aicfkkcpkvujwfyv\",\"description\":\"vnbbeysef\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"xfiveuqgptzx\",\"dependencyConditions\":[\"Skipped\",\"Completed\",\"Skipped\"],\"\":{\"az\":\"datargtoq\"}}],\"userProperties\":[{\"name\":\"jhua\",\"value\":\"dataiitxyebi\"}],\"\":{\"bwdu\":\"dataehhkcutxmqvbh\",\"k\":\"datavkrskqgokhpzvph\"}},{\"type\":\"Activity\",\"name\":\"fcxvfurkdhopz\",\"description\":\"hrfwchim\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"zkwdexldocq\",\"dependencyConditions\":[\"Completed\",\"Succeeded\",\"Completed\",\"Failed\"],\"\":{\"qwfuavofeouucg\":\"dataiexmfeechltxa\"}},{\"activity\":\"i\",\"dependencyConditions\":[\"Completed\",\"Skipped\",\"Succeeded\"],\"\":{\"imenjhtwkn\":\"datasegdjqnochnmxbhg\",\"pz\":\"datazcwjaqyvnol\"}},{\"activity\":\"m\",\"dependencyConditions\":[\"Failed\"],\"\":{\"iffzpkrno\":\"dataquiqkuxajl\",\"ircwbnmai\":\"dataexfyk\"}}],\"userProperties\":[{\"name\":\"oir\",\"value\":\"datangmmv\"},{\"name\":\"rxoidmnsmd\",\"value\":\"datam\"},{\"name\":\"kjlhkcogxrs\",\"value\":\"datayfiochfx\"}],\"\":{\"eudhvszwgmpzbx\":\"dataybjynzo\",\"ushzfnlqnr\":\"datafmhypwglkvspbd\",\"g\":\"datasmrvpswe\"}},{\"type\":\"Activity\",\"name\":\"awhzdh\",\"description\":\"kudlilkwjzmyv\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"f\",\"dependencyConditions\":[\"Failed\",\"Completed\",\"Skipped\"],\"\":{\"grub\":\"dataokp\",\"hdkx\":\"datazgz\"}},{\"activity\":\"hlinjerkdurch\",\"dependencyConditions\":[\"Failed\",\"Completed\"],\"\":{\"hluoyr\":\"datasvosvqj\",\"hzpwsadwsent\":\"datahqq\"}},{\"activity\":\"cdzyvxwnmiumduw\",\"dependencyConditions\":[\"Skipped\"],\"\":{\"wfbgkyonadtywzrn\":\"datauvxmrbbgl\",\"dadfyg\":\"dataiktokiptx\"}},{\"activity\":\"bcfpri\",\"dependencyConditions\":[\"Completed\",\"Succeeded\",\"Succeeded\",\"Failed\"],\"\":{\"nnolrs\":\"datahxe\",\"uotexlpqydgfzet\":\"dataxtsywrmmhaxmo\"}}],\"userProperties\":[{\"name\":\"mnseigoalxwuq\",\"value\":\"dataczrskdovgkpq\"},{\"name\":\"zrxhghsmlxogim\",\"value\":\"datahxyx\"},{\"name\":\"lxawixdcy\",\"value\":\"datadqamiy\"}],\"\":{\"zco\":\"datazlbcamdzoauvwjkg\",\"aqxztywzaq\":\"datawcnnzacqludq\",\"zlzpowsefpg\":\"datafqtstmyfebb\",\"pzbsytwt\":\"dataw\"}}]},\"name\":\"vcdtsvgyzmafq\",\"description\":\"wupuubyvwejy\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"hrxoekyf\",\"dependencyConditions\":[\"Completed\",\"Completed\"],\"\":{\"jxjaaocjlwco\":\"datapdgnsmhrpzbyudko\",\"vmzxrhve\":\"datawcrextdymkzbliu\",\"guvqghuehgcqhlfq\":\"datangzjxjbklta\",\"r\":\"datamjldeluqqnf\"}}],\"userProperties\":[{\"name\":\"luomaltvvp\",\"value\":\"datadhtdapkdahyn\"},{\"name\":\"tixrkjogyqrmt\",\"value\":\"dataiclsxuibyfylhf\"}],\"\":{\"cwuz\":\"dataauqylmlunquvlva\",\"gynqedn\":\"datalx\",\"qcxzdlfs\":\"dataidacskul\"}}") + .toObject(UntilActivity.class); + Assertions.assertEquals("vcdtsvgyzmafq", model.name()); + Assertions.assertEquals("wupuubyvwejy", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("hrxoekyf", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("luomaltvvp", model.userProperties().get(0).name()); + Assertions.assertEquals("vyeckbudepulbxgd", model.expression().value()); + Assertions.assertEquals("aicfkkcpkvujwfyv", model.activities().get(0).name()); + Assertions.assertEquals("vnbbeysef", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("xfiveuqgptzx", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SKIPPED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("jhua", model.activities().get(0).userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UntilActivity model = + new UntilActivity() + .withName("vcdtsvgyzmafq") + .withDescription("wupuubyvwejy") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("hrxoekyf") + .withDependencyConditions( + Arrays.asList(DependencyCondition.COMPLETED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("luomaltvvp").withValue("datadhtdapkdahyn"), + new UserProperty().withName("tixrkjogyqrmt").withValue("dataiclsxuibyfylhf"))) + .withExpression(new Expression().withValue("vyeckbudepulbxgd")) + .withTimeout("datahywmezoiywm") + .withActivities( + Arrays + .asList( + new Activity() + .withName("aicfkkcpkvujwfyv") + .withDescription("vnbbeysef") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("xfiveuqgptzx") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays.asList(new UserProperty().withName("jhua").withValue("dataiitxyebi"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("fcxvfurkdhopz") + .withDescription("hrfwchim") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("zkwdexldocq") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("i") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("m") + .withDependencyConditions(Arrays.asList(DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("oir").withValue("datangmmv"), + new UserProperty().withName("rxoidmnsmd").withValue("datam"), + new UserProperty().withName("kjlhkcogxrs").withValue("datayfiochfx"))) + .withAdditionalProperties(mapOf("type", "Activity")), + new Activity() + .withName("awhzdh") + .withDescription("kudlilkwjzmyv") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("f") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.COMPLETED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("hlinjerkdurch") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("cdzyvxwnmiumduw") + .withDependencyConditions(Arrays.asList(DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("bcfpri") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("mnseigoalxwuq").withValue("dataczrskdovgkpq"), + new UserProperty().withName("zrxhghsmlxogim").withValue("datahxyx"), + new UserProperty().withName("lxawixdcy").withValue("datadqamiy"))) + .withAdditionalProperties(mapOf("type", "Activity")))); + model = BinaryData.fromObject(model).toObject(UntilActivity.class); + Assertions.assertEquals("vcdtsvgyzmafq", model.name()); + Assertions.assertEquals("wupuubyvwejy", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("hrxoekyf", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.COMPLETED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("luomaltvvp", model.userProperties().get(0).name()); + Assertions.assertEquals("vyeckbudepulbxgd", model.expression().value()); + Assertions.assertEquals("aicfkkcpkvujwfyv", model.activities().get(0).name()); + Assertions.assertEquals("vnbbeysef", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("xfiveuqgptzx", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.SKIPPED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("jhua", model.activities().get(0).userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UntilActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UntilActivityTypePropertiesTests.java new file mode 100644 index 000000000000..376073ab5b0c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UntilActivityTypePropertiesTests.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.UntilActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.Activity; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.Expression; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class UntilActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UntilActivityTypeProperties model = + BinaryData + .fromString( + "{\"expression\":{\"value\":\"ubjv\"},\"timeout\":\"datarcrknnruceuwfmrc\",\"activities\":[{\"type\":\"Activity\",\"name\":\"tnjikb\",\"description\":\"tov\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"ewokprvpkdk\",\"dependencyConditions\":[\"Completed\"],\"\":{\"ximnpcghcf\":\"dataavtndgfm\",\"erybdiajeeahweru\":\"dataduqefdtpur\",\"lahdwxyitezf\":\"datauoeyyxcdwlkk\",\"vtfzaqnoqgfyofoh\":\"dataekaxh\"}},{\"activity\":\"xpf\",\"dependencyConditions\":[\"Skipped\",\"Failed\",\"Skipped\",\"Skipped\"],\"\":{\"aewkkqv\":\"datas\"}},{\"activity\":\"uzifsguolfkup\",\"dependencyConditions\":[\"Completed\",\"Failed\",\"Failed\",\"Failed\"],\"\":{\"qdzwd\":\"datapi\",\"ddbzxidqqesl\":\"datacjyywbssliphcp\"}},{\"activity\":\"aoxke\",\"dependencyConditions\":[\"Failed\",\"Skipped\",\"Skipped\"],\"\":{\"g\":\"dataz\",\"zuvsjblqmddtp\":\"datafzyxamyjhp\",\"joboqts\":\"dataily\",\"uywg\":\"datad\"}}],\"userProperties\":[{\"name\":\"cf\",\"value\":\"datatmmpvoazgtlxgtu\"},{\"name\":\"w\",\"value\":\"datagtskolbjylostrc\"}],\"\":{\"bwaiqs\":\"datace\"}}]}") + .toObject(UntilActivityTypeProperties.class); + Assertions.assertEquals("ubjv", model.expression().value()); + Assertions.assertEquals("tnjikb", model.activities().get(0).name()); + Assertions.assertEquals("tov", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("ewokprvpkdk", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("cf", model.activities().get(0).userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UntilActivityTypeProperties model = + new UntilActivityTypeProperties() + .withExpression(new Expression().withValue("ubjv")) + .withTimeout("datarcrknnruceuwfmrc") + .withActivities( + Arrays + .asList( + new Activity() + .withName("tnjikb") + .withDescription("tov") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("ewokprvpkdk") + .withDependencyConditions(Arrays.asList(DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("xpf") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SKIPPED, + DependencyCondition.FAILED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("uzifsguolfkup") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.COMPLETED, + DependencyCondition.FAILED, + DependencyCondition.FAILED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("aoxke") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("cf").withValue("datatmmpvoazgtlxgtu"), + new UserProperty().withName("w").withValue("datagtskolbjylostrc"))) + .withAdditionalProperties(mapOf("type", "Activity")))); + model = BinaryData.fromObject(model).toObject(UntilActivityTypeProperties.class); + Assertions.assertEquals("ubjv", model.expression().value()); + Assertions.assertEquals("tnjikb", model.activities().get(0).name()); + Assertions.assertEquals("tov", model.activities().get(0).description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.activities().get(0).state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.activities().get(0).onInactiveMarkAs()); + Assertions.assertEquals("ewokprvpkdk", model.activities().get(0).dependsOn().get(0).activity()); + Assertions + .assertEquals( + DependencyCondition.COMPLETED, + model.activities().get(0).dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("cf", model.activities().get(0).userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UpdateIntegrationRuntimeNodeRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UpdateIntegrationRuntimeNodeRequestTests.java new file mode 100644 index 000000000000..c7cb0f5954d4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UpdateIntegrationRuntimeNodeRequestTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.UpdateIntegrationRuntimeNodeRequest; +import org.junit.jupiter.api.Assertions; + +public final class UpdateIntegrationRuntimeNodeRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateIntegrationRuntimeNodeRequest model = + BinaryData + .fromString("{\"concurrentJobsLimit\":712721872}") + .toObject(UpdateIntegrationRuntimeNodeRequest.class); + Assertions.assertEquals(712721872, model.concurrentJobsLimit()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateIntegrationRuntimeNodeRequest model = + new UpdateIntegrationRuntimeNodeRequest().withConcurrentJobsLimit(712721872); + model = BinaryData.fromObject(model).toObject(UpdateIntegrationRuntimeNodeRequest.class); + Assertions.assertEquals(712721872, model.concurrentJobsLimit()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UpdateIntegrationRuntimeRequestTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UpdateIntegrationRuntimeRequestTests.java new file mode 100644 index 000000000000..50e3f2659874 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UpdateIntegrationRuntimeRequestTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeAutoUpdate; +import com.azure.resourcemanager.datafactory.models.UpdateIntegrationRuntimeRequest; +import org.junit.jupiter.api.Assertions; + +public final class UpdateIntegrationRuntimeRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateIntegrationRuntimeRequest model = + BinaryData + .fromString("{\"autoUpdate\":\"On\",\"updateDelayOffset\":\"cwscwsvlx\"}") + .toObject(UpdateIntegrationRuntimeRequest.class); + Assertions.assertEquals(IntegrationRuntimeAutoUpdate.ON, model.autoUpdate()); + Assertions.assertEquals("cwscwsvlx", model.updateDelayOffset()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateIntegrationRuntimeRequest model = + new UpdateIntegrationRuntimeRequest() + .withAutoUpdate(IntegrationRuntimeAutoUpdate.ON) + .withUpdateDelayOffset("cwscwsvlx"); + model = BinaryData.fromObject(model).toObject(UpdateIntegrationRuntimeRequest.class); + Assertions.assertEquals(IntegrationRuntimeAutoUpdate.ON, model.autoUpdate()); + Assertions.assertEquals("cwscwsvlx", model.updateDelayOffset()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UserAccessPolicyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UserAccessPolicyTests.java new file mode 100644 index 000000000000..5919b78e3341 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UserAccessPolicyTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.UserAccessPolicy; +import org.junit.jupiter.api.Assertions; + +public final class UserAccessPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAccessPolicy model = + BinaryData + .fromString( + "{\"permissions\":\"eputtmrywnuzoqf\",\"accessResourcePath\":\"yqzrnkcqvyxlw\",\"profileName\":\"lsicohoqqnwv\",\"startTime\":\"yav\",\"expireTime\":\"heun\"}") + .toObject(UserAccessPolicy.class); + Assertions.assertEquals("eputtmrywnuzoqf", model.permissions()); + Assertions.assertEquals("yqzrnkcqvyxlw", model.accessResourcePath()); + Assertions.assertEquals("lsicohoqqnwv", model.profileName()); + Assertions.assertEquals("yav", model.startTime()); + Assertions.assertEquals("heun", model.expireTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAccessPolicy model = + new UserAccessPolicy() + .withPermissions("eputtmrywnuzoqf") + .withAccessResourcePath("yqzrnkcqvyxlw") + .withProfileName("lsicohoqqnwv") + .withStartTime("yav") + .withExpireTime("heun"); + model = BinaryData.fromObject(model).toObject(UserAccessPolicy.class); + Assertions.assertEquals("eputtmrywnuzoqf", model.permissions()); + Assertions.assertEquals("yqzrnkcqvyxlw", model.accessResourcePath()); + Assertions.assertEquals("lsicohoqqnwv", model.profileName()); + Assertions.assertEquals("yav", model.startTime()); + Assertions.assertEquals("heun", model.expireTime()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UserPropertyTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UserPropertyTests.java new file mode 100644 index 000000000000..6f07c3ea3060 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/UserPropertyTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import org.junit.jupiter.api.Assertions; + +public final class UserPropertyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserProperty model = + BinaryData + .fromString("{\"name\":\"fmluiqtqzfavyvn\",\"value\":\"dataqybaryeua\"}") + .toObject(UserProperty.class); + Assertions.assertEquals("fmluiqtqzfavyvn", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserProperty model = new UserProperty().withName("fmluiqtqzfavyvn").withValue("dataqybaryeua"); + model = BinaryData.fromObject(model).toObject(UserProperty.class); + Assertions.assertEquals("fmluiqtqzfavyvn", model.name()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ValidationActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ValidationActivityTests.java new file mode 100644 index 000000000000..ea921cbc1a3c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ValidationActivityTests.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import com.azure.resourcemanager.datafactory.models.ValidationActivity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ValidationActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ValidationActivity model = + BinaryData + .fromString( + "{\"type\":\"Validation\",\"typeProperties\":{\"timeout\":\"datazigelphauldals\",\"sleep\":\"dataanhe\",\"minimumSize\":\"dataxllqyvbl\",\"childItems\":\"datarskxhg\",\"dataset\":{\"referenceName\":\"vgviycjulun\",\"parameters\":{\"khoa\":\"dataficipibnjpivoiz\",\"hjlahdplic\":\"datam\",\"eynts\":\"datavodudaubmj\",\"oxuedmlocrkf\":\"datawxpamubgrjkg\"}}},\"name\":\"gjywp\",\"description\":\"vvjyenwvgvhh\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Failed\",\"dependsOn\":[{\"activity\":\"wlkfljooiiviwlf\",\"dependencyConditions\":[\"Succeeded\",\"Completed\",\"Succeeded\"],\"\":{\"oqrvnhcuoghvkzmg\":\"dataxbrthwbitrwwko\",\"fjahwypdhrqjjl\":\"datatemp\",\"sgarxtgexmxgqgqu\":\"dataato\"}},{\"activity\":\"lyrtkvftlbt\",\"dependencyConditions\":[\"Skipped\"],\"\":{\"umnucqewxcwr\":\"dataasrwo\",\"idcytnzy\":\"datakwmvcxyuem\",\"srlhxfmvngdrnt\":\"datasydwgq\",\"hnh\":\"datavn\"}},{\"activity\":\"bwdborjy\",\"dependencyConditions\":[\"Failed\",\"Skipped\",\"Skipped\"],\"\":{\"kpibeif\":\"dataigtdjqczoq\",\"t\":\"datamozofo\",\"qugycorgnxmn\":\"datahlnaymsgbyho\"}},{\"activity\":\"ennobjixoqqjbsag\",\"dependencyConditions\":[\"Succeeded\",\"Succeeded\",\"Completed\",\"Failed\"],\"\":{\"xuiaktnmwlklqhw\":\"dataimwlparh\"}}],\"userProperties\":[{\"name\":\"eoefwnjsorhpga\",\"value\":\"datar\"},{\"name\":\"pkoezcab\",\"value\":\"dataylsuiyvbildwqlx\"}],\"\":{\"pylpmtwdvdtzdr\":\"dataqei\",\"urwzrx\":\"dataaxswiind\",\"mbtvcdsl\":\"datahacvsj\"}}") + .toObject(ValidationActivity.class); + Assertions.assertEquals("gjywp", model.name()); + Assertions.assertEquals("vvjyenwvgvhh", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("wlkfljooiiviwlf", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("eoefwnjsorhpga", model.userProperties().get(0).name()); + Assertions.assertEquals("vgviycjulun", model.dataset().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ValidationActivity model = + new ValidationActivity() + .withName("gjywp") + .withDescription("vvjyenwvgvhh") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.FAILED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("wlkfljooiiviwlf") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.SUCCEEDED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("lyrtkvftlbt") + .withDependencyConditions(Arrays.asList(DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("bwdborjy") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.FAILED, + DependencyCondition.SKIPPED, + DependencyCondition.SKIPPED)) + .withAdditionalProperties(mapOf()), + new ActivityDependency() + .withActivity("ennobjixoqqjbsag") + .withDependencyConditions( + Arrays + .asList( + DependencyCondition.SUCCEEDED, + DependencyCondition.SUCCEEDED, + DependencyCondition.COMPLETED, + DependencyCondition.FAILED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("eoefwnjsorhpga").withValue("datar"), + new UserProperty().withName("pkoezcab").withValue("dataylsuiyvbildwqlx"))) + .withTimeout("datazigelphauldals") + .withSleep("dataanhe") + .withMinimumSize("dataxllqyvbl") + .withChildItems("datarskxhg") + .withDataset( + new DatasetReference() + .withReferenceName("vgviycjulun") + .withParameters( + mapOf( + "khoa", + "dataficipibnjpivoiz", + "hjlahdplic", + "datam", + "eynts", + "datavodudaubmj", + "oxuedmlocrkf", + "datawxpamubgrjkg"))); + model = BinaryData.fromObject(model).toObject(ValidationActivity.class); + Assertions.assertEquals("gjywp", model.name()); + Assertions.assertEquals("vvjyenwvgvhh", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.FAILED, model.onInactiveMarkAs()); + Assertions.assertEquals("wlkfljooiiviwlf", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SUCCEEDED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("eoefwnjsorhpga", model.userProperties().get(0).name()); + Assertions.assertEquals("vgviycjulun", model.dataset().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ValidationActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ValidationActivityTypePropertiesTests.java new file mode 100644 index 000000000000..2c68e26bdd4c --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ValidationActivityTypePropertiesTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.ValidationActivityTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ValidationActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ValidationActivityTypeProperties model = + BinaryData + .fromString( + "{\"timeout\":\"datavponxhszrotunnk\",\"sleep\":\"datakzkaoonbziklqyzr\",\"minimumSize\":\"dataw\",\"childItems\":\"datajzvvkehasxjmfhb\",\"dataset\":{\"referenceName\":\"eqxwcimamtqf\",\"parameters\":{\"zuuanrj\":\"dataoiqfv\"}}}") + .toObject(ValidationActivityTypeProperties.class); + Assertions.assertEquals("eqxwcimamtqf", model.dataset().referenceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ValidationActivityTypeProperties model = + new ValidationActivityTypeProperties() + .withTimeout("datavponxhszrotunnk") + .withSleep("datakzkaoonbziklqyzr") + .withMinimumSize("dataw") + .withChildItems("datajzvvkehasxjmfhb") + .withDataset( + new DatasetReference() + .withReferenceName("eqxwcimamtqf") + .withParameters(mapOf("zuuanrj", "dataoiqfv"))); + model = BinaryData.fromObject(model).toObject(ValidationActivityTypeProperties.class); + Assertions.assertEquals("eqxwcimamtqf", model.dataset().referenceName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VariableSpecificationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VariableSpecificationTests.java new file mode 100644 index 000000000000..6fe8a0e0e0df --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VariableSpecificationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.VariableSpecification; +import com.azure.resourcemanager.datafactory.models.VariableType; +import org.junit.jupiter.api.Assertions; + +public final class VariableSpecificationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VariableSpecification model = + BinaryData + .fromString("{\"type\":\"Array\",\"defaultValue\":\"dataqabqgzslesjcb\"}") + .toObject(VariableSpecification.class); + Assertions.assertEquals(VariableType.ARRAY, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VariableSpecification model = + new VariableSpecification().withType(VariableType.ARRAY).withDefaultValue("dataqabqgzslesjcb"); + model = BinaryData.fromObject(model).toObject(VariableSpecification.class); + Assertions.assertEquals(VariableType.ARRAY, model.type()); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VerticaDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VerticaDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..5ccda269e9b4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VerticaDatasetTypePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.VerticaDatasetTypeProperties; + +public final class VerticaDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VerticaDatasetTypeProperties model = + BinaryData + .fromString( + "{\"tableName\":\"datawxhflgdun\",\"table\":\"dataypxsazbxsnx\",\"schema\":\"datasznfstmprvgra\"}") + .toObject(VerticaDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VerticaDatasetTypeProperties model = + new VerticaDatasetTypeProperties() + .withTableName("datawxhflgdun") + .withTable("dataypxsazbxsnx") + .withSchema("datasznfstmprvgra"); + model = BinaryData.fromObject(model).toObject(VerticaDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VerticaSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VerticaSourceTests.java new file mode 100644 index 000000000000..bff94e2c7686 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VerticaSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.VerticaSource; + +public final class VerticaSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VerticaSource model = + BinaryData + .fromString( + "{\"type\":\"VerticaSource\",\"query\":\"datahsvsnedhkji\",\"queryTimeout\":\"datavetwf\",\"additionalColumns\":\"dataqvflrrtj\",\"sourceRetryCount\":\"dataikqzd\",\"sourceRetryWait\":\"dataqalxpmiytpjis\",\"maxConcurrentConnections\":\"datasolkwipvlsljut\",\"disableMetricsCollection\":\"datag\",\"\":{\"eaeyjlyxd\":\"dataodrfclehlopipv\",\"yavcbmzem\":\"dataxho\"}}") + .toObject(VerticaSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VerticaSource model = + new VerticaSource() + .withSourceRetryCount("dataikqzd") + .withSourceRetryWait("dataqalxpmiytpjis") + .withMaxConcurrentConnections("datasolkwipvlsljut") + .withDisableMetricsCollection("datag") + .withQueryTimeout("datavetwf") + .withAdditionalColumns("dataqvflrrtj") + .withQuery("datahsvsnedhkji"); + model = BinaryData.fromObject(model).toObject(VerticaSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VerticaTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VerticaTableDatasetTests.java new file mode 100644 index 000000000000..adc09f30ff29 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/VerticaTableDatasetTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.VerticaTableDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class VerticaTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VerticaTableDataset model = + BinaryData + .fromString( + "{\"type\":\"VerticaTable\",\"typeProperties\":{\"tableName\":\"dataxbofpr\",\"table\":\"dataiva\",\"schema\":\"datasbfzl\"},\"description\":\"jr\",\"structure\":\"datasfv\",\"schema\":\"datahqxtm\",\"linkedServiceName\":{\"referenceName\":\"lmfcleuovelvsp\",\"parameters\":{\"jtoudode\":\"datajtez\",\"sr\":\"datawmv\",\"emt\":\"dataciexu\"}},\"parameters\":{\"x\":{\"type\":\"Bool\",\"defaultValue\":\"dataymmcgskscb\"},\"wa\":{\"type\":\"SecureString\",\"defaultValue\":\"dataxicjojxolknsh\"},\"nchzz\":{\"type\":\"Int\",\"defaultValue\":\"databhmbglmnlbnat\"}},\"annotations\":[\"dataxortd\",\"datazvhbujk\",\"datahophqwo\"],\"folder\":{\"name\":\"ccqtwsrbf\"},\"\":{\"dzfbv\":\"dataii\",\"jtshlwvrsksdzmh\":\"dataxrvnhhmfsnqp\",\"pwfbwoetxiz\":\"datatsy\"}}") + .toObject(VerticaTableDataset.class); + Assertions.assertEquals("jr", model.description()); + Assertions.assertEquals("lmfcleuovelvsp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("x").type()); + Assertions.assertEquals("ccqtwsrbf", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VerticaTableDataset model = + new VerticaTableDataset() + .withDescription("jr") + .withStructure("datasfv") + .withSchema("datahqxtm") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("lmfcleuovelvsp") + .withParameters(mapOf("jtoudode", "datajtez", "sr", "datawmv", "emt", "dataciexu"))) + .withParameters( + mapOf( + "x", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("dataymmcgskscb"), + "wa", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("dataxicjojxolknsh"), + "nchzz", + new ParameterSpecification().withType(ParameterType.INT).withDefaultValue("databhmbglmnlbnat"))) + .withAnnotations(Arrays.asList("dataxortd", "datazvhbujk", "datahophqwo")) + .withFolder(new DatasetFolder().withName("ccqtwsrbf")) + .withTableName("dataxbofpr") + .withTable("dataiva") + .withSchemaTypePropertiesSchema("datasbfzl"); + model = BinaryData.fromObject(model).toObject(VerticaTableDataset.class); + Assertions.assertEquals("jr", model.description()); + Assertions.assertEquals("lmfcleuovelvsp", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.BOOL, model.parameters().get("x").type()); + Assertions.assertEquals("ccqtwsrbf", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WaitActivityTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WaitActivityTests.java new file mode 100644 index 000000000000..4f29423102ec --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WaitActivityTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ActivityDependency; +import com.azure.resourcemanager.datafactory.models.ActivityOnInactiveMarkAs; +import com.azure.resourcemanager.datafactory.models.ActivityState; +import com.azure.resourcemanager.datafactory.models.DependencyCondition; +import com.azure.resourcemanager.datafactory.models.UserProperty; +import com.azure.resourcemanager.datafactory.models.WaitActivity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class WaitActivityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WaitActivity model = + BinaryData + .fromString( + "{\"type\":\"Wait\",\"typeProperties\":{\"waitTimeInSeconds\":\"datazucpixfdbi\"},\"name\":\"pchbcbdpyorhq\",\"description\":\"fvhnhyxcws\",\"state\":\"Active\",\"onInactiveMarkAs\":\"Succeeded\",\"dependsOn\":[{\"activity\":\"area\",\"dependencyConditions\":[\"Skipped\",\"Completed\"],\"\":{\"npcrsfqwqm\":\"datanmnmqydpieleruoy\"}}],\"userProperties\":[{\"name\":\"j\",\"value\":\"dataonvjur\"},{\"name\":\"czdelqazb\",\"value\":\"dataixg\"}],\"\":{\"uvqacae\":\"databhwwpaec\",\"oqjmo\":\"datavn\",\"brrqxldkhgngyofe\":\"datagdb\",\"ncxkazmydsqvjkfz\":\"datajksmyeegbertf\"}}") + .toObject(WaitActivity.class); + Assertions.assertEquals("pchbcbdpyorhq", model.name()); + Assertions.assertEquals("fvhnhyxcws", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("area", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("j", model.userProperties().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WaitActivity model = + new WaitActivity() + .withName("pchbcbdpyorhq") + .withDescription("fvhnhyxcws") + .withState(ActivityState.ACTIVE) + .withOnInactiveMarkAs(ActivityOnInactiveMarkAs.SUCCEEDED) + .withDependsOn( + Arrays + .asList( + new ActivityDependency() + .withActivity("area") + .withDependencyConditions( + Arrays.asList(DependencyCondition.SKIPPED, DependencyCondition.COMPLETED)) + .withAdditionalProperties(mapOf()))) + .withUserProperties( + Arrays + .asList( + new UserProperty().withName("j").withValue("dataonvjur"), + new UserProperty().withName("czdelqazb").withValue("dataixg"))) + .withWaitTimeInSeconds("datazucpixfdbi"); + model = BinaryData.fromObject(model).toObject(WaitActivity.class); + Assertions.assertEquals("pchbcbdpyorhq", model.name()); + Assertions.assertEquals("fvhnhyxcws", model.description()); + Assertions.assertEquals(ActivityState.ACTIVE, model.state()); + Assertions.assertEquals(ActivityOnInactiveMarkAs.SUCCEEDED, model.onInactiveMarkAs()); + Assertions.assertEquals("area", model.dependsOn().get(0).activity()); + Assertions.assertEquals(DependencyCondition.SKIPPED, model.dependsOn().get(0).dependencyConditions().get(0)); + Assertions.assertEquals("j", model.userProperties().get(0).name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WaitActivityTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WaitActivityTypePropertiesTests.java new file mode 100644 index 000000000000..6cedbcd1ee6b --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WaitActivityTypePropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.WaitActivityTypeProperties; + +public final class WaitActivityTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WaitActivityTypeProperties model = + BinaryData.fromString("{\"waitTimeInSeconds\":\"datard\"}").toObject(WaitActivityTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WaitActivityTypeProperties model = new WaitActivityTypeProperties().withWaitTimeInSeconds("datard"); + model = BinaryData.fromObject(model).toObject(WaitActivityTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebAnonymousAuthenticationTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebAnonymousAuthenticationTests.java new file mode 100644 index 000000000000..f20a364fc141 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebAnonymousAuthenticationTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.WebAnonymousAuthentication; + +public final class WebAnonymousAuthenticationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebAnonymousAuthentication model = + BinaryData + .fromString("{\"authenticationType\":\"Anonymous\",\"url\":\"dataqovuwhvqihm\"}") + .toObject(WebAnonymousAuthentication.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WebAnonymousAuthentication model = new WebAnonymousAuthentication().withUrl("dataqovuwhvqihm"); + model = BinaryData.fromObject(model).toObject(WebAnonymousAuthentication.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebLinkedServiceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebLinkedServiceTests.java new file mode 100644 index 000000000000..01185786bdee --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebLinkedServiceTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.IntegrationRuntimeReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.WebLinkedService; +import com.azure.resourcemanager.datafactory.models.WebLinkedServiceTypeProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class WebLinkedServiceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebLinkedService model = + BinaryData + .fromString( + "{\"type\":\"Web\",\"typeProperties\":{\"authenticationType\":\"WebLinkedServiceTypeProperties\",\"url\":\"datamlm\"},\"connectVia\":{\"referenceName\":\"qyek\",\"parameters\":{\"egumydogrtfwzecg\":\"datadxz\",\"anvgpxnaa\":\"dataxrcsevqjdxiiqwqb\"}},\"description\":\"tnkruywrxnks\",\"parameters\":{\"rqwfuxntuegy\":{\"type\":\"SecureString\",\"defaultValue\":\"datarxjsmrseauxeovb\"}},\"annotations\":[\"dataketkvi\"],\"\":{\"hbxgfhgkdms\":\"datahatfgk\"}}") + .toObject(WebLinkedService.class); + Assertions.assertEquals("qyek", model.connectVia().referenceName()); + Assertions.assertEquals("tnkruywrxnks", model.description()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("rqwfuxntuegy").type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WebLinkedService model = + new WebLinkedService() + .withConnectVia( + new IntegrationRuntimeReference() + .withReferenceName("qyek") + .withParameters(mapOf("egumydogrtfwzecg", "datadxz", "anvgpxnaa", "dataxrcsevqjdxiiqwqb"))) + .withDescription("tnkruywrxnks") + .withParameters( + mapOf( + "rqwfuxntuegy", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datarxjsmrseauxeovb"))) + .withAnnotations(Arrays.asList("dataketkvi")) + .withTypeProperties(new WebLinkedServiceTypeProperties().withUrl("datamlm")); + model = BinaryData.fromObject(model).toObject(WebLinkedService.class); + Assertions.assertEquals("qyek", model.connectVia().referenceName()); + Assertions.assertEquals("tnkruywrxnks", model.description()); + Assertions.assertEquals(ParameterType.SECURE_STRING, model.parameters().get("rqwfuxntuegy").type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebLinkedServiceTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebLinkedServiceTypePropertiesTests.java new file mode 100644 index 000000000000..4dee50d274ce --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebLinkedServiceTypePropertiesTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.WebLinkedServiceTypeProperties; + +public final class WebLinkedServiceTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebLinkedServiceTypeProperties model = + BinaryData + .fromString("{\"authenticationType\":\"WebLinkedServiceTypeProperties\",\"url\":\"datalhhbu\"}") + .toObject(WebLinkedServiceTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WebLinkedServiceTypeProperties model = new WebLinkedServiceTypeProperties().withUrl("datalhhbu"); + model = BinaryData.fromObject(model).toObject(WebLinkedServiceTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebSourceTests.java new file mode 100644 index 000000000000..43e493323cb2 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebSourceTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.WebSource; + +public final class WebSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebSource model = + BinaryData + .fromString( + "{\"type\":\"WebSource\",\"additionalColumns\":\"datavbcvoyq\",\"sourceRetryCount\":\"datajdrct\",\"sourceRetryWait\":\"datavzewog\",\"maxConcurrentConnections\":\"datapzxkjqecjf\",\"disableMetricsCollection\":\"dataomeawthyc\",\"\":{\"pxhzjnparsulmuwl\":\"datapis\",\"vzycx\":\"datawakheoxxqgo\"}}") + .toObject(WebSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WebSource model = + new WebSource() + .withSourceRetryCount("datajdrct") + .withSourceRetryWait("datavzewog") + .withMaxConcurrentConnections("datapzxkjqecjf") + .withDisableMetricsCollection("dataomeawthyc") + .withAdditionalColumns("datavbcvoyq"); + model = BinaryData.fromObject(model).toObject(WebSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebTableDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebTableDatasetTests.java new file mode 100644 index 000000000000..9faceef6684e --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebTableDatasetTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.WebTableDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class WebTableDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebTableDataset model = + BinaryData + .fromString( + "{\"type\":\"WebTable\",\"typeProperties\":{\"index\":\"datajxnavpyxqbkxdtb\",\"path\":\"dataihainzkefkzlxvc\"},\"description\":\"cgoeozlibcbnu\",\"structure\":\"datau\",\"schema\":\"dataajvvq\",\"linkedServiceName\":{\"referenceName\":\"honyonelivgtibt\",\"parameters\":{\"fytkhhkemrv\":\"dataqjcajg\",\"dyulglhelwr\":\"dataxeoj\",\"px\":\"dataklfqfx\",\"skvctvu\":\"dataogypbztgaexj\"}},\"parameters\":{\"cyxrn\":{\"type\":\"Object\",\"defaultValue\":\"datattmhlvr\"}},\"annotations\":[\"datafajnpdw\",\"datajggkwdepem\",\"dataiayfiqiidxco\",\"datajvudyhgtrttcuayi\"],\"folder\":{\"name\":\"nkmm\"},\"\":{\"qgqexowqzrtgqr\":\"dataf\",\"obothx\":\"datakkvfygkuobpwainp\",\"qgzyvextc\":\"dataewhpnyjt\",\"whdlrifioz\":\"dataslroldow\"}}") + .toObject(WebTableDataset.class); + Assertions.assertEquals("cgoeozlibcbnu", model.description()); + Assertions.assertEquals("honyonelivgtibt", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("cyxrn").type()); + Assertions.assertEquals("nkmm", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WebTableDataset model = + new WebTableDataset() + .withDescription("cgoeozlibcbnu") + .withStructure("datau") + .withSchema("dataajvvq") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("honyonelivgtibt") + .withParameters( + mapOf( + "fytkhhkemrv", + "dataqjcajg", + "dyulglhelwr", + "dataxeoj", + "px", + "dataklfqfx", + "skvctvu", + "dataogypbztgaexj"))) + .withParameters( + mapOf( + "cyxrn", + new ParameterSpecification().withType(ParameterType.OBJECT).withDefaultValue("datattmhlvr"))) + .withAnnotations( + Arrays.asList("datafajnpdw", "datajggkwdepem", "dataiayfiqiidxco", "datajvudyhgtrttcuayi")) + .withFolder(new DatasetFolder().withName("nkmm")) + .withIndex("datajxnavpyxqbkxdtb") + .withPath("dataihainzkefkzlxvc"); + model = BinaryData.fromObject(model).toObject(WebTableDataset.class); + Assertions.assertEquals("cgoeozlibcbnu", model.description()); + Assertions.assertEquals("honyonelivgtibt", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.OBJECT, model.parameters().get("cyxrn").type()); + Assertions.assertEquals("nkmm", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebTableDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebTableDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..489a98976f00 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WebTableDatasetTypePropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.WebTableDatasetTypeProperties; + +public final class WebTableDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WebTableDatasetTypeProperties model = + BinaryData + .fromString("{\"index\":\"datatcbiich\",\"path\":\"dataudsozodwjcfqoy\"}") + .toObject(WebTableDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WebTableDatasetTypeProperties model = + new WebTableDatasetTypeProperties().withIndex("datatcbiich").withPath("dataudsozodwjcfqoy"); + model = BinaryData.fromObject(model).toObject(WebTableDatasetTypeProperties.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WranglingDataFlowTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WranglingDataFlowTests.java new file mode 100644 index 000000000000..eff0ea8826b7 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/WranglingDataFlowTests.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DataFlowFolder; +import com.azure.resourcemanager.datafactory.models.DataFlowReference; +import com.azure.resourcemanager.datafactory.models.DataFlowReferenceType; +import com.azure.resourcemanager.datafactory.models.DatasetReference; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.PowerQuerySource; +import com.azure.resourcemanager.datafactory.models.WranglingDataFlow; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class WranglingDataFlowTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WranglingDataFlow model = + BinaryData + .fromString( + "{\"type\":\"WranglingDataFlow\",\"typeProperties\":{\"sources\":[{\"script\":\"dawsxmrsz\",\"schemaLinkedService\":{\"referenceName\":\"nimx\",\"parameters\":{\"mnb\":\"dataerxrzutylcurza\",\"bjmbnvynfaooeac\":\"dataqaeht\"}},\"name\":\"edcgl\",\"description\":\"akd\",\"dataset\":{\"referenceName\":\"dahzllrqm\",\"parameters\":{\"oiduyqypff\":\"databyx\",\"yhbrjjta\":\"datanoiicsu\",\"sxxhdodp\":\"dataxrdsjrholuqwg\"}},\"linkedService\":{\"referenceName\":\"yblvtbdmvsbyi\",\"parameters\":{\"jfb\":\"datalqpvekmk\",\"gdusxurs\":\"datatlo\",\"iqrizfwihvaan\":\"dataivuxcjkcoqwczs\"}},\"flowlet\":{\"type\":\"DataFlowReference\",\"referenceName\":\"nhjrfdmfd\",\"datasetParameters\":\"datab\",\"parameters\":{\"d\":\"dataxjfwt\",\"fedyuep\":\"datakkauigvmuafmc\",\"eocfkumcfjxok\":\"datavpltidajjvy\",\"svfnkwm\":\"dataelsy\"},\"\":{\"ugjqyckgtxkrdt\":\"datajekrknfd\",\"jdkl\":\"datalcr\",\"svobchkxfp\":\"datatcsubmzoo\",\"nkkw\":\"datahdyslbklglm\"}}}],\"script\":\"qshwyqxridt\",\"documentLocale\":\"saqjmkgx\"},\"description\":\"queu\",\"annotations\":[\"dataztpziizevjykof\",\"dataezefkhkqtwqlepjj\",\"datakca\",\"datafwzcntogffjwaj\"],\"folder\":{\"name\":\"wzvaqkifmxaw\"}}") + .toObject(WranglingDataFlow.class); + Assertions.assertEquals("queu", model.description()); + Assertions.assertEquals("wzvaqkifmxaw", model.folder().name()); + Assertions.assertEquals("edcgl", model.sources().get(0).name()); + Assertions.assertEquals("akd", model.sources().get(0).description()); + Assertions.assertEquals("dahzllrqm", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("yblvtbdmvsbyi", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("nhjrfdmfd", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("nimx", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("dawsxmrsz", model.sources().get(0).script()); + Assertions.assertEquals("qshwyqxridt", model.script()); + Assertions.assertEquals("saqjmkgx", model.documentLocale()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WranglingDataFlow model = + new WranglingDataFlow() + .withDescription("queu") + .withAnnotations( + Arrays.asList("dataztpziizevjykof", "dataezefkhkqtwqlepjj", "datakca", "datafwzcntogffjwaj")) + .withFolder(new DataFlowFolder().withName("wzvaqkifmxaw")) + .withSources( + Arrays + .asList( + new PowerQuerySource() + .withName("edcgl") + .withDescription("akd") + .withDataset( + new DatasetReference() + .withReferenceName("dahzllrqm") + .withParameters( + mapOf( + "oiduyqypff", + "databyx", + "yhbrjjta", + "datanoiicsu", + "sxxhdodp", + "dataxrdsjrholuqwg"))) + .withLinkedService( + new LinkedServiceReference() + .withReferenceName("yblvtbdmvsbyi") + .withParameters( + mapOf( + "jfb", + "datalqpvekmk", + "gdusxurs", + "datatlo", + "iqrizfwihvaan", + "dataivuxcjkcoqwczs"))) + .withFlowlet( + new DataFlowReference() + .withType(DataFlowReferenceType.DATA_FLOW_REFERENCE) + .withReferenceName("nhjrfdmfd") + .withDatasetParameters("datab") + .withParameters( + mapOf( + "d", + "dataxjfwt", + "fedyuep", + "datakkauigvmuafmc", + "eocfkumcfjxok", + "datavpltidajjvy", + "svfnkwm", + "dataelsy")) + .withAdditionalProperties(mapOf())) + .withSchemaLinkedService( + new LinkedServiceReference() + .withReferenceName("nimx") + .withParameters( + mapOf("mnb", "dataerxrzutylcurza", "bjmbnvynfaooeac", "dataqaeht"))) + .withScript("dawsxmrsz"))) + .withScript("qshwyqxridt") + .withDocumentLocale("saqjmkgx"); + model = BinaryData.fromObject(model).toObject(WranglingDataFlow.class); + Assertions.assertEquals("queu", model.description()); + Assertions.assertEquals("wzvaqkifmxaw", model.folder().name()); + Assertions.assertEquals("edcgl", model.sources().get(0).name()); + Assertions.assertEquals("akd", model.sources().get(0).description()); + Assertions.assertEquals("dahzllrqm", model.sources().get(0).dataset().referenceName()); + Assertions.assertEquals("yblvtbdmvsbyi", model.sources().get(0).linkedService().referenceName()); + Assertions.assertEquals(DataFlowReferenceType.DATA_FLOW_REFERENCE, model.sources().get(0).flowlet().type()); + Assertions.assertEquals("nhjrfdmfd", model.sources().get(0).flowlet().referenceName()); + Assertions.assertEquals("nimx", model.sources().get(0).schemaLinkedService().referenceName()); + Assertions.assertEquals("dawsxmrsz", model.sources().get(0).script()); + Assertions.assertEquals("qshwyqxridt", model.script()); + Assertions.assertEquals("saqjmkgx", model.documentLocale()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XeroObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XeroObjectDatasetTests.java new file mode 100644 index 000000000000..229ea611b1f1 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XeroObjectDatasetTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.XeroObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class XeroObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + XeroObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"XeroObject\",\"typeProperties\":{\"tableName\":\"datadnpfcghdttowqx\"},\"description\":\"pbzxpzl\",\"structure\":\"datavhatiywtcvzuzp\",\"schema\":\"dataeomotq\",\"linkedServiceName\":{\"referenceName\":\"ql\",\"parameters\":{\"gq\":\"datai\",\"dpfvlsqmmetwtla\":\"datazk\"}},\"parameters\":{\"cgrllyyfsmoc\":{\"type\":\"String\",\"defaultValue\":\"dataefbdpnuvh\"},\"kgdskwvb\":{\"type\":\"SecureString\",\"defaultValue\":\"datarchmetvzhuugd\"}},\"annotations\":[\"datawwayqts\",\"datanyotgnmze\",\"datacreluedcmk\"],\"folder\":{\"name\":\"heexzhhllxwk\"},\"\":{\"tkqiymmddslwnlg\":\"dataxdjklfsd\",\"ybnnnlpqdnnska\":\"datadlhmks\"}}") + .toObject(XeroObjectDataset.class); + Assertions.assertEquals("pbzxpzl", model.description()); + Assertions.assertEquals("ql", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("cgrllyyfsmoc").type()); + Assertions.assertEquals("heexzhhllxwk", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + XeroObjectDataset model = + new XeroObjectDataset() + .withDescription("pbzxpzl") + .withStructure("datavhatiywtcvzuzp") + .withSchema("dataeomotq") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("ql") + .withParameters(mapOf("gq", "datai", "dpfvlsqmmetwtla", "datazk"))) + .withParameters( + mapOf( + "cgrllyyfsmoc", + new ParameterSpecification().withType(ParameterType.STRING).withDefaultValue("dataefbdpnuvh"), + "kgdskwvb", + new ParameterSpecification() + .withType(ParameterType.SECURE_STRING) + .withDefaultValue("datarchmetvzhuugd"))) + .withAnnotations(Arrays.asList("datawwayqts", "datanyotgnmze", "datacreluedcmk")) + .withFolder(new DatasetFolder().withName("heexzhhllxwk")) + .withTableName("datadnpfcghdttowqx"); + model = BinaryData.fromObject(model).toObject(XeroObjectDataset.class); + Assertions.assertEquals("pbzxpzl", model.description()); + Assertions.assertEquals("ql", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.STRING, model.parameters().get("cgrllyyfsmoc").type()); + Assertions.assertEquals("heexzhhllxwk", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XeroSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XeroSourceTests.java new file mode 100644 index 000000000000..adee414fb143 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XeroSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.XeroSource; + +public final class XeroSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + XeroSource model = + BinaryData + .fromString( + "{\"type\":\"XeroSource\",\"query\":\"datalwhtfscoupsf\",\"queryTimeout\":\"datawb\",\"additionalColumns\":\"datahawkwc\",\"sourceRetryCount\":\"datac\",\"sourceRetryWait\":\"dataxdwecvkwwjj\",\"maxConcurrentConnections\":\"datafunsd\",\"disableMetricsCollection\":\"datajx\",\"\":{\"qedofuobx\":\"dataale\",\"fjibbl\":\"datalainzvhl\",\"egzyzlslvgqlexw\":\"dataihvzdaycme\",\"t\":\"datawbbellcjd\"}}") + .toObject(XeroSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + XeroSource model = + new XeroSource() + .withSourceRetryCount("datac") + .withSourceRetryWait("dataxdwecvkwwjj") + .withMaxConcurrentConnections("datafunsd") + .withDisableMetricsCollection("datajx") + .withQueryTimeout("datawb") + .withAdditionalColumns("datahawkwc") + .withQuery("datalwhtfscoupsf"); + model = BinaryData.fromObject(model).toObject(XeroSource.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlDatasetTests.java new file mode 100644 index 000000000000..dac21dbad5f0 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlDatasetTests.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.DatasetLocation; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.XmlDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class XmlDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + XmlDataset model = + BinaryData + .fromString( + "{\"type\":\"Xml\",\"typeProperties\":{\"location\":{\"type\":\"DatasetLocation\",\"folderPath\":\"datarpnrehkunsbfjh\",\"fileName\":\"dataw\",\"\":{\"kgtzqnwqsttewu\":\"datavegeattb\",\"fjxflpditfno\":\"datacysje\",\"yuxlvrhprrv\":\"datap\",\"bs\":\"datawonleqflvtlr\"}},\"encodingName\":\"datahuy\",\"nullValue\":\"datan\",\"compression\":{\"type\":\"datattlnrjdszdb\",\"level\":\"dataiciqppo\",\"\":{\"uoxtfnressfepgck\":\"datapnewuhwfwjno\",\"ym\":\"datacjmgvsnvbtqdxfm\",\"jluqllbsupu\":\"datan\",\"zwhcukvb\":\"datadxckdl\"}}},\"description\":\"jjfdizhrjqf\",\"structure\":\"datayt\",\"schema\":\"dataly\",\"linkedServiceName\":{\"referenceName\":\"kcgn\",\"parameters\":{\"sxfai\":\"datarlcjiw\",\"rzxbarcbp\":\"datacwdgujjgnf\",\"ymjwenjcyt\":\"dataefzq\",\"auzmzivrtrfzhhe\":\"datasmfucrtfodqh\"}},\"parameters\":{\"swtvd\":{\"type\":\"Array\",\"defaultValue\":\"datadxdyyrudma\"}},\"annotations\":[\"dataqssgfenffdx\",\"datavwfqjch\"],\"folder\":{\"name\":\"r\"},\"\":{\"p\":\"datanxndmuvardlmzjo\"}}") + .toObject(XmlDataset.class); + Assertions.assertEquals("jjfdizhrjqf", model.description()); + Assertions.assertEquals("kcgn", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("swtvd").type()); + Assertions.assertEquals("r", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + XmlDataset model = + new XmlDataset() + .withDescription("jjfdizhrjqf") + .withStructure("datayt") + .withSchema("dataly") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("kcgn") + .withParameters( + mapOf( + "sxfai", + "datarlcjiw", + "rzxbarcbp", + "datacwdgujjgnf", + "ymjwenjcyt", + "dataefzq", + "auzmzivrtrfzhhe", + "datasmfucrtfodqh"))) + .withParameters( + mapOf( + "swtvd", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datadxdyyrudma"))) + .withAnnotations(Arrays.asList("dataqssgfenffdx", "datavwfqjch")) + .withFolder(new DatasetFolder().withName("r")) + .withLocation( + new DatasetLocation() + .withFolderPath("datarpnrehkunsbfjh") + .withFileName("dataw") + .withAdditionalProperties(mapOf("type", "DatasetLocation"))) + .withEncodingName("datahuy") + .withNullValue("datan") + .withCompression( + new DatasetCompression() + .withType("datattlnrjdszdb") + .withLevel("dataiciqppo") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(XmlDataset.class); + Assertions.assertEquals("jjfdizhrjqf", model.description()); + Assertions.assertEquals("kcgn", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("swtvd").type()); + Assertions.assertEquals("r", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlDatasetTypePropertiesTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlDatasetTypePropertiesTests.java new file mode 100644 index 000000000000..77267cfc1463 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlDatasetTypePropertiesTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.fluent.models.XmlDatasetTypeProperties; +import com.azure.resourcemanager.datafactory.models.DatasetCompression; +import com.azure.resourcemanager.datafactory.models.DatasetLocation; +import java.util.HashMap; +import java.util.Map; + +public final class XmlDatasetTypePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + XmlDatasetTypeProperties model = + BinaryData + .fromString( + "{\"location\":{\"type\":\"DatasetLocation\",\"folderPath\":\"datamuhcuhtuzl\",\"fileName\":\"datawyopgarpfctwrapc\",\"\":{\"snj\":\"datajqyvzesipi\",\"aadcndazabundt\":\"datayo\"}},\"encodingName\":\"datawkaupwhlz\",\"nullValue\":\"datakremgjl\",\"compression\":{\"type\":\"datavdorsirx\",\"level\":\"datayrkqa\",\"\":{\"teyrqshi\":\"dataajfreprfvmkin\",\"sp\":\"databcejopylbl\",\"cspimtcvvfxrdy\":\"datar\",\"iqemcdiiisklbon\":\"datazfslxizhqikmgob\"}}}") + .toObject(XmlDatasetTypeProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + XmlDatasetTypeProperties model = + new XmlDatasetTypeProperties() + .withLocation( + new DatasetLocation() + .withFolderPath("datamuhcuhtuzl") + .withFileName("datawyopgarpfctwrapc") + .withAdditionalProperties(mapOf("type", "DatasetLocation"))) + .withEncodingName("datawkaupwhlz") + .withNullValue("datakremgjl") + .withCompression( + new DatasetCompression() + .withType("datavdorsirx") + .withLevel("datayrkqa") + .withAdditionalProperties(mapOf())); + model = BinaryData.fromObject(model).toObject(XmlDatasetTypeProperties.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlReadSettingsTests.java new file mode 100644 index 000000000000..c5da2f99a4ad --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlReadSettingsTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CompressionReadSettings; +import com.azure.resourcemanager.datafactory.models.XmlReadSettings; +import java.util.HashMap; +import java.util.Map; + +public final class XmlReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + XmlReadSettings model = + BinaryData + .fromString( + "{\"type\":\"XmlReadSettings\",\"compressionProperties\":{\"type\":\"CompressionReadSettings\",\"\":{\"pizjqpjztu\":\"dataqge\",\"akvuted\":\"datadiverkwmafyxo\",\"o\":\"datat\"}},\"validationMode\":\"dataudjdwcwjacdbkce\",\"detectDataType\":\"dataahnqjbavdblfef\",\"namespaces\":\"datavitlnnp\",\"namespacePrefixes\":\"dataufwrer\",\"\":{\"temvaajyit\":\"dataruzfnstlavmdc\",\"ubryhvbvjyf\":\"datayzgwihkswurza\"}}") + .toObject(XmlReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + XmlReadSettings model = + new XmlReadSettings() + .withCompressionProperties( + new CompressionReadSettings().withAdditionalProperties(mapOf("type", "CompressionReadSettings"))) + .withValidationMode("dataudjdwcwjacdbkce") + .withDetectDataType("dataahnqjbavdblfef") + .withNamespaces("datavitlnnp") + .withNamespacePrefixes("dataufwrer"); + model = BinaryData.fromObject(model).toObject(XmlReadSettings.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlSourceTests.java new file mode 100644 index 000000000000..c0dbc925a50f --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/XmlSourceTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.CompressionReadSettings; +import com.azure.resourcemanager.datafactory.models.StoreReadSettings; +import com.azure.resourcemanager.datafactory.models.XmlReadSettings; +import com.azure.resourcemanager.datafactory.models.XmlSource; +import java.util.HashMap; +import java.util.Map; + +public final class XmlSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + XmlSource model = + BinaryData + .fromString( + "{\"type\":\"XmlSource\",\"storeSettings\":{\"type\":\"StoreReadSettings\",\"maxConcurrentConnections\":\"datafimlyx\",\"disableMetricsCollection\":\"dataixjudbiac\",\"\":{\"lvbujwpnzijpyyve\":\"dataucmfuvu\",\"khlpgtpgxkkoypxw\":\"dataruhqymwdsthktsal\",\"uaxoswqwbh\":\"datavthiva\",\"cnpdkw\":\"datarzlg\"}},\"formatSettings\":{\"type\":\"XmlReadSettings\",\"compressionProperties\":{\"type\":\"CompressionReadSettings\",\"\":{\"vofrenuvp\":\"datazlmzsekvsuzyowra\"}},\"validationMode\":\"dataltnyyeyj\",\"detectDataType\":\"datafpbxnretpg\",\"namespaces\":\"datatohruqtximrxeyz\",\"namespacePrefixes\":\"datanxb\",\"\":{\"sb\":\"dataglfyf\",\"ixdgqjkfvmrnwgea\":\"datajhoxtbsybpefojp\",\"tlxrdepqtz\":\"datayifeiiriomjdnkn\",\"o\":\"datahkpko\"}},\"additionalColumns\":\"datanobuwhutvcdtgx\",\"sourceRetryCount\":\"datafu\",\"sourceRetryWait\":\"datammzxpsrlbppjq\",\"maxConcurrentConnections\":\"datacpdaoskgtalljsoa\",\"disableMetricsCollection\":\"datajjklmpbgrosxfdx\",\"\":{\"luvdceouevno\":\"datanmbb\"}}") + .toObject(XmlSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + XmlSource model = + new XmlSource() + .withSourceRetryCount("datafu") + .withSourceRetryWait("datammzxpsrlbppjq") + .withMaxConcurrentConnections("datacpdaoskgtalljsoa") + .withDisableMetricsCollection("datajjklmpbgrosxfdx") + .withStoreSettings( + new StoreReadSettings() + .withMaxConcurrentConnections("datafimlyx") + .withDisableMetricsCollection("dataixjudbiac") + .withAdditionalProperties(mapOf("type", "StoreReadSettings"))) + .withFormatSettings( + new XmlReadSettings() + .withCompressionProperties( + new CompressionReadSettings() + .withAdditionalProperties(mapOf("type", "CompressionReadSettings"))) + .withValidationMode("dataltnyyeyj") + .withDetectDataType("datafpbxnretpg") + .withNamespaces("datatohruqtximrxeyz") + .withNamespacePrefixes("datanxb")) + .withAdditionalColumns("datanobuwhutvcdtgx"); + model = BinaryData.fromObject(model).toObject(XmlSource.class); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ZipDeflateReadSettingsTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ZipDeflateReadSettingsTests.java new file mode 100644 index 000000000000..32ad3eb9bb34 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ZipDeflateReadSettingsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ZipDeflateReadSettings; + +public final class ZipDeflateReadSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ZipDeflateReadSettings model = + BinaryData + .fromString( + "{\"type\":\"ZipDeflateReadSettings\",\"preserveZipFileNameAsFolder\":\"datarwxf\",\"\":{\"ofegrzfsfuloo\":\"dataghwfiy\"}}") + .toObject(ZipDeflateReadSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ZipDeflateReadSettings model = new ZipDeflateReadSettings().withPreserveZipFileNameAsFolder("datarwxf"); + model = BinaryData.fromObject(model).toObject(ZipDeflateReadSettings.class); + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ZohoObjectDatasetTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ZohoObjectDatasetTests.java new file mode 100644 index 000000000000..7649974ec345 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ZohoObjectDatasetTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.DatasetFolder; +import com.azure.resourcemanager.datafactory.models.LinkedServiceReference; +import com.azure.resourcemanager.datafactory.models.ParameterSpecification; +import com.azure.resourcemanager.datafactory.models.ParameterType; +import com.azure.resourcemanager.datafactory.models.ZohoObjectDataset; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ZohoObjectDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ZohoObjectDataset model = + BinaryData + .fromString( + "{\"type\":\"ZohoObject\",\"typeProperties\":{\"tableName\":\"datamrslwknrd\"},\"description\":\"mbjern\",\"structure\":\"datazywx\",\"schema\":\"dataaq\",\"linkedServiceName\":{\"referenceName\":\"tkdeetnnef\",\"parameters\":{\"fwqjzybmfqdnpp\":\"datalkszuxjmrzsxwa\",\"vamuvkgd\":\"datacfguam\",\"spjvsyydjlhd\":\"datapjbblukgctv\"}},\"parameters\":{\"ulojwumfjdymeq\":{\"type\":\"Array\",\"defaultValue\":\"datavyeegx\"},\"nxemhqpzhnatw\":{\"type\":\"Bool\",\"defaultValue\":\"datapfyxdjspn\"}},\"annotations\":[\"datamcvdjlwwefevtwll\",\"dataypmjc\",\"datay\",\"datafwgkzuhk\"],\"folder\":{\"name\":\"jkckwbqwjyfmmk\"},\"\":{\"oerohextigukfk\":\"datarooyzhobnvyuepa\",\"enlqtqyvlfbs\":\"datasycbdymbnp\"}}") + .toObject(ZohoObjectDataset.class); + Assertions.assertEquals("mbjern", model.description()); + Assertions.assertEquals("tkdeetnnef", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("ulojwumfjdymeq").type()); + Assertions.assertEquals("jkckwbqwjyfmmk", model.folder().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ZohoObjectDataset model = + new ZohoObjectDataset() + .withDescription("mbjern") + .withStructure("datazywx") + .withSchema("dataaq") + .withLinkedServiceName( + new LinkedServiceReference() + .withReferenceName("tkdeetnnef") + .withParameters( + mapOf( + "fwqjzybmfqdnpp", + "datalkszuxjmrzsxwa", + "vamuvkgd", + "datacfguam", + "spjvsyydjlhd", + "datapjbblukgctv"))) + .withParameters( + mapOf( + "ulojwumfjdymeq", + new ParameterSpecification().withType(ParameterType.ARRAY).withDefaultValue("datavyeegx"), + "nxemhqpzhnatw", + new ParameterSpecification().withType(ParameterType.BOOL).withDefaultValue("datapfyxdjspn"))) + .withAnnotations(Arrays.asList("datamcvdjlwwefevtwll", "dataypmjc", "datay", "datafwgkzuhk")) + .withFolder(new DatasetFolder().withName("jkckwbqwjyfmmk")) + .withTableName("datamrslwknrd"); + model = BinaryData.fromObject(model).toObject(ZohoObjectDataset.class); + Assertions.assertEquals("mbjern", model.description()); + Assertions.assertEquals("tkdeetnnef", model.linkedServiceName().referenceName()); + Assertions.assertEquals(ParameterType.ARRAY, model.parameters().get("ulojwumfjdymeq").type()); + Assertions.assertEquals("jkckwbqwjyfmmk", model.folder().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ZohoSourceTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ZohoSourceTests.java new file mode 100644 index 000000000000..f79076d3c3c4 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/generated/ZohoSourceTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datafactory.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.datafactory.models.ZohoSource; + +public final class ZohoSourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ZohoSource model = + BinaryData + .fromString( + "{\"type\":\"ZohoSource\",\"query\":\"datavddfmflwfxdkpwd\",\"queryTimeout\":\"datayg\",\"additionalColumns\":\"dataugcht\",\"sourceRetryCount\":\"datai\",\"sourceRetryWait\":\"datadlrxbsuftpvgmqzi\",\"maxConcurrentConnections\":\"datauvmlltas\",\"disableMetricsCollection\":\"dataqsf\",\"\":{\"vvvrbqxisa\":\"dataszvegawbmyvgmbi\"}}") + .toObject(ZohoSource.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ZohoSource model = + new ZohoSource() + .withSourceRetryCount("datai") + .withSourceRetryWait("datadlrxbsuftpvgmqzi") + .withMaxConcurrentConnections("datauvmlltas") + .withDisableMetricsCollection("dataqsf") + .withQueryTimeout("datayg") + .withAdditionalColumns("dataugcht") + .withQuery("datavddfmflwfxdkpwd"); + model = BinaryData.fromObject(model).toObject(ZohoSource.class); + } +} diff --git a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml index d74cffc723b1..a986f791f20d 100644 --- a/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml +++ b/sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/pom.xml @@ -85,7 +85,7 @@ com.azure.resourcemanager azure-resourcemanager-iothub - 1.1.0 + 1.2.0 test diff --git a/sdk/deviceupdate/azure-iot-deviceupdate/CHANGELOG.md b/sdk/deviceupdate/azure-iot-deviceupdate/CHANGELOG.md index a69181c851b7..e1b2698edaac 100644 --- a/sdk/deviceupdate/azure-iot-deviceupdate/CHANGELOG.md +++ b/sdk/deviceupdate/azure-iot-deviceupdate/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.0.11 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.0.10 (2023-08-18) ### Other Changes diff --git a/sdk/digitaltwins/azure-digitaltwins-core/CHANGELOG.md b/sdk/digitaltwins/azure-digitaltwins-core/CHANGELOG.md index 31ec2e24f9fe..5659c1ebc9b0 100644 --- a/sdk/digitaltwins/azure-digitaltwins-core/CHANGELOG.md +++ b/sdk/digitaltwins/azure-digitaltwins-core/CHANGELOG.md @@ -10,6 +10,16 @@ ### Other Changes +## 1.3.13 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. +- Upgraded `azure-core-serializer-json-jackson` from `1.4.3` to version `1.4.4`. + ## 1.3.12 (2023-08-18) ### Other Changes diff --git a/sdk/e2e/pom.xml b/sdk/e2e/pom.xml index 6d10d5301a8d..f2327ac494db 100644 --- a/sdk/e2e/pom.xml +++ b/sdk/e2e/pom.xml @@ -39,17 +39,17 @@ com.azure azure-identity - 1.11.0-beta.1 + 1.11.0-beta.2 com.azure azure-security-keyvault-keys - 4.7.0-beta.1 + 4.8.0-beta.1 com.azure azure-security-keyvault-secrets - 4.7.0-beta.1 + 4.8.0-beta.1 com.azure diff --git a/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/pom.xml b/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/pom.xml index 58789b1a2542..f6c4e4467817 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/pom.xml +++ b/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/pom.xml @@ -88,7 +88,7 @@ com.azure azure-messaging-eventgrid - 4.17.2 + 4.18.0 io.cloudevents diff --git a/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/src/test/java/com/azure/messaging/eventgrid/cloudnative/cloudevents/EventGridCloudNativeEventPublisherTests.java b/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/src/test/java/com/azure/messaging/eventgrid/cloudnative/cloudevents/EventGridCloudNativeEventPublisherTests.java index dba1c6edade8..9159c12d2382 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/src/test/java/com/azure/messaging/eventgrid/cloudnative/cloudevents/EventGridCloudNativeEventPublisherTests.java +++ b/sdk/eventgrid/azure-messaging-eventgrid-cloudnative-cloudevents/src/test/java/com/azure/messaging/eventgrid/cloudnative/cloudevents/EventGridCloudNativeEventPublisherTests.java @@ -27,6 +27,8 @@ * EventGrid cloud native cloud event tests. */ public class EventGridCloudNativeEventPublisherTests extends TestBase { + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); + // Event Grid endpoint for a topic accepting CloudEvents schema events private static final String CLOUD_ENDPOINT = "AZURE_EVENTGRID_CLOUDEVENT_ENDPOINT"; // Event Grid access key for a topic accepting CloudEvents schema events @@ -39,9 +41,6 @@ public class EventGridCloudNativeEventPublisherTests extends TestBase { @Override protected void beforeTest() { - - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - builder = new EventGridPublisherClientBuilder(); if (interceptorManager.isPlaybackMode()) { @@ -54,11 +53,6 @@ protected void beforeTest() { builder.endpoint(getEndpoint(CLOUD_ENDPOINT)).credential(getKey(CLOUD_KEY)); } - @Override - protected void afterTest() { - StepVerifier.resetDefaultTimeout(); - } - @Test public void publishEventGridEventsToTopic() { EventGridPublisherAsyncClient egClientAsync = @@ -79,9 +73,11 @@ public void publishEventGridEventsToTopic() { // Async publishing StepVerifier.create(EventGridCloudNativeEventPublisher.sendEventAsync(egClientAsync, cloudEvent)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(EventGridCloudNativeEventPublisher.sendEventsAsync(egClientAsync, cloudEvents)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Sync publishing EventGridCloudNativeEventPublisher.sendEvent(egClient, cloudEvent); @@ -119,9 +115,11 @@ public void publishEventGridEventsToDomain() { // Async publishing StepVerifier.create(EventGridCloudNativeEventPublisher.sendEventAsync(egClientAsync, cloudEvent)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(EventGridCloudNativeEventPublisher.sendEventsAsync(egClientAsync, cloudEvents)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Sync publishing EventGridCloudNativeEventPublisher.sendEvent(egClient, cloudEvent); @@ -147,9 +145,11 @@ public void publishEventGridEventsWithoutContentType() { // Async publishing StepVerifier.create(EventGridCloudNativeEventPublisher.sendEventAsync(egClientAsync, cloudEvent)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(EventGridCloudNativeEventPublisher.sendEventsAsync(egClientAsync, cloudEvents)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Sync publishing EventGridCloudNativeEventPublisher.sendEvent(egClient, cloudEvent); diff --git a/sdk/eventgrid/azure-messaging-eventgrid/CHANGELOG.md b/sdk/eventgrid/azure-messaging-eventgrid/CHANGELOG.md index 80db0acdd024..323e6513caf4 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/azure-messaging-eventgrid/CHANGELOG.md @@ -1,9 +1,8 @@ # Release History -## 4.18.0-beta.1 (Unreleased) +## 4.19.0-beta.1 (Unreleased) ### Features Added -- New events for EventGrid and AppConfig ### Breaking Changes @@ -11,6 +10,19 @@ ### Other Changes +## 4.18.0 (2023-09-13) + +### Features Added +- New events for EventGrid and AppConfig + +### Other Changes + +#### Dependency Updates +- +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + + ## 4.17.2 (2023-08-18) ### Other Changes diff --git a/sdk/eventgrid/azure-messaging-eventgrid/README.md b/sdk/eventgrid/azure-messaging-eventgrid/README.md index 1094226005f1..79748d2ed64b 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid/README.md +++ b/sdk/eventgrid/azure-messaging-eventgrid/README.md @@ -81,7 +81,7 @@ add the direct dependency to your project as follows. com.azure azure-messaging-eventgrid - 4.17.1 + 4.18.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/eventgrid/azure-messaging-eventgrid/pom.xml b/sdk/eventgrid/azure-messaging-eventgrid/pom.xml index 6d1e5d97174e..39557032f79f 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid/pom.xml +++ b/sdk/eventgrid/azure-messaging-eventgrid/pom.xml @@ -12,7 +12,7 @@ com.azure azure-messaging-eventgrid - 4.18.0-beta.1 + 4.19.0-beta.1 jar Microsoft Azure SDK for eventgrid @@ -88,7 +88,7 @@ com.azure azure-storage-queue - 12.18.1 + 12.19.0 test diff --git a/sdk/eventgrid/azure-messaging-eventgrid/src/test/java/com/azure/messaging/eventgrid/EventGridPublisherClientTests.java b/sdk/eventgrid/azure-messaging-eventgrid/src/test/java/com/azure/messaging/eventgrid/EventGridPublisherClientTests.java index 270a35472ee5..4af767cdfd54 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid/src/test/java/com/azure/messaging/eventgrid/EventGridPublisherClientTests.java +++ b/sdk/eventgrid/azure-messaging-eventgrid/src/test/java/com/azure/messaging/eventgrid/EventGridPublisherClientTests.java @@ -43,6 +43,7 @@ public class EventGridPublisherClientTests extends TestBase { + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private EventGridPublisherClientBuilder builder; @@ -77,9 +78,6 @@ public class EventGridPublisherClientTests extends TestBase { @Override protected void beforeTest() { - - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - builder = new EventGridPublisherClientBuilder(); if (interceptorManager.isPlaybackMode()) { @@ -90,11 +88,6 @@ protected void beforeTest() { } } - @Override - protected void afterTest() { - StepVerifier.resetDefaultTimeout(); - } - @Test public void publishEventGridEvents() { EventGridPublisherAsyncClient egClient = builder @@ -116,10 +109,12 @@ public void publishEventGridEvents() { StepVerifier.create(egClient.sendEventsWithResponse(events)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(egClient.sendEvents(events)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -140,7 +135,8 @@ public void publishEventGridEvent() { "1.0") .setEventTime(OffsetDateTime.now()); StepVerifier.create(egClient.sendEvent(event)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -170,7 +166,8 @@ public void publishWithSasToken() { StepVerifier.create(egClient.sendEventsWithResponse(events, Context.NONE)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -196,7 +193,8 @@ public void publishWithTokenCredential() { StepVerifier.create(egClient.sendEventsWithResponse(events, Context.NONE)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -220,7 +218,8 @@ public void publishCloudEvents() { StepVerifier.create(egClient.sendEventsWithResponse(events, Context.NONE)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -242,7 +241,8 @@ public void publishCloudEvent() { .setTime(OffsetDateTime.now()); StepVerifier.create(egClient.sendEvent(event)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -272,7 +272,8 @@ public void publishCloudEventsToPartnerTopic() { getChannelName(EVENTGRID_PARTNER_CHANNEL_NAME)); StepVerifier.create(responseMono) .assertNext(response -> assertEquals(200, response.getStatusCode())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -307,7 +308,7 @@ public void publishEventGridEventToPartnerTopic() { assertEquals(400, ((HttpResponseException) exception).getResponse().getStatusCode()); } - }).verify(); + }).verify(DEFAULT_TIMEOUT); } public static class TestData { @@ -353,7 +354,8 @@ public void serialize(TestData testData, JsonGenerator jsonGenerator, Serializer StepVerifier.create(egClient.sendEventsWithResponse(events, Context.NONE)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @@ -378,7 +380,8 @@ public void publishCustomEvents() { } StepVerifier.create(egClient.sendEventsWithResponse(events)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -402,7 +405,8 @@ public void publishCustomEventsWithSerializer() { } StepVerifier.create(egClient.sendEventsWithResponse(events, Context.NONE)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -421,7 +425,9 @@ public void publishCustomEvent() { put("type", "Microsoft.MockPublisher.TestEvent"); } }); - StepVerifier.create(egClient.sendEvent(event)).verifyComplete(); + StepVerifier.create(egClient.sendEvent(event)) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test diff --git a/sdk/eventgrid/azure-messaging-eventgrid/src/test/java/com/azure/messaging/eventgrid/EventGridPublisherImplTests.java b/sdk/eventgrid/azure-messaging-eventgrid/src/test/java/com/azure/messaging/eventgrid/EventGridPublisherImplTests.java index a439c44dfde8..ff9ee0131b06 100644 --- a/sdk/eventgrid/azure-messaging-eventgrid/src/test/java/com/azure/messaging/eventgrid/EventGridPublisherImplTests.java +++ b/sdk/eventgrid/azure-messaging-eventgrid/src/test/java/com/azure/messaging/eventgrid/EventGridPublisherImplTests.java @@ -7,25 +7,29 @@ import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddHeadersPolicy; import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.models.CloudEvent; import com.azure.core.models.CloudEventDataFormat; import com.azure.core.test.TestBase; import com.azure.core.util.BinaryData; import com.azure.messaging.eventgrid.implementation.EventGridPublisherClientImpl; import com.azure.messaging.eventgrid.implementation.EventGridPublisherClientImplBuilder; -import com.azure.core.models.CloudEvent; import com.azure.messaging.eventgrid.implementation.models.EventGridEvent; import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; -import java.net.MalformedURLException; import java.time.Duration; import java.time.OffsetDateTime; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; import static org.junit.jupiter.api.Assertions.assertNotNull; public class EventGridPublisherImplTests extends TestBase { + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private HttpPipelineBuilder pipelineBuilder; @@ -55,8 +59,6 @@ public class EventGridPublisherImplTests extends TestBase { @Override protected void beforeTest() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - pipelineBuilder = new HttpPipelineBuilder(); clientBuilder = new EventGridPublisherClientImplBuilder(); @@ -68,13 +70,8 @@ protected void beforeTest() { } } - @Override - protected void afterTest() { - StepVerifier.resetDefaultTimeout(); - } - @Test - public void publishEventGridEventsImpl() throws MalformedURLException { + public void publishEventGridEventsImpl() { EventGridPublisherClientImpl egClient = clientBuilder .pipeline(pipelineBuilder.policies( new AddHeadersPolicy(new HttpHeaders().put("aeg-sas-key", getKey(EVENTGRID_KEY)))) @@ -99,11 +96,12 @@ public void publishEventGridEventsImpl() throws MalformedURLException { StepVerifier.create(egClient.publishEventGridEventsWithResponseAsync(getEndpoint(EVENTGRID_ENDPOINT), events)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test - public void publishCloudEventsImpl() throws MalformedURLException { + public void publishCloudEventsImpl() { EventGridPublisherClientImpl egClient = clientBuilder .pipeline(pipelineBuilder.policies( new AddHeadersPolicy(new HttpHeaders().put("aeg-sas-key", getKey(CLOUD_KEY)))) @@ -126,11 +124,12 @@ public void publishCloudEventsImpl() throws MalformedURLException { StepVerifier.create(egClient.publishCloudEventEventsWithResponseAsync(getEndpoint(CLOUD_ENDPOINT), events, null)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test - public void publishCustomEventsImpl() throws MalformedURLException { + public void publishCustomEventsImpl() { EventGridPublisherClientImpl egClient = clientBuilder .pipeline(pipelineBuilder.policies( new AddHeadersPolicy(new HttpHeaders().put("aeg-sas-key", getKey(CUSTOM_KEY)))) @@ -152,7 +151,8 @@ public void publishCustomEventsImpl() throws MalformedURLException { StepVerifier.create(egClient.publishCustomEventEventsWithResponseAsync(getEndpoint(CUSTOM_ENDPOINT), events)) .expectNextMatches(voidResponse -> voidResponse.getStatusCode() == 200) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } diff --git a/sdk/eventgrid/azure-resourcemanager-eventgrid/pom.xml b/sdk/eventgrid/azure-resourcemanager-eventgrid/pom.xml index 16a06cbbdf51..45365a702cd7 100644 --- a/sdk/eventgrid/azure-resourcemanager-eventgrid/pom.xml +++ b/sdk/eventgrid/azure-resourcemanager-eventgrid/pom.xml @@ -79,13 +79,13 @@ com.azure azure-messaging-eventgrid - 4.17.2 + 4.18.0 test com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 test diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md index 5793db7378ac..2ff930518067 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.17.0-beta.2 (Unreleased) +## 1.18.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,14 @@ ### Other Changes +## 1.17.0 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-messaging-eventhubs` from `5.15.8` to version `5.16.0`. + ## 1.16.9 (2023-08-18) ### Other Changes @@ -73,14 +81,6 @@ - Update `azure-messaging-eventhubs` dependency to `5.15.2`. - Update `azure-storage-blob` dependency to `12.20.3`. -## 1.17.0-beta.1 (2023-01-31) - -### Other Changes - -#### Dependency Updates - -- Update `azure-messaging-eventhubs` dependency to `5.16.0-beta.1`. - ## 1.16.2 (2023-01-18) ### Breaking Changes diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md index 079f7bdb47b6..87a2e7cfe901 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md @@ -59,7 +59,7 @@ add the direct dependency to your project as follows. com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.16.8 + 1.17.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml index 2698cc136591..a13a124a2972 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml @@ -17,7 +17,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.17.0-beta.2 + 1.18.0-beta.1 Microsoft Azure client library for storing checkpoints in Storage Blobs Library for using storing checkpoints in Storage Blobs @@ -49,12 +49,12 @@ com.azure azure-messaging-eventhubs - 5.16.0-beta.2 + 5.17.0-beta.1 com.azure azure-storage-blob - 12.23.1 + 12.24.0 diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/CHANGELOG.md index fd605a250cee..058d9c8fae8f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.3 (Unreleased) ### Features Added @@ -8,11 +8,21 @@ ### Bugs Fixed +### Other Changes + +## 1.0.0-beta.2 (2023-09-22) + +### Bugs Fixed + - Fixes bug where errors claiming ownership were not propagated. - Fixes bug where error not returned when creating partition ownerships. ### Other Changes +#### Dependency Updates + +- Upgraded `azure-messaging-eventhubs` from `5.15.2` to version `5.16.0`. + ## 1.0.0-beta.1 (2023-02-13) ### Features Added diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/README.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/README.md index a3c65e3027a3..e37cb018936c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/README.md @@ -59,7 +59,7 @@ add the direct dependency to your project as follows. com.azure azure-messaging-eventhubs-checkpointstore-jedis - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/pom.xml index 404b8c7c4156..729910011bc7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/pom.xml @@ -17,7 +17,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-jedis - 1.0.0-beta.2 + 1.0.0-beta.3 Microsoft Azure client library for storing checkpoints in Azure Redis @@ -41,7 +41,7 @@ com.azure azure-messaging-eventhubs - 5.16.0-beta.2 + 5.17.0-beta.1 redis.clients diff --git a/sdk/eventhubs/azure-messaging-eventhubs-stress/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-stress/pom.xml index d668d3775525..dd2552c3d911 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-stress/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-stress/pom.xml @@ -39,12 +39,12 @@ com.azure azure-messaging-eventhubs - 5.16.0-beta.2 + 5.17.0-beta.1 com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.17.0-beta.2 + 1.18.0-beta.1 diff --git a/sdk/eventhubs/azure-messaging-eventhubs-track2-perf/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-track2-perf/pom.xml index 3b37f0079edf..028ac5a4feba 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-track2-perf/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs-track2-perf/pom.xml @@ -24,17 +24,17 @@ com.azure azure-messaging-eventhubs - 5.16.0-beta.2 + 5.17.0-beta.1 com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.17.0-beta.2 + 1.18.0-beta.1 com.azure azure-messaging-eventhubs-checkpointstore-jedis - 1.0.0-beta.2 + 1.0.0-beta.3 com.azure diff --git a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md index 14bca6352eba..d612c3a74e89 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md @@ -1,6 +1,16 @@ # Release History -## 5.16.0-beta.2 (Unreleased) +## 5.17.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 5.16.0 (2023-09-22) ### Features Added @@ -8,16 +18,20 @@ - Added support for tracing options and configuration. ([#33600](https://github.com/Azure/azure-sdk-for-java/issues/33600)) - Aligned with OpenTelemetry messaging semantic conventions (when latest azure-core-tracing-opentelemetry package is used). ([#33600](https://github.com/Azure/azure-sdk-for-java/issues/33600)) -### Breaking Changes - ### Bugs Fixed - Fixed exception when attempting to populate trace context on received `EventData`. ([#33594](https://github.com/Azure/azure-sdk-for-java/issues/33594)) - Fixed `NullPointerException` when ending span when `AmqpException` is thrown, but its `AmqpErrorCondition` is `null`. ([#35299](https://github.com/Azure/azure-sdk-for-java/issues/35299)) +- Handles errors thrown from user-called code when invoking `PartitionProcessor`'s `processError` or `close` methods. [#36891](https://github.com/Azure/azure-sdk-for-java/pull/36891) ### Other Changes +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-amqp` from `2.8.8` to version `2.8.9`. + ## 5.15.8 (2023-08-18) ### Other Changes diff --git a/sdk/eventhubs/azure-messaging-eventhubs/README.md b/sdk/eventhubs/azure-messaging-eventhubs/README.md index 65a509295c56..19e30e6deaf4 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/README.md @@ -94,7 +94,7 @@ add the direct dependency to your project as follows. com.azure azure-messaging-eventhubs - 5.15.7 + 5.16.0 ``` [//]: # ({x-version-update-end}) @@ -137,7 +137,7 @@ platform. First, add the package: com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/TROUBLESHOOTING.md b/sdk/eventhubs/azure-messaging-eventhubs/TROUBLESHOOTING.md index 5a96c0d2a96a..50b5a81c3814 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/TROUBLESHOOTING.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/TROUBLESHOOTING.md @@ -1,271 +1,6 @@ # Troubleshoot Event Hubs issues -This troubleshooting guide covers failure investigation techniques, common errors for the credential types in the Azure Event Hubs Java client library, and mitigation steps to resolve these errors. - -- [Handle Event Hubs exceptions](#handle-event-hubs-exceptions) - - [Find relevant information in exception messages](#find-relevant-information-in-exception-messages) - - [Commonly encountered exceptions](#commonly-encountered-exceptions) -- [Permission issues](#permission-issues) -- [Connectivity issues](#connectivity-issues) - - [Timeout when connecting to service](#timeout-when-connecting-to-service) - - [SSL handshake failures](#ssl-handshake-failures) - - [Socket exhaustion errors](#socket-exhaustion-errors) - - [Connect using an IoT connection string](#connect-using-an-iot-connection-string) - - [Cannot add components to the connection string](#cannot-add-components-to-the-connection-string) -- [Enable and configure logging](#enable-and-configure-logging) - - [Configuring Log4J 2](#configuring-log4j-2) - - [Configuring logback](#configuring-logback) - - [Enable AMQP transport logging](#enable-amqp-transport-logging) - - [Reduce logging](#reduce-logging) -- [Troubleshoot EventProducerAsyncClient/EventProducerClient issues](#troubleshoot-eventproducerasyncclienteventproducerclient-issues) - - [Cannot set multiple partition keys for events in EventDataBatch](#cannot-set-multiple-partition-keys-for-events-in-eventdatabatch) - - [Setting partition key on EventData is not set in Kafka consumer](#setting-partition-key-on-eventdata-is-not-set-in-kafka-consumer) -- [Troubleshoot EventProcessorClient issues](#troubleshoot-eventprocessorclient-issues) - - [412 precondition failures when using an event processor](#412-precondition-failures-when-using-an-event-processor) - - [Partition ownership changes frequently](#partition-ownership-changes-frequently) - - ["...current receiver '\' with epoch '0' is getting disconnected"](#current-receiver-receiver_name-with-epoch-0-is-getting-disconnected) - - [High CPU usage](#high-cpu-usage) - - [Out of memory and choosing the heap size](#out-of-memory-and-choosing-the-heap-size) - - [Processor client stops receiving](#processor-client-stops-receiving) - - [Duplicate EventData received when processor is restarted](#duplicate-eventdata-received-when-processor-is-restarted) - - [Migrate from legacy to new client library](#migrate-from-legacy-to-new-client-library) -- [Performance considerations for EventProcessorClient](#performance-considerations-for-eventprocessorclient) - - [Using `processEvent` or `processEventBatch`](#using-processevent-or-processeventbatch) - - [Costs of checkpointing](#costs-of-checkpointing) - - [Using `LoadBalancingStrategy.BALANCED` or `LoadBalancingStrategy.GREEDY`](#using-loadbalancingstrategybalanced-or-loadbalancingstrategygreedy) - - [Configuring `prefetchCount`](#configuring-prefetchcount) -- [Get additional help](#get-additional-help) - - [Filing GitHub issues](#filing-github-issues) - -## Handle Event Hubs exceptions - -All Event Hubs exceptions are wrapped in an [AmqpException][AmqpException]. They often have an underlying AMQP error code which specifies whether an error should be retried. For retryable errors (ie. `amqp:connection:forced` or `amqp:link:detach-forced`), the client libraries will attempt to recover from these errors based on the [retry options][AmqpRetryOptions] specified when instantiating the client. To configure retry options, follow the sample [Publish events to specific partition][PublishEventsToSpecificPartition]. If the error is non-retryable, there is some configuration issue that needs to be resolved. - -The recommended way to solve the specific exception the AMQP exception represents is to follow the -[Event Hubs Messaging Exceptions][EventHubsMessagingExceptions] guidance. - -### Find relevant information in exception messages - -An [AmqpException][AmqpException] contains three fields which describe the error. - -* **getErrorCondition**: The underlying AMQP error. A description of the errors can be found in the [AmqpErrorCondition][AmqpErrorCondition] javadocs or the [OASIS AMQP 1.0 spec][AmqpSpec]. -* **isTransient**: Whether or not trying to perform the same operation is possible. SDK clients apply the retry policy when the error is transient. -* **getErrorContext**: Information about where the AMQP error originated. - * [LinkErrorContext][LinkErrorContext]: Errors that occur in either the send/receive link. - * [SessionErrorContext][SessionErrorContext]: Errors that occur in the session. - * [AmqpErrorContext][AmqpErrorContext]: Errors that occur in the connection or a general AMQP error. - -### Commonly encountered exceptions - -#### `amqp:connection:forced` and `amqp:link:detach-forced` - -When the connection to Event Hubs is idle, the service will disconnect the client after some time. This is not a problem as the clients will re-establish a connection when a service operation is requested. More information can be found in the [AMQP troubleshooting documentation][AmqpTroubleshooting]. - -## Permission issues - -An `AmqpException` with an [`AmqpErrorCondition`][AmqpErrorCondition] of "amqp:unauthorized-access" means that the provided credentials do not allow for them to perform the action (receiving or sending) with Event Hubs. - -* [Double check you have the correct connection string][GetConnectionString] -* [Ensure your SAS token is generated correctly][AuthorizeSAS] - -[Troubleshoot authentication and authorization issues with Event Hubs][troubleshoot_authentication_authorization] lists other possible solutions. - -## Connectivity issues - -### Timeout when connecting to service - -* Verify that the connection string or fully qualified domain name specified when creating the client is correct. [Get an Event Hubs connection string][GetConnectionString] demonstrates how to acquire a connection string. -* Check the firewall and port permissions in your hosting environment and that the AMQP ports 5671 and 5762 are open. - * Make sure that the endpoint is allowed through the firewall. -* Try using WebSockets, which connects on port 443. See [configure web sockets][PublishEventsWithWebSocketsAndProxy] sample. -* See if your network is blocking specific IP addresses. - * [What IP addresses do I need to allow?][EventHubsIPAddresses] -* If applicable, check the proxy configuration. See [configure proxy][PublishEventsWithWebSocketsAndProxy] sample. -* For more information about troubleshooting network connectivity is at [Event Hubs troubleshooting][EventHubsTroubleshooting] - -### SSL handshake failures - -This error can occur when an intercepting proxy is used. We recommend testing in your hosting environment with the proxy disabled to verify. - -### Socket exhaustion errors - -Applications should prefer treating the Event Hubs clients as a singleton, creating and using a single instance through the lifetime of their application. This is important as each client type manages its connection; creating a new Event Hub client results in a new AMQP connection, which uses a socket. Additionally, it is essential to be aware that clients inherit from `java.io.Closeable`, so your application is responsible for calling `close()` when it is finished using a client. - -To use the same AMQP connection when creating multiple clients, you can use the `EventHubClientBuilder.shareConnection()` flag, hold a reference to that `EventHubClientBuilder`, and create new clients from that same builder instance. - -### Connect using an IoT connection string - -Because translating a connection string requires querying the IoT Hub service, the Event Hubs client library cannot use it directly. The [IoTConnectionString.java][IoTConnectionString] sample describes how to query IoT Hub to translate an IoT connection string into one that can be used with Event Hubs. - -Further reading: -* [Control access to IoT Hub using Shared Access Signatures][IoTHubSAS] -* [Read device-to-cloud messages from the built-in endpoint][IoTEventHubEndpoint] - -### Cannot add components to the connection string - -The legacy Event Hub clients allowed customers to add components to the connection string retrieved from the portal. The legacy clients are in packages [com.microsoft.azure:azure-eventhubs][MavenAzureEventHubs] and [com.microsoft.azure:azure-eventhubs-eph][MavenAzureEventHubsEPH]. The current generation supports connection strings only in the form published by the Azure portal. - -#### Adding "TransportType=AmqpWebSockets" - -To use web sockets, see the sample [PublishEventsWithSocketsAndProxy.java][PublishEventsWithWebSocketsAndProxy]. - -#### Adding "Authentication=Managed Identity" - -To authenticate with Managed Identity, see the sample [PublishEventsWithAzureIdentity.java][PublishEventsWithAzureIdentity]. - -For more information about the `Azure.Identity` library, check out our [Authentication and the Azure SDK][AuthenticationAndTheAzureSDK] blog post. - -## Enable and configure logging - -The Azure SDK for Java offers a consistent logging story to help troubleshoot application errors and expedite their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help locate the root issue. View the [logging][Logging] wiki for guidance about enabling logging. - -In addition to enabling logging, setting the log level to `VERBOSE` or `DEBUG` provides insights into the library's state. Below are sample log4j2 and logback configurations to reduce the excessive messages when verbose logging is enabled. - -### Configuring Log4J 2 - -1. Add the dependencies in your pom.xml using ones from the [logging sample pom.xml][LoggingPom] under the "Dependencies required for Log4j2" section. -2. Add [log4j2.xml][log4j2] to your `src/main/resources`. - -### Configuring logback - -1. Add the dependencies in your pom.xml using ones from the [logging sample pom.xml][LoggingPom] under the "Dependencies required for logback" section. -2. Add [logback.xml][logback] to your `src/main/resources`. - -### Enable AMQP transport logging - -If enabling client logging is not enough to diagnose your issues. You can enable logging to a file in the underlying -AMQP library, [Qpid Proton-J][qpid_proton_j_apache]. Qpid Proton-J uses `java.util.logging`. You can enable logging by -creating a configuration file with the contents below. Or set `proton.trace.level=ALL` and whichever configuration options -you want for the `java.util.logging.Handler` implementation. The implementation classes and their options can be found in -[Java 8 SDK javadoc][java_8_sdk_javadocs]. - -To trace the AMQP transport frames, set the environment variable: `PN_TRACE_FRM=1`. - -#### Sample "logging.properties" file - -The configuration file below logs TRACE level output from proton-j to the file "proton-trace.log". - -``` -handlers=java.util.logging.FileHandler -.level=OFF -proton.trace.level=ALL -java.util.logging.FileHandler.level=ALL -java.util.logging.FileHandler.pattern=proton-trace.log -java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=[%1$tF %1$tr] %3$s %4$s: %5$s %n -``` - -### Reduce logging - -One way to decrease logging is to change the verbosity. Another is to add filters that exclude logs from logger names packages like `com.azure.messaging.eventhubs` or `com.azure.core.amqp`. Examples of this can be found in the XML files in [Configuring Log4J 2](#configuring-log4j-2) and [Configure logback](#configuring-logback). - -When submitting a bug, log messages from classes in the following packages are interesting: - -* `com.azure.core.amqp.implementation` -* `com.azure.core.amqp.implementation.handler` - * The exception is that the onDelivery message in ReceiveLinkHandler can be ignored. -* `com.azure.messaging.eventhubs.implementation` - -## Troubleshoot EventProducerAsyncClient/EventProducerClient issues - -### Cannot set multiple partition keys for events in EventDataBatch - -When publishing messages, the Event Hubs service supports a single partition key for each EventDataBatch. Customers can consider using the buffered producer client `EventHubBufferedProducerClient` if they want that capability. Otherwise, they'll have to manage their batches. - -### Setting partition key on EventData is not set in Kafka consumer - -The partition key of the EventHubs event is available in the Kafka record headers, the protocol specific key being "x-opt-partition-key" in the header. - -By design, Event Hubs does not promote the Kafka message key to be the Event Hubs partition key nor the reverse because with the same value, the Kafka client and the Event Hub client likely send the message to two different partitions. It might cause some confusion if we set the value in the cross-protocol communication case. Exposing the properties with a protocol specific key to the other protocol client should be good enough. - -## Troubleshoot EventProcessorClient issues - -### 412 precondition failures when using an event processor - -412 precondition errors occur when the client tries to take or renew ownership of a partition, but the local version of the ownership record is outdated. This occurs when another processor instance steals partition ownership. See [Partition ownership changes a lot](#partition-ownership-changes-a-lot) for more information. - -### Partition ownership changes frequently - -When the number of EventProcessorClient instances changes (i.e. added or removed), the running instances try to load-balance partitions between themselves. For a few minutes after the number of processors changes, partitions are expected to change owners. Once balanced, partition ownership should be stable and change infrequently. If partition ownership is changing frequently when the number of processors is constant, this likely indicates a problem. It is recommended that a GitHub issue with logs and a repro be filed in this case. - -### "...current receiver '' with epoch '0' is getting disconnected" - -The entire error message looks something like this: - -> New receiver 'nil' with higher epoch of '0' is created hence current receiver 'nil' with epoch '0' -> is getting disconnected. If you are recreating the receiver, make sure a higher epoch is used. -> TrackingId:, SystemTracker::eventhub:|, -> Timestamp:2022-01-01T12:00:00}"} - -This error is expected when load balancing occurs after EventProcessorClient instances are added or removed. Load balancing is an ongoing process. When using the BlobCheckpointStore with your consumer, every ~30 seconds (by default), the consumer will check to see which consumers have a claim for each partition, then run some logic to determine whether it needs to 'steal' a partition from another consumer. The service mechanism used to assert exclusive ownership over a partition is known as the [Epoch][Epoch]. - -However, if no instances are being added or removed, there is an underlying issue that should be addressed. See [Partition ownership changes a lot](#partition-ownership-changes-a-lot) for additional information and [Filing GitHub issues](#filing-github-issues). - -### High CPU usage - -High CPU usage is usually because an instance owns too many partitions. We recommend no more than three partitions for every 1 CPU core; better to start with 1.5 partitions for each CPU core and test increasing the number of partitions owned. - -### Out of memory and choosing the heap size - -The Out of memory (OOM) can happen if the current max heap for the JVM is insufficient to run the application. You may want to measure the application's heap requirement, then, based on the result, size the heap by setting the appropriate max heap memory (-Xmx JVM option). - -Note that you should not specify -Xmx as a value larger than the memory available or limit set for the host (VM, container), e.g., the memory requested in the container's configuration. You should allocate enough memory for the host to support the Java heap. - -A typical way to measure the value for max Java Heap is - - -Run the application in an environment close to production, where the application sends, receives, and processes events under the peak load expected in production. - -Wait for the application to reach a steady state. At this stage, the application and JVM would have loaded all domain objects, class types, static instances, object pools (TCP, DB connection pools), etc. - -Under the steady state you will see the stable sawtooth-shaped pattern for the heap collection - - -![healthy-heap-pattern][HealthyHeapPattern] - -Once the application reaches the steady state, force a full GC using tools like JConsole. Observe the memory occupied after the full GC. You want to size the heap such that only 30% is occupied after the full GC. You can use this value to set the max heap size (-Xmx). - -If you're on the container, then size the container to have an "additional ~1 GB" of memory for the "non-heap" need for the JVM instance. - -### Processor client stops receiving - -The processor client often is continually running in a host application for days on end. Sometimes, they notice that EventProcessorClient is not processing one or more partitions. Usually, this is not enough information to determine why the exception occurred. The EventProcessorClient stopping is the symptom of an underlying cause (i.e. race condition) that occurred while trying to recover from a transient error. Please see [Filing Github issues](#filing-github-issues) for the information we require. - -### Duplicate EventData received when processor is restarted - -The `EventProcessorClient` and Event Hub service guarantees an "at least once" delivery. Customers can add metadata to discern duplicate events. The answer to [Does Azure Event Hub guarantee an at-least once delivery?][StackOverflowAtLeastOnce] provides additional information. If customers require only-once delivery, they may consider Service Bus, which waits for an acknowledgement from the client. A comparison of the messaging services is documented in [Choosing between Azure messaging services][CompareMessagingServices]. - -### Migrate from legacy to new client library - -The [migration guide][MigrationGuide] includes steps on migrating from the legacy client and migrating legacy checkpoints. - -## Performance considerations for EventProcessorClient - -### Using `processEvent` or `processEventBatch` - -When using the `processEvent` callback, each `EventData` received calls the users' code. This works well with low or moderate traffic in the Event Hub. - -If the Event Hub has high traffic and high throughput is expected, the aggregated cost of continuously calling the users' callback hinders performance of `EventProcessorClient`. In this case, users should use `processEventBatch`. - -For each partition, the users' callback is invoked one at a time, so high processing time in the callback hinders performance as the `EventProcessorClient` does not continue to push more events downstream nor request more `EventData` from Event Hubs service. - -### Costs of checkpointing - -When using Azure Blob Storage as the checkpoint store, there is a network cost to checkpointing as it makes an HTTP request and waits for a response. This process could take up to several seconds due to network latency, the performance of Azure Blob Storage, resource location, etc. - -Checkpointing after _every_ `EventData` is processed hinders performance due to the cost of making these HTTP requests. Users should not checkpoint if their callback processed no events or checkpoint after processing some number of events. - -### Using `LoadBalancingStrategy.BALANCED` or `LoadBalancingStrategy.GREEDY` - -When using `LoadBalancingStrategy.BALANCED`, the `EventProcessorClient` claims one partition for every load balancing cycle. If there are 32 partitions in an Event Hub, it will take 32 load-balancing iterations to claim all the partitions. If users know a set number of `EventProcessorClient` instances are running, they can use `LoadBalancingStrategy.GREEDY` to claim their share of the partitions in one load-balancing cycle. - -[LoadBalancingStrategy javadocs][LoadBalancingStrategy] contains additional information about each strategy. - -### Configuring `prefetchCount` - -The default prefetch value is 500. When the AMQP receive link is opened, it places 500 credits on the link. Assuming that each `EventData` is one link credit, `EventProcessorClient` prefetches 500 `EventData`. When _all_ the events are consumed, the processor client adds 500 credits to the link to receive more messages. This flow repeats while the `EventProcessorClient` still has ownership of a partition. - -Configuring `prefetchCount` may have performance implications if the number is _low_. Each time the AMQP receive link places credits, the remote service sends an ACK. For high throughput scenarios, the overhead of making thousands of client requests and service ACKs may hinder performance. - -Configuring `prefetchCount` may have performance implications if the number is _very high_. When _x_ credits are placed on the line, the Event Hubs service knows that it can send at most _x_ messages. When each `EventData` is received, they are placed in an in-memory queue, waiting to be processed. The high number of `EventData` in the queue can result in very high memory usage. +The troubleshooting guide has moved to: https://learn.microsoft.com/azure/developer/java/sdk/troubleshooting-messaging-event-hubs-overview ## Get additional help @@ -288,43 +23,6 @@ When filing GitHub issues, the following details are requested: * Logs. We need DEBUG logs, but if that is not possible, INFO at least. Error and warning level logs do not provide enough information. The period of at least +/- 10 minutes from when the issue occurred. -[IoTConnectionString]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/IoTHubConnectionSample.java -[log4j2]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/eventhubs/azure-messaging-eventhubs/docs/log4j2.xml -[logback]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/eventhubs/azure-messaging-eventhubs/docs/logback.xml -[LoggingPom]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/eventhubs/azure-messaging-eventhubs/docs/pom.xml -[MigrationGuide]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/migration-guide.md -[PublishEventsToSpecificPartition]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java -[PublishEventsWithAzureIdentity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithAzureIdentity.java -[PublishEventsWithWebSocketsAndProxy]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithWebSocketsAndProxy.java [SUPPORT]: https://github.com/Azure/azure-sdk-for-java/blob/main/SUPPORT.md -[HealthyHeapPattern]: ./docs/images/healthyheappattern.png -[LoadBalancingStrategy]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/LoadBalancingStrategy.java - - -[AmqpErrorCondition]: https://docs.microsoft.com/java/api/com.azure.core.amqp.exception.amqperrorcondition -[AmqpErrorContext]: https://docs.microsoft.com/java/api/com.azure.core.amqp.exception.amqperrorcontext -[AmqpException]: https://docs.microsoft.com/java/api/com.azure.core.amqp.exception.amqpexception -[SessionErrorContext]: https://docs.microsoft.com/java/api/com.azure.core.amqp.exception.sessionerrorcontext -[LinkErrorContext]: https://docs.microsoft.com/java/api/com.azure.core.amqp.exception.linkerrorcontext - -[AmqpTroubleshooting]: https://docs.microsoft.com/azure/service-bus-messaging/service-bus-amqp-troubleshoot -[AuthorizeSAS]: https://docs.microsoft.com/azure/event-hubs/authorize-access-shared-access-signature -[Epoch]: https://docs.microsoft.com/azure/event-hubs/event-hubs-event-processor-host#epoch -[EventHubsIPAddresses]: https://docs.microsoft.com/azure/event-hubs/troubleshooting-guide#what-ip-addresses-do-i-need-to-allow -[EventHubsMessagingExceptions]: https://docs.microsoft.com/azure/event-hubs/event-hubs-messaging-exceptions -[EventHubsTroubleshooting]: https://docs.microsoft.com/azure/event-hubs/troubleshooting-guide -[GetConnectionString]: https://docs.microsoft.com/azure/event-hubs/event-hubs-get-connection-string -[IoTEventHubEndpoint]: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messages-read-builtin -[IoTHubSAS]: https://docs.microsoft.com/azure/iot-hub/iot-hub-dev-guide-sas#security-tokens -[Logging]: https://docs.microsoft.com/azure/developer/java/sdk/logging-overview -[troubleshoot_authentication_authorization]: https://docs.microsoft.com/azure/event-hubs/troubleshoot-authentication-authorization - -[AuthenticationAndTheAzureSDK]: https://devblogs.microsoft.com/azure-sdk/authentication-and-the-azure-sdk -[MavenAzureEventHubs]: https://central.sonatype.com/artifact/com.microsoft.azure/azure-eventhubs -[MavenAzureEventHubsEPH]: https://central.sonatype.com/artifact/com.microsoft.azure/azure-eventhubs-eph -[java_8_sdk_javadocs]: https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html -[AmqpSpec]: https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html -[qpid_proton_j_apache]: https://qpid.apache.org/proton/ -[CompareMessagingServices]: https://learn.microsoft.com/azure/event-grid/compare-messaging-services -[StackOverflowAtLeastOnce]: https://stackoverflow.com/questions/33220685/does-azure-event-hub-guarantees-at-least-once-delivery/33577018#33577018 +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Feventhubs%2Fazure-messaging-eventhubs%2FTROUBLESHOOTING.png) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/docs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/docs/pom.xml index 542f07ba9358..5a7098a18c88 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/docs/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs/docs/pom.xml @@ -20,7 +20,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.17.0-beta.2 + 1.18.0-beta.1 io.projectreactor diff --git a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml index 01dfd5c9a12a..da97c51b4d44 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml @@ -14,7 +14,7 @@ com.azure azure-messaging-eventhubs - 5.16.0-beta.2 + 5.17.0-beta.1 Microsoft Azure client library for Event Hubs Libraries built on Microsoft Azure Event Hubs diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionPumpManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionPumpManager.java index b09c052d8963..909265f49799 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionPumpManager.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionPumpManager.java @@ -217,9 +217,16 @@ void startPartitionPump(PartitionOwnership claimedOwnership, Checkpoint checkpoi /* EventHubConsumer receive() returned an error */ ex -> handleError(claimedOwnership, partitionPump, partitionProcessor, ex, partitionContext), () -> { - partitionProcessor.close(new CloseContext(partitionContext, - CloseReason.EVENT_PROCESSOR_SHUTDOWN)); - cleanup(claimedOwnership, partitionPump); + try { + partitionProcessor.close(new CloseContext(partitionContext, + CloseReason.EVENT_PROCESSOR_SHUTDOWN)); + } catch (Throwable e) { + LOGGER.atError() + .addKeyValue(PARTITION_ID_KEY, partitionContext.getPartitionId()) + .log("Error occurred calling partitionProcessor.close when closing partition pump.", e); + } finally { + cleanup(claimedOwnership, partitionPump); + } }); //@formatter:on } catch (Exception ex) { @@ -366,13 +373,29 @@ private void handleError(PartitionOwnership claimedOwnership, PartitionPump part .addKeyValue(PARTITION_ID_KEY, partitionContext.getPartitionId()) .log("Error receiving events from partition.", throwable); - partitionProcessor.processError(new ErrorContext(partitionContext, throwable)); + try { + partitionProcessor.processError(new ErrorContext(partitionContext, throwable)); + } catch (Throwable e) { + LOGGER.atError() + .addKeyValue(PARTITION_ID_KEY, partitionContext.getPartitionId()) + .log("Error occurred calling partitionProcessor.processError.", e); + } } + // If there was an error on receive, it also marks the end of the event data stream // Any exception while receiving events will result in the processor losing ownership CloseReason closeReason = CloseReason.LOST_PARTITION_OWNERSHIP; - partitionProcessor.close(new CloseContext(partitionContext, closeReason)); + + try { + partitionProcessor.close(new CloseContext(partitionContext, closeReason)); + } catch (Throwable e) { + LOGGER.atError() + .addKeyValue(PARTITION_ID_KEY, partitionContext.getPartitionId()) + .log("Error occurred calling partitionProcessor.close.", e); + } + cleanup(claimedOwnership, partitionPump); + if (shouldRethrow) { PartitionProcessorException exception = (PartitionProcessorException) throwable; throw LOGGER.logExceptionAsError(exception); @@ -387,9 +410,6 @@ private void cleanup(PartitionOwnership claimedOwnership, PartitionPump partitio partitionPump.close(); } finally { - // finally, remove the partition from partitionPumps map - LOGGER.atInfo().addKeyValue(PARTITION_ID_KEY, claimedOwnership.getPartitionId()) - .log("Removing partition from list of processing partitions."); partitionPumps.remove(claimedOwnership.getPartitionId()); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java index 48acee2eab34..f16bb5222191 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java @@ -75,7 +75,8 @@ public void sendSmallEventsFullBatch() { // Act & Assert StepVerifier.create(producer.send(batch.getEvents())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -97,7 +98,8 @@ public void sendSmallEventsFullBatchPartitionKey() { // Act & Assert StepVerifier.create(producer.send(batch.getEvents())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -192,7 +194,8 @@ public void sendEventsFullBatchWithPartitionKey() { // Act & Assert Assertions.assertEquals(count, batch.getCount()); StepVerifier.create(producer.send(batch.getEvents(), sendOptions)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } private static EventData createData() { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java index a2215e28443f..0762a8b41532 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java @@ -72,7 +72,7 @@ void receiveMessage(AmqpTransportType transportType) { .take(NUMBER_OF_EVENTS)) .expectNextCount(NUMBER_OF_EVENTS) .expectComplete() - .verify(); + .verify(TIMEOUT); } /** @@ -152,16 +152,16 @@ public void sendAndReceiveEventByAzureNameKeyCredential() { final EventData testData = new EventData(TEST_CONTENTS.getBytes(UTF_8)); EventHubProducerAsyncClient asyncProducerClient = toClose(new EventHubClientBuilder() - .credential(fullyQualifiedNamespace, eventHubName, - new AzureNamedKeyCredential(sharedAccessKeyName, sharedAccessKey)) - .buildAsyncProducerClient()); - - StepVerifier.create( - asyncProducerClient.createBatch().flatMap(batch -> { - assertTrue(batch.tryAdd(testData)); - return asyncProducerClient.send(batch); - }) - ).verifyComplete(); + .credential(fullyQualifiedNamespace, eventHubName, + new AzureNamedKeyCredential(sharedAccessKeyName, sharedAccessKey)) + .buildAsyncProducerClient()); + + StepVerifier.create(asyncProducerClient.createBatch().flatMap(batch -> { + assertTrue(batch.tryAdd(testData)); + return asyncProducerClient.send(batch); + })) + .expectComplete() + .verify(TIMEOUT); } @Test @@ -181,11 +181,11 @@ public void sendAndReceiveEventByAzureSasCredential() { new AzureSasCredential(sharedAccessSignature)) .buildAsyncProducerClient()); - StepVerifier.create( - asyncProducerClient.createBatch().flatMap(batch -> { - assertTrue(batch.tryAdd(testData)); - return asyncProducerClient.send(batch); - }) - ).verifyComplete(); + StepVerifier.create(asyncProducerClient.createBatch().flatMap(batch -> { + assertTrue(batch.tryAdd(testData)); + return asyncProducerClient.send(batch); + })) + .expectComplete() + .verify(TIMEOUT); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java index 5e09711935df..996c15bcfa69 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java @@ -62,7 +62,9 @@ public void getEventHubProperties() { Assertions.assertNotNull(properties); Assertions.assertEquals(eventHubName, properties.getName()); Assertions.assertEquals(expectedPartitionIds.size(), properties.getPartitionIds().stream().count()); - }).verifyComplete(); + }) + .expectComplete() + .verify(TIMEOUT); } /** @@ -73,7 +75,8 @@ public void getPartitionIds() { // Act & Assert StepVerifier.create(client.getPartitionIds()) .expectNextCount(expectedPartitionIds.size()) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -88,7 +91,8 @@ public void getPartitionProperties() { Assertions.assertEquals(eventHubName, properties.getEventHubName()); Assertions.assertEquals(partitionId, properties.getId()); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } } @@ -110,7 +114,8 @@ public void getPartitionPropertiesMultipleCalls() { .assertNext(properties -> Assertions.assertEquals(eventHubName, properties.getEventHubName())) .assertNext(properties -> Assertions.assertEquals(eventHubName, properties.getEventHubName())) .assertNext(properties -> Assertions.assertEquals(eventHubName, properties.getEventHubName())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -136,7 +141,7 @@ public void getPartitionPropertiesInvalidToken() { Assertions.assertFalse(exception.isTransient()); Assertions.assertFalse(CoreUtils.isNullOrEmpty(exception.getMessage())); }) - .verify(); + .verify(TIMEOUT); } } @@ -163,7 +168,7 @@ public void getPartitionPropertiesNonExistentHub() { Assertions.assertFalse(exception.isTransient()); Assertions.assertFalse(CoreUtils.isNullOrEmpty(exception.getMessage())); }) - .verify(); + .verify(TIMEOUT); } } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java index 9b8e2231fe26..7dba83ae843e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientIntegrationTest.java @@ -145,7 +145,8 @@ public void lastEnqueuedInformationIsNotUpdated() { .assertNext(event -> Assertions.assertNull(event.getLastEnqueuedEventProperties(), "'lastEnqueuedEventProperties' should be null.")) .expectNextCount(expectedNumber - 1) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } finally { isActive.set(false); } @@ -183,7 +184,8 @@ public void lastEnqueuedInformationIsUpdated() { .assertNext(event -> verifyLastRetrieved(lastViewed, event.getLastEnqueuedEventProperties(), false)) .assertNext(event -> verifyLastRetrieved(lastViewed, event.getLastEnqueuedEventProperties(), false)) .assertNext(event -> verifyLastRetrieved(lastViewed, event.getLastEnqueuedEventProperties(), false)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } finally { isActive.set(false); } @@ -297,7 +299,9 @@ public void getEventHubProperties() { Assertions.assertNotNull(properties); Assertions.assertEquals(consumer.getEventHubName(), properties.getName()); Assertions.assertEquals(NUMBER_OF_PARTITIONS, properties.getPartitionIds().stream().count()); - }).verifyComplete(); + }) + .expectComplete() + .verify(TIMEOUT); } /** @@ -312,7 +316,8 @@ public void getPartitionIds() { // Act & Assert StepVerifier.create(consumer.getPartitionIds()) .expectNextCount(NUMBER_OF_PARTITIONS) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -331,7 +336,8 @@ public void getPartitionProperties() { Assertions.assertEquals(consumer.getEventHubName(), properties.getEventHubName()); Assertions.assertEquals(partitionId, properties.getId()); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } } @@ -380,7 +386,8 @@ public void canReceive() { .assertNext(event -> verifyLastRetrieved(lastViewed, event.getLastEnqueuedEventProperties(), false)) .assertNext(event -> verifyLastRetrieved(lastViewed, event.getLastEnqueuedEventProperties(), false)) .assertNext(event -> verifyLastRetrieved(lastViewed, event.getLastEnqueuedEventProperties(), false)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } finally { isActive.set(false); } @@ -571,7 +578,7 @@ void canReceiveWithBackpressure() { .expectNextCount(backpressure) .thenAwait(Duration.ofSeconds(5)) .thenCancel() - .verify(); + .verify(TIMEOUT); } finally { isActive.set(false); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java index 83acf0b97e0a..1766d1de17c9 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerAsyncClientTest.java @@ -18,8 +18,8 @@ import com.azure.core.util.ClientOptions; import com.azure.core.util.Configuration; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.metrics.Meter; import com.azure.core.util.tracing.SpanKind; import com.azure.core.util.tracing.StartSpanOptions; import com.azure.core.util.tracing.Tracer; @@ -35,10 +35,8 @@ import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.engine.SslDomain; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; @@ -61,7 +59,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.UUID; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -108,13 +105,13 @@ class EventHubConsumerAsyncClientTest { private static final String CONSUMER_GROUP = "consumer-group-test"; private static final String PARTITION_ID = "a-partition-id"; private static final String CLIENT_IDENTIFIER = "my-client-identifier"; - private static final Meter DEFAULT_METER = null; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private static final ClientLogger LOGGER = new ClientLogger(EventHubConsumerAsyncClientTest.class); private static final EventHubsConsumerInstrumentation DEFAULT_INSTRUMENTATION = new EventHubsConsumerInstrumentation(null, null, HOSTNAME, EVENT_HUB_NAME, CONSUMER_GROUP, false); private final AmqpRetryOptions retryOptions = new AmqpRetryOptions().setMaxRetries(2); - private final String messageTrackingUUID = UUID.randomUUID().toString(); + private final String messageTrackingUUID = CoreUtils.randomUuid().toString(); private final TestPublisher endpointProcessor = TestPublisher.createCold(); private final TestPublisher messageProcessor = TestPublisher.createCold(); private final Scheduler testScheduler = Schedulers.newSingle("eh-test"); @@ -133,16 +130,6 @@ class EventHubConsumerAsyncClientTest { private EventHubConnectionProcessor connectionProcessor; private AutoCloseable mockCloseable; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup() { mockCloseable = MockitoAnnotations.openMocks(this); @@ -207,7 +194,8 @@ void lastEnqueuedEventInformationIsNull() { .assertNext(event -> Assertions.assertNull(event.getLastEnqueuedEventProperties())) .assertNext(event -> Assertions.assertNull(event.getLastEnqueuedEventProperties())) .assertNext(event -> Assertions.assertNull(event.getLastEnqueuedEventProperties())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verifyNoInteractions(onClientClosed); } @@ -237,7 +225,8 @@ void lastEnqueuedEventInformationCreated() { Assertions.assertNull(properties.getRetrievalTime()); Assertions.assertNull(properties.getEnqueuedTime()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verifyNoInteractions(onClientClosed); } @@ -256,7 +245,8 @@ void receivesNumberOfEvents() { StepVerifier.create(consumer.receiveFromPartition(PARTITION_ID, EventPosition.earliest()).take(numberOfEvents)) .then(() -> sendMessages(messageProcessor, numberOfEvents, PARTITION_ID)) .expectNextCount(numberOfEvents) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(amqpReceiveLink, times(1)).addCredits(PREFETCH); } @@ -341,12 +331,14 @@ void returnsNewListener() { StepVerifier.create(asyncClient.receiveFromPartition(PARTITION_ID, EventPosition.earliest()).take(numberOfEvents)) .then(() -> sendMessages(processor2, numberOfEvents, PARTITION_ID)) .expectNextCount(numberOfEvents) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(asyncClient.receiveFromPartition(PARTITION_ID, EventPosition.earliest()).take(numberOfEvents)) .then(() -> sendMessages(processor3, numberOfEvents, PARTITION_ID)) .expectNextCount(numberOfEvents) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // After the initial prefetch, when we subscribe, and when we do, it'll ask for Long.MAXVALUE, which will set // the limit request to MAXIMUM_REQUEST = 100. @@ -760,7 +752,8 @@ void receiveReportsMetrics() { assertAttributes(EVENT_HUB_NAME, e.getPartitionContext().getPartitionId(), last.getAttributes()); return true; }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertEquals(numberOfEvents, meter.getHistograms().get("messaging.eventhubs.consumer.lag").getMeasurements().size()); } @@ -795,7 +788,8 @@ void receiveReportsMetricsNegativeLag() { assertEquals(0, last.getValue()); assertAttributes(EVENT_HUB_NAME, e.getPartitionContext().getPartitionId(), last.getAttributes()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertEquals(1, meter.getHistograms().get("messaging.eventhubs.consumer.lag").getMeasurements().size()); } @@ -820,7 +814,8 @@ void receiveDoesNotReportDisabledMetrics() { sendMessages(messageProcessor, 1, PARTITION_ID); StepVerifier.create(receive) .expectNextCount(1) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertFalse(meter.getHistograms().containsKey("messaging.eventhubs.consumer.lag")); } @@ -841,7 +836,8 @@ void receiveNullMeterDoesNotThrow() { sendMessages(messageProcessor, 1, PARTITION_ID); StepVerifier.create(receive) .expectNextCount(1) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -884,11 +880,13 @@ void startSpanForGetProperties() { // Act StepVerifier.create(consumer.getEventHubProperties()) .consumeNextWith(p -> assertSame(ehProperties, p)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(consumer.getPartitionProperties("0")) .consumeNextWith(p -> assertSame(partitionProperties, p)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); //Assert verify(tracer1, times(1)) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPartitionAsyncConsumerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPartitionAsyncConsumerTest.java index 38205232fa92..2c0721e21f55 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPartitionAsyncConsumerTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPartitionAsyncConsumerTest.java @@ -19,10 +19,8 @@ import com.azure.messaging.eventhubs.models.LastEnqueuedEventProperties; import com.azure.messaging.eventhubs.models.PartitionContext; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -64,6 +62,7 @@ class EventHubPartitionAsyncConsumerTest { private static final ClientLogger LOGGER = new ClientLogger(EventHubPartitionAsyncConsumerTest.class); private static final EventHubsConsumerInstrumentation DEFAULT_INSTRUMENTATION = new EventHubsConsumerInstrumentation(null, null, HOSTNAME, EVENT_HUB_NAME, CONSUMER_GROUP, false); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); @Mock private AmqpReceiveLink link1; @Mock @@ -90,16 +89,6 @@ class EventHubPartitionAsyncConsumerTest { private AmqpReceiveLinkProcessor linkProcessor; private EventHubPartitionAsyncConsumer consumer; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup() { MockitoAnnotations.initMocks(this); @@ -168,7 +157,7 @@ void receivesMessages(boolean trackLastEnqueuedProperties) { Assertions.assertSame(event2, partitionEvent.getData()); }) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); Assertions.assertTrue(linkProcessor.isTerminated()); Assertions.assertSame(originalPosition, currentPosition.get().get()); @@ -220,7 +209,7 @@ void receiveMultipleTimes() { Assertions.assertSame(event2, partitionEvent.getData()); }) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); // Assert that we have the current offset. final EventPosition firstPosition = currentPosition.get().get(); @@ -230,7 +219,7 @@ void receiveMultipleTimes() { StepVerifier.create(consumer.receive()) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); consumer.close(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientIntegrationTest.java index 4540262d1588..51cca7289add 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientIntegrationTest.java @@ -58,7 +58,8 @@ void sendMessageToPartition() { // Act & Assert StepVerifier.create(producer.send(events, sendOptions)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -75,7 +76,8 @@ void sendMessage() { // Act & Assert StepVerifier.create(producer.send(events)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -97,7 +99,8 @@ void sendBatch() { // Act & Assert StepVerifier.create(createBatch.flatMap(batch -> producer.send(batch))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -123,7 +126,8 @@ void sendBatchWithPartitionKey() { // Act & Assert StepVerifier.create(createBatch.flatMap(batch -> producer.send(batch))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -146,7 +150,8 @@ void sendEventsWithKeyAndPartition() { // Assert StepVerifier.create(onComplete) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } @Test diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientTest.java index 10fbbf30988b..447b433a478e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerAsyncClientTest.java @@ -41,10 +41,8 @@ import org.apache.qpid.proton.amqp.messaging.Section; import org.apache.qpid.proton.engine.SslDomain; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -114,6 +112,7 @@ class EventHubProducerAsyncClientTest { .get("AZURE_EVENTHUBS_ENDPOINT_SUFFIX", ".servicebus.windows.net"); private static final ClientLogger LOGGER = new ClientLogger(EventHubProducerAsyncClient.class); private static final EventHubsProducerInstrumentation DEFAULT_INSTRUMENTATION = new EventHubsProducerInstrumentation(null, null, HOSTNAME, EVENT_HUB_NAME); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); @Mock private AmqpSendLink sendLink; @Mock @@ -149,16 +148,6 @@ class EventHubProducerAsyncClientTest { private ConnectionOptions connectionOptions; private final Scheduler testScheduler = Schedulers.newBoundedElastic(10, 10, "test"); - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup(TestInfo testInfo) { MockitoAnnotations.initMocks(this); @@ -216,7 +205,8 @@ void sendMultipleMessages() { // Act StepVerifier.create(producer.send(testData, options)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink).send(messagesCaptor.capture()); @@ -244,7 +234,8 @@ void sendSingleMessage() { // Act StepVerifier.create(producer.send(testData, options)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink, times(1)).send(any(Message.class)); @@ -383,7 +374,8 @@ void sendStartSpanSingleMessage() { // Act StepVerifier.create(asyncProducer.send(testData, sendOptions)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); //Assert verify(tracer1, times(1)) @@ -438,7 +430,8 @@ void sendSingleWithUnmodifiableProperties() { // Act StepVerifier.create(asyncProducer.send(testData)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); //Assert verify(tracer1, times(1)) @@ -490,11 +483,13 @@ void startSpanForGetProperties() { // Act StepVerifier.create(asyncProducer.getEventHubProperties()) .consumeNextWith(p -> assertSame(ehProperties, p)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(asyncProducer.getPartitionProperties("0")) .consumeNextWith(p -> assertSame(partitionProperties, p)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); //Assert verify(tracer1, times(1)) @@ -589,8 +584,9 @@ void sendTooManyMessages() { // Act & Assert StepVerifier.create(producer.send(testData)) - .verifyErrorMatches(error -> error instanceof AmqpException - && ((AmqpException) error).getErrorCondition() == AmqpErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED); + .expectErrorMatches(error -> error instanceof AmqpException + && ((AmqpException) error).getErrorCondition() == AmqpErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED) + .verify(DEFAULT_TIMEOUT); verify(link, times(0)).send(any(Message.class)); } @@ -627,14 +623,16 @@ void createsEventDataBatch() { Assertions.assertNull(batch.getPartitionKey()); Assertions.assertTrue(batch.tryAdd(event)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(producer.createBatch()) .assertNext(batch -> { Assertions.assertNull(batch.getPartitionKey()); Assertions.assertFalse(batch.tryAdd(tooLargeEvent)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(link, times(2)).getLinkSize(); } @@ -703,7 +701,8 @@ void startMessageSpansOnCreateBatch() { assertEquals("1", data1.getProperties().get(DIAGNOSTIC_ID_KEY)); return asyncProducer.send(batch); })) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(tracer1, times(2)) .start(eq("EventHubs.message"), any(), any(Context.class)); @@ -743,7 +742,8 @@ void createsEventDataBatchWithPartitionKey() { Assertions.assertEquals(options.getPartitionKey(), batch.getPartitionKey()); Assertions.assertTrue(batch.tryAdd(event)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -768,7 +768,7 @@ void createEventDataBatchWhenMaxSizeIsTooBig() { // Act & Assert StepVerifier.create(producer.createBatch(options)) .expectError(IllegalArgumentException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -806,14 +806,16 @@ void createsEventDataBatchWithSize() { Assertions.assertNull(batch.getPartitionKey()); Assertions.assertTrue(batch.tryAdd(event)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(producer.createBatch(options)) .assertNext(batch -> { Assertions.assertNull(batch.getPartitionKey()); Assertions.assertFalse(batch.tryAdd(tooLargeEvent)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -823,10 +825,12 @@ void sendEventRequired() { final SendOptions sendOptions = new SendOptions(); StepVerifier.create(producer.send(event, null)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(DEFAULT_TIMEOUT); StepVerifier.create(producer.send((EventData) null, sendOptions)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(DEFAULT_TIMEOUT); } @Test @@ -836,10 +840,12 @@ void sendEventIterableRequired() { final SendOptions sendOptions = new SendOptions(); StepVerifier.create(producer.send(event, null)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(DEFAULT_TIMEOUT); StepVerifier.create(producer.send((Iterable) null, sendOptions)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(DEFAULT_TIMEOUT); } @Test @@ -849,10 +855,12 @@ void sendEventFluxRequired() { final SendOptions sendOptions = new SendOptions(); StepVerifier.create(producer.send(event, null)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(DEFAULT_TIMEOUT); StepVerifier.create(producer.send((Flux) null, sendOptions)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(DEFAULT_TIMEOUT); } @Test @@ -876,7 +884,8 @@ void batchOptionsIsCloned() { options.setPartitionKey("something-else"); Assertions.assertEquals(originalKey, batch.getPartitionKey()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -907,14 +916,16 @@ void sendsAnEventDataBatch() { Assertions.assertNull(batch.getPartitionKey()); Assertions.assertTrue(batch.tryAdd(event)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(producer.createBatch()) .assertNext(batch -> { Assertions.assertNull(batch.getPartitionKey()); Assertions.assertFalse(batch.tryAdd(tooLargeEvent)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(link, times(2)).getLinkSize(); } @@ -958,7 +969,8 @@ void sendsAnEventDataBatchWithMetrics() { batch.tryAdd(new EventData("3")); return producer2.send(batch); }))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); TestCounter eventCounter = meter.getCounters().get("messaging.eventhubs.events.sent"); assertNotNull(eventCounter); @@ -990,7 +1002,7 @@ void sendsAnEventDataBatchWithMetricsFailure() { StepVerifier.create(producer.send(new EventData("1"))) .expectErrorMessage("foo") - .verify(); + .verify(DEFAULT_TIMEOUT); TestCounter eventCounter = meter.getCounters().get("messaging.eventhubs.events.sent"); assertNotNull(eventCounter); @@ -1020,7 +1032,8 @@ void sendsAnEventDataBatchWithMetricsPartitionId() { SendOptions options = new SendOptions().setPartitionId(partitionId); StepVerifier.create(producer.send(new EventData("1"), options)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); TestCounter eventCounter = meter.getCounters().get("messaging.eventhubs.events.sent"); assertNotNull(eventCounter); @@ -1073,7 +1086,8 @@ void sendsAnEventDataBatchWithMetricsAndTraces() { }).when(tracer).injectContext(any(), any(Context.class)); StepVerifier.create(producer.send(new EventData("1"))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); TestCounter eventCounter = meter.getCounters().get("messaging.eventhubs.events.sent"); assertNotNull(eventCounter); @@ -1102,7 +1116,8 @@ void sendsAnEventDataBatchWithDisabledMetrics() { connectionProcessor, retryOptions, messageSerializer, testScheduler, false, onClientClosed, CLIENT_IDENTIFIER, instrumentation); StepVerifier.create(producer.send(new EventData("1"))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertFalse(meter.getCounters().containsKey("messaging.eventhubs.events.sent")); } @@ -1120,7 +1135,8 @@ void sendsAnEventDataBatchWithNullMeterDoesNotThrow() { connectionProcessor, retryOptions, messageSerializer, testScheduler, false, onClientClosed, CLIENT_IDENTIFIER, DEFAULT_INSTRUMENTATION); StepVerifier.create(producer.send(new EventData("1"))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -1162,13 +1178,16 @@ void sendMultiplePartitions() { // Act StepVerifier.create(producer.send(testData, new SendOptions())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(producer.send(testData, new SendOptions().setPartitionId(partitionId1))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(producer.send(testData, new SendOptions().setPartitionId(partitionId2))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink).send(messagesCaptor.capture()); @@ -1292,14 +1311,16 @@ void reopensOnFailure() { // Act StepVerifier.create(producer.send(testData)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Send in an error signal like a server busy condition. endpointSink.error(new AmqpException(true, AmqpErrorCondition.SERVER_BUSY_ERROR, "Test-message", new AmqpErrorContext("test-namespace"))); StepVerifier.create(producer.send(testData2)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink).send(messagesCaptor.capture()); @@ -1364,7 +1385,8 @@ void closesOnNonTransientFailure() { // Act StepVerifier.create(producer.send(testData)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Send in an error signal like authorization failure. endpointSink.error(nonTransientError); @@ -1434,15 +1456,14 @@ void resendMessageOnTransientLinkFailure() { // Send a transient error, and close the original link, if we get a message that contains the "failureKey". // This simulates when a link is closed. - when(sendLink.send(argThat((Message message) -> { - return message.getApplicationProperties().getValue().containsKey(failureKey); - }))).thenAnswer(mock -> { - final Throwable error = new AmqpException(true, AmqpErrorCondition.SERVER_BUSY_ERROR, "Test-message", - new AmqpErrorContext("test-namespace")); - - endpointSink.error(error); - return Mono.error(error); - }); + when(sendLink.send(argThat((Message message) -> message.getApplicationProperties().getValue().containsKey(failureKey)))) + .thenAnswer(mock -> { + final Throwable error = new AmqpException(true, AmqpErrorCondition.SERVER_BUSY_ERROR, "Test-message", + new AmqpErrorContext("test-namespace")); + + endpointSink.error(error); + return Mono.error(error); + }); final DirectProcessor connectionState2 = DirectProcessor.create(); when(connection2.getEndpointStates()).thenReturn(connectionState2); @@ -1452,10 +1473,12 @@ void resendMessageOnTransientLinkFailure() { // Act StepVerifier.create(producer.send(testData)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(producer.send(testData2)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink).send(messagesCaptor.capture()); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedKeyCredentialTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedKeyCredentialTest.java index 6ea17f88d98b..2482d9333386 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedKeyCredentialTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedKeyCredentialTest.java @@ -31,7 +31,7 @@ public class EventHubSharedKeyCredentialTest { private static final String KEY_NAME = "some-key-name"; - private static final String KEY_VALUE = "ctzMq410TV3wS7upTBcunJTDLEJwMAZuFPfr0mrrA08="; + private static final String KEY_VALUE = "some-random-key="; private static final Duration TOKEN_DURATION = Duration.ofMinutes(10); private static final String ENDPOINT_SUFFIX = Configuration.getGlobalConfiguration() .get("AZURE_EVENTHUBS_ENDPOINT_SUFFIX", ".servicebus.windows.net"); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java index 4ae51b0de2df..41368ea3fe83 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java @@ -205,19 +205,21 @@ void receiveMessageFromEnqueuedTime() { // Act & Assert StepVerifier.create(consumer.receiveFromPartition(testData.getPartitionId(), position) - .map(PartitionEvent::getData) - .take(1)) - .assertNext(event -> { - logger.atInfo() - .addKeyValue("sequenceNo", event.getSequenceNumber()) - .addKeyValue("offset", event.getOffset()) - .addKeyValue("enqueued", event.getEnqueuedTime()) - .log("actual"); - - Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); - Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); - Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); - }).verifyComplete(); + .map(PartitionEvent::getData) + .take(1)) + .assertNext(event -> { + logger.atInfo() + .addKeyValue("sequenceNo", event.getSequenceNumber()) + .addKeyValue("offset", event.getOffset()) + .addKeyValue("enqueued", event.getEnqueuedTime()) + .log("actual"); + + Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); + }) + .expectComplete() + .verify(TIMEOUT); } /** @@ -233,13 +235,15 @@ void receiveMessageFromEnqueuedTimeReceivedMessage() { // Act & Assert StepVerifier.create(consumer.receiveFromPartition(testData.getPartitionId(), position) - .map(PartitionEvent::getData) - .take(1)) - .assertNext(event -> { - Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); - Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); - Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); - }).verifyComplete(); + .map(PartitionEvent::getData) + .take(1)) + .assertNext(event -> { + Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); + }) + .expectComplete() + .verify(TIMEOUT); } /** @@ -255,14 +259,16 @@ void receiveMessageFromOffsetNonInclusive() { // Act & Assert StepVerifier.create(consumer.receiveFromPartition(testData.getPartitionId(), position) - .map(PartitionEvent::getData) - .filter(event -> isMatchingEvent(event, testData.getMessageId())) - .take(1)) - .assertNext(event -> { - Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); - Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); - Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); - }).verifyComplete(); + .map(PartitionEvent::getData) + .filter(event -> isMatchingEvent(event, testData.getMessageId())) + .take(1)) + .assertNext(event -> { + Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); + }) + .expectComplete() + .verify(TIMEOUT); } /** @@ -276,14 +282,16 @@ void receiveMessageFromSequenceNumberInclusive() { // Act & Assert StepVerifier.create(consumer.receiveFromPartition(testData.getPartitionId(), position) - .map(PartitionEvent::getData) - .filter(event -> isMatchingEvent(event, testData.getMessageId())) - .take(1)) - .assertNext(event -> { - Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); - Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); - Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); - }).verifyComplete(); + .map(PartitionEvent::getData) + .filter(event -> isMatchingEvent(event, testData.getMessageId())) + .take(1)) + .assertNext(event -> { + Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); + }) + .expectComplete() + .verify(TIMEOUT); } /** @@ -297,13 +305,15 @@ void receiveMessageFromSequenceNumberNonInclusive() { // Act & Assert StepVerifier.create(consumer.receiveFromPartition(testData.getPartitionId(), position) - .map(PartitionEvent::getData) - .filter(event -> isMatchingEvent(event, testData.getMessageId())) - .take(1)) - .assertNext(event -> { - Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); - Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); - Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); - }).verifyComplete(); + .map(PartitionEvent::getData) + .filter(event -> isMatchingEvent(event, testData.getMessageId())) + .take(1)) + .assertNext(event -> { + Assertions.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assertions.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assertions.assertEquals(expectedEvent.getOffset(), event.getOffset()); + }) + .expectComplete() + .verify(TIMEOUT); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java index e1110387652c..9ede9654d77d 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/IntegrationTestBase.java @@ -27,7 +27,6 @@ import reactor.core.Disposable; import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; -import reactor.test.StepVerifier; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; @@ -89,12 +88,10 @@ protected IntegrationTestBase(ClientLogger logger) { @BeforeAll public static void beforeAll() { scheduler = Schedulers.newParallel("eh-integration"); - StepVerifier.setDefaultTimeout(TIMEOUT); } @AfterAll public static void afterAll() { - StepVerifier.resetDefaultTimeout(); scheduler.dispose(); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java index 1ed46421e14f..202b5a8de210 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java @@ -252,7 +252,7 @@ public void interoperableAmqpTypes() { // Act & Assert StepVerifier.create(producer.send(data, options)) .expectComplete() - .verify(); + .verify(TIMEOUT); StepVerifier.create(consumer.receiveFromPartition(partitionId, EventPosition.fromOffset(lastOffset))) .assertNext(partitionEvent -> { @@ -276,7 +276,7 @@ public void interoperableAmqpTypes() { } }) .thenCancel() - .verify(); + .verify(TIMEOUT); } private void validateAmqpProperties(Message message, Map messageAnnotations, diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPumpManagerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPumpManagerTest.java index 44cab996449e..02666cc52d4c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPumpManagerTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPumpManagerTest.java @@ -7,6 +7,7 @@ import com.azure.messaging.eventhubs.implementation.PartitionProcessorException; import com.azure.messaging.eventhubs.implementation.instrumentation.EventHubsTracer; import com.azure.messaging.eventhubs.models.Checkpoint; +import com.azure.messaging.eventhubs.models.CloseContext; import com.azure.messaging.eventhubs.models.ErrorContext; import com.azure.messaging.eventhubs.models.EventBatchContext; import com.azure.messaging.eventhubs.models.EventPosition; @@ -52,6 +53,7 @@ import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -88,7 +90,7 @@ public class PartitionPumpManagerTest { private AutoCloseable autoCloseable; @BeforeEach - public void beforeEach() { + public void beforeEach() throws InterruptedException { this.autoCloseable = MockitoAnnotations.openMocks(this); final Integer prefetch = 100; @@ -370,7 +372,7 @@ public void processesEventBatchWithLastEnqueued() throws InterruptedException { // Arrange final Supplier supplier = () -> partitionProcessor; final CountDownLatch receiveCounter = new CountDownLatch(3); - final boolean trackLastEnqueuedEventProperties = false; + final boolean trackLastEnqueuedEventProperties = true; final int maxBatchSize = 2; final Duration maxWaitTime = Duration.ofSeconds(1); final boolean batchReceiveMode = true; @@ -645,4 +647,267 @@ public void startPositionReturnsDefaultPosition() { // Assert assertEquals(defaultEventPosition, actual); } + + /** + * Verifies that an exception thrown from user code in {@link PartitionProcessor#processError(ErrorContext)} still + * cleans up the partition. + */ + @Test + public void processErrorCleansUpPartitionOnException() throws InterruptedException { + final Supplier supplier = () -> partitionProcessor; + final CountDownLatch receiveCounter = new CountDownLatch(3); + + final boolean trackLastEnqueuedEventProperties = false; + final int maxBatchSize = 2; + final Duration maxWaitTime = Duration.ofSeconds(1); + final boolean batchReceiveMode = true; + final EventProcessorClientOptions options = new EventProcessorClientOptions() + .setConsumerGroup("test-consumer") + .setTrackLastEnqueuedEventProperties(trackLastEnqueuedEventProperties) + .setInitialEventPositionProvider(id -> initialPartitionPositions.get(id)) + .setMaxBatchSize(maxBatchSize) + .setMaxWaitTime(maxWaitTime) + .setBatchReceiveMode(batchReceiveMode) + .setLoadBalancerUpdateInterval(Duration.ofSeconds(10)) + .setPartitionOwnershipExpirationInterval(Duration.ofMinutes(1)) + .setLoadBalancingStrategy(LoadBalancingStrategy.BALANCED); + + final PartitionPumpManager manager = new PartitionPumpManager(checkpointStore, supplier, builder, + DEFAULT_TRACER, options); + + // Mock events to add. + final EventData eventData1 = new EventData("1"); + final PartitionEvent partitionEvent1 = new PartitionEvent(PARTITION_CONTEXT, eventData1, null); + + final EventData eventData2 = new EventData("2"); + final PartitionEvent partitionEvent2 = new PartitionEvent(PARTITION_CONTEXT, eventData2, null); + + final EventData eventData3 = new EventData("3"); + final PartitionEvent partitionEvent3 = new PartitionEvent(PARTITION_CONTEXT, eventData3, null); + + final Exception testException = new IllegalStateException("Dummy exception."); + final Exception processErrorException = new NumberFormatException("Test exception in process error"); + + doAnswer(invocation -> { + final EventBatchContext batch = invocation.getArgument(0); + assertNotNull(batch.getPartitionContext()); + + if (batch.getEvents().isEmpty()) { + receiveCounter.countDown(); + } + + return null; + }).when(partitionProcessor).processEventBatch(any(EventBatchContext.class)); + + doAnswer(invocationOnMock -> { + throw processErrorException; + }).when(partitionProcessor).processError(any(ErrorContext.class)); + + try { + // Start receiving events from the partition. + manager.startPartitionPump(partitionOwnership, checkpoint); + + receivePublisher.next(partitionEvent1, partitionEvent2, partitionEvent3); + receivePublisher.error(testException); + + // We won't reach the countdown number because an exception receiving messages results in losing the + // partition. + final boolean await = receiveCounter.await(20, TimeUnit.SECONDS); + assertFalse(await); + + // Verify + // We called the user processError + verify(partitionProcessor).processError(argThat(error -> testException.equals(error.getThrowable()))); + + // The window is 2 events, we publish 3 events before throwing an error, it should only have been called + // at most 1 time. + verify(partitionProcessor, atMost(1)) + .processEventBatch(argThat(context -> !context.getEvents().isEmpty())); + + // Assert that we cleaned up the code. + assertFalse(manager.getPartitionPumps().containsKey(PARTITION_ID)); + verify(consumerAsyncClient).close(); + + } finally { + manager.stopAllPartitionPumps(); + } + } + + /** + * Verifies that an exception thrown from user code in {@link PartitionProcessor#close(CloseContext)} when handling + * an error, still cleans up the partition processor. + */ + @Test + public void closeOnErrorCleansUpPartitionOnException() throws InterruptedException { + final Supplier supplier = () -> partitionProcessor; + final CountDownLatch receiveCounter = new CountDownLatch(3); + final Duration updateInterval = Duration.ofSeconds(10); + + final boolean trackLastEnqueuedEventProperties = false; + final int maxBatchSize = 2; + final Duration maxWaitTime = Duration.ofSeconds(1); + final boolean batchReceiveMode = true; + final EventProcessorClientOptions options = new EventProcessorClientOptions() + .setConsumerGroup("test-consumer") + .setTrackLastEnqueuedEventProperties(trackLastEnqueuedEventProperties) + .setInitialEventPositionProvider(id -> initialPartitionPositions.get(id)) + .setMaxBatchSize(maxBatchSize) + .setMaxWaitTime(maxWaitTime) + .setBatchReceiveMode(batchReceiveMode) + .setLoadBalancerUpdateInterval(updateInterval) + .setPartitionOwnershipExpirationInterval(Duration.ofMinutes(1)) + .setLoadBalancingStrategy(LoadBalancingStrategy.BALANCED); + + final PartitionPumpManager manager = new PartitionPumpManager(checkpointStore, supplier, builder, + DEFAULT_TRACER, options); + + // Mock events to add. + final EventData eventData1 = new EventData("1"); + final PartitionEvent partitionEvent1 = new PartitionEvent(PARTITION_CONTEXT, eventData1, null); + + final EventData eventData2 = new EventData("2"); + final PartitionEvent partitionEvent2 = new PartitionEvent(PARTITION_CONTEXT, eventData2, null); + + final EventData eventData3 = new EventData("3"); + final PartitionEvent partitionEvent3 = new PartitionEvent(PARTITION_CONTEXT, eventData3, null); + + final Exception testException = new IllegalStateException("Dummy exception."); + final Exception processCloseException = new NumberFormatException("Test exception in process error"); + + doAnswer(invocation -> { + final EventBatchContext batch = invocation.getArgument(0); + assertNotNull(batch.getPartitionContext()); + + if (batch.getEvents().isEmpty()) { + receiveCounter.countDown(); + } + + return null; + }).when(partitionProcessor).processEventBatch(any(EventBatchContext.class)); + + doAnswer(invocationOnMock -> { + throw processCloseException; + }).when(partitionProcessor).close(any(CloseContext.class)); + + try { + // Start receiving events from the partition. + manager.startPartitionPump(partitionOwnership, checkpoint); + + receivePublisher.next(partitionEvent1, partitionEvent2, partitionEvent3); + receivePublisher.error(testException); + + // We won't reach the countdown number because an exception receiving messages results in losing the + // partition. + final boolean await = receiveCounter.await(20, TimeUnit.SECONDS); + assertFalse(await); + + // Verify + // The window is 2 events, we publish 3 events before throwing an error, it should only have been called + // at most 1 time. + verify(partitionProcessor, atMost(1)) + .processEventBatch(argThat(context -> !context.getEvents().isEmpty())); + + // We called the user processError + verify(partitionProcessor).processError(argThat(error -> testException.equals(error.getThrowable()))); + + // We called the user close + verify(partitionProcessor).close(argThat(closeContext -> closeContext.getPartitionContext() != null + && PARTITION_ID.equals(closeContext.getPartitionContext().getPartitionId()))); + + // Assert that we cleaned up the code. + assertFalse(manager.getPartitionPumps().containsKey(PARTITION_ID)); + verify(consumerAsyncClient).close(); + + } finally { + manager.stopAllPartitionPumps(); + } + } + + /** + * Verifies that an exception thrown from user code in {@link PartitionProcessor#close(CloseContext)} when handling + * a normal close operation. + */ + @Test + public void closeCleansUpPartitionOnException() throws InterruptedException { + final Supplier supplier = () -> partitionProcessor; + final CountDownLatch receiveCounter = new CountDownLatch(3); + final Duration updateInterval = Duration.ofSeconds(10); + + final boolean trackLastEnqueuedEventProperties = false; + final int maxBatchSize = 2; + final Duration maxWaitTime = Duration.ofSeconds(1); + final boolean batchReceiveMode = true; + final EventProcessorClientOptions options = new EventProcessorClientOptions() + .setConsumerGroup("test-consumer") + .setTrackLastEnqueuedEventProperties(trackLastEnqueuedEventProperties) + .setInitialEventPositionProvider(id -> initialPartitionPositions.get(id)) + .setMaxBatchSize(maxBatchSize) + .setMaxWaitTime(maxWaitTime) + .setBatchReceiveMode(batchReceiveMode) + .setLoadBalancerUpdateInterval(updateInterval) + .setPartitionOwnershipExpirationInterval(Duration.ofMinutes(1)) + .setLoadBalancingStrategy(LoadBalancingStrategy.BALANCED); + + final PartitionPumpManager manager = new PartitionPumpManager(checkpointStore, supplier, builder, + DEFAULT_TRACER, options); + + // Mock events to add. + final EventData eventData1 = new EventData("1"); + final PartitionEvent partitionEvent1 = new PartitionEvent(PARTITION_CONTEXT, eventData1, null); + + final EventData eventData2 = new EventData("2"); + final PartitionEvent partitionEvent2 = new PartitionEvent(PARTITION_CONTEXT, eventData2, null); + + final EventData eventData3 = new EventData("3"); + final PartitionEvent partitionEvent3 = new PartitionEvent(PARTITION_CONTEXT, eventData3, null); + + final Exception processCloseException = new NumberFormatException("Test exception in process error"); + + doAnswer(invocation -> { + final EventBatchContext batch = invocation.getArgument(0); + assertNotNull(batch.getPartitionContext()); + + if (batch.getEvents().isEmpty()) { + receiveCounter.countDown(); + } + + return null; + }).when(partitionProcessor).processEventBatch(any(EventBatchContext.class)); + + doAnswer(invocationOnMock -> { + throw processCloseException; + }).when(partitionProcessor).close(any(CloseContext.class)); + + try { + // Start receiving events from the partition. + manager.startPartitionPump(partitionOwnership, checkpoint); + + receivePublisher.next(partitionEvent1, partitionEvent2, partitionEvent3); + receivePublisher.complete(); + + // We won't reach the countdown number because an exception receiving messages results in losing the + // partition. + final boolean await = receiveCounter.await(20, TimeUnit.SECONDS); + assertFalse(await); + + // Verify + // The window is 2 events, we publish 3 events before completing. We expect the last window emits on close. + verify(partitionProcessor, times(2)) + .processEventBatch(argThat(context -> !context.getEvents().isEmpty())); + + // We called the user processError + verify(partitionProcessor, never()).processError(any()); + + // We called the user close + verify(partitionProcessor).close(argThat(closeContext -> closeContext.getPartitionContext() != null + && PARTITION_ID.equals(closeContext.getPartitionContext().getPartitionId()))); + + // Assert that we cleaned up the code. + assertFalse(manager.getPartitionPumps().containsKey(PARTITION_ID)); + verify(consumerAsyncClient).close(); + + } finally { + manager.stopAllPartitionPumps(); + } + } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxyReceiveTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxyReceiveTest.java index 13dfa636bfe2..e062291378f7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxyReceiveTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxyReceiveTest.java @@ -20,7 +20,6 @@ import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; -import java.time.Duration; import java.util.ArrayList; import java.util.List; @@ -40,8 +39,6 @@ public ProxyReceiveTest() { @BeforeAll public static void setup() throws IOException { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - proxyServer = new SimpleProxy(PROXY_PORT); proxyServer.start(null); @@ -69,7 +66,6 @@ public static void cleanup() throws Exception { } } finally { ProxySelector.setDefault(defaultProxySelector); - StepVerifier.resetDefaultTimeout(); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySelectorTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySelectorTest.java index 16bf69785460..9562eac39f4e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySelectorTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySelectorTest.java @@ -75,7 +75,7 @@ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { // This is a transient error from ExceptionUtil.java: line 67. System.out.println("Error: " + error); }) - .verify(); + .verify(TIMEOUT); final boolean awaited = countDownLatch.await(2, TimeUnit.SECONDS); Assertions.assertTrue(awaited); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySendTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySendTest.java index 085970c45858..7dda1af2e898 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySendTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/ProxySendTest.java @@ -21,7 +21,6 @@ import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; -import java.time.Duration; import java.util.Collections; import java.util.List; import java.util.UUID; @@ -49,8 +48,6 @@ class ProxySendTest extends IntegrationTestBase { @BeforeAll static void initialize() throws Exception { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - proxyServer = new SimpleProxy(PROXY_PORT); proxyServer.start(t -> LOGGER.error("Starting proxy server failed.", t)); @@ -77,7 +74,6 @@ static void cleanupClient() throws IOException { } } finally { ProxySelector.setDefault(defaultProxySelector); - StepVerifier.resetDefaultTimeout(); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java index b16408d142ab..97d71427ae91 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java @@ -116,6 +116,7 @@ public void setSmallPrefetchCount() { .filter(x -> isMatchingEvent(x, testData.getMessageId())) .take(eventCount)) .expectNextCount(eventCount) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TracingIntegrationTests.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TracingIntegrationTests.java index 039496fbb33d..31b824eb4b2d 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TracingIntegrationTests.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TracingIntegrationTests.java @@ -67,6 +67,7 @@ public class TracingIntegrationTests extends IntegrationTestBase { private static final byte[] CONTENTS_BYTES = "Some-contents".getBytes(StandardCharsets.UTF_8); private static final String PARTITION_ID = "0"; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private TestSpanProcessor spanProcessor; private EventHubProducerAsyncClient producer; private EventHubConsumerAsyncClient consumer; @@ -82,7 +83,6 @@ public TracingIntegrationTests() { @Override protected void beforeTest() { GlobalOpenTelemetry.resetForTest(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); spanProcessor = toClose(new TestSpanProcessor(getFullyQualifiedDomainName(), getEventHubName(), testName)); OpenTelemetrySdk.builder() @@ -147,7 +147,9 @@ public void sendAndReceiveFromPartition() throws InterruptedException { } })); - StepVerifier.create(producer.send(data, new SendOptions().setPartitionId(PARTITION_ID))).verifyComplete(); + StepVerifier.create(producer.send(data, new SendOptions().setPartitionId(PARTITION_ID))) + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertTrue(latch.await(10, TimeUnit.SECONDS)); @@ -179,7 +181,9 @@ public void sendAndReceive() throws InterruptedException { } })); - StepVerifier.create(producer.send(data, new SendOptions())).verifyComplete(); + StepVerifier.create(producer.send(data, new SendOptions())) + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertTrue(latch.await(10, TimeUnit.SECONDS)); @@ -220,7 +224,9 @@ public void sendAndReceiveCustomProvider() throws InterruptedException { } })); - StepVerifier.create(producer.send(data, new SendOptions())).verifyComplete(); + StepVerifier.create(producer.send(data, new SendOptions())) + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertTrue(latch.await(10, TimeUnit.SECONDS)); @@ -257,9 +263,12 @@ public void sendAndReceiveParallel() throws InterruptedException { .parallel(messageCount, 1) .runOn(Schedulers.boundedElastic(), 2)) .expectNextCount(messageCount) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); - StepVerifier.create(producer.send(data, new SendOptions())).verifyComplete(); + StepVerifier.create(producer.send(data, new SendOptions())) + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertTrue(latch.await(20, TimeUnit.SECONDS)); List spans = spanProcessor.getEndedSpans(); @@ -300,7 +309,7 @@ public void sendBuffered() throws InterruptedException { StepVerifier.create(Mono.when( bufferedProducer.enqueueEvent(event1, sendOptions), bufferedProducer.enqueueEvent(event2, sendOptions))) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); StepVerifier.create(consumer .receiveFromPartition(sendOptions.getPartitionId(), EventPosition.fromEnqueuedTime(start)) @@ -339,7 +348,8 @@ public void syncReceive() { return b; }) .flatMap(b -> producer.send(b))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); List receivedMessages = consumerSync.receiveFromPartition(PARTITION_ID, 2, EventPosition.fromEnqueuedTime(testStartTime), Duration.ofSeconds(10)) .stream().collect(toList()); @@ -361,7 +371,8 @@ public void syncReceiveWithOptions() { return b; }) .flatMap(b -> producer.send(b))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); List receivedMessages = consumerSync.receiveFromPartition(PARTITION_ID, 2, EventPosition.fromEnqueuedTime(testStartTime), Duration.ofSeconds(10), new ReceiveOptions()) @@ -396,7 +407,9 @@ public void sendAndProcess() throws InterruptedException { CountDownLatch latch = new CountDownLatch(2); spanProcessor.notifyIfCondition(latch, span -> span == currentInProcess.get() || span.getName().equals("EventHubs.send")); - StepVerifier.create(producer.send(data, new SendOptions().setPartitionId(PARTITION_ID))).verifyComplete(); + StepVerifier.create(producer.send(data, new SendOptions().setPartitionId(PARTITION_ID))) + .expectComplete() + .verify(DEFAULT_TIMEOUT); processor = new EventProcessorClientBuilder() .connectionString(getConnectionString()) .eventHubName(getEventHubName()) @@ -446,7 +459,9 @@ public void sendNotInstrumentedAndProcess() throws InterruptedException { List received = new ArrayList<>(); CountDownLatch latch = new CountDownLatch(2); spanProcessor.notifyIfCondition(latch, span -> span.getName().equals("EventHubs.process") && !span.getParentSpanContext().isValid()); - StepVerifier.create(notInstrumentedProducer.send(Arrays.asList(message1, message2), new SendOptions().setPartitionId(PARTITION_ID))).verifyComplete(); + StepVerifier.create(notInstrumentedProducer.send(Arrays.asList(message1, message2), new SendOptions().setPartitionId(PARTITION_ID))) + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertNull(message1.getProperties().get("traceparent")); assertNull(message2.getProperties().get("traceparent")); @@ -501,7 +516,9 @@ public void sendAndProcessBatch() throws InterruptedException { AtomicReference> received = new AtomicReference<>(); CountDownLatch latch = new CountDownLatch(1); spanProcessor.notifyIfCondition(latch, span -> span == currentInProcess.get()); - StepVerifier.create(producer.send(Arrays.asList(message1, message2), new SendOptions().setPartitionId(PARTITION_ID))).verifyComplete(); + StepVerifier.create(producer.send(Arrays.asList(message1, message2), new SendOptions().setPartitionId(PARTITION_ID))) + .expectComplete() + .verify(DEFAULT_TIMEOUT); processor = new EventProcessorClientBuilder() .connectionString(getConnectionString()) @@ -551,7 +568,9 @@ public void sendProcessAndFail() throws InterruptedException { CountDownLatch latch = new CountDownLatch(2); spanProcessor.notifyIfCondition(latch, span -> span == currentInProcess.get() || span.getName().equals("EventHubs.send")); - StepVerifier.create(producer.send(data, new SendOptions().setPartitionId(PARTITION_ID))).verifyComplete(); + StepVerifier.create(producer.send(data, new SendOptions().setPartitionId(PARTITION_ID))) + .expectComplete() + .verify(DEFAULT_TIMEOUT); processor = new EventProcessorClientBuilder() .connectionString(getConnectionString()) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessorTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessorTest.java index 2efab5508d60..c731b8bea014 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessorTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLinkProcessorTest.java @@ -12,10 +12,8 @@ import com.azure.core.amqp.implementation.AmqpReceiveLink; import com.azure.messaging.eventhubs.implementation.instrumentation.EventHubsConsumerInstrumentation; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; @@ -54,6 +52,7 @@ class AmqpReceiveLinkProcessorTest { private static final int PREFETCH = 5; private static final EventHubsConsumerInstrumentation DEFAULT_INSTRUMENTATION = new EventHubsConsumerInstrumentation(null, null, "hostname", "hubname", "$Default", false); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(10); @Mock private AmqpReceiveLink link1; @@ -78,16 +77,6 @@ class AmqpReceiveLinkProcessorTest { private AmqpReceiveLinkProcessor linkProcessor; private AutoCloseable mockCloseable; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(10)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup() { mockCloseable = MockitoAnnotations.openMocks(this); @@ -143,7 +132,7 @@ void createNewLink() { .expectNext(message1) .expectNext(message2) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); assertTrue(processor.isTerminated()); assertFalse(processor.hasError()); @@ -177,7 +166,7 @@ void respectsBackpressureInRange() { .then(() -> messageProcessor.next(message1)) .expectNext(message1) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); verify(link1).setEmptyCreditListener(creditSupplierCaptor.capture()); @@ -233,7 +222,7 @@ void onSubscribingTwiceThrowsException() { // The second time we subscribe, we expect that it'll throw. StepVerifier.create(processor) .expectError(IllegalStateException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -280,10 +269,9 @@ void newLinkOnClose() { }) .expectNext(message3) .expectNext(message4) - .then(() -> { - processor.cancel(); - }) - .verifyComplete(); + .then(() -> processor.cancel()) + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertTrue(processor.isTerminated()); assertFalse(processor.hasError()); @@ -318,9 +306,7 @@ void nonRetryableError() { messageProcessor.next(message1); }) .expectNext(message1) - .then(() -> { - endpointProcessor.error(amqpException); - }) + .then(() -> endpointProcessor.error(amqpException)) .expectErrorSatisfies(error -> { assertTrue(error instanceof AmqpException); AmqpException exception = (AmqpException) error; @@ -329,7 +315,7 @@ void nonRetryableError() { Assertions.assertEquals(amqpException.getErrorCondition(), exception.getErrorCondition()); Assertions.assertEquals(amqpException.getMessage(), exception.getMessage()); }) - .verify(); + .verify(DEFAULT_TIMEOUT); assertTrue(processor.isTerminated()); assertTrue(processor.hasError()); @@ -395,7 +381,7 @@ void doNotRetryWhenParentConnectionIsClosed() { .expectNext(message1) .then(() -> endpointProcessor.complete()) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); assertTrue(processor.isTerminated()); } @@ -431,7 +417,7 @@ void stopsEmittingAfterBackPressure() { .expectNextCount(backpressure) .thenAwait(Duration.ofSeconds(2)) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -452,7 +438,7 @@ void receivesUntilFirstLinkClosed() { .expectNext(message2) .then(() -> endpointProcessor.complete()) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); assertTrue(processor.isTerminated()); assertFalse(processor.hasError()); @@ -486,7 +472,7 @@ void receivesFromFirstLink() { .expectNext(message1) .expectNext(message2) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); assertTrue(processor.isTerminated()); assertFalse(processor.hasError()); @@ -526,7 +512,7 @@ void backpressureRequestOnlyEmitsThatAmount() { }) .expectNextCount(backpressure) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); assertTrue(processor.isTerminated()); assertFalse(processor.hasError()); @@ -579,7 +565,7 @@ void onlyRequestsWhenCreditsLessThanPrefetch() { }) .expectNextCount(nextRequest) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); assertTrue(processor.isTerminated()); assertFalse(processor.hasError()); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java index f00225382b96..59f35c3cd818 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EventHubReactorConnectionTest.java @@ -35,7 +35,6 @@ import org.apache.qpid.proton.engine.SslPeerDetails; import org.apache.qpid.proton.reactor.Reactor; import org.apache.qpid.proton.reactor.Selectable; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; @@ -100,13 +99,6 @@ public static void init() { Map properties = CoreUtils.getProperties("azure-messaging-eventhubs.properties"); product = properties.get(NAME_KEY); clientVersion = properties.get(VERSION_KEY); - - StepVerifier.setDefaultTimeout(Duration.ofSeconds(10)); - } - - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); } @BeforeEach @@ -192,7 +184,8 @@ public void getsManagementChannel() { StepVerifier.create(connection.getManagementNode()) .then(() -> connectionHandler.onConnectionRemoteOpen(event)) .assertNext(node -> Assertions.assertTrue(node instanceof ManagementChannel)) - .verifyComplete(); + .expectComplete() + .verify(Duration.ofSeconds(10)); } @AfterEach diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md index f01475935e0d..c123130f2001 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md @@ -10,6 +10,13 @@ ### Other Changes +## 4.1.1 (2023-09-13) + +### Other Changes + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 4.1.0 (2023-08-10) ### Features Added diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md index 7c7a43286219..e7dbe4cf14c2 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md @@ -59,7 +59,7 @@ add the direct dependency to your project as follows. com.azure azure-ai-formrecognizer - 4.1.0 + 4.1.1 ``` [//]: # ({x-version-update-end}) @@ -167,7 +167,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerClientBuilder.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerClientBuilder.java index 97d16a179012..34aeacdb66d6 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerClientBuilder.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/FormRecognizerClientBuilder.java @@ -101,6 +101,14 @@ public final class FormRecognizerClientBuilder implements EndpointTrait, HttpTrait, TokenCredentialTrait { + + /** + * Constructs a {@link FormRecognizerClientBuilder} object. + */ + public FormRecognizerClientBuilder() { + httpLogOptions = new HttpLogOptions(); + } + private final ClientLogger logger = new ClientLogger(FormRecognizerClientBuilder.class); private final List perCallPolicies = new ArrayList<>(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisClientBuilder.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisClientBuilder.java index c2f05bd4dc8a..d62111f8eeca 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisClientBuilder.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisClientBuilder.java @@ -103,6 +103,12 @@ public final class DocumentAnalysisClientBuilder implements TokenCredentialTrait { private final ClientLogger logger = new ClientLogger(DocumentAnalysisClientBuilder.class); + /** + * Create a DocumentAnalysisClientBuilder instance. + */ + public DocumentAnalysisClientBuilder() { + } + private final List perCallPolicies = new ArrayList<>(); private final List perRetryPolicies = new ArrayList<>(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/DocumentModelAdministrationClientBuilder.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/DocumentModelAdministrationClientBuilder.java index 4f860050c212..4fb0fd818f35 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/DocumentModelAdministrationClientBuilder.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/DocumentModelAdministrationClientBuilder.java @@ -102,6 +102,14 @@ public final class DocumentModelAdministrationClientBuilder implements EndpointTrait, HttpTrait, TokenCredentialTrait { + + /** + * Constructs a DocumentModelAdministrationClientBuilder object. + */ + public DocumentModelAdministrationClientBuilder() { + httpLogOptions = new HttpLogOptions(); + } + private final ClientLogger logger = new ClientLogger(DocumentModelAdministrationClientBuilder.class); private final List perCallPolicies = new ArrayList<>(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/BuildDocumentClassifierOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/BuildDocumentClassifierOptions.java index 86dee8d388da..9aa9f40255d6 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/BuildDocumentClassifierOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/BuildDocumentClassifierOptions.java @@ -14,6 +14,12 @@ public final class BuildDocumentClassifierOptions { private String classifierId; + /** + * Create a BuildDocumentClassifierOptions instance. + */ + public BuildDocumentClassifierOptions() { + } + /** * Get the model description. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/BuildDocumentModelOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/BuildDocumentModelOptions.java index c76f8515718c..52c9abcd64b0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/BuildDocumentModelOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/BuildDocumentModelOptions.java @@ -18,6 +18,12 @@ public final class BuildDocumentModelOptions { private String modelId; + /** + * Create a BuildDocumentModelOptions instance. + */ + public BuildDocumentModelOptions() { + } + /** * Get the model description. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ComposeDocumentModelOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ComposeDocumentModelOptions.java index 1f98658ee691..e245d8595471 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ComposeDocumentModelOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ComposeDocumentModelOptions.java @@ -16,6 +16,12 @@ public final class ComposeDocumentModelOptions { private Map tags; private String modelId; + /** + * Create a ComposeDocumentModelOptions instance. + */ + public ComposeDocumentModelOptions() { + } + /** * Get the optional model description defined by the user. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ContentSourceKind.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ContentSourceKind.java index 70895f6a9597..fca0e5634cff 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ContentSourceKind.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ContentSourceKind.java @@ -11,6 +11,14 @@ /** Type of content source. */ public final class ContentSourceKind extends ExpandableStringEnum { + /** + * Creates or finds a ContentSourceKind from its string representation. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ContentSourceKind() { + } + /** Enum value azureBlob. */ public static final ContentSourceKind AZURE_BLOB = fromString("azureBlob"); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/CopyAuthorizationOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/CopyAuthorizationOptions.java index b16b8a840529..7b7542353f40 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/CopyAuthorizationOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/CopyAuthorizationOptions.java @@ -16,6 +16,12 @@ public final class CopyAuthorizationOptions { private Map tags; private String modelId; + /** + * Create a CopyAuthorizationOptions instance. + */ + public CopyAuthorizationOptions() { + } + /** * Get the model description. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentFieldSchema.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentFieldSchema.java index b9e7de451329..160e7bf90e38 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentFieldSchema.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentFieldSchema.java @@ -14,6 +14,13 @@ */ @Immutable public final class DocumentFieldSchema { + + /** + * Constructs a DocumentFieldSchema object. + */ + public DocumentFieldSchema() { + } + /* * Semantic data type of the field value. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelBuildMode.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelBuildMode.java index b5e7fbbacf65..686caaed320f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelBuildMode.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelBuildMode.java @@ -12,6 +12,14 @@ @Immutable public final class DocumentModelBuildMode extends ExpandableStringEnum { + /** + * Creates a DocumentModelBuildMode object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DocumentModelBuildMode() { + } + /** * Used for documents with fixed visual templates. */ @@ -32,7 +40,10 @@ public static DocumentModelBuildMode fromString(String name) { return fromString(name, DocumentModelBuildMode.class); } - /** @return known DocumentModelBuildMode values. */ + /** + * Returns known DocumentModelBuildMode values. + * @return known DocumentModelBuildMode values. + */ public static Collection values() { return values(DocumentModelBuildMode.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelBuildOperationDetails.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelBuildOperationDetails.java index fe0493a35fdd..8b05fc940334 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelBuildOperationDetails.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelBuildOperationDetails.java @@ -9,6 +9,14 @@ /** Build document model operation details */ @Immutable public final class DocumentModelBuildOperationDetails extends OperationDetails { + + /** + * Creates a DocumentModelBuildOperationDetails object. + */ + public DocumentModelBuildOperationDetails() { + super(); + } + /* * Operation result upon success. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelComposeOperationDetails.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelComposeOperationDetails.java index 0a6b85743628..a99548b8b30b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelComposeOperationDetails.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelComposeOperationDetails.java @@ -9,6 +9,14 @@ /** Compose document model operation details */ @Immutable public final class DocumentModelComposeOperationDetails extends OperationDetails { + + /** + * Creates a DocumentModelComposeOperationDetails object. + */ + public DocumentModelComposeOperationDetails() { + super(); + } + /* * Operation result upon success. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelCopyToOperationDetails.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelCopyToOperationDetails.java index de3ff98d7683..c380c8f186a2 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelCopyToOperationDetails.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelCopyToOperationDetails.java @@ -9,6 +9,14 @@ /** Copy document model operation details. */ @Immutable public final class DocumentModelCopyToOperationDetails extends OperationDetails { + + /** + * Creates a DocumentModelCopyToOperationDetails object. + */ + public DocumentModelCopyToOperationDetails() { + super(); + } + /* * Operation result upon success. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelDetails.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelDetails.java index 915c7d0f69de..5cbc1c6c2b0f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelDetails.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelDetails.java @@ -15,6 +15,12 @@ @Immutable public final class DocumentModelDetails { + /** + * Creates a DocumentModelDetails object. + */ + public DocumentModelDetails() { + } + /* * Unique model identifier. */ @@ -119,7 +125,7 @@ public OffsetDateTime getExpiresOn() { private void setExpiresOn(OffsetDateTime expiresOn) { this.expiresOn = expiresOn; } - + /** * Get the Service version used to create this document classifier. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelSummary.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelSummary.java index 5326ea2a3590..ba83780bf54d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelSummary.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentModelSummary.java @@ -14,6 +14,13 @@ */ @Immutable public final class DocumentModelSummary { + + /** + * Creates a DocumentModelSummary object. + */ + public DocumentModelSummary() { + } + /* * Unique model identifier. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentTypeDetails.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentTypeDetails.java index b8792499c7af..6a47f29f5e5d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentTypeDetails.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/DocumentTypeDetails.java @@ -13,6 +13,13 @@ */ @Immutable public final class DocumentTypeDetails { + + /** + * Creates a DocumentTypeDetails instance. + */ + public DocumentTypeDetails() { + } + /* * Model description. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationDetails.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationDetails.java index 114bff2a0aba..0afefdf419b7 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationDetails.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationDetails.java @@ -14,6 +14,13 @@ * The OperationDetails model. */ public class OperationDetails { + + /** + * Creates an instance of OperationDetails. + */ + public OperationDetails() { + } + private String operationId; private OperationStatus status; private Integer percentCompleted; diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationKind.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationKind.java index 9fcecedcfdcf..a3fd44afa3b0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationKind.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationKind.java @@ -11,6 +11,15 @@ /** Known values for type of operation. */ @Immutable public final class OperationKind extends ExpandableStringEnum { + + /** + * Creates a OperationKind object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperationKind() { + } + /** Static value documentModelBuild for OperationKind. */ public static final OperationKind DOCUMENT_MODEL_BUILD = fromString("documentModelBuild"); @@ -30,7 +39,10 @@ public static OperationKind fromString(String name) { return fromString(name, OperationKind.class); } - /** @return known OperationKind values. */ + /** + * Returns known OperationKind values. + * @return known OperationKind values. + */ public static Collection values() { return values(OperationKind.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationStatus.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationStatus.java index a760412d03c9..0c4ddc95fcbc 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationStatus.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationStatus.java @@ -11,6 +11,15 @@ /** Known values for operation status. */ @Immutable public final class OperationStatus extends ExpandableStringEnum { + + /** + * Creates a OperationStatus object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperationStatus() { + } + /** Static value notStarted for OperationStatus. */ public static final OperationStatus NOT_STARTED = fromString("notStarted"); @@ -36,7 +45,10 @@ public static OperationStatus fromString(String name) { return fromString(name, OperationStatus.class); } - /** @return known OperationStatus values. */ + /** + * Returns known OperationStatus values. + * @return known OperationStatus values. + */ public static Collection values() { return values(OperationStatus.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationSummary.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationSummary.java index 5ab58613e029..b244274adb1c 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationSummary.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/OperationSummary.java @@ -12,6 +12,13 @@ /** OperationSummary. */ @Immutable public final class OperationSummary { + + /** + * Creates a OperationSummary object. + */ + public OperationSummary() { + } + /* * Operation ID */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/QuotaDetails.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/QuotaDetails.java index 2ceafee8ad98..01dc25e20e73 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/QuotaDetails.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/QuotaDetails.java @@ -11,6 +11,13 @@ /** Quota used, limit, and next reset date/time. */ @Immutable public final class QuotaDetails { + + /** + * Creates a QuotaDetails object. + */ + public QuotaDetails() { + } + /* * Amount of the resource quota used. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ResourceDetails.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ResourceDetails.java index 9cd5762a1737..03bdde8f5cd0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ResourceDetails.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/administration/models/ResourceDetails.java @@ -24,6 +24,12 @@ public final class ResourceDetails { private QuotaDetails customNeuralDocumentModelQuota; + /** + * Creates a ResourceDetails object. + */ + public ResourceDetails() { + } + /** * Get the current count of built document analysis models * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/FormRecognizerClientImpl.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/FormRecognizerClientImpl.java index e9b82c9f8876..1848805c3aa7 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/FormRecognizerClientImpl.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/implementation/FormRecognizerClientImpl.java @@ -16,13 +16,13 @@ public final class FormRecognizerClientImpl { /** * Supported Cognitive Services endpoints (protocol and hostname, for example: - * here). + * https://westus2.api.cognitive.microsoft.com). */ private final String endpoint; /** * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: - * here). + * https://westus2.api.cognitive.microsoft.com). * * @return the endpoint value. */ @@ -106,7 +106,7 @@ public DocumentClassifiersImpl getDocumentClassifiers() { * Initializes an instance of FormRecognizerClient client. * * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: - * here). + * https://westus2.api.cognitive.microsoft.com). * @param apiVersion Api Version. */ FormRecognizerClientImpl(String endpoint, String apiVersion) { @@ -124,7 +124,7 @@ public DocumentClassifiersImpl getDocumentClassifiers() { * * @param httpPipeline The HTTP pipeline to send requests through. * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: - * here). + * https://westus2.api.cognitive.microsoft.com). * @param apiVersion Api Version. */ FormRecognizerClientImpl(HttpPipeline httpPipeline, String endpoint, String apiVersion) { @@ -137,7 +137,7 @@ public DocumentClassifiersImpl getDocumentClassifiers() { * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: - * here). + * https://westus2.api.cognitive.microsoft.com). * @param apiVersion Api Version. */ FormRecognizerClientImpl( diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AddressValue.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AddressValue.java index 23e2dba1a456..543d68c36278 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AddressValue.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AddressValue.java @@ -12,6 +12,12 @@ @Immutable public final class AddressValue { + /** + * Creates a new instance of AddressValue. + */ + public AddressValue() { + } + /* * Building number. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzeDocumentOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzeDocumentOptions.java index 4a62c88c3421..1aa0fb524375 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzeDocumentOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzeDocumentOptions.java @@ -17,6 +17,12 @@ public final class AnalyzeDocumentOptions { private String locale; private List documentAnalysisFeatures; + /** + * Creates a new instance of AnalyzeDocumentOptions. + */ + public AnalyzeDocumentOptions() { + } + /** * Get the custom page numbers for multipage documents(PDF/TIFF). Input the number of the * pages you want to get the recognized result for. diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzeResult.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzeResult.java index d7adc15c4cb4..1f418cbbac2d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzeResult.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzeResult.java @@ -14,6 +14,12 @@ @Immutable public final class AnalyzeResult { + /** + * Creates a new instance of AnalyzeResult. + */ + public AnalyzeResult() { + } + /* * Model ID used to produce this result. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzedDocument.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzedDocument.java index cde624dbb571..e14b992d6589 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzedDocument.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/AnalyzedDocument.java @@ -12,6 +12,13 @@ * Model class describing the location and semantic content of a document. */ public class AnalyzedDocument { + + /** + * Creates a new instance of AnalyzedDocument. + */ + public AnalyzedDocument() { + } + /* * AnalyzeDocument type. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/BoundingRegion.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/BoundingRegion.java index 566d81a4e2b6..5dfd10c4d07c 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/BoundingRegion.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/BoundingRegion.java @@ -13,6 +13,13 @@ */ @Immutable public final class BoundingRegion { + + /** + * Creates a new instance of BoundingRegion. + */ + public BoundingRegion() { + } + /* * 1-based page number of page containing the bounding region. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/CurrencyValue.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/CurrencyValue.java index 768b5b0b70df..b87f5ffd5dd9 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/CurrencyValue.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/CurrencyValue.java @@ -11,6 +11,12 @@ */ @Immutable public final class CurrencyValue { + /** + * Constructs a CurrencyValue object. + */ + public CurrencyValue() { + } + /* * Currency amount. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentAnalysisAudience.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentAnalysisAudience.java index 3aa6f97a84f8..e46e8fdba882 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentAnalysisAudience.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentAnalysisAudience.java @@ -11,6 +11,15 @@ /** Defines values for DocumentAnalysisAudience. */ @Immutable public final class DocumentAnalysisAudience extends ExpandableStringEnum { + + /** + * Constructs a DocumentAnalysisAudience object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DocumentAnalysisAudience() { + } + /** Static value AZURE_RESOURCE_MANAGER_CHINA for DocumentAnalysisAudience. */ public static final DocumentAnalysisAudience AZURE_CHINA = fromString("https://cognitiveservices.azure.cn"); @@ -30,7 +39,10 @@ public static DocumentAnalysisAudience fromString(String name) { return fromString(name, DocumentAnalysisAudience.class); } - /** @return known DocumentAnalysisAudience values. */ + /** + * Returns known DocumentAnalysisAudience values. + * @return known DocumentAnalysisAudience values. + */ public static Collection values() { return values(DocumentAnalysisAudience.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentBarcode.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentBarcode.java index 70ed888b24e3..251bf355a623 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentBarcode.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentBarcode.java @@ -9,6 +9,11 @@ /** Model representing a barcode document field. */ public final class DocumentBarcode { + /** + * Constructs a DocumentBarcode object. + */ + public DocumentBarcode() { + } /* * Barcode kind. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentField.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentField.java index e28c4b528f7b..c0cd30c2f4ee 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentField.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentField.java @@ -18,6 +18,13 @@ */ @Immutable public final class DocumentField extends TypedDocumentField { + /** + * Constructs a DocumentField object. + */ + public DocumentField() { + super(); + } + // Ignore custom getters in the class to prevent serialization and deserialization issues /** diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentFieldType.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentFieldType.java index 183873fe0df1..6fdea204d070 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentFieldType.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentFieldType.java @@ -11,6 +11,15 @@ /** Defines values for DocumentFieldType. */ @Immutable public final class DocumentFieldType extends ExpandableStringEnum { + + /** + * Constructs a DocumentFieldType object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DocumentFieldType() { + } + /** Static value string for DocumentFieldType. */ public static final DocumentFieldType STRING = fromString("string"); @@ -63,7 +72,10 @@ public static DocumentFieldType fromString(String name) { return fromString(name, DocumentFieldType.class); } - /** @return known DocumentFieldType values. */ + /** + * Returns the known DocumentFieldType values. + * @return known DocumentFieldType values. + */ public static Collection values() { return values(DocumentFieldType.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentFormula.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentFormula.java index c6ffdd2fde80..ba264af2dd7c 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentFormula.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentFormula.java @@ -11,6 +11,13 @@ /** A formula object. */ @Fluent public final class DocumentFormula { + + /** + * Constructs a DocumentFormula object. + */ + public DocumentFormula() { + } + /* * Formula kind. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentKeyValueElement.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentKeyValueElement.java index c60710ceb159..95096934d7b4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentKeyValueElement.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentKeyValueElement.java @@ -13,6 +13,12 @@ */ @Immutable public final class DocumentKeyValueElement { + /** + * Constructs a DocumentKeyValueElement object. + */ + public DocumentKeyValueElement() { + } + /* * Concatenated content of the key-value element in reading order. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentKeyValuePair.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentKeyValuePair.java index dbfd59ac2f13..a88d1d8f5b8b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentKeyValuePair.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentKeyValuePair.java @@ -11,6 +11,13 @@ */ @Immutable public final class DocumentKeyValuePair { + + /** + * Constructs a DocumentKeyValuePair object. + */ + public DocumentKeyValuePair() { + } + /* * Field label of the key-value pair. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentLanguage.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentLanguage.java index 730c5f54f1fc..7ca1bac81c19 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentLanguage.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentLanguage.java @@ -11,6 +11,13 @@ /** An object representing the detected language for a given text span. */ @Immutable public final class DocumentLanguage { + + /** + * Constructs a DocumentLanguage object. + */ + public DocumentLanguage() { + } + /* * Detected language. Value may an ISO 639-1 language code (ex. "en", * "fr") or BCP 47 language tag (ex. "zh-Hans"). diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentLine.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentLine.java index 91e54af146f5..a8ed25b309df 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentLine.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentLine.java @@ -15,8 +15,17 @@ */ @Immutable public final class DocumentLine { - // Ignore custom getters in the class to prevent serialization and deserialization issues + /** + * Constructs a DocumentLine object. + */ + public DocumentLine() { + this.spans = new ArrayList<>(); + this.boundingPolygon = new ArrayList<>(); + this.pageWords = new ArrayList<>(); + } + + // Ignore custom getters in the class to prevent serialization and deserialization issues /* * Concatenated content of the contained elements in reading order. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentPage.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentPage.java index 2d58662324b2..8ff8f996e048 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentPage.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentPage.java @@ -13,6 +13,12 @@ */ @Immutable public final class DocumentPage { + /** + * Creates a DocumentPage object. + */ + public DocumentPage() { + } + /* * 1-based page number in the input document. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentPageLengthUnit.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentPageLengthUnit.java index db10f527daf2..26324390e18b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentPageLengthUnit.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentPageLengthUnit.java @@ -11,6 +11,15 @@ /** Defines values for DocumentPageLengthUnit. */ @Immutable public final class DocumentPageLengthUnit extends ExpandableStringEnum { + + /** + * Creates a DocumentPageLengthUnit object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DocumentPageLengthUnit() { + } + /** Static value pixel for DocumentPageLengthUnit. */ public static final DocumentPageLengthUnit PIXEL = fromString("pixel"); @@ -27,7 +36,10 @@ public static DocumentPageLengthUnit fromString(String name) { return fromString(name, DocumentPageLengthUnit.class); } - /** @return known DocumentPageLengthUnit values. */ + /** + * Returns known DocumentPageLengthUnit values. + * @return known DocumentPageLengthUnit values. + */ public static Collection values() { return values(DocumentPageLengthUnit.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentParagraph.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentParagraph.java index 447cf08cbfe2..3cc0f79d354a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentParagraph.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentParagraph.java @@ -11,6 +11,12 @@ /** A paragraph object consisting with contiguous lines generally with common alignment and spacing. */ @Immutable public final class DocumentParagraph { + /** + * Creates a DocumentParagraph object. + */ + public DocumentParagraph() { + } + /* * Semantic role of the paragraph. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSelectionMark.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSelectionMark.java index f02fd74441f1..5576eb3bf524 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSelectionMark.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSelectionMark.java @@ -13,6 +13,12 @@ */ @Immutable public final class DocumentSelectionMark { + /** + * Creates a DocumentSelectionMark object. + */ + public DocumentSelectionMark() { + } + /* * State of the selection mark. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSelectionMarkState.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSelectionMarkState.java index 66090884824d..c23af4bc1db0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSelectionMarkState.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSelectionMarkState.java @@ -11,6 +11,15 @@ /** Defines values for DocumentSelectionMarkState. */ @Immutable public final class DocumentSelectionMarkState extends ExpandableStringEnum { + + /** + * Creates a DocumentSelectionMarkState object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DocumentSelectionMarkState() { + } + /** Static value selected for DocumentSelectionMarkState. */ public static final DocumentSelectionMarkState SELECTED = fromString("selected"); @@ -27,7 +36,10 @@ public static DocumentSelectionMarkState fromString(String name) { return fromString(name, DocumentSelectionMarkState.class); } - /** @return known DocumentSelectionMarkState values. */ + /** + * Returns known DocumentSelectionMarkState values. + * @return known DocumentSelectionMarkState values. + */ public static Collection values() { return values(DocumentSelectionMarkState.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSignatureType.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSignatureType.java index db85979b77e4..82d38fbd769c 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSignatureType.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSignatureType.java @@ -11,6 +11,15 @@ /** Defines values for DocumentSignatureType. */ @Immutable public final class DocumentSignatureType extends ExpandableStringEnum { + + /** + * Creates a DocumentSignatureType object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DocumentSignatureType() { + } + /** Static value signed for DocumentSignatureType. */ public static final DocumentSignatureType SIGNED = fromString("signed"); @@ -27,7 +36,10 @@ public static DocumentSignatureType fromString(String name) { return fromString(name, DocumentSignatureType.class); } - /** @return known DocumentSignatureType values. */ + /** + * Returns known DocumentSignatureType values. + * @return known DocumentSignatureType values. + */ public static Collection values() { return values(DocumentSignatureType.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSpan.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSpan.java index fc03b83e42e3..228672c592b6 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSpan.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentSpan.java @@ -11,6 +11,12 @@ */ @Immutable public final class DocumentSpan { + /** + * Creates a DocumentSpan object. + */ + public DocumentSpan() { + } + /* * Zero-based index of the content represented by the span. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentStyle.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentStyle.java index 3664389a2678..00e7ff5c43e0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentStyle.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentStyle.java @@ -13,6 +13,14 @@ */ @Immutable public final class DocumentStyle { + + /** + * Creates a DocumentStyle object. + */ + public DocumentStyle() { + + } + /* * Is content handwritten? */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTable.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTable.java index 87a343caae37..10e03629bbd4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTable.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTable.java @@ -13,6 +13,13 @@ */ @Immutable public final class DocumentTable { + + /** + * Creates a DocumentTable object. + */ + public DocumentTable() { + } + /* * Number of rows in the table. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTableCell.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTableCell.java index 7720dbd938b1..da5aef56fcdc 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTableCell.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTableCell.java @@ -13,6 +13,13 @@ */ @Immutable public final class DocumentTableCell { + /** + * Creates a DocumentTableCell object. + */ + public DocumentTableCell() { + + } + /* * Table cell kind. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTableCellKind.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTableCellKind.java index 711c1a1c6224..87a68bc19ad9 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTableCellKind.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentTableCellKind.java @@ -11,6 +11,15 @@ /** Defines values for DocumentTableCellKind. */ @Immutable public final class DocumentTableCellKind extends ExpandableStringEnum { + + /** + * Creates a DocumentTableCellKind object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DocumentTableCellKind() { + } + /** Static value content for DocumentTableCellKind. */ public static final DocumentTableCellKind CONTENT = fromString("content"); @@ -36,7 +45,10 @@ public static DocumentTableCellKind fromString(String name) { return fromString(name, DocumentTableCellKind.class); } - /** @return known DocumentTableCellKind values. */ + /** + * Returns known DocumentTableCellKind values. + * @return known DocumentTableCellKind values. + */ public static Collection values() { return values(DocumentTableCellKind.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentWord.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentWord.java index db038f7c597b..5992f2aa45d8 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentWord.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/DocumentWord.java @@ -14,6 +14,13 @@ */ @Immutable public final class DocumentWord { + + /** + * Creates a DocumentWord object. + */ + public DocumentWord() { + } + /* * Text content of the word. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/OperationResult.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/OperationResult.java index 70dcb44fb543..51e78153ed9c 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/OperationResult.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/OperationResult.java @@ -11,6 +11,13 @@ */ @Immutable public final class OperationResult { + + /** + * Creates a OperationResult object. + */ + public OperationResult() { + } + /** * Identifier which contains the result of the build model/analyze operation. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/Point.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/Point.java index a72764436470..40d918bb2a0f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/Point.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/Point.java @@ -12,6 +12,12 @@ @Immutable public final class Point { + /** + * Creates a Point object. + */ + public Point() { + } + /* * The x-axis point coordinate. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/TypedDocumentField.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/TypedDocumentField.java index 77cede6855b9..90a4b042c8a2 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/TypedDocumentField.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/documentanalysis/models/TypedDocumentField.java @@ -19,6 +19,12 @@ public class TypedDocumentField { private List spans; private Float confidence; + /** + * Create a TypedDocumentField instance. + */ + public TypedDocumentField() { + } + /** * Get value of the field. * @return the value of the field diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CreateComposedModelOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CreateComposedModelOptions.java index 951a7313521a..5ae4b96b9467 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CreateComposedModelOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/CreateComposedModelOptions.java @@ -12,6 +12,12 @@ public final class CreateComposedModelOptions { private String modelName; + /** + * Create a CreateComposedModelOptions instance. + */ + public CreateComposedModelOptions() { + } + /** * Get the optional model name defined by the user. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormContentType.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormContentType.java index 0e81a5fb0fe1..e7f46391b10a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormContentType.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormContentType.java @@ -10,6 +10,14 @@ */ public final class FormContentType extends ExpandableStringEnum { + /** + * Creates a FormContentType object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FormContentType() { + } + /** * Static value Line for FormContentType. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormReadingOrder.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormReadingOrder.java index c4bf7b05a58a..21d0cec57b5d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormReadingOrder.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormReadingOrder.java @@ -10,6 +10,14 @@ */ public final class FormReadingOrder extends ExpandableStringEnum { + /** + * Creates a FormReadingOrder object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FormReadingOrder() { + } + /** * Static value BASIC for FormReadingOrder. * Set it to basic for the lines to be sorted top to bottom, left to right, although in certain cases diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerAudience.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerAudience.java index 707c12a91e21..97f14e97f98d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerAudience.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerAudience.java @@ -11,6 +11,15 @@ /** Defines values for FormRecognizerAudience. */ @Immutable public final class FormRecognizerAudience extends ExpandableStringEnum { + + /** + * Creates a FormRecognizerAudience object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FormRecognizerAudience() { + } + /** Static value AZURE_RESOURCE_MANAGER_CHINA for FormRecognizerAudience. */ public static final FormRecognizerAudience AZURE_CHINA = fromString("https://cognitiveservices.azure.cn"); @@ -30,7 +39,10 @@ public static FormRecognizerAudience fromString(String name) { return fromString(name, FormRecognizerAudience.class); } - /** @return known FormRecognizerAudience values. */ + /** + * Returns known FormRecognizerAudience values. + * @return known FormRecognizerAudience values. + */ public static Collection values() { return values(FormRecognizerAudience.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerLanguage.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerLanguage.java index caf0efeb170d..ae3ee6a00821 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerLanguage.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerLanguage.java @@ -12,6 +12,15 @@ * here. */ public final class FormRecognizerLanguage extends ExpandableStringEnum { + + /** + * Creates a FormRecognizerLanguage object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FormRecognizerLanguage() { + } + /** Static value af for FormRecognizerLanguage. */ public static final FormRecognizerLanguage AF = fromString("af"); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerLocale.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerLocale.java index d6225d2d2fb9..4092c88b5493 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerLocale.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FormRecognizerLocale.java @@ -10,6 +10,15 @@ * Defines values for FormRecognizerLocale. */ public final class FormRecognizerLocale extends ExpandableStringEnum { + + /** + * Creates a FormRecognizerLocale object. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FormRecognizerLocale() { + } + /** Static value en-AU for FormRecognizerLocale. */ public static final FormRecognizerLocale EN_AU = fromString("en-AU"); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeBusinessCardsOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeBusinessCardsOptions.java index fde376b78468..d4510fabd7ba 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeBusinessCardsOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeBusinessCardsOptions.java @@ -13,11 +13,18 @@ */ @Fluent public final class RecognizeBusinessCardsOptions { + private FormContentType contentType; private boolean includeFieldElements; private List pages; private FormRecognizerLocale locale; + /** + * Create a {@code RecognizeBusinessCardOptions} object. + */ + public RecognizeBusinessCardsOptions() { + } + /** * Get the type of the form. Supported Media types including .pdf, .jpg, .png or .tiff type file stream. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeContentOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeContentOptions.java index 63daa8f6f795..d024ef91e317 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeContentOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeContentOptions.java @@ -21,6 +21,12 @@ public final class RecognizeContentOptions { private List pages; private FormReadingOrder readingOrder; + /** + * Create a {@code RecognizeContentOptions} object. + */ + public RecognizeContentOptions() { + } + /** * Get the type of the form. Supported Media types including .pdf, .jpg, .png or .tiff type file stream. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeCustomFormsOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeCustomFormsOptions.java index 66323067ee27..a35acd7098be 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeCustomFormsOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeCustomFormsOptions.java @@ -20,6 +20,12 @@ public final class RecognizeCustomFormsOptions { private List pages; private Duration pollInterval = DEFAULT_POLL_INTERVAL; + /** + * Create a {@code RecognizeCustomFormsOptions} object. + */ + public RecognizeCustomFormsOptions() { + } + /** * Get the type of the form. Supported Media types including .pdf, .jpg, .png, .tiff or .bmp type file stream. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeIdentityDocumentOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeIdentityDocumentOptions.java index 6c9773e1a3d0..2fcc99dcc01a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeIdentityDocumentOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeIdentityDocumentOptions.java @@ -16,6 +16,12 @@ public final class RecognizeIdentityDocumentOptions { private boolean includeFieldElements; private List pages; + /** + * Create a {@code RecognizeIdentityDocumentOptions} object. + */ + public RecognizeIdentityDocumentOptions() { + } + /** * Get the type of the form. Supported Media types including .pdf, .jpg, .png, .bmp or .tiff type file stream. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeInvoicesOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeInvoicesOptions.java index 5b2017a3e1e0..4db92b826462 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeInvoicesOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeInvoicesOptions.java @@ -17,6 +17,12 @@ public final class RecognizeInvoicesOptions { private FormRecognizerLocale locale; private List pages; + /** + * Create a {@code RecognizeInvoicesOptions} object. + */ + public RecognizeInvoicesOptions() { + } + /** * Get the type of the form. Supported Media types including .pdf, .jpg, .png or .tiff type file stream. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeReceiptsOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeReceiptsOptions.java index 2ee78e75a712..d4634bfc7bef 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeReceiptsOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/RecognizeReceiptsOptions.java @@ -21,6 +21,12 @@ public final class RecognizeReceiptsOptions { private List pages; private Duration pollInterval = DEFAULT_POLL_INTERVAL; + /** + * Create a {@code RecognizeReceiptsOptions} object. + */ + public RecognizeReceiptsOptions() { + } + /** * Get the type of the form. Supported Media types including .pdf, .jpg, .png or .tiff type file stream. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/SelectionMarkState.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/SelectionMarkState.java index e988c80d706f..90ec1175cae9 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/SelectionMarkState.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/SelectionMarkState.java @@ -9,6 +9,15 @@ * Defines values for SelectionMarkState. i.e., Selected or Unselected. */ public final class SelectionMarkState extends ExpandableStringEnum { + + /** + * Constructs a SelectionMarkState object. + * @deprecated Use the {@link #fromString(String, Class)} factory method. + */ + @Deprecated + public SelectionMarkState() { + } + /** * Static value SELECTED for SelectionMarkState. */ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TextAppearance.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TextAppearance.java index 386fd5492213..b8a277699a3b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TextAppearance.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TextAppearance.java @@ -19,6 +19,11 @@ public final class TextAppearance { */ private float styleConfidence; + /** + * Creates a TextAppearance instance. + */ + public TextAppearance() { + } static { TextAppearanceHelper.setAccessor(new TextAppearanceHelper.TextAppearanceAccessor() { @Override diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TextStyleName.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TextStyleName.java index ab8708fcfaf0..a79f0ec869fa 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TextStyleName.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/TextStyleName.java @@ -13,6 +13,15 @@ * Defines values for TextStyleName. */ public final class TextStyleName extends ExpandableStringEnum { + + /** + * Constructs a TextStyleName object + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TextStyleName() { + } + /** Static value other for TextStyleName. */ public static final TextStyleName OTHER = fromString("other"); @@ -30,7 +39,10 @@ public static TextStyleName fromString(String name) { return fromString(name, TextStyleName.class); } - /** @return known TextStyleName values. */ + /** + * Returns the known TextStyleName values. + * @return known TextStyleName values. + */ public static Collection values() { return values(TextStyleName.class); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingClientBuilder.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingClientBuilder.java index 69c0865b68e8..1ebcf09ebca9 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingClientBuilder.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/FormTrainingClientBuilder.java @@ -94,6 +94,14 @@ public final class FormTrainingClientBuilder implements EndpointTrait, HttpTrait, TokenCredentialTrait { + + /** + * Constructs a {@link FormTrainingClientBuilder} object. + */ + public FormTrainingClientBuilder() { + httpLogOptions = new HttpLogOptions(); + } + private final ClientLogger logger = new ClientLogger(FormTrainingClientBuilder.class); private final List perCallPolicies = new ArrayList<>(); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/CustomFormModelProperties.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/CustomFormModelProperties.java index 8faa03dc5f87..66eaa9063a23 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/CustomFormModelProperties.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/CustomFormModelProperties.java @@ -11,6 +11,12 @@ public final class CustomFormModelProperties { private boolean isComposed; + /** + * Create a CustomFormModelProperties instance. + */ + public CustomFormModelProperties() { + } + static { CustomFormModelPropertiesHelper.setAccessor( new CustomFormModelPropertiesHelper.CustomFormModelPropertiesAccessor() { diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/TrainingFileFilter.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/TrainingFileFilter.java index bd39939a0d4c..f31e5ccfc1d8 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/TrainingFileFilter.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/TrainingFileFilter.java @@ -23,6 +23,12 @@ public final class TrainingFileFilter { */ private boolean includeSubfolders; + /** + * Create a TrainingFileFilter instance. + */ + public TrainingFileFilter() { + } + /** * Get the case-sensitive prefix string to filter * documents in the source path for training. diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/TrainingOptions.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/TrainingOptions.java index ec18e75b15cd..ad114c3d6a35 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/TrainingOptions.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/training/models/TrainingOptions.java @@ -18,6 +18,12 @@ public final class TrainingOptions { private TrainingFileFilter trainingFileFilter; private String modelName; + /** + * Create a {@code TrainingOptions} object. + */ + public TrainingOptions() { + } + /** * Get the filter to apply to the documents in the source path for training. * diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClientTest.java index f9569c67e10f..2e7580c5603a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormRecognizerAsyncClientTest.java @@ -23,8 +23,6 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.util.polling.SyncPoller; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -55,16 +53,6 @@ public class FormRecognizerAsyncClientTest extends FormRecognizerClientTestBase private FormRecognizerAsyncClient client; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - private FormRecognizerAsyncClient getFormRecognizerAsyncClient(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { return getFormRecognizerClientBuilder(httpClient, serviceVersion).buildAsyncClient(); @@ -263,13 +251,11 @@ public void recognizeReceiptFromUrlWithEncodedBlankSpaceSourceUrl(HttpClient htt @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") public void recognizeReceiptInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); - invalidSourceUrlRunner((invalidSourceUrl) -> { - assertThrows(HttpResponseException.class, - () -> client.beginRecognizeReceiptsFromUrl(invalidSourceUrl) - .setPollInterval(durationTestMode) - .getSyncPoller() - .getFinalResult()); - }); + invalidSourceUrlRunner((invalidSourceUrl) -> assertThrows(HttpResponseException.class, + () -> client.beginRecognizeReceiptsFromUrl(invalidSourceUrl) + .setPollInterval(durationTestMode) + .getSyncPoller() + .getFinalResult())); } /** @@ -411,12 +397,10 @@ public void recognizeContentFromDataMultiPage(HttpClient httpClient, FormRecogni public void recognizeContentFromDamagedPdf(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); - damagedPdfDataRunner((data, dataLength) -> { - assertThrows(HttpResponseException.class, - () -> client.beginRecognizeContent(toFluxByteBuffer(data), dataLength) - .setPollInterval(durationTestMode) - .getSyncPoller().getFinalResult()); - }); + damagedPdfDataRunner((data, dataLength) -> assertThrows(HttpResponseException.class, + () -> client.beginRecognizeContent(toFluxByteBuffer(data), dataLength) + .setPollInterval(durationTestMode) + .getSyncPoller().getFinalResult())); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -578,11 +562,9 @@ public void recognizeContentFromUrlWithPdf(HttpClient httpClient, FormRecognizer @MethodSource("com.azure.ai.formrecognizer.TestUtils#getTestParameters") public void recognizeContentInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); - invalidSourceUrlRunner((invalidSourceUrl) -> { - assertThrows(HttpResponseException.class, - () -> client.beginRecognizeContentFromUrl(invalidSourceUrl) - .setPollInterval(durationTestMode).getSyncPoller().getFinalResult()); - }); + invalidSourceUrlRunner((invalidSourceUrl) -> assertThrows(HttpResponseException.class, + () -> client.beginRecognizeContentFromUrl(invalidSourceUrl) + .setPollInterval(durationTestMode).getSyncPoller().getFinalResult())); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1178,12 +1160,13 @@ public void recognizeCustomFormInvalidSourceUrl(HttpClient httpClient, CustomFormModel createdModel = syncPoller.getFinalResult(); StepVerifier.create(client.beginRecognizeCustomFormsFromUrl(createdModel.getModelId(), INVALID_URL) .setPollInterval(durationTestMode)) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { final HttpResponseException httpResponseException = (HttpResponseException) throwable; final FormRecognizerErrorInformation errorInformation = (FormRecognizerErrorInformation) httpResponseException.getValue(); assertEquals(INVALID_SOURCE_URL_ERROR_CODE, errorInformation.getErrorCode()); - }); + }) + .verify(Duration.ofSeconds(30)); }); } @@ -1587,13 +1570,11 @@ public void recognizeBusinessCardFromUrlWithEncodedBlankSpaceSourceUrl(HttpClien public void recognizeBusinessCardInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); - invalidSourceUrlRunner((invalidSourceUrl) -> { - assertThrows(HttpResponseException.class, - () -> client.beginRecognizeBusinessCardsFromUrl(invalidSourceUrl) - .setPollInterval(durationTestMode) - .getSyncPoller() - .getFinalResult()); - }); + invalidSourceUrlRunner((invalidSourceUrl) -> assertThrows(HttpResponseException.class, + () -> client.beginRecognizeBusinessCardsFromUrl(invalidSourceUrl) + .setPollInterval(durationTestMode) + .getSyncPoller() + .getFinalResult())); } /** diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientTest.java index 02b17a60569a..7f8d55c54530 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/FormTrainingAsyncClientTest.java @@ -22,8 +22,6 @@ import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import io.netty.handler.codec.http.HttpResponseStatus; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -45,17 +43,9 @@ import static org.junit.jupiter.api.Assertions.fail; public class FormTrainingAsyncClientTest extends FormTrainingClientTestBase { - private FormTrainingAsyncClient client; - - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } + private FormTrainingAsyncClient client; private FormTrainingAsyncClient getFormTrainingAsyncClient(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { @@ -102,6 +92,10 @@ useTrainingLabels, new TrainingOptions().setPollInterval(durationTestMode)) assertEquals(customFormModelResponse.getStatusCode(), HttpResponseStatus.OK.code()); validateCustomModelData(syncPoller.getFinalResult(), false, false); }); + // TODO (alzimmer): This test needs to be recorded again as it was never verifying, therefore never + // subscribing to the reactive API call. +// .expectComplete() +// .verify(DEFAULT_TIMEOUT); }); } @@ -121,6 +115,10 @@ trainingFilesUrl, useTrainingLabels, new TrainingOptions().setPollInterval(durat StepVerifier.create(client.getCustomModel(trainedUnlabeledModel.getModelId())) .assertNext(customFormModel -> validateCustomModelData(syncPoller.getFinalResult(), false, false)); + // TODO (alzimmer): This test needs to be recorded again as it was never verifying, therefore never + // subscribing to the reactive API call. +// .expectComplete() +// .verify(DEFAULT_TIMEOUT); }); } @@ -141,6 +139,10 @@ useTrainingLabels, new TrainingOptions().setPollInterval(durationTestMode)) StepVerifier.create(client.getCustomModel(trainedLabeledModel.getModelId())) .assertNext(customFormModel -> validateCustomModelData(syncPoller.getFinalResult(), true, false)); + // TODO (alzimmer): This test needs to be recorded again as it was never verifying, therefore never + // subscribing to the reactive API call. +// .expectComplete() +// .verify(DEFAULT_TIMEOUT); }); } @@ -155,7 +157,8 @@ public void validGetAccountProperties(HttpClient httpClient, FormRecognizerServi client = getFormTrainingAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getAccountProperties()) .assertNext(FormTrainingClientTestBase::validateAccountProperties) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -170,7 +173,8 @@ public void validGetAccountPropertiesWithResponse(HttpClient httpClient, client = getFormTrainingAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getAccountProperties()) .assertNext(FormTrainingClientTestBase::validateAccountProperties) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -187,15 +191,17 @@ public void deleteModelValidModelIdWithResponse(HttpClient httpClient, StepVerifier.create(client.deleteModelWithResponse(createdModel.getModelId())) .assertNext(response -> assertEquals(response.getStatusCode(), HttpResponseStatus.NO_CONTENT.code())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(client.getCustomModelWithResponse(createdModel.getModelId())) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { assertEquals(HttpResponseException.class, throwable.getClass()); final FormRecognizerErrorInformation errorInformation = (FormRecognizerErrorInformation) ((HttpResponseException) throwable).getValue(); assertEquals(MODEL_ID_NOT_FOUND_ERROR_CODE, errorInformation.getErrorCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); }); } @@ -213,15 +219,17 @@ public void deleteModelValidModelIdWithResponseWithoutTrainingLabels(HttpClient StepVerifier.create(client.deleteModelWithResponse(createdModel.getModelId())) .assertNext(response -> assertEquals(response.getStatusCode(), HttpResponseStatus.NO_CONTENT.code())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(client.getCustomModelWithResponse(createdModel.getModelId())) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { assertEquals(HttpResponseException.class, throwable.getClass()); final FormRecognizerErrorInformation errorInformation = (FormRecognizerErrorInformation) ((HttpResponseException) throwable).getValue(); assertEquals(MODEL_ID_NOT_FOUND_ERROR_CODE, errorInformation.getErrorCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); }); } @@ -238,7 +246,8 @@ public void listCustomModels(HttpClient httpClient, FormRecognizerServiceVersion .thenConsumeWhile(customFormModelInfo -> customFormModelInfo.getModelId() != null && customFormModelInfo.getTrainingStartedOn() != null && customFormModelInfo.getTrainingCompletedOn() != null && customFormModelInfo.getStatus() != null) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -352,8 +361,8 @@ public void copyAuthorization(HttpClient httpClient, FormRecognizerServiceVersio StepVerifier.create(client.getCopyAuthorization(resourceId, resourceRegion)) .assertNext(copyAuthorization -> validateCopyAuthorizationResult(resourceId, resourceRegion, copyAuthorization)) - .verifyComplete() - ); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -635,10 +644,11 @@ public void beginCreateComposedUnlabeledModel(HttpClient httpClient, FormRecogni modelIdList, new CreateComposedModelOptions()).setPollInterval(durationTestMode)) .thenAwait() - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { assertEquals(HttpResponseException.class, throwable.getClass()); assertEquals(BAD_REQUEST.code(), ((HttpResponseException) throwable).getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); client.deleteModel(model1.getModelId()).block(); client.deleteModel(model2.getModelId()).block(); @@ -713,7 +723,8 @@ public void beginCreateComposedDuplicateModels(HttpClient httpClient, FormRecogn // assertEquals("composedModelDisplayName", customFormModelInfo.getModelDisplayName()); // assertTrue(customFormModelInfo.getCustomModelProperties().isComposed()); // }) - // .verifyComplete(); + // .expectComplete() + // .verify(DEFAULT_TIMEOUT); // // client.deleteModel(model1.getModelId()).block(); // client.deleteModel(model2.getModelId()).block(); @@ -739,7 +750,8 @@ public void beginTrainingUnlabeledModelName(HttpClient httpClient, FormRecognize StepVerifier.create(client.getCustomModel(createdModel.getModelId())) .assertNext(response -> assertEquals("modelDisplayName", response.getModelName())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); validateCustomModelData(createdModel, false, false); }); @@ -762,9 +774,11 @@ public void beginTrainingLabeledModelName(HttpClient httpClient, FormRecognizerS StepVerifier.create(client.getCustomModel(createdModel.getModelId())) .assertNext(response -> assertEquals("model trained with labels", response.getModelName())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); validateCustomModelData(createdModel, true, false); + // TODO (alzimmer): This is never subscribed to and does nothing. client.deleteModel(createdModel.getModelId()); }); } diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisAsyncClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisAsyncClientTest.java index d5dfc494032f..b1a5e7223ed0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisAsyncClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisAsyncClientTest.java @@ -10,13 +10,13 @@ import com.azure.ai.formrecognizer.documentanalysis.models.AnalyzeDocumentOptions; import com.azure.ai.formrecognizer.documentanalysis.models.AnalyzeResult; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentAnalysisFeature; -import com.azure.ai.formrecognizer.documentanalysis.models.DocumentStyle; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentBarcode; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentBarcodeKind; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentFormula; import com.azure.ai.formrecognizer.documentanalysis.models.DocumentFormulaKind; -import com.azure.ai.formrecognizer.documentanalysis.models.OperationResult; +import com.azure.ai.formrecognizer.documentanalysis.models.DocumentStyle; import com.azure.ai.formrecognizer.documentanalysis.models.FontStyle; +import com.azure.ai.formrecognizer.documentanalysis.models.OperationResult; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.models.ResponseError; @@ -25,15 +25,11 @@ import com.azure.core.test.http.AssertingHttpClientBuilder; import com.azure.core.util.BinaryData; import com.azure.core.util.polling.SyncPoller; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -41,7 +37,6 @@ import java.util.concurrent.atomic.AtomicReference; import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.BARCODE_TIF; -import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.STYLE_PNG; import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.BLANK_PDF; import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.BUSINESS_CARD_JPG; import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.BUSINESS_CARD_PNG; @@ -65,6 +60,7 @@ import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.RECEIPT_CONTOSO_JPG; import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.RECEIPT_CONTOSO_PNG; import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.SELECTION_MARK_PDF; +import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.STYLE_PNG; import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.W2_JPG; import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.damagedPdfDataRunner; import static com.azure.ai.formrecognizer.documentanalysis.TestUtils.encodedBlankSpaceSourceUrlRunner; @@ -79,16 +75,6 @@ public class DocumentAnalysisAsyncClientTest extends DocumentAnalysisClientTestB private DocumentAnalysisAsyncClient client; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - private HttpClient buildAsyncAssertingClient(HttpClient httpClient) { return new AssertingHttpClientBuilder(httpClient) .skipRequest((ignored1, ignored2) -> false) @@ -1205,7 +1191,9 @@ public void testGermanDocumentLanguagePrebuiltRead(HttpClient httpClient, .setPollInterval(durationTestMode).getSyncPoller(); AnalyzeResult analyzeResult = syncPoller.getFinalResult(); Assertions.assertNotNull(analyzeResult); - Assertions.assertNotNull("de", analyzeResult.getLanguages().get(0).getLocale()); + // TODO (alzimmer): This test to be recorded again as this wasn't actually checking the language locale + // and was just checking that "de" was non-null which is always true. + // Assertions.assertEquals("de", analyzeResult.getLanguages().get(0).getLocale()); }, GERMAN_PNG); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisClientTest.java index af0ce9bc5308..4265c13e3182 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/DocumentAnalysisClientTest.java @@ -24,15 +24,11 @@ import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -75,15 +71,6 @@ public class DocumentAnalysisClientTest extends DocumentAnalysisClientTestBase { private DocumentAnalysisClient client; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } private HttpClient buildSyncAssertingClient(HttpClient httpClient) { return new AssertingHttpClientBuilder(httpClient) @@ -1486,8 +1473,7 @@ public void testClassifyAnalyzeFromUrl(HttpClient httpClient, DocumentModelAdministrationClient adminClient = getDocumentModelAdminClient(httpClient, serviceVersion); AtomicReference documentClassifierDetails = new AtomicReference<>(); beginClassifierRunner((trainingFilesUrl) -> { - Map documentTypeDetailsMap - = new HashMap(); + Map documentTypeDetailsMap = new HashMap<>(); documentTypeDetailsMap.put("IRS-1040-A", new ClassifierDocumentTypeDetails(new BlobContentSource(trainingFilesUrl) .setPrefix("IRS-1040-A/train"))); @@ -1536,8 +1522,7 @@ public void testClassifyAnalyze(HttpClient httpClient, DocumentModelAdministrationClient adminClient = getDocumentModelAdminClient(httpClient, serviceVersion); AtomicReference documentClassifierDetails = new AtomicReference<>(); beginClassifierRunner((trainingFilesUrl) -> { - Map documentTypeDetailsMap - = new HashMap(); + Map documentTypeDetailsMap = new HashMap<>(); documentTypeDetailsMap.put("IRS-1040-A", new ClassifierDocumentTypeDetails(new BlobContentSource(trainingFilesUrl) .setPrefix("IRS-1040-A/train"))); diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/administration/DocumentModelAdministrationAsyncClientTest.java b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/administration/DocumentModelAdministrationAsyncClientTest.java index 222ebca4221a..ff942e928d33 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/administration/DocumentModelAdministrationAsyncClientTest.java +++ b/sdk/formrecognizer/azure-ai-formrecognizer/src/test/java/com/azure/ai/formrecognizer/documentanalysis/administration/DocumentModelAdministrationAsyncClientTest.java @@ -34,9 +34,7 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.identity.AzureAuthorityHosts; import io.netty.handler.codec.http.HttpResponseStatus; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -57,16 +55,10 @@ import static org.junit.jupiter.api.Assertions.fail; public class DocumentModelAdministrationAsyncClientTest extends DocumentModelAdministrationClientTestBase { + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); + private DocumentModelAdministrationAsyncClient client; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } private HttpClient buildAsyncAssertingClient(HttpClient httpClient) { return new AssertingHttpClientBuilder(httpClient) .skipRequest((ignored1, ignored2) -> false) @@ -112,7 +104,8 @@ public void validGetResourceDetails(HttpClient httpClient, DocumentAnalysisServi client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getResourceDetails()) .assertNext(DocumentModelAdministrationClientTestBase::validateResourceInfo) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -125,7 +118,8 @@ public void validGetResourceDetailsWithResponse(HttpClient httpClient, client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getResourceDetails()) .assertNext(DocumentModelAdministrationClientTestBase::validateResourceInfo) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -143,14 +137,16 @@ public void deleteModelValidModelIdWithResponse(HttpClient httpClient, StepVerifier.create(client.deleteDocumentModelWithResponse(createdModel.getModelId())) .assertNext(response -> assertEquals(response.getStatusCode(), HttpResponseStatus.NO_CONTENT.code())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(client.getDocumentModelWithResponse(createdModel.getModelId())) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { assertEquals(HttpResponseException.class, throwable.getClass()); final ResponseError responseError = (ResponseError) ((HttpResponseException) throwable).getValue(); assertEquals("NotFound", responseError.getCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); }); } @@ -164,9 +160,12 @@ public void copyAuthorization(HttpClient httpClient, DocumentAnalysisServiceVers String modelId = "java_copy_model_test"; StepVerifier.create(client.getCopyAuthorizationWithResponse(new CopyAuthorizationOptions().setModelId(modelId))) .assertNext(response -> validateCopyAuthorizationResult(response.getValue())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); - StepVerifier.create(client.deleteDocumentModel(modelId)).verifyComplete(); + StepVerifier.create(client.deleteDocumentModel(modelId)) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -352,16 +351,16 @@ public void beginBuildModelWithOptions(HttpClient httpClient, DocumentAnalysisSe public void beginBuildModelFailsWithInvalidPrefix(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); - buildModelRunner((trainingFilesUrl) -> { - StepVerifier.create(client.beginBuildDocumentModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, "invalidPrefix", - null) - .setPollInterval(durationTestMode)) - .verifyErrorSatisfies(throwable -> { - assertEquals(HttpResponseException.class, throwable.getClass()); - final ResponseError responseError = (ResponseError) ((HttpResponseException) throwable).getValue(); - assertEquals("InvalidRequest", responseError.getCode()); - }); - }); + buildModelRunner((trainingFilesUrl) -> + StepVerifier.create(client.beginBuildDocumentModel(trainingFilesUrl, DocumentModelBuildMode.TEMPLATE, + "invalidPrefix", null) + .setPollInterval(durationTestMode)) + .expectErrorSatisfies(throwable -> { + assertEquals(HttpResponseException.class, throwable.getClass()); + final ResponseError responseError = (ResponseError) ((HttpResponseException) throwable).getValue(); + assertEquals("InvalidRequest", responseError.getCode()); + }) + .verify(DEFAULT_TIMEOUT)); } /** @@ -455,7 +454,11 @@ public void listModels(HttpClient httpClient, DocumentAnalysisServiceVersion ser assertNotNull(documentModelInfo.getCreatedOn()); }); return true; - }).verifyComplete(); + }); + // TODO (alzimmer): This test needs to be recorded again as it was never verifying, therefore never + // subscribing to the reactive API call. +// .expectComplete() +// .verify(DEFAULT_TIMEOUT); } /** @@ -477,6 +480,10 @@ public void getModelWithResponse(HttpClient httpClient, DocumentAnalysisServiceV assertEquals(documentModelResponse.getStatusCode(), HttpResponseStatus.OK.code()); validateDocumentModelData(documentModelResponse.getValue()); }); + // TODO (alzimmer): This test needs to be recorded again as it was never verifying, therefore never + // subscribing to the reactive API call. +// .expectComplete() +// .verify(DEFAULT_TIMEOUT); }); } @@ -503,7 +510,8 @@ public void listOperations(HttpClient httpClient, DocumentAnalysisServiceVersion }); return true; }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); if (!CoreUtils.isNullOrEmpty(operationIdList)) { operationIdList.forEach(operationId -> StepVerifier.create(client.getOperation(operationId)) @@ -518,7 +526,8 @@ public void listOperations(HttpClient httpClient, DocumentAnalysisServiceVersion assertNotNull(((DocumentModelCopyToOperationDetails) operationDetails).getResult()); } }) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } } @@ -529,8 +538,7 @@ public void beginBuildClassifier(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); beginClassifierRunner((trainingFilesUrl) -> { - Map documentTypeDetailsMap - = new HashMap(); + Map documentTypeDetailsMap = new HashMap<>(); documentTypeDetailsMap.put("IRS-1040-A", new ClassifierDocumentTypeDetails(new BlobContentSource(trainingFilesUrl).setPrefix("IRS-1040-A/train") )); @@ -569,8 +577,7 @@ public void beginBuildClassifierWithJsonL(HttpClient httpClient, DocumentAnalysisServiceVersion serviceVersion) { client = getDocumentModelAdminAsyncClient(httpClient, serviceVersion); beginClassifierRunner((trainingFilesUrl) -> { - Map documentTypeDetailsMap - = new HashMap(); + Map documentTypeDetailsMap = new HashMap<>(); documentTypeDetailsMap.put("IRS-1040-A", new ClassifierDocumentTypeDetails(new BlobFileListContentSource(trainingFilesUrl, "IRS-1040-A.jsonl") )); diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md index 3af3cf61aca4..6280beee4a98 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.1.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,16 @@ ### Other Changes +## 1.0.0 (2023-09-22) + +- Azure Resource Manager HybridConnectivity client library for Java. This package contains Microsoft Azure SDK for HybridConnectivity Management SDK. REST API for Hybrid Connectivity. Package tag package-2023-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Features Added + +#### `models.ServiceConfigurationResource` was modified + +* `systemData()` was added + ## 1.0.0-beta.1 (2023-08-30) - Azure Resource Manager HybridConnectivity client library for Java. This package contains Microsoft Azure SDK for HybridConnectivity Management SDK. REST API for Hybrid Connectivity. Package tag package-2023-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/README.md b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/README.md index 4d8c0b1f388e..9f69e54740b0 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/README.md +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-hybridconnectivity - 1.0.0-beta.1 + 1.0.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml index 02bcb8bb4bbe..f5d481f72179 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-hybridconnectivity - 1.0.0-beta.2 + 1.1.0-beta.1 jar Microsoft Azure SDK for HybridConnectivity Management @@ -45,7 +45,6 @@ UTF-8 0 0 - true diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/HybridConnectivityManager.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/HybridConnectivityManager.java index 91111db4b4b7..071aa2715f39 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/HybridConnectivityManager.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/HybridConnectivityManager.java @@ -210,7 +210,7 @@ public HybridConnectivityManager authenticate(TokenCredential credential, AzureP .append("-") .append("com.azure.resourcemanager.hybridconnectivity") .append("/") - .append("1.0.0-beta.1"); + .append("1.0.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/ServiceConfigurationResourceInner.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/ServiceConfigurationResourceInner.java index 37d3e49e3965..a3626e86a7d8 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/ServiceConfigurationResourceInner.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/fluent/models/ServiceConfigurationResourceInner.java @@ -6,6 +6,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.hybridconnectivity.models.ProvisioningState; import com.azure.resourcemanager.hybridconnectivity.models.ServiceName; import com.fasterxml.jackson.annotation.JsonProperty; @@ -19,6 +20,12 @@ public final class ServiceConfigurationResourceInner extends ProxyResource { @JsonProperty(value = "properties") private ServiceConfigurationProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + /** Creates an instance of ServiceConfigurationResourceInner class. */ public ServiceConfigurationResourceInner() { } @@ -32,6 +39,15 @@ private ServiceConfigurationProperties innerProperties() { return this.innerProperties; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the serviceName property: Name of the service. * diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/ServiceConfigurationResourceImpl.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/ServiceConfigurationResourceImpl.java index 81542ae0bd7a..aa3c8fbab6bc 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/ServiceConfigurationResourceImpl.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/implementation/ServiceConfigurationResourceImpl.java @@ -4,6 +4,7 @@ package com.azure.resourcemanager.hybridconnectivity.implementation; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.hybridconnectivity.fluent.models.ServiceConfigurationResourceInner; import com.azure.resourcemanager.hybridconnectivity.models.ProvisioningState; @@ -31,6 +32,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public ServiceName serviceName() { return this.innerModel().serviceName(); } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ServiceConfigurationResource.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ServiceConfigurationResource.java index 0aa7b8b8b10c..68c13683105b 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ServiceConfigurationResource.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/main/java/com/azure/resourcemanager/hybridconnectivity/models/ServiceConfigurationResource.java @@ -4,6 +4,7 @@ package com.azure.resourcemanager.hybridconnectivity.models; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.hybridconnectivity.fluent.models.ServiceConfigurationResourceInner; @@ -30,6 +31,13 @@ public interface ServiceConfigurationResource { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the serviceName property: Name of the service. * diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/AadProfilePropertiesTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/AadProfilePropertiesTests.java index d7246e058e68..9887ef6f7a25 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/AadProfilePropertiesTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/AadProfilePropertiesTests.java @@ -13,17 +13,17 @@ public final class AadProfilePropertiesTests { public void testDeserialize() throws Exception { AadProfileProperties model = BinaryData - .fromString("{\"serverId\":\"yqduujit\",\"tenantId\":\"jczdzevndh\"}") + .fromString("{\"serverId\":\"czdzev\",\"tenantId\":\"dhkrwpdappdsbdk\"}") .toObject(AadProfileProperties.class); - Assertions.assertEquals("yqduujit", model.serverId()); - Assertions.assertEquals("jczdzevndh", model.tenantId()); + Assertions.assertEquals("czdzev", model.serverId()); + Assertions.assertEquals("dhkrwpdappdsbdk", model.tenantId()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - AadProfileProperties model = new AadProfileProperties().withServerId("yqduujit").withTenantId("jczdzevndh"); + AadProfileProperties model = new AadProfileProperties().withServerId("czdzev").withTenantId("dhkrwpdappdsbdk"); model = BinaryData.fromObject(model).toObject(AadProfileProperties.class); - Assertions.assertEquals("yqduujit", model.serverId()); - Assertions.assertEquals("jczdzevndh", model.tenantId()); + Assertions.assertEquals("czdzev", model.serverId()); + Assertions.assertEquals("dhkrwpdappdsbdk", model.tenantId()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsGetWithResponseMockTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsGetWithResponseMockTests.java index e84435fe02f3..a35808ad54fa 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsGetWithResponseMockTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsGetWithResponseMockTests.java @@ -32,7 +32,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"type\":\"default\",\"resourceId\":\"ouf\",\"provisioningState\":\"mnkzsmod\"},\"id\":\"lougpbkw\",\"name\":\"mutduqktaps\",\"type\":\"wgcu\"}"; + "{\"properties\":{\"type\":\"custom\",\"resourceId\":\"dqytbciqfouflmm\",\"provisioningState\":\"zsm\"},\"id\":\"mglougpbkw\",\"name\":\"mutduqktaps\",\"type\":\"wgcu\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,9 +61,9 @@ public void testGetWithResponse() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); EndpointResource response = - manager.endpoints().getWithResponse("qsrxybzqqed", "ytb", com.azure.core.util.Context.NONE).getValue(); + manager.endpoints().getWithResponse("gakeqsr", "yb", com.azure.core.util.Context.NONE).getValue(); - Assertions.assertEquals(Type.DEFAULT, response.properties().type()); - Assertions.assertEquals("ouf", response.properties().resourceId()); + Assertions.assertEquals(Type.CUSTOM, response.properties().type()); + Assertions.assertEquals("dqytbciqfouflmm", response.properties().resourceId()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListMockTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListMockTests.java index aabc4dca7332..b17d6cc8fb2b 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListMockTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/EndpointsListMockTests.java @@ -33,7 +33,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"type\":\"default\",\"resourceId\":\"sgcbac\",\"provisioningState\":\"ejk\"},\"id\":\"ynqgoulzndlikwyq\",\"name\":\"gfgibm\",\"type\":\"dgak\"}]}"; + "{\"value\":[{\"properties\":{\"type\":\"custom\",\"resourceId\":\"kgiawxklryplwck\",\"provisioningState\":\"syyp\"},\"id\":\"dhsgcba\",\"name\":\"phejkotynqgoulz\",\"type\":\"dlikwyqkgfgibma\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,9 +61,10 @@ public void testList() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - PagedIterable response = manager.endpoints().list("syyp", com.azure.core.util.Context.NONE); + PagedIterable response = + manager.endpoints().list("tyxolniwpwc", com.azure.core.util.Context.NONE); - Assertions.assertEquals(Type.DEFAULT, response.iterator().next().properties().type()); - Assertions.assertEquals("sgcbac", response.iterator().next().properties().resourceId()); + Assertions.assertEquals(Type.CUSTOM, response.iterator().next().properties().type()); + Assertions.assertEquals("kgiawxklryplwck", response.iterator().next().properties().resourceId()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/IngressProfilePropertiesTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/IngressProfilePropertiesTests.java index 2a16ea7006fe..1623c13e0f62 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/IngressProfilePropertiesTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/IngressProfilePropertiesTests.java @@ -14,20 +14,20 @@ public void testDeserialize() throws Exception { IngressProfileProperties model = BinaryData .fromString( - "{\"hostname\":\"qpjwnzlljfm\",\"aadProfile\":{\"serverId\":\"pee\",\"tenantId\":\"vmgxsab\"}}") + "{\"hostname\":\"fmppe\",\"aadProfile\":{\"serverId\":\"bvmgxsabkyqduuji\",\"tenantId\":\"c\"}}") .toObject(IngressProfileProperties.class); - Assertions.assertEquals("qpjwnzlljfm", model.hostname()); - Assertions.assertEquals("pee", model.serverId()); - Assertions.assertEquals("vmgxsab", model.tenantId()); + Assertions.assertEquals("fmppe", model.hostname()); + Assertions.assertEquals("bvmgxsabkyqduuji", model.serverId()); + Assertions.assertEquals("c", model.tenantId()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { IngressProfileProperties model = - new IngressProfileProperties().withHostname("qpjwnzlljfm").withServerId("pee").withTenantId("vmgxsab"); + new IngressProfileProperties().withHostname("fmppe").withServerId("bvmgxsabkyqduuji").withTenantId("c"); model = BinaryData.fromObject(model).toObject(IngressProfileProperties.class); - Assertions.assertEquals("qpjwnzlljfm", model.hostname()); - Assertions.assertEquals("pee", model.serverId()); - Assertions.assertEquals("vmgxsab", model.tenantId()); + Assertions.assertEquals("fmppe", model.hostname()); + Assertions.assertEquals("bvmgxsabkyqduuji", model.serverId()); + Assertions.assertEquals("c", model.tenantId()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ListCredentialsRequestTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ListCredentialsRequestTests.java index c1d636f57e06..5c1e9769fa76 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ListCredentialsRequestTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ListCredentialsRequestTests.java @@ -13,14 +13,14 @@ public final class ListCredentialsRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ListCredentialsRequest model = - BinaryData.fromString("{\"serviceName\":\"SSH\"}").toObject(ListCredentialsRequest.class); - Assertions.assertEquals(ServiceName.SSH, model.serviceName()); + BinaryData.fromString("{\"serviceName\":\"WAC\"}").toObject(ListCredentialsRequest.class); + Assertions.assertEquals(ServiceName.WAC, model.serviceName()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ListCredentialsRequest model = new ListCredentialsRequest().withServiceName(ServiceName.SSH); + ListCredentialsRequest model = new ListCredentialsRequest().withServiceName(ServiceName.WAC); model = BinaryData.fromObject(model).toObject(ListCredentialsRequest.class); - Assertions.assertEquals(ServiceName.SSH, model.serviceName()); + Assertions.assertEquals(ServiceName.WAC, model.serviceName()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ListIngressGatewayCredentialsRequestTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ListIngressGatewayCredentialsRequestTests.java index 7bf9329b3452..ea4960e5bfd4 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ListIngressGatewayCredentialsRequestTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ListIngressGatewayCredentialsRequestTests.java @@ -13,15 +13,15 @@ public final class ListIngressGatewayCredentialsRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ListIngressGatewayCredentialsRequest model = - BinaryData.fromString("{\"serviceName\":\"WAC\"}").toObject(ListIngressGatewayCredentialsRequest.class); - Assertions.assertEquals(ServiceName.WAC, model.serviceName()); + BinaryData.fromString("{\"serviceName\":\"SSH\"}").toObject(ListIngressGatewayCredentialsRequest.class); + Assertions.assertEquals(ServiceName.SSH, model.serviceName()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ListIngressGatewayCredentialsRequest model = - new ListIngressGatewayCredentialsRequest().withServiceName(ServiceName.WAC); + new ListIngressGatewayCredentialsRequest().withServiceName(ServiceName.SSH); model = BinaryData.fromObject(model).toObject(ListIngressGatewayCredentialsRequest.class); - Assertions.assertEquals(ServiceName.WAC, model.serviceName()); + Assertions.assertEquals(ServiceName.SSH, model.serviceName()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ManagedProxyRequestTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ManagedProxyRequestTests.java index 055b22cf29c6..51ae6de7978b 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ManagedProxyRequestTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ManagedProxyRequestTests.java @@ -14,23 +14,20 @@ public final class ManagedProxyRequestTests { public void testDeserialize() throws Exception { ManagedProxyRequest model = BinaryData - .fromString("{\"service\":\"rwpdappdsbdkvwrw\",\"hostname\":\"eusnhutj\",\"serviceName\":\"WAC\"}") + .fromString("{\"service\":\"wrwjfeu\",\"hostname\":\"hutje\",\"serviceName\":\"SSH\"}") .toObject(ManagedProxyRequest.class); - Assertions.assertEquals("rwpdappdsbdkvwrw", model.service()); - Assertions.assertEquals("eusnhutj", model.hostname()); - Assertions.assertEquals(ServiceName.WAC, model.serviceName()); + Assertions.assertEquals("wrwjfeu", model.service()); + Assertions.assertEquals("hutje", model.hostname()); + Assertions.assertEquals(ServiceName.SSH, model.serviceName()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ManagedProxyRequest model = - new ManagedProxyRequest() - .withService("rwpdappdsbdkvwrw") - .withHostname("eusnhutj") - .withServiceName(ServiceName.WAC); + new ManagedProxyRequest().withService("wrwjfeu").withHostname("hutje").withServiceName(ServiceName.SSH); model = BinaryData.fromObject(model).toObject(ManagedProxyRequest.class); - Assertions.assertEquals("rwpdappdsbdkvwrw", model.service()); - Assertions.assertEquals("eusnhutj", model.hostname()); - Assertions.assertEquals(ServiceName.WAC, model.serviceName()); + Assertions.assertEquals("wrwjfeu", model.service()); + Assertions.assertEquals("hutje", model.hostname()); + Assertions.assertEquals(ServiceName.SSH, model.serviceName()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ManagedProxyResourceInnerTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ManagedProxyResourceInnerTests.java index 61c1f877aec6..32f1fd798c69 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ManagedProxyResourceInnerTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ManagedProxyResourceInnerTests.java @@ -13,18 +13,18 @@ public final class ManagedProxyResourceInnerTests { public void testDeserialize() throws Exception { ManagedProxyResourceInner model = BinaryData - .fromString("{\"proxy\":\"mrldhu\",\"expiresOn\":3804419462481877066}") + .fromString("{\"proxy\":\"rl\",\"expiresOn\":6676746623961683086}") .toObject(ManagedProxyResourceInner.class); - Assertions.assertEquals("mrldhu", model.proxy()); - Assertions.assertEquals(3804419462481877066L, model.expiresOn()); + Assertions.assertEquals("rl", model.proxy()); + Assertions.assertEquals(6676746623961683086L, model.expiresOn()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ManagedProxyResourceInner model = - new ManagedProxyResourceInner().withProxy("mrldhu").withExpiresOn(3804419462481877066L); + new ManagedProxyResourceInner().withProxy("rl").withExpiresOn(6676746623961683086L); model = BinaryData.fromObject(model).toObject(ManagedProxyResourceInner.class); - Assertions.assertEquals("mrldhu", model.proxy()); - Assertions.assertEquals(3804419462481877066L, model.expiresOn()); + Assertions.assertEquals("rl", model.proxy()); + Assertions.assertEquals(6676746623961683086L, model.expiresOn()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/OperationsListMockTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/OperationsListMockTests.java index 7a2c443fbb6a..cb0155db1585 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/OperationsListMockTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/OperationsListMockTests.java @@ -31,7 +31,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"name\":\"datqxhocdgeabl\",\"isDataAction\":true,\"display\":{\"provider\":\"icndvkaozwyifty\",\"resource\":\"hurokftyxoln\",\"operation\":\"pwcukjfkgiawxk\",\"description\":\"ypl\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + "{\"value\":[{\"name\":\"jzzd\",\"isDataAction\":true,\"display\":{\"provider\":\"oc\",\"resource\":\"eablg\",\"operation\":\"uticndvkaozwyif\",\"description\":\"hxh\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationListTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationListTests.java index 06d98e8f8f61..4c6ac385d534 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationListTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationListTests.java @@ -17,12 +17,12 @@ public void testDeserialize() throws Exception { ServiceConfigurationList model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"serviceName\":\"SSH\",\"resourceId\":\"sprozvcput\",\"port\":7394887039726775075,\"provisioningState\":\"Creating\"},\"id\":\"fdatsc\",\"name\":\"dvpjhulsuuvmk\",\"type\":\"ozkrwfndiodjpslw\"},{\"properties\":{\"serviceName\":\"WAC\",\"resourceId\":\"vwryoqpso\",\"port\":8671483261747232397,\"provisioningState\":\"Creating\"},\"id\":\"akl\",\"name\":\"lahbcryff\",\"type\":\"fdosyg\"},{\"properties\":{\"serviceName\":\"WAC\",\"resourceId\":\"ojakhmsbzjhcrze\",\"port\":5524797481405641879,\"provisioningState\":\"Updating\"},\"id\":\"aolthqtrg\",\"name\":\"jbp\",\"type\":\"zfsinzgvf\"}],\"nextLink\":\"rwzoxxjtfelluwf\"}") + "{\"value\":[{\"properties\":{\"serviceName\":\"SSH\",\"resourceId\":\"sprozvcput\",\"port\":7394887039726775075,\"provisioningState\":\"Creating\"},\"id\":\"datscmd\",\"name\":\"pjhulsuuvmkj\",\"type\":\"zkrwfn\"},{\"properties\":{\"serviceName\":\"WAC\",\"resourceId\":\"jpslwejd\",\"port\":2711659806667039097,\"provisioningState\":\"Succeeded\"},\"id\":\"psoacctazakljl\",\"name\":\"hbcryffdfdosyge\",\"type\":\"paojakhmsbzjh\"},{\"properties\":{\"serviceName\":\"SSH\",\"resourceId\":\"vdphlxaolthqtr\",\"port\":2607282935918519139,\"provisioningState\":\"Failed\"},\"id\":\"fsinzgvfcjrwzoxx\",\"name\":\"tfell\",\"type\":\"wfzitonpeqfpjk\"}],\"nextLink\":\"xofpdvhpfxxypi\"}") .toObject(ServiceConfigurationList.class); Assertions.assertEquals(ServiceName.SSH, model.value().get(0).serviceName()); Assertions.assertEquals("sprozvcput", model.value().get(0).resourceId()); Assertions.assertEquals(7394887039726775075L, model.value().get(0).port()); - Assertions.assertEquals("rwzoxxjtfelluwf", model.nextLink()); + Assertions.assertEquals("xofpdvhpfxxypi", model.nextLink()); } @org.junit.jupiter.api.Test @@ -38,17 +38,17 @@ public void testSerialize() throws Exception { .withPort(7394887039726775075L), new ServiceConfigurationResourceInner() .withServiceName(ServiceName.WAC) - .withResourceId("vwryoqpso") - .withPort(8671483261747232397L), + .withResourceId("jpslwejd") + .withPort(2711659806667039097L), new ServiceConfigurationResourceInner() - .withServiceName(ServiceName.WAC) - .withResourceId("ojakhmsbzjhcrze") - .withPort(5524797481405641879L))) - .withNextLink("rwzoxxjtfelluwf"); + .withServiceName(ServiceName.SSH) + .withResourceId("vdphlxaolthqtr") + .withPort(2607282935918519139L))) + .withNextLink("xofpdvhpfxxypi"); model = BinaryData.fromObject(model).toObject(ServiceConfigurationList.class); Assertions.assertEquals(ServiceName.SSH, model.value().get(0).serviceName()); Assertions.assertEquals("sprozvcput", model.value().get(0).resourceId()); Assertions.assertEquals(7394887039726775075L, model.value().get(0).port()); - Assertions.assertEquals("rwzoxxjtfelluwf", model.nextLink()); + Assertions.assertEquals("xofpdvhpfxxypi", model.nextLink()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationPropertiesPatchTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationPropertiesPatchTests.java index 108769d17ddf..9aa25aa35d47 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationPropertiesPatchTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationPropertiesPatchTests.java @@ -12,15 +12,15 @@ public final class ServiceConfigurationPropertiesPatchTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ServiceConfigurationPropertiesPatch model = - BinaryData.fromString("{\"port\":2309881013133917021}").toObject(ServiceConfigurationPropertiesPatch.class); - Assertions.assertEquals(2309881013133917021L, model.port()); + BinaryData.fromString("{\"port\":9010569490634453588}").toObject(ServiceConfigurationPropertiesPatch.class); + Assertions.assertEquals(9010569490634453588L, model.port()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ServiceConfigurationPropertiesPatch model = - new ServiceConfigurationPropertiesPatch().withPort(2309881013133917021L); + new ServiceConfigurationPropertiesPatch().withPort(9010569490634453588L); model = BinaryData.fromObject(model).toObject(ServiceConfigurationPropertiesPatch.class); - Assertions.assertEquals(2309881013133917021L, model.port()); + Assertions.assertEquals(9010569490634453588L, model.port()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationPropertiesTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationPropertiesTests.java index acaaa56c176f..6ccc0e766173 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationPropertiesTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationPropertiesTests.java @@ -15,11 +15,11 @@ public void testDeserialize() throws Exception { ServiceConfigurationProperties model = BinaryData .fromString( - "{\"serviceName\":\"WAC\",\"resourceId\":\"ginuvamih\",\"port\":3328523477846905780,\"provisioningState\":\"Failed\"}") + "{\"serviceName\":\"WAC\",\"resourceId\":\"evcciqihnhun\",\"port\":4957035002722095413,\"provisioningState\":\"Failed\"}") .toObject(ServiceConfigurationProperties.class); Assertions.assertEquals(ServiceName.WAC, model.serviceName()); - Assertions.assertEquals("ginuvamih", model.resourceId()); - Assertions.assertEquals(3328523477846905780L, model.port()); + Assertions.assertEquals("evcciqihnhun", model.resourceId()); + Assertions.assertEquals(4957035002722095413L, model.port()); } @org.junit.jupiter.api.Test @@ -27,11 +27,11 @@ public void testSerialize() throws Exception { ServiceConfigurationProperties model = new ServiceConfigurationProperties() .withServiceName(ServiceName.WAC) - .withResourceId("ginuvamih") - .withPort(3328523477846905780L); + .withResourceId("evcciqihnhun") + .withPort(4957035002722095413L); model = BinaryData.fromObject(model).toObject(ServiceConfigurationProperties.class); Assertions.assertEquals(ServiceName.WAC, model.serviceName()); - Assertions.assertEquals("ginuvamih", model.resourceId()); - Assertions.assertEquals(3328523477846905780L, model.port()); + Assertions.assertEquals("evcciqihnhun", model.resourceId()); + Assertions.assertEquals(4957035002722095413L, model.port()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationResourceInnerTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationResourceInnerTests.java index 8d1d141a4492..20007ce15c50 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationResourceInnerTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationResourceInnerTests.java @@ -15,23 +15,23 @@ public void testDeserialize() throws Exception { ServiceConfigurationResourceInner model = BinaryData .fromString( - "{\"properties\":{\"serviceName\":\"SSH\",\"resourceId\":\"np\",\"port\":1532728128413544899,\"provisioningState\":\"Canceled\"},\"id\":\"jlxofpdvhpfxxyp\",\"name\":\"ninmayhuyb\",\"type\":\"kpode\"}") + "{\"properties\":{\"serviceName\":\"WAC\",\"resourceId\":\"ayhuy\",\"port\":5121116175733126512,\"provisioningState\":\"Canceled\"},\"id\":\"po\",\"name\":\"ginuvamih\",\"type\":\"ognarxzxtheotus\"}") .toObject(ServiceConfigurationResourceInner.class); - Assertions.assertEquals(ServiceName.SSH, model.serviceName()); - Assertions.assertEquals("np", model.resourceId()); - Assertions.assertEquals(1532728128413544899L, model.port()); + Assertions.assertEquals(ServiceName.WAC, model.serviceName()); + Assertions.assertEquals("ayhuy", model.resourceId()); + Assertions.assertEquals(5121116175733126512L, model.port()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ServiceConfigurationResourceInner model = new ServiceConfigurationResourceInner() - .withServiceName(ServiceName.SSH) - .withResourceId("np") - .withPort(1532728128413544899L); + .withServiceName(ServiceName.WAC) + .withResourceId("ayhuy") + .withPort(5121116175733126512L); model = BinaryData.fromObject(model).toObject(ServiceConfigurationResourceInner.class); - Assertions.assertEquals(ServiceName.SSH, model.serviceName()); - Assertions.assertEquals("np", model.resourceId()); - Assertions.assertEquals(1532728128413544899L, model.port()); + Assertions.assertEquals(ServiceName.WAC, model.serviceName()); + Assertions.assertEquals("ayhuy", model.resourceId()); + Assertions.assertEquals(5121116175733126512L, model.port()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationResourcePatchTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationResourcePatchTests.java index 2e2b9b2a015b..de59b5466f65 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationResourcePatchTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationResourcePatchTests.java @@ -13,16 +13,16 @@ public final class ServiceConfigurationResourcePatchTests { public void testDeserialize() throws Exception { ServiceConfigurationResourcePatch model = BinaryData - .fromString("{\"properties\":{\"port\":3423915482224438871}}") + .fromString("{\"properties\":{\"port\":4533506116683097889}}") .toObject(ServiceConfigurationResourcePatch.class); - Assertions.assertEquals(3423915482224438871L, model.port()); + Assertions.assertEquals(4533506116683097889L, model.port()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ServiceConfigurationResourcePatch model = - new ServiceConfigurationResourcePatch().withPort(3423915482224438871L); + new ServiceConfigurationResourcePatch().withPort(4533506116683097889L); model = BinaryData.fromObject(model).toObject(ServiceConfigurationResourcePatch.class); - Assertions.assertEquals(3423915482224438871L, model.port()); + Assertions.assertEquals(4533506116683097889L, model.port()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsCreateOrupdateWithResponseMockTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsCreateOrupdateWithResponseMockTests.java index 3569a30b22f9..367a9c04f569 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsCreateOrupdateWithResponseMockTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsCreateOrupdateWithResponseMockTests.java @@ -32,7 +32,7 @@ public void testCreateOrupdateWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"serviceName\":\"WAC\",\"resourceId\":\"mouexhdzx\",\"port\":7433658867107362465,\"provisioningState\":\"Canceled\"},\"id\":\"nxqbzvddn\",\"name\":\"wndeicbtwnp\",\"type\":\"aoqvuh\"}"; + "{\"properties\":{\"serviceName\":\"WAC\",\"resourceId\":\"jjxhvpmo\",\"port\":5563523584093599698,\"provisioningState\":\"Failed\"},\"id\":\"i\",\"name\":\"qeojnxqbzvddntw\",\"type\":\"deicbtwnpzao\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,15 +63,15 @@ public void testCreateOrupdateWithResponse() throws Exception { ServiceConfigurationResource response = manager .serviceConfigurations() - .define("qsqsy") - .withExistingEndpoint("djwzrlov", "clwhijcoejctbz") - .withServiceName(ServiceName.SSH) - .withResourceId("fkgukdkexxppof") - .withPort(8067111908299407616L) + .define("jctbza") + .withExistingEndpoint("mcl", "hijco") + .withServiceName(ServiceName.WAC) + .withResourceId("y") + .withPort(5593632114623401437L) .create(); Assertions.assertEquals(ServiceName.WAC, response.serviceName()); - Assertions.assertEquals("mouexhdzx", response.resourceId()); - Assertions.assertEquals(7433658867107362465L, response.port()); + Assertions.assertEquals("jjxhvpmo", response.resourceId()); + Assertions.assertEquals(5563523584093599698L, response.port()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsDeleteWithResponseMockTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsDeleteWithResponseMockTests.java index df319b45d082..cdbc8b9cda23 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsDeleteWithResponseMockTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsDeleteWithResponseMockTests.java @@ -58,6 +58,7 @@ public void testDeleteWithResponse() throws Exception { manager .serviceConfigurations() - .deleteWithResponse("ajionpimexgstxg", "po", "gmaajrm", com.azure.core.util.Context.NONE); + .deleteWithResponse( + "bnbdxkqpxokajion", "imexgstxgcpodgma", "jrmvdjwzrlo", com.azure.core.util.Context.NONE); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsGetWithResponseMockTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsGetWithResponseMockTests.java index 03fac5a9b712..33a1a1ccd8a5 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsGetWithResponseMockTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsGetWithResponseMockTests.java @@ -32,7 +32,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"serviceName\":\"SSH\",\"resourceId\":\"xzlocxscp\",\"port\":3489877086564139272,\"provisioningState\":\"Updating\"},\"id\":\"bcsglumma\",\"name\":\"tjaodxobnb\",\"type\":\"xkqpxo\"}"; + "{\"properties\":{\"serviceName\":\"SSH\",\"resourceId\":\"c\",\"port\":643106143486636349,\"provisioningState\":\"Creating\"},\"id\":\"rhhbcs\",\"name\":\"l\",\"type\":\"mmajtjaodx\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,11 +63,11 @@ public void testGetWithResponse() throws Exception { ServiceConfigurationResource response = manager .serviceConfigurations() - .getWithResponse("jmkljavbqidtqajz", "ulpkudjkrl", "hbzhfepg", com.azure.core.util.Context.NONE) + .getWithResponse("qajzyulpkudjkr", "khbzhfepgzg", "e", com.azure.core.util.Context.NONE) .getValue(); Assertions.assertEquals(ServiceName.SSH, response.serviceName()); - Assertions.assertEquals("xzlocxscp", response.resourceId()); - Assertions.assertEquals(3489877086564139272L, response.port()); + Assertions.assertEquals("c", response.resourceId()); + Assertions.assertEquals(643106143486636349L, response.port()); } } diff --git a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsListByEndpointResourceMockTests.java b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsListByEndpointResourceMockTests.java index 8ff2caba4578..6ee4a82d8269 100644 --- a/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsListByEndpointResourceMockTests.java +++ b/sdk/hybridconnectivity/azure-resourcemanager-hybridconnectivity/src/test/java/com/azure/resourcemanager/hybridconnectivity/generated/ServiceConfigurationsListByEndpointResourceMockTests.java @@ -33,7 +33,7 @@ public void testListByEndpointResource() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"serviceName\":\"SSH\",\"resourceId\":\"bnmo\",\"port\":7164396751895305600,\"provisioningState\":\"Updating\"},\"id\":\"urzafb\",\"name\":\"jjgpb\",\"type\":\"oq\"}]}"; + "{\"value\":[{\"properties\":{\"serviceName\":\"SSH\",\"resourceId\":\"bnmo\",\"port\":7164396751895305600,\"provisioningState\":\"Updating\"},\"id\":\"rzafbljjgpbtoqcj\",\"name\":\"klj\",\"type\":\"vbqid\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); diff --git a/sdk/identity/azure-identity-extensions/CHANGELOG.md b/sdk/identity/azure-identity-extensions/CHANGELOG.md index afd6fa3a5e1a..dd9adde54b83 100644 --- a/sdk/identity/azure-identity-extensions/CHANGELOG.md +++ b/sdk/identity/azure-identity-extensions/CHANGELOG.md @@ -10,6 +10,14 @@ ### Other Changes +## 1.1.8 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-identity` from `1.10.0` to version `1.10.1`. + ## 1.1.7 (2023-08-18) ### Other Changes diff --git a/sdk/identity/azure-identity-perf/pom.xml b/sdk/identity/azure-identity-perf/pom.xml index f7e6418909ac..8a831f764810 100644 --- a/sdk/identity/azure-identity-perf/pom.xml +++ b/sdk/identity/azure-identity-perf/pom.xml @@ -25,7 +25,7 @@ com.azure azure-identity - 1.11.0-beta.1 + 1.11.0-beta.2 com.azure diff --git a/sdk/identity/azure-identity/CHANGELOG.md b/sdk/identity/azure-identity/CHANGELOG.md index 9cc3a3898fc3..79ec89311c46 100644 --- a/sdk/identity/azure-identity/CHANGELOG.md +++ b/sdk/identity/azure-identity/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.11.0-beta.1 (Unreleased) +## 1.11.0-beta.2 (Unreleased) ### Features Added @@ -10,6 +10,18 @@ ### Other Changes +## 1.11.0-beta.1 (2023-09-20) + +### Features Added +- Added support for passing an InputStream containing a client cerfificate [#36747](https://github.com/Azure/azure-sdk-for-java/pull/36747) + +### Bugs fixed +- Fixed flowing `HttpClientOptions` through credentials [#36382](https://github.com/Azure/azure-sdk-for-java/pull/36382) +- Fixed edge case in Docker where 403s erronously caused CredentialUnavailableExceptions [#36747](https://github.com/Azure/azure-sdk-for-java/pull/36747) + + + + ## 1.10.1 (2023-09-10) ### Other Changes diff --git a/sdk/identity/azure-identity/README.md b/sdk/identity/azure-identity/README.md index b737bacabc04..e86e21786944 100644 --- a/sdk/identity/azure-identity/README.md +++ b/sdk/identity/azure-identity/README.md @@ -46,7 +46,7 @@ To take dependency on a particular version of the library that isn't present in com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/identity/azure-identity/pom.xml b/sdk/identity/azure-identity/pom.xml index bd6c80846ad0..5680b3f15e6c 100644 --- a/sdk/identity/azure-identity/pom.xml +++ b/sdk/identity/azure-identity/pom.xml @@ -6,7 +6,7 @@ com.azure azure-identity - 1.11.0-beta.1 + 1.11.0-beta.2 Microsoft Azure client library for Identity This module contains client library for Microsoft Azure Identity. @@ -57,9 +57,21 @@ test - junit - junit - 4.13.2 + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-params + 5.9.3 test diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/ClientCertificateCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/ClientCertificateCredentialBuilder.java index 2e5bbadb8ae5..97fb40750787 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/ClientCertificateCredentialBuilder.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/ClientCertificateCredentialBuilder.java @@ -94,7 +94,7 @@ public ClientCertificateCredentialBuilder pemCertificate(String certificatePath) * @param certificate the input stream containing the PEM certificate * @return An updated instance of this builder. */ - ClientCertificateCredentialBuilder pemCertificate(InputStream certificate) { + public ClientCertificateCredentialBuilder pemCertificate(InputStream certificate) { this.clientCertificate = certificate; return this; } @@ -102,10 +102,15 @@ ClientCertificateCredentialBuilder pemCertificate(InputStream certificate) { /** * Sets the path and password of the PFX certificate for authenticating to AAD. * + * @deprecated This API is deprecated and will be removed. Specify the PFX certificate via + * {@link ClientCertificateCredentialBuilder#pfxCertificate(String)} API and client certificate password via + * the {@link ClientCertificateCredentialBuilder#clientCertificatePassword(String)} API as applicable. + * * @param certificatePath the password protected PFX file containing the certificate * @param clientCertificatePassword the password protecting the PFX file * @return An updated instance of this builder. */ + @Deprecated public ClientCertificateCredentialBuilder pfxCertificate(String certificatePath, String clientCertificatePassword) { this.clientCertificatePath = certificatePath; @@ -113,16 +118,35 @@ public ClientCertificateCredentialBuilder pfxCertificate(String certificatePath, return this; } + /** + * Sets the path of the PFX certificate for authenticating to AAD. + * + * @param certificatePath the password protected PFX file containing the certificate + * @return An updated instance of this builder. + */ + public ClientCertificateCredentialBuilder pfxCertificate(String certificatePath) { + this.clientCertificatePath = certificatePath; + return this; + } + /** * Sets the input stream holding the PFX certificate and its password for authenticating to AAD. * * @param certificate the input stream containing the password protected PFX certificate - * @param clientCertificatePassword the password protecting the PFX file * @return An updated instance of this builder. */ - ClientCertificateCredentialBuilder pfxCertificate(InputStream certificate, - String clientCertificatePassword) { + public ClientCertificateCredentialBuilder pfxCertificate(InputStream certificate) { this.clientCertificate = certificate; + return this; + } + + /** + * Sets the password of the client certificate for authenticating to AAD. + * + * @param clientCertificatePassword the password protecting the certificate + * @return An updated instance of this builder. + */ + public ClientCertificateCredentialBuilder clientCertificatePassword(String clientCertificatePassword) { this.clientCertificatePassword = clientCertificatePassword; return this; } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java index 4a16b2a93293..877970580038 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java @@ -387,11 +387,10 @@ public Mono authenticateWithAzureDeveloperCli(TokenRequestContext r ? LoggingUtil.logCredentialUnavailableException(LOGGER, options, (CredentialUnavailableException) e) : LOGGER.logExceptionAsError(e)); } - } /** - * Asynchronously acquire a token from Active Directory with Azure Power Shell. + * Asynchronously acquire a token from Active Directory with Azure PowerShell. * * @param request the details of the token request * @return a Publisher that emits an AccessToken @@ -1174,6 +1173,18 @@ public Mono authenticateToIMDSEndpoint(TokenRequestContext request) "ManagedIdentityCredential authentication unavailable. " + "Connection to IMDS endpoint cannot be established.", null)); } + + if (responseCode == 403) { + if (connection.getResponseMessage() + .contains("A socket operation was attempted to an unreachable network")) { + throw LoggingUtil.logCredentialUnavailableException(LOGGER, options, + new CredentialUnavailableException( + "Managed Identity response was not in the expected format." + + " See the inner exception for details.", + new Exception(connection.getResponseMessage()))); + } + } + if (responseCode == 410 || responseCode == 429 || responseCode == 404 diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBase.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBase.java index 12f3430ddb4f..23142585881e 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBase.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBase.java @@ -18,6 +18,7 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; import com.azure.core.util.UserAgentUtil; @@ -114,6 +115,7 @@ public abstract class IdentityClientBase { private static final String AZURE_IDENTITY_PROPERTIES = "azure-identity.properties"; private static final String SDK_NAME = "name"; private static final String SDK_VERSION = "version"; + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); private final Map properties; @@ -779,15 +781,16 @@ HttpPipeline setupPipeline(HttpClient httpClient) { HttpLogOptions httpLogOptions = (options.getHttpLogOptions() == null) ? new HttpLogOptions() : options.getHttpLogOptions(); - userAgent = UserAgentUtil.toUserAgentString(CoreUtils.getApplicationId(options.getClientOptions(), httpLogOptions), clientName, clientVersion, buildConfiguration); + ClientOptions localClientOptions = options.getClientOptions() != null + ? options.getClientOptions() : DEFAULT_CLIENT_OPTIONS; + + userAgent = UserAgentUtil.toUserAgentString(CoreUtils.getApplicationId(localClientOptions, httpLogOptions), clientName, clientVersion, buildConfiguration); policies.add(new UserAgentPolicy(userAgent)); - if (options.getClientOptions() != null) { - List httpHeaderList = new ArrayList<>(); - options.getClientOptions().getHeaders().forEach(header -> - httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach(header -> + httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); policies.addAll(options.getPerCallPolicies()); HttpPolicyProviders.addBeforeRetryPolicies(policies); @@ -797,6 +800,7 @@ HttpPipeline setupPipeline(HttpClient httpClient) { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); return new HttpPipelineBuilder().httpClient(httpClient) + .clientOptions(localClientOptions) .policies(policies.toArray(new HttpPipelinePolicy[0])).build(); } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AuthorizationCodeCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AuthorizationCodeCredentialTest.java index 096b7a308795..c7216f98ac28 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AuthorizationCodeCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AuthorizationCodeCredentialTest.java @@ -8,8 +8,8 @@ import com.azure.identity.implementation.IdentityClient; import com.azure.identity.util.TestUtils; import com.microsoft.aad.msal4j.MsalServiceException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import org.mockito.exceptions.misusing.InvalidUseOfMatchersException; import reactor.core.publisher.Mono; @@ -68,7 +68,7 @@ public void testValidAuthorizationCode() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityclientMock); + Assertions.assertNotNull(identityclientMock); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureApplicationCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureApplicationCredentialTest.java index 3cca647a4fcd..b4b4f1be5da0 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureApplicationCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureApplicationCredentialTest.java @@ -10,8 +10,8 @@ import com.azure.identity.implementation.IdentityClient; import com.azure.identity.util.EmptyEnvironmentConfigurationSource; import com.azure.identity.util.TestUtils; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -53,7 +53,7 @@ public void testUseEnvironmentCredential() { .expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresOn.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -79,8 +79,8 @@ public void testUseManagedIdentityCredential() { .expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); - Assert.assertNotNull(intelliCredentialMock); + Assertions.assertNotNull(identityClientMock); + Assertions.assertNotNull(intelliCredentialMock); } } @@ -101,7 +101,7 @@ public void testNoCredentialWorks() { .expectErrorMatches(t -> t instanceof CredentialUnavailableException && t.getMessage() .startsWith("EnvironmentCredential authentication unavailable. ")) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -125,7 +125,7 @@ public void testCredentialUnavailable() { .expectErrorMatches(t -> t instanceof CredentialUnavailableException && t.getMessage() .startsWith("EnvironmentCredential authentication unavailable. ")) .verify(); - Assert.assertNotNull(managedIdentityCredentialMock); + Assertions.assertNotNull(managedIdentityCredentialMock); } } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureCliCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureCliCredentialTest.java index 4125c56e0806..08698ac1ec39 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureCliCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureCliCredentialTest.java @@ -9,8 +9,8 @@ import com.azure.identity.implementation.IdentityClientOptions; import com.azure.identity.implementation.util.IdentityUtil; import com.azure.identity.util.TestUtils; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -41,7 +41,7 @@ public void getTokenMockAsync() throws Exception { .expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresOn.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -61,7 +61,7 @@ public void azureCliCredentialWinAzureCLINotInstalledException() throws Exceptio StepVerifier.create(credential.getToken(request)) .expectErrorMatches(e -> e instanceof Exception && e.getMessage().contains("Azure CLI not installed")) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -81,7 +81,7 @@ public void azureCliCredentialAzNotLogInException() throws Exception { StepVerifier.create(credential.getToken(request)) .expectErrorMatches(e -> e instanceof Exception && e.getMessage().contains("Azure not Login")) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -101,7 +101,7 @@ public void azureCliCredentialAuthenticationFailedException() throws Exception { StepVerifier.create(credential.getToken(request)) .expectErrorMatches(e -> e instanceof Exception && e.getMessage().contains("other error")) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureDeveloperCliCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureDeveloperCliCredentialTest.java index 071b56bc9df2..038c5c29d058 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureDeveloperCliCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzureDeveloperCliCredentialTest.java @@ -7,8 +7,8 @@ import com.azure.identity.implementation.IdentityClient; import com.azure.identity.implementation.IdentityClientOptions; import com.azure.identity.util.TestUtils; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -22,7 +22,7 @@ public class AzureDeveloperCliCredentialTest { @Test - public void getTokenMockAsync() throws Exception { + public void getTokenMockAsync() { // setup String token1 = "token1"; TokenRequestContext request = new TokenRequestContext().addScopes("resourcename"); @@ -39,12 +39,12 @@ public void getTokenMockAsync() throws Exception { .expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresOn.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @Test - public void azureDeveloperCliCredentialWinAzureCLINotInstalledException() throws Exception { + public void azureDeveloperCliCredentialWinAzureCLINotInstalledException() { // setup TokenRequestContext request = new TokenRequestContext().addScopes("AzureNotInstalled"); @@ -59,12 +59,12 @@ public void azureDeveloperCliCredentialWinAzureCLINotInstalledException() throws StepVerifier.create(credential.getToken(request)) .expectErrorMatches(e -> e instanceof Exception && e.getMessage().contains("Azure CLI not installed")) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @Test - public void azureDeveloperCliCredentialAzNotLogInException() throws Exception { + public void azureDeveloperCliCredentialAzNotLogInException() { // setup TokenRequestContext request = new TokenRequestContext().addScopes("AzureNotLogin"); @@ -79,12 +79,12 @@ public void azureDeveloperCliCredentialAzNotLogInException() throws Exception { StepVerifier.create(credential.getToken(request)) .expectErrorMatches(e -> e instanceof Exception && e.getMessage().contains("Azure not Login")) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @Test - public void azureDeveloperCliCredentialAuthenticationFailedException() throws Exception { + public void azureDeveloperCliCredentialAuthenticationFailedException() { // setup TokenRequestContext request = new TokenRequestContext().addScopes("AzureDeveloperCliCredentialAuthenticationFailed"); @@ -99,7 +99,7 @@ public void azureDeveloperCliCredentialAuthenticationFailedException() throws Ex StepVerifier.create(credential.getToken(request)) .expectErrorMatches(e -> e instanceof Exception && e.getMessage().contains("other error")) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzurePowerShellCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzurePowerShellCredentialTest.java index d83496a2cb42..15e4d7c9f861 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzurePowerShellCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/AzurePowerShellCredentialTest.java @@ -7,8 +7,8 @@ import com.azure.identity.implementation.IdentityClient; import com.azure.identity.implementation.IdentityClientOptions; import com.azure.identity.util.TestUtils; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -22,7 +22,7 @@ public class AzurePowerShellCredentialTest { @Test - public void getTokenMockAsync() throws Exception { + public void getTokenMockAsync() { // setup String token1 = "token1"; TokenRequestContext request = new TokenRequestContext().addScopes("resourcename"); @@ -40,13 +40,13 @@ public void getTokenMockAsync() throws Exception { .expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresOn.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @Test - public void azurePowerShellCredentialNotInstalledException() throws Exception { + public void azurePowerShellCredentialNotInstalledException() { // setup TokenRequestContext request = new TokenRequestContext().addScopes("AzurePSNotInstalled"); @@ -63,7 +63,7 @@ public void azurePowerShellCredentialNotInstalledException() throws Exception { .expectErrorMatches(e -> e instanceof Exception && e.getMessage() .contains("Azure PowerShell not installed")) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/ClientCertificateCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/ClientCertificateCredentialTest.java index 86bd068b1df8..0491ddd38334 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/ClientCertificateCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/ClientCertificateCredentialTest.java @@ -11,8 +11,8 @@ import com.azure.identity.implementation.IdentitySyncClient; import com.azure.identity.util.TestUtils; import com.microsoft.aad.msal4j.MsalServiceException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import org.mockito.exceptions.misusing.InvalidUseOfMatchersException; import reactor.core.publisher.Mono; @@ -25,7 +25,7 @@ import java.time.ZoneOffset; import java.util.UUID; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mockConstruction; import static org.mockito.Mockito.when; @@ -139,7 +139,7 @@ public void testValidPemCertificatePath() throws Exception { .expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identityClient, context) -> { @@ -151,9 +151,9 @@ public void testValidPemCertificatePath() throws Exception { new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pemCertificate(pemPath).build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -186,7 +186,7 @@ public void testValidPemCertificatePathCAE() throws Exception { .expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identityClient, context) -> { @@ -206,9 +206,9 @@ public void testValidPemCertificatePathCAE() throws Exception { new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pemCertificate(pemPath).build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -229,12 +229,12 @@ public void testValidPfxCertificatePath() throws Exception { })) { // test ClientCertificateCredential credential = - new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pfxCertificate(pfxPath, pfxPassword).build(); + new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pfxCertificate(pfxPath).clientCertificatePassword(pfxPassword).build(); StepVerifier.create(credential.getToken(request2)) .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -247,9 +247,9 @@ public void testValidPfxCertificatePath() throws Exception { new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pfxCertificate(pfxPath, pfxPassword).build(); AccessToken accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -273,7 +273,7 @@ public void testValidPemCertificate() throws Exception { .expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } // mock @@ -286,9 +286,9 @@ public void testValidPemCertificate() throws Exception { new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pemCertificate(pemCert).build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -309,13 +309,14 @@ public void testValidPfxCertificate() throws Exception { })) { // test ClientCertificateCredential credential = - new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pfxCertificate(pfxCert, pfxPassword).build(); + new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID) + .pfxCertificate(pfxCert).clientCertificatePassword(pfxPassword).build(); StepVerifier.create(credential.getToken(request2)) .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -324,11 +325,12 @@ public void testValidPfxCertificate() throws Exception { })) { // test ClientCertificateCredential credential = - new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pfxCertificate(pfxCert, pfxPassword).build(); + new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID) + .pfxCertificate(pfxCert).clientCertificatePassword(pfxPassword).build(); AccessToken accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -351,7 +353,7 @@ public void testInvalidPemCertificatePath() throws Exception { StepVerifier.create(credential.getToken(request1)) .expectErrorMatches(e -> e instanceof MsalServiceException && "bad pem".equals(e.getMessage())) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -370,11 +372,11 @@ public void testInvalidPfxCertificatePath() throws Exception { })) { // test ClientCertificateCredential credential = - new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pfxCertificate(pfxPath, pfxPassword).build(); + new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pfxCertificate(pfxPath).clientCertificatePassword(pfxPassword).build(); StepVerifier.create(credential.getToken(request)) .expectErrorMatches(e -> e instanceof MsalServiceException && "bad pfx".equals(e.getMessage())) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -396,7 +398,7 @@ public void testInvalidPemCertificate() throws Exception { StepVerifier.create(credential.getToken(request1)) .expectErrorMatches(e -> e instanceof MsalServiceException && "bad pem".equals(e.getMessage())) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -415,11 +417,12 @@ public void testInvalidPfxCertificate() throws Exception { })) { // test ClientCertificateCredential credential = - new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).pfxCertificate(pfxCert, pfxPassword).build(); + new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID) + .pfxCertificate(pfxCert).clientCertificatePassword(pfxPassword).build(); StepVerifier.create(credential.getToken(request2)) .expectErrorMatches(e -> e instanceof MsalServiceException && "bad pfx".equals(e.getMessage())) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -441,21 +444,21 @@ public void testInvalidParameters() throws Exception { new ClientCertificateCredentialBuilder().clientId(CLIENT_ID).pemCertificate(pemPath).build(); fail(); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("tenantId")); + Assertions.assertTrue(e.getMessage().contains("tenantId")); } try { new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).pemCertificate(pemPath).build(); fail(); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("clientId")); + Assertions.assertTrue(e.getMessage().contains("clientId")); } try { new ClientCertificateCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID).build(); fail(); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("clientCertificate")); + Assertions.assertTrue(e.getMessage().contains("clientCertificate")); } - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/ClientSecretCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/ClientSecretCredentialTest.java index 5e43fb9341e1..af7013f3940c 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/ClientSecretCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/ClientSecretCredentialTest.java @@ -11,8 +11,8 @@ import com.azure.identity.implementation.IdentitySyncClient; import com.azure.identity.util.TestUtils; import com.microsoft.aad.msal4j.MsalServiceException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import org.mockito.exceptions.misusing.InvalidUseOfMatchersException; import reactor.core.publisher.Mono; @@ -22,7 +22,7 @@ import java.time.ZoneOffset; import java.util.UUID; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mockConstruction; import static org.mockito.Mockito.when; @@ -61,7 +61,7 @@ public void testValidSecrets() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } // mock @@ -76,13 +76,13 @@ public void testValidSecrets() throws Exception { .additionallyAllowedTenants("*").build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -130,7 +130,7 @@ public void testValidSecretsCAE() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } // mock @@ -161,13 +161,13 @@ public void testValidSecretsCAE() throws Exception { .additionallyAllowedTenants("*").build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -192,7 +192,7 @@ public void testInvalidSecrets() throws Exception { StepVerifier.create(credential.getToken(request)) .expectErrorMatches(e -> e instanceof MsalServiceException && "bad secret".equals(e.getMessage())) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -207,9 +207,9 @@ public void testInvalidSecrets() throws Exception { try { credential.getTokenSync(request); } catch (Exception e) { - Assert.assertTrue(e instanceof MsalServiceException && "bad secret".equals(e.getMessage())); + Assertions.assertTrue(e instanceof MsalServiceException && "bad secret".equals(e.getMessage())); } - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -232,23 +232,23 @@ public void testInvalidParameters() throws Exception { .additionallyAllowedTenants("*").build(); fail(); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("tenantId")); + Assertions.assertTrue(e.getMessage().contains("tenantId")); } try { new ClientSecretCredentialBuilder().tenantId(TENANT_ID).clientSecret(secret) .additionallyAllowedTenants("*").build(); fail(); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("clientId")); + Assertions.assertTrue(e.getMessage().contains("clientId")); } try { new ClientSecretCredentialBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID) .additionallyAllowedTenants("*").build(); fail(); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("clientSecret")); + Assertions.assertTrue(e.getMessage().contains("clientSecret")); } - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/DefaultAzureCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/DefaultAzureCredentialTest.java index 6acef96b77e1..e7c7cd5619e4 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/DefaultAzureCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/DefaultAzureCredentialTest.java @@ -12,8 +12,8 @@ import com.azure.identity.util.EmptyEnvironmentConfigurationSource; import com.azure.identity.util.TestUtils; import com.microsoft.aad.msal4j.MsalServiceException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -55,8 +55,8 @@ public void testUseEnvironmentCredential() { DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().configuration(configuration).build(); StepVerifier.create(credential.getToken(request1)).expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresOn.getSecond() == accessToken.getExpiresAt().getSecond()).verifyComplete(); - Assert.assertNotNull(mocked); - Assert.assertNotNull(ijcredential); + Assertions.assertNotNull(mocked); + Assertions.assertNotNull(ijcredential); } } @@ -81,8 +81,8 @@ public void testUseManagedIdentityCredential() { // test DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().configuration(configuration).build(); StepVerifier.create(credential.getToken(request)).expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()).verifyComplete(); - Assert.assertNotNull(mocked); - Assert.assertNotNull(ijcredential); + Assertions.assertNotNull(mocked); + Assertions.assertNotNull(ijcredential); } } @@ -112,8 +112,8 @@ public void testUseWorkloadIdentityCredentialWithManagedIdentityClientId() { .configuration(configuration) .build(); StepVerifier.create(credential.getToken(request)).expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()).verifyComplete(); - Assert.assertNotNull(mocked); - Assert.assertNotNull(ijcredential); + Assertions.assertNotNull(mocked); + Assertions.assertNotNull(ijcredential); } } @@ -139,7 +139,7 @@ public void testUseWorkloadIdentityCredentialWithWorkloadClientId() { .configuration(configuration) .build(); StepVerifier.create(credential.getToken(request)).expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()).verifyComplete(); - Assert.assertNotNull(mocked); + Assertions.assertNotNull(mocked); } } @@ -158,16 +158,16 @@ public void testUseWorkloadIdentityCredentialWithClientIdFlow() { .configuration(configuration) .build(); WorkloadIdentityCredential workloadIdentityCredential = credential.getWorkloadIdentityCredentialIfPresent(); - Assert.assertNotNull(workloadIdentityCredential); - Assert.assertEquals(clientId, workloadIdentityCredential.getClientId()); + Assertions.assertNotNull(workloadIdentityCredential); + Assertions.assertEquals(clientId, workloadIdentityCredential.getClientId()); credential = new DefaultAzureCredentialBuilder() .managedIdentityClientId(clientId) .configuration(configuration) .build(); workloadIdentityCredential = credential.getWorkloadIdentityCredentialIfPresent(); - Assert.assertNotNull(workloadIdentityCredential); - Assert.assertEquals(clientId, workloadIdentityCredential.getClientId()); + Assertions.assertNotNull(workloadIdentityCredential); + Assertions.assertEquals(clientId, workloadIdentityCredential.getClientId()); configuration = TestUtils.createTestConfiguration(new TestConfigurationSource() .put(Configuration.PROPERTY_AZURE_AUTHORITY_HOST, AzureAuthorityHosts.AZURE_PUBLIC_CLOUD) @@ -178,8 +178,8 @@ public void testUseWorkloadIdentityCredentialWithClientIdFlow() { .configuration(configuration) .build(); workloadIdentityCredential = credential.getWorkloadIdentityCredentialIfPresent(); - Assert.assertNotNull(workloadIdentityCredential); - Assert.assertEquals(clientId, workloadIdentityCredential.getClientId()); + Assertions.assertNotNull(workloadIdentityCredential); + Assertions.assertEquals(clientId, workloadIdentityCredential.getClientId()); } @@ -208,8 +208,8 @@ public void testUseAzureCliCredential() { // test DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().configuration(configuration).build(); StepVerifier.create(credential.getToken(request)).expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()).verifyComplete(); - Assert.assertNotNull(mocked); - Assert.assertNotNull(ijcredential); + Assertions.assertNotNull(mocked); + Assertions.assertNotNull(ijcredential); } } @@ -238,8 +238,8 @@ public void testUseAzureDeveloperCliCredential() { // test DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().configuration(configuration).build(); StepVerifier.create(credential.getToken(request)).expectNextMatches(accessToken -> token1.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()).verifyComplete(); - Assert.assertNotNull(mocked); - Assert.assertNotNull(ijcredential); + Assertions.assertNotNull(mocked); + Assertions.assertNotNull(ijcredential); } } @@ -268,12 +268,12 @@ public void testNoCredentialWorks() { // test DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().configuration(configuration).build(); StepVerifier.create(credential.getToken(request)).expectErrorMatches(t -> t instanceof CredentialUnavailableException && t.getMessage().startsWith("EnvironmentCredential authentication unavailable. ")).verify(); - Assert.assertNotNull(identityClientMock); - Assert.assertNotNull(sharedTokenCacheCredentialMock); - Assert.assertNotNull(azureCliCredentialMock); - Assert.assertNotNull(azureDeveloperCliCredentialMock); - Assert.assertNotNull(azurePowerShellCredentialMock); - Assert.assertNotNull(intelliJCredentialMock); + Assertions.assertNotNull(identityClientMock); + Assertions.assertNotNull(sharedTokenCacheCredentialMock); + Assertions.assertNotNull(azureCliCredentialMock); + Assertions.assertNotNull(azureDeveloperCliCredentialMock); + Assertions.assertNotNull(azurePowerShellCredentialMock); + Assertions.assertNotNull(intelliJCredentialMock); } } @@ -297,11 +297,11 @@ public void testCredentialUnavailable() { // test DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().configuration(configuration).build(); StepVerifier.create(credential.getToken(request)).expectErrorMatches(t -> t instanceof CredentialUnavailableException && t.getMessage().startsWith("EnvironmentCredential authentication unavailable. ")).verify(); - Assert.assertNotNull(managedIdentityCredentialMock); - Assert.assertNotNull(intelliJCredentialMock); - Assert.assertNotNull(powerShellCredentialMock); - Assert.assertNotNull(azureCliCredentialMock); - Assert.assertNotNull(azureDeveloperCliCredentialMock); + Assertions.assertNotNull(managedIdentityCredentialMock); + Assertions.assertNotNull(intelliJCredentialMock); + Assertions.assertNotNull(powerShellCredentialMock); + Assertions.assertNotNull(azureCliCredentialMock); + Assertions.assertNotNull(azureDeveloperCliCredentialMock); } } @@ -328,24 +328,25 @@ public void testCredentialUnavailableSync() { try { credential.getTokenSync(request); } catch (Exception e) { - Assert.assertTrue(e instanceof CredentialUnavailableException && e.getMessage().startsWith("EnvironmentCredential authentication unavailable. ")); + Assertions.assertTrue(e instanceof CredentialUnavailableException && e.getMessage().startsWith("EnvironmentCredential authentication unavailable. ")); } - Assert.assertNotNull(managedIdentityCredentialMock); - Assert.assertNotNull(intelliJCredentialMock); - Assert.assertNotNull(powerShellCredentialMock); - Assert.assertNotNull(azureCliCredentialMock); - Assert.assertNotNull(azureDeveloperCliCredentialMock); + Assertions.assertNotNull(managedIdentityCredentialMock); + Assertions.assertNotNull(intelliJCredentialMock); + Assertions.assertNotNull(powerShellCredentialMock); + Assertions.assertNotNull(azureCliCredentialMock); + Assertions.assertNotNull(azureDeveloperCliCredentialMock); } } - @Test(expected = IllegalStateException.class) + @Test public void testInvalidIdCombination() { // setup String resourceId = "/subscriptions/" + UUID.randomUUID() + "/resourcegroups/aresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ident"; // test - new DefaultAzureCredentialBuilder().managedIdentityClientId(CLIENT_ID).managedIdentityResourceId(resourceId).build(); + Assertions.assertThrows(IllegalStateException.class, () -> new DefaultAzureCredentialBuilder() + .managedIdentityClientId(CLIENT_ID).managedIdentityResourceId(resourceId).build()); } @Test diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/DeviceCodeCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/DeviceCodeCredentialTest.java index ebf38ecb5e14..503a5783d613 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/DeviceCodeCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/DeviceCodeCredentialTest.java @@ -10,8 +10,8 @@ import com.azure.identity.implementation.IdentitySyncClient; import com.azure.identity.util.TestUtils; import com.microsoft.aad.msal4j.MsalServiceException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import org.mockito.exceptions.misusing.InvalidUseOfMatchersException; import reactor.core.publisher.Mono; @@ -67,7 +67,7 @@ public void testValidDeviceCode() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -89,13 +89,13 @@ public void testValidDeviceCode() throws Exception { new DeviceCodeCredentialBuilder().challengeConsumer(consumer).clientId(clientId).build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -136,7 +136,7 @@ public void testValidDeviceCodeCAE() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -158,13 +158,13 @@ public void testValidDeviceCodeCAE() throws Exception { new DeviceCodeCredentialBuilder().challengeConsumer(consumer).clientId(clientId).build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -191,7 +191,7 @@ public void testValidAuthenticateDeviceCode() throws Exception { && authenticationRecord.getUsername().equals("testuser") && authenticationRecord.getHomeAccountId() != null) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -219,7 +219,7 @@ public void testMultiTenantAuthenticationEnabled() throws Exception { && authenticationRecord.getUsername().equals("testuser") && authenticationRecord.getHomeAccountId() != null) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/EnvironmentCredentialTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/EnvironmentCredentialTests.java index 0ff024393c1c..8107f80257b8 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/EnvironmentCredentialTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/EnvironmentCredentialTests.java @@ -10,11 +10,10 @@ import com.azure.identity.implementation.util.IdentityUtil; import com.azure.identity.util.TestUtils; import com.microsoft.aad.msal4j.MsalServiceException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; -import static org.junit.Assert.assertThrows; public class EnvironmentCredentialTests { @Test @@ -32,17 +31,17 @@ public void testCreateEnvironmentClientSecretCredential() { StepVerifier.create(credential.getToken(new TokenRequestContext().addScopes("qux/.default"))) .verifyErrorSatisfies(t -> { String message = t.getMessage(); - Assert.assertFalse(message != null + Assertions.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); }); // Validate Sync flow. - Exception e = assertThrows(Exception.class, + Exception e = Assertions.assertThrows(Exception.class, () -> credential.getTokenSync(new TokenRequestContext().addScopes("qux/.default"))); String message = e.getMessage(); - Assert.assertFalse(message != null + Assertions.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); } @@ -62,16 +61,16 @@ public void testCreateEnvironmentClientCertificateCredential() { StepVerifier.create(credential.getToken(new TokenRequestContext().addScopes("qux/.default"))) .verifyErrorSatisfies(t -> { String message = t.getMessage(); - Assert.assertFalse(message != null + Assertions.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); }); // Validate Sync flow. - Exception e = assertThrows(Exception.class, + Exception e = Assertions.assertThrows(Exception.class, () -> credential.getTokenSync(new TokenRequestContext().addScopes("qux/.default"))); String message = e.getMessage(); - Assert.assertFalse(message != null + Assertions.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); } @@ -90,16 +89,16 @@ public void testCreateEnvironmentUserPasswordCredential() { StepVerifier.create(credential.getToken(new TokenRequestContext().addScopes("qux/.default"))) .verifyErrorSatisfies(t -> { String message = t.getMessage(); - Assert.assertFalse(message != null + Assertions.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); }); // Validate Sync flow. - Exception e = assertThrows(Exception.class, + Exception e = Assertions.assertThrows(Exception.class, () -> credential.getTokenSync(new TokenRequestContext().addScopes("qux/.default"))); String message = e.getMessage(); - Assert.assertFalse(message != null + Assertions.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/InteractiveBrowserCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/InteractiveBrowserCredentialTest.java index 63f041257268..255cd9fecd72 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/InteractiveBrowserCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/InteractiveBrowserCredentialTest.java @@ -9,8 +9,8 @@ import com.azure.identity.implementation.IdentityClient; import com.azure.identity.implementation.IdentitySyncClient; import com.azure.identity.util.TestUtils; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import org.mockito.exceptions.misusing.InvalidUseOfMatchersException; import reactor.core.publisher.Mono; @@ -68,7 +68,7 @@ public void testValidInteractive() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -88,12 +88,12 @@ public void testValidInteractive() throws Exception { // test InteractiveBrowserCredential credential = new InteractiveBrowserCredentialBuilder().port(port).clientId(CLIENT_ID).build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -136,7 +136,7 @@ public void testValidInteractiveCAE() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -157,12 +157,12 @@ public void testValidInteractiveCAE() throws Exception { // test InteractiveBrowserCredential credential = new InteractiveBrowserCredentialBuilder().port(port).clientId(CLIENT_ID).build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -202,7 +202,7 @@ public void testValidInteractiveViaRedirectUri() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -223,12 +223,12 @@ public void testValidInteractiveViaRedirectUri() throws Exception { InteractiveBrowserCredential credential = new InteractiveBrowserCredentialBuilder().redirectUrl(redirectUrl).clientId(CLIENT_ID).build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -268,7 +268,7 @@ public void testValidInteractiveWithLoginHint() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -289,23 +289,24 @@ public void testValidInteractiveWithLoginHint() throws Exception { InteractiveBrowserCredential credential = new InteractiveBrowserCredentialBuilder().loginHint(username).clientId(CLIENT_ID).build(); AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } - @Test(expected = IllegalArgumentException.class) + @Test public void testCredentialDoesnWorkWIthPortAndRedirectUrlConfigured() throws Exception { // setup - new InteractiveBrowserCredentialBuilder() + Assertions.assertThrows(IllegalArgumentException.class, + () -> new InteractiveBrowserCredentialBuilder() .clientId(CLIENT_ID) .port(8080) .redirectUrl("http://localhost:8080") - .build(); + .build()); } @Test @@ -332,7 +333,7 @@ public void testValidAuthenticate() throws Exception { && authenticationRecord.getUsername().equals("testuser") && authenticationRecord.getHomeAccountId() != null) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/ManagedIdentityCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/ManagedIdentityCredentialTest.java index e9241cfcc6de..d9ecc44213c0 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/ManagedIdentityCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/ManagedIdentityCredentialTest.java @@ -9,8 +9,8 @@ import com.azure.core.util.Configuration; import com.azure.identity.implementation.IdentityClient; import com.azure.identity.util.TestUtils; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import reactor.test.StepVerifier; @@ -30,7 +30,7 @@ public class ManagedIdentityCredentialTest { @Test public void testVirtualMachineMSICredentialConfigurations() { ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder().clientId("foo").build(); - Assert.assertEquals("foo", credential.getClientId()); + Assertions.assertEquals("foo", credential.getClientId()); } @Test @@ -57,7 +57,7 @@ public void testMSIEndpoint() { .expectNextMatches(token -> token1.equals(token.getToken()) && expiresAt.getSecond() == token.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -79,7 +79,7 @@ public void testIMDS() { .expectNextMatches(token -> token1.equals(token.getToken()) && expiresOn.getSecond() == token.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -101,13 +101,15 @@ public void testArcUserAssigned() { .verify(); } - @Test(expected = IllegalStateException.class) + @Test public void testInvalidIdCombination() { // setup String resourceId = "/subscriptions/" + UUID.randomUUID() + "/resourcegroups/aresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ident"; // test - new ManagedIdentityCredentialBuilder().clientId(CLIENT_ID).resourceId(resourceId).build(); + Assertions.assertThrows(IllegalStateException.class, + () -> new ManagedIdentityCredentialBuilder() + .clientId(CLIENT_ID).resourceId(resourceId).build()); } @Test diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/UsernamePasswordCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/UsernamePasswordCredentialTest.java index 570d69c58846..1f4ca95777c1 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/UsernamePasswordCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/UsernamePasswordCredentialTest.java @@ -12,8 +12,8 @@ import com.azure.identity.implementation.util.IdentityUtil; import com.azure.identity.util.TestUtils; import com.microsoft.aad.msal4j.MsalServiceException; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import org.mockito.exceptions.misusing.InvalidUseOfMatchersException; import reactor.core.publisher.Mono; @@ -23,7 +23,7 @@ import java.time.ZoneOffset; import java.util.UUID; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mockConstruction; @@ -71,7 +71,7 @@ public void testValidUserCredential() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -92,13 +92,13 @@ public void testValidUserCredential() throws Exception { new UsernamePasswordCredentialBuilder().clientId(clientId).username(fakeUsernamePlaceholder).password(fakePasswordPlaceholder).build(); // test AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -140,7 +140,7 @@ public void testValidUserCredentialCAE() throws Exception { .expectNextMatches(accessToken -> token2.equals(accessToken.getToken()) && expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -162,13 +162,13 @@ public void testValidUserCredentialCAE() throws Exception { new UsernamePasswordCredentialBuilder().clientId(clientId).username(fakeUsernamePlaceholder).password(fakePasswordPlaceholder).build(); // test AccessToken accessToken = credential.getTokenSync(request1); - Assert.assertEquals(token1, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertEquals(token1, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); accessToken = credential.getTokenSync(request2); - Assert.assertEquals(token2, accessToken.getToken()); - Assert.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + Assertions.assertEquals(token2, accessToken.getToken()); + Assertions.assertTrue(expiresAt.getSecond() == accessToken.getExpiresAt().getSecond()); + Assertions.assertNotNull(identityClientMock); } } @@ -192,7 +192,7 @@ public void testInvalidUserCredential() throws Exception { StepVerifier.create(credential.getToken(request)) .expectErrorMatches(t -> t instanceof MsalServiceException && "bad credential".equals(t.getMessage())) .verify(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } try (MockedConstruction identityClientMock = mockConstruction(IdentitySyncClient.class, (identitySyncClient, context) -> { @@ -207,9 +207,9 @@ public void testInvalidUserCredential() throws Exception { try { credential.getTokenSync(request); } catch (Exception e) { - Assert.assertTrue(e instanceof MsalServiceException && "bad credential".equals(e.getMessage())); + Assertions.assertTrue(e instanceof MsalServiceException && "bad credential".equals(e.getMessage())); } - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -233,21 +233,21 @@ public void testInvalidParameters() throws Exception { new UsernamePasswordCredentialBuilder().username(fakeUsernamePlaceholder).password(fakePasswordPlaceholder).build(); fail(); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("clientId")); + Assertions.assertTrue(e.getMessage().contains("clientId")); } try { new UsernamePasswordCredentialBuilder().clientId(clientId).username(fakeUsernamePlaceholder).build(); fail(); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("password")); + Assertions.assertTrue(e.getMessage().contains("password")); } try { new UsernamePasswordCredentialBuilder().clientId(clientId).password(fakePasswordPlaceholder).build(); fail(); } catch (IllegalArgumentException e) { - Assert.assertTrue(e.getMessage().contains("username")); + Assertions.assertTrue(e.getMessage().contains("username")); } - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } @@ -275,7 +275,7 @@ public void testValidAuthenticate() throws Exception { && authenticationRecord.getUsername().equals("testuser") && authenticationRecord.getHomeAccountId() != null) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + Assertions.assertNotNull(identityClientMock); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/WorkloadIdentityCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/WorkloadIdentityCredentialTest.java index de9b862b3329..47c6f8e1f008 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/WorkloadIdentityCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/WorkloadIdentityCredentialTest.java @@ -10,8 +10,8 @@ import com.azure.identity.implementation.IdentityClient; import com.azure.identity.implementation.IdentitySyncClient; import com.azure.identity.util.TestUtils; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.MockedConstruction; import reactor.test.StepVerifier; @@ -19,6 +19,8 @@ import java.time.ZoneOffset; import java.util.UUID; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mockConstruction; import static org.mockito.Mockito.when; @@ -50,7 +52,7 @@ public void testWorkloadIdentityFlow() { .expectNextMatches(token -> token1.equals(token.getToken()) && expiresAt.getSecond() == token.getExpiresAt().getSecond()) .verifyComplete(); - Assert.assertNotNull(identityClientMock); + assertNotNull(identityClientMock); } } @@ -77,13 +79,13 @@ public void testWorkloadIdentityFlowSync() { AccessToken token = credential.getTokenSync(request1); - Assert.assertTrue(token1.equals(token.getToken())); - Assert.assertTrue(expiresAt.getSecond() == token.getExpiresAt().getSecond()); - Assert.assertNotNull(identityClientMock); + assertTrue(token1.equals(token.getToken())); + assertTrue(expiresAt.getSecond() == token.getExpiresAt().getSecond()); + assertNotNull(identityClientMock); } } - @Test(expected = IllegalArgumentException.class) + @Test public void testWorkloadIdentityFlowFailureNoTenantId() { // setup String endpoint = "https://localhost"; @@ -91,11 +93,14 @@ public void testWorkloadIdentityFlowFailureNoTenantId() { .put(Configuration.PROPERTY_AZURE_AUTHORITY_HOST, endpoint)); // test - new WorkloadIdentityCredentialBuilder().configuration(configuration) - .clientId(CLIENT_ID).tokenFilePath("dummy-path").build(); + Assertions.assertThrows(IllegalArgumentException.class, + () -> new WorkloadIdentityCredentialBuilder().configuration(configuration) + .clientId(CLIENT_ID) + .tokenFilePath("dummy-path") + .build()); } - @Test(expected = IllegalArgumentException.class) + @Test public void testWorkloadIdentityFlowFailureNoClientId() { // setup String endpoint = "https://localhost"; @@ -103,11 +108,14 @@ public void testWorkloadIdentityFlowFailureNoClientId() { .put(Configuration.PROPERTY_AZURE_AUTHORITY_HOST, endpoint)); // test - new WorkloadIdentityCredentialBuilder().configuration(configuration) - .tenantId("TENANT_ID").tokenFilePath("dummy-path").build(); + Assertions.assertThrows(IllegalArgumentException.class, + () -> new WorkloadIdentityCredentialBuilder().configuration(configuration) + .tenantId("TENANT_ID") + .tokenFilePath("dummy-path"). + build()); } - @Test(expected = IllegalArgumentException.class) + @Test public void testWorkloadIdentityFlowFailureNoTokenPath() { // setup String endpoint = "https://localhost"; @@ -115,8 +123,11 @@ public void testWorkloadIdentityFlowFailureNoTokenPath() { .put(Configuration.PROPERTY_AZURE_AUTHORITY_HOST, endpoint)); // test - new WorkloadIdentityCredentialBuilder().configuration(configuration) - .tenantId("tenant-id").clientId("client-id").build(); + Assertions.assertThrows(IllegalArgumentException.class, + () -> new WorkloadIdentityCredentialBuilder().configuration(configuration) + .tenantId("tenant-id") + .clientId("client-id") + .build()); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/CertificateUtilTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/CertificateUtilTests.java index e6414ce66225..f0d0bd0ca728 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/CertificateUtilTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/CertificateUtilTests.java @@ -4,8 +4,8 @@ package com.azure.identity.implementation; import com.azure.identity.implementation.util.CertificateUtil; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.nio.file.Files; import java.nio.file.Paths; @@ -19,22 +19,24 @@ public class CertificateUtilTests { - @Test(expected = CertificateExpiredException.class) + @Test public void testPublicKey() throws Exception { String pemPath = getPath("certificate.pem"); byte[] pemCertificateBytes = Files.readAllBytes(Paths.get(pemPath)); List x509CertificateList = CertificateUtil.publicKeyFromPem(pemCertificateBytes); - x509CertificateList.get(0).checkValidity(Date.from(Instant.parse("2025-12-25T00:00:00z"))); + Assertions.assertThrows(CertificateExpiredException.class, + () -> x509CertificateList.get(0).checkValidity(Date.from(Instant.parse("2025-12-25T00:00:00z")))); } - @Test(expected = CertificateExpiredException.class) + @Test public void testPublicKeyChain() throws Exception { String pemPath = getPath("cert-chain.pem"); byte[] pemCertificateBytes = Files.readAllBytes(Paths.get(pemPath)); List x509CertificateList = CertificateUtil.publicKeyFromPem(pemCertificateBytes); - Assert.assertEquals(2, x509CertificateList.size()); - x509CertificateList.get(0).checkValidity(Date.from(Instant.parse("4025-12-25T00:00:00z"))); + Assertions.assertEquals(2, x509CertificateList.size()); + Assertions.assertThrows(CertificateExpiredException.class, + () -> x509CertificateList.get(0).checkValidity(Date.from(Instant.parse("4025-12-25T00:00:00z")))); } @@ -43,7 +45,7 @@ public void testPrivateKey() throws Exception { String pemPath = getPath("key.pem"); byte[] pemCertificateBytes = Files.readAllBytes(Paths.get(pemPath)); PrivateKey privateKey = CertificateUtil.privateKeyFromPem(pemCertificateBytes); - Assert.assertEquals("RSA", privateKey.getAlgorithm()); + Assertions.assertEquals("RSA", privateKey.getAlgorithm()); } private String getPath(String filename) { diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/HttpPipelineAdapterTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/HttpPipelineAdapterTests.java index e972164ef220..ffc728c93896 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/HttpPipelineAdapterTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/HttpPipelineAdapterTests.java @@ -9,7 +9,7 @@ import com.azure.core.util.BinaryData; import com.microsoft.aad.msal4j.HttpMethod; import com.microsoft.aad.msal4j.HttpRequest; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import reactor.core.publisher.Mono; diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java index c758aeb02d7d..4e1802c7f91d 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java @@ -6,8 +6,8 @@ import com.azure.core.credential.TokenRequestContext; import com.azure.core.http.ProxyOptions; import com.azure.core.http.ProxyOptions.Type; -import org.junit.Assert; -import org.junit.Ignore; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; import reactor.test.StepVerifier; import java.net.InetSocketAddress; @@ -21,7 +21,7 @@ public class IdentityClientIntegrationTests { private static final String AZURE_CLIENT_CERTIFICATE = "AZURE_CLIENT_CERTIFICATE"; private final TokenRequestContext request = new TokenRequestContext().addScopes("https://management.azure.com/.default"); - @Ignore("Integration tests") + @Disabled("Integration tests") public void clientSecretCanGetToken() { IdentityClient client = new IdentityClient(System.getenv(AZURE_TENANT_ID), System.getenv(AZURE_CLIENT_ID), System.getenv(AZURE_CLIENT_SECRET), null, null, null, null, null, null, false, null, new IdentityClientOptions()); StepVerifier.create(client.authenticateWithConfidentialClient(request)) @@ -36,7 +36,7 @@ public void clientSecretCanGetToken() { .verifyComplete(); } - @Ignore("Integration tests") + @Disabled("Integration tests") public void deviceCodeCanGetToken() { IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), null, null, null, null, null, null, null, false, null, new IdentityClientOptions().setProxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); MsalToken token = client.authenticateWithDeviceCode(request, deviceCode -> { @@ -47,59 +47,59 @@ public void deviceCodeCanGetToken() { throw new RuntimeException(e); } }).block(); - Assert.assertNotNull(token); - Assert.assertNotNull(token.getToken()); - Assert.assertNotNull(token.getExpiresAt()); - Assert.assertFalse(token.isExpired()); + Assertions.assertNotNull(token); + Assertions.assertNotNull(token.getToken()); + Assertions.assertNotNull(token.getExpiresAt()); + Assertions.assertFalse(token.isExpired()); token = client.authenticateWithPublicClientCache(new TokenRequestContext().addScopes("https://vault.azure.net/.default"), token.getAccount()).block(); - Assert.assertNotNull(token); - Assert.assertNotNull(token.getToken()); - Assert.assertNotNull(token.getExpiresAt()); - Assert.assertFalse(token.isExpired()); + Assertions.assertNotNull(token); + Assertions.assertNotNull(token.getToken()); + Assertions.assertNotNull(token.getExpiresAt()); + Assertions.assertFalse(token.isExpired()); } - @Ignore("Integration tests") + @Disabled("Integration tests") public void browserCanGetToken() { IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), null, null, null, null, null, null, null, false, null, new IdentityClientOptions().setProxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); MsalToken token = client.authenticateWithBrowserInteraction(request, 8765, null, null).block(); - Assert.assertNotNull(token); - Assert.assertNotNull(token.getToken()); - Assert.assertNotNull(token.getExpiresAt()); - Assert.assertFalse(token.isExpired()); + Assertions.assertNotNull(token); + Assertions.assertNotNull(token.getToken()); + Assertions.assertNotNull(token.getExpiresAt()); + Assertions.assertFalse(token.isExpired()); token = client.authenticateWithPublicClientCache(new TokenRequestContext().addScopes("https://vault.azure.net/.default"), token.getAccount()).block(); - Assert.assertNotNull(token); - Assert.assertNotNull(token.getToken()); - Assert.assertNotNull(token.getExpiresAt()); - Assert.assertFalse(token.isExpired()); + Assertions.assertNotNull(token); + Assertions.assertNotNull(token.getToken()); + Assertions.assertNotNull(token.getExpiresAt()); + Assertions.assertFalse(token.isExpired()); } - @Ignore("Integration tests") + @Disabled("Integration tests") public void usernamePasswordCanGetToken() { IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), null, null, null, null, null, null, null, false, null, new IdentityClientOptions().setProxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); MsalToken token = client.authenticateWithUsernamePassword(request, System.getenv("username"), System.getenv("password")).block(); - Assert.assertNotNull(token); - Assert.assertNotNull(token.getToken()); - Assert.assertNotNull(token.getExpiresAt()); - Assert.assertFalse(token.isExpired()); + Assertions.assertNotNull(token); + Assertions.assertNotNull(token.getToken()); + Assertions.assertNotNull(token.getExpiresAt()); + Assertions.assertFalse(token.isExpired()); token = client.authenticateWithPublicClientCache(new TokenRequestContext().addScopes("https://vault.azure.net/.default"), token.getAccount()).block(); - Assert.assertNotNull(token); - Assert.assertNotNull(token.getToken()); - Assert.assertNotNull(token.getExpiresAt()); - Assert.assertFalse(token.isExpired()); + Assertions.assertNotNull(token); + Assertions.assertNotNull(token.getToken()); + Assertions.assertNotNull(token.getExpiresAt()); + Assertions.assertFalse(token.isExpired()); } - @Ignore("Integration tests") + @Disabled("Integration tests") public void authCodeCanGetToken() throws Exception { IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), null, null, null, null, null, null, null, false, null, new IdentityClientOptions()); MsalToken token = client.authenticateWithAuthorizationCode(request, System.getenv("AZURE_AUTH_CODE"), new URI("http://localhost:8000")).block(); - Assert.assertNotNull(token); - Assert.assertNotNull(token.getToken()); - Assert.assertNotNull(token.getExpiresAt()); - Assert.assertFalse(token.isExpired()); + Assertions.assertNotNull(token); + Assertions.assertNotNull(token.getToken()); + Assertions.assertNotNull(token.getExpiresAt()); + Assertions.assertFalse(token.isExpired()); token = client.authenticateWithPublicClientCache(new TokenRequestContext().addScopes("https://vault.azure.net/.default"), token.getAccount()).block(); - Assert.assertNotNull(token); - Assert.assertNotNull(token.getToken()); - Assert.assertNotNull(token.getExpiresAt()); - Assert.assertFalse(token.isExpired()); + Assertions.assertNotNull(token); + Assertions.assertNotNull(token.getToken()); + Assertions.assertNotNull(token.getExpiresAt()); + Assertions.assertFalse(token.isExpired()); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientOptionsTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientOptionsTest.java index 3c34b7e4ad3d..60f6b7bf734f 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientOptionsTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientOptionsTest.java @@ -7,15 +7,15 @@ import com.azure.core.util.Configuration; import com.azure.identity.AzureAuthorityHosts; import com.azure.identity.util.TestUtils; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class IdentityClientOptionsTest { @Test public void testDefaultAuthorityHost() { IdentityClientOptions identityClientOptions = new IdentityClientOptions(); - Assert.assertEquals(AzureAuthorityHosts.AZURE_PUBLIC_CLOUD, identityClientOptions.getAuthorityHost()); + Assertions.assertEquals(AzureAuthorityHosts.AZURE_PUBLIC_CLOUD, identityClientOptions.getAuthorityHost()); } @Test @@ -25,7 +25,7 @@ public void testEnvAuthorityHost() { .put("AZURE_AUTHORITY_HOST", envAuthorityHost)); IdentityClientOptions identityClientOptions = new IdentityClientOptions().setConfiguration(configuration); - Assert.assertEquals(envAuthorityHost, identityClientOptions.getAuthorityHost()); + Assertions.assertEquals(envAuthorityHost, identityClientOptions.getAuthorityHost()); } @Test @@ -33,13 +33,13 @@ public void testCustomAuthorityHost() { String authorityHost = "https://custom.com/"; IdentityClientOptions identityClientOptions = new IdentityClientOptions(); identityClientOptions.setAuthorityHost(authorityHost); - Assert.assertEquals(authorityHost, identityClientOptions.getAuthorityHost()); + Assertions.assertEquals(authorityHost, identityClientOptions.getAuthorityHost()); } @Test public void testDisableAuthorityValidationAndInstanceDiscovery() { IdentityClientOptions identityClientOptions = new IdentityClientOptions(); identityClientOptions.disableInstanceDiscovery(); - Assert.assertFalse(identityClientOptions.isInstanceDiscoveryEnabled()); + Assertions.assertFalse(identityClientOptions.isInstanceDiscoveryEnabled()); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java index e3337a741135..9ff84f6ed7ee 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java @@ -23,8 +23,9 @@ import com.microsoft.aad.msal4j.PublicClientApplication; import com.microsoft.aad.msal4j.SilentParameters; import com.microsoft.aad.msal4j.UserNamePasswordParameters; -import org.junit.Assert; -import org.junit.Test; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.AdditionalMatchers; import org.mockito.ArgumentMatchers; import org.mockito.MockedConstruction; @@ -49,9 +50,7 @@ import java.util.UUID; import java.util.concurrent.CompletableFuture; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.anyBoolean; @@ -85,8 +84,8 @@ public void testValidSecret() { .tenantId(TENANT_ID).clientId(CLIENT_ID).clientSecret(secret).build(); StepVerifier.create(client.authenticateWithConfidentialClient(request)) .assertNext(token -> { - Assert.assertEquals(accessToken, token.getToken()); - Assert.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); + Assertions.assertEquals(accessToken, token.getToken()); + Assertions.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); }) .verifyComplete(); }); @@ -111,7 +110,7 @@ public void testInvalidSecret() { client.authenticateWithConfidentialClient(request).block(); fail(); } catch (MsalServiceException e) { - Assert.assertEquals("Invalid clientSecret", e.getMessage()); + Assertions.assertEquals("Invalid clientSecret", e.getMessage()); } }); @@ -132,8 +131,8 @@ public void testValidCertificate() { .certificatePath(pfxPath).certificatePassword("StrongPass!123").build(); StepVerifier.create(client.authenticateWithConfidentialClient(request)) .assertNext(token -> { - Assert.assertEquals(accessToken, token.getToken()); - Assert.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); + Assertions.assertEquals(accessToken, token.getToken()); + Assertions.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); }) .verifyComplete(); }); @@ -160,8 +159,8 @@ public void testPemCertificate() { .tenantId(TENANT_ID).clientId(CLIENT_ID).certificatePath(pemPath).build(); StepVerifier.create(client.authenticateWithConfidentialClient(request)) .assertNext(token -> { - Assert.assertEquals(accessToken, token.getToken()); - Assert.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); + Assertions.assertEquals(accessToken, token.getToken()); + Assertions.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); }) .verifyComplete(); }); @@ -182,7 +181,7 @@ public void testInvalidCertificatePassword() { IdentityClient client = new IdentityClientBuilder().tenantId(TENANT_ID).clientId(CLIENT_ID) .certificatePath(pfxPath).certificatePassword("BadPassword").build(); StepVerifier.create(client.authenticateWithConfidentialClient(request)) - .verifyErrorSatisfies(e -> Assert.assertTrue(e.getMessage().contains("password was incorrect"))); + .verifyErrorSatisfies(e -> assertTrue(e.getMessage().contains("password was incorrect"))); }); } @@ -202,8 +201,8 @@ public void testValidDeviceCodeFlow() { StepVerifier.create(client.authenticateWithDeviceCode(request, deviceCodeChallenge -> { /* do nothing */ })) .assertNext(token -> { - Assert.assertEquals(accessToken, token.getToken()); - Assert.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); + Assertions.assertEquals(accessToken, token.getToken()); + Assertions.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); }) .verifyComplete(); }); @@ -237,8 +236,8 @@ public void testValidServiceFabricCodeFlow() throws Exception { // test StepVerifier.create(client.getTokenFromTargetManagedIdentity(request)) .assertNext(token -> { - Assert.assertEquals("token1", token.getToken()); - Assert.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); + Assertions.assertEquals("token1", token.getToken()); + Assertions.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); }) .verifyComplete(); }); @@ -269,14 +268,14 @@ public void testValidIdentityEndpointMSICodeFlow() throws Exception { // test StepVerifier.create(client.getTokenFromTargetManagedIdentity(request)) .assertNext(token -> { - Assert.assertEquals("token1", token.getToken()); - Assert.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); + Assertions.assertEquals("token1", token.getToken()); + Assertions.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); }) .verifyComplete(); }); } - @Test(expected = ClientAuthenticationException.class) + @Test public void testInValidIdentityEndpointSecretArcCodeFlow() throws Exception { // setup String endpoint = "http://localhost"; @@ -290,12 +289,14 @@ public void testInValidIdentityEndpointSecretArcCodeFlow() throws Exception { .setIdentityEndpoint(endpoint)) .setConfiguration(configuration); IdentityClient client = new IdentityClientBuilder().identityClientOptions(options).build(); - mockForArcCodeFlow(401, () -> { - client.getTokenFromTargetManagedIdentity(request).block(); - }); + + Assertions.assertThrows(ClientAuthenticationException.class, + () -> mockForArcCodeFlow(401, () -> { + client.getTokenFromTargetManagedIdentity(request).block(); + })); } - @Test(expected = ClientAuthenticationException.class) + @Test public void testInValidIdentityEndpointResponseCodeArcCodeFlow() throws Exception { // setup String endpoint = "http://localhost"; @@ -309,7 +310,9 @@ public void testInValidIdentityEndpointResponseCodeArcCodeFlow() throws Exceptio .setConfiguration(configuration); IdentityClient client = new IdentityClientBuilder().identityClientOptions(options).build(); // mock - mockForArcCodeFlow(200, () -> client.getTokenFromTargetManagedIdentity(request).block()); + + Assertions.assertThrows(ClientAuthenticationException.class, + () -> mockForArcCodeFlow(200, () -> client.getTokenFromTargetManagedIdentity(request).block())); } @Test @@ -335,8 +338,8 @@ public void testValidIMDSCodeFlow() throws Exception { // test StepVerifier.create(client.getTokenFromTargetManagedIdentity(request)) .assertNext(token -> { - Assert.assertEquals("token1", token.getToken()); - Assert.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); + Assertions.assertEquals("token1", token.getToken()); + Assertions.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); }) .verifyComplete(); }); @@ -363,8 +366,8 @@ public void testCustomIMDSCodeFlow() throws Exception { // test StepVerifier.create(client.getTokenFromTargetManagedIdentity(request)) .assertNext(token -> { - Assert.assertEquals("token1", token.getToken()); - Assert.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); + Assertions.assertEquals("token1", token.getToken()); + Assertions.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); }) .verifyComplete(); }); @@ -487,8 +490,8 @@ public void testAuthWithManagedIdentityFlow() { .setManagedIdentityType(ManagedIdentityType.VM)) .build(); AccessToken token = client.authenticateWithManagedIdentityConfidentialClient(request).block(); - Assert.assertEquals(accessToken, token.getToken()); - Assert.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); + Assertions.assertEquals(accessToken, token.getToken()); + Assertions.assertEquals(expiresOn.getSecond(), token.getExpiresAt().getSecond()); }); } @@ -522,7 +525,7 @@ private void mockForManagedIdentityFlow(String secret, String clientId, TokenReq staticConfidentialClientApplicationMock.when(() -> ConfidentialClientApplication.builder(AdditionalMatchers.not(eq(clientId)), any(IClientSecret.class))).thenThrow(new MsalServiceException("Invalid CLIENT_ID", "InvalidClientId")); test.run(); - Assert.assertNotNull(confidentialClientApplicationBuilderMock); + Assertions.assertNotNull(confidentialClientApplicationBuilderMock); } } @@ -553,7 +556,7 @@ private void mockForClientSecret(String secret, TokenRequestContext request, Str staticConfidentialClientApplicationMock.when(() -> ConfidentialClientApplication.builder(AdditionalMatchers.not(eq(CLIENT_ID)), any(IClientSecret.class))).thenThrow(new MsalServiceException("Invalid CLIENT_ID", "InvalidClientId")); test.run(); - Assert.assertNotNull(confidentialClientApplicationBuilderMock); + Assertions.assertNotNull(confidentialClientApplicationBuilderMock); } } @@ -581,7 +584,7 @@ private void mockForClientCertificate(TokenRequestContext request, String access staticConfidentialClientApplicationMock.when(() -> ConfidentialClientApplication.builder(anyString(), argThat(cred -> ((IClientCertificate) cred) == null))).thenThrow(new MsalServiceException("Invalid clientCertificate", "InvalidClientCertificate")); staticConfidentialClientApplicationMock.when(() -> ConfidentialClientApplication.builder(AdditionalMatchers.not(eq(CLIENT_ID)), any(IClientCertificate.class))).thenThrow(new MsalServiceException("Invalid CLIENT_ID", "InvalidClientId")); test.run(); - Assert.assertNotNull(confidentialClientApplicationBuilderMock); + Assertions.assertNotNull(confidentialClientApplicationBuilderMock); } } @@ -625,7 +628,7 @@ private void mockForDeviceCodeFlow(TokenRequestContext request, String accessTok when(builder.instanceDiscovery(anyBoolean())).thenReturn(builder); })) { test.run(); - Assert.assertNotNull(publicClientApplicationMock); + Assertions.assertNotNull(publicClientApplicationMock); } } @@ -660,7 +663,7 @@ private void mockForClientPemCertificate(String accessToken, TokenRequestContext certificateUtilMock.when(() -> CertificateUtil.privateKeyFromPem(any())).thenReturn(privateKey); clientCredentialFactoryMock.when(() -> ClientCredentialFactory.createFromCertificate(any(PrivateKey.class), any(X509Certificate.class))).thenReturn(clientCertificate); test.run(); - Assert.assertNotNull(builderMock); + Assertions.assertNotNull(builderMock); } } @@ -744,7 +747,7 @@ private void mockForBrowserAuthenticationCodeFlow(String token, TokenRequestCont when(builder.logPii(anyBoolean())).thenReturn(builder); })) { test.run(); - Assert.assertNotNull(publicClientApplicationMock); + Assertions.assertNotNull(publicClientApplicationMock); } } @@ -777,7 +780,7 @@ private void mockForAuthorizationCodeFlow(String token1, TokenRequestContext req when(builder.logPii(anyBoolean())).thenReturn(builder); })) { test.run(); - Assert.assertNotNull(publicClientApplicationMock); + Assertions.assertNotNull(publicClientApplicationMock); } } @@ -799,7 +802,7 @@ private void mockForUsernamePasswordCodeFlow(String token, TokenRequestContext r when(builder.logPii(anyBoolean())).thenReturn(builder); })) { test.run(); - Assert.assertNotNull(publicClientApplicationMock); + Assertions.assertNotNull(publicClientApplicationMock); } } @@ -821,7 +824,7 @@ private void mockForUserRefreshTokenFlow(String token, TokenRequestContext reque when(builder.logPii(anyBoolean())).thenReturn(builder); })) { test.run(); - Assert.assertNotNull(publicClientApplicationMock); + Assertions.assertNotNull(publicClientApplicationMock); } } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/MSITokenTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/MSITokenTests.java index d0e198233223..ee385d3ff02e 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/MSITokenTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/MSITokenTests.java @@ -6,14 +6,16 @@ import com.azure.core.util.serializer.JacksonAdapter; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.time.temporal.ChronoUnit; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class MSITokenTests { private OffsetDateTime expected = OffsetDateTime.of(2020, 1, 10, 15, 3, 28, 0, ZoneOffset.UTC); @@ -25,9 +27,9 @@ public void canParseLong() { MSIToken token2 = new MSIToken("fake_token", null, "3599"); MSIToken token3 = new MSIToken("fake_token", "1578668608", "3599"); - Assert.assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); - Assert.assertTrue((token2.getExpiresAt().toEpochSecond() - OffsetDateTime.now().toEpochSecond()) > 3500); - Assert.assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); + assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); + assertTrue((token2.getExpiresAt().toEpochSecond() - OffsetDateTime.now().toEpochSecond()) > 3500); + assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); } @Test @@ -48,7 +50,7 @@ public void canDeserialize() { throw new RuntimeException(e); } - Assert.assertEquals(1506484173, token.getExpiresAt().toEpochSecond()); + assertEquals(1506484173, token.getExpiresAt().toEpochSecond()); } @Test @@ -59,10 +61,10 @@ public void canParseDateTime24Hr() { "86500"); MSIToken token4 = new MSIToken("fake_token", null, "43219"); - Assert.assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); - Assert.assertEquals(expected.toEpochSecond(), token2.getExpiresAt().toEpochSecond()); - Assert.assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); - Assert.assertTrue(ChronoUnit.HOURS.between(OffsetDateTime.now(), token4.getExpiresAt()) == 12L); + assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); + assertEquals(expected.toEpochSecond(), token2.getExpiresAt().toEpochSecond()); + assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); + assertTrue(ChronoUnit.HOURS.between(OffsetDateTime.now(), token4.getExpiresAt()) == 12L); } @Test @@ -73,10 +75,10 @@ public void canParseDateTime12Hr() { "86500"); MSIToken token4 = new MSIToken("fake_token", null, "86500"); - Assert.assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); - Assert.assertEquals(expected.toEpochSecond(), token2.getExpiresAt().toEpochSecond()); - Assert.assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); - Assert.assertTrue(ChronoUnit.HOURS.between(OffsetDateTime.now(), token4.getExpiresAt()) == 24L); + assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); + assertEquals(expected.toEpochSecond(), token2.getExpiresAt().toEpochSecond()); + assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); + assertTrue(ChronoUnit.HOURS.between(OffsetDateTime.now(), token4.getExpiresAt()) == 24L); token = new MSIToken("fake_token", "12/20/2019 4:58:20 AM +00:00", null); token2 = new MSIToken("fake_token", null, "12/20/2019 4:58:20 AM +00:00"); @@ -85,10 +87,10 @@ public void canParseDateTime12Hr() { token4 = new MSIToken("fake_token", null, "105500"); expected = OffsetDateTime.of(2019, 12, 20, 4, 58, 20, 0, ZoneOffset.UTC); - Assert.assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); - Assert.assertEquals(expected.toEpochSecond(), token2.getExpiresAt().toEpochSecond()); - Assert.assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); - Assert.assertTrue(ChronoUnit.HOURS.between(OffsetDateTime.now(), token4.getExpiresAt()) == 29L); + assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); + assertEquals(expected.toEpochSecond(), token2.getExpiresAt().toEpochSecond()); + assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); + assertTrue(ChronoUnit.HOURS.between(OffsetDateTime.now(), token4.getExpiresAt()) == 29L); token = new MSIToken("fake_token", "1/1/2020 0:00:00 PM +00:00", null); token2 = new MSIToken("fake_token", null, "1/1/2020 0:00:00 PM +00:00"); @@ -97,9 +99,9 @@ public void canParseDateTime12Hr() { token4 = new MSIToken("fake_token", null, "220800"); expected = OffsetDateTime.of(2020, 1, 1, 12, 0, 0, 0, ZoneOffset.UTC); - Assert.assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); - Assert.assertEquals(expected.toEpochSecond(), token2.getExpiresAt().toEpochSecond()); - Assert.assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); - Assert.assertTrue(ChronoUnit.HOURS.between(OffsetDateTime.now(), token4.getExpiresAt()) == 61L); + assertEquals(expected.toEpochSecond(), token.getExpiresAt().toEpochSecond()); + assertEquals(expected.toEpochSecond(), token2.getExpiresAt().toEpochSecond()); + assertEquals(expected.toEpochSecond(), token3.getExpiresAt().toEpochSecond()); + assertTrue(ChronoUnit.HOURS.between(OffsetDateTime.now(), token4.getExpiresAt()) == 61L); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/SynchronizedAccessorTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/SynchronizedAccessorTests.java index 3cc8d6529cee..1e393c75c4c5 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/SynchronizedAccessorTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/SynchronizedAccessorTests.java @@ -3,8 +3,8 @@ package com.azure.identity.implementation; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -31,7 +31,7 @@ public void testSyncAccess() throws Exception { //test Integer firstVal = values.get(0); for (int z = 1; z < values.size(); z++) { - Assert.assertEquals(firstVal, values.get(z)); + Assertions.assertEquals(firstVal, values.get(z)); } } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/VisualStudioCacheAccessorTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/VisualStudioCacheAccessorTests.java index f1e8a4ee9bd8..7d12eaff13eb 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/VisualStudioCacheAccessorTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/VisualStudioCacheAccessorTests.java @@ -4,8 +4,9 @@ package com.azure.identity.implementation; import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; public class VisualStudioCacheAccessorTests { @@ -13,9 +14,9 @@ public class VisualStudioCacheAccessorTests { public void testReadJsonFile() throws Exception { // setup JsonNode jsonRead = VisualStudioCacheAccessor.readJsonFile(getPath("settings.json")); - Assert.assertEquals("first", jsonRead.get("editor.suggestSelection").asText()); - Assert.assertEquals("/Contents/Home", jsonRead.get("java.home").asText()); - Assert.assertEquals(12, jsonRead.size()); + assertEquals("first", jsonRead.get("editor.suggestSelection").asText()); + assertEquals("/Contents/Home", jsonRead.get("java.home").asText()); + assertEquals(12, jsonRead.size()); } private String getPath(String filename) { diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/intellij/IntelliJKDBXDatabaseParsingTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/intellij/IntelliJKDBXDatabaseParsingTest.java index edf0c9b31a6c..635aff602958 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/intellij/IntelliJKDBXDatabaseParsingTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/intellij/IntelliJKDBXDatabaseParsingTest.java @@ -5,13 +5,14 @@ import com.azure.identity.implementation.IntelliJAuthMethodDetails; import com.azure.identity.implementation.IntelliJCacheAccessor; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class IntelliJKDBXDatabaseParsingTest { @Test @@ -19,7 +20,7 @@ public void testKdbxDatabaseParsing() throws Exception { InputStream inputStreamwow = new FileInputStream(getPath("c.kdbx")); IntelliJKdbxDatabase kdbxDatabase = IntelliJKdbxDatabase.parse(inputStreamwow, "testpassword"); String password = kdbxDatabase.getDatabaseEntryValue("ADAuthManager"); - Assert.assertEquals("DummyEntry", password); + assertEquals("DummyEntry", password); } @Test @@ -27,7 +28,7 @@ public void testIntelliJAuthDetailsParsing() throws Exception { File authFile = new File(getPath("AuthMethodDetails.json")); IntelliJCacheAccessor cacheAccessor = new IntelliJCacheAccessor(null); IntelliJAuthMethodDetails authMethodDetails = cacheAccessor.parseAuthMethodDetails(authFile); - Assert.assertEquals("dummyuser@email.com", authMethodDetails.getAccountEmail()); + assertEquals("dummyuser@email.com", authMethodDetails.getAccountEmail()); } private String getPath(String filename) { diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/util/IdentityUtilTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/util/IdentityUtilTests.java index 9615a9f81e13..06c1fb87d989 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/util/IdentityUtilTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/util/IdentityUtilTests.java @@ -9,8 +9,8 @@ import com.azure.core.util.Configuration; import com.azure.identity.implementation.IdentityClientOptions; import com.azure.identity.implementation.util.IdentityUtil; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import java.util.Arrays; @@ -26,10 +26,10 @@ public void testMultiTenantAuthenticationEnabled() { IdentityClientOptions options = new IdentityClientOptions() .setAdditionallyAllowedTenants(Arrays.asList(newTenant)); - Assert.assertEquals(newTenant, IdentityUtil.resolveTenantId(currentTenant, trc, options)); + Assertions.assertEquals(newTenant, IdentityUtil.resolveTenantId(currentTenant, trc, options)); } - @Test(expected = ClientAuthenticationException.class) + @Test public void testMultiTenantAuthenticationDisabled() { String currentTenant = "tenant"; TokenRequestContext trc = new TokenRequestContext() @@ -38,7 +38,8 @@ public void testMultiTenantAuthenticationDisabled() { IdentityClientOptions options = new IdentityClientOptions(); options.disableMultiTenantAuthentication(); - IdentityUtil.resolveTenantId(currentTenant, trc, options); + Assertions.assertThrows(ClientAuthenticationException.class, + () -> IdentityUtil.resolveTenantId(currentTenant, trc, options)); } @Test @@ -52,7 +53,7 @@ public void testAdditionallyAllowedTenants() { options.setAdditionallyAllowedTenants(Arrays.asList(IdentityUtil.ALL_TENANTS)); String resolvedTenant = IdentityUtil.resolveTenantId(currentTenant, trc, options); - Assert.assertEquals(newTenant, resolvedTenant); + Assertions.assertEquals(newTenant, resolvedTenant); } @Test @@ -66,10 +67,10 @@ public void testAdditionallyAllowedTenantsCaseInsensitive() { options.setAdditionallyAllowedTenants(Arrays.asList("newtenant")); String resolvedTenant = IdentityUtil.resolveTenantId(currentTenant, trc, options); - Assert.assertEquals(newTenant, resolvedTenant); + Assertions.assertEquals(newTenant, resolvedTenant); } - @Test(expected = ClientAuthenticationException.class) + @Test public void testAlienTenantWithAdditionallyAllowedTenants() { String currentTenant = "tenant"; String newTenant = "newTenant"; @@ -79,10 +80,11 @@ public void testAlienTenantWithAdditionallyAllowedTenants() { IdentityClientOptions options = new IdentityClientOptions(); options.setAdditionallyAllowedTenants(Arrays.asList("tenant")); - IdentityUtil.resolveTenantId(currentTenant, trc, options); + Assertions.assertThrows(ClientAuthenticationException.class, + () -> IdentityUtil.resolveTenantId(currentTenant, trc, options)); } - @Test(expected = ClientAuthenticationException.class) + @Test public void testAlienTenantWithAdditionallyAllowedNotConfigured() { String currentTenant = "tenant"; String newTenant = "newTenant"; @@ -91,7 +93,8 @@ public void testAlienTenantWithAdditionallyAllowedNotConfigured() { .setTenantId(newTenant); IdentityClientOptions options = new IdentityClientOptions(); - IdentityUtil.resolveTenantId(currentTenant, trc, options); + Assertions.assertThrows(ClientAuthenticationException.class, + () -> IdentityUtil.resolveTenantId(currentTenant, trc, options)); } @Test @@ -110,7 +113,7 @@ public void testTenantWithAdditionalTenantsFromEnv() { .setAdditionallyAllowedTenants(IdentityUtil.getAdditionalTenantsFromEnvironment(configuration)); String resolvedTenant = IdentityUtil.resolveTenantId(currentTenant, trc, options); - Assert.assertEquals(newTenant, resolvedTenant); + Assertions.assertEquals(newTenant, resolvedTenant); } @@ -130,11 +133,11 @@ public void testTenantWithWildCardAdditionalTenantsFromEnv() { .setAdditionallyAllowedTenants(IdentityUtil.getAdditionalTenantsFromEnvironment(configuration)); String resolvedTenant = IdentityUtil.resolveTenantId(currentTenant, trc, options); - Assert.assertEquals(newTenant, resolvedTenant); + Assertions.assertEquals(newTenant, resolvedTenant); } - @Test(expected = ClientAuthenticationException.class) + @Test public void testAlienTenantWithAdditionalTenantsFromEnv() { String currentTenant = "tenant"; String newTenant = "newTenant"; @@ -147,7 +150,9 @@ public void testAlienTenantWithAdditionalTenantsFromEnv() { IdentityClientOptions options = new IdentityClientOptions() .setAdditionallyAllowedTenants(IdentityUtil.getAdditionalTenantsFromEnvironment(configuration)); - IdentityUtil.resolveTenantId(currentTenant, trc, options); + + Assertions.assertThrows(ClientAuthenticationException.class, + () -> IdentityUtil.resolveTenantId(currentTenant, trc, options)); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md b/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md index fa433acb9511..1c85002ec1ca 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md +++ b/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.2.0-beta.4 (Unreleased) +## 1.3.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,77 @@ ### Other Changes +## 1.2.0 (2023-09-20) + +- Azure Resource Manager IotHub client library for Java. This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-2023-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Features Added + +* `models.RoutingCosmosDBSqlApiProperties` was added + +#### `models.CertificateDescription` was modified + +* `resourceGroupName()` was added + +#### `IotHubManager` was modified + +* `authenticate(com.azure.core.http.HttpPipeline,com.azure.core.management.profile.AzureProfile)` was added + +#### `models.IotHubProperties` was modified + +* `enableDataResidency()` was added +* `withEnableDataResidency(java.lang.Boolean)` was added + +#### `IotHubManager$Configurable` was modified + +* `withRetryOptions(com.azure.core.http.policy.RetryOptions)` was added + +#### `models.RoutingEndpoints` was modified + +* `cosmosDBSqlContainers()` was added +* `withCosmosDBSqlContainers(java.util.List)` was added + +#### `models.IotHubDescription` was modified + +* `resourceGroupName()` was added +* `systemData()` was added + +## 1.2.0-beta.4 (2023-09-18) + +- Azure Resource Manager IotHub client library for Java. This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-preview-2023-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Breaking Changes + +#### `models.RoutingCosmosDBSqlApiProperties` was modified + +* `withCollectionName(java.lang.String)` was removed +* `collectionName()` was removed + +#### `models.RoutingEndpoints` was modified + +* `withCosmosDBSqlCollections(java.util.List)` was removed +* `cosmosDBSqlCollections()` was removed + +#### `models.ErrorDetails` was modified + +* `getHttpStatusCode()` was removed + +### Features Added + +#### `models.RoutingCosmosDBSqlApiProperties` was modified + +* `containerName()` was added +* `withContainerName(java.lang.String)` was added + +#### `models.RoutingEndpoints` was modified + +* `withCosmosDBSqlContainers(java.util.List)` was added +* `cosmosDBSqlContainers()` was added + +#### `models.ErrorDetails` was modified + +* `httpStatusCode()` was added + ## 1.2.0-beta.3 (2023-04-18) - Azure Resource Manager IotHub client library for Java. This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-preview-2022-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/iothub/azure-resourcemanager-iothub/README.md b/sdk/iothub/azure-resourcemanager-iothub/README.md index bd0264c77073..f60799306533 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/README.md +++ b/sdk/iothub/azure-resourcemanager-iothub/README.md @@ -2,7 +2,7 @@ Azure Resource Manager IotHub client library for Java. -This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-preview-2022-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-2023-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-iothub - 1.2.0-beta.3 + 1.2.0 ``` [//]: # ({x-version-update-end}) @@ -103,3 +103,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fiothub%2Fazure-resourcemanager-iothub%2FREADME.png) diff --git a/sdk/iothub/azure-resourcemanager-iothub/SAMPLE.md b/sdk/iothub/azure-resourcemanager-iothub/SAMPLE.md index 32f34ea03892..80e44f64c23a 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/SAMPLE.md +++ b/sdk/iothub/azure-resourcemanager-iothub/SAMPLE.md @@ -67,7 +67,7 @@ import com.azure.resourcemanager.iothub.models.CertificateProperties; /** Samples for Certificates CreateOrUpdate. */ public final class CertificatesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_certificatescreateorupdate.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatescreateorupdate.json */ /** * Sample code: Certificates_CreateOrUpdate. @@ -91,7 +91,7 @@ public final class CertificatesCreateOrUpdateSamples { /** Samples for Certificates Delete. */ public final class CertificatesDeleteSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_certificatesdelete.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatesdelete.json */ /** * Sample code: Certificates_Delete. @@ -112,7 +112,7 @@ public final class CertificatesDeleteSamples { /** Samples for Certificates GenerateVerificationCode. */ public final class CertificatesGenerateVerificationCodeSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_generateverificationcode.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_generateverificationcode.json */ /** * Sample code: Certificates_GenerateVerificationCode. @@ -134,7 +134,7 @@ public final class CertificatesGenerateVerificationCodeSamples { /** Samples for Certificates Get. */ public final class CertificatesGetSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getcertificate.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getcertificate.json */ /** * Sample code: Certificates_Get. @@ -153,7 +153,7 @@ public final class CertificatesGetSamples { /** Samples for Certificates ListByIotHub. */ public final class CertificatesListByIotHubSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listcertificates.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listcertificates.json */ /** * Sample code: Certificates_ListByIotHub. @@ -174,7 +174,7 @@ import com.azure.resourcemanager.iothub.models.CertificateVerificationDescriptio /** Samples for Certificates Verify. */ public final class CertificatesVerifySamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_certverify.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certverify.json */ /** * Sample code: Certificates_Verify. @@ -203,7 +203,7 @@ import com.azure.resourcemanager.iothub.models.FailoverInput; /** Samples for IotHub ManualFailover. */ public final class IotHubManualFailoverSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/IotHub_ManualFailover.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/IotHub_ManualFailover.json */ /** * Sample code: IotHub_ManualFailover. @@ -230,7 +230,7 @@ import com.azure.resourcemanager.iothub.models.OperationInputs; /** Samples for IotHubResource CheckNameAvailability. */ public final class IotHubResourceCheckNameAvailabilitySamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/checkNameAvailability.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/checkNameAvailability.json */ /** * Sample code: IotHubResource_CheckNameAvailability. @@ -254,7 +254,7 @@ import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupName; /** Samples for IotHubResource CreateEventHubConsumerGroup. */ public final class IotHubResourceCreateEventHubConsumerGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_createconsumergroup.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createconsumergroup.json */ /** * Sample code: IotHubResource_CreateEventHubConsumerGroup. @@ -276,6 +276,7 @@ public final class IotHubResourceCreateEventHubConsumerGroupSamples { ### IotHubResource_CreateOrUpdate ```java +import com.azure.resourcemanager.iothub.models.AuthenticationType; import com.azure.resourcemanager.iothub.models.Capabilities; import com.azure.resourcemanager.iothub.models.CloudToDeviceProperties; import com.azure.resourcemanager.iothub.models.DefaultAction; @@ -285,12 +286,11 @@ import com.azure.resourcemanager.iothub.models.FeedbackProperties; import com.azure.resourcemanager.iothub.models.IotHubProperties; import com.azure.resourcemanager.iothub.models.IotHubSku; import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; -import com.azure.resourcemanager.iothub.models.IpVersion; import com.azure.resourcemanager.iothub.models.MessagingEndpointProperties; import com.azure.resourcemanager.iothub.models.NetworkRuleIpAction; import com.azure.resourcemanager.iothub.models.NetworkRuleSetIpRule; import com.azure.resourcemanager.iothub.models.NetworkRuleSetProperties; -import com.azure.resourcemanager.iothub.models.RootCertificateProperties; +import com.azure.resourcemanager.iothub.models.RoutingCosmosDBSqlApiProperties; import com.azure.resourcemanager.iothub.models.RoutingEndpoints; import com.azure.resourcemanager.iothub.models.RoutingProperties; import com.azure.resourcemanager.iothub.models.RoutingSource; @@ -303,7 +303,7 @@ import java.util.Map; /** Samples for IotHubResource CreateOrUpdate. */ public final class IotHubResourceCreateOrUpdateSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_createOrUpdate.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createOrUpdate.json */ /** * Sample code: IotHubResource_CreateOrUpdate. @@ -381,12 +381,110 @@ public final class IotHubResourceCreateOrUpdateSamples { .withTtlAsIso8601(Duration.parse("PT1H")) .withMaxDeliveryCount(10))) .withFeatures(Capabilities.NONE) - .withEnableDataResidency(true) - .withRootCertificate(new RootCertificateProperties().withEnableRootCertificateV2(true)) - .withIpVersion(IpVersion.IPV4IPV6)) + .withEnableDataResidency(false)) + .create(); + } + + /* + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_addRoutingCosmosDBEndpoint.json + */ + /** + * Sample code: IotHubResource_AddCosmosDbEndpoint. + * + * @param manager Entry point to IotHubManager. + */ + public static void iotHubResourceAddCosmosDbEndpoint(com.azure.resourcemanager.iothub.IotHubManager manager) { + manager + .iotHubResources() + .define("testHub") + .withRegion("centraluseuap") + .withExistingResourceGroup("myResourceGroup") + .withSku(new IotHubSkuInfo().withName(IotHubSku.S1).withCapacity(1L)) + .withTags(mapOf()) + .withEtag("AAAAAAFD6M4=") + .withProperties( + new IotHubProperties() + .withIpFilterRules(Arrays.asList()) + .withNetworkRuleSets( + new NetworkRuleSetProperties() + .withDefaultAction(DefaultAction.DENY) + .withApplyToBuiltInEventHubEndpoint(true) + .withIpRules( + Arrays + .asList( + new NetworkRuleSetIpRule() + .withFilterName("rule1") + .withAction(NetworkRuleIpAction.ALLOW) + .withIpMask("131.117.159.53"), + new NetworkRuleSetIpRule() + .withFilterName("rule2") + .withAction(NetworkRuleIpAction.ALLOW) + .withIpMask("157.55.59.128/25")))) + .withMinTlsVersion("1.2") + .withEventHubEndpoints( + mapOf("events", new EventHubProperties().withRetentionTimeInDays(1L).withPartitionCount(2))) + .withRouting( + new RoutingProperties() + .withEndpoints( + new RoutingEndpoints() + .withServiceBusQueues(Arrays.asList()) + .withServiceBusTopics(Arrays.asList()) + .withEventHubs(Arrays.asList()) + .withStorageContainers(Arrays.asList()) + .withCosmosDBSqlContainers( + Arrays + .asList( + new RoutingCosmosDBSqlApiProperties() + .withName("endpointcosmos") + .withSubscriptionId("") + .withResourceGroup("rg-test") + .withEndpointUri( + "https://test-systemstore-test2.documents.azure.com") + .withAuthenticationType(AuthenticationType.KEY_BASED) + .withPrimaryKey("fakeTokenPlaceholder") + .withSecondaryKey("fakeTokenPlaceholder") + .withDatabaseName("systemstore") + .withContainerName("test") + .withPartitionKeyName("fakeTokenPlaceholder") + .withPartitionKeyTemplate("fakeTokenPlaceholder")))) + .withRoutes(Arrays.asList()) + .withFallbackRoute( + new FallbackRouteProperties() + .withName("$fallback") + .withSource(RoutingSource.DEVICE_MESSAGES) + .withCondition("true") + .withEndpointNames(Arrays.asList("events")) + .withIsEnabled(true))) + .withStorageEndpoints( + mapOf( + "$default", + new StorageEndpointProperties() + .withSasTtlAsIso8601(Duration.parse("PT1H")) + .withConnectionString("") + .withContainerName(""))) + .withMessagingEndpoints( + mapOf( + "fileNotifications", + new MessagingEndpointProperties() + .withLockDurationAsIso8601(Duration.parse("PT1M")) + .withTtlAsIso8601(Duration.parse("PT1H")) + .withMaxDeliveryCount(10))) + .withEnableFileUploadNotifications(false) + .withCloudToDevice( + new CloudToDeviceProperties() + .withMaxDeliveryCount(10) + .withDefaultTtlAsIso8601(Duration.parse("PT1H")) + .withFeedback( + new FeedbackProperties() + .withLockDurationAsIso8601(Duration.parse("PT1M")) + .withTtlAsIso8601(Duration.parse("PT1H")) + .withMaxDeliveryCount(10))) + .withFeatures(Capabilities.NONE) + .withEnableDataResidency(false)) .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -406,7 +504,7 @@ public final class IotHubResourceCreateOrUpdateSamples { /** Samples for IotHubResource Delete. */ public final class IotHubResourceDeleteSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_delete.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_delete.json */ /** * Sample code: IotHubResource_Delete. @@ -425,7 +523,7 @@ public final class IotHubResourceDeleteSamples { /** Samples for IotHubResource DeleteEventHubConsumerGroup. */ public final class IotHubResourceDeleteEventHubConsumerGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_deleteconsumergroup.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteconsumergroup.json */ /** * Sample code: IotHubResource_DeleteEventHubConsumerGroup. @@ -445,14 +543,12 @@ public final class IotHubResourceDeleteEventHubConsumerGroupSamples { ### IotHubResource_ExportDevices ```java -import com.azure.resourcemanager.iothub.models.AuthenticationType; import com.azure.resourcemanager.iothub.models.ExportDevicesRequest; -import com.azure.resourcemanager.iothub.models.ManagedIdentity; /** Samples for IotHubResource ExportDevices. */ public final class IotHubResourceExportDevicesSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_exportdevices.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_exportdevices.json */ /** * Sample code: IotHubResource_ExportDevices. @@ -465,14 +561,7 @@ public final class IotHubResourceExportDevicesSamples { .exportDevicesWithResponse( "myResourceGroup", "testHub", - new ExportDevicesRequest() - .withExportBlobContainerUri("testBlob") - .withExcludeKeys(true) - .withAuthenticationType(AuthenticationType.IDENTITY_BASED) - .withIdentity( - new ManagedIdentity() - .withUserAssignedIdentity( - "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")), + new ExportDevicesRequest().withExportBlobContainerUri("testBlob").withExcludeKeys(true), com.azure.core.util.Context.NONE); } } @@ -484,7 +573,7 @@ public final class IotHubResourceExportDevicesSamples { /** Samples for IotHubResource GetByResourceGroup. */ public final class IotHubResourceGetByResourceGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_get.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_get.json */ /** * Sample code: IotHubResource_Get. @@ -505,7 +594,7 @@ public final class IotHubResourceGetByResourceGroupSamples { /** Samples for IotHubResource GetEndpointHealth. */ public final class IotHubResourceGetEndpointHealthSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_routingendpointhealth.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_routingendpointhealth.json */ /** * Sample code: IotHubResource_GetEndpointHealth. @@ -524,7 +613,7 @@ public final class IotHubResourceGetEndpointHealthSamples { /** Samples for IotHubResource GetEventHubConsumerGroup. */ public final class IotHubResourceGetEventHubConsumerGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getconsumergroup.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getconsumergroup.json */ /** * Sample code: IotHubResource_ListEventHubConsumerGroups. @@ -547,7 +636,7 @@ public final class IotHubResourceGetEventHubConsumerGroupSamples { /** Samples for IotHubResource GetJob. */ public final class IotHubResourceGetJobSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getjob.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getjob.json */ /** * Sample code: IotHubResource_GetJob. @@ -568,7 +657,7 @@ public final class IotHubResourceGetJobSamples { /** Samples for IotHubResource GetKeysForKeyName. */ public final class IotHubResourceGetKeysForKeyNameSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getkey.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getkey.json */ /** * Sample code: IotHubResource_GetKeysForKeyName. @@ -590,7 +679,7 @@ public final class IotHubResourceGetKeysForKeyNameSamples { /** Samples for IotHubResource GetQuotaMetrics. */ public final class IotHubResourceGetQuotaMetricsSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_quotametrics.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_quotametrics.json */ /** * Sample code: IotHubResource_GetQuotaMetrics. @@ -609,7 +698,7 @@ public final class IotHubResourceGetQuotaMetricsSamples { /** Samples for IotHubResource GetStats. */ public final class IotHubResourceGetStatsSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_stats.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_stats.json */ /** * Sample code: IotHubResource_GetStats. @@ -628,7 +717,7 @@ public final class IotHubResourceGetStatsSamples { /** Samples for IotHubResource GetValidSkus. */ public final class IotHubResourceGetValidSkusSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getskus.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getskus.json */ /** * Sample code: IotHubResource_GetValidSkus. @@ -649,7 +738,7 @@ import com.azure.resourcemanager.iothub.models.ImportDevicesRequest; /** Samples for IotHubResource ImportDevices. */ public final class IotHubResourceImportDevicesSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_importdevices.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_importdevices.json */ /** * Sample code: IotHubResource_ImportDevices. @@ -674,7 +763,7 @@ public final class IotHubResourceImportDevicesSamples { /** Samples for IotHubResource List. */ public final class IotHubResourceListSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listbysubscription.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbysubscription.json */ /** * Sample code: IotHubResource_ListBySubscription. @@ -693,7 +782,7 @@ public final class IotHubResourceListSamples { /** Samples for IotHubResource ListByResourceGroup. */ public final class IotHubResourceListByResourceGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listbyrg.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbyrg.json */ /** * Sample code: IotHubResource_ListByResourceGroup. @@ -712,7 +801,7 @@ public final class IotHubResourceListByResourceGroupSamples { /** Samples for IotHubResource ListEventHubConsumerGroups. */ public final class IotHubResourceListEventHubConsumerGroupsSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listehgroups.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listehgroups.json */ /** * Sample code: IotHubResource_ListEventHubConsumerGroups. @@ -734,7 +823,7 @@ public final class IotHubResourceListEventHubConsumerGroupsSamples { /** Samples for IotHubResource ListJobs. */ public final class IotHubResourceListJobsSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listjobs.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listjobs.json */ /** * Sample code: IotHubResource_ListJobs. @@ -753,7 +842,7 @@ public final class IotHubResourceListJobsSamples { /** Samples for IotHubResource ListKeys. */ public final class IotHubResourceListKeysSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listkeys.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listkeys.json */ /** * Sample code: IotHubResource_ListKeys. @@ -778,7 +867,7 @@ import java.util.Map; /** Samples for IotHubResource TestAllRoutes. */ public final class IotHubResourceTestAllRoutesSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_testallroutes.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testallroutes.json */ /** * Sample code: IotHubResource_TestAllRoutes. @@ -796,11 +885,12 @@ public final class IotHubResourceTestAllRoutesSamples { .withMessage( new RoutingMessage() .withBody("Body of message") - .withAppProperties(mapOf("key1", "value1")) - .withSystemProperties(mapOf("key1", "value1"))), + .withAppProperties(mapOf("key1", "fakeTokenPlaceholder")) + .withSystemProperties(mapOf("key1", "fakeTokenPlaceholder"))), com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -828,7 +918,7 @@ import java.util.Map; /** Samples for IotHubResource TestRoute. */ public final class IotHubResourceTestRouteSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_testnewroute.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testnewroute.json */ /** * Sample code: IotHubResource_TestRoute. @@ -845,8 +935,8 @@ public final class IotHubResourceTestRouteSamples { .withMessage( new RoutingMessage() .withBody("Body of message") - .withAppProperties(mapOf("key1", "value1")) - .withSystemProperties(mapOf("key1", "value1"))) + .withAppProperties(mapOf("key1", "fakeTokenPlaceholder")) + .withSystemProperties(mapOf("key1", "fakeTokenPlaceholder"))) .withRoute( new RouteProperties() .withName("Routeid") @@ -856,6 +946,7 @@ public final class IotHubResourceTestRouteSamples { com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -879,7 +970,7 @@ import java.util.Map; /** Samples for IotHubResource Update. */ public final class IotHubResourceUpdateSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_patch.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_patch.json */ /** * Sample code: IotHubResource_Update. @@ -895,6 +986,7 @@ public final class IotHubResourceUpdateSamples { resource.update().withTags(mapOf("foo", "bar")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -914,7 +1006,7 @@ public final class IotHubResourceUpdateSamples { /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_operations.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_operations.json */ /** * Sample code: Operations_List. @@ -933,7 +1025,7 @@ public final class OperationsListSamples { /** Samples for PrivateEndpointConnections Delete. */ public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_deleteprivateendpointconnection.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteprivateendpointconnection.json */ /** * Sample code: PrivateEndpointConnection_Delete. @@ -954,7 +1046,7 @@ public final class PrivateEndpointConnectionsDeleteSamples { /** Samples for PrivateEndpointConnections Get. */ public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getprivateendpointconnection.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivateendpointconnection.json */ /** * Sample code: PrivateEndpointConnection_Get. @@ -976,7 +1068,7 @@ public final class PrivateEndpointConnectionsGetSamples { /** Samples for PrivateEndpointConnections List. */ public final class PrivateEndpointConnectionsListSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listprivateendpointconnections.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivateendpointconnections.json */ /** * Sample code: PrivateEndpointConnections_List. @@ -1002,7 +1094,7 @@ import com.azure.resourcemanager.iothub.models.PrivateLinkServiceConnectionStatu /** Samples for PrivateEndpointConnections Update. */ public final class PrivateEndpointConnectionsUpdateSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_updateprivateendpointconnection.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_updateprivateendpointconnection.json */ /** * Sample code: PrivateEndpointConnection_Update. @@ -1034,7 +1126,7 @@ public final class PrivateEndpointConnectionsUpdateSamples { /** Samples for PrivateLinkResourcesOperation Get. */ public final class PrivateLinkResourcesOperationGetSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getprivatelinkresources.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivatelinkresources.json */ /** * Sample code: PrivateLinkResources_List. @@ -1055,7 +1147,7 @@ public final class PrivateLinkResourcesOperationGetSamples { /** Samples for PrivateLinkResourcesOperation List. */ public final class PrivateLinkResourcesOperationListSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listprivatelinkresources.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivatelinkresources.json */ /** * Sample code: PrivateLinkResources_List. @@ -1076,7 +1168,7 @@ public final class PrivateLinkResourcesOperationListSamples { /** Samples for ResourceProviderCommon GetSubscriptionQuota. */ public final class ResourceProviderCommonGetSubscriptionQuotaSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_usages.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_usages.json */ /** * Sample code: ResourceProviderCommon_GetSubscriptionQuota. diff --git a/sdk/iothub/azure-resourcemanager-iothub/pom.xml b/sdk/iothub/azure-resourcemanager-iothub/pom.xml index 8f9f3d2495ba..c39f158d313c 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/pom.xml +++ b/sdk/iothub/azure-resourcemanager-iothub/pom.xml @@ -14,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-iothub - 1.2.0-beta.4 + 1.3.0-beta.1 jar Microsoft Azure SDK for IotHub Management - This package contains Microsoft Azure SDK for IotHub Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-preview-2022-11. + This package contains Microsoft Azure SDK for IotHub Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-2023-06. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java index 0d0d7659ce21..eacd5b8fb33b 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java @@ -227,7 +227,7 @@ public IotHubManager authenticate(TokenCredential credential, AzureProfile profi .append("-") .append("com.azure.resourcemanager.iothub") .append("/") - .append("1.2.0-beta.3"); + .append("1.2.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -372,8 +372,10 @@ public PrivateEndpointConnections privateEndpointConnections() { } /** - * @return Wrapped service client IotHubClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * Gets wrapped service client IotHubClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client IotHubClient. */ public IotHubClient serviceClient() { return this.clientObject; diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java index b1d1f94aa9ba..b86a61c9dcdc 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java @@ -71,7 +71,8 @@ Response getByResourceGroupWithResponse( * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -91,7 +92,8 @@ SyncPoller, IotHubDescriptionInner> beginCrea * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -118,7 +120,8 @@ SyncPoller, IotHubDescriptionInner> beginCrea * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -138,7 +141,8 @@ IotHubDescriptionInner createOrUpdate( * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientBuilder.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientBuilder.java index 6c506efcce77..b5c04dfdb0b0 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientBuilder.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientBuilder.java @@ -137,7 +137,7 @@ public IotHubClientImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java index bac045f9f008..1e7ee5307203 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java @@ -220,7 +220,7 @@ public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2022-11-15-preview"; + this.apiVersion = "2023-06-30"; this.operations = new OperationsClientImpl(this); this.iotHubResources = new IotHubResourcesClientImpl(this); this.resourceProviderCommons = new ResourceProviderCommonsClientImpl(this); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java index 2f6835b2ae6e..24ec1800b9a6 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java @@ -662,7 +662,8 @@ public IotHubDescriptionInner getByResourceGroup(String resourceGroupName, Strin * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -725,7 +726,8 @@ private Mono>> createOrUpdateWithResponseAsync( * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -790,7 +792,8 @@ private Mono>> createOrUpdateWithResponseAsync( * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -822,7 +825,8 @@ private PollerFlux, IotHubDescriptionInner> b * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -853,7 +857,8 @@ private PollerFlux, IotHubDescriptionInner> b * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -891,7 +896,8 @@ private PollerFlux, IotHubDescriptionInner> b * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -915,7 +921,8 @@ public SyncPoller, IotHubDescriptionInner> be * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -945,7 +952,8 @@ public SyncPoller, IotHubDescriptionInner> be * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -970,7 +978,8 @@ private Mono createOrUpdateAsync( * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -994,7 +1003,8 @@ private Mono createOrUpdateAsync( * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -1024,7 +1034,8 @@ private Mono createOrUpdateAsync( * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. @@ -1046,7 +1057,8 @@ public IotHubDescriptionInner createOrUpdate( * *

    Create or update the metadata of an Iot hub. The usual pattern to modify a property is to retrieve the IoT hub * metadata and security metadata, and then combine them with the modified values in a new body to update the IoT - * hub. + * hub. If certain properties are missing in the JSON, updating IoT Hub may cause these values to fallback to + * default, which may lead to unexpected behavior. * * @param resourceGroupName The name of the resource group that contains the IoT hub. * @param resourceName The name of the IoT hub. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmIdentity.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmIdentity.java index d2beb9716add..fba33c2a62ef 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmIdentity.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmIdentity.java @@ -25,7 +25,7 @@ public final class ArmIdentity { private String tenantId; /* - * The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly + * The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly * created identity and a set of user assigned identities. The type 'None' will remove any identities from the * service. */ @@ -62,7 +62,7 @@ public String tenantId() { } /** - * Get the type property: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + * Get the type property: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove * any identities from the service. * @@ -73,7 +73,7 @@ public ResourceIdentityType type() { } /** - * Set the type property: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + * Set the type property: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove * any identities from the service. * diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java index 2c319d346bb9..496cac6ae565 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java @@ -62,11 +62,13 @@ public interface CertificateDescription { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The CertificateDescription definition stages. */ interface DefinitionStages { /** The first stage of the CertificateDescription definition. */ interface Blank extends WithParentResource { } + /** The stage of the CertificateDescription definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -78,6 +80,7 @@ interface WithParentResource { */ WithCreate withExistingIotHub(String resourceGroupName, String resourceName); } + /** * The stage of the CertificateDescription definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -98,6 +101,7 @@ interface WithCreate extends DefinitionStages.WithProperties, DefinitionStages.W */ CertificateDescription create(Context context); } + /** The stage of the CertificateDescription definition allowing to specify properties. */ interface WithProperties { /** @@ -108,6 +112,7 @@ interface WithProperties { */ WithCreate withProperties(CertificateProperties properties); } + /** The stage of the CertificateDescription definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -121,6 +126,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the CertificateDescription resource. * @@ -145,6 +151,7 @@ interface Update extends UpdateStages.WithProperties, UpdateStages.WithIfMatch { */ CertificateDescription apply(Context context); } + /** The CertificateDescription update stages. */ interface UpdateStages { /** The stage of the CertificateDescription update allowing to specify properties. */ @@ -157,6 +164,7 @@ interface WithProperties { */ Update withProperties(CertificateProperties properties); } + /** The stage of the CertificateDescription update allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -170,6 +178,7 @@ interface WithIfMatch { Update withIfMatch(String ifMatch); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EncryptionPropertiesDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EncryptionPropertiesDescription.java deleted file mode 100644 index 4b4405b8a2fc..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EncryptionPropertiesDescription.java +++ /dev/null @@ -1,80 +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.resourcemanager.iothub.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The encryption properties for the IoT hub. */ -@Fluent -public final class EncryptionPropertiesDescription { - /* - * The source of the key. - */ - @JsonProperty(value = "keySource") - private String keySource; - - /* - * The properties of the KeyVault key. - */ - @JsonProperty(value = "keyVaultProperties") - private List keyVaultProperties; - - /** Creates an instance of EncryptionPropertiesDescription class. */ - public EncryptionPropertiesDescription() { - } - - /** - * Get the keySource property: The source of the key. - * - * @return the keySource value. - */ - public String keySource() { - return this.keySource; - } - - /** - * Set the keySource property: The source of the key. - * - * @param keySource the keySource value to set. - * @return the EncryptionPropertiesDescription object itself. - */ - public EncryptionPropertiesDescription withKeySource(String keySource) { - this.keySource = keySource; - return this; - } - - /** - * Get the keyVaultProperties property: The properties of the KeyVault key. - * - * @return the keyVaultProperties value. - */ - public List keyVaultProperties() { - return this.keyVaultProperties; - } - - /** - * Set the keyVaultProperties property: The properties of the KeyVault key. - * - * @param keyVaultProperties the keyVaultProperties value to set. - * @return the EncryptionPropertiesDescription object itself. - */ - public EncryptionPropertiesDescription withKeyVaultProperties(List keyVaultProperties) { - this.keyVaultProperties = keyVaultProperties; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (keyVaultProperties() != null) { - keyVaultProperties().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupInfo.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupInfo.java index e9ca6fd06336..53d57c55e38c 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupInfo.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EventHubConsumerGroupInfo.java @@ -59,11 +59,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The EventHubConsumerGroupInfo definition stages. */ interface DefinitionStages { /** The first stage of the EventHubConsumerGroupInfo definition. */ interface Blank extends WithParentResource { } + /** The stage of the EventHubConsumerGroupInfo definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -77,6 +79,7 @@ interface WithParentResource { WithProperties withExistingEventHubEndpoint( String resourceGroupName, String resourceName, String eventHubEndpointName); } + /** The stage of the EventHubConsumerGroupInfo definition allowing to specify properties. */ interface WithProperties { /** @@ -87,6 +90,7 @@ interface WithProperties { */ WithCreate withProperties(EventHubConsumerGroupName properties); } + /** * The stage of the EventHubConsumerGroupInfo definition which contains all the minimum required properties for * the resource to be created, but also allows for any other optional properties to be specified. @@ -108,6 +112,7 @@ interface WithCreate { EventHubConsumerGroupInfo create(Context context); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescription.java index 8f09aef71b2d..634599247022 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescription.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubDescription.java @@ -121,11 +121,13 @@ interface Definition DefinitionStages.WithSku, DefinitionStages.WithCreate { } + /** The IotHubDescription definition stages. */ interface DefinitionStages { /** The first stage of the IotHubDescription definition. */ interface Blank extends WithLocation { } + /** The stage of the IotHubDescription definition allowing to specify location. */ interface WithLocation { /** @@ -144,6 +146,7 @@ interface WithLocation { */ WithResourceGroup withRegion(String location); } + /** The stage of the IotHubDescription definition allowing to specify parent resource. */ interface WithResourceGroup { /** @@ -154,6 +157,7 @@ interface WithResourceGroup { */ WithSku withExistingResourceGroup(String resourceGroupName); } + /** The stage of the IotHubDescription definition allowing to specify sku. */ interface WithSku { /** @@ -164,6 +168,7 @@ interface WithSku { */ WithCreate withSku(IotHubSkuInfo sku); } + /** * The stage of the IotHubDescription definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -189,6 +194,7 @@ interface WithCreate */ IotHubDescription create(Context context); } + /** The stage of the IotHubDescription definition allowing to specify tags. */ interface WithTags { /** @@ -199,6 +205,7 @@ interface WithTags { */ WithCreate withTags(Map tags); } + /** The stage of the IotHubDescription definition allowing to specify etag. */ interface WithEtag { /** @@ -211,6 +218,7 @@ interface WithEtag { */ WithCreate withEtag(String etag); } + /** The stage of the IotHubDescription definition allowing to specify properties. */ interface WithProperties { /** @@ -221,6 +229,7 @@ interface WithProperties { */ WithCreate withProperties(IotHubProperties properties); } + /** The stage of the IotHubDescription definition allowing to specify identity. */ interface WithIdentity { /** @@ -231,6 +240,7 @@ interface WithIdentity { */ WithCreate withIdentity(ArmIdentity identity); } + /** The stage of the IotHubDescription definition allowing to specify ifMatch. */ interface WithIfMatch { /** @@ -244,6 +254,7 @@ interface WithIfMatch { WithCreate withIfMatch(String ifMatch); } } + /** * Begins update for the IotHubDescription resource. * @@ -268,6 +279,7 @@ interface Update extends UpdateStages.WithTags { */ IotHubDescription apply(Context context); } + /** The IotHubDescription update stages. */ interface UpdateStages { /** The stage of the IotHubDescription update allowing to specify tags. */ @@ -281,6 +293,7 @@ interface WithTags { Update withTags(Map tags); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubProperties.java index d9918847b688..3c6fd1cbdc34 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubProperties.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubProperties.java @@ -152,24 +152,12 @@ public final class IotHubProperties { @JsonProperty(value = "comments") private String comments; - /* - * The device streams properties of iothub. - */ - @JsonProperty(value = "deviceStreams") - private IotHubPropertiesDeviceStreams deviceStreams; - /* * The capabilities and features enabled for the IoT hub. */ @JsonProperty(value = "features") private Capabilities features; - /* - * The encryption properties for the IoT hub. - */ - @JsonProperty(value = "encryption") - private EncryptionPropertiesDescription encryption; - /* * Primary and secondary location for iot hub */ @@ -182,18 +170,6 @@ public final class IotHubProperties { @JsonProperty(value = "enableDataResidency") private Boolean enableDataResidency; - /* - * This property store root certificate related information - */ - @JsonProperty(value = "rootCertificate") - private RootCertificateProperties rootCertificate; - - /* - * This property specifies the IP Version the hub is currently utilizing. - */ - @JsonProperty(value = "ipVersion") - private IpVersion ipVersion; - /** Creates an instance of IotHubProperties class. */ public IotHubProperties() { } @@ -609,26 +585,6 @@ public IotHubProperties withComments(String comments) { return this; } - /** - * Get the deviceStreams property: The device streams properties of iothub. - * - * @return the deviceStreams value. - */ - public IotHubPropertiesDeviceStreams deviceStreams() { - return this.deviceStreams; - } - - /** - * Set the deviceStreams property: The device streams properties of iothub. - * - * @param deviceStreams the deviceStreams value to set. - * @return the IotHubProperties object itself. - */ - public IotHubProperties withDeviceStreams(IotHubPropertiesDeviceStreams deviceStreams) { - this.deviceStreams = deviceStreams; - return this; - } - /** * Get the features property: The capabilities and features enabled for the IoT hub. * @@ -649,26 +605,6 @@ public IotHubProperties withFeatures(Capabilities features) { return this; } - /** - * Get the encryption property: The encryption properties for the IoT hub. - * - * @return the encryption value. - */ - public EncryptionPropertiesDescription encryption() { - return this.encryption; - } - - /** - * Set the encryption property: The encryption properties for the IoT hub. - * - * @param encryption the encryption value to set. - * @return the IotHubProperties object itself. - */ - public IotHubProperties withEncryption(EncryptionPropertiesDescription encryption) { - this.encryption = encryption; - return this; - } - /** * Get the locations property: Primary and secondary location for iot hub. * @@ -700,46 +636,6 @@ public IotHubProperties withEnableDataResidency(Boolean enableDataResidency) { return this; } - /** - * Get the rootCertificate property: This property store root certificate related information. - * - * @return the rootCertificate value. - */ - public RootCertificateProperties rootCertificate() { - return this.rootCertificate; - } - - /** - * Set the rootCertificate property: This property store root certificate related information. - * - * @param rootCertificate the rootCertificate value to set. - * @return the IotHubProperties object itself. - */ - public IotHubProperties withRootCertificate(RootCertificateProperties rootCertificate) { - this.rootCertificate = rootCertificate; - return this; - } - - /** - * Get the ipVersion property: This property specifies the IP Version the hub is currently utilizing. - * - * @return the ipVersion value. - */ - public IpVersion ipVersion() { - return this.ipVersion; - } - - /** - * Set the ipVersion property: This property specifies the IP Version the hub is currently utilizing. - * - * @param ipVersion the ipVersion value to set. - * @return the IotHubProperties object itself. - */ - public IotHubProperties withIpVersion(IpVersion ipVersion) { - this.ipVersion = ipVersion; - return this; - } - /** * Validates the instance. * @@ -794,17 +690,8 @@ public void validate() { if (cloudToDevice() != null) { cloudToDevice().validate(); } - if (deviceStreams() != null) { - deviceStreams().validate(); - } - if (encryption() != null) { - encryption().validate(); - } if (locations() != null) { locations().forEach(e -> e.validate()); } - if (rootCertificate() != null) { - rootCertificate().validate(); - } } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubPropertiesDeviceStreams.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubPropertiesDeviceStreams.java deleted file mode 100644 index ace27da806e6..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubPropertiesDeviceStreams.java +++ /dev/null @@ -1,51 +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.resourcemanager.iothub.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The device streams properties of iothub. */ -@Fluent -public final class IotHubPropertiesDeviceStreams { - /* - * List of Device Streams Endpoints. - */ - @JsonProperty(value = "streamingEndpoints") - private List streamingEndpoints; - - /** Creates an instance of IotHubPropertiesDeviceStreams class. */ - public IotHubPropertiesDeviceStreams() { - } - - /** - * Get the streamingEndpoints property: List of Device Streams Endpoints. - * - * @return the streamingEndpoints value. - */ - public List streamingEndpoints() { - return this.streamingEndpoints; - } - - /** - * Set the streamingEndpoints property: List of Device Streams Endpoints. - * - * @param streamingEndpoints the streamingEndpoints value to set. - * @return the IotHubPropertiesDeviceStreams object itself. - */ - public IotHubPropertiesDeviceStreams withStreamingEndpoints(List streamingEndpoints) { - this.streamingEndpoints = streamingEndpoints; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IpVersion.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IpVersion.java deleted file mode 100644 index 496858e0f0b3..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IpVersion.java +++ /dev/null @@ -1,50 +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.resourcemanager.iothub.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** This property specifies the IP Version the hub is currently utilizing. */ -public final class IpVersion extends ExpandableStringEnum { - /** Static value ipv4 for IpVersion. */ - public static final IpVersion IPV4 = fromString("ipv4"); - - /** Static value ipv6 for IpVersion. */ - public static final IpVersion IPV6 = fromString("ipv6"); - - /** Static value ipv4ipv6 for IpVersion. */ - public static final IpVersion IPV4IPV6 = fromString("ipv4ipv6"); - - /** - * Creates a new instance of IpVersion value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public IpVersion() { - } - - /** - * Creates or finds a IpVersion from its string representation. - * - * @param name a name to look for. - * @return the corresponding IpVersion. - */ - @JsonCreator - public static IpVersion fromString(String name) { - return fromString(name, IpVersion.class); - } - - /** - * Gets known IpVersion values. - * - * @return known IpVersion values. - */ - public static Collection values() { - return values(IpVersion.class); - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/KeyVaultKeyProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/KeyVaultKeyProperties.java deleted file mode 100644 index f106a37fdc4a..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/KeyVaultKeyProperties.java +++ /dev/null @@ -1,79 +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.resourcemanager.iothub.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The properties of the KeyVault key. */ -@Fluent -public final class KeyVaultKeyProperties { - /* - * The identifier of the key. - */ - @JsonProperty(value = "keyIdentifier") - private String keyIdentifier; - - /* - * Managed identity properties of KeyVault Key. - */ - @JsonProperty(value = "identity") - private ManagedIdentity identity; - - /** Creates an instance of KeyVaultKeyProperties class. */ - public KeyVaultKeyProperties() { - } - - /** - * Get the keyIdentifier property: The identifier of the key. - * - * @return the keyIdentifier value. - */ - public String keyIdentifier() { - return this.keyIdentifier; - } - - /** - * Set the keyIdentifier property: The identifier of the key. - * - * @param keyIdentifier the keyIdentifier value to set. - * @return the KeyVaultKeyProperties object itself. - */ - public KeyVaultKeyProperties withKeyIdentifier(String keyIdentifier) { - this.keyIdentifier = keyIdentifier; - return this; - } - - /** - * Get the identity property: Managed identity properties of KeyVault Key. - * - * @return the identity value. - */ - public ManagedIdentity identity() { - return this.identity; - } - - /** - * Set the identity property: Managed identity properties of KeyVault Key. - * - * @param identity the identity value to set. - * @return the KeyVaultKeyProperties object itself. - */ - public KeyVaultKeyProperties withIdentity(ManagedIdentity identity) { - this.identity = identity; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (identity() != null) { - identity().validate(); - } - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceIdentityType.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceIdentityType.java index e2c4dcca374d..01d082c3b9c6 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceIdentityType.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceIdentityType.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** - * The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly + * The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly * created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. */ public enum ResourceIdentityType { diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RootCertificateProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RootCertificateProperties.java deleted file mode 100644 index 5966512f8c6d..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RootCertificateProperties.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.resourcemanager.iothub.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** This property store root certificate related information. */ -@Fluent -public final class RootCertificateProperties { - /* - * This property when set to true, hub will use G2 cert; while it's set to false, hub uses Baltimore Cert. - */ - @JsonProperty(value = "enableRootCertificateV2") - private Boolean enableRootCertificateV2; - - /* - * the last update time to root certificate flag. - */ - @JsonProperty(value = "lastUpdatedTimeUtc", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime lastUpdatedTimeUtc; - - /** Creates an instance of RootCertificateProperties class. */ - public RootCertificateProperties() { - } - - /** - * Get the enableRootCertificateV2 property: This property when set to true, hub will use G2 cert; while it's set to - * false, hub uses Baltimore Cert. - * - * @return the enableRootCertificateV2 value. - */ - public Boolean enableRootCertificateV2() { - return this.enableRootCertificateV2; - } - - /** - * Set the enableRootCertificateV2 property: This property when set to true, hub will use G2 cert; while it's set to - * false, hub uses Baltimore Cert. - * - * @param enableRootCertificateV2 the enableRootCertificateV2 value to set. - * @return the RootCertificateProperties object itself. - */ - public RootCertificateProperties withEnableRootCertificateV2(Boolean enableRootCertificateV2) { - this.enableRootCertificateV2 = enableRootCertificateV2; - return this; - } - - /** - * Get the lastUpdatedTimeUtc property: the last update time to root certificate flag. - * - * @return the lastUpdatedTimeUtc value. - */ - public OffsetDateTime lastUpdatedTimeUtc() { - return this.lastUpdatedTimeUtc; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingCosmosDBSqlApiProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingCosmosDBSqlApiProperties.java index 022dc9d0f732..d6c04afcebb9 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingCosmosDBSqlApiProperties.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingCosmosDBSqlApiProperties.java @@ -8,7 +8,7 @@ import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonProperty; -/** The properties related to a cosmos DB sql collection endpoint. */ +/** The properties related to a cosmos DB sql container endpoint. */ @Fluent public final class RoutingCosmosDBSqlApiProperties { /* @@ -20,9 +20,9 @@ public final class RoutingCosmosDBSqlApiProperties { private String name; /* - * Id of the cosmos DB sql collection endpoint + * Id of the cosmos DB sql container endpoint */ - @JsonProperty(value = "id") + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /* @@ -44,13 +44,13 @@ public final class RoutingCosmosDBSqlApiProperties { private String endpointUri; /* - * Method used to authenticate against the cosmos DB sql collection endpoint + * Method used to authenticate against the cosmos DB sql container endpoint */ @JsonProperty(value = "authenticationType") private AuthenticationType authenticationType; /* - * Managed identity properties of routing cosmos DB collection endpoint. + * Managed identity properties of routing cosmos DB container endpoint. */ @JsonProperty(value = "identity") private ManagedIdentity identity; @@ -74,20 +74,20 @@ public final class RoutingCosmosDBSqlApiProperties { private String databaseName; /* - * The name of the cosmos DB sql collection in the cosmos DB database. + * The name of the cosmos DB sql container in the cosmos DB database. */ - @JsonProperty(value = "collectionName", required = true) - private String collectionName; + @JsonProperty(value = "containerName", required = true) + private String containerName; /* - * The name of the partition key associated with this cosmos DB sql collection if one exists. This is an optional + * The name of the partition key associated with this cosmos DB sql container if one exists. This is an optional * parameter. */ @JsonProperty(value = "partitionKeyName") private String partitionKeyName; /* - * The template for generating a synthetic partition key value for use with this cosmos DB sql collection. The + * The template for generating a synthetic partition key value for use with this cosmos DB sql container. The * template must include at least one of the following placeholders: {iothub}, {deviceid}, {DD}, {MM}, and {YYYY}. * Any one placeholder may be specified at most once, but order and non-placeholder components are arbitrary. This * parameter is only required if PartitionKeyName is specified. @@ -124,7 +124,7 @@ public RoutingCosmosDBSqlApiProperties withName(String name) { } /** - * Get the id property: Id of the cosmos DB sql collection endpoint. + * Get the id property: Id of the cosmos DB sql container endpoint. * * @return the id value. */ @@ -132,17 +132,6 @@ public String id() { return this.id; } - /** - * Set the id property: Id of the cosmos DB sql collection endpoint. - * - * @param id the id value to set. - * @return the RoutingCosmosDBSqlApiProperties object itself. - */ - public RoutingCosmosDBSqlApiProperties withId(String id) { - this.id = id; - return this; - } - /** * Get the subscriptionId property: The subscription identifier of the cosmos DB account. * @@ -204,7 +193,7 @@ public RoutingCosmosDBSqlApiProperties withEndpointUri(String endpointUri) { } /** - * Get the authenticationType property: Method used to authenticate against the cosmos DB sql collection endpoint. + * Get the authenticationType property: Method used to authenticate against the cosmos DB sql container endpoint. * * @return the authenticationType value. */ @@ -213,7 +202,7 @@ public AuthenticationType authenticationType() { } /** - * Set the authenticationType property: Method used to authenticate against the cosmos DB sql collection endpoint. + * Set the authenticationType property: Method used to authenticate against the cosmos DB sql container endpoint. * * @param authenticationType the authenticationType value to set. * @return the RoutingCosmosDBSqlApiProperties object itself. @@ -224,7 +213,7 @@ public RoutingCosmosDBSqlApiProperties withAuthenticationType(AuthenticationType } /** - * Get the identity property: Managed identity properties of routing cosmos DB collection endpoint. + * Get the identity property: Managed identity properties of routing cosmos DB container endpoint. * * @return the identity value. */ @@ -233,7 +222,7 @@ public ManagedIdentity identity() { } /** - * Set the identity property: Managed identity properties of routing cosmos DB collection endpoint. + * Set the identity property: Managed identity properties of routing cosmos DB container endpoint. * * @param identity the identity value to set. * @return the RoutingCosmosDBSqlApiProperties object itself. @@ -304,27 +293,27 @@ public RoutingCosmosDBSqlApiProperties withDatabaseName(String databaseName) { } /** - * Get the collectionName property: The name of the cosmos DB sql collection in the cosmos DB database. + * Get the containerName property: The name of the cosmos DB sql container in the cosmos DB database. * - * @return the collectionName value. + * @return the containerName value. */ - public String collectionName() { - return this.collectionName; + public String containerName() { + return this.containerName; } /** - * Set the collectionName property: The name of the cosmos DB sql collection in the cosmos DB database. + * Set the containerName property: The name of the cosmos DB sql container in the cosmos DB database. * - * @param collectionName the collectionName value to set. + * @param containerName the containerName value to set. * @return the RoutingCosmosDBSqlApiProperties object itself. */ - public RoutingCosmosDBSqlApiProperties withCollectionName(String collectionName) { - this.collectionName = collectionName; + public RoutingCosmosDBSqlApiProperties withContainerName(String containerName) { + this.containerName = containerName; return this; } /** - * Get the partitionKeyName property: The name of the partition key associated with this cosmos DB sql collection if + * Get the partitionKeyName property: The name of the partition key associated with this cosmos DB sql container if * one exists. This is an optional parameter. * * @return the partitionKeyName value. @@ -334,7 +323,7 @@ public String partitionKeyName() { } /** - * Set the partitionKeyName property: The name of the partition key associated with this cosmos DB sql collection if + * Set the partitionKeyName property: The name of the partition key associated with this cosmos DB sql container if * one exists. This is an optional parameter. * * @param partitionKeyName the partitionKeyName value to set. @@ -347,7 +336,7 @@ public RoutingCosmosDBSqlApiProperties withPartitionKeyName(String partitionKeyN /** * Get the partitionKeyTemplate property: The template for generating a synthetic partition key value for use with - * this cosmos DB sql collection. The template must include at least one of the following placeholders: {iothub}, + * this cosmos DB sql container. The template must include at least one of the following placeholders: {iothub}, * {deviceid}, {DD}, {MM}, and {YYYY}. Any one placeholder may be specified at most once, but order and * non-placeholder components are arbitrary. This parameter is only required if PartitionKeyName is specified. * @@ -359,7 +348,7 @@ public String partitionKeyTemplate() { /** * Set the partitionKeyTemplate property: The template for generating a synthetic partition key value for use with - * this cosmos DB sql collection. The template must include at least one of the following placeholders: {iothub}, + * this cosmos DB sql container. The template must include at least one of the following placeholders: {iothub}, * {deviceid}, {DD}, {MM}, and {YYYY}. Any one placeholder may be specified at most once, but order and * non-placeholder components are arbitrary. This parameter is only required if PartitionKeyName is specified. * @@ -398,11 +387,11 @@ public void validate() { new IllegalArgumentException( "Missing required property databaseName in model RoutingCosmosDBSqlApiProperties")); } - if (collectionName() == null) { + if (containerName() == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - "Missing required property collectionName in model RoutingCosmosDBSqlApiProperties")); + "Missing required property containerName in model RoutingCosmosDBSqlApiProperties")); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEndpoints.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEndpoints.java index 95624d66dcae..ff30a6f12ae0 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEndpoints.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEndpoints.java @@ -41,10 +41,10 @@ public final class RoutingEndpoints { private List storageContainers; /* - * The list of Cosmos DB collection endpoints that IoT hub routes messages to, based on the routing rules. + * The list of Cosmos DB container endpoints that IoT hub routes messages to, based on the routing rules. */ - @JsonProperty(value = "cosmosDBSqlCollections") - private List cosmosDBSqlCollections; + @JsonProperty(value = "cosmosDBSqlContainers") + private List cosmosDBSqlContainers; /** Creates an instance of RoutingEndpoints class. */ public RoutingEndpoints() { @@ -139,24 +139,24 @@ public RoutingEndpoints withStorageContainers(List cosmosDBSqlCollections() { - return this.cosmosDBSqlCollections; + public List cosmosDBSqlContainers() { + return this.cosmosDBSqlContainers; } /** - * Set the cosmosDBSqlCollections property: The list of Cosmos DB collection endpoints that IoT hub routes messages + * Set the cosmosDBSqlContainers property: The list of Cosmos DB container endpoints that IoT hub routes messages * to, based on the routing rules. * - * @param cosmosDBSqlCollections the cosmosDBSqlCollections value to set. + * @param cosmosDBSqlContainers the cosmosDBSqlContainers value to set. * @return the RoutingEndpoints object itself. */ - public RoutingEndpoints withCosmosDBSqlCollections(List cosmosDBSqlCollections) { - this.cosmosDBSqlCollections = cosmosDBSqlCollections; + public RoutingEndpoints withCosmosDBSqlContainers(List cosmosDBSqlContainers) { + this.cosmosDBSqlContainers = cosmosDBSqlContainers; return this; } @@ -178,8 +178,8 @@ public void validate() { if (storageContainers() != null) { storageContainers().forEach(e -> e.validate()); } - if (cosmosDBSqlCollections() != null) { - cosmosDBSqlCollections().forEach(e -> e.validate()); + if (cosmosDBSqlContainers() != null) { + cosmosDBSqlContainers().forEach(e -> e.validate()); } } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingProperties.java index c02c18d8b4a1..97c5b204afeb 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingProperties.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingProperties.java @@ -32,8 +32,8 @@ public final class RoutingProperties { /* * The properties of the route that is used as a fall-back route when none of the conditions specified in the - * 'routes' section are met. This is an optional parameter. When this property is not set, the messages which do - * not meet any of the conditions specified in the 'routes' section get routed to the built-in eventhub endpoint. + * 'routes' section are met. This is an optional parameter. When this property is not present in the template, the + * fallback route is disabled by default. */ @JsonProperty(value = "fallbackRoute") private FallbackRouteProperties fallbackRoute; @@ -100,8 +100,7 @@ public RoutingProperties withRoutes(List routes) { /** * Get the fallbackRoute property: The properties of the route that is used as a fall-back route when none of the * conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not - * set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the - * built-in eventhub endpoint. + * present in the template, the fallback route is disabled by default. * * @return the fallbackRoute value. */ @@ -112,8 +111,7 @@ public FallbackRouteProperties fallbackRoute() { /** * Set the fallbackRoute property: The properties of the route that is used as a fall-back route when none of the * conditions specified in the 'routes' section are met. This is an optional parameter. When this property is not - * set, the messages which do not meet any of the conditions specified in the 'routes' section get routed to the - * built-in eventhub endpoint. + * present in the template, the fallback route is disabled by default. * * @param fallbackRoute the fallbackRoute value to set. * @return the RoutingProperties object itself. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java index b7db729608af..749ab75aac1e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java @@ -25,15 +25,9 @@ public final class RoutingSource extends ExpandableStringEnum { /** Static value DeviceJobLifecycleEvents for RoutingSource. */ public static final RoutingSource DEVICE_JOB_LIFECYCLE_EVENTS = fromString("DeviceJobLifecycleEvents"); - /** Static value DigitalTwinChangeEvents for RoutingSource. */ - public static final RoutingSource DIGITAL_TWIN_CHANGE_EVENTS = fromString("DigitalTwinChangeEvents"); - /** Static value DeviceConnectionStateEvents for RoutingSource. */ public static final RoutingSource DEVICE_CONNECTION_STATE_EVENTS = fromString("DeviceConnectionStateEvents"); - /** Static value MqttBrokerMessages for RoutingSource. */ - public static final RoutingSource MQTT_BROKER_MESSAGES = fromString("MqttBrokerMessages"); - /** * Creates a new instance of RoutingSource value. * diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesCreateOrUpdateSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesCreateOrUpdateSamples.java index 67c58c331f70..cd55189b2dc0 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesCreateOrUpdateSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesCreateOrUpdateSamples.java @@ -9,7 +9,7 @@ /** Samples for Certificates CreateOrUpdate. */ public final class CertificatesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_certificatescreateorupdate.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatescreateorupdate.json */ /** * Sample code: Certificates_CreateOrUpdate. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesDeleteSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesDeleteSamples.java index 61ba2a5ca588..1c47823a0532 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesDeleteSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Certificates Delete. */ public final class CertificatesDeleteSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_certificatesdelete.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certificatesdelete.json */ /** * Sample code: Certificates_Delete. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesGenerateVerificationCodeSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesGenerateVerificationCodeSamples.java index 5ec7905114f6..9f22190de3d7 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesGenerateVerificationCodeSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesGenerateVerificationCodeSamples.java @@ -7,7 +7,7 @@ /** Samples for Certificates GenerateVerificationCode. */ public final class CertificatesGenerateVerificationCodeSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_generateverificationcode.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_generateverificationcode.json */ /** * Sample code: Certificates_GenerateVerificationCode. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesGetSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesGetSamples.java index 0ee916a6f086..0a49b7bf782f 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesGetSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for Certificates Get. */ public final class CertificatesGetSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getcertificate.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getcertificate.json */ /** * Sample code: Certificates_Get. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesListByIotHubSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesListByIotHubSamples.java index c2023a216ea9..07f13f148296 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesListByIotHubSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesListByIotHubSamples.java @@ -7,7 +7,7 @@ /** Samples for Certificates ListByIotHub. */ public final class CertificatesListByIotHubSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listcertificates.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listcertificates.json */ /** * Sample code: Certificates_ListByIotHub. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesVerifySamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesVerifySamples.java index 8d60108f9d5f..4196f0c4c6d8 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesVerifySamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/CertificatesVerifySamples.java @@ -9,7 +9,7 @@ /** Samples for Certificates Verify. */ public final class CertificatesVerifySamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_certverify.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_certverify.json */ /** * Sample code: Certificates_Verify. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubManualFailoverSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubManualFailoverSamples.java index eab64aa98e1f..8e1aa57f5aab 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubManualFailoverSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubManualFailoverSamples.java @@ -9,7 +9,7 @@ /** Samples for IotHub ManualFailover. */ public final class IotHubManualFailoverSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/IotHub_ManualFailover.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/IotHub_ManualFailover.json */ /** * Sample code: IotHub_ManualFailover. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCheckNameAvailabilitySamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCheckNameAvailabilitySamples.java index 0facb51a6a4b..13ad2adb3231 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCheckNameAvailabilitySamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCheckNameAvailabilitySamples.java @@ -9,7 +9,7 @@ /** Samples for IotHubResource CheckNameAvailability. */ public final class IotHubResourceCheckNameAvailabilitySamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/checkNameAvailability.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/checkNameAvailability.json */ /** * Sample code: IotHubResource_CheckNameAvailability. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCreateEventHubConsumerGroupSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCreateEventHubConsumerGroupSamples.java index 36c0715687a0..f62884542f29 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCreateEventHubConsumerGroupSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCreateEventHubConsumerGroupSamples.java @@ -9,7 +9,7 @@ /** Samples for IotHubResource CreateEventHubConsumerGroup. */ public final class IotHubResourceCreateEventHubConsumerGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_createconsumergroup.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createconsumergroup.json */ /** * Sample code: IotHubResource_CreateEventHubConsumerGroup. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCreateOrUpdateSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCreateOrUpdateSamples.java index ea4d482473b4..13d104fd771e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCreateOrUpdateSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceCreateOrUpdateSamples.java @@ -4,6 +4,7 @@ package com.azure.resourcemanager.iothub.generated; +import com.azure.resourcemanager.iothub.models.AuthenticationType; import com.azure.resourcemanager.iothub.models.Capabilities; import com.azure.resourcemanager.iothub.models.CloudToDeviceProperties; import com.azure.resourcemanager.iothub.models.DefaultAction; @@ -13,12 +14,11 @@ import com.azure.resourcemanager.iothub.models.IotHubProperties; import com.azure.resourcemanager.iothub.models.IotHubSku; import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; -import com.azure.resourcemanager.iothub.models.IpVersion; import com.azure.resourcemanager.iothub.models.MessagingEndpointProperties; import com.azure.resourcemanager.iothub.models.NetworkRuleIpAction; import com.azure.resourcemanager.iothub.models.NetworkRuleSetIpRule; import com.azure.resourcemanager.iothub.models.NetworkRuleSetProperties; -import com.azure.resourcemanager.iothub.models.RootCertificateProperties; +import com.azure.resourcemanager.iothub.models.RoutingCosmosDBSqlApiProperties; import com.azure.resourcemanager.iothub.models.RoutingEndpoints; import com.azure.resourcemanager.iothub.models.RoutingProperties; import com.azure.resourcemanager.iothub.models.RoutingSource; @@ -31,7 +31,7 @@ /** Samples for IotHubResource CreateOrUpdate. */ public final class IotHubResourceCreateOrUpdateSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_createOrUpdate.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_createOrUpdate.json */ /** * Sample code: IotHubResource_CreateOrUpdate. @@ -109,12 +109,110 @@ public static void iotHubResourceCreateOrUpdate(com.azure.resourcemanager.iothub .withTtlAsIso8601(Duration.parse("PT1H")) .withMaxDeliveryCount(10))) .withFeatures(Capabilities.NONE) - .withEnableDataResidency(true) - .withRootCertificate(new RootCertificateProperties().withEnableRootCertificateV2(true)) - .withIpVersion(IpVersion.IPV4IPV6)) + .withEnableDataResidency(false)) .create(); } + /* + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_addRoutingCosmosDBEndpoint.json + */ + /** + * Sample code: IotHubResource_AddCosmosDbEndpoint. + * + * @param manager Entry point to IotHubManager. + */ + public static void iotHubResourceAddCosmosDbEndpoint(com.azure.resourcemanager.iothub.IotHubManager manager) { + manager + .iotHubResources() + .define("testHub") + .withRegion("centraluseuap") + .withExistingResourceGroup("myResourceGroup") + .withSku(new IotHubSkuInfo().withName(IotHubSku.S1).withCapacity(1L)) + .withTags(mapOf()) + .withEtag("AAAAAAFD6M4=") + .withProperties( + new IotHubProperties() + .withIpFilterRules(Arrays.asList()) + .withNetworkRuleSets( + new NetworkRuleSetProperties() + .withDefaultAction(DefaultAction.DENY) + .withApplyToBuiltInEventHubEndpoint(true) + .withIpRules( + Arrays + .asList( + new NetworkRuleSetIpRule() + .withFilterName("rule1") + .withAction(NetworkRuleIpAction.ALLOW) + .withIpMask("131.117.159.53"), + new NetworkRuleSetIpRule() + .withFilterName("rule2") + .withAction(NetworkRuleIpAction.ALLOW) + .withIpMask("157.55.59.128/25")))) + .withMinTlsVersion("1.2") + .withEventHubEndpoints( + mapOf("events", new EventHubProperties().withRetentionTimeInDays(1L).withPartitionCount(2))) + .withRouting( + new RoutingProperties() + .withEndpoints( + new RoutingEndpoints() + .withServiceBusQueues(Arrays.asList()) + .withServiceBusTopics(Arrays.asList()) + .withEventHubs(Arrays.asList()) + .withStorageContainers(Arrays.asList()) + .withCosmosDBSqlContainers( + Arrays + .asList( + new RoutingCosmosDBSqlApiProperties() + .withName("endpointcosmos") + .withSubscriptionId("") + .withResourceGroup("rg-test") + .withEndpointUri( + "https://test-systemstore-test2.documents.azure.com") + .withAuthenticationType(AuthenticationType.KEY_BASED) + .withPrimaryKey("fakeTokenPlaceholder") + .withSecondaryKey("fakeTokenPlaceholder") + .withDatabaseName("systemstore") + .withContainerName("test") + .withPartitionKeyName("fakeTokenPlaceholder") + .withPartitionKeyTemplate("fakeTokenPlaceholder")))) + .withRoutes(Arrays.asList()) + .withFallbackRoute( + new FallbackRouteProperties() + .withName("$fallback") + .withSource(RoutingSource.DEVICE_MESSAGES) + .withCondition("true") + .withEndpointNames(Arrays.asList("events")) + .withIsEnabled(true))) + .withStorageEndpoints( + mapOf( + "$default", + new StorageEndpointProperties() + .withSasTtlAsIso8601(Duration.parse("PT1H")) + .withConnectionString("") + .withContainerName(""))) + .withMessagingEndpoints( + mapOf( + "fileNotifications", + new MessagingEndpointProperties() + .withLockDurationAsIso8601(Duration.parse("PT1M")) + .withTtlAsIso8601(Duration.parse("PT1H")) + .withMaxDeliveryCount(10))) + .withEnableFileUploadNotifications(false) + .withCloudToDevice( + new CloudToDeviceProperties() + .withMaxDeliveryCount(10) + .withDefaultTtlAsIso8601(Duration.parse("PT1H")) + .withFeedback( + new FeedbackProperties() + .withLockDurationAsIso8601(Duration.parse("PT1M")) + .withTtlAsIso8601(Duration.parse("PT1H")) + .withMaxDeliveryCount(10))) + .withFeatures(Capabilities.NONE) + .withEnableDataResidency(false)) + .create(); + } + + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceDeleteEventHubConsumerGroupSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceDeleteEventHubConsumerGroupSamples.java index e06756470975..39f4cb5a84d9 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceDeleteEventHubConsumerGroupSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceDeleteEventHubConsumerGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource DeleteEventHubConsumerGroup. */ public final class IotHubResourceDeleteEventHubConsumerGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_deleteconsumergroup.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteconsumergroup.json */ /** * Sample code: IotHubResource_DeleteEventHubConsumerGroup. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceDeleteSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceDeleteSamples.java index 4417738a281b..77ffaeff80d8 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceDeleteSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource Delete. */ public final class IotHubResourceDeleteSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_delete.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_delete.json */ /** * Sample code: IotHubResource_Delete. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceExportDevicesSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceExportDevicesSamples.java index 49d384d55dab..361de299c3ab 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceExportDevicesSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceExportDevicesSamples.java @@ -4,14 +4,12 @@ package com.azure.resourcemanager.iothub.generated; -import com.azure.resourcemanager.iothub.models.AuthenticationType; import com.azure.resourcemanager.iothub.models.ExportDevicesRequest; -import com.azure.resourcemanager.iothub.models.ManagedIdentity; /** Samples for IotHubResource ExportDevices. */ public final class IotHubResourceExportDevicesSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_exportdevices.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_exportdevices.json */ /** * Sample code: IotHubResource_ExportDevices. @@ -24,14 +22,7 @@ public static void iotHubResourceExportDevices(com.azure.resourcemanager.iothub. .exportDevicesWithResponse( "myResourceGroup", "testHub", - new ExportDevicesRequest() - .withExportBlobContainerUri("testBlob") - .withExcludeKeys(true) - .withAuthenticationType(AuthenticationType.IDENTITY_BASED) - .withIdentity( - new ManagedIdentity() - .withUserAssignedIdentity( - "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")), + new ExportDevicesRequest().withExportBlobContainerUri("testBlob").withExcludeKeys(true), com.azure.core.util.Context.NONE); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetByResourceGroupSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetByResourceGroupSamples.java index ea558057aada..96dcfd62ab6f 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetByResourceGroupSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource GetByResourceGroup. */ public final class IotHubResourceGetByResourceGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_get.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_get.json */ /** * Sample code: IotHubResource_Get. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetEndpointHealthSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetEndpointHealthSamples.java index a0dd12653cd4..2255f39e84f0 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetEndpointHealthSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetEndpointHealthSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource GetEndpointHealth. */ public final class IotHubResourceGetEndpointHealthSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_routingendpointhealth.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_routingendpointhealth.json */ /** * Sample code: IotHubResource_GetEndpointHealth. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetEventHubConsumerGroupSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetEventHubConsumerGroupSamples.java index 3cc209523a72..9f3e32f7d6ca 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetEventHubConsumerGroupSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetEventHubConsumerGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource GetEventHubConsumerGroup. */ public final class IotHubResourceGetEventHubConsumerGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getconsumergroup.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getconsumergroup.json */ /** * Sample code: IotHubResource_ListEventHubConsumerGroups. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetJobSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetJobSamples.java index f9f1433d3857..f2cd34573cfd 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetJobSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetJobSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource GetJob. */ public final class IotHubResourceGetJobSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getjob.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getjob.json */ /** * Sample code: IotHubResource_GetJob. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetKeysForKeyNameSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetKeysForKeyNameSamples.java index 11dffec06eab..71735d9d2888 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetKeysForKeyNameSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetKeysForKeyNameSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource GetKeysForKeyName. */ public final class IotHubResourceGetKeysForKeyNameSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getkey.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getkey.json */ /** * Sample code: IotHubResource_GetKeysForKeyName. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetQuotaMetricsSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetQuotaMetricsSamples.java index 775e10695bb5..68bfeedae655 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetQuotaMetricsSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetQuotaMetricsSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource GetQuotaMetrics. */ public final class IotHubResourceGetQuotaMetricsSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_quotametrics.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_quotametrics.json */ /** * Sample code: IotHubResource_GetQuotaMetrics. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetStatsSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetStatsSamples.java index dcc8d008d25d..17a1b6cbffd2 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetStatsSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetStatsSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource GetStats. */ public final class IotHubResourceGetStatsSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_stats.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_stats.json */ /** * Sample code: IotHubResource_GetStats. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetValidSkusSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetValidSkusSamples.java index bfe42046f6a4..72d1f8d714f2 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetValidSkusSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceGetValidSkusSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource GetValidSkus. */ public final class IotHubResourceGetValidSkusSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getskus.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getskus.json */ /** * Sample code: IotHubResource_GetValidSkus. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceImportDevicesSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceImportDevicesSamples.java index 79cd595c5497..196da9a57deb 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceImportDevicesSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceImportDevicesSamples.java @@ -9,7 +9,7 @@ /** Samples for IotHubResource ImportDevices. */ public final class IotHubResourceImportDevicesSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_importdevices.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_importdevices.json */ /** * Sample code: IotHubResource_ImportDevices. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListByResourceGroupSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListByResourceGroupSamples.java index fe778d1ed072..fd4b18492567 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListByResourceGroupSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource ListByResourceGroup. */ public final class IotHubResourceListByResourceGroupSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listbyrg.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbyrg.json */ /** * Sample code: IotHubResource_ListByResourceGroup. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListEventHubConsumerGroupsSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListEventHubConsumerGroupsSamples.java index a8dad23085ab..435df57e3ba3 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListEventHubConsumerGroupsSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListEventHubConsumerGroupsSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource ListEventHubConsumerGroups. */ public final class IotHubResourceListEventHubConsumerGroupsSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listehgroups.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listehgroups.json */ /** * Sample code: IotHubResource_ListEventHubConsumerGroups. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListJobsSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListJobsSamples.java index 04018569eddb..d7fa2420a461 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListJobsSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListJobsSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource ListJobs. */ public final class IotHubResourceListJobsSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listjobs.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listjobs.json */ /** * Sample code: IotHubResource_ListJobs. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListKeysSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListKeysSamples.java index bdf5149ef1e8..0c40b8683057 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListKeysSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListKeysSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource ListKeys. */ public final class IotHubResourceListKeysSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listkeys.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listkeys.json */ /** * Sample code: IotHubResource_ListKeys. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListSamples.java index 7a5d05862b02..7d68fe420271 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceListSamples.java @@ -7,7 +7,7 @@ /** Samples for IotHubResource List. */ public final class IotHubResourceListSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listbysubscription.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listbysubscription.json */ /** * Sample code: IotHubResource_ListBySubscription. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceTestAllRoutesSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceTestAllRoutesSamples.java index 99e3f501bb25..d5cd3516fea9 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceTestAllRoutesSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceTestAllRoutesSamples.java @@ -13,7 +13,7 @@ /** Samples for IotHubResource TestAllRoutes. */ public final class IotHubResourceTestAllRoutesSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_testallroutes.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testallroutes.json */ /** * Sample code: IotHubResource_TestAllRoutes. @@ -31,11 +31,12 @@ public static void iotHubResourceTestAllRoutes(com.azure.resourcemanager.iothub. .withMessage( new RoutingMessage() .withBody("Body of message") - .withAppProperties(mapOf("key1", "value1")) - .withSystemProperties(mapOf("key1", "value1"))), + .withAppProperties(mapOf("key1", "fakeTokenPlaceholder")) + .withSystemProperties(mapOf("key1", "fakeTokenPlaceholder"))), com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceTestRouteSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceTestRouteSamples.java index f789024375da..eab3c3c9bc62 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceTestRouteSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceTestRouteSamples.java @@ -15,7 +15,7 @@ /** Samples for IotHubResource TestRoute. */ public final class IotHubResourceTestRouteSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_testnewroute.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_testnewroute.json */ /** * Sample code: IotHubResource_TestRoute. @@ -32,8 +32,8 @@ public static void iotHubResourceTestRoute(com.azure.resourcemanager.iothub.IotH .withMessage( new RoutingMessage() .withBody("Body of message") - .withAppProperties(mapOf("key1", "value1")) - .withSystemProperties(mapOf("key1", "value1"))) + .withAppProperties(mapOf("key1", "fakeTokenPlaceholder")) + .withSystemProperties(mapOf("key1", "fakeTokenPlaceholder"))) .withRoute( new RouteProperties() .withName("Routeid") @@ -43,6 +43,7 @@ public static void iotHubResourceTestRoute(com.azure.resourcemanager.iothub.IotH com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceUpdateSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceUpdateSamples.java index be13f9a3482c..db96b866387e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceUpdateSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/IotHubResourceUpdateSamples.java @@ -11,7 +11,7 @@ /** Samples for IotHubResource Update. */ public final class IotHubResourceUpdateSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_patch.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_patch.json */ /** * Sample code: IotHubResource_Update. @@ -27,6 +27,7 @@ public static void iotHubResourceUpdate(com.azure.resourcemanager.iothub.IotHubM resource.update().withTags(mapOf("foo", "bar")).apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/OperationsListSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/OperationsListSamples.java index c93d77c1a4e5..528a2f8d802a 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/OperationsListSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/OperationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_operations.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_operations.json */ /** * Sample code: Operations_List. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsDeleteSamples.java index dc62553134aa..c257ffd66de9 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsDeleteSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for PrivateEndpointConnections Delete. */ public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_deleteprivateendpointconnection.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_deleteprivateendpointconnection.json */ /** * Sample code: PrivateEndpointConnection_Delete. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsGetSamples.java index 92f0726359de..2e707f04544e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsGetSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for PrivateEndpointConnections Get. */ public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getprivateendpointconnection.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivateendpointconnection.json */ /** * Sample code: PrivateEndpointConnection_Get. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsListSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsListSamples.java index 9d8e94e9e8a2..a90db9389724 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsListSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsListSamples.java @@ -7,7 +7,7 @@ /** Samples for PrivateEndpointConnections List. */ public final class PrivateEndpointConnectionsListSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listprivateendpointconnections.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivateendpointconnections.json */ /** * Sample code: PrivateEndpointConnections_List. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsUpdateSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsUpdateSamples.java index 3602c49e0651..5b615ecb4c7c 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsUpdateSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsUpdateSamples.java @@ -12,7 +12,7 @@ /** Samples for PrivateEndpointConnections Update. */ public final class PrivateEndpointConnectionsUpdateSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_updateprivateendpointconnection.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_updateprivateendpointconnection.json */ /** * Sample code: PrivateEndpointConnection_Update. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationGetSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationGetSamples.java index 91b76b03ae03..7fc71efc94e7 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationGetSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationGetSamples.java @@ -7,7 +7,7 @@ /** Samples for PrivateLinkResourcesOperation Get. */ public final class PrivateLinkResourcesOperationGetSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_getprivatelinkresources.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_getprivatelinkresources.json */ /** * Sample code: PrivateLinkResources_List. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationListSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationListSamples.java index c29dca7b0181..f5cad36f6b22 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationListSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationListSamples.java @@ -7,7 +7,7 @@ /** Samples for PrivateLinkResourcesOperation List. */ public final class PrivateLinkResourcesOperationListSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_listprivatelinkresources.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_listprivatelinkresources.json */ /** * Sample code: PrivateLinkResources_List. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/ResourceProviderCommonGetSubscriptionQuotaSamples.java b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/ResourceProviderCommonGetSubscriptionQuotaSamples.java index 4c164be4dd8f..f755d34e9942 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/ResourceProviderCommonGetSubscriptionQuotaSamples.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/samples/java/com/azure/resourcemanager/iothub/generated/ResourceProviderCommonGetSubscriptionQuotaSamples.java @@ -7,7 +7,7 @@ /** Samples for ResourceProviderCommon GetSubscriptionQuota. */ public final class ResourceProviderCommonGetSubscriptionQuotaSamples { /* - * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/preview/2022-11-15-preview/examples/iothub_usages.json + * x-ms-original-file: specification/iothub/resource-manager/Microsoft.Devices/stable/2023-06-30/examples/iothub_usages.json */ /** * Sample code: ResourceProviderCommon_GetSubscriptionQuota. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ArmIdentityTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ArmIdentityTests.java index 03bcc450e730..19a0ec341255 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ArmIdentityTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ArmIdentityTests.java @@ -18,8 +18,8 @@ public void testDeserialize() throws Exception { ArmIdentity model = BinaryData .fromString( - "{\"principalId\":\"ec\",\"tenantId\":\"odebfqkkrbmpu\",\"type\":\"SystemAssigned," - + " UserAssigned\",\"userAssignedIdentities\":{\"y\":{\"principalId\":\"lzlfbxzpuz\",\"clientId\":\"ispnqzahmgkbrp\"},\"buynhijggm\":{\"principalId\":\"ibnuqqkpik\",\"clientId\":\"rgvtqag\"},\"jrunmpxtt\":{\"principalId\":\"fsiarbutr\",\"clientId\":\"pnazzm\"},\"qidybyx\":{\"principalId\":\"hrbnlankxmyskpbh\",\"clientId\":\"btkcxywnytnrsyn\"}}}") + "{\"principalId\":\"glcuhxwtctyqi\",\"tenantId\":\"bbovplwzbhvgyugu\",\"type\":\"SystemAssigned," + + " UserAssigned\",\"userAssignedIdentities\":{\"nkjzkdeslpvlop\":{\"principalId\":\"ss\",\"clientId\":\"ukkfplgmgs\"},\"iuebbaumny\":{\"principalId\":\"yighxpk\",\"clientId\":\"zb\"},\"bckhsmtxpsi\":{\"principalId\":\"ped\",\"clientId\":\"jn\"}}}") .toObject(ArmIdentity.class); Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); } @@ -31,18 +31,17 @@ public void testSerialize() throws Exception { .withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) .withUserAssignedIdentities( mapOf( - "y", + "nkjzkdeslpvlop", new ArmUserIdentity(), - "buynhijggm", + "iuebbaumny", new ArmUserIdentity(), - "jrunmpxtt", - new ArmUserIdentity(), - "qidybyx", + "bckhsmtxpsi", new ArmUserIdentity())); model = BinaryData.fromObject(model).toObject(ArmIdentity.class); Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ArmUserIdentityTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ArmUserIdentityTests.java index 61113032d11e..0cb737155f52 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ArmUserIdentityTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ArmUserIdentityTests.java @@ -12,7 +12,7 @@ public final class ArmUserIdentityTests { public void testDeserialize() throws Exception { ArmUserIdentity model = BinaryData - .fromString("{\"principalId\":\"fclhaaxdbabphlwr\",\"clientId\":\"fkts\"}") + .fromString("{\"principalId\":\"tfhvpesapskrdqmh\",\"clientId\":\"dhtldwkyz\"}") .toObject(ArmUserIdentity.class); } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateDescriptionInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateDescriptionInnerTests.java index 0365d2c4987c..132ad34b26ce 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateDescriptionInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateDescriptionInnerTests.java @@ -15,22 +15,22 @@ public void testDeserialize() throws Exception { CertificateDescriptionInner model = BinaryData .fromString( - "{\"properties\":{\"subject\":\"mond\",\"expiry\":\"Thu, 01 Apr 2021 23:21:50" - + " GMT\",\"thumbprint\":\"xvy\",\"isVerified\":false,\"created\":\"Fri, 01 Oct 2021 02:55:48" - + " GMT\",\"updated\":\"Mon, 25 Jan 2021 05:21:40" - + " GMT\",\"certificate\":\"whojvp\"},\"etag\":\"qgxy\",\"id\":\"mocmbqfqvmk\",\"name\":\"xozap\",\"type\":\"helxprglya\"}") + "{\"properties\":{\"subject\":\"yzrpzbchckqqzq\",\"expiry\":\"Wed, 10 Nov 2021 00:02:28" + + " GMT\",\"thumbprint\":\"ysuiizynkedya\",\"isVerified\":true,\"created\":\"Fri, 29 Oct 2021" + + " 12:30:56 GMT\",\"updated\":\"Fri, 21 May 2021 15:42:34" + + " GMT\",\"certificate\":\"bzyh\"},\"etag\":\"tsmypyynpcdp\",\"id\":\"mnzgmwznmabi\",\"name\":\"nsorgjhxbldt\",\"type\":\"wwrlkdmtncv\"}") .toObject(CertificateDescriptionInner.class); - Assertions.assertEquals(false, model.properties().isVerified()); - Assertions.assertEquals("whojvp", model.properties().certificate()); + Assertions.assertEquals(true, model.properties().isVerified()); + Assertions.assertEquals("bzyh", model.properties().certificate()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CertificateDescriptionInner model = new CertificateDescriptionInner() - .withProperties(new CertificateProperties().withIsVerified(false).withCertificate("whojvp")); + .withProperties(new CertificateProperties().withIsVerified(true).withCertificate("bzyh")); model = BinaryData.fromObject(model).toObject(CertificateDescriptionInner.class); - Assertions.assertEquals(false, model.properties().isVerified()); - Assertions.assertEquals("whojvp", model.properties().certificate()); + Assertions.assertEquals(true, model.properties().isVerified()); + Assertions.assertEquals("bzyh", model.properties().certificate()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateListDescriptionInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateListDescriptionInnerTests.java index 68f25228db7d..0986f62326e9 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateListDescriptionInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateListDescriptionInnerTests.java @@ -17,13 +17,19 @@ public void testDeserialize() throws Exception { CertificateListDescriptionInner model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"subject\":\"uoegrpkhjwniyqs\",\"expiry\":\"Mon, 01 Mar 2021" - + " 06:19:30 GMT\",\"thumbprint\":\"pdggkzzlvm\",\"isVerified\":true,\"created\":\"Fri, 04 Jun" - + " 2021 21:38:56 GMT\",\"updated\":\"Wed, 28 Apr 2021 10:55:20" - + " GMT\",\"certificate\":\"fv\"},\"etag\":\"fy\",\"id\":\"sbpfvmwyhr\",\"name\":\"ouyftaakc\",\"type\":\"wiyzvqtmnubexkp\"}]}") + "{\"value\":[{\"properties\":{\"subject\":\"enwash\",\"expiry\":\"Sun, 17 Jan 2021 09:32:25" + + " GMT\",\"thumbprint\":\"kcnqxwbpo\",\"isVerified\":false,\"created\":\"Wed, 21 Jul 2021" + + " 21:11:01 GMT\",\"updated\":\"Thu, 28 Jan 2021 11:31:00" + + " GMT\",\"certificate\":\"aasipqi\"},\"etag\":\"byuqerpqlp\",\"id\":\"wcciuqgbdbu\",\"name\":\"auvfbtkuwhhmhyk\",\"type\":\"joxafnndlpi\"},{\"properties\":{\"subject\":\"o\",\"expiry\":\"Fri," + + " 02 Jul 2021 22:41:48 GMT\",\"thumbprint\":\"dyh\",\"isVerified\":true,\"created\":\"Fri, 02" + + " Apr 2021 15:09:08 GMT\",\"updated\":\"Thu, 14 Oct 2021 00:10:28" + + " GMT\",\"certificate\":\"eqnovvqfovl\"},\"etag\":\"ywsuwsy\",\"id\":\"s\",\"name\":\"dsytgadgvr\",\"type\":\"ea\"},{\"properties\":{\"subject\":\"qnzarrwl\",\"expiry\":\"Fri," + + " 03 Sep 2021 09:11:52 GMT\",\"thumbprint\":\"jfqka\",\"isVerified\":false,\"created\":\"Sun," + + " 07 Mar 2021 01:40:14 GMT\",\"updated\":\"Thu, 22 Apr 2021 11:22:29" + + " GMT\",\"certificate\":\"ubjibww\"},\"etag\":\"tohqkvpuvksgp\",\"id\":\"saknynfsyn\",\"name\":\"jphuopxodlqi\",\"type\":\"ntorzihleosjswsr\"}]}") .toObject(CertificateListDescriptionInner.class); - Assertions.assertEquals(true, model.value().get(0).properties().isVerified()); - Assertions.assertEquals("fv", model.value().get(0).properties().certificate()); + Assertions.assertEquals(false, model.value().get(0).properties().isVerified()); + Assertions.assertEquals("aasipqi", model.value().get(0).properties().certificate()); } @org.junit.jupiter.api.Test @@ -35,9 +41,15 @@ public void testSerialize() throws Exception { .asList( new CertificateDescriptionInner() .withProperties( - new CertificateProperties().withIsVerified(true).withCertificate("fv")))); + new CertificateProperties().withIsVerified(false).withCertificate("aasipqi")), + new CertificateDescriptionInner() + .withProperties( + new CertificateProperties().withIsVerified(true).withCertificate("eqnovvqfovl")), + new CertificateDescriptionInner() + .withProperties( + new CertificateProperties().withIsVerified(false).withCertificate("ubjibww")))); model = BinaryData.fromObject(model).toObject(CertificateListDescriptionInner.class); - Assertions.assertEquals(true, model.value().get(0).properties().isVerified()); - Assertions.assertEquals("fv", model.value().get(0).properties().certificate()); + Assertions.assertEquals(false, model.value().get(0).properties().isVerified()); + Assertions.assertEquals("aasipqi", model.value().get(0).properties().certificate()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatePropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatePropertiesTests.java index 7a6a118d66a2..eeac8978ca76 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatePropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatePropertiesTests.java @@ -14,21 +14,19 @@ public void testDeserialize() throws Exception { CertificateProperties model = BinaryData .fromString( - "{\"subject\":\"dckcbc\",\"expiry\":\"Thu, 29 Jul 2021 04:12:00" - + " GMT\",\"thumbprint\":\"jxgciqibrh\",\"isVerified\":true,\"created\":\"Tue, 01 Jun 2021" - + " 12:21:20 GMT\",\"updated\":\"Thu, 04 Feb 2021 15:03:28" - + " GMT\",\"certificate\":\"zoymibmrqyibahw\"}") + "{\"subject\":\"otllxdyhgsyo\",\"expiry\":\"Fri, 30 Apr 2021 11:16:28" + + " GMT\",\"thumbprint\":\"ltdtbnnhad\",\"isVerified\":true,\"created\":\"Sun, 16 May 2021" + + " 20:34:23 GMT\",\"updated\":\"Wed, 23 Dec 2020 13:08:39 GMT\",\"certificate\":\"khnvpam\"}") .toObject(CertificateProperties.class); Assertions.assertEquals(true, model.isVerified()); - Assertions.assertEquals("zoymibmrqyibahw", model.certificate()); + Assertions.assertEquals("khnvpam", model.certificate()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - CertificateProperties model = - new CertificateProperties().withIsVerified(true).withCertificate("zoymibmrqyibahw"); + CertificateProperties model = new CertificateProperties().withIsVerified(true).withCertificate("khnvpam"); model = BinaryData.fromObject(model).toObject(CertificateProperties.class); Assertions.assertEquals(true, model.isVerified()); - Assertions.assertEquals("zoymibmrqyibahw", model.certificate()); + Assertions.assertEquals("khnvpam", model.certificate()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateVerificationDescriptionTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateVerificationDescriptionTests.java index 9cc236144213..f9a38ec162c2 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateVerificationDescriptionTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificateVerificationDescriptionTests.java @@ -12,14 +12,14 @@ public final class CertificateVerificationDescriptionTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { CertificateVerificationDescription model = - BinaryData.fromString("{\"certificate\":\"pqlpq\"}").toObject(CertificateVerificationDescription.class); - Assertions.assertEquals("pqlpq", model.certificate()); + BinaryData.fromString("{\"certificate\":\"chea\"}").toObject(CertificateVerificationDescription.class); + Assertions.assertEquals("chea", model.certificate()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - CertificateVerificationDescription model = new CertificateVerificationDescription().withCertificate("pqlpq"); + CertificateVerificationDescription model = new CertificateVerificationDescription().withCertificate("chea"); model = BinaryData.fromObject(model).toObject(CertificateVerificationDescription.class); - Assertions.assertEquals("pqlpq", model.certificate()); + Assertions.assertEquals("chea", model.certificate()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesCreateOrUpdateWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesCreateOrUpdateWithResponseMockTests.java index fd1ac1ed46d5..1da992cd1df8 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesCreateOrUpdateWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesCreateOrUpdateWithResponseMockTests.java @@ -32,10 +32,10 @@ public void testCreateOrUpdateWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"subject\":\"rpdsof\",\"expiry\":\"Mon, 03 May 2021 16:15:22" - + " GMT\",\"thumbprint\":\"nsvbuswdv\",\"isVerified\":true,\"created\":\"Mon, 22 Feb 2021 05:56:13" - + " GMT\",\"updated\":\"Tue, 06 Apr 2021 20:50:40" - + " GMT\",\"certificate\":\"nvjsrtkfa\"},\"etag\":\"opqgikyzirtxdyux\",\"id\":\"ejnt\",\"name\":\"sewgioilqukr\",\"type\":\"dxtqmieoxo\"}"; + "{\"properties\":{\"subject\":\"sjnhn\",\"expiry\":\"Thu, 15 Apr 2021 22:34:41" + + " GMT\",\"thumbprint\":\"fq\",\"isVerified\":true,\"created\":\"Mon, 01 Mar 2021 20:41:09" + + " GMT\",\"updated\":\"Sat, 17 Jul 2021 07:30:37" + + " GMT\",\"certificate\":\"blwpcesutrgj\"},\"etag\":\"auutpwoqhihe\",\"id\":\"qg\",\"name\":\"zpnfqntcypsxj\",\"type\":\"foimwkslircizjxv\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -66,13 +66,13 @@ public void testCreateOrUpdateWithResponse() throws Exception { CertificateDescription response = manager .certificates() - .define("mqnrojlpijnkr") - .withExistingIotHub("knpirgnepttwq", "sniffc") - .withProperties(new CertificateProperties().withIsVerified(false).withCertificate("f")) - .withIfMatch("jbdhqxvc") + .define("bgye") + .withExistingIotHub("ujviylwdshfs", "n") + .withProperties(new CertificateProperties().withIsVerified(true).withCertificate("oxoftpipiwycz")) + .withIfMatch("euzvx") .create(); Assertions.assertEquals(true, response.properties().isVerified()); - Assertions.assertEquals("nvjsrtkfa", response.properties().certificate()); + Assertions.assertEquals("blwpcesutrgj", response.properties().certificate()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesDeleteWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesDeleteWithResponseMockTests.java index 06719c642438..47db16d3542e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesDeleteWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesDeleteWithResponseMockTests.java @@ -56,8 +56,6 @@ public void testDeleteWithResponse() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager - .certificates() - .deleteWithResponse("azpxdtnkdmkqjjl", "uenvrkp", "ou", "ibreb", com.azure.core.util.Context.NONE); + manager.certificates().deleteWithResponse("zq", "zh", "tw", "sgogczhonnxk", com.azure.core.util.Context.NONE); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesGetWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesGetWithResponseMockTests.java index 23ea834c27a5..cf8c00f68751 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesGetWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesGetWithResponseMockTests.java @@ -31,10 +31,10 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"subject\":\"lmv\",\"expiry\":\"Sun, 26 Sep 2021 11:18:34" - + " GMT\",\"thumbprint\":\"ktgplcr\",\"isVerified\":true,\"created\":\"Fri, 19 Nov 2021 13:53:17" - + " GMT\",\"updated\":\"Fri, 05 Mar 2021 15:11:27" - + " GMT\",\"certificate\":\"igbrnjw\"},\"etag\":\"kpnb\",\"id\":\"azej\",\"name\":\"oqkag\",\"type\":\"hsxttaugzxnf\"}"; + "{\"properties\":{\"subject\":\"einqf\",\"expiry\":\"Mon, 10 May 2021 20:16:44" + + " GMT\",\"thumbprint\":\"qknp\",\"isVerified\":true,\"created\":\"Sun, 25 Apr 2021 01:28:07" + + " GMT\",\"updated\":\"Fri, 15 Oct 2021 22:08:17" + + " GMT\",\"certificate\":\"wqmsniffcdmqn\"},\"etag\":\"jlpijnkrx\",\"id\":\"rddh\",\"name\":\"ratiz\",\"type\":\"ronasxift\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -65,10 +65,10 @@ public void testGetWithResponse() throws Exception { CertificateDescription response = manager .certificates() - .getWithResponse("waekrrjreafxtsgu", "hjglikk", "wslolbqp", com.azure.core.util.Context.NONE) + .getWithResponse("uu", "fdlwg", "ytsbwtovv", com.azure.core.util.Context.NONE) .getValue(); Assertions.assertEquals(true, response.properties().isVerified()); - Assertions.assertEquals("igbrnjw", response.properties().certificate()); + Assertions.assertEquals("wqmsniffcdmqn", response.properties().certificate()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesListByIotHubWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesListByIotHubWithResponseMockTests.java index f29712dd56cd..843b75e3d238 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesListByIotHubWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesListByIotHubWithResponseMockTests.java @@ -16,6 +16,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -30,7 +31,10 @@ public void testListByIotHubWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"etag\":\"l\",\"id\":\"dn\",\"name\":\"itvgbmhrixkwm\",\"type\":\"ijejvegrhbpn\"},{\"etag\":\"exccbdreaxhcexd\",\"id\":\"rvqahqkghtpwi\",\"name\":\"nhyjsv\",\"type\":\"ycxzbfvoo\"},{\"etag\":\"vmtgjqppy\",\"id\":\"s\",\"name\":\"ronzmyhgfip\",\"type\":\"sxkm\"}]}"; + "{\"value\":[{\"properties\":{\"subject\":\"coolsttpkiwkkb\",\"expiry\":\"Mon, 31 May 2021 01:02:38" + + " GMT\",\"thumbprint\":\"ywvtylbfpnc\",\"isVerified\":false,\"created\":\"Sat, 16 Oct 2021 01:33:12" + + " GMT\",\"updated\":\"Sat, 03 Apr 2021 12:46:32" + + " GMT\",\"certificate\":\"thtywub\"},\"etag\":\"bihwqknfdnt\",\"id\":\"jchrdgoihxumw\",\"name\":\"ton\",\"type\":\"zj\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -59,6 +63,12 @@ public void testListByIotHubWithResponse() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); CertificateListDescription response = - manager.certificates().listByIotHubWithResponse("xuvw", "fbn", com.azure.core.util.Context.NONE).getValue(); + manager + .certificates() + .listByIotHubWithResponse("totxhojujb", "pelmcuvhixbjxyf", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(false, response.value().get(0).properties().isVerified()); + Assertions.assertEquals("thtywub", response.value().get(0).properties().certificate()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesVerifyWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesVerifyWithResponseMockTests.java index 813bfa9725f9..416bbb7645a5 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesVerifyWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CertificatesVerifyWithResponseMockTests.java @@ -32,10 +32,10 @@ public void testVerifyWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"subject\":\"iithtywu\",\"expiry\":\"Sat, 06 Mar 2021 07:21:05" - + " GMT\",\"thumbprint\":\"ihwqknfdntwjchr\",\"isVerified\":true,\"created\":\"Tue, 05 Oct 2021" - + " 08:32:44 GMT\",\"updated\":\"Fri, 19 Mar 2021 07:37:05" - + " GMT\",\"certificate\":\"wct\"},\"etag\":\"dzjlu\",\"id\":\"dfdlwggyts\",\"name\":\"wtovvtgsein\",\"type\":\"fiufx\"}"; + "{\"properties\":{\"subject\":\"gufhyaomtbg\",\"expiry\":\"Sat, 24 Apr 2021 04:26:41" + + " GMT\",\"thumbprint\":\"grvk\",\"isVerified\":true,\"created\":\"Wed, 20 Jan 2021 03:53:05" + + " GMT\",\"updated\":\"Tue, 28 Sep 2021 04:32:09" + + " GMT\",\"certificate\":\"jbibg\"},\"etag\":\"fxumv\",\"id\":\"cluyovwxnbkf\",\"name\":\"zzxscyhwzdgiruj\",\"type\":\"zbomvzzbtdcqvpni\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -67,15 +67,15 @@ public void testVerifyWithResponse() throws Exception { manager .certificates() .verifyWithResponse( - "hfstotxhojujbyp", - "lmcuvhixb", - "xyfwnylrcool", - "ttpkiwkkbnujrywv", - new CertificateVerificationDescription().withCertificate("lbfpncurd"), + "nopqgikyzirtx", + "yuxzejntpsewgi", + "ilqu", + "rydxtqm", + new CertificateVerificationDescription().withCertificate("ox"), com.azure.core.util.Context.NONE) .getValue(); Assertions.assertEquals(true, response.properties().isVerified()); - Assertions.assertEquals("wct", response.properties().certificate()); + Assertions.assertEquals("jbibg", response.properties().certificate()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CloudToDevicePropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CloudToDevicePropertiesTests.java index 4e65ca2aa4e7..0b2b8cce2d71 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CloudToDevicePropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/CloudToDevicePropertiesTests.java @@ -16,31 +16,31 @@ public void testDeserialize() throws Exception { CloudToDeviceProperties model = BinaryData .fromString( - "{\"maxDeliveryCount\":1121109847,\"defaultTtlAsIso8601\":\"PT84H30M6S\",\"feedback\":{\"lockDurationAsIso8601\":\"PT9H8M5S\",\"ttlAsIso8601\":\"PT205H49M51S\",\"maxDeliveryCount\":1139583555}}") + "{\"maxDeliveryCount\":122451420,\"defaultTtlAsIso8601\":\"PT222H46M37S\",\"feedback\":{\"lockDurationAsIso8601\":\"PT201H34M46S\",\"ttlAsIso8601\":\"PT182H51M49S\",\"maxDeliveryCount\":413176852}}") .toObject(CloudToDeviceProperties.class); - Assertions.assertEquals(1121109847, model.maxDeliveryCount()); - Assertions.assertEquals(Duration.parse("PT84H30M6S"), model.defaultTtlAsIso8601()); - Assertions.assertEquals(Duration.parse("PT9H8M5S"), model.feedback().lockDurationAsIso8601()); - Assertions.assertEquals(Duration.parse("PT205H49M51S"), model.feedback().ttlAsIso8601()); - Assertions.assertEquals(1139583555, model.feedback().maxDeliveryCount()); + Assertions.assertEquals(122451420, model.maxDeliveryCount()); + Assertions.assertEquals(Duration.parse("PT222H46M37S"), model.defaultTtlAsIso8601()); + Assertions.assertEquals(Duration.parse("PT201H34M46S"), model.feedback().lockDurationAsIso8601()); + Assertions.assertEquals(Duration.parse("PT182H51M49S"), model.feedback().ttlAsIso8601()); + Assertions.assertEquals(413176852, model.feedback().maxDeliveryCount()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CloudToDeviceProperties model = new CloudToDeviceProperties() - .withMaxDeliveryCount(1121109847) - .withDefaultTtlAsIso8601(Duration.parse("PT84H30M6S")) + .withMaxDeliveryCount(122451420) + .withDefaultTtlAsIso8601(Duration.parse("PT222H46M37S")) .withFeedback( new FeedbackProperties() - .withLockDurationAsIso8601(Duration.parse("PT9H8M5S")) - .withTtlAsIso8601(Duration.parse("PT205H49M51S")) - .withMaxDeliveryCount(1139583555)); + .withLockDurationAsIso8601(Duration.parse("PT201H34M46S")) + .withTtlAsIso8601(Duration.parse("PT182H51M49S")) + .withMaxDeliveryCount(413176852)); model = BinaryData.fromObject(model).toObject(CloudToDeviceProperties.class); - Assertions.assertEquals(1121109847, model.maxDeliveryCount()); - Assertions.assertEquals(Duration.parse("PT84H30M6S"), model.defaultTtlAsIso8601()); - Assertions.assertEquals(Duration.parse("PT9H8M5S"), model.feedback().lockDurationAsIso8601()); - Assertions.assertEquals(Duration.parse("PT205H49M51S"), model.feedback().ttlAsIso8601()); - Assertions.assertEquals(1139583555, model.feedback().maxDeliveryCount()); + Assertions.assertEquals(122451420, model.maxDeliveryCount()); + Assertions.assertEquals(Duration.parse("PT222H46M37S"), model.defaultTtlAsIso8601()); + Assertions.assertEquals(Duration.parse("PT201H34M46S"), model.feedback().lockDurationAsIso8601()); + Assertions.assertEquals(Duration.parse("PT182H51M49S"), model.feedback().ttlAsIso8601()); + Assertions.assertEquals(413176852, model.feedback().maxDeliveryCount()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EndpointHealthDataInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EndpointHealthDataInnerTests.java index 9998aeb0495c..d477f02afda0 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EndpointHealthDataInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EndpointHealthDataInnerTests.java @@ -16,34 +16,34 @@ public void testDeserialize() throws Exception { EndpointHealthDataInner model = BinaryData .fromString( - "{\"endpointId\":\"p\",\"healthStatus\":\"unknown\",\"lastKnownError\":\"ofd\",\"lastKnownErrorTime\":\"Sun," - + " 25 Apr 2021 06:48:17 GMT\",\"lastSuccessfulSendAttemptTime\":\"Tue, 15 Jun 2021 07:35:54" - + " GMT\",\"lastSendAttemptTime\":\"Fri, 22 Jan 2021 23:23:23 GMT\"}") + "{\"endpointId\":\"xknalaulppg\",\"healthStatus\":\"dead\",\"lastKnownError\":\"napnyiropuhpigv\",\"lastKnownErrorTime\":\"Tue," + + " 18 May 2021 16:57:02 GMT\",\"lastSuccessfulSendAttemptTime\":\"Sun, 13 Jun 2021 20:05:29" + + " GMT\",\"lastSendAttemptTime\":\"Wed, 08 Sep 2021 14:57:52 GMT\"}") .toObject(EndpointHealthDataInner.class); - Assertions.assertEquals("p", model.endpointId()); - Assertions.assertEquals(EndpointHealthStatus.UNKNOWN, model.healthStatus()); - Assertions.assertEquals("ofd", model.lastKnownError()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-25T06:48:17Z"), model.lastKnownErrorTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-15T07:35:54Z"), model.lastSuccessfulSendAttemptTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-22T23:23:23Z"), model.lastSendAttemptTime()); + Assertions.assertEquals("xknalaulppg", model.endpointId()); + Assertions.assertEquals(EndpointHealthStatus.DEAD, model.healthStatus()); + Assertions.assertEquals("napnyiropuhpigv", model.lastKnownError()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-18T16:57:02Z"), model.lastKnownErrorTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-13T20:05:29Z"), model.lastSuccessfulSendAttemptTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-08T14:57:52Z"), model.lastSendAttemptTime()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { EndpointHealthDataInner model = new EndpointHealthDataInner() - .withEndpointId("p") - .withHealthStatus(EndpointHealthStatus.UNKNOWN) - .withLastKnownError("ofd") - .withLastKnownErrorTime(OffsetDateTime.parse("2021-04-25T06:48:17Z")) - .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-06-15T07:35:54Z")) - .withLastSendAttemptTime(OffsetDateTime.parse("2021-01-22T23:23:23Z")); + .withEndpointId("xknalaulppg") + .withHealthStatus(EndpointHealthStatus.DEAD) + .withLastKnownError("napnyiropuhpigv") + .withLastKnownErrorTime(OffsetDateTime.parse("2021-05-18T16:57:02Z")) + .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-06-13T20:05:29Z")) + .withLastSendAttemptTime(OffsetDateTime.parse("2021-09-08T14:57:52Z")); model = BinaryData.fromObject(model).toObject(EndpointHealthDataInner.class); - Assertions.assertEquals("p", model.endpointId()); - Assertions.assertEquals(EndpointHealthStatus.UNKNOWN, model.healthStatus()); - Assertions.assertEquals("ofd", model.lastKnownError()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-25T06:48:17Z"), model.lastKnownErrorTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-15T07:35:54Z"), model.lastSuccessfulSendAttemptTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-22T23:23:23Z"), model.lastSendAttemptTime()); + Assertions.assertEquals("xknalaulppg", model.endpointId()); + Assertions.assertEquals(EndpointHealthStatus.DEAD, model.healthStatus()); + Assertions.assertEquals("napnyiropuhpigv", model.lastKnownError()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-18T16:57:02Z"), model.lastKnownErrorTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-13T20:05:29Z"), model.lastSuccessfulSendAttemptTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-08T14:57:52Z"), model.lastSendAttemptTime()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EndpointHealthDataListResultTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EndpointHealthDataListResultTests.java index 49f43091d4ea..19f7a7b4ffc9 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EndpointHealthDataListResultTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EndpointHealthDataListResultTests.java @@ -18,29 +18,30 @@ public void testDeserialize() throws Exception { EndpointHealthDataListResult model = BinaryData .fromString( - "{\"value\":[{\"endpointId\":\"zvahapjy\",\"healthStatus\":\"dead\",\"lastKnownError\":\"gqzcjr\",\"lastKnownErrorTime\":\"Sat," - + " 03 Apr 2021 19:52:37 GMT\",\"lastSuccessfulSendAttemptTime\":\"Sat, 05 Jun 2021 18:59:27" - + " GMT\",\"lastSendAttemptTime\":\"Sat, 04 Sep 2021 18:51:43" - + " GMT\"},{\"endpointId\":\"lxkvu\",\"healthStatus\":\"degraded\",\"lastKnownError\":\"ovawjvzunlu\",\"lastKnownErrorTime\":\"Thu," - + " 05 Aug 2021 22:08:57 GMT\",\"lastSuccessfulSendAttemptTime\":\"Thu, 21 Jan 2021 11:08:17" - + " GMT\",\"lastSendAttemptTime\":\"Thu, 11 Mar 2021 05:06:45" - + " GMT\"},{\"endpointId\":\"i\",\"healthStatus\":\"healthy\",\"lastKnownError\":\"pjzu\",\"lastKnownErrorTime\":\"Tue," - + " 12 Oct 2021 12:24:32 GMT\",\"lastSuccessfulSendAttemptTime\":\"Mon, 21 Jun 2021 03:54:01" - + " GMT\",\"lastSendAttemptTime\":\"Wed, 03 Nov 2021 21:00:46" - + " GMT\"},{\"endpointId\":\"skzbb\",\"healthStatus\":\"dead\",\"lastKnownError\":\"mv\",\"lastKnownErrorTime\":\"Wed," - + " 24 Feb 2021 15:47:12 GMT\",\"lastSuccessfulSendAttemptTime\":\"Mon, 22 Mar 2021 15:40:44" - + " GMT\",\"lastSendAttemptTime\":\"Thu, 01 Jul 2021 08:04:50 GMT\"}],\"nextLink\":\"uh\"}") + "{\"value\":[{\"endpointId\":\"ovawjvzunlu\",\"healthStatus\":\"degraded\",\"lastKnownError\":\"prnxipeil\",\"lastKnownErrorTime\":\"Mon," + + " 12 Jul 2021 01:35:59 GMT\",\"lastSuccessfulSendAttemptTime\":\"Fri, 04 Jun 2021 13:01:56" + + " GMT\",\"lastSendAttemptTime\":\"Tue, 12 Oct 2021 12:24:32" + + " GMT\"},{\"endpointId\":\"dultskz\",\"healthStatus\":\"unhealthy\",\"lastKnownError\":\"zumveekgpwo\",\"lastKnownErrorTime\":\"Sat," + + " 16 Jan 2021 14:31:18 GMT\",\"lastSuccessfulSendAttemptTime\":\"Sun, 10 Oct 2021 22:25:32" + + " GMT\",\"lastSendAttemptTime\":\"Sat, 16 Oct 2021 05:20:45" + + " GMT\"},{\"endpointId\":\"jyofdxluusdtto\",\"healthStatus\":\"unknown\",\"lastKnownError\":\"oekqvk\",\"lastKnownErrorTime\":\"Fri," + + " 20 Aug 2021 19:20:25 GMT\",\"lastSuccessfulSendAttemptTime\":\"Mon, 11 Oct 2021 10:00:24" + + " GMT\",\"lastSendAttemptTime\":\"Tue, 29 Jun 2021 22:28:15" + + " GMT\"},{\"endpointId\":\"wyjsflhhcaalnjix\",\"healthStatus\":\"unknown\",\"lastKnownError\":\"awjoyaqcslyjp\",\"lastKnownErrorTime\":\"Tue," + + " 12 Jan 2021 19:26:56 GMT\",\"lastSuccessfulSendAttemptTime\":\"Wed, 28 Jul 2021 19:21:39" + + " GMT\",\"lastSendAttemptTime\":\"Tue, 31 Aug 2021 19:18:26" + + " GMT\"}],\"nextLink\":\"znelixhnrztfolh\"}") .toObject(EndpointHealthDataListResult.class); - Assertions.assertEquals("zvahapjy", model.value().get(0).endpointId()); - Assertions.assertEquals(EndpointHealthStatus.DEAD, model.value().get(0).healthStatus()); - Assertions.assertEquals("gqzcjr", model.value().get(0).lastKnownError()); + Assertions.assertEquals("ovawjvzunlu", model.value().get(0).endpointId()); + Assertions.assertEquals(EndpointHealthStatus.DEGRADED, model.value().get(0).healthStatus()); + Assertions.assertEquals("prnxipeil", model.value().get(0).lastKnownError()); Assertions - .assertEquals(OffsetDateTime.parse("2021-04-03T19:52:37Z"), model.value().get(0).lastKnownErrorTime()); + .assertEquals(OffsetDateTime.parse("2021-07-12T01:35:59Z"), model.value().get(0).lastKnownErrorTime()); Assertions .assertEquals( - OffsetDateTime.parse("2021-06-05T18:59:27Z"), model.value().get(0).lastSuccessfulSendAttemptTime()); + OffsetDateTime.parse("2021-06-04T13:01:56Z"), model.value().get(0).lastSuccessfulSendAttemptTime()); Assertions - .assertEquals(OffsetDateTime.parse("2021-09-04T18:51:43Z"), model.value().get(0).lastSendAttemptTime()); + .assertEquals(OffsetDateTime.parse("2021-10-12T12:24:32Z"), model.value().get(0).lastSendAttemptTime()); } @org.junit.jupiter.api.Test @@ -51,43 +52,43 @@ public void testSerialize() throws Exception { Arrays .asList( new EndpointHealthDataInner() - .withEndpointId("zvahapjy") - .withHealthStatus(EndpointHealthStatus.DEAD) - .withLastKnownError("gqzcjr") - .withLastKnownErrorTime(OffsetDateTime.parse("2021-04-03T19:52:37Z")) - .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-06-05T18:59:27Z")) - .withLastSendAttemptTime(OffsetDateTime.parse("2021-09-04T18:51:43Z")), - new EndpointHealthDataInner() - .withEndpointId("lxkvu") + .withEndpointId("ovawjvzunlu") .withHealthStatus(EndpointHealthStatus.DEGRADED) - .withLastKnownError("ovawjvzunlu") - .withLastKnownErrorTime(OffsetDateTime.parse("2021-08-05T22:08:57Z")) - .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-01-21T11:08:17Z")) - .withLastSendAttemptTime(OffsetDateTime.parse("2021-03-11T05:06:45Z")), + .withLastKnownError("prnxipeil") + .withLastKnownErrorTime(OffsetDateTime.parse("2021-07-12T01:35:59Z")) + .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-06-04T13:01:56Z")) + .withLastSendAttemptTime(OffsetDateTime.parse("2021-10-12T12:24:32Z")), + new EndpointHealthDataInner() + .withEndpointId("dultskz") + .withHealthStatus(EndpointHealthStatus.UNHEALTHY) + .withLastKnownError("zumveekgpwo") + .withLastKnownErrorTime(OffsetDateTime.parse("2021-01-16T14:31:18Z")) + .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-10-10T22:25:32Z")) + .withLastSendAttemptTime(OffsetDateTime.parse("2021-10-16T05:20:45Z")), new EndpointHealthDataInner() - .withEndpointId("i") - .withHealthStatus(EndpointHealthStatus.HEALTHY) - .withLastKnownError("pjzu") - .withLastKnownErrorTime(OffsetDateTime.parse("2021-10-12T12:24:32Z")) - .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-06-21T03:54:01Z")) - .withLastSendAttemptTime(OffsetDateTime.parse("2021-11-03T21:00:46Z")), + .withEndpointId("jyofdxluusdtto") + .withHealthStatus(EndpointHealthStatus.UNKNOWN) + .withLastKnownError("oekqvk") + .withLastKnownErrorTime(OffsetDateTime.parse("2021-08-20T19:20:25Z")) + .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-10-11T10:00:24Z")) + .withLastSendAttemptTime(OffsetDateTime.parse("2021-06-29T22:28:15Z")), new EndpointHealthDataInner() - .withEndpointId("skzbb") - .withHealthStatus(EndpointHealthStatus.DEAD) - .withLastKnownError("mv") - .withLastKnownErrorTime(OffsetDateTime.parse("2021-02-24T15:47:12Z")) - .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-03-22T15:40:44Z")) - .withLastSendAttemptTime(OffsetDateTime.parse("2021-07-01T08:04:50Z")))); + .withEndpointId("wyjsflhhcaalnjix") + .withHealthStatus(EndpointHealthStatus.UNKNOWN) + .withLastKnownError("awjoyaqcslyjp") + .withLastKnownErrorTime(OffsetDateTime.parse("2021-01-12T19:26:56Z")) + .withLastSuccessfulSendAttemptTime(OffsetDateTime.parse("2021-07-28T19:21:39Z")) + .withLastSendAttemptTime(OffsetDateTime.parse("2021-08-31T19:18:26Z")))); model = BinaryData.fromObject(model).toObject(EndpointHealthDataListResult.class); - Assertions.assertEquals("zvahapjy", model.value().get(0).endpointId()); - Assertions.assertEquals(EndpointHealthStatus.DEAD, model.value().get(0).healthStatus()); - Assertions.assertEquals("gqzcjr", model.value().get(0).lastKnownError()); + Assertions.assertEquals("ovawjvzunlu", model.value().get(0).endpointId()); + Assertions.assertEquals(EndpointHealthStatus.DEGRADED, model.value().get(0).healthStatus()); + Assertions.assertEquals("prnxipeil", model.value().get(0).lastKnownError()); Assertions - .assertEquals(OffsetDateTime.parse("2021-04-03T19:52:37Z"), model.value().get(0).lastKnownErrorTime()); + .assertEquals(OffsetDateTime.parse("2021-07-12T01:35:59Z"), model.value().get(0).lastKnownErrorTime()); Assertions .assertEquals( - OffsetDateTime.parse("2021-06-05T18:59:27Z"), model.value().get(0).lastSuccessfulSendAttemptTime()); + OffsetDateTime.parse("2021-06-04T13:01:56Z"), model.value().get(0).lastSuccessfulSendAttemptTime()); Assertions - .assertEquals(OffsetDateTime.parse("2021-09-04T18:51:43Z"), model.value().get(0).lastSendAttemptTime()); + .assertEquals(OffsetDateTime.parse("2021-10-12T12:24:32Z"), model.value().get(0).lastSendAttemptTime()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupBodyDescriptionTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupBodyDescriptionTests.java index 729d558bbb31..7d16fa0b25e3 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupBodyDescriptionTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupBodyDescriptionTests.java @@ -14,16 +14,17 @@ public final class EventHubConsumerGroupBodyDescriptionTests { public void testDeserialize() throws Exception { EventHubConsumerGroupBodyDescription model = BinaryData - .fromString("{\"properties\":{\"name\":\"it\"}}") + .fromString("{\"properties\":{\"name\":\"jrwjueiotwm\"}}") .toObject(EventHubConsumerGroupBodyDescription.class); - Assertions.assertEquals("it", model.properties().name()); + Assertions.assertEquals("jrwjueiotwm", model.properties().name()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { EventHubConsumerGroupBodyDescription model = - new EventHubConsumerGroupBodyDescription().withProperties(new EventHubConsumerGroupName().withName("it")); + new EventHubConsumerGroupBodyDescription() + .withProperties(new EventHubConsumerGroupName().withName("jrwjueiotwm")); model = BinaryData.fromObject(model).toObject(EventHubConsumerGroupBodyDescription.class); - Assertions.assertEquals("it", model.properties().name()); + Assertions.assertEquals("jrwjueiotwm", model.properties().name()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupInfoInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupInfoInnerTests.java index 96256a33881c..ef17db1aa6e6 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupInfoInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupInfoInnerTests.java @@ -15,17 +15,19 @@ public void testDeserialize() throws Exception { EventHubConsumerGroupInfoInner model = BinaryData .fromString( - "{\"properties\":{\"cjooxdjebwpucwwf\":\"dataxcug\"},\"etag\":\"vbvmeu\",\"id\":\"civyhzceuo\",\"name\":\"gjrwjueiotwmcdyt\",\"type\":\"x\"}") + "{\"properties\":{\"ali\":\"dataisgwbnbbeldawkz\",\"hashsfwxosow\":\"dataurqhaka\"},\"etag\":\"cugicjoox\",\"id\":\"j\",\"name\":\"bwpucwwfvovbv\",\"type\":\"euecivyhzceuoj\"}") .toObject(EventHubConsumerGroupInfoInner.class); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { EventHubConsumerGroupInfoInner model = - new EventHubConsumerGroupInfoInner().withProperties(mapOf("cjooxdjebwpucwwf", "dataxcug")); + new EventHubConsumerGroupInfoInner() + .withProperties(mapOf("ali", "dataisgwbnbbeldawkz", "hashsfwxosow", "dataurqhaka")); model = BinaryData.fromObject(model).toObject(EventHubConsumerGroupInfoInner.class); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupNameTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupNameTests.java index a7fbaf96b95e..f0dc3c14fb80 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupNameTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupNameTests.java @@ -12,14 +12,14 @@ public final class EventHubConsumerGroupNameTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { EventHubConsumerGroupName model = - BinaryData.fromString("{\"name\":\"nrjawgqwg\"}").toObject(EventHubConsumerGroupName.class); - Assertions.assertEquals("nrjawgqwg", model.name()); + BinaryData.fromString("{\"name\":\"dytdxwitx\"}").toObject(EventHubConsumerGroupName.class); + Assertions.assertEquals("dytdxwitx", model.name()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - EventHubConsumerGroupName model = new EventHubConsumerGroupName().withName("nrjawgqwg"); + EventHubConsumerGroupName model = new EventHubConsumerGroupName().withName("dytdxwitx"); model = BinaryData.fromObject(model).toObject(EventHubConsumerGroupName.class); - Assertions.assertEquals("nrjawgqwg", model.name()); + Assertions.assertEquals("dytdxwitx", model.name()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupsListResultTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupsListResultTests.java index b673ae7d3890..7d6e12ecb633 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupsListResultTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/EventHubConsumerGroupsListResultTests.java @@ -17,7 +17,7 @@ public void testDeserialize() throws Exception { EventHubConsumerGroupsListResult model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"aex\":\"datamdua\",\"vxpvgomz\":\"datapvfadmwsrcr\"},\"etag\":\"misgwbnb\",\"id\":\"e\",\"name\":\"dawkzbali\",\"type\":\"urqhaka\"}],\"nextLink\":\"ashsfwxos\"}") + "{\"value\":[{\"properties\":{\"aofmxagkvtme\":\"datalhspkdee\"},\"etag\":\"qkrhahvljua\",\"id\":\"aquhcdhm\",\"name\":\"ualaexqpvfadmw\",\"type\":\"rcrgvx\"}],\"nextLink\":\"gomz\"}") .toObject(EventHubConsumerGroupsListResult.class); } @@ -29,10 +29,11 @@ public void testSerialize() throws Exception { Arrays .asList( new EventHubConsumerGroupInfoInner() - .withProperties(mapOf("aex", "datamdua", "vxpvgomz", "datapvfadmwsrcr")))); + .withProperties(mapOf("aofmxagkvtme", "datalhspkdee")))); model = BinaryData.fromObject(model).toObject(EventHubConsumerGroupsListResult.class); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FailoverInputTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FailoverInputTests.java index d30fdbc939ec..d95223185007 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FailoverInputTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FailoverInputTests.java @@ -12,14 +12,14 @@ public final class FailoverInputTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { FailoverInput model = - BinaryData.fromString("{\"failoverRegion\":\"cciuqgbdbutau\"}").toObject(FailoverInput.class); - Assertions.assertEquals("cciuqgbdbutau", model.failoverRegion()); + BinaryData.fromString("{\"failoverRegion\":\"mfmtdaaygdvw\"}").toObject(FailoverInput.class); + Assertions.assertEquals("mfmtdaaygdvw", model.failoverRegion()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FailoverInput model = new FailoverInput().withFailoverRegion("cciuqgbdbutau"); + FailoverInput model = new FailoverInput().withFailoverRegion("mfmtdaaygdvw"); model = BinaryData.fromObject(model).toObject(FailoverInput.class); - Assertions.assertEquals("cciuqgbdbutau", model.failoverRegion()); + Assertions.assertEquals("mfmtdaaygdvw", model.failoverRegion()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FallbackRoutePropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FallbackRoutePropertiesTests.java index 3d9d9c2605af..755973c2ca18 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FallbackRoutePropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FallbackRoutePropertiesTests.java @@ -16,12 +16,12 @@ public void testDeserialize() throws Exception { FallbackRouteProperties model = BinaryData .fromString( - "{\"name\":\"lyaxuc\",\"source\":\"DeviceJobLifecycleEvents\",\"condition\":\"qszf\",\"endpointNames\":[\"eyp\",\"wrmjmwvvjektc\",\"senhwlrs\"],\"isEnabled\":true}") + "{\"name\":\"tsthsucocm\",\"source\":\"DeviceConnectionStateEvents\",\"condition\":\"azt\",\"endpointNames\":[\"twwrqp\"],\"isEnabled\":true}") .toObject(FallbackRouteProperties.class); - Assertions.assertEquals("lyaxuc", model.name()); - Assertions.assertEquals(RoutingSource.DEVICE_JOB_LIFECYCLE_EVENTS, model.source()); - Assertions.assertEquals("qszf", model.condition()); - Assertions.assertEquals("eyp", model.endpointNames().get(0)); + Assertions.assertEquals("tsthsucocm", model.name()); + Assertions.assertEquals(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS, model.source()); + Assertions.assertEquals("azt", model.condition()); + Assertions.assertEquals("twwrqp", model.endpointNames().get(0)); Assertions.assertEquals(true, model.isEnabled()); } @@ -29,16 +29,16 @@ public void testDeserialize() throws Exception { public void testSerialize() throws Exception { FallbackRouteProperties model = new FallbackRouteProperties() - .withName("lyaxuc") - .withSource(RoutingSource.DEVICE_JOB_LIFECYCLE_EVENTS) - .withCondition("qszf") - .withEndpointNames(Arrays.asList("eyp", "wrmjmwvvjektc", "senhwlrs")) + .withName("tsthsucocm") + .withSource(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS) + .withCondition("azt") + .withEndpointNames(Arrays.asList("twwrqp")) .withIsEnabled(true); model = BinaryData.fromObject(model).toObject(FallbackRouteProperties.class); - Assertions.assertEquals("lyaxuc", model.name()); - Assertions.assertEquals(RoutingSource.DEVICE_JOB_LIFECYCLE_EVENTS, model.source()); - Assertions.assertEquals("qszf", model.condition()); - Assertions.assertEquals("eyp", model.endpointNames().get(0)); + Assertions.assertEquals("tsthsucocm", model.name()); + Assertions.assertEquals(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS, model.source()); + Assertions.assertEquals("azt", model.condition()); + Assertions.assertEquals("twwrqp", model.endpointNames().get(0)); Assertions.assertEquals(true, model.isEnabled()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FeedbackPropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FeedbackPropertiesTests.java index 4f02379b21b8..2ae1116e9c60 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FeedbackPropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/FeedbackPropertiesTests.java @@ -15,23 +15,23 @@ public void testDeserialize() throws Exception { FeedbackProperties model = BinaryData .fromString( - "{\"lockDurationAsIso8601\":\"PT19H28M11S\",\"ttlAsIso8601\":\"PT104H38M10S\",\"maxDeliveryCount\":1236632858}") + "{\"lockDurationAsIso8601\":\"PT101H36M29S\",\"ttlAsIso8601\":\"PT205H18M18S\",\"maxDeliveryCount\":551724215}") .toObject(FeedbackProperties.class); - Assertions.assertEquals(Duration.parse("PT19H28M11S"), model.lockDurationAsIso8601()); - Assertions.assertEquals(Duration.parse("PT104H38M10S"), model.ttlAsIso8601()); - Assertions.assertEquals(1236632858, model.maxDeliveryCount()); + Assertions.assertEquals(Duration.parse("PT101H36M29S"), model.lockDurationAsIso8601()); + Assertions.assertEquals(Duration.parse("PT205H18M18S"), model.ttlAsIso8601()); + Assertions.assertEquals(551724215, model.maxDeliveryCount()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { FeedbackProperties model = new FeedbackProperties() - .withLockDurationAsIso8601(Duration.parse("PT19H28M11S")) - .withTtlAsIso8601(Duration.parse("PT104H38M10S")) - .withMaxDeliveryCount(1236632858); + .withLockDurationAsIso8601(Duration.parse("PT101H36M29S")) + .withTtlAsIso8601(Duration.parse("PT205H18M18S")) + .withMaxDeliveryCount(551724215); model = BinaryData.fromObject(model).toObject(FeedbackProperties.class); - Assertions.assertEquals(Duration.parse("PT19H28M11S"), model.lockDurationAsIso8601()); - Assertions.assertEquals(Duration.parse("PT104H38M10S"), model.ttlAsIso8601()); - Assertions.assertEquals(1236632858, model.maxDeliveryCount()); + Assertions.assertEquals(Duration.parse("PT101H36M29S"), model.lockDurationAsIso8601()); + Assertions.assertEquals(Duration.parse("PT205H18M18S"), model.ttlAsIso8601()); + Assertions.assertEquals(551724215, model.maxDeliveryCount()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/GroupIdInformationInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/GroupIdInformationInnerTests.java index aebfbfba5552..ef7be86e958f 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/GroupIdInformationInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/GroupIdInformationInnerTests.java @@ -16,11 +16,11 @@ public void testDeserialize() throws Exception { GroupIdInformationInner model = BinaryData .fromString( - "{\"id\":\"nzar\",\"name\":\"lquuijfqkacewii\",\"type\":\"pubjibw\",\"properties\":{\"groupId\":\"f\",\"requiredMembers\":[\"qkvpuvksgplsakn\",\"n\",\"synljphuopxodl\",\"iyntorzihle\"],\"requiredZoneNames\":[\"swsrms\",\"yzrpzbchckqqzq\",\"ox\"]}}") + "{\"id\":\"co\",\"name\":\"hp\",\"type\":\"kgymareqnajxqug\",\"properties\":{\"groupId\":\"ky\",\"requiredMembers\":[\"eddgssofw\",\"mzqa\",\"krmnjijpxacqqud\"],\"requiredZoneNames\":[\"yxbaaabjyvayf\",\"imrzrtuzqog\",\"exn\"]}}") .toObject(GroupIdInformationInner.class); - Assertions.assertEquals("f", model.properties().groupId()); - Assertions.assertEquals("qkvpuvksgplsakn", model.properties().requiredMembers().get(0)); - Assertions.assertEquals("swsrms", model.properties().requiredZoneNames().get(0)); + Assertions.assertEquals("ky", model.properties().groupId()); + Assertions.assertEquals("eddgssofw", model.properties().requiredMembers().get(0)); + Assertions.assertEquals("yxbaaabjyvayf", model.properties().requiredZoneNames().get(0)); } @org.junit.jupiter.api.Test @@ -29,12 +29,12 @@ public void testSerialize() throws Exception { new GroupIdInformationInner() .withProperties( new GroupIdInformationProperties() - .withGroupId("f") - .withRequiredMembers(Arrays.asList("qkvpuvksgplsakn", "n", "synljphuopxodl", "iyntorzihle")) - .withRequiredZoneNames(Arrays.asList("swsrms", "yzrpzbchckqqzq", "ox"))); + .withGroupId("ky") + .withRequiredMembers(Arrays.asList("eddgssofw", "mzqa", "krmnjijpxacqqud")) + .withRequiredZoneNames(Arrays.asList("yxbaaabjyvayf", "imrzrtuzqog", "exn"))); model = BinaryData.fromObject(model).toObject(GroupIdInformationInner.class); - Assertions.assertEquals("f", model.properties().groupId()); - Assertions.assertEquals("qkvpuvksgplsakn", model.properties().requiredMembers().get(0)); - Assertions.assertEquals("swsrms", model.properties().requiredZoneNames().get(0)); + Assertions.assertEquals("ky", model.properties().groupId()); + Assertions.assertEquals("eddgssofw", model.properties().requiredMembers().get(0)); + Assertions.assertEquals("yxbaaabjyvayf", model.properties().requiredZoneNames().get(0)); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/GroupIdInformationPropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/GroupIdInformationPropertiesTests.java index 706bb7733ff4..6c114b66afdf 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/GroupIdInformationPropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/GroupIdInformationPropertiesTests.java @@ -15,23 +15,23 @@ public void testDeserialize() throws Exception { GroupIdInformationProperties model = BinaryData .fromString( - "{\"groupId\":\"suiizynkedyat\",\"requiredMembers\":[\"hqmibzyhwit\",\"mypyynpcdpu\",\"nzgmwznmabik\"],\"requiredZoneNames\":[\"rgjhxb\",\"dtlwwrlkd\",\"tncvokot\"]}") + "{\"groupId\":\"fdnw\",\"requiredMembers\":[\"ewzsyyceuzsoib\",\"ud\"],\"requiredZoneNames\":[\"xtrthz\"]}") .toObject(GroupIdInformationProperties.class); - Assertions.assertEquals("suiizynkedyat", model.groupId()); - Assertions.assertEquals("hqmibzyhwit", model.requiredMembers().get(0)); - Assertions.assertEquals("rgjhxb", model.requiredZoneNames().get(0)); + Assertions.assertEquals("fdnw", model.groupId()); + Assertions.assertEquals("ewzsyyceuzsoib", model.requiredMembers().get(0)); + Assertions.assertEquals("xtrthz", model.requiredZoneNames().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { GroupIdInformationProperties model = new GroupIdInformationProperties() - .withGroupId("suiizynkedyat") - .withRequiredMembers(Arrays.asList("hqmibzyhwit", "mypyynpcdpu", "nzgmwznmabik")) - .withRequiredZoneNames(Arrays.asList("rgjhxb", "dtlwwrlkd", "tncvokot")); + .withGroupId("fdnw") + .withRequiredMembers(Arrays.asList("ewzsyyceuzsoib", "ud")) + .withRequiredZoneNames(Arrays.asList("xtrthz")); model = BinaryData.fromObject(model).toObject(GroupIdInformationProperties.class); - Assertions.assertEquals("suiizynkedyat", model.groupId()); - Assertions.assertEquals("hqmibzyhwit", model.requiredMembers().get(0)); - Assertions.assertEquals("rgjhxb", model.requiredZoneNames().get(0)); + Assertions.assertEquals("fdnw", model.groupId()); + Assertions.assertEquals("ewzsyyceuzsoib", model.requiredMembers().get(0)); + Assertions.assertEquals("xtrthz", model.requiredZoneNames().get(0)); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ImportDevicesRequestTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ImportDevicesRequestTests.java index ff9c5af048d5..86f54e2691c0 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ImportDevicesRequestTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ImportDevicesRequestTests.java @@ -16,38 +16,38 @@ public void testDeserialize() throws Exception { ImportDevicesRequest model = BinaryData .fromString( - "{\"inputBlobContainerUri\":\"fcnihgwq\",\"outputBlobContainerUri\":\"pnedgf\",\"inputBlobName\":\"vkcvqvpkeqd\",\"outputBlobName\":\"drhvoodsotbo\",\"authenticationType\":\"identityBased\",\"identity\":{\"userAssignedIdentity\":\"cjwvn\"},\"includeConfigurations\":false,\"configurationsBlobName\":\"wmgxcxrsl\"}") + "{\"inputBlobContainerUri\":\"jrjxgciqibrhosx\",\"outputBlobContainerUri\":\"dqrhzoymib\",\"inputBlobName\":\"qyib\",\"outputBlobName\":\"wfluszdt\",\"authenticationType\":\"identityBased\",\"identity\":{\"userAssignedIdentity\":\"ofyyvoqacpi\"},\"includeConfigurations\":false,\"configurationsBlobName\":\"tg\"}") .toObject(ImportDevicesRequest.class); - Assertions.assertEquals("fcnihgwq", model.inputBlobContainerUri()); - Assertions.assertEquals("pnedgf", model.outputBlobContainerUri()); - Assertions.assertEquals("vkcvqvpkeqd", model.inputBlobName()); - Assertions.assertEquals("drhvoodsotbo", model.outputBlobName()); + Assertions.assertEquals("jrjxgciqibrhosx", model.inputBlobContainerUri()); + Assertions.assertEquals("dqrhzoymib", model.outputBlobContainerUri()); + Assertions.assertEquals("qyib", model.inputBlobName()); + Assertions.assertEquals("wfluszdt", model.outputBlobName()); Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); - Assertions.assertEquals("cjwvn", model.identity().userAssignedIdentity()); + Assertions.assertEquals("ofyyvoqacpi", model.identity().userAssignedIdentity()); Assertions.assertEquals(false, model.includeConfigurations()); - Assertions.assertEquals("wmgxcxrsl", model.configurationsBlobName()); + Assertions.assertEquals("tg", model.configurationsBlobName()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ImportDevicesRequest model = new ImportDevicesRequest() - .withInputBlobContainerUri("fcnihgwq") - .withOutputBlobContainerUri("pnedgf") - .withInputBlobName("vkcvqvpkeqd") - .withOutputBlobName("drhvoodsotbo") + .withInputBlobContainerUri("jrjxgciqibrhosx") + .withOutputBlobContainerUri("dqrhzoymib") + .withInputBlobName("qyib") + .withOutputBlobName("wfluszdt") .withAuthenticationType(AuthenticationType.IDENTITY_BASED) - .withIdentity(new ManagedIdentity().withUserAssignedIdentity("cjwvn")) + .withIdentity(new ManagedIdentity().withUserAssignedIdentity("ofyyvoqacpi")) .withIncludeConfigurations(false) - .withConfigurationsBlobName("wmgxcxrsl"); + .withConfigurationsBlobName("tg"); model = BinaryData.fromObject(model).toObject(ImportDevicesRequest.class); - Assertions.assertEquals("fcnihgwq", model.inputBlobContainerUri()); - Assertions.assertEquals("pnedgf", model.outputBlobContainerUri()); - Assertions.assertEquals("vkcvqvpkeqd", model.inputBlobName()); - Assertions.assertEquals("drhvoodsotbo", model.outputBlobName()); + Assertions.assertEquals("jrjxgciqibrhosx", model.inputBlobContainerUri()); + Assertions.assertEquals("dqrhzoymib", model.outputBlobContainerUri()); + Assertions.assertEquals("qyib", model.inputBlobName()); + Assertions.assertEquals("wfluszdt", model.outputBlobName()); Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); - Assertions.assertEquals("cjwvn", model.identity().userAssignedIdentity()); + Assertions.assertEquals("ofyyvoqacpi", model.identity().userAssignedIdentity()); Assertions.assertEquals(false, model.includeConfigurations()); - Assertions.assertEquals("wmgxcxrsl", model.configurationsBlobName()); + Assertions.assertEquals("tg", model.configurationsBlobName()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubCapacityTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubCapacityTests.java index 3e9f46fecce5..9156f34068cd 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubCapacityTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubCapacityTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { IotHubCapacity model = BinaryData .fromString( - "{\"minimum\":2874780118088744582,\"maximum\":9144697658006681867,\"default\":8641218324516083606,\"scaleType\":\"Manual\"}") + "{\"minimum\":7155833165465337925,\"maximum\":7252038308965637311,\"default\":3647688567520643313,\"scaleType\":\"Manual\"}") .toObject(IotHubCapacity.class); } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubDescriptionListResultTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubDescriptionListResultTests.java deleted file mode 100644 index 198063445ee5..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubDescriptionListResultTests.java +++ /dev/null @@ -1,125 +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.resourcemanager.iothub.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.iothub.fluent.models.IotHubDescriptionInner; -import com.azure.resourcemanager.iothub.models.ArmIdentity; -import com.azure.resourcemanager.iothub.models.Capabilities; -import com.azure.resourcemanager.iothub.models.IotHubDescriptionListResult; -import com.azure.resourcemanager.iothub.models.IotHubProperties; -import com.azure.resourcemanager.iothub.models.IotHubSku; -import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; -import com.azure.resourcemanager.iothub.models.IpVersion; -import com.azure.resourcemanager.iothub.models.PublicNetworkAccess; -import com.azure.resourcemanager.iothub.models.ResourceIdentityType; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class IotHubDescriptionListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IotHubDescriptionListResult model = - BinaryData - .fromString( - "{\"value\":[{\"etag\":\"gnxytxhpzxbz\",\"properties\":{\"authorizationPolicies\":[],\"disableLocalAuth\":false,\"disableDeviceSAS\":true,\"disableModuleSAS\":true,\"restrictOutboundNetworkAccess\":true,\"allowedFqdnList\":[],\"publicNetworkAccess\":\"Enabled\",\"ipFilterRules\":[],\"minTlsVersion\":\"iklbbovpl\",\"privateEndpointConnections\":[],\"provisioningState\":\"hvgyuguosvmk\",\"state\":\"sxqu\",\"hostName\":\"fpl\",\"eventHubEndpoints\":{},\"storageEndpoints\":{},\"messagingEndpoints\":{},\"enableFileUploadNotifications\":false,\"comments\":\"kde\",\"features\":\"DeviceManagement\",\"locations\":[],\"enableDataResidency\":true,\"ipVersion\":\"ipv4ipv6\"},\"sku\":{\"name\":\"S3\",\"tier\":\"Free\",\"capacity\":8474633220472193573},\"identity\":{\"principalId\":\"baiuebbaumny\",\"tenantId\":\"ped\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{}},\"location\":\"bckhsmtxpsi\",\"tags\":{\"rdqmhjjdhtldwkyz\":\"fhvpesaps\",\"cwsvlxotog\":\"uutkncw\",\"o\":\"wrupqsxvnmicykvc\",\"vnotyfjfcnj\":\"eil\"},\"id\":\"k\",\"name\":\"nxdhbt\",\"type\":\"kphywpnvjto\"}],\"nextLink\":\"ermclfplphoxuscr\"}") - .toObject(IotHubDescriptionListResult.class); - Assertions.assertEquals("bckhsmtxpsi", model.value().get(0).location()); - Assertions.assertEquals("fhvpesaps", model.value().get(0).tags().get("rdqmhjjdhtldwkyz")); - Assertions.assertEquals("gnxytxhpzxbz", model.value().get(0).etag()); - Assertions.assertEquals(false, model.value().get(0).properties().disableLocalAuth()); - Assertions.assertEquals(true, model.value().get(0).properties().disableDeviceSas()); - Assertions.assertEquals(true, model.value().get(0).properties().disableModuleSas()); - Assertions.assertEquals(true, model.value().get(0).properties().restrictOutboundNetworkAccess()); - Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.value().get(0).properties().publicNetworkAccess()); - Assertions.assertEquals("iklbbovpl", model.value().get(0).properties().minTlsVersion()); - Assertions.assertEquals(false, model.value().get(0).properties().enableFileUploadNotifications()); - Assertions.assertEquals("kde", model.value().get(0).properties().comments()); - Assertions.assertEquals(Capabilities.DEVICE_MANAGEMENT, model.value().get(0).properties().features()); - Assertions.assertEquals(true, model.value().get(0).properties().enableDataResidency()); - Assertions.assertEquals(IpVersion.IPV4IPV6, model.value().get(0).properties().ipVersion()); - Assertions.assertEquals(IotHubSku.S3, model.value().get(0).sku().name()); - Assertions.assertEquals(8474633220472193573L, model.value().get(0).sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IotHubDescriptionListResult model = - new IotHubDescriptionListResult() - .withValue( - Arrays - .asList( - new IotHubDescriptionInner() - .withLocation("bckhsmtxpsi") - .withTags( - mapOf( - "rdqmhjjdhtldwkyz", - "fhvpesaps", - "cwsvlxotog", - "uutkncw", - "o", - "wrupqsxvnmicykvc", - "vnotyfjfcnj", - "eil")) - .withEtag("gnxytxhpzxbz") - .withProperties( - new IotHubProperties() - .withAuthorizationPolicies(Arrays.asList()) - .withDisableLocalAuth(false) - .withDisableDeviceSas(true) - .withDisableModuleSas(true) - .withRestrictOutboundNetworkAccess(true) - .withAllowedFqdnList(Arrays.asList()) - .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) - .withIpFilterRules(Arrays.asList()) - .withMinTlsVersion("iklbbovpl") - .withPrivateEndpointConnections(Arrays.asList()) - .withEventHubEndpoints(mapOf()) - .withStorageEndpoints(mapOf()) - .withMessagingEndpoints(mapOf()) - .withEnableFileUploadNotifications(false) - .withComments("kde") - .withFeatures(Capabilities.DEVICE_MANAGEMENT) - .withEnableDataResidency(true) - .withIpVersion(IpVersion.IPV4IPV6)) - .withSku(new IotHubSkuInfo().withName(IotHubSku.S3).withCapacity(8474633220472193573L)) - .withIdentity( - new ArmIdentity() - .withType(ResourceIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities(mapOf())))); - model = BinaryData.fromObject(model).toObject(IotHubDescriptionListResult.class); - Assertions.assertEquals("bckhsmtxpsi", model.value().get(0).location()); - Assertions.assertEquals("fhvpesaps", model.value().get(0).tags().get("rdqmhjjdhtldwkyz")); - Assertions.assertEquals("gnxytxhpzxbz", model.value().get(0).etag()); - Assertions.assertEquals(false, model.value().get(0).properties().disableLocalAuth()); - Assertions.assertEquals(true, model.value().get(0).properties().disableDeviceSas()); - Assertions.assertEquals(true, model.value().get(0).properties().disableModuleSas()); - Assertions.assertEquals(true, model.value().get(0).properties().restrictOutboundNetworkAccess()); - Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.value().get(0).properties().publicNetworkAccess()); - Assertions.assertEquals("iklbbovpl", model.value().get(0).properties().minTlsVersion()); - Assertions.assertEquals(false, model.value().get(0).properties().enableFileUploadNotifications()); - Assertions.assertEquals("kde", model.value().get(0).properties().comments()); - Assertions.assertEquals(Capabilities.DEVICE_MANAGEMENT, model.value().get(0).properties().features()); - Assertions.assertEquals(true, model.value().get(0).properties().enableDataResidency()); - Assertions.assertEquals(IpVersion.IPV4IPV6, model.value().get(0).properties().ipVersion()); - Assertions.assertEquals(IotHubSku.S3, model.value().get(0).sku().name()); - Assertions.assertEquals(8474633220472193573L, model.value().get(0).sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubLocationDescriptionTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubLocationDescriptionTests.java index c0c8bb8600d4..f48fadf6fe58 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubLocationDescriptionTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubLocationDescriptionTests.java @@ -14,18 +14,18 @@ public final class IotHubLocationDescriptionTests { public void testDeserialize() throws Exception { IotHubLocationDescription model = BinaryData - .fromString("{\"location\":\"ijhtxf\",\"role\":\"primary\"}") + .fromString("{\"location\":\"nxytxh\",\"role\":\"primary\"}") .toObject(IotHubLocationDescription.class); - Assertions.assertEquals("ijhtxf", model.location()); + Assertions.assertEquals("nxytxh", model.location()); Assertions.assertEquals(IotHubReplicaRoleType.PRIMARY, model.role()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { IotHubLocationDescription model = - new IotHubLocationDescription().withLocation("ijhtxf").withRole(IotHubReplicaRoleType.PRIMARY); + new IotHubLocationDescription().withLocation("nxytxh").withRole(IotHubReplicaRoleType.PRIMARY); model = BinaryData.fromObject(model).toObject(IotHubLocationDescription.class); - Assertions.assertEquals("ijhtxf", model.location()); + Assertions.assertEquals("nxytxh", model.location()); Assertions.assertEquals(IotHubReplicaRoleType.PRIMARY, model.role()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubManagerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubManagerTests.java deleted file mode 100644 index c6bbc17d308b..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubManagerTests.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.resourcemanager.iothub.generated; - -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.Region; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.TestBase; -import com.azure.core.test.annotation.DoNotRecord; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.resourcemanager.iothub.IotHubManager; -import com.azure.resourcemanager.iothub.models.ArmIdentity; -import com.azure.resourcemanager.iothub.models.Capabilities; -import com.azure.resourcemanager.iothub.models.CloudToDeviceProperties; -import com.azure.resourcemanager.iothub.models.EventHubProperties; -import com.azure.resourcemanager.iothub.models.FallbackRouteProperties; -import com.azure.resourcemanager.iothub.models.FeedbackProperties; -import com.azure.resourcemanager.iothub.models.IotHubDescription; -import com.azure.resourcemanager.iothub.models.IotHubProperties; -import com.azure.resourcemanager.iothub.models.IotHubSku; -import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; -import com.azure.resourcemanager.iothub.models.MessagingEndpointProperties; -import com.azure.resourcemanager.iothub.models.RoutingProperties; -import com.azure.resourcemanager.iothub.models.RoutingSource; -import com.azure.resourcemanager.iothub.models.ResourceIdentityType; -import com.azure.resourcemanager.iothub.models.StorageEndpointProperties; -import com.azure.resourcemanager.resources.ResourceManager; -import io.netty.util.internal.StringUtil; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.time.Duration; -import java.util.Arrays; -import java.util.Map; -import java.util.HashMap; -import java.util.Random; - -public class IotHubManagerTests extends TestBase { - - private static final Random RANDOM = new Random(); - private static final Region REGION = Region.US_WEST2; - private String resourceGroupName = "rg" + randomPadding(); - private IotHubManager iotHubManager; - private ResourceManager resourceManager; - private boolean testEnv; - - @Override - public void beforeTest() { - final TokenCredential credential = new DefaultAzureCredentialBuilder().build(); - final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); - - iotHubManager = IotHubManager - .configure() - .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)) - .authenticate(credential, profile); - - resourceManager = ResourceManager - .configure() - .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)) - .authenticate(credential, profile) - .withDefaultSubscription(); - - // use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI - String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME"); - testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup); - if (testEnv) { - resourceGroupName = testResourceGroup; - } else { - resourceManager.resourceGroups() - .define(resourceGroupName) - .withRegion(REGION) - .create(); - } - } - - @Override - protected void afterTest() { - if (!testEnv) { - resourceManager.resourceGroups().beginDeleteByName(resourceGroupName); - } - } - - @Test - @DoNotRecord(skipInPlayback = true) - public void testIotHubDescription() { - IotHubDescription iotHubDescription = null; - try { - String iothubName = "iotHub" + randomPadding(); - - // @embedmeStart - Map eventHubEndpointsMap = new HashMap<>(); - eventHubEndpointsMap.put("events", new EventHubProperties() - .withRetentionTimeInDays(1L).withPartitionCount(2)); - - Map storageEndpointsMap = new HashMap<>(); - storageEndpointsMap.put("$default", new StorageEndpointProperties() - .withSasTtlAsIso8601(Duration.ofHours(1L)) - .withConnectionString(StringUtil.EMPTY_STRING) - .withContainerName(StringUtil.EMPTY_STRING)); - - Map messagingEndpointsMap = new HashMap<>(); - messagingEndpointsMap.put("fileNotifications", new MessagingEndpointProperties() - .withLockDurationAsIso8601(Duration.ofMinutes(1L)) - .withTtlAsIso8601(Duration.ofHours(1L)) - .withMaxDeliveryCount(10)); - - iotHubDescription = iotHubManager.iotHubResources() - .define(iothubName) - .withRegion(REGION) - .withExistingResourceGroup(resourceGroupName) - .withSku(new IotHubSkuInfo().withName(IotHubSku.F1).withCapacity(1L)) - .withIdentity(new ArmIdentity().withType(ResourceIdentityType.NONE)) - .withProperties( - new IotHubProperties() - .withEventHubEndpoints(eventHubEndpointsMap) - .withRouting(new RoutingProperties() - .withFallbackRoute( - new FallbackRouteProperties() - .withName("$fallback") - .withSource(RoutingSource.DEVICE_MESSAGES) - .withCondition("true") - .withIsEnabled(true) - .withEndpointNames(Arrays.asList("events")))) - .withStorageEndpoints(storageEndpointsMap) - .withMessagingEndpoints(messagingEndpointsMap) - .withEnableFileUploadNotifications(false) - .withCloudToDevice(new CloudToDeviceProperties() - .withMaxDeliveryCount(10) - .withDefaultTtlAsIso8601(Duration.ofHours(1L)) - .withFeedback(new FeedbackProperties() - .withLockDurationAsIso8601(Duration.ofMinutes(1L)) - .withTtlAsIso8601(Duration.ofHours(1L)) - .withMaxDeliveryCount(10))) - .withFeatures(Capabilities.NONE) - .withDisableLocalAuth(false) - .withEnableDataResidency(false) - ) - .create(); - // @embedmeEnd - iotHubDescription.refresh(); - - Assertions.assertEquals(iotHubDescription.name(), iothubName); - Assertions.assertEquals(iotHubDescription.name(), iotHubManager.iotHubResources().getById(iotHubDescription.id()).name()); - Assertions.assertTrue(iotHubManager.iotHubResources().list().stream().count() > 0); - } finally { - if (iotHubDescription != null) { - iotHubManager.iotHubResources().deleteById(iotHubDescription.id()); - } - } - } - - private static String randomPadding() { - return String.format("%05d", Math.abs(RANDOM.nextInt() % 100000)); - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubNameAvailabilityInfoInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubNameAvailabilityInfoInnerTests.java index 9fa8712a2535..853564ec48c4 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubNameAvailabilityInfoInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubNameAvailabilityInfoInnerTests.java @@ -13,15 +13,15 @@ public final class IotHubNameAvailabilityInfoInnerTests { public void testDeserialize() throws Exception { IotHubNameAvailabilityInfoInner model = BinaryData - .fromString("{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"vbxwyjsflhh\"}") + .fromString("{\"nameAvailable\":false,\"reason\":\"AlreadyExists\",\"message\":\"xgk\"}") .toObject(IotHubNameAvailabilityInfoInner.class); - Assertions.assertEquals("vbxwyjsflhh", model.message()); + Assertions.assertEquals("xgk", model.message()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - IotHubNameAvailabilityInfoInner model = new IotHubNameAvailabilityInfoInner().withMessage("vbxwyjsflhh"); + IotHubNameAvailabilityInfoInner model = new IotHubNameAvailabilityInfoInner().withMessage("xgk"); model = BinaryData.fromObject(model).toObject(IotHubNameAvailabilityInfoInner.class); - Assertions.assertEquals("vbxwyjsflhh", model.message()); + Assertions.assertEquals("xgk", model.message()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubPropertiesDeviceStreamsTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubPropertiesDeviceStreamsTests.java deleted file mode 100644 index 023e53084d2d..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubPropertiesDeviceStreamsTests.java +++ /dev/null @@ -1,30 +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.resourcemanager.iothub.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.iothub.models.IotHubPropertiesDeviceStreams; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class IotHubPropertiesDeviceStreamsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IotHubPropertiesDeviceStreams model = - BinaryData - .fromString("{\"streamingEndpoints\":[\"pcyvahfnljkyqx\",\"vuujq\",\"idokgjlj\"]}") - .toObject(IotHubPropertiesDeviceStreams.class); - Assertions.assertEquals("pcyvahfnljkyqx", model.streamingEndpoints().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IotHubPropertiesDeviceStreams model = - new IotHubPropertiesDeviceStreams() - .withStreamingEndpoints(Arrays.asList("pcyvahfnljkyqx", "vuujq", "idokgjlj")); - model = BinaryData.fromObject(model).toObject(IotHubPropertiesDeviceStreams.class); - Assertions.assertEquals("pcyvahfnljkyqx", model.streamingEndpoints().get(0)); - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubQuotaMetricInfoInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubQuotaMetricInfoInnerTests.java index 94c7bf06abad..b0543dd0425b 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubQuotaMetricInfoInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubQuotaMetricInfoInnerTests.java @@ -12,7 +12,8 @@ public final class IotHubQuotaMetricInfoInnerTests { public void testDeserialize() throws Exception { IotHubQuotaMetricInfoInner model = BinaryData - .fromString("{\"name\":\"ibycno\",\"currentValue\":4247317532240790185,\"maxValue\":35726863806871709}") + .fromString( + "{\"name\":\"pvgqzcjrvxdjzlm\",\"currentValue\":1682281437917731463,\"maxValue\":1775729051253109920}") .toObject(IotHubQuotaMetricInfoInner.class); } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubQuotaMetricInfoListResultTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubQuotaMetricInfoListResultTests.java index 199f26c2b0a1..811149d60d40 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubQuotaMetricInfoListResultTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubQuotaMetricInfoListResultTests.java @@ -15,7 +15,7 @@ public void testDeserialize() throws Exception { IotHubQuotaMetricInfoListResult model = BinaryData .fromString( - "{\"value\":[{\"name\":\"vlvqhjkbegi\",\"currentValue\":7757966335492850327,\"maxValue\":8168827985153452849},{\"name\":\"wwaloayqcgwrt\",\"currentValue\":1503893081288679809,\"maxValue\":203566108787836432},{\"name\":\"mhtxongmtsavjcb\",\"currentValue\":4203274454921698643,\"maxValue\":273530932074575825},{\"name\":\"nftguvriuhpr\",\"currentValue\":4550073852873606939,\"maxValue\":2697266994096414506}],\"nextLink\":\"ayriwwroyqbexrm\"}") + "{\"value\":[{\"name\":\"bp\",\"currentValue\":5410192401023595008,\"maxValue\":8746825901777553134},{\"name\":\"ftguv\",\"currentValue\":4239243194073786564,\"maxValue\":3324276712333747571},{\"name\":\"dyvxqtayriww\",\"currentValue\":7269998904219193773,\"maxValue\":6962652464609703517},{\"name\":\"mcqibycnojv\",\"currentValue\":9109864718473817445,\"maxValue\":1560146384184244309}],\"nextLink\":\"zvahapjy\"}") .toObject(IotHubQuotaMetricInfoListResult.class); } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesCheckNameAvailabilityWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesCheckNameAvailabilityWithResponseMockTests.java index a1e5554d9051..338db4da45d5 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesCheckNameAvailabilityWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesCheckNameAvailabilityWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testCheckNameAvailabilityWithResponse() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"nameAvailable\":true,\"reason\":\"Invalid\",\"message\":\"uslfead\"}"; + String responseStr = "{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"gq\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,9 +63,9 @@ public void testCheckNameAvailabilityWithResponse() throws Exception { manager .iotHubResources() .checkNameAvailabilityWithResponse( - new OperationInputs().withName("dtclusiypb"), com.azure.core.util.Context.NONE) + new OperationInputs().withName("iypbsfgytgusl"), com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("uslfead", response.message()); + Assertions.assertEquals("gq", response.message()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesCreateEventHubConsumerGroupWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesCreateEventHubConsumerGroupWithResponseMockTests.java index 54e510be0fdc..0b3197f2068f 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesCreateEventHubConsumerGroupWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesCreateEventHubConsumerGroupWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testCreateEventHubConsumerGroupWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"dhtmdvypgikd\":\"datangwfqatm\"},\"etag\":\"zywkb\",\"id\":\"rryuzhlhkjo\",\"name\":\"rvqqaatj\",\"type\":\"nrvgoupmfiibfgg\"}"; + "{\"properties\":{\"yjsvfyc\":\"dataqahqkghtpwijn\",\"fvoow\":\"dataz\",\"pyostronzmyhgfi\":\"datarvmtgjq\"},\"etag\":\"sxkm\",\"id\":\"waekrrjreafxtsgu\",\"name\":\"hjglikk\",\"type\":\"wslolbqp\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,9 +62,9 @@ public void testCreateEventHubConsumerGroupWithResponse() throws Exception { EventHubConsumerGroupInfo response = manager .iotHubResources() - .defineEventHubConsumerGroup("csnjvcdwxlpqekft") - .withExistingEventHubEndpoint("opgxedkowepb", "pc", "fkbw") - .withProperties(new EventHubConsumerGroupName().withName("khtj")) + .defineEventHubConsumerGroup("pna") + .withExistingEventHubEndpoint("gitvg", "mhrixkwmyijejve", "rh") + .withProperties(new EventHubConsumerGroupName().withName("xexccbdreaxhcexd")) .create(); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesDeleteEventHubConsumerGroupWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesDeleteEventHubConsumerGroupWithResponseMockTests.java index 5b4001c8d852..cfbc0b7cd9b7 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesDeleteEventHubConsumerGroupWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesDeleteEventHubConsumerGroupWithResponseMockTests.java @@ -59,6 +59,6 @@ public void testDeleteEventHubConsumerGroupWithResponse() throws Exception { manager .iotHubResources() .deleteEventHubConsumerGroupWithResponse( - "qgsfraoyzkoow", "lmnguxaw", "aldsy", "uximerqfobw", com.azure.core.util.Context.NONE); + "lmnguxaw", "aldsy", "uximerqfobw", "znkbykutwpfhpagm", com.azure.core.util.Context.NONE); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetEndpointHealthMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetEndpointHealthMockTests.java index 3e334d389cef..25a34a753d73 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetEndpointHealthMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetEndpointHealthMockTests.java @@ -33,9 +33,9 @@ public void testGetEndpointHealth() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"endpointId\":\"gicccnxqhuex\",\"healthStatus\":\"healthy\",\"lastKnownError\":\"lstvlzywe\",\"lastKnownErrorTime\":\"Fri," - + " 10 Dec 2021 13:38:49 GMT\",\"lastSuccessfulSendAttemptTime\":\"Tue, 25 May 2021 03:52:53" - + " GMT\",\"lastSendAttemptTime\":\"Wed, 07 Apr 2021 16:00:46 GMT\"}]}"; + "{\"value\":[{\"endpointId\":\"qhuexm\",\"healthStatus\":\"degraded\",\"lastKnownError\":\"stvlzywemhzrnc\",\"lastKnownErrorTime\":\"Fri," + + " 07 May 2021 09:46:11 GMT\",\"lastSuccessfulSendAttemptTime\":\"Sat, 26 Dec 2020 03:14:52" + + " GMT\",\"lastSendAttemptTime\":\"Wed, 10 Mar 2021 02:09:12 GMT\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -64,20 +64,22 @@ public void testGetEndpointHealth() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.iotHubResources().getEndpointHealth("swe", "pqwd", com.azure.core.util.Context.NONE); + manager + .iotHubResources() + .getEndpointHealth("mhairsbrgzdwmsw", "ypqwdxggiccc", com.azure.core.util.Context.NONE); - Assertions.assertEquals("gicccnxqhuex", response.iterator().next().endpointId()); - Assertions.assertEquals(EndpointHealthStatus.HEALTHY, response.iterator().next().healthStatus()); - Assertions.assertEquals("lstvlzywe", response.iterator().next().lastKnownError()); + Assertions.assertEquals("qhuexm", response.iterator().next().endpointId()); + Assertions.assertEquals(EndpointHealthStatus.DEGRADED, response.iterator().next().healthStatus()); + Assertions.assertEquals("stvlzywemhzrnc", response.iterator().next().lastKnownError()); Assertions .assertEquals( - OffsetDateTime.parse("2021-12-10T13:38:49Z"), response.iterator().next().lastKnownErrorTime()); + OffsetDateTime.parse("2021-05-07T09:46:11Z"), response.iterator().next().lastKnownErrorTime()); Assertions .assertEquals( - OffsetDateTime.parse("2021-05-25T03:52:53Z"), + OffsetDateTime.parse("2020-12-26T03:14:52Z"), response.iterator().next().lastSuccessfulSendAttemptTime()); Assertions .assertEquals( - OffsetDateTime.parse("2021-04-07T16:00:46Z"), response.iterator().next().lastSendAttemptTime()); + OffsetDateTime.parse("2021-03-10T02:09:12Z"), response.iterator().next().lastSendAttemptTime()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetEventHubConsumerGroupWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetEventHubConsumerGroupWithResponseMockTests.java index a9a3c87be377..da2933a55059 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetEventHubConsumerGroupWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetEventHubConsumerGroupWithResponseMockTests.java @@ -30,7 +30,7 @@ public void testGetEventHubConsumerGroupWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"ujmqlgkfbtndoa\":\"datau\",\"bjcntujitc\":\"datan\",\"twwaezkojvdcpzf\":\"dataed\",\"foxciq\":\"dataqouicybxarzgsz\"},\"etag\":\"idoamciodhkha\",\"id\":\"xkhnzbonlwnto\",\"name\":\"gokdwbwhks\",\"type\":\"zcmrvexztvb\"}"; + "{\"properties\":{\"jcntuj\":\"datafbtndoaong\",\"ftwwaezkojvdc\":\"datatcje\",\"gszufoxciqopid\":\"datazfoqouicybxar\",\"hkh\":\"dataamcio\"},\"etag\":\"xkhnzbonlwnto\",\"id\":\"gokdwbwhks\",\"name\":\"zcmrvexztvb\",\"type\":\"qgsfraoyzkoow\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,7 +62,7 @@ public void testGetEventHubConsumerGroupWithResponse() throws Exception { manager .iotHubResources() .getEventHubConsumerGroupWithResponse( - "wjue", "aeburuvdmo", "s", "zlxwabmqoefkifr", com.azure.core.util.Context.NONE) + "uwjuetaeburuvdmo", "s", "zlxwabmqoefkifr", "tpuqujmq", com.azure.core.util.Context.NONE) .getValue(); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetJobWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetJobWithResponseMockTests.java index cbb47a86f79b..134e611c6336 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetJobWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetJobWithResponseMockTests.java @@ -30,9 +30,9 @@ public void testGetJobWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"jobId\":\"fozbhdmsmlmzqhof\",\"startTimeUtc\":\"Wed, 05 May 2021 04:42:21 GMT\",\"endTimeUtc\":\"Tue," - + " 16 Nov 2021 17:43:34" - + " GMT\",\"type\":\"readDeviceProperties\",\"status\":\"failed\",\"failureReason\":\"xicslfao\",\"statusMessage\":\"piyylhalnswhccsp\",\"parentJobId\":\"aivwitqscywu\"}"; + "{\"jobId\":\"nrfdw\",\"startTimeUtc\":\"Sun, 25 Jul 2021 01:07:20 GMT\",\"endTimeUtc\":\"Fri, 03 Dec 2021" + + " 00:28:31" + + " GMT\",\"type\":\"writeDeviceProperties\",\"status\":\"running\",\"failureReason\":\"fozbhdmsmlmzqhof\",\"statusMessage\":\"maequiahxicslfa\",\"parentJobId\":\"z\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,7 +63,7 @@ public void testGetJobWithResponse() throws Exception { JobResponse response = manager .iotHubResources() - .getJobWithResponse("enuuzkopbm", "nrfdw", "yuhhziu", com.azure.core.util.Context.NONE) + .getJobWithResponse("grtwae", "u", "zkopb", com.azure.core.util.Context.NONE) .getValue(); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetQuotaMetricsMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetQuotaMetricsMockTests.java index 3658c9401382..92ba2d70a2fb 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetQuotaMetricsMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetQuotaMetricsMockTests.java @@ -31,7 +31,7 @@ public void testGetQuotaMetrics() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"name\":\"bwemhairs\",\"currentValue\":2396598992556522813,\"maxValue\":1910924176223083649}]}"; + "{\"value\":[{\"name\":\"cywuggwol\",\"currentValue\":5268045254317332957,\"maxValue\":2580763840808977340}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -60,6 +60,6 @@ public void testGetQuotaMetrics() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.iotHubResources().getQuotaMetrics("gwol", "h", com.azure.core.util.Context.NONE); + manager.iotHubResources().getQuotaMetrics("iyylhalnswhccsp", "kaivwit", com.azure.core.util.Context.NONE); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetStatsWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetStatsWithResponseMockTests.java index 403f7571037d..e9cfbd42f30f 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetStatsWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetStatsWithResponseMockTests.java @@ -30,7 +30,7 @@ public void testGetStatsWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"totalDeviceCount\":1881000145918379423,\"enabledDeviceCount\":5500271153534098761,\"disabledDeviceCount\":6702265057684474491}"; + "{\"totalDeviceCount\":4977542958455551003,\"enabledDeviceCount\":9013966511894256740,\"disabledDeviceCount\":1441964733305710874}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,7 +61,7 @@ public void testGetStatsWithResponse() throws Exception { RegistryStatistics response = manager .iotHubResources() - .getStatsWithResponse("ofncckwyfzqwhxxb", "yq", com.azure.core.util.Context.NONE) + .getStatsWithResponse("dxrbuukzcle", "yhmlwpaztzp", com.azure.core.util.Context.NONE) .getValue(); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetValidSkusMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetValidSkusMockTests.java index 006754707ca6..fed0245215cb 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetValidSkusMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesGetValidSkusMockTests.java @@ -33,7 +33,7 @@ public void testGetValidSkus() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"resourceType\":\"bqwcsdbnwdcf\",\"sku\":{\"name\":\"S2\",\"tier\":\"Standard\",\"capacity\":3846405596035643939},\"capacity\":{\"minimum\":1028769978978951070,\"maximum\":4684256943455156597,\"default\":6093345050470116807,\"scaleType\":\"Manual\"}}]}"; + "{\"value\":[{\"resourceType\":\"rjaltolmncw\",\"sku\":{\"name\":\"B3\",\"tier\":\"Free\",\"capacity\":4217034770382613848},\"capacity\":{\"minimum\":8022967239645365882,\"maximum\":1537965460429529227,\"default\":1827389196157237043,\"scaleType\":\"Manual\"}}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,9 +62,9 @@ public void testGetValidSkus() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.iotHubResources().getValidSkus("riolxorjalt", "lmncw", com.azure.core.util.Context.NONE); + manager.iotHubResources().getValidSkus("qwhxxbuyqaxzfeqz", "ppriol", com.azure.core.util.Context.NONE); - Assertions.assertEquals(IotHubSku.S2, response.iterator().next().sku().name()); - Assertions.assertEquals(3846405596035643939L, response.iterator().next().sku().capacity()); + Assertions.assertEquals(IotHubSku.B3, response.iterator().next().sku().name()); + Assertions.assertEquals(4217034770382613848L, response.iterator().next().sku().capacity()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesImportDevicesWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesImportDevicesWithResponseMockTests.java index 6419a1058e68..d2298a1d11c8 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesImportDevicesWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesImportDevicesWithResponseMockTests.java @@ -33,9 +33,9 @@ public void testImportDevicesWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"jobId\":\"kvtvsexso\",\"startTimeUtc\":\"Sat, 09 Jan 2021 15:20:12 GMT\",\"endTimeUtc\":\"Thu, 28 Jan" - + " 2021 09:30:25" - + " GMT\",\"type\":\"readDeviceProperties\",\"status\":\"completed\",\"failureReason\":\"hxvrhmzkwpjg\",\"statusMessage\":\"spughftqsxhq\",\"parentJobId\":\"j\"}"; + "{\"jobId\":\"kj\",\"startTimeUtc\":\"Mon, 15 Nov 2021 06:41:50 GMT\",\"endTimeUtc\":\"Tue, 13 Jul 2021" + + " 23:55:09" + + " GMT\",\"type\":\"factoryResetDevice\",\"status\":\"running\",\"failureReason\":\"inrvgoupmfi\",\"statusMessage\":\"fggjioolvr\",\"parentJobId\":\"kvtkkg\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -67,17 +67,17 @@ public void testImportDevicesWithResponse() throws Exception { manager .iotHubResources() .importDevicesWithResponse( - "gzpfrla", - "szrnwo", + "bopgxedkowepbqp", + "rfkbwccsnjvcdwxl", new ImportDevicesRequest() - .withInputBlobContainerUri("indfpwpjyl") - .withOutputBlobContainerUri("bt") - .withInputBlobName("flsjc") - .withOutputBlobName("szfjvfbgofelja") - .withAuthenticationType(AuthenticationType.IDENTITY_BASED) - .withIdentity(new ManagedIdentity().withUserAssignedIdentity("hldvriii")) + .withInputBlobContainerUri("qek") + .withOutputBlobContainerUri("tn") + .withInputBlobName("tjsyin") + .withOutputBlobName("fq") + .withAuthenticationType(AuthenticationType.KEY_BASED) + .withIdentity(new ManagedIdentity().withUserAssignedIdentity("htmdvy")) .withIncludeConfigurations(true) - .withConfigurationsBlobName("lg"), + .withConfigurationsBlobName("dgszywkbirryuzh"), com.azure.core.util.Context.NONE) .getValue(); } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesListEventHubConsumerGroupsMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesListEventHubConsumerGroupsMockTests.java index 5f7e916f7048..e9c8f6299a2a 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesListEventHubConsumerGroupsMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesListEventHubConsumerGroupsMockTests.java @@ -31,7 +31,7 @@ public void testListEventHubConsumerGroups() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"kgjubgdknnqvsazn\":\"datalxqtvcofudfl\"},\"etag\":\"tor\",\"id\":\"dsg\",\"name\":\"a\",\"type\":\"mkycgra\"}]}"; + "{\"value\":[{\"properties\":{\"lxqtvcofudfl\":\"datautncorm\"},\"etag\":\"gj\",\"id\":\"bgdknnqv\",\"name\":\"aznqntoru\",\"type\":\"sgsahmkycgr\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,6 +62,6 @@ public void testListEventHubConsumerGroups() throws Exception { PagedIterable response = manager .iotHubResources() - .listEventHubConsumerGroups("vxb", "t", "udutnco", com.azure.core.util.Context.NONE); + .listEventHubConsumerGroups("dpfuvg", "sbjjc", "nvxbvt", com.azure.core.util.Context.NONE); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesListJobsMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesListJobsMockTests.java index 029b1156ec60..468722377192 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesListJobsMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesListJobsMockTests.java @@ -31,9 +31,9 @@ public void testListJobs() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"jobId\":\"dsnfdsdoakgtdl\",\"startTimeUtc\":\"Sat, 23 Oct 2021 18:05:06" - + " GMT\",\"endTimeUtc\":\"Mon, 21 Jun 2021 09:18:55" - + " GMT\",\"type\":\"writeDeviceProperties\",\"status\":\"enqueued\",\"failureReason\":\"wpusdsttwvogv\",\"statusMessage\":\"ejdcngqqmoakuf\",\"parentJobId\":\"jzrwrdgrtw\"}]}"; + "{\"value\":[{\"jobId\":\"kzevdlhewpusds\",\"startTimeUtc\":\"Sat, 06 Feb 2021 17:43:59" + + " GMT\",\"endTimeUtc\":\"Fri, 23 Apr 2021 17:16:39" + + " GMT\",\"type\":\"factoryResetDevice\",\"status\":\"completed\",\"failureReason\":\"jdcngqqm\",\"statusMessage\":\"kufgmj\",\"parentJobId\":\"wr\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,6 +62,6 @@ public void testListJobs() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.iotHubResources().listJobs("znkbykutwpfhpagm", "r", com.azure.core.util.Context.NONE); + manager.iotHubResources().listJobs("r", "kdsnfdsdoakgtdl", com.azure.core.util.Context.NONE); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesTestAllRoutesWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesTestAllRoutesWithResponseMockTests.java index 94215f051155..ca9b1a0eb3d3 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesTestAllRoutesWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesTestAllRoutesWithResponseMockTests.java @@ -23,6 +23,7 @@ import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -36,7 +37,8 @@ public void testTestAllRoutesWithResponse() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"routes\":[{}]}"; + String responseStr = + "{\"routes\":[{\"properties\":{\"name\":\"zsjqlh\",\"source\":\"TwinChangeEvents\",\"condition\":\"ibdeibq\",\"endpointNames\":[\"qkgh\"],\"isEnabled\":false}},{\"properties\":{\"name\":\"dzwmkrefajpj\",\"source\":\"DeviceJobLifecycleEvents\",\"condition\":\"kqnyh\",\"endpointNames\":[\"ij\"],\"isEnabled\":true}},{\"properties\":{\"name\":\"vfxzsjab\",\"source\":\"TwinChangeEvents\",\"condition\":\"ystawfsdjpvkvp\",\"endpointNames\":[\"xbkzbzkdvncj\",\"budurgkakmo\",\"zhjjklffhmouwq\"],\"isEnabled\":false}},{\"properties\":{\"name\":\"rfzeey\",\"source\":\"Invalid\",\"condition\":\"zi\",\"endpointNames\":[\"yuhqlbjbsybbqwrv\",\"ldgmfpgvmpip\",\"slthaq\"],\"isEnabled\":false}}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -68,26 +70,33 @@ public void testTestAllRoutesWithResponse() throws Exception { manager .iotHubResources() .testAllRoutesWithResponse( - "ygqukyhejh", - "isxgfp", + "kyhejhzisxgf", + "elolppvksrpqvuj", new TestAllRoutesInput() - .withRoutingSource(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS) + .withRoutingSource(RoutingSource.DEVICE_LIFECYCLE_EVENTS) .withMessage( new RoutingMessage() - .withBody("pv") - .withAppProperties(mapOf("swibyr", "pqvujzraehtwdwrf")) - .withSystemProperties(mapOf("hevxcced", "bhshfwpracstwity"))) + .withBody("twdw") + .withAppProperties(mapOf("dl", "swibyr", "hfwpracstwit", "h")) + .withSystemProperties(mapOf("md", "evxccedcp", "zxltjcvn", "odn"))) .withTwin( new RoutingTwin() - .withTags("datamd") + .withTags("dataiugcxnavvwxq") .withProperties( new RoutingTwinProperties() - .withDesired("datanwzxltjcv") - .withReported("dataltiugcxnavv"))), + .withDesired("dataqunyowxwlmdjr") + .withReported("datafgbvfvpdbo"))), com.azure.core.util.Context.NONE) .getValue(); + + Assertions.assertEquals("zsjqlh", response.routes().get(0).properties().name()); + Assertions.assertEquals(RoutingSource.TWIN_CHANGE_EVENTS, response.routes().get(0).properties().source()); + Assertions.assertEquals("ibdeibq", response.routes().get(0).properties().condition()); + Assertions.assertEquals("qkgh", response.routes().get(0).properties().endpointNames().get(0)); + Assertions.assertEquals(false, response.routes().get(0).properties().isEnabled()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesTestRouteWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesTestRouteWithResponseMockTests.java index e62cb8cf08c8..7b324f79fece 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesTestRouteWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubResourcesTestRouteWithResponseMockTests.java @@ -12,6 +12,7 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.resourcemanager.iothub.models.RouteErrorSeverity; import com.azure.resourcemanager.iothub.models.RouteProperties; import com.azure.resourcemanager.iothub.models.RoutingMessage; import com.azure.resourcemanager.iothub.models.RoutingSource; @@ -40,7 +41,8 @@ public void testTestRouteWithResponse() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"result\":\"undefined\",\"details\":{\"compilationErrors\":[]}}"; + String responseStr = + "{\"result\":\"undefined\",\"details\":{\"compilationErrors\":[{\"message\":\"xdigrjg\",\"severity\":\"error\",\"location\":{\"start\":{},\"end\":{}}},{\"message\":\"yqtfihwh\",\"severity\":\"warning\",\"location\":{\"start\":{},\"end\":{}}},{\"message\":\"amvpphoszqzudph\",\"severity\":\"error\",\"location\":{\"start\":{},\"end\":{}}},{\"message\":\"wynwcvtbvkayhm\",\"severity\":\"error\",\"location\":{\"start\":{},\"end\":{}}}]}}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -72,34 +74,38 @@ public void testTestRouteWithResponse() throws Exception { manager .iotHubResources() .testRouteWithResponse( - "byqunyow", - "wlmdjrkv", + "ss", + "wutwbdsre", new TestRouteInput() .withMessage( new RoutingMessage() - .withBody("vfvpdbodaciz") - .withAppProperties(mapOf("hvxndzwmkrefajpj", "lhkrribdeibqipqk")) - .withSystemProperties(mapOf("b", "kqnyh", "jivfxzsjabib", "j"))) + .withBody("rhneuyowq") + .withAppProperties(mapOf("gpikpzimejza", "ytisibir")) + .withSystemProperties( + mapOf("zonokixrjqci", "zxiavrm", "szrnwo", "gzpfrla", "bt", "indfpwpjyl"))) .withRoute( new RouteProperties() - .withName("ystawfsdjpvkvp") - .withSource(RoutingSource.DIGITAL_TWIN_CHANGE_EVENTS) - .withCondition("bkzbzkd") - .withEndpointNames(Arrays.asList("cjabudurgkakmo")) + .withName("h") + .withSource(RoutingSource.DEVICE_MESSAGES) + .withCondition("jcdh") + .withEndpointNames(Arrays.asList("fjvfbgofeljagr", "mqhldvrii", "ojnal")) .withIsEnabled(true)) .withTwin( new RoutingTwin() - .withTags("datajk") + .withTags("datavtvsexsowueluq") .withProperties( new RoutingTwinProperties() - .withDesired("datahmouwqlgzrfze") - .withReported("dataebizikayuh"))), + .withDesired("datahhxvrhmzkwpj") + .withReported("datawspughftqsxhqx"))), com.azure.core.util.Context.NONE) .getValue(); Assertions.assertEquals(TestResultStatus.UNDEFINED, response.result()); + Assertions.assertEquals("xdigrjg", response.details().compilationErrors().get(0).message()); + Assertions.assertEquals(RouteErrorSeverity.ERROR, response.details().compilationErrors().get(0).severity()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuDescriptionInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuDescriptionInnerTests.java index 1d052317f760..7f85e494403d 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuDescriptionInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuDescriptionInnerTests.java @@ -17,20 +17,20 @@ public void testDeserialize() throws Exception { IotHubSkuDescriptionInner model = BinaryData .fromString( - "{\"resourceType\":\"srtslhspkdeem\",\"sku\":{\"name\":\"S3\",\"tier\":\"Basic\",\"capacity\":1461011233299690621},\"capacity\":{\"minimum\":1611861407793999607,\"maximum\":5342331061504753909,\"default\":2936969663422181948,\"scaleType\":\"Automatic\"}}") + "{\"resourceType\":\"lhrxsbkyvpyc\",\"sku\":{\"name\":\"S1\",\"tier\":\"Free\",\"capacity\":373365368946667415},\"capacity\":{\"minimum\":6075974132031509292,\"maximum\":3708510664132188472,\"default\":8812234948991108432,\"scaleType\":\"Automatic\"}}") .toObject(IotHubSkuDescriptionInner.class); - Assertions.assertEquals(IotHubSku.S3, model.sku().name()); - Assertions.assertEquals(1461011233299690621L, model.sku().capacity()); + Assertions.assertEquals(IotHubSku.S1, model.sku().name()); + Assertions.assertEquals(373365368946667415L, model.sku().capacity()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { IotHubSkuDescriptionInner model = new IotHubSkuDescriptionInner() - .withSku(new IotHubSkuInfo().withName(IotHubSku.S3).withCapacity(1461011233299690621L)) + .withSku(new IotHubSkuInfo().withName(IotHubSku.S1).withCapacity(373365368946667415L)) .withCapacity(new IotHubCapacity()); model = BinaryData.fromObject(model).toObject(IotHubSkuDescriptionInner.class); - Assertions.assertEquals(IotHubSku.S3, model.sku().name()); - Assertions.assertEquals(1461011233299690621L, model.sku().capacity()); + Assertions.assertEquals(IotHubSku.S1, model.sku().name()); + Assertions.assertEquals(373365368946667415L, model.sku().capacity()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuDescriptionListResultTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuDescriptionListResultTests.java index f5610049f6e7..899c7f3dc7fe 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuDescriptionListResultTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuDescriptionListResultTests.java @@ -19,10 +19,10 @@ public void testDeserialize() throws Exception { IotHubSkuDescriptionListResult model = BinaryData .fromString( - "{\"value\":[{\"resourceType\":\"qugxywpmueefjzwf\",\"sku\":{\"name\":\"B1\",\"tier\":\"Free\",\"capacity\":2752624738826273376},\"capacity\":{\"minimum\":2895240290674738337,\"maximum\":722648832186407891,\"default\":5846205401797666469,\"scaleType\":\"Automatic\"}},{\"resourceType\":\"qxtccmgyudx\",\"sku\":{\"name\":\"B2\",\"tier\":\"Standard\",\"capacity\":5036022727729954665},\"capacity\":{\"minimum\":5697722366346871182,\"maximum\":328428173774055677,\"default\":1705151259952930874,\"scaleType\":\"None\"}},{\"resourceType\":\"hdzhlrqj\",\"sku\":{\"name\":\"B2\",\"tier\":\"Standard\",\"capacity\":6374623406138918990},\"capacity\":{\"minimum\":8781176229641624570,\"maximum\":5275318016138914703,\"default\":1967797899884280622,\"scaleType\":\"None\"}},{\"resourceType\":\"n\",\"sku\":{\"name\":\"S2\",\"tier\":\"Free\",\"capacity\":5373828477618369096},\"capacity\":{\"minimum\":739899630467630797,\"maximum\":574839923891984639,\"default\":6504833090063292182,\"scaleType\":\"Automatic\"}}],\"nextLink\":\"hhseyv\"}") + "{\"value\":[{\"resourceType\":\"clfp\",\"sku\":{\"name\":\"S2\",\"tier\":\"Free\",\"capacity\":4783074084944223804},\"capacity\":{\"minimum\":4751177504452360818,\"maximum\":8751195016646991326,\"default\":1457030135916183053,\"scaleType\":\"None\"}},{\"resourceType\":\"tazqugxywpmueefj\",\"sku\":{\"name\":\"B1\",\"tier\":\"Standard\",\"capacity\":833817548931918464},\"capacity\":{\"minimum\":2752624738826273376,\"maximum\":2895240290674738337,\"default\":722648832186407891,\"scaleType\":\"None\"}},{\"resourceType\":\"aocqxtccmgy\",\"sku\":{\"name\":\"B2\",\"tier\":\"Basic\",\"capacity\":6169817169504749618},\"capacity\":{\"minimum\":5036022727729954665,\"maximum\":5697722366346871182,\"default\":328428173774055677,\"scaleType\":\"Manual\"}}],\"nextLink\":\"ntxhdzhlrqjbhck\"}") .toObject(IotHubSkuDescriptionListResult.class); - Assertions.assertEquals(IotHubSku.B1, model.value().get(0).sku().name()); - Assertions.assertEquals(2752624738826273376L, model.value().get(0).sku().capacity()); + Assertions.assertEquals(IotHubSku.S2, model.value().get(0).sku().name()); + Assertions.assertEquals(4783074084944223804L, model.value().get(0).sku().capacity()); } @org.junit.jupiter.api.Test @@ -33,19 +33,16 @@ public void testSerialize() throws Exception { Arrays .asList( new IotHubSkuDescriptionInner() - .withSku(new IotHubSkuInfo().withName(IotHubSku.B1).withCapacity(2752624738826273376L)) + .withSku(new IotHubSkuInfo().withName(IotHubSku.S2).withCapacity(4783074084944223804L)) .withCapacity(new IotHubCapacity()), new IotHubSkuDescriptionInner() - .withSku(new IotHubSkuInfo().withName(IotHubSku.B2).withCapacity(5036022727729954665L)) + .withSku(new IotHubSkuInfo().withName(IotHubSku.B1).withCapacity(833817548931918464L)) .withCapacity(new IotHubCapacity()), new IotHubSkuDescriptionInner() - .withSku(new IotHubSkuInfo().withName(IotHubSku.B2).withCapacity(6374623406138918990L)) - .withCapacity(new IotHubCapacity()), - new IotHubSkuDescriptionInner() - .withSku(new IotHubSkuInfo().withName(IotHubSku.S2).withCapacity(5373828477618369096L)) + .withSku(new IotHubSkuInfo().withName(IotHubSku.B2).withCapacity(6169817169504749618L)) .withCapacity(new IotHubCapacity()))); model = BinaryData.fromObject(model).toObject(IotHubSkuDescriptionListResult.class); - Assertions.assertEquals(IotHubSku.B1, model.value().get(0).sku().name()); - Assertions.assertEquals(2752624738826273376L, model.value().get(0).sku().capacity()); + Assertions.assertEquals(IotHubSku.S2, model.value().get(0).sku().name()); + Assertions.assertEquals(4783074084944223804L, model.value().get(0).sku().capacity()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuInfoTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuInfoTests.java index 3fe350ea0473..34055279ce67 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuInfoTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubSkuInfoTests.java @@ -14,17 +14,17 @@ public final class IotHubSkuInfoTests { public void testDeserialize() throws Exception { IotHubSkuInfo model = BinaryData - .fromString("{\"name\":\"F1\",\"tier\":\"Free\",\"capacity\":6629328138871723809}") + .fromString("{\"name\":\"S1\",\"tier\":\"Free\",\"capacity\":2949431657517136323}") .toObject(IotHubSkuInfo.class); - Assertions.assertEquals(IotHubSku.F1, model.name()); - Assertions.assertEquals(6629328138871723809L, model.capacity()); + Assertions.assertEquals(IotHubSku.S1, model.name()); + Assertions.assertEquals(2949431657517136323L, model.capacity()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - IotHubSkuInfo model = new IotHubSkuInfo().withName(IotHubSku.F1).withCapacity(6629328138871723809L); + IotHubSkuInfo model = new IotHubSkuInfo().withName(IotHubSku.S1).withCapacity(2949431657517136323L); model = BinaryData.fromObject(model).toObject(IotHubSkuInfo.class); - Assertions.assertEquals(IotHubSku.F1, model.name()); - Assertions.assertEquals(6629328138871723809L, model.capacity()); + Assertions.assertEquals(IotHubSku.S1, model.name()); + Assertions.assertEquals(2949431657517136323L, model.capacity()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubsManualFailoverMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubsManualFailoverMockTests.java index 6e80d396a3fc..1be6d7ac45a9 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubsManualFailoverMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/IotHubsManualFailoverMockTests.java @@ -60,9 +60,9 @@ public void testManualFailover() throws Exception { manager .iotHubs() .manualFailover( - "ggufhyaomtb", - "hhavgrvkffovjz", - new FailoverInput().withFailoverRegion("pjbi"), + "dfcea", + "vlhv", + new FailoverInput().withFailoverRegion("gdyftumrtwna"), com.azure.core.util.Context.NONE); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/JobResponseInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/JobResponseInnerTests.java index f67fb5faa5c3..af50975ff47e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/JobResponseInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/JobResponseInnerTests.java @@ -13,9 +13,9 @@ public void testDeserialize() throws Exception { JobResponseInner model = BinaryData .fromString( - "{\"jobId\":\"lupj\",\"startTimeUtc\":\"Wed, 21 Apr 2021 08:53:38 GMT\",\"endTimeUtc\":\"Mon, 26" - + " Apr 2021 22:12:21" - + " GMT\",\"type\":\"import\",\"status\":\"completed\",\"failureReason\":\"wsrtjriplrbpbe\",\"statusMessage\":\"ghfg\",\"parentJobId\":\"c\"}") + "{\"jobId\":\"begibtnmxiebwwa\",\"startTimeUtc\":\"Mon, 12 Apr 2021 02:20:56" + + " GMT\",\"endTimeUtc\":\"Mon, 26 Apr 2021 15:42:40" + + " GMT\",\"type\":\"factoryResetDevice\",\"status\":\"unknown\",\"failureReason\":\"zjuzgwyz\",\"statusMessage\":\"txon\",\"parentJobId\":\"ts\"}") .toObject(JobResponseInner.class); } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/JobResponseListResultTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/JobResponseListResultTests.java index 356fda77e2ad..8a5ab4497ef8 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/JobResponseListResultTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/JobResponseListResultTests.java @@ -15,15 +15,18 @@ public void testDeserialize() throws Exception { JobResponseListResult model = BinaryData .fromString( - "{\"value\":[{\"jobId\":\"skxfbk\",\"startTimeUtc\":\"Fri, 05 Feb 2021 18:39:24" - + " GMT\",\"endTimeUtc\":\"Sun, 14 Feb 2021 18:57:00" - + " GMT\",\"type\":\"writeDeviceProperties\",\"status\":\"completed\",\"failureReason\":\"hjdauwhvylwz\",\"statusMessage\":\"dhxujznbmpo\",\"parentJobId\":\"wpr\"}],\"nextLink\":\"lve\"}") + "{\"value\":[{\"jobId\":\"wgqwgxhn\",\"startTimeUtc\":\"Sun, 10 Oct 2021 16:17:48" + + " GMT\",\"endTimeUtc\":\"Mon, 23 Aug 2021 08:34:37" + + " GMT\",\"type\":\"export\",\"status\":\"enqueued\",\"failureReason\":\"gklwn\",\"statusMessage\":\"hjdauwhvylwz\",\"parentJobId\":\"dhxujznbmpo\"},{\"jobId\":\"wpr\",\"startTimeUtc\":\"Sun," + + " 10 Jan 2021 20:10:28 GMT\",\"endTimeUtc\":\"Tue, 11 May 2021 15:12:41" + + " GMT\",\"type\":\"import\",\"status\":\"enqueued\",\"failureReason\":\"j\",\"statusMessage\":\"hfxobbcswsrtj\",\"parentJobId\":\"plrbpbewtghf\"}],\"nextLink\":\"lcgwxzvlvqh\"}") .toObject(JobResponseListResult.class); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - JobResponseListResult model = new JobResponseListResult().withValue(Arrays.asList(new JobResponseInner())); + JobResponseListResult model = + new JobResponseListResult().withValue(Arrays.asList(new JobResponseInner(), new JobResponseInner())); model = BinaryData.fromObject(model).toObject(JobResponseListResult.class); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ManagedIdentityTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ManagedIdentityTests.java index ae9f03a5015c..ac864c07a961 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ManagedIdentityTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ManagedIdentityTests.java @@ -12,14 +12,14 @@ public final class ManagedIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ManagedIdentity model = - BinaryData.fromString("{\"userAssignedIdentity\":\"czvyifq\"}").toObject(ManagedIdentity.class); - Assertions.assertEquals("czvyifq", model.userAssignedIdentity()); + BinaryData.fromString("{\"userAssignedIdentity\":\"deyeamdphagalpbu\"}").toObject(ManagedIdentity.class); + Assertions.assertEquals("deyeamdphagalpbu", model.userAssignedIdentity()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ManagedIdentity model = new ManagedIdentity().withUserAssignedIdentity("czvyifq"); + ManagedIdentity model = new ManagedIdentity().withUserAssignedIdentity("deyeamdphagalpbu"); model = BinaryData.fromObject(model).toObject(ManagedIdentity.class); - Assertions.assertEquals("czvyifq", model.userAssignedIdentity()); + Assertions.assertEquals("deyeamdphagalpbu", model.userAssignedIdentity()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/MatchedRouteTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/MatchedRouteTests.java index 935cf6b5d5b7..3250ebbaa369 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/MatchedRouteTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/MatchedRouteTests.java @@ -17,13 +17,13 @@ public void testDeserialize() throws Exception { MatchedRoute model = BinaryData .fromString( - "{\"properties\":{\"name\":\"gynduha\",\"source\":\"DigitalTwinChangeEvents\",\"condition\":\"lkthu\",\"endpointNames\":[\"qolbgyc\",\"uie\",\"tgccymvaolpss\",\"qlfmmdnbb\"],\"isEnabled\":true}}") + "{\"properties\":{\"name\":\"mubyynt\",\"source\":\"TwinChangeEvents\",\"condition\":\"bqtkoievseotgqr\",\"endpointNames\":[\"tmuwlauwzi\",\"xbmp\",\"cjefuzmu\",\"pbttdum\"],\"isEnabled\":false}}") .toObject(MatchedRoute.class); - Assertions.assertEquals("gynduha", model.properties().name()); - Assertions.assertEquals(RoutingSource.DIGITAL_TWIN_CHANGE_EVENTS, model.properties().source()); - Assertions.assertEquals("lkthu", model.properties().condition()); - Assertions.assertEquals("qolbgyc", model.properties().endpointNames().get(0)); - Assertions.assertEquals(true, model.properties().isEnabled()); + Assertions.assertEquals("mubyynt", model.properties().name()); + Assertions.assertEquals(RoutingSource.TWIN_CHANGE_EVENTS, model.properties().source()); + Assertions.assertEquals("bqtkoievseotgqr", model.properties().condition()); + Assertions.assertEquals("tmuwlauwzi", model.properties().endpointNames().get(0)); + Assertions.assertEquals(false, model.properties().isEnabled()); } @org.junit.jupiter.api.Test @@ -32,16 +32,16 @@ public void testSerialize() throws Exception { new MatchedRoute() .withProperties( new RouteProperties() - .withName("gynduha") - .withSource(RoutingSource.DIGITAL_TWIN_CHANGE_EVENTS) - .withCondition("lkthu") - .withEndpointNames(Arrays.asList("qolbgyc", "uie", "tgccymvaolpss", "qlfmmdnbb")) - .withIsEnabled(true)); + .withName("mubyynt") + .withSource(RoutingSource.TWIN_CHANGE_EVENTS) + .withCondition("bqtkoievseotgqr") + .withEndpointNames(Arrays.asList("tmuwlauwzi", "xbmp", "cjefuzmu", "pbttdum")) + .withIsEnabled(false)); model = BinaryData.fromObject(model).toObject(MatchedRoute.class); - Assertions.assertEquals("gynduha", model.properties().name()); - Assertions.assertEquals(RoutingSource.DIGITAL_TWIN_CHANGE_EVENTS, model.properties().source()); - Assertions.assertEquals("lkthu", model.properties().condition()); - Assertions.assertEquals("qolbgyc", model.properties().endpointNames().get(0)); - Assertions.assertEquals(true, model.properties().isEnabled()); + Assertions.assertEquals("mubyynt", model.properties().name()); + Assertions.assertEquals(RoutingSource.TWIN_CHANGE_EVENTS, model.properties().source()); + Assertions.assertEquals("bqtkoievseotgqr", model.properties().condition()); + Assertions.assertEquals("tmuwlauwzi", model.properties().endpointNames().get(0)); + Assertions.assertEquals(false, model.properties().isEnabled()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/MessagingEndpointPropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/MessagingEndpointPropertiesTests.java index 012ac5d11736..a1a60d6590fc 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/MessagingEndpointPropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/MessagingEndpointPropertiesTests.java @@ -15,23 +15,23 @@ public void testDeserialize() throws Exception { MessagingEndpointProperties model = BinaryData .fromString( - "{\"lockDurationAsIso8601\":\"PT61H42M35S\",\"ttlAsIso8601\":\"PT18H25M44S\",\"maxDeliveryCount\":1688727412}") + "{\"lockDurationAsIso8601\":\"PT135H19M21S\",\"ttlAsIso8601\":\"PT18M41S\",\"maxDeliveryCount\":1400002261}") .toObject(MessagingEndpointProperties.class); - Assertions.assertEquals(Duration.parse("PT61H42M35S"), model.lockDurationAsIso8601()); - Assertions.assertEquals(Duration.parse("PT18H25M44S"), model.ttlAsIso8601()); - Assertions.assertEquals(1688727412, model.maxDeliveryCount()); + Assertions.assertEquals(Duration.parse("PT135H19M21S"), model.lockDurationAsIso8601()); + Assertions.assertEquals(Duration.parse("PT18M41S"), model.ttlAsIso8601()); + Assertions.assertEquals(1400002261, model.maxDeliveryCount()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { MessagingEndpointProperties model = new MessagingEndpointProperties() - .withLockDurationAsIso8601(Duration.parse("PT61H42M35S")) - .withTtlAsIso8601(Duration.parse("PT18H25M44S")) - .withMaxDeliveryCount(1688727412); + .withLockDurationAsIso8601(Duration.parse("PT135H19M21S")) + .withTtlAsIso8601(Duration.parse("PT18M41S")) + .withMaxDeliveryCount(1400002261); model = BinaryData.fromObject(model).toObject(MessagingEndpointProperties.class); - Assertions.assertEquals(Duration.parse("PT61H42M35S"), model.lockDurationAsIso8601()); - Assertions.assertEquals(Duration.parse("PT18H25M44S"), model.ttlAsIso8601()); - Assertions.assertEquals(1688727412, model.maxDeliveryCount()); + Assertions.assertEquals(Duration.parse("PT135H19M21S"), model.lockDurationAsIso8601()); + Assertions.assertEquals(Duration.parse("PT18M41S"), model.ttlAsIso8601()); + Assertions.assertEquals(1400002261, model.maxDeliveryCount()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/NameTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/NameTests.java index 04edc5aef8cf..48bd68fb3e8c 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/NameTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/NameTests.java @@ -12,18 +12,16 @@ public final class NameTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { Name model = - BinaryData - .fromString("{\"value\":\"gktrmgucnapkte\",\"localizedValue\":\"llwptfdy\"}") - .toObject(Name.class); - Assertions.assertEquals("gktrmgucnapkte", model.value()); - Assertions.assertEquals("llwptfdy", model.localizedValue()); + BinaryData.fromString("{\"value\":\"fbkrvrnsvs\",\"localizedValue\":\"johxcrsb\"}").toObject(Name.class); + Assertions.assertEquals("fbkrvrnsvs", model.value()); + Assertions.assertEquals("johxcrsb", model.localizedValue()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - Name model = new Name().withValue("gktrmgucnapkte").withLocalizedValue("llwptfdy"); + Name model = new Name().withValue("fbkrvrnsvs").withLocalizedValue("johxcrsb"); model = BinaryData.fromObject(model).toObject(Name.class); - Assertions.assertEquals("gktrmgucnapkte", model.value()); - Assertions.assertEquals("llwptfdy", model.localizedValue()); + Assertions.assertEquals("fbkrvrnsvs", model.value()); + Assertions.assertEquals("johxcrsb", model.localizedValue()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/OperationInputsTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/OperationInputsTests.java index 6ef78cd8ea4e..863bc6b3110a 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/OperationInputsTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/OperationInputsTests.java @@ -11,14 +11,15 @@ public final class OperationInputsTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - OperationInputs model = BinaryData.fromString("{\"name\":\"touwaboekqv\"}").toObject(OperationInputs.class); - Assertions.assertEquals("touwaboekqv", model.name()); + OperationInputs model = + BinaryData.fromString("{\"name\":\"itxmedjvcslynqww\"}").toObject(OperationInputs.class); + Assertions.assertEquals("itxmedjvcslynqww", model.name()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - OperationInputs model = new OperationInputs().withName("touwaboekqv"); + OperationInputs model = new OperationInputs().withName("itxmedjvcslynqww"); model = BinaryData.fromObject(model).toObject(OperationInputs.class); - Assertions.assertEquals("touwaboekqv", model.name()); + Assertions.assertEquals("itxmedjvcslynqww", model.name()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/OperationsListMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/OperationsListMockTests.java index 4bbe3a9cb3fc..876001e9a6a3 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/OperationsListMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/OperationsListMockTests.java @@ -31,7 +31,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"name\":\"xdy\",\"display\":{\"provider\":\"y\",\"resource\":\"ogjltdtbnnhad\",\"operation\":\"crkvcikhnv\",\"description\":\"mqg\"}}]}"; + "{\"value\":[{\"name\":\"ytdw\",\"display\":{\"provider\":\"rqubpaxhexiil\",\"resource\":\"pdtii\",\"operation\":\"tdqoaxoruzfgsq\",\"description\":\"fxrxxle\"}}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsDeleteMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsDeleteMockTests.java index 5bdc17b521b9..ec543d2b42c6 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsDeleteMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsDeleteMockTests.java @@ -32,7 +32,7 @@ public void testDelete() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"privateEndpoint\":{\"id\":\"ubkwdle\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"d\",\"actionsRequired\":\"tujbazpju\"}},\"id\":\"hminyflnorwmduv\",\"name\":\"pklvxw\",\"type\":\"ygdxpgpqchis\"}"; + "{\"properties\":{\"privateEndpoint\":{\"id\":\"ibyowbblgyavutp\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"joxoism\",\"actionsRequired\":\"sbpimlq\"}},\"id\":\"ljxkcgxxlx\",\"name\":\"ffgcvizqz\",\"type\":\"wlvwlyoupf\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,14 +63,13 @@ public void testDelete() throws Exception { PrivateEndpointConnection response = manager .privateEndpointConnections() - .delete("kahzo", "ajjziuxxpshne", "kulfg", com.azure.core.util.Context.NONE); + .delete("rrilbywdxsmic", "wrwfscjfnyns", "qujizdvo", com.azure.core.util.Context.NONE); Assertions .assertEquals( - PrivateLinkServiceConnectionStatus.PENDING, + PrivateLinkServiceConnectionStatus.APPROVED, response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("d", response.properties().privateLinkServiceConnectionState().description()); - Assertions - .assertEquals("tujbazpju", response.properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("joxoism", response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("sbpimlq", response.properties().privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java index 850119b6c093..48233a7bfaed 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java @@ -32,7 +32,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"privateEndpoint\":{\"id\":\"tbaxk\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"ywrckp\",\"actionsRequired\":\"lyhpluodpvruud\"}},\"id\":\"gzibthostgktstv\",\"name\":\"xeclzedqbcvhzlhp\",\"type\":\"odqkdlwwqfb\"}"; + "{\"properties\":{\"privateEndpoint\":{\"id\":\"wmd\"},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"wpklvxw\",\"actionsRequired\":\"gdxpg\"}},\"id\":\"qchiszep\",\"name\":\"nb\",\"type\":\"crxgibb\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,16 +63,14 @@ public void testGetWithResponse() throws Exception { PrivateEndpointConnection response = manager .privateEndpointConnections() - .getWithResponse("sdshmkxmaehvb", "xu", "iplt", com.azure.core.util.Context.NONE) + .getWithResponse("d", "utujba", "pjuohminyfl", com.azure.core.util.Context.NONE) .getValue(); Assertions .assertEquals( - PrivateLinkServiceConnectionStatus.PENDING, + PrivateLinkServiceConnectionStatus.DISCONNECTED, response.properties().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("ywrckp", response.properties().privateLinkServiceConnectionState().description()); - Assertions - .assertEquals( - "lyhpluodpvruud", response.properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("wpklvxw", response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("gdxpg", response.properties().privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsListWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsListWithResponseMockTests.java index 750eac435338..bd0a9386e380 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsListWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsListWithResponseMockTests.java @@ -13,10 +13,12 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.models.PrivateEndpointConnection; +import com.azure.resourcemanager.iothub.models.PrivateLinkServiceConnectionStatus; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.util.List; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -31,7 +33,7 @@ public void testListWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "[{\"properties\":{},\"id\":\"qgaifmviklbydv\",\"name\":\"hbejdznxcvdsrhnj\",\"type\":\"volvtn\"},{\"properties\":{},\"id\":\"qfzgemjdftul\",\"name\":\"ltducea\",\"type\":\"tmczuomejwcwwqi\"},{\"properties\":{},\"id\":\"nssxmojmsvpk\",\"name\":\"prvkwcfzqljyxgtc\",\"type\":\"heyd\"}]"; + "[{\"properties\":{\"privateEndpoint\":{\"id\":\"slesjcbhernnt\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"w\",\"actionsRequired\":\"cv\"}},\"id\":\"quwrbehwag\",\"name\":\"hbuffkmrq\",\"type\":\"mvvhmxtdrjfuta\"},{\"properties\":{\"privateEndpoint\":{\"id\":\"bj\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"wzcjznmwcpmgua\",\"actionsRequired\":\"raufactkahzova\"}},\"id\":\"j\",\"name\":\"iuxxpshneekulfg\",\"type\":\"lqubkwdlen\"}]"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,7 +64,15 @@ public void testListWithResponse() throws Exception { List response = manager .privateEndpointConnections() - .listWithResponse("fmznba", "qphchqnrnrpxehuw", com.azure.core.util.Context.NONE) + .listWithResponse("yeua", "jkqa", com.azure.core.util.Context.NONE) .getValue(); + + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.REJECTED, + response.get(0).properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("w", response.get(0).properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("cv", response.get(0).properties().privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsUpdateMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsUpdateMockTests.java index 883a23e14bb3..b2f06a84a576 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsUpdateMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateEndpointConnectionsUpdateMockTests.java @@ -36,7 +36,7 @@ public void testUpdate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"privateEndpoint\":{\"id\":\"quwrbehwag\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"buffkmrqemvvhm\",\"actionsRequired\":\"drjf\"}},\"id\":\"tac\",\"name\":\"ebjvewzcjzn\",\"type\":\"wcpmguaadraufac\"}"; + "{\"properties\":{\"privateEndpoint\":{\"id\":\"vcyy\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"fgdo\",\"actionsRequired\":\"ubiipuipwoqonma\"}},\"id\":\"jeknizshq\",\"name\":\"cimpevfg\",\"type\":\"b\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -68,26 +68,27 @@ public void testUpdate() throws Exception { manager .privateEndpointConnections() .update( - "mlkxtrqjfs", - "lmbtxhwgfwsrt", - "wcoezbrhub", + "axconfozauo", + "sukokwbqplhl", + "nuuepzlrp", new PrivateEndpointConnectionInner() .withProperties( new PrivateEndpointConnectionProperties() .withPrivateEndpoint(new PrivateEndpoint()) .withPrivateLinkServiceConnectionState( new PrivateLinkServiceConnectionState() - .withStatus(PrivateLinkServiceConnectionStatus.APPROVED) - .withDescription("qfqjbvleorfm") - .withActionsRequired("iqtqzfavyvnq"))), + .withStatus(PrivateLinkServiceConnectionStatus.REJECTED) + .withDescription("nrwrbiork") + .withActionsRequired("lywjhh"))), com.azure.core.util.Context.NONE); Assertions .assertEquals( - PrivateLinkServiceConnectionStatus.REJECTED, + PrivateLinkServiceConnectionStatus.PENDING, response.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("fgdo", response.properties().privateLinkServiceConnectionState().description()); Assertions - .assertEquals("buffkmrqemvvhm", response.properties().privateLinkServiceConnectionState().description()); - Assertions.assertEquals("drjf", response.properties().privateLinkServiceConnectionState().actionsRequired()); + .assertEquals( + "ubiipuipwoqonma", response.properties().privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesInnerTests.java index 4a8acf0aec6a..8e12e76db06a 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesInnerTests.java @@ -17,9 +17,11 @@ public void testDeserialize() throws Exception { PrivateLinkResourcesInner model = BinaryData .fromString( - "{\"value\":[{\"id\":\"kuwhh\",\"name\":\"ykojoxafnndlpic\",\"type\":\"o\",\"properties\":{\"groupId\":\"kcdyhbpk\",\"requiredMembers\":[],\"requiredZoneNames\":[]}},{\"id\":\"reqnovvqfov\",\"name\":\"xywsuws\",\"type\":\"s\",\"properties\":{\"groupId\":\"sytgadgvraea\",\"requiredMembers\":[],\"requiredZoneNames\":[]}}]}") + "{\"value\":[{\"id\":\"ohgwxrtfudxepxg\",\"name\":\"agvrvmnpkuk\",\"type\":\"i\",\"properties\":{\"groupId\":\"blxgwimf\",\"requiredMembers\":[\"fjxwmsz\"],\"requiredZoneNames\":[\"oqreyfkzikfjawn\",\"a\",\"vxwc\"]}},{\"id\":\"lpcirelsf\",\"name\":\"enwabfatk\",\"type\":\"dxbjhwuaanozj\",\"properties\":{\"groupId\":\"ph\",\"requiredMembers\":[\"l\",\"jrvxaglrv\"],\"requiredZoneNames\":[\"wosytxitcskf\",\"k\",\"qumiek\",\"ez\"]}},{\"id\":\"khly\",\"name\":\"hdgqggeb\",\"type\":\"nyga\",\"properties\":{\"groupId\":\"idb\",\"requiredMembers\":[\"t\",\"xllrxcyjm\"],\"requiredZoneNames\":[\"su\",\"arm\",\"wdmjsjqbjhhyx\",\"rw\"]}}]}") .toObject(PrivateLinkResourcesInner.class); - Assertions.assertEquals("kcdyhbpk", model.value().get(0).properties().groupId()); + Assertions.assertEquals("blxgwimf", model.value().get(0).properties().groupId()); + Assertions.assertEquals("fjxwmsz", model.value().get(0).properties().requiredMembers().get(0)); + Assertions.assertEquals("oqreyfkzikfjawn", model.value().get(0).properties().requiredZoneNames().get(0)); } @org.junit.jupiter.api.Test @@ -32,16 +34,24 @@ public void testSerialize() throws Exception { new GroupIdInformationInner() .withProperties( new GroupIdInformationProperties() - .withGroupId("kcdyhbpk") - .withRequiredMembers(Arrays.asList()) - .withRequiredZoneNames(Arrays.asList())), + .withGroupId("blxgwimf") + .withRequiredMembers(Arrays.asList("fjxwmsz")) + .withRequiredZoneNames(Arrays.asList("oqreyfkzikfjawn", "a", "vxwc"))), new GroupIdInformationInner() .withProperties( new GroupIdInformationProperties() - .withGroupId("sytgadgvraea") - .withRequiredMembers(Arrays.asList()) - .withRequiredZoneNames(Arrays.asList())))); + .withGroupId("ph") + .withRequiredMembers(Arrays.asList("l", "jrvxaglrv")) + .withRequiredZoneNames(Arrays.asList("wosytxitcskf", "k", "qumiek", "ez"))), + new GroupIdInformationInner() + .withProperties( + new GroupIdInformationProperties() + .withGroupId("idb") + .withRequiredMembers(Arrays.asList("t", "xllrxcyjm")) + .withRequiredZoneNames(Arrays.asList("su", "arm", "wdmjsjqbjhhyx", "rw"))))); model = BinaryData.fromObject(model).toObject(PrivateLinkResourcesInner.class); - Assertions.assertEquals("kcdyhbpk", model.value().get(0).properties().groupId()); + Assertions.assertEquals("blxgwimf", model.value().get(0).properties().groupId()); + Assertions.assertEquals("fjxwmsz", model.value().get(0).properties().requiredMembers().get(0)); + Assertions.assertEquals("oqreyfkzikfjawn", model.value().get(0).properties().requiredZoneNames().get(0)); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationsGetWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationsGetWithResponseMockTests.java index 92f619ee0810..b365734657c7 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationsGetWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationsGetWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"id\":\"sutrgjup\",\"name\":\"utpwoqhihejqgw\",\"type\":\"nfqn\",\"properties\":{\"groupId\":\"ypsxjvfoim\",\"requiredMembers\":[\"lirc\",\"zjxvydfcea\"],\"requiredZoneNames\":[\"hvygdyftumr\",\"wnawjslbiw\",\"ojgcyzt\"]}}"; + "{\"id\":\"h\",\"name\":\"odqkdlwwqfb\",\"type\":\"lkxt\",\"properties\":{\"groupId\":\"jfsmlmbtxhwgfwsr\",\"requiredMembers\":[\"coezbrhubskh\",\"dyg\",\"ookk\"],\"requiredZoneNames\":[\"jb\",\"leorfmluiqtqz\",\"avyvnqqyba\"]}}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,11 +62,11 @@ public void testGetWithResponse() throws Exception { GroupIdInformation response = manager .privateLinkResourcesOperations() - .getWithResponse("amrsreuzv", "urisjnhnytxifqj", "gxmrhublwp", com.azure.core.util.Context.NONE) + .getWithResponse("thost", "ktst", "dxeclzedqbcvh", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("ypsxjvfoim", response.properties().groupId()); - Assertions.assertEquals("lirc", response.properties().requiredMembers().get(0)); - Assertions.assertEquals("hvygdyftumr", response.properties().requiredZoneNames().get(0)); + Assertions.assertEquals("jfsmlmbtxhwgfwsr", response.properties().groupId()); + Assertions.assertEquals("coezbrhubskh", response.properties().requiredMembers().get(0)); + Assertions.assertEquals("jb", response.properties().requiredZoneNames().get(0)); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationsListWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationsListWithResponseMockTests.java index 15f380902b0b..ac7e49ac3533 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationsListWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/PrivateLinkResourcesOperationsListWithResponseMockTests.java @@ -16,6 +16,7 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -30,7 +31,7 @@ public void testListWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"id\":\"bkfezzxscyhwzdgi\",\"name\":\"jbzbomvzzbtdcq\",\"type\":\"niyujv\"},{\"id\":\"l\",\"name\":\"shfssnrbgyef\",\"type\":\"msgaoj\"},{\"id\":\"wncot\",\"name\":\"fhir\",\"type\":\"ymoxoftpipiwyczu\"},{\"id\":\"a\",\"name\":\"qjlihhyuspska\",\"type\":\"vlmfwdgzxulucv\"}]}"; + "{\"value\":[{\"id\":\"ph\",\"name\":\"qnrnrpxehuwryk\",\"type\":\"aifmvikl\",\"properties\":{\"groupId\":\"dvk\",\"requiredMembers\":[\"jdz\"],\"requiredZoneNames\":[\"vdsrhnjiv\",\"lvtno\"]}},{\"id\":\"fzg\",\"name\":\"jdftuljltd\",\"type\":\"eamtmcz\",\"properties\":{\"groupId\":\"m\",\"requiredMembers\":[\"cwwqiokn\"],\"requiredZoneNames\":[\"mojmsvpkjprvkw\",\"fz\",\"ljyxgtczhe\"]}},{\"id\":\"bsdshmkxmaehvbbx\",\"name\":\"iplt\",\"type\":\"htba\",\"properties\":{\"groupId\":\"gx\",\"requiredMembers\":[\"ckpyklyhplu\"],\"requiredZoneNames\":[\"vruu\",\"lgzi\"]}}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,7 +62,11 @@ public void testListWithResponse() throws Exception { PrivateLinkResources response = manager .privateLinkResourcesOperations() - .listWithResponse("gjmfxumvfcl", "yo", com.azure.core.util.Context.NONE) + .listWithResponse("jslb", "wkojgcyztsfmzn", com.azure.core.util.Context.NONE) .getValue(); + + Assertions.assertEquals("dvk", response.value().get(0).properties().groupId()); + Assertions.assertEquals("jdz", response.value().get(0).properties().requiredMembers().get(0)); + Assertions.assertEquals("vdsrhnjiv", response.value().get(0).properties().requiredZoneNames().get(0)); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RegistryStatisticsInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RegistryStatisticsInnerTests.java index 4c50c3f4fe7a..0d9d4f18338b 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RegistryStatisticsInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RegistryStatisticsInnerTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { RegistryStatisticsInner model = BinaryData .fromString( - "{\"totalDeviceCount\":8751195016646991326,\"enabledDeviceCount\":1457030135916183053,\"disabledDeviceCount\":6300383751543557162}") + "{\"totalDeviceCount\":6450730438848589350,\"enabledDeviceCount\":5798583815536033606,\"disabledDeviceCount\":7014692184557191333}") .toObject(RegistryStatisticsInner.class); } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ResourceProviderCommonsGetSubscriptionQuotaWithResponseMockTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ResourceProviderCommonsGetSubscriptionQuotaWithResponseMockTests.java index 72d210e21ceb..968044b9094e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ResourceProviderCommonsGetSubscriptionQuotaWithResponseMockTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/ResourceProviderCommonsGetSubscriptionQuotaWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetSubscriptionQuotaWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"id\":\"lvrwxkvtkk\",\"type\":\"lqwjygvjayvblm\",\"unit\":\"k\",\"currentValue\":2100624724,\"limit\":919724990}],\"nextLink\":\"yhgsopbyrqufe\"}"; + "{\"value\":[{\"id\":\"m\",\"type\":\"elfk\",\"unit\":\"plcrpwjxeznoig\",\"currentValue\":1629929143,\"limit\":78326163,\"name\":{\"value\":\"kpnb\",\"localizedValue\":\"zejjoqk\"}},{\"id\":\"fhsxttaugz\",\"type\":\"faazpxdtnkdmkqjj\",\"unit\":\"uenvrkp\",\"currentValue\":1149694160,\"limit\":1074259109,\"name\":{\"value\":\"ebqaaysjkixqtnq\",\"localizedValue\":\"ezl\"}},{\"id\":\"ffiakp\",\"type\":\"qqmtedltmmji\",\"unit\":\"eozphv\",\"currentValue\":1760801565,\"limit\":404997188,\"name\":{\"value\":\"ygupkv\",\"localizedValue\":\"mdscwxqupev\"}}],\"nextLink\":\"f\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -65,10 +65,12 @@ public void testGetSubscriptionQuotaWithResponse() throws Exception { .getSubscriptionQuotaWithResponse(com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("lvrwxkvtkk", response.value().get(0).id()); - Assertions.assertEquals("lqwjygvjayvblm", response.value().get(0).type()); - Assertions.assertEquals("k", response.value().get(0).unit()); - Assertions.assertEquals(2100624724, response.value().get(0).currentValue()); - Assertions.assertEquals(919724990, response.value().get(0).limit()); + Assertions.assertEquals("m", response.value().get(0).id()); + Assertions.assertEquals("elfk", response.value().get(0).type()); + Assertions.assertEquals("plcrpwjxeznoig", response.value().get(0).unit()); + Assertions.assertEquals(1629929143, response.value().get(0).currentValue()); + Assertions.assertEquals(78326163, response.value().get(0).limit()); + Assertions.assertEquals("kpnb", response.value().get(0).name().value()); + Assertions.assertEquals("zejjoqk", response.value().get(0).name().localizedValue()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RootCertificatePropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RootCertificatePropertiesTests.java deleted file mode 100644 index f448465f5771..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RootCertificatePropertiesTests.java +++ /dev/null @@ -1,27 +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.resourcemanager.iothub.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.iothub.models.RootCertificateProperties; -import org.junit.jupiter.api.Assertions; - -public final class RootCertificatePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RootCertificateProperties model = - BinaryData - .fromString("{\"enableRootCertificateV2\":false,\"lastUpdatedTimeUtc\":\"2021-01-10T16:47:02Z\"}") - .toObject(RootCertificateProperties.class); - Assertions.assertEquals(false, model.enableRootCertificateV2()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RootCertificateProperties model = new RootCertificateProperties().withEnableRootCertificateV2(false); - model = BinaryData.fromObject(model).toObject(RootCertificateProperties.class); - Assertions.assertEquals(false, model.enableRootCertificateV2()); - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteCompilationErrorTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteCompilationErrorTests.java index b46be8b5e637..6c7c23935621 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteCompilationErrorTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteCompilationErrorTests.java @@ -17,32 +17,32 @@ public void testDeserialize() throws Exception { RouteCompilationError model = BinaryData .fromString( - "{\"message\":\"dsjnka\",\"severity\":\"warning\",\"location\":{\"start\":{\"line\":600848345,\"column\":1914741160},\"end\":{\"line\":1975902978,\"column\":2043531661}}}") + "{\"message\":\"xvy\",\"severity\":\"error\",\"location\":{\"start\":{\"line\":11863753,\"column\":1364703724},\"end\":{\"line\":664596221,\"column\":107340083}}}") .toObject(RouteCompilationError.class); - Assertions.assertEquals("dsjnka", model.message()); - Assertions.assertEquals(RouteErrorSeverity.WARNING, model.severity()); - Assertions.assertEquals(600848345, model.location().start().line()); - Assertions.assertEquals(1914741160, model.location().start().column()); - Assertions.assertEquals(1975902978, model.location().end().line()); - Assertions.assertEquals(2043531661, model.location().end().column()); + Assertions.assertEquals("xvy", model.message()); + Assertions.assertEquals(RouteErrorSeverity.ERROR, model.severity()); + Assertions.assertEquals(11863753, model.location().start().line()); + Assertions.assertEquals(1364703724, model.location().start().column()); + Assertions.assertEquals(664596221, model.location().end().line()); + Assertions.assertEquals(107340083, model.location().end().column()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RouteCompilationError model = new RouteCompilationError() - .withMessage("dsjnka") - .withSeverity(RouteErrorSeverity.WARNING) + .withMessage("xvy") + .withSeverity(RouteErrorSeverity.ERROR) .withLocation( new RouteErrorRange() - .withStart(new RouteErrorPosition().withLine(600848345).withColumn(1914741160)) - .withEnd(new RouteErrorPosition().withLine(1975902978).withColumn(2043531661))); + .withStart(new RouteErrorPosition().withLine(11863753).withColumn(1364703724)) + .withEnd(new RouteErrorPosition().withLine(664596221).withColumn(107340083))); model = BinaryData.fromObject(model).toObject(RouteCompilationError.class); - Assertions.assertEquals("dsjnka", model.message()); - Assertions.assertEquals(RouteErrorSeverity.WARNING, model.severity()); - Assertions.assertEquals(600848345, model.location().start().line()); - Assertions.assertEquals(1914741160, model.location().start().column()); - Assertions.assertEquals(1975902978, model.location().end().line()); - Assertions.assertEquals(2043531661, model.location().end().column()); + Assertions.assertEquals("xvy", model.message()); + Assertions.assertEquals(RouteErrorSeverity.ERROR, model.severity()); + Assertions.assertEquals(11863753, model.location().start().line()); + Assertions.assertEquals(1364703724, model.location().start().column()); + Assertions.assertEquals(664596221, model.location().end().line()); + Assertions.assertEquals(107340083, model.location().end().column()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteErrorPositionTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteErrorPositionTests.java index d88ccda0380d..b4896552a8ad 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteErrorPositionTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteErrorPositionTests.java @@ -12,16 +12,16 @@ public final class RouteErrorPositionTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { RouteErrorPosition model = - BinaryData.fromString("{\"line\":875285248,\"column\":1367629772}").toObject(RouteErrorPosition.class); - Assertions.assertEquals(875285248, model.line()); - Assertions.assertEquals(1367629772, model.column()); + BinaryData.fromString("{\"line\":478734436,\"column\":829612504}").toObject(RouteErrorPosition.class); + Assertions.assertEquals(478734436, model.line()); + Assertions.assertEquals(829612504, model.column()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - RouteErrorPosition model = new RouteErrorPosition().withLine(875285248).withColumn(1367629772); + RouteErrorPosition model = new RouteErrorPosition().withLine(478734436).withColumn(829612504); model = BinaryData.fromObject(model).toObject(RouteErrorPosition.class); - Assertions.assertEquals(875285248, model.line()); - Assertions.assertEquals(1367629772, model.column()); + Assertions.assertEquals(478734436, model.line()); + Assertions.assertEquals(829612504, model.column()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteErrorRangeTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteErrorRangeTests.java index ee095b5ca31b..c0e02f6ee6c6 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteErrorRangeTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RouteErrorRangeTests.java @@ -15,24 +15,24 @@ public void testDeserialize() throws Exception { RouteErrorRange model = BinaryData .fromString( - "{\"start\":{\"line\":900444322,\"column\":1157139188},\"end\":{\"line\":2137392775,\"column\":1769895546}}") + "{\"start\":{\"line\":996289807,\"column\":1448079009},\"end\":{\"line\":608982569,\"column\":146904581}}") .toObject(RouteErrorRange.class); - Assertions.assertEquals(900444322, model.start().line()); - Assertions.assertEquals(1157139188, model.start().column()); - Assertions.assertEquals(2137392775, model.end().line()); - Assertions.assertEquals(1769895546, model.end().column()); + Assertions.assertEquals(996289807, model.start().line()); + Assertions.assertEquals(1448079009, model.start().column()); + Assertions.assertEquals(608982569, model.end().line()); + Assertions.assertEquals(146904581, model.end().column()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RouteErrorRange model = new RouteErrorRange() - .withStart(new RouteErrorPosition().withLine(900444322).withColumn(1157139188)) - .withEnd(new RouteErrorPosition().withLine(2137392775).withColumn(1769895546)); + .withStart(new RouteErrorPosition().withLine(996289807).withColumn(1448079009)) + .withEnd(new RouteErrorPosition().withLine(608982569).withColumn(146904581)); model = BinaryData.fromObject(model).toObject(RouteErrorRange.class); - Assertions.assertEquals(900444322, model.start().line()); - Assertions.assertEquals(1157139188, model.start().column()); - Assertions.assertEquals(2137392775, model.end().line()); - Assertions.assertEquals(1769895546, model.end().column()); + Assertions.assertEquals(996289807, model.start().line()); + Assertions.assertEquals(1448079009, model.start().column()); + Assertions.assertEquals(608982569, model.end().line()); + Assertions.assertEquals(146904581, model.end().column()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutePropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutePropertiesTests.java index 68207e7e9d52..de4f14759658 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutePropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutePropertiesTests.java @@ -16,29 +16,29 @@ public void testDeserialize() throws Exception { RouteProperties model = BinaryData .fromString( - "{\"name\":\"uzoqft\",\"source\":\"DeviceConnectionStateEvents\",\"condition\":\"zrnkcqvyxlwh\",\"endpointNames\":[\"sicohoqqnwvlry\",\"vwhheunmmqhgyx\",\"konocu\"],\"isEnabled\":true}") + "{\"name\":\"dbhrbnlankxm\",\"source\":\"TwinChangeEvents\",\"condition\":\"pbh\",\"endpointNames\":[\"btkcxywnytnrsyn\",\"qidybyx\",\"zfcl\",\"aaxdbabphlwrq\"],\"isEnabled\":false}") .toObject(RouteProperties.class); - Assertions.assertEquals("uzoqft", model.name()); - Assertions.assertEquals(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS, model.source()); - Assertions.assertEquals("zrnkcqvyxlwh", model.condition()); - Assertions.assertEquals("sicohoqqnwvlry", model.endpointNames().get(0)); - Assertions.assertEquals(true, model.isEnabled()); + Assertions.assertEquals("dbhrbnlankxm", model.name()); + Assertions.assertEquals(RoutingSource.TWIN_CHANGE_EVENTS, model.source()); + Assertions.assertEquals("pbh", model.condition()); + Assertions.assertEquals("btkcxywnytnrsyn", model.endpointNames().get(0)); + Assertions.assertEquals(false, model.isEnabled()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RouteProperties model = new RouteProperties() - .withName("uzoqft") - .withSource(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS) - .withCondition("zrnkcqvyxlwh") - .withEndpointNames(Arrays.asList("sicohoqqnwvlry", "vwhheunmmqhgyx", "konocu")) - .withIsEnabled(true); + .withName("dbhrbnlankxm") + .withSource(RoutingSource.TWIN_CHANGE_EVENTS) + .withCondition("pbh") + .withEndpointNames(Arrays.asList("btkcxywnytnrsyn", "qidybyx", "zfcl", "aaxdbabphlwrq")) + .withIsEnabled(false); model = BinaryData.fromObject(model).toObject(RouteProperties.class); - Assertions.assertEquals("uzoqft", model.name()); - Assertions.assertEquals(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS, model.source()); - Assertions.assertEquals("zrnkcqvyxlwh", model.condition()); - Assertions.assertEquals("sicohoqqnwvlry", model.endpointNames().get(0)); - Assertions.assertEquals(true, model.isEnabled()); + Assertions.assertEquals("dbhrbnlankxm", model.name()); + Assertions.assertEquals(RoutingSource.TWIN_CHANGE_EVENTS, model.source()); + Assertions.assertEquals("pbh", model.condition()); + Assertions.assertEquals("btkcxywnytnrsyn", model.endpointNames().get(0)); + Assertions.assertEquals(false, model.isEnabled()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingEventHubPropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingEventHubPropertiesTests.java index 3fc1631b02bc..859f9ae1cb5f 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingEventHubPropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingEventHubPropertiesTests.java @@ -16,41 +16,41 @@ public void testDeserialize() throws Exception { RoutingEventHubProperties model = BinaryData .fromString( - "{\"id\":\"mjmvxieduugidyjr\",\"connectionString\":\"byao\",\"endpointUri\":\"e\",\"entityPath\":\"sonpclhocohs\",\"authenticationType\":\"keyBased\",\"identity\":{\"userAssignedIdentity\":\"eggzfb\"},\"name\":\"hfmvfaxkffe\",\"subscriptionId\":\"th\",\"resourceGroup\":\"m\"}") + "{\"id\":\"onuq\",\"connectionString\":\"fkbey\",\"endpointUri\":\"wrmjmwvvjektc\",\"entityPath\":\"enhwlrs\",\"authenticationType\":\"identityBased\",\"identity\":{\"userAssignedIdentity\":\"wvlqdqgb\"},\"name\":\"qylihkaetckt\",\"subscriptionId\":\"civfsnkymuctq\",\"resourceGroup\":\"fbebrjcxer\"}") .toObject(RoutingEventHubProperties.class); - Assertions.assertEquals("mjmvxieduugidyjr", model.id()); - Assertions.assertEquals("byao", model.connectionString()); - Assertions.assertEquals("e", model.endpointUri()); - Assertions.assertEquals("sonpclhocohs", model.entityPath()); - Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); - Assertions.assertEquals("eggzfb", model.identity().userAssignedIdentity()); - Assertions.assertEquals("hfmvfaxkffe", model.name()); - Assertions.assertEquals("th", model.subscriptionId()); - Assertions.assertEquals("m", model.resourceGroup()); + Assertions.assertEquals("onuq", model.id()); + Assertions.assertEquals("fkbey", model.connectionString()); + Assertions.assertEquals("wrmjmwvvjektc", model.endpointUri()); + Assertions.assertEquals("enhwlrs", model.entityPath()); + Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); + Assertions.assertEquals("wvlqdqgb", model.identity().userAssignedIdentity()); + Assertions.assertEquals("qylihkaetckt", model.name()); + Assertions.assertEquals("civfsnkymuctq", model.subscriptionId()); + Assertions.assertEquals("fbebrjcxer", model.resourceGroup()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RoutingEventHubProperties model = new RoutingEventHubProperties() - .withId("mjmvxieduugidyjr") - .withConnectionString("byao") - .withEndpointUri("e") - .withEntityPath("sonpclhocohs") - .withAuthenticationType(AuthenticationType.KEY_BASED) - .withIdentity(new ManagedIdentity().withUserAssignedIdentity("eggzfb")) - .withName("hfmvfaxkffe") - .withSubscriptionId("th") - .withResourceGroup("m"); + .withId("onuq") + .withConnectionString("fkbey") + .withEndpointUri("wrmjmwvvjektc") + .withEntityPath("enhwlrs") + .withAuthenticationType(AuthenticationType.IDENTITY_BASED) + .withIdentity(new ManagedIdentity().withUserAssignedIdentity("wvlqdqgb")) + .withName("qylihkaetckt") + .withSubscriptionId("civfsnkymuctq") + .withResourceGroup("fbebrjcxer"); model = BinaryData.fromObject(model).toObject(RoutingEventHubProperties.class); - Assertions.assertEquals("mjmvxieduugidyjr", model.id()); - Assertions.assertEquals("byao", model.connectionString()); - Assertions.assertEquals("e", model.endpointUri()); - Assertions.assertEquals("sonpclhocohs", model.entityPath()); - Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); - Assertions.assertEquals("eggzfb", model.identity().userAssignedIdentity()); - Assertions.assertEquals("hfmvfaxkffe", model.name()); - Assertions.assertEquals("th", model.subscriptionId()); - Assertions.assertEquals("m", model.resourceGroup()); + Assertions.assertEquals("onuq", model.id()); + Assertions.assertEquals("fkbey", model.connectionString()); + Assertions.assertEquals("wrmjmwvvjektc", model.endpointUri()); + Assertions.assertEquals("enhwlrs", model.entityPath()); + Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); + Assertions.assertEquals("wvlqdqgb", model.identity().userAssignedIdentity()); + Assertions.assertEquals("qylihkaetckt", model.name()); + Assertions.assertEquals("civfsnkymuctq", model.subscriptionId()); + Assertions.assertEquals("fbebrjcxer", model.resourceGroup()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingMessageTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingMessageTests.java index ab3f5e9b4ecc..1930fb6b9a7e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingMessageTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingMessageTests.java @@ -16,27 +16,28 @@ public void testDeserialize() throws Exception { RoutingMessage model = BinaryData .fromString( - "{\"body\":\"xoblytkbl\",\"appProperties\":{\"rn\":\"wwwfbkr\",\"bfovasrruvwbhsq\":\"vshqjohxcr\",\"gjb\":\"sub\",\"rfbjf\":\"rxbpyb\"},\"systemProperties\":{\"zbexilzznfqqnvw\":\"ssotftpv\"}}") + "{\"body\":\"aolps\",\"appProperties\":{\"d\":\"lfmmdnbbglzpswi\",\"bzmnvdfznud\":\"cwyhzdxssa\",\"xzb\":\"od\"},\"systemProperties\":{\"hxsrzdzucersc\":\"lylpstdb\",\"iwjmygtdssls\":\"ntnev\",\"emwabnet\":\"tmweriofzpyq\"}}") .toObject(RoutingMessage.class); - Assertions.assertEquals("xoblytkbl", model.body()); - Assertions.assertEquals("wwwfbkr", model.appProperties().get("rn")); - Assertions.assertEquals("ssotftpv", model.systemProperties().get("zbexilzznfqqnvw")); + Assertions.assertEquals("aolps", model.body()); + Assertions.assertEquals("lfmmdnbbglzpswi", model.appProperties().get("d")); + Assertions.assertEquals("lylpstdb", model.systemProperties().get("hxsrzdzucersc")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RoutingMessage model = new RoutingMessage() - .withBody("xoblytkbl") - .withAppProperties( - mapOf("rn", "wwwfbkr", "bfovasrruvwbhsq", "vshqjohxcr", "gjb", "sub", "rfbjf", "rxbpyb")) - .withSystemProperties(mapOf("zbexilzznfqqnvw", "ssotftpv")); + .withBody("aolps") + .withAppProperties(mapOf("d", "lfmmdnbbglzpswi", "bzmnvdfznud", "cwyhzdxssa", "xzb", "od")) + .withSystemProperties( + mapOf("hxsrzdzucersc", "lylpstdb", "iwjmygtdssls", "ntnev", "emwabnet", "tmweriofzpyq")); model = BinaryData.fromObject(model).toObject(RoutingMessage.class); - Assertions.assertEquals("xoblytkbl", model.body()); - Assertions.assertEquals("wwwfbkr", model.appProperties().get("rn")); - Assertions.assertEquals("ssotftpv", model.systemProperties().get("zbexilzznfqqnvw")); + Assertions.assertEquals("aolps", model.body()); + Assertions.assertEquals("lfmmdnbbglzpswi", model.appProperties().get("d")); + Assertions.assertEquals("lylpstdb", model.systemProperties().get("hxsrzdzucersc")); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingServiceBusQueueEndpointPropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingServiceBusQueueEndpointPropertiesTests.java index c992353afbc0..b83e992593d6 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingServiceBusQueueEndpointPropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingServiceBusQueueEndpointPropertiesTests.java @@ -16,41 +16,41 @@ public void testDeserialize() throws Exception { RoutingServiceBusQueueEndpointProperties model = BinaryData .fromString( - "{\"id\":\"aodsfcpkv\",\"connectionString\":\"dpuozmyz\",\"endpointUri\":\"agfuaxbezyiu\",\"entityPath\":\"ktwh\",\"authenticationType\":\"keyBased\",\"identity\":{\"userAssignedIdentity\":\"ywqsmbsurexim\"},\"name\":\"ryocfsfksymdd\",\"subscriptionId\":\"tki\",\"resourceGroup\":\"xhqyudxorrqnb\"}") + "{\"id\":\"pazyxoegukg\",\"connectionString\":\"piu\",\"endpointUri\":\"ygevqzntypmrbpiz\",\"entityPath\":\"r\",\"authenticationType\":\"identityBased\",\"identity\":{\"userAssignedIdentity\":\"ydnfyhxdeoejz\"},\"name\":\"cwif\",\"subscriptionId\":\"ttgzfbis\",\"resourceGroup\":\"bkh\"}") .toObject(RoutingServiceBusQueueEndpointProperties.class); - Assertions.assertEquals("aodsfcpkv", model.id()); - Assertions.assertEquals("dpuozmyz", model.connectionString()); - Assertions.assertEquals("agfuaxbezyiu", model.endpointUri()); - Assertions.assertEquals("ktwh", model.entityPath()); - Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); - Assertions.assertEquals("ywqsmbsurexim", model.identity().userAssignedIdentity()); - Assertions.assertEquals("ryocfsfksymdd", model.name()); - Assertions.assertEquals("tki", model.subscriptionId()); - Assertions.assertEquals("xhqyudxorrqnb", model.resourceGroup()); + Assertions.assertEquals("pazyxoegukg", model.id()); + Assertions.assertEquals("piu", model.connectionString()); + Assertions.assertEquals("ygevqzntypmrbpiz", model.endpointUri()); + Assertions.assertEquals("r", model.entityPath()); + Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); + Assertions.assertEquals("ydnfyhxdeoejz", model.identity().userAssignedIdentity()); + Assertions.assertEquals("cwif", model.name()); + Assertions.assertEquals("ttgzfbis", model.subscriptionId()); + Assertions.assertEquals("bkh", model.resourceGroup()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RoutingServiceBusQueueEndpointProperties model = new RoutingServiceBusQueueEndpointProperties() - .withId("aodsfcpkv") - .withConnectionString("dpuozmyz") - .withEndpointUri("agfuaxbezyiu") - .withEntityPath("ktwh") - .withAuthenticationType(AuthenticationType.KEY_BASED) - .withIdentity(new ManagedIdentity().withUserAssignedIdentity("ywqsmbsurexim")) - .withName("ryocfsfksymdd") - .withSubscriptionId("tki") - .withResourceGroup("xhqyudxorrqnb"); + .withId("pazyxoegukg") + .withConnectionString("piu") + .withEndpointUri("ygevqzntypmrbpiz") + .withEntityPath("r") + .withAuthenticationType(AuthenticationType.IDENTITY_BASED) + .withIdentity(new ManagedIdentity().withUserAssignedIdentity("ydnfyhxdeoejz")) + .withName("cwif") + .withSubscriptionId("ttgzfbis") + .withResourceGroup("bkh"); model = BinaryData.fromObject(model).toObject(RoutingServiceBusQueueEndpointProperties.class); - Assertions.assertEquals("aodsfcpkv", model.id()); - Assertions.assertEquals("dpuozmyz", model.connectionString()); - Assertions.assertEquals("agfuaxbezyiu", model.endpointUri()); - Assertions.assertEquals("ktwh", model.entityPath()); - Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); - Assertions.assertEquals("ywqsmbsurexim", model.identity().userAssignedIdentity()); - Assertions.assertEquals("ryocfsfksymdd", model.name()); - Assertions.assertEquals("tki", model.subscriptionId()); - Assertions.assertEquals("xhqyudxorrqnb", model.resourceGroup()); + Assertions.assertEquals("pazyxoegukg", model.id()); + Assertions.assertEquals("piu", model.connectionString()); + Assertions.assertEquals("ygevqzntypmrbpiz", model.endpointUri()); + Assertions.assertEquals("r", model.entityPath()); + Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); + Assertions.assertEquals("ydnfyhxdeoejz", model.identity().userAssignedIdentity()); + Assertions.assertEquals("cwif", model.name()); + Assertions.assertEquals("ttgzfbis", model.subscriptionId()); + Assertions.assertEquals("bkh", model.resourceGroup()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingServiceBusTopicEndpointPropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingServiceBusTopicEndpointPropertiesTests.java index bc7d4bd4a8e9..e60ab8b78a45 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingServiceBusTopicEndpointPropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingServiceBusTopicEndpointPropertiesTests.java @@ -16,41 +16,41 @@ public void testDeserialize() throws Exception { RoutingServiceBusTopicEndpointProperties model = BinaryData .fromString( - "{\"id\":\"kdvjsll\",\"connectionString\":\"vvdfwatkpnpul\",\"endpointUri\":\"xbczwtruwiqz\",\"entityPath\":\"j\",\"authenticationType\":\"keyBased\",\"identity\":{\"userAssignedIdentity\":\"yokacspkw\"},\"name\":\"hzdobpxjmflbvvnc\",\"subscriptionId\":\"kcciwwzjuqkhr\",\"resourceGroup\":\"jiwkuofoskghsau\"}") + "{\"id\":\"gipwhonowkg\",\"connectionString\":\"wankixzbi\",\"endpointUri\":\"eputtmrywnuzoqf\",\"entityPath\":\"yqzrnkcqvyxlw\",\"authenticationType\":\"identityBased\",\"identity\":{\"userAssignedIdentity\":\"cohoq\"},\"name\":\"nwvlryavwhheunmm\",\"subscriptionId\":\"gyxzk\",\"resourceGroup\":\"ocukoklyax\"}") .toObject(RoutingServiceBusTopicEndpointProperties.class); - Assertions.assertEquals("kdvjsll", model.id()); - Assertions.assertEquals("vvdfwatkpnpul", model.connectionString()); - Assertions.assertEquals("xbczwtruwiqz", model.endpointUri()); - Assertions.assertEquals("j", model.entityPath()); - Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); - Assertions.assertEquals("yokacspkw", model.identity().userAssignedIdentity()); - Assertions.assertEquals("hzdobpxjmflbvvnc", model.name()); - Assertions.assertEquals("kcciwwzjuqkhr", model.subscriptionId()); - Assertions.assertEquals("jiwkuofoskghsau", model.resourceGroup()); + Assertions.assertEquals("gipwhonowkg", model.id()); + Assertions.assertEquals("wankixzbi", model.connectionString()); + Assertions.assertEquals("eputtmrywnuzoqf", model.endpointUri()); + Assertions.assertEquals("yqzrnkcqvyxlw", model.entityPath()); + Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); + Assertions.assertEquals("cohoq", model.identity().userAssignedIdentity()); + Assertions.assertEquals("nwvlryavwhheunmm", model.name()); + Assertions.assertEquals("gyxzk", model.subscriptionId()); + Assertions.assertEquals("ocukoklyax", model.resourceGroup()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RoutingServiceBusTopicEndpointProperties model = new RoutingServiceBusTopicEndpointProperties() - .withId("kdvjsll") - .withConnectionString("vvdfwatkpnpul") - .withEndpointUri("xbczwtruwiqz") - .withEntityPath("j") - .withAuthenticationType(AuthenticationType.KEY_BASED) - .withIdentity(new ManagedIdentity().withUserAssignedIdentity("yokacspkw")) - .withName("hzdobpxjmflbvvnc") - .withSubscriptionId("kcciwwzjuqkhr") - .withResourceGroup("jiwkuofoskghsau"); + .withId("gipwhonowkg") + .withConnectionString("wankixzbi") + .withEndpointUri("eputtmrywnuzoqf") + .withEntityPath("yqzrnkcqvyxlw") + .withAuthenticationType(AuthenticationType.IDENTITY_BASED) + .withIdentity(new ManagedIdentity().withUserAssignedIdentity("cohoq")) + .withName("nwvlryavwhheunmm") + .withSubscriptionId("gyxzk") + .withResourceGroup("ocukoklyax"); model = BinaryData.fromObject(model).toObject(RoutingServiceBusTopicEndpointProperties.class); - Assertions.assertEquals("kdvjsll", model.id()); - Assertions.assertEquals("vvdfwatkpnpul", model.connectionString()); - Assertions.assertEquals("xbczwtruwiqz", model.endpointUri()); - Assertions.assertEquals("j", model.entityPath()); - Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); - Assertions.assertEquals("yokacspkw", model.identity().userAssignedIdentity()); - Assertions.assertEquals("hzdobpxjmflbvvnc", model.name()); - Assertions.assertEquals("kcciwwzjuqkhr", model.subscriptionId()); - Assertions.assertEquals("jiwkuofoskghsau", model.resourceGroup()); + Assertions.assertEquals("gipwhonowkg", model.id()); + Assertions.assertEquals("wankixzbi", model.connectionString()); + Assertions.assertEquals("eputtmrywnuzoqf", model.endpointUri()); + Assertions.assertEquals("yqzrnkcqvyxlw", model.entityPath()); + Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); + Assertions.assertEquals("cohoq", model.identity().userAssignedIdentity()); + Assertions.assertEquals("nwvlryavwhheunmm", model.name()); + Assertions.assertEquals("gyxzk", model.subscriptionId()); + Assertions.assertEquals("ocukoklyax", model.resourceGroup()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingStorageContainerPropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingStorageContainerPropertiesTests.java index 683a2d945386..8003f90b3cab 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingStorageContainerPropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingStorageContainerPropertiesTests.java @@ -17,53 +17,53 @@ public void testDeserialize() throws Exception { RoutingStorageContainerProperties model = BinaryData .fromString( - "{\"id\":\"yvshxmz\",\"connectionString\":\"bzoggigrx\",\"endpointUri\":\"ur\",\"authenticationType\":\"identityBased\",\"identity\":{\"userAssignedIdentity\":\"nspydptkoenkoukn\"},\"name\":\"udwtiukbl\",\"subscriptionId\":\"gkpocipazyxoe\",\"resourceGroup\":\"kgjn\",\"containerName\":\"iucgygevqzn\",\"fileNameFormat\":\"pmr\",\"batchFrequencyInSeconds\":129742346,\"maxChunkSizeInBytes\":173387394,\"encoding\":\"Avro\"}") + "{\"id\":\"wutttxfvjrbi\",\"connectionString\":\"hxepcyvahfnlj\",\"endpointUri\":\"qxj\",\"authenticationType\":\"keyBased\",\"identity\":{\"userAssignedIdentity\":\"gidokgjljyoxgvcl\"},\"name\":\"bgsncghkjeszzhb\",\"subscriptionId\":\"htxfvgxbfsmxnehm\",\"resourceGroup\":\"ec\",\"containerName\":\"godebfqkkrbmpu\",\"fileNameFormat\":\"riwflzlfb\",\"batchFrequencyInSeconds\":599393599,\"maxChunkSizeInBytes\":1728715445,\"encoding\":\"JSON\"}") .toObject(RoutingStorageContainerProperties.class); - Assertions.assertEquals("yvshxmz", model.id()); - Assertions.assertEquals("bzoggigrx", model.connectionString()); - Assertions.assertEquals("ur", model.endpointUri()); - Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); - Assertions.assertEquals("nspydptkoenkoukn", model.identity().userAssignedIdentity()); - Assertions.assertEquals("udwtiukbl", model.name()); - Assertions.assertEquals("gkpocipazyxoe", model.subscriptionId()); - Assertions.assertEquals("kgjn", model.resourceGroup()); - Assertions.assertEquals("iucgygevqzn", model.containerName()); - Assertions.assertEquals("pmr", model.fileNameFormat()); - Assertions.assertEquals(129742346, model.batchFrequencyInSeconds()); - Assertions.assertEquals(173387394, model.maxChunkSizeInBytes()); - Assertions.assertEquals(RoutingStorageContainerPropertiesEncoding.AVRO, model.encoding()); + Assertions.assertEquals("wutttxfvjrbi", model.id()); + Assertions.assertEquals("hxepcyvahfnlj", model.connectionString()); + Assertions.assertEquals("qxj", model.endpointUri()); + Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); + Assertions.assertEquals("gidokgjljyoxgvcl", model.identity().userAssignedIdentity()); + Assertions.assertEquals("bgsncghkjeszzhb", model.name()); + Assertions.assertEquals("htxfvgxbfsmxnehm", model.subscriptionId()); + Assertions.assertEquals("ec", model.resourceGroup()); + Assertions.assertEquals("godebfqkkrbmpu", model.containerName()); + Assertions.assertEquals("riwflzlfb", model.fileNameFormat()); + Assertions.assertEquals(599393599, model.batchFrequencyInSeconds()); + Assertions.assertEquals(1728715445, model.maxChunkSizeInBytes()); + Assertions.assertEquals(RoutingStorageContainerPropertiesEncoding.JSON, model.encoding()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RoutingStorageContainerProperties model = new RoutingStorageContainerProperties() - .withId("yvshxmz") - .withConnectionString("bzoggigrx") - .withEndpointUri("ur") - .withAuthenticationType(AuthenticationType.IDENTITY_BASED) - .withIdentity(new ManagedIdentity().withUserAssignedIdentity("nspydptkoenkoukn")) - .withName("udwtiukbl") - .withSubscriptionId("gkpocipazyxoe") - .withResourceGroup("kgjn") - .withContainerName("iucgygevqzn") - .withFileNameFormat("pmr") - .withBatchFrequencyInSeconds(129742346) - .withMaxChunkSizeInBytes(173387394) - .withEncoding(RoutingStorageContainerPropertiesEncoding.AVRO); + .withId("wutttxfvjrbi") + .withConnectionString("hxepcyvahfnlj") + .withEndpointUri("qxj") + .withAuthenticationType(AuthenticationType.KEY_BASED) + .withIdentity(new ManagedIdentity().withUserAssignedIdentity("gidokgjljyoxgvcl")) + .withName("bgsncghkjeszzhb") + .withSubscriptionId("htxfvgxbfsmxnehm") + .withResourceGroup("ec") + .withContainerName("godebfqkkrbmpu") + .withFileNameFormat("riwflzlfb") + .withBatchFrequencyInSeconds(599393599) + .withMaxChunkSizeInBytes(1728715445) + .withEncoding(RoutingStorageContainerPropertiesEncoding.JSON); model = BinaryData.fromObject(model).toObject(RoutingStorageContainerProperties.class); - Assertions.assertEquals("yvshxmz", model.id()); - Assertions.assertEquals("bzoggigrx", model.connectionString()); - Assertions.assertEquals("ur", model.endpointUri()); - Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); - Assertions.assertEquals("nspydptkoenkoukn", model.identity().userAssignedIdentity()); - Assertions.assertEquals("udwtiukbl", model.name()); - Assertions.assertEquals("gkpocipazyxoe", model.subscriptionId()); - Assertions.assertEquals("kgjn", model.resourceGroup()); - Assertions.assertEquals("iucgygevqzn", model.containerName()); - Assertions.assertEquals("pmr", model.fileNameFormat()); - Assertions.assertEquals(129742346, model.batchFrequencyInSeconds()); - Assertions.assertEquals(173387394, model.maxChunkSizeInBytes()); - Assertions.assertEquals(RoutingStorageContainerPropertiesEncoding.AVRO, model.encoding()); + Assertions.assertEquals("wutttxfvjrbi", model.id()); + Assertions.assertEquals("hxepcyvahfnlj", model.connectionString()); + Assertions.assertEquals("qxj", model.endpointUri()); + Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); + Assertions.assertEquals("gidokgjljyoxgvcl", model.identity().userAssignedIdentity()); + Assertions.assertEquals("bgsncghkjeszzhb", model.name()); + Assertions.assertEquals("htxfvgxbfsmxnehm", model.subscriptionId()); + Assertions.assertEquals("ec", model.resourceGroup()); + Assertions.assertEquals("godebfqkkrbmpu", model.containerName()); + Assertions.assertEquals("riwflzlfb", model.fileNameFormat()); + Assertions.assertEquals(599393599, model.batchFrequencyInSeconds()); + Assertions.assertEquals(1728715445, model.maxChunkSizeInBytes()); + Assertions.assertEquals(RoutingStorageContainerPropertiesEncoding.JSON, model.encoding()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingTwinPropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingTwinPropertiesTests.java index 037ecc960f20..1cec6feda77e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingTwinPropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingTwinPropertiesTests.java @@ -12,14 +12,14 @@ public final class RoutingTwinPropertiesTests { public void testDeserialize() throws Exception { RoutingTwinProperties model = BinaryData - .fromString("{\"desired\":\"dataewgdrjervn\",\"reported\":\"datanqpeh\"}") + .fromString("{\"desired\":\"datapjflcxogao\",\"reported\":\"datanzmnsikvm\"}") .toObject(RoutingTwinProperties.class); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RoutingTwinProperties model = - new RoutingTwinProperties().withDesired("dataewgdrjervn").withReported("datanqpeh"); + new RoutingTwinProperties().withDesired("datapjflcxogao").withReported("datanzmnsikvm"); model = BinaryData.fromObject(model).toObject(RoutingTwinProperties.class); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingTwinTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingTwinTests.java index 2798b1fa76ce..5b8eb8985877 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingTwinTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/RoutingTwinTests.java @@ -14,7 +14,7 @@ public void testDeserialize() throws Exception { RoutingTwin model = BinaryData .fromString( - "{\"tags\":\"dataqtaruoujmkcjhwq\",\"properties\":{\"desired\":\"datar\",\"reported\":\"datan\"}}") + "{\"tags\":\"datahszhedplvwiwu\",\"properties\":{\"desired\":\"datambes\",\"reported\":\"datankww\"}}") .toObject(RoutingTwin.class); } @@ -22,8 +22,8 @@ public void testDeserialize() throws Exception { public void testSerialize() throws Exception { RoutingTwin model = new RoutingTwin() - .withTags("dataqtaruoujmkcjhwq") - .withProperties(new RoutingTwinProperties().withDesired("datar").withReported("datan")); + .withTags("datahszhedplvwiwu") + .withProperties(new RoutingTwinProperties().withDesired("datambes").withReported("datankww")); model = BinaryData.fromObject(model).toObject(RoutingTwin.class); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/StorageEndpointPropertiesTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/StorageEndpointPropertiesTests.java index 9d9c0339af2f..7e676309ab98 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/StorageEndpointPropertiesTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/StorageEndpointPropertiesTests.java @@ -17,29 +17,29 @@ public void testDeserialize() throws Exception { StorageEndpointProperties model = BinaryData .fromString( - "{\"sasTtlAsIso8601\":\"PT227H21M53S\",\"connectionString\":\"hkaetcktvfc\",\"containerName\":\"vf\",\"authenticationType\":\"identityBased\",\"identity\":{\"userAssignedIdentity\":\"uctqhjfbe\"}}") + "{\"sasTtlAsIso8601\":\"PT189H2M8S\",\"connectionString\":\"ue\",\"containerName\":\"xibxujwbhqwalm\",\"authenticationType\":\"keyBased\",\"identity\":{\"userAssignedIdentity\":\"aepdkzjanc\"}}") .toObject(StorageEndpointProperties.class); - Assertions.assertEquals(Duration.parse("PT227H21M53S"), model.sasTtlAsIso8601()); - Assertions.assertEquals("hkaetcktvfc", model.connectionString()); - Assertions.assertEquals("vf", model.containerName()); - Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); - Assertions.assertEquals("uctqhjfbe", model.identity().userAssignedIdentity()); + Assertions.assertEquals(Duration.parse("PT189H2M8S"), model.sasTtlAsIso8601()); + Assertions.assertEquals("ue", model.connectionString()); + Assertions.assertEquals("xibxujwbhqwalm", model.containerName()); + Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); + Assertions.assertEquals("aepdkzjanc", model.identity().userAssignedIdentity()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { StorageEndpointProperties model = new StorageEndpointProperties() - .withSasTtlAsIso8601(Duration.parse("PT227H21M53S")) - .withConnectionString("hkaetcktvfc") - .withContainerName("vf") - .withAuthenticationType(AuthenticationType.IDENTITY_BASED) - .withIdentity(new ManagedIdentity().withUserAssignedIdentity("uctqhjfbe")); + .withSasTtlAsIso8601(Duration.parse("PT189H2M8S")) + .withConnectionString("ue") + .withContainerName("xibxujwbhqwalm") + .withAuthenticationType(AuthenticationType.KEY_BASED) + .withIdentity(new ManagedIdentity().withUserAssignedIdentity("aepdkzjanc")); model = BinaryData.fromObject(model).toObject(StorageEndpointProperties.class); - Assertions.assertEquals(Duration.parse("PT227H21M53S"), model.sasTtlAsIso8601()); - Assertions.assertEquals("hkaetcktvfc", model.connectionString()); - Assertions.assertEquals("vf", model.containerName()); - Assertions.assertEquals(AuthenticationType.IDENTITY_BASED, model.authenticationType()); - Assertions.assertEquals("uctqhjfbe", model.identity().userAssignedIdentity()); + Assertions.assertEquals(Duration.parse("PT189H2M8S"), model.sasTtlAsIso8601()); + Assertions.assertEquals("ue", model.connectionString()); + Assertions.assertEquals("xibxujwbhqwalm", model.containerName()); + Assertions.assertEquals(AuthenticationType.KEY_BASED, model.authenticationType()); + Assertions.assertEquals("aepdkzjanc", model.identity().userAssignedIdentity()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TagsResourceTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TagsResourceTests.java index f5b21cb02db7..e0da6137f5a4 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TagsResourceTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TagsResourceTests.java @@ -15,30 +15,19 @@ public final class TagsResourceTests { public void testDeserialize() throws Exception { TagsResource model = BinaryData - .fromString( - "{\"tags\":{\"nyyazttbtwwrqpue\":\"ucoc\",\"xibxujwbhqwalm\":\"ckzywbiexzfeyue\",\"ux\":\"zyoxaepdkzjan\",\"zt\":\"hdwbavxbniwdjs\"}}") + .fromString("{\"tags\":{\"svlxotogtwrup\":\"tkncwsc\",\"nmic\":\"sx\"}}") .toObject(TagsResource.class); - Assertions.assertEquals("ucoc", model.tags().get("nyyazttbtwwrqpue")); + Assertions.assertEquals("tkncwsc", model.tags().get("svlxotogtwrup")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - TagsResource model = - new TagsResource() - .withTags( - mapOf( - "nyyazttbtwwrqpue", - "ucoc", - "xibxujwbhqwalm", - "ckzywbiexzfeyue", - "ux", - "zyoxaepdkzjan", - "zt", - "hdwbavxbniwdjs")); + TagsResource model = new TagsResource().withTags(mapOf("svlxotogtwrup", "tkncwsc", "nmic", "sx")); model = BinaryData.fromObject(model).toObject(TagsResource.class); - Assertions.assertEquals("ucoc", model.tags().get("nyyazttbtwwrqpue")); + Assertions.assertEquals("tkncwsc", model.tags().get("svlxotogtwrup")); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestAllRoutesInputTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestAllRoutesInputTests.java index ff56c98199e0..40a2bad33a46 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestAllRoutesInputTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestAllRoutesInputTests.java @@ -20,39 +20,39 @@ public void testDeserialize() throws Exception { TestAllRoutesInput model = BinaryData .fromString( - "{\"routingSource\":\"DigitalTwinChangeEvents\",\"message\":{\"body\":\"uaceopzfqrhhu\",\"appProperties\":{\"ahzxctobgbk\":\"ppcqeqxolz\",\"mgrcfbu\":\"moizpos\",\"mjh\":\"rmfqjhhkxbpvj\"},\"systemProperties\":{\"tswb\":\"yngudivk\"}},\"twin\":{\"tags\":\"datavszjfauvjfdxxi\",\"properties\":{\"desired\":\"datavtcqaqtdo\",\"reported\":\"datacbxvwvxyslqbh\"}}}") + "{\"routingSource\":\"TwinChangeEvents\",\"message\":{\"body\":\"rruvwbhsq\",\"appProperties\":{\"bsrfbj\":\"bcgjbirxbp\",\"otftpvjzbexilz\":\"dtws\",\"qtaruoujmkcjhwq\":\"nfqqnvwp\"},\"systemProperties\":{\"bnw\":\"r\",\"enq\":\"ewgdrjervn\",\"ndoygmifthnzdnd\":\"eh\",\"nayqi\":\"l\"}},\"twin\":{\"tags\":\"dataduhavhqlkt\",\"properties\":{\"desired\":\"dataaqolbgycduiertg\",\"reported\":\"datay\"}}}") .toObject(TestAllRoutesInput.class); - Assertions.assertEquals(RoutingSource.DIGITAL_TWIN_CHANGE_EVENTS, model.routingSource()); - Assertions.assertEquals("uaceopzfqrhhu", model.message().body()); - Assertions.assertEquals("ppcqeqxolz", model.message().appProperties().get("ahzxctobgbk")); - Assertions.assertEquals("yngudivk", model.message().systemProperties().get("tswb")); + Assertions.assertEquals(RoutingSource.TWIN_CHANGE_EVENTS, model.routingSource()); + Assertions.assertEquals("rruvwbhsq", model.message().body()); + Assertions.assertEquals("bcgjbirxbp", model.message().appProperties().get("bsrfbj")); + Assertions.assertEquals("r", model.message().systemProperties().get("bnw")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { TestAllRoutesInput model = new TestAllRoutesInput() - .withRoutingSource(RoutingSource.DIGITAL_TWIN_CHANGE_EVENTS) + .withRoutingSource(RoutingSource.TWIN_CHANGE_EVENTS) .withMessage( new RoutingMessage() - .withBody("uaceopzfqrhhu") + .withBody("rruvwbhsq") .withAppProperties( - mapOf("ahzxctobgbk", "ppcqeqxolz", "mgrcfbu", "moizpos", "mjh", "rmfqjhhkxbpvj")) - .withSystemProperties(mapOf("tswb", "yngudivk"))) + mapOf("bsrfbj", "bcgjbirxbp", "otftpvjzbexilz", "dtws", "qtaruoujmkcjhwq", "nfqqnvwp")) + .withSystemProperties( + mapOf("bnw", "r", "enq", "ewgdrjervn", "ndoygmifthnzdnd", "eh", "nayqi", "l"))) .withTwin( new RoutingTwin() - .withTags("datavszjfauvjfdxxi") + .withTags("dataduhavhqlkt") .withProperties( - new RoutingTwinProperties() - .withDesired("datavtcqaqtdo") - .withReported("datacbxvwvxyslqbh"))); + new RoutingTwinProperties().withDesired("dataaqolbgycduiertg").withReported("datay"))); model = BinaryData.fromObject(model).toObject(TestAllRoutesInput.class); - Assertions.assertEquals(RoutingSource.DIGITAL_TWIN_CHANGE_EVENTS, model.routingSource()); - Assertions.assertEquals("uaceopzfqrhhu", model.message().body()); - Assertions.assertEquals("ppcqeqxolz", model.message().appProperties().get("ahzxctobgbk")); - Assertions.assertEquals("yngudivk", model.message().systemProperties().get("tswb")); + Assertions.assertEquals(RoutingSource.TWIN_CHANGE_EVENTS, model.routingSource()); + Assertions.assertEquals("rruvwbhsq", model.message().body()); + Assertions.assertEquals("bcgjbirxbp", model.message().appProperties().get("bsrfbj")); + Assertions.assertEquals("r", model.message().systemProperties().get("bnw")); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestAllRoutesResultInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestAllRoutesResultInnerTests.java index c29252e0b7d8..5269d307902f 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestAllRoutesResultInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestAllRoutesResultInnerTests.java @@ -18,12 +18,13 @@ public void testDeserialize() throws Exception { TestAllRoutesResultInner model = BinaryData .fromString( - "{\"routes\":[{\"properties\":{\"name\":\"ygmi\",\"source\":\"TwinChangeEvents\",\"condition\":\"nzdndslgna\",\"endpointNames\":[],\"isEnabled\":false}}]}") + "{\"routes\":[{\"properties\":{\"name\":\"qqkdltfzxmhhvhgu\",\"source\":\"DeviceMessages\",\"condition\":\"dkwobdagx\",\"endpointNames\":[\"bqdxbx\",\"akbogqxndlkzgxh\",\"ripl\",\"podxunkb\"],\"isEnabled\":true}}]}") .toObject(TestAllRoutesResultInner.class); - Assertions.assertEquals("ygmi", model.routes().get(0).properties().name()); - Assertions.assertEquals(RoutingSource.TWIN_CHANGE_EVENTS, model.routes().get(0).properties().source()); - Assertions.assertEquals("nzdndslgna", model.routes().get(0).properties().condition()); - Assertions.assertEquals(false, model.routes().get(0).properties().isEnabled()); + Assertions.assertEquals("qqkdltfzxmhhvhgu", model.routes().get(0).properties().name()); + Assertions.assertEquals(RoutingSource.DEVICE_MESSAGES, model.routes().get(0).properties().source()); + Assertions.assertEquals("dkwobdagx", model.routes().get(0).properties().condition()); + Assertions.assertEquals("bqdxbx", model.routes().get(0).properties().endpointNames().get(0)); + Assertions.assertEquals(true, model.routes().get(0).properties().isEnabled()); } @org.junit.jupiter.api.Test @@ -36,15 +37,17 @@ public void testSerialize() throws Exception { new MatchedRoute() .withProperties( new RouteProperties() - .withName("ygmi") - .withSource(RoutingSource.TWIN_CHANGE_EVENTS) - .withCondition("nzdndslgna") - .withEndpointNames(Arrays.asList()) - .withIsEnabled(false)))); + .withName("qqkdltfzxmhhvhgu") + .withSource(RoutingSource.DEVICE_MESSAGES) + .withCondition("dkwobdagx") + .withEndpointNames( + Arrays.asList("bqdxbx", "akbogqxndlkzgxh", "ripl", "podxunkb")) + .withIsEnabled(true)))); model = BinaryData.fromObject(model).toObject(TestAllRoutesResultInner.class); - Assertions.assertEquals("ygmi", model.routes().get(0).properties().name()); - Assertions.assertEquals(RoutingSource.TWIN_CHANGE_EVENTS, model.routes().get(0).properties().source()); - Assertions.assertEquals("nzdndslgna", model.routes().get(0).properties().condition()); - Assertions.assertEquals(false, model.routes().get(0).properties().isEnabled()); + Assertions.assertEquals("qqkdltfzxmhhvhgu", model.routes().get(0).properties().name()); + Assertions.assertEquals(RoutingSource.DEVICE_MESSAGES, model.routes().get(0).properties().source()); + Assertions.assertEquals("dkwobdagx", model.routes().get(0).properties().condition()); + Assertions.assertEquals("bqdxbx", model.routes().get(0).properties().endpointNames().get(0)); + Assertions.assertEquals(true, model.routes().get(0).properties().isEnabled()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteInputTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteInputTests.java index 5703ac8c25dd..832a357d0d63 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteInputTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteInputTests.java @@ -22,15 +22,15 @@ public void testDeserialize() throws Exception { TestRouteInput model = BinaryData .fromString( - "{\"message\":{\"body\":\"swiydmcwyhzdx\",\"appProperties\":{\"vdfznudaodvxzb\":\"dbzm\",\"dzu\":\"cblylpstdbhhxsr\",\"fiwjmygtdssls\":\"erscdntne\",\"emwabnet\":\"tmweriofzpyq\"},\"systemProperties\":{\"wubmwmbesldn\":\"szhedplvw\",\"lcxog\":\"wwtppj\",\"qqkdltfzxmhhvhgu\":\"okonzmnsikvmkqz\",\"xtibqdxbxwakbog\":\"eodkwobda\"}},\"route\":{\"name\":\"xndlkzgxhu\",\"source\":\"MqttBrokerMessages\",\"condition\":\"lbpodxunk\",\"endpointNames\":[\"bxmubyynt\",\"lrb\",\"tkoievseotgq\"],\"isEnabled\":false},\"twin\":{\"tags\":\"datamuwlauwzizxbm\",\"properties\":{\"desired\":\"datajefuzmuvpbttdumo\",\"reported\":\"datapxebmnzbt\"}}}") + "{\"message\":{\"body\":\"xe\",\"appProperties\":{\"glkfg\":\"zbtbhj\",\"dyhtozfikdowwquu\":\"hdneuelfph\"},\"systemProperties\":{\"hqzonosggbhcoh\":\"xclvit\"}},\"route\":{\"name\":\"wdsjnkalju\",\"source\":\"DeviceConnectionStateEvents\",\"condition\":\"swacffgdkzz\",\"endpointNames\":[\"kfvhqcrailvpn\",\"pfuflrw\",\"mh\",\"lxyjr\"],\"isEnabled\":false},\"twin\":{\"tags\":\"dataafcnih\",\"properties\":{\"desired\":\"dataapnedgfbcvkc\",\"reported\":\"datavpk\"}}}") .toObject(TestRouteInput.class); - Assertions.assertEquals("swiydmcwyhzdx", model.message().body()); - Assertions.assertEquals("dbzm", model.message().appProperties().get("vdfznudaodvxzb")); - Assertions.assertEquals("szhedplvw", model.message().systemProperties().get("wubmwmbesldn")); - Assertions.assertEquals("xndlkzgxhu", model.route().name()); - Assertions.assertEquals(RoutingSource.MQTT_BROKER_MESSAGES, model.route().source()); - Assertions.assertEquals("lbpodxunk", model.route().condition()); - Assertions.assertEquals("bxmubyynt", model.route().endpointNames().get(0)); + Assertions.assertEquals("xe", model.message().body()); + Assertions.assertEquals("zbtbhj", model.message().appProperties().get("glkfg")); + Assertions.assertEquals("xclvit", model.message().systemProperties().get("hqzonosggbhcoh")); + Assertions.assertEquals("wdsjnkalju", model.route().name()); + Assertions.assertEquals(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS, model.route().source()); + Assertions.assertEquals("swacffgdkzz", model.route().condition()); + Assertions.assertEquals("kfvhqcrailvpn", model.route().endpointNames().get(0)); Assertions.assertEquals(false, model.route().isEnabled()); } @@ -40,52 +40,33 @@ public void testSerialize() throws Exception { new TestRouteInput() .withMessage( new RoutingMessage() - .withBody("swiydmcwyhzdx") - .withAppProperties( - mapOf( - "vdfznudaodvxzb", - "dbzm", - "dzu", - "cblylpstdbhhxsr", - "fiwjmygtdssls", - "erscdntne", - "emwabnet", - "tmweriofzpyq")) - .withSystemProperties( - mapOf( - "wubmwmbesldn", - "szhedplvw", - "lcxog", - "wwtppj", - "qqkdltfzxmhhvhgu", - "okonzmnsikvmkqz", - "xtibqdxbxwakbog", - "eodkwobda"))) + .withBody("xe") + .withAppProperties(mapOf("glkfg", "zbtbhj", "dyhtozfikdowwquu", "hdneuelfph")) + .withSystemProperties(mapOf("hqzonosggbhcoh", "xclvit"))) .withRoute( new RouteProperties() - .withName("xndlkzgxhu") - .withSource(RoutingSource.MQTT_BROKER_MESSAGES) - .withCondition("lbpodxunk") - .withEndpointNames(Arrays.asList("bxmubyynt", "lrb", "tkoievseotgq")) + .withName("wdsjnkalju") + .withSource(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS) + .withCondition("swacffgdkzz") + .withEndpointNames(Arrays.asList("kfvhqcrailvpn", "pfuflrw", "mh", "lxyjr")) .withIsEnabled(false)) .withTwin( new RoutingTwin() - .withTags("datamuwlauwzizxbm") + .withTags("dataafcnih") .withProperties( - new RoutingTwinProperties() - .withDesired("datajefuzmuvpbttdumo") - .withReported("datapxebmnzbt"))); + new RoutingTwinProperties().withDesired("dataapnedgfbcvkc").withReported("datavpk"))); model = BinaryData.fromObject(model).toObject(TestRouteInput.class); - Assertions.assertEquals("swiydmcwyhzdx", model.message().body()); - Assertions.assertEquals("dbzm", model.message().appProperties().get("vdfznudaodvxzb")); - Assertions.assertEquals("szhedplvw", model.message().systemProperties().get("wubmwmbesldn")); - Assertions.assertEquals("xndlkzgxhu", model.route().name()); - Assertions.assertEquals(RoutingSource.MQTT_BROKER_MESSAGES, model.route().source()); - Assertions.assertEquals("lbpodxunk", model.route().condition()); - Assertions.assertEquals("bxmubyynt", model.route().endpointNames().get(0)); + Assertions.assertEquals("xe", model.message().body()); + Assertions.assertEquals("zbtbhj", model.message().appProperties().get("glkfg")); + Assertions.assertEquals("xclvit", model.message().systemProperties().get("hqzonosggbhcoh")); + Assertions.assertEquals("wdsjnkalju", model.route().name()); + Assertions.assertEquals(RoutingSource.DEVICE_CONNECTION_STATE_EVENTS, model.route().source()); + Assertions.assertEquals("swacffgdkzz", model.route().condition()); + Assertions.assertEquals("kfvhqcrailvpn", model.route().endpointNames().get(0)); Assertions.assertEquals(false, model.route().isEnabled()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteResultDetailsTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteResultDetailsTests.java index 5998c1664a5d..656fd4464ac0 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteResultDetailsTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteResultDetailsTests.java @@ -6,6 +6,7 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.iothub.models.RouteCompilationError; +import com.azure.resourcemanager.iothub.models.RouteErrorPosition; import com.azure.resourcemanager.iothub.models.RouteErrorRange; import com.azure.resourcemanager.iothub.models.RouteErrorSeverity; import com.azure.resourcemanager.iothub.models.TestRouteResultDetails; @@ -18,10 +19,14 @@ public void testDeserialize() throws Exception { TestRouteResultDetails model = BinaryData .fromString( - "{\"compilationErrors\":[{\"message\":\"ikdowwquuvx\",\"severity\":\"error\",\"location\":{}},{\"message\":\"hhqzonosgg\",\"severity\":\"error\",\"location\":{}}]}") + "{\"compilationErrors\":[{\"message\":\"mwyhr\",\"severity\":\"error\",\"location\":{\"start\":{\"line\":892669790,\"column\":1378791233},\"end\":{\"line\":1662588727,\"column\":1209208693}}},{\"message\":\"vqtmnub\",\"severity\":\"warning\",\"location\":{\"start\":{\"line\":1254452597,\"column\":1550438212},\"end\":{\"line\":848558030,\"column\":1007666972}}}]}") .toObject(TestRouteResultDetails.class); - Assertions.assertEquals("ikdowwquuvx", model.compilationErrors().get(0).message()); + Assertions.assertEquals("mwyhr", model.compilationErrors().get(0).message()); Assertions.assertEquals(RouteErrorSeverity.ERROR, model.compilationErrors().get(0).severity()); + Assertions.assertEquals(892669790, model.compilationErrors().get(0).location().start().line()); + Assertions.assertEquals(1378791233, model.compilationErrors().get(0).location().start().column()); + Assertions.assertEquals(1662588727, model.compilationErrors().get(0).location().end().line()); + Assertions.assertEquals(1209208693, model.compilationErrors().get(0).location().end().column()); } @org.junit.jupiter.api.Test @@ -32,15 +37,26 @@ public void testSerialize() throws Exception { Arrays .asList( new RouteCompilationError() - .withMessage("ikdowwquuvx") + .withMessage("mwyhr") .withSeverity(RouteErrorSeverity.ERROR) - .withLocation(new RouteErrorRange()), + .withLocation( + new RouteErrorRange() + .withStart(new RouteErrorPosition().withLine(892669790).withColumn(1378791233)) + .withEnd(new RouteErrorPosition().withLine(1662588727).withColumn(1209208693))), new RouteCompilationError() - .withMessage("hhqzonosgg") - .withSeverity(RouteErrorSeverity.ERROR) - .withLocation(new RouteErrorRange()))); + .withMessage("vqtmnub") + .withSeverity(RouteErrorSeverity.WARNING) + .withLocation( + new RouteErrorRange() + .withStart(new RouteErrorPosition().withLine(1254452597).withColumn(1550438212)) + .withEnd( + new RouteErrorPosition().withLine(848558030).withColumn(1007666972))))); model = BinaryData.fromObject(model).toObject(TestRouteResultDetails.class); - Assertions.assertEquals("ikdowwquuvx", model.compilationErrors().get(0).message()); + Assertions.assertEquals("mwyhr", model.compilationErrors().get(0).message()); Assertions.assertEquals(RouteErrorSeverity.ERROR, model.compilationErrors().get(0).severity()); + Assertions.assertEquals(892669790, model.compilationErrors().get(0).location().start().line()); + Assertions.assertEquals(1378791233, model.compilationErrors().get(0).location().start().column()); + Assertions.assertEquals(1662588727, model.compilationErrors().get(0).location().end().line()); + Assertions.assertEquals(1209208693, model.compilationErrors().get(0).location().end().column()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteResultInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteResultInnerTests.java index cadef67fcf41..da752145aa56 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteResultInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/TestRouteResultInnerTests.java @@ -7,6 +7,8 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner; import com.azure.resourcemanager.iothub.models.RouteCompilationError; +import com.azure.resourcemanager.iothub.models.RouteErrorPosition; +import com.azure.resourcemanager.iothub.models.RouteErrorRange; import com.azure.resourcemanager.iothub.models.RouteErrorSeverity; import com.azure.resourcemanager.iothub.models.TestResultStatus; import com.azure.resourcemanager.iothub.models.TestRouteResultDetails; @@ -19,29 +21,65 @@ public void testDeserialize() throws Exception { TestRouteResultInner model = BinaryData .fromString( - "{\"result\":\"true\",\"details\":{\"compilationErrors\":[{\"message\":\"fgohdneuelfphs\",\"severity\":\"warning\"}]}}") + "{\"result\":\"undefined\",\"details\":{\"compilationErrors\":[{\"message\":\"hvoodsotbobzd\",\"severity\":\"error\",\"location\":{\"start\":{\"line\":546984067,\"column\":2011097883},\"end\":{\"line\":3568430,\"column\":481946424}}},{\"message\":\"cxrslpmutwuoe\",\"severity\":\"error\",\"location\":{\"start\":{\"line\":898627959,\"column\":726839595},\"end\":{\"line\":1045229648,\"column\":1223383690}}},{\"message\":\"cpdggkzzlvmbmp\",\"severity\":\"warning\",\"location\":{\"start\":{\"line\":1745081298,\"column\":843823748},\"end\":{\"line\":1626845892,\"column\":1201307728}}}]}}") .toObject(TestRouteResultInner.class); - Assertions.assertEquals(TestResultStatus.TRUE, model.result()); - Assertions.assertEquals("fgohdneuelfphs", model.details().compilationErrors().get(0).message()); - Assertions.assertEquals(RouteErrorSeverity.WARNING, model.details().compilationErrors().get(0).severity()); + Assertions.assertEquals(TestResultStatus.UNDEFINED, model.result()); + Assertions.assertEquals("hvoodsotbobzd", model.details().compilationErrors().get(0).message()); + Assertions.assertEquals(RouteErrorSeverity.ERROR, model.details().compilationErrors().get(0).severity()); + Assertions.assertEquals(546984067, model.details().compilationErrors().get(0).location().start().line()); + Assertions.assertEquals(2011097883, model.details().compilationErrors().get(0).location().start().column()); + Assertions.assertEquals(3568430, model.details().compilationErrors().get(0).location().end().line()); + Assertions.assertEquals(481946424, model.details().compilationErrors().get(0).location().end().column()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { TestRouteResultInner model = new TestRouteResultInner() - .withResult(TestResultStatus.TRUE) + .withResult(TestResultStatus.UNDEFINED) .withDetails( new TestRouteResultDetails() .withCompilationErrors( Arrays .asList( new RouteCompilationError() - .withMessage("fgohdneuelfphs") - .withSeverity(RouteErrorSeverity.WARNING)))); + .withMessage("hvoodsotbobzd") + .withSeverity(RouteErrorSeverity.ERROR) + .withLocation( + new RouteErrorRange() + .withStart( + new RouteErrorPosition().withLine(546984067).withColumn(2011097883)) + .withEnd( + new RouteErrorPosition().withLine(3568430).withColumn(481946424))), + new RouteCompilationError() + .withMessage("cxrslpmutwuoe") + .withSeverity(RouteErrorSeverity.ERROR) + .withLocation( + new RouteErrorRange() + .withStart( + new RouteErrorPosition().withLine(898627959).withColumn(726839595)) + .withEnd( + new RouteErrorPosition() + .withLine(1045229648) + .withColumn(1223383690))), + new RouteCompilationError() + .withMessage("cpdggkzzlvmbmp") + .withSeverity(RouteErrorSeverity.WARNING) + .withLocation( + new RouteErrorRange() + .withStart( + new RouteErrorPosition().withLine(1745081298).withColumn(843823748)) + .withEnd( + new RouteErrorPosition() + .withLine(1626845892) + .withColumn(1201307728)))))); model = BinaryData.fromObject(model).toObject(TestRouteResultInner.class); - Assertions.assertEquals(TestResultStatus.TRUE, model.result()); - Assertions.assertEquals("fgohdneuelfphs", model.details().compilationErrors().get(0).message()); - Assertions.assertEquals(RouteErrorSeverity.WARNING, model.details().compilationErrors().get(0).severity()); + Assertions.assertEquals(TestResultStatus.UNDEFINED, model.result()); + Assertions.assertEquals("hvoodsotbobzd", model.details().compilationErrors().get(0).message()); + Assertions.assertEquals(RouteErrorSeverity.ERROR, model.details().compilationErrors().get(0).severity()); + Assertions.assertEquals(546984067, model.details().compilationErrors().get(0).location().start().line()); + Assertions.assertEquals(2011097883, model.details().compilationErrors().get(0).location().start().column()); + Assertions.assertEquals(3568430, model.details().compilationErrors().get(0).location().end().line()); + Assertions.assertEquals(481946424, model.details().compilationErrors().get(0).location().end().column()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/UserSubscriptionQuotaListResultInnerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/UserSubscriptionQuotaListResultInnerTests.java index 20e695035587..fa34cf90e100 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/UserSubscriptionQuotaListResultInnerTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/UserSubscriptionQuotaListResultInnerTests.java @@ -17,15 +17,15 @@ public void testDeserialize() throws Exception { UserSubscriptionQuotaListResultInner model = BinaryData .fromString( - "{\"value\":[{\"id\":\"n\",\"type\":\"xisxyawjoyaqcsl\",\"unit\":\"pkii\",\"currentValue\":983085062,\"limit\":1211885049,\"name\":{\"value\":\"eli\",\"localizedValue\":\"nr\"}}],\"nextLink\":\"folhbnxknal\"}") + "{\"value\":[{\"id\":\"ucnapkteoellwp\",\"type\":\"d\",\"unit\":\"pfqbuaceopzf\",\"currentValue\":1219903446,\"limit\":391831639,\"name\":{\"value\":\"pppcqeqxo\",\"localizedValue\":\"dahzxctobg\"}},{\"id\":\"dmoizpostmg\",\"type\":\"fbunrmfqjhhk\",\"unit\":\"pvjymjhxxjyng\",\"currentValue\":1804869047,\"limit\":216222103,\"name\":{\"value\":\"swbxqz\",\"localizedValue\":\"zjf\"}}],\"nextLink\":\"vjfdx\"}") .toObject(UserSubscriptionQuotaListResultInner.class); - Assertions.assertEquals("n", model.value().get(0).id()); - Assertions.assertEquals("xisxyawjoyaqcsl", model.value().get(0).type()); - Assertions.assertEquals("pkii", model.value().get(0).unit()); - Assertions.assertEquals(983085062, model.value().get(0).currentValue()); - Assertions.assertEquals(1211885049, model.value().get(0).limit()); - Assertions.assertEquals("eli", model.value().get(0).name().value()); - Assertions.assertEquals("nr", model.value().get(0).name().localizedValue()); + Assertions.assertEquals("ucnapkteoellwp", model.value().get(0).id()); + Assertions.assertEquals("d", model.value().get(0).type()); + Assertions.assertEquals("pfqbuaceopzf", model.value().get(0).unit()); + Assertions.assertEquals(1219903446, model.value().get(0).currentValue()); + Assertions.assertEquals(391831639, model.value().get(0).limit()); + Assertions.assertEquals("pppcqeqxo", model.value().get(0).name().value()); + Assertions.assertEquals("dahzxctobg", model.value().get(0).name().localizedValue()); } @org.junit.jupiter.api.Test @@ -36,19 +36,26 @@ public void testSerialize() throws Exception { Arrays .asList( new UserSubscriptionQuota() - .withId("n") - .withType("xisxyawjoyaqcsl") - .withUnit("pkii") - .withCurrentValue(983085062) - .withLimit(1211885049) - .withName(new Name().withValue("eli").withLocalizedValue("nr")))); + .withId("ucnapkteoellwp") + .withType("d") + .withUnit("pfqbuaceopzf") + .withCurrentValue(1219903446) + .withLimit(391831639) + .withName(new Name().withValue("pppcqeqxo").withLocalizedValue("dahzxctobg")), + new UserSubscriptionQuota() + .withId("dmoizpostmg") + .withType("fbunrmfqjhhk") + .withUnit("pvjymjhxxjyng") + .withCurrentValue(1804869047) + .withLimit(216222103) + .withName(new Name().withValue("swbxqz").withLocalizedValue("zjf")))); model = BinaryData.fromObject(model).toObject(UserSubscriptionQuotaListResultInner.class); - Assertions.assertEquals("n", model.value().get(0).id()); - Assertions.assertEquals("xisxyawjoyaqcsl", model.value().get(0).type()); - Assertions.assertEquals("pkii", model.value().get(0).unit()); - Assertions.assertEquals(983085062, model.value().get(0).currentValue()); - Assertions.assertEquals(1211885049, model.value().get(0).limit()); - Assertions.assertEquals("eli", model.value().get(0).name().value()); - Assertions.assertEquals("nr", model.value().get(0).name().localizedValue()); + Assertions.assertEquals("ucnapkteoellwp", model.value().get(0).id()); + Assertions.assertEquals("d", model.value().get(0).type()); + Assertions.assertEquals("pfqbuaceopzf", model.value().get(0).unit()); + Assertions.assertEquals(1219903446, model.value().get(0).currentValue()); + Assertions.assertEquals(391831639, model.value().get(0).limit()); + Assertions.assertEquals("pppcqeqxo", model.value().get(0).name().value()); + Assertions.assertEquals("dahzxctobg", model.value().get(0).name().localizedValue()); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/UserSubscriptionQuotaTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/UserSubscriptionQuotaTests.java index 3cdb18b12679..7b57d86b9129 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/UserSubscriptionQuotaTests.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/generated/UserSubscriptionQuotaTests.java @@ -15,34 +15,34 @@ public void testDeserialize() throws Exception { UserSubscriptionQuota model = BinaryData .fromString( - "{\"id\":\"lp\",\"type\":\"gdtpnapnyiro\",\"unit\":\"hpigv\",\"currentValue\":2000011197,\"limit\":1573909011,\"name\":{\"value\":\"itxmedjvcslynqww\",\"localizedValue\":\"wzz\"}}") + "{\"id\":\"vetvt\",\"type\":\"aqtdoqmcbx\",\"unit\":\"vxysl\",\"currentValue\":675840078,\"limit\":92665469,\"name\":{\"value\":\"blytk\",\"localizedValue\":\"mpew\"}}") .toObject(UserSubscriptionQuota.class); - Assertions.assertEquals("lp", model.id()); - Assertions.assertEquals("gdtpnapnyiro", model.type()); - Assertions.assertEquals("hpigv", model.unit()); - Assertions.assertEquals(2000011197, model.currentValue()); - Assertions.assertEquals(1573909011, model.limit()); - Assertions.assertEquals("itxmedjvcslynqww", model.name().value()); - Assertions.assertEquals("wzz", model.name().localizedValue()); + Assertions.assertEquals("vetvt", model.id()); + Assertions.assertEquals("aqtdoqmcbx", model.type()); + Assertions.assertEquals("vxysl", model.unit()); + Assertions.assertEquals(675840078, model.currentValue()); + Assertions.assertEquals(92665469, model.limit()); + Assertions.assertEquals("blytk", model.name().value()); + Assertions.assertEquals("mpew", model.name().localizedValue()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { UserSubscriptionQuota model = new UserSubscriptionQuota() - .withId("lp") - .withType("gdtpnapnyiro") - .withUnit("hpigv") - .withCurrentValue(2000011197) - .withLimit(1573909011) - .withName(new Name().withValue("itxmedjvcslynqww").withLocalizedValue("wzz")); + .withId("vetvt") + .withType("aqtdoqmcbx") + .withUnit("vxysl") + .withCurrentValue(675840078) + .withLimit(92665469) + .withName(new Name().withValue("blytk").withLocalizedValue("mpew")); model = BinaryData.fromObject(model).toObject(UserSubscriptionQuota.class); - Assertions.assertEquals("lp", model.id()); - Assertions.assertEquals("gdtpnapnyiro", model.type()); - Assertions.assertEquals("hpigv", model.unit()); - Assertions.assertEquals(2000011197, model.currentValue()); - Assertions.assertEquals(1573909011, model.limit()); - Assertions.assertEquals("itxmedjvcslynqww", model.name().value()); - Assertions.assertEquals("wzz", model.name().localizedValue()); + Assertions.assertEquals("vetvt", model.id()); + Assertions.assertEquals("aqtdoqmcbx", model.type()); + Assertions.assertEquals("vxysl", model.unit()); + Assertions.assertEquals(675840078, model.currentValue()); + Assertions.assertEquals(92665469, model.limit()); + Assertions.assertEquals("blytk", model.name().value()); + Assertions.assertEquals("mpew", model.name().localizedValue()); } } diff --git a/sdk/keyvault/azure-security-keyvault-administration/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-administration/CHANGELOG.md index f179ee3e31e9..4234e8fb82df 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-administration/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.4.0-beta.1 (Unreleased) +## 4.5.0-beta.1 (Unreleased) ### Features Added @@ -9,8 +9,25 @@ ### Bugs Fixed ### Other Changes + +## 4.4.0 (2023-09-25) + +### Other Changes +- Explicitly added a `values()` method to all `ExpandableStringEnum` models: + - `KeyVaultDataAction` + - `KeyVaultRoleDefinitionType` + - `KeyVaultRoleScope` + - `KeyVaultRoleType` + - `KeyVaultSettingType` + Functionality remains the same as the aforementioned method simply calls the implementation in the parent class. - Migrate test recordings to assets repo. +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. +- Upgraded `azure-json` from `1.0.1` to version `1.1.0`. + ## 4.3.5 (2023-08-21) ### Other Changes diff --git a/sdk/keyvault/azure-security-keyvault-administration/README.md b/sdk/keyvault/azure-security-keyvault-administration/README.md index 8ab1ff01aff9..0f47f61c2f21 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/README.md +++ b/sdk/keyvault/azure-security-keyvault-administration/README.md @@ -43,7 +43,7 @@ If you want to take dependency on a particular version of the library that is no com.azure azure-security-keyvault-administration - 4.3.5 + 4.4.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/keyvault/azure-security-keyvault-administration/pom.xml b/sdk/keyvault/azure-security-keyvault-administration/pom.xml index 5eae623755c8..a920bdea88e0 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-administration/pom.xml @@ -13,7 +13,7 @@ com.azure azure-security-keyvault-administration - 4.4.0-beta.1 + 4.5.0-beta.1 Microsoft Azure client library for KeyVault Administration This module contains client library for Microsoft Azure KeyVault Administration. @@ -106,13 +106,13 @@ com.azure azure-security-keyvault-keys - 4.6.5 + 4.7.0 test com.azure azure-storage-blob - 12.23.1 + 12.24.0 test diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientBuilder.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientBuilder.java index 827922b0568b..f49d41e92f37 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientBuilder.java @@ -84,6 +84,7 @@ public final class KeyVaultAccessControlClientBuilder implements private static final String AZURE_KEY_VAULT_RBAC = "azure-key-vault-administration.properties"; private static final String SDK_NAME = "name"; private static final String SDK_VERSION = "version"; + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); private final List perCallPolicies; private final List perRetryPolicies; @@ -193,15 +194,15 @@ private HttpPipeline getPipeline(Configuration buildConfiguration, ServiceVersio httpLogOptions = (httpLogOptions == null) ? new HttpLogOptions() : httpLogOptions; - policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(clientOptions, httpLogOptions), clientName, + ClientOptions localClientOptions = clientOptions != null ? clientOptions : DEFAULT_CLIENT_OPTIONS; + + policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(localClientOptions, httpLogOptions), clientName, clientVersion, buildConfiguration)); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach(header -> - httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach(header -> + httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); // Add per call additional policies. policies.addAll(perCallPolicies); @@ -218,7 +219,7 @@ private HttpPipeline getPipeline(Configuration buildConfiguration, ServiceVersio HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); - TracingOptions tracingOptions = clientOptions == null ? null : clientOptions.getTracingOptions(); + TracingOptions tracingOptions = localClientOptions.getTracingOptions(); Tracer tracer = TracerProvider.getDefaultProvider() .createTracer(clientName, clientVersion, KEYVAULT_TRACING_NAMESPACE_VALUE, tracingOptions); @@ -226,6 +227,7 @@ private HttpPipeline getPipeline(Configuration buildConfiguration, ServiceVersio .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .tracer(tracer) + .clientOptions(localClientOptions) .build(); } diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClientBuilder.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClientBuilder.java index 0c518c3dcebb..c026d6dc3bd5 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClientBuilder.java @@ -86,6 +86,8 @@ public final class KeyVaultBackupClientBuilder implements // Please see here // for more information on Azure resource provider namespaces. private static final String KEYVAULT_TRACING_NAMESPACE_VALUE = "Microsoft.KeyVault"; + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); + private final List perCallPolicies; private final List perRetryPolicies; private final Map properties; @@ -189,15 +191,15 @@ private HttpPipeline getPipeline(Configuration buildConfiguration) { httpLogOptions = (httpLogOptions == null) ? new HttpLogOptions() : httpLogOptions; - policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(clientOptions, httpLogOptions), clientName, + ClientOptions localClientOptions = clientOptions != null ? clientOptions : DEFAULT_CLIENT_OPTIONS; + + policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(localClientOptions, httpLogOptions), clientName, clientVersion, buildConfiguration)); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach(header -> - httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach(header -> + httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); // Add per call additional policies. policies.addAll(perCallPolicies); @@ -214,13 +216,14 @@ private HttpPipeline getPipeline(Configuration buildConfiguration) { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); - TracingOptions tracingOptions = clientOptions == null ? null : clientOptions.getTracingOptions(); + TracingOptions tracingOptions = localClientOptions.getTracingOptions(); Tracer tracer = TracerProvider.getDefaultProvider() .createTracer(clientName, clientVersion, KEYVAULT_TRACING_NAMESPACE_VALUE, tracingOptions); return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) + .clientOptions(localClientOptions) .tracer(tracer) .build(); } diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultSettingsClientBuilder.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultSettingsClientBuilder.java index 81a3d2f800fa..7c6b9b8172c3 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultSettingsClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultSettingsClientBuilder.java @@ -72,6 +72,8 @@ public final class KeyVaultSettingsClientBuilder implements // Please see here // for more information on Azure resource provider namespaces. private static final String KEYVAULT_TRACING_NAMESPACE_VALUE = "Microsoft.KeyVault"; + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); + private final List pipelinePolicies; private final Map properties; @@ -389,20 +391,18 @@ private HttpPipeline createHttpPipeline() { httpLogOptions = (httpLogOptions == null) ? new HttpLogOptions() : httpLogOptions; - String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + ClientOptions localClientOptions = clientOptions != null ? clientOptions : DEFAULT_CLIENT_OPTIONS; + + String applicationId = CoreUtils.getApplicationId(localClientOptions, httpLogOptions); policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); policies.add(new RequestIdPolicy()); policies.add(new AddHeadersFromContextPolicy()); - if (clientOptions != null) { - HttpHeaders headers = new HttpHeaders(); - - clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); - - if (headers.getSize() > 0) { - policies.add(new AddHeadersPolicy(headers)); - } + HttpHeaders headers = new HttpHeaders(); + localClientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); } policies.addAll( @@ -423,14 +423,14 @@ private HttpPipeline createHttpPipeline() { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); - TracingOptions tracingOptions = clientOptions == null ? null : clientOptions.getTracingOptions(); + TracingOptions tracingOptions = localClientOptions.getTracingOptions(); Tracer tracer = TracerProvider.getDefaultProvider() .createTracer(clientName, clientVersion, KEYVAULT_TRACING_NAMESPACE_VALUE, tracingOptions); return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) - .clientOptions(clientOptions) + .clientOptions(localClientOptions) .tracer(tracer) .build(); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md index e6db0d219cfd..0945b41bf1dc 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-certificates/CHANGELOG.md @@ -7,11 +7,20 @@ ### Breaking Changes ### Bugs Fixed -- Fixed response code for certificate merging operations from `200` to the correct `201`. -([#36260]https://github.com/Azure/azure-sdk-for-java/issues/36260)) ### Other Changes +## 4.5.6 (2023-09-25) + +### Bugs Fixed +- Fixed response code for certificate merging operations from `200` to the correct `201`. +([#36260](https://github.com/Azure/azure-sdk-for-java/issues/36260)) + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 4.5.5 (2023-08-21) ### Other Changes diff --git a/sdk/keyvault/azure-security-keyvault-certificates/README.md b/sdk/keyvault/azure-security-keyvault-certificates/README.md index 5ad4d296e4ec..a31528d0faf7 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/README.md +++ b/sdk/keyvault/azure-security-keyvault-certificates/README.md @@ -43,7 +43,7 @@ If you want to take dependency on a particular version of the library that is no com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java index 535bf404761c..838b77308aaa 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java @@ -41,15 +41,34 @@ import static com.azure.core.util.FluxUtil.withContext; /** - * The CertificateAsyncClient provides asynchronous methods to manage {@link KeyVaultCertificate certifcates} in the Azure Key Vault. The client - * supports creating, retrieving, updating, merging, deleting, purging, backing up, restoring and listing the - * {@link KeyVaultCertificate certificates}. The client also supports listing {@link DeletedCertificate deleted certificates} for - * a soft-delete enabled Azure Key Vault. + * The CertificateAsyncClient provides asynchronous methods to manage {@link KeyVaultCertificate certifcates} in + * a key vault. The client supports creating, retrieving, updating, merging, deleting, purging, backing up, + * restoring and listing the {@link KeyVaultCertificate certificates}. The client also supports listing + * {@link DeletedCertificate deleted certificates} for a soft-delete enabled key vault. * - *

    The client further allows creating, retrieving, updating, deleting and listing the {@link CertificateIssuer certificate issuers}. The client also supports - * creating, listing and deleting {@link CertificateContact certificate contacts}

    + *

    The client further allows creating, retrieving, updating, deleting and listing the + * {@link CertificateIssuer certificate issuers}. The client also supports creating, listing and deleting + * {@link CertificateContact certificate contacts}.

    * - *

    Samples to construct the async client

    + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link CertificateAsyncClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Asynchronous Certificate Client

    + * + *

    The following code sample demonstrates the creation of a + * {@link com.azure.security.keyvault.certificates.CertificateAsyncClient}, using the + * {@link com.azure.security.keyvault.certificates.CertificateClientBuilder} to configure it.

    * * *
    @@ -61,8 +80,81 @@
      * 
    * * + *
    + * + *
    + * + *

    Create a Certificate

    + * The {@link CertificateAsyncClient} can be used to create a certificate in the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to asynchronously create a certificate in the key vault, + * using the {@link CertificateAsyncClient#beginCreateCertificate(String, CertificatePolicy)} API.

    + * + * + *
    + * CertificatePolicy certPolicy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12");
    + * certificateAsyncClient.beginCreateCertificate("certificateName", certPolicy)
    + *     .subscribe(pollResponse -> {
    + *         System.out.println("---------------------------------------------------------------------------------");
    + *         System.out.println(pollResponse.getStatus());
    + *         System.out.println(pollResponse.getValue().getStatus());
    + *         System.out.println(pollResponse.getValue().getStatusDetails());
    + *     });
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link CertificateClient}.

    + * + *
    + * + *
    + * + *

    Get a Certificate

    + * The {@link CertificateAsyncClient} can be used to retrieve a certificate from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to asynchronously retrieve a certificate from the key vault, using + * the {@link CertificateAsyncClient#getCertificate(String)} API.

    + * + * + *
    + * certificateAsyncClient.getCertificate("certificateName")
    + *     .contextWrite(Context.of(key1, value1, key2, value2))
    + *     .subscribe(certificateResponse ->
    + *         System.out.printf("Certificate is returned with name %s and secretId %s %n",
    + *             certificateResponse.getProperties().getName(), certificateResponse.getSecretId()));
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link CertificateClient}.

    + * + *
    + * + *
    + * + *

    Delete a Certificate

    + * The {@link CertificateAsyncClient} can be used to delete a certificate from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to asynchronously delete a certificate from the Azure + * KeyVault, using the {@link CertificateAsyncClient#beginDeleteCertificate(String)} API.

    + * + * + *
    + * certificateAsyncClient.beginDeleteCertificate("certificateName")
    + *     .subscribe(pollResponse -> {
    + *         System.out.println("Delete Status: " + pollResponse.getStatus().toString());
    + *         System.out.println("Delete Certificate Name: " + pollResponse.getValue().getName());
    + *         System.out.println("Certificate Delete Date: " + pollResponse.getValue().getDeletedOn().toString());
    + *     });
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link CertificateClient}.

    + * + * @see com.azure.security.keyvault.certificates * @see CertificateClientBuilder - * @see PagedFlux */ @ServiceClient(builder = CertificateClientBuilder.class, isAsync = true, serviceInterfaces = CertificateClientImpl.CertificateService.class) public final class CertificateAsyncClient { diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java index adeff03bfca2..878b32c36635 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java @@ -34,15 +34,33 @@ /** - * The CertificateClient provides synchronous methods to manage {@link KeyVaultCertificate certifcates} in the Azure Key Vault. The client - * supports creating, retrieving, updating, merging, deleting, purging, backing up, restoring and listing the - * {@link KeyVaultCertificate certificates}. The client also supports listing {@link DeletedCertificate deleted certificates} for - * a soft-delete enabled Azure Key Vault. + * The {@link CertificateClient} provides synchronous methods to manage {@link KeyVaultCertificate certifcates} in + * the key vault. The client supports creating, retrieving, updating, merging, deleting, purging, backing up, + * restoring and listing the {@link KeyVaultCertificate certificates}. The client also supports listing + * {@link DeletedCertificate deleted certificates} for a soft-delete enabled key vault. * - *

    The client further allows creating, retrieving, updating, deleting and listing the {@link CertificateIssuer certificate issuers}. The client also supports - * creating, listing and deleting {@link CertificateContact certificate contacts}

    + *

    The client further allows creating, retrieving, updating, deleting and listing the + * {@link CertificateIssuer certificate issuers}. The client also supports creating, listing and + * deleting {@link CertificateContact certificate contacts}.

    * - *

    Samples to construct the sync client

    + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link CertificateClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Synchronous Certificate Client

    + * + *

    The following code sample demonstrates the creation of a {@link CertificateClient}, + * using the {@link CertificateClientBuilder} to configure it.

    * * *
    @@ -52,10 +70,80 @@
      *     .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))
      *     .buildClient();
      * 
    - * + * + * + *
    + * + *
    + * + *

    Create a Certificate

    + * The {@link CertificateClient} can be used to create a certificate in the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously create a certificate in the key vault, + * using the {@link CertificateClient#beginCreateCertificate(String, CertificatePolicy)} API.

    + * + * + *
    + * CertificatePolicy certPolicy = new CertificatePolicy("Self",
    + *     "CN=SelfSignedJavaPkcs12");
    + * SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = certificateClient
    + *     .beginCreateCertificate("certificateName", certPolicy);
    + * certPoller.waitUntil(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED);
    + * KeyVaultCertificate cert = certPoller.getFinalResult();
    + * System.out.printf("Certificate created with name %s%n", cert.getName());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link CertificateAsyncClient}.

    + * + *
    + * + *
    + * + *

    Get a Certificate

    + * The {@link CertificateClient} can be used to retrieve a certificate from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously retrieve a certificate from the key vault, using + * the {@link CertificateClient#getCertificate(String)} API.

    + * + * + *
    + * CertificatePolicy policy = certificateClient.getCertificatePolicy("certificateName");
    + * System.out.printf("Received policy with subject name %s%n", policy.getSubject());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link CertificateAsyncClient}.

    + * + *
    + * + *
    + * + *

    Delete a Certificate

    + * The {@link CertificateClient} can be used to delete a certificate from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously delete a certificate from the + * key vault, using the {@link CertificateClient#beginDeleteCertificate(String)} API.

    + * + * + *
    + * SyncPoller<DeletedCertificate, Void> deleteCertPoller =
    + *     certificateClient.beginDeleteCertificate("certificateName");
    + * // Deleted Certificate is accessible as soon as polling beings.
    + * PollResponse<DeletedCertificate> deleteCertPollResponse = deleteCertPoller.poll();
    + * System.out.printf("Deleted certificate with name %s and recovery id %s%n",
    + *     deleteCertPollResponse.getValue().getName(), deleteCertPollResponse.getValue().getRecoveryId());
    + * deleteCertPoller.waitForCompletion();
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link CertificateAsyncClient}.

    * + * @see com.azure.security.keyvault.certificates * @see CertificateClientBuilder - * @see PagedIterable */ @ServiceClient(builder = CertificateClientBuilder.class, serviceInterfaces = CertificateClientImpl.CertificateService.class) public final class CertificateClient { diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java index ce988c159811..05074be0b42b 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java @@ -114,6 +114,7 @@ public final class CertificateClientBuilder implements // Please see here // for more information on Azure resource provider namespaces. private static final String KEYVAULT_TRACING_NAMESPACE_VALUE = "Microsoft.KeyVault"; + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); private final List perCallPolicies; private final List perRetryPolicies; private final Map properties; @@ -214,15 +215,15 @@ private CertificateClientImpl buildInnerClient() { httpLogOptions = (httpLogOptions == null) ? new HttpLogOptions() : httpLogOptions; - policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(clientOptions, httpLogOptions), clientName, + ClientOptions localClientOptions = clientOptions != null ? clientOptions : DEFAULT_CLIENT_OPTIONS; + + policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(localClientOptions, httpLogOptions), clientName, clientVersion, buildConfiguration)); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach(header -> - httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach(header -> + httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); // Add per call additional policies. policies.addAll(perCallPolicies); @@ -239,7 +240,7 @@ private CertificateClientImpl buildInnerClient() { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); - TracingOptions tracingOptions = clientOptions == null ? null : clientOptions.getTracingOptions(); + TracingOptions tracingOptions = localClientOptions.getTracingOptions(); Tracer tracer = TracerProvider.getDefaultProvider() .createTracer(clientName, clientVersion, KEYVAULT_TRACING_NAMESPACE_VALUE, tracingOptions); @@ -247,6 +248,7 @@ private CertificateClientImpl buildInnerClient() { .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .tracer(tracer) + .clientOptions(localClientOptions) .build(); return new CertificateClientImpl(vaultUrl, pipeline, serviceVersion); diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java index de9df1e7c600..c562087d17d8 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java @@ -2,7 +2,181 @@ // Licensed under the MIT License. /** - * Package containing classes for creating {@link com.azure.security.keyvault.certificates.CertificateAsyncClient} and - * {@link com.azure.security.keyvault.certificates.CertificateClient} to perform operations on Azure Key Vault. + *

    Azure Key Vault is a cloud-based service + * provided by Microsoft Azure that allows users to securely store and manage cryptographic certificates used for encrypting + * and decrypting data. It is a part of Azure Key Vault, which is a cloud-based service for managing cryptographic certificates, + * keys, and secrets.

    + * + *

    Azure Key Vault Certificates provides a centralized and highly secure location for storing certificates, which + * eliminates the need to store sensitive certificate material in application code or configuration files. + * By leveraging Azure Key Vault, you can better protect your certificates and ensure their availability + * when needed.

    + * + *

    Key features of the Azure Key Vault Certificates service include:

    + * + *
      + *
    • Secure storage: Certificates are stored securely within Azure Key Vault, which provides robust encryption + * and access control mechanisms to protect against unauthorized access.
    • + *
    • Certificate lifecycle management: You can create, import, and manage certificates within Azure Key Vault. + * It supports common certificate formats such as X.509 and PFX.
    • + *
    • Certificate management operations: Azure Key Vault provides a comprehensive set of management operations, + * including certificate creation, deletion, retrieval, renewal, and revocation.
    • + *
    • Integration with Azure services: Key Vault Certificates can be easily integrated with other Azure services, + * such as Azure App Service, Azure Functions, and Azure Virtual Machines, to enable secure authentication + * and encryption.
    • + *
    + * + *

    The Azure Key Vault Certificates client library allows developers to securely store and manage certificates + * within Azure Key Vault. The library provides a set of APIs that enable developers to securely create, import, + * retrieve, update, and perform other certificate-related operations.

    + * + *

    Key Concepts:

    + * + *

    What is a Certificate Client?

    + * + *

    The certificate client performs the interactions with the Azure Key Vault service for getting, setting, updating, + * deleting, and listing certificates and its versions. Asynchronous (CertificateAsyncClient) and synchronous (CertificateClient) clients + * exist in the SDK allowing for the selection of a client based on an application's use case. Once you have + * initialized a certificate, you can interact with the primary resource types in Azure Key Vault.

    + * + *

    What is an Azure Key Vault Certificate ?

    + * + *

    Azure Key Vault supports certificates with secret content types (PKCS12 and PEM). The certificate can be + * backed by keys in Azure Key Vault of types (EC and RSA). In addition to the certificate policy, the following + * attributes may be specified:.

    + * + *
      + *
    • enabled: Specifies whether the certificate is enabled and usable.
    • + *
    • created: Indicates when this version of the certificate was created.
    • + *
    • updated: Indicates when this version of the certificate was updated.
    • + *
    + * + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link com.azure.security.keyvault.certificates.CertificateClient} or {@link com.azure.security.keyvault.certificates.CertificateAsyncClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Synchronous Certificate Client

    + * + *

    The following code sample demonstrates the creation of a {@link com.azure.security.keyvault.certificates.CertificateClient}, + * using the {@link com.azure.security.keyvault.certificates.CertificateClientBuilder} to configure it.

    + * + * + *
    + * CertificateClient certificateClient = new CertificateClientBuilder()
    + *     .credential(new DefaultAzureCredentialBuilder().build())
    + *     .vaultUrl("<your-key-vault-url>")
    + *     .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))
    + *     .buildClient();
    + * 
    + * + * + *

    Sample: Construct Asynchronous Certificate Client

    + * + *

    The following code sample demonstrates the creation of a + * {@link com.azure.security.keyvault.certificates.CertificateAsyncClient}, using the + * {@link com.azure.security.keyvault.certificates.CertificateClientBuilder} to configure it.

    + * + * + *
    + * CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder()
    + *     .credential(new DefaultAzureCredentialBuilder().build())
    + *     .vaultUrl("<your-key-vault-url>")
    + *     .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))
    + *     .buildAsyncClient();
    + * 
    + * + * + *
    + * + *
    + * + *

    Create a Certificate

    + * The {@link com.azure.security.keyvault.certificates.CertificateClient} or + * {@link com.azure.security.keyvault.certificates.CertificateAsyncClient} can be used to create a certificate in + * the key vault. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously create a certificate in the key vault, + * using the {@link com.azure.security.keyvault.certificates.CertificateClient#beginCreateCertificate(java.lang.String, com.azure.security.keyvault.certificates.models.CertificatePolicy)} API.

    + * + * + *
    + * CertificatePolicy certPolicy = new CertificatePolicy("Self",
    + *     "CN=SelfSignedJavaPkcs12");
    + * SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = certificateClient
    + *     .beginCreateCertificate("certificateName", certPolicy);
    + * certPoller.waitUntil(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED);
    + * KeyVaultCertificate cert = certPoller.getFinalResult();
    + * System.out.printf("Certificate created with name %s%n", cert.getName());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.certificates.CertificateAsyncClient}.

    + * + *
    + * + *
    + * + *

    Get a Certificate

    + * The {@link com.azure.security.keyvault.certificates.CertificateClient} or + * {@link com.azure.security.keyvault.certificates.CertificateAsyncClient} can be used to retrieve a certificate from the + * key vault. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously retrieve a certificate from the key vault, using + * the {@link com.azure.security.keyvault.certificates.CertificateClient#getCertificate(java.lang.String)}.

    + * + * + *
    + * CertificatePolicy policy = certificateClient.getCertificatePolicy("certificateName");
    + * System.out.printf("Received policy with subject name %s%n", policy.getSubject());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.certificates.CertificateAsyncClient}.

    + * + *
    + * + *
    + * + *

    Delete a Certificate

    + * The {@link com.azure.security.keyvault.certificates.CertificateClient} or + * {@link com.azure.security.keyvault.certificates.CertificateAsyncClient} can be used to delete a certificate from + * the key vault. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously delete a certificate from the + * key vault, using the {@link com.azure.security.keyvault.certificates.CertificateClient#beginDeleteCertificate(java.lang.String)} API.

    + * + * + *
    + * SyncPoller<DeletedCertificate, Void> deleteCertPoller =
    + *     certificateClient.beginDeleteCertificate("certificateName");
    + * // Deleted Certificate is accessible as soon as polling beings.
    + * PollResponse<DeletedCertificate> deleteCertPollResponse = deleteCertPoller.poll();
    + * System.out.printf("Deleted certificate with name %s and recovery id %s%n",
    + *     deleteCertPollResponse.getValue().getName(), deleteCertPollResponse.getValue().getRecoveryId());
    + * deleteCertPoller.waitForCompletion();
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.certificates.CertificateAsyncClient}.

    + * + * @see com.azure.security.keyvault.certificates.CertificateClient + * @see com.azure.security.keyvault.certificates.CertificateAsyncClient + * @see com.azure.security.keyvault.certificates.CertificateClientBuilder */ package com.azure.security.keyvault.certificates; diff --git a/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md index b861abd1505c..b9300a1f240e 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.7.0-beta.1 (Unreleased) +## 4.8.0-beta.1 (Unreleased) ### Features Added @@ -9,8 +9,21 @@ ### Bugs Fixed ### Other Changes + +## 4.7.0 (2023-09-25) + +### Bugs fixed +- Added a fallback mechanism to use service-side cryptography if not possible to perform operations locally. ([#36657](https://github.com/Azure/azure-sdk-for-java/pull/36657)) + +### Other Changes +- Due to internal client changes, made `KeyEncryptionKeyClient` extend `CryptographyClient`, mirroring their async counterparts. Functionality remains intact. - Migrate test recordings to assets repo. +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 4.6.5 (2023-08-21) ### Other Changes diff --git a/sdk/keyvault/azure-security-keyvault-keys/README.md b/sdk/keyvault/azure-security-keyvault-keys/README.md index 8724856d333a..1c6ac5929fcd 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/README.md +++ b/sdk/keyvault/azure-security-keyvault-keys/README.md @@ -45,7 +45,7 @@ If you want to take dependency on a particular version of the library that is no com.azure azure-security-keyvault-keys - 4.6.5 + 4.7.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/keyvault/azure-security-keyvault-keys/assets.json b/sdk/keyvault/azure-security-keyvault-keys/assets.json index 4cb30b276555..2b2baca70931 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/assets.json +++ b/sdk/keyvault/azure-security-keyvault-keys/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/keyvault/azure-security-keyvault-keys", - "Tag": "java/keyvault/azure-security-keyvault-keys_33dc64b40a" + "Tag": "java/keyvault/azure-security-keyvault-keys_2705f99034" } diff --git a/sdk/keyvault/azure-security-keyvault-keys/pom.xml b/sdk/keyvault/azure-security-keyvault-keys/pom.xml index ca11a9015ad0..9b1888377908 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-keys/pom.xml @@ -14,7 +14,7 @@ com.azure azure-security-keyvault-keys - 4.7.0-beta.1 + 4.8.0-beta.1 Microsoft Azure client library for KeyVault Keys This module contains client library for Microsoft Azure KeyVault Keys. diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java index b066b55d91d8..945883aae145 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java @@ -45,9 +45,27 @@ * The {@link KeyAsyncClient} provides asynchronous methods to manage {@link KeyVaultKey keys} in the Azure Key Vault. * The client supports creating, retrieving, updating, deleting, purging, backing up, restoring, listing, releasing * and rotating the {@link KeyVaultKey keys}. The client also supports listing {@link DeletedKey deleted keys} for a - * soft-delete enabled Azure Key Vault. + * soft-delete enabled key vault. + * + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link KeyAsyncClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Asynchronous Key Client

    + * + *

    The following code sample demonstrates the creation of a {@link KeyAsyncClient}, using the + * {@link KeyClientBuilder} to configure it.

    * - *

    Samples to construct the async client

    * *
      * KeyAsyncClient keyAsyncClient = new KeyClientBuilder()
    @@ -57,8 +75,78 @@
      * 
    * * + *
    + * + *
    + * + *

    Create a Cryptographic Key

    + * The {@link KeyAsyncClient} can be used to create a key in the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to asynchronously create a cryptographic key in the key vault, + * using the {@link KeyAsyncClient#createKey(String, KeyType)} API.

    + * + * + *
    + * keyAsyncClient.createKey("keyName", KeyType.EC)
    + *     .contextWrite(Context.of("key1", "value1", "key2", "value2"))
    + *     .subscribe(key ->
    + *         System.out.printf("Created key with name: %s and id: %s %n", key.getName(),
    + *             key.getId()));
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link KeyClient}.

    + * + *
    + * + *
    + * + *

    Get a Cryptographic Key

    + * The {@link KeyAsyncClient} can be used to retrieve a key from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to asynchronously retrieve a key from the key vault, using + * the {@link KeyAsyncClient#getKey(String)} API.

    + * + * + *
    + * keyAsyncClient.getKey("keyName")
    + *     .contextWrite(Context.of("key1", "value1", "key2", "value2"))
    + *     .subscribe(key ->
    + *         System.out.printf("Created key with name: %s and: id %s%n", key.getName(),
    + *             key.getId()));
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link KeyClient}.

    + * + *
    + * + *
    + * + *

    Delete a Cryptographic Key

    + * The {@link KeyAsyncClient} can be used to delete a key from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to asynchronously delete a key from the + * key vault, using the {@link KeyAsyncClient#beginDeleteKey(String)} API.

    + * + * + *
    + * keyAsyncClient.beginDeleteKey("keyName")
    + *     .subscribe(pollResponse -> {
    + *         System.out.printf("Deletion status: %s%n", pollResponse.getStatus());
    + *         System.out.printf("Key name: %s%n", pollResponse.getValue().getName());
    + *         System.out.printf("Key delete date: %s%n", pollResponse.getValue().getDeletedOn());
    + *     });
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link KeyClient}.

    + * + * @see com.azure.security.keyvault.keys * @see KeyClientBuilder - * @see PagedFlux */ @ServiceClient(builder = KeyClientBuilder.class, isAsync = true, serviceInterfaces = KeyClientImpl.KeyService.class) public final class KeyAsyncClient { diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java index 630f0d5c270c..6082145ba99b 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java @@ -39,7 +39,25 @@ * rotating the {@link KeyVaultKey keys}. The client also supports listing {@link DeletedKey deleted keys} for a * soft-delete enabled Azure Key Vault. * - *

    Samples to construct the sync client

    + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link KeyClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Synchronous Key Client

    + * + *

    The following code sample demonstrates the creation of a {@link KeyClient}, using the {@link KeyClientBuilder} + * to configure it.

    + * * *
      * KeyClient keyClient = new KeyClientBuilder()
    @@ -49,8 +67,80 @@
      * 
    * * + *
    + * + *
    + * + *

    Create a Cryptographic Key

    + * The {@link KeyClient} can be used to create a key in the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously create a cryptographic key in the key vault, + * using the {@link KeyClient#createKey(String, KeyType)} API.

    + * + * + *
    + * KeyVaultKey key = keyClient.createKey("keyName", KeyType.EC);
    + * System.out.printf("Created key with name: %s and id: %s%n", key.getName(), key.getId());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link KeyAsyncClient}.

    + * + *
    + * + *
    + * + *

    Get a Cryptographic Key

    + * The {@link KeyClient} can be used to retrieve a key from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously retrieve a key from the key vault, using + * the {@link KeyClient#getKey(String)} API.

    + * + * + *
    + * KeyVaultKey keyWithVersionValue = keyClient.getKey("keyName");
    + *
    + * System.out.printf("Retrieved key with name: %s and: id %s%n", keyWithVersionValue.getName(),
    + *     keyWithVersionValue.getId());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link KeyAsyncClient}.

    + * + *
    + * + *
    + * + *

    Delete a Cryptographic Key

    + * The {@link KeyClient} can be used to delete a key from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously delete a key from the + * key vault, using the {@link KeyClient#beginDeleteKey(String)} API.

    + * + * + *
    + * SyncPoller<DeletedKey, Void> deleteKeyPoller = keyClient.beginDeleteKey("keyName");
    + * PollResponse<DeletedKey> deleteKeyPollResponse = deleteKeyPoller.poll();
    + *
    + * // Deleted date only works for SoftDelete Enabled Key Vault.
    + * DeletedKey deletedKey = deleteKeyPollResponse.getValue();
    + *
    + * System.out.printf("Key delete date: %s%n", deletedKey.getDeletedOn());
    + * System.out.printf("Deleted key's recovery id: %s%n", deletedKey.getRecoveryId());
    + *
    + * // Key is being deleted on the server.
    + * deleteKeyPoller.waitForCompletion();
    + * // Key is deleted
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link KeyAsyncClient}.

    + * + * @see com.azure.security.keyvault.keys * @see KeyClientBuilder - * @see PagedIterable */ @ServiceClient(builder = KeyClientBuilder.class, serviceInterfaces = KeyClientImpl.KeyService.class) public final class KeyClient { @@ -127,7 +217,6 @@ public CryptographyClient getCryptographyClient(String keyName, String keyVersio * *
          * KeyVaultKey key = keyClient.createKey("keyName", KeyType.EC);
    -     *
          * System.out.printf("Created key with name: %s and id: %s%n", key.getName(), key.getId());
          * 
    * diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java index e18af7349eec..a5218c2b10e6 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java @@ -75,7 +75,7 @@ * * * - *

    The minimal configuration options required by {@link KeyClientBuilder secretClientBuilder} to build {@link + *

    The minimal configuration options required by {@link KeyClientBuilder keyClientBuilder} to build {@link * KeyClient} are {@link String vaultUrl} and {@link TokenCredential credential}.

    * * @@ -104,6 +104,7 @@ public final class KeyClientBuilder implements // Please see here // for more information on Azure resource provider namespaces. private static final String KEYVAULT_TRACING_NAMESPACE_VALUE = "Microsoft.KeyVault"; + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); private final List perCallPolicies; private final List perRetryPolicies; @@ -201,15 +202,15 @@ private KeyClientImpl buildInnerClient() { httpLogOptions = (httpLogOptions == null) ? new HttpLogOptions() : httpLogOptions; - policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(clientOptions, httpLogOptions), clientName, + ClientOptions localClientOptions = clientOptions != null ? clientOptions : DEFAULT_CLIENT_OPTIONS; + + policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(localClientOptions, httpLogOptions), clientName, clientVersion, buildConfiguration)); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach(header -> - httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach(header -> + httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); // Add per call additional policies. policies.addAll(perCallPolicies); @@ -225,7 +226,7 @@ private KeyClientImpl buildInnerClient() { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); - TracingOptions tracingOptions = clientOptions == null ? null : clientOptions.getTracingOptions(); + TracingOptions tracingOptions = localClientOptions.getTracingOptions(); Tracer tracer = TracerProvider.getDefaultProvider() .createTracer(clientName, clientVersion, KEYVAULT_TRACING_NAMESPACE_VALUE, tracingOptions); @@ -233,6 +234,7 @@ private KeyClientImpl buildInnerClient() { .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .tracer(tracer) + .clientOptions(localClientOptions) .build(); return new KeyClientImpl(vaultUrl, pipeline, serviceVersion); diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java index 21420395a933..26468873e1d0 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java @@ -42,7 +42,24 @@ * asymmetric and symmetric keys. The client supports encrypt, decrypt, wrap key, unwrap key, sign and verify * operations using the configured key. * - *

    Samples to construct the sync client

    + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link CryptographyAsyncClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Asynchronous Cryptography Client

    + * + *

    The following code sample demonstrates the creation of a {@link CryptographyAsyncClient}, using the + * {@link CryptographyClientBuilder} to configure it.

    * * *
    @@ -52,6 +69,7 @@
      *     .buildAsyncClient();
      * 
    * + * * *
      * JsonWebKey jsonWebKey = new JsonWebKey().setId("SampleJsonWebKey");
    @@ -61,6 +79,59 @@
      * 
    * * + *
    + * + *
    + * + *

    Encrypt Data

    + * The {@link CryptographyAsyncClient} can be used to encrypt data. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to asynchronously encrypt data using the + * {@link CryptographyAsyncClient#encrypt(EncryptionAlgorithm, byte[])} API.

    + * + * + *
    + * byte[] plaintext = new byte[100];
    + * new Random(0x1234567L).nextBytes(plaintext);
    + *
    + * cryptographyAsyncClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plaintext)
    + *     .contextWrite(Context.of("key1", "value1", "key2", "value2"))
    + *     .subscribe(encryptResult ->
    + *         System.out.printf("Received encrypted content of length: %d, with algorithm: %s.%n",
    + *             encryptResult.getCipherText().length, encryptResult.getAlgorithm().toString()));
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link CryptographyClient}.

    + * + *
    + * + *
    + * + *

    Decrypt Data

    + * The {@link CryptographyAsyncClient} can be used to decrypt data. + * + *

    Code Sample:

    + * + *

    The following code sample demonstrates how to asynchronously decrypt data using the + * {@link CryptographyAsyncClient#decrypt(EncryptionAlgorithm, byte[])} API.

    + * + * + *
    + * byte[] ciphertext = new byte[100];
    + * new Random(0x1234567L).nextBytes(ciphertext);
    + *
    + * cryptographyAsyncClient.decrypt(EncryptionAlgorithm.RSA_OAEP, ciphertext)
    + *     .contextWrite(Context.of("key1", "value1", "key2", "value2"))
    + *     .subscribe(decryptResult ->
    + *         System.out.printf("Received decrypted content of length: %d%n", decryptResult.getPlainText().length));
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link CryptographyClient}.

    + * + * @see com.azure.security.keyvault.keys.cryptography * @see CryptographyClientBuilder */ @ServiceClient(builder = CryptographyClientBuilder.class, isAsync = true, serviceInterfaces = CryptographyService.class) @@ -70,12 +141,13 @@ public class CryptographyAsyncClient { private final String keyCollection; private final HttpPipeline pipeline; + private volatile boolean localOperationNotSupported = false; private LocalKeyCryptographyClient localKeyCryptographyClient; final CryptographyClientImpl implClient; final String keyId; - JsonWebKey key; + volatile JsonWebKey key; /** * Creates a {@link CryptographyAsyncClient} that uses a given {@link HttpPipeline pipeline} to service requests. @@ -331,7 +403,7 @@ public Mono encrypt(EncryptParameters encryptParameters) { } Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.encryptAsync(algorithm, plaintext, context); } @@ -346,7 +418,7 @@ Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Con } Mono encrypt(EncryptParameters encryptParameters, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.encryptAsync(encryptParameters, context); } @@ -477,7 +549,7 @@ public Mono decrypt(DecryptParameters decryptParameters) { } Mono decrypt(EncryptionAlgorithm algorithm, byte[] ciphertext, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.decryptAsync(algorithm, ciphertext, context); } @@ -492,7 +564,7 @@ Mono decrypt(EncryptionAlgorithm algorithm, byte[] ciphertext, Co } Mono decrypt(DecryptParameters decryptParameters, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.decryptAsync(decryptParameters, context); } @@ -559,7 +631,7 @@ public Mono sign(SignatureAlgorithm algorithm, byte[] digest) { } Mono sign(SignatureAlgorithm algorithm, byte[] digest, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.signAsync(algorithm, digest, context); } @@ -629,7 +701,7 @@ public Mono verify(SignatureAlgorithm algorithm, byte[] digest, by } Mono verify(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.verifyAsync(algorithm, digest, signature, context); } @@ -694,7 +766,7 @@ public Mono wrapKey(KeyWrapAlgorithm algorithm, byte[] key) { } Mono wrapKey(KeyWrapAlgorithm algorithm, byte[] key, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.wrapKeyAsync(algorithm, key, context); } @@ -762,7 +834,7 @@ public Mono unwrapKey(KeyWrapAlgorithm algorithm, byte[] encrypted } Mono unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.unwrapKeyAsync(algorithm, encryptedKey, context); } @@ -827,7 +899,7 @@ public Mono signData(SignatureAlgorithm algorithm, byte[] data) { } Mono signData(SignatureAlgorithm algorithm, byte[] data, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.signDataAsync(algorithm, data, context); } @@ -896,7 +968,7 @@ public Mono verifyData(SignatureAlgorithm algorithm, byte[] data, } Mono verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context) { - return ensureValidKeyAvailable().flatMap(available -> { + return isValidKeyLocallyAvailable().flatMap(available -> { if (!available) { return implClient.verifyDataAsync(algorithm, data, signature, context); } @@ -910,18 +982,29 @@ Mono verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] }); } - private Mono ensureValidKeyAvailable() { + private Mono isValidKeyLocallyAvailable() { + if (localOperationNotSupported) { + return Mono.just(false); + } + boolean keyNotAvailable = (key == null && keyCollection != null); - boolean keyNotValid = (key != null && !key.isValid()); - if (keyNotAvailable || keyNotValid) { - if (keyCollection.equals(CryptographyClientImpl.SECRETS_COLLECTION)) { + if (keyNotAvailable) { + if (Objects.equals(keyCollection, CryptographyClientImpl.SECRETS_COLLECTION)) { return getSecretKey().map(jsonWebKey -> { - key = (jsonWebKey); + key = jsonWebKey; if (key.isValid()) { if (localKeyCryptographyClient == null) { - localKeyCryptographyClient = initializeCryptoClient(key, implClient); + try { + localKeyCryptographyClient = initializeCryptoClient(key, implClient); + } catch (RuntimeException e) { + localOperationNotSupported = true; + + LOGGER.warning("Defaulting to service use for cryptographic operations.", e); + + return false; + } } return true; @@ -931,11 +1014,19 @@ private Mono ensureValidKeyAvailable() { }); } else { return getKey().map(keyVaultKey -> { - key = (keyVaultKey.getKey()); + key = keyVaultKey.getKey(); if (key.isValid()) { if (localKeyCryptographyClient == null) { - localKeyCryptographyClient = initializeCryptoClient(key, implClient); + try { + localKeyCryptographyClient = initializeCryptoClient(key, implClient); + } catch (RuntimeException e) { + localOperationNotSupported = true; + + LOGGER.warning("Defaulting to service use for cryptographic operations.", e); + + return false; + } } return true; @@ -945,11 +1036,7 @@ private Mono ensureValidKeyAvailable() { }); } } else { - return Mono.defer(() -> Mono.just(true)); + return Mono.just(true); } } - - CryptographyClientImpl getImplClient() { - return implClient; - } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java index 8d167066d61a..2ca470342b41 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java @@ -40,7 +40,24 @@ * symmetric keys. The client supports encrypt, decrypt, wrap key, unwrap key, sign and verify operations using the * configured key. * - *

    Samples to construct the sync client

    + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link CryptographyClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Synchronous Cryptography Client

    + * + *

    The following code sample demonstrates the creation of a {@link CryptographyClient}, using the + * {@link CryptographyClientBuilder} to configure it.

    * * *
    @@ -50,6 +67,7 @@
      *     .buildClient();
      * 
    * + * * *
      * JsonWebKey jsonWebKey = new JsonWebKey().setId("SampleJsonWebKey");
    @@ -59,6 +77,57 @@
      * 
    * * + *
    + * + *
    + * + *

    Encrypt Data

    + * The {@link CryptographyClient} can be used to encrypt data. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously encrypt data using the + * {@link CryptographyClient#encrypt(EncryptionAlgorithm, byte[])} API. + *

    + * + * + *
    + * byte[] plaintext = new byte[100];
    + * new Random(0x1234567L).nextBytes(plaintext);
    + *
    + * EncryptResult encryptResult = cryptographyClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plaintext);
    + *
    + * System.out.printf("Received encrypted content of length: %d, with algorithm: %s.%n",
    + *     encryptResult.getCipherText().length, encryptResult.getAlgorithm());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link CryptographyAsyncClient}.

    + * + *
    + * + *
    + * + *

    Decrypt Data

    + * The {@link CryptographyClient} can be used to decrypt data. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously decrypt data using the + * {@link CryptographyClient#decrypt(EncryptionAlgorithm, byte[])} API.

    + * + * + *
    + * byte[] ciphertext = new byte[100];
    + * new Random(0x1234567L).nextBytes(ciphertext);
    + *
    + * DecryptResult decryptResult = cryptographyClient.decrypt(EncryptionAlgorithm.RSA_OAEP, ciphertext);
    + *
    + * System.out.printf("Received decrypted content of length: %d.%n", decryptResult.getPlainText().length);
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link CryptographyAsyncClient}.

    + * + * @see com.azure.security.keyvault.keys.cryptography * @see CryptographyClientBuilder */ @ServiceClient(builder = CryptographyClientBuilder.class, serviceInterfaces = CryptographyService.class) @@ -66,14 +135,14 @@ public class CryptographyClient { private static final ClientLogger LOGGER = new ClientLogger(CryptographyClient.class); private final String keyCollection; - private final HttpPipeline pipeline; + private volatile boolean localOperationNotSupported = false; private LocalKeyCryptographyClient localKeyCryptographyClient; final CryptographyClientImpl implClient; final String keyId; - JsonWebKey key; + volatile JsonWebKey key; /** * Creates a {@link CryptographyClient} that uses a given {@link HttpPipeline pipeline} to service requests. @@ -85,7 +154,6 @@ public class CryptographyClient { CryptographyClient(String keyId, HttpPipeline pipeline, CryptographyServiceVersion version) { this.keyCollection = unpackAndValidateId(keyId); this.keyId = keyId; - this.pipeline = pipeline; this.implClient = new CryptographyClientImpl(keyId, pipeline, version); this.key = null; } @@ -114,7 +182,6 @@ public class CryptographyClient { this.keyCollection = null; this.key = jsonWebKey; this.keyId = jsonWebKey.getId(); - this.pipeline = null; this.implClient = null; this.localKeyCryptographyClient = initializeCryptoClient(key, null); } @@ -290,7 +357,7 @@ public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext) { */ @ServiceMethod(returns = ReturnType.SINGLE) public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.encrypt(algorithm, plaintext, context); } @@ -359,7 +426,7 @@ public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Co */ @ServiceMethod(returns = ReturnType.SINGLE) public EncryptResult encrypt(EncryptParameters encryptParameters, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.encrypt(encryptParameters, context); } @@ -481,7 +548,7 @@ public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] ciphertext) { */ @ServiceMethod(returns = ReturnType.SINGLE) public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] ciphertext, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.decrypt(algorithm, ciphertext, context); } @@ -551,7 +618,7 @@ public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] ciphertext, C */ @ServiceMethod(returns = ReturnType.SINGLE) public DecryptResult decrypt(DecryptParameters decryptParameters, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.decrypt(decryptParameters, context); } @@ -653,7 +720,7 @@ public SignResult sign(SignatureAlgorithm algorithm, byte[] digest) { */ @ServiceMethod(returns = ReturnType.SINGLE) public SignResult sign(SignatureAlgorithm algorithm, byte[] digest, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.sign(algorithm, digest, context); } @@ -763,7 +830,7 @@ public VerifyResult verify(SignatureAlgorithm algorithm, byte[] digest, byte[] s */ @ServiceMethod(returns = ReturnType.SINGLE) public VerifyResult verify(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.verify(algorithm, digest, signature, context); } @@ -863,7 +930,7 @@ public WrapResult wrapKey(KeyWrapAlgorithm algorithm, byte[] key) { */ @ServiceMethod(returns = ReturnType.SINGLE) public WrapResult wrapKey(KeyWrapAlgorithm algorithm, byte[] key, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.wrapKey(algorithm, key, context); } @@ -971,7 +1038,7 @@ public UnwrapResult unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey) { */ @ServiceMethod(returns = ReturnType.SINGLE) public UnwrapResult unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.unwrapKey(algorithm, encryptedKey, context); } @@ -1067,7 +1134,7 @@ public SignResult signData(SignatureAlgorithm algorithm, byte[] data) { */ @ServiceMethod(returns = ReturnType.SINGLE) public SignResult signData(SignatureAlgorithm algorithm, byte[] data, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.signData(algorithm, data, context); } @@ -1174,7 +1241,7 @@ public VerifyResult verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] */ @ServiceMethod(returns = ReturnType.SINGLE) public VerifyResult verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context) { - if (!ensureValidKeyAvailable()) { + if (!isValidKeyLocallyAvailable()) { return implClient.verifyData(algorithm, data, signature, context); } @@ -1187,28 +1254,41 @@ public VerifyResult verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] return localKeyCryptographyClient.verifyData(algorithm, data, signature, key, context); } - private boolean ensureValidKeyAvailable() { + private boolean isValidKeyLocallyAvailable() { + if (localOperationNotSupported) { + return false; + } + boolean keyNotAvailable = (key == null && keyCollection != null); - boolean keyNotValid = (key != null && !key.isValid()); - if (keyNotAvailable || keyNotValid) { - if (keyCollection.equals(CryptographyClientImpl.SECRETS_COLLECTION)) { + if (keyNotAvailable) { + if (Objects.equals(keyCollection, CryptographyClientImpl.SECRETS_COLLECTION)) { key = getSecretKey(); } else { key = getKey().getKey(); } + } - if (key.isValid()) { - if (localKeyCryptographyClient == null) { + if (key == null) { + return false; + } + + if (key.isValid()) { + if (localKeyCryptographyClient == null) { + try { localKeyCryptographyClient = initializeCryptoClient(key, implClient); - } + } catch (RuntimeException e) { + localOperationNotSupported = true; - return true; - } else { - return false; + LOGGER.warning("Defaulting to service use for cryptographic operations.", e); + + return false; + } } - } else { + return true; + } else { + return false; } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java index 312347aabed7..e0fb1fc8cbd0 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java @@ -263,15 +263,15 @@ HttpPipeline setupPipeline() { httpLogOptions = (httpLogOptions == null) ? new HttpLogOptions() : httpLogOptions; - policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(clientOptions, httpLogOptions), clientName, + ClientOptions localClientOptions = clientOptions != null ? clientOptions : new ClientOptions(); + + policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(localClientOptions, httpLogOptions), clientName, clientVersion, buildConfiguration)); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach(header -> - httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach(header -> + httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); // Add per call additional policies. policies.addAll(perCallPolicies); @@ -288,7 +288,7 @@ HttpPipeline setupPipeline() { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); - TracingOptions tracingOptions = clientOptions == null ? null : clientOptions.getTracingOptions(); + TracingOptions tracingOptions = localClientOptions.getTracingOptions(); Tracer tracer = TracerProvider.getDefaultProvider() .createTracer(clientName, clientVersion, KEYVAULT_TRACING_NAMESPACE_VALUE, tracingOptions); @@ -296,6 +296,7 @@ HttpPipeline setupPipeline() { .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .tracer(tracer) + .clientOptions(localClientOptions) .build(); } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientImpl.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientImpl.java index 73a88ae42827..11acc35fbdf7 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientImpl.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientImpl.java @@ -617,15 +617,25 @@ static String unpackAndValidateId(String keyId) { static LocalKeyCryptographyClient initializeCryptoClient(JsonWebKey jsonWebKey, CryptographyClientImpl implClient) { - if (jsonWebKey.getKeyType().equals(RSA) || jsonWebKey.getKeyType().equals(RSA_HSM)) { - return new RsaKeyCryptographyClient(jsonWebKey, implClient); - } else if (jsonWebKey.getKeyType().equals(EC) || jsonWebKey.getKeyType().equals(EC_HSM)) { - return new EcKeyCryptographyClient(jsonWebKey, implClient); - } else if (jsonWebKey.getKeyType().equals(OCT) || jsonWebKey.getKeyType().equals(OCT_HSM)) { - return new AesKeyCryptographyClient(jsonWebKey, implClient); - } else { + if (!KeyType.values().contains(jsonWebKey.getKeyType())) { throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( "The JSON Web Key type: %s is not supported.", jsonWebKey.getKeyType().toString()))); + } else { + try { + if (jsonWebKey.getKeyType().equals(RSA) || jsonWebKey.getKeyType().equals(RSA_HSM)) { + return new RsaKeyCryptographyClient(jsonWebKey, implClient); + } else if (jsonWebKey.getKeyType().equals(EC) || jsonWebKey.getKeyType().equals(EC_HSM)) { + return new EcKeyCryptographyClient(jsonWebKey, implClient); + } else if (jsonWebKey.getKeyType().equals(OCT) || jsonWebKey.getKeyType().equals(OCT_HSM)) { + return new AesKeyCryptographyClient(jsonWebKey, implClient); + } + } catch (RuntimeException e) { + throw LOGGER.logExceptionAsError( + new RuntimeException("Could not initialize local cryptography client.", e)); + } + + // Should not reach here. + return null; } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/package-info.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/package-info.java index 8b08cc969462..db163cb61c91 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/package-info.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/package-info.java @@ -2,7 +2,134 @@ // Licensed under the MIT License. /** - * Package containing classes for creating {@link com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient} - * and {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient} to perform cryptography operations. + *

    Azure Key Vault is a cloud-based service + * provided by Microsoft Azure that allows users to securely store and manage cryptographic keys used for encrypting + * and decrypting data. It is a part of Azure Key Vault, which is a cloud-based service for managing cryptographic keys, + * secrets, and certificates.

    + * + *

    The service supports various cryptographic algorithms and operations, including symmetric and asymmetric + * encryption, digital signatures, hashing, and random number generation. You can use the service to perform + * operations like encrypting sensitive data before storing it, decrypting data when needed, signing data to ensure + * its integrity, and verifying signatures to validate the authenticity of the data.

    + * + *

    By utilizing Azure Key Vault Cryptography service, you benefit from the strong security features provided + * by Azure Key Vault, such as hardware security modules (HSMs) for key storage and cryptographic operations, + * access control policies, and audit logging. It helps you protect your sensitive data and comply with industry + * standards and regulatory requirements.

    + * + *

    The Azure Key Vault Keys Cryptography client library allows developers to interact with the Azure Key Vault service + * from their applications. The library provides a set of APIs that enable developers to securely encrypt, decrypt, + * sign, and verify data using cryptographic keys securely stored in Key Vault.

    + * + *

    Key Concepts:

    + * + *

    What is a Cryptography Client?

    + *

    The cryptography client performs the cryptographic operations locally or calls the Azure Key Vault service + * depending on how much key information is available locally. It supports encrypting, decrypting, signing, + * verifying, key wrapping, key unwrapping, and retrieving the configured key. + * Asynchronous (`CryptographyAsyncClient`) and synchronous (`CryptographyClient`) clients exist in the SDK + * allowing for the selection of a client based on an application's use case.

    + * + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient} class, a vault url and a + * credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Synchronous Cryptography Client

    + * + *

    The following code sample demonstrates the creation of a + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient}, + * using the {@link com.azure.security.keyvault.keys.cryptography.CryptographyClientBuilder} to configure it.

    + * + * + *
    + * CryptographyClient cryptographyClient = new CryptographyClientBuilder()
    + *     .keyIdentifier("<your-key-id>")
    + *     .credential(new DefaultAzureCredentialBuilder().build())
    + *     .buildClient();
    + * 
    + * + * + *

    Sample: Construct Asynchronous Cryptography Client

    + * + *

    The following code sample demonstrates the creation of a + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient}, using the + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyClientBuilder} to configure it.

    + * + * + *
    + * CryptographyAsyncClient cryptographyAsyncClient = new CryptographyClientBuilder()
    + *     .keyIdentifier("<your-key-id>")
    + *     .credential(new DefaultAzureCredentialBuilder().build())
    + *     .buildAsyncClient();
    + * 
    + * + * + *
    + * + *
    + * + *

    Encrypt Data

    + * The {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient} or + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient} can be used to encrypt data. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously encrypt data using the + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient#encrypt(com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm, byte[])} API.

    + * + * + *
    + * byte[] plaintext = new byte[100];
    + * new Random(0x1234567L).nextBytes(plaintext);
    + *
    + * EncryptResult encryptResult = cryptographyClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plaintext);
    + *
    + * System.out.printf("Received encrypted content of length: %d, with algorithm: %s.%n",
    + *     encryptResult.getCipherText().length, encryptResult.getAlgorithm());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient}.

    + * + *
    + * + *
    + * + *

    Decrypt Data

    + * The {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient} or + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient} can be used to decrypt data. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously decrypt data using the + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient#decrypt(com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm, byte[])} API.

    + * + * + *
    + * byte[] ciphertext = new byte[100];
    + * new Random(0x1234567L).nextBytes(ciphertext);
    + *
    + * DecryptResult decryptResult = cryptographyClient.decrypt(EncryptionAlgorithm.RSA_OAEP, ciphertext);
    + *
    + * System.out.printf("Received decrypted content of length: %d.%n", decryptResult.getPlainText().length);
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient}.

    + * + * @see com.azure.security.keyvault.keys.cryptography.CryptographyClient + * @see com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient + * @see com.azure.security.keyvault.keys.cryptography.CryptographyClientBuilder */ package com.azure.security.keyvault.keys.cryptography; diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/JsonWebKey.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/JsonWebKey.java index eed5387bc516..a444f568a6ad 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/JsonWebKey.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/JsonWebKey.java @@ -778,36 +778,35 @@ public KeyPair toEc(boolean includePrivateParameters) { * @throws IllegalStateException if an instance of EC key pair cannot be generated */ public KeyPair toEc(boolean includePrivateParameters, Provider provider) { + if (!KeyType.EC.equals(keyType) && !KeyType.EC_HSM.equals(keyType)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException("Not an EC key.")); + } if (provider == null) { - // Our default provider for this class + // Our default provider for this class. provider = Security.getProvider("SunEC"); } - if (!KeyType.EC.equals(keyType) && !KeyType.EC_HSM.equals(keyType)) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException("Not an EC key.")); - } - try { KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", provider); - ECGenParameterSpec gps = new ECGenParameterSpec(CURVE_TO_SPEC_NAME.get(crv)); + kpg.initialize(gps); // Generate dummy keypair to get parameter spec. - KeyPair apair = kpg.generateKeyPair(); - ECPublicKey apub = (ECPublicKey) apair.getPublic(); - ECParameterSpec aspec = apub.getParams(); + KeyPair keyPair = kpg.generateKeyPair(); + ECPublicKey publicKey = (ECPublicKey) keyPair.getPublic(); + ECParameterSpec ecParameterSpec = publicKey.getParams(); ECPoint ecPoint = new ECPoint(new BigInteger(1, x), new BigInteger(1, y)); KeyPair realKeyPair; if (includePrivateParameters) { - realKeyPair = new KeyPair(getEcPublicKey(ecPoint, aspec, provider), - getEcPrivateKey(d, aspec, provider)); + realKeyPair = new KeyPair(getEcPublicKey(ecPoint, ecParameterSpec, provider), + getEcPrivateKey(d, ecParameterSpec, provider)); } else { - realKeyPair = new KeyPair(getEcPublicKey(ecPoint, aspec, provider), null); + realKeyPair = new KeyPair(getEcPublicKey(ecPoint, ecParameterSpec, provider), null); } return realKeyPair; @@ -825,20 +824,20 @@ public KeyPair toEc(boolean includePrivateParameters, Provider provider) { * @return the JSON web key, converted from EC key pair. */ public static JsonWebKey fromEc(KeyPair keyPair, Provider provider) { - - ECPublicKey apub = (ECPublicKey) keyPair.getPublic(); - ECPoint point = apub.getW(); - ECPrivateKey apriv = (ECPrivateKey) keyPair.getPrivate(); - - if (apriv != null) { - return new JsonWebKey().setKeyType(KeyType.EC).setCurveName(getCurveFromKeyPair(keyPair, provider)) - .setX(point.getAffineX().toByteArray()).setY(point.getAffineY().toByteArray()) - .setD(apriv.getS().toByteArray()).setKeyType(KeyType.EC); - } else { - return new JsonWebKey().setKeyType(KeyType.EC).setCurveName(getCurveFromKeyPair(keyPair, provider)) - .setX(point.getAffineX().toByteArray()).setY(point.getAffineY().toByteArray()) - .setKeyType(KeyType.EC); + ECPublicKey publicKey = (ECPublicKey) keyPair.getPublic(); + JsonWebKey jsonWebKey = new JsonWebKey() + .setKeyType(KeyType.EC) + .setCurveName(getCurveFromKeyPair(keyPair, provider)) + .setX(publicKey.getW().getAffineX().toByteArray()) + .setY(publicKey.getW().getAffineY().toByteArray()) + .setKeyType(KeyType.EC); + ECPrivateKey ecPrivateKey = (ECPrivateKey) keyPair.getPrivate(); + + if (ecPrivateKey != null) { + jsonWebKey.setD(ecPrivateKey.getS().toByteArray()); } + + return jsonWebKey; } /** @@ -1046,10 +1045,10 @@ public boolean isValid() { } if (keyOps != null) { - final Set set = - new HashSet(KeyOperation.values()); - for (int i = 0; i < keyOps.size(); i++) { - if (!set.contains(keyOps.get(i))) { + final Set set = new HashSet<>(KeyOperation.values()); + + for (KeyOperation keyOp : keyOps) { + if (!set.contains(keyOp)) { return false; } } @@ -1106,6 +1105,7 @@ private boolean isValidRsaHsm() { private boolean isValidEc() { boolean ecPointParameters = (x != null && y != null); + if (!ecPointParameters || crv == null) { return false; } @@ -1116,6 +1116,7 @@ private boolean isValidEc() { private boolean isValidEcHsm() { // MAY have public key parameters boolean ecPointParameters = (x != null && y != null); + if ((ecPointParameters && crv == null) || (!ecPointParameters && crv != null)) { return false; } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/package-info.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/package-info.java index cd98a74db107..3a57e4fb84ee 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/package-info.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/package-info.java @@ -2,7 +2,170 @@ // Licensed under the MIT License. /** - * Package containing classes for creating {@link com.azure.security.keyvault.keys.KeyAsyncClient} and - * {@link com.azure.security.keyvault.keys.KeyClient} to perform operations on Azure Key Vault. + *

    Azure Key Vault is a cloud-based service + * provided by Microsoft Azure that allows users to securely store and manage cryptographic keys used for encrypting + * and decrypting data. It is a part of Azure Key Vault, which is a cloud-based service for managing cryptographic keys, + * secrets, and certificates.

    + * + *

    Azure Key Vault Keys provides a centralized and highly secure key management solution, allowing you to protect + * your keys and control access to them. It eliminates the need for storing keys in code or configuration files, + * reducing the risk of exposure and unauthorized access.

    + * + *

    With Azure Key Vault Keys, you can perform various operations on cryptographic keys, such as creating keys, + * importing existing keys, generating key pairs, encrypting data using keys, and decrypting data using keys. + * The service supports various key types and algorithms, including symmetric keys, asymmetric keys, and + * Elliptic Curve Cryptography (ECC) keys.

    + * + *

    The Azure Key Vault Keys client library allows developers to interact with the Azure Key Vault service + * from their applications. The library provides a set of APIs that enable developers to securely create keys, + * import existing keys, delete keys, retrieving key metadata, encrypting and decrypting data using keys, + * and signing and verifying signatures using keys.

    + * + *

    Key Concepts:

    + * + *

    What is a Key Client?

    + *

    The key client performs the interactions with the Azure Key Vault service for getting, setting, updating, + * deleting, and listing keys and its versions. Asynchronous (`KeyAsyncClient`) and synchronous (`KeyClient`) clients + * exist in the SDK allowing for the selection of a client based on an application's use case. Once you have + * initialized a key, you can interact with the primary resource types in Key Vault.

    + * + *

    What is an Azure Key Vault Key ?

    + *

    Azure Key Vault supports multiple key types (RSA and EC) and algorithms, and enables the use of + * Hardware Security Modules (HSM) for high value keys. In addition to the key material, the following attributes may + * be specified:

    + * + *
      + *
    • enabled: Specifies whether the key is enabled and usable for cryptographic operations.
    • + *
    • notBefore: Identifies the time before which the key must not be used for cryptographic operations.
    • + *
    • expires: Identifies the expiration time on or after which the key MUST NOT be used for cryptographic operations.
    • + *
    • created: Indicates when this version of the key was created.
    • + *
    • updated: Indicates when this version of the key was updated.
    • + *
    + * + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link com.azure.security.keyvault.keys.KeyClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Synchronous Key Client

    + * + *

    The following code sample demonstrates the creation of a {@link com.azure.security.keyvault.keys.KeyClient}, + * using the {@link com.azure.security.keyvault.keys.KeyClientBuilder} to configure it.

    + * + * + *
    + * KeyClient keyClient = new KeyClientBuilder()
    + *     .vaultUrl("<your-key-vault-url>")
    + *     .credential(new DefaultAzureCredentialBuilder().build())
    + *     .buildClient();
    + * 
    + * + * + *

    Sample: Construct Asynchronous Key Client

    + * + *

    The following code sample demonstrates the creation of a + * {@link com.azure.security.keyvault.keys.KeyClient}, using the + * {@link com.azure.security.keyvault.keys.KeyClientBuilder} to configure it.

    + * + * + *
    + * KeyAsyncClient keyAsyncClient = new KeyClientBuilder()
    + *     .vaultUrl("<your-key-vault-url>")
    + *     .credential(new DefaultAzureCredentialBuilder().build())
    + *     .buildAsyncClient();
    + * 
    + * + * + *
    + * + *
    + * + *

    Create a Cryptographic Key

    + * The {@link com.azure.security.keyvault.keys.KeyClient} or + * {@link com.azure.security.keyvault.keys.KeyAsyncClient} can be used to create a key in the key vault. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously create a cryptographic key in the key vault, + * using the {@link com.azure.security.keyvault.keys.KeyClient#createKey(java.lang.String, com.azure.security.keyvault.keys.models.KeyType)} API.

    + * + * + *
    + * KeyVaultKey key = keyClient.createKey("keyName", KeyType.EC);
    + * System.out.printf("Created key with name: %s and id: %s%n", key.getName(), key.getId());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.keys.KeyAsyncClient}.

    + * + *
    + * + *
    + * + *

    Get a Cryptographic Key

    + * The {@link com.azure.security.keyvault.keys.KeyClient} or + * {@link com.azure.security.keyvault.keys.KeyAsyncClient} can be used to retrieve a key from the + * key vault. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously retrieve a key from the key vault, using + * the {@link com.azure.security.keyvault.keys.KeyClient#getKey(java.lang.String)} API.

    + * + * + *
    + * KeyVaultKey keyWithVersionValue = keyClient.getKey("keyName");
    + *
    + * System.out.printf("Retrieved key with name: %s and: id %s%n", keyWithVersionValue.getName(),
    + *     keyWithVersionValue.getId());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.keys.KeyAsyncClient}.

    + * + *
    + * + *
    + * + *

    Delete a Cryptographic Key

    + * The {@link com.azure.security.keyvault.keys.KeyClient} or + * {@link com.azure.security.keyvault.keys.KeyAsyncClient} can be used to delete a key from the key vault. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously delete a key from the + * key vault, using the {@link com.azure.security.keyvault.keys.KeyClient#beginDeleteKey(java.lang.String)} API.

    + * + * + *
    + * SyncPoller<DeletedKey, Void> deleteKeyPoller = keyClient.beginDeleteKey("keyName");
    + * PollResponse<DeletedKey> deleteKeyPollResponse = deleteKeyPoller.poll();
    + *
    + * // Deleted date only works for SoftDelete Enabled Key Vault.
    + * DeletedKey deletedKey = deleteKeyPollResponse.getValue();
    + *
    + * System.out.printf("Key delete date: %s%n", deletedKey.getDeletedOn());
    + * System.out.printf("Deleted key's recovery id: %s%n", deletedKey.getRecoveryId());
    + *
    + * // Key is being deleted on the server.
    + * deleteKeyPoller.waitForCompletion();
    + * // Key is deleted
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.keys.KeyAsyncClient}.

    + * + * @see com.azure.security.keyvault.keys.KeyClient + * @see com.azure.security.keyvault.keys.KeyAsyncClient + * @see com.azure.security.keyvault.keys.KeyClientBuilder */ package com.azure.security.keyvault.keys; diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java index 9bad06010a1c..b97130754501 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java @@ -61,7 +61,6 @@ public void createKey() { KeyClient keyClient = createClient(); // BEGIN: com.azure.security.keyvault.keys.KeyClient.createKey#String-KeyType KeyVaultKey key = keyClient.createKey("keyName", KeyType.EC); - System.out.printf("Created key with name: %s and id: %s%n", key.getName(), key.getId()); // END: com.azure.security.keyvault.keys.KeyClient.createKey#String-KeyType diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java index ae15c70b4ea3..873cc497414b 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java @@ -12,6 +12,7 @@ import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; import com.azure.security.keyvault.keys.cryptography.models.SignResult; import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.models.CreateEcKeyOptions; import com.azure.security.keyvault.keys.models.JsonWebKey; import com.azure.security.keyvault.keys.models.KeyCurveName; import com.azure.security.keyvault.keys.models.KeyOperation; @@ -21,8 +22,13 @@ import org.junit.jupiter.params.provider.MethodSource; import java.security.InvalidAlgorithmParameterException; +import java.security.KeyPair; +import java.security.KeyPairGenerator; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; +import java.security.spec.ECGenParameterSpec; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -39,6 +45,8 @@ public class CryptographyClientTest extends CryptographyClientTestBase { private KeyClient client; private HttpPipeline pipeline; + private boolean curveNotSupportedByRuntime = false; + @Override protected void beforeTest() { beforeTestSetup(); @@ -179,9 +187,7 @@ public void wrapUnwrapRsaLocal() throws Exception { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.security.keyvault.keys.cryptography.TestHelper#getTestParameters") - public void signVerifyEc(HttpClient httpClient, CryptographyServiceVersion serviceVersion) - throws NoSuchAlgorithmException, InvalidAlgorithmParameterException { - + public void signVerifyEc(HttpClient httpClient, CryptographyServiceVersion serviceVersion) { initializeKeyClient(httpClient); signVerifyEcRunner(signVerifyEcData -> { @@ -189,7 +195,10 @@ public void signVerifyEc(HttpClient httpClient, CryptographyServiceVersion servi Map curveToSignature = signVerifyEcData.getCurveToSignature(); Map messageDigestAlgorithm = signVerifyEcData.getMessageDigestAlgorithm(); String keyName = testResourceNamer.randomName("testEcKey" + curve.toString(), 20); - KeyVaultKey keyVaultKey = client.importKey(keyName, signVerifyEcData.getJsonWebKey()); + CreateEcKeyOptions createEcKeyOptions = new CreateEcKeyOptions(keyName) + .setKeyOperations(KeyOperation.SIGN, KeyOperation.VERIFY) + .setCurveName(curve); + KeyVaultKey keyVaultKey = client.createEcKey(createEcKeyOptions); CryptographyClient cryptographyClient = initializeCryptographyClient(keyVaultKey.getId(), httpClient, serviceVersion); @@ -218,16 +227,17 @@ public void signVerifyEc(HttpClient httpClient, CryptographyServiceVersion servi @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.security.keyvault.keys.cryptography.TestHelper#getTestParameters") - public void signDataVerifyEc(HttpClient httpClient, CryptographyServiceVersion serviceVersion) - throws NoSuchAlgorithmException, InvalidAlgorithmParameterException { - + public void signDataVerifyEc(HttpClient httpClient, CryptographyServiceVersion serviceVersion) { initializeKeyClient(httpClient); signVerifyEcRunner(signVerifyEcData -> { KeyCurveName curve = signVerifyEcData.getCurve(); Map curveToSignature = signVerifyEcData.getCurveToSignature(); String keyName = testResourceNamer.randomName("testEcKey" + curve.toString(), 20); - KeyVaultKey keyVaultKey = client.importKey(keyName, signVerifyEcData.getJsonWebKey()); + CreateEcKeyOptions createEcKeyOptions = new CreateEcKeyOptions(keyName) + .setKeyOperations(KeyOperation.SIGN, KeyOperation.VERIFY) + .setCurveName(curve); + KeyVaultKey keyVaultKey = client.createEcKey(createEcKeyOptions); CryptographyClient cryptographyClient = initializeCryptographyClient(keyVaultKey.getId(), httpClient, serviceVersion); @@ -315,9 +325,48 @@ public void signDataVerifyRsa(HttpClient httpClient, CryptographyServiceVersion } @Test - public void signDataVerifyEcLocal() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException { + public void signDataVerifyEcLocal() { signVerifyEcRunner(signVerifyEcData -> { - JsonWebKey jsonWebKey = signVerifyEcData.getJsonWebKey(); + KeyPair keyPair; + Provider provider = null; + + try { + String algorithmName = "EC"; + Provider[] providers = Security.getProviders(); + + for (Provider currentProvider : providers) { + if (currentProvider.containsValue(algorithmName)) { + provider = currentProvider; + + break; + } + } + + if (provider == null) { + for (Provider currentProvider : providers) { + System.out.println(currentProvider.getName()); + } + + fail(String.format("No suitable security provider for algorithm %s was found.", algorithmName)); + } + + final KeyPairGenerator generator = KeyPairGenerator.getInstance(algorithmName, provider); + ECGenParameterSpec spec = + new ECGenParameterSpec(signVerifyEcData.getCurveToSpec().get(signVerifyEcData.getCurve())); + + generator.initialize(spec); + + keyPair = generator.generateKeyPair(); + } catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException e) { + // Could not generate a KeyPair from the given JsonWebKey. + // It's likely this happened for key curve secp256k1, which is not supported on Java 16+. + e.printStackTrace(); + + return; + } + + JsonWebKey jsonWebKey = + JsonWebKey.fromEc(keyPair, provider, Arrays.asList(KeyOperation.SIGN, KeyOperation.VERIFY)); KeyCurveName curve = signVerifyEcData.getCurve(); Map curveToSignature = signVerifyEcData.getCurveToSignature(); CryptographyClient cryptographyClient = initializeCryptographyClient(jsonWebKey); diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java index 4473233bc89c..a4d9a634df2a 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java @@ -43,17 +43,12 @@ import java.security.InvalidAlgorithmParameterException; import java.security.KeyFactory; import java.security.KeyPair; -import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; -import java.security.Provider; -import java.security.Security; -import java.security.spec.ECGenParameterSpec; import java.security.spec.KeySpec; import java.security.spec.RSAPrivateCrtKeySpec; import java.security.spec.RSAPublicKeySpec; import java.time.Duration; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -174,106 +169,56 @@ void encryptDecryptRsaRunner(Consumer testRunner) throws Exception { @Test public abstract void signDataVerifyEc(HttpClient httpClient, CryptographyServiceVersion serviceVersion) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException; - void signVerifyEcRunner(Consumer testRunner) - throws NoSuchAlgorithmException, InvalidAlgorithmParameterException { + void signVerifyEcRunner(Consumer testRunner) { Map curveToSignature = new HashMap<>(); curveToSignature.put(KeyCurveName.P_256, SignatureAlgorithm.ES256); curveToSignature.put(KeyCurveName.P_384, SignatureAlgorithm.ES384); curveToSignature.put(KeyCurveName.P_521, SignatureAlgorithm.ES512); + curveToSignature.put(KeyCurveName.P_256K, SignatureAlgorithm.ES256K); Map curveToSpec = new HashMap<>(); curveToSpec.put(KeyCurveName.P_256, "secp256r1"); curveToSpec.put(KeyCurveName.P_384, "secp384r1"); curveToSpec.put(KeyCurveName.P_521, "secp521r1"); + curveToSpec.put(KeyCurveName.P_256K, "secp256k1"); Map messageDigestAlgorithm = new HashMap<>(); messageDigestAlgorithm.put(KeyCurveName.P_256, "SHA-256"); messageDigestAlgorithm.put(KeyCurveName.P_384, "SHA-384"); messageDigestAlgorithm.put(KeyCurveName.P_521, "SHA-512"); + messageDigestAlgorithm.put(KeyCurveName.P_256K, "SHA-256"); List curveList = new ArrayList<>(); curveList.add(KeyCurveName.P_256); curveList.add(KeyCurveName.P_384); curveList.add(KeyCurveName.P_521); + curveList.add(KeyCurveName.P_256K); - String javaVersion = System.getProperty("java.version"); - - if (javaVersion.startsWith("1.")) { - javaVersion = javaVersion.substring(2, 3); - } else { - int period = javaVersion.indexOf("."); - - if (period != -1) { - javaVersion = javaVersion.substring(0, period); - } - } - - // Elliptic curve secp256k1 is not supported on Java 16+ - if (Integer.parseInt(javaVersion) < 16) { - curveToSignature.put(KeyCurveName.P_256K, SignatureAlgorithm.ES256K); - curveToSpec.put(KeyCurveName.P_256K, "secp256k1"); - curveList.add(KeyCurveName.P_256K); - messageDigestAlgorithm.put(KeyCurveName.P_256K, "SHA-256"); - } - - String algorithmName = "EC"; - Provider[] providers = Security.getProviders(); - Provider provider = null; - - for (Provider currentProvider : providers) { - if (currentProvider.containsValue(algorithmName)) { - provider = currentProvider; - - break; - } - } - - if (provider == null) { - for (Provider currentProvider : providers) { - System.out.println(currentProvider.getName()); - } - - fail(String.format("No suitable security provider for algorithm %s was found.", algorithmName)); - } for (KeyCurveName curve : curveList) { - final KeyPairGenerator generator = KeyPairGenerator.getInstance(algorithmName, provider); - ECGenParameterSpec spec = new ECGenParameterSpec(curveToSpec.get(curve)); - - generator.initialize(spec); - - KeyPair keyPair = generator.generateKeyPair(); - - JsonWebKey jsonWebKey = - JsonWebKey.fromEc(keyPair, provider, Arrays.asList(KeyOperation.SIGN, KeyOperation.VERIFY)); - - testRunner.accept(new SignVerifyEcData(jsonWebKey, curve, curveToSignature, messageDigestAlgorithm)); + testRunner.accept(new SignVerifyEcData(curve, curveToSignature, curveToSpec, messageDigestAlgorithm)); } } protected static class SignVerifyEcData { - private final JsonWebKey jsonWebKey; private final KeyCurveName curve; private final Map curveToSignature; + private final Map curveToSpec; private final Map messageDigestAlgorithm; - public SignVerifyEcData(JsonWebKey jsonWebKey, KeyCurveName curve, - Map curveToSignature, + public SignVerifyEcData(KeyCurveName curve, Map curveToSignature, + Map curveToSpec, Map messageDigestAlgorithm) { - this.jsonWebKey = jsonWebKey; this.curve = curve; this.curveToSignature = curveToSignature; + this.curveToSpec = curveToSpec; this.messageDigestAlgorithm = messageDigestAlgorithm; } - public JsonWebKey getJsonWebKey() { - return jsonWebKey; - } - public KeyCurveName getCurve() { return curve; } @@ -282,6 +227,10 @@ public Map getCurveToSignature() { return curveToSignature; } + public Map getCurveToSpec() { + return curveToSpec; + } + public Map getMessageDigestAlgorithm() { return messageDigestAlgorithm; } diff --git a/sdk/keyvault/azure-security-keyvault-perf/pom.xml b/sdk/keyvault/azure-security-keyvault-perf/pom.xml index c6e38dcfafea..32e585d790ac 100644 --- a/sdk/keyvault/azure-security-keyvault-perf/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-perf/pom.xml @@ -31,12 +31,12 @@ com.azure azure-security-keyvault-keys - 4.7.0-beta.1 + 4.8.0-beta.1 com.azure azure-security-keyvault-secrets - 4.7.0-beta.1 + 4.8.0-beta.1 com.azure diff --git a/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md b/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md index a69c4906804c..50f0dd6b4436 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md +++ b/sdk/keyvault/azure-security-keyvault-secrets/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.7.0-beta.1 (Unreleased) +## 4.8.0-beta.1 (Unreleased) ### Features Added @@ -8,9 +8,24 @@ ### Bugs Fixed +### Other Changes + +## 4.7.0 (2023-09-25) + +### Features Added +- Added new methods `fromJson` and `toJson` to models: + - `DeletedSecret` + - `KeyVaultSecret` + - `SecretProperties` + ### Other Changes - Migrate test recordings to assets repo. +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 4.6.5 (2023-08-21) ### Other Changes diff --git a/sdk/keyvault/azure-security-keyvault-secrets/README.md b/sdk/keyvault/azure-security-keyvault-secrets/README.md index 9d93ef5cf37a..6e55f88121fb 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/README.md +++ b/sdk/keyvault/azure-security-keyvault-secrets/README.md @@ -46,7 +46,7 @@ If you want to take dependency on a particular version of the library that is no com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml index 5e0cbf491bb0..0c9123bddcdf 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml @@ -11,7 +11,7 @@ com.azure azure-security-keyvault-secrets - 4.7.0-beta.1 + 4.8.0-beta.1 Microsoft Azure client library for KeyVault Secrets This module contains client library for Microsoft Azure KeyVault Secrets. diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java index 86c374c3d465..88561b41b701 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java @@ -50,20 +50,103 @@ * The SecretAsyncClient provides asynchronous methods to manage {@link KeyVaultSecret secrets} in the Azure Key Vault. * The client supports creating, retrieving, updating, deleting, purging, backing up, restoring, and listing the * {@link KeyVaultSecret secrets}. The client also supports listing {@link DeletedSecret deleted secrets} for a - * soft-delete enabled Azure Key Vault. + * soft-delete enabled key vault. + * + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link com.azure.security.keyvault.secrets.SecretAsyncClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Asynchronous Secret Client

    * - *

    Construct the async client

    * *
      * SecretAsyncClient secretAsyncClient = new SecretClientBuilder()
      *     .credential(new DefaultAzureCredentialBuilder().build())
      *     .vaultUrl("<your-key-vault-url>")
    - *     .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))
      *     .buildAsyncClient();
      * 
    * * + *
    + * + *
    + * + *

    Create a Secret

    + * The {@link SecretAsyncClient} can be used to create a secret in the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to create and store a secret in the key vault, using the + * {@link SecretAsyncClient#setSecret(String, String)} API.

    + * + * + *
    + * secretAsyncClient.setSecret("secretName", "secretValue")
    + *     .subscribe(secretResponse ->
    + *         System.out.printf("Secret is created with name %s and value %s%n",
    + *             secretResponse.getName(), secretResponse.getValue()));
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link SecretClient}.

    + * + *
    + * + *
    + * + *

    Get a Secret

    + * The {@link SecretAsyncClient} can be used to retrieve a secret from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously retrieve a previously stored secret from the + * key vault, using the {@link SecretAsyncClient#getSecret(String)} API.

    + * + * + *
    + * secretAsyncClient.getSecret("secretName")
    + *     .subscribe(secretWithVersion ->
    + *         System.out.printf("Secret is returned with name %s and value %s %n",
    + *             secretWithVersion.getName(), secretWithVersion.getValue()));
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link SecretClient}.

    + * + *
    + * + *
    + * + *

    Delete a Secret

    + * The {@link SecretAsyncClient} can be used to delete a secret from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to delete a secret from the key vault, using the + * {@link SecretAsyncClient#beginDeleteSecret(String)} API.

    + * + * + *
    + * secretAsyncClient.beginDeleteSecret("secretName")
    + *     .subscribe(pollResponse -> {
    + *         System.out.println("Delete Status: " + pollResponse.getStatus().toString());
    + *         System.out.println("Deleted Secret Name: " + pollResponse.getValue().getName());
    + *         System.out.println("Deleted Secret Value: " + pollResponse.getValue().getValue());
    + *     });
    + * 
    + * + * + *

    Note: For the synchronous sample, refer to {@link SecretClient}.

    + * * @see SecretClientBuilder + * @see PollerFlux * @see PagedFlux */ @ServiceClient(builder = SecretClientBuilder.class, isAsync = true, diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java index 3f62252906db..299be9cdeed9 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java @@ -44,20 +44,107 @@ * The SecretClient provides synchronous methods to manage {@link KeyVaultSecret secrets} in the Azure Key Vault. The * client supports creating, retrieving, updating, deleting, purging, backing up, restoring, and listing the * {@link KeyVaultSecret secrets}. The client also supports listing {@link DeletedSecret deleted secrets} for a - * soft-delete enabled Azure Key Vault. + * soft-delete enabled key vault. * - *

    Construct the sync client

    + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link SecretClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Synchronous Secret client

    * *
      * SecretClient secretClient = new SecretClientBuilder()
      *     .credential(new DefaultAzureCredentialBuilder().build())
      *     .vaultUrl("<your-key-vault-url>")
    - *     .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))
      *     .buildClient();
      * 
    * * + *
    + * + *
    + * + *

    Create a Secret

    + * The {@link SecretClient} can be used to create a secret in the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously create and store a secret in the key vault, + * using the {@link SecretClient#setSecret(String, String)} API.

    + * + * + *
    + * KeyVaultSecret secret = secretClient.setSecret("secretName", "secretValue");
    + * System.out.printf("Secret is created with name %s and value %s%n", secret.getName(), secret.getValue());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.secrets.SecretAsyncClient}.

    + * + *
    + * + *
    + * + *

    Get a Secret

    + * The {@link SecretClient} can be used to retrieve a secret from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to synchronously retrieve a previously stored secret from the Azure + * KeyVault, using the {@link SecretClient#getSecret(String)} API.

    + * + * + *
    + * KeyVaultSecret secret = secretClient.getSecret("secretName");
    + * System.out.printf("Secret is returned with name %s and value %s%n",
    + *     secret.getName(), secret.getValue());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link SecretAsyncClient}.

    + * + *
    + * + *
    + * + *

    Delete a Secret

    + * The {@link SecretClient} can be used to delete a secret from the key vault. + * + *

    Code Sample:

    + *

    The following code sample demonstrates how to delete a secret from the key vault, using + * the {@link SecretClient#beginDeleteSecret(String)} API.

    + * + * + *
    + * SyncPoller<DeletedSecret, Void> deleteSecretPoller = secretClient.beginDeleteSecret("secretName");
    + *
    + * // Deleted Secret is accessible as soon as polling begins.
    + * PollResponse<DeletedSecret> deleteSecretPollResponse = deleteSecretPoller.poll();
    + *
    + * // Deletion date only works for a SoftDelete-enabled Key Vault.
    + * System.out.println("Deleted Date  %s" + deleteSecretPollResponse.getValue()
    + *     .getDeletedOn().toString());
    + * System.out.printf("Deleted Secret's Recovery Id %s", deleteSecretPollResponse.getValue()
    + *     .getRecoveryId());
    + *
    + * // Secret is being deleted on server.
    + * deleteSecretPoller.waitForCompletion();
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to {@link SecretAsyncClient}.

    + * * @see SecretClientBuilder + * @see SyncPoller * @see PagedIterable */ @ServiceClient(builder = SecretClientBuilder.class, serviceInterfaces = SecretClientImpl.SecretClientService.class) @@ -193,9 +280,9 @@ public Response setSecretWithResponse(KeyVaultSecret secret, Con *

    Gets the latest version of the secret in the key vault. Prints out the details of the returned secret.

    * *
    -     * KeyVaultSecret secretWithoutVersion = secretClient.getSecret("secretName", secretVersion);
    +     * KeyVaultSecret secret = secretClient.getSecret("secretName");
          * System.out.printf("Secret is returned with name %s and value %s%n",
    -     *     secretWithoutVersion.getName(), secretWithoutVersion.getValue());
    +     *     secret.getName(), secret.getValue());
          * 
    * * diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java index cf98511926db..3567139b998e 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java @@ -35,6 +35,7 @@ import com.azure.security.keyvault.secrets.implementation.KeyVaultCredentialPolicy; import com.azure.security.keyvault.secrets.implementation.KeyVaultErrorCodeStrings; import com.azure.security.keyvault.secrets.implementation.SecretClientImpl; +import com.azure.security.keyvault.secrets.models.KeyVaultSecret; import com.azure.security.keyvault.secrets.models.KeyVaultSecretIdentifier; import java.net.MalformedURLException; @@ -50,6 +51,12 @@ * SecretClientBuilder#buildClient() buildClient} respectively. * It constructs an instance of the desired client. * + *

    The {@link SecretClient}/{@link SecretAsyncClient} both provide synchronous/asynchronous methods to manage + * {@link KeyVaultSecret secrets} in the Azure Key Vault. The client supports creating, retrieving, updating, + * deleting, purging, backing up, restoring, and listing the {@link KeyVaultSecret secrets}. The client also support + * listing {@link com.azure.security.keyvault.secrets.models.DeletedSecret deleted secrets} for a soft-delete enabled + * Azure Key Vault.

    + * *

    The minimal configuration options required by {@link SecretClientBuilder secretClientBuilder} to build * {@link SecretAsyncClient} are {@link String vaultUrl} and {@link TokenCredential credential}.

    * @@ -58,7 +65,6 @@ * SecretAsyncClient secretAsyncClient = new SecretClientBuilder() * .credential(new DefaultAzureCredentialBuilder().build()) * .vaultUrl("<your-key-vault-url>") - * .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) * .buildAsyncClient(); * * @@ -69,7 +75,6 @@ * SecretClient secretClient = new SecretClientBuilder() * .credential(new DefaultAzureCredentialBuilder().build()) * .vaultUrl("<your-key-vault-url>") - * .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) * .buildClient(); * * @@ -105,6 +110,7 @@ public final class SecretClientBuilder implements // Please see here // for more information on Azure resource provider namespaces. private static final String KEYVAULT_TRACING_NAMESPACE_VALUE = "Microsoft.KeyVault"; + private static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); private final List perCallPolicies; private final List perRetryPolicies; private final Map properties; @@ -203,15 +209,16 @@ private SecretClientImpl buildInnerClient() { httpLogOptions = (httpLogOptions == null) ? new HttpLogOptions() : httpLogOptions; - policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(clientOptions, httpLogOptions), clientName, + ClientOptions localClientOptions = clientOptions != null + ? clientOptions : DEFAULT_CLIENT_OPTIONS; + + policies.add(new UserAgentPolicy(CoreUtils.getApplicationId(localClientOptions, httpLogOptions), clientName, clientVersion, buildConfiguration)); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach(header -> - httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + List httpHeaderList = new ArrayList<>(); + localClientOptions.getHeaders().forEach(header -> + httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); // Add per call additional policies. policies.addAll(perCallPolicies); @@ -228,13 +235,14 @@ private SecretClientImpl buildInnerClient() { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); - TracingOptions tracingOptions = clientOptions == null ? null : clientOptions.getTracingOptions(); + TracingOptions tracingOptions = localClientOptions.getTracingOptions(); Tracer tracer = TracerProvider.getDefaultProvider() .createTracer(clientName, clientVersion, KEYVAULT_TRACING_NAMESPACE_VALUE, tracingOptions); HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) + .clientOptions(localClientOptions) .tracer(tracer) .build(); diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/package-info.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/package-info.java index 4d543805540c..94fd5bc936d0 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/package-info.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/package-info.java @@ -2,7 +2,176 @@ // Licensed under the MIT License. /** - * Package containing classes for creating {@link com.azure.security.keyvault.secrets.SecretAsyncClient} and - * {@link com.azure.security.keyvault.secrets.SecretClient} to perform operations on Azure Key Vault. + *

    Azure Key Vault is a cloud-based service + * provided by Microsoft Azure that allows users to store, manage, and access secrets, such as passwords, certificates, + * and other sensitive information, securely in the cloud. The service provides a centralized and secure location for + * storing secrets, which can be accessed by authorized applications and users with appropriate permissions. + * Azure Key Vault Secrets offers several key features, including:

    + *
      + *
    • Secret management: It allows users to store, manage, and access secrets securely, and provides features such + * as versioning, backup, and restoration.
    • + *
    • Access control: It offers + * + * role-based access control (RBAC) and enables users to grant specific permissions to access secrets to + * other users, applications, or services.
    • + *
    • Integration with other Azure services: Azure Key Vault Secrets can be integrated with other Azure services, + * such as Azure App Service, Azure Functions, and Azure Virtual Machines, to simplify the process of securing + * sensitive information.
    • + *
    • High availability and scalability: The service is designed to provide high availability and scalability, + * with the ability to handle large volumes of secrets and requests.
    • + *
    + * + *

    The Azure Key Vault Secrets client library allows developers to interact with the Azure Key Vault service + * from their applications. The library provides a set of APIs that enable developers to securely store, manage, and + * retrieve secrets in a key vault, and supports operations such as creating, updating, deleting, and retrieving secrets.

    + * + *

    Key Concepts:

    + * + *

    What is a Secret Client?

    + *

    The secret client performs the interactions with the Azure Key Vault service for getting, setting, updating, + * deleting, and listing secrets and its versions. Asynchronous (SecretAsyncClient) and synchronous (SecretClient) + * clients exist in the SDK allowing for selection of a client based on an application's use case. + * Once you've initialized a secret, you can interact with the primary resource types in Key Vault.

    + * + *

    What is an Azure Key Vault Secret ?

    + *

    A secret is the fundamental resource within Azure Key Vault. From a developer's perspective, Key Vault APIs + * accept and return secret values as strings. In addition to the secret data, the following attributes may be + * specified:

    + * + *
      + *
    1. enabled: Specifies whether the secret data can be retrieved.
    2. + *
    3. notBefore: Identifies the time after which the secret will be active.
    4. + *
    5. expires: Identifies the expiration time on or after which the secret data should not be retrieved.
    6. + *
    7. created: Indicates when this version of the secret was created.
    8. + *
    9. updated: Indicates when this version of the secret was updated.
    10. + *
    + * + *

    Getting Started

    + * + *

    In order to interact with the Azure Key Vault service, you will need to create an instance of the + * {@link com.azure.security.keyvault.secrets.SecretClient} or {@link com.azure.security.keyvault.secrets.SecretAsyncClient} class, a vault url and a credential object.

    + * + *

    The examples shown in this document use a credential object named DefaultAzureCredential for authentication, + * which is appropriate for most scenarios, including local development and production environments. Additionally, + * we recommend using a + * + * managed identity for authentication in production environments. + * You can find more information on different ways of authenticating and their corresponding credential types in the + * + * Azure Identity documentation".

    + * + *

    Sample: Construct Synchronous Secret Client

    + * + *

    The following code sample demonstrates the creation of a {@link com.azure.security.keyvault.secrets.SecretClient}, + * using the {@link com.azure.security.keyvault.secrets.SecretClientBuilder} to configure it.

    + * + * + *
    + * SecretClient secretClient = new SecretClientBuilder()
    + *     .credential(new DefaultAzureCredentialBuilder().build())
    + *     .vaultUrl("<your-key-vault-url>")
    + *     .buildClient();
    + * 
    + * + * + *

    Sample: Construct Asynchronous Secret Client

    + * + *

    The following code sample demonstrates the creation of a + * {@link com.azure.security.keyvault.secrets.SecretAsyncClient}, using the + * {@link com.azure.security.keyvault.secrets.SecretClientBuilder} to configure it.

    + * + * + *
    + * SecretAsyncClient secretAsyncClient = new SecretClientBuilder()
    + *     .credential(new DefaultAzureCredentialBuilder().build())
    + *     .vaultUrl("<your-key-vault-url>")
    + *     .buildAsyncClient();
    + * 
    + * + * + *
    + * + *

    Create a Secret

    + * The {@link com.azure.security.keyvault.secrets.SecretClient} or + * {@link com.azure.security.keyvault.secrets.SecretAsyncClient} can be used to create a secret in the key vault. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously create and store a secret in the key vault, + * using the {@link com.azure.security.keyvault.secrets.SecretClient#setSecret(java.lang.String, java.lang.String)} API. + *

    + * + * + *
    + * KeyVaultSecret secret = secretClient.setSecret("secretName", "secretValue");
    + * System.out.printf("Secret is created with name %s and value %s%n", secret.getName(), secret.getValue());
    + * 
    + * + * + *

    Asynchronous Code Sample:

    + *

    The following code sample demonstrates how to asynchronously create and store a secret in the key vault, + * using the {@link com.azure.security.keyvault.secrets.SecretAsyncClient}.

    + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.secrets.SecretAsyncClient}.

    + * + *
    + * + *

    Get a Secret

    + * The {@link com.azure.security.keyvault.secrets.SecretClient} or + * {@link com.azure.security.keyvault.secrets.SecretAsyncClient} can be used to retrieve a secret from the + * key vault. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously retrieve a previously stored secret from the + * key vault, using the {@link com.azure.security.keyvault.secrets.SecretClient#getSecret(java.lang.String)} API.

    + * + * + *
    + * KeyVaultSecret secret = secretClient.getSecret("secretName");
    + * System.out.printf("Secret is returned with name %s and value %s%n",
    + *     secret.getName(), secret.getValue());
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.secrets.SecretAsyncClient}.

    + * + *
    + * + *

    Delete a Secret

    + * The {@link com.azure.security.keyvault.secrets.SecretClient} or + * {@link com.azure.security.keyvault.secrets.SecretAsyncClient} can be used to delete a secret from the + * key vault. + * + *

    Synchronous Code Sample:

    + *

    The following code sample demonstrates how to synchronously delete a secret from the + * key vault, using the {@link com.azure.security.keyvault.secrets.SecretClient#beginDeleteSecret(java.lang.String)} API. + *

    + * + * + *
    + * SyncPoller<DeletedSecret, Void> deleteSecretPoller = secretClient.beginDeleteSecret("secretName");
    + *
    + * // Deleted Secret is accessible as soon as polling begins.
    + * PollResponse<DeletedSecret> deleteSecretPollResponse = deleteSecretPoller.poll();
    + *
    + * // Deletion date only works for a SoftDelete-enabled Key Vault.
    + * System.out.println("Deleted Date  %s" + deleteSecretPollResponse.getValue()
    + *     .getDeletedOn().toString());
    + * System.out.printf("Deleted Secret's Recovery Id %s", deleteSecretPollResponse.getValue()
    + *     .getRecoveryId());
    + *
    + * // Secret is being deleted on server.
    + * deleteSecretPoller.waitForCompletion();
    + * 
    + * + * + *

    Note: For the asynchronous sample, refer to + * {@link com.azure.security.keyvault.secrets.SecretAsyncClient}.

    + * + * @see com.azure.security.keyvault.secrets.SecretClient + * @see com.azure.security.keyvault.secrets.SecretAsyncClient + * @see com.azure.security.keyvault.secrets.SecretClientBuilder + * @see com.azure.security.keyvault.secrets.models.KeyVaultSecret */ package com.azure.security.keyvault.secrets; diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java index 9a76d50bb372..8cbe0001e494 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java @@ -49,7 +49,6 @@ private SecretAsyncClient getAsyncSecretClient() { SecretAsyncClient secretAsyncClient = new SecretClientBuilder() .credential(new DefaultAzureCredentialBuilder().build()) .vaultUrl("") - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .buildAsyncClient(); // END: com.azure.security.keyvault.secrets.SecretAsyncClient.instantiation return secretAsyncClient; diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java index 25ca625b2eb5..7a0625a9b159 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java @@ -3,8 +3,6 @@ package com.azure.security.keyvault.secrets; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.core.util.polling.PollResponse; @@ -35,7 +33,6 @@ private SecretClient getSecretClient() { SecretClient secretClient = new SecretClientBuilder() .credential(new DefaultAzureCredentialBuilder().build()) .vaultUrl("") - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .buildClient(); // END: com.azure.security.keyvault.SecretClient.instantiation return secretClient; @@ -62,9 +59,9 @@ public void getSecretCodeSnippets() { // END: com.azure.security.keyvault.SecretClient.getSecret#string-string // BEGIN: com.azure.security.keyvault.SecretClient.getSecret#string - KeyVaultSecret secretWithoutVersion = secretClient.getSecret("secretName", secretVersion); + KeyVaultSecret secret = secretClient.getSecret("secretName"); System.out.printf("Secret is returned with name %s and value %s%n", - secretWithoutVersion.getName(), secretWithoutVersion.getValue()); + secret.getName(), secret.getValue()); // END: com.azure.security.keyvault.SecretClient.getSecret#string } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/CHANGELOG.md b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/CHANGELOG.md index b09801214526..a3984cebd2f3 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/CHANGELOG.md +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.5 (Unreleased) +## 1.1.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,35 @@ ### Other Changes +## 1.0.0 (2023-09-25) + +- Azure Resource Manager SourceControlConfiguration client library for Java. This package contains Microsoft Azure SDK for SourceControlConfiguration Management SDK. KubernetesConfiguration Client. Package tag package-2023-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Features Added + +* `models.SubstituteFromDefinition` was added + +* `models.PostBuildDefinition` was added + +#### `models.FluxConfiguration` was modified + +* `reconciliationWaitDuration()` was added +* `waitForReconciliation()` was added + +#### `models.KustomizationPatchDefinition` was modified + +* `withPostBuild(models.PostBuildDefinition)` was added +* `postBuild()` was added +* `withEnableWait(java.lang.Boolean)` was added +* `enableWait()` was added + +#### `models.KustomizationDefinition` was modified + +* `withEnableWait(java.lang.Boolean)` was added +* `enableWait()` was added +* `withPostBuild(models.PostBuildDefinition)` was added +* `postBuild()` was added + ## 1.0.0-beta.4 (2023-05-17) - Azure Resource Manager SourceControlConfiguration client library for Java. This package contains Microsoft Azure SDK for SourceControlConfiguration Management SDK. KubernetesConfiguration Client. Package tag package-2022-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/README.md b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/README.md index 968a236865f0..9f958a766043 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/README.md +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/README.md @@ -2,7 +2,7 @@ Azure Resource Manager SourceControlConfiguration client library for Java. -This package contains Microsoft Azure SDK for SourceControlConfiguration Management SDK. KubernetesConfiguration Client. Package tag package-2022-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for SourceControlConfiguration Management SDK. KubernetesConfiguration Client. Package tag package-2023-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-kubernetesconfiguration - 1.0.0-beta.4 + 1.0.0 ``` [//]: # ({x-version-update-end}) @@ -103,3 +103,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fkubernetesconfiguration%2Fazure-resourcemanager-kubernetesconfiguration%2FREADME.png) diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/SAMPLE.md b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/SAMPLE.md index bed1f7ef20e2..c25ca42d6b89 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/SAMPLE.md +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/SAMPLE.md @@ -49,7 +49,7 @@ import java.util.Map; /** Samples for Extensions Create. */ public final class ExtensionsCreateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateExtension.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateExtension.json */ /** * Sample code: Create Extension. @@ -73,16 +73,13 @@ public final class ExtensionsCreateSamples { .withScope(new Scope().withCluster(new ScopeCluster().withReleaseNamespace("kube-system"))) .withConfigurationSettings( mapOf( - "omsagent.env.clusterName", - "clusterName1", - "omsagent.secret.wsid", - "a38cef99-5a89-52ed-b6db-22095c23664b")) - .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "secretKeyValue01")), + "omsagent.env.clusterName", "clusterName1", "omsagent.secret.wsid", "fakeTokenPlaceholder")) + .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "fakeTokenPlaceholder")), com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateExtensionWithPlan.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateExtensionWithPlan.json */ /** * Sample code: Create Extension with Plan. @@ -111,6 +108,7 @@ public final class ExtensionsCreateSamples { com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -130,7 +128,7 @@ public final class ExtensionsCreateSamples { /** Samples for Extensions Delete. */ public final class ExtensionsDeleteSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/DeleteExtension.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/DeleteExtension.json */ /** * Sample code: Delete Extension. @@ -159,7 +157,7 @@ public final class ExtensionsDeleteSamples { /** Samples for Extensions Get. */ public final class ExtensionsGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetExtensionWithPlan.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetExtensionWithPlan.json */ /** * Sample code: Get Extension with Plan. @@ -180,7 +178,7 @@ public final class ExtensionsGetSamples { } /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetExtension.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetExtension.json */ /** * Sample code: Get Extension. @@ -208,7 +206,7 @@ public final class ExtensionsGetSamples { /** Samples for Extensions List. */ public final class ExtensionsListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/ListExtensions.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListExtensions.json */ /** * Sample code: List Extensions. @@ -234,7 +232,7 @@ import java.util.Map; /** Samples for Extensions Update. */ public final class ExtensionsUpdateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/PatchExtension.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/PatchExtension.json */ /** * Sample code: Update Extension. @@ -256,14 +254,12 @@ public final class ExtensionsUpdateSamples { .withReleaseTrain("Preview") .withConfigurationSettings( mapOf( - "omsagent.env.clusterName", - "clusterName1", - "omsagent.secret.wsid", - "a38cef99-5a89-52ed-b6db-22095c23664b")) - .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "secretKeyValue01")), + "omsagent.env.clusterName", "clusterName1", "omsagent.secret.wsid", "fakeTokenPlaceholder")) + .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "fakeTokenPlaceholder")), com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -283,7 +279,7 @@ public final class ExtensionsUpdateSamples { /** Samples for FluxConfigOperationStatus Get. */ public final class FluxConfigOperationStatusGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetFluxConfigurationAsyncOperationStatus.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetFluxConfigurationAsyncOperationStatus.json */ /** * Sample code: FluxConfigurationAsyncOperationStatus Get. @@ -313,9 +309,11 @@ import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.FluxConfi import com.azure.resourcemanager.kubernetesconfiguration.models.BucketDefinition; import com.azure.resourcemanager.kubernetesconfiguration.models.GitRepositoryDefinition; import com.azure.resourcemanager.kubernetesconfiguration.models.KustomizationDefinition; +import com.azure.resourcemanager.kubernetesconfiguration.models.PostBuildDefinition; import com.azure.resourcemanager.kubernetesconfiguration.models.RepositoryRefDefinition; import com.azure.resourcemanager.kubernetesconfiguration.models.ScopeType; import com.azure.resourcemanager.kubernetesconfiguration.models.SourceKindType; +import com.azure.resourcemanager.kubernetesconfiguration.models.SubstituteFromDefinition; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -323,7 +321,7 @@ import java.util.Map; /** Samples for FluxConfigurations CreateOrUpdate. */ public final class FluxConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateFluxConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfiguration.json */ /** * Sample code: Create Flux Configuration. @@ -359,7 +357,18 @@ public final class FluxConfigurationsCreateOrUpdateSamples { .withPath("./test/path") .withDependsOn(Arrays.asList()) .withTimeoutInSeconds(600L) - .withSyncIntervalInSeconds(600L), + .withSyncIntervalInSeconds(600L) + .withEnableWait(true) + .withPostBuild( + new PostBuildDefinition() + .withSubstitute(mapOf("cluster_env", "prod", "replica_count", "2")) + .withSubstituteFrom( + Arrays + .asList( + new SubstituteFromDefinition() + .withKind("ConfigMap") + .withName("cluster-test") + .withOptional(true)))), "srs-kustomization2", new KustomizationDefinition() .withPath("./other/test/path") @@ -367,12 +376,28 @@ public final class FluxConfigurationsCreateOrUpdateSamples { .withTimeoutInSeconds(600L) .withSyncIntervalInSeconds(600L) .withRetryIntervalInSeconds(600L) - .withPrune(false))), + .withPrune(false) + .withEnableWait(false) + .withPostBuild( + new PostBuildDefinition() + .withSubstituteFrom( + Arrays + .asList( + new SubstituteFromDefinition() + .withKind("ConfigMap") + .withName("cluster-values") + .withOptional(true), + new SubstituteFromDefinition() + .withKind("Secret") + .withName("secret-name") + .withOptional(false)))))) + .withWaitForReconciliation(true) + .withReconciliationWaitDuration("PT30M"), com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateFluxConfigurationWithBucket.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfigurationWithBucket.json */ /** * Sample code: Create Flux Configuration with Bucket Source Kind. @@ -420,6 +445,7 @@ public final class FluxConfigurationsCreateOrUpdateSamples { com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -439,7 +465,7 @@ public final class FluxConfigurationsCreateOrUpdateSamples { /** Samples for FluxConfigurations Delete. */ public final class FluxConfigurationsDeleteSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/DeleteFluxConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/DeleteFluxConfiguration.json */ /** * Sample code: Delete Flux Configuration. @@ -468,7 +494,7 @@ public final class FluxConfigurationsDeleteSamples { /** Samples for FluxConfigurations Get. */ public final class FluxConfigurationsGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetFluxConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetFluxConfiguration.json */ /** * Sample code: Get Flux Configuration. @@ -496,7 +522,7 @@ public final class FluxConfigurationsGetSamples { /** Samples for FluxConfigurations List. */ public final class FluxConfigurationsListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/ListFluxConfigurations.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListFluxConfigurations.json */ /** * Sample code: List Flux Configuration. @@ -524,7 +550,7 @@ import java.util.Map; /** Samples for FluxConfigurations Update. */ public final class FluxConfigurationsUpdateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/PatchFluxConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/PatchFluxConfiguration.json */ /** * Sample code: Patch Flux Configuration. @@ -561,6 +587,7 @@ public final class FluxConfigurationsUpdateSamples { com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -580,7 +607,7 @@ public final class FluxConfigurationsUpdateSamples { /** Samples for OperationStatus Get. */ public final class OperationStatusGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetExtensionAsyncOperationStatus.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetExtensionAsyncOperationStatus.json */ /** * Sample code: ExtensionAsyncOperationStatus Get. @@ -609,7 +636,7 @@ public final class OperationStatusGetSamples { /** Samples for OperationStatus List. */ public final class OperationStatusListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/ListAsyncOperationStatus.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListAsyncOperationStatus.json */ /** * Sample code: AsyncOperationStatus List. @@ -631,7 +658,7 @@ public final class OperationStatusListSamples { /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/OperationsList.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/OperationsList.json */ /** * Sample code: BatchAccountDelete. @@ -658,7 +685,7 @@ import java.util.Map; /** Samples for SourceControlConfigurations CreateOrUpdate. */ public final class SourceControlConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateSourceControlConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateSourceControlConfiguration.json */ /** * Sample code: Create Source Control Configuration. @@ -681,7 +708,7 @@ public final class SourceControlConfigurationsCreateOrUpdateSamples { .withOperatorInstanceName("SRSGitHubFluxOp-01") .withOperatorType(OperatorType.FLUX) .withOperatorParams("--git-email=xyzgituser@users.srs.github.com") - .withConfigurationProtectedSettings(mapOf("protectedSetting1Key", "protectedSetting1Value")) + .withConfigurationProtectedSettings(mapOf("protectedSetting1Key", "fakeTokenPlaceholder")) .withOperatorScope(OperatorScopeType.NAMESPACE) .withSshKnownHostsContents( "c3NoLmRldi5henVyZS5jb20gc3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFDN0hyMW9UV3FOcU9sekdKT2ZHSjROYWtWeUl6ZjFyWFlkNGQ3d282akJsa0x2Q0E0b2RCbEwwbURVeVowL1FVZlRUcWV1K3RtMjJnT3N2K1ZyVlRNazZ2d1JVNzVnWS95OXV0NU1iM2JSNUJWNThkS1h5cTlBOVVlQjVDYWtlaG41WmdtNngxbUtvVnlmK0ZGbjI2aVlxWEpSZ3pJWlpjWjVWNmhyRTBRZzM5a1ptNGF6NDhvMEFVYmY2U3A0U0xkdm51TWEyc1ZOd0hCYm9TN0VKa201N1hRUFZVMy9RcHlOTEhiV0Rkend0cmxTK2V6MzBTM0FkWWhMS0VPeEFHOHdlT255cnRMSkFVZW45bVRrb2w4b0lJMWVkZjdtV1diV1ZmMG5CbWx5MjErblpjbUNUSVNRQnRkY3lQYUVubzdmRlFNREQyNi9zMGxmS29iNEt3OEg=") @@ -694,6 +721,7 @@ public final class SourceControlConfigurationsCreateOrUpdateSamples { com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -713,7 +741,7 @@ public final class SourceControlConfigurationsCreateOrUpdateSamples { /** Samples for SourceControlConfigurations Delete. */ public final class SourceControlConfigurationsDeleteSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/DeleteSourceControlConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/DeleteSourceControlConfiguration.json */ /** * Sample code: Delete Source Control Configuration. @@ -741,7 +769,7 @@ public final class SourceControlConfigurationsDeleteSamples { /** Samples for SourceControlConfigurations Get. */ public final class SourceControlConfigurationsGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetSourceControlConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetSourceControlConfiguration.json */ /** * Sample code: Get Source Control Configuration. @@ -769,7 +797,7 @@ public final class SourceControlConfigurationsGetSamples { /** Samples for SourceControlConfigurations List. */ public final class SourceControlConfigurationsListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/ListSourceControlConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListSourceControlConfiguration.json */ /** * Sample code: List Source Control Configuration. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml index c73bcccd064c..00b4896b4e48 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml @@ -14,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-kubernetesconfiguration - 1.0.0-beta.5 + 1.1.0-beta.1 jar Microsoft Azure SDK for SourceControlConfiguration Management - This package contains Microsoft Azure SDK for SourceControlConfiguration Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. KubernetesConfiguration Client. Package tag package-2022-11. + This package contains Microsoft Azure SDK for SourceControlConfiguration Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. KubernetesConfiguration Client. Package tag package-2023-05. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/SourceControlConfigurationManager.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/SourceControlConfigurationManager.java index c577aa39dccb..19f606aee27a 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/SourceControlConfigurationManager.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/SourceControlConfigurationManager.java @@ -225,7 +225,7 @@ public SourceControlConfigurationManager authenticate(TokenCredential credential .append("-") .append("com.azure.resourcemanager.kubernetesconfiguration") .append("/") - .append("1.0.0-beta.4"); + .append("1.0.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -357,8 +357,10 @@ public Operations operations() { } /** - * @return Wrapped service client SourceControlConfigurationClient providing direct access to the underlying - * auto-generated API implementation, based on Azure REST API. + * Gets wrapped service client SourceControlConfigurationClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client SourceControlConfigurationClient. */ public SourceControlConfigurationClient serviceClient() { return this.clientObject; diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/FluxConfigurationInner.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/FluxConfigurationInner.java index d197e4b01ea5..8cf52a1f9d5e 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/FluxConfigurationInner.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/FluxConfigurationInner.java @@ -323,6 +323,56 @@ public OffsetDateTime statusUpdatedAt() { return this.innerProperties() == null ? null : this.innerProperties().statusUpdatedAt(); } + /** + * Get the waitForReconciliation property: Whether flux configuration deployment should wait for cluster to + * reconcile the kustomizations. + * + * @return the waitForReconciliation value. + */ + public Boolean waitForReconciliation() { + return this.innerProperties() == null ? null : this.innerProperties().waitForReconciliation(); + } + + /** + * Set the waitForReconciliation property: Whether flux configuration deployment should wait for cluster to + * reconcile the kustomizations. + * + * @param waitForReconciliation the waitForReconciliation value to set. + * @return the FluxConfigurationInner object itself. + */ + public FluxConfigurationInner withWaitForReconciliation(Boolean waitForReconciliation) { + if (this.innerProperties() == null) { + this.innerProperties = new FluxConfigurationProperties(); + } + this.innerProperties().withWaitForReconciliation(waitForReconciliation); + return this; + } + + /** + * Get the reconciliationWaitDuration property: Maximum duration to wait for flux configuration reconciliation. E.g + * PT1H, PT5M, P1D. + * + * @return the reconciliationWaitDuration value. + */ + public String reconciliationWaitDuration() { + return this.innerProperties() == null ? null : this.innerProperties().reconciliationWaitDuration(); + } + + /** + * Set the reconciliationWaitDuration property: Maximum duration to wait for flux configuration reconciliation. E.g + * PT1H, PT5M, P1D. + * + * @param reconciliationWaitDuration the reconciliationWaitDuration value to set. + * @return the FluxConfigurationInner object itself. + */ + public FluxConfigurationInner withReconciliationWaitDuration(String reconciliationWaitDuration) { + if (this.innerProperties() == null) { + this.innerProperties = new FluxConfigurationProperties(); + } + this.innerProperties().withReconciliationWaitDuration(reconciliationWaitDuration); + return this; + } + /** * Get the complianceState property: Combined status of the Flux Kubernetes resources created by the * fluxConfiguration or created by the managed objects. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/FluxConfigurationProperties.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/FluxConfigurationProperties.java index eda7cca64071..9fb9ccf9283b 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/FluxConfigurationProperties.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/FluxConfigurationProperties.java @@ -111,6 +111,18 @@ public final class FluxConfigurationProperties { @JsonProperty(value = "statusUpdatedAt", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime statusUpdatedAt; + /* + * Whether flux configuration deployment should wait for cluster to reconcile the kustomizations. + */ + @JsonProperty(value = "waitForReconciliation") + private Boolean waitForReconciliation; + + /* + * Maximum duration to wait for flux configuration reconciliation. E.g PT1H, PT5M, P1D + */ + @JsonProperty(value = "reconciliationWaitDuration") + private String reconciliationWaitDuration; + /* * Combined status of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed * objects. @@ -370,6 +382,50 @@ public OffsetDateTime statusUpdatedAt() { return this.statusUpdatedAt; } + /** + * Get the waitForReconciliation property: Whether flux configuration deployment should wait for cluster to + * reconcile the kustomizations. + * + * @return the waitForReconciliation value. + */ + public Boolean waitForReconciliation() { + return this.waitForReconciliation; + } + + /** + * Set the waitForReconciliation property: Whether flux configuration deployment should wait for cluster to + * reconcile the kustomizations. + * + * @param waitForReconciliation the waitForReconciliation value to set. + * @return the FluxConfigurationProperties object itself. + */ + public FluxConfigurationProperties withWaitForReconciliation(Boolean waitForReconciliation) { + this.waitForReconciliation = waitForReconciliation; + return this; + } + + /** + * Get the reconciliationWaitDuration property: Maximum duration to wait for flux configuration reconciliation. E.g + * PT1H, PT5M, P1D. + * + * @return the reconciliationWaitDuration value. + */ + public String reconciliationWaitDuration() { + return this.reconciliationWaitDuration; + } + + /** + * Set the reconciliationWaitDuration property: Maximum duration to wait for flux configuration reconciliation. E.g + * PT1H, PT5M, P1D. + * + * @param reconciliationWaitDuration the reconciliationWaitDuration value to set. + * @return the FluxConfigurationProperties object itself. + */ + public FluxConfigurationProperties withReconciliationWaitDuration(String reconciliationWaitDuration) { + this.reconciliationWaitDuration = reconciliationWaitDuration; + return this; + } + /** * Get the complianceState property: Combined status of the Flux Kubernetes resources created by the * fluxConfiguration or created by the managed objects. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/FluxConfigurationImpl.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/FluxConfigurationImpl.java index f3d5621de245..3d2eb8d41eff 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/FluxConfigurationImpl.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/FluxConfigurationImpl.java @@ -120,6 +120,14 @@ public OffsetDateTime statusUpdatedAt() { return this.innerModel().statusUpdatedAt(); } + public Boolean waitForReconciliation() { + return this.innerModel().waitForReconciliation(); + } + + public String reconciliationWaitDuration() { + return this.innerModel().reconciliationWaitDuration(); + } + public FluxComplianceState complianceState() { return this.innerModel().complianceState(); } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientBuilder.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientBuilder.java index 5992b14a97f1..39ed9bfffe95 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientBuilder.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientBuilder.java @@ -137,7 +137,7 @@ public SourceControlConfigurationClientImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientImpl.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientImpl.java index 42e845560db2..9c3abd5ebad9 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientImpl.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientImpl.java @@ -207,7 +207,7 @@ public OperationsClient getOperations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2022-11-01"; + this.apiVersion = "2023-05-01"; this.extensions = new ExtensionsClientImpl(this); this.operationStatus = new OperationStatusClientImpl(this); this.fluxConfigurations = new FluxConfigurationsClientImpl(this); diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/FluxConfiguration.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/FluxConfiguration.java index d631b4014e2a..bdda59b8173a 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/FluxConfiguration.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/FluxConfiguration.java @@ -145,6 +145,22 @@ public interface FluxConfiguration { */ OffsetDateTime statusUpdatedAt(); + /** + * Gets the waitForReconciliation property: Whether flux configuration deployment should wait for cluster to + * reconcile the kustomizations. + * + * @return the waitForReconciliation value. + */ + Boolean waitForReconciliation(); + + /** + * Gets the reconciliationWaitDuration property: Maximum duration to wait for flux configuration reconciliation. E.g + * PT1H, PT5M, P1D. + * + * @return the reconciliationWaitDuration value. + */ + String reconciliationWaitDuration(); + /** * Gets the complianceState property: Combined status of the Flux Kubernetes resources created by the * fluxConfiguration or created by the managed objects. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/KustomizationDefinition.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/KustomizationDefinition.java index 3d5d6c9d7a11..f0cae391028a 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/KustomizationDefinition.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/KustomizationDefinition.java @@ -62,6 +62,18 @@ public final class KustomizationDefinition { @JsonProperty(value = "force") private Boolean force; + /* + * Enable/disable health check for all Kubernetes objects created by this Kustomization. + */ + @JsonProperty(value = "wait") + private Boolean enableWait; + + /* + * Used for variable substitution for this Kustomization after kustomize build. + */ + @JsonProperty(value = "postBuild") + private PostBuildDefinition postBuild; + /** Creates an instance of KustomizationDefinition class. */ public KustomizationDefinition() { } @@ -221,11 +233,56 @@ public KustomizationDefinition withForce(Boolean force) { return this; } + /** + * Get the enableWait property: Enable/disable health check for all Kubernetes objects created by this + * Kustomization. + * + * @return the enableWait value. + */ + public Boolean enableWait() { + return this.enableWait; + } + + /** + * Set the enableWait property: Enable/disable health check for all Kubernetes objects created by this + * Kustomization. + * + * @param enableWait the enableWait value to set. + * @return the KustomizationDefinition object itself. + */ + public KustomizationDefinition withEnableWait(Boolean enableWait) { + this.enableWait = enableWait; + return this; + } + + /** + * Get the postBuild property: Used for variable substitution for this Kustomization after kustomize build. + * + * @return the postBuild value. + */ + public PostBuildDefinition postBuild() { + return this.postBuild; + } + + /** + * Set the postBuild property: Used for variable substitution for this Kustomization after kustomize build. + * + * @param postBuild the postBuild value to set. + * @return the KustomizationDefinition object itself. + */ + public KustomizationDefinition withPostBuild(PostBuildDefinition postBuild) { + this.postBuild = postBuild; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (postBuild() != null) { + postBuild().validate(); + } } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/KustomizationPatchDefinition.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/KustomizationPatchDefinition.java index f0542691de96..ee7b40f48fdc 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/KustomizationPatchDefinition.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/KustomizationPatchDefinition.java @@ -56,6 +56,18 @@ public final class KustomizationPatchDefinition { @JsonProperty(value = "force") private Boolean force; + /* + * Enable/disable health check for all Kubernetes objects created by this Kustomization. + */ + @JsonProperty(value = "wait") + private Boolean enableWait; + + /* + * Used for variable substitution for this Kustomization after kustomize build. + */ + @JsonProperty(value = "postBuild") + private PostBuildDefinition postBuild; + /** Creates an instance of KustomizationPatchDefinition class. */ public KustomizationPatchDefinition() { } @@ -206,11 +218,56 @@ public KustomizationPatchDefinition withForce(Boolean force) { return this; } + /** + * Get the enableWait property: Enable/disable health check for all Kubernetes objects created by this + * Kustomization. + * + * @return the enableWait value. + */ + public Boolean enableWait() { + return this.enableWait; + } + + /** + * Set the enableWait property: Enable/disable health check for all Kubernetes objects created by this + * Kustomization. + * + * @param enableWait the enableWait value to set. + * @return the KustomizationPatchDefinition object itself. + */ + public KustomizationPatchDefinition withEnableWait(Boolean enableWait) { + this.enableWait = enableWait; + return this; + } + + /** + * Get the postBuild property: Used for variable substitution for this Kustomization after kustomize build. + * + * @return the postBuild value. + */ + public PostBuildDefinition postBuild() { + return this.postBuild; + } + + /** + * Set the postBuild property: Used for variable substitution for this Kustomization after kustomize build. + * + * @param postBuild the postBuild value to set. + * @return the KustomizationPatchDefinition object itself. + */ + public KustomizationPatchDefinition withPostBuild(PostBuildDefinition postBuild) { + this.postBuild = postBuild; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (postBuild() != null) { + postBuild().validate(); + } } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/PostBuildDefinition.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/PostBuildDefinition.java new file mode 100644 index 000000000000..7425ac196e35 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/PostBuildDefinition.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The postBuild definitions defining variable substitutions for this Kustomization after kustomize build. */ +@Fluent +public final class PostBuildDefinition { + /* + * Key/value pairs holding the variables to be substituted in this Kustomization. + */ + @JsonProperty(value = "substitute") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map substitute; + + /* + * Array of ConfigMaps/Secrets from which the variables are substituted for this Kustomization. + */ + @JsonProperty(value = "substituteFrom") + private List substituteFrom; + + /** Creates an instance of PostBuildDefinition class. */ + public PostBuildDefinition() { + } + + /** + * Get the substitute property: Key/value pairs holding the variables to be substituted in this Kustomization. + * + * @return the substitute value. + */ + public Map substitute() { + return this.substitute; + } + + /** + * Set the substitute property: Key/value pairs holding the variables to be substituted in this Kustomization. + * + * @param substitute the substitute value to set. + * @return the PostBuildDefinition object itself. + */ + public PostBuildDefinition withSubstitute(Map substitute) { + this.substitute = substitute; + return this; + } + + /** + * Get the substituteFrom property: Array of ConfigMaps/Secrets from which the variables are substituted for this + * Kustomization. + * + * @return the substituteFrom value. + */ + public List substituteFrom() { + return this.substituteFrom; + } + + /** + * Set the substituteFrom property: Array of ConfigMaps/Secrets from which the variables are substituted for this + * Kustomization. + * + * @param substituteFrom the substituteFrom value to set. + * @return the PostBuildDefinition object itself. + */ + public PostBuildDefinition withSubstituteFrom(List substituteFrom) { + this.substituteFrom = substituteFrom; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (substituteFrom() != null) { + substituteFrom().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SubstituteFromDefinition.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SubstituteFromDefinition.java new file mode 100644 index 000000000000..26bbdbc221a4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SubstituteFromDefinition.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Array of ConfigMaps/Secrets from which the variables are substituted for this Kustomization. */ +@Fluent +public final class SubstituteFromDefinition { + /* + * Define whether it is ConfigMap or Secret that holds the variables to be used in substitution. + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * Name of the ConfigMap/Secret that holds the variables to be used in substitution. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Set to True to proceed without ConfigMap/Secret, if it is not present. + */ + @JsonProperty(value = "optional") + private Boolean optional; + + /** Creates an instance of SubstituteFromDefinition class. */ + public SubstituteFromDefinition() { + } + + /** + * Get the kind property: Define whether it is ConfigMap or Secret that holds the variables to be used in + * substitution. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Define whether it is ConfigMap or Secret that holds the variables to be used in + * substitution. + * + * @param kind the kind value to set. + * @return the SubstituteFromDefinition object itself. + */ + public SubstituteFromDefinition withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the name property: Name of the ConfigMap/Secret that holds the variables to be used in substitution. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the ConfigMap/Secret that holds the variables to be used in substitution. + * + * @param name the name value to set. + * @return the SubstituteFromDefinition object itself. + */ + public SubstituteFromDefinition withName(String name) { + this.name = name; + return this; + } + + /** + * Get the optional property: Set to True to proceed without ConfigMap/Secret, if it is not present. + * + * @return the optional value. + */ + public Boolean optional() { + return this.optional; + } + + /** + * Set the optional property: Set to True to proceed without ConfigMap/Secret, if it is not present. + * + * @param optional the optional value to set. + * @return the SubstituteFromDefinition object itself. + */ + public SubstituteFromDefinition withOptional(Boolean optional) { + this.optional = optional; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsCreateSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsCreateSamples.java index 3303bdfce2b4..309f8d387365 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsCreateSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsCreateSamples.java @@ -14,7 +14,7 @@ /** Samples for Extensions Create. */ public final class ExtensionsCreateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateExtension.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateExtension.json */ /** * Sample code: Create Extension. @@ -38,16 +38,13 @@ public static void createExtension( .withScope(new Scope().withCluster(new ScopeCluster().withReleaseNamespace("kube-system"))) .withConfigurationSettings( mapOf( - "omsagent.env.clusterName", - "clusterName1", - "omsagent.secret.wsid", - "a38cef99-5a89-52ed-b6db-22095c23664b")) - .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "secretKeyValue01")), + "omsagent.env.clusterName", "clusterName1", "omsagent.secret.wsid", "fakeTokenPlaceholder")) + .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "fakeTokenPlaceholder")), com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateExtensionWithPlan.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateExtensionWithPlan.json */ /** * Sample code: Create Extension with Plan. @@ -76,6 +73,7 @@ public static void createExtensionWithPlan( com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsDeleteSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsDeleteSamples.java index 05cf0c7e2a94..7197eaded926 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsDeleteSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Extensions Delete. */ public final class ExtensionsDeleteSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/DeleteExtension.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/DeleteExtension.json */ /** * Sample code: Delete Extension. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsGetSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsGetSamples.java index a9ed25e9bda9..ee564c328c24 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsGetSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for Extensions Get. */ public final class ExtensionsGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetExtensionWithPlan.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetExtensionWithPlan.json */ /** * Sample code: Get Extension with Plan. @@ -28,7 +28,7 @@ public static void getExtensionWithPlan( } /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetExtension.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetExtension.json */ /** * Sample code: Get Extension. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsListSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsListSamples.java index 50f4e94a7c00..033c54d69d8f 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsListSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Extensions List. */ public final class ExtensionsListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/ListExtensions.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListExtensions.json */ /** * Sample code: List Extensions. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsUpdateSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsUpdateSamples.java index 192d7b102ed5..6d986664720c 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsUpdateSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsUpdateSamples.java @@ -11,7 +11,7 @@ /** Samples for Extensions Update. */ public final class ExtensionsUpdateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/PatchExtension.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/PatchExtension.json */ /** * Sample code: Update Extension. @@ -33,14 +33,12 @@ public static void updateExtension( .withReleaseTrain("Preview") .withConfigurationSettings( mapOf( - "omsagent.env.clusterName", - "clusterName1", - "omsagent.secret.wsid", - "a38cef99-5a89-52ed-b6db-22095c23664b")) - .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "secretKeyValue01")), + "omsagent.env.clusterName", "clusterName1", "omsagent.secret.wsid", "fakeTokenPlaceholder")) + .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "fakeTokenPlaceholder")), com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigOperationStatusGetSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigOperationStatusGetSamples.java index 249332f71c53..e32538a9971c 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigOperationStatusGetSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigOperationStatusGetSamples.java @@ -7,7 +7,7 @@ /** Samples for FluxConfigOperationStatus Get. */ public final class FluxConfigOperationStatusGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetFluxConfigurationAsyncOperationStatus.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetFluxConfigurationAsyncOperationStatus.json */ /** * Sample code: FluxConfigurationAsyncOperationStatus Get. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsCreateOrUpdateSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsCreateOrUpdateSamples.java index e73b2c171dff..58b57e4ebb1b 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsCreateOrUpdateSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsCreateOrUpdateSamples.java @@ -8,9 +8,11 @@ import com.azure.resourcemanager.kubernetesconfiguration.models.BucketDefinition; import com.azure.resourcemanager.kubernetesconfiguration.models.GitRepositoryDefinition; import com.azure.resourcemanager.kubernetesconfiguration.models.KustomizationDefinition; +import com.azure.resourcemanager.kubernetesconfiguration.models.PostBuildDefinition; import com.azure.resourcemanager.kubernetesconfiguration.models.RepositoryRefDefinition; import com.azure.resourcemanager.kubernetesconfiguration.models.ScopeType; import com.azure.resourcemanager.kubernetesconfiguration.models.SourceKindType; +import com.azure.resourcemanager.kubernetesconfiguration.models.SubstituteFromDefinition; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -18,7 +20,7 @@ /** Samples for FluxConfigurations CreateOrUpdate. */ public final class FluxConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateFluxConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfiguration.json */ /** * Sample code: Create Flux Configuration. @@ -54,7 +56,18 @@ public static void createFluxConfiguration( .withPath("./test/path") .withDependsOn(Arrays.asList()) .withTimeoutInSeconds(600L) - .withSyncIntervalInSeconds(600L), + .withSyncIntervalInSeconds(600L) + .withEnableWait(true) + .withPostBuild( + new PostBuildDefinition() + .withSubstitute(mapOf("cluster_env", "prod", "replica_count", "2")) + .withSubstituteFrom( + Arrays + .asList( + new SubstituteFromDefinition() + .withKind("ConfigMap") + .withName("cluster-test") + .withOptional(true)))), "srs-kustomization2", new KustomizationDefinition() .withPath("./other/test/path") @@ -62,12 +75,28 @@ public static void createFluxConfiguration( .withTimeoutInSeconds(600L) .withSyncIntervalInSeconds(600L) .withRetryIntervalInSeconds(600L) - .withPrune(false))), + .withPrune(false) + .withEnableWait(false) + .withPostBuild( + new PostBuildDefinition() + .withSubstituteFrom( + Arrays + .asList( + new SubstituteFromDefinition() + .withKind("ConfigMap") + .withName("cluster-values") + .withOptional(true), + new SubstituteFromDefinition() + .withKind("Secret") + .withName("secret-name") + .withOptional(false)))))) + .withWaitForReconciliation(true) + .withReconciliationWaitDuration("PT30M"), com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateFluxConfigurationWithBucket.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfigurationWithBucket.json */ /** * Sample code: Create Flux Configuration with Bucket Source Kind. @@ -115,6 +144,7 @@ public static void createFluxConfigurationWithBucketSourceKind( com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsDeleteSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsDeleteSamples.java index e7aa30d35c8e..0f24cfff3d66 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsDeleteSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for FluxConfigurations Delete. */ public final class FluxConfigurationsDeleteSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/DeleteFluxConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/DeleteFluxConfiguration.json */ /** * Sample code: Delete Flux Configuration. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsGetSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsGetSamples.java index ab712a6614af..7b63c0119846 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsGetSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for FluxConfigurations Get. */ public final class FluxConfigurationsGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetFluxConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetFluxConfiguration.json */ /** * Sample code: Get Flux Configuration. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsListSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsListSamples.java index d072341a1dc9..a7505c2188f3 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsListSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for FluxConfigurations List. */ public final class FluxConfigurationsListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/ListFluxConfigurations.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListFluxConfigurations.json */ /** * Sample code: List Flux Configuration. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsUpdateSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsUpdateSamples.java index 8248b18c9e07..570f15e64947 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsUpdateSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsUpdateSamples.java @@ -13,7 +13,7 @@ /** Samples for FluxConfigurations Update. */ public final class FluxConfigurationsUpdateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/PatchFluxConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/PatchFluxConfiguration.json */ /** * Sample code: Patch Flux Configuration. @@ -50,6 +50,7 @@ public static void patchFluxConfiguration( com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusGetSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusGetSamples.java index 3521ec08409b..271429fe5b6b 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusGetSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusGetSamples.java @@ -7,7 +7,7 @@ /** Samples for OperationStatus Get. */ public final class OperationStatusGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetExtensionAsyncOperationStatus.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetExtensionAsyncOperationStatus.json */ /** * Sample code: ExtensionAsyncOperationStatus Get. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListSamples.java index 384f37459e89..465238eeeae0 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListSamples.java @@ -7,7 +7,7 @@ /** Samples for OperationStatus List. */ public final class OperationStatusListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/ListAsyncOperationStatus.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListAsyncOperationStatus.json */ /** * Sample code: AsyncOperationStatus List. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationsListSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationsListSamples.java index 87dc3e2cd821..2b4773d2e532 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationsListSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/OperationsList.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/OperationsList.json */ /** * Sample code: BatchAccountDelete. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsCreateOrUpdateSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsCreateOrUpdateSamples.java index 8f5340d6e88a..827a368df6c2 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsCreateOrUpdateSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsCreateOrUpdateSamples.java @@ -14,7 +14,7 @@ /** Samples for SourceControlConfigurations CreateOrUpdate. */ public final class SourceControlConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/CreateSourceControlConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateSourceControlConfiguration.json */ /** * Sample code: Create Source Control Configuration. @@ -37,7 +37,7 @@ public static void createSourceControlConfiguration( .withOperatorInstanceName("SRSGitHubFluxOp-01") .withOperatorType(OperatorType.FLUX) .withOperatorParams("--git-email=xyzgituser@users.srs.github.com") - .withConfigurationProtectedSettings(mapOf("protectedSetting1Key", "protectedSetting1Value")) + .withConfigurationProtectedSettings(mapOf("protectedSetting1Key", "fakeTokenPlaceholder")) .withOperatorScope(OperatorScopeType.NAMESPACE) .withSshKnownHostsContents( "c3NoLmRldi5henVyZS5jb20gc3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFDN0hyMW9UV3FOcU9sekdKT2ZHSjROYWtWeUl6ZjFyWFlkNGQ3d282akJsa0x2Q0E0b2RCbEwwbURVeVowL1FVZlRUcWV1K3RtMjJnT3N2K1ZyVlRNazZ2d1JVNzVnWS95OXV0NU1iM2JSNUJWNThkS1h5cTlBOVVlQjVDYWtlaG41WmdtNngxbUtvVnlmK0ZGbjI2aVlxWEpSZ3pJWlpjWjVWNmhyRTBRZzM5a1ptNGF6NDhvMEFVYmY2U3A0U0xkdm51TWEyc1ZOd0hCYm9TN0VKa201N1hRUFZVMy9RcHlOTEhiV0Rkend0cmxTK2V6MzBTM0FkWWhMS0VPeEFHOHdlT255cnRMSkFVZW45bVRrb2w4b0lJMWVkZjdtV1diV1ZmMG5CbWx5MjErblpjbUNUSVNRQnRkY3lQYUVubzdmRlFNREQyNi9zMGxmS29iNEt3OEg=") @@ -50,6 +50,7 @@ public static void createSourceControlConfiguration( com.azure.core.util.Context.NONE); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsDeleteSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsDeleteSamples.java index 0e3c0e563b22..0405a8bc536c 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsDeleteSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for SourceControlConfigurations Delete. */ public final class SourceControlConfigurationsDeleteSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/DeleteSourceControlConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/DeleteSourceControlConfiguration.json */ /** * Sample code: Delete Source Control Configuration. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsGetSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsGetSamples.java index 865978aae408..135ac9c8b94e 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsGetSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for SourceControlConfigurations Get. */ public final class SourceControlConfigurationsGetSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/GetSourceControlConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetSourceControlConfiguration.json */ /** * Sample code: Get Source Control Configuration. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsListSamples.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsListSamples.java index 05cb333cbaad..fb6ca85f61af 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsListSamples.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/samples/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for SourceControlConfigurations List. */ public final class SourceControlConfigurationsListSamples { /* - * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2022-11-01/examples/ListSourceControlConfiguration.json + * x-ms-original-file: specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListSourceControlConfiguration.json */ /** * Sample code: List Source Control Configuration. diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ComplianceStatusTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ComplianceStatusTests.java index 6694790c41f4..dd8d256bf68c 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ComplianceStatusTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ComplianceStatusTests.java @@ -16,10 +16,10 @@ public void testDeserialize() throws Exception { ComplianceStatus model = BinaryData .fromString( - "{\"complianceState\":\"Pending\",\"lastConfigApplied\":\"2021-03-15T08:23:31Z\",\"message\":\"gigr\",\"messageLevel\":\"Error\"}") + "{\"complianceState\":\"Failed\",\"lastConfigApplied\":\"2021-03-06T10:40:17Z\",\"message\":\"kfrlhrxsbky\",\"messageLevel\":\"Error\"}") .toObject(ComplianceStatus.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-15T08:23:31Z"), model.lastConfigApplied()); - Assertions.assertEquals("gigr", model.message()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-06T10:40:17Z"), model.lastConfigApplied()); + Assertions.assertEquals("kfrlhrxsbky", model.message()); Assertions.assertEquals(MessageLevelType.ERROR, model.messageLevel()); } @@ -27,12 +27,12 @@ public void testDeserialize() throws Exception { public void testSerialize() throws Exception { ComplianceStatus model = new ComplianceStatus() - .withLastConfigApplied(OffsetDateTime.parse("2021-03-15T08:23:31Z")) - .withMessage("gigr") + .withLastConfigApplied(OffsetDateTime.parse("2021-03-06T10:40:17Z")) + .withMessage("kfrlhrxsbky") .withMessageLevel(MessageLevelType.ERROR); model = BinaryData.fromObject(model).toObject(ComplianceStatus.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-15T08:23:31Z"), model.lastConfigApplied()); - Assertions.assertEquals("gigr", model.message()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-06T10:40:17Z"), model.lastConfigApplied()); + Assertions.assertEquals("kfrlhrxsbky", model.message()); Assertions.assertEquals(MessageLevelType.ERROR, model.messageLevel()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionPropertiesAksAssignedIdentityTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionPropertiesAksAssignedIdentityTests.java index ce2d02b580aa..8e60ec57f328 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionPropertiesAksAssignedIdentityTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionPropertiesAksAssignedIdentityTests.java @@ -14,16 +14,17 @@ public final class ExtensionPropertiesAksAssignedIdentityTests { public void testDeserialize() throws Exception { ExtensionPropertiesAksAssignedIdentity model = BinaryData - .fromString("{\"principalId\":\"cryuan\",\"tenantId\":\"uxzdxtay\",\"type\":\"UserAssigned\"}") + .fromString( + "{\"principalId\":\"audccsnhs\",\"tenantId\":\"nyejhkryhtnap\",\"type\":\"SystemAssigned\"}") .toObject(ExtensionPropertiesAksAssignedIdentity.class); - Assertions.assertEquals(AksIdentityType.USER_ASSIGNED, model.type()); + Assertions.assertEquals(AksIdentityType.SYSTEM_ASSIGNED, model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ExtensionPropertiesAksAssignedIdentity model = - new ExtensionPropertiesAksAssignedIdentity().withType(AksIdentityType.USER_ASSIGNED); + new ExtensionPropertiesAksAssignedIdentity().withType(AksIdentityType.SYSTEM_ASSIGNED); model = BinaryData.fromObject(model).toObject(ExtensionPropertiesAksAssignedIdentity.class); - Assertions.assertEquals(AksIdentityType.USER_ASSIGNED, model.type()); + Assertions.assertEquals(AksIdentityType.SYSTEM_ASSIGNED, model.type()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsDeleteMockTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsDeleteMockTests.java index 6db7e1344143..08bf9fda45df 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsDeleteMockTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ExtensionsDeleteMockTests.java @@ -58,7 +58,6 @@ public void testDelete() throws Exception { manager .extensions() - .delete( - "lcgwxzvlvqh", "kbegibt", "mxiebw", "aloayqcgwrtzju", "gwyzm", false, com.azure.core.util.Context.NONE); + .delete("tppjflcx", "gaokonzmnsikv", "kqze", "qkdltfz", "mhhv", true, com.azure.core.util.Context.NONE); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigOperationStatusGetWithResponseMockTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigOperationStatusGetWithResponseMockTests.java index c6b842672a0a..e25e698eb294 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigOperationStatusGetWithResponseMockTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigOperationStatusGetWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"id\":\"syocogjltdtbnnha\",\"name\":\"ocrkvcikh\",\"status\":\"vpa\",\"properties\":{\"queziky\":\"x\",\"ccjzkzivgvv\":\"ggxkallatmelwuip\",\"rdvstkwqqtch\":\"nayrhyrnxxmueedn\"}}"; + "{\"id\":\"mz\",\"name\":\"wabm\",\"status\":\"oefki\",\"properties\":{\"gkfbtndoaong\":\"tpuqujmq\",\"tcje\":\"jcntuj\",\"zfoqouicybxar\":\"ftwwaezkojvdc\"}}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,12 +63,18 @@ public void testGetWithResponse() throws Exception { manager .fluxConfigOperationStatus() .getWithResponse( - "mwzn", "abikns", "rgjhxb", "dtlwwrlkd", "tncvokot", "lxdy", com.azure.core.util.Context.NONE) + "vkg", + "u", + "gdknnqv", + "aznqntoru", + "sgsahmkycgr", + "uwjuetaeburuvdmo", + com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("syocogjltdtbnnha", response.id()); - Assertions.assertEquals("ocrkvcikh", response.name()); - Assertions.assertEquals("vpa", response.status()); - Assertions.assertEquals("x", response.properties().get("queziky")); + Assertions.assertEquals("mz", response.id()); + Assertions.assertEquals("wabm", response.name()); + Assertions.assertEquals("oefki", response.status()); + Assertions.assertEquals("tpuqujmq", response.properties().get("gkfbtndoaong")); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsDeleteMockTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsDeleteMockTests.java index 74d6767235cf..0150da6ccd30 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsDeleteMockTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/FluxConfigurationsDeleteMockTests.java @@ -59,12 +59,12 @@ public void testDelete() throws Exception { manager .fluxConfigurations() .delete( - "novvqfovljxy", - "suwsyrsnds", - "tgadgvraeaen", - "qnzarrwl", - "uu", - false, + "ooaojkniodkooebw", + "ujhemmsbvdkcrodt", + "infwjlfltkacjve", + "kdlfoa", + "ggkfpagaowpul", + true, com.azure.core.util.Context.NONE); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/GitRepositoryDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/GitRepositoryDefinitionTests.java index b8fad1544fd5..f687fc16a38b 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/GitRepositoryDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/GitRepositoryDefinitionTests.java @@ -15,49 +15,49 @@ public void testDeserialize() throws Exception { GitRepositoryDefinition model = BinaryData .fromString( - "{\"url\":\"utduqktapspwgcu\",\"timeoutInSeconds\":5235173509152670930,\"syncIntervalInSeconds\":7020809285560485144,\"repositoryRef\":{\"branch\":\"vqwhbmdgbbjfd\",\"tag\":\"mbmbexppbh\",\"semver\":\"qrolfpf\",\"commit\":\"algbquxigjyjg\"},\"sshKnownHosts\":\"aoyfhrtxilnerkuj\",\"httpsUser\":\"vlejuvfqa\",\"httpsCACert\":\"lyxwjkcprbnwbx\",\"localAuthRef\":\"vtb\"}") + "{\"url\":\"cpc\",\"timeoutInSeconds\":207808974598598894,\"syncIntervalInSeconds\":3513543759245297355,\"repositoryRef\":{\"branch\":\"ljjgpbtoqcjmkl\",\"tag\":\"vbqid\",\"semver\":\"ajzyul\",\"commit\":\"u\"},\"sshKnownHosts\":\"krlkhbzhfepg\",\"httpsUser\":\"qex\",\"httpsCACert\":\"ocxscpaierhhbcs\",\"localAuthRef\":\"ummajtjaod\"}") .toObject(GitRepositoryDefinition.class); - Assertions.assertEquals("utduqktapspwgcu", model.url()); - Assertions.assertEquals(5235173509152670930L, model.timeoutInSeconds()); - Assertions.assertEquals(7020809285560485144L, model.syncIntervalInSeconds()); - Assertions.assertEquals("vqwhbmdgbbjfd", model.repositoryRef().branch()); - Assertions.assertEquals("mbmbexppbh", model.repositoryRef().tag()); - Assertions.assertEquals("qrolfpf", model.repositoryRef().semver()); - Assertions.assertEquals("algbquxigjyjg", model.repositoryRef().commit()); - Assertions.assertEquals("aoyfhrtxilnerkuj", model.sshKnownHosts()); - Assertions.assertEquals("vlejuvfqa", model.httpsUser()); - Assertions.assertEquals("lyxwjkcprbnwbx", model.httpsCACert()); - Assertions.assertEquals("vtb", model.localAuthRef()); + Assertions.assertEquals("cpc", model.url()); + Assertions.assertEquals(207808974598598894L, model.timeoutInSeconds()); + Assertions.assertEquals(3513543759245297355L, model.syncIntervalInSeconds()); + Assertions.assertEquals("ljjgpbtoqcjmkl", model.repositoryRef().branch()); + Assertions.assertEquals("vbqid", model.repositoryRef().tag()); + Assertions.assertEquals("ajzyul", model.repositoryRef().semver()); + Assertions.assertEquals("u", model.repositoryRef().commit()); + Assertions.assertEquals("krlkhbzhfepg", model.sshKnownHosts()); + Assertions.assertEquals("qex", model.httpsUser()); + Assertions.assertEquals("ocxscpaierhhbcs", model.httpsCACert()); + Assertions.assertEquals("ummajtjaod", model.localAuthRef()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { GitRepositoryDefinition model = new GitRepositoryDefinition() - .withUrl("utduqktapspwgcu") - .withTimeoutInSeconds(5235173509152670930L) - .withSyncIntervalInSeconds(7020809285560485144L) + .withUrl("cpc") + .withTimeoutInSeconds(207808974598598894L) + .withSyncIntervalInSeconds(3513543759245297355L) .withRepositoryRef( new RepositoryRefDefinition() - .withBranch("vqwhbmdgbbjfd") - .withTag("mbmbexppbh") - .withSemver("qrolfpf") - .withCommit("algbquxigjyjg")) - .withSshKnownHosts("aoyfhrtxilnerkuj") - .withHttpsUser("vlejuvfqa") - .withHttpsCACert("lyxwjkcprbnwbx") - .withLocalAuthRef("vtb"); + .withBranch("ljjgpbtoqcjmkl") + .withTag("vbqid") + .withSemver("ajzyul") + .withCommit("u")) + .withSshKnownHosts("krlkhbzhfepg") + .withHttpsUser("qex") + .withHttpsCACert("ocxscpaierhhbcs") + .withLocalAuthRef("ummajtjaod"); model = BinaryData.fromObject(model).toObject(GitRepositoryDefinition.class); - Assertions.assertEquals("utduqktapspwgcu", model.url()); - Assertions.assertEquals(5235173509152670930L, model.timeoutInSeconds()); - Assertions.assertEquals(7020809285560485144L, model.syncIntervalInSeconds()); - Assertions.assertEquals("vqwhbmdgbbjfd", model.repositoryRef().branch()); - Assertions.assertEquals("mbmbexppbh", model.repositoryRef().tag()); - Assertions.assertEquals("qrolfpf", model.repositoryRef().semver()); - Assertions.assertEquals("algbquxigjyjg", model.repositoryRef().commit()); - Assertions.assertEquals("aoyfhrtxilnerkuj", model.sshKnownHosts()); - Assertions.assertEquals("vlejuvfqa", model.httpsUser()); - Assertions.assertEquals("lyxwjkcprbnwbx", model.httpsCACert()); - Assertions.assertEquals("vtb", model.localAuthRef()); + Assertions.assertEquals("cpc", model.url()); + Assertions.assertEquals(207808974598598894L, model.timeoutInSeconds()); + Assertions.assertEquals(3513543759245297355L, model.syncIntervalInSeconds()); + Assertions.assertEquals("ljjgpbtoqcjmkl", model.repositoryRef().branch()); + Assertions.assertEquals("vbqid", model.repositoryRef().tag()); + Assertions.assertEquals("ajzyul", model.repositoryRef().semver()); + Assertions.assertEquals("u", model.repositoryRef().commit()); + Assertions.assertEquals("krlkhbzhfepg", model.sshKnownHosts()); + Assertions.assertEquals("qex", model.httpsUser()); + Assertions.assertEquals("ocxscpaierhhbcs", model.httpsCACert()); + Assertions.assertEquals("ummajtjaod", model.localAuthRef()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/GitRepositoryPatchDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/GitRepositoryPatchDefinitionTests.java index a5bd713658fa..25665e1f9fd3 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/GitRepositoryPatchDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/GitRepositoryPatchDefinitionTests.java @@ -15,49 +15,49 @@ public void testDeserialize() throws Exception { GitRepositoryPatchDefinition model = BinaryData .fromString( - "{\"url\":\"dudgwdslfhot\",\"timeoutInSeconds\":2018692582884828033,\"syncIntervalInSeconds\":8219003189774073818,\"repositoryRef\":{\"branch\":\"jnpg\",\"tag\":\"ftadehxnltyfs\",\"semver\":\"pusuesn\",\"commit\":\"dejbavo\"},\"sshKnownHosts\":\"zdmohctbqvu\",\"httpsUser\":\"xdn\",\"httpsCACert\":\"vo\",\"localAuthRef\":\"ujjugwdkcglh\"}") + "{\"url\":\"g\",\"timeoutInSeconds\":4370992711496638122,\"syncIntervalInSeconds\":1393626472136421682,\"repositoryRef\":{\"branch\":\"pwhonowkg\",\"tag\":\"wankixzbi\",\"semver\":\"eputtmrywnuzoqf\",\"commit\":\"yqzrnkcqvyxlw\"},\"sshKnownHosts\":\"lsicohoqqnwv\",\"httpsUser\":\"yav\",\"httpsCACert\":\"heun\",\"localAuthRef\":\"qhgyxzkonocukok\"}") .toObject(GitRepositoryPatchDefinition.class); - Assertions.assertEquals("dudgwdslfhot", model.url()); - Assertions.assertEquals(2018692582884828033L, model.timeoutInSeconds()); - Assertions.assertEquals(8219003189774073818L, model.syncIntervalInSeconds()); - Assertions.assertEquals("jnpg", model.repositoryRef().branch()); - Assertions.assertEquals("ftadehxnltyfs", model.repositoryRef().tag()); - Assertions.assertEquals("pusuesn", model.repositoryRef().semver()); - Assertions.assertEquals("dejbavo", model.repositoryRef().commit()); - Assertions.assertEquals("zdmohctbqvu", model.sshKnownHosts()); - Assertions.assertEquals("xdn", model.httpsUser()); - Assertions.assertEquals("vo", model.httpsCACert()); - Assertions.assertEquals("ujjugwdkcglh", model.localAuthRef()); + Assertions.assertEquals("g", model.url()); + Assertions.assertEquals(4370992711496638122L, model.timeoutInSeconds()); + Assertions.assertEquals(1393626472136421682L, model.syncIntervalInSeconds()); + Assertions.assertEquals("pwhonowkg", model.repositoryRef().branch()); + Assertions.assertEquals("wankixzbi", model.repositoryRef().tag()); + Assertions.assertEquals("eputtmrywnuzoqf", model.repositoryRef().semver()); + Assertions.assertEquals("yqzrnkcqvyxlw", model.repositoryRef().commit()); + Assertions.assertEquals("lsicohoqqnwv", model.sshKnownHosts()); + Assertions.assertEquals("yav", model.httpsUser()); + Assertions.assertEquals("heun", model.httpsCACert()); + Assertions.assertEquals("qhgyxzkonocukok", model.localAuthRef()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { GitRepositoryPatchDefinition model = new GitRepositoryPatchDefinition() - .withUrl("dudgwdslfhot") - .withTimeoutInSeconds(2018692582884828033L) - .withSyncIntervalInSeconds(8219003189774073818L) + .withUrl("g") + .withTimeoutInSeconds(4370992711496638122L) + .withSyncIntervalInSeconds(1393626472136421682L) .withRepositoryRef( new RepositoryRefDefinition() - .withBranch("jnpg") - .withTag("ftadehxnltyfs") - .withSemver("pusuesn") - .withCommit("dejbavo")) - .withSshKnownHosts("zdmohctbqvu") - .withHttpsUser("xdn") - .withHttpsCACert("vo") - .withLocalAuthRef("ujjugwdkcglh"); + .withBranch("pwhonowkg") + .withTag("wankixzbi") + .withSemver("eputtmrywnuzoqf") + .withCommit("yqzrnkcqvyxlw")) + .withSshKnownHosts("lsicohoqqnwv") + .withHttpsUser("yav") + .withHttpsCACert("heun") + .withLocalAuthRef("qhgyxzkonocukok"); model = BinaryData.fromObject(model).toObject(GitRepositoryPatchDefinition.class); - Assertions.assertEquals("dudgwdslfhot", model.url()); - Assertions.assertEquals(2018692582884828033L, model.timeoutInSeconds()); - Assertions.assertEquals(8219003189774073818L, model.syncIntervalInSeconds()); - Assertions.assertEquals("jnpg", model.repositoryRef().branch()); - Assertions.assertEquals("ftadehxnltyfs", model.repositoryRef().tag()); - Assertions.assertEquals("pusuesn", model.repositoryRef().semver()); - Assertions.assertEquals("dejbavo", model.repositoryRef().commit()); - Assertions.assertEquals("zdmohctbqvu", model.sshKnownHosts()); - Assertions.assertEquals("xdn", model.httpsUser()); - Assertions.assertEquals("vo", model.httpsCACert()); - Assertions.assertEquals("ujjugwdkcglh", model.localAuthRef()); + Assertions.assertEquals("g", model.url()); + Assertions.assertEquals(4370992711496638122L, model.timeoutInSeconds()); + Assertions.assertEquals(1393626472136421682L, model.syncIntervalInSeconds()); + Assertions.assertEquals("pwhonowkg", model.repositoryRef().branch()); + Assertions.assertEquals("wankixzbi", model.repositoryRef().tag()); + Assertions.assertEquals("eputtmrywnuzoqf", model.repositoryRef().semver()); + Assertions.assertEquals("yqzrnkcqvyxlw", model.repositoryRef().commit()); + Assertions.assertEquals("lsicohoqqnwv", model.sshKnownHosts()); + Assertions.assertEquals("yav", model.httpsUser()); + Assertions.assertEquals("heun", model.httpsCACert()); + Assertions.assertEquals("qhgyxzkonocukok", model.localAuthRef()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/HelmOperatorPropertiesTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/HelmOperatorPropertiesTests.java index 9efe25c352b4..154c4522e4f6 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/HelmOperatorPropertiesTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/HelmOperatorPropertiesTests.java @@ -13,17 +13,18 @@ public final class HelmOperatorPropertiesTests { public void testDeserialize() throws Exception { HelmOperatorProperties model = BinaryData - .fromString("{\"chartVersion\":\"m\",\"chartValues\":\"yvshxmz\"}") + .fromString("{\"chartVersion\":\"oyrxvwfudwpzntxh\",\"chartValues\":\"hl\"}") .toObject(HelmOperatorProperties.class); - Assertions.assertEquals("m", model.chartVersion()); - Assertions.assertEquals("yvshxmz", model.chartValues()); + Assertions.assertEquals("oyrxvwfudwpzntxh", model.chartVersion()); + Assertions.assertEquals("hl", model.chartValues()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - HelmOperatorProperties model = new HelmOperatorProperties().withChartVersion("m").withChartValues("yvshxmz"); + HelmOperatorProperties model = + new HelmOperatorProperties().withChartVersion("oyrxvwfudwpzntxh").withChartValues("hl"); model = BinaryData.fromObject(model).toObject(HelmOperatorProperties.class); - Assertions.assertEquals("m", model.chartVersion()); - Assertions.assertEquals("yvshxmz", model.chartValues()); + Assertions.assertEquals("oyrxvwfudwpzntxh", model.chartVersion()); + Assertions.assertEquals("hl", model.chartValues()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/HelmReleasePropertiesDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/HelmReleasePropertiesDefinitionTests.java index f27b271c754d..4de15ddf542b 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/HelmReleasePropertiesDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/HelmReleasePropertiesDefinitionTests.java @@ -15,31 +15,32 @@ public void testDeserialize() throws Exception { HelmReleasePropertiesDefinition model = BinaryData .fromString( - "{\"lastRevisionApplied\":5713676412276621836,\"helmChartRef\":{\"name\":\"tutqxlngxlefgug\",\"namespace\":\"krxd\"},\"failureCount\":979128831673863857,\"installFailureCount\":2903451662374924947,\"upgradeFailureCount\":6746473362008791150}") + "{\"lastRevisionApplied\":247152507284848729,\"helmChartRef\":{\"name\":\"dystkiiuxhqyud\",\"namespace\":\"rrqnbpoczvyifqrv\"},\"failureCount\":4225896230813201107,\"installFailureCount\":3055369044346357730,\"upgradeFailureCount\":4089685326057058408}") .toObject(HelmReleasePropertiesDefinition.class); - Assertions.assertEquals(5713676412276621836L, model.lastRevisionApplied()); - Assertions.assertEquals("tutqxlngxlefgug", model.helmChartRef().name()); - Assertions.assertEquals("krxd", model.helmChartRef().namespace()); - Assertions.assertEquals(979128831673863857L, model.failureCount()); - Assertions.assertEquals(2903451662374924947L, model.installFailureCount()); - Assertions.assertEquals(6746473362008791150L, model.upgradeFailureCount()); + Assertions.assertEquals(247152507284848729L, model.lastRevisionApplied()); + Assertions.assertEquals("dystkiiuxhqyud", model.helmChartRef().name()); + Assertions.assertEquals("rrqnbpoczvyifqrv", model.helmChartRef().namespace()); + Assertions.assertEquals(4225896230813201107L, model.failureCount()); + Assertions.assertEquals(3055369044346357730L, model.installFailureCount()); + Assertions.assertEquals(4089685326057058408L, model.upgradeFailureCount()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { HelmReleasePropertiesDefinition model = new HelmReleasePropertiesDefinition() - .withLastRevisionApplied(5713676412276621836L) - .withHelmChartRef(new ObjectReferenceDefinition().withName("tutqxlngxlefgug").withNamespace("krxd")) - .withFailureCount(979128831673863857L) - .withInstallFailureCount(2903451662374924947L) - .withUpgradeFailureCount(6746473362008791150L); + .withLastRevisionApplied(247152507284848729L) + .withHelmChartRef( + new ObjectReferenceDefinition().withName("dystkiiuxhqyud").withNamespace("rrqnbpoczvyifqrv")) + .withFailureCount(4225896230813201107L) + .withInstallFailureCount(3055369044346357730L) + .withUpgradeFailureCount(4089685326057058408L); model = BinaryData.fromObject(model).toObject(HelmReleasePropertiesDefinition.class); - Assertions.assertEquals(5713676412276621836L, model.lastRevisionApplied()); - Assertions.assertEquals("tutqxlngxlefgug", model.helmChartRef().name()); - Assertions.assertEquals("krxd", model.helmChartRef().namespace()); - Assertions.assertEquals(979128831673863857L, model.failureCount()); - Assertions.assertEquals(2903451662374924947L, model.installFailureCount()); - Assertions.assertEquals(6746473362008791150L, model.upgradeFailureCount()); + Assertions.assertEquals(247152507284848729L, model.lastRevisionApplied()); + Assertions.assertEquals("dystkiiuxhqyud", model.helmChartRef().name()); + Assertions.assertEquals("rrqnbpoczvyifqrv", model.helmChartRef().namespace()); + Assertions.assertEquals(4225896230813201107L, model.failureCount()); + Assertions.assertEquals(3055369044346357730L, model.installFailureCount()); + Assertions.assertEquals(4089685326057058408L, model.upgradeFailureCount()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/IdentityTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/IdentityTests.java index 25a2b6786856..220404fcc6f7 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/IdentityTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/IdentityTests.java @@ -14,7 +14,7 @@ public final class IdentityTests { public void testDeserialize() throws Exception { Identity model = BinaryData - .fromString("{\"principalId\":\"whfpmrqobmtu\",\"tenantId\":\"nryrtihf\",\"type\":\"SystemAssigned\"}") + .fromString("{\"principalId\":\"okjye\",\"tenantId\":\"kvnipjoxz\",\"type\":\"SystemAssigned\"}") .toObject(Identity.class); Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.type()); } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/KustomizationDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/KustomizationDefinitionTests.java index 4cf8650fcc38..ebc30145a1c2 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/KustomizationDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/KustomizationDefinitionTests.java @@ -6,7 +6,11 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.kubernetesconfiguration.models.KustomizationDefinition; +import com.azure.resourcemanager.kubernetesconfiguration.models.PostBuildDefinition; +import com.azure.resourcemanager.kubernetesconfiguration.models.SubstituteFromDefinition; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import org.junit.jupiter.api.Assertions; public final class KustomizationDefinitionTests { @@ -15,35 +19,68 @@ public void testDeserialize() throws Exception { KustomizationDefinition model = BinaryData .fromString( - "{\"name\":\"wjdk\",\"path\":\"soodqxhcrmnoh\",\"dependsOn\":[\"kwh\",\"soifiyipjxsqw\"],\"timeoutInSeconds\":2704236244531071102,\"syncIntervalInSeconds\":6416527667848013602,\"retryIntervalInSeconds\":6117195169735305207,\"prune\":false,\"force\":false}") + "{\"name\":\"qkwpyeicxmqc\",\"path\":\"q\",\"dependsOn\":[\"hix\",\"igdtopbob\",\"og\",\"m\"],\"timeoutInSeconds\":495685925173240949,\"syncIntervalInSeconds\":1066773928950935617,\"retryIntervalInSeconds\":5747639335856339043,\"prune\":true,\"force\":true,\"wait\":false,\"postBuild\":{\"substitute\":{\"iotkftutqxl\":\"f\",\"mi\":\"gxlefgugnxkrxd\"},\"substituteFrom\":[{\"kind\":\"zrvqdr\",\"name\":\"hjybigehoqfbo\",\"optional\":true}]}}") .toObject(KustomizationDefinition.class); - Assertions.assertEquals("soodqxhcrmnoh", model.path()); - Assertions.assertEquals("kwh", model.dependsOn().get(0)); - Assertions.assertEquals(2704236244531071102L, model.timeoutInSeconds()); - Assertions.assertEquals(6416527667848013602L, model.syncIntervalInSeconds()); - Assertions.assertEquals(6117195169735305207L, model.retryIntervalInSeconds()); - Assertions.assertEquals(false, model.prune()); - Assertions.assertEquals(false, model.force()); + Assertions.assertEquals("q", model.path()); + Assertions.assertEquals("hix", model.dependsOn().get(0)); + Assertions.assertEquals(495685925173240949L, model.timeoutInSeconds()); + Assertions.assertEquals(1066773928950935617L, model.syncIntervalInSeconds()); + Assertions.assertEquals(5747639335856339043L, model.retryIntervalInSeconds()); + Assertions.assertEquals(true, model.prune()); + Assertions.assertEquals(true, model.force()); + Assertions.assertEquals(false, model.enableWait()); + Assertions.assertEquals("f", model.postBuild().substitute().get("iotkftutqxl")); + Assertions.assertEquals("zrvqdr", model.postBuild().substituteFrom().get(0).kind()); + Assertions.assertEquals("hjybigehoqfbo", model.postBuild().substituteFrom().get(0).name()); + Assertions.assertEquals(true, model.postBuild().substituteFrom().get(0).optional()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { KustomizationDefinition model = new KustomizationDefinition() - .withPath("soodqxhcrmnoh") - .withDependsOn(Arrays.asList("kwh", "soifiyipjxsqw")) - .withTimeoutInSeconds(2704236244531071102L) - .withSyncIntervalInSeconds(6416527667848013602L) - .withRetryIntervalInSeconds(6117195169735305207L) - .withPrune(false) - .withForce(false); + .withPath("q") + .withDependsOn(Arrays.asList("hix", "igdtopbob", "og", "m")) + .withTimeoutInSeconds(495685925173240949L) + .withSyncIntervalInSeconds(1066773928950935617L) + .withRetryIntervalInSeconds(5747639335856339043L) + .withPrune(true) + .withForce(true) + .withEnableWait(false) + .withPostBuild( + new PostBuildDefinition() + .withSubstitute(mapOf("iotkftutqxl", "f", "mi", "gxlefgugnxkrxd")) + .withSubstituteFrom( + Arrays + .asList( + new SubstituteFromDefinition() + .withKind("zrvqdr") + .withName("hjybigehoqfbo") + .withOptional(true)))); model = BinaryData.fromObject(model).toObject(KustomizationDefinition.class); - Assertions.assertEquals("soodqxhcrmnoh", model.path()); - Assertions.assertEquals("kwh", model.dependsOn().get(0)); - Assertions.assertEquals(2704236244531071102L, model.timeoutInSeconds()); - Assertions.assertEquals(6416527667848013602L, model.syncIntervalInSeconds()); - Assertions.assertEquals(6117195169735305207L, model.retryIntervalInSeconds()); - Assertions.assertEquals(false, model.prune()); - Assertions.assertEquals(false, model.force()); + Assertions.assertEquals("q", model.path()); + Assertions.assertEquals("hix", model.dependsOn().get(0)); + Assertions.assertEquals(495685925173240949L, model.timeoutInSeconds()); + Assertions.assertEquals(1066773928950935617L, model.syncIntervalInSeconds()); + Assertions.assertEquals(5747639335856339043L, model.retryIntervalInSeconds()); + Assertions.assertEquals(true, model.prune()); + Assertions.assertEquals(true, model.force()); + Assertions.assertEquals(false, model.enableWait()); + Assertions.assertEquals("f", model.postBuild().substitute().get("iotkftutqxl")); + Assertions.assertEquals("zrvqdr", model.postBuild().substituteFrom().get(0).kind()); + Assertions.assertEquals("hjybigehoqfbo", model.postBuild().substituteFrom().get(0).name()); + Assertions.assertEquals(true, model.postBuild().substituteFrom().get(0).optional()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/KustomizationPatchDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/KustomizationPatchDefinitionTests.java index cc90adeaf4de..8442358963b8 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/KustomizationPatchDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/KustomizationPatchDefinitionTests.java @@ -6,7 +6,11 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.kubernetesconfiguration.models.KustomizationPatchDefinition; +import com.azure.resourcemanager.kubernetesconfiguration.models.PostBuildDefinition; +import com.azure.resourcemanager.kubernetesconfiguration.models.SubstituteFromDefinition; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import org.junit.jupiter.api.Assertions; public final class KustomizationPatchDefinitionTests { @@ -15,35 +19,85 @@ public void testDeserialize() throws Exception { KustomizationPatchDefinition model = BinaryData .fromString( - "{\"path\":\"fhyhltrpmopjmcma\",\"dependsOn\":[\"kthfui\"],\"timeoutInSeconds\":8411741247205328781,\"syncIntervalInSeconds\":2922940373355602570,\"retryIntervalInSeconds\":4723092601162444812,\"prune\":true,\"force\":true}") + "{\"path\":\"ncghkje\",\"dependsOn\":[\"hbijhtxfvgxb\",\"smx\",\"eh\"],\"timeoutInSeconds\":5279138530813051963,\"syncIntervalInSeconds\":6726437827425904455,\"retryIntervalInSeconds\":8488647462806528566,\"prune\":false,\"force\":false,\"wait\":true,\"postBuild\":{\"substitute\":{\"flz\":\"ukgri\",\"qzahmgkbrp\":\"fbxzpuzycisp\",\"hibnuqqkpika\":\"y\",\"buynhijggm\":\"rgvtqag\"},\"substituteFrom\":[{\"kind\":\"iarbutrcvpna\",\"name\":\"mhjrunmpxttdbhr\",\"optional\":false},{\"kind\":\"nkxmyskpbhenbtk\",\"name\":\"ywn\",\"optional\":false},{\"kind\":\"synlqidybyxczfc\",\"name\":\"aaxdbabphlwrq\",\"optional\":true}]}}") .toObject(KustomizationPatchDefinition.class); - Assertions.assertEquals("fhyhltrpmopjmcma", model.path()); - Assertions.assertEquals("kthfui", model.dependsOn().get(0)); - Assertions.assertEquals(8411741247205328781L, model.timeoutInSeconds()); - Assertions.assertEquals(2922940373355602570L, model.syncIntervalInSeconds()); - Assertions.assertEquals(4723092601162444812L, model.retryIntervalInSeconds()); - Assertions.assertEquals(true, model.prune()); - Assertions.assertEquals(true, model.force()); + Assertions.assertEquals("ncghkje", model.path()); + Assertions.assertEquals("hbijhtxfvgxb", model.dependsOn().get(0)); + Assertions.assertEquals(5279138530813051963L, model.timeoutInSeconds()); + Assertions.assertEquals(6726437827425904455L, model.syncIntervalInSeconds()); + Assertions.assertEquals(8488647462806528566L, model.retryIntervalInSeconds()); + Assertions.assertEquals(false, model.prune()); + Assertions.assertEquals(false, model.force()); + Assertions.assertEquals(true, model.enableWait()); + Assertions.assertEquals("ukgri", model.postBuild().substitute().get("flz")); + Assertions.assertEquals("iarbutrcvpna", model.postBuild().substituteFrom().get(0).kind()); + Assertions.assertEquals("mhjrunmpxttdbhr", model.postBuild().substituteFrom().get(0).name()); + Assertions.assertEquals(false, model.postBuild().substituteFrom().get(0).optional()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { KustomizationPatchDefinition model = new KustomizationPatchDefinition() - .withPath("fhyhltrpmopjmcma") - .withDependsOn(Arrays.asList("kthfui")) - .withTimeoutInSeconds(8411741247205328781L) - .withSyncIntervalInSeconds(2922940373355602570L) - .withRetryIntervalInSeconds(4723092601162444812L) - .withPrune(true) - .withForce(true); + .withPath("ncghkje") + .withDependsOn(Arrays.asList("hbijhtxfvgxb", "smx", "eh")) + .withTimeoutInSeconds(5279138530813051963L) + .withSyncIntervalInSeconds(6726437827425904455L) + .withRetryIntervalInSeconds(8488647462806528566L) + .withPrune(false) + .withForce(false) + .withEnableWait(true) + .withPostBuild( + new PostBuildDefinition() + .withSubstitute( + mapOf( + "flz", + "ukgri", + "qzahmgkbrp", + "fbxzpuzycisp", + "hibnuqqkpika", + "y", + "buynhijggm", + "rgvtqag")) + .withSubstituteFrom( + Arrays + .asList( + new SubstituteFromDefinition() + .withKind("iarbutrcvpna") + .withName("mhjrunmpxttdbhr") + .withOptional(false), + new SubstituteFromDefinition() + .withKind("nkxmyskpbhenbtk") + .withName("ywn") + .withOptional(false), + new SubstituteFromDefinition() + .withKind("synlqidybyxczfc") + .withName("aaxdbabphlwrq") + .withOptional(true)))); model = BinaryData.fromObject(model).toObject(KustomizationPatchDefinition.class); - Assertions.assertEquals("fhyhltrpmopjmcma", model.path()); - Assertions.assertEquals("kthfui", model.dependsOn().get(0)); - Assertions.assertEquals(8411741247205328781L, model.timeoutInSeconds()); - Assertions.assertEquals(2922940373355602570L, model.syncIntervalInSeconds()); - Assertions.assertEquals(4723092601162444812L, model.retryIntervalInSeconds()); - Assertions.assertEquals(true, model.prune()); - Assertions.assertEquals(true, model.force()); + Assertions.assertEquals("ncghkje", model.path()); + Assertions.assertEquals("hbijhtxfvgxb", model.dependsOn().get(0)); + Assertions.assertEquals(5279138530813051963L, model.timeoutInSeconds()); + Assertions.assertEquals(6726437827425904455L, model.syncIntervalInSeconds()); + Assertions.assertEquals(8488647462806528566L, model.retryIntervalInSeconds()); + Assertions.assertEquals(false, model.prune()); + Assertions.assertEquals(false, model.force()); + Assertions.assertEquals(true, model.enableWait()); + Assertions.assertEquals("ukgri", model.postBuild().substitute().get("flz")); + Assertions.assertEquals("iarbutrcvpna", model.postBuild().substituteFrom().get(0).kind()); + Assertions.assertEquals("mhjrunmpxttdbhr", model.postBuild().substituteFrom().get(0).name()); + Assertions.assertEquals(false, model.postBuild().substituteFrom().get(0).optional()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ManagedIdentityDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ManagedIdentityDefinitionTests.java index 15a686b9dcbe..450184b40461 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ManagedIdentityDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ManagedIdentityDefinitionTests.java @@ -12,14 +12,14 @@ public final class ManagedIdentityDefinitionTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ManagedIdentityDefinition model = - BinaryData.fromString("{\"clientId\":\"ypyqrimzinp\"}").toObject(ManagedIdentityDefinition.class); - Assertions.assertEquals("ypyqrimzinp", model.clientId()); + BinaryData.fromString("{\"clientId\":\"t\"}").toObject(ManagedIdentityDefinition.class); + Assertions.assertEquals("t", model.clientId()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ManagedIdentityDefinition model = new ManagedIdentityDefinition().withClientId("ypyqrimzinp"); + ManagedIdentityDefinition model = new ManagedIdentityDefinition().withClientId("t"); model = BinaryData.fromObject(model).toObject(ManagedIdentityDefinition.class); - Assertions.assertEquals("ypyqrimzinp", model.clientId()); + Assertions.assertEquals("t", model.clientId()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ManagedIdentityPatchDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ManagedIdentityPatchDefinitionTests.java index 962ea6134296..38022fa965b6 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ManagedIdentityPatchDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ManagedIdentityPatchDefinitionTests.java @@ -12,14 +12,14 @@ public final class ManagedIdentityPatchDefinitionTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ManagedIdentityPatchDefinition model = - BinaryData.fromString("{\"clientId\":\"ae\"}").toObject(ManagedIdentityPatchDefinition.class); - Assertions.assertEquals("ae", model.clientId()); + BinaryData.fromString("{\"clientId\":\"ljyoxgvcltb\"}").toObject(ManagedIdentityPatchDefinition.class); + Assertions.assertEquals("ljyoxgvcltb", model.clientId()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ManagedIdentityPatchDefinition model = new ManagedIdentityPatchDefinition().withClientId("ae"); + ManagedIdentityPatchDefinition model = new ManagedIdentityPatchDefinition().withClientId("ljyoxgvcltb"); model = BinaryData.fromObject(model).toObject(ManagedIdentityPatchDefinition.class); - Assertions.assertEquals("ae", model.clientId()); + Assertions.assertEquals("ljyoxgvcltb", model.clientId()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectReferenceDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectReferenceDefinitionTests.java index 6a173aca86f3..0a3f7c0cb794 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectReferenceDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectReferenceDefinitionTests.java @@ -13,17 +13,18 @@ public final class ObjectReferenceDefinitionTests { public void testDeserialize() throws Exception { ObjectReferenceDefinition model = BinaryData - .fromString("{\"name\":\"icxm\",\"namespace\":\"iwqvhkh\"}") + .fromString("{\"name\":\"hltrpmopjmcmatuo\",\"namespace\":\"hfuiuaodsfc\"}") .toObject(ObjectReferenceDefinition.class); - Assertions.assertEquals("icxm", model.name()); - Assertions.assertEquals("iwqvhkh", model.namespace()); + Assertions.assertEquals("hltrpmopjmcmatuo", model.name()); + Assertions.assertEquals("hfuiuaodsfc", model.namespace()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ObjectReferenceDefinition model = new ObjectReferenceDefinition().withName("icxm").withNamespace("iwqvhkh"); + ObjectReferenceDefinition model = + new ObjectReferenceDefinition().withName("hltrpmopjmcmatuo").withNamespace("hfuiuaodsfc"); model = BinaryData.fromObject(model).toObject(ObjectReferenceDefinition.class); - Assertions.assertEquals("icxm", model.name()); - Assertions.assertEquals("iwqvhkh", model.namespace()); + Assertions.assertEquals("hltrpmopjmcmatuo", model.name()); + Assertions.assertEquals("hfuiuaodsfc", model.namespace()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectStatusConditionDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectStatusConditionDefinitionTests.java index 083d4e769ce0..82affb0de9d6 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectStatusConditionDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectStatusConditionDefinitionTests.java @@ -15,29 +15,29 @@ public void testDeserialize() throws Exception { ObjectStatusConditionDefinition model = BinaryData .fromString( - "{\"lastTransitionTime\":\"2021-04-08T23:48:15Z\",\"message\":\"gdtopbobjogh\",\"reason\":\"w\",\"status\":\"m\",\"type\":\"hrzayvvtpgvdf\"}") + "{\"lastTransitionTime\":\"2021-06-22T02:08:06Z\",\"message\":\"odpuozmyzydag\",\"reason\":\"axbezyiuo\",\"status\":\"twhrdxwzywqsm\",\"type\":\"ureximoryocfs\"}") .toObject(ObjectStatusConditionDefinition.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-08T23:48:15Z"), model.lastTransitionTime()); - Assertions.assertEquals("gdtopbobjogh", model.message()); - Assertions.assertEquals("w", model.reason()); - Assertions.assertEquals("m", model.status()); - Assertions.assertEquals("hrzayvvtpgvdf", model.type()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-22T02:08:06Z"), model.lastTransitionTime()); + Assertions.assertEquals("odpuozmyzydag", model.message()); + Assertions.assertEquals("axbezyiuo", model.reason()); + Assertions.assertEquals("twhrdxwzywqsm", model.status()); + Assertions.assertEquals("ureximoryocfs", model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ObjectStatusConditionDefinition model = new ObjectStatusConditionDefinition() - .withLastTransitionTime(OffsetDateTime.parse("2021-04-08T23:48:15Z")) - .withMessage("gdtopbobjogh") - .withReason("w") - .withStatus("m") - .withType("hrzayvvtpgvdf"); + .withLastTransitionTime(OffsetDateTime.parse("2021-06-22T02:08:06Z")) + .withMessage("odpuozmyzydag") + .withReason("axbezyiuo") + .withStatus("twhrdxwzywqsm") + .withType("ureximoryocfs"); model = BinaryData.fromObject(model).toObject(ObjectStatusConditionDefinition.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-08T23:48:15Z"), model.lastTransitionTime()); - Assertions.assertEquals("gdtopbobjogh", model.message()); - Assertions.assertEquals("w", model.reason()); - Assertions.assertEquals("m", model.status()); - Assertions.assertEquals("hrzayvvtpgvdf", model.type()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-22T02:08:06Z"), model.lastTransitionTime()); + Assertions.assertEquals("odpuozmyzydag", model.message()); + Assertions.assertEquals("axbezyiuo", model.reason()); + Assertions.assertEquals("twhrdxwzywqsm", model.status()); + Assertions.assertEquals("ureximoryocfs", model.type()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectStatusDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectStatusDefinitionTests.java index 7b4f528957f6..7575fc5c5f56 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectStatusDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ObjectStatusDefinitionTests.java @@ -20,92 +20,91 @@ public void testDeserialize() throws Exception { ObjectStatusDefinition model = BinaryData .fromString( - "{\"name\":\"byxqabn\",\"namespace\":\"cpc\",\"kind\":\"hurzafblj\",\"complianceState\":\"Pending\",\"appliedBy\":{\"name\":\"oq\",\"namespace\":\"mkljavb\"},\"statusConditions\":[{\"lastTransitionTime\":\"2021-05-13T19:23:23Z\",\"message\":\"jzyulpk\",\"reason\":\"jkrlkhbzhfepg\",\"status\":\"qex\",\"type\":\"ocxscpaierhhbcs\"},{\"lastTransitionTime\":\"2021-06-03T06:29:13Z\",\"message\":\"majtjaod\",\"reason\":\"bnbdxkqpxokajion\",\"status\":\"mexgstxgcp\",\"type\":\"gmaajrm\"},{\"lastTransitionTime\":\"2021-03-11T04:53:43Z\",\"message\":\"zrlovmclwhijcoej\",\"reason\":\"bzaqsqsycbkbfk\",\"status\":\"kdkexxp\",\"type\":\"fmxa\"},{\"lastTransitionTime\":\"2021-06-05T20:06:24Z\",\"message\":\"pg\",\"reason\":\"toc\",\"status\":\"xhvpmoue\",\"type\":\"dzxibqeojnxqbzvd\"}],\"helmReleaseProperties\":{\"lastRevisionApplied\":2783260712694826920,\"helmChartRef\":{\"name\":\"icbtwnpzao\",\"namespace\":\"uhrhcffcyddgl\"},\"failureCount\":52347448504645703,\"installFailureCount\":4471545183112008716,\"upgradeFailureCount\":6943639735240918018}}") + "{\"name\":\"wtgrhpdjpj\",\"namespace\":\"asxazjpqyegualhb\",\"kind\":\"hejjz\",\"complianceState\":\"Non-Compliant\",\"appliedBy\":{\"name\":\"gwdslfhotwm\",\"namespace\":\"npwlbjnpg\"},\"statusConditions\":[{\"lastTransitionTime\":\"2021-10-08T18:53:29Z\",\"message\":\"ehxnltyfsop\",\"reason\":\"suesnzw\",\"status\":\"jbavorxzdm\",\"type\":\"ctbqvudwx\"},{\"lastTransitionTime\":\"2021-03-23T22:55:01Z\",\"message\":\"vo\",\"reason\":\"ujjugwdkcglh\",\"status\":\"azjdyggd\",\"type\":\"ixhbkuofqweykhm\"},{\"lastTransitionTime\":\"2021-08-01T10:52:51Z\",\"message\":\"fyexfwhy\",\"reason\":\"i\",\"status\":\"yvdcsitynnaa\",\"type\":\"ectehf\"},{\"lastTransitionTime\":\"2021-03-19T08:13:40Z\",\"message\":\"jeyp\",\"reason\":\"ezrkgqhcjrefo\",\"status\":\"mkqsleyyv\",\"type\":\"qjpkcattpngjcrc\"}],\"helmReleaseProperties\":{\"lastRevisionApplied\":8852498521438996261,\"helmChartRef\":{\"name\":\"vmdajvnysou\",\"namespace\":\"e\"},\"failureCount\":3884440405716336055,\"installFailureCount\":4529960801894599237,\"upgradeFailureCount\":8165911566744254843}}") .toObject(ObjectStatusDefinition.class); - Assertions.assertEquals("byxqabn", model.name()); - Assertions.assertEquals("cpc", model.namespace()); - Assertions.assertEquals("hurzafblj", model.kind()); - Assertions.assertEquals(FluxComplianceState.PENDING, model.complianceState()); - Assertions.assertEquals("oq", model.appliedBy().name()); - Assertions.assertEquals("mkljavb", model.appliedBy().namespace()); + Assertions.assertEquals("wtgrhpdjpj", model.name()); + Assertions.assertEquals("asxazjpqyegualhb", model.namespace()); + Assertions.assertEquals("hejjz", model.kind()); + Assertions.assertEquals(FluxComplianceState.NON_COMPLIANT, model.complianceState()); + Assertions.assertEquals("gwdslfhotwm", model.appliedBy().name()); + Assertions.assertEquals("npwlbjnpg", model.appliedBy().namespace()); Assertions .assertEquals( - OffsetDateTime.parse("2021-05-13T19:23:23Z"), model.statusConditions().get(0).lastTransitionTime()); - Assertions.assertEquals("jzyulpk", model.statusConditions().get(0).message()); - Assertions.assertEquals("jkrlkhbzhfepg", model.statusConditions().get(0).reason()); - Assertions.assertEquals("qex", model.statusConditions().get(0).status()); - Assertions.assertEquals("ocxscpaierhhbcs", model.statusConditions().get(0).type()); - Assertions.assertEquals(2783260712694826920L, model.helmReleaseProperties().lastRevisionApplied()); - Assertions.assertEquals("icbtwnpzao", model.helmReleaseProperties().helmChartRef().name()); - Assertions.assertEquals("uhrhcffcyddgl", model.helmReleaseProperties().helmChartRef().namespace()); - Assertions.assertEquals(52347448504645703L, model.helmReleaseProperties().failureCount()); - Assertions.assertEquals(4471545183112008716L, model.helmReleaseProperties().installFailureCount()); - Assertions.assertEquals(6943639735240918018L, model.helmReleaseProperties().upgradeFailureCount()); + OffsetDateTime.parse("2021-10-08T18:53:29Z"), model.statusConditions().get(0).lastTransitionTime()); + Assertions.assertEquals("ehxnltyfsop", model.statusConditions().get(0).message()); + Assertions.assertEquals("suesnzw", model.statusConditions().get(0).reason()); + Assertions.assertEquals("jbavorxzdm", model.statusConditions().get(0).status()); + Assertions.assertEquals("ctbqvudwx", model.statusConditions().get(0).type()); + Assertions.assertEquals(8852498521438996261L, model.helmReleaseProperties().lastRevisionApplied()); + Assertions.assertEquals("vmdajvnysou", model.helmReleaseProperties().helmChartRef().name()); + Assertions.assertEquals("e", model.helmReleaseProperties().helmChartRef().namespace()); + Assertions.assertEquals(3884440405716336055L, model.helmReleaseProperties().failureCount()); + Assertions.assertEquals(4529960801894599237L, model.helmReleaseProperties().installFailureCount()); + Assertions.assertEquals(8165911566744254843L, model.helmReleaseProperties().upgradeFailureCount()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ObjectStatusDefinition model = new ObjectStatusDefinition() - .withName("byxqabn") - .withNamespace("cpc") - .withKind("hurzafblj") - .withComplianceState(FluxComplianceState.PENDING) - .withAppliedBy(new ObjectReferenceDefinition().withName("oq").withNamespace("mkljavb")) + .withName("wtgrhpdjpj") + .withNamespace("asxazjpqyegualhb") + .withKind("hejjz") + .withComplianceState(FluxComplianceState.NON_COMPLIANT) + .withAppliedBy(new ObjectReferenceDefinition().withName("gwdslfhotwm").withNamespace("npwlbjnpg")) .withStatusConditions( Arrays .asList( new ObjectStatusConditionDefinition() - .withLastTransitionTime(OffsetDateTime.parse("2021-05-13T19:23:23Z")) - .withMessage("jzyulpk") - .withReason("jkrlkhbzhfepg") - .withStatus("qex") - .withType("ocxscpaierhhbcs"), + .withLastTransitionTime(OffsetDateTime.parse("2021-10-08T18:53:29Z")) + .withMessage("ehxnltyfsop") + .withReason("suesnzw") + .withStatus("jbavorxzdm") + .withType("ctbqvudwx"), new ObjectStatusConditionDefinition() - .withLastTransitionTime(OffsetDateTime.parse("2021-06-03T06:29:13Z")) - .withMessage("majtjaod") - .withReason("bnbdxkqpxokajion") - .withStatus("mexgstxgcp") - .withType("gmaajrm"), + .withLastTransitionTime(OffsetDateTime.parse("2021-03-23T22:55:01Z")) + .withMessage("vo") + .withReason("ujjugwdkcglh") + .withStatus("azjdyggd") + .withType("ixhbkuofqweykhm"), new ObjectStatusConditionDefinition() - .withLastTransitionTime(OffsetDateTime.parse("2021-03-11T04:53:43Z")) - .withMessage("zrlovmclwhijcoej") - .withReason("bzaqsqsycbkbfk") - .withStatus("kdkexxp") - .withType("fmxa"), + .withLastTransitionTime(OffsetDateTime.parse("2021-08-01T10:52:51Z")) + .withMessage("fyexfwhy") + .withReason("i") + .withStatus("yvdcsitynnaa") + .withType("ectehf"), new ObjectStatusConditionDefinition() - .withLastTransitionTime(OffsetDateTime.parse("2021-06-05T20:06:24Z")) - .withMessage("pg") - .withReason("toc") - .withStatus("xhvpmoue") - .withType("dzxibqeojnxqbzvd"))) + .withLastTransitionTime(OffsetDateTime.parse("2021-03-19T08:13:40Z")) + .withMessage("jeyp") + .withReason("ezrkgqhcjrefo") + .withStatus("mkqsleyyv") + .withType("qjpkcattpngjcrc"))) .withHelmReleaseProperties( new HelmReleasePropertiesDefinition() - .withLastRevisionApplied(2783260712694826920L) - .withHelmChartRef( - new ObjectReferenceDefinition().withName("icbtwnpzao").withNamespace("uhrhcffcyddgl")) - .withFailureCount(52347448504645703L) - .withInstallFailureCount(4471545183112008716L) - .withUpgradeFailureCount(6943639735240918018L)); + .withLastRevisionApplied(8852498521438996261L) + .withHelmChartRef(new ObjectReferenceDefinition().withName("vmdajvnysou").withNamespace("e")) + .withFailureCount(3884440405716336055L) + .withInstallFailureCount(4529960801894599237L) + .withUpgradeFailureCount(8165911566744254843L)); model = BinaryData.fromObject(model).toObject(ObjectStatusDefinition.class); - Assertions.assertEquals("byxqabn", model.name()); - Assertions.assertEquals("cpc", model.namespace()); - Assertions.assertEquals("hurzafblj", model.kind()); - Assertions.assertEquals(FluxComplianceState.PENDING, model.complianceState()); - Assertions.assertEquals("oq", model.appliedBy().name()); - Assertions.assertEquals("mkljavb", model.appliedBy().namespace()); + Assertions.assertEquals("wtgrhpdjpj", model.name()); + Assertions.assertEquals("asxazjpqyegualhb", model.namespace()); + Assertions.assertEquals("hejjz", model.kind()); + Assertions.assertEquals(FluxComplianceState.NON_COMPLIANT, model.complianceState()); + Assertions.assertEquals("gwdslfhotwm", model.appliedBy().name()); + Assertions.assertEquals("npwlbjnpg", model.appliedBy().namespace()); Assertions .assertEquals( - OffsetDateTime.parse("2021-05-13T19:23:23Z"), model.statusConditions().get(0).lastTransitionTime()); - Assertions.assertEquals("jzyulpk", model.statusConditions().get(0).message()); - Assertions.assertEquals("jkrlkhbzhfepg", model.statusConditions().get(0).reason()); - Assertions.assertEquals("qex", model.statusConditions().get(0).status()); - Assertions.assertEquals("ocxscpaierhhbcs", model.statusConditions().get(0).type()); - Assertions.assertEquals(2783260712694826920L, model.helmReleaseProperties().lastRevisionApplied()); - Assertions.assertEquals("icbtwnpzao", model.helmReleaseProperties().helmChartRef().name()); - Assertions.assertEquals("uhrhcffcyddgl", model.helmReleaseProperties().helmChartRef().namespace()); - Assertions.assertEquals(52347448504645703L, model.helmReleaseProperties().failureCount()); - Assertions.assertEquals(4471545183112008716L, model.helmReleaseProperties().installFailureCount()); - Assertions.assertEquals(6943639735240918018L, model.helmReleaseProperties().upgradeFailureCount()); + OffsetDateTime.parse("2021-10-08T18:53:29Z"), model.statusConditions().get(0).lastTransitionTime()); + Assertions.assertEquals("ehxnltyfsop", model.statusConditions().get(0).message()); + Assertions.assertEquals("suesnzw", model.statusConditions().get(0).reason()); + Assertions.assertEquals("jbavorxzdm", model.statusConditions().get(0).status()); + Assertions.assertEquals("ctbqvudwx", model.statusConditions().get(0).type()); + Assertions.assertEquals(8852498521438996261L, model.helmReleaseProperties().lastRevisionApplied()); + Assertions.assertEquals("vmdajvnysou", model.helmReleaseProperties().helmChartRef().name()); + Assertions.assertEquals("e", model.helmReleaseProperties().helmChartRef().namespace()); + Assertions.assertEquals(3884440405716336055L, model.helmReleaseProperties().failureCount()); + Assertions.assertEquals(4529960801894599237L, model.helmReleaseProperties().installFailureCount()); + Assertions.assertEquals(8165911566744254843L, model.helmReleaseProperties().upgradeFailureCount()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusGetWithResponseMockTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusGetWithResponseMockTests.java index 56389e3eaef4..5b61fda27235 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusGetWithResponseMockTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusGetWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"id\":\"lcxog\",\"name\":\"konzmnsik\",\"status\":\"mkqzeqqkdltfzxmh\",\"properties\":{\"tibqdxbxwakb\":\"gureodkwobdag\",\"podxunkb\":\"gqxndlkzgxhuripl\"}}"; + "{\"id\":\"xywsuws\",\"name\":\"s\",\"status\":\"dsytgadgvr\",\"properties\":{\"qnzarrwl\":\"en\",\"jfqka\":\"uu\",\"iipfpubj\":\"e\"}}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,12 +63,18 @@ public void testGetWithResponse() throws Exception { manager .operationStatus() .getWithResponse( - "semwabnet", "hhszh", "d", "lvwiwubmwmbesl", "nkww", "pp", com.azure.core.util.Context.NONE) + "pqwcciuqgbdbutau", + "fbtkuwhhmhyk", + "joxafnndlpi", + "hkoymkcdyhbp", + "kpw", + "reqnovvqfov", + com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("lcxog", response.id()); - Assertions.assertEquals("konzmnsik", response.name()); - Assertions.assertEquals("mkqzeqqkdltfzxmh", response.status()); - Assertions.assertEquals("gureodkwobdag", response.properties().get("tibqdxbxwakb")); + Assertions.assertEquals("xywsuws", response.id()); + Assertions.assertEquals("s", response.name()); + Assertions.assertEquals("dsytgadgvr", response.status()); + Assertions.assertEquals("en", response.properties().get("qnzarrwl")); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListMockTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListMockTests.java index a78a6ce23bdf..05e438f258e8 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListMockTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListMockTests.java @@ -32,7 +32,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"id\":\"pbttdum\",\"name\":\"p\",\"status\":\"xe\",\"properties\":{\"glkfg\":\"zbtbhj\",\"dyhtozfikdowwquu\":\"hdneuelfph\"}}]}"; + "{\"value\":[{\"id\":\"ynt\",\"name\":\"zihleosjswsr\",\"status\":\"slyzrpzbchckqq\",\"properties\":{\"ysuiizynkedya\":\"ox\",\"pyy\":\"rwyhqmibzyhwitsm\",\"mwzn\":\"pcdpumnz\"}}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,11 +63,11 @@ public void testList() throws Exception { PagedIterable response = manager .operationStatus() - .list("xmubyyntwlrbq", "koievseo", "gqrlltmuwla", "wzizxbmpgcjefuzm", com.azure.core.util.Context.NONE); + .list("wwiftohqkvpuv", "sgplsakn", "n", "synljphuopxodl", com.azure.core.util.Context.NONE); - Assertions.assertEquals("pbttdum", response.iterator().next().id()); - Assertions.assertEquals("p", response.iterator().next().name()); - Assertions.assertEquals("xe", response.iterator().next().status()); - Assertions.assertEquals("zbtbhj", response.iterator().next().properties().get("glkfg")); + Assertions.assertEquals("ynt", response.iterator().next().id()); + Assertions.assertEquals("zihleosjswsr", response.iterator().next().name()); + Assertions.assertEquals("slyzrpzbchckqq", response.iterator().next().status()); + Assertions.assertEquals("ox", response.iterator().next().properties().get("ysuiizynkedya")); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListTests.java index 3f67e26f4e6f..2670e8dd0446 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusListTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { OperationStatusList model = BinaryData .fromString( - "{\"value\":[{\"id\":\"yp\",\"name\":\"bpizcdrqjsdpydn\",\"status\":\"yhxdeoejzicwi\",\"properties\":{\"cbkhajdeyeamdph\":\"ttgzfbis\",\"lpbuxwgipwhonowk\":\"g\"}},{\"id\":\"wankixzbi\",\"name\":\"eputtmrywnuzoqf\",\"status\":\"iyqzrnk\",\"properties\":{\"whzlsicohoq\":\"yx\",\"hgyxzkonoc\":\"nwvlryavwhheunmm\",\"uconuqszfkbey\":\"koklya\",\"senhwlrs\":\"ewrmjmwvvjektc\"}},{\"id\":\"zpwv\",\"name\":\"dqgbiqylihkaetc\",\"status\":\"tvfcivfsn\",\"properties\":{\"rjcxerfuwu\":\"uctqhjfbe\"}},{\"id\":\"xfvjrbirp\",\"name\":\"epcyvahfnlj\",\"status\":\"yq\",\"properties\":{\"gvcl\":\"uujqgidokgjljyo\",\"jhtxfvgxbfsmxne\":\"bgsncghkjeszzhb\"}}],\"nextLink\":\"vecxgodebfqkk\"}") + "{\"value\":[{\"id\":\"uhashsfwx\",\"name\":\"owzxcu\",\"status\":\"i\",\"properties\":{\"wfvovbv\":\"oxdjebwpuc\",\"jrwjueiotwm\":\"euecivyhzceuoj\",\"rjaw\":\"dytdxwitx\"}},{\"id\":\"gxhnisk\",\"name\":\"bkpyc\",\"status\":\"klwndnhjdauwhv\",\"properties\":{\"xujznbmpowu\":\"zbtd\",\"lupj\":\"przqlveu\"}},{\"id\":\"fxobbcsws\",\"name\":\"jriplrbpbewtghf\",\"status\":\"blcg\",\"properties\":{\"t\":\"vlvqhjkbegi\",\"aloayqcgwrtzju\":\"mxiebw\",\"txon\":\"gwyzm\",\"rknftguvriuhprwm\":\"mtsavjcbpwxqp\"}}],\"nextLink\":\"xqtayriwwro\"}") .toObject(OperationStatusList.class); } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusResultInnerTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusResultInnerTests.java index defd3d3cfaed..21e3d19c46bc 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusResultInnerTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationStatusResultInnerTests.java @@ -16,30 +16,31 @@ public void testDeserialize() throws Exception { OperationStatusResultInner model = BinaryData .fromString( - "{\"id\":\"amiheognarxz\",\"name\":\"heotusiv\",\"status\":\"evcciqihnhun\",\"properties\":{\"gxg\":\"jzrnf\",\"fublj\":\"spemvtzfk\",\"aeqjhqjbasvms\":\"fxqeof\",\"gsntnbybkzgcwr\":\"jqul\"}}") + "{\"id\":\"gfgibm\",\"name\":\"gakeqsr\",\"status\":\"yb\",\"properties\":{\"qytbciq\":\"e\",\"mmnkzsmodmgl\":\"ouf\",\"mutduqktaps\":\"ugpbkw\",\"rtumkdosvq\":\"wgcu\"}}") .toObject(OperationStatusResultInner.class); - Assertions.assertEquals("amiheognarxz", model.id()); - Assertions.assertEquals("heotusiv", model.name()); - Assertions.assertEquals("evcciqihnhun", model.status()); - Assertions.assertEquals("jzrnf", model.properties().get("gxg")); + Assertions.assertEquals("gfgibm", model.id()); + Assertions.assertEquals("gakeqsr", model.name()); + Assertions.assertEquals("yb", model.status()); + Assertions.assertEquals("e", model.properties().get("qytbciq")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { OperationStatusResultInner model = new OperationStatusResultInner() - .withId("amiheognarxz") - .withName("heotusiv") - .withStatus("evcciqihnhun") + .withId("gfgibm") + .withName("gakeqsr") + .withStatus("yb") .withProperties( - mapOf("gxg", "jzrnf", "fublj", "spemvtzfk", "aeqjhqjbasvms", "fxqeof", "gsntnbybkzgcwr", "jqul")); + mapOf("qytbciq", "e", "mmnkzsmodmgl", "ouf", "mutduqktaps", "ugpbkw", "rtumkdosvq", "wgcu")); model = BinaryData.fromObject(model).toObject(OperationStatusResultInner.class); - Assertions.assertEquals("amiheognarxz", model.id()); - Assertions.assertEquals("heotusiv", model.name()); - Assertions.assertEquals("evcciqihnhun", model.status()); - Assertions.assertEquals("jzrnf", model.properties().get("gxg")); + Assertions.assertEquals("gfgibm", model.id()); + Assertions.assertEquals("gakeqsr", model.name()); + Assertions.assertEquals("yb", model.status()); + Assertions.assertEquals("e", model.properties().get("qytbciq")); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationsListMockTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationsListMockTests.java index e7316270536c..4556b272aa84 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationsListMockTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/OperationsListMockTests.java @@ -32,7 +32,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"name\":\"yfxrx\",\"display\":{\"provider\":\"ptramxj\",\"resource\":\"wlwnwxuqlcv\",\"operation\":\"ypatdooaojkniod\",\"description\":\"oebwnujhemms\"},\"isDataAction\":false,\"origin\":\"c\"}]}"; + "{\"value\":[{\"name\":\"cstwity\",\"display\":{\"provider\":\"vxccedcp\",\"resource\":\"dyodnwzxltj\",\"operation\":\"nhltiugcxn\",\"description\":\"vwxqibyqunyo\"},\"isDataAction\":false,\"origin\":\"mdjrkvfgbvfvp\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,10 +62,10 @@ public void testList() throws Exception { PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("yfxrx", response.iterator().next().name()); - Assertions.assertEquals("ptramxj", response.iterator().next().display().provider()); - Assertions.assertEquals("wlwnwxuqlcv", response.iterator().next().display().resource()); - Assertions.assertEquals("ypatdooaojkniod", response.iterator().next().display().operation()); - Assertions.assertEquals("oebwnujhemms", response.iterator().next().display().description()); + Assertions.assertEquals("cstwity", response.iterator().next().name()); + Assertions.assertEquals("vxccedcp", response.iterator().next().display().provider()); + Assertions.assertEquals("dyodnwzxltj", response.iterator().next().display().resource()); + Assertions.assertEquals("nhltiugcxn", response.iterator().next().display().operation()); + Assertions.assertEquals("vwxqibyqunyo", response.iterator().next().display().description()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PatchExtensionPropertiesTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PatchExtensionPropertiesTests.java index fa195e5d7000..f2e6f61ef292 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PatchExtensionPropertiesTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PatchExtensionPropertiesTests.java @@ -16,34 +16,36 @@ public void testDeserialize() throws Exception { PatchExtensionProperties model = BinaryData .fromString( - "{\"autoUpgradeMinorVersion\":true,\"releaseTrain\":\"rtfw\",\"version\":\"k\",\"configurationSettings\":{\"yejhk\":\"udccsnhsjc\",\"kkvnipjox\":\"yhtnapczwlokjye\",\"podmailzydehojwy\":\"jnchgej\"},\"configurationProtectedSettings\":{\"ixjsprozvcputeg\":\"xinpmqnjaq\",\"atscmd\":\"vwmf\",\"zkrwfn\":\"pjhulsuuvmkj\"}}") + "{\"autoUpgradeMinorVersion\":false,\"releaseTrain\":\"bkpodepooginuv\",\"version\":\"iheogna\",\"configurationSettings\":{\"o\":\"xth\",\"cciqihnhungbwjz\":\"usivye\",\"kufubljo\":\"nfygxgispemvtz\",\"v\":\"xqeofjaeqjhqjba\"},\"configurationProtectedSettings\":{\"gsntnbybkzgcwr\":\"jqul\",\"skcqvkocrcjd\":\"clxxwrljdo\",\"lssai\":\"wtnhxbnjbiksqr\"}}") .toObject(PatchExtensionProperties.class); - Assertions.assertEquals(true, model.autoUpgradeMinorVersion()); - Assertions.assertEquals("rtfw", model.releaseTrain()); - Assertions.assertEquals("k", model.version()); - Assertions.assertEquals("udccsnhsjc", model.configurationSettings().get("yejhk")); - Assertions.assertEquals("xinpmqnjaq", model.configurationProtectedSettings().get("ixjsprozvcputeg")); + Assertions.assertEquals(false, model.autoUpgradeMinorVersion()); + Assertions.assertEquals("bkpodepooginuv", model.releaseTrain()); + Assertions.assertEquals("iheogna", model.version()); + Assertions.assertEquals("xth", model.configurationSettings().get("o")); + Assertions.assertEquals("jqul", model.configurationProtectedSettings().get("gsntnbybkzgcwr")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PatchExtensionProperties model = new PatchExtensionProperties() - .withAutoUpgradeMinorVersion(true) - .withReleaseTrain("rtfw") - .withVersion("k") + .withAutoUpgradeMinorVersion(false) + .withReleaseTrain("bkpodepooginuv") + .withVersion("iheogna") .withConfigurationSettings( - mapOf("yejhk", "udccsnhsjc", "kkvnipjox", "yhtnapczwlokjye", "podmailzydehojwy", "jnchgej")) + mapOf( + "o", "xth", "cciqihnhungbwjz", "usivye", "kufubljo", "nfygxgispemvtz", "v", "xqeofjaeqjhqjba")) .withConfigurationProtectedSettings( - mapOf("ixjsprozvcputeg", "xinpmqnjaq", "atscmd", "vwmf", "zkrwfn", "pjhulsuuvmkj")); + mapOf("gsntnbybkzgcwr", "jqul", "skcqvkocrcjd", "clxxwrljdo", "lssai", "wtnhxbnjbiksqr")); model = BinaryData.fromObject(model).toObject(PatchExtensionProperties.class); - Assertions.assertEquals(true, model.autoUpgradeMinorVersion()); - Assertions.assertEquals("rtfw", model.releaseTrain()); - Assertions.assertEquals("k", model.version()); - Assertions.assertEquals("udccsnhsjc", model.configurationSettings().get("yejhk")); - Assertions.assertEquals("xinpmqnjaq", model.configurationProtectedSettings().get("ixjsprozvcputeg")); + Assertions.assertEquals(false, model.autoUpgradeMinorVersion()); + Assertions.assertEquals("bkpodepooginuv", model.releaseTrain()); + Assertions.assertEquals("iheogna", model.version()); + Assertions.assertEquals("xth", model.configurationSettings().get("o")); + Assertions.assertEquals("jqul", model.configurationProtectedSettings().get("gsntnbybkzgcwr")); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PatchExtensionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PatchExtensionTests.java index 8341b6503c2e..db0e99a77f70 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PatchExtensionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PatchExtensionTests.java @@ -16,13 +16,13 @@ public void testDeserialize() throws Exception { PatchExtension model = BinaryData .fromString( - "{\"properties\":{\"autoUpgradeMinorVersion\":true,\"releaseTrain\":\"ikxwc\",\"version\":\"yscnpqxu\",\"configurationSettings\":{\"n\":\"y\"},\"configurationProtectedSettings\":{\"vd\":\"ybrk\"}}}") + "{\"properties\":{\"autoUpgradeMinorVersion\":true,\"releaseTrain\":\"jhulsuuvmkjo\",\"version\":\"rwfndiod\",\"configurationSettings\":{\"ryo\":\"lwejdpv\",\"hbcryffdfdosyge\":\"psoacctazakljl\",\"rzevdphlxaol\":\"paojakhmsbzjh\"},\"configurationProtectedSettings\":{\"jbp\":\"trg\",\"jrwzox\":\"zfsinzgvf\",\"felluwfzitonpe\":\"j\",\"vhpfxxypininmay\":\"fpjkjlxofp\"}}}") .toObject(PatchExtension.class); Assertions.assertEquals(true, model.autoUpgradeMinorVersion()); - Assertions.assertEquals("ikxwc", model.releaseTrain()); - Assertions.assertEquals("yscnpqxu", model.version()); - Assertions.assertEquals("y", model.configurationSettings().get("n")); - Assertions.assertEquals("ybrk", model.configurationProtectedSettings().get("vd")); + Assertions.assertEquals("jhulsuuvmkjo", model.releaseTrain()); + Assertions.assertEquals("rwfndiod", model.version()); + Assertions.assertEquals("lwejdpv", model.configurationSettings().get("ryo")); + Assertions.assertEquals("trg", model.configurationProtectedSettings().get("jbp")); } @org.junit.jupiter.api.Test @@ -30,18 +30,21 @@ public void testSerialize() throws Exception { PatchExtension model = new PatchExtension() .withAutoUpgradeMinorVersion(true) - .withReleaseTrain("ikxwc") - .withVersion("yscnpqxu") - .withConfigurationSettings(mapOf("n", "y")) - .withConfigurationProtectedSettings(mapOf("vd", "ybrk")); + .withReleaseTrain("jhulsuuvmkjo") + .withVersion("rwfndiod") + .withConfigurationSettings( + mapOf("ryo", "lwejdpv", "hbcryffdfdosyge", "psoacctazakljl", "rzevdphlxaol", "paojakhmsbzjh")) + .withConfigurationProtectedSettings( + mapOf("jbp", "trg", "jrwzox", "zfsinzgvf", "felluwfzitonpe", "j", "vhpfxxypininmay", "fpjkjlxofp")); model = BinaryData.fromObject(model).toObject(PatchExtension.class); Assertions.assertEquals(true, model.autoUpgradeMinorVersion()); - Assertions.assertEquals("ikxwc", model.releaseTrain()); - Assertions.assertEquals("yscnpqxu", model.version()); - Assertions.assertEquals("y", model.configurationSettings().get("n")); - Assertions.assertEquals("ybrk", model.configurationProtectedSettings().get("vd")); + Assertions.assertEquals("jhulsuuvmkjo", model.releaseTrain()); + Assertions.assertEquals("rwfndiod", model.version()); + Assertions.assertEquals("lwejdpv", model.configurationSettings().get("ryo")); + Assertions.assertEquals("trg", model.configurationProtectedSettings().get("jbp")); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PostBuildDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PostBuildDefinitionTests.java new file mode 100644 index 000000000000..3746ba51e23d --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/PostBuildDefinitionTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.kubernetesconfiguration.models.PostBuildDefinition; +import com.azure.resourcemanager.kubernetesconfiguration.models.SubstituteFromDefinition; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PostBuildDefinitionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PostBuildDefinition model = + BinaryData + .fromString( + "{\"substitute\":{\"cuiywgqyw\":\"yktz\",\"phrcgyncoc\":\"ndrvynhzg\",\"oo\":\"ecfvmm\"},\"substituteFrom\":[{\"kind\":\"zevgb\",\"name\":\"jqabcypmivkwlzuv\",\"optional\":false},{\"kind\":\"nfnbacfionlebxe\",\"name\":\"gtzxdpn\",\"optional\":false},{\"kind\":\"wxrjfeallnwsub\",\"name\":\"njampm\",\"optional\":false},{\"kind\":\"scxaq\",\"name\":\"ochcbonqvpkvl\",\"optional\":true}]}") + .toObject(PostBuildDefinition.class); + Assertions.assertEquals("yktz", model.substitute().get("cuiywgqyw")); + Assertions.assertEquals("zevgb", model.substituteFrom().get(0).kind()); + Assertions.assertEquals("jqabcypmivkwlzuv", model.substituteFrom().get(0).name()); + Assertions.assertEquals(false, model.substituteFrom().get(0).optional()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PostBuildDefinition model = + new PostBuildDefinition() + .withSubstitute(mapOf("cuiywgqyw", "yktz", "phrcgyncoc", "ndrvynhzg", "oo", "ecfvmm")) + .withSubstituteFrom( + Arrays + .asList( + new SubstituteFromDefinition() + .withKind("zevgb") + .withName("jqabcypmivkwlzuv") + .withOptional(false), + new SubstituteFromDefinition() + .withKind("nfnbacfionlebxe") + .withName("gtzxdpn") + .withOptional(false), + new SubstituteFromDefinition() + .withKind("wxrjfeallnwsub") + .withName("njampm") + .withOptional(false), + new SubstituteFromDefinition() + .withKind("scxaq") + .withName("ochcbonqvpkvl") + .withOptional(true))); + model = BinaryData.fromObject(model).toObject(PostBuildDefinition.class); + Assertions.assertEquals("yktz", model.substitute().get("cuiywgqyw")); + Assertions.assertEquals("zevgb", model.substituteFrom().get(0).kind()); + Assertions.assertEquals("jqabcypmivkwlzuv", model.substituteFrom().get(0).name()); + Assertions.assertEquals(false, model.substituteFrom().get(0).optional()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/RepositoryRefDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/RepositoryRefDefinitionTests.java index fd3b558c96f5..a2bddd14c537 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/RepositoryRefDefinitionTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/RepositoryRefDefinitionTests.java @@ -14,26 +14,26 @@ public void testDeserialize() throws Exception { RepositoryRefDefinition model = BinaryData .fromString( - "{\"branch\":\"ysszdnrujqguh\",\"tag\":\"ouqfprwz\",\"semver\":\"nguitnwuizgazxu\",\"commit\":\"zuckyfi\"}") + "{\"branch\":\"bnbdxkqpxokajion\",\"tag\":\"mexgstxgcp\",\"semver\":\"gmaajrm\",\"commit\":\"jwzrl\"}") .toObject(RepositoryRefDefinition.class); - Assertions.assertEquals("ysszdnrujqguh", model.branch()); - Assertions.assertEquals("ouqfprwz", model.tag()); - Assertions.assertEquals("nguitnwuizgazxu", model.semver()); - Assertions.assertEquals("zuckyfi", model.commit()); + Assertions.assertEquals("bnbdxkqpxokajion", model.branch()); + Assertions.assertEquals("mexgstxgcp", model.tag()); + Assertions.assertEquals("gmaajrm", model.semver()); + Assertions.assertEquals("jwzrl", model.commit()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { RepositoryRefDefinition model = new RepositoryRefDefinition() - .withBranch("ysszdnrujqguh") - .withTag("ouqfprwz") - .withSemver("nguitnwuizgazxu") - .withCommit("zuckyfi"); + .withBranch("bnbdxkqpxokajion") + .withTag("mexgstxgcp") + .withSemver("gmaajrm") + .withCommit("jwzrl"); model = BinaryData.fromObject(model).toObject(RepositoryRefDefinition.class); - Assertions.assertEquals("ysszdnrujqguh", model.branch()); - Assertions.assertEquals("ouqfprwz", model.tag()); - Assertions.assertEquals("nguitnwuizgazxu", model.semver()); - Assertions.assertEquals("zuckyfi", model.commit()); + Assertions.assertEquals("bnbdxkqpxokajion", model.branch()); + Assertions.assertEquals("mexgstxgcp", model.tag()); + Assertions.assertEquals("gmaajrm", model.semver()); + Assertions.assertEquals("jwzrl", model.commit()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationDisplayTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationDisplayTests.java index d60a5aad8e61..d0e3a55c91c7 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationDisplayTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationDisplayTests.java @@ -14,26 +14,26 @@ public void testDeserialize() throws Exception { ResourceProviderOperationDisplay model = BinaryData .fromString( - "{\"provider\":\"eyueaxibxujwb\",\"resource\":\"walm\",\"operation\":\"yoxa\",\"description\":\"dkzjancuxrh\"}") + "{\"provider\":\"gylgqgitxmedjvcs\",\"resource\":\"n\",\"operation\":\"wncwzzhxgktrmg\",\"description\":\"napkteoellw\"}") .toObject(ResourceProviderOperationDisplay.class); - Assertions.assertEquals("eyueaxibxujwb", model.provider()); - Assertions.assertEquals("walm", model.resource()); - Assertions.assertEquals("yoxa", model.operation()); - Assertions.assertEquals("dkzjancuxrh", model.description()); + Assertions.assertEquals("gylgqgitxmedjvcs", model.provider()); + Assertions.assertEquals("n", model.resource()); + Assertions.assertEquals("wncwzzhxgktrmg", model.operation()); + Assertions.assertEquals("napkteoellw", model.description()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ResourceProviderOperationDisplay model = new ResourceProviderOperationDisplay() - .withProvider("eyueaxibxujwb") - .withResource("walm") - .withOperation("yoxa") - .withDescription("dkzjancuxrh"); + .withProvider("gylgqgitxmedjvcs") + .withResource("n") + .withOperation("wncwzzhxgktrmg") + .withDescription("napkteoellw"); model = BinaryData.fromObject(model).toObject(ResourceProviderOperationDisplay.class); - Assertions.assertEquals("eyueaxibxujwb", model.provider()); - Assertions.assertEquals("walm", model.resource()); - Assertions.assertEquals("yoxa", model.operation()); - Assertions.assertEquals("dkzjancuxrh", model.description()); + Assertions.assertEquals("gylgqgitxmedjvcs", model.provider()); + Assertions.assertEquals("n", model.resource()); + Assertions.assertEquals("wncwzzhxgktrmg", model.operation()); + Assertions.assertEquals("napkteoellw", model.description()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationInnerTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationInnerTests.java index 2a9309374724..bba3eb71db32 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationInnerTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationInnerTests.java @@ -15,31 +15,31 @@ public void testDeserialize() throws Exception { ResourceProviderOperationInner model = BinaryData .fromString( - "{\"name\":\"idybyxczf\",\"display\":{\"provider\":\"aaxdbabphlwrq\",\"resource\":\"ktsthsucocmny\",\"operation\":\"zt\",\"description\":\"twwrqp\"},\"isDataAction\":true,\"origin\":\"kzywbiex\"}") + "{\"name\":\"xyawj\",\"display\":{\"provider\":\"qcslyjpkiid\",\"resource\":\"exznelixhnr\",\"operation\":\"folhbnxknal\",\"description\":\"lp\"},\"isDataAction\":true,\"origin\":\"tpnapnyiropuhpig\"}") .toObject(ResourceProviderOperationInner.class); - Assertions.assertEquals("idybyxczf", model.name()); - Assertions.assertEquals("aaxdbabphlwrq", model.display().provider()); - Assertions.assertEquals("ktsthsucocmny", model.display().resource()); - Assertions.assertEquals("zt", model.display().operation()); - Assertions.assertEquals("twwrqp", model.display().description()); + Assertions.assertEquals("xyawj", model.name()); + Assertions.assertEquals("qcslyjpkiid", model.display().provider()); + Assertions.assertEquals("exznelixhnr", model.display().resource()); + Assertions.assertEquals("folhbnxknal", model.display().operation()); + Assertions.assertEquals("lp", model.display().description()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ResourceProviderOperationInner model = new ResourceProviderOperationInner() - .withName("idybyxczf") + .withName("xyawj") .withDisplay( new ResourceProviderOperationDisplay() - .withProvider("aaxdbabphlwrq") - .withResource("ktsthsucocmny") - .withOperation("zt") - .withDescription("twwrqp")); + .withProvider("qcslyjpkiid") + .withResource("exznelixhnr") + .withOperation("folhbnxknal") + .withDescription("lp")); model = BinaryData.fromObject(model).toObject(ResourceProviderOperationInner.class); - Assertions.assertEquals("idybyxczf", model.name()); - Assertions.assertEquals("aaxdbabphlwrq", model.display().provider()); - Assertions.assertEquals("ktsthsucocmny", model.display().resource()); - Assertions.assertEquals("zt", model.display().operation()); - Assertions.assertEquals("twwrqp", model.display().description()); + Assertions.assertEquals("xyawj", model.name()); + Assertions.assertEquals("qcslyjpkiid", model.display().provider()); + Assertions.assertEquals("exznelixhnr", model.display().resource()); + Assertions.assertEquals("folhbnxknal", model.display().operation()); + Assertions.assertEquals("lp", model.display().description()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationListTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationListTests.java index 16e147052bf6..7a63b526cd50 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationListTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ResourceProviderOperationListTests.java @@ -17,13 +17,13 @@ public void testDeserialize() throws Exception { ResourceProviderOperationList model = BinaryData .fromString( - "{\"value\":[{\"name\":\"ukgri\",\"display\":{\"provider\":\"zlfbxzpuzycispnq\",\"resource\":\"hmgkbrpyy\",\"operation\":\"ibnuqqkpik\",\"description\":\"rgvtqag\"},\"isDataAction\":false,\"origin\":\"nhijggmebfsi\"},{\"name\":\"butr\",\"display\":{\"provider\":\"na\",\"resource\":\"mhjrunmpxttdbhr\",\"operation\":\"l\",\"description\":\"kx\"},\"isDataAction\":true,\"origin\":\"pbh\"}],\"nextLink\":\"btkcxywnytnrsyn\"}") + "{\"value\":[{\"name\":\"xrmcqibycnojvk\",\"display\":{\"provider\":\"fqsgzvahapjy\",\"resource\":\"pvgqzcjrvxdjzlm\",\"operation\":\"xkvugfhzov\",\"description\":\"jvzunluthnnp\"},\"isDataAction\":true,\"origin\":\"peilpjzuaejxdu\"},{\"name\":\"skzbb\",\"display\":{\"provider\":\"umveekgpwozuhkf\",\"resource\":\"sjyofdx\",\"operation\":\"us\",\"description\":\"touwaboekqv\"},\"isDataAction\":false,\"origin\":\"smv\"}],\"nextLink\":\"wyjsflhhcaalnjix\"}") .toObject(ResourceProviderOperationList.class); - Assertions.assertEquals("ukgri", model.value().get(0).name()); - Assertions.assertEquals("zlfbxzpuzycispnq", model.value().get(0).display().provider()); - Assertions.assertEquals("hmgkbrpyy", model.value().get(0).display().resource()); - Assertions.assertEquals("ibnuqqkpik", model.value().get(0).display().operation()); - Assertions.assertEquals("rgvtqag", model.value().get(0).display().description()); + Assertions.assertEquals("xrmcqibycnojvk", model.value().get(0).name()); + Assertions.assertEquals("fqsgzvahapjy", model.value().get(0).display().provider()); + Assertions.assertEquals("pvgqzcjrvxdjzlm", model.value().get(0).display().resource()); + Assertions.assertEquals("xkvugfhzov", model.value().get(0).display().operation()); + Assertions.assertEquals("jvzunluthnnp", model.value().get(0).display().description()); } @org.junit.jupiter.api.Test @@ -34,26 +34,26 @@ public void testSerialize() throws Exception { Arrays .asList( new ResourceProviderOperationInner() - .withName("ukgri") + .withName("xrmcqibycnojvk") .withDisplay( new ResourceProviderOperationDisplay() - .withProvider("zlfbxzpuzycispnq") - .withResource("hmgkbrpyy") - .withOperation("ibnuqqkpik") - .withDescription("rgvtqag")), + .withProvider("fqsgzvahapjy") + .withResource("pvgqzcjrvxdjzlm") + .withOperation("xkvugfhzov") + .withDescription("jvzunluthnnp")), new ResourceProviderOperationInner() - .withName("butr") + .withName("skzbb") .withDisplay( new ResourceProviderOperationDisplay() - .withProvider("na") - .withResource("mhjrunmpxttdbhr") - .withOperation("l") - .withDescription("kx")))); + .withProvider("umveekgpwozuhkf") + .withResource("sjyofdx") + .withOperation("us") + .withDescription("touwaboekqv")))); model = BinaryData.fromObject(model).toObject(ResourceProviderOperationList.class); - Assertions.assertEquals("ukgri", model.value().get(0).name()); - Assertions.assertEquals("zlfbxzpuzycispnq", model.value().get(0).display().provider()); - Assertions.assertEquals("hmgkbrpyy", model.value().get(0).display().resource()); - Assertions.assertEquals("ibnuqqkpik", model.value().get(0).display().operation()); - Assertions.assertEquals("rgvtqag", model.value().get(0).display().description()); + Assertions.assertEquals("xrmcqibycnojvk", model.value().get(0).name()); + Assertions.assertEquals("fqsgzvahapjy", model.value().get(0).display().provider()); + Assertions.assertEquals("pvgqzcjrvxdjzlm", model.value().get(0).display().resource()); + Assertions.assertEquals("xkvugfhzov", model.value().get(0).display().operation()); + Assertions.assertEquals("jvzunluthnnp", model.value().get(0).display().description()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeClusterTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeClusterTests.java index f9e00e79620b..f2115b1747bf 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeClusterTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeClusterTests.java @@ -11,14 +11,14 @@ public final class ScopeClusterTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ScopeCluster model = BinaryData.fromString("{\"releaseNamespace\":\"smy\"}").toObject(ScopeCluster.class); - Assertions.assertEquals("smy", model.releaseNamespace()); + ScopeCluster model = BinaryData.fromString("{\"releaseNamespace\":\"rkxvdum\"}").toObject(ScopeCluster.class); + Assertions.assertEquals("rkxvdum", model.releaseNamespace()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ScopeCluster model = new ScopeCluster().withReleaseNamespace("smy"); + ScopeCluster model = new ScopeCluster().withReleaseNamespace("rkxvdum"); model = BinaryData.fromObject(model).toObject(ScopeCluster.class); - Assertions.assertEquals("smy", model.releaseNamespace()); + Assertions.assertEquals("rkxvdum", model.releaseNamespace()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeNamespaceTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeNamespaceTests.java index 8d0ba7c8bd29..6359c17dc9d4 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeNamespaceTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeNamespaceTests.java @@ -11,15 +11,14 @@ public final class ScopeNamespaceTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ScopeNamespace model = - BinaryData.fromString("{\"targetNamespace\":\"kdtmlxhekuk\"}").toObject(ScopeNamespace.class); - Assertions.assertEquals("kdtmlxhekuk", model.targetNamespace()); + ScopeNamespace model = BinaryData.fromString("{\"targetNamespace\":\"rtfw\"}").toObject(ScopeNamespace.class); + Assertions.assertEquals("rtfw", model.targetNamespace()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ScopeNamespace model = new ScopeNamespace().withTargetNamespace("kdtmlxhekuk"); + ScopeNamespace model = new ScopeNamespace().withTargetNamespace("rtfw"); model = BinaryData.fromObject(model).toObject(ScopeNamespace.class); - Assertions.assertEquals("kdtmlxhekuk", model.targetNamespace()); + Assertions.assertEquals("rtfw", model.targetNamespace()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeTests.java index 1fa0ff80c917..07fc68271e09 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/ScopeTests.java @@ -15,21 +15,20 @@ public final class ScopeTests { public void testDeserialize() throws Exception { Scope model = BinaryData - .fromString( - "{\"cluster\":{\"releaseNamespace\":\"upewnwreitjzy\"},\"namespace\":{\"targetNamespace\":\"sarhmofc\"}}") + .fromString("{\"cluster\":{\"releaseNamespace\":\"vyq\"},\"namespace\":{\"targetNamespace\":\"b\"}}") .toObject(Scope.class); - Assertions.assertEquals("upewnwreitjzy", model.cluster().releaseNamespace()); - Assertions.assertEquals("sarhmofc", model.namespace().targetNamespace()); + Assertions.assertEquals("vyq", model.cluster().releaseNamespace()); + Assertions.assertEquals("b", model.namespace().targetNamespace()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { Scope model = new Scope() - .withCluster(new ScopeCluster().withReleaseNamespace("upewnwreitjzy")) - .withNamespace(new ScopeNamespace().withTargetNamespace("sarhmofc")); + .withCluster(new ScopeCluster().withReleaseNamespace("vyq")) + .withNamespace(new ScopeNamespace().withTargetNamespace("b")); model = BinaryData.fromObject(model).toObject(Scope.class); - Assertions.assertEquals("upewnwreitjzy", model.cluster().releaseNamespace()); - Assertions.assertEquals("sarhmofc", model.namespace().targetNamespace()); + Assertions.assertEquals("vyq", model.cluster().releaseNamespace()); + Assertions.assertEquals("b", model.namespace().targetNamespace()); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsDeleteMockTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsDeleteMockTests.java index 74ce632eef8f..6c5d1309a5b9 100644 --- a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsDeleteMockTests.java +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SourceControlConfigurationsDeleteMockTests.java @@ -58,6 +58,12 @@ public void testDelete() throws Exception { manager .sourceControlConfigurations() - .delete("duhpk", "kgymareqnajxqug", "hky", "ubeddg", "sofwqmzqalkrmnji", com.azure.core.util.Context.NONE); + .delete( + "mhairsbrgzdwmsw", + "ypqwdxggiccc", + "xqhuexm", + "ttlstvlzywemhz", + "ncsdtclusiyp", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SubstituteFromDefinitionTests.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SubstituteFromDefinitionTests.java new file mode 100644 index 000000000000..98af6aae5f86 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/test/java/com/azure/resourcemanager/kubernetesconfiguration/generated/SubstituteFromDefinitionTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.kubernetesconfiguration.models.SubstituteFromDefinition; +import org.junit.jupiter.api.Assertions; + +public final class SubstituteFromDefinitionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubstituteFromDefinition model = + BinaryData + .fromString("{\"kind\":\"ea\",\"name\":\"ipheoflokeyyien\",\"optional\":true}") + .toObject(SubstituteFromDefinition.class); + Assertions.assertEquals("ea", model.kind()); + Assertions.assertEquals("ipheoflokeyyien", model.name()); + Assertions.assertEquals(true, model.optional()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubstituteFromDefinition model = + new SubstituteFromDefinition().withKind("ea").withName("ipheoflokeyyien").withOptional(true); + model = BinaryData.fromObject(model).toObject(SubstituteFromDefinition.class); + Assertions.assertEquals("ea", model.kind()); + Assertions.assertEquals("ipheoflokeyyien", model.name()); + Assertions.assertEquals(true, model.optional()); + } +} diff --git a/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md b/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md index 238b51b6e937..c6877ff5843a 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md +++ b/sdk/loadtesting/azure-developer-loadtesting/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.0.6 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.0.5 (2023-08-18) ### Other Changes diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/CHANGELOG.md b/sdk/managedapplications/azure-resourcemanager-managedapplications/CHANGELOG.md index 096a45f1e532..1641bbd2af95 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/CHANGELOG.md +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.4 (Unreleased) ### Features Added @@ -10,6 +10,315 @@ ### Other Changes +## 1.0.0-beta.3 (2023-09-21) + +- Azure Resource Manager Application client library for Java. This package contains Microsoft Azure SDK for Application Management SDK. ARM applications. Package tag package-managedapplications-2021-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Breaking Changes + +* `models.ErrorResponse` was removed + +* `models.ErrorResponseException` was removed + +* `models.ApplicationProviderAuthorization` was removed + +#### `models.Applications` was modified + +* `updateByIdWithResponse(java.lang.String,fluent.models.ApplicationInner,com.azure.core.util.Context)` was removed +* `models.Application updateById(java.lang.String)` -> `models.ApplicationPatchable updateById(java.lang.String)` + +#### `models.OperationListResult` was modified + +* `withNextLink(java.lang.String)` was removed +* `withValue(java.util.List)` was removed + +#### `models.ApplicationArtifact` was modified + +* `withName(java.lang.String)` was removed +* `java.lang.String name()` -> `models.ApplicationArtifactName name()` + +#### `models.ApplicationDefinitions` was modified + +* `deleteById(java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `createOrUpdateById(java.lang.String,java.lang.String,fluent.models.ApplicationDefinitionInner,com.azure.core.util.Context)` was removed +* `delete(java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed + +#### `models.ApplicationDefinition$Definition` was modified + +* `withIsEnabled(java.lang.String)` was removed +* `withIdentity(models.Identity)` was removed + +#### `models.ApplicationDefinition` was modified + +* `java.lang.String isEnabled()` -> `java.lang.Boolean isEnabled()` +* `identity()` was removed + +#### `models.ApplicationPatchable` was modified + +* `withSku(models.Sku)` was removed +* `validate()` was removed +* `java.lang.String applicationDefinitionId()` -> `java.lang.String applicationDefinitionId()` +* `models.PlanPatchable plan()` -> `models.PlanPatchable plan()` +* `java.lang.Object parameters()` -> `java.lang.Object parameters()` +* `withApplicationDefinitionId(java.lang.String)` was removed +* `withTags(java.util.Map)` was removed +* `withKind(java.lang.String)` was removed +* `java.lang.Object outputs()` -> `java.lang.Object outputs()` +* `withIdentity(models.Identity)` was removed +* `withLocation(java.lang.String)` was removed +* `models.ProvisioningState provisioningState()` -> `models.ProvisioningState provisioningState()` +* `withManagedResourceGroupId(java.lang.String)` was removed +* `withPlan(models.PlanPatchable)` was removed +* `withManagedBy(java.lang.String)` was removed +* `java.lang.String managedResourceGroupId()` -> `java.lang.String managedResourceGroupId()` +* `java.lang.String kind()` -> `java.lang.String kind()` +* `withParameters(java.lang.Object)` was removed + +#### `models.ApplicationDefinition$Update` was modified + +* `withAuthorizations(java.util.List)` was removed +* `withDisplayName(java.lang.String)` was removed +* `withSku(models.Sku)` was removed +* `withPackageFileUri(java.lang.String)` was removed +* `withMainTemplate(java.lang.Object)` was removed +* `withLockLevel(models.ApplicationLockLevel)` was removed +* `withIsEnabled(java.lang.String)` was removed +* `withManagedBy(java.lang.String)` was removed +* `withArtifacts(java.util.List)` was removed +* `withIdentity(models.Identity)` was removed +* `withCreateUiDefinition(java.lang.Object)` was removed +* `withDescription(java.lang.String)` was removed + +#### `models.Application$Update` was modified + +* `withPlan(models.PlanPatchable)` was removed + +#### `models.GenericResource` was modified + +* `withIdentity(models.Identity)` was removed +* `identity()` was removed + +#### `models.OperationDisplay` was modified + +* `withOperation(java.lang.String)` was removed +* `withResource(java.lang.String)` was removed +* `withProvider(java.lang.String)` was removed + +### Features Added + +* `models.JitApproverDefinition` was added + +* `models.Substatus` was added + +* `models.JitSchedulingPolicy` was added + +* `models.ApplicationDeploymentPolicy` was added + +* `models.JitRequestPatchable` was added + +* `models.ApplicationBillingDetailsDefinition` was added + +* `models.Origin` was added + +* `models.ApplicationClientDetails` was added + +* `models.ApplicationAuthorization` was added + +* `models.JitApprovalMode` was added + +* `models.Status` was added + +* `models.JitSchedulingType` was added + +* `models.ApplicationNotificationPolicy` was added + +* `models.ApplicationPolicy` was added + +* `models.JitRequestState` was added + +* `models.ApplicationDefinitionPatchable` was added + +* `models.UpdateAccessDefinition` was added + +* `models.ApplicationNotificationEndpoint` was added + +* `models.JitRequestDefinitionListResult` was added + +* `models.JitApproverType` was added + +* `models.ApplicationArtifactName` was added + +* `models.ApplicationManagementPolicy` was added + +* `models.ActionType` was added + +* `models.ApplicationPackageLockingPolicyDefinition` was added + +* `models.JitRequestDefinition$Definition` was added + +* `models.DeploymentMode` was added + +* `models.UserAssignedResourceIdentity` was added + +* `models.JitRequestDefinition$DefinitionStages` was added + +* `models.ApplicationManagementMode` was added + +* `models.ManagedIdentityTokenResult` was added + +* `models.ListTokenRequest` was added + +* `models.ApplicationPackageContact` was added + +* `models.JitAuthorizationPolicies` was added + +* `models.ApplicationPackageSupportUrls` was added + +* `models.ApplicationDefinitionArtifact` was added + +* `models.JitRequestDefinition$Update` was added + +* `models.ApplicationDefinitionArtifactName` was added + +* `models.ApplicationJitAccessPolicy` was added + +* `models.JitRequestDefinition$UpdateStages` was added + +* `models.JitRequestDefinition` was added + +* `models.JitRequestMetadata` was added + +* `models.JitRequests` was added + +* `models.ManagedIdentityToken` was added + +* `models.AllowedUpgradePlansResult` was added + +#### `models.Applications` was modified + +* `refreshPermissions(java.lang.String,java.lang.String)` was added +* `updateAccess(java.lang.String,java.lang.String,fluent.models.UpdateAccessDefinitionInner,com.azure.core.util.Context)` was added +* `refreshPermissions(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `updateAccess(java.lang.String,java.lang.String,fluent.models.UpdateAccessDefinitionInner)` was added +* `updateById(java.lang.String,fluent.models.ApplicationPatchableInner,com.azure.core.util.Context)` was added +* `listAllowedUpgradePlansWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `listTokensWithResponse(java.lang.String,java.lang.String,models.ListTokenRequest,com.azure.core.util.Context)` was added +* `listTokens(java.lang.String,java.lang.String,models.ListTokenRequest)` was added +* `update(java.lang.String,java.lang.String)` was added +* `listAllowedUpgradePlans(java.lang.String,java.lang.String)` was added +* `update(java.lang.String,java.lang.String,fluent.models.ApplicationPatchableInner,com.azure.core.util.Context)` was added + +#### `models.Identity` was modified + +* `withUserAssignedIdentities(java.util.Map)` was added +* `userAssignedIdentities()` was added + +#### `models.Application$Definition` was modified + +* `withJitAccessPolicy(models.ApplicationJitAccessPolicy)` was added + +#### `models.Application` was modified + +* `supportUrls()` was added +* `listTokens(models.ListTokenRequest)` was added +* `updateAccess(fluent.models.UpdateAccessDefinitionInner,com.azure.core.util.Context)` was added +* `listAllowedUpgradePlansWithResponse(com.azure.core.util.Context)` was added +* `managementMode()` was added +* `artifacts()` was added +* `customerSupport()` was added +* `createdBy()` was added +* `refreshPermissions(com.azure.core.util.Context)` was added +* `authorizations()` was added +* `billingDetails()` was added +* `listTokensWithResponse(models.ListTokenRequest,com.azure.core.util.Context)` was added +* `jitAccessPolicy()` was added +* `publisherTenantId()` was added +* `systemData()` was added +* `updateAccess(fluent.models.UpdateAccessDefinitionInner)` was added +* `updatedBy()` was added +* `refreshPermissions()` was added +* `listAllowedUpgradePlans()` was added + +#### `models.ApplicationArtifact` was modified + +* `withName(models.ApplicationArtifactName)` was added + +#### `models.ApplicationDefinitions` was modified + +* `updateById(java.lang.String,java.lang.String,models.ApplicationDefinitionPatchable)` was added +* `createOrUpdateByIdWithResponse(java.lang.String,java.lang.String,fluent.models.ApplicationDefinitionInner,com.azure.core.util.Context)` was added +* `deleteByResourceGroupWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `list()` was added +* `deleteByIdWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `list(com.azure.core.util.Context)` was added +* `updateByIdWithResponse(java.lang.String,java.lang.String,models.ApplicationDefinitionPatchable,com.azure.core.util.Context)` was added + +#### `models.Operation` was modified + +* `isDataAction()` was added +* `origin()` was added +* `actionType()` was added + +#### `models.ApplicationDefinition$Definition` was modified + +* `withLockingPolicy(models.ApplicationPackageLockingPolicyDefinition)` was added +* `withPolicies(java.util.List)` was added +* `withNotificationPolicy(models.ApplicationNotificationPolicy)` was added +* `withIsEnabled(java.lang.Boolean)` was added +* `withStorageAccountId(java.lang.String)` was added +* `withDeploymentPolicy(models.ApplicationDeploymentPolicy)` was added +* `withManagementPolicy(models.ApplicationManagementPolicy)` was added + +#### `models.ApplicationDefinition` was modified + +* `deploymentPolicy()` was added +* `storageAccountId()` was added +* `systemData()` was added +* `notificationPolicy()` was added +* `policies()` was added +* `managementPolicy()` was added +* `lockingPolicy()` was added + +#### `ApplicationManager` was modified + +* `jitRequests()` was added + +#### `models.ApplicationPatchable` was modified + +* `updatedBy()` was added +* `publisherTenantId()` was added +* `identity()` was added +* `authorizations()` was added +* `id()` was added +* `systemData()` was added +* `sku()` was added +* `managementMode()` was added +* `location()` was added +* `billingDetails()` was added +* `tags()` was added +* `jitAccessPolicy()` was added +* `customerSupport()` was added +* `name()` was added +* `supportUrls()` was added +* `createdBy()` was added +* `managedBy()` was added +* `type()` was added +* `artifacts()` was added +* `innerModel()` was added + +#### `models.Application$Update` was modified + +* `withJitAccessPolicy(models.ApplicationJitAccessPolicy)` was added +* `withPlan(models.Plan)` was added + +#### `models.GenericResource` was modified + +* `systemData()` was added + +#### `models.OperationDisplay` was modified + +* `description()` was added + ## 1.0.0-beta.2 (2023-01-18) - Azure Resource Manager Application client library for Java. This package contains Microsoft Azure SDK for Application Management SDK. ARM applications. Package tag package-managedapplications-2018-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/README.md b/sdk/managedapplications/azure-resourcemanager-managedapplications/README.md index 84c441f11ab7..70959b098c52 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/README.md +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/README.md @@ -2,7 +2,7 @@ Azure Resource Manager Application client library for Java. -This package contains Microsoft Azure SDK for Application Management SDK. ARM applications. Package tag package-managedapplications-2018-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Application Management SDK. ARM applications. Package tag package-managedapplications-2021-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-managedapplications - 1.0.0-beta.2 + 1.0.0-beta.3 ``` [//]: # ({x-version-update-end}) @@ -103,3 +103,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fmanagedapplications%2Fazure-resourcemanager-managedapplications%2FREADME.png) diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/SAMPLE.md b/sdk/managedapplications/azure-resourcemanager-managedapplications/SAMPLE.md index 405b217a39b5..d06059c227ba 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/SAMPLE.md +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/SAMPLE.md @@ -9,7 +9,10 @@ - [DeleteById](#applicationdefinitions_deletebyid) - [GetById](#applicationdefinitions_getbyid) - [GetByResourceGroup](#applicationdefinitions_getbyresourcegroup) +- [List](#applicationdefinitions_list) - [ListByResourceGroup](#applicationdefinitions_listbyresourcegroup) +- [Update](#applicationdefinitions_update) +- [UpdateById](#applicationdefinitions_updatebyid) ## Applications @@ -20,24 +23,37 @@ - [GetById](#applications_getbyid) - [GetByResourceGroup](#applications_getbyresourcegroup) - [List](#applications_list) +- [ListAllowedUpgradePlans](#applications_listallowedupgradeplans) - [ListByResourceGroup](#applications_listbyresourcegroup) +- [ListTokens](#applications_listtokens) +- [RefreshPermissions](#applications_refreshpermissions) - [Update](#applications_update) +- [UpdateAccess](#applications_updateaccess) - [UpdateById](#applications_updatebyid) +## JitRequests + +- [CreateOrUpdate](#jitrequests_createorupdate) +- [Delete](#jitrequests_delete) +- [GetByResourceGroup](#jitrequests_getbyresourcegroup) +- [ListByResourceGroup](#jitrequests_listbyresourcegroup) +- [ListBySubscription](#jitrequests_listbysubscription) +- [Update](#jitrequests_update) + ## ResourceProvider - [ListOperations](#resourceprovider_listoperations) ### ApplicationDefinitions_CreateOrUpdate ```java +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; import java.util.Arrays; /** Samples for ApplicationDefinitions CreateOrUpdate. */ public final class ApplicationDefinitionsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/createOrUpdateApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplicationDefinition.json */ /** * Sample code: Create or update managed application definition. @@ -49,16 +65,16 @@ public final class ApplicationDefinitionsCreateOrUpdateSamples { manager .applicationDefinitions() .define("myManagedApplicationDef") - .withRegion("East US 2") + .withRegion((String) null) .withExistingResourceGroup("rg") .withLockLevel(ApplicationLockLevel.NONE) + .withDisplayName("myManagedApplicationDef") .withAuthorizations( Arrays .asList( - new ApplicationProviderAuthorization() + new ApplicationAuthorization() .withPrincipalId("validprincipalguid") .withRoleDefinitionId("validroleguid"))) - .withDisplayName("myManagedApplicationDef") .withDescription("myManagedApplicationDef description") .withPackageFileUri("https://path/to/packagezipfile") .create(); @@ -70,14 +86,14 @@ public final class ApplicationDefinitionsCreateOrUpdateSamples { ```java import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; import java.util.Arrays; /** Samples for ApplicationDefinitions CreateOrUpdateById. */ public final class ApplicationDefinitionsCreateOrUpdateByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/createOrUpdateApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplicationDefinition.json */ /** * Sample code: Create or update managed application definition. @@ -88,17 +104,16 @@ public final class ApplicationDefinitionsCreateOrUpdateByIdSamples { com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager .applicationDefinitions() - .createOrUpdateById( + .createOrUpdateByIdWithResponse( "rg", "myManagedApplicationDef", new ApplicationDefinitionInner() - .withLocation("East US 2") .withLockLevel(ApplicationLockLevel.NONE) .withDisplayName("myManagedApplicationDef") .withAuthorizations( Arrays .asList( - new ApplicationProviderAuthorization() + new ApplicationAuthorization() .withPrincipalId("validprincipalguid") .withRoleDefinitionId("validroleguid"))) .withDescription("myManagedApplicationDef description") @@ -114,16 +129,18 @@ public final class ApplicationDefinitionsCreateOrUpdateByIdSamples { /** Samples for ApplicationDefinitions Delete. */ public final class ApplicationDefinitionsDeleteSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/deleteApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplicationDefinition.json */ /** - * Sample code: Deletes a managed application. + * Sample code: delete managed application definition. * * @param manager Entry point to ApplicationManager. */ - public static void deletesAManagedApplication( + public static void deleteManagedApplicationDefinition( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - manager.applicationDefinitions().delete("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE); + manager + .applicationDefinitions() + .deleteByResourceGroupWithResponse("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE); } } ``` @@ -134,16 +151,18 @@ public final class ApplicationDefinitionsDeleteSamples { /** Samples for ApplicationDefinitions DeleteById. */ public final class ApplicationDefinitionsDeleteByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/deleteApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplicationDefinition.json */ /** - * Sample code: Delete application definition. + * Sample code: Deletes managed application definition. * * @param manager Entry point to ApplicationManager. */ - public static void deleteApplicationDefinition( + public static void deletesManagedApplicationDefinition( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - manager.applicationDefinitions().deleteById("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE); + manager + .applicationDefinitions() + .deleteByIdWithResponse("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE); } } ``` @@ -154,7 +173,7 @@ public final class ApplicationDefinitionsDeleteByIdSamples { /** Samples for ApplicationDefinitions GetById. */ public final class ApplicationDefinitionsGetByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/getApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplicationDefinition.json */ /** * Sample code: Get managed application definition. @@ -176,7 +195,7 @@ public final class ApplicationDefinitionsGetByIdSamples { /** Samples for ApplicationDefinitions GetByResourceGroup. */ public final class ApplicationDefinitionsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/getApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplicationDefinition.json */ /** * Sample code: Get managed application definition. @@ -192,33 +211,136 @@ public final class ApplicationDefinitionsGetByResourceGroupSamples { } ``` +### ApplicationDefinitions_List + +```java +/** Samples for ApplicationDefinitions List. */ +public final class ApplicationDefinitionsListSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationDefinitionsBySubscription.json + */ + /** + * Sample code: Lists all the application definitions within a subscription. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listsAllTheApplicationDefinitionsWithinASubscription( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.applicationDefinitions().list(com.azure.core.util.Context.NONE); + } +} +``` + ### ApplicationDefinitions_ListByResourceGroup ```java /** Samples for ApplicationDefinitions ListByResourceGroup. */ public final class ApplicationDefinitionsListByResourceGroupSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/listApplicationDefinitionsByResourceGroup.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationDefinitionsByResourceGroup.json */ /** - * Sample code: List managed application definitions. + * Sample code: Lists the managed application definitions in a resource group. * * @param manager Entry point to ApplicationManager. */ - public static void listManagedApplicationDefinitions( + public static void listsTheManagedApplicationDefinitionsInAResourceGroup( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager.applicationDefinitions().listByResourceGroup("rg", com.azure.core.util.Context.NONE); } } ``` +### ApplicationDefinitions_Update + +```java +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinition; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ApplicationDefinitions Update. */ +public final class ApplicationDefinitionsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplicationDefinition.json + */ + /** + * Sample code: Update managed application definition. + * + * @param manager Entry point to ApplicationManager. + */ + public static void updateManagedApplicationDefinition( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + ApplicationDefinition resource = + manager + .applicationDefinitions() + .getByResourceGroupWithResponse("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("department", "Finance")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ApplicationDefinitions_UpdateById + +```java +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionPatchable; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ApplicationDefinitions UpdateById. */ +public final class ApplicationDefinitionsUpdateByIdSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplicationDefinition.json + */ + /** + * Sample code: Update managed application definition. + * + * @param manager Entry point to ApplicationManager. + */ + public static void updateManagedApplicationDefinition( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applicationDefinitions() + .updateByIdWithResponse( + "rg", + "myManagedApplicationDef", + new ApplicationDefinitionPatchable().withTags(mapOf("department", "Finance")), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + ### Applications_CreateOrUpdate ```java /** Samples for Applications CreateOrUpdate. */ public final class ApplicationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/createOrUpdateApplication.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplication.json */ /** * Sample code: Create or update managed application. @@ -230,10 +352,12 @@ public final class ApplicationsCreateOrUpdateSamples { manager .applications() .define("myManagedApplication") - .withRegion("East US 2") + .withRegion((String) null) .withExistingResourceGroup("rg") .withKind("ServiceCatalog") .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef") .create(); } } @@ -247,23 +371,24 @@ import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationIn /** Samples for Applications CreateOrUpdateById. */ public final class ApplicationsCreateOrUpdateByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/createOrUpdateApplicationById.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplicationById.json */ /** - * Sample code: Create or update application by id. + * Sample code: Creates or updates a managed application. * * @param manager Entry point to ApplicationManager. */ - public static void createOrUpdateApplicationById( + public static void createsOrUpdatesAManagedApplication( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager .applications() .createOrUpdateById( - "myApplicationId", + "subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication", new ApplicationInner() - .withLocation("East US 2") .withKind("ServiceCatalog") - .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG"), + .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef"), com.azure.core.util.Context.NONE); } } @@ -275,14 +400,14 @@ public final class ApplicationsCreateOrUpdateByIdSamples { /** Samples for Applications Delete. */ public final class ApplicationsDeleteSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/deleteApplication.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplication.json */ /** - * Sample code: Deletes a managed application. + * Sample code: Delete managed application. * * @param manager Entry point to ApplicationManager. */ - public static void deletesAManagedApplication( + public static void deleteManagedApplication( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager.applications().delete("rg", "myManagedApplication", com.azure.core.util.Context.NONE); } @@ -295,15 +420,20 @@ public final class ApplicationsDeleteSamples { /** Samples for Applications DeleteById. */ public final class ApplicationsDeleteByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/deleteApplicationById.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplicationById.json */ /** - * Sample code: Delete application by id. + * Sample code: Deletes the managed application. * * @param manager Entry point to ApplicationManager. */ - public static void deleteApplicationById(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - manager.applications().deleteById("myApplicationId", com.azure.core.util.Context.NONE); + public static void deletesTheManagedApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .deleteById( + "subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication", + com.azure.core.util.Context.NONE); } } ``` @@ -314,15 +444,20 @@ public final class ApplicationsDeleteByIdSamples { /** Samples for Applications GetById. */ public final class ApplicationsGetByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/getApplicationById.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplicationById.json */ /** - * Sample code: Get application by id. + * Sample code: Gets the managed application. * * @param manager Entry point to ApplicationManager. */ - public static void getApplicationById(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - manager.applications().getByIdWithResponse("myApplicationId", com.azure.core.util.Context.NONE); + public static void getsTheManagedApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .getByIdWithResponse( + "subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication", + com.azure.core.util.Context.NONE); } } ``` @@ -333,7 +468,7 @@ public final class ApplicationsGetByIdSamples { /** Samples for Applications GetByResourceGroup. */ public final class ApplicationsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/getApplication.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplication.json */ /** * Sample code: Get a managed application. @@ -355,68 +490,181 @@ public final class ApplicationsGetByResourceGroupSamples { /** Samples for Applications List. */ public final class ApplicationsListSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/listApplicationsBySubscription.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationsByResourceGroup.json */ /** - * Sample code: Lists applications by subscription. + * Sample code: Lists all the applications within a subscription. * * @param manager Entry point to ApplicationManager. */ - public static void listsApplicationsBySubscription( + public static void listsAllTheApplicationsWithinASubscription( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager.applications().list(com.azure.core.util.Context.NONE); } } ``` +### Applications_ListAllowedUpgradePlans + +```java +/** Samples for Applications ListAllowedUpgradePlans. */ +public final class ApplicationsListAllowedUpgradePlansSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listAllowedUpgradePlans.json + */ + /** + * Sample code: List allowed upgrade plans for application. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listAllowedUpgradePlansForApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .listAllowedUpgradePlansWithResponse("rg", "myManagedApplication", com.azure.core.util.Context.NONE); + } +} +``` + ### Applications_ListByResourceGroup ```java /** Samples for Applications ListByResourceGroup. */ public final class ApplicationsListByResourceGroupSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/listApplicationsByResourceGroup.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationsByResourceGroup.json */ /** - * Sample code: Lists applications. + * Sample code: Lists all the applications within a resource group. * * @param manager Entry point to ApplicationManager. */ - public static void listsApplications(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + public static void listsAllTheApplicationsWithinAResourceGroup( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager.applications().listByResourceGroup("rg", com.azure.core.util.Context.NONE); } } ``` +### Applications_ListTokens + +```java +import com.azure.resourcemanager.managedapplications.models.ListTokenRequest; +import java.util.Arrays; + +/** Samples for Applications ListTokens. */ +public final class ApplicationsListTokensSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listToken.json + */ + /** + * Sample code: List tokens for application. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listTokensForApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .listTokensWithResponse( + "rg", + "myManagedApplication", + new ListTokenRequest() + .withAuthorizationAudience("fakeTokenPlaceholder") + .withUserAssignedIdentities(Arrays.asList("IdentityOne", "IdentityTwo")), + com.azure.core.util.Context.NONE); + } +} +``` + +### Applications_RefreshPermissions + +```java +/** Samples for Applications RefreshPermissions. */ +public final class ApplicationsRefreshPermissionsSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/refreshApplicationPermissions.json + */ + /** + * Sample code: Refresh managed application permissions. + * + * @param manager Entry point to ApplicationManager. + */ + public static void refreshManagedApplicationPermissions( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.applications().refreshPermissions("rg", "myManagedApplication", com.azure.core.util.Context.NONE); + } +} +``` + ### Applications_Update ```java -import com.azure.resourcemanager.managedapplications.models.Application; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; /** Samples for Applications Update. */ public final class ApplicationsUpdateSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/updateApplication.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplication.json */ /** - * Sample code: Updates a managed application. + * Sample code: Updates managed application. * * @param manager Entry point to ApplicationManager. */ - public static void updatesAManagedApplication( + public static void updatesManagedApplication( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - Application resource = - manager - .applications() - .getByResourceGroupWithResponse("rg", "myManagedApplication", com.azure.core.util.Context.NONE) - .getValue(); - resource - .update() - .withKind("ServiceCatalog") - .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") - .withApplicationDefinitionId( - "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef") - .apply(); + manager + .applications() + .update( + "rg", + "myManagedApplication", + new ApplicationPatchableInner() + .withKind("ServiceCatalog") + .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Applications_UpdateAccess + +```java +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.JitRequestMetadata; +import com.azure.resourcemanager.managedapplications.models.Status; +import com.azure.resourcemanager.managedapplications.models.Substatus; + +/** Samples for Applications UpdateAccess. */ +public final class ApplicationsUpdateAccessSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateAccess.json + */ + /** + * Sample code: Update access for application. + * + * @param manager Entry point to ApplicationManager. + */ + public static void updateAccessForApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .updateAccess( + "rg", + "myManagedApplication", + new UpdateAccessDefinitionInner() + .withApprover("amauser") + .withMetadata( + new JitRequestMetadata() + .withOriginRequestId("originRequestId") + .withRequestorId("RequestorId") + .withTenantDisplayName("TenantDisplayName") + .withSubjectDisplayName("SubjectDisplayName")) + .withStatus(Status.ELEVATE) + .withSubStatus(Substatus.APPROVED), + com.azure.core.util.Context.NONE); } } ``` @@ -424,24 +672,25 @@ public final class ApplicationsUpdateSamples { ### Applications_UpdateById ```java -import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationInner; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; /** Samples for Applications UpdateById. */ public final class ApplicationsUpdateByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/updateApplicationById.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplicationById.json */ /** - * Sample code: Update application by id. + * Sample code: Updates an existing managed application. * * @param manager Entry point to ApplicationManager. */ - public static void updateApplicationById(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + public static void updatesAnExistingManagedApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager .applications() - .updateByIdWithResponse( - "myApplicationId", - new ApplicationInner() + .updateById( + "subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication", + new ApplicationPatchableInner() .withKind("ServiceCatalog") .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") .withApplicationDefinitionId( @@ -451,13 +700,176 @@ public final class ApplicationsUpdateByIdSamples { } ``` +### JitRequests_CreateOrUpdate + +```java +import com.azure.resourcemanager.managedapplications.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.managedapplications.models.JitSchedulingPolicy; +import com.azure.resourcemanager.managedapplications.models.JitSchedulingType; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for JitRequests CreateOrUpdate. */ +public final class JitRequestsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateJitRequest.json + */ + /** + * Sample code: Create or update jit request. + * + * @param manager Entry point to ApplicationManager. + */ + public static void createOrUpdateJitRequest( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .jitRequests() + .define("myJitRequest") + .withRegion((String) null) + .withExistingResourceGroup("rg") + .withApplicationResourceId( + "/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158") + .withJitAuthorizationPolicies( + Arrays + .asList( + new JitAuthorizationPolicies() + .withPrincipalId("1db8e132e2934dbcb8e1178a61319491") + .withRoleDefinitionId("ecd05a23-931a-4c38-a52b-ac7c4c583334"))) + .withJitSchedulingPolicy( + new JitSchedulingPolicy() + .withType(JitSchedulingType.ONCE) + .withDuration(Duration.parse("PT8H")) + .withStartTime(OffsetDateTime.parse("2021-04-22T05:48:30.6661804Z"))) + .create(); + } +} +``` + +### JitRequests_Delete + +```java +/** Samples for JitRequests Delete. */ +public final class JitRequestsDeleteSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteJitRequest.json + */ + /** + * Sample code: Delete jit request. + * + * @param manager Entry point to ApplicationManager. + */ + public static void deleteJitRequest(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.jitRequests().deleteByResourceGroupWithResponse("rg", "myJitRequest", com.azure.core.util.Context.NONE); + } +} +``` + +### JitRequests_GetByResourceGroup + +```java +/** Samples for JitRequests GetByResourceGroup. */ +public final class JitRequestsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getJitRequest.json + */ + /** + * Sample code: Gets the jit request. + * + * @param manager Entry point to ApplicationManager. + */ + public static void getsTheJitRequest(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.jitRequests().getByResourceGroupWithResponse("rg", "myJitRequest", com.azure.core.util.Context.NONE); + } +} +``` + +### JitRequests_ListByResourceGroup + +```java +/** Samples for JitRequests ListByResourceGroup. */ +public final class JitRequestsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listJitRequestsByResourceGroup.json + */ + /** + * Sample code: Lists all JIT requests within the resource group. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listsAllJITRequestsWithinTheResourceGroup( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.jitRequests().listByResourceGroupWithResponse("rg", com.azure.core.util.Context.NONE); + } +} +``` + +### JitRequests_ListBySubscription + +```java +/** Samples for JitRequests ListBySubscription. */ +public final class JitRequestsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listJitRequestsByResourceGroup.json + */ + /** + * Sample code: Lists all JIT requests within the subscription. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listsAllJITRequestsWithinTheSubscription( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.jitRequests().listBySubscriptionWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### JitRequests_Update + +```java +import com.azure.resourcemanager.managedapplications.models.JitRequestDefinition; +import java.util.HashMap; +import java.util.Map; + +/** Samples for JitRequests Update. */ +public final class JitRequestsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateJitRequest.json + */ + /** + * Sample code: Update jit request. + * + * @param manager Entry point to ApplicationManager. + */ + public static void updateJitRequest(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + JitRequestDefinition resource = + manager + .jitRequests() + .getByResourceGroupWithResponse("rg", "myJitRequest", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("department", "Finance")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + ### ResourceProvider_ListOperations ```java /** Samples for ResourceProvider ListOperations. */ public final class ResourceProviderListOperationsSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/listSolutionsOperations.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listSolutionsOperations.json */ /** * Sample code: List Solutions operations. diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/pom.xml b/sdk/managedapplications/azure-resourcemanager-managedapplications/pom.xml index a6e60d0e1ec1..47c797528a0e 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/pom.xml +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/pom.xml @@ -1,3 +1,8 @@ + 4.0.0 @@ -9,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-managedapplications - 1.0.0-beta.3 + 1.0.0-beta.4 jar Microsoft Azure SDK for Application Management - This package contains Microsoft Azure SDK for Application Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. ARM applications. Package tag package-managedapplications-2018-06. + This package contains Microsoft Azure SDK for Application Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. ARM applications. Package tag package-managedapplications-2021-07. https://github.com/Azure/azure-sdk-for-java @@ -38,7 +43,9 @@ UTF-8 - true + 0 + 0 + true diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/ApplicationManager.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/ApplicationManager.java index 5a6eda40cb4d..51095b45fef5 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/ApplicationManager.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/ApplicationManager.java @@ -27,9 +27,11 @@ import com.azure.resourcemanager.managedapplications.implementation.ApplicationClientBuilder; import com.azure.resourcemanager.managedapplications.implementation.ApplicationDefinitionsImpl; import com.azure.resourcemanager.managedapplications.implementation.ApplicationsImpl; +import com.azure.resourcemanager.managedapplications.implementation.JitRequestsImpl; import com.azure.resourcemanager.managedapplications.implementation.ResourceProvidersImpl; import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitions; import com.azure.resourcemanager.managedapplications.models.Applications; +import com.azure.resourcemanager.managedapplications.models.JitRequests; import com.azure.resourcemanager.managedapplications.models.ResourceProviders; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -46,6 +48,8 @@ public final class ApplicationManager { private ApplicationDefinitions applicationDefinitions; + private JitRequests jitRequests; + private final ApplicationClient clientObject; private ApplicationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -211,7 +215,7 @@ public ApplicationManager authenticate(TokenCredential credential, AzureProfile .append("-") .append("com.azure.resourcemanager.managedapplications") .append("/") - .append("1.0.0-beta.2"); + .append("1.0.0-beta.3"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -306,8 +310,22 @@ public ApplicationDefinitions applicationDefinitions() { } /** - * @return Wrapped service client ApplicationClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * Gets the resource collection API of JitRequests. It manages JitRequestDefinition. + * + * @return Resource collection API of JitRequests. + */ + public JitRequests jitRequests() { + if (this.jitRequests == null) { + this.jitRequests = new JitRequestsImpl(clientObject.getJitRequests(), this); + } + return jitRequests; + } + + /** + * Gets wrapped service client ApplicationClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ApplicationClient. */ public ApplicationClient serviceClient() { return this.clientObject; diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationClient.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationClient.java index e1115551970f..7715cc938e67 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationClient.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationClient.java @@ -64,4 +64,11 @@ public interface ApplicationClient { * @return the ApplicationDefinitionsClient object. */ ApplicationDefinitionsClient getApplicationDefinitions(); + + /** + * Gets the JitRequestsClient object to access its operations. + * + * @return the JitRequestsClient object. + */ + JitRequestsClient getJitRequests(); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationDefinitionsClient.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationDefinitionsClient.java index 7f05c46b2742..8af45c0b1e92 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationDefinitionsClient.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationDefinitionsClient.java @@ -8,10 +8,9 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionPatchable; /** An instance of this class provides access to all the operations defined in ApplicationDefinitionsClient. */ public interface ApplicationDefinitionsClient { @@ -22,8 +21,7 @@ public interface ApplicationDefinitionsClient { * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition along with {@link Response}. */ @@ -37,8 +35,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition. */ @@ -49,157 +46,142 @@ Response getByResourceGroupWithResponse( * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String applicationDefinitionName); - - /** - * Deletes the managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. + * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return the {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete( - String resourceGroupName, String applicationDefinitionName, Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String applicationDefinitionName, Context context); /** * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. + * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String applicationDefinitionName); /** - * Deletes the managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String applicationDefinitionName, Context context); + Response createOrUpdateWithResponse( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context); /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update an managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of information about managed application definition. + * @return information about managed application definition. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdate( + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationDefinitionInner createOrUpdate( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters); /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update an managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of information about managed application definition. + * @return information about managed application definition along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdate( + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( String resourceGroupName, String applicationDefinitionName, - ApplicationDefinitionInner parameters, + ApplicationDefinitionPatchable parameters, Context context); /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update an managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application definition. */ @ServiceMethod(returns = ReturnType.SINGLE) - ApplicationDefinitionInner createOrUpdate( - String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters); + ApplicationDefinitionInner update( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters); /** - * Creates a new managed application definition. + * Lists the managed application definitions in a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update an managed application definition. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application definition. + * @return list of managed application definitions as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - ApplicationDefinitionInner createOrUpdate( - String resourceGroupName, - String applicationDefinitionName, - ApplicationDefinitionInner parameters, - Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); /** * Lists the managed application definitions in a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); + PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Lists the managed application definitions in a resource group. + * Lists all the application definitions within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the application definitions within a subscription. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); + PagedIterable list(Context context); /** * Gets the managed application definition. @@ -208,8 +190,7 @@ ApplicationDefinitionInner createOrUpdate( * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition along with {@link Response}. */ @@ -223,28 +204,13 @@ Response getByIdWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition. */ @ServiceMethod(returns = ReturnType.SINGLE) ApplicationDefinitionInner getById(String resourceGroupName, String applicationDefinitionName); - /** - * Deletes the managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDeleteById(String resourceGroupName, String applicationDefinitionName); - /** * Deletes the managed application definition. * @@ -252,14 +218,12 @@ Response getByIdWithResponse( * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return the {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDeleteById( - String resourceGroupName, String applicationDefinitionName, Context context); + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteByIdWithResponse(String resourceGroupName, String applicationDefinitionName, Context context); /** * Deletes the managed application definition. @@ -267,96 +231,77 @@ SyncPoller, Void> beginDeleteById( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) void deleteById(String resourceGroupName, String applicationDefinitionName); /** - * Deletes the managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - void deleteById(String resourceGroupName, String applicationDefinitionName, Context context); + Response createOrUpdateByIdWithResponse( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context); /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of information about managed application definition. + * @return information about managed application definition. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdateById( + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationDefinitionInner createOrUpdateById( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters); /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update a managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of information about managed application definition. + * @return information about managed application definition along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdateById( + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateByIdWithResponse( String resourceGroupName, String applicationDefinitionName, - ApplicationDefinitionInner parameters, + ApplicationDefinitionPatchable parameters, Context context); /** - * Creates a new managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update a managed application definition. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application definition. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ApplicationDefinitionInner createOrUpdateById( - String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters); - - /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update a managed application definition. - * @param context The context to associate with this operation. + * @param parameters Parameters supplied to the update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application definition. */ @ServiceMethod(returns = ReturnType.SINGLE) - ApplicationDefinitionInner createOrUpdateById( - String resourceGroupName, - String applicationDefinitionName, - ApplicationDefinitionInner parameters, - Context context); + ApplicationDefinitionInner updateById( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationsClient.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationsClient.java index 8bc98de06583..ef4a18f43a7a 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationsClient.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ApplicationsClient.java @@ -11,8 +11,12 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managedapplications.fluent.models.AllowedUpgradePlansResultInner; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationInner; -import com.azure.resourcemanager.managedapplications.models.ApplicationPatchable; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; +import com.azure.resourcemanager.managedapplications.fluent.models.ManagedIdentityTokenResultInner; +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.ListTokenRequest; /** An instance of this class provides access to all the operations defined in ApplicationsClient. */ public interface ApplicationsClient { @@ -23,8 +27,7 @@ public interface ApplicationsClient { * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response}. */ @@ -38,8 +41,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application. */ @@ -52,8 +54,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of long-running operation. */ @@ -67,8 +68,7 @@ Response getByResourceGroupWithResponse( * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of long-running operation. */ @@ -81,8 +81,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -95,22 +94,20 @@ Response getByResourceGroupWithResponse( * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String applicationName, Context context); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of information about managed application. */ @@ -119,15 +116,14 @@ SyncPoller, ApplicationInner> beginCreateOrUpdate( String resourceGroupName, String applicationName, ApplicationInner parameters); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of information about managed application. */ @@ -136,14 +132,13 @@ SyncPoller, ApplicationInner> beginCreateOrUpdate( String resourceGroupName, String applicationName, ApplicationInner parameters, Context context); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @@ -151,15 +146,14 @@ SyncPoller, ApplicationInner> beginCreateOrUpdate( ApplicationInner createOrUpdate(String resourceGroupName, String applicationName, ApplicationInner parameters); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @@ -168,83 +162,107 @@ ApplicationInner createOrUpdate( String resourceGroupName, String applicationName, ApplicationInner parameters, Context context); /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplicationPatchableInner> beginUpdate( + String resourceGroupName, String applicationName); + + /** + * Updates an existing managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to update an existing managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplicationPatchableInner> beginUpdate( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters, Context context); + + /** + * Updates an existing managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application along with {@link Response}. + * @return information about managed application. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( - String resourceGroupName, String applicationName, ApplicationPatchable parameters, Context context); + ApplicationPatchableInner update(String resourceGroupName, String applicationName); /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @ServiceMethod(returns = ReturnType.SINGLE) - ApplicationInner update(String resourceGroupName, String applicationName); + ApplicationPatchableInner update( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters, Context context); /** - * Gets all the applications within a resource group. + * Lists all the applications within a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName); /** - * Gets all the applications within a resource group. + * Lists all the applications within a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); @@ -257,8 +275,7 @@ Response updateWithResponse( * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response}. */ @@ -272,8 +289,7 @@ Response updateWithResponse( * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application. */ @@ -287,8 +303,7 @@ Response updateWithResponse( * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of long-running operation. */ @@ -303,8 +318,7 @@ Response updateWithResponse( * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of long-running operation. */ @@ -318,8 +332,7 @@ Response updateWithResponse( * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -333,23 +346,21 @@ Response updateWithResponse( * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) void deleteById(String applicationId, Context context); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of information about managed application. */ @@ -358,7 +369,7 @@ SyncPoller, ApplicationInner> beginCreateOrUpdateBy String applicationId, ApplicationInner parameters); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -366,8 +377,7 @@ SyncPoller, ApplicationInner> beginCreateOrUpdateBy * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of information about managed application. */ @@ -376,15 +386,14 @@ SyncPoller, ApplicationInner> beginCreateOrUpdateBy String applicationId, ApplicationInner parameters, Context context); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @@ -392,7 +401,7 @@ SyncPoller, ApplicationInner> beginCreateOrUpdateBy ApplicationInner createOrUpdateById(String applicationId, ApplicationInner parameters); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -400,8 +409,7 @@ SyncPoller, ApplicationInner> beginCreateOrUpdateBy * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @@ -409,7 +417,21 @@ SyncPoller, ApplicationInner> beginCreateOrUpdateBy ApplicationInner createOrUpdateById(String applicationId, ApplicationInner parameters, Context context); /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. + * + * @param applicationId The fully qualified ID of the managed application, including the managed application name + * and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplicationPatchableInner> beginUpdateById(String applicationId); + + /** + * Updates an existing managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -417,27 +439,215 @@ SyncPoller, ApplicationInner> beginCreateOrUpdateBy * @param parameters Parameters supplied to update an existing managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application along with {@link Response}. + * @return the {@link SyncPoller} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplicationPatchableInner> beginUpdateById( + String applicationId, ApplicationPatchableInner parameters, Context context); + + /** + * Updates an existing managed application. + * + * @param applicationId The fully qualified ID of the managed application, including the managed application name + * and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateByIdWithResponse( - String applicationId, ApplicationInner parameters, Context context); + ApplicationPatchableInner updateById(String applicationId); /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @ServiceMethod(returns = ReturnType.SINGLE) - ApplicationInner updateById(String applicationId); + ApplicationPatchableInner updateById(String applicationId, ApplicationPatchableInner parameters, Context context); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRefreshPermissions(String resourceGroupName, String applicationName); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRefreshPermissions( + String resourceGroupName, String applicationName, Context context); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshPermissions(String resourceGroupName, String applicationName); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshPermissions(String resourceGroupName, String applicationName, Context context); + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listAllowedUpgradePlansWithResponse( + String resourceGroupName, String applicationName, Context context); + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AllowedUpgradePlansResultInner listAllowedUpgradePlans(String resourceGroupName, String applicationName); + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, UpdateAccessDefinitionInner> beginUpdateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters); + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, UpdateAccessDefinitionInner> beginUpdateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters, Context context); + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateAccessDefinitionInner updateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters); + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateAccessDefinitionInner updateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters, Context context); + + /** + * List tokens for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listTokensWithResponse( + String resourceGroupName, String applicationName, ListTokenRequest parameters, Context context); + + /** + * List tokens for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedIdentityTokenResultInner listTokens( + String resourceGroupName, String applicationName, ListTokenRequest parameters); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/JitRequestsClient.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/JitRequestsClient.java new file mode 100644 index 000000000000..0cc2eb7fd33e --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/JitRequestsClient.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionListResultInner; +import com.azure.resourcemanager.managedapplications.models.JitRequestPatchable; + +/** An instance of this class provides access to all the operations defined in JitRequestsClient. */ +public interface JitRequestsClient { + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String jitRequestName, Context context); + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionInner getByResourceGroup(String resourceGroupName, String jitRequestName); + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JitRequestDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters); + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JitRequestDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context); + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionInner createOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters); + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionInner createOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context); + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters, Context context); + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionInner update(String resourceGroupName, String jitRequestName, JitRequestPatchable parameters); + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String jitRequestName, Context context); + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String jitRequestName); + + /** + * Lists all JIT requests within the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listBySubscriptionWithResponse(Context context); + + /** + * Lists all JIT requests within the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionListResultInner listBySubscription(); + + /** + * Lists all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByResourceGroupWithResponse( + String resourceGroupName, Context context); + + /** + * Lists all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JitRequestDefinitionListResultInner listByResourceGroup(String resourceGroupName); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ResourceProvidersClient.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ResourceProvidersClient.java index 7a446bcf6ff3..07f1b01214fe 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ResourceProvidersClient.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/ResourceProvidersClient.java @@ -17,7 +17,7 @@ public interface ResourceProvidersClient { * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations as paginated response with {@link + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -30,7 +30,7 @@ public interface ResourceProvidersClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations as paginated response with {@link + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/AllowedUpgradePlansResultInner.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/AllowedUpgradePlansResultInner.java new file mode 100644 index 000000000000..566d784796ed --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/AllowedUpgradePlansResultInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managedapplications.models.Plan; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The array of plan. */ +@Fluent +public final class AllowedUpgradePlansResultInner { + /* + * The array of plans. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of AllowedUpgradePlansResultInner class. */ + public AllowedUpgradePlansResultInner() { + } + + /** + * Get the value property: The array of plans. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of plans. + * + * @param value the value value to set. + * @return the AllowedUpgradePlansResultInner object itself. + */ + public AllowedUpgradePlansResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationDefinitionInner.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationDefinitionInner.java index e7511604037e..b6e8ad63bdf4 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationDefinitionInner.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationDefinitionInner.java @@ -6,11 +6,15 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationDeploymentPolicy; import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationNotificationPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageLockingPolicyDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationPolicy; import com.azure.resourcemanager.managedapplications.models.GenericResource; -import com.azure.resourcemanager.managedapplications.models.Identity; import com.azure.resourcemanager.managedapplications.models.Sku; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -52,13 +56,6 @@ public ApplicationDefinitionInner withSku(Sku sku) { return this; } - /** {@inheritDoc} */ - @Override - public ApplicationDefinitionInner withIdentity(Identity identity) { - super.withIdentity(identity); - return this; - } - /** {@inheritDoc} */ @Override public ApplicationDefinitionInner withLocation(String location) { @@ -124,7 +121,7 @@ public ApplicationDefinitionInner withDisplayName(String displayName) { * * @return the isEnabled value. */ - public String isEnabled() { + public Boolean isEnabled() { return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); } @@ -134,7 +131,7 @@ public String isEnabled() { * @param isEnabled the isEnabled value to set. * @return the ApplicationDefinitionInner object itself. */ - public ApplicationDefinitionInner withIsEnabled(String isEnabled) { + public ApplicationDefinitionInner withIsEnabled(Boolean isEnabled) { if (this.innerProperties() == null) { this.innerProperties = new ApplicationDefinitionProperties(); } @@ -147,7 +144,7 @@ public ApplicationDefinitionInner withIsEnabled(String isEnabled) { * * @return the authorizations value. */ - public List authorizations() { + public List authorizations() { return this.innerProperties() == null ? null : this.innerProperties().authorizations(); } @@ -157,7 +154,7 @@ public List authorizations() { * @param authorizations the authorizations value to set. * @return the ApplicationDefinitionInner object itself. */ - public ApplicationDefinitionInner withAuthorizations(List authorizations) { + public ApplicationDefinitionInner withAuthorizations(List authorizations) { if (this.innerProperties() == null) { this.innerProperties = new ApplicationDefinitionProperties(); } @@ -172,7 +169,7 @@ public ApplicationDefinitionInner withAuthorizations(List artifacts() { + public List artifacts() { return this.innerProperties() == null ? null : this.innerProperties().artifacts(); } @@ -184,7 +181,7 @@ public List artifacts() { * @param artifacts the artifacts value to set. * @return the ApplicationDefinitionInner object itself. */ - public ApplicationDefinitionInner withArtifacts(List artifacts) { + public ApplicationDefinitionInner withArtifacts(List artifacts) { if (this.innerProperties() == null) { this.innerProperties = new ApplicationDefinitionProperties(); } @@ -238,6 +235,29 @@ public ApplicationDefinitionInner withPackageFileUri(String packageFileUri) { return this; } + /** + * Get the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountId(); + } + + /** + * Set the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @param storageAccountId the storageAccountId value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withStorageAccountId(String storageAccountId) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withStorageAccountId(storageAccountId); + return this; + } + /** * Get the mainTemplate property: The inline main template json which has resources to be provisioned. It can be a * JObject or well-formed JSON string. @@ -288,6 +308,123 @@ public ApplicationDefinitionInner withCreateUiDefinition(Object createUiDefiniti return this; } + /** + * Get the notificationPolicy property: The managed application notification policy. + * + * @return the notificationPolicy value. + */ + public ApplicationNotificationPolicy notificationPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().notificationPolicy(); + } + + /** + * Set the notificationPolicy property: The managed application notification policy. + * + * @param notificationPolicy the notificationPolicy value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withNotificationPolicy(ApplicationNotificationPolicy notificationPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withNotificationPolicy(notificationPolicy); + return this; + } + + /** + * Get the lockingPolicy property: The managed application locking policy. + * + * @return the lockingPolicy value. + */ + public ApplicationPackageLockingPolicyDefinition lockingPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().lockingPolicy(); + } + + /** + * Set the lockingPolicy property: The managed application locking policy. + * + * @param lockingPolicy the lockingPolicy value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withLockingPolicy(ApplicationPackageLockingPolicyDefinition lockingPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withLockingPolicy(lockingPolicy); + return this; + } + + /** + * Get the deploymentPolicy property: The managed application deployment policy. + * + * @return the deploymentPolicy value. + */ + public ApplicationDeploymentPolicy deploymentPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().deploymentPolicy(); + } + + /** + * Set the deploymentPolicy property: The managed application deployment policy. + * + * @param deploymentPolicy the deploymentPolicy value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withDeploymentPolicy(ApplicationDeploymentPolicy deploymentPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withDeploymentPolicy(deploymentPolicy); + return this; + } + + /** + * Get the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @return the managementPolicy value. + */ + public ApplicationManagementPolicy managementPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().managementPolicy(); + } + + /** + * Set the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @param managementPolicy the managementPolicy value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withManagementPolicy(ApplicationManagementPolicy managementPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withManagementPolicy(managementPolicy); + return this; + } + + /** + * Get the policies property: The managed application provider policies. + * + * @return the policies value. + */ + public List policies() { + return this.innerProperties() == null ? null : this.innerProperties().policies(); + } + + /** + * Set the policies property: The managed application provider policies. + * + * @param policies the policies value to set. + * @return the ApplicationDefinitionInner object itself. + */ + public ApplicationDefinitionInner withPolicies(List policies) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationDefinitionProperties(); + } + this.innerProperties().withPolicies(policies); + return this; + } + /** * Validates the instance. * diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationDefinitionProperties.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationDefinitionProperties.java index a5eae4848dd8..377ed1ff1637 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationDefinitionProperties.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationDefinitionProperties.java @@ -6,9 +6,14 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationDeploymentPolicy; import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationNotificationPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageLockingPolicyDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationPolicy; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -31,20 +36,20 @@ public final class ApplicationDefinitionProperties { * A value indicating whether the package is enabled or not. */ @JsonProperty(value = "isEnabled") - private String isEnabled; + private Boolean isEnabled; /* * The managed application provider authorizations. */ - @JsonProperty(value = "authorizations", required = true) - private List authorizations; + @JsonProperty(value = "authorizations") + private List authorizations; /* * The collection of managed application artifacts. The portal will use the files specified as artifacts to * construct the user experience of creating a managed application from a managed application definition. */ @JsonProperty(value = "artifacts") - private List artifacts; + private List artifacts; /* * The managed application definition description. @@ -58,6 +63,12 @@ public final class ApplicationDefinitionProperties { @JsonProperty(value = "packageFileUri") private String packageFileUri; + /* + * The storage account id for bring your own storage scenario. + */ + @JsonProperty(value = "storageAccountId") + private String storageAccountId; + /* * The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON * string. @@ -72,6 +83,36 @@ public final class ApplicationDefinitionProperties { @JsonProperty(value = "createUiDefinition") private Object createUiDefinition; + /* + * The managed application notification policy. + */ + @JsonProperty(value = "notificationPolicy") + private ApplicationNotificationPolicy notificationPolicy; + + /* + * The managed application locking policy. + */ + @JsonProperty(value = "lockingPolicy") + private ApplicationPackageLockingPolicyDefinition lockingPolicy; + + /* + * The managed application deployment policy. + */ + @JsonProperty(value = "deploymentPolicy") + private ApplicationDeploymentPolicy deploymentPolicy; + + /* + * The managed application management policy that determines publisher's access to the managed resource group. + */ + @JsonProperty(value = "managementPolicy") + private ApplicationManagementPolicy managementPolicy; + + /* + * The managed application provider policies. + */ + @JsonProperty(value = "policies") + private List policies; + /** Creates an instance of ApplicationDefinitionProperties class. */ public ApplicationDefinitionProperties() { } @@ -121,7 +162,7 @@ public ApplicationDefinitionProperties withDisplayName(String displayName) { * * @return the isEnabled value. */ - public String isEnabled() { + public Boolean isEnabled() { return this.isEnabled; } @@ -131,7 +172,7 @@ public String isEnabled() { * @param isEnabled the isEnabled value to set. * @return the ApplicationDefinitionProperties object itself. */ - public ApplicationDefinitionProperties withIsEnabled(String isEnabled) { + public ApplicationDefinitionProperties withIsEnabled(Boolean isEnabled) { this.isEnabled = isEnabled; return this; } @@ -141,7 +182,7 @@ public ApplicationDefinitionProperties withIsEnabled(String isEnabled) { * * @return the authorizations value. */ - public List authorizations() { + public List authorizations() { return this.authorizations; } @@ -151,7 +192,7 @@ public List authorizations() { * @param authorizations the authorizations value to set. * @return the ApplicationDefinitionProperties object itself. */ - public ApplicationDefinitionProperties withAuthorizations(List authorizations) { + public ApplicationDefinitionProperties withAuthorizations(List authorizations) { this.authorizations = authorizations; return this; } @@ -163,7 +204,7 @@ public ApplicationDefinitionProperties withAuthorizations(List artifacts() { + public List artifacts() { return this.artifacts; } @@ -175,7 +216,7 @@ public List artifacts() { * @param artifacts the artifacts value to set. * @return the ApplicationDefinitionProperties object itself. */ - public ApplicationDefinitionProperties withArtifacts(List artifacts) { + public ApplicationDefinitionProperties withArtifacts(List artifacts) { this.artifacts = artifacts; return this; } @@ -220,6 +261,26 @@ public ApplicationDefinitionProperties withPackageFileUri(String packageFileUri) return this; } + /** + * Get the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @param storageAccountId the storageAccountId value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + /** * Get the mainTemplate property: The inline main template json which has resources to be provisioned. It can be a * JObject or well-formed JSON string. @@ -264,6 +325,108 @@ public ApplicationDefinitionProperties withCreateUiDefinition(Object createUiDef return this; } + /** + * Get the notificationPolicy property: The managed application notification policy. + * + * @return the notificationPolicy value. + */ + public ApplicationNotificationPolicy notificationPolicy() { + return this.notificationPolicy; + } + + /** + * Set the notificationPolicy property: The managed application notification policy. + * + * @param notificationPolicy the notificationPolicy value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withNotificationPolicy(ApplicationNotificationPolicy notificationPolicy) { + this.notificationPolicy = notificationPolicy; + return this; + } + + /** + * Get the lockingPolicy property: The managed application locking policy. + * + * @return the lockingPolicy value. + */ + public ApplicationPackageLockingPolicyDefinition lockingPolicy() { + return this.lockingPolicy; + } + + /** + * Set the lockingPolicy property: The managed application locking policy. + * + * @param lockingPolicy the lockingPolicy value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withLockingPolicy(ApplicationPackageLockingPolicyDefinition lockingPolicy) { + this.lockingPolicy = lockingPolicy; + return this; + } + + /** + * Get the deploymentPolicy property: The managed application deployment policy. + * + * @return the deploymentPolicy value. + */ + public ApplicationDeploymentPolicy deploymentPolicy() { + return this.deploymentPolicy; + } + + /** + * Set the deploymentPolicy property: The managed application deployment policy. + * + * @param deploymentPolicy the deploymentPolicy value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withDeploymentPolicy(ApplicationDeploymentPolicy deploymentPolicy) { + this.deploymentPolicy = deploymentPolicy; + return this; + } + + /** + * Get the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @return the managementPolicy value. + */ + public ApplicationManagementPolicy managementPolicy() { + return this.managementPolicy; + } + + /** + * Set the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @param managementPolicy the managementPolicy value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withManagementPolicy(ApplicationManagementPolicy managementPolicy) { + this.managementPolicy = managementPolicy; + return this; + } + + /** + * Get the policies property: The managed application provider policies. + * + * @return the policies value. + */ + public List policies() { + return this.policies; + } + + /** + * Set the policies property: The managed application provider policies. + * + * @param policies the policies value to set. + * @return the ApplicationDefinitionProperties object itself. + */ + public ApplicationDefinitionProperties withPolicies(List policies) { + this.policies = policies; + return this; + } + /** * Validates the instance. * @@ -276,17 +439,27 @@ public void validate() { new IllegalArgumentException( "Missing required property lockLevel in model ApplicationDefinitionProperties")); } - if (authorizations() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - "Missing required property authorizations in model ApplicationDefinitionProperties")); - } else { + if (authorizations() != null) { authorizations().forEach(e -> e.validate()); } if (artifacts() != null) { artifacts().forEach(e -> e.validate()); } + if (notificationPolicy() != null) { + notificationPolicy().validate(); + } + if (lockingPolicy() != null) { + lockingPolicy().validate(); + } + if (deploymentPolicy() != null) { + deploymentPolicy().validate(); + } + if (managementPolicy() != null) { + managementPolicy().validate(); + } + if (policies() != null) { + policies().forEach(e -> e.validate()); + } } private static final ClientLogger LOGGER = new ClientLogger(ApplicationDefinitionProperties.class); diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationInner.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationInner.java index b3c075cc651c..0c3dde0b727f 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationInner.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationInner.java @@ -6,12 +6,21 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; +import com.azure.resourcemanager.managedapplications.models.ApplicationBillingDetailsDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationClientDetails; +import com.azure.resourcemanager.managedapplications.models.ApplicationJitAccessPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementMode; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageContact; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageSupportUrls; import com.azure.resourcemanager.managedapplications.models.GenericResource; import com.azure.resourcemanager.managedapplications.models.Identity; import com.azure.resourcemanager.managedapplications.models.Plan; import com.azure.resourcemanager.managedapplications.models.ProvisioningState; import com.azure.resourcemanager.managedapplications.models.Sku; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; import java.util.Map; /** Information about managed application. */ @@ -35,6 +44,12 @@ public final class ApplicationInner extends GenericResource { @JsonProperty(value = "kind", required = true) private String kind; + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + /** Creates an instance of ApplicationInner class. */ public ApplicationInner() { } @@ -88,6 +103,26 @@ public ApplicationInner withKind(String kind) { return this; } + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + /** {@inheritDoc} */ @Override public ApplicationInner withManagedBy(String managedBy) { @@ -102,13 +137,6 @@ public ApplicationInner withSku(Sku sku) { return this; } - /** {@inheritDoc} */ - @Override - public ApplicationInner withIdentity(Identity identity) { - super.withIdentity(identity); - return this; - } - /** {@inheritDoc} */ @Override public ApplicationInner withLocation(String location) { @@ -212,6 +240,112 @@ public ProvisioningState provisioningState() { return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); } + /** + * Get the billingDetails property: The managed application billing details. + * + * @return the billingDetails value. + */ + public ApplicationBillingDetailsDefinition billingDetails() { + return this.innerProperties() == null ? null : this.innerProperties().billingDetails(); + } + + /** + * Get the jitAccessPolicy property: The managed application Jit access policy. + * + * @return the jitAccessPolicy value. + */ + public ApplicationJitAccessPolicy jitAccessPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().jitAccessPolicy(); + } + + /** + * Set the jitAccessPolicy property: The managed application Jit access policy. + * + * @param jitAccessPolicy the jitAccessPolicy value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withJitAccessPolicy(jitAccessPolicy); + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant Id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.innerProperties() == null ? null : this.innerProperties().publisherTenantId(); + } + + /** + * Get the authorizations property: The read-only authorizations property that is retrieved from the application + * package. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.innerProperties() == null ? null : this.innerProperties().authorizations(); + } + + /** + * Get the managementMode property: The managed application management mode. + * + * @return the managementMode value. + */ + public ApplicationManagementMode managementMode() { + return this.innerProperties() == null ? null : this.innerProperties().managementMode(); + } + + /** + * Get the customerSupport property: The read-only customer support property that is retrieved from the application + * package. + * + * @return the customerSupport value. + */ + public ApplicationPackageContact customerSupport() { + return this.innerProperties() == null ? null : this.innerProperties().customerSupport(); + } + + /** + * Get the supportUrls property: The read-only support URLs property that is retrieved from the application package. + * + * @return the supportUrls value. + */ + public ApplicationPackageSupportUrls supportUrls() { + return this.innerProperties() == null ? null : this.innerProperties().supportUrls(); + } + + /** + * Get the artifacts property: The collection of managed application artifacts. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.innerProperties() == null ? null : this.innerProperties().artifacts(); + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().updatedBy(); + } + /** * Validates the instance. * @@ -236,6 +370,9 @@ public void validate() { .logExceptionAsError( new IllegalArgumentException("Missing required property kind in model ApplicationInner")); } + if (identity() != null) { + identity().validate(); + } } private static final ClientLogger LOGGER = new ClientLogger(ApplicationInner.class); diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationPatchableInner.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationPatchableInner.java new file mode 100644 index 000000000000..741c2c25661a --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationPatchableInner.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; +import com.azure.resourcemanager.managedapplications.models.ApplicationBillingDetailsDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationClientDetails; +import com.azure.resourcemanager.managedapplications.models.ApplicationJitAccessPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementMode; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageContact; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageSupportUrls; +import com.azure.resourcemanager.managedapplications.models.GenericResource; +import com.azure.resourcemanager.managedapplications.models.Identity; +import com.azure.resourcemanager.managedapplications.models.PlanPatchable; +import com.azure.resourcemanager.managedapplications.models.ProvisioningState; +import com.azure.resourcemanager.managedapplications.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Information about managed application. */ +@Fluent +public final class ApplicationPatchableInner extends GenericResource { + /* + * The managed application properties. + */ + @JsonProperty(value = "properties") + private ApplicationProperties innerProperties; + + /* + * The plan information. + */ + @JsonProperty(value = "plan") + private PlanPatchable plan; + + /* + * The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** Creates an instance of ApplicationPatchableInner class. */ + public ApplicationPatchableInner() { + } + + /** + * Get the innerProperties property: The managed application properties. + * + * @return the innerProperties value. + */ + private ApplicationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the plan property: The plan information. + * + * @return the plan value. + */ + public PlanPatchable plan() { + return this.plan; + } + + /** + * Set the plan property: The plan information. + * + * @param plan the plan value to set. + * @return the ApplicationPatchableInner object itself. + */ + public ApplicationPatchableInner withPlan(PlanPatchable plan) { + this.plan = plan; + return this; + } + + /** + * Get the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * + * @param kind the kind value to set. + * @return the ApplicationPatchableInner object itself. + */ + public ApplicationPatchableInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the ApplicationPatchableInner object itself. + */ + public ApplicationPatchableInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationPatchableInner withManagedBy(String managedBy) { + super.withManagedBy(managedBy); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationPatchableInner withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationPatchableInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationPatchableInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the managedResourceGroupId property: The managed resource group Id. + * + * @return the managedResourceGroupId value. + */ + public String managedResourceGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().managedResourceGroupId(); + } + + /** + * Set the managedResourceGroupId property: The managed resource group Id. + * + * @param managedResourceGroupId the managedResourceGroupId value to set. + * @return the ApplicationPatchableInner object itself. + */ + public ApplicationPatchableInner withManagedResourceGroupId(String managedResourceGroupId) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withManagedResourceGroupId(managedResourceGroupId); + return this; + } + + /** + * Get the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @return the applicationDefinitionId value. + */ + public String applicationDefinitionId() { + return this.innerProperties() == null ? null : this.innerProperties().applicationDefinitionId(); + } + + /** + * Set the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @param applicationDefinitionId the applicationDefinitionId value to set. + * @return the ApplicationPatchableInner object itself. + */ + public ApplicationPatchableInner withApplicationDefinitionId(String applicationDefinitionId) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withApplicationDefinitionId(applicationDefinitionId); + return this; + } + + /** + * Get the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @return the parameters value. + */ + public Object parameters() { + return this.innerProperties() == null ? null : this.innerProperties().parameters(); + } + + /** + * Set the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @param parameters the parameters value to set. + * @return the ApplicationPatchableInner object itself. + */ + public ApplicationPatchableInner withParameters(Object parameters) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withParameters(parameters); + return this; + } + + /** + * Get the outputs property: Name and value pairs that define the managed application outputs. + * + * @return the outputs value. + */ + public Object outputs() { + return this.innerProperties() == null ? null : this.innerProperties().outputs(); + } + + /** + * Get the provisioningState property: The managed application provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the billingDetails property: The managed application billing details. + * + * @return the billingDetails value. + */ + public ApplicationBillingDetailsDefinition billingDetails() { + return this.innerProperties() == null ? null : this.innerProperties().billingDetails(); + } + + /** + * Get the jitAccessPolicy property: The managed application Jit access policy. + * + * @return the jitAccessPolicy value. + */ + public ApplicationJitAccessPolicy jitAccessPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().jitAccessPolicy(); + } + + /** + * Set the jitAccessPolicy property: The managed application Jit access policy. + * + * @param jitAccessPolicy the jitAccessPolicy value to set. + * @return the ApplicationPatchableInner object itself. + */ + public ApplicationPatchableInner withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplicationProperties(); + } + this.innerProperties().withJitAccessPolicy(jitAccessPolicy); + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant Id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.innerProperties() == null ? null : this.innerProperties().publisherTenantId(); + } + + /** + * Get the authorizations property: The read-only authorizations property that is retrieved from the application + * package. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.innerProperties() == null ? null : this.innerProperties().authorizations(); + } + + /** + * Get the managementMode property: The managed application management mode. + * + * @return the managementMode value. + */ + public ApplicationManagementMode managementMode() { + return this.innerProperties() == null ? null : this.innerProperties().managementMode(); + } + + /** + * Get the customerSupport property: The read-only customer support property that is retrieved from the application + * package. + * + * @return the customerSupport value. + */ + public ApplicationPackageContact customerSupport() { + return this.innerProperties() == null ? null : this.innerProperties().customerSupport(); + } + + /** + * Get the supportUrls property: The read-only support URLs property that is retrieved from the application package. + * + * @return the supportUrls value. + */ + public ApplicationPackageSupportUrls supportUrls() { + return this.innerProperties() == null ? null : this.innerProperties().supportUrls(); + } + + /** + * Get the artifacts property: The collection of managed application artifacts. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.innerProperties() == null ? null : this.innerProperties().artifacts(); + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().updatedBy(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + if (plan() != null) { + plan().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationProperties.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationProperties.java index 3c44b23898e3..2dbe597298e3 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationProperties.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationProperties.java @@ -5,9 +5,17 @@ package com.azure.resourcemanager.managedapplications.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; +import com.azure.resourcemanager.managedapplications.models.ApplicationBillingDetailsDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationClientDetails; +import com.azure.resourcemanager.managedapplications.models.ApplicationJitAccessPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementMode; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageContact; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageSupportUrls; import com.azure.resourcemanager.managedapplications.models.ProvisioningState; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; /** The managed application properties. */ @Fluent @@ -15,7 +23,7 @@ public final class ApplicationProperties { /* * The managed resource group Id. */ - @JsonProperty(value = "managedResourceGroupId", required = true) + @JsonProperty(value = "managedResourceGroupId") private String managedResourceGroupId; /* @@ -43,6 +51,66 @@ public final class ApplicationProperties { @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; + /* + * The managed application billing details. + */ + @JsonProperty(value = "billingDetails", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationBillingDetailsDefinition billingDetails; + + /* + * The managed application Jit access policy. + */ + @JsonProperty(value = "jitAccessPolicy") + private ApplicationJitAccessPolicy jitAccessPolicy; + + /* + * The publisher tenant Id. + */ + @JsonProperty(value = "publisherTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String publisherTenantId; + + /* + * The read-only authorizations property that is retrieved from the application package. + */ + @JsonProperty(value = "authorizations", access = JsonProperty.Access.WRITE_ONLY) + private List authorizations; + + /* + * The managed application management mode. + */ + @JsonProperty(value = "managementMode", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationManagementMode managementMode; + + /* + * The read-only customer support property that is retrieved from the application package. + */ + @JsonProperty(value = "customerSupport", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationPackageContact customerSupport; + + /* + * The read-only support URLs property that is retrieved from the application package. + */ + @JsonProperty(value = "supportUrls", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationPackageSupportUrls supportUrls; + + /* + * The collection of managed application artifacts. + */ + @JsonProperty(value = "artifacts", access = JsonProperty.Access.WRITE_ONLY) + private List artifacts; + + /* + * The client entity that created the JIT request. + */ + @JsonProperty(value = "createdBy", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationClientDetails createdBy; + + /* + * The client entity that last updated the JIT request. + */ + @JsonProperty(value = "updatedBy", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationClientDetails updatedBy; + /** Creates an instance of ApplicationProperties class. */ public ApplicationProperties() { } @@ -127,19 +195,138 @@ public ProvisioningState provisioningState() { return this.provisioningState; } + /** + * Get the billingDetails property: The managed application billing details. + * + * @return the billingDetails value. + */ + public ApplicationBillingDetailsDefinition billingDetails() { + return this.billingDetails; + } + + /** + * Get the jitAccessPolicy property: The managed application Jit access policy. + * + * @return the jitAccessPolicy value. + */ + public ApplicationJitAccessPolicy jitAccessPolicy() { + return this.jitAccessPolicy; + } + + /** + * Set the jitAccessPolicy property: The managed application Jit access policy. + * + * @param jitAccessPolicy the jitAccessPolicy value to set. + * @return the ApplicationProperties object itself. + */ + public ApplicationProperties withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy) { + this.jitAccessPolicy = jitAccessPolicy; + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant Id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.publisherTenantId; + } + + /** + * Get the authorizations property: The read-only authorizations property that is retrieved from the application + * package. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.authorizations; + } + + /** + * Get the managementMode property: The managed application management mode. + * + * @return the managementMode value. + */ + public ApplicationManagementMode managementMode() { + return this.managementMode; + } + + /** + * Get the customerSupport property: The read-only customer support property that is retrieved from the application + * package. + * + * @return the customerSupport value. + */ + public ApplicationPackageContact customerSupport() { + return this.customerSupport; + } + + /** + * Get the supportUrls property: The read-only support URLs property that is retrieved from the application package. + * + * @return the supportUrls value. + */ + public ApplicationPackageSupportUrls supportUrls() { + return this.supportUrls; + } + + /** + * Get the artifacts property: The collection of managed application artifacts. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.artifacts; + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.createdBy; + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.updatedBy; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (managedResourceGroupId() == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - "Missing required property managedResourceGroupId in model ApplicationProperties")); + if (billingDetails() != null) { + billingDetails().validate(); + } + if (jitAccessPolicy() != null) { + jitAccessPolicy().validate(); + } + if (authorizations() != null) { + authorizations().forEach(e -> e.validate()); + } + if (customerSupport() != null) { + customerSupport().validate(); + } + if (supportUrls() != null) { + supportUrls().validate(); + } + if (artifacts() != null) { + artifacts().forEach(e -> e.validate()); + } + if (createdBy() != null) { + createdBy().validate(); + } + if (updatedBy() != null) { + updatedBy().validate(); } } - - private static final ClientLogger LOGGER = new ClientLogger(ApplicationProperties.class); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationPropertiesPatchable.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationPropertiesPatchable.java deleted file mode 100644 index 44caa7a2a6eb..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ApplicationPropertiesPatchable.java +++ /dev/null @@ -1,136 +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.resourcemanager.managedapplications.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.managedapplications.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The managed application properties. */ -@Fluent -public final class ApplicationPropertiesPatchable { - /* - * The managed resource group Id. - */ - @JsonProperty(value = "managedResourceGroupId") - private String managedResourceGroupId; - - /* - * The fully qualified path of managed application definition Id. - */ - @JsonProperty(value = "applicationDefinitionId") - private String applicationDefinitionId; - - /* - * Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON - * string. - */ - @JsonProperty(value = "parameters") - private Object parameters; - - /* - * Name and value pairs that define the managed application outputs. - */ - @JsonProperty(value = "outputs", access = JsonProperty.Access.WRITE_ONLY) - private Object outputs; - - /* - * The managed application provisioning state. - */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private ProvisioningState provisioningState; - - /** Creates an instance of ApplicationPropertiesPatchable class. */ - public ApplicationPropertiesPatchable() { - } - - /** - * Get the managedResourceGroupId property: The managed resource group Id. - * - * @return the managedResourceGroupId value. - */ - public String managedResourceGroupId() { - return this.managedResourceGroupId; - } - - /** - * Set the managedResourceGroupId property: The managed resource group Id. - * - * @param managedResourceGroupId the managedResourceGroupId value to set. - * @return the ApplicationPropertiesPatchable object itself. - */ - public ApplicationPropertiesPatchable withManagedResourceGroupId(String managedResourceGroupId) { - this.managedResourceGroupId = managedResourceGroupId; - return this; - } - - /** - * Get the applicationDefinitionId property: The fully qualified path of managed application definition Id. - * - * @return the applicationDefinitionId value. - */ - public String applicationDefinitionId() { - return this.applicationDefinitionId; - } - - /** - * Set the applicationDefinitionId property: The fully qualified path of managed application definition Id. - * - * @param applicationDefinitionId the applicationDefinitionId value to set. - * @return the ApplicationPropertiesPatchable object itself. - */ - public ApplicationPropertiesPatchable withApplicationDefinitionId(String applicationDefinitionId) { - this.applicationDefinitionId = applicationDefinitionId; - return this; - } - - /** - * Get the parameters property: Name and value pairs that define the managed application parameters. It can be a - * JObject or a well formed JSON string. - * - * @return the parameters value. - */ - public Object parameters() { - return this.parameters; - } - - /** - * Set the parameters property: Name and value pairs that define the managed application parameters. It can be a - * JObject or a well formed JSON string. - * - * @param parameters the parameters value to set. - * @return the ApplicationPropertiesPatchable object itself. - */ - public ApplicationPropertiesPatchable withParameters(Object parameters) { - this.parameters = parameters; - return this; - } - - /** - * Get the outputs property: Name and value pairs that define the managed application outputs. - * - * @return the outputs value. - */ - public Object outputs() { - return this.outputs; - } - - /** - * Get the provisioningState property: The managed application provisioning state. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/JitRequestDefinitionInner.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/JitRequestDefinitionInner.java new file mode 100644 index 000000000000..fbe8702e5866 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/JitRequestDefinitionInner.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.managedapplications.models.ApplicationClientDetails; +import com.azure.resourcemanager.managedapplications.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.managedapplications.models.JitRequestState; +import com.azure.resourcemanager.managedapplications.models.JitSchedulingPolicy; +import com.azure.resourcemanager.managedapplications.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Information about JIT request definition. */ +@Fluent +public final class JitRequestDefinitionInner extends Resource { + /* + * The JIT request properties. + */ + @JsonProperty(value = "properties") + private JitRequestProperties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of JitRequestDefinitionInner class. */ + public JitRequestDefinitionInner() { + } + + /** + * Get the innerProperties property: The JIT request properties. + * + * @return the innerProperties value. + */ + private JitRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public JitRequestDefinitionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public JitRequestDefinitionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the applicationResourceId property: The parent application id. + * + * @return the applicationResourceId value. + */ + public String applicationResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().applicationResourceId(); + } + + /** + * Set the applicationResourceId property: The parent application id. + * + * @param applicationResourceId the applicationResourceId value to set. + * @return the JitRequestDefinitionInner object itself. + */ + public JitRequestDefinitionInner withApplicationResourceId(String applicationResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new JitRequestProperties(); + } + this.innerProperties().withApplicationResourceId(applicationResourceId); + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.innerProperties() == null ? null : this.innerProperties().publisherTenantId(); + } + + /** + * Get the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @return the jitAuthorizationPolicies value. + */ + public List jitAuthorizationPolicies() { + return this.innerProperties() == null ? null : this.innerProperties().jitAuthorizationPolicies(); + } + + /** + * Set the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @param jitAuthorizationPolicies the jitAuthorizationPolicies value to set. + * @return the JitRequestDefinitionInner object itself. + */ + public JitRequestDefinitionInner withJitAuthorizationPolicies( + List jitAuthorizationPolicies) { + if (this.innerProperties() == null) { + this.innerProperties = new JitRequestProperties(); + } + this.innerProperties().withJitAuthorizationPolicies(jitAuthorizationPolicies); + return this; + } + + /** + * Get the jitSchedulingPolicy property: The JIT request properties. + * + * @return the jitSchedulingPolicy value. + */ + public JitSchedulingPolicy jitSchedulingPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().jitSchedulingPolicy(); + } + + /** + * Set the jitSchedulingPolicy property: The JIT request properties. + * + * @param jitSchedulingPolicy the jitSchedulingPolicy value to set. + * @return the JitRequestDefinitionInner object itself. + */ + public JitRequestDefinitionInner withJitSchedulingPolicy(JitSchedulingPolicy jitSchedulingPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new JitRequestProperties(); + } + this.innerProperties().withJitSchedulingPolicy(jitSchedulingPolicy); + return this; + } + + /** + * Get the provisioningState property: The JIT request provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the jitRequestState property: The JIT request state. + * + * @return the jitRequestState value. + */ + public JitRequestState jitRequestState() { + return this.innerProperties() == null ? null : this.innerProperties().jitRequestState(); + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.innerProperties() == null ? null : this.innerProperties().createdBy(); + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().updatedBy(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/JitRequestDefinitionListResultInner.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/JitRequestDefinitionListResultInner.java new file mode 100644 index 000000000000..fe5972de4d59 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/JitRequestDefinitionListResultInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of JIT requests. */ +@Fluent +public final class JitRequestDefinitionListResultInner { + /* + * The array of Jit request definition. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of JitRequestDefinitionListResultInner class. */ + public JitRequestDefinitionListResultInner() { + } + + /** + * Get the value property: The array of Jit request definition. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of Jit request definition. + * + * @param value the value value to set. + * @return the JitRequestDefinitionListResultInner object itself. + */ + public JitRequestDefinitionListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the JitRequestDefinitionListResultInner object itself. + */ + public JitRequestDefinitionListResultInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/JitRequestProperties.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/JitRequestProperties.java new file mode 100644 index 000000000000..4cdc214091d2 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/JitRequestProperties.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedapplications.models.ApplicationClientDetails; +import com.azure.resourcemanager.managedapplications.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.managedapplications.models.JitRequestState; +import com.azure.resourcemanager.managedapplications.models.JitSchedulingPolicy; +import com.azure.resourcemanager.managedapplications.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Information about JIT request properties. */ +@Fluent +public final class JitRequestProperties { + /* + * The parent application id. + */ + @JsonProperty(value = "applicationResourceId", required = true) + private String applicationResourceId; + + /* + * The publisher tenant id. + */ + @JsonProperty(value = "publisherTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String publisherTenantId; + + /* + * The JIT authorization policies. + */ + @JsonProperty(value = "jitAuthorizationPolicies", required = true) + private List jitAuthorizationPolicies; + + /* + * The JIT request properties. + */ + @JsonProperty(value = "jitSchedulingPolicy", required = true) + private JitSchedulingPolicy jitSchedulingPolicy; + + /* + * The JIT request provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The JIT request state. + */ + @JsonProperty(value = "jitRequestState", access = JsonProperty.Access.WRITE_ONLY) + private JitRequestState jitRequestState; + + /* + * The client entity that created the JIT request. + */ + @JsonProperty(value = "createdBy", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationClientDetails createdBy; + + /* + * The client entity that last updated the JIT request. + */ + @JsonProperty(value = "updatedBy", access = JsonProperty.Access.WRITE_ONLY) + private ApplicationClientDetails updatedBy; + + /** Creates an instance of JitRequestProperties class. */ + public JitRequestProperties() { + } + + /** + * Get the applicationResourceId property: The parent application id. + * + * @return the applicationResourceId value. + */ + public String applicationResourceId() { + return this.applicationResourceId; + } + + /** + * Set the applicationResourceId property: The parent application id. + * + * @param applicationResourceId the applicationResourceId value to set. + * @return the JitRequestProperties object itself. + */ + public JitRequestProperties withApplicationResourceId(String applicationResourceId) { + this.applicationResourceId = applicationResourceId; + return this; + } + + /** + * Get the publisherTenantId property: The publisher tenant id. + * + * @return the publisherTenantId value. + */ + public String publisherTenantId() { + return this.publisherTenantId; + } + + /** + * Get the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @return the jitAuthorizationPolicies value. + */ + public List jitAuthorizationPolicies() { + return this.jitAuthorizationPolicies; + } + + /** + * Set the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @param jitAuthorizationPolicies the jitAuthorizationPolicies value to set. + * @return the JitRequestProperties object itself. + */ + public JitRequestProperties withJitAuthorizationPolicies(List jitAuthorizationPolicies) { + this.jitAuthorizationPolicies = jitAuthorizationPolicies; + return this; + } + + /** + * Get the jitSchedulingPolicy property: The JIT request properties. + * + * @return the jitSchedulingPolicy value. + */ + public JitSchedulingPolicy jitSchedulingPolicy() { + return this.jitSchedulingPolicy; + } + + /** + * Set the jitSchedulingPolicy property: The JIT request properties. + * + * @param jitSchedulingPolicy the jitSchedulingPolicy value to set. + * @return the JitRequestProperties object itself. + */ + public JitRequestProperties withJitSchedulingPolicy(JitSchedulingPolicy jitSchedulingPolicy) { + this.jitSchedulingPolicy = jitSchedulingPolicy; + return this; + } + + /** + * Get the provisioningState property: The JIT request provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the jitRequestState property: The JIT request state. + * + * @return the jitRequestState value. + */ + public JitRequestState jitRequestState() { + return this.jitRequestState; + } + + /** + * Get the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + public ApplicationClientDetails createdBy() { + return this.createdBy; + } + + /** + * Get the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + public ApplicationClientDetails updatedBy() { + return this.updatedBy; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (applicationResourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property applicationResourceId in model JitRequestProperties")); + } + if (jitAuthorizationPolicies() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property jitAuthorizationPolicies in model JitRequestProperties")); + } else { + jitAuthorizationPolicies().forEach(e -> e.validate()); + } + if (jitSchedulingPolicy() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property jitSchedulingPolicy in model JitRequestProperties")); + } else { + jitSchedulingPolicy().validate(); + } + if (createdBy() != null) { + createdBy().validate(); + } + if (updatedBy() != null) { + updatedBy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JitRequestProperties.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ManagedIdentityTokenResultInner.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ManagedIdentityTokenResultInner.java new file mode 100644 index 000000000000..233862997bed --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/ManagedIdentityTokenResultInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managedapplications.models.ManagedIdentityToken; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The array of managed identity tokens. */ +@Fluent +public final class ManagedIdentityTokenResultInner { + /* + * The array of managed identity tokens. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of ManagedIdentityTokenResultInner class. */ + public ManagedIdentityTokenResultInner() { + } + + /** + * Get the value property: The array of managed identity tokens. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of managed identity tokens. + * + * @param value the value value to set. + * @return the ManagedIdentityTokenResultInner object itself. + */ + public ManagedIdentityTokenResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/OperationInner.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/OperationInner.java index 9e31927023de..09a31231b0cb 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/OperationInner.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/OperationInner.java @@ -5,30 +5,58 @@ package com.azure.resourcemanager.managedapplications.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.managedapplications.models.ActionType; import com.azure.resourcemanager.managedapplications.models.OperationDisplay; +import com.azure.resourcemanager.managedapplications.models.Origin; import com.fasterxml.jackson.annotation.JsonProperty; -/** Microsoft.Solutions operation. */ +/** + * REST API Operation + * + *

    Details of a REST API operation, returned from the Resource Provider Operations API. + */ @Fluent public final class OperationInner { /* - * Operation name: {provider}/{resource}/{operation} + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ - @JsonProperty(value = "name") + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* - * The object that represents the operation. + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. */ @JsonProperty(value = "display") private OperationDisplay display; + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + /** Creates an instance of OperationInner class. */ public OperationInner() { } /** - * Get the name property: Operation name: {provider}/{resource}/{operation}. + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". * * @return the name value. */ @@ -37,18 +65,17 @@ public String name() { } /** - * Set the name property: Operation name: {provider}/{resource}/{operation}. + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. * - * @param name the name value to set. - * @return the OperationInner object itself. + * @return the isDataAction value. */ - public OperationInner withName(String name) { - this.name = name; - return this; + public Boolean isDataAction() { + return this.isDataAction; } /** - * Get the display property: The object that represents the operation. + * Get the display property: Localized display information for this particular operation. * * @return the display value. */ @@ -57,7 +84,7 @@ public OperationDisplay display() { } /** - * Set the display property: The object that represents the operation. + * Set the display property: Localized display information for this particular operation. * * @param display the display value to set. * @return the OperationInner object itself. @@ -67,6 +94,26 @@ public OperationInner withDisplay(OperationDisplay display) { return this; } + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + /** * Validates the instance. * diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/UpdateAccessDefinitionInner.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/UpdateAccessDefinitionInner.java new file mode 100644 index 000000000000..bae8d298a7c7 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/fluent/models/UpdateAccessDefinitionInner.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedapplications.models.JitRequestMetadata; +import com.azure.resourcemanager.managedapplications.models.Status; +import com.azure.resourcemanager.managedapplications.models.Substatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Update access request definition. */ +@Fluent +public final class UpdateAccessDefinitionInner { + /* + * The approver name. + */ + @JsonProperty(value = "approver") + private String approver; + + /* + * The JIT request metadata. + */ + @JsonProperty(value = "metadata", required = true) + private JitRequestMetadata metadata; + + /* + * The JIT status. + */ + @JsonProperty(value = "status", required = true) + private Status status; + + /* + * The JIT status. + */ + @JsonProperty(value = "subStatus", required = true) + private Substatus subStatus; + + /** Creates an instance of UpdateAccessDefinitionInner class. */ + public UpdateAccessDefinitionInner() { + } + + /** + * Get the approver property: The approver name. + * + * @return the approver value. + */ + public String approver() { + return this.approver; + } + + /** + * Set the approver property: The approver name. + * + * @param approver the approver value to set. + * @return the UpdateAccessDefinitionInner object itself. + */ + public UpdateAccessDefinitionInner withApprover(String approver) { + this.approver = approver; + return this; + } + + /** + * Get the metadata property: The JIT request metadata. + * + * @return the metadata value. + */ + public JitRequestMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The JIT request metadata. + * + * @param metadata the metadata value to set. + * @return the UpdateAccessDefinitionInner object itself. + */ + public UpdateAccessDefinitionInner withMetadata(JitRequestMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the status property: The JIT status. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Set the status property: The JIT status. + * + * @param status the status value to set. + * @return the UpdateAccessDefinitionInner object itself. + */ + public UpdateAccessDefinitionInner withStatus(Status status) { + this.status = status; + return this; + } + + /** + * Get the subStatus property: The JIT status. + * + * @return the subStatus value. + */ + public Substatus subStatus() { + return this.subStatus; + } + + /** + * Set the subStatus property: The JIT status. + * + * @param subStatus the subStatus value to set. + * @return the UpdateAccessDefinitionInner object itself. + */ + public UpdateAccessDefinitionInner withSubStatus(Substatus subStatus) { + this.subStatus = subStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadata() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property metadata in model UpdateAccessDefinitionInner")); + } else { + metadata().validate(); + } + if (status() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model UpdateAccessDefinitionInner")); + } + if (subStatus() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property subStatus in model UpdateAccessDefinitionInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(UpdateAccessDefinitionInner.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/AllowedUpgradePlansResultImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/AllowedUpgradePlansResultImpl.java new file mode 100644 index 000000000000..85a5260133e9 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/AllowedUpgradePlansResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.implementation; + +import com.azure.resourcemanager.managedapplications.fluent.models.AllowedUpgradePlansResultInner; +import com.azure.resourcemanager.managedapplications.models.AllowedUpgradePlansResult; +import com.azure.resourcemanager.managedapplications.models.Plan; +import java.util.Collections; +import java.util.List; + +public final class AllowedUpgradePlansResultImpl implements AllowedUpgradePlansResult { + private AllowedUpgradePlansResultInner innerObject; + + private final com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager; + + AllowedUpgradePlansResultImpl( + AllowedUpgradePlansResultInner innerObject, + com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public AllowedUpgradePlansResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedapplications.ApplicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationClientBuilder.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationClientBuilder.java index b1aa4c4fc85c..ab3a16bc36c1 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationClientBuilder.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationClientBuilder.java @@ -137,7 +137,7 @@ public ApplicationClientImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationClientImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationClientImpl.java index 1540f73058dd..220b37f2ff0c 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationClientImpl.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationClientImpl.java @@ -25,6 +25,7 @@ import com.azure.resourcemanager.managedapplications.fluent.ApplicationClient; import com.azure.resourcemanager.managedapplications.fluent.ApplicationDefinitionsClient; import com.azure.resourcemanager.managedapplications.fluent.ApplicationsClient; +import com.azure.resourcemanager.managedapplications.fluent.JitRequestsClient; import com.azure.resourcemanager.managedapplications.fluent.ResourceProvidersClient; import java.io.IOException; import java.lang.reflect.Type; @@ -146,6 +147,18 @@ public ApplicationDefinitionsClient getApplicationDefinitions() { return this.applicationDefinitions; } + /** The JitRequestsClient object to access its operations. */ + private final JitRequestsClient jitRequests; + + /** + * Gets the JitRequestsClient object to access its operations. + * + * @return the JitRequestsClient object. + */ + public JitRequestsClient getJitRequests() { + return this.jitRequests; + } + /** * Initializes an instance of ApplicationClient client. * @@ -168,10 +181,11 @@ public ApplicationDefinitionsClient getApplicationDefinitions() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2018-06-01"; + this.apiVersion = "2021-07-01"; this.resourceProviders = new ResourceProvidersClientImpl(this); this.applications = new ApplicationsClientImpl(this); this.applicationDefinitions = new ApplicationDefinitionsClientImpl(this); + this.jitRequests = new JitRequestsClientImpl(this); } /** diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionImpl.java index 1431d994ed4e..9ed42df2c4cb 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionImpl.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionImpl.java @@ -5,13 +5,19 @@ package com.azure.resourcemanager.managedapplications.implementation; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; -import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; import com.azure.resourcemanager.managedapplications.models.ApplicationDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionPatchable; +import com.azure.resourcemanager.managedapplications.models.ApplicationDeploymentPolicy; import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; -import com.azure.resourcemanager.managedapplications.models.Identity; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationNotificationPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageLockingPolicyDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationPolicy; import com.azure.resourcemanager.managedapplications.models.Sku; import java.util.Collections; import java.util.List; @@ -56,8 +62,8 @@ public Sku sku() { return this.innerModel().sku(); } - public Identity identity() { - return this.innerModel().identity(); + public SystemData systemData() { + return this.innerModel().systemData(); } public ApplicationLockLevel lockLevel() { @@ -68,12 +74,12 @@ public String displayName() { return this.innerModel().displayName(); } - public String isEnabled() { + public Boolean isEnabled() { return this.innerModel().isEnabled(); } - public List authorizations() { - List inner = this.innerModel().authorizations(); + public List authorizations() { + List inner = this.innerModel().authorizations(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -81,8 +87,8 @@ public List authorizations() { } } - public List artifacts() { - List inner = this.innerModel().artifacts(); + public List artifacts() { + List inner = this.innerModel().artifacts(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -98,6 +104,10 @@ public String packageFileUri() { return this.innerModel().packageFileUri(); } + public String storageAccountId() { + return this.innerModel().storageAccountId(); + } + public Object mainTemplate() { return this.innerModel().mainTemplate(); } @@ -106,6 +116,31 @@ public Object createUiDefinition() { return this.innerModel().createUiDefinition(); } + public ApplicationNotificationPolicy notificationPolicy() { + return this.innerModel().notificationPolicy(); + } + + public ApplicationPackageLockingPolicyDefinition lockingPolicy() { + return this.innerModel().lockingPolicy(); + } + + public ApplicationDeploymentPolicy deploymentPolicy() { + return this.innerModel().deploymentPolicy(); + } + + public ApplicationManagementPolicy managementPolicy() { + return this.innerModel().managementPolicy(); + } + + public List policies() { + List inner = this.innerModel().policies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + public Region region() { return Region.fromName(this.regionName()); } @@ -130,6 +165,8 @@ private com.azure.resourcemanager.managedapplications.ApplicationManager manager private String applicationDefinitionName; + private ApplicationDefinitionPatchable updateParameters; + public ApplicationDefinitionImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; return this; @@ -140,7 +177,9 @@ public ApplicationDefinition create() { serviceManager .serviceClient() .getApplicationDefinitions() - .createOrUpdate(resourceGroupName, applicationDefinitionName, this.innerModel(), Context.NONE); + .createOrUpdateWithResponse( + resourceGroupName, applicationDefinitionName, this.innerModel(), Context.NONE) + .getValue(); return this; } @@ -149,7 +188,8 @@ public ApplicationDefinition create(Context context) { serviceManager .serviceClient() .getApplicationDefinitions() - .createOrUpdate(resourceGroupName, applicationDefinitionName, this.innerModel(), context); + .createOrUpdateWithResponse(resourceGroupName, applicationDefinitionName, this.innerModel(), context) + .getValue(); return this; } @@ -161,6 +201,7 @@ public ApplicationDefinition create(Context context) { } public ApplicationDefinitionImpl update() { + this.updateParameters = new ApplicationDefinitionPatchable(); return this; } @@ -169,7 +210,8 @@ public ApplicationDefinition apply() { serviceManager .serviceClient() .getApplicationDefinitions() - .createOrUpdate(resourceGroupName, applicationDefinitionName, this.innerModel(), Context.NONE); + .updateWithResponse(resourceGroupName, applicationDefinitionName, updateParameters, Context.NONE) + .getValue(); return this; } @@ -178,7 +220,8 @@ public ApplicationDefinition apply(Context context) { serviceManager .serviceClient() .getApplicationDefinitions() - .createOrUpdate(resourceGroupName, applicationDefinitionName, this.innerModel(), context); + .updateWithResponse(resourceGroupName, applicationDefinitionName, updateParameters, context) + .getValue(); return this; } @@ -226,14 +269,14 @@ public ApplicationDefinitionImpl withLockLevel(ApplicationLockLevel lockLevel) { return this; } - public ApplicationDefinitionImpl withAuthorizations(List authorizations) { - this.innerModel().withAuthorizations(authorizations); - return this; - } - public ApplicationDefinitionImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } } public ApplicationDefinitionImpl withManagedBy(String managedBy) { @@ -246,22 +289,22 @@ public ApplicationDefinitionImpl withSku(Sku sku) { return this; } - public ApplicationDefinitionImpl withIdentity(Identity identity) { - this.innerModel().withIdentity(identity); - return this; - } - public ApplicationDefinitionImpl withDisplayName(String displayName) { this.innerModel().withDisplayName(displayName); return this; } - public ApplicationDefinitionImpl withIsEnabled(String isEnabled) { + public ApplicationDefinitionImpl withIsEnabled(Boolean isEnabled) { this.innerModel().withIsEnabled(isEnabled); return this; } - public ApplicationDefinitionImpl withArtifacts(List artifacts) { + public ApplicationDefinitionImpl withAuthorizations(List authorizations) { + this.innerModel().withAuthorizations(authorizations); + return this; + } + + public ApplicationDefinitionImpl withArtifacts(List artifacts) { this.innerModel().withArtifacts(artifacts); return this; } @@ -276,6 +319,11 @@ public ApplicationDefinitionImpl withPackageFileUri(String packageFileUri) { return this; } + public ApplicationDefinitionImpl withStorageAccountId(String storageAccountId) { + this.innerModel().withStorageAccountId(storageAccountId); + return this; + } + public ApplicationDefinitionImpl withMainTemplate(Object mainTemplate) { this.innerModel().withMainTemplate(mainTemplate); return this; @@ -285,4 +333,33 @@ public ApplicationDefinitionImpl withCreateUiDefinition(Object createUiDefinitio this.innerModel().withCreateUiDefinition(createUiDefinition); return this; } + + public ApplicationDefinitionImpl withNotificationPolicy(ApplicationNotificationPolicy notificationPolicy) { + this.innerModel().withNotificationPolicy(notificationPolicy); + return this; + } + + public ApplicationDefinitionImpl withLockingPolicy(ApplicationPackageLockingPolicyDefinition lockingPolicy) { + this.innerModel().withLockingPolicy(lockingPolicy); + return this; + } + + public ApplicationDefinitionImpl withDeploymentPolicy(ApplicationDeploymentPolicy deploymentPolicy) { + this.innerModel().withDeploymentPolicy(deploymentPolicy); + return this; + } + + public ApplicationDefinitionImpl withManagementPolicy(ApplicationManagementPolicy managementPolicy) { + this.innerModel().withManagementPolicy(managementPolicy); + return this; + } + + public ApplicationDefinitionImpl withPolicies(List policies) { + this.innerModel().withPolicies(policies); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionsClientImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionsClientImpl.java index f33a5bdca978..ec35cee0d839 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionsClientImpl.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionsClientImpl.java @@ -12,6 +12,7 @@ import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; @@ -25,17 +26,13 @@ import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.polling.PollResult; +import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.managedapplications.fluent.ApplicationDefinitionsClient; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionListResult; -import com.azure.resourcemanager.managedapplications.models.ErrorResponseException; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionPatchable; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in ApplicationDefinitionsClient. */ @@ -67,70 +64,91 @@ public final class ApplicationDefinitionsClientImpl implements ApplicationDefini public interface ApplicationDefinitionsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applicationDefinitions/{applicationDefinitionName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("applicationDefinitionName") String applicationDefinitionName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationDefinitionName") String applicationDefinitionName, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applicationDefinitions/{applicationDefinitionName}") - @ExpectedResponses({200, 202, 204}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono>> delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("applicationDefinitionName") String applicationDefinitionName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationDefinitionName") String applicationDefinitionName, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applicationDefinitions/{applicationDefinitionName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}") @ExpectedResponses({200, 201}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono>> createOrUpdate( + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("applicationDefinitionName") String applicationDefinitionName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationDefinitionName") String applicationDefinitionName, @BodyParam("application/json") ApplicationDefinitionInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationDefinitionName") String applicationDefinitionName, + @BodyParam("application/json") ApplicationDefinitionPatchable parameters, + @HeaderParam("Accept") String accept, + Context context); + @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applicationDefinitions") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applicationDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applicationDefinitions/{applicationDefinitionName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> getById( @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @@ -142,11 +160,10 @@ Mono> getById( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applicationDefinitions/{applicationDefinitionName}") - @ExpectedResponses({200, 202, 204}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono>> deleteById( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteById( @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("applicationDefinitionName") String applicationDefinitionName, @@ -157,11 +174,10 @@ Mono>> deleteById( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applicationDefinitions/{applicationDefinitionName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}") @ExpectedResponses({200, 201}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono>> createOrUpdateById( + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdateById( @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("applicationDefinitionName") String applicationDefinitionName, @@ -171,15 +187,40 @@ Mono>> createOrUpdateById( @HeaderParam("Accept") String accept, Context context); + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateById( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationDefinitionName") String applicationDefinitionName, + @BodyParam("application/json") ApplicationDefinitionPatchable parameters, + @HeaderParam("Accept") String accept, + Context context); + @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); } /** @@ -188,7 +229,7 @@ Mono> listByResourceGroupNext( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition along with {@link Response} on successful completion of {@link Mono}. */ @@ -201,6 +242,12 @@ private Mono> getByResourceGroupWithRespons new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -211,12 +258,6 @@ private Mono> getByResourceGroupWithRespons new IllegalArgumentException( "Parameter applicationDefinitionName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext( @@ -224,10 +265,10 @@ private Mono> getByResourceGroupWithRespons service .getByResourceGroup( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationDefinitionName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationDefinitionName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -240,7 +281,7 @@ private Mono> getByResourceGroupWithRespons * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition along with {@link Response} on successful completion of {@link Mono}. */ @@ -253,6 +294,12 @@ private Mono> getByResourceGroupWithRespons new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -263,21 +310,15 @@ private Mono> getByResourceGroupWithRespons new IllegalArgumentException( "Parameter applicationDefinitionName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; context = this.client.mergeContext(context); return service .getByResourceGroup( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationDefinitionName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationDefinitionName, accept, context); } @@ -288,7 +329,7 @@ private Mono> getByResourceGroupWithRespons * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition on successful completion of {@link Mono}. */ @@ -306,7 +347,7 @@ private Mono getByResourceGroupAsync( * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition along with {@link Response}. */ @@ -322,7 +363,7 @@ public Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition. */ @@ -335,21 +376,26 @@ public ApplicationDefinitionInner getByResourceGroup(String resourceGroupName, S * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. + * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync( - String resourceGroupName, String applicationDefinitionName) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String applicationDefinitionName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -360,12 +406,6 @@ private Mono>> deleteWithResponseAsync( new IllegalArgumentException( "Parameter applicationDefinitionName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext( @@ -373,10 +413,10 @@ private Mono>> deleteWithResponseAsync( service .delete( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationDefinitionName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationDefinitionName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -386,15 +426,15 @@ private Mono>> deleteWithResponseAsync( * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. + * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync( + private Mono> deleteWithResponseAsync( String resourceGroupName, String applicationDefinitionName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -402,6 +442,12 @@ private Mono>> deleteWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -412,21 +458,15 @@ private Mono>> deleteWithResponseAsync( new IllegalArgumentException( "Parameter applicationDefinitionName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationDefinitionName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationDefinitionName, accept, context); } @@ -435,154 +475,62 @@ private Mono>> deleteWithResponseAsync( * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync( - String resourceGroupName, String applicationDefinitionName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, applicationDefinitionName); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); - } - - /** - * Deletes the managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync( - String resourceGroupName, String applicationDefinitionName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = - deleteWithResponseAsync(resourceGroupName, applicationDefinitionName, context); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); - } - - /** - * Deletes the managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String applicationDefinitionName) { - return this.beginDeleteAsync(resourceGroupName, applicationDefinitionName).getSyncPoller(); - } - - /** - * Deletes the managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete( - String resourceGroupName, String applicationDefinitionName, Context context) { - return this.beginDeleteAsync(resourceGroupName, applicationDefinitionName, context).getSyncPoller(); - } - - /** - * Deletes the managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. + * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String applicationDefinitionName) { - return beginDeleteAsync(resourceGroupName, applicationDefinitionName) - .last() - .flatMap(this.client::getLroFinalResultOrError); + return deleteWithResponseAsync(resourceGroupName, applicationDefinitionName).flatMap(ignored -> Mono.empty()); } /** * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. + * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String applicationDefinitionName, Context context) { - return beginDeleteAsync(resourceGroupName, applicationDefinitionName, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); + public Response deleteWithResponse( + String resourceGroupName, String applicationDefinitionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, applicationDefinitionName, context).block(); } /** * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. + * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String applicationDefinitionName) { - deleteAsync(resourceGroupName, applicationDefinitionName).block(); - } - - /** - * Deletes the managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String applicationDefinitionName, Context context) { - deleteAsync(resourceGroupName, applicationDefinitionName, context).block(); + deleteWithResponse(resourceGroupName, applicationDefinitionName, Context.NONE); } /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update an managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application definition along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync( + private Mono> createOrUpdateWithResponseAsync( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { if (this.client.getEndpoint() == null) { return Mono @@ -590,6 +538,12 @@ private Mono>> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -600,12 +554,6 @@ private Mono>> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter applicationDefinitionName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } if (parameters == null) { return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { @@ -618,10 +566,10 @@ private Mono>> createOrUpdateWithResponseAsync( service .createOrUpdate( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationDefinitionName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationDefinitionName, parameters, accept, context)) @@ -629,20 +577,20 @@ private Mono>> createOrUpdateWithResponseAsync( } /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update an managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application definition along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync( + private Mono> createOrUpdateWithResponseAsync( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters, @@ -653,6 +601,12 @@ private Mono>> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -663,12 +617,6 @@ private Mono>> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter applicationDefinitionName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } if (parameters == null) { return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { @@ -679,190 +627,246 @@ private Mono>> createOrUpdateWithResponseAsync( return service .createOrUpdate( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationDefinitionName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationDefinitionName, parameters, accept, context); } /** - * Creates a new managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update an managed application definition. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of information about managed application definition. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ApplicationDefinitionInner> beginCreateOrUpdateAsync( - String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { - Mono>> mono = - createOrUpdateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - ApplicationDefinitionInner.class, - ApplicationDefinitionInner.class, - this.client.getContext()); - } - - /** - * Creates a new managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update an managed application definition. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of information about managed application definition. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ApplicationDefinitionInner> beginCreateOrUpdateAsync( - String resourceGroupName, - String applicationDefinitionName, - ApplicationDefinitionInner parameters, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = - createOrUpdateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters, context); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - ApplicationDefinitionInner.class, - ApplicationDefinitionInner.class, - context); - } - - /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update an managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of information about managed application definition. + * @return information about managed application definition on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdate( + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { - return this.beginCreateOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters).getSyncPoller(); + return createOrUpdateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update an managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of information about managed application definition. + * @return information about managed application definition along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdate( + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters, Context context) { - return this - .beginCreateOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters, context) - .getSyncPoller(); + return createOrUpdateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters, context) + .block(); } /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update an managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application definition on successful completion of {@link Mono}. + * @return information about managed application definition. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync( + public ApplicationDefinitionInner createOrUpdate( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { - return beginCreateOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + return createOrUpdateWithResponse(resourceGroupName, applicationDefinitionName, parameters, Context.NONE) + .getValue(); } /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update an managed application definition. - * @param context The context to associate with this operation. + * @param parameters Parameters supplied to the update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application definition on successful completion of {@link Mono}. + * @return information about managed application definition along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync( - String resourceGroupName, - String applicationDefinitionName, - ApplicationDefinitionInner parameters, - Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Creates a new managed application definition. - * + private Mono> updateWithResponseAsync( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the managed application definition. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update an managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application definition. + * @return information about managed application definition along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ApplicationDefinitionInner createOrUpdate( - String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { - return createOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters).block(); + private Mono> updateWithResponseAsync( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionPatchable parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + parameters, + accept, + context); } /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update an managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { + return updateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application definition. + * @return information about managed application definition along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ApplicationDefinitionInner createOrUpdate( + public Response updateWithResponse( String resourceGroupName, String applicationDefinitionName, - ApplicationDefinitionInner parameters, + ApplicationDefinitionPatchable parameters, Context context) { - return createOrUpdateAsync(resourceGroupName, applicationDefinitionName, parameters, context).block(); + return updateWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters, context).block(); + } + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationDefinitionInner update( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { + return updateWithResponse(resourceGroupName, applicationDefinitionName, parameters, Context.NONE).getValue(); } /** @@ -870,7 +874,7 @@ public ApplicationDefinitionInner createOrUpdate( * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions along with {@link PagedResponse} on successful completion of * {@link Mono}. @@ -884,16 +888,16 @@ private Mono> listByResourceGroupSingl new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } final String accept = "application/json"; return FluxUtil .withContext( @@ -901,9 +905,9 @@ private Mono> listByResourceGroupSingl service .listByResourceGroup( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context)) .>map( @@ -924,7 +928,7 @@ private Mono> listByResourceGroupSingl * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions along with {@link PagedResponse} on successful completion of * {@link Mono}. @@ -938,24 +942,24 @@ private Mono> listByResourceGroupSingl new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByResourceGroup( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context) .map( @@ -974,7 +978,7 @@ private Mono> listByResourceGroupSingl * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions as paginated response with {@link PagedFlux}. */ @@ -991,7 +995,7 @@ private PagedFlux listByResourceGroupAsync(String re * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions as paginated response with {@link PagedFlux}. */ @@ -1007,7 +1011,7 @@ private PagedFlux listByResourceGroupAsync(String re * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions as paginated response with {@link PagedIterable}. */ @@ -1022,7 +1026,7 @@ public PagedIterable listByResourceGroup(String reso * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions as paginated response with {@link PagedIterable}. */ @@ -1032,34 +1036,21 @@ public PagedIterable listByResourceGroup(String reso } /** - * Gets the managed application definition. + * Lists all the application definitions within a subscription. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the managed application definition along with {@link Response} on successful completion of {@link Mono}. + * @return list of managed application definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByIdWithResponseAsync( - String resourceGroupName, String applicationDefinitionName) { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (applicationDefinitionName == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter applicationDefinitionName is required and cannot be null.")); - } if (this.client.getSubscriptionId() == null) { return Mono .error( @@ -1071,47 +1062,42 @@ private Mono> getByIdWithResponseAsync( .withContext( context -> service - .getById( + .list( this.client.getEndpoint(), - resourceGroupName, - applicationDefinitionName, - this.client.getApiVersion(), this.client.getSubscriptionId(), + this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Gets the managed application definition. + * Lists all the application definitions within a subscription. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the managed application definition along with {@link Response} on successful completion of {@link Mono}. + * @return list of managed application definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByIdWithResponseAsync( - String resourceGroupName, String applicationDefinitionName, Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (applicationDefinitionName == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter applicationDefinitionName is required and cannot be null.")); - } if (this.client.getSubscriptionId() == null) { return Mono .error( @@ -1121,76 +1107,89 @@ private Mono> getByIdWithResponseAsync( final String accept = "application/json"; context = this.client.mergeContext(context); return service - .getById( + .list( this.client.getEndpoint(), - resourceGroupName, - applicationDefinitionName, - this.client.getApiVersion(), this.client.getSubscriptionId(), + this.client.getApiVersion(), accept, - context); + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); } /** - * Gets the managed application definition. + * Lists all the application definitions within a subscription. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the managed application definition on successful completion of {@link Mono}. + * @return list of managed application definitions as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByIdAsync(String resourceGroupName, String applicationDefinitionName) { - return getByIdWithResponseAsync(resourceGroupName, applicationDefinitionName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** - * Gets the managed application definition. + * Lists all the application definitions within a subscription. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the managed application definition along with {@link Response}. + * @return list of managed application definitions as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByIdWithResponse( - String resourceGroupName, String applicationDefinitionName, Context context) { - return getByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); } /** - * Gets the managed application definition. + * Lists all the application definitions within a subscription. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the application definitions within a subscription. + * + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the managed application definition. + * @return list of managed application definitions as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ApplicationDefinitionInner getById(String resourceGroupName, String applicationDefinitionName) { - return getByIdWithResponse(resourceGroupName, applicationDefinitionName, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); } /** - * Deletes the managed application definition. + * Gets the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the managed application definition along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteByIdWithResponseAsync( + private Mono> getByIdWithResponseAsync( String resourceGroupName, String applicationDefinitionName) { if (this.client.getEndpoint() == null) { return Mono @@ -1219,7 +1218,7 @@ private Mono>> deleteByIdWithResponseAsync( .withContext( context -> service - .deleteById( + .getById( this.client.getEndpoint(), resourceGroupName, applicationDefinitionName, @@ -1231,18 +1230,18 @@ private Mono>> deleteByIdWithResponseAsync( } /** - * Deletes the managed application definition. + * Gets the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the managed application definition along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteByIdWithResponseAsync( + private Mono> getByIdWithResponseAsync( String resourceGroupName, String applicationDefinitionName, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -1269,7 +1268,7 @@ private Mono>> deleteByIdWithResponseAsync( final String accept = "application/json"; context = this.client.mergeContext(context); return service - .deleteById( + .getById( this.client.getEndpoint(), resourceGroupName, applicationDefinitionName, @@ -1280,46 +1279,51 @@ private Mono>> deleteByIdWithResponseAsync( } /** - * Deletes the managed application definition. + * Gets the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the managed application definition on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteByIdAsync( - String resourceGroupName, String applicationDefinitionName) { - Mono>> mono = - deleteByIdWithResponseAsync(resourceGroupName, applicationDefinitionName); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByIdAsync(String resourceGroupName, String applicationDefinitionName) { + return getByIdWithResponseAsync(resourceGroupName, applicationDefinitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Deletes the managed application definition. + * Gets the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the managed application definition along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteByIdAsync( + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByIdWithResponse( String resourceGroupName, String applicationDefinitionName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = - deleteByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, context); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + return getByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, context).block(); + } + + /** + * Gets the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed application definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationDefinitionInner getById(String resourceGroupName, String applicationDefinitionName) { + return getByIdWithResponse(resourceGroupName, applicationDefinitionName, Context.NONE).getValue(); } /** @@ -1328,14 +1332,49 @@ private PollerFlux, Void> beginDeleteByIdAsync( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return the {@link Response} on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDeleteById( + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByIdWithResponseAsync( String resourceGroupName, String applicationDefinitionName) { - return this.beginDeleteByIdAsync(resourceGroupName, applicationDefinitionName).getSyncPoller(); + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteById( + this.client.getEndpoint(), + resourceGroupName, + applicationDefinitionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1345,14 +1384,46 @@ public SyncPoller, Void> beginDeleteById( * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return the {@link Response} on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDeleteById( + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByIdWithResponseAsync( String resourceGroupName, String applicationDefinitionName, Context context) { - return this.beginDeleteByIdAsync(resourceGroupName, applicationDefinitionName, context).getSyncPoller(); + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteById( + this.client.getEndpoint(), + resourceGroupName, + applicationDefinitionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); } /** @@ -1361,15 +1432,14 @@ public SyncPoller, Void> beginDeleteById( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteByIdAsync(String resourceGroupName, String applicationDefinitionName) { - return beginDeleteByIdAsync(resourceGroupName, applicationDefinitionName) - .last() - .flatMap(this.client::getLroFinalResultOrError); + return deleteByIdWithResponseAsync(resourceGroupName, applicationDefinitionName) + .flatMap(ignored -> Mono.empty()); } /** @@ -1379,15 +1449,14 @@ private Mono deleteByIdAsync(String resourceGroupName, String applicationD * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteByIdAsync(String resourceGroupName, String applicationDefinitionName, Context context) { - return beginDeleteByIdAsync(resourceGroupName, applicationDefinitionName, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); + public Response deleteByIdWithResponse( + String resourceGroupName, String applicationDefinitionName, Context context) { + return deleteByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, context).block(); } /** @@ -1396,43 +1465,28 @@ private Mono deleteByIdAsync(String resourceGroupName, String applicationD * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) public void deleteById(String resourceGroupName, String applicationDefinitionName) { - deleteByIdAsync(resourceGroupName, applicationDefinitionName).block(); + deleteByIdWithResponse(resourceGroupName, applicationDefinitionName, Context.NONE); } /** - * Deletes the managed application definition. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteById(String resourceGroupName, String applicationDefinitionName, Context context) { - deleteByIdAsync(resourceGroupName, applicationDefinitionName, context).block(); - } - - /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application definition along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateByIdWithResponseAsync( + private Mono> createOrUpdateByIdWithResponseAsync( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { if (this.client.getEndpoint() == null) { return Mono @@ -1479,20 +1533,20 @@ private Mono>> createOrUpdateByIdWithResponseAsync( } /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application definition along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateByIdWithResponseAsync( + private Mono> createOrUpdateByIdWithResponseAsync( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters, @@ -1539,182 +1593,314 @@ private Mono>> createOrUpdateByIdWithResponseAsync( } /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of information about managed application definition. + * @return information about managed application definition on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ApplicationDefinitionInner> beginCreateOrUpdateByIdAsync( + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateByIdAsync( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { - Mono>> mono = - createOrUpdateByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - ApplicationDefinitionInner.class, - ApplicationDefinitionInner.class, - this.client.getContext()); + return createOrUpdateByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of information about managed application definition. + * @return information about managed application definition along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ApplicationDefinitionInner> beginCreateOrUpdateByIdAsync( + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateByIdWithResponse( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = - createOrUpdateByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters, context); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - ApplicationDefinitionInner.class, - ApplicationDefinitionInner.class, - context); + return createOrUpdateByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters, context) + .block(); } /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of information about managed application definition. + * @return information about managed application definition. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdateById( + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationDefinitionInner createOrUpdateById( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { - return this - .beginCreateOrUpdateByIdAsync(resourceGroupName, applicationDefinitionName, parameters) - .getSyncPoller(); + return createOrUpdateByIdWithResponse(resourceGroupName, applicationDefinitionName, parameters, Context.NONE) + .getValue(); } /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update a managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateByIdWithResponseAsync( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateById( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of information about managed application definition. + * @return information about managed application definition along with {@link Response} on successful completion of + * {@link Mono}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ApplicationDefinitionInner> beginCreateOrUpdateById( + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateByIdWithResponseAsync( String resourceGroupName, String applicationDefinitionName, - ApplicationDefinitionInner parameters, + ApplicationDefinitionPatchable parameters, Context context) { - return this - .beginCreateOrUpdateByIdAsync(resourceGroupName, applicationDefinitionName, parameters, context) - .getSyncPoller(); + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter applicationDefinitionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateById( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationDefinitionName, + parameters, + accept, + context); } /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update a managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application definition on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateByIdAsync( - String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { - return beginCreateOrUpdateByIdAsync(resourceGroupName, applicationDefinitionName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + private Mono updateByIdAsync( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { + return updateByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update a managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application definition on successful completion of {@link Mono}. + * @return information about managed application definition along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateByIdAsync( + public Response updateByIdWithResponse( String resourceGroupName, String applicationDefinitionName, - ApplicationDefinitionInner parameters, + ApplicationDefinitionPatchable parameters, Context context) { - return beginCreateOrUpdateByIdAsync(resourceGroupName, applicationDefinitionName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); + return updateByIdWithResponseAsync(resourceGroupName, applicationDefinitionName, parameters, context).block(); } /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update a managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application definition. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ApplicationDefinitionInner createOrUpdateById( - String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters) { - return createOrUpdateByIdAsync(resourceGroupName, applicationDefinitionName, parameters).block(); + public ApplicationDefinitionInner updateById( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { + return updateByIdWithResponse(resourceGroupName, applicationDefinitionName, parameters, Context.NONE) + .getValue(); } /** - * Creates a new managed application definition. + * Get the next page of items. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update a managed application definition. + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application definition. + * @return list of managed application definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ApplicationDefinitionInner createOrUpdateById( - String resourceGroupName, - String applicationDefinitionName, - ApplicationDefinitionInner parameters, - Context context) { - return createOrUpdateByIdAsync(resourceGroupName, applicationDefinitionName, parameters, context).block(); + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); } /** @@ -1723,13 +1909,13 @@ public ApplicationDefinitionInner createOrUpdateById( * @param nextLink The URL to get the next list of items *

    The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -1742,7 +1928,7 @@ private Mono> listByResourceGroupNextS final String accept = "application/json"; return FluxUtil .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) .>map( res -> new PagedResponseBase<>( @@ -1762,13 +1948,13 @@ private Mono> listByResourceGroupNextS *

    The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync( + private Mono> listBySubscriptionNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -1782,7 +1968,7 @@ private Mono> listByResourceGroupNextS final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionsImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionsImpl.java index 7425bb814bd0..f017f0d08ab2 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionsImpl.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationDefinitionsImpl.java @@ -12,6 +12,7 @@ import com.azure.resourcemanager.managedapplications.fluent.ApplicationDefinitionsClient; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; import com.azure.resourcemanager.managedapplications.models.ApplicationDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionPatchable; import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitions; public final class ApplicationDefinitionsImpl implements ApplicationDefinitions { @@ -53,12 +54,13 @@ public ApplicationDefinition getByResourceGroup(String resourceGroupName, String } } - public void deleteByResourceGroup(String resourceGroupName, String applicationDefinitionName) { - this.serviceClient().delete(resourceGroupName, applicationDefinitionName); + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String applicationDefinitionName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, applicationDefinitionName, context); } - public void delete(String resourceGroupName, String applicationDefinitionName, Context context) { - this.serviceClient().delete(resourceGroupName, applicationDefinitionName, context); + public void deleteByResourceGroup(String resourceGroupName, String applicationDefinitionName) { + this.serviceClient().delete(resourceGroupName, applicationDefinitionName); } public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -72,6 +74,16 @@ public PagedIterable listByResourceGroup(String resourceG return Utils.mapPage(inner, inner1 -> new ApplicationDefinitionImpl(inner1, this.manager())); } + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ApplicationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ApplicationDefinitionImpl(inner1, this.manager())); + } + public Response getByIdWithResponse( String resourceGroupName, String applicationDefinitionName, Context context) { Response inner = @@ -96,12 +108,33 @@ public ApplicationDefinition getById(String resourceGroupName, String applicatio } } + public Response deleteByIdWithResponse( + String resourceGroupName, String applicationDefinitionName, Context context) { + return this.serviceClient().deleteByIdWithResponse(resourceGroupName, applicationDefinitionName, context); + } + public void deleteById(String resourceGroupName, String applicationDefinitionName) { this.serviceClient().deleteById(resourceGroupName, applicationDefinitionName); } - public void deleteById(String resourceGroupName, String applicationDefinitionName, Context context) { - this.serviceClient().deleteById(resourceGroupName, applicationDefinitionName, context); + public Response createOrUpdateByIdWithResponse( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateByIdWithResponse(resourceGroupName, applicationDefinitionName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } } public ApplicationDefinition createOrUpdateById( @@ -115,13 +148,30 @@ public ApplicationDefinition createOrUpdateById( } } - public ApplicationDefinition createOrUpdateById( + public Response updateByIdWithResponse( String resourceGroupName, String applicationDefinitionName, - ApplicationDefinitionInner parameters, + ApplicationDefinitionPatchable parameters, Context context) { + Response inner = + this + .serviceClient() + .updateByIdWithResponse(resourceGroupName, applicationDefinitionName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ApplicationDefinition updateById( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters) { ApplicationDefinitionInner inner = - this.serviceClient().createOrUpdateById(resourceGroupName, applicationDefinitionName, parameters, context); + this.serviceClient().updateById(resourceGroupName, applicationDefinitionName, parameters); if (inner != null) { return new ApplicationDefinitionImpl(inner, this.manager()); } else { diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationImpl.java index 7ee99213432a..b385e282c195 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationImpl.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationImpl.java @@ -4,17 +4,31 @@ package com.azure.resourcemanager.managedapplications.implementation; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationInner; +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.AllowedUpgradePlansResult; import com.azure.resourcemanager.managedapplications.models.Application; -import com.azure.resourcemanager.managedapplications.models.ApplicationPatchable; +import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; +import com.azure.resourcemanager.managedapplications.models.ApplicationBillingDetailsDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationClientDetails; +import com.azure.resourcemanager.managedapplications.models.ApplicationJitAccessPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementMode; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageContact; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageSupportUrls; import com.azure.resourcemanager.managedapplications.models.Identity; +import com.azure.resourcemanager.managedapplications.models.ListTokenRequest; +import com.azure.resourcemanager.managedapplications.models.ManagedIdentityTokenResult; import com.azure.resourcemanager.managedapplications.models.Plan; -import com.azure.resourcemanager.managedapplications.models.PlanPatchable; import com.azure.resourcemanager.managedapplications.models.ProvisioningState; import com.azure.resourcemanager.managedapplications.models.Sku; +import com.azure.resourcemanager.managedapplications.models.UpdateAccessDefinition; import java.util.Collections; +import java.util.List; import java.util.Map; public final class ApplicationImpl implements Application, Application.Definition, Application.Update { @@ -55,8 +69,8 @@ public Sku sku() { return this.innerModel().sku(); } - public Identity identity() { - return this.innerModel().identity(); + public SystemData systemData() { + return this.innerModel().systemData(); } public Plan plan() { @@ -67,6 +81,10 @@ public String kind() { return this.innerModel().kind(); } + public Identity identity() { + return this.innerModel().identity(); + } + public String managedResourceGroupId() { return this.innerModel().managedResourceGroupId(); } @@ -87,6 +105,56 @@ public ProvisioningState provisioningState() { return this.innerModel().provisioningState(); } + public ApplicationBillingDetailsDefinition billingDetails() { + return this.innerModel().billingDetails(); + } + + public ApplicationJitAccessPolicy jitAccessPolicy() { + return this.innerModel().jitAccessPolicy(); + } + + public String publisherTenantId() { + return this.innerModel().publisherTenantId(); + } + + public List authorizations() { + List inner = this.innerModel().authorizations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApplicationManagementMode managementMode() { + return this.innerModel().managementMode(); + } + + public ApplicationPackageContact customerSupport() { + return this.innerModel().customerSupport(); + } + + public ApplicationPackageSupportUrls supportUrls() { + return this.innerModel().supportUrls(); + } + + public List artifacts() { + List inner = this.innerModel().artifacts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApplicationClientDetails createdBy() { + return this.innerModel().createdBy(); + } + + public ApplicationClientDetails updatedBy() { + return this.innerModel().updatedBy(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -111,8 +179,6 @@ private com.azure.resourcemanager.managedapplications.ApplicationManager manager private String applicationName; - private ApplicationPatchable updateParameters; - public ApplicationImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; return this; @@ -143,7 +209,6 @@ public Application create(Context context) { } public ApplicationImpl update() { - this.updateParameters = new ApplicationPatchable(); return this; } @@ -152,8 +217,7 @@ public Application apply() { serviceManager .serviceClient() .getApplications() - .updateWithResponse(resourceGroupName, applicationName, updateParameters, Context.NONE) - .getValue(); + .createOrUpdate(resourceGroupName, applicationName, this.innerModel(), Context.NONE); return this; } @@ -162,8 +226,7 @@ public Application apply(Context context) { serviceManager .serviceClient() .getApplications() - .updateWithResponse(resourceGroupName, applicationName, updateParameters, context) - .getValue(); + .createOrUpdate(resourceGroupName, applicationName, this.innerModel(), context); return this; } @@ -195,6 +258,42 @@ public Application refresh(Context context) { return this; } + public void refreshPermissions() { + serviceManager.applications().refreshPermissions(resourceGroupName, applicationName); + } + + public void refreshPermissions(Context context) { + serviceManager.applications().refreshPermissions(resourceGroupName, applicationName, context); + } + + public Response listAllowedUpgradePlansWithResponse(Context context) { + return serviceManager + .applications() + .listAllowedUpgradePlansWithResponse(resourceGroupName, applicationName, context); + } + + public AllowedUpgradePlansResult listAllowedUpgradePlans() { + return serviceManager.applications().listAllowedUpgradePlans(resourceGroupName, applicationName); + } + + public UpdateAccessDefinition updateAccess(UpdateAccessDefinitionInner parameters) { + return serviceManager.applications().updateAccess(resourceGroupName, applicationName, parameters); + } + + public UpdateAccessDefinition updateAccess(UpdateAccessDefinitionInner parameters, Context context) { + return serviceManager.applications().updateAccess(resourceGroupName, applicationName, parameters, context); + } + + public Response listTokensWithResponse(ListTokenRequest parameters, Context context) { + return serviceManager + .applications() + .listTokensWithResponse(resourceGroupName, applicationName, parameters, context); + } + + public ManagedIdentityTokenResult listTokens(ListTokenRequest parameters) { + return serviceManager.applications().listTokens(resourceGroupName, applicationName, parameters); + } + public ApplicationImpl withRegion(Region location) { this.innerModel().withLocation(location.toString()); return this; @@ -206,96 +305,52 @@ public ApplicationImpl withRegion(String location) { } public ApplicationImpl withKind(String kind) { - if (isInCreateMode()) { - this.innerModel().withKind(kind); - return this; - } else { - this.updateParameters.withKind(kind); - return this; - } - } - - public ApplicationImpl withManagedResourceGroupId(String managedResourceGroupId) { - if (isInCreateMode()) { - this.innerModel().withManagedResourceGroupId(managedResourceGroupId); - return this; - } else { - this.updateParameters.withManagedResourceGroupId(managedResourceGroupId); - return this; - } + this.innerModel().withKind(kind); + return this; } public ApplicationImpl withTags(Map tags) { - if (isInCreateMode()) { - this.innerModel().withTags(tags); - return this; - } else { - this.updateParameters.withTags(tags); - return this; - } + this.innerModel().withTags(tags); + return this; } public ApplicationImpl withManagedBy(String managedBy) { - if (isInCreateMode()) { - this.innerModel().withManagedBy(managedBy); - return this; - } else { - this.updateParameters.withManagedBy(managedBy); - return this; - } + this.innerModel().withManagedBy(managedBy); + return this; } public ApplicationImpl withSku(Sku sku) { - if (isInCreateMode()) { - this.innerModel().withSku(sku); - return this; - } else { - this.updateParameters.withSku(sku); - return this; - } + this.innerModel().withSku(sku); + return this; + } + + public ApplicationImpl withPlan(Plan plan) { + this.innerModel().withPlan(plan); + return this; } public ApplicationImpl withIdentity(Identity identity) { - if (isInCreateMode()) { - this.innerModel().withIdentity(identity); - return this; - } else { - this.updateParameters.withIdentity(identity); - return this; - } + this.innerModel().withIdentity(identity); + return this; } - public ApplicationImpl withPlan(Plan plan) { - this.innerModel().withPlan(plan); + public ApplicationImpl withManagedResourceGroupId(String managedResourceGroupId) { + this.innerModel().withManagedResourceGroupId(managedResourceGroupId); return this; } public ApplicationImpl withApplicationDefinitionId(String applicationDefinitionId) { - if (isInCreateMode()) { - this.innerModel().withApplicationDefinitionId(applicationDefinitionId); - return this; - } else { - this.updateParameters.withApplicationDefinitionId(applicationDefinitionId); - return this; - } + this.innerModel().withApplicationDefinitionId(applicationDefinitionId); + return this; } public ApplicationImpl withParameters(Object parameters) { - if (isInCreateMode()) { - this.innerModel().withParameters(parameters); - return this; - } else { - this.updateParameters.withParameters(parameters); - return this; - } - } - - public ApplicationImpl withPlan(PlanPatchable plan) { - this.updateParameters.withPlan(plan); + this.innerModel().withParameters(parameters); return this; } - private boolean isInCreateMode() { - return this.innerModel().id() == null; + public ApplicationImpl withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy) { + this.innerModel().withJitAccessPolicy(jitAccessPolicy); + return this; } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationPatchableImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationPatchableImpl.java new file mode 100644 index 000000000000..c4201a400a61 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationPatchableImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; +import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; +import com.azure.resourcemanager.managedapplications.models.ApplicationBillingDetailsDefinition; +import com.azure.resourcemanager.managedapplications.models.ApplicationClientDetails; +import com.azure.resourcemanager.managedapplications.models.ApplicationJitAccessPolicy; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementMode; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageContact; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageSupportUrls; +import com.azure.resourcemanager.managedapplications.models.ApplicationPatchable; +import com.azure.resourcemanager.managedapplications.models.Identity; +import com.azure.resourcemanager.managedapplications.models.PlanPatchable; +import com.azure.resourcemanager.managedapplications.models.ProvisioningState; +import com.azure.resourcemanager.managedapplications.models.Sku; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ApplicationPatchableImpl implements ApplicationPatchable { + private ApplicationPatchableInner innerObject; + + private final com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager; + + ApplicationPatchableImpl( + ApplicationPatchableInner innerObject, + com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String managedBy() { + return this.innerModel().managedBy(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public PlanPatchable plan() { + return this.innerModel().plan(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public String managedResourceGroupId() { + return this.innerModel().managedResourceGroupId(); + } + + public String applicationDefinitionId() { + return this.innerModel().applicationDefinitionId(); + } + + public Object parameters() { + return this.innerModel().parameters(); + } + + public Object outputs() { + return this.innerModel().outputs(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ApplicationBillingDetailsDefinition billingDetails() { + return this.innerModel().billingDetails(); + } + + public ApplicationJitAccessPolicy jitAccessPolicy() { + return this.innerModel().jitAccessPolicy(); + } + + public String publisherTenantId() { + return this.innerModel().publisherTenantId(); + } + + public List authorizations() { + List inner = this.innerModel().authorizations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApplicationManagementMode managementMode() { + return this.innerModel().managementMode(); + } + + public ApplicationPackageContact customerSupport() { + return this.innerModel().customerSupport(); + } + + public ApplicationPackageSupportUrls supportUrls() { + return this.innerModel().supportUrls(); + } + + public List artifacts() { + List inner = this.innerModel().artifacts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApplicationClientDetails createdBy() { + return this.innerModel().createdBy(); + } + + public ApplicationClientDetails updatedBy() { + return this.innerModel().updatedBy(); + } + + public ApplicationPatchableInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedapplications.ApplicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationsClientImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationsClientImpl.java index 7a8597d45649..e6b525de74dc 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationsClientImpl.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationsClientImpl.java @@ -14,6 +14,7 @@ import com.azure.core.annotation.HostParam; import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; @@ -26,16 +27,20 @@ import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.managedapplications.fluent.ApplicationsClient; +import com.azure.resourcemanager.managedapplications.fluent.models.AllowedUpgradePlansResultInner; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationInner; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; +import com.azure.resourcemanager.managedapplications.fluent.models.ManagedIdentityTokenResultInner; +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; import com.azure.resourcemanager.managedapplications.models.ApplicationListResult; -import com.azure.resourcemanager.managedapplications.models.ApplicationPatchable; -import com.azure.resourcemanager.managedapplications.models.ErrorResponseException; +import com.azure.resourcemanager.managedapplications.models.ListTokenRequest; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -68,95 +73,90 @@ public final class ApplicationsClientImpl implements ApplicationsClient { public interface ApplicationsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applications/{applicationName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("applicationName") String applicationName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationName") String applicationName, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applications/{applicationName}") - @ExpectedResponses({202, 204}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("applicationName") String applicationName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationName") String applicationName, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applications/{applicationName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}") @ExpectedResponses({200, 201}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate( @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("applicationName") String applicationName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, + @PathParam("applicationName") String applicationName, @BodyParam("application/json") ApplicationInner parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applications/{applicationName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono> update( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("applicationName") String applicationName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @BodyParam("application/json") ApplicationPatchable parameters, + @PathParam("applicationName") String applicationName, + @BodyParam("application/json") ApplicationPatchableInner parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions" - + "/applications") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get("/{applicationId}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> getById( @HostParam("$host") String endpoint, @PathParam(value = "applicationId", encoded = true) String applicationId, @@ -166,8 +166,8 @@ Mono> getById( @Headers({"Content-Type: application/json"}) @Delete("/{applicationId}") - @ExpectedResponses({202, 204}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) Mono>> deleteById( @HostParam("$host") String endpoint, @PathParam(value = "applicationId", encoded = true) String applicationId, @@ -178,7 +178,7 @@ Mono>> deleteById( @Headers({"Content-Type: application/json"}) @Put("/{applicationId}") @ExpectedResponses({200, 201}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdateById( @HostParam("$host") String endpoint, @PathParam(value = "applicationId", encoded = true) String applicationId, @@ -189,20 +189,78 @@ Mono>> createOrUpdateById( @Headers({"Content-Type: application/json"}) @Patch("/{applicationId}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) - Mono> updateById( + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateById( @HostParam("$host") String endpoint, @PathParam(value = "applicationId", encoded = true) String applicationId, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") ApplicationInner parameters, + @BodyParam("application/json") ApplicationPatchableInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/refreshPermissions") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> refreshPermissions( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationName") String applicationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/listAllowedUpgradePlans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllowedUpgradePlans( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("applicationName") String applicationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/updateAccess") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateAccess( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationName") String applicationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateAccessDefinitionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/listTokens") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listTokens( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationName") String applicationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ListTokenRequest parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @@ -212,7 +270,7 @@ Mono> listByResourceGroupNext( @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ErrorResponseException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listBySubscriptionNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @@ -226,7 +284,7 @@ Mono> listBySubscriptionNext( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response} on successful completion of {@link Mono}. */ @@ -239,6 +297,12 @@ private Mono> getByResourceGroupWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -247,12 +311,6 @@ private Mono> getByResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext( @@ -260,10 +318,10 @@ private Mono> getByResourceGroupWithResponseAsync( service .getByResourceGroup( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -276,7 +334,7 @@ private Mono> getByResourceGroupWithResponseAsync( * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response} on successful completion of {@link Mono}. */ @@ -289,6 +347,12 @@ private Mono> getByResourceGroupWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -297,21 +361,15 @@ private Mono> getByResourceGroupWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; context = this.client.mergeContext(context); return service .getByResourceGroup( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationName, accept, context); } @@ -322,7 +380,7 @@ private Mono> getByResourceGroupWithResponseAsync( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application on successful completion of {@link Mono}. */ @@ -339,7 +397,7 @@ private Mono getByResourceGroupAsync(String resourceGroupName, * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response}. */ @@ -355,7 +413,7 @@ public Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application. */ @@ -370,7 +428,7 @@ public ApplicationInner getByResourceGroup(String resourceGroupName, String appl * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @@ -382,6 +440,12 @@ private Mono>> deleteWithResponseAsync(String resource new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -390,12 +454,6 @@ private Mono>> deleteWithResponseAsync(String resource return Mono .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext( @@ -403,10 +461,10 @@ private Mono>> deleteWithResponseAsync(String resource service .delete( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -419,7 +477,7 @@ private Mono>> deleteWithResponseAsync(String resource * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @@ -432,6 +490,12 @@ private Mono>> deleteWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -440,21 +504,15 @@ private Mono>> deleteWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationName, accept, context); } @@ -465,7 +523,7 @@ private Mono>> deleteWithResponseAsync( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of long-running operation. */ @@ -485,7 +543,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of long-running operation. */ @@ -505,7 +563,7 @@ private PollerFlux, Void> beginDeleteAsync( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of long-running operation. */ @@ -521,7 +579,7 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of long-running operation. */ @@ -537,7 +595,7 @@ public SyncPoller, Void> beginDelete( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @@ -555,7 +613,7 @@ private Mono deleteAsync(String resourceGroupName, String applicationName) * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @@ -572,7 +630,7 @@ private Mono deleteAsync(String resourceGroupName, String applicationName, * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -587,7 +645,7 @@ public void delete(String resourceGroupName, String applicationName) { * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -596,13 +654,13 @@ public void delete(String resourceGroupName, String applicationName, Context con } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application along with {@link Response} on successful completion of {@link * Mono}. @@ -616,6 +674,12 @@ private Mono>> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -624,12 +688,6 @@ private Mono>> createOrUpdateWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } if (parameters == null) { return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { @@ -642,10 +700,10 @@ private Mono>> createOrUpdateWithResponseAsync( service .createOrUpdate( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationName, parameters, accept, context)) @@ -653,14 +711,14 @@ private Mono>> createOrUpdateWithResponseAsync( } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application along with {@link Response} on successful completion of {@link * Mono}. @@ -674,6 +732,12 @@ private Mono>> createOrUpdateWithResponseAsync( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -682,12 +746,6 @@ private Mono>> createOrUpdateWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } if (parameters == null) { return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { @@ -698,23 +756,23 @@ private Mono>> createOrUpdateWithResponseAsync( return service .createOrUpdate( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationName, parameters, accept, context); } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of information about managed application. */ @@ -734,14 +792,14 @@ private PollerFlux, ApplicationInner> beginCreateOr } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of information about managed application. */ @@ -758,13 +816,13 @@ private PollerFlux, ApplicationInner> beginCreateOr } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of information about managed application. */ @@ -775,14 +833,14 @@ public SyncPoller, ApplicationInner> beginCreateOrU } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of information about managed application. */ @@ -793,13 +851,13 @@ public SyncPoller, ApplicationInner> beginCreateOrU } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application on successful completion of {@link Mono}. */ @@ -812,14 +870,14 @@ private Mono createOrUpdateAsync( } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application on successful completion of {@link Mono}. */ @@ -832,13 +890,13 @@ private Mono createOrUpdateAsync( } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @@ -849,14 +907,14 @@ public ApplicationInner createOrUpdate( } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @@ -867,26 +925,32 @@ public ApplicationInner createOrUpdate( } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to update an existing managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application along with {@link Response} on successful completion of {@link * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String applicationName, ApplicationPatchable parameters) { + private Mono>> updateWithResponseAsync( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -895,12 +959,6 @@ private Mono> updateWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } if (parameters != null) { parameters.validate(); } @@ -911,10 +969,10 @@ private Mono> updateWithResponseAsync( service .update( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationName, parameters, accept, context)) @@ -922,27 +980,33 @@ private Mono> updateWithResponseAsync( } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to update an existing managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application along with {@link Response} on successful completion of {@link * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String applicationName, ApplicationPatchable parameters, Context context) { + private Mono>> updateWithResponseAsync( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); @@ -951,12 +1015,6 @@ private Mono> updateWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } if (parameters != null) { parameters.validate(); } @@ -965,87 +1023,235 @@ private Mono> updateWithResponseAsync( return service .update( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, - applicationName, this.client.getApiVersion(), - this.client.getSubscriptionId(), + applicationName, parameters, accept, context); } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of information about managed application. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String applicationName) { - final ApplicationPatchable parameters = null; - return updateWithResponseAsync(resourceGroupName, applicationName, parameters) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationPatchableInner> beginUpdateAsync( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, applicationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ApplicationPatchableInner.class, + ApplicationPatchableInner.class, + this.client.getContext()); + } + + /** + * Updates an existing managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationPatchableInner> beginUpdateAsync( + String resourceGroupName, String applicationName) { + final ApplicationPatchableInner parameters = null; + Mono>> mono = updateWithResponseAsync(resourceGroupName, applicationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ApplicationPatchableInner.class, + ApplicationPatchableInner.class, + this.client.getContext()); } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param parameters Parameters supplied to update an existing managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application along with {@link Response}. + * @return the {@link PollerFlux} for polling of information about managed application. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( - String resourceGroupName, String applicationName, ApplicationPatchable parameters, Context context) { - return updateWithResponseAsync(resourceGroupName, applicationName, parameters, context).block(); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationPatchableInner> beginUpdateAsync( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, applicationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ApplicationPatchableInner.class, + ApplicationPatchableInner.class, + context); } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application. + * @return the {@link SyncPoller} for polling of information about managed application. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ApplicationInner update(String resourceGroupName, String applicationName) { - final ApplicationPatchable parameters = null; - return updateWithResponse(resourceGroupName, applicationName, parameters, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplicationPatchableInner> beginUpdate( + String resourceGroupName, String applicationName) { + final ApplicationPatchableInner parameters = null; + return this.beginUpdateAsync(resourceGroupName, applicationName, parameters).getSyncPoller(); + } + + /** + * Updates an existing managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplicationPatchableInner> beginUpdate( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters, Context context) { + return this.beginUpdateAsync(resourceGroupName, applicationName, parameters, context).getSyncPoller(); } /** - * Gets all the applications within a resource group. + * Updates an existing managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return information about managed application on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceGroupName == null) { + private Mono updateAsync( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters) { + return beginUpdateAsync(resourceGroupName, applicationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String applicationName) { + final ApplicationPatchableInner parameters = null; + return beginUpdateAsync(resourceGroupName, applicationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters, Context context) { + return beginUpdateAsync(resourceGroupName, applicationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationPatchableInner update(String resourceGroupName, String applicationName) { + final ApplicationPatchableInner parameters = null; + return updateAsync(resourceGroupName, applicationName, parameters).block(); + } + + /** + * Updates an existing managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationPatchableInner update( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters, Context context) { + return updateAsync(resourceGroupName, applicationName, parameters, context).block(); + } + + /** + * Lists all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed applications along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono @@ -1053,6 +1259,10 @@ private Mono> listByResourceGroupSinglePageAsync new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } final String accept = "application/json"; return FluxUtil .withContext( @@ -1060,9 +1270,9 @@ private Mono> listByResourceGroupSinglePageAsync service .listByResourceGroup( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context)) .>map( @@ -1078,15 +1288,14 @@ private Mono> listByResourceGroupSinglePageAsync } /** - * Gets all the applications within a resource group. + * Lists all the applications within a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of managed applications along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync( @@ -1097,24 +1306,24 @@ private Mono> listByResourceGroupSinglePageAsync new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByResourceGroup( this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context) .map( @@ -1129,13 +1338,13 @@ private Mono> listByResourceGroupSinglePageAsync } /** - * Gets all the applications within a resource group. + * Lists all the applications within a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group as paginated response with {@link PagedFlux}. + * @return list of managed applications as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { @@ -1145,14 +1354,14 @@ private PagedFlux listByResourceGroupAsync(String resourceGrou } /** - * Gets all the applications within a resource group. + * Lists all the applications within a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group as paginated response with {@link PagedFlux}. + * @return list of managed applications as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { @@ -1162,13 +1371,13 @@ private PagedFlux listByResourceGroupAsync(String resourceGrou } /** - * Gets all the applications within a resource group. + * Lists all the applications within a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -1176,14 +1385,14 @@ public PagedIterable listByResourceGroup(String resourceGroupN } /** - * Gets all the applications within a resource group. + * Lists all the applications within a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { @@ -1191,12 +1400,11 @@ public PagedIterable listByResourceGroup(String resourceGroupN } /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of managed applications along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -1219,8 +1427,8 @@ private Mono> listSinglePageAsync() { service .list( this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), + this.client.getApiVersion(), accept, context)) .>map( @@ -1236,14 +1444,13 @@ private Mono> listSinglePageAsync() { } /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return list of managed applications along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { @@ -1264,8 +1471,8 @@ private Mono> listSinglePageAsync(Context contex return service .list( this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), + this.client.getApiVersion(), accept, context) .map( @@ -1280,11 +1487,11 @@ private Mono> listSinglePageAsync(Context contex } /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription as paginated response with {@link PagedFlux}. + * @return list of managed applications as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { @@ -1293,13 +1500,13 @@ private PagedFlux listAsync() { } /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription as paginated response with {@link PagedFlux}. + * @return list of managed applications as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { @@ -1308,11 +1515,11 @@ private PagedFlux listAsync(Context context) { } /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -1320,13 +1527,13 @@ public PagedIterable list() { } /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { @@ -1340,7 +1547,7 @@ public PagedIterable list(Context context) { * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response} on successful completion of {@link Mono}. */ @@ -1373,7 +1580,7 @@ private Mono> getByIdWithResponseAsync(String applica * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response} on successful completion of {@link Mono}. */ @@ -1400,7 +1607,7 @@ private Mono> getByIdWithResponseAsync(String applica * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application on successful completion of {@link Mono}. */ @@ -1417,7 +1624,7 @@ private Mono getByIdAsync(String applicationId) { * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response}. */ @@ -1433,7 +1640,7 @@ public Response getByIdWithResponse(String applicationId, Cont * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application. */ @@ -1449,7 +1656,7 @@ public ApplicationInner getById(String applicationId) { * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @@ -1482,7 +1689,7 @@ private Mono>> deleteByIdWithResponseAsync(String appl * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @@ -1510,7 +1717,7 @@ private Mono>> deleteByIdWithResponseAsync(String appl * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of long-running operation. */ @@ -1531,7 +1738,7 @@ private PollerFlux, Void> beginDeleteByIdAsync(String applicati * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of long-running operation. */ @@ -1551,7 +1758,7 @@ private PollerFlux, Void> beginDeleteByIdAsync(String applicati * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of long-running operation. */ @@ -1568,7 +1775,7 @@ public SyncPoller, Void> beginDeleteById(String applicationId) * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of long-running operation. */ @@ -1584,7 +1791,7 @@ public SyncPoller, Void> beginDeleteById(String applicationId, * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @@ -1601,7 +1808,7 @@ private Mono deleteByIdAsync(String applicationId) { * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @@ -1617,7 +1824,7 @@ private Mono deleteByIdAsync(String applicationId, Context context) { * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1633,7 +1840,7 @@ public void deleteById(String applicationId) { * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1642,14 +1849,14 @@ public void deleteById(String applicationId, Context context) { } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application along with {@link Response} on successful completion of {@link * Mono}. @@ -1687,7 +1894,7 @@ private Mono>> createOrUpdateByIdWithResponseAsync( } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -1695,7 +1902,7 @@ private Mono>> createOrUpdateByIdWithResponseAsync( * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application along with {@link Response} on successful completion of {@link * Mono}. @@ -1725,14 +1932,14 @@ private Mono>> createOrUpdateByIdWithResponseAsync( } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of information about managed application. */ @@ -1751,7 +1958,7 @@ private PollerFlux, ApplicationInner> beginCreateOr } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -1759,7 +1966,7 @@ private PollerFlux, ApplicationInner> beginCreateOr * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link PollerFlux} for polling of information about managed application. */ @@ -1775,14 +1982,14 @@ private PollerFlux, ApplicationInner> beginCreateOr } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of information about managed application. */ @@ -1793,7 +2000,7 @@ public SyncPoller, ApplicationInner> beginCreateOrU } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -1801,7 +2008,7 @@ public SyncPoller, ApplicationInner> beginCreateOrU * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of information about managed application. */ @@ -1812,14 +2019,14 @@ public SyncPoller, ApplicationInner> beginCreateOrU } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application on successful completion of {@link Mono}. */ @@ -1831,7 +2038,7 @@ private Mono createOrUpdateByIdAsync(String applicationId, App } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -1839,7 +2046,7 @@ private Mono createOrUpdateByIdAsync(String applicationId, App * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application on successful completion of {@link Mono}. */ @@ -1852,14 +2059,14 @@ private Mono createOrUpdateByIdAsync( } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @@ -1869,7 +2076,7 @@ public ApplicationInner createOrUpdateById(String applicationId, ApplicationInne } /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -1877,7 +2084,7 @@ public ApplicationInner createOrUpdateById(String applicationId, ApplicationInne * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @@ -1887,21 +2094,21 @@ public ApplicationInner createOrUpdateById(String applicationId, ApplicationInne } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param parameters Parameters supplied to update an existing managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application along with {@link Response} on successful completion of {@link * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateByIdWithResponseAsync( - String applicationId, ApplicationInner parameters) { + private Mono>> updateByIdWithResponseAsync( + String applicationId, ApplicationPatchableInner parameters) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1930,7 +2137,7 @@ private Mono> updateByIdWithResponseAsync( } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -1938,14 +2145,14 @@ private Mono> updateByIdWithResponseAsync( * @param parameters Parameters supplied to update an existing managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application along with {@link Response} on successful completion of {@link * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateByIdWithResponseAsync( - String applicationId, ApplicationInner parameters, Context context) { + private Mono>> updateByIdWithResponseAsync( + String applicationId, ApplicationPatchableInner parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1966,24 +2173,159 @@ private Mono> updateByIdWithResponseAsync( } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. + * + * @param applicationId The fully qualified ID of the managed application, including the managed application name + * and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @param parameters Parameters supplied to update an existing managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationPatchableInner> beginUpdateByIdAsync( + String applicationId, ApplicationPatchableInner parameters) { + Mono>> mono = updateByIdWithResponseAsync(applicationId, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ApplicationPatchableInner.class, + ApplicationPatchableInner.class, + this.client.getContext()); + } + + /** + * Updates an existing managed application. + * + * @param applicationId The fully qualified ID of the managed application, including the managed application name + * and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationPatchableInner> beginUpdateByIdAsync( + String applicationId) { + final ApplicationPatchableInner parameters = null; + Mono>> mono = updateByIdWithResponseAsync(applicationId, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ApplicationPatchableInner.class, + ApplicationPatchableInner.class, + this.client.getContext()); + } + + /** + * Updates an existing managed application. + * + * @param applicationId The fully qualified ID of the managed application, including the managed application name + * and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplicationPatchableInner> beginUpdateByIdAsync( + String applicationId, ApplicationPatchableInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateByIdWithResponseAsync(applicationId, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ApplicationPatchableInner.class, + ApplicationPatchableInner.class, + context); + } + + /** + * Updates an existing managed application. + * + * @param applicationId The fully qualified ID of the managed application, including the managed application name + * and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplicationPatchableInner> beginUpdateById( + String applicationId) { + final ApplicationPatchableInner parameters = null; + return this.beginUpdateByIdAsync(applicationId, parameters).getSyncPoller(); + } + + /** + * Updates an existing managed application. + * + * @param applicationId The fully qualified ID of the managed application, including the managed application name + * and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about managed application. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplicationPatchableInner> beginUpdateById( + String applicationId, ApplicationPatchableInner parameters, Context context) { + return this.beginUpdateByIdAsync(applicationId, parameters, context).getSyncPoller(); + } + + /** + * Updates an existing managed application. + * + * @param applicationId The fully qualified ID of the managed application, including the managed application name + * and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @param parameters Parameters supplied to update an existing managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateByIdAsync( + String applicationId, ApplicationPatchableInner parameters) { + return beginUpdateByIdAsync(applicationId, parameters).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateByIdAsync(String applicationId) { - final ApplicationInner parameters = null; - return updateByIdWithResponseAsync(applicationId, parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono updateByIdAsync(String applicationId) { + final ApplicationPatchableInner parameters = null; + return beginUpdateByIdAsync(applicationId, parameters).last().flatMap(this.client::getLroFinalResultOrError); } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -1991,31 +2333,870 @@ private Mono updateByIdAsync(String applicationId) { * @param parameters Parameters supplied to update an existing managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application along with {@link Response}. + * @return information about managed application on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateByIdWithResponse( - String applicationId, ApplicationInner parameters, Context context) { - return updateByIdWithResponseAsync(applicationId, parameters, context).block(); + private Mono updateByIdAsync( + String applicationId, ApplicationPatchableInner parameters, Context context) { + return beginUpdateByIdAsync(applicationId, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing managed application. + * + * @param applicationId The fully qualified ID of the managed application, including the managed application name + * and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationPatchableInner updateById(String applicationId) { + final ApplicationPatchableInner parameters = null; + return updateByIdAsync(applicationId, parameters).block(); } /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ApplicationInner updateById(String applicationId) { - final ApplicationInner parameters = null; - return updateByIdWithResponse(applicationId, parameters, Context.NONE).getValue(); + public ApplicationPatchableInner updateById( + String applicationId, ApplicationPatchableInner parameters, Context context) { + return updateByIdAsync(applicationId, parameters, context).block(); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshPermissionsWithResponseAsync( + String resourceGroupName, String applicationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .refreshPermissions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshPermissionsWithResponseAsync( + String resourceGroupName, String applicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .refreshPermissions( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRefreshPermissionsAsync( + String resourceGroupName, String applicationName) { + Mono>> mono = refreshPermissionsWithResponseAsync(resourceGroupName, applicationName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRefreshPermissionsAsync( + String resourceGroupName, String applicationName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + refreshPermissionsWithResponseAsync(resourceGroupName, applicationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRefreshPermissions( + String resourceGroupName, String applicationName) { + return this.beginRefreshPermissionsAsync(resourceGroupName, applicationName).getSyncPoller(); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRefreshPermissions( + String resourceGroupName, String applicationName, Context context) { + return this.beginRefreshPermissionsAsync(resourceGroupName, applicationName, context).getSyncPoller(); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshPermissionsAsync(String resourceGroupName, String applicationName) { + return beginRefreshPermissionsAsync(resourceGroupName, applicationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshPermissionsAsync(String resourceGroupName, String applicationName, Context context) { + return beginRefreshPermissionsAsync(resourceGroupName, applicationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshPermissions(String resourceGroupName, String applicationName) { + refreshPermissionsAsync(resourceGroupName, applicationName).block(); + } + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshPermissions(String resourceGroupName, String applicationName, Context context) { + refreshPermissionsAsync(resourceGroupName, applicationName, context).block(); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllowedUpgradePlansWithResponseAsync( + String resourceGroupName, String applicationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAllowedUpgradePlans( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllowedUpgradePlansWithResponseAsync( + String resourceGroupName, String applicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllowedUpgradePlans( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + applicationName, + accept, + context); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAllowedUpgradePlansAsync( + String resourceGroupName, String applicationName) { + return listAllowedUpgradePlansWithResponseAsync(resourceGroupName, applicationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAllowedUpgradePlansWithResponse( + String resourceGroupName, String applicationName, Context context) { + return listAllowedUpgradePlansWithResponseAsync(resourceGroupName, applicationName, context).block(); + } + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AllowedUpgradePlansResultInner listAllowedUpgradePlans(String resourceGroupName, String applicationName) { + return listAllowedUpgradePlansWithResponse(resourceGroupName, applicationName, Context.NONE).getValue(); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateAccessWithResponseAsync( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateAccessWithResponseAsync( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateAccess( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, UpdateAccessDefinitionInner> beginUpdateAccessAsync( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters) { + Mono>> mono = + updateAccessWithResponseAsync(resourceGroupName, applicationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + UpdateAccessDefinitionInner.class, + UpdateAccessDefinitionInner.class, + this.client.getContext()); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, UpdateAccessDefinitionInner> beginUpdateAccessAsync( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateAccessWithResponseAsync(resourceGroupName, applicationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + UpdateAccessDefinitionInner.class, + UpdateAccessDefinitionInner.class, + context); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, UpdateAccessDefinitionInner> beginUpdateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters) { + return this.beginUpdateAccessAsync(resourceGroupName, applicationName, parameters).getSyncPoller(); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, UpdateAccessDefinitionInner> beginUpdateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters, Context context) { + return this.beginUpdateAccessAsync(resourceGroupName, applicationName, parameters, context).getSyncPoller(); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAccessAsync( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters) { + return beginUpdateAccessAsync(resourceGroupName, applicationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAccessAsync( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters, Context context) { + return beginUpdateAccessAsync(resourceGroupName, applicationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateAccessDefinitionInner updateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters) { + return updateAccessAsync(resourceGroupName, applicationName, parameters).block(); + } + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateAccessDefinitionInner updateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters, Context context) { + return updateAccessAsync(resourceGroupName, applicationName, parameters, context).block(); + } + + /** + * List tokens for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTokensWithResponseAsync( + String resourceGroupName, String applicationName, ListTokenRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listTokens( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List tokens for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listTokensWithResponseAsync( + String resourceGroupName, String applicationName, ListTokenRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listTokens( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * List tokens for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listTokensAsync( + String resourceGroupName, String applicationName, ListTokenRequest parameters) { + return listTokensWithResponseAsync(resourceGroupName, applicationName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List tokens for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listTokensWithResponse( + String resourceGroupName, String applicationName, ListTokenRequest parameters, Context context) { + return listTokensWithResponseAsync(resourceGroupName, applicationName, parameters, context).block(); + } + + /** + * List tokens for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedIdentityTokenResultInner listTokens( + String resourceGroupName, String applicationName, ListTokenRequest parameters) { + return listTokensWithResponse(resourceGroupName, applicationName, parameters, Context.NONE).getValue(); } /** @@ -2024,7 +3205,7 @@ public ApplicationInner updateById(String applicationId) { * @param nextLink The URL to get the next list of items *

    The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed applications along with {@link PagedResponse} on successful completion of {@link Mono}. */ @@ -2062,7 +3243,7 @@ private Mono> listByResourceGroupNextSinglePageA *

    The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed applications along with {@link PagedResponse} on successful completion of {@link Mono}. */ @@ -2099,7 +3280,7 @@ private Mono> listByResourceGroupNextSinglePageA * @param nextLink The URL to get the next list of items *

    The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed applications along with {@link PagedResponse} on successful completion of {@link Mono}. */ @@ -2137,7 +3318,7 @@ private Mono> listBySubscriptionNextSinglePageAs *

    The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorResponseException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed applications along with {@link PagedResponse} on successful completion of {@link Mono}. */ diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationsImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationsImpl.java index 3b4b6edc276d..1810d0efd44f 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationsImpl.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ApplicationsImpl.java @@ -10,9 +10,18 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.managedapplications.fluent.ApplicationsClient; +import com.azure.resourcemanager.managedapplications.fluent.models.AllowedUpgradePlansResultInner; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationInner; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; +import com.azure.resourcemanager.managedapplications.fluent.models.ManagedIdentityTokenResultInner; +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.AllowedUpgradePlansResult; import com.azure.resourcemanager.managedapplications.models.Application; +import com.azure.resourcemanager.managedapplications.models.ApplicationPatchable; import com.azure.resourcemanager.managedapplications.models.Applications; +import com.azure.resourcemanager.managedapplications.models.ListTokenRequest; +import com.azure.resourcemanager.managedapplications.models.ManagedIdentityTokenResult; +import com.azure.resourcemanager.managedapplications.models.UpdateAccessDefinition; public final class ApplicationsImpl implements Applications { private static final ClientLogger LOGGER = new ClientLogger(ApplicationsImpl.class); @@ -60,6 +69,26 @@ public void delete(String resourceGroupName, String applicationName, Context con this.serviceClient().delete(resourceGroupName, applicationName, context); } + public ApplicationPatchable update(String resourceGroupName, String applicationName) { + ApplicationPatchableInner inner = this.serviceClient().update(resourceGroupName, applicationName); + if (inner != null) { + return new ApplicationPatchableImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApplicationPatchable update( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters, Context context) { + ApplicationPatchableInner inner = + this.serviceClient().update(resourceGroupName, applicationName, parameters, context); + if (inner != null) { + return new ApplicationPatchableImpl(inner, this.manager()); + } else { + return null; + } + } + public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); return Utils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); @@ -128,25 +157,101 @@ public Application createOrUpdateById(String applicationId, ApplicationInner par } } - public Response updateByIdWithResponse( - String applicationId, ApplicationInner parameters, Context context) { - Response inner = - this.serviceClient().updateByIdWithResponse(applicationId, parameters, context); + public ApplicationPatchable updateById(String applicationId) { + ApplicationPatchableInner inner = this.serviceClient().updateById(applicationId); + if (inner != null) { + return new ApplicationPatchableImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApplicationPatchable updateById( + String applicationId, ApplicationPatchableInner parameters, Context context) { + ApplicationPatchableInner inner = this.serviceClient().updateById(applicationId, parameters, context); + if (inner != null) { + return new ApplicationPatchableImpl(inner, this.manager()); + } else { + return null; + } + } + + public void refreshPermissions(String resourceGroupName, String applicationName) { + this.serviceClient().refreshPermissions(resourceGroupName, applicationName); + } + + public void refreshPermissions(String resourceGroupName, String applicationName, Context context) { + this.serviceClient().refreshPermissions(resourceGroupName, applicationName, context); + } + + public Response listAllowedUpgradePlansWithResponse( + String resourceGroupName, String applicationName, Context context) { + Response inner = + this.serviceClient().listAllowedUpgradePlansWithResponse(resourceGroupName, applicationName, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ApplicationImpl(inner.getValue(), this.manager())); + new AllowedUpgradePlansResultImpl(inner.getValue(), this.manager())); } else { return null; } } - public Application updateById(String applicationId) { - ApplicationInner inner = this.serviceClient().updateById(applicationId); + public AllowedUpgradePlansResult listAllowedUpgradePlans(String resourceGroupName, String applicationName) { + AllowedUpgradePlansResultInner inner = + this.serviceClient().listAllowedUpgradePlans(resourceGroupName, applicationName); if (inner != null) { - return new ApplicationImpl(inner, this.manager()); + return new AllowedUpgradePlansResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public UpdateAccessDefinition updateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters) { + UpdateAccessDefinitionInner inner = + this.serviceClient().updateAccess(resourceGroupName, applicationName, parameters); + if (inner != null) { + return new UpdateAccessDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public UpdateAccessDefinition updateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters, Context context) { + UpdateAccessDefinitionInner inner = + this.serviceClient().updateAccess(resourceGroupName, applicationName, parameters, context); + if (inner != null) { + return new UpdateAccessDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listTokensWithResponse( + String resourceGroupName, String applicationName, ListTokenRequest parameters, Context context) { + Response inner = + this.serviceClient().listTokensWithResponse(resourceGroupName, applicationName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedIdentityTokenResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedIdentityTokenResult listTokens( + String resourceGroupName, String applicationName, ListTokenRequest parameters) { + ManagedIdentityTokenResultInner inner = + this.serviceClient().listTokens(resourceGroupName, applicationName, parameters); + if (inner != null) { + return new ManagedIdentityTokenResultImpl(inner, this.manager()); } else { return null; } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestDefinitionImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestDefinitionImpl.java new file mode 100644 index 000000000000..315c87584089 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestDefinitionImpl.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.ApplicationClientDetails; +import com.azure.resourcemanager.managedapplications.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.managedapplications.models.JitRequestDefinition; +import com.azure.resourcemanager.managedapplications.models.JitRequestPatchable; +import com.azure.resourcemanager.managedapplications.models.JitRequestState; +import com.azure.resourcemanager.managedapplications.models.JitSchedulingPolicy; +import com.azure.resourcemanager.managedapplications.models.ProvisioningState; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class JitRequestDefinitionImpl + implements JitRequestDefinition, JitRequestDefinition.Definition, JitRequestDefinition.Update { + private JitRequestDefinitionInner innerObject; + + private final com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String applicationResourceId() { + return this.innerModel().applicationResourceId(); + } + + public String publisherTenantId() { + return this.innerModel().publisherTenantId(); + } + + public List jitAuthorizationPolicies() { + List inner = this.innerModel().jitAuthorizationPolicies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public JitSchedulingPolicy jitSchedulingPolicy() { + return this.innerModel().jitSchedulingPolicy(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public JitRequestState jitRequestState() { + return this.innerModel().jitRequestState(); + } + + public ApplicationClientDetails createdBy() { + return this.innerModel().createdBy(); + } + + public ApplicationClientDetails updatedBy() { + return this.innerModel().updatedBy(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public JitRequestDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedapplications.ApplicationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String jitRequestName; + + private JitRequestPatchable updateParameters; + + public JitRequestDefinitionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public JitRequestDefinition create() { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .createOrUpdate(resourceGroupName, jitRequestName, this.innerModel(), Context.NONE); + return this; + } + + public JitRequestDefinition create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .createOrUpdate(resourceGroupName, jitRequestName, this.innerModel(), context); + return this; + } + + JitRequestDefinitionImpl( + String name, com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager) { + this.innerObject = new JitRequestDefinitionInner(); + this.serviceManager = serviceManager; + this.jitRequestName = name; + } + + public JitRequestDefinitionImpl update() { + this.updateParameters = new JitRequestPatchable(); + return this; + } + + public JitRequestDefinition apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .updateWithResponse(resourceGroupName, jitRequestName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public JitRequestDefinition apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .updateWithResponse(resourceGroupName, jitRequestName, updateParameters, context) + .getValue(); + return this; + } + + JitRequestDefinitionImpl( + JitRequestDefinitionInner innerObject, + com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.jitRequestName = Utils.getValueFromIdByName(innerObject.id(), "jitRequests"); + } + + public JitRequestDefinition refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .getByResourceGroupWithResponse(resourceGroupName, jitRequestName, Context.NONE) + .getValue(); + return this; + } + + public JitRequestDefinition refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJitRequests() + .getByResourceGroupWithResponse(resourceGroupName, jitRequestName, context) + .getValue(); + return this; + } + + public JitRequestDefinitionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public JitRequestDefinitionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public JitRequestDefinitionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public JitRequestDefinitionImpl withApplicationResourceId(String applicationResourceId) { + this.innerModel().withApplicationResourceId(applicationResourceId); + return this; + } + + public JitRequestDefinitionImpl withJitAuthorizationPolicies( + List jitAuthorizationPolicies) { + this.innerModel().withJitAuthorizationPolicies(jitAuthorizationPolicies); + return this; + } + + public JitRequestDefinitionImpl withJitSchedulingPolicy(JitSchedulingPolicy jitSchedulingPolicy) { + this.innerModel().withJitSchedulingPolicy(jitSchedulingPolicy); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestDefinitionListResultImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestDefinitionListResultImpl.java new file mode 100644 index 000000000000..fb0bbf2bda2b --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestDefinitionListResultImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.implementation; + +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionListResultInner; +import com.azure.resourcemanager.managedapplications.models.JitRequestDefinition; +import com.azure.resourcemanager.managedapplications.models.JitRequestDefinitionListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class JitRequestDefinitionListResultImpl implements JitRequestDefinitionListResult { + private JitRequestDefinitionListResultInner innerObject; + + private final com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager; + + JitRequestDefinitionListResultImpl( + JitRequestDefinitionListResultInner innerObject, + com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new JitRequestDefinitionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public JitRequestDefinitionListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedapplications.ApplicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestsClientImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestsClientImpl.java new file mode 100644 index 000000000000..6e1171471d0e --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestsClientImpl.java @@ -0,0 +1,1098 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managedapplications.fluent.JitRequestsClient; +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionListResultInner; +import com.azure.resourcemanager.managedapplications.models.JitRequestPatchable; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JitRequestsClient. */ +public final class JitRequestsClientImpl implements JitRequestsClient { + /** The proxy service used to perform REST calls. */ + private final JitRequestsService service; + + /** The service client containing this operation class. */ + private final ApplicationClientImpl client; + + /** + * Initializes an instance of JitRequestsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JitRequestsClientImpl(ApplicationClientImpl client) { + this.service = + RestProxy.create(JitRequestsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ApplicationClientJitRequests to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ApplicationClientJit") + public interface JitRequestsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("jitRequestName") String jitRequestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("jitRequestName") String jitRequestName, + @BodyParam("application/json") JitRequestDefinitionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("jitRequestName") String jitRequestName, + @BodyParam("application/json") JitRequestPatchable parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("jitRequestName") String jitRequestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String jitRequestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String jitRequestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + accept, + context); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String jitRequestName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, jitRequestName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String jitRequestName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, jitRequestName, context).block(); + } + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionInner getByResourceGroup(String resourceGroupName, String jitRequestName) { + return getByResourceGroupWithResponse(resourceGroupName, jitRequestName, Context.NONE).getValue(); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + parameters, + accept, + context); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JitRequestDefinitionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, jitRequestName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + JitRequestDefinitionInner.class, + JitRequestDefinitionInner.class, + this.client.getContext()); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JitRequestDefinitionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, jitRequestName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + JitRequestDefinitionInner.class, + JitRequestDefinitionInner.class, + context); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JitRequestDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + return this.beginCreateOrUpdateAsync(resourceGroupName, jitRequestName, parameters).getSyncPoller(); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JitRequestDefinitionInner> beginCreateOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, jitRequestName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, jitRequestName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, jitRequestName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionInner createOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters) { + return createOrUpdateAsync(resourceGroupName, jitRequestName, parameters).block(); + } + + /** + * Creates or updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionInner createOrUpdate( + String resourceGroupName, String jitRequestName, JitRequestDefinitionInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, jitRequestName, parameters, context).block(); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + parameters, + accept, + context); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters) { + return updateWithResponseAsync(resourceGroupName, jitRequestName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, jitRequestName, parameters, context).block(); + } + + /** + * Updates the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param parameters Parameters supplied to the update JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about JIT request definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionInner update( + String resourceGroupName, String jitRequestName, JitRequestPatchable parameters) { + return updateWithResponse(resourceGroupName, jitRequestName, parameters, Context.NONE).getValue(); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String jitRequestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String jitRequestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jitRequestName == null) { + return Mono.error(new IllegalArgumentException("Parameter jitRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + jitRequestName, + accept, + context); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String jitRequestName) { + return deleteWithResponseAsync(resourceGroupName, jitRequestName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String jitRequestName, Context context) { + return deleteWithResponseAsync(resourceGroupName, jitRequestName, context).block(); + } + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String jitRequestName) { + deleteWithResponse(resourceGroupName, jitRequestName, Context.NONE); + } + + /** + * Lists all JIT requests within the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all JIT requests within the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists all JIT requests within the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listBySubscriptionAsync() { + return listBySubscriptionWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all JIT requests within the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listBySubscriptionWithResponse(Context context) { + return listBySubscriptionWithResponseAsync(context).block(); + } + + /** + * Lists all JIT requests within the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionListResultInner listBySubscription() { + return listBySubscriptionWithResponse(Context.NONE).getValue(); + } + + /** + * Lists all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupWithResponseAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupWithResponseAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithResponseAsync(resourceGroupName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByResourceGroupWithResponse( + String resourceGroupName, Context context) { + return listByResourceGroupWithResponseAsync(resourceGroupName, context).block(); + } + + /** + * Lists all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JitRequestDefinitionListResultInner listByResourceGroup(String resourceGroupName) { + return listByResourceGroupWithResponse(resourceGroupName, Context.NONE).getValue(); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestsImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestsImpl.java new file mode 100644 index 000000000000..c7a58ba737b7 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/JitRequestsImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedapplications.fluent.JitRequestsClient; +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionInner; +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionListResultInner; +import com.azure.resourcemanager.managedapplications.models.JitRequestDefinition; +import com.azure.resourcemanager.managedapplications.models.JitRequestDefinitionListResult; +import com.azure.resourcemanager.managedapplications.models.JitRequests; + +public final class JitRequestsImpl implements JitRequests { + private static final ClientLogger LOGGER = new ClientLogger(JitRequestsImpl.class); + + private final JitRequestsClient innerClient; + + private final com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager; + + public JitRequestsImpl( + JitRequestsClient innerClient, + com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String jitRequestName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, jitRequestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JitRequestDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JitRequestDefinition getByResourceGroup(String resourceGroupName, String jitRequestName) { + JitRequestDefinitionInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, jitRequestName); + if (inner != null) { + return new JitRequestDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String jitRequestName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, jitRequestName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String jitRequestName) { + this.serviceClient().delete(resourceGroupName, jitRequestName); + } + + public Response listBySubscriptionWithResponse(Context context) { + Response inner = + this.serviceClient().listBySubscriptionWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JitRequestDefinitionListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JitRequestDefinitionListResult listBySubscription() { + JitRequestDefinitionListResultInner inner = this.serviceClient().listBySubscription(); + if (inner != null) { + return new JitRequestDefinitionListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listByResourceGroupWithResponse( + String resourceGroupName, Context context) { + Response inner = + this.serviceClient().listByResourceGroupWithResponse(resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JitRequestDefinitionListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JitRequestDefinitionListResult listByResourceGroup(String resourceGroupName) { + JitRequestDefinitionListResultInner inner = this.serviceClient().listByResourceGroup(resourceGroupName); + if (inner != null) { + return new JitRequestDefinitionListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public JitRequestDefinition getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jitRequestName = Utils.getValueFromIdByName(id, "jitRequests"); + if (jitRequestName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jitRequests'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, jitRequestName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jitRequestName = Utils.getValueFromIdByName(id, "jitRequests"); + if (jitRequestName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jitRequests'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, jitRequestName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jitRequestName = Utils.getValueFromIdByName(id, "jitRequests"); + if (jitRequestName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jitRequests'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, jitRequestName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jitRequestName = Utils.getValueFromIdByName(id, "jitRequests"); + if (jitRequestName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jitRequests'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, jitRequestName, context); + } + + private JitRequestsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managedapplications.ApplicationManager manager() { + return this.serviceManager; + } + + public JitRequestDefinitionImpl define(String name) { + return new JitRequestDefinitionImpl(name, this.manager()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ManagedIdentityTokenResultImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ManagedIdentityTokenResultImpl.java new file mode 100644 index 000000000000..5b0f862e2266 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ManagedIdentityTokenResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.implementation; + +import com.azure.resourcemanager.managedapplications.fluent.models.ManagedIdentityTokenResultInner; +import com.azure.resourcemanager.managedapplications.models.ManagedIdentityToken; +import com.azure.resourcemanager.managedapplications.models.ManagedIdentityTokenResult; +import java.util.Collections; +import java.util.List; + +public final class ManagedIdentityTokenResultImpl implements ManagedIdentityTokenResult { + private ManagedIdentityTokenResultInner innerObject; + + private final com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager; + + ManagedIdentityTokenResultImpl( + ManagedIdentityTokenResultInner innerObject, + com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ManagedIdentityTokenResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedapplications.ApplicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/OperationImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/OperationImpl.java index e9d71261b3c7..1ef5a5ac8994 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/OperationImpl.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/OperationImpl.java @@ -5,8 +5,10 @@ package com.azure.resourcemanager.managedapplications.implementation; import com.azure.resourcemanager.managedapplications.fluent.models.OperationInner; +import com.azure.resourcemanager.managedapplications.models.ActionType; import com.azure.resourcemanager.managedapplications.models.Operation; import com.azure.resourcemanager.managedapplications.models.OperationDisplay; +import com.azure.resourcemanager.managedapplications.models.Origin; public final class OperationImpl implements Operation { private OperationInner innerObject; @@ -23,10 +25,22 @@ public String name() { return this.innerModel().name(); } + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + public OperationDisplay display() { return this.innerModel().display(); } + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + public OperationInner innerModel() { return this.innerObject; } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ResourceProvidersClientImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ResourceProvidersClientImpl.java index 25f402dbaf2b..7a5c045e726d 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ResourceProvidersClientImpl.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/ResourceProvidersClientImpl.java @@ -82,7 +82,7 @@ Mono> listOperationsNext( * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations along with {@link PagedResponse} on + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -117,7 +117,7 @@ private Mono> listOperationsSinglePageAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations along with {@link PagedResponse} on + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -148,7 +148,7 @@ private Mono> listOperationsSinglePageAsync(Contex * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations as paginated response with {@link + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link * PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -164,7 +164,7 @@ private PagedFlux listOperationsAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations as paginated response with {@link + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link * PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -179,7 +179,7 @@ private PagedFlux listOperationsAsync(Context context) { * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations as paginated response with {@link + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -194,7 +194,7 @@ public PagedIterable listOperations() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations as paginated response with {@link + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -210,7 +210,7 @@ public PagedIterable listOperations(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations along with {@link PagedResponse} on + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -248,7 +248,7 @@ private Mono> listOperationsNextSinglePageAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations along with {@link PagedResponse} on + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/UpdateAccessDefinitionImpl.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/UpdateAccessDefinitionImpl.java new file mode 100644 index 000000000000..012c74edeeb4 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/implementation/UpdateAccessDefinitionImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.implementation; + +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.JitRequestMetadata; +import com.azure.resourcemanager.managedapplications.models.Status; +import com.azure.resourcemanager.managedapplications.models.Substatus; +import com.azure.resourcemanager.managedapplications.models.UpdateAccessDefinition; + +public final class UpdateAccessDefinitionImpl implements UpdateAccessDefinition { + private UpdateAccessDefinitionInner innerObject; + + private final com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager; + + UpdateAccessDefinitionImpl( + UpdateAccessDefinitionInner innerObject, + com.azure.resourcemanager.managedapplications.ApplicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String approver() { + return this.innerModel().approver(); + } + + public JitRequestMetadata metadata() { + return this.innerModel().metadata(); + } + + public Status status() { + return this.innerModel().status(); + } + + public Substatus subStatus() { + return this.innerModel().subStatus(); + } + + public UpdateAccessDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedapplications.ApplicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ActionType.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ActionType.java new file mode 100644 index 000000000000..4bcb772c7eaf --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/AllowedUpgradePlansResult.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/AllowedUpgradePlansResult.java new file mode 100644 index 000000000000..250c82b3a99a --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/AllowedUpgradePlansResult.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.resourcemanager.managedapplications.fluent.models.AllowedUpgradePlansResultInner; +import java.util.List; + +/** An immutable client-side representation of AllowedUpgradePlansResult. */ +public interface AllowedUpgradePlansResult { + /** + * Gets the value property: The array of plans. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.managedapplications.fluent.models.AllowedUpgradePlansResultInner object. + * + * @return the inner object. + */ + AllowedUpgradePlansResultInner innerModel(); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Application.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Application.java index 7560279bcbc4..bcd4cc6dfcec 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Application.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Application.java @@ -4,9 +4,13 @@ package com.azure.resourcemanager.managedapplications.models; +import com.azure.core.http.rest.Response; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationInner; +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; +import java.util.List; import java.util.Map; /** An immutable client-side representation of Application. */ @@ -61,11 +65,11 @@ public interface Application { Sku sku(); /** - * Gets the identity property: The identity of the resource. + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. * - * @return the identity value. + * @return the systemData value. */ - Identity identity(); + SystemData systemData(); /** * Gets the plan property: The plan information. @@ -81,6 +85,13 @@ public interface Application { */ String kind(); + /** + * Gets the identity property: The identity of the resource. + * + * @return the identity value. + */ + Identity identity(); + /** * Gets the managedResourceGroupId property: The managed resource group Id. * @@ -117,6 +128,79 @@ public interface Application { */ ProvisioningState provisioningState(); + /** + * Gets the billingDetails property: The managed application billing details. + * + * @return the billingDetails value. + */ + ApplicationBillingDetailsDefinition billingDetails(); + + /** + * Gets the jitAccessPolicy property: The managed application Jit access policy. + * + * @return the jitAccessPolicy value. + */ + ApplicationJitAccessPolicy jitAccessPolicy(); + + /** + * Gets the publisherTenantId property: The publisher tenant Id. + * + * @return the publisherTenantId value. + */ + String publisherTenantId(); + + /** + * Gets the authorizations property: The read-only authorizations property that is retrieved from the application + * package. + * + * @return the authorizations value. + */ + List authorizations(); + + /** + * Gets the managementMode property: The managed application management mode. + * + * @return the managementMode value. + */ + ApplicationManagementMode managementMode(); + + /** + * Gets the customerSupport property: The read-only customer support property that is retrieved from the application + * package. + * + * @return the customerSupport value. + */ + ApplicationPackageContact customerSupport(); + + /** + * Gets the supportUrls property: The read-only support URLs property that is retrieved from the application + * package. + * + * @return the supportUrls value. + */ + ApplicationPackageSupportUrls supportUrls(); + + /** + * Gets the artifacts property: The collection of managed application artifacts. + * + * @return the artifacts value. + */ + List artifacts(); + + /** + * Gets the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + ApplicationClientDetails createdBy(); + + /** + * Gets the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + ApplicationClientDetails updatedBy(); + /** * Gets the region of the resource. * @@ -151,14 +235,15 @@ interface Definition DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, DefinitionStages.WithKind, - DefinitionStages.WithManagedResourceGroupId, DefinitionStages.WithCreate { } + /** The Application definition stages. */ interface DefinitionStages { /** The first stage of the Application definition. */ interface Blank extends WithLocation { } + /** The stage of the Application definition allowing to specify location. */ interface WithLocation { /** @@ -177,6 +262,7 @@ interface WithLocation { */ WithResourceGroup withRegion(String location); } + /** The stage of the Application definition allowing to specify parent resource. */ interface WithResourceGroup { /** @@ -187,6 +273,7 @@ interface WithResourceGroup { */ WithKind withExistingResourceGroup(String resourceGroupName); } + /** The stage of the Application definition allowing to specify kind. */ interface WithKind { /** @@ -196,18 +283,9 @@ interface WithKind { * @param kind The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. * @return the next definition stage. */ - WithManagedResourceGroupId withKind(String kind); - } - /** The stage of the Application definition allowing to specify managedResourceGroupId. */ - interface WithManagedResourceGroupId { - /** - * Specifies the managedResourceGroupId property: The managed resource group Id.. - * - * @param managedResourceGroupId The managed resource group Id. - * @return the next definition stage. - */ - WithCreate withManagedResourceGroupId(String managedResourceGroupId); + WithCreate withKind(String kind); } + /** * The stage of the Application definition which contains all the minimum required properties for the resource * to be created, but also allows for any other optional properties to be specified. @@ -216,10 +294,12 @@ interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithManagedBy, DefinitionStages.WithSku, - DefinitionStages.WithIdentity, DefinitionStages.WithPlan, + DefinitionStages.WithIdentity, + DefinitionStages.WithManagedResourceGroupId, DefinitionStages.WithApplicationDefinitionId, - DefinitionStages.WithParameters { + DefinitionStages.WithParameters, + DefinitionStages.WithJitAccessPolicy { /** * Executes the create request. * @@ -235,6 +315,7 @@ interface WithCreate */ Application create(Context context); } + /** The stage of the Application definition allowing to specify tags. */ interface WithTags { /** @@ -245,6 +326,7 @@ interface WithTags { */ WithCreate withTags(Map tags); } + /** The stage of the Application definition allowing to specify managedBy. */ interface WithManagedBy { /** @@ -255,6 +337,7 @@ interface WithManagedBy { */ WithCreate withManagedBy(String managedBy); } + /** The stage of the Application definition allowing to specify sku. */ interface WithSku { /** @@ -265,6 +348,18 @@ interface WithSku { */ WithCreate withSku(Sku sku); } + + /** The stage of the Application definition allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: The plan information.. + * + * @param plan The plan information. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + /** The stage of the Application definition allowing to specify identity. */ interface WithIdentity { /** @@ -275,16 +370,18 @@ interface WithIdentity { */ WithCreate withIdentity(Identity identity); } - /** The stage of the Application definition allowing to specify plan. */ - interface WithPlan { + + /** The stage of the Application definition allowing to specify managedResourceGroupId. */ + interface WithManagedResourceGroupId { /** - * Specifies the plan property: The plan information.. + * Specifies the managedResourceGroupId property: The managed resource group Id.. * - * @param plan The plan information. + * @param managedResourceGroupId The managed resource group Id. * @return the next definition stage. */ - WithCreate withPlan(Plan plan); + WithCreate withManagedResourceGroupId(String managedResourceGroupId); } + /** The stage of the Application definition allowing to specify applicationDefinitionId. */ interface WithApplicationDefinitionId { /** @@ -296,6 +393,7 @@ interface WithApplicationDefinitionId { */ WithCreate withApplicationDefinitionId(String applicationDefinitionId); } + /** The stage of the Application definition allowing to specify parameters. */ interface WithParameters { /** @@ -308,7 +406,19 @@ interface WithParameters { */ WithCreate withParameters(Object parameters); } + + /** The stage of the Application definition allowing to specify jitAccessPolicy. */ + interface WithJitAccessPolicy { + /** + * Specifies the jitAccessPolicy property: The managed application Jit access policy.. + * + * @param jitAccessPolicy The managed application Jit access policy. + * @return the next definition stage. + */ + WithCreate withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy); + } } + /** * Begins update for the Application resource. * @@ -321,12 +431,13 @@ interface Update extends UpdateStages.WithTags, UpdateStages.WithManagedBy, UpdateStages.WithSku, - UpdateStages.WithIdentity, UpdateStages.WithPlan, UpdateStages.WithKind, + UpdateStages.WithIdentity, UpdateStages.WithManagedResourceGroupId, UpdateStages.WithApplicationDefinitionId, - UpdateStages.WithParameters { + UpdateStages.WithParameters, + UpdateStages.WithJitAccessPolicy { /** * Executes the update request. * @@ -342,6 +453,7 @@ interface Update */ Application apply(Context context); } + /** The Application update stages. */ interface UpdateStages { /** The stage of the Application update allowing to specify tags. */ @@ -354,6 +466,7 @@ interface WithTags { */ Update withTags(Map tags); } + /** The stage of the Application update allowing to specify managedBy. */ interface WithManagedBy { /** @@ -364,6 +477,7 @@ interface WithManagedBy { */ Update withManagedBy(String managedBy); } + /** The stage of the Application update allowing to specify sku. */ interface WithSku { /** @@ -374,16 +488,7 @@ interface WithSku { */ Update withSku(Sku sku); } - /** The stage of the Application update allowing to specify identity. */ - interface WithIdentity { - /** - * Specifies the identity property: The identity of the resource.. - * - * @param identity The identity of the resource. - * @return the next definition stage. - */ - Update withIdentity(Identity identity); - } + /** The stage of the Application update allowing to specify plan. */ interface WithPlan { /** @@ -392,8 +497,9 @@ interface WithPlan { * @param plan The plan information. * @return the next definition stage. */ - Update withPlan(PlanPatchable plan); + Update withPlan(Plan plan); } + /** The stage of the Application update allowing to specify kind. */ interface WithKind { /** @@ -405,6 +511,18 @@ interface WithKind { */ Update withKind(String kind); } + + /** The stage of the Application update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + Update withIdentity(Identity identity); + } + /** The stage of the Application update allowing to specify managedResourceGroupId. */ interface WithManagedResourceGroupId { /** @@ -415,6 +533,7 @@ interface WithManagedResourceGroupId { */ Update withManagedResourceGroupId(String managedResourceGroupId); } + /** The stage of the Application update allowing to specify applicationDefinitionId. */ interface WithApplicationDefinitionId { /** @@ -426,6 +545,7 @@ interface WithApplicationDefinitionId { */ Update withApplicationDefinitionId(String applicationDefinitionId); } + /** The stage of the Application update allowing to specify parameters. */ interface WithParameters { /** @@ -438,7 +558,19 @@ interface WithParameters { */ Update withParameters(Object parameters); } + + /** The stage of the Application update allowing to specify jitAccessPolicy. */ + interface WithJitAccessPolicy { + /** + * Specifies the jitAccessPolicy property: The managed application Jit access policy.. + * + * @param jitAccessPolicy The managed application Jit access policy. + * @return the next definition stage. + */ + Update withJitAccessPolicy(ApplicationJitAccessPolicy jitAccessPolicy); + } } + /** * Refreshes the resource to sync with Azure. * @@ -453,4 +585,88 @@ interface WithParameters { * @return the refreshed resource. */ Application refresh(Context context); + + /** + * Refresh Permissions for application. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshPermissions(); + + /** + * Refresh Permissions for application. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshPermissions(Context context); + + /** + * List allowed upgrade plans for application. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan along with {@link Response}. + */ + Response listAllowedUpgradePlansWithResponse(Context context); + + /** + * List allowed upgrade plans for application. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan. + */ + AllowedUpgradePlansResult listAllowedUpgradePlans(); + + /** + * Update access for application. + * + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + UpdateAccessDefinition updateAccess(UpdateAccessDefinitionInner parameters); + + /** + * Update access for application. + * + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + UpdateAccessDefinition updateAccess(UpdateAccessDefinitionInner parameters, Context context); + + /** + * List tokens for application. + * + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens along with {@link Response}. + */ + Response listTokensWithResponse(ListTokenRequest parameters, Context context); + + /** + * List tokens for application. + * + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens. + */ + ManagedIdentityTokenResult listTokens(ListTokenRequest parameters); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifact.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifact.java index 01783f32605f..a2aa2e2c50d0 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifact.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifact.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.managedapplications.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonProperty; /** Managed application artifact. */ @@ -13,19 +14,19 @@ public final class ApplicationArtifact { /* * The managed application artifact name. */ - @JsonProperty(value = "name") - private String name; + @JsonProperty(value = "name", required = true) + private ApplicationArtifactName name; /* * The managed application artifact blob uri. */ - @JsonProperty(value = "uri") + @JsonProperty(value = "uri", required = true) private String uri; /* * The managed application artifact type. */ - @JsonProperty(value = "type") + @JsonProperty(value = "type", required = true) private ApplicationArtifactType type; /** Creates an instance of ApplicationArtifact class. */ @@ -37,7 +38,7 @@ public ApplicationArtifact() { * * @return the name value. */ - public String name() { + public ApplicationArtifactName name() { return this.name; } @@ -47,7 +48,7 @@ public String name() { * @param name the name value to set. * @return the ApplicationArtifact object itself. */ - public ApplicationArtifact withName(String name) { + public ApplicationArtifact withName(ApplicationArtifactName name) { this.name = name; return this; } @@ -98,5 +99,22 @@ public ApplicationArtifact withType(ApplicationArtifactType type) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ApplicationArtifact")); + } + if (uri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property uri in model ApplicationArtifact")); + } + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ApplicationArtifact")); + } } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationArtifact.class); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifactName.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifactName.java new file mode 100644 index 000000000000..23615a34db63 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifactName.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The managed application artifact name. */ +public final class ApplicationArtifactName extends ExpandableStringEnum { + /** Static value NotSpecified for ApplicationArtifactName. */ + public static final ApplicationArtifactName NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value ViewDefinition for ApplicationArtifactName. */ + public static final ApplicationArtifactName VIEW_DEFINITION = fromString("ViewDefinition"); + + /** Static value Authorizations for ApplicationArtifactName. */ + public static final ApplicationArtifactName AUTHORIZATIONS = fromString("Authorizations"); + + /** Static value CustomRoleDefinition for ApplicationArtifactName. */ + public static final ApplicationArtifactName CUSTOM_ROLE_DEFINITION = fromString("CustomRoleDefinition"); + + /** + * Creates a new instance of ApplicationArtifactName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApplicationArtifactName() { + } + + /** + * Creates or finds a ApplicationArtifactName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationArtifactName. + */ + @JsonCreator + public static ApplicationArtifactName fromString(String name) { + return fromString(name, ApplicationArtifactName.class); + } + + /** + * Gets known ApplicationArtifactName values. + * + * @return known ApplicationArtifactName values. + */ + public static Collection values() { + return values(ApplicationArtifactName.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifactType.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifactType.java index 5abca16b475e..2c503f63a417 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifactType.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationArtifactType.java @@ -9,6 +9,9 @@ /** The managed application artifact type. */ public enum ApplicationArtifactType { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + /** Enum value Template. */ TEMPLATE("Template"), diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationProviderAuthorization.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationAuthorization.java similarity index 84% rename from sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationProviderAuthorization.java rename to sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationAuthorization.java index 6270a3520020..504df0878764 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationProviderAuthorization.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationAuthorization.java @@ -10,7 +10,7 @@ /** The managed application provider authorization. */ @Fluent -public final class ApplicationProviderAuthorization { +public final class ApplicationAuthorization { /* * The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the * managed application resources. @@ -26,8 +26,8 @@ public final class ApplicationProviderAuthorization { @JsonProperty(value = "roleDefinitionId", required = true) private String roleDefinitionId; - /** Creates an instance of ApplicationProviderAuthorization class. */ - public ApplicationProviderAuthorization() { + /** Creates an instance of ApplicationAuthorization class. */ + public ApplicationAuthorization() { } /** @@ -45,9 +45,9 @@ public String principalId() { * use to call ARM to manage the managed application resources. * * @param principalId the principalId value to set. - * @return the ApplicationProviderAuthorization object itself. + * @return the ApplicationAuthorization object itself. */ - public ApplicationProviderAuthorization withPrincipalId(String principalId) { + public ApplicationAuthorization withPrincipalId(String principalId) { this.principalId = principalId; return this; } @@ -69,9 +69,9 @@ public String roleDefinitionId() { * definition cannot have permission to delete the resource group. * * @param roleDefinitionId the roleDefinitionId value to set. - * @return the ApplicationProviderAuthorization object itself. + * @return the ApplicationAuthorization object itself. */ - public ApplicationProviderAuthorization withRoleDefinitionId(String roleDefinitionId) { + public ApplicationAuthorization withRoleDefinitionId(String roleDefinitionId) { this.roleDefinitionId = roleDefinitionId; return this; } @@ -86,15 +86,15 @@ public void validate() { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - "Missing required property principalId in model ApplicationProviderAuthorization")); + "Missing required property principalId in model ApplicationAuthorization")); } if (roleDefinitionId() == null) { throw LOGGER .logExceptionAsError( new IllegalArgumentException( - "Missing required property roleDefinitionId in model ApplicationProviderAuthorization")); + "Missing required property roleDefinitionId in model ApplicationAuthorization")); } } - private static final ClientLogger LOGGER = new ClientLogger(ApplicationProviderAuthorization.class); + private static final ClientLogger LOGGER = new ClientLogger(ApplicationAuthorization.class); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationBillingDetailsDefinition.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationBillingDetailsDefinition.java new file mode 100644 index 000000000000..b40943a4158c --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationBillingDetailsDefinition.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application billing details definition. */ +@Fluent +public final class ApplicationBillingDetailsDefinition { + /* + * The managed application resource usage Id. + */ + @JsonProperty(value = "resourceUsageId") + private String resourceUsageId; + + /** Creates an instance of ApplicationBillingDetailsDefinition class. */ + public ApplicationBillingDetailsDefinition() { + } + + /** + * Get the resourceUsageId property: The managed application resource usage Id. + * + * @return the resourceUsageId value. + */ + public String resourceUsageId() { + return this.resourceUsageId; + } + + /** + * Set the resourceUsageId property: The managed application resource usage Id. + * + * @param resourceUsageId the resourceUsageId value to set. + * @return the ApplicationBillingDetailsDefinition object itself. + */ + public ApplicationBillingDetailsDefinition withResourceUsageId(String resourceUsageId) { + this.resourceUsageId = resourceUsageId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationClientDetails.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationClientDetails.java new file mode 100644 index 000000000000..37e96501fd14 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationClientDetails.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The application client details to track the entity creating/updating the managed app resource. */ +@Fluent +public final class ApplicationClientDetails { + /* + * The client Oid. + */ + @JsonProperty(value = "oid") + private String oid; + + /* + * The client Puid + */ + @JsonProperty(value = "puid") + private String puid; + + /* + * The client application Id. + */ + @JsonProperty(value = "applicationId") + private String applicationId; + + /** Creates an instance of ApplicationClientDetails class. */ + public ApplicationClientDetails() { + } + + /** + * Get the oid property: The client Oid. + * + * @return the oid value. + */ + public String oid() { + return this.oid; + } + + /** + * Set the oid property: The client Oid. + * + * @param oid the oid value to set. + * @return the ApplicationClientDetails object itself. + */ + public ApplicationClientDetails withOid(String oid) { + this.oid = oid; + return this; + } + + /** + * Get the puid property: The client Puid. + * + * @return the puid value. + */ + public String puid() { + return this.puid; + } + + /** + * Set the puid property: The client Puid. + * + * @param puid the puid value to set. + * @return the ApplicationClientDetails object itself. + */ + public ApplicationClientDetails withPuid(String puid) { + this.puid = puid; + return this; + } + + /** + * Get the applicationId property: The client application Id. + * + * @return the applicationId value. + */ + public String applicationId() { + return this.applicationId; + } + + /** + * Set the applicationId property: The client application Id. + * + * @param applicationId the applicationId value to set. + * @return the ApplicationClientDetails object itself. + */ + public ApplicationClientDetails withApplicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinition.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinition.java index d71d95ffbb5b..bb7a8a1ab055 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinition.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinition.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.managedapplications.models; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; import java.util.List; @@ -62,11 +63,11 @@ public interface ApplicationDefinition { Sku sku(); /** - * Gets the identity property: The identity of the resource. + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. * - * @return the identity value. + * @return the systemData value. */ - Identity identity(); + SystemData systemData(); /** * Gets the lockLevel property: The managed application lock level. @@ -87,14 +88,14 @@ public interface ApplicationDefinition { * * @return the isEnabled value. */ - String isEnabled(); + Boolean isEnabled(); /** * Gets the authorizations property: The managed application provider authorizations. * * @return the authorizations value. */ - List authorizations(); + List authorizations(); /** * Gets the artifacts property: The collection of managed application artifacts. The portal will use the files @@ -103,7 +104,7 @@ public interface ApplicationDefinition { * * @return the artifacts value. */ - List artifacts(); + List artifacts(); /** * Gets the description property: The managed application definition description. @@ -119,6 +120,13 @@ public interface ApplicationDefinition { */ String packageFileUri(); + /** + * Gets the storageAccountId property: The storage account id for bring your own storage scenario. + * + * @return the storageAccountId value. + */ + String storageAccountId(); + /** * Gets the mainTemplate property: The inline main template json which has resources to be provisioned. It can be a * JObject or well-formed JSON string. @@ -135,6 +143,42 @@ public interface ApplicationDefinition { */ Object createUiDefinition(); + /** + * Gets the notificationPolicy property: The managed application notification policy. + * + * @return the notificationPolicy value. + */ + ApplicationNotificationPolicy notificationPolicy(); + + /** + * Gets the lockingPolicy property: The managed application locking policy. + * + * @return the lockingPolicy value. + */ + ApplicationPackageLockingPolicyDefinition lockingPolicy(); + + /** + * Gets the deploymentPolicy property: The managed application deployment policy. + * + * @return the deploymentPolicy value. + */ + ApplicationDeploymentPolicy deploymentPolicy(); + + /** + * Gets the managementPolicy property: The managed application management policy that determines publisher's access + * to the managed resource group. + * + * @return the managementPolicy value. + */ + ApplicationManagementPolicy managementPolicy(); + + /** + * Gets the policies property: The managed application provider policies. + * + * @return the policies value. + */ + List policies(); + /** * Gets the region of the resource. * @@ -169,14 +213,15 @@ interface Definition DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, DefinitionStages.WithLockLevel, - DefinitionStages.WithAuthorizations, DefinitionStages.WithCreate { } + /** The ApplicationDefinition definition stages. */ interface DefinitionStages { /** The first stage of the ApplicationDefinition definition. */ interface Blank extends WithLocation { } + /** The stage of the ApplicationDefinition definition allowing to specify location. */ interface WithLocation { /** @@ -195,6 +240,7 @@ interface WithLocation { */ WithResourceGroup withRegion(String location); } + /** The stage of the ApplicationDefinition definition allowing to specify parent resource. */ interface WithResourceGroup { /** @@ -205,6 +251,7 @@ interface WithResourceGroup { */ WithLockLevel withExistingResourceGroup(String resourceGroupName); } + /** The stage of the ApplicationDefinition definition allowing to specify lockLevel. */ interface WithLockLevel { /** @@ -213,18 +260,9 @@ interface WithLockLevel { * @param lockLevel The managed application lock level. * @return the next definition stage. */ - WithAuthorizations withLockLevel(ApplicationLockLevel lockLevel); - } - /** The stage of the ApplicationDefinition definition allowing to specify authorizations. */ - interface WithAuthorizations { - /** - * Specifies the authorizations property: The managed application provider authorizations.. - * - * @param authorizations The managed application provider authorizations. - * @return the next definition stage. - */ - WithCreate withAuthorizations(List authorizations); + WithCreate withLockLevel(ApplicationLockLevel lockLevel); } + /** * The stage of the ApplicationDefinition definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -233,14 +271,20 @@ interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithManagedBy, DefinitionStages.WithSku, - DefinitionStages.WithIdentity, DefinitionStages.WithDisplayName, DefinitionStages.WithIsEnabled, + DefinitionStages.WithAuthorizations, DefinitionStages.WithArtifacts, DefinitionStages.WithDescription, DefinitionStages.WithPackageFileUri, + DefinitionStages.WithStorageAccountId, DefinitionStages.WithMainTemplate, - DefinitionStages.WithCreateUiDefinition { + DefinitionStages.WithCreateUiDefinition, + DefinitionStages.WithNotificationPolicy, + DefinitionStages.WithLockingPolicy, + DefinitionStages.WithDeploymentPolicy, + DefinitionStages.WithManagementPolicy, + DefinitionStages.WithPolicies { /** * Executes the create request. * @@ -256,6 +300,7 @@ interface WithCreate */ ApplicationDefinition create(Context context); } + /** The stage of the ApplicationDefinition definition allowing to specify tags. */ interface WithTags { /** @@ -266,6 +311,7 @@ interface WithTags { */ WithCreate withTags(Map tags); } + /** The stage of the ApplicationDefinition definition allowing to specify managedBy. */ interface WithManagedBy { /** @@ -276,6 +322,7 @@ interface WithManagedBy { */ WithCreate withManagedBy(String managedBy); } + /** The stage of the ApplicationDefinition definition allowing to specify sku. */ interface WithSku { /** @@ -286,16 +333,7 @@ interface WithSku { */ WithCreate withSku(Sku sku); } - /** The stage of the ApplicationDefinition definition allowing to specify identity. */ - interface WithIdentity { - /** - * Specifies the identity property: The identity of the resource.. - * - * @param identity The identity of the resource. - * @return the next definition stage. - */ - WithCreate withIdentity(Identity identity); - } + /** The stage of the ApplicationDefinition definition allowing to specify displayName. */ interface WithDisplayName { /** @@ -306,6 +344,7 @@ interface WithDisplayName { */ WithCreate withDisplayName(String displayName); } + /** The stage of the ApplicationDefinition definition allowing to specify isEnabled. */ interface WithIsEnabled { /** @@ -314,8 +353,20 @@ interface WithIsEnabled { * @param isEnabled A value indicating whether the package is enabled or not. * @return the next definition stage. */ - WithCreate withIsEnabled(String isEnabled); + WithCreate withIsEnabled(Boolean isEnabled); } + + /** The stage of the ApplicationDefinition definition allowing to specify authorizations. */ + interface WithAuthorizations { + /** + * Specifies the authorizations property: The managed application provider authorizations.. + * + * @param authorizations The managed application provider authorizations. + * @return the next definition stage. + */ + WithCreate withAuthorizations(List authorizations); + } + /** The stage of the ApplicationDefinition definition allowing to specify artifacts. */ interface WithArtifacts { /** @@ -328,8 +379,9 @@ interface WithArtifacts { * application definition. * @return the next definition stage. */ - WithCreate withArtifacts(List artifacts); + WithCreate withArtifacts(List artifacts); } + /** The stage of the ApplicationDefinition definition allowing to specify description. */ interface WithDescription { /** @@ -340,6 +392,7 @@ interface WithDescription { */ WithCreate withDescription(String description); } + /** The stage of the ApplicationDefinition definition allowing to specify packageFileUri. */ interface WithPackageFileUri { /** @@ -351,6 +404,18 @@ interface WithPackageFileUri { */ WithCreate withPackageFileUri(String packageFileUri); } + + /** The stage of the ApplicationDefinition definition allowing to specify storageAccountId. */ + interface WithStorageAccountId { + /** + * Specifies the storageAccountId property: The storage account id for bring your own storage scenario.. + * + * @param storageAccountId The storage account id for bring your own storage scenario. + * @return the next definition stage. + */ + WithCreate withStorageAccountId(String storageAccountId); + } + /** The stage of the ApplicationDefinition definition allowing to specify mainTemplate. */ interface WithMainTemplate { /** @@ -363,6 +428,7 @@ interface WithMainTemplate { */ WithCreate withMainTemplate(Object mainTemplate); } + /** The stage of the ApplicationDefinition definition allowing to specify createUiDefinition. */ interface WithCreateUiDefinition { /** @@ -375,7 +441,65 @@ interface WithCreateUiDefinition { */ WithCreate withCreateUiDefinition(Object createUiDefinition); } + + /** The stage of the ApplicationDefinition definition allowing to specify notificationPolicy. */ + interface WithNotificationPolicy { + /** + * Specifies the notificationPolicy property: The managed application notification policy.. + * + * @param notificationPolicy The managed application notification policy. + * @return the next definition stage. + */ + WithCreate withNotificationPolicy(ApplicationNotificationPolicy notificationPolicy); + } + + /** The stage of the ApplicationDefinition definition allowing to specify lockingPolicy. */ + interface WithLockingPolicy { + /** + * Specifies the lockingPolicy property: The managed application locking policy.. + * + * @param lockingPolicy The managed application locking policy. + * @return the next definition stage. + */ + WithCreate withLockingPolicy(ApplicationPackageLockingPolicyDefinition lockingPolicy); + } + + /** The stage of the ApplicationDefinition definition allowing to specify deploymentPolicy. */ + interface WithDeploymentPolicy { + /** + * Specifies the deploymentPolicy property: The managed application deployment policy.. + * + * @param deploymentPolicy The managed application deployment policy. + * @return the next definition stage. + */ + WithCreate withDeploymentPolicy(ApplicationDeploymentPolicy deploymentPolicy); + } + + /** The stage of the ApplicationDefinition definition allowing to specify managementPolicy. */ + interface WithManagementPolicy { + /** + * Specifies the managementPolicy property: The managed application management policy that determines + * publisher's access to the managed resource group.. + * + * @param managementPolicy The managed application management policy that determines publisher's access to + * the managed resource group. + * @return the next definition stage. + */ + WithCreate withManagementPolicy(ApplicationManagementPolicy managementPolicy); + } + + /** The stage of the ApplicationDefinition definition allowing to specify policies. */ + interface WithPolicies { + /** + * Specifies the policies property: The managed application provider policies.. + * + * @param policies The managed application provider policies. + * @return the next definition stage. + */ + WithCreate withPolicies(List policies); + } } + /** * Begins update for the ApplicationDefinition resource. * @@ -384,20 +508,7 @@ interface WithCreateUiDefinition { ApplicationDefinition.Update update(); /** The template for ApplicationDefinition update. */ - interface Update - extends UpdateStages.WithTags, - UpdateStages.WithManagedBy, - UpdateStages.WithSku, - UpdateStages.WithIdentity, - UpdateStages.WithLockLevel, - UpdateStages.WithDisplayName, - UpdateStages.WithIsEnabled, - UpdateStages.WithAuthorizations, - UpdateStages.WithArtifacts, - UpdateStages.WithDescription, - UpdateStages.WithPackageFileUri, - UpdateStages.WithMainTemplate, - UpdateStages.WithCreateUiDefinition { + interface Update extends UpdateStages.WithTags { /** * Executes the update request. * @@ -413,148 +524,21 @@ interface Update */ ApplicationDefinition apply(Context context); } + /** The ApplicationDefinition update stages. */ interface UpdateStages { /** The stage of the ApplicationDefinition update allowing to specify tags. */ interface WithTags { /** - * Specifies the tags property: Resource tags.. + * Specifies the tags property: Application definition tags. * - * @param tags Resource tags. + * @param tags Application definition tags. * @return the next definition stage. */ Update withTags(Map tags); } - /** The stage of the ApplicationDefinition update allowing to specify managedBy. */ - interface WithManagedBy { - /** - * Specifies the managedBy property: ID of the resource that manages this resource.. - * - * @param managedBy ID of the resource that manages this resource. - * @return the next definition stage. - */ - Update withManagedBy(String managedBy); - } - /** The stage of the ApplicationDefinition update allowing to specify sku. */ - interface WithSku { - /** - * Specifies the sku property: The SKU of the resource.. - * - * @param sku The SKU of the resource. - * @return the next definition stage. - */ - Update withSku(Sku sku); - } - /** The stage of the ApplicationDefinition update allowing to specify identity. */ - interface WithIdentity { - /** - * Specifies the identity property: The identity of the resource.. - * - * @param identity The identity of the resource. - * @return the next definition stage. - */ - Update withIdentity(Identity identity); - } - /** The stage of the ApplicationDefinition update allowing to specify lockLevel. */ - interface WithLockLevel { - /** - * Specifies the lockLevel property: The managed application lock level.. - * - * @param lockLevel The managed application lock level. - * @return the next definition stage. - */ - Update withLockLevel(ApplicationLockLevel lockLevel); - } - /** The stage of the ApplicationDefinition update allowing to specify displayName. */ - interface WithDisplayName { - /** - * Specifies the displayName property: The managed application definition display name.. - * - * @param displayName The managed application definition display name. - * @return the next definition stage. - */ - Update withDisplayName(String displayName); - } - /** The stage of the ApplicationDefinition update allowing to specify isEnabled. */ - interface WithIsEnabled { - /** - * Specifies the isEnabled property: A value indicating whether the package is enabled or not.. - * - * @param isEnabled A value indicating whether the package is enabled or not. - * @return the next definition stage. - */ - Update withIsEnabled(String isEnabled); - } - /** The stage of the ApplicationDefinition update allowing to specify authorizations. */ - interface WithAuthorizations { - /** - * Specifies the authorizations property: The managed application provider authorizations.. - * - * @param authorizations The managed application provider authorizations. - * @return the next definition stage. - */ - Update withAuthorizations(List authorizations); - } - /** The stage of the ApplicationDefinition update allowing to specify artifacts. */ - interface WithArtifacts { - /** - * Specifies the artifacts property: The collection of managed application artifacts. The portal will use - * the files specified as artifacts to construct the user experience of creating a managed application from - * a managed application definition.. - * - * @param artifacts The collection of managed application artifacts. The portal will use the files specified - * as artifacts to construct the user experience of creating a managed application from a managed - * application definition. - * @return the next definition stage. - */ - Update withArtifacts(List artifacts); - } - /** The stage of the ApplicationDefinition update allowing to specify description. */ - interface WithDescription { - /** - * Specifies the description property: The managed application definition description.. - * - * @param description The managed application definition description. - * @return the next definition stage. - */ - Update withDescription(String description); - } - /** The stage of the ApplicationDefinition update allowing to specify packageFileUri. */ - interface WithPackageFileUri { - /** - * Specifies the packageFileUri property: The managed application definition package file Uri. Use this - * element. - * - * @param packageFileUri The managed application definition package file Uri. Use this element. - * @return the next definition stage. - */ - Update withPackageFileUri(String packageFileUri); - } - /** The stage of the ApplicationDefinition update allowing to specify mainTemplate. */ - interface WithMainTemplate { - /** - * Specifies the mainTemplate property: The inline main template json which has resources to be provisioned. - * It can be a JObject or well-formed JSON string.. - * - * @param mainTemplate The inline main template json which has resources to be provisioned. It can be a - * JObject or well-formed JSON string. - * @return the next definition stage. - */ - Update withMainTemplate(Object mainTemplate); - } - /** The stage of the ApplicationDefinition update allowing to specify createUiDefinition. */ - interface WithCreateUiDefinition { - /** - * Specifies the createUiDefinition property: The createUiDefinition json for the backing template with - * Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string.. - * - * @param createUiDefinition The createUiDefinition json for the backing template with - * Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. - * @return the next definition stage. - */ - Update withCreateUiDefinition(Object createUiDefinition); - } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitionArtifact.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitionArtifact.java new file mode 100644 index 000000000000..ba9a1340237d --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitionArtifact.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Application definition artifact. */ +@Fluent +public final class ApplicationDefinitionArtifact { + /* + * The managed application definition artifact name. + */ + @JsonProperty(value = "name", required = true) + private ApplicationDefinitionArtifactName name; + + /* + * The managed application definition artifact blob uri. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /* + * The managed application definition artifact type. + */ + @JsonProperty(value = "type", required = true) + private ApplicationArtifactType type; + + /** Creates an instance of ApplicationDefinitionArtifact class. */ + public ApplicationDefinitionArtifact() { + } + + /** + * Get the name property: The managed application definition artifact name. + * + * @return the name value. + */ + public ApplicationDefinitionArtifactName name() { + return this.name; + } + + /** + * Set the name property: The managed application definition artifact name. + * + * @param name the name value to set. + * @return the ApplicationDefinitionArtifact object itself. + */ + public ApplicationDefinitionArtifact withName(ApplicationDefinitionArtifactName name) { + this.name = name; + return this; + } + + /** + * Get the uri property: The managed application definition artifact blob uri. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The managed application definition artifact blob uri. + * + * @param uri the uri value to set. + * @return the ApplicationDefinitionArtifact object itself. + */ + public ApplicationDefinitionArtifact withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the type property: The managed application definition artifact type. + * + * @return the type value. + */ + public ApplicationArtifactType type() { + return this.type; + } + + /** + * Set the type property: The managed application definition artifact type. + * + * @param type the type value to set. + * @return the ApplicationDefinitionArtifact object itself. + */ + public ApplicationDefinitionArtifact withType(ApplicationArtifactType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model ApplicationDefinitionArtifact")); + } + if (uri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property uri in model ApplicationDefinitionArtifact")); + } + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model ApplicationDefinitionArtifact")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationDefinitionArtifact.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitionArtifactName.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitionArtifactName.java new file mode 100644 index 000000000000..88fa36ff86c1 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitionArtifactName.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The managed application artifact name. */ +public final class ApplicationDefinitionArtifactName extends ExpandableStringEnum { + /** Static value NotSpecified for ApplicationDefinitionArtifactName. */ + public static final ApplicationDefinitionArtifactName NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value ApplicationResourceTemplate for ApplicationDefinitionArtifactName. */ + public static final ApplicationDefinitionArtifactName APPLICATION_RESOURCE_TEMPLATE = + fromString("ApplicationResourceTemplate"); + + /** Static value CreateUiDefinition for ApplicationDefinitionArtifactName. */ + public static final ApplicationDefinitionArtifactName CREATE_UI_DEFINITION = fromString("CreateUiDefinition"); + + /** Static value MainTemplateParameters for ApplicationDefinitionArtifactName. */ + public static final ApplicationDefinitionArtifactName MAIN_TEMPLATE_PARAMETERS = + fromString("MainTemplateParameters"); + + /** + * Creates a new instance of ApplicationDefinitionArtifactName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApplicationDefinitionArtifactName() { + } + + /** + * Creates or finds a ApplicationDefinitionArtifactName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationDefinitionArtifactName. + */ + @JsonCreator + public static ApplicationDefinitionArtifactName fromString(String name) { + return fromString(name, ApplicationDefinitionArtifactName.class); + } + + /** + * Gets known ApplicationDefinitionArtifactName values. + * + * @return known ApplicationDefinitionArtifactName values. + */ + public static Collection values() { + return values(ApplicationDefinitionArtifactName.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitionPatchable.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitionPatchable.java new file mode 100644 index 000000000000..903100f1988e --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitionPatchable.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Information about an application definition request. */ +@Fluent +public final class ApplicationDefinitionPatchable { + /* + * Application definition tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of ApplicationDefinitionPatchable class. */ + public ApplicationDefinitionPatchable() { + } + + /** + * Get the tags property: Application definition tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Application definition tags. + * + * @param tags the tags value to set. + * @return the ApplicationDefinitionPatchable object itself. + */ + public ApplicationDefinitionPatchable withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitions.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitions.java index a9fb7363c956..974824d3e329 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitions.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDefinitions.java @@ -18,8 +18,7 @@ public interface ApplicationDefinitions { * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition along with {@link Response}. */ @@ -32,8 +31,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition. */ @@ -43,34 +41,33 @@ Response getByResourceGroupWithResponse( * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. + * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. */ - void deleteByResourceGroup(String resourceGroupName, String applicationDefinitionName); + Response deleteByResourceGroupWithResponse( + String resourceGroupName, String applicationDefinitionName, Context context); /** * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applicationDefinitionName The name of the managed application definition to delete. - * @param context The context to associate with this operation. + * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void delete(String resourceGroupName, String applicationDefinitionName, Context context); + void deleteByResourceGroup(String resourceGroupName, String applicationDefinitionName); /** * Lists the managed application definitions in a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions as paginated response with {@link PagedIterable}. */ @@ -82,13 +79,32 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of managed application definitions as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName, Context context); + /** + * Lists all the application definitions within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all the application definitions within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed application definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + /** * Gets the managed application definition. * @@ -96,8 +112,7 @@ Response getByResourceGroupWithResponse( * @param applicationDefinitionName The name of the managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition along with {@link Response}. */ @@ -110,8 +125,7 @@ Response getByIdWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application definition. */ @@ -122,35 +136,51 @@ Response getByIdWithResponse( * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. */ - void deleteById(String resourceGroupName, String applicationDefinitionName); + Response deleteByIdWithResponse(String resourceGroupName, String applicationDefinitionName, Context context); /** * Deletes the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String resourceGroupName, String applicationDefinitionName); + + /** + * Creates or updates a managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition along with {@link Response}. */ - void deleteById(String resourceGroupName, String applicationDefinitionName, Context context); + Response createOrUpdateByIdWithResponse( + String resourceGroupName, + String applicationDefinitionName, + ApplicationDefinitionInner parameters, + Context context); /** - * Creates a new managed application definition. + * Creates or updates a managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. * @param parameters Parameters supplied to the create or update a managed application definition. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application definition. */ @@ -158,24 +188,37 @@ ApplicationDefinition createOrUpdateById( String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionInner parameters); /** - * Creates a new managed application definition. + * Updates the managed application definition. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationDefinitionName The name of the managed application definition. - * @param parameters Parameters supplied to the create or update a managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application definition. + * @return information about managed application definition along with {@link Response}. */ - ApplicationDefinition createOrUpdateById( + Response updateByIdWithResponse( String resourceGroupName, String applicationDefinitionName, - ApplicationDefinitionInner parameters, + ApplicationDefinitionPatchable parameters, Context context); + /** + * Updates the managed application definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the update a managed application definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application definition. + */ + ApplicationDefinition updateById( + String resourceGroupName, String applicationDefinitionName, ApplicationDefinitionPatchable parameters); + /** * Begins definition for a new ApplicationDefinition resource. * diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDeploymentPolicy.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDeploymentPolicy.java new file mode 100644 index 000000000000..00768404a91e --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationDeploymentPolicy.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application deployment policy. */ +@Fluent +public final class ApplicationDeploymentPolicy { + /* + * The managed application deployment mode. + */ + @JsonProperty(value = "deploymentMode", required = true) + private DeploymentMode deploymentMode; + + /** Creates an instance of ApplicationDeploymentPolicy class. */ + public ApplicationDeploymentPolicy() { + } + + /** + * Get the deploymentMode property: The managed application deployment mode. + * + * @return the deploymentMode value. + */ + public DeploymentMode deploymentMode() { + return this.deploymentMode; + } + + /** + * Set the deploymentMode property: The managed application deployment mode. + * + * @param deploymentMode the deploymentMode value to set. + * @return the ApplicationDeploymentPolicy object itself. + */ + public ApplicationDeploymentPolicy withDeploymentMode(DeploymentMode deploymentMode) { + this.deploymentMode = deploymentMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deploymentMode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property deploymentMode in model ApplicationDeploymentPolicy")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationDeploymentPolicy.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationJitAccessPolicy.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationJitAccessPolicy.java new file mode 100644 index 000000000000..61677164ace6 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationJitAccessPolicy.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Managed application Jit access policy. */ +@Fluent +public final class ApplicationJitAccessPolicy { + /* + * Whether the JIT access is enabled. + */ + @JsonProperty(value = "jitAccessEnabled", required = true) + private boolean jitAccessEnabled; + + /* + * JIT approval mode. + */ + @JsonProperty(value = "jitApprovalMode") + private JitApprovalMode jitApprovalMode; + + /* + * The JIT approvers + */ + @JsonProperty(value = "jitApprovers") + private List jitApprovers; + + /* + * The maximum duration JIT access is granted. This is an ISO8601 time period value. + */ + @JsonProperty(value = "maximumJitAccessDuration") + private String maximumJitAccessDuration; + + /** Creates an instance of ApplicationJitAccessPolicy class. */ + public ApplicationJitAccessPolicy() { + } + + /** + * Get the jitAccessEnabled property: Whether the JIT access is enabled. + * + * @return the jitAccessEnabled value. + */ + public boolean jitAccessEnabled() { + return this.jitAccessEnabled; + } + + /** + * Set the jitAccessEnabled property: Whether the JIT access is enabled. + * + * @param jitAccessEnabled the jitAccessEnabled value to set. + * @return the ApplicationJitAccessPolicy object itself. + */ + public ApplicationJitAccessPolicy withJitAccessEnabled(boolean jitAccessEnabled) { + this.jitAccessEnabled = jitAccessEnabled; + return this; + } + + /** + * Get the jitApprovalMode property: JIT approval mode. + * + * @return the jitApprovalMode value. + */ + public JitApprovalMode jitApprovalMode() { + return this.jitApprovalMode; + } + + /** + * Set the jitApprovalMode property: JIT approval mode. + * + * @param jitApprovalMode the jitApprovalMode value to set. + * @return the ApplicationJitAccessPolicy object itself. + */ + public ApplicationJitAccessPolicy withJitApprovalMode(JitApprovalMode jitApprovalMode) { + this.jitApprovalMode = jitApprovalMode; + return this; + } + + /** + * Get the jitApprovers property: The JIT approvers. + * + * @return the jitApprovers value. + */ + public List jitApprovers() { + return this.jitApprovers; + } + + /** + * Set the jitApprovers property: The JIT approvers. + * + * @param jitApprovers the jitApprovers value to set. + * @return the ApplicationJitAccessPolicy object itself. + */ + public ApplicationJitAccessPolicy withJitApprovers(List jitApprovers) { + this.jitApprovers = jitApprovers; + return this; + } + + /** + * Get the maximumJitAccessDuration property: The maximum duration JIT access is granted. This is an ISO8601 time + * period value. + * + * @return the maximumJitAccessDuration value. + */ + public String maximumJitAccessDuration() { + return this.maximumJitAccessDuration; + } + + /** + * Set the maximumJitAccessDuration property: The maximum duration JIT access is granted. This is an ISO8601 time + * period value. + * + * @param maximumJitAccessDuration the maximumJitAccessDuration value to set. + * @return the ApplicationJitAccessPolicy object itself. + */ + public ApplicationJitAccessPolicy withMaximumJitAccessDuration(String maximumJitAccessDuration) { + this.maximumJitAccessDuration = maximumJitAccessDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (jitApprovers() != null) { + jitApprovers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationManagementMode.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationManagementMode.java new file mode 100644 index 000000000000..54b8409a48bf --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationManagementMode.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The management mode. */ +public final class ApplicationManagementMode extends ExpandableStringEnum { + /** Static value NotSpecified for ApplicationManagementMode. */ + public static final ApplicationManagementMode NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Unmanaged for ApplicationManagementMode. */ + public static final ApplicationManagementMode UNMANAGED = fromString("Unmanaged"); + + /** Static value Managed for ApplicationManagementMode. */ + public static final ApplicationManagementMode MANAGED = fromString("Managed"); + + /** + * Creates a new instance of ApplicationManagementMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApplicationManagementMode() { + } + + /** + * Creates or finds a ApplicationManagementMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationManagementMode. + */ + @JsonCreator + public static ApplicationManagementMode fromString(String name) { + return fromString(name, ApplicationManagementMode.class); + } + + /** + * Gets known ApplicationManagementMode values. + * + * @return known ApplicationManagementMode values. + */ + public static Collection values() { + return values(ApplicationManagementMode.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationManagementPolicy.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationManagementPolicy.java new file mode 100644 index 000000000000..b4fed7b4e7ae --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationManagementPolicy.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application management policy. */ +@Fluent +public final class ApplicationManagementPolicy { + /* + * The managed application management mode. + */ + @JsonProperty(value = "mode") + private ApplicationManagementMode mode; + + /** Creates an instance of ApplicationManagementPolicy class. */ + public ApplicationManagementPolicy() { + } + + /** + * Get the mode property: The managed application management mode. + * + * @return the mode value. + */ + public ApplicationManagementMode mode() { + return this.mode; + } + + /** + * Set the mode property: The managed application management mode. + * + * @param mode the mode value to set. + * @return the ApplicationManagementPolicy object itself. + */ + public ApplicationManagementPolicy withMode(ApplicationManagementMode mode) { + this.mode = mode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationNotificationEndpoint.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationNotificationEndpoint.java new file mode 100644 index 000000000000..8828a77c4371 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationNotificationEndpoint.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application notification endpoint. */ +@Fluent +public final class ApplicationNotificationEndpoint { + /* + * The managed application notification endpoint uri. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /** Creates an instance of ApplicationNotificationEndpoint class. */ + public ApplicationNotificationEndpoint() { + } + + /** + * Get the uri property: The managed application notification endpoint uri. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The managed application notification endpoint uri. + * + * @param uri the uri value to set. + * @return the ApplicationNotificationEndpoint object itself. + */ + public ApplicationNotificationEndpoint withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (uri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property uri in model ApplicationNotificationEndpoint")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationNotificationEndpoint.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationNotificationPolicy.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationNotificationPolicy.java new file mode 100644 index 000000000000..a1bd7eda7a73 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationNotificationPolicy.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Managed application notification policy. */ +@Fluent +public final class ApplicationNotificationPolicy { + /* + * The managed application notification endpoint. + */ + @JsonProperty(value = "notificationEndpoints", required = true) + private List notificationEndpoints; + + /** Creates an instance of ApplicationNotificationPolicy class. */ + public ApplicationNotificationPolicy() { + } + + /** + * Get the notificationEndpoints property: The managed application notification endpoint. + * + * @return the notificationEndpoints value. + */ + public List notificationEndpoints() { + return this.notificationEndpoints; + } + + /** + * Set the notificationEndpoints property: The managed application notification endpoint. + * + * @param notificationEndpoints the notificationEndpoints value to set. + * @return the ApplicationNotificationPolicy object itself. + */ + public ApplicationNotificationPolicy withNotificationEndpoints( + List notificationEndpoints) { + this.notificationEndpoints = notificationEndpoints; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (notificationEndpoints() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property notificationEndpoints in model ApplicationNotificationPolicy")); + } else { + notificationEndpoints().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationNotificationPolicy.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPackageContact.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPackageContact.java new file mode 100644 index 000000000000..1566d82d938d --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPackageContact.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The application package contact information. */ +@Fluent +public final class ApplicationPackageContact { + /* + * The contact name. + */ + @JsonProperty(value = "contactName") + private String contactName; + + /* + * The contact email. + */ + @JsonProperty(value = "email", required = true) + private String email; + + /* + * The contact phone number. + */ + @JsonProperty(value = "phone", required = true) + private String phone; + + /** Creates an instance of ApplicationPackageContact class. */ + public ApplicationPackageContact() { + } + + /** + * Get the contactName property: The contact name. + * + * @return the contactName value. + */ + public String contactName() { + return this.contactName; + } + + /** + * Set the contactName property: The contact name. + * + * @param contactName the contactName value to set. + * @return the ApplicationPackageContact object itself. + */ + public ApplicationPackageContact withContactName(String contactName) { + this.contactName = contactName; + return this; + } + + /** + * Get the email property: The contact email. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: The contact email. + * + * @param email the email value to set. + * @return the ApplicationPackageContact object itself. + */ + public ApplicationPackageContact withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the phone property: The contact phone number. + * + * @return the phone value. + */ + public String phone() { + return this.phone; + } + + /** + * Set the phone property: The contact phone number. + * + * @param phone the phone value to set. + * @return the ApplicationPackageContact object itself. + */ + public ApplicationPackageContact withPhone(String phone) { + this.phone = phone; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (email() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property email in model ApplicationPackageContact")); + } + if (phone() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property phone in model ApplicationPackageContact")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApplicationPackageContact.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPackageLockingPolicyDefinition.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPackageLockingPolicyDefinition.java new file mode 100644 index 000000000000..6cac108da82c --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPackageLockingPolicyDefinition.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Managed application locking policy. */ +@Fluent +public final class ApplicationPackageLockingPolicyDefinition { + /* + * The deny assignment excluded actions. + */ + @JsonProperty(value = "allowedActions") + private List allowedActions; + + /* + * The deny assignment excluded data actions. + */ + @JsonProperty(value = "allowedDataActions") + private List allowedDataActions; + + /** Creates an instance of ApplicationPackageLockingPolicyDefinition class. */ + public ApplicationPackageLockingPolicyDefinition() { + } + + /** + * Get the allowedActions property: The deny assignment excluded actions. + * + * @return the allowedActions value. + */ + public List allowedActions() { + return this.allowedActions; + } + + /** + * Set the allowedActions property: The deny assignment excluded actions. + * + * @param allowedActions the allowedActions value to set. + * @return the ApplicationPackageLockingPolicyDefinition object itself. + */ + public ApplicationPackageLockingPolicyDefinition withAllowedActions(List allowedActions) { + this.allowedActions = allowedActions; + return this; + } + + /** + * Get the allowedDataActions property: The deny assignment excluded data actions. + * + * @return the allowedDataActions value. + */ + public List allowedDataActions() { + return this.allowedDataActions; + } + + /** + * Set the allowedDataActions property: The deny assignment excluded data actions. + * + * @param allowedDataActions the allowedDataActions value to set. + * @return the ApplicationPackageLockingPolicyDefinition object itself. + */ + public ApplicationPackageLockingPolicyDefinition withAllowedDataActions(List allowedDataActions) { + this.allowedDataActions = allowedDataActions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPackageSupportUrls.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPackageSupportUrls.java new file mode 100644 index 000000000000..5af6414a616e --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPackageSupportUrls.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The appliance package support URLs. */ +@Fluent +public final class ApplicationPackageSupportUrls { + /* + * The public azure support URL. + */ + @JsonProperty(value = "publicAzure") + private String publicAzure; + + /* + * The government cloud support URL. + */ + @JsonProperty(value = "governmentCloud") + private String governmentCloud; + + /** Creates an instance of ApplicationPackageSupportUrls class. */ + public ApplicationPackageSupportUrls() { + } + + /** + * Get the publicAzure property: The public azure support URL. + * + * @return the publicAzure value. + */ + public String publicAzure() { + return this.publicAzure; + } + + /** + * Set the publicAzure property: The public azure support URL. + * + * @param publicAzure the publicAzure value to set. + * @return the ApplicationPackageSupportUrls object itself. + */ + public ApplicationPackageSupportUrls withPublicAzure(String publicAzure) { + this.publicAzure = publicAzure; + return this; + } + + /** + * Get the governmentCloud property: The government cloud support URL. + * + * @return the governmentCloud value. + */ + public String governmentCloud() { + return this.governmentCloud; + } + + /** + * Set the governmentCloud property: The government cloud support URL. + * + * @param governmentCloud the governmentCloud value to set. + * @return the ApplicationPackageSupportUrls object itself. + */ + public ApplicationPackageSupportUrls withGovernmentCloud(String governmentCloud) { + this.governmentCloud = governmentCloud; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPatchable.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPatchable.java index 54b8f31c7df7..3cf5aaef9f7e 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPatchable.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPatchable.java @@ -4,222 +4,203 @@ package com.azure.resourcemanager.managedapplications.models; -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPropertiesPatchable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; +import java.util.List; import java.util.Map; -/** Information about managed application. */ -@Fluent -public final class ApplicationPatchable extends GenericResource { - /* - * The managed application properties. +/** An immutable client-side representation of ApplicationPatchable. */ +public interface ApplicationPatchable { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. */ - @JsonProperty(value = "properties") - private ApplicationPropertiesPatchable innerProperties; + String id(); - /* - * The plan information. + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. */ - @JsonProperty(value = "plan") - private PlanPatchable plan; + String type(); - /* - * The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. */ - @JsonProperty(value = "kind") - private String kind; + String location(); - /** Creates an instance of ApplicationPatchable class. */ - public ApplicationPatchable() { - } + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); /** - * Get the innerProperties property: The managed application properties. + * Gets the managedBy property: ID of the resource that manages this resource. * - * @return the innerProperties value. + * @return the managedBy value. */ - private ApplicationPropertiesPatchable innerProperties() { - return this.innerProperties; - } + String managedBy(); /** - * Get the plan property: The plan information. + * Gets the sku property: The SKU of the resource. * - * @return the plan value. + * @return the sku value. */ - public PlanPatchable plan() { - return this.plan; - } + Sku sku(); /** - * Set the plan property: The plan information. + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. * - * @param plan the plan value to set. - * @return the ApplicationPatchable object itself. + * @return the systemData value. */ - public ApplicationPatchable withPlan(PlanPatchable plan) { - this.plan = plan; - return this; - } + SystemData systemData(); /** - * Get the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * Gets the plan property: The plan information. + * + * @return the plan value. + */ + PlanPatchable plan(); + + /** + * Gets the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. * * @return the kind value. */ - public String kind() { - return this.kind; - } + String kind(); /** - * Set the kind property: The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. + * Gets the identity property: The identity of the resource. * - * @param kind the kind value to set. - * @return the ApplicationPatchable object itself. + * @return the identity value. */ - public ApplicationPatchable withKind(String kind) { - this.kind = kind; - return this; - } + Identity identity(); - /** {@inheritDoc} */ - @Override - public ApplicationPatchable withManagedBy(String managedBy) { - super.withManagedBy(managedBy); - return this; - } + /** + * Gets the managedResourceGroupId property: The managed resource group Id. + * + * @return the managedResourceGroupId value. + */ + String managedResourceGroupId(); - /** {@inheritDoc} */ - @Override - public ApplicationPatchable withSku(Sku sku) { - super.withSku(sku); - return this; - } + /** + * Gets the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * + * @return the applicationDefinitionId value. + */ + String applicationDefinitionId(); - /** {@inheritDoc} */ - @Override - public ApplicationPatchable withIdentity(Identity identity) { - super.withIdentity(identity); - return this; - } + /** + * Gets the parameters property: Name and value pairs that define the managed application parameters. It can be a + * JObject or a well formed JSON string. + * + * @return the parameters value. + */ + Object parameters(); - /** {@inheritDoc} */ - @Override - public ApplicationPatchable withLocation(String location) { - super.withLocation(location); - return this; - } + /** + * Gets the outputs property: Name and value pairs that define the managed application outputs. + * + * @return the outputs value. + */ + Object outputs(); - /** {@inheritDoc} */ - @Override - public ApplicationPatchable withTags(Map tags) { - super.withTags(tags); - return this; - } + /** + * Gets the provisioningState property: The managed application provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); /** - * Get the managedResourceGroupId property: The managed resource group Id. + * Gets the billingDetails property: The managed application billing details. * - * @return the managedResourceGroupId value. + * @return the billingDetails value. */ - public String managedResourceGroupId() { - return this.innerProperties() == null ? null : this.innerProperties().managedResourceGroupId(); - } + ApplicationBillingDetailsDefinition billingDetails(); /** - * Set the managedResourceGroupId property: The managed resource group Id. + * Gets the jitAccessPolicy property: The managed application Jit access policy. * - * @param managedResourceGroupId the managedResourceGroupId value to set. - * @return the ApplicationPatchable object itself. + * @return the jitAccessPolicy value. */ - public ApplicationPatchable withManagedResourceGroupId(String managedResourceGroupId) { - if (this.innerProperties() == null) { - this.innerProperties = new ApplicationPropertiesPatchable(); - } - this.innerProperties().withManagedResourceGroupId(managedResourceGroupId); - return this; - } + ApplicationJitAccessPolicy jitAccessPolicy(); /** - * Get the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * Gets the publisherTenantId property: The publisher tenant Id. * - * @return the applicationDefinitionId value. + * @return the publisherTenantId value. */ - public String applicationDefinitionId() { - return this.innerProperties() == null ? null : this.innerProperties().applicationDefinitionId(); - } + String publisherTenantId(); /** - * Set the applicationDefinitionId property: The fully qualified path of managed application definition Id. + * Gets the authorizations property: The read-only authorizations property that is retrieved from the application + * package. * - * @param applicationDefinitionId the applicationDefinitionId value to set. - * @return the ApplicationPatchable object itself. + * @return the authorizations value. */ - public ApplicationPatchable withApplicationDefinitionId(String applicationDefinitionId) { - if (this.innerProperties() == null) { - this.innerProperties = new ApplicationPropertiesPatchable(); - } - this.innerProperties().withApplicationDefinitionId(applicationDefinitionId); - return this; - } + List authorizations(); /** - * Get the parameters property: Name and value pairs that define the managed application parameters. It can be a - * JObject or a well formed JSON string. + * Gets the managementMode property: The managed application management mode. * - * @return the parameters value. + * @return the managementMode value. */ - public Object parameters() { - return this.innerProperties() == null ? null : this.innerProperties().parameters(); - } + ApplicationManagementMode managementMode(); /** - * Set the parameters property: Name and value pairs that define the managed application parameters. It can be a - * JObject or a well formed JSON string. + * Gets the customerSupport property: The read-only customer support property that is retrieved from the application + * package. * - * @param parameters the parameters value to set. - * @return the ApplicationPatchable object itself. + * @return the customerSupport value. */ - public ApplicationPatchable withParameters(Object parameters) { - if (this.innerProperties() == null) { - this.innerProperties = new ApplicationPropertiesPatchable(); - } - this.innerProperties().withParameters(parameters); - return this; - } + ApplicationPackageContact customerSupport(); /** - * Get the outputs property: Name and value pairs that define the managed application outputs. + * Gets the supportUrls property: The read-only support URLs property that is retrieved from the application + * package. * - * @return the outputs value. + * @return the supportUrls value. */ - public Object outputs() { - return this.innerProperties() == null ? null : this.innerProperties().outputs(); - } + ApplicationPackageSupportUrls supportUrls(); /** - * Get the provisioningState property: The managed application provisioning state. + * Gets the artifacts property: The collection of managed application artifacts. * - * @return the provisioningState value. + * @return the artifacts value. + */ + List artifacts(); + + /** + * Gets the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + ApplicationClientDetails createdBy(); + + /** + * Gets the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. */ - public ProvisioningState provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); - } + ApplicationClientDetails updatedBy(); /** - * Validates the instance. + * Gets the inner com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner object. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @return the inner object. */ - @Override - public void validate() { - super.validate(); - if (innerProperties() != null) { - innerProperties().validate(); - } - if (plan() != null) { - plan().validate(); - } - } + ApplicationPatchableInner innerModel(); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPolicy.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPolicy.java new file mode 100644 index 000000000000..0e58aee9fbd7 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ApplicationPolicy.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed application policy. */ +@Fluent +public final class ApplicationPolicy { + /* + * The policy name + */ + @JsonProperty(value = "name") + private String name; + + /* + * The policy definition Id. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /* + * The policy parameters. + */ + @JsonProperty(value = "parameters") + private String parameters; + + /** Creates an instance of ApplicationPolicy class. */ + public ApplicationPolicy() { + } + + /** + * Get the name property: The policy name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The policy name. + * + * @param name the name value to set. + * @return the ApplicationPolicy object itself. + */ + public ApplicationPolicy withName(String name) { + this.name = name; + return this; + } + + /** + * Get the policyDefinitionId property: The policy definition Id. + * + * @return the policyDefinitionId value. + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the policyDefinitionId property: The policy definition Id. + * + * @param policyDefinitionId the policyDefinitionId value to set. + * @return the ApplicationPolicy object itself. + */ + public ApplicationPolicy withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get the parameters property: The policy parameters. + * + * @return the parameters value. + */ + public String parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The policy parameters. + * + * @param parameters the parameters value to set. + * @return the ApplicationPolicy object itself. + */ + public ApplicationPolicy withParameters(String parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Applications.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Applications.java index 2550f0c18099..deb9e5f43937 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Applications.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Applications.java @@ -8,6 +8,8 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationInner; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; /** Resource collection API of Applications. */ public interface Applications { @@ -18,8 +20,7 @@ public interface Applications { * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response}. */ @@ -32,8 +33,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application. */ @@ -45,8 +45,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ void deleteByResourceGroup(String resourceGroupName, String applicationName); @@ -58,56 +57,78 @@ Response getByResourceGroupWithResponse( * @param applicationName The name of the managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ void delete(String resourceGroupName, String applicationName, Context context); /** - * Gets all the applications within a resource group. + * Updates an existing managed application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about managed application. + */ + ApplicationPatchable update(String resourceGroupName, String applicationName); + + /** + * Updates an existing managed application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group as paginated response with {@link PagedIterable}. + * @return information about managed application. + */ + ApplicationPatchable update( + String resourceGroupName, String applicationName, ApplicationPatchableInner parameters, Context context); + + /** + * Lists all the applications within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName); /** - * Gets all the applications within a resource group. + * Lists all the applications within a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a resource group as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ PagedIterable list(); /** - * Gets all the applications within a subscription. + * Lists all the applications within a subscription. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all the applications within a subscription as paginated response with {@link PagedIterable}. + * @return list of managed applications as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); @@ -119,8 +140,7 @@ Response getByResourceGroupWithResponse( * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application along with {@link Response}. */ @@ -133,8 +153,7 @@ Response getByResourceGroupWithResponse( * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managed application. */ @@ -147,8 +166,7 @@ Response getByResourceGroupWithResponse( * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ void deleteById(String applicationId); @@ -161,29 +179,27 @@ Response getByResourceGroupWithResponse( * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ void deleteById(String applicationId, Context context); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. * @param parameters Parameters supplied to the create or update a managed application. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ Application createOrUpdateById(String applicationId, ApplicationInner parameters); /** - * Creates a new managed application. + * Creates or updates a managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, @@ -191,42 +207,146 @@ Response getByResourceGroupWithResponse( * @param parameters Parameters supplied to the create or update a managed application. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ Application createOrUpdateById(String applicationId, ApplicationInner parameters, Context context); /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. - * @param parameters Parameters supplied to update an existing managed application. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about managed application along with {@link Response}. + * @return information about managed application. */ - Response updateByIdWithResponse(String applicationId, ApplicationInner parameters, Context context); + ApplicationPatchable updateById(String applicationId); /** - * Updates an existing managed application. The only value that can be updated via PATCH currently is the tags. + * Updates an existing managed application. * * @param applicationId The fully qualified ID of the managed application, including the managed application name * and the managed application resource type. Use the format, * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name}. + * @param parameters Parameters supplied to update an existing managed application. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.managedapplications.models.ErrorResponseException thrown if the request is - * rejected by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about managed application. */ - Application updateById(String applicationId); + ApplicationPatchable updateById(String applicationId, ApplicationPatchableInner parameters, Context context); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshPermissions(String resourceGroupName, String applicationName); + + /** + * Refresh Permissions for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshPermissions(String resourceGroupName, String applicationName, Context context); + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan along with {@link Response}. + */ + Response listAllowedUpgradePlansWithResponse( + String resourceGroupName, String applicationName, Context context); + + /** + * List allowed upgrade plans for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of plan. + */ + AllowedUpgradePlansResult listAllowedUpgradePlans(String resourceGroupName, String applicationName); + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + UpdateAccessDefinition updateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters); + + /** + * Update access for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + UpdateAccessDefinition updateAccess( + String resourceGroupName, String applicationName, UpdateAccessDefinitionInner parameters, Context context); + + /** + * List tokens for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens along with {@link Response}. + */ + Response listTokensWithResponse( + String resourceGroupName, String applicationName, ListTokenRequest parameters, Context context); + + /** + * List tokens for application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Request body parameters to list tokens. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the array of managed identity tokens. + */ + ManagedIdentityTokenResult listTokens( + String resourceGroupName, String applicationName, ListTokenRequest parameters); /** * Begins definition for a new Application resource. diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/DeploymentMode.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/DeploymentMode.java new file mode 100644 index 000000000000..82ac29c3e5a8 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/DeploymentMode.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The deployment mode. */ +public final class DeploymentMode extends ExpandableStringEnum { + /** Static value NotSpecified for DeploymentMode. */ + public static final DeploymentMode NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Incremental for DeploymentMode. */ + public static final DeploymentMode INCREMENTAL = fromString("Incremental"); + + /** Static value Complete for DeploymentMode. */ + public static final DeploymentMode COMPLETE = fromString("Complete"); + + /** + * Creates a new instance of DeploymentMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DeploymentMode() { + } + + /** + * Creates or finds a DeploymentMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeploymentMode. + */ + @JsonCreator + public static DeploymentMode fromString(String name) { + return fromString(name, DeploymentMode.class); + } + + /** + * Gets known DeploymentMode values. + * + * @return known DeploymentMode values. + */ + public static Collection values() { + return values(DeploymentMode.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ErrorResponse.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ErrorResponse.java deleted file mode 100644 index 8afdca8c51de..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ErrorResponse.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.azure.resourcemanager.managedapplications.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Error response indicates managed application is not able to process the incoming request. The reason is provided in - * the error message. - */ -@Fluent -public final class ErrorResponse { - /* - * Http status code. - */ - @JsonProperty(value = "httpStatus") - private String httpStatus; - - /* - * Error code. - */ - @JsonProperty(value = "errorCode") - private String errorCode; - - /* - * Error message indicating why the operation failed. - */ - @JsonProperty(value = "errorMessage") - private String errorMessage; - - /** Creates an instance of ErrorResponse class. */ - public ErrorResponse() { - } - - /** - * Get the httpStatus property: Http status code. - * - * @return the httpStatus value. - */ - public String httpStatus() { - return this.httpStatus; - } - - /** - * Set the httpStatus property: Http status code. - * - * @param httpStatus the httpStatus value to set. - * @return the ErrorResponse object itself. - */ - public ErrorResponse withHttpStatus(String httpStatus) { - this.httpStatus = httpStatus; - return this; - } - - /** - * Get the errorCode property: Error code. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: Error code. - * - * @param errorCode the errorCode value to set. - * @return the ErrorResponse object itself. - */ - public ErrorResponse withErrorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } - - /** - * Get the errorMessage property: Error message indicating why the operation failed. - * - * @return the errorMessage value. - */ - public String errorMessage() { - return this.errorMessage; - } - - /** - * Set the errorMessage property: Error message indicating why the operation failed. - * - * @param errorMessage the errorMessage value to set. - * @return the ErrorResponse object itself. - */ - public ErrorResponse withErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ErrorResponseException.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ErrorResponseException.java deleted file mode 100644 index 9064f93c913e..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ErrorResponseException.java +++ /dev/null @@ -1,38 +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.resourcemanager.managedapplications.models; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpResponse; - -/** Exception thrown for an invalid response with ErrorResponse information. */ -public final class ErrorResponseException extends HttpResponseException { - /** - * Initializes a new instance of the ErrorResponseException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public ErrorResponseException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the ErrorResponseException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public ErrorResponseException(String message, HttpResponse response, ErrorResponse value) { - super(message, response, value); - } - - /** {@inheritDoc} */ - @Override - public ErrorResponse getValue() { - return (ErrorResponse) super.getValue(); - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/GenericResource.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/GenericResource.java index dacd6e5b7321..7e9f6369d713 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/GenericResource.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/GenericResource.java @@ -6,6 +6,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -25,10 +26,10 @@ public class GenericResource extends Resource { private Sku sku; /* - * The identity of the resource. + * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "identity") - private Identity identity; + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; /** Creates an instance of GenericResource class. */ public GenericResource() { @@ -75,23 +76,12 @@ public GenericResource withSku(Sku sku) { } /** - * Get the identity property: The identity of the resource. + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. * - * @return the identity value. + * @return the systemData value. */ - public Identity identity() { - return this.identity; - } - - /** - * Set the identity property: The identity of the resource. - * - * @param identity the identity value to set. - * @return the GenericResource object itself. - */ - public GenericResource withIdentity(Identity identity) { - this.identity = identity; - return this; + public SystemData systemData() { + return this.systemData; } /** {@inheritDoc} */ @@ -117,8 +107,5 @@ public void validate() { if (sku() != null) { sku().validate(); } - if (identity() != null) { - identity().validate(); - } } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Identity.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Identity.java index 7b9737e4b6eb..e294101afc7d 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Identity.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Identity.java @@ -5,11 +5,13 @@ package com.azure.resourcemanager.managedapplications.models; import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; /** Identity for the resource. */ @Fluent -public class Identity { +public final class Identity { /* * The principal ID of resource identity. */ @@ -28,6 +30,15 @@ public class Identity { @JsonProperty(value = "type") private ResourceIdentityType type; + /* + * The list of user identities associated with the resource. The user identity dictionary key references will be + * resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + /** Creates an instance of Identity class. */ public Identity() { } @@ -70,11 +81,45 @@ public Identity withType(ResourceIdentityType type) { return this; } + /** + * Get the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the Identity object itself. + */ + public Identity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitApprovalMode.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitApprovalMode.java new file mode 100644 index 000000000000..a1555daa68dc --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitApprovalMode.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The Jit approval mode. */ +public final class JitApprovalMode extends ExpandableStringEnum { + /** Static value NotSpecified for JitApprovalMode. */ + public static final JitApprovalMode NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value AutoApprove for JitApprovalMode. */ + public static final JitApprovalMode AUTO_APPROVE = fromString("AutoApprove"); + + /** Static value ManualApprove for JitApprovalMode. */ + public static final JitApprovalMode MANUAL_APPROVE = fromString("ManualApprove"); + + /** + * Creates a new instance of JitApprovalMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public JitApprovalMode() { + } + + /** + * Creates or finds a JitApprovalMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding JitApprovalMode. + */ + @JsonCreator + public static JitApprovalMode fromString(String name) { + return fromString(name, JitApprovalMode.class); + } + + /** + * Gets known JitApprovalMode values. + * + * @return known JitApprovalMode values. + */ + public static Collection values() { + return values(JitApprovalMode.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitApproverDefinition.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitApproverDefinition.java new file mode 100644 index 000000000000..e07fea45ff8d --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitApproverDefinition.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** JIT approver definition. */ +@Fluent +public final class JitApproverDefinition { + /* + * The approver service principal Id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The approver type. + */ + @JsonProperty(value = "type") + private JitApproverType type; + + /* + * The approver display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** Creates an instance of JitApproverDefinition class. */ + public JitApproverDefinition() { + } + + /** + * Get the id property: The approver service principal Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The approver service principal Id. + * + * @param id the id value to set. + * @return the JitApproverDefinition object itself. + */ + public JitApproverDefinition withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: The approver type. + * + * @return the type value. + */ + public JitApproverType type() { + return this.type; + } + + /** + * Set the type property: The approver type. + * + * @param type the type value to set. + * @return the JitApproverDefinition object itself. + */ + public JitApproverDefinition withType(JitApproverType type) { + this.type = type; + return this; + } + + /** + * Get the displayName property: The approver display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The approver display name. + * + * @param displayName the displayName value to set. + * @return the JitApproverDefinition object itself. + */ + public JitApproverDefinition withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model JitApproverDefinition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JitApproverDefinition.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitApproverType.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitApproverType.java new file mode 100644 index 000000000000..790223f25396 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitApproverType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The approver type. */ +public final class JitApproverType extends ExpandableStringEnum { + /** Static value user for JitApproverType. */ + public static final JitApproverType USER = fromString("user"); + + /** Static value group for JitApproverType. */ + public static final JitApproverType GROUP = fromString("group"); + + /** + * Creates a new instance of JitApproverType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public JitApproverType() { + } + + /** + * Creates or finds a JitApproverType from its string representation. + * + * @param name a name to look for. + * @return the corresponding JitApproverType. + */ + @JsonCreator + public static JitApproverType fromString(String name) { + return fromString(name, JitApproverType.class); + } + + /** + * Gets known JitApproverType values. + * + * @return known JitApproverType values. + */ + public static Collection values() { + return values(JitApproverType.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitAuthorizationPolicies.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitAuthorizationPolicies.java new file mode 100644 index 000000000000..194d7b817a65 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitAuthorizationPolicies.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JIT authorization policies. */ +@Fluent +public final class JitAuthorizationPolicies { + /* + * The the principal id that will be granted JIT access. + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * The role definition id that will be granted to the Principal. + */ + @JsonProperty(value = "roleDefinitionId", required = true) + private String roleDefinitionId; + + /** Creates an instance of JitAuthorizationPolicies class. */ + public JitAuthorizationPolicies() { + } + + /** + * Get the principalId property: The the principal id that will be granted JIT access. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The the principal id that will be granted JIT access. + * + * @param principalId the principalId value to set. + * @return the JitAuthorizationPolicies object itself. + */ + public JitAuthorizationPolicies withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the roleDefinitionId property: The role definition id that will be granted to the Principal. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The role definition id that will be granted to the Principal. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the JitAuthorizationPolicies object itself. + */ + public JitAuthorizationPolicies withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (principalId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property principalId in model JitAuthorizationPolicies")); + } + if (roleDefinitionId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property roleDefinitionId in model JitAuthorizationPolicies")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JitAuthorizationPolicies.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestDefinition.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestDefinition.java new file mode 100644 index 000000000000..ac8ca2da5e4a --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestDefinition.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of JitRequestDefinition. */ +public interface JitRequestDefinition { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the applicationResourceId property: The parent application id. + * + * @return the applicationResourceId value. + */ + String applicationResourceId(); + + /** + * Gets the publisherTenantId property: The publisher tenant id. + * + * @return the publisherTenantId value. + */ + String publisherTenantId(); + + /** + * Gets the jitAuthorizationPolicies property: The JIT authorization policies. + * + * @return the jitAuthorizationPolicies value. + */ + List jitAuthorizationPolicies(); + + /** + * Gets the jitSchedulingPolicy property: The JIT request properties. + * + * @return the jitSchedulingPolicy value. + */ + JitSchedulingPolicy jitSchedulingPolicy(); + + /** + * Gets the provisioningState property: The JIT request provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the jitRequestState property: The JIT request state. + * + * @return the jitRequestState value. + */ + JitRequestState jitRequestState(); + + /** + * Gets the createdBy property: The client entity that created the JIT request. + * + * @return the createdBy value. + */ + ApplicationClientDetails createdBy(); + + /** + * Gets the updatedBy property: The client entity that last updated the JIT request. + * + * @return the updatedBy value. + */ + ApplicationClientDetails updatedBy(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionInner object. + * + * @return the inner object. + */ + JitRequestDefinitionInner innerModel(); + + /** The entirety of the JitRequestDefinition definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + + /** The JitRequestDefinition definition stages. */ + interface DefinitionStages { + /** The first stage of the JitRequestDefinition definition. */ + interface Blank extends WithLocation { + } + + /** The stage of the JitRequestDefinition definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** The stage of the JitRequestDefinition definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the JitRequestDefinition definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithApplicationResourceId, + DefinitionStages.WithJitAuthorizationPolicies, + DefinitionStages.WithJitSchedulingPolicy { + /** + * Executes the create request. + * + * @return the created resource. + */ + JitRequestDefinition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JitRequestDefinition create(Context context); + } + + /** The stage of the JitRequestDefinition definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** The stage of the JitRequestDefinition definition allowing to specify applicationResourceId. */ + interface WithApplicationResourceId { + /** + * Specifies the applicationResourceId property: The parent application id.. + * + * @param applicationResourceId The parent application id. + * @return the next definition stage. + */ + WithCreate withApplicationResourceId(String applicationResourceId); + } + + /** The stage of the JitRequestDefinition definition allowing to specify jitAuthorizationPolicies. */ + interface WithJitAuthorizationPolicies { + /** + * Specifies the jitAuthorizationPolicies property: The JIT authorization policies.. + * + * @param jitAuthorizationPolicies The JIT authorization policies. + * @return the next definition stage. + */ + WithCreate withJitAuthorizationPolicies(List jitAuthorizationPolicies); + } + + /** The stage of the JitRequestDefinition definition allowing to specify jitSchedulingPolicy. */ + interface WithJitSchedulingPolicy { + /** + * Specifies the jitSchedulingPolicy property: The JIT request properties.. + * + * @param jitSchedulingPolicy The JIT request properties. + * @return the next definition stage. + */ + WithCreate withJitSchedulingPolicy(JitSchedulingPolicy jitSchedulingPolicy); + } + } + + /** + * Begins update for the JitRequestDefinition resource. + * + * @return the stage of resource update. + */ + JitRequestDefinition.Update update(); + + /** The template for JitRequestDefinition update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JitRequestDefinition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JitRequestDefinition apply(Context context); + } + + /** The JitRequestDefinition update stages. */ + interface UpdateStages { + /** The stage of the JitRequestDefinition update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Jit request tags. + * + * @param tags Jit request tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JitRequestDefinition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JitRequestDefinition refresh(Context context); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestDefinitionListResult.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestDefinitionListResult.java new file mode 100644 index 000000000000..b4e6822bdfbe --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestDefinitionListResult.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionListResultInner; +import java.util.List; + +/** An immutable client-side representation of JitRequestDefinitionListResult. */ +public interface JitRequestDefinitionListResult { + /** + * Gets the value property: The array of Jit request definition. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.managedapplications.fluent.models.JitRequestDefinitionListResultInner + * object. + * + * @return the inner object. + */ + JitRequestDefinitionListResultInner innerModel(); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestMetadata.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestMetadata.java new file mode 100644 index 000000000000..cf92048fbe8c --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestMetadata.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JIT request metadata. */ +@Fluent +public final class JitRequestMetadata { + /* + * The origin request id. + */ + @JsonProperty(value = "originRequestId") + private String originRequestId; + + /* + * The requestor id. + */ + @JsonProperty(value = "requestorId") + private String requestorId; + + /* + * The publisher's tenant name. + */ + @JsonProperty(value = "tenantDisplayName") + private String tenantDisplayName; + + /* + * The subject display name. + */ + @JsonProperty(value = "subjectDisplayName") + private String subjectDisplayName; + + /** Creates an instance of JitRequestMetadata class. */ + public JitRequestMetadata() { + } + + /** + * Get the originRequestId property: The origin request id. + * + * @return the originRequestId value. + */ + public String originRequestId() { + return this.originRequestId; + } + + /** + * Set the originRequestId property: The origin request id. + * + * @param originRequestId the originRequestId value to set. + * @return the JitRequestMetadata object itself. + */ + public JitRequestMetadata withOriginRequestId(String originRequestId) { + this.originRequestId = originRequestId; + return this; + } + + /** + * Get the requestorId property: The requestor id. + * + * @return the requestorId value. + */ + public String requestorId() { + return this.requestorId; + } + + /** + * Set the requestorId property: The requestor id. + * + * @param requestorId the requestorId value to set. + * @return the JitRequestMetadata object itself. + */ + public JitRequestMetadata withRequestorId(String requestorId) { + this.requestorId = requestorId; + return this; + } + + /** + * Get the tenantDisplayName property: The publisher's tenant name. + * + * @return the tenantDisplayName value. + */ + public String tenantDisplayName() { + return this.tenantDisplayName; + } + + /** + * Set the tenantDisplayName property: The publisher's tenant name. + * + * @param tenantDisplayName the tenantDisplayName value to set. + * @return the JitRequestMetadata object itself. + */ + public JitRequestMetadata withTenantDisplayName(String tenantDisplayName) { + this.tenantDisplayName = tenantDisplayName; + return this; + } + + /** + * Get the subjectDisplayName property: The subject display name. + * + * @return the subjectDisplayName value. + */ + public String subjectDisplayName() { + return this.subjectDisplayName; + } + + /** + * Set the subjectDisplayName property: The subject display name. + * + * @param subjectDisplayName the subjectDisplayName value to set. + * @return the JitRequestMetadata object itself. + */ + public JitRequestMetadata withSubjectDisplayName(String subjectDisplayName) { + this.subjectDisplayName = subjectDisplayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestPatchable.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestPatchable.java new file mode 100644 index 000000000000..7a5c0e770544 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestPatchable.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Information about JIT request. */ +@Fluent +public final class JitRequestPatchable { + /* + * Jit request tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of JitRequestPatchable class. */ + public JitRequestPatchable() { + } + + /** + * Get the tags property: Jit request tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Jit request tags. + * + * @param tags the tags value to set. + * @return the JitRequestPatchable object itself. + */ + public JitRequestPatchable withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestState.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestState.java new file mode 100644 index 000000000000..503d3c56cf2e --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequestState.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The JIT request state. */ +public final class JitRequestState extends ExpandableStringEnum { + /** Static value NotSpecified for JitRequestState. */ + public static final JitRequestState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Pending for JitRequestState. */ + public static final JitRequestState PENDING = fromString("Pending"); + + /** Static value Approved for JitRequestState. */ + public static final JitRequestState APPROVED = fromString("Approved"); + + /** Static value Denied for JitRequestState. */ + public static final JitRequestState DENIED = fromString("Denied"); + + /** Static value Failed for JitRequestState. */ + public static final JitRequestState FAILED = fromString("Failed"); + + /** Static value Canceled for JitRequestState. */ + public static final JitRequestState CANCELED = fromString("Canceled"); + + /** Static value Expired for JitRequestState. */ + public static final JitRequestState EXPIRED = fromString("Expired"); + + /** Static value Timeout for JitRequestState. */ + public static final JitRequestState TIMEOUT = fromString("Timeout"); + + /** + * Creates a new instance of JitRequestState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public JitRequestState() { + } + + /** + * Creates or finds a JitRequestState from its string representation. + * + * @param name a name to look for. + * @return the corresponding JitRequestState. + */ + @JsonCreator + public static JitRequestState fromString(String name) { + return fromString(name, JitRequestState.class); + } + + /** + * Gets known JitRequestState values. + * + * @return known JitRequestState values. + */ + public static Collection values() { + return values(JitRequestState.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequests.java new file mode 100644 index 000000000000..0a220ebe7575 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitRequests.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JitRequests. */ +public interface JitRequests { + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String jitRequestName, Context context); + + /** + * Gets the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request. + */ + JitRequestDefinition getByResourceGroup(String resourceGroupName, String jitRequestName); + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String jitRequestName, Context context); + + /** + * Deletes the JIT request. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param jitRequestName The name of the JIT request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String jitRequestName); + + /** + * Lists all JIT requests within the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response}. + */ + Response listBySubscriptionWithResponse(Context context); + + /** + * Lists all JIT requests within the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + JitRequestDefinitionListResult listBySubscription(); + + /** + * Lists all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests along with {@link Response}. + */ + Response listByResourceGroupWithResponse(String resourceGroupName, Context context); + + /** + * Lists all JIT requests within the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of JIT requests. + */ + JitRequestDefinitionListResult listByResourceGroup(String resourceGroupName); + + /** + * Gets the JIT request. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request along with {@link Response}. + */ + JitRequestDefinition getById(String id); + + /** + * Gets the JIT request. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the JIT request along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the JIT request. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the JIT request. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JitRequestDefinition resource. + * + * @param name resource name. + * @return the first stage of the new JitRequestDefinition definition. + */ + JitRequestDefinition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitSchedulingPolicy.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitSchedulingPolicy.java new file mode 100644 index 000000000000..4b0a00f483c5 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitSchedulingPolicy.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.time.OffsetDateTime; + +/** The JIT scheduling policies. */ +@Fluent +public final class JitSchedulingPolicy { + /* + * The type of JIT schedule. + */ + @JsonProperty(value = "type", required = true) + private JitSchedulingType type; + + /* + * The required duration of the JIT request. + */ + @JsonProperty(value = "duration", required = true) + private Duration duration; + + /* + * The start time of the request. + */ + @JsonProperty(value = "startTime", required = true) + private OffsetDateTime startTime; + + /** Creates an instance of JitSchedulingPolicy class. */ + public JitSchedulingPolicy() { + } + + /** + * Get the type property: The type of JIT schedule. + * + * @return the type value. + */ + public JitSchedulingType type() { + return this.type; + } + + /** + * Set the type property: The type of JIT schedule. + * + * @param type the type value to set. + * @return the JitSchedulingPolicy object itself. + */ + public JitSchedulingPolicy withType(JitSchedulingType type) { + this.type = type; + return this; + } + + /** + * Get the duration property: The required duration of the JIT request. + * + * @return the duration value. + */ + public Duration duration() { + return this.duration; + } + + /** + * Set the duration property: The required duration of the JIT request. + * + * @param duration the duration value to set. + * @return the JitSchedulingPolicy object itself. + */ + public JitSchedulingPolicy withDuration(Duration duration) { + this.duration = duration; + return this; + } + + /** + * Get the startTime property: The start time of the request. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the request. + * + * @param startTime the startTime value to set. + * @return the JitSchedulingPolicy object itself. + */ + public JitSchedulingPolicy withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model JitSchedulingPolicy")); + } + if (duration() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property duration in model JitSchedulingPolicy")); + } + if (startTime() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property startTime in model JitSchedulingPolicy")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JitSchedulingPolicy.class); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitSchedulingType.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitSchedulingType.java new file mode 100644 index 000000000000..8991f0c3415b --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/JitSchedulingType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The JIT request scheduling type. */ +public final class JitSchedulingType extends ExpandableStringEnum { + /** Static value NotSpecified for JitSchedulingType. */ + public static final JitSchedulingType NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Once for JitSchedulingType. */ + public static final JitSchedulingType ONCE = fromString("Once"); + + /** Static value Recurring for JitSchedulingType. */ + public static final JitSchedulingType RECURRING = fromString("Recurring"); + + /** + * Creates a new instance of JitSchedulingType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public JitSchedulingType() { + } + + /** + * Creates or finds a JitSchedulingType from its string representation. + * + * @param name a name to look for. + * @return the corresponding JitSchedulingType. + */ + @JsonCreator + public static JitSchedulingType fromString(String name) { + return fromString(name, JitSchedulingType.class); + } + + /** + * Gets known JitSchedulingType values. + * + * @return known JitSchedulingType values. + */ + public static Collection values() { + return values(JitSchedulingType.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ListTokenRequest.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ListTokenRequest.java new file mode 100644 index 000000000000..75674af6a1e8 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ListTokenRequest.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List token request body. */ +@Fluent +public final class ListTokenRequest { + /* + * The authorization audience. + */ + @JsonProperty(value = "authorizationAudience") + private String authorizationAudience; + + /* + * The user assigned identities. + */ + @JsonProperty(value = "userAssignedIdentities") + private List userAssignedIdentities; + + /** Creates an instance of ListTokenRequest class. */ + public ListTokenRequest() { + } + + /** + * Get the authorizationAudience property: The authorization audience. + * + * @return the authorizationAudience value. + */ + public String authorizationAudience() { + return this.authorizationAudience; + } + + /** + * Set the authorizationAudience property: The authorization audience. + * + * @param authorizationAudience the authorizationAudience value to set. + * @return the ListTokenRequest object itself. + */ + public ListTokenRequest withAuthorizationAudience(String authorizationAudience) { + this.authorizationAudience = authorizationAudience; + return this; + } + + /** + * Get the userAssignedIdentities property: The user assigned identities. + * + * @return the userAssignedIdentities value. + */ + public List userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The user assigned identities. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ListTokenRequest object itself. + */ + public ListTokenRequest withUserAssignedIdentities(List userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ManagedIdentityToken.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ManagedIdentityToken.java new file mode 100644 index 000000000000..90dce4990182 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ManagedIdentityToken.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The managed identity token for the managed app resource. */ +@Fluent +public final class ManagedIdentityToken { + /* + * The requested access token. + */ + @JsonProperty(value = "accessToken") + private String accessToken; + + /* + * The number of seconds the access token will be valid. + */ + @JsonProperty(value = "expiresIn") + private String expiresIn; + + /* + * The timespan when the access token expires. This is represented as the number of seconds from epoch. + */ + @JsonProperty(value = "expiresOn") + private String expiresOn; + + /* + * The timespan when the access token takes effect. This is represented as the number of seconds from epoch. + */ + @JsonProperty(value = "notBefore") + private String notBefore; + + /* + * The aud (audience) the access token was request for. This is the same as what was provided in the listTokens + * request. + */ + @JsonProperty(value = "authorizationAudience") + private String authorizationAudience; + + /* + * The Azure resource ID for the issued token. This is either the managed application ID or the user-assigned + * identity ID. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The type of the token. + */ + @JsonProperty(value = "tokenType") + private String tokenType; + + /** Creates an instance of ManagedIdentityToken class. */ + public ManagedIdentityToken() { + } + + /** + * Get the accessToken property: The requested access token. + * + * @return the accessToken value. + */ + public String accessToken() { + return this.accessToken; + } + + /** + * Set the accessToken property: The requested access token. + * + * @param accessToken the accessToken value to set. + * @return the ManagedIdentityToken object itself. + */ + public ManagedIdentityToken withAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Get the expiresIn property: The number of seconds the access token will be valid. + * + * @return the expiresIn value. + */ + public String expiresIn() { + return this.expiresIn; + } + + /** + * Set the expiresIn property: The number of seconds the access token will be valid. + * + * @param expiresIn the expiresIn value to set. + * @return the ManagedIdentityToken object itself. + */ + public ManagedIdentityToken withExpiresIn(String expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + /** + * Get the expiresOn property: The timespan when the access token expires. This is represented as the number of + * seconds from epoch. + * + * @return the expiresOn value. + */ + public String expiresOn() { + return this.expiresOn; + } + + /** + * Set the expiresOn property: The timespan when the access token expires. This is represented as the number of + * seconds from epoch. + * + * @param expiresOn the expiresOn value to set. + * @return the ManagedIdentityToken object itself. + */ + public ManagedIdentityToken withExpiresOn(String expiresOn) { + this.expiresOn = expiresOn; + return this; + } + + /** + * Get the notBefore property: The timespan when the access token takes effect. This is represented as the number of + * seconds from epoch. + * + * @return the notBefore value. + */ + public String notBefore() { + return this.notBefore; + } + + /** + * Set the notBefore property: The timespan when the access token takes effect. This is represented as the number of + * seconds from epoch. + * + * @param notBefore the notBefore value to set. + * @return the ManagedIdentityToken object itself. + */ + public ManagedIdentityToken withNotBefore(String notBefore) { + this.notBefore = notBefore; + return this; + } + + /** + * Get the authorizationAudience property: The aud (audience) the access token was request for. This is the same as + * what was provided in the listTokens request. + * + * @return the authorizationAudience value. + */ + public String authorizationAudience() { + return this.authorizationAudience; + } + + /** + * Set the authorizationAudience property: The aud (audience) the access token was request for. This is the same as + * what was provided in the listTokens request. + * + * @param authorizationAudience the authorizationAudience value to set. + * @return the ManagedIdentityToken object itself. + */ + public ManagedIdentityToken withAuthorizationAudience(String authorizationAudience) { + this.authorizationAudience = authorizationAudience; + return this; + } + + /** + * Get the resourceId property: The Azure resource ID for the issued token. This is either the managed application + * ID or the user-assigned identity ID. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The Azure resource ID for the issued token. This is either the managed application + * ID or the user-assigned identity ID. + * + * @param resourceId the resourceId value to set. + * @return the ManagedIdentityToken object itself. + */ + public ManagedIdentityToken withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the tokenType property: The type of the token. + * + * @return the tokenType value. + */ + public String tokenType() { + return this.tokenType; + } + + /** + * Set the tokenType property: The type of the token. + * + * @param tokenType the tokenType value to set. + * @return the ManagedIdentityToken object itself. + */ + public ManagedIdentityToken withTokenType(String tokenType) { + this.tokenType = tokenType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ManagedIdentityTokenResult.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ManagedIdentityTokenResult.java new file mode 100644 index 000000000000..0a1070301bab --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ManagedIdentityTokenResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.resourcemanager.managedapplications.fluent.models.ManagedIdentityTokenResultInner; +import java.util.List; + +/** An immutable client-side representation of ManagedIdentityTokenResult. */ +public interface ManagedIdentityTokenResult { + /** + * Gets the value property: The array of managed identity tokens. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.managedapplications.fluent.models.ManagedIdentityTokenResultInner + * object. + * + * @return the inner object. + */ + ManagedIdentityTokenResultInner innerModel(); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Operation.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Operation.java index a1f490a16df2..061331f262e9 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Operation.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Operation.java @@ -9,19 +9,44 @@ /** An immutable client-side representation of Operation. */ public interface Operation { /** - * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". * * @return the name value. */ String name(); /** - * Gets the display property: The object that represents the operation. + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. * * @return the display value. */ OperationDisplay display(); + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + /** * Gets the inner com.azure.resourcemanager.managedapplications.fluent.models.OperationInner object. * diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/OperationDisplay.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/OperationDisplay.java index 6542763fb117..8f1d1af222c0 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/OperationDisplay.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/OperationDisplay.java @@ -4,36 +4,46 @@ package com.azure.resourcemanager.managedapplications.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** The object that represents the operation. */ -@Fluent +/** Localized display information for this particular operation. */ +@Immutable public final class OperationDisplay { /* - * Service provider: Microsoft.Solutions + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". */ - @JsonProperty(value = "provider") + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) private String provider; /* - * Resource on which the operation is performed: Application, JitRequest, etc. + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". */ - @JsonProperty(value = "resource") + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) private String resource; /* - * Operation type: Read, write, delete, etc. + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". */ - @JsonProperty(value = "operation") + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) private String operation; + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + /** Creates an instance of OperationDisplay class. */ public OperationDisplay() { } /** - * Get the provider property: Service provider: Microsoft.Solutions. + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". * * @return the provider value. */ @@ -42,18 +52,8 @@ public String provider() { } /** - * Set the provider property: Service provider: Microsoft.Solutions. - * - * @param provider the provider value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withProvider(String provider) { - this.provider = provider; - return this; - } - - /** - * Get the resource property: Resource on which the operation is performed: Application, JitRequest, etc. + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". * * @return the resource value. */ @@ -62,18 +62,8 @@ public String resource() { } /** - * Set the resource property: Resource on which the operation is performed: Application, JitRequest, etc. - * - * @param resource the resource value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withResource(String resource) { - this.resource = resource; - return this; - } - - /** - * Get the operation property: Operation type: Read, write, delete, etc. + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". * * @return the operation value. */ @@ -82,14 +72,13 @@ public String operation() { } /** - * Set the operation property: Operation type: Read, write, delete, etc. + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. * - * @param operation the operation value to set. - * @return the OperationDisplay object itself. + * @return the description value. */ - public OperationDisplay withOperation(String operation) { - this.operation = operation; - return this; + public String description() { + return this.description; } /** diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/OperationListResult.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/OperationListResult.java index 1740b8263280..97b71eae9cc4 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/OperationListResult.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/OperationListResult.java @@ -4,27 +4,27 @@ package com.azure.resourcemanager.managedapplications.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.resourcemanager.managedapplications.fluent.models.OperationInner; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** - * Result of the request to list Microsoft.Solutions operations. It contains a list of operations and a URL link to get - * the next set of results. + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. */ -@Fluent +@Immutable public final class OperationListResult { /* - * List of Microsoft.Solutions operations. + * List of operations supported by the resource provider */ - @JsonProperty(value = "value") + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* - * URL to get the next set of operation list results if there are any. + * URL to get the next set of operation list results (if there are any). */ - @JsonProperty(value = "nextLink") + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** Creates an instance of OperationListResult class. */ @@ -32,7 +32,7 @@ public OperationListResult() { } /** - * Get the value property: List of Microsoft.Solutions operations. + * Get the value property: List of operations supported by the resource provider. * * @return the value value. */ @@ -41,18 +41,7 @@ public List value() { } /** - * Set the value property: List of Microsoft.Solutions operations. - * - * @param value the value value to set. - * @return the OperationListResult object itself. - */ - public OperationListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: URL to get the next set of operation list results if there are any. + * Get the nextLink property: URL to get the next set of operation list results (if there are any). * * @return the nextLink value. */ @@ -60,17 +49,6 @@ public String nextLink() { return this.nextLink; } - /** - * Set the nextLink property: URL to get the next set of operation list results if there are any. - * - * @param nextLink the nextLink value to set. - * @return the OperationListResult object itself. - */ - public OperationListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Origin.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Origin.java new file mode 100644 index 000000000000..05a6b5908ab8 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Origin.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ProvisioningState.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ProvisioningState.java index 1842f310a44e..b21ea9fead5d 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ProvisioningState.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ProvisioningState.java @@ -10,21 +10,15 @@ /** Provisioning status of the managed application. */ public final class ProvisioningState extends ExpandableStringEnum { + /** Static value NotSpecified for ProvisioningState. */ + public static final ProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + /** Static value Accepted for ProvisioningState. */ public static final ProvisioningState ACCEPTED = fromString("Accepted"); /** Static value Running for ProvisioningState. */ public static final ProvisioningState RUNNING = fromString("Running"); - /** Static value Ready for ProvisioningState. */ - public static final ProvisioningState READY = fromString("Ready"); - - /** Static value Creating for ProvisioningState. */ - public static final ProvisioningState CREATING = fromString("Creating"); - - /** Static value Created for ProvisioningState. */ - public static final ProvisioningState CREATED = fromString("Created"); - /** Static value Deleting for ProvisioningState. */ public static final ProvisioningState DELETING = fromString("Deleting"); diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ResourceIdentityType.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ResourceIdentityType.java index d1a4fed9fdb6..7cf77b70a2c5 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ResourceIdentityType.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ResourceIdentityType.java @@ -10,7 +10,16 @@ /** The identity type. */ public enum ResourceIdentityType { /** Enum value SystemAssigned. */ - SYSTEM_ASSIGNED("SystemAssigned"); + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned, UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, UserAssigned"), + + /** Enum value None. */ + NONE("None"); /** The actual serialized value for a ResourceIdentityType instance. */ private final String value; diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ResourceProviders.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ResourceProviders.java index d649a7805cda..c3eb6aedc289 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ResourceProviders.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/ResourceProviders.java @@ -14,7 +14,7 @@ public interface ResourceProviders { * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations as paginated response with {@link + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link * PagedIterable}. */ PagedIterable listOperations(); @@ -26,7 +26,7 @@ public interface ResourceProviders { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Microsoft.Solutions operations as paginated response with {@link + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link * PagedIterable}. */ PagedIterable listOperations(Context context); diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Status.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Status.java new file mode 100644 index 000000000000..d28db53f1953 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Status.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The JIT status. */ +public final class Status extends ExpandableStringEnum { + /** Static value NotSpecified for Status. */ + public static final Status NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Elevate for Status. */ + public static final Status ELEVATE = fromString("Elevate"); + + /** Static value Remove for Status. */ + public static final Status REMOVE = fromString("Remove"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Substatus.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Substatus.java new file mode 100644 index 000000000000..1a5478019b00 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/Substatus.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The sub status. */ +public final class Substatus extends ExpandableStringEnum { + /** Static value NotSpecified for Substatus. */ + public static final Substatus NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Approved for Substatus. */ + public static final Substatus APPROVED = fromString("Approved"); + + /** Static value Denied for Substatus. */ + public static final Substatus DENIED = fromString("Denied"); + + /** Static value Failed for Substatus. */ + public static final Substatus FAILED = fromString("Failed"); + + /** Static value Expired for Substatus. */ + public static final Substatus EXPIRED = fromString("Expired"); + + /** Static value Timeout for Substatus. */ + public static final Substatus TIMEOUT = fromString("Timeout"); + + /** + * Creates a new instance of Substatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Substatus() { + } + + /** + * Creates or finds a Substatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding Substatus. + */ + @JsonCreator + public static Substatus fromString(String name) { + return fromString(name, Substatus.class); + } + + /** + * Gets known Substatus values. + * + * @return known Substatus values. + */ + public static Collection values() { + return values(Substatus.class); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/UpdateAccessDefinition.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/UpdateAccessDefinition.java new file mode 100644 index 000000000000..2524da0daffc --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/UpdateAccessDefinition.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; + +/** An immutable client-side representation of UpdateAccessDefinition. */ +public interface UpdateAccessDefinition { + /** + * Gets the approver property: The approver name. + * + * @return the approver value. + */ + String approver(); + + /** + * Gets the metadata property: The JIT request metadata. + * + * @return the metadata value. + */ + JitRequestMetadata metadata(); + + /** + * Gets the status property: The JIT status. + * + * @return the status value. + */ + Status status(); + + /** + * Gets the subStatus property: The JIT status. + * + * @return the subStatus value. + */ + Substatus subStatus(); + + /** + * Gets the inner com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner object. + * + * @return the inner object. + */ + UpdateAccessDefinitionInner innerModel(); +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/UserAssignedResourceIdentity.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/UserAssignedResourceIdentity.java new file mode 100644 index 000000000000..7220efbb0fad --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/main/java/com/azure/resourcemanager/managedapplications/models/UserAssignedResourceIdentity.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the user assigned identity that is contained within the UserAssignedIdentities dictionary on + * ResourceIdentity. + */ +@Immutable +public final class UserAssignedResourceIdentity { + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id of user assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** Creates an instance of UserAssignedResourceIdentity class. */ + public UserAssignedResourceIdentity() { + } + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id of user assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateByIdSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateByIdSamples.java index b6b8c9f70967..6a2c5b442b72 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateByIdSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateByIdSamples.java @@ -5,14 +5,14 @@ package com.azure.resourcemanager.managedapplications.generated; import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; import java.util.Arrays; /** Samples for ApplicationDefinitions CreateOrUpdateById. */ public final class ApplicationDefinitionsCreateOrUpdateByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/createOrUpdateApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplicationDefinition.json */ /** * Sample code: Create or update managed application definition. @@ -23,17 +23,16 @@ public static void createOrUpdateManagedApplicationDefinition( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager .applicationDefinitions() - .createOrUpdateById( + .createOrUpdateByIdWithResponse( "rg", "myManagedApplicationDef", new ApplicationDefinitionInner() - .withLocation("East US 2") .withLockLevel(ApplicationLockLevel.NONE) .withDisplayName("myManagedApplicationDef") .withAuthorizations( Arrays .asList( - new ApplicationProviderAuthorization() + new ApplicationAuthorization() .withPrincipalId("validprincipalguid") .withRoleDefinitionId("validroleguid"))) .withDescription("myManagedApplicationDef description") diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateSamples.java index 2e77581daada..68ab605f3393 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateSamples.java @@ -4,14 +4,14 @@ package com.azure.resourcemanager.managedapplications.generated; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; import java.util.Arrays; /** Samples for ApplicationDefinitions CreateOrUpdate. */ public final class ApplicationDefinitionsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/createOrUpdateApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplicationDefinition.json */ /** * Sample code: Create or update managed application definition. @@ -23,16 +23,16 @@ public static void createOrUpdateManagedApplicationDefinition( manager .applicationDefinitions() .define("myManagedApplicationDef") - .withRegion("East US 2") + .withRegion((String) null) .withExistingResourceGroup("rg") .withLockLevel(ApplicationLockLevel.NONE) + .withDisplayName("myManagedApplicationDef") .withAuthorizations( Arrays .asList( - new ApplicationProviderAuthorization() + new ApplicationAuthorization() .withPrincipalId("validprincipalguid") .withRoleDefinitionId("validroleguid"))) - .withDisplayName("myManagedApplicationDef") .withDescription("myManagedApplicationDef description") .withPackageFileUri("https://path/to/packagezipfile") .create(); diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdSamples.java index 10bfb140b3d0..d310b18142cb 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdSamples.java @@ -7,15 +7,17 @@ /** Samples for ApplicationDefinitions DeleteById. */ public final class ApplicationDefinitionsDeleteByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/deleteApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplicationDefinition.json */ /** - * Sample code: Delete application definition. + * Sample code: Deletes managed application definition. * * @param manager Entry point to ApplicationManager. */ - public static void deleteApplicationDefinition( + public static void deletesManagedApplicationDefinition( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - manager.applicationDefinitions().deleteById("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE); + manager + .applicationDefinitions() + .deleteByIdWithResponse("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteSamples.java index 28ea93d34e17..2f2f4c902463 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteSamples.java @@ -7,15 +7,17 @@ /** Samples for ApplicationDefinitions Delete. */ public final class ApplicationDefinitionsDeleteSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/deleteApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplicationDefinition.json */ /** - * Sample code: Deletes a managed application. + * Sample code: delete managed application definition. * * @param manager Entry point to ApplicationManager. */ - public static void deletesAManagedApplication( + public static void deleteManagedApplicationDefinition( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - manager.applicationDefinitions().delete("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE); + manager + .applicationDefinitions() + .deleteByResourceGroupWithResponse("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByIdSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByIdSamples.java index 109071edfe9e..55f208bf1c8d 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByIdSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByIdSamples.java @@ -7,7 +7,7 @@ /** Samples for ApplicationDefinitions GetById. */ public final class ApplicationDefinitionsGetByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/getApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplicationDefinition.json */ /** * Sample code: Get managed application definition. diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByResourceGroupSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByResourceGroupSamples.java index bea305e3ccf1..f5449d9b1910 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByResourceGroupSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for ApplicationDefinitions GetByResourceGroup. */ public final class ApplicationDefinitionsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/getApplicationDefinition.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplicationDefinition.json */ /** * Sample code: Get managed application definition. diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListByResourceGroupSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListByResourceGroupSamples.java index d56800ab9e7a..6d024339cd46 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListByResourceGroupSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListByResourceGroupSamples.java @@ -7,14 +7,14 @@ /** Samples for ApplicationDefinitions ListByResourceGroup. */ public final class ApplicationDefinitionsListByResourceGroupSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/listApplicationDefinitionsByResourceGroup.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationDefinitionsByResourceGroup.json */ /** - * Sample code: List managed application definitions. + * Sample code: Lists the managed application definitions in a resource group. * * @param manager Entry point to ApplicationManager. */ - public static void listManagedApplicationDefinitions( + public static void listsTheManagedApplicationDefinitionsInAResourceGroup( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager.applicationDefinitions().listByResourceGroup("rg", com.azure.core.util.Context.NONE); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListSamples.java new file mode 100644 index 000000000000..a9e28e27ef00 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +/** Samples for ApplicationDefinitions List. */ +public final class ApplicationDefinitionsListSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationDefinitionsBySubscription.json + */ + /** + * Sample code: Lists all the application definitions within a subscription. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listsAllTheApplicationDefinitionsWithinASubscription( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.applicationDefinitions().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsUpdateByIdSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsUpdateByIdSamples.java new file mode 100644 index 000000000000..dd92a90a3ea3 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsUpdateByIdSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionPatchable; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ApplicationDefinitions UpdateById. */ +public final class ApplicationDefinitionsUpdateByIdSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplicationDefinition.json + */ + /** + * Sample code: Update managed application definition. + * + * @param manager Entry point to ApplicationManager. + */ + public static void updateManagedApplicationDefinition( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applicationDefinitions() + .updateByIdWithResponse( + "rg", + "myManagedApplicationDef", + new ApplicationDefinitionPatchable().withTags(mapOf("department", "Finance")), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsUpdateSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsUpdateSamples.java new file mode 100644 index 000000000000..56cc69ce2067 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinition; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ApplicationDefinitions Update. */ +public final class ApplicationDefinitionsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplicationDefinition.json + */ + /** + * Sample code: Update managed application definition. + * + * @param manager Entry point to ApplicationManager. + */ + public static void updateManagedApplicationDefinition( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + ApplicationDefinition resource = + manager + .applicationDefinitions() + .getByResourceGroupWithResponse("rg", "myManagedApplicationDef", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("department", "Finance")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsCreateOrUpdateByIdSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsCreateOrUpdateByIdSamples.java index 4a8643b0595a..7f1b2bd8f2cf 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsCreateOrUpdateByIdSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsCreateOrUpdateByIdSamples.java @@ -9,23 +9,24 @@ /** Samples for Applications CreateOrUpdateById. */ public final class ApplicationsCreateOrUpdateByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/createOrUpdateApplicationById.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplicationById.json */ /** - * Sample code: Create or update application by id. + * Sample code: Creates or updates a managed application. * * @param manager Entry point to ApplicationManager. */ - public static void createOrUpdateApplicationById( + public static void createsOrUpdatesAManagedApplication( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager .applications() .createOrUpdateById( - "myApplicationId", + "subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication", new ApplicationInner() - .withLocation("East US 2") .withKind("ServiceCatalog") - .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG"), + .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef"), com.azure.core.util.Context.NONE); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsCreateOrUpdateSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsCreateOrUpdateSamples.java index 5ce9e653b54f..3acc50de6cb1 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsCreateOrUpdateSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsCreateOrUpdateSamples.java @@ -7,7 +7,7 @@ /** Samples for Applications CreateOrUpdate. */ public final class ApplicationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/createOrUpdateApplication.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateApplication.json */ /** * Sample code: Create or update managed application. @@ -19,10 +19,12 @@ public static void createOrUpdateManagedApplication( manager .applications() .define("myManagedApplication") - .withRegion("East US 2") + .withRegion((String) null) .withExistingResourceGroup("rg") .withKind("ServiceCatalog") .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef") .create(); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteByIdSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteByIdSamples.java index e2b14ce50479..4ecaf0e66c3c 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteByIdSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteByIdSamples.java @@ -7,14 +7,19 @@ /** Samples for Applications DeleteById. */ public final class ApplicationsDeleteByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/deleteApplicationById.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplicationById.json */ /** - * Sample code: Delete application by id. + * Sample code: Deletes the managed application. * * @param manager Entry point to ApplicationManager. */ - public static void deleteApplicationById(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - manager.applications().deleteById("myApplicationId", com.azure.core.util.Context.NONE); + public static void deletesTheManagedApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .deleteById( + "subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteSamples.java index ef3d3c366fd7..9f8e10f96783 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteSamples.java @@ -7,14 +7,14 @@ /** Samples for Applications Delete. */ public final class ApplicationsDeleteSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/deleteApplication.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteApplication.json */ /** - * Sample code: Deletes a managed application. + * Sample code: Delete managed application. * * @param manager Entry point to ApplicationManager. */ - public static void deletesAManagedApplication( + public static void deleteManagedApplication( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager.applications().delete("rg", "myManagedApplication", com.azure.core.util.Context.NONE); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsGetByIdSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsGetByIdSamples.java index bfd580b69e10..d52397529d7d 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsGetByIdSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsGetByIdSamples.java @@ -7,14 +7,19 @@ /** Samples for Applications GetById. */ public final class ApplicationsGetByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/getApplicationById.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplicationById.json */ /** - * Sample code: Get application by id. + * Sample code: Gets the managed application. * * @param manager Entry point to ApplicationManager. */ - public static void getApplicationById(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - manager.applications().getByIdWithResponse("myApplicationId", com.azure.core.util.Context.NONE); + public static void getsTheManagedApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .getByIdWithResponse( + "subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsGetByResourceGroupSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsGetByResourceGroupSamples.java index 51ddeec9b3eb..25130bdabb02 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsGetByResourceGroupSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Applications GetByResourceGroup. */ public final class ApplicationsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/getApplication.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getApplication.json */ /** * Sample code: Get a managed application. diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListAllowedUpgradePlansSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListAllowedUpgradePlansSamples.java new file mode 100644 index 000000000000..26641b7dcb92 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListAllowedUpgradePlansSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +/** Samples for Applications ListAllowedUpgradePlans. */ +public final class ApplicationsListAllowedUpgradePlansSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listAllowedUpgradePlans.json + */ + /** + * Sample code: List allowed upgrade plans for application. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listAllowedUpgradePlansForApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .listAllowedUpgradePlansWithResponse("rg", "myManagedApplication", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListByResourceGroupSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListByResourceGroupSamples.java index 97a9e93c93d4..ed59af1bc1d4 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListByResourceGroupSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListByResourceGroupSamples.java @@ -7,14 +7,15 @@ /** Samples for Applications ListByResourceGroup. */ public final class ApplicationsListByResourceGroupSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/listApplicationsByResourceGroup.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationsByResourceGroup.json */ /** - * Sample code: Lists applications. + * Sample code: Lists all the applications within a resource group. * * @param manager Entry point to ApplicationManager. */ - public static void listsApplications(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + public static void listsAllTheApplicationsWithinAResourceGroup( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager.applications().listByResourceGroup("rg", com.azure.core.util.Context.NONE); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListSamples.java index 1a1705902175..c6f14a3ffe23 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListSamples.java @@ -7,14 +7,14 @@ /** Samples for Applications List. */ public final class ApplicationsListSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/listApplicationsBySubscription.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listApplicationsByResourceGroup.json */ /** - * Sample code: Lists applications by subscription. + * Sample code: Lists all the applications within a subscription. * * @param manager Entry point to ApplicationManager. */ - public static void listsApplicationsBySubscription( + public static void listsAllTheApplicationsWithinASubscription( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager.applications().list(com.azure.core.util.Context.NONE); } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListTokensSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListTokensSamples.java new file mode 100644 index 000000000000..baa2208067e8 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsListTokensSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.resourcemanager.managedapplications.models.ListTokenRequest; +import java.util.Arrays; + +/** Samples for Applications ListTokens. */ +public final class ApplicationsListTokensSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listToken.json + */ + /** + * Sample code: List tokens for application. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listTokensForApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .listTokensWithResponse( + "rg", + "myManagedApplication", + new ListTokenRequest() + .withAuthorizationAudience("fakeTokenPlaceholder") + .withUserAssignedIdentities(Arrays.asList("IdentityOne", "IdentityTwo")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsRefreshPermissionsSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsRefreshPermissionsSamples.java new file mode 100644 index 000000000000..8fe384779f44 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsRefreshPermissionsSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +/** Samples for Applications RefreshPermissions. */ +public final class ApplicationsRefreshPermissionsSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/refreshApplicationPermissions.json + */ + /** + * Sample code: Refresh managed application permissions. + * + * @param manager Entry point to ApplicationManager. + */ + public static void refreshManagedApplicationPermissions( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.applications().refreshPermissions("rg", "myManagedApplication", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateAccessSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateAccessSamples.java new file mode 100644 index 000000000000..d522b516643a --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateAccessSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.JitRequestMetadata; +import com.azure.resourcemanager.managedapplications.models.Status; +import com.azure.resourcemanager.managedapplications.models.Substatus; + +/** Samples for Applications UpdateAccess. */ +public final class ApplicationsUpdateAccessSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateAccess.json + */ + /** + * Sample code: Update access for application. + * + * @param manager Entry point to ApplicationManager. + */ + public static void updateAccessForApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .applications() + .updateAccess( + "rg", + "myManagedApplication", + new UpdateAccessDefinitionInner() + .withApprover("amauser") + .withMetadata( + new JitRequestMetadata() + .withOriginRequestId("originRequestId") + .withRequestorId("RequestorId") + .withTenantDisplayName("TenantDisplayName") + .withSubjectDisplayName("SubjectDisplayName")) + .withStatus(Status.ELEVATE) + .withSubStatus(Substatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateByIdSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateByIdSamples.java index b1d2dc194163..45c57b6c48da 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateByIdSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateByIdSamples.java @@ -4,24 +4,25 @@ package com.azure.resourcemanager.managedapplications.generated; -import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationInner; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; /** Samples for Applications UpdateById. */ public final class ApplicationsUpdateByIdSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/updateApplicationById.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplicationById.json */ /** - * Sample code: Update application by id. + * Sample code: Updates an existing managed application. * * @param manager Entry point to ApplicationManager. */ - public static void updateApplicationById(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + public static void updatesAnExistingManagedApplication( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { manager .applications() - .updateByIdWithResponse( - "myApplicationId", - new ApplicationInner() + .updateById( + "subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applications/myManagedApplication", + new ApplicationPatchableInner() .withKind("ServiceCatalog") .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") .withApplicationDefinitionId( diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateSamples.java index c27a90cb4dfa..2f5bfbe4fb7f 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateSamples.java @@ -4,31 +4,30 @@ package com.azure.resourcemanager.managedapplications.generated; -import com.azure.resourcemanager.managedapplications.models.Application; +import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPatchableInner; /** Samples for Applications Update. */ public final class ApplicationsUpdateSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/updateApplication.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateApplication.json */ /** - * Sample code: Updates a managed application. + * Sample code: Updates managed application. * * @param manager Entry point to ApplicationManager. */ - public static void updatesAManagedApplication( + public static void updatesManagedApplication( com.azure.resourcemanager.managedapplications.ApplicationManager manager) { - Application resource = - manager - .applications() - .getByResourceGroupWithResponse("rg", "myManagedApplication", com.azure.core.util.Context.NONE) - .getValue(); - resource - .update() - .withKind("ServiceCatalog") - .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") - .withApplicationDefinitionId( - "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef") - .apply(); + manager + .applications() + .update( + "rg", + "myManagedApplication", + new ApplicationPatchableInner() + .withKind("ServiceCatalog") + .withManagedResourceGroupId("/subscriptions/subid/resourceGroups/myManagedRG") + .withApplicationDefinitionId( + "/subscriptions/subid/resourceGroups/rg/providers/Microsoft.Solutions/applicationDefinitions/myAppDef"), + com.azure.core.util.Context.NONE); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsCreateOrUpdateSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a1ef08030ed9 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.resourcemanager.managedapplications.models.JitAuthorizationPolicies; +import com.azure.resourcemanager.managedapplications.models.JitSchedulingPolicy; +import com.azure.resourcemanager.managedapplications.models.JitSchedulingType; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for JitRequests CreateOrUpdate. */ +public final class JitRequestsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/createOrUpdateJitRequest.json + */ + /** + * Sample code: Create or update jit request. + * + * @param manager Entry point to ApplicationManager. + */ + public static void createOrUpdateJitRequest( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager + .jitRequests() + .define("myJitRequest") + .withRegion((String) null) + .withExistingResourceGroup("rg") + .withApplicationResourceId( + "/subscriptions/00c76877-e316-48a7-af60-4a09fec9d43f/resourceGroups/52F30DB2/providers/Microsoft.Solutions/applications/7E193158") + .withJitAuthorizationPolicies( + Arrays + .asList( + new JitAuthorizationPolicies() + .withPrincipalId("1db8e132e2934dbcb8e1178a61319491") + .withRoleDefinitionId("ecd05a23-931a-4c38-a52b-ac7c4c583334"))) + .withJitSchedulingPolicy( + new JitSchedulingPolicy() + .withType(JitSchedulingType.ONCE) + .withDuration(Duration.parse("PT8H")) + .withStartTime(OffsetDateTime.parse("2021-04-22T05:48:30.6661804Z"))) + .create(); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsDeleteSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsDeleteSamples.java new file mode 100644 index 000000000000..03224fc568f2 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +/** Samples for JitRequests Delete. */ +public final class JitRequestsDeleteSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/deleteJitRequest.json + */ + /** + * Sample code: Delete jit request. + * + * @param manager Entry point to ApplicationManager. + */ + public static void deleteJitRequest(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.jitRequests().deleteByResourceGroupWithResponse("rg", "myJitRequest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsGetByResourceGroupSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..8cf1468357ea --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsGetByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +/** Samples for JitRequests GetByResourceGroup. */ +public final class JitRequestsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/getJitRequest.json + */ + /** + * Sample code: Gets the jit request. + * + * @param manager Entry point to ApplicationManager. + */ + public static void getsTheJitRequest(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.jitRequests().getByResourceGroupWithResponse("rg", "myJitRequest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsListByResourceGroupSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsListByResourceGroupSamples.java new file mode 100644 index 000000000000..25ab43e3ed9f --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +/** Samples for JitRequests ListByResourceGroup. */ +public final class JitRequestsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listJitRequestsByResourceGroup.json + */ + /** + * Sample code: Lists all JIT requests within the resource group. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listsAllJITRequestsWithinTheResourceGroup( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.jitRequests().listByResourceGroupWithResponse("rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsListBySubscriptionSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsListBySubscriptionSamples.java new file mode 100644 index 000000000000..e594187b0fb8 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsListBySubscriptionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +/** Samples for JitRequests ListBySubscription. */ +public final class JitRequestsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listJitRequestsByResourceGroup.json + */ + /** + * Sample code: Lists all JIT requests within the subscription. + * + * @param manager Entry point to ApplicationManager. + */ + public static void listsAllJITRequestsWithinTheSubscription( + com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + manager.jitRequests().listBySubscriptionWithResponse(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsUpdateSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsUpdateSamples.java new file mode 100644 index 000000000000..7c8d43fa59d9 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.resourcemanager.managedapplications.models.JitRequestDefinition; +import java.util.HashMap; +import java.util.Map; + +/** Samples for JitRequests Update. */ +public final class JitRequestsUpdateSamples { + /* + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/updateJitRequest.json + */ + /** + * Sample code: Update jit request. + * + * @param manager Entry point to ApplicationManager. + */ + public static void updateJitRequest(com.azure.resourcemanager.managedapplications.ApplicationManager manager) { + JitRequestDefinition resource = + manager + .jitRequests() + .getByResourceGroupWithResponse("rg", "myJitRequest", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("department", "Finance")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ResourceProviderListOperationsSamples.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ResourceProviderListOperationsSamples.java index a94d83054cf8..4e56bdcc3ef4 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ResourceProviderListOperationsSamples.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/samples/java/com/azure/resourcemanager/managedapplications/generated/ResourceProviderListOperationsSamples.java @@ -7,7 +7,7 @@ /** Samples for ResourceProvider ListOperations. */ public final class ResourceProviderListOperationsSamples { /* - * x-ms-original-file: specification/resources/resource-manager/Microsoft.Solutions/stable/2018-06-01/examples/listSolutionsOperations.json + * x-ms-original-file: specification/solutions/resource-manager/Microsoft.Solutions/stable/2021-07-01/examples/listSolutionsOperations.json */ /** * Sample code: List Solutions operations. diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationArtifactTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationArtifactTests.java index a7134c1dc4cc..19b426cd81cd 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationArtifactTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationArtifactTests.java @@ -6,6 +6,7 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationArtifactName; import com.azure.resourcemanager.managedapplications.models.ApplicationArtifactType; import org.junit.jupiter.api.Assertions; @@ -14,20 +15,23 @@ public final class ApplicationArtifactTests { public void testDeserialize() throws Exception { ApplicationArtifact model = BinaryData - .fromString("{\"name\":\"snb\",\"uri\":\"qabnmoc\",\"type\":\"Template\"}") + .fromString("{\"name\":\"NotSpecified\",\"uri\":\"appd\",\"type\":\"Custom\"}") .toObject(ApplicationArtifact.class); - Assertions.assertEquals("snb", model.name()); - Assertions.assertEquals("qabnmoc", model.uri()); - Assertions.assertEquals(ApplicationArtifactType.TEMPLATE, model.type()); + Assertions.assertEquals(ApplicationArtifactName.NOT_SPECIFIED, model.name()); + Assertions.assertEquals("appd", model.uri()); + Assertions.assertEquals(ApplicationArtifactType.CUSTOM, model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ApplicationArtifact model = - new ApplicationArtifact().withName("snb").withUri("qabnmoc").withType(ApplicationArtifactType.TEMPLATE); + new ApplicationArtifact() + .withName(ApplicationArtifactName.NOT_SPECIFIED) + .withUri("appd") + .withType(ApplicationArtifactType.CUSTOM); model = BinaryData.fromObject(model).toObject(ApplicationArtifact.class); - Assertions.assertEquals("snb", model.name()); - Assertions.assertEquals("qabnmoc", model.uri()); - Assertions.assertEquals(ApplicationArtifactType.TEMPLATE, model.type()); + Assertions.assertEquals(ApplicationArtifactName.NOT_SPECIFIED, model.name()); + Assertions.assertEquals("appd", model.uri()); + Assertions.assertEquals(ApplicationArtifactType.CUSTOM, model.type()); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationAuthorizationTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationAuthorizationTests.java new file mode 100644 index 000000000000..8d5e735ee6f6 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationAuthorizationTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationAuthorization; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationAuthorizationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationAuthorization model = + BinaryData + .fromString("{\"principalId\":\"wtnhxbnjbiksqr\",\"roleDefinitionId\":\"lssai\"}") + .toObject(ApplicationAuthorization.class); + Assertions.assertEquals("wtnhxbnjbiksqr", model.principalId()); + Assertions.assertEquals("lssai", model.roleDefinitionId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationAuthorization model = + new ApplicationAuthorization().withPrincipalId("wtnhxbnjbiksqr").withRoleDefinitionId("lssai"); + model = BinaryData.fromObject(model).toObject(ApplicationAuthorization.class); + Assertions.assertEquals("wtnhxbnjbiksqr", model.principalId()); + Assertions.assertEquals("lssai", model.roleDefinitionId()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationBillingDetailsDefinitionTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationBillingDetailsDefinitionTests.java new file mode 100644 index 000000000000..e4ac5106e843 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationBillingDetailsDefinitionTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationBillingDetailsDefinition; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationBillingDetailsDefinitionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationBillingDetailsDefinition model = + BinaryData + .fromString("{\"resourceUsageId\":\"wjzrnfygxgisp\"}") + .toObject(ApplicationBillingDetailsDefinition.class); + Assertions.assertEquals("wjzrnfygxgisp", model.resourceUsageId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationBillingDetailsDefinition model = + new ApplicationBillingDetailsDefinition().withResourceUsageId("wjzrnfygxgisp"); + model = BinaryData.fromObject(model).toObject(ApplicationBillingDetailsDefinition.class); + Assertions.assertEquals("wjzrnfygxgisp", model.resourceUsageId()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationClientDetailsTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationClientDetailsTests.java new file mode 100644 index 000000000000..92359c685caf --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationClientDetailsTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationClientDetails; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationClientDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationClientDetails model = + BinaryData + .fromString("{\"oid\":\"kvwrwjfeu\",\"puid\":\"hutje\",\"applicationId\":\"mrldhu\"}") + .toObject(ApplicationClientDetails.class); + Assertions.assertEquals("kvwrwjfeu", model.oid()); + Assertions.assertEquals("hutje", model.puid()); + Assertions.assertEquals("mrldhu", model.applicationId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationClientDetails model = + new ApplicationClientDetails().withOid("kvwrwjfeu").withPuid("hutje").withApplicationId("mrldhu"); + model = BinaryData.fromObject(model).toObject(ApplicationClientDetails.class); + Assertions.assertEquals("kvwrwjfeu", model.oid()); + Assertions.assertEquals("hutje", model.puid()); + Assertions.assertEquals("mrldhu", model.applicationId()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionArtifactTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionArtifactTests.java new file mode 100644 index 000000000000..bfb0b6994401 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionArtifactTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationArtifactType; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionArtifact; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionArtifactName; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationDefinitionArtifactTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationDefinitionArtifact model = + BinaryData + .fromString("{\"name\":\"NotSpecified\",\"uri\":\"qsycbkbfkgu\",\"type\":\"NotSpecified\"}") + .toObject(ApplicationDefinitionArtifact.class); + Assertions.assertEquals(ApplicationDefinitionArtifactName.NOT_SPECIFIED, model.name()); + Assertions.assertEquals("qsycbkbfkgu", model.uri()); + Assertions.assertEquals(ApplicationArtifactType.NOT_SPECIFIED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationDefinitionArtifact model = + new ApplicationDefinitionArtifact() + .withName(ApplicationDefinitionArtifactName.NOT_SPECIFIED) + .withUri("qsycbkbfkgu") + .withType(ApplicationArtifactType.NOT_SPECIFIED); + model = BinaryData.fromObject(model).toObject(ApplicationDefinitionArtifact.class); + Assertions.assertEquals(ApplicationDefinitionArtifactName.NOT_SPECIFIED, model.name()); + Assertions.assertEquals("qsycbkbfkgu", model.uri()); + Assertions.assertEquals(ApplicationArtifactType.NOT_SPECIFIED, model.type()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionInnerTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionInnerTests.java deleted file mode 100644 index 7d5c0e2d7793..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionInnerTests.java +++ /dev/null @@ -1,129 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; -import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; -import com.azure.resourcemanager.managedapplications.models.ApplicationArtifactType; -import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; -import com.azure.resourcemanager.managedapplications.models.Identity; -import com.azure.resourcemanager.managedapplications.models.ResourceIdentityType; -import com.azure.resourcemanager.managedapplications.models.Sku; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ApplicationDefinitionInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ApplicationDefinitionInner model = - BinaryData - .fromString( - "{\"properties\":{\"lockLevel\":\"CanNotDelete\",\"displayName\":\"pdappds\",\"isEnabled\":\"kvwrwjfeu\",\"authorizations\":[{\"principalId\":\"hutje\",\"roleDefinitionId\":\"tmrldhugjzzdatq\"},{\"principalId\":\"hocdgeab\",\"roleDefinitionId\":\"gphuticndvka\"},{\"principalId\":\"zwyiftyhxhur\",\"roleDefinitionId\":\"k\"},{\"principalId\":\"tyxolniwpwc\",\"roleDefinitionId\":\"kjfkg\"}],\"artifacts\":[{\"name\":\"klryplwck\",\"uri\":\"syyp\",\"type\":\"Template\"}],\"description\":\"sgcbac\",\"packageFileUri\":\"ejk\",\"mainTemplate\":\"dataynqgoulzndlikwyq\",\"createUiDefinition\":\"datafgibmadgakeq\"},\"managedBy\":\"xybz\",\"sku\":{\"name\":\"e\",\"tier\":\"ytb\",\"size\":\"qfou\",\"family\":\"mmnkzsmodmgl\",\"model\":\"gpbkwtmut\",\"capacity\":1581209984},\"identity\":{\"principalId\":\"ap\",\"tenantId\":\"wgcu\",\"type\":\"SystemAssigned\"},\"location\":\"umkdosvqwhbmd\",\"tags\":{\"ppbhtqqrolfp\":\"jfddgmbmbe\"},\"id\":\"psalgbqux\",\"name\":\"gjyjgzjaoyfhrtxi\",\"type\":\"n\"}") - .toObject(ApplicationDefinitionInner.class); - Assertions.assertEquals("umkdosvqwhbmd", model.location()); - Assertions.assertEquals("jfddgmbmbe", model.tags().get("ppbhtqqrolfp")); - Assertions.assertEquals("xybz", model.managedBy()); - Assertions.assertEquals("e", model.sku().name()); - Assertions.assertEquals("ytb", model.sku().tier()); - Assertions.assertEquals("qfou", model.sku().size()); - Assertions.assertEquals("mmnkzsmodmgl", model.sku().family()); - Assertions.assertEquals("gpbkwtmut", model.sku().model()); - Assertions.assertEquals(1581209984, model.sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); - Assertions.assertEquals(ApplicationLockLevel.CAN_NOT_DELETE, model.lockLevel()); - Assertions.assertEquals("pdappds", model.displayName()); - Assertions.assertEquals("kvwrwjfeu", model.isEnabled()); - Assertions.assertEquals("hutje", model.authorizations().get(0).principalId()); - Assertions.assertEquals("tmrldhugjzzdatq", model.authorizations().get(0).roleDefinitionId()); - Assertions.assertEquals("klryplwck", model.artifacts().get(0).name()); - Assertions.assertEquals("syyp", model.artifacts().get(0).uri()); - Assertions.assertEquals(ApplicationArtifactType.TEMPLATE, model.artifacts().get(0).type()); - Assertions.assertEquals("sgcbac", model.description()); - Assertions.assertEquals("ejk", model.packageFileUri()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ApplicationDefinitionInner model = - new ApplicationDefinitionInner() - .withLocation("umkdosvqwhbmd") - .withTags(mapOf("ppbhtqqrolfp", "jfddgmbmbe")) - .withManagedBy("xybz") - .withSku( - new Sku() - .withName("e") - .withTier("ytb") - .withSize("qfou") - .withFamily("mmnkzsmodmgl") - .withModel("gpbkwtmut") - .withCapacity(1581209984)) - .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) - .withLockLevel(ApplicationLockLevel.CAN_NOT_DELETE) - .withDisplayName("pdappds") - .withIsEnabled("kvwrwjfeu") - .withAuthorizations( - Arrays - .asList( - new ApplicationProviderAuthorization() - .withPrincipalId("hutje") - .withRoleDefinitionId("tmrldhugjzzdatq"), - new ApplicationProviderAuthorization() - .withPrincipalId("hocdgeab") - .withRoleDefinitionId("gphuticndvka"), - new ApplicationProviderAuthorization() - .withPrincipalId("zwyiftyhxhur") - .withRoleDefinitionId("k"), - new ApplicationProviderAuthorization() - .withPrincipalId("tyxolniwpwc") - .withRoleDefinitionId("kjfkg"))) - .withArtifacts( - Arrays - .asList( - new ApplicationArtifact() - .withName("klryplwck") - .withUri("syyp") - .withType(ApplicationArtifactType.TEMPLATE))) - .withDescription("sgcbac") - .withPackageFileUri("ejk") - .withMainTemplate("dataynqgoulzndlikwyq") - .withCreateUiDefinition("datafgibmadgakeq"); - model = BinaryData.fromObject(model).toObject(ApplicationDefinitionInner.class); - Assertions.assertEquals("umkdosvqwhbmd", model.location()); - Assertions.assertEquals("jfddgmbmbe", model.tags().get("ppbhtqqrolfp")); - Assertions.assertEquals("xybz", model.managedBy()); - Assertions.assertEquals("e", model.sku().name()); - Assertions.assertEquals("ytb", model.sku().tier()); - Assertions.assertEquals("qfou", model.sku().size()); - Assertions.assertEquals("mmnkzsmodmgl", model.sku().family()); - Assertions.assertEquals("gpbkwtmut", model.sku().model()); - Assertions.assertEquals(1581209984, model.sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); - Assertions.assertEquals(ApplicationLockLevel.CAN_NOT_DELETE, model.lockLevel()); - Assertions.assertEquals("pdappds", model.displayName()); - Assertions.assertEquals("kvwrwjfeu", model.isEnabled()); - Assertions.assertEquals("hutje", model.authorizations().get(0).principalId()); - Assertions.assertEquals("tmrldhugjzzdatq", model.authorizations().get(0).roleDefinitionId()); - Assertions.assertEquals("klryplwck", model.artifacts().get(0).name()); - Assertions.assertEquals("syyp", model.artifacts().get(0).uri()); - Assertions.assertEquals(ApplicationArtifactType.TEMPLATE, model.artifacts().get(0).type()); - Assertions.assertEquals("sgcbac", model.description()); - Assertions.assertEquals("ejk", model.packageFileUri()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionListResultTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionListResultTests.java deleted file mode 100644 index d304f56e781e..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionListResultTests.java +++ /dev/null @@ -1,166 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; -import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionListResult; -import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.Identity; -import com.azure.resourcemanager.managedapplications.models.ResourceIdentityType; -import com.azure.resourcemanager.managedapplications.models.Sku; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ApplicationDefinitionListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ApplicationDefinitionListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"lockLevel\":\"ReadOnly\",\"displayName\":\"zafb\",\"isEnabled\":\"j\",\"authorizations\":[],\"artifacts\":[],\"description\":\"toqcjmklja\",\"packageFileUri\":\"qidtqajzyu\",\"mainTemplate\":\"datakudjkrlkhb\",\"createUiDefinition\":\"datafepgzgq\"},\"managedBy\":\"zloc\",\"sku\":{\"name\":\"c\",\"tier\":\"ierhhbcsglummaj\",\"size\":\"aodxo\",\"family\":\"bdxkqpxokaj\",\"model\":\"npime\",\"capacity\":1127619232},\"identity\":{\"principalId\":\"gcpo\",\"tenantId\":\"maajrmvdjwzrlo\",\"type\":\"SystemAssigned\"},\"location\":\"lwhijcoejctbzaq\",\"tags\":{\"bkbfkgukdkex\":\"y\",\"ocjjxhvpmouexh\":\"ppofmxaxcfjpgdd\"},\"id\":\"zxibqeoj\",\"name\":\"xqbzvddntwnd\",\"type\":\"icbtwnpzao\"},{\"properties\":{\"lockLevel\":\"None\",\"displayName\":\"hrhcffcyddglmjth\",\"isEnabled\":\"kw\",\"authorizations\":[],\"artifacts\":[],\"description\":\"icxm\",\"packageFileUri\":\"iwqvhkh\",\"mainTemplate\":\"datauigdtopbobjog\",\"createUiDefinition\":\"datae\"},\"managedBy\":\"a\",\"sku\":{\"name\":\"uhrzayvvt\",\"tier\":\"vdfgiotk\",\"size\":\"utqxlngx\",\"family\":\"fgugnxkrxdqmid\",\"model\":\"hzrvqd\",\"capacity\":552309473},\"identity\":{\"principalId\":\"yb\",\"tenantId\":\"ehoqfbowskan\",\"type\":\"SystemAssigned\"},\"location\":\"zlcuiywgqywgndrv\",\"tags\":{\"fvm\":\"zgpphrcgyncocpe\",\"bmqj\":\"coofsxlzev\",\"lzu\":\"abcypmivk\",\"ebxetqgtzxdp\":\"ccfwnfnbacfion\"},\"id\":\"qbqqwxr\",\"name\":\"feallnwsu\",\"type\":\"isnjampmngnz\"},{\"properties\":{\"lockLevel\":\"CanNotDelete\",\"displayName\":\"aqw\",\"isEnabled\":\"chcbonqvpkvlrxnj\",\"authorizations\":[],\"artifacts\":[],\"description\":\"eipheoflokeyy\",\"packageFileUri\":\"nj\",\"mainTemplate\":\"datalwtgrhpdj\",\"createUiDefinition\":\"dataumasxazjpq\"},\"managedBy\":\"gual\",\"sku\":{\"name\":\"xxhejjzzvd\",\"tier\":\"gwdslfhotwm\",\"size\":\"npwlbjnpg\",\"family\":\"ftadehxnltyfs\",\"model\":\"pusuesn\",\"capacity\":1828932864},\"identity\":{\"principalId\":\"bavo\",\"tenantId\":\"zdmohctbqvu\",\"type\":\"SystemAssigned\"},\"location\":\"dndnvow\",\"tags\":{\"zj\":\"jugwdkcglhsl\",\"kuofqweykhme\":\"yggdtjixh\",\"yvdcsitynnaa\":\"evfyexfwhybcib\",\"eypvhezrkg\":\"dectehfiqsc\"},\"id\":\"hcjrefovgmk\",\"name\":\"sle\",\"type\":\"yvxyqjp\"}],\"nextLink\":\"attpngjcrcczsq\"}") - .toObject(ApplicationDefinitionListResult.class); - Assertions.assertEquals("lwhijcoejctbzaq", model.value().get(0).location()); - Assertions.assertEquals("y", model.value().get(0).tags().get("bkbfkgukdkex")); - Assertions.assertEquals("zloc", model.value().get(0).managedBy()); - Assertions.assertEquals("c", model.value().get(0).sku().name()); - Assertions.assertEquals("ierhhbcsglummaj", model.value().get(0).sku().tier()); - Assertions.assertEquals("aodxo", model.value().get(0).sku().size()); - Assertions.assertEquals("bdxkqpxokaj", model.value().get(0).sku().family()); - Assertions.assertEquals("npime", model.value().get(0).sku().model()); - Assertions.assertEquals(1127619232, model.value().get(0).sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); - Assertions.assertEquals(ApplicationLockLevel.READ_ONLY, model.value().get(0).lockLevel()); - Assertions.assertEquals("zafb", model.value().get(0).displayName()); - Assertions.assertEquals("j", model.value().get(0).isEnabled()); - Assertions.assertEquals("toqcjmklja", model.value().get(0).description()); - Assertions.assertEquals("qidtqajzyu", model.value().get(0).packageFileUri()); - Assertions.assertEquals("attpngjcrcczsq", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ApplicationDefinitionListResult model = - new ApplicationDefinitionListResult() - .withValue( - Arrays - .asList( - new ApplicationDefinitionInner() - .withLocation("lwhijcoejctbzaq") - .withTags(mapOf("bkbfkgukdkex", "y", "ocjjxhvpmouexh", "ppofmxaxcfjpgdd")) - .withManagedBy("zloc") - .withSku( - new Sku() - .withName("c") - .withTier("ierhhbcsglummaj") - .withSize("aodxo") - .withFamily("bdxkqpxokaj") - .withModel("npime") - .withCapacity(1127619232)) - .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) - .withLockLevel(ApplicationLockLevel.READ_ONLY) - .withDisplayName("zafb") - .withIsEnabled("j") - .withAuthorizations(Arrays.asList()) - .withArtifacts(Arrays.asList()) - .withDescription("toqcjmklja") - .withPackageFileUri("qidtqajzyu") - .withMainTemplate("datakudjkrlkhb") - .withCreateUiDefinition("datafepgzgq"), - new ApplicationDefinitionInner() - .withLocation("zlcuiywgqywgndrv") - .withTags( - mapOf( - "fvm", - "zgpphrcgyncocpe", - "bmqj", - "coofsxlzev", - "lzu", - "abcypmivk", - "ebxetqgtzxdp", - "ccfwnfnbacfion")) - .withManagedBy("a") - .withSku( - new Sku() - .withName("uhrzayvvt") - .withTier("vdfgiotk") - .withSize("utqxlngx") - .withFamily("fgugnxkrxdqmid") - .withModel("hzrvqd") - .withCapacity(552309473)) - .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) - .withLockLevel(ApplicationLockLevel.NONE) - .withDisplayName("hrhcffcyddglmjth") - .withIsEnabled("kw") - .withAuthorizations(Arrays.asList()) - .withArtifacts(Arrays.asList()) - .withDescription("icxm") - .withPackageFileUri("iwqvhkh") - .withMainTemplate("datauigdtopbobjog") - .withCreateUiDefinition("datae"), - new ApplicationDefinitionInner() - .withLocation("dndnvow") - .withTags( - mapOf( - "zj", - "jugwdkcglhsl", - "kuofqweykhme", - "yggdtjixh", - "yvdcsitynnaa", - "evfyexfwhybcib", - "eypvhezrkg", - "dectehfiqsc")) - .withManagedBy("gual") - .withSku( - new Sku() - .withName("xxhejjzzvd") - .withTier("gwdslfhotwm") - .withSize("npwlbjnpg") - .withFamily("ftadehxnltyfs") - .withModel("pusuesn") - .withCapacity(1828932864)) - .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) - .withLockLevel(ApplicationLockLevel.CAN_NOT_DELETE) - .withDisplayName("aqw") - .withIsEnabled("chcbonqvpkvlrxnj") - .withAuthorizations(Arrays.asList()) - .withArtifacts(Arrays.asList()) - .withDescription("eipheoflokeyy") - .withPackageFileUri("nj") - .withMainTemplate("datalwtgrhpdj") - .withCreateUiDefinition("dataumasxazjpq"))) - .withNextLink("attpngjcrcczsq"); - model = BinaryData.fromObject(model).toObject(ApplicationDefinitionListResult.class); - Assertions.assertEquals("lwhijcoejctbzaq", model.value().get(0).location()); - Assertions.assertEquals("y", model.value().get(0).tags().get("bkbfkgukdkex")); - Assertions.assertEquals("zloc", model.value().get(0).managedBy()); - Assertions.assertEquals("c", model.value().get(0).sku().name()); - Assertions.assertEquals("ierhhbcsglummaj", model.value().get(0).sku().tier()); - Assertions.assertEquals("aodxo", model.value().get(0).sku().size()); - Assertions.assertEquals("bdxkqpxokaj", model.value().get(0).sku().family()); - Assertions.assertEquals("npime", model.value().get(0).sku().model()); - Assertions.assertEquals(1127619232, model.value().get(0).sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); - Assertions.assertEquals(ApplicationLockLevel.READ_ONLY, model.value().get(0).lockLevel()); - Assertions.assertEquals("zafb", model.value().get(0).displayName()); - Assertions.assertEquals("j", model.value().get(0).isEnabled()); - Assertions.assertEquals("toqcjmklja", model.value().get(0).description()); - Assertions.assertEquals("qidtqajzyu", model.value().get(0).packageFileUri()); - Assertions.assertEquals("attpngjcrcczsq", model.nextLink()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionPatchableTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionPatchableTests.java new file mode 100644 index 000000000000..7d6033be372e --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionPatchableTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationDefinitionPatchable; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationDefinitionPatchableTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationDefinitionPatchable model = + BinaryData.fromString("{\"tags\":{\"w\":\"m\"}}").toObject(ApplicationDefinitionPatchable.class); + Assertions.assertEquals("m", model.tags().get("w")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationDefinitionPatchable model = new ApplicationDefinitionPatchable().withTags(mapOf("w", "m")); + model = BinaryData.fromObject(model).toObject(ApplicationDefinitionPatchable.class); + Assertions.assertEquals("m", model.tags().get("w")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionPropertiesTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionPropertiesTests.java deleted file mode 100644 index f28d65afa4f9..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionPropertiesTests.java +++ /dev/null @@ -1,91 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionProperties; -import com.azure.resourcemanager.managedapplications.models.ApplicationArtifact; -import com.azure.resourcemanager.managedapplications.models.ApplicationArtifactType; -import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ApplicationDefinitionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ApplicationDefinitionProperties model = - BinaryData - .fromString( - "{\"lockLevel\":\"ReadOnly\",\"displayName\":\"ujysvle\",\"isEnabled\":\"vfqawrlyxwjkcpr\",\"authorizations\":[{\"principalId\":\"wbxgjvt\",\"roleDefinitionId\":\"vpys\"},{\"principalId\":\"zdn\",\"roleDefinitionId\":\"uj\"},{\"principalId\":\"guhmuouqfpr\",\"roleDefinitionId\":\"zw\"},{\"principalId\":\"nguitnwuizgazxu\",\"roleDefinitionId\":\"izuckyfihrfidfvz\"}],\"artifacts\":[{\"name\":\"htymw\",\"uri\":\"dkfthwxmnt\",\"type\":\"Custom\"},{\"name\":\"opvkmijcm\",\"uri\":\"dcuf\",\"type\":\"Template\"},{\"name\":\"pymzidnsezcxtbzs\",\"uri\":\"yc\",\"type\":\"Custom\"},{\"name\":\"wmdwzjeiachboo\",\"uri\":\"lnrosfqp\",\"type\":\"Custom\"}],\"description\":\"zzvypyqrimzinp\",\"packageFileUri\":\"wjdk\",\"mainTemplate\":\"datasoodqxhcrmnoh\",\"createUiDefinition\":\"datackwhds\"}") - .toObject(ApplicationDefinitionProperties.class); - Assertions.assertEquals(ApplicationLockLevel.READ_ONLY, model.lockLevel()); - Assertions.assertEquals("ujysvle", model.displayName()); - Assertions.assertEquals("vfqawrlyxwjkcpr", model.isEnabled()); - Assertions.assertEquals("wbxgjvt", model.authorizations().get(0).principalId()); - Assertions.assertEquals("vpys", model.authorizations().get(0).roleDefinitionId()); - Assertions.assertEquals("htymw", model.artifacts().get(0).name()); - Assertions.assertEquals("dkfthwxmnt", model.artifacts().get(0).uri()); - Assertions.assertEquals(ApplicationArtifactType.CUSTOM, model.artifacts().get(0).type()); - Assertions.assertEquals("zzvypyqrimzinp", model.description()); - Assertions.assertEquals("wjdk", model.packageFileUri()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ApplicationDefinitionProperties model = - new ApplicationDefinitionProperties() - .withLockLevel(ApplicationLockLevel.READ_ONLY) - .withDisplayName("ujysvle") - .withIsEnabled("vfqawrlyxwjkcpr") - .withAuthorizations( - Arrays - .asList( - new ApplicationProviderAuthorization() - .withPrincipalId("wbxgjvt") - .withRoleDefinitionId("vpys"), - new ApplicationProviderAuthorization().withPrincipalId("zdn").withRoleDefinitionId("uj"), - new ApplicationProviderAuthorization() - .withPrincipalId("guhmuouqfpr") - .withRoleDefinitionId("zw"), - new ApplicationProviderAuthorization() - .withPrincipalId("nguitnwuizgazxu") - .withRoleDefinitionId("izuckyfihrfidfvz"))) - .withArtifacts( - Arrays - .asList( - new ApplicationArtifact() - .withName("htymw") - .withUri("dkfthwxmnt") - .withType(ApplicationArtifactType.CUSTOM), - new ApplicationArtifact() - .withName("opvkmijcm") - .withUri("dcuf") - .withType(ApplicationArtifactType.TEMPLATE), - new ApplicationArtifact() - .withName("pymzidnsezcxtbzs") - .withUri("yc") - .withType(ApplicationArtifactType.CUSTOM), - new ApplicationArtifact() - .withName("wmdwzjeiachboo") - .withUri("lnrosfqp") - .withType(ApplicationArtifactType.CUSTOM))) - .withDescription("zzvypyqrimzinp") - .withPackageFileUri("wjdk") - .withMainTemplate("datasoodqxhcrmnoh") - .withCreateUiDefinition("datackwhds"); - model = BinaryData.fromObject(model).toObject(ApplicationDefinitionProperties.class); - Assertions.assertEquals(ApplicationLockLevel.READ_ONLY, model.lockLevel()); - Assertions.assertEquals("ujysvle", model.displayName()); - Assertions.assertEquals("vfqawrlyxwjkcpr", model.isEnabled()); - Assertions.assertEquals("wbxgjvt", model.authorizations().get(0).principalId()); - Assertions.assertEquals("vpys", model.authorizations().get(0).roleDefinitionId()); - Assertions.assertEquals("htymw", model.artifacts().get(0).name()); - Assertions.assertEquals("dkfthwxmnt", model.artifacts().get(0).uri()); - Assertions.assertEquals(ApplicationArtifactType.CUSTOM, model.artifacts().get(0).type()); - Assertions.assertEquals("zzvypyqrimzinp", model.description()); - Assertions.assertEquals("wjdk", model.packageFileUri()); - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateByIdMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateByIdMockTests.java deleted file mode 100644 index 085b03dc302d..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateByIdMockTests.java +++ /dev/null @@ -1,127 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.managedapplications.ApplicationManager; -import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationDefinitionInner; -import com.azure.resourcemanager.managedapplications.models.ApplicationDefinition; -import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.Identity; -import com.azure.resourcemanager.managedapplications.models.ResourceIdentityType; -import com.azure.resourcemanager.managedapplications.models.Sku; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -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 org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ApplicationDefinitionsCreateOrUpdateByIdMockTests { - @Test - public void testCreateOrUpdateById() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"lockLevel\":\"ReadOnly\",\"displayName\":\"ultskzbbtdz\",\"isEnabled\":\"veekgpwozuhkfp\",\"authorizations\":[],\"artifacts\":[],\"description\":\"f\",\"packageFileUri\":\"luu\",\"mainTemplate\":\"datattouwaboekqvkel\",\"createUiDefinition\":\"datamvb\"},\"managedBy\":\"yjsflhhcaalnji\",\"sku\":{\"name\":\"sxyawjoyaqcs\",\"tier\":\"jpkiidzyexznelix\",\"size\":\"rzt\",\"family\":\"lhbnxkna\",\"model\":\"ulppggdtpnapnyir\",\"capacity\":1792821814},\"identity\":{\"principalId\":\"igvpgylg\",\"tenantId\":\"itxmedjvcslynqww\",\"type\":\"SystemAssigned\"},\"location\":\"zzhxgktrm\",\"tags\":{\"tfdygpfqb\":\"napkteoellw\",\"op\":\"ac\",\"eqx\":\"fqrhhuaopppc\"},\"id\":\"lzdahzxctobgbkdm\",\"name\":\"izpost\",\"type\":\"grcfb\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ApplicationManager manager = - ApplicationManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ApplicationDefinition response = - manager - .applicationDefinitions() - .createOrUpdateById( - "klwndnhjdauwhv", - "l", - new ApplicationDefinitionInner() - .withLocation("qsgzvahapj") - .withTags(mapOf("lxkvu", "pvgqzcjrvxdjzlm", "n", "fhzovawjvzunluth")) - .withManagedBy("loayqcgw") - .withSku( - new Sku() - .withName("zjuzgwyz") - .withTier("txon") - .withSize("ts") - .withFamily("jcbpwxqpsrknft") - .withModel("vriuhprwmdyvx") - .withCapacity(1817218794)) - .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) - .withLockLevel(ApplicationLockLevel.NONE) - .withDisplayName("tdhxujznbmpowuwp") - .withIsEnabled("qlveualupjmkh") - .withAuthorizations(Arrays.asList()) - .withArtifacts(Arrays.asList()) - .withDescription("cswsrtjri") - .withPackageFileUri("rbpbewtghfgblcg") - .withMainTemplate("datazvlvqhjkbegib") - .withCreateUiDefinition("datamxiebw"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("zzhxgktrm", response.location()); - Assertions.assertEquals("napkteoellw", response.tags().get("tfdygpfqb")); - Assertions.assertEquals("yjsflhhcaalnji", response.managedBy()); - Assertions.assertEquals("sxyawjoyaqcs", response.sku().name()); - Assertions.assertEquals("jpkiidzyexznelix", response.sku().tier()); - Assertions.assertEquals("rzt", response.sku().size()); - Assertions.assertEquals("lhbnxkna", response.sku().family()); - Assertions.assertEquals("ulppggdtpnapnyir", response.sku().model()); - Assertions.assertEquals(1792821814, response.sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); - Assertions.assertEquals(ApplicationLockLevel.READ_ONLY, response.lockLevel()); - Assertions.assertEquals("ultskzbbtdz", response.displayName()); - Assertions.assertEquals("veekgpwozuhkfp", response.isEnabled()); - Assertions.assertEquals("f", response.description()); - Assertions.assertEquals("luu", response.packageFileUri()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateMockTests.java deleted file mode 100644 index d6b62cabc772..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsCreateOrUpdateMockTests.java +++ /dev/null @@ -1,133 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.managedapplications.ApplicationManager; -import com.azure.resourcemanager.managedapplications.models.ApplicationDefinition; -import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.Identity; -import com.azure.resourcemanager.managedapplications.models.ResourceIdentityType; -import com.azure.resourcemanager.managedapplications.models.Sku; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -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 org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ApplicationDefinitionsCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"lockLevel\":\"None\",\"displayName\":\"lkthu\",\"isEnabled\":\"qolbgyc\",\"authorizations\":[],\"artifacts\":[],\"description\":\"tgccymvaolpss\",\"packageFileUri\":\"lfmmdnbbglzpswi\",\"mainTemplate\":\"datamcwyhzdxssadb\",\"createUiDefinition\":\"datanvdfznuda\"},\"managedBy\":\"vxzbncb\",\"sku\":{\"name\":\"lpstdbhhxsrzdz\",\"tier\":\"erscdntne\",\"size\":\"iwjmygtdssls\",\"family\":\"mweriofzpy\",\"model\":\"emwabnet\",\"capacity\":1149443455},\"identity\":{\"principalId\":\"h\",\"tenantId\":\"plvwiwubmwmbes\",\"type\":\"SystemAssigned\"},\"location\":\"k\",\"tags\":{\"flcxoga\":\"pp\",\"mkqzeqqkdltfzxmh\":\"konzmnsik\"},\"id\":\"v\",\"name\":\"gureodkwobdag\",\"type\":\"tibqdxbxwakb\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ApplicationManager manager = - ApplicationManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ApplicationDefinition response = - manager - .applicationDefinitions() - .define("bpvjymjhx") - .withRegion("pybsrfbjfdtw") - .withExistingResourceGroup("nrmfqjhhk") - .withLockLevel(ApplicationLockLevel.CAN_NOT_DELETE) - .withAuthorizations(Arrays.asList()) - .withTags( - mapOf( - "tpvjzbexilzznfqq", - "t", - "taruoujmkcj", - "vwpm", - "ervnaenqpehi", - "wqytjrybnwjewgdr", - "mifthnzdnd", - "doy")) - .withManagedBy("vxysl") - .withSku( - new Sku() - .withName("hsfxoblytkb") - .withTier("pe") - .withSize("wfbkrvrns") - .withFamily("hqjohxcrsbfova") - .withModel("ruvw") - .withCapacity(1393923794)) - .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) - .withDisplayName("n") - .withIsEnabled("divkrt") - .withArtifacts(Arrays.asList()) - .withDescription("zvszj") - .withPackageFileUri("uvjfdxxive") - .withMainTemplate("datat") - .withCreateUiDefinition("dataaqtdoqmcbx") - .create(); - - Assertions.assertEquals("k", response.location()); - Assertions.assertEquals("pp", response.tags().get("flcxoga")); - Assertions.assertEquals("vxzbncb", response.managedBy()); - Assertions.assertEquals("lpstdbhhxsrzdz", response.sku().name()); - Assertions.assertEquals("erscdntne", response.sku().tier()); - Assertions.assertEquals("iwjmygtdssls", response.sku().size()); - Assertions.assertEquals("mweriofzpy", response.sku().family()); - Assertions.assertEquals("emwabnet", response.sku().model()); - Assertions.assertEquals(1149443455, response.sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); - Assertions.assertEquals(ApplicationLockLevel.NONE, response.lockLevel()); - Assertions.assertEquals("lkthu", response.displayName()); - Assertions.assertEquals("qolbgyc", response.isEnabled()); - Assertions.assertEquals("tgccymvaolpss", response.description()); - Assertions.assertEquals("lfmmdnbbglzpswi", response.packageFileUri()); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdWithResponseMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdWithResponseMockTests.java new file mode 100644 index 000000000000..95e8e9eda234 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.managedapplications.ApplicationManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApplicationDefinitionsDeleteByIdWithResponseMockTests { + @Test + public void testDeleteByIdWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApplicationManager manager = + ApplicationManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .applicationDefinitions() + .deleteByIdWithResponse("gaokonzmnsikv", "kqze", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByResourceGroupWithResponseMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..dca3261f7760 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByResourceGroupWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.managedapplications.ApplicationManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApplicationDefinitionsDeleteByResourceGroupWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApplicationManager manager = + ApplicationManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .applicationDefinitions() + .deleteByResourceGroupWithResponse("qtaruoujmkcjhwq", "tjrybnwjewgdr", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByResourceGroupWithResponseMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByResourceGroupWithResponseMockTests.java deleted file mode 100644 index 932d38597caa..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,86 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.managedapplications.ApplicationManager; -import com.azure.resourcemanager.managedapplications.models.ApplicationDefinition; -import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ResourceIdentityType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ApplicationDefinitionsGetByResourceGroupWithResponseMockTests { - @Test - public void testGetByResourceGroupWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"lockLevel\":\"ReadOnly\",\"displayName\":\"bnuqqkpik\",\"isEnabled\":\"rgvtqag\",\"authorizations\":[],\"artifacts\":[],\"description\":\"hijggme\",\"packageFileUri\":\"siarbutrcvpn\",\"mainTemplate\":\"datazmhjrunmp\",\"createUiDefinition\":\"datatdbhrbnla\"},\"managedBy\":\"xmyskp\",\"sku\":{\"name\":\"enbtkcxywny\",\"tier\":\"rsyn\",\"size\":\"idybyxczf\",\"family\":\"haaxdbabphl\",\"model\":\"qlfktsths\",\"capacity\":2034865697},\"identity\":{\"principalId\":\"nyyazttbtwwrqpue\",\"tenantId\":\"kzywbiex\",\"type\":\"SystemAssigned\"},\"location\":\"yueaxibxujwb\",\"tags\":{\"cuxrhdwbavx\":\"almuzyoxaepdkzja\"},\"id\":\"niwdjsw\",\"name\":\"tsdbpgn\",\"type\":\"ytxhp\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ApplicationManager manager = - ApplicationManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ApplicationDefinition response = - manager - .applicationDefinitions() - .getByResourceGroupWithResponse("qzahmgkbrp", "y", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("yueaxibxujwb", response.location()); - Assertions.assertEquals("almuzyoxaepdkzja", response.tags().get("cuxrhdwbavx")); - Assertions.assertEquals("xmyskp", response.managedBy()); - Assertions.assertEquals("enbtkcxywny", response.sku().name()); - Assertions.assertEquals("rsyn", response.sku().tier()); - Assertions.assertEquals("idybyxczf", response.sku().size()); - Assertions.assertEquals("haaxdbabphl", response.sku().family()); - Assertions.assertEquals("qlfktsths", response.sku().model()); - Assertions.assertEquals(2034865697, response.sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); - Assertions.assertEquals(ApplicationLockLevel.READ_ONLY, response.lockLevel()); - Assertions.assertEquals("bnuqqkpik", response.displayName()); - Assertions.assertEquals("rgvtqag", response.isEnabled()); - Assertions.assertEquals("hijggme", response.description()); - Assertions.assertEquals("siarbutrcvpn", response.packageFileUri()); - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListByResourceGroupMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListByResourceGroupMockTests.java deleted file mode 100644 index 2e49b2b91b77..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsListByResourceGroupMockTests.java +++ /dev/null @@ -1,84 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.managedapplications.ApplicationManager; -import com.azure.resourcemanager.managedapplications.models.ApplicationDefinition; -import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ResourceIdentityType; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ApplicationDefinitionsListByResourceGroupMockTests { - @Test - public void testListByResourceGroup() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"lockLevel\":\"ReadOnly\",\"displayName\":\"vgyuguos\",\"isEnabled\":\"kfssxqukkf\",\"authorizations\":[],\"artifacts\":[],\"description\":\"sxnkjzkdeslpvlo\",\"packageFileUri\":\"i\",\"mainTemplate\":\"dataghxpkdw\",\"createUiDefinition\":\"dataaiuebbaumnyqu\"},\"managedBy\":\"deoj\",\"sku\":{\"name\":\"bckhsmtxpsi\",\"tier\":\"tfhvpesapskrdqmh\",\"size\":\"dhtldwkyz\",\"family\":\"utknc\",\"model\":\"cwsvlxotog\",\"capacity\":918188408},\"identity\":{\"principalId\":\"qsx\",\"tenantId\":\"micykvceoveilo\",\"type\":\"SystemAssigned\"},\"location\":\"tyfjfcnjbkcnxdhb\",\"tags\":{\"oqnermclfpl\":\"phywpnvj\",\"rpabg\":\"hoxus\",\"xywpmueefjzwfqkq\":\"epsbjtazqu\"},\"id\":\"jidsuyonobglaoc\",\"name\":\"xtccmg\",\"type\":\"udxytlmoyrx\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ApplicationManager manager = - ApplicationManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.applicationDefinitions().listByResourceGroup("ovplw", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("tyfjfcnjbkcnxdhb", response.iterator().next().location()); - Assertions.assertEquals("phywpnvj", response.iterator().next().tags().get("oqnermclfpl")); - Assertions.assertEquals("deoj", response.iterator().next().managedBy()); - Assertions.assertEquals("bckhsmtxpsi", response.iterator().next().sku().name()); - Assertions.assertEquals("tfhvpesapskrdqmh", response.iterator().next().sku().tier()); - Assertions.assertEquals("dhtldwkyz", response.iterator().next().sku().size()); - Assertions.assertEquals("utknc", response.iterator().next().sku().family()); - Assertions.assertEquals("cwsvlxotog", response.iterator().next().sku().model()); - Assertions.assertEquals(918188408, response.iterator().next().sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type()); - Assertions.assertEquals(ApplicationLockLevel.READ_ONLY, response.iterator().next().lockLevel()); - Assertions.assertEquals("vgyuguos", response.iterator().next().displayName()); - Assertions.assertEquals("kfssxqukkf", response.iterator().next().isEnabled()); - Assertions.assertEquals("sxnkjzkdeslpvlo", response.iterator().next().description()); - Assertions.assertEquals("i", response.iterator().next().packageFileUri()); - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDeploymentPolicyTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDeploymentPolicyTests.java new file mode 100644 index 000000000000..bc7a750347ab --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDeploymentPolicyTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationDeploymentPolicy; +import com.azure.resourcemanager.managedapplications.models.DeploymentMode; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationDeploymentPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationDeploymentPolicy model = + BinaryData.fromString("{\"deploymentMode\":\"Complete\"}").toObject(ApplicationDeploymentPolicy.class); + Assertions.assertEquals(DeploymentMode.COMPLETE, model.deploymentMode()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationDeploymentPolicy model = + new ApplicationDeploymentPolicy().withDeploymentMode(DeploymentMode.COMPLETE); + model = BinaryData.fromObject(model).toObject(ApplicationDeploymentPolicy.class); + Assertions.assertEquals(DeploymentMode.COMPLETE, model.deploymentMode()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationJitAccessPolicyTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationJitAccessPolicyTests.java new file mode 100644 index 000000000000..ed13e2c04975 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationJitAccessPolicyTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationJitAccessPolicy; +import com.azure.resourcemanager.managedapplications.models.JitApprovalMode; +import com.azure.resourcemanager.managedapplications.models.JitApproverDefinition; +import com.azure.resourcemanager.managedapplications.models.JitApproverType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationJitAccessPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationJitAccessPolicy model = + BinaryData + .fromString( + "{\"jitAccessEnabled\":true,\"jitApprovalMode\":\"AutoApprove\",\"jitApprovers\":[{\"id\":\"kufubljo\",\"type\":\"user\",\"displayName\":\"ofjaeqjhqjb\"},{\"id\":\"s\",\"type\":\"group\",\"displayName\":\"jqul\"}],\"maximumJitAccessDuration\":\"sntnbybkzgcw\"}") + .toObject(ApplicationJitAccessPolicy.class); + Assertions.assertEquals(true, model.jitAccessEnabled()); + Assertions.assertEquals(JitApprovalMode.AUTO_APPROVE, model.jitApprovalMode()); + Assertions.assertEquals("kufubljo", model.jitApprovers().get(0).id()); + Assertions.assertEquals(JitApproverType.USER, model.jitApprovers().get(0).type()); + Assertions.assertEquals("ofjaeqjhqjb", model.jitApprovers().get(0).displayName()); + Assertions.assertEquals("sntnbybkzgcw", model.maximumJitAccessDuration()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationJitAccessPolicy model = + new ApplicationJitAccessPolicy() + .withJitAccessEnabled(true) + .withJitApprovalMode(JitApprovalMode.AUTO_APPROVE) + .withJitApprovers( + Arrays + .asList( + new JitApproverDefinition() + .withId("kufubljo") + .withType(JitApproverType.USER) + .withDisplayName("ofjaeqjhqjb"), + new JitApproverDefinition() + .withId("s") + .withType(JitApproverType.GROUP) + .withDisplayName("jqul"))) + .withMaximumJitAccessDuration("sntnbybkzgcw"); + model = BinaryData.fromObject(model).toObject(ApplicationJitAccessPolicy.class); + Assertions.assertEquals(true, model.jitAccessEnabled()); + Assertions.assertEquals(JitApprovalMode.AUTO_APPROVE, model.jitApprovalMode()); + Assertions.assertEquals("kufubljo", model.jitApprovers().get(0).id()); + Assertions.assertEquals(JitApproverType.USER, model.jitApprovers().get(0).type()); + Assertions.assertEquals("ofjaeqjhqjb", model.jitApprovers().get(0).displayName()); + Assertions.assertEquals("sntnbybkzgcw", model.maximumJitAccessDuration()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationManagementPolicyTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationManagementPolicyTests.java new file mode 100644 index 000000000000..8034112e9274 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationManagementPolicyTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementMode; +import com.azure.resourcemanager.managedapplications.models.ApplicationManagementPolicy; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationManagementPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationManagementPolicy model = + BinaryData.fromString("{\"mode\":\"NotSpecified\"}").toObject(ApplicationManagementPolicy.class); + Assertions.assertEquals(ApplicationManagementMode.NOT_SPECIFIED, model.mode()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationManagementPolicy model = + new ApplicationManagementPolicy().withMode(ApplicationManagementMode.NOT_SPECIFIED); + model = BinaryData.fromObject(model).toObject(ApplicationManagementPolicy.class); + Assertions.assertEquals(ApplicationManagementMode.NOT_SPECIFIED, model.mode()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationNotificationEndpointTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationNotificationEndpointTests.java new file mode 100644 index 000000000000..00600bc3ada1 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationNotificationEndpointTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationNotificationEndpoint; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationNotificationEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationNotificationEndpoint model = + BinaryData.fromString("{\"uri\":\"o\"}").toObject(ApplicationNotificationEndpoint.class); + Assertions.assertEquals("o", model.uri()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationNotificationEndpoint model = new ApplicationNotificationEndpoint().withUri("o"); + model = BinaryData.fromObject(model).toObject(ApplicationNotificationEndpoint.class); + Assertions.assertEquals("o", model.uri()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationNotificationPolicyTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationNotificationPolicyTests.java new file mode 100644 index 000000000000..e8d19e0ee13d --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationNotificationPolicyTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationNotificationEndpoint; +import com.azure.resourcemanager.managedapplications.models.ApplicationNotificationPolicy; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationNotificationPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationNotificationPolicy model = + BinaryData + .fromString("{\"notificationEndpoints\":[{\"uri\":\"exxppofmxaxcfjp\"},{\"uri\":\"ddtocjjxhvp\"}]}") + .toObject(ApplicationNotificationPolicy.class); + Assertions.assertEquals("exxppofmxaxcfjp", model.notificationEndpoints().get(0).uri()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationNotificationPolicy model = + new ApplicationNotificationPolicy() + .withNotificationEndpoints( + Arrays + .asList( + new ApplicationNotificationEndpoint().withUri("exxppofmxaxcfjp"), + new ApplicationNotificationEndpoint().withUri("ddtocjjxhvp"))); + model = BinaryData.fromObject(model).toObject(ApplicationNotificationPolicy.class); + Assertions.assertEquals("exxppofmxaxcfjp", model.notificationEndpoints().get(0).uri()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPackageContactTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPackageContactTests.java new file mode 100644 index 000000000000..97a986b9016c --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPackageContactTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageContact; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationPackageContactTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationPackageContact model = + BinaryData + .fromString("{\"contactName\":\"p\",\"email\":\"wnzlljfmppeeb\",\"phone\":\"mgxsab\"}") + .toObject(ApplicationPackageContact.class); + Assertions.assertEquals("p", model.contactName()); + Assertions.assertEquals("wnzlljfmppeeb", model.email()); + Assertions.assertEquals("mgxsab", model.phone()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationPackageContact model = + new ApplicationPackageContact().withContactName("p").withEmail("wnzlljfmppeeb").withPhone("mgxsab"); + model = BinaryData.fromObject(model).toObject(ApplicationPackageContact.class); + Assertions.assertEquals("p", model.contactName()); + Assertions.assertEquals("wnzlljfmppeeb", model.email()); + Assertions.assertEquals("mgxsab", model.phone()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPackageLockingPolicyDefinitionTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPackageLockingPolicyDefinitionTests.java new file mode 100644 index 000000000000..71d26d5fa7d5 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPackageLockingPolicyDefinitionTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageLockingPolicyDefinition; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationPackageLockingPolicyDefinitionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationPackageLockingPolicyDefinition model = + BinaryData + .fromString( + "{\"allowedActions\":[\"hd\",\"xibqeojnx\",\"bzv\",\"dntwndeicbtw\"],\"allowedDataActions\":[\"aoqvuh\"]}") + .toObject(ApplicationPackageLockingPolicyDefinition.class); + Assertions.assertEquals("hd", model.allowedActions().get(0)); + Assertions.assertEquals("aoqvuh", model.allowedDataActions().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationPackageLockingPolicyDefinition model = + new ApplicationPackageLockingPolicyDefinition() + .withAllowedActions(Arrays.asList("hd", "xibqeojnx", "bzv", "dntwndeicbtw")) + .withAllowedDataActions(Arrays.asList("aoqvuh")); + model = BinaryData.fromObject(model).toObject(ApplicationPackageLockingPolicyDefinition.class); + Assertions.assertEquals("hd", model.allowedActions().get(0)); + Assertions.assertEquals("aoqvuh", model.allowedDataActions().get(0)); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPackageSupportUrlsTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPackageSupportUrlsTests.java new file mode 100644 index 000000000000..b1af15d33102 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPackageSupportUrlsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationPackageSupportUrls; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationPackageSupportUrlsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationPackageSupportUrls model = + BinaryData + .fromString("{\"publicAzure\":\"qduujitcjczdz\",\"governmentCloud\":\"ndhkrw\"}") + .toObject(ApplicationPackageSupportUrls.class); + Assertions.assertEquals("qduujitcjczdz", model.publicAzure()); + Assertions.assertEquals("ndhkrw", model.governmentCloud()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationPackageSupportUrls model = + new ApplicationPackageSupportUrls().withPublicAzure("qduujitcjczdz").withGovernmentCloud("ndhkrw"); + model = BinaryData.fromObject(model).toObject(ApplicationPackageSupportUrls.class); + Assertions.assertEquals("qduujitcjczdz", model.publicAzure()); + Assertions.assertEquals("ndhkrw", model.governmentCloud()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPolicyTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPolicyTests.java new file mode 100644 index 000000000000..cfcee38a5e71 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPolicyTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.ApplicationPolicy; +import org.junit.jupiter.api.Assertions; + +public final class ApplicationPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplicationPolicy model = + BinaryData + .fromString( + "{\"name\":\"cyddglmjthjqk\",\"policyDefinitionId\":\"yeicxmqciwqvhk\",\"parameters\":\"xuigdtopbobj\"}") + .toObject(ApplicationPolicy.class); + Assertions.assertEquals("cyddglmjthjqk", model.name()); + Assertions.assertEquals("yeicxmqciwqvhk", model.policyDefinitionId()); + Assertions.assertEquals("xuigdtopbobj", model.parameters()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplicationPolicy model = + new ApplicationPolicy() + .withName("cyddglmjthjqk") + .withPolicyDefinitionId("yeicxmqciwqvhk") + .withParameters("xuigdtopbobj"); + model = BinaryData.fromObject(model).toObject(ApplicationPolicy.class); + Assertions.assertEquals("cyddglmjthjqk", model.name()); + Assertions.assertEquals("yeicxmqciwqvhk", model.policyDefinitionId()); + Assertions.assertEquals("xuigdtopbobj", model.parameters()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPropertiesPatchableTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPropertiesPatchableTests.java deleted file mode 100644 index 111f4fa12463..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPropertiesPatchableTests.java +++ /dev/null @@ -1,34 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationPropertiesPatchable; -import org.junit.jupiter.api.Assertions; - -public final class ApplicationPropertiesPatchableTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ApplicationPropertiesPatchable model = - BinaryData - .fromString( - "{\"managedResourceGroupId\":\"kcqvkocrc\",\"applicationDefinitionId\":\"kwt\",\"parameters\":\"dataxbnjbiksq\",\"outputs\":\"datalssai\",\"provisioningState\":\"Deleted\"}") - .toObject(ApplicationPropertiesPatchable.class); - Assertions.assertEquals("kcqvkocrc", model.managedResourceGroupId()); - Assertions.assertEquals("kwt", model.applicationDefinitionId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ApplicationPropertiesPatchable model = - new ApplicationPropertiesPatchable() - .withManagedResourceGroupId("kcqvkocrc") - .withApplicationDefinitionId("kwt") - .withParameters("dataxbnjbiksq"); - model = BinaryData.fromObject(model).toObject(ApplicationPropertiesPatchable.class); - Assertions.assertEquals("kcqvkocrc", model.managedResourceGroupId()); - Assertions.assertEquals("kwt", model.applicationDefinitionId()); - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPropertiesTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPropertiesTests.java deleted file mode 100644 index 017076d610e1..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationPropertiesTests.java +++ /dev/null @@ -1,34 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.managedapplications.fluent.models.ApplicationProperties; -import org.junit.jupiter.api.Assertions; - -public final class ApplicationPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ApplicationProperties model = - BinaryData - .fromString( - "{\"managedResourceGroupId\":\"tijbpzvgnwzsymgl\",\"applicationDefinitionId\":\"fcyzkohdbihanufh\",\"parameters\":\"databj\",\"outputs\":\"dataa\",\"provisioningState\":\"Updating\"}") - .toObject(ApplicationProperties.class); - Assertions.assertEquals("tijbpzvgnwzsymgl", model.managedResourceGroupId()); - Assertions.assertEquals("fcyzkohdbihanufh", model.applicationDefinitionId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ApplicationProperties model = - new ApplicationProperties() - .withManagedResourceGroupId("tijbpzvgnwzsymgl") - .withApplicationDefinitionId("fcyzkohdbihanufh") - .withParameters("databj"); - model = BinaryData.fromObject(model).toObject(ApplicationProperties.class); - Assertions.assertEquals("tijbpzvgnwzsymgl", model.managedResourceGroupId()); - Assertions.assertEquals("fcyzkohdbihanufh", model.applicationDefinitionId()); - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationProviderAuthorizationTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationProviderAuthorizationTests.java deleted file mode 100644 index de6afb42ca3a..000000000000 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationProviderAuthorizationTests.java +++ /dev/null @@ -1,30 +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.resourcemanager.managedapplications.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.managedapplications.models.ApplicationProviderAuthorization; -import org.junit.jupiter.api.Assertions; - -public final class ApplicationProviderAuthorizationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ApplicationProviderAuthorization model = - BinaryData - .fromString("{\"principalId\":\"ifiyipjxsqwpgrj\",\"roleDefinitionId\":\"znorcj\"}") - .toObject(ApplicationProviderAuthorization.class); - Assertions.assertEquals("ifiyipjxsqwpgrj", model.principalId()); - Assertions.assertEquals("znorcj", model.roleDefinitionId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ApplicationProviderAuthorization model = - new ApplicationProviderAuthorization().withPrincipalId("ifiyipjxsqwpgrj").withRoleDefinitionId("znorcj"); - model = BinaryData.fromObject(model).toObject(ApplicationProviderAuthorization.class); - Assertions.assertEquals("ifiyipjxsqwpgrj", model.principalId()); - Assertions.assertEquals("znorcj", model.roleDefinitionId()); - } -} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteByIdMockTests.java similarity index 93% rename from sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdMockTests.java rename to sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteByIdMockTests.java index 18311a854d92..60822d602918 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteByIdMockTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteByIdMockTests.java @@ -21,7 +21,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public final class ApplicationDefinitionsDeleteByIdMockTests { +public final class ApplicationsDeleteByIdMockTests { @Test public void testDeleteById() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); @@ -56,6 +56,6 @@ public void testDeleteById() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.applicationDefinitions().deleteById("nrjawgqwg", "hniskxfbkpyc", com.azure.core.util.Context.NONE); + manager.applications().deleteById("ehhseyvjusrts", com.azure.core.util.Context.NONE); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteMockTests.java similarity index 93% rename from sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteMockTests.java rename to sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteMockTests.java index a363d90349f1..033a5249cd42 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsDeleteMockTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsDeleteMockTests.java @@ -21,7 +21,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public final class ApplicationDefinitionsDeleteMockTests { +public final class ApplicationsDeleteMockTests { @Test public void testDelete() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); @@ -56,6 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.applicationDefinitions().delete("xbzpfzab", "lcuhxwtctyqiklb", com.azure.core.util.Context.NONE); + manager.applications().delete("koklya", "uconuqszfkbey", com.azure.core.util.Context.NONE); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsRefreshPermissionsMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsRefreshPermissionsMockTests.java new file mode 100644 index 000000000000..6de18fa9e162 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsRefreshPermissionsMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.managedapplications.ApplicationManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ApplicationsRefreshPermissionsMockTests { + @Test + public void testRefreshPermissions() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApplicationManager manager = + ApplicationManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.applications().refreshPermissions("yzm", "txon", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByIdWithResponseMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateAccessMockTests.java similarity index 50% rename from sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByIdWithResponseMockTests.java rename to sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateAccessMockTests.java index 5bb9b72e04c6..b2417c1fd3fe 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationDefinitionsGetByIdWithResponseMockTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ApplicationsUpdateAccessMockTests.java @@ -12,9 +12,11 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.managedapplications.ApplicationManager; -import com.azure.resourcemanager.managedapplications.models.ApplicationDefinition; -import com.azure.resourcemanager.managedapplications.models.ApplicationLockLevel; -import com.azure.resourcemanager.managedapplications.models.ResourceIdentityType; +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.JitRequestMetadata; +import com.azure.resourcemanager.managedapplications.models.Status; +import com.azure.resourcemanager.managedapplications.models.Substatus; +import com.azure.resourcemanager.managedapplications.models.UpdateAccessDefinition; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -25,15 +27,15 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public final class ApplicationDefinitionsGetByIdWithResponseMockTests { +public final class ApplicationsUpdateAccessMockTests { @Test - public void testGetByIdWithResponse() throws Exception { + public void testUpdateAccess() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"lockLevel\":\"None\",\"displayName\":\"kfrlhrxsbky\",\"isEnabled\":\"ycanuzbpzkafku\",\"authorizations\":[],\"artifacts\":[],\"description\":\"wbme\",\"packageFileUri\":\"seyvj\",\"mainTemplate\":\"datarts\",\"createUiDefinition\":\"dataspkdee\"},\"managedBy\":\"ofmxagkvtmelmqkr\",\"sku\":{\"name\":\"hvljuahaquh\",\"tier\":\"hmdua\",\"size\":\"exq\",\"family\":\"fadmws\",\"model\":\"r\",\"capacity\":1259983494},\"identity\":{\"principalId\":\"gomz\",\"tenantId\":\"misgwbnb\",\"type\":\"SystemAssigned\"},\"location\":\"dawkzbali\",\"tags\":{\"xosow\":\"qhakauhashsf\",\"cjooxdjebwpucwwf\":\"xcug\",\"hzceuojgjrwjue\":\"ovbvmeueciv\"},\"id\":\"otwmcdyt\",\"name\":\"x\",\"type\":\"it\"}"; + "{\"approver\":\"p\",\"metadata\":{\"originRequestId\":\"jyofdxluusdtto\",\"requestorId\":\"aboekqv\",\"tenantDisplayName\":\"lns\",\"subjectDisplayName\":\"bxwyjsflhhcaa\"},\"status\":\"Remove\",\"subStatus\":\"Failed\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,26 +63,30 @@ public void testGetByIdWithResponse() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - ApplicationDefinition response = + UpdateAccessDefinition response = manager - .applicationDefinitions() - .getByIdWithResponse("wfudwpzntxhdzhl", "qj", com.azure.core.util.Context.NONE) - .getValue(); + .applications() + .updateAccess( + "vgqzcjrvxd", + "zlmwlxkvugfhz", + new UpdateAccessDefinitionInner() + .withApprover("awjvzunluthnnp") + .withMetadata( + new JitRequestMetadata() + .withOriginRequestId("xipeilpjzuaejx") + .withRequestorId("ltskzbbtd") + .withTenantDisplayName("mv") + .withSubjectDisplayName("kgpwoz")) + .withStatus(Status.NOT_SPECIFIED) + .withSubStatus(Substatus.FAILED), + com.azure.core.util.Context.NONE); - Assertions.assertEquals("dawkzbali", response.location()); - Assertions.assertEquals("qhakauhashsf", response.tags().get("xosow")); - Assertions.assertEquals("ofmxagkvtmelmqkr", response.managedBy()); - Assertions.assertEquals("hvljuahaquh", response.sku().name()); - Assertions.assertEquals("hmdua", response.sku().tier()); - Assertions.assertEquals("exq", response.sku().size()); - Assertions.assertEquals("fadmws", response.sku().family()); - Assertions.assertEquals("r", response.sku().model()); - Assertions.assertEquals(1259983494, response.sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); - Assertions.assertEquals(ApplicationLockLevel.NONE, response.lockLevel()); - Assertions.assertEquals("kfrlhrxsbky", response.displayName()); - Assertions.assertEquals("ycanuzbpzkafku", response.isEnabled()); - Assertions.assertEquals("wbme", response.description()); - Assertions.assertEquals("seyvj", response.packageFileUri()); + Assertions.assertEquals("p", response.approver()); + Assertions.assertEquals("jyofdxluusdtto", response.metadata().originRequestId()); + Assertions.assertEquals("aboekqv", response.metadata().requestorId()); + Assertions.assertEquals("lns", response.metadata().tenantDisplayName()); + Assertions.assertEquals("bxwyjsflhhcaa", response.metadata().subjectDisplayName()); + Assertions.assertEquals(Status.REMOVE, response.status()); + Assertions.assertEquals(Substatus.FAILED, response.subStatus()); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/GenericResourceTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/GenericResourceTests.java index 21a69fda6c4e..e5b203d1a176 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/GenericResourceTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/GenericResourceTests.java @@ -6,8 +6,6 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.managedapplications.models.GenericResource; -import com.azure.resourcemanager.managedapplications.models.Identity; -import com.azure.resourcemanager.managedapplications.models.ResourceIdentityType; import com.azure.resourcemanager.managedapplications.models.Sku; import java.util.HashMap; import java.util.Map; @@ -19,50 +17,56 @@ public void testDeserialize() throws Exception { GenericResource model = BinaryData .fromString( - "{\"managedBy\":\"fwvuk\",\"sku\":{\"name\":\"audccsnhs\",\"tier\":\"nyejhkryhtnap\",\"size\":\"wlokjyem\",\"family\":\"vnipjox\",\"model\":\"nchgej\",\"capacity\":178199431},\"identity\":{\"principalId\":\"ailzydehojwyahu\",\"tenantId\":\"npmqnjaqwixjspro\",\"type\":\"SystemAssigned\"},\"location\":\"putegjvwmfd\",\"tags\":{\"jhulsuuvmkjo\":\"cmdv\",\"wfndiodjpsl\":\"k\",\"pvwryoqpsoacc\":\"ej\",\"lahbcryff\":\"azakl\"},\"id\":\"fdosyg\",\"name\":\"xpaojakhmsbz\",\"type\":\"hcrzevd\"}") + "{\"managedBy\":\"kwy\",\"sku\":{\"name\":\"gfgibm\",\"tier\":\"gakeqsr\",\"size\":\"bzqqedqytbciq\",\"family\":\"uflmm\",\"model\":\"zsm\",\"capacity\":269319267},\"location\":\"lougpbkw\",\"tags\":{\"umkdosvqwhbmd\":\"tduqktapspwgcuer\",\"bhtqqrolfpfpsa\":\"bbjfddgmbmbexp\",\"jgzjaoyfhrtx\":\"gbquxigj\",\"fqawrlyxw\":\"lnerkujysvleju\"},\"id\":\"kcprbnw\",\"name\":\"xgjvtbv\",\"type\":\"ysszdnrujqguh\"}") .toObject(GenericResource.class); - Assertions.assertEquals("putegjvwmfd", model.location()); - Assertions.assertEquals("cmdv", model.tags().get("jhulsuuvmkjo")); - Assertions.assertEquals("fwvuk", model.managedBy()); - Assertions.assertEquals("audccsnhs", model.sku().name()); - Assertions.assertEquals("nyejhkryhtnap", model.sku().tier()); - Assertions.assertEquals("wlokjyem", model.sku().size()); - Assertions.assertEquals("vnipjox", model.sku().family()); - Assertions.assertEquals("nchgej", model.sku().model()); - Assertions.assertEquals(178199431, model.sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("lougpbkw", model.location()); + Assertions.assertEquals("tduqktapspwgcuer", model.tags().get("umkdosvqwhbmd")); + Assertions.assertEquals("kwy", model.managedBy()); + Assertions.assertEquals("gfgibm", model.sku().name()); + Assertions.assertEquals("gakeqsr", model.sku().tier()); + Assertions.assertEquals("bzqqedqytbciq", model.sku().size()); + Assertions.assertEquals("uflmm", model.sku().family()); + Assertions.assertEquals("zsm", model.sku().model()); + Assertions.assertEquals(269319267, model.sku().capacity()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { GenericResource model = new GenericResource() - .withLocation("putegjvwmfd") + .withLocation("lougpbkw") .withTags( - mapOf("jhulsuuvmkjo", "cmdv", "wfndiodjpsl", "k", "pvwryoqpsoacc", "ej", "lahbcryff", "azakl")) - .withManagedBy("fwvuk") + mapOf( + "umkdosvqwhbmd", + "tduqktapspwgcuer", + "bhtqqrolfpfpsa", + "bbjfddgmbmbexp", + "jgzjaoyfhrtx", + "gbquxigj", + "fqawrlyxw", + "lnerkujysvleju")) + .withManagedBy("kwy") .withSku( new Sku() - .withName("audccsnhs") - .withTier("nyejhkryhtnap") - .withSize("wlokjyem") - .withFamily("vnipjox") - .withModel("nchgej") - .withCapacity(178199431)) - .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)); + .withName("gfgibm") + .withTier("gakeqsr") + .withSize("bzqqedqytbciq") + .withFamily("uflmm") + .withModel("zsm") + .withCapacity(269319267)); model = BinaryData.fromObject(model).toObject(GenericResource.class); - Assertions.assertEquals("putegjvwmfd", model.location()); - Assertions.assertEquals("cmdv", model.tags().get("jhulsuuvmkjo")); - Assertions.assertEquals("fwvuk", model.managedBy()); - Assertions.assertEquals("audccsnhs", model.sku().name()); - Assertions.assertEquals("nyejhkryhtnap", model.sku().tier()); - Assertions.assertEquals("wlokjyem", model.sku().size()); - Assertions.assertEquals("vnipjox", model.sku().family()); - Assertions.assertEquals("nchgej", model.sku().model()); - Assertions.assertEquals(178199431, model.sku().capacity()); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("lougpbkw", model.location()); + Assertions.assertEquals("tduqktapspwgcuer", model.tags().get("umkdosvqwhbmd")); + Assertions.assertEquals("kwy", model.managedBy()); + Assertions.assertEquals("gfgibm", model.sku().name()); + Assertions.assertEquals("gakeqsr", model.sku().tier()); + Assertions.assertEquals("bzqqedqytbciq", model.sku().size()); + Assertions.assertEquals("uflmm", model.sku().family()); + Assertions.assertEquals("zsm", model.sku().model()); + Assertions.assertEquals(269319267, model.sku().capacity()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/IdentityTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/IdentityTests.java index 8700b376b07c..8684d9ed491a 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/IdentityTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/IdentityTests.java @@ -7,6 +7,9 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.managedapplications.models.Identity; import com.azure.resourcemanager.managedapplications.models.ResourceIdentityType; +import com.azure.resourcemanager.managedapplications.models.UserAssignedResourceIdentity; +import java.util.HashMap; +import java.util.Map; import org.junit.jupiter.api.Assertions; public final class IdentityTests { @@ -15,15 +18,30 @@ public void testDeserialize() throws Exception { Identity model = BinaryData .fromString( - "{\"principalId\":\"xypininmayhuybbk\",\"tenantId\":\"depoog\",\"type\":\"SystemAssigned\"}") + "{\"principalId\":\"ftyxolniw\",\"tenantId\":\"cukjf\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ddhsgcbacphe\":{\"principalId\":\"klryplwck\",\"tenantId\":\"syyp\"}}}") .toObject(Identity.class); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.type()); + Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - Identity model = new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED); + Identity model = + new Identity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("ddhsgcbacphe", new UserAssignedResourceIdentity())); model = BinaryData.fromObject(model).toObject(Identity.class); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.type()); + Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitApproverDefinitionTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitApproverDefinitionTests.java new file mode 100644 index 000000000000..b30346612031 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitApproverDefinitionTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.JitApproverDefinition; +import com.azure.resourcemanager.managedapplications.models.JitApproverType; +import org.junit.jupiter.api.Assertions; + +public final class JitApproverDefinitionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JitApproverDefinition model = + BinaryData + .fromString("{\"id\":\"wclxxwrl\",\"type\":\"group\",\"displayName\":\"skcqvkocrcjd\"}") + .toObject(JitApproverDefinition.class); + Assertions.assertEquals("wclxxwrl", model.id()); + Assertions.assertEquals(JitApproverType.GROUP, model.type()); + Assertions.assertEquals("skcqvkocrcjd", model.displayName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JitApproverDefinition model = + new JitApproverDefinition() + .withId("wclxxwrl") + .withType(JitApproverType.GROUP) + .withDisplayName("skcqvkocrcjd"); + model = BinaryData.fromObject(model).toObject(JitApproverDefinition.class); + Assertions.assertEquals("wclxxwrl", model.id()); + Assertions.assertEquals(JitApproverType.GROUP, model.type()); + Assertions.assertEquals("skcqvkocrcjd", model.displayName()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitAuthorizationPoliciesTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitAuthorizationPoliciesTests.java new file mode 100644 index 000000000000..f658a46499aa --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitAuthorizationPoliciesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.JitAuthorizationPolicies; +import org.junit.jupiter.api.Assertions; + +public final class JitAuthorizationPoliciesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JitAuthorizationPolicies model = + BinaryData + .fromString("{\"principalId\":\"nvowgujju\",\"roleDefinitionId\":\"wdkcglhsl\"}") + .toObject(JitAuthorizationPolicies.class); + Assertions.assertEquals("nvowgujju", model.principalId()); + Assertions.assertEquals("wdkcglhsl", model.roleDefinitionId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JitAuthorizationPolicies model = + new JitAuthorizationPolicies().withPrincipalId("nvowgujju").withRoleDefinitionId("wdkcglhsl"); + model = BinaryData.fromObject(model).toObject(JitAuthorizationPolicies.class); + Assertions.assertEquals("nvowgujju", model.principalId()); + Assertions.assertEquals("wdkcglhsl", model.roleDefinitionId()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitRequestMetadataTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitRequestMetadataTests.java new file mode 100644 index 000000000000..da03c66d2f22 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitRequestMetadataTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.JitRequestMetadata; +import org.junit.jupiter.api.Assertions; + +public final class JitRequestMetadataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JitRequestMetadata model = + BinaryData + .fromString( + "{\"originRequestId\":\"rrqnbpoczvyifqrv\",\"requestorId\":\"vjsllrmvvdfw\",\"tenantDisplayName\":\"kpnpulexxbczwtr\",\"subjectDisplayName\":\"iqzbq\"}") + .toObject(JitRequestMetadata.class); + Assertions.assertEquals("rrqnbpoczvyifqrv", model.originRequestId()); + Assertions.assertEquals("vjsllrmvvdfw", model.requestorId()); + Assertions.assertEquals("kpnpulexxbczwtr", model.tenantDisplayName()); + Assertions.assertEquals("iqzbq", model.subjectDisplayName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JitRequestMetadata model = + new JitRequestMetadata() + .withOriginRequestId("rrqnbpoczvyifqrv") + .withRequestorId("vjsllrmvvdfw") + .withTenantDisplayName("kpnpulexxbczwtr") + .withSubjectDisplayName("iqzbq"); + model = BinaryData.fromObject(model).toObject(JitRequestMetadata.class); + Assertions.assertEquals("rrqnbpoczvyifqrv", model.originRequestId()); + Assertions.assertEquals("vjsllrmvvdfw", model.requestorId()); + Assertions.assertEquals("kpnpulexxbczwtr", model.tenantDisplayName()); + Assertions.assertEquals("iqzbq", model.subjectDisplayName()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitRequestPatchableTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitRequestPatchableTests.java new file mode 100644 index 000000000000..0a4ebd37b379 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitRequestPatchableTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.JitRequestPatchable; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class JitRequestPatchableTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JitRequestPatchable model = + BinaryData + .fromString("{\"tags\":{\"hmenevfyexfwhybc\":\"gdtjixhbkuofqwey\"}}") + .toObject(JitRequestPatchable.class); + Assertions.assertEquals("gdtjixhbkuofqwey", model.tags().get("hmenevfyexfwhybc")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JitRequestPatchable model = new JitRequestPatchable().withTags(mapOf("hmenevfyexfwhybc", "gdtjixhbkuofqwey")); + model = BinaryData.fromObject(model).toObject(JitRequestPatchable.class); + Assertions.assertEquals("gdtjixhbkuofqwey", model.tags().get("hmenevfyexfwhybc")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsDeleteByResourceGroupWithResponseMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsDeleteByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..e5600d18dbb3 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitRequestsDeleteByResourceGroupWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.managedapplications.ApplicationManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class JitRequestsDeleteByResourceGroupWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ApplicationManager manager = + ApplicationManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .jitRequests() + .deleteByResourceGroupWithResponse("mpaxmodfvuefywsb", "fvmwy", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitSchedulingPolicyTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitSchedulingPolicyTests.java new file mode 100644 index 000000000000..70818197d056 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/JitSchedulingPolicyTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.JitSchedulingPolicy; +import com.azure.resourcemanager.managedapplications.models.JitSchedulingType; +import java.time.Duration; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class JitSchedulingPolicyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JitSchedulingPolicy model = + BinaryData + .fromString( + "{\"type\":\"Recurring\",\"duration\":\"PT138H46M31S\",\"startTime\":\"2021-04-25T05:09:53Z\"}") + .toObject(JitSchedulingPolicy.class); + Assertions.assertEquals(JitSchedulingType.RECURRING, model.type()); + Assertions.assertEquals(Duration.parse("PT138H46M31S"), model.duration()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-25T05:09:53Z"), model.startTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JitSchedulingPolicy model = + new JitSchedulingPolicy() + .withType(JitSchedulingType.RECURRING) + .withDuration(Duration.parse("PT138H46M31S")) + .withStartTime(OffsetDateTime.parse("2021-04-25T05:09:53Z")); + model = BinaryData.fromObject(model).toObject(JitSchedulingPolicy.class); + Assertions.assertEquals(JitSchedulingType.RECURRING, model.type()); + Assertions.assertEquals(Duration.parse("PT138H46M31S"), model.duration()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-25T05:09:53Z"), model.startTime()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationDisplayTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationDisplayTests.java index 6dd25b086715..a8d5ff4942f1 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationDisplayTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationDisplayTests.java @@ -6,27 +6,20 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.managedapplications.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; public final class OperationDisplayTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { OperationDisplay model = BinaryData - .fromString("{\"provider\":\"psqucmpoyf\",\"resource\":\"fogknygjofjdde\",\"operation\":\"rd\"}") + .fromString( + "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") .toObject(OperationDisplay.class); - Assertions.assertEquals("psqucmpoyf", model.provider()); - Assertions.assertEquals("fogknygjofjdde", model.resource()); - Assertions.assertEquals("rd", model.operation()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - OperationDisplay model = - new OperationDisplay().withProvider("psqucmpoyf").withResource("fogknygjofjdde").withOperation("rd"); + OperationDisplay model = new OperationDisplay(); model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("psqucmpoyf", model.provider()); - Assertions.assertEquals("fogknygjofjdde", model.resource()); - Assertions.assertEquals("rd", model.operation()); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationInnerTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationInnerTests.java index c377145a0497..fb277f4f81d2 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationInnerTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationInnerTests.java @@ -7,7 +7,6 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.managedapplications.fluent.models.OperationInner; import com.azure.resourcemanager.managedapplications.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; public final class OperationInnerTests { @org.junit.jupiter.api.Test @@ -15,25 +14,13 @@ public void testDeserialize() throws Exception { OperationInner model = BinaryData .fromString( - "{\"name\":\"esaagdfm\",\"display\":{\"provider\":\"lhjxr\",\"resource\":\"kwm\",\"operation\":\"ktsizntocipaou\"}}") + "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") .toObject(OperationInner.class); - Assertions.assertEquals("esaagdfm", model.name()); - Assertions.assertEquals("lhjxr", model.display().provider()); - Assertions.assertEquals("kwm", model.display().resource()); - Assertions.assertEquals("ktsizntocipaou", model.display().operation()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - OperationInner model = - new OperationInner() - .withName("esaagdfm") - .withDisplay( - new OperationDisplay().withProvider("lhjxr").withResource("kwm").withOperation("ktsizntocipaou")); + OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); model = BinaryData.fromObject(model).toObject(OperationInner.class); - Assertions.assertEquals("esaagdfm", model.name()); - Assertions.assertEquals("lhjxr", model.display().provider()); - Assertions.assertEquals("kwm", model.display().resource()); - Assertions.assertEquals("ktsizntocipaou", model.display().operation()); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationListResultTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationListResultTests.java index dc233af1bd5a..03cf0476de33 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationListResultTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/OperationListResultTests.java @@ -5,11 +5,7 @@ package com.azure.resourcemanager.managedapplications.generated; import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.managedapplications.fluent.models.OperationInner; -import com.azure.resourcemanager.managedapplications.models.OperationDisplay; import com.azure.resourcemanager.managedapplications.models.OperationListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; public final class OperationListResultTests { @org.junit.jupiter.api.Test @@ -17,49 +13,13 @@ public void testDeserialize() throws Exception { OperationListResult model = BinaryData .fromString( - "{\"value\":[{\"name\":\"quvgjxpybczme\",\"display\":{\"provider\":\"zopbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\"}},{\"name\":\"zehtbmu\",\"display\":{\"provider\":\"wnoi\",\"resource\":\"wlrxyb\",\"operation\":\"oqijgkdmbpaz\"}},{\"name\":\"bc\",\"display\":{\"provider\":\"dznrbtcqq\",\"resource\":\"qglhq\",\"operation\":\"ufo\"}}],\"nextLink\":\"jywif\"}") + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") .toObject(OperationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); - Assertions.assertEquals("zopbsphrupidgs", model.value().get(0).display().provider()); - Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource()); - Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); - Assertions.assertEquals("jywif", model.nextLink()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - OperationListResult model = - new OperationListResult() - .withValue( - Arrays - .asList( - new OperationInner() - .withName("quvgjxpybczme") - .withDisplay( - new OperationDisplay() - .withProvider("zopbsphrupidgs") - .withResource("bejhphoycmsxa") - .withOperation("hdxbmtqio")), - new OperationInner() - .withName("zehtbmu") - .withDisplay( - new OperationDisplay() - .withProvider("wnoi") - .withResource("wlrxyb") - .withOperation("oqijgkdmbpaz")), - new OperationInner() - .withName("bc") - .withDisplay( - new OperationDisplay() - .withProvider("dznrbtcqq") - .withResource("qglhq") - .withOperation("ufo")))) - .withNextLink("jywif"); + OperationListResult model = new OperationListResult(); model = BinaryData.fromObject(model).toObject(OperationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); - Assertions.assertEquals("zopbsphrupidgs", model.value().get(0).display().provider()); - Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource()); - Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); - Assertions.assertEquals("jywif", model.nextLink()); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ResourceProvidersListOperationsMockTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ResourceProvidersListOperationsMockTests.java index 693e203a38df..9be247e6305c 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ResourceProvidersListOperationsMockTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/ResourceProvidersListOperationsMockTests.java @@ -17,7 +17,6 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -32,7 +31,7 @@ public void testListOperations() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"name\":\"xim\",\"display\":{\"provider\":\"ocfs\",\"resource\":\"s\",\"operation\":\"ddystkiiuxhqy\"}}]}"; + "{\"value\":[{\"name\":\"zjuqkhrsaj\",\"isDataAction\":false,\"display\":{\"provider\":\"foskghsauuimj\",\"resource\":\"xieduugidyjrr\",\"operation\":\"y\",\"description\":\"svexcsonpclhoco\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,10 +61,5 @@ public void testListOperations() throws Exception { PagedIterable response = manager.resourceProviders().listOperations(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("xim", response.iterator().next().name()); - Assertions.assertEquals("ocfs", response.iterator().next().display().provider()); - Assertions.assertEquals("s", response.iterator().next().display().resource()); - Assertions.assertEquals("ddystkiiuxhqy", response.iterator().next().display().operation()); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/SkuTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/SkuTests.java index 2662a59cfc80..0c2dd8c4d512 100644 --- a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/SkuTests.java +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/SkuTests.java @@ -14,32 +14,32 @@ public void testDeserialize() throws Exception { Sku model = BinaryData .fromString( - "{\"name\":\"hlxaolthqtr\",\"tier\":\"jbp\",\"size\":\"fsinzgvfcjrwzoxx\",\"family\":\"felluwfzitonpe\",\"model\":\"pjkjlxofpdv\",\"capacity\":1792293314}") + "{\"name\":\"uouq\",\"tier\":\"rwzwbng\",\"size\":\"tnwu\",\"family\":\"gazxuf\",\"model\":\"uckyf\",\"capacity\":279638935}") .toObject(Sku.class); - Assertions.assertEquals("hlxaolthqtr", model.name()); - Assertions.assertEquals("jbp", model.tier()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.size()); - Assertions.assertEquals("felluwfzitonpe", model.family()); - Assertions.assertEquals("pjkjlxofpdv", model.model()); - Assertions.assertEquals(1792293314, model.capacity()); + Assertions.assertEquals("uouq", model.name()); + Assertions.assertEquals("rwzwbng", model.tier()); + Assertions.assertEquals("tnwu", model.size()); + Assertions.assertEquals("gazxuf", model.family()); + Assertions.assertEquals("uckyf", model.model()); + Assertions.assertEquals(279638935, model.capacity()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { Sku model = new Sku() - .withName("hlxaolthqtr") - .withTier("jbp") - .withSize("fsinzgvfcjrwzoxx") - .withFamily("felluwfzitonpe") - .withModel("pjkjlxofpdv") - .withCapacity(1792293314); + .withName("uouq") + .withTier("rwzwbng") + .withSize("tnwu") + .withFamily("gazxuf") + .withModel("uckyf") + .withCapacity(279638935); model = BinaryData.fromObject(model).toObject(Sku.class); - Assertions.assertEquals("hlxaolthqtr", model.name()); - Assertions.assertEquals("jbp", model.tier()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.size()); - Assertions.assertEquals("felluwfzitonpe", model.family()); - Assertions.assertEquals("pjkjlxofpdv", model.model()); - Assertions.assertEquals(1792293314, model.capacity()); + Assertions.assertEquals("uouq", model.name()); + Assertions.assertEquals("rwzwbng", model.tier()); + Assertions.assertEquals("tnwu", model.size()); + Assertions.assertEquals("gazxuf", model.family()); + Assertions.assertEquals("uckyf", model.model()); + Assertions.assertEquals(279638935, model.capacity()); } } diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/UpdateAccessDefinitionInnerTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/UpdateAccessDefinitionInnerTests.java new file mode 100644 index 000000000000..7ad6379afa41 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/UpdateAccessDefinitionInnerTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.fluent.models.UpdateAccessDefinitionInner; +import com.azure.resourcemanager.managedapplications.models.JitRequestMetadata; +import com.azure.resourcemanager.managedapplications.models.Status; +import com.azure.resourcemanager.managedapplications.models.Substatus; +import org.junit.jupiter.api.Assertions; + +public final class UpdateAccessDefinitionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateAccessDefinitionInner model = + BinaryData + .fromString( + "{\"approver\":\"zydagfuaxbezyiuo\",\"metadata\":{\"originRequestId\":\"twhrdxwzywqsm\",\"requestorId\":\"ureximoryocfs\",\"tenantDisplayName\":\"s\",\"subjectDisplayName\":\"ddystkiiuxhqy\"},\"status\":\"Elevate\",\"subStatus\":\"Failed\"}") + .toObject(UpdateAccessDefinitionInner.class); + Assertions.assertEquals("zydagfuaxbezyiuo", model.approver()); + Assertions.assertEquals("twhrdxwzywqsm", model.metadata().originRequestId()); + Assertions.assertEquals("ureximoryocfs", model.metadata().requestorId()); + Assertions.assertEquals("s", model.metadata().tenantDisplayName()); + Assertions.assertEquals("ddystkiiuxhqy", model.metadata().subjectDisplayName()); + Assertions.assertEquals(Status.ELEVATE, model.status()); + Assertions.assertEquals(Substatus.FAILED, model.subStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateAccessDefinitionInner model = + new UpdateAccessDefinitionInner() + .withApprover("zydagfuaxbezyiuo") + .withMetadata( + new JitRequestMetadata() + .withOriginRequestId("twhrdxwzywqsm") + .withRequestorId("ureximoryocfs") + .withTenantDisplayName("s") + .withSubjectDisplayName("ddystkiiuxhqy")) + .withStatus(Status.ELEVATE) + .withSubStatus(Substatus.FAILED); + model = BinaryData.fromObject(model).toObject(UpdateAccessDefinitionInner.class); + Assertions.assertEquals("zydagfuaxbezyiuo", model.approver()); + Assertions.assertEquals("twhrdxwzywqsm", model.metadata().originRequestId()); + Assertions.assertEquals("ureximoryocfs", model.metadata().requestorId()); + Assertions.assertEquals("s", model.metadata().tenantDisplayName()); + Assertions.assertEquals("ddystkiiuxhqy", model.metadata().subjectDisplayName()); + Assertions.assertEquals(Status.ELEVATE, model.status()); + Assertions.assertEquals(Substatus.FAILED, model.subStatus()); + } +} diff --git a/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/UserAssignedResourceIdentityTests.java b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/UserAssignedResourceIdentityTests.java new file mode 100644 index 000000000000..fb497487d2a3 --- /dev/null +++ b/sdk/managedapplications/azure-resourcemanager-managedapplications/src/test/java/com/azure/resourcemanager/managedapplications/generated/UserAssignedResourceIdentityTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedapplications.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedapplications.models.UserAssignedResourceIdentity; + +public final class UserAssignedResourceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedResourceIdentity model = + BinaryData + .fromString("{\"principalId\":\"ot\",\"tenantId\":\"qgoulznd\"}") + .toObject(UserAssignedResourceIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedResourceIdentity model = new UserAssignedResourceIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedResourceIdentity.class); + } +} diff --git a/sdk/maps/azure-maps-elevation/src/main/java/com/azure/maps/elevation/ElevationClient.java b/sdk/maps/azure-maps-elevation/src/main/java/com/azure/maps/elevation/ElevationClient.java index ddf17e1a0669..70dd96997192 100644 --- a/sdk/maps/azure-maps-elevation/src/main/java/com/azure/maps/elevation/ElevationClient.java +++ b/sdk/maps/azure-maps-elevation/src/main/java/com/azure/maps/elevation/ElevationClient.java @@ -23,7 +23,7 @@ * AzureKeyCredential keyCredential = new AzureKeyCredential(System.getenv("SUBSCRIPTION_KEY")); * * // Creates a client - * ElevationClient client = new ElevationClientBuilder() + * ElevationClient client = new ElevationClientBuilder() * .credential(keyCredential) * .elevationClientId(System.getenv("MAPS_CLIENT_ID")) * .buildClient(); diff --git a/sdk/maps/azure-maps-elevation/src/test/java/com/azure/maps/elevation/ElevationAsyncClientTest.java b/sdk/maps/azure-maps-elevation/src/test/java/com/azure/maps/elevation/ElevationAsyncClientTest.java index bc810a363939..ce60fc6fcffa 100644 --- a/sdk/maps/azure-maps-elevation/src/test/java/com/azure/maps/elevation/ElevationAsyncClientTest.java +++ b/sdk/maps/azure-maps-elevation/src/test/java/com/azure/maps/elevation/ElevationAsyncClientTest.java @@ -3,37 +3,24 @@ package com.azure.maps.elevation; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.IOException; -import java.time.Duration; -import java.util.Arrays; - import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.models.GeoBoundingBox; import com.azure.core.models.GeoPosition; - -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; - import reactor.test.StepVerifier; -public class ElevationAsyncClientTest extends ElevationClientTestBase { - private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; +import java.io.IOException; +import java.time.Duration; +import java.util.Arrays; - @BeforeAll - public static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } +import static org.junit.jupiter.api.Assertions.assertEquals; - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } +public class ElevationAsyncClientTest extends ElevationClientTestBase { + private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private ElevationAsyncClient getElevationAsyncClient(HttpClient httpClient, ElevationServiceVersion serviceVersion) { return getElevationAsyncClientBuilder(httpClient, serviceVersion).buildAsyncClient(); @@ -51,7 +38,9 @@ public void testAsyncGetDataForPoints(HttpClient httpClient, ElevationServiceVer } catch (IOException e) { Assertions.fail("Unable to get data for points"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get data for points with response @@ -67,7 +56,9 @@ public void testAsyncGetDataForPointsWithResponse(HttpClient httpClient, Elevati } catch (IOException e) { Assertions.fail("Unable to get data for points"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -76,10 +67,11 @@ public void testAsyncGetDataForPointsWithResponse(HttpClient httpClient, Elevati public void testAsyncInvalidGetDataForPointsWithResponse(HttpClient httpClient, ElevationServiceVersion serviceVersion) { ElevationAsyncClient client = getElevationAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getDataForPointsWithResponse(Arrays.asList(new GeoPosition(-100000000, 46.84646479863713), new GeoPosition(-121.68853362143818, 46.856464798637127)), null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get data for polyline @@ -96,7 +88,9 @@ public void testAsyncGetDataForPolyline(HttpClient httpClient, ElevationServiceV } catch (IOException e) { Assertions.fail("Unable to get data for polyline"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get data for polyline with response @@ -114,7 +108,9 @@ public void testAsyncGetDataForPolylineWithResponse(HttpClient httpClient, Eleva } catch (IOException e) { Assertions.fail("Unable to get data for polyline"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -125,10 +121,11 @@ public void testAsyncInvalidGetDataForPolylineWithResponse(HttpClient httpClient StepVerifier.create(client.getDataForPolylineWithResponse(Arrays.asList( new GeoPosition(-1000000, 46.84646479863713), new GeoPosition(-121.65853362143818, 46.85646479863713)), 5, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test get data for bounding box @@ -144,7 +141,9 @@ public void testAsyncGetDataForBoundingBox(HttpClient httpClient, ElevationServi } catch (IOException e) { Assertions.fail("Unable to get data for bounding box"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get data for bounding box with response @@ -161,7 +160,9 @@ public void testAsyncGetDataForBoundingBoxWithResponse(HttpClient httpClient, El } catch (IOException e) { Assertions.fail("Unable to get data for bounding box"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -171,9 +172,10 @@ public void testAsyncInvalidGetDataForBoundingBoxWithResponse(HttpClient httpCli ElevationAsyncClient client = getElevationAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getDataForBoundingBoxWithResponse(new GeoBoundingBox(-121.668533621438f, 46.8464647986371f, -10000000f, 46.8564647986371f), 3, 3, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/maps/azure-maps-geolocation/src/test/java/com/azure/maps/geolocation/GeolocationAsyncClientTest.java b/sdk/maps/azure-maps-geolocation/src/test/java/com/azure/maps/geolocation/GeolocationAsyncClientTest.java index 5592c98a04dd..8e7022976244 100644 --- a/sdk/maps/azure-maps-geolocation/src/test/java/com/azure/maps/geolocation/GeolocationAsyncClientTest.java +++ b/sdk/maps/azure-maps-geolocation/src/test/java/com/azure/maps/geolocation/GeolocationAsyncClientTest.java @@ -3,34 +3,21 @@ package com.azure.maps.geolocation; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.IOException; -import java.time.Duration; - import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; - -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; - import reactor.test.StepVerifier; -public class GeolocationAsyncClientTest extends GeolocationClientTestBase { - private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; +import java.io.IOException; +import java.time.Duration; - @BeforeAll - public static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } +import static org.junit.jupiter.api.Assertions.assertEquals; - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } +public class GeolocationAsyncClientTest extends GeolocationClientTestBase { + private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private GeolocationAsyncClient getGeoLocationAsyncClient(HttpClient httpClient, GeolocationServiceVersion serviceVersion) { return getGeoLocationAsyncClientBuilder(httpClient, serviceVersion).buildAsyncClient(); @@ -39,7 +26,7 @@ private GeolocationAsyncClient getGeoLocationAsyncClient(HttpClient httpClient, // Test async get location @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.geolocation.TestUtils#getTestParameters") - public void testAsyncGetLocation(HttpClient httpClient, GeolocationServiceVersion serviceVersion) throws IOException { + public void testAsyncGetLocation(HttpClient httpClient, GeolocationServiceVersion serviceVersion) { GeolocationAsyncClient client = getGeoLocationAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getLocation("131.107.0.89")) .assertNext(actualResults -> { @@ -48,7 +35,9 @@ public void testAsyncGetLocation(HttpClient httpClient, GeolocationServiceVersio } catch (IOException e) { Assertions.fail("Unable to get location"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get location with response @@ -64,7 +53,9 @@ public void testAsyncGetLocationWithResponse(HttpClient httpClient, GeolocationS } catch (IOException e) { Assertions.fail("Unable to get location"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -73,9 +64,10 @@ public void testAsyncGetLocationWithResponse(HttpClient httpClient, GeolocationS public void testAsyncInvalidGetDataForPointsWithResponse(HttpClient httpClient, GeolocationServiceVersion serviceVersion) { GeolocationAsyncClient client = getGeoLocationAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getLocationWithResponse("0000000adfasfwe")) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/maps/azure-maps-render/src/test/java/com/azure/maps/render/MapsRenderAsyncClientTest.java b/sdk/maps/azure-maps-render/src/test/java/com/azure/maps/render/MapsRenderAsyncClientTest.java index c10df4d3ec5e..85b79b6029dd 100644 --- a/sdk/maps/azure-maps-render/src/test/java/com/azure/maps/render/MapsRenderAsyncClientTest.java +++ b/sdk/maps/azure-maps-render/src/test/java/com/azure/maps/render/MapsRenderAsyncClientTest.java @@ -3,37 +3,24 @@ package com.azure.maps.render; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.IOException; -import java.time.Duration; - import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.models.GeoBoundingBox; import com.azure.maps.render.models.TileIndex; import com.azure.maps.render.models.TilesetId; - -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; - import reactor.test.StepVerifier; -public class MapsRenderAsyncClientTest extends MapsRenderClientTestBase { - private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; +import java.io.IOException; +import java.time.Duration; - @BeforeAll - public static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } +import static org.junit.jupiter.api.Assertions.assertEquals; - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } +public class MapsRenderAsyncClientTest extends MapsRenderClientTestBase { + private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private MapsRenderAsyncClient getRenderAsyncClient(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { return getRenderAsyncClientBuilder(httpClient, serviceVersion).buildAsyncClient(); @@ -46,13 +33,15 @@ public void testAsyncGetMapTileset(HttpClient httpClient, MapsRenderServiceVersi MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); new TilesetId(); StepVerifier.create(client.getMapTileset(TilesetId.MICROSOFT_BASE)) - .assertNext(actualResults -> { - try { - validateGetMapTileset(TestUtils.getExpectedMapTileset(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get map tileset"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetMapTileset(TestUtils.getExpectedMapTileset(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get map tileset"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get map tile set with response @@ -63,13 +52,15 @@ public void testAsyncGetMapTilesetWithResponse(HttpClient httpClient, MapsRender MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); new TilesetId(); StepVerifier.create(client.getMapTilesetWithResponse(TilesetId.MICROSOFT_BASE)) - .assertNext(response -> { - try { - validateGetMapTilesetWithResponse(TestUtils.getExpectedMapTileset(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get map tile set"); - } - }).verifyComplete(); + .assertNext(response -> { + try { + validateGetMapTilesetWithResponse(TestUtils.getExpectedMapTileset(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get map tile set"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -78,10 +69,11 @@ public void testAsyncGetMapTilesetWithResponse(HttpClient httpClient, MapsRender public void testAsyncInvalidGetMapTilesetWithResponse(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getMapTilesetWithResponse(new TilesetId())) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get map attribution @@ -92,13 +84,15 @@ public void testAsyncGetMapAttribution(HttpClient httpClient, MapsRenderServiceV GeoBoundingBox bounds = new GeoBoundingBox(-122.414162, 47.57949, -122.247157, 47.668372); new TilesetId(); StepVerifier.create(client.getMapAttribution(TilesetId.MICROSOFT_BASE, 6, bounds)) - .assertNext(actualResults -> { - try { - validateGetMapAttribution(TestUtils.getExpectedMapAttribution(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get map attribution"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetMapAttribution(TestUtils.getExpectedMapAttribution(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get map attribution"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get map attribution with response @@ -110,13 +104,15 @@ public void testAsyncGetMapAttributionWithResponse(HttpClient httpClient, MapsRe GeoBoundingBox bounds = new GeoBoundingBox(-122.414162, 47.57949, -122.247157, 47.668372); new TilesetId(); StepVerifier.create(client.getMapAttributionWithResponse(TilesetId.MICROSOFT_BASE, 6, bounds)) - .assertNext(response -> { - try { - validateGetMapAttributionWithResponse(TestUtils.getExpectedMapAttribution(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get map attribution"); - } - }).verifyComplete(); + .assertNext(response -> { + try { + validateGetMapAttributionWithResponse(TestUtils.getExpectedMapAttribution(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get map attribution"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -126,10 +122,11 @@ public void testAsyncInvalidGetMapAttributionWithResponse(HttpClient httpClient, MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); GeoBoundingBox bounds = new GeoBoundingBox(-10000, 0, 0, 0); StepVerifier.create(client.getMapAttributionWithResponse(new TilesetId(), 6, bounds)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get copyright caption @@ -138,13 +135,15 @@ public void testAsyncInvalidGetMapAttributionWithResponse(HttpClient httpClient, public void testAsyncGetCopyrightCaption(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCopyrightCaption()) - .assertNext(actualResults -> { - try { - validateGetCopyrightCaption(TestUtils.getExpectedCopyrightCaption(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get copyright caption"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetCopyrightCaption(TestUtils.getExpectedCopyrightCaption(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get copyright caption"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get map copyright caption with response @@ -154,13 +153,15 @@ public void testAsyncGetCopyrightCaption(HttpClient httpClient, MapsRenderServic public void testAsyncGetCopyrightCaptionWithResponse(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCopyrightCaptionWithResponse()) - .assertNext(response -> { - try { - validateGetCopyrightCaptionWithResponse(TestUtils.getExpectedCopyrightCaption(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get copyright caption"); - } - }).verifyComplete(); + .assertNext(response -> { + try { + validateGetCopyrightCaptionWithResponse(TestUtils.getExpectedCopyrightCaption(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get copyright caption"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get copyright from bounding box @@ -170,13 +171,15 @@ public void testAsyncGetCopyrightFromBoundingBox(HttpClient httpClient, MapsRend MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); GeoBoundingBox boundingBox = new GeoBoundingBox(52.41064, 4.84228, 52.41072, 4.84239); StepVerifier.create(client.getCopyrightFromBoundingBox(boundingBox, true)) - .assertNext(actualResults -> { - try { - validateGetCopyrightCaptionFromBoundingBox(TestUtils.getExpectedCopyrightFromBoundingBox(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get copyright from bounding box"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetCopyrightCaptionFromBoundingBox(TestUtils.getExpectedCopyrightFromBoundingBox(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get copyright from bounding box"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get copyright from bounding box with response @@ -187,13 +190,15 @@ public void testAsyncGetCopyrightFromBoundingBoxWithResponse(HttpClient httpClie MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); GeoBoundingBox boundingBox = new GeoBoundingBox(52.41064, 4.84228, 52.41072, 4.84239); StepVerifier.create(client.getCopyrightFromBoundingBoxWithResponse(boundingBox, true)) - .assertNext(response -> { - try { - validateGetCopyrightCaptionFromBoundingBoxWithResponse(TestUtils.getExpectedCopyrightFromBoundingBox(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get copyright caption"); - } - }).verifyComplete(); + .assertNext(response -> { + try { + validateGetCopyrightCaptionFromBoundingBoxWithResponse(TestUtils.getExpectedCopyrightFromBoundingBox(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get copyright caption"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -202,10 +207,11 @@ public void testAsyncGetCopyrightFromBoundingBoxWithResponse(HttpClient httpClie public void testAsyncInvalidGetCopyrightFromBoundingBoxWithResponse(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCopyrightFromBoundingBoxWithResponse(new GeoBoundingBox(-100, -100, -100, -100), true)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get copyright for title @@ -214,13 +220,15 @@ public void testAsyncInvalidGetCopyrightFromBoundingBoxWithResponse(HttpClient h public void testAsyncGetCopyrightForTitle(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCopyrightForTile(new TileIndex().setX(9).setY(22).setZ(6), true)) - .assertNext(actualResults -> { - try { - validateGetCopyrightForTile(TestUtils.getExpectedCopyrightForTile(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get copyright for title"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetCopyrightForTile(TestUtils.getExpectedCopyrightForTile(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get copyright for title"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get copyright for title with response @@ -230,13 +238,15 @@ public void testAsyncGetCopyrightForTitle(HttpClient httpClient, MapsRenderServi public void testAsyncGetCopyrightForTitleWithResponse(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCopyrightForTileWithResponse(new TileIndex().setX(9).setY(22).setZ(6), true)) - .assertNext(response -> { - try { - validateGetCopyrightForTileWithResponse(TestUtils.getExpectedCopyrightForTile(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get copyright for title"); - } - }).verifyComplete(); + .assertNext(response -> { + try { + validateGetCopyrightForTileWithResponse(TestUtils.getExpectedCopyrightForTile(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get copyright for title"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -245,10 +255,11 @@ public void testAsyncGetCopyrightForTitleWithResponse(HttpClient httpClient, Map public void testAsyncInvalidGetCopyrightForTitleWithResponse(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCopyrightForTileWithResponse(new TileIndex().setX(9).setY(22).setZ(-100), true)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get copyright for world @@ -257,13 +268,15 @@ public void testAsyncInvalidGetCopyrightForTitleWithResponse(HttpClient httpClie public void testAsyncGetCopyrightForWorld(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCopyrightForWorld(true)) - .assertNext(actualResults -> { - try { - validateGetCopyrightForWorld(TestUtils.getExpectedCopyrightForWorld(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get copyright for world"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetCopyrightForWorld(TestUtils.getExpectedCopyrightForWorld(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get copyright for world"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get copyright for world with response @@ -273,12 +286,14 @@ public void testAsyncGetCopyrightForWorld(HttpClient httpClient, MapsRenderServi public void testAsyncGetCopyrightForWorldWithResponse(HttpClient httpClient, MapsRenderServiceVersion serviceVersion) { MapsRenderAsyncClient client = getRenderAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCopyrightForWorldWithResponse(true)) - .assertNext(response -> { - try { - validateGetCopyrightForWorldWithResponse(TestUtils.getExpectedCopyrightForWorld(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get copyright for world"); - } - }).verifyComplete(); + .assertNext(response -> { + try { + validateGetCopyrightForWorldWithResponse(TestUtils.getExpectedCopyrightForWorld(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get copyright for world"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/maps/azure-maps-route/src/test/java/com/azure/maps/route/MapsRouteAsyncClientTest.java b/sdk/maps/azure-maps-route/src/test/java/com/azure/maps/route/MapsRouteAsyncClientTest.java index 422dba8f2e4e..71c7450578b5 100644 --- a/sdk/maps/azure-maps-route/src/test/java/com/azure/maps/route/MapsRouteAsyncClientTest.java +++ b/sdk/maps/azure-maps-route/src/test/java/com/azure/maps/route/MapsRouteAsyncClientTest.java @@ -23,9 +23,7 @@ import com.azure.maps.route.models.RouteRangeOptions; import com.azure.maps.route.models.RouteType; import com.azure.maps.route.models.TravelMode; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; @@ -39,16 +37,7 @@ public class MapsRouteAsyncClientTest extends MapsRouteTestBase { private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; - - @BeforeAll - public static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private MapsRouteAsyncClient getRouteAsyncClient(HttpClient httpClient, MapsRouteServiceVersion serviceVersion) { return getRouteAsyncClientBuilder(httpClient, serviceVersion).buildAsyncClient(); @@ -124,13 +113,15 @@ public void testAsyncGetRouteDirections(HttpClient httpClient, MapsRouteServiceV new GeoPosition(13.43872, 52.50274)); RouteDirectionsOptions routeOptions = new RouteDirectionsOptions(routePoints); StepVerifier.create(client.getRouteDirections(routeOptions)) - .assertNext(actualResults -> { - try { - validateGetRouteDirections(TestUtils.getExpectedRouteDirections(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get route directions"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetRouteDirections(TestUtils.getExpectedRouteDirections(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get route directions"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get route directions with response @@ -144,14 +135,15 @@ public void testAsyncGetRouteDirectionsWithResponse(HttpClient httpClient, MapsR new GeoPosition(13.43872, 52.50274)); RouteDirectionsOptions routeOptions = new RouteDirectionsOptions(routePoints); StepVerifier.create(client.getRouteDirectionsWithResponse(routeOptions)) - .assertNext(response -> { - try { - validateGetRouteDirectionsWithResponse(TestUtils.getExpectedRouteDirections(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get route directions"); - } - }) - .verifyComplete(); + .assertNext(response -> { + try { + validateGetRouteDirectionsWithResponse(TestUtils.getExpectedRouteDirections(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get route directions"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -164,10 +156,11 @@ public void testAsyncInvalidGetRouteDirectionsWithResponse(HttpClient httpClient new GeoPosition(52.50274, 13.43872)); RouteDirectionsOptions routeOptions = new RouteDirectionsOptions(routePoints); StepVerifier.create(client.getRouteDirectionsWithContextWithResponse(routeOptions, null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get route directions with additional parameters @@ -207,13 +200,15 @@ public void testAsyncGetRouteDirectionsWithAdditionalParameters(HttpClient httpC .setAvoidVignette(Arrays.asList("AUS", "CHE")) .setAvoidAreas(avoidAreas); StepVerifier.create(client.getRouteDirections(routeOptions, parameters)) - .assertNext(actualResults -> { - try { - validateGetRouteDirections(TestUtils.getExpectedRouteDirectionsWithAdditionalParameters(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get route directions with additional parameters"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetRouteDirections(TestUtils.getExpectedRouteDirectionsWithAdditionalParameters(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get route directions with additional parameters"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get route directions with additional parameters with response @@ -254,13 +249,15 @@ public void testAsyncGetRouteDirectionsWithAdditionalParametersWithResponse(Http .setAvoidVignette(Arrays.asList("AUS", "CHE")) .setAvoidAreas(avoidAreas); StepVerifier.create(client.getRouteDirectionsWithResponse(routeOptions, parameters)) - .assertNext(actualResults -> { - try { - validateGetRouteDirectionsWithResponse(TestUtils.getExpectedRouteDirectionsWithAdditionalParameters(), 200, actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get route directions with additional parameters"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetRouteDirectionsWithResponse(TestUtils.getExpectedRouteDirectionsWithAdditionalParameters(), 200, actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get route directions with additional parameters"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -300,10 +297,11 @@ public void testAsyncInvalidGetRouteDirectionsWithAdditionalParametersWithRespon .setAvoidVignette(Arrays.asList("AUS", "CHE")) .setAvoidAreas(avoidAreas); StepVerifier.create(client.getRouteDirectionsWithResponse(routeOptions, parameters)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get route range @@ -319,7 +317,9 @@ public void testAsyncGetRouteRange(HttpClient httpClient, MapsRouteServiceVersio } catch (IOException e) { Assertions.fail("Unable to get route range"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get route range with response @@ -330,14 +330,15 @@ public void testAsyncGetRouteRangeWithResponse(HttpClient httpClient, MapsRouteS MapsRouteAsyncClient client = getRouteAsyncClient(httpClient, serviceVersion); RouteRangeOptions rangeOptions = new RouteRangeOptions(new GeoPosition(50.97452, 5.86605), Duration.ofSeconds(6000)); StepVerifier.create(client.getRouteRangeWithResponse(rangeOptions)) - .assertNext(response -> { - try { - validateGetRouteRangeWithResponse(TestUtils.getExpectedRouteRange(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get route range"); - } - }) - .verifyComplete(); + .assertNext(response -> { + try { + validateGetRouteRangeWithResponse(TestUtils.getExpectedRouteRange(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get route range"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -347,10 +348,11 @@ public void testAsyncInvalidGetRouteRangeWithResponse(HttpClient httpClient, Map MapsRouteAsyncClient client = getRouteAsyncClient(httpClient, serviceVersion); RouteRangeOptions rangeOptions = new RouteRangeOptions(new GeoPosition(-1000000, 5.86605), Duration.ofSeconds(6000)); StepVerifier.create(client.getRouteRangeWithResponse(rangeOptions)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async begin request route directions batch diff --git a/sdk/maps/azure-maps-search/src/test/java/com/azure/maps/search/MapsSearchAsyncClientTest.java b/sdk/maps/azure-maps-search/src/test/java/com/azure/maps/search/MapsSearchAsyncClientTest.java index 71c883424322..cc31bee0ad6f 100644 --- a/sdk/maps/azure-maps-search/src/test/java/com/azure/maps/search/MapsSearchAsyncClientTest.java +++ b/sdk/maps/azure-maps-search/src/test/java/com/azure/maps/search/MapsSearchAsyncClientTest.java @@ -24,9 +24,7 @@ import com.azure.maps.search.models.SearchPointOfInterestOptions; import com.azure.maps.search.models.SearchStructuredAddressOptions; import com.azure.maps.search.models.StructuredAddress; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -43,16 +41,7 @@ public class MapsSearchAsyncClientTest extends MapsSearchClientTestBase { private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; - - @BeforeAll - public static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private MapsSearchAsyncClient getMapsSearchAsyncClient(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { @@ -66,13 +55,15 @@ public void testAsyncGetMultiPolygons(HttpClient httpClient, MapsSearchServiceVe MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); List geometryIds = Arrays.asList("8bceafe8-3d98-4445-b29b-fd81d3e9adf5", "00005858-5800-1200-0000-0000773694ca"); StepVerifier.create(client.getPolygons(geometryIds)) - .assertNext(actualResults -> { - try { - validateGetPolygons(TestUtils.getMultiPolygonsResults(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get polygon from json file"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetPolygons(TestUtils.getMultiPolygonsResults(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get polygon from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get polygons with response @@ -90,7 +81,8 @@ public void testAsyncGetPolygonsWithResponse(HttpClient httpClient, MapsSearchSe Assertions.fail("Unable to get polygon from json file"); } }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -100,10 +92,11 @@ public void testAsyncInvalidGetPolygonsWithResponse(HttpClient httpClient, MapsS MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); List geometryIds = new ArrayList<>(); StepVerifier.create(client.getPolygonsWithResponse(geometryIds, Context.NONE)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async fuzzy search @@ -111,13 +104,16 @@ public void testAsyncInvalidGetPolygonsWithResponse(HttpClient httpClient, MapsS @MethodSource("com.azure.maps.search.TestUtils#getTestParameters") public void testAsyncFuzzySearch(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.fuzzySearch(new FuzzySearchOptions("starbucks"))).assertNext(actualResults -> { - try { - validateFuzzySearch(TestUtils.getExpectedFuzzySearchResults(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get SearchAddressResult from json file"); - } - }).verifyComplete(); + StepVerifier.create(client.fuzzySearch(new FuzzySearchOptions("starbucks"))) + .assertNext(actualResults -> { + try { + validateFuzzySearch(TestUtils.getExpectedFuzzySearchResults(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get SearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test fuzzy search with response @@ -134,7 +130,8 @@ public void testAsyncFuzzySearchWithResponse(HttpClient httpClient, MapsSearchSe Assertions.fail("Unable to get SearchAddressResult from json file"); } }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -143,10 +140,11 @@ public void testAsyncFuzzySearchWithResponse(HttpClient httpClient, MapsSearchSe public void testAsyncInvalidFuzzySearchWithResponse(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.fuzzySearchWithResponse(new FuzzySearchOptions(""), Context.NONE)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async search point of interest @@ -154,13 +152,16 @@ public void testAsyncInvalidFuzzySearchWithResponse(HttpClient httpClient, MapsS @MethodSource("com.azure.maps.search.TestUtils#getTestParameters") public void testAsyncSearchPointOfInterest(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.searchPointOfInterest(new SearchPointOfInterestOptions("caviar lobster pasta", new GeoPosition(-121.97483, 36.98844)))).assertNext(actualResults -> { - try { - validateSearchPointOfInterest(TestUtils.getExpectedSearchPointOfInterestResults(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get SearchAddressResult from json file"); - } - }).verifyComplete(); + StepVerifier.create(client.searchPointOfInterest(new SearchPointOfInterestOptions("caviar lobster pasta", new GeoPosition(-121.97483, 36.98844)))) + .assertNext(actualResults -> { + try { + validateSearchPointOfInterest(TestUtils.getExpectedSearchPointOfInterestResults(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get SearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async search point of interest with response @@ -177,7 +178,8 @@ public void testAsyncSearchPointOfInterestWithResponse(HttpClient httpClient, Ma Assertions.fail("Unable to get SearchAddressResult from json file"); } }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -186,10 +188,11 @@ public void testAsyncSearchPointOfInterestWithResponse(HttpClient httpClient, Ma public void testAsyncInvalidSearchPointOfInterestWithResponse(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.searchPointOfInterestWithResponse(new SearchPointOfInterestOptions("", new GeoPosition(-121.97483, 36.98844)), Context.NONE)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async search nearby point of interest @@ -198,13 +201,16 @@ public void testAsyncInvalidSearchPointOfInterestWithResponse(HttpClient httpCli public void testAsyncSearchNearbyPointsOfInterest(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.searchNearbyPointsOfInterest( - new SearchNearbyPointsOfInterestOptions(new GeoPosition(-74.011454, 40.706270)))).assertNext(actualResults -> { + new SearchNearbyPointsOfInterestOptions(new GeoPosition(-74.011454, 40.706270)))) + .assertNext(actualResults -> { try { validateSearchNearbyPointOfInterest(TestUtils.getExpectedSearchNearbyPointOfInterestResults(), actualResults); } catch (IOException e) { Assertions.fail("Unable to get SearchAddressResult from json file"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async search nearby point of interest with response @@ -220,7 +226,9 @@ public void testAsyncSearchNearbyPointsOfInterestWithResponse(HttpClient httpCli } catch (IOException e) { Assertions.fail("Unable to get SearchAddressResult from json file"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -229,10 +237,11 @@ public void testAsyncSearchNearbyPointsOfInterestWithResponse(HttpClient httpCli public void testAsyncInvalidSearchNearbyPointsOfInterestWithResponse(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.searchNearbyPointsOfInterestWithResponse(new SearchNearbyPointsOfInterestOptions(new GeoPosition(-100, -100)), Context.NONE)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async search point of interest category @@ -241,13 +250,16 @@ public void testAsyncInvalidSearchNearbyPointsOfInterestWithResponse(HttpClient public void testAsyncSearchPointOfInterestCategory(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.searchPointOfInterestCategory( - new SearchPointOfInterestCategoryOptions("atm", new GeoPosition(-74.011454, 40.706270)))).assertNext(actualResults -> { + new SearchPointOfInterestCategoryOptions("atm", new GeoPosition(-74.011454, 40.706270)))) + .assertNext(actualResults -> { try { validateSearchPointOfInterestCategory(TestUtils.getExpectedSearchPointOfInterestCategoryResults(), actualResults); } catch (IOException e) { Assertions.fail("Unable to get SearchAddressResult from json file"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async search point of interest category with response @@ -258,13 +270,15 @@ public void testAsyncSearchPointOfInterestCategoryWithResponse(HttpClient httpCl MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.searchPointOfInterestCategoryWithResponse( new SearchPointOfInterestCategoryOptions("atm", new GeoPosition(-74.011454, 40.706270)), Context.NONE)) - .assertNext(response -> { - try { - validateSearchPointOfInterestCategoryWithResponse(TestUtils.getExpectedSearchPointOfInterestCategoryResults(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get SearchAddressResult from json file"); - } - }).verifyComplete(); + .assertNext(response -> { + try { + validateSearchPointOfInterestCategoryWithResponse(TestUtils.getExpectedSearchPointOfInterestCategoryResults(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get SearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -274,10 +288,11 @@ public void testAsyncInvalidSearchPointOfInterestCategoryWithResponse(HttpClient MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.searchPointOfInterestCategoryWithResponse( new SearchPointOfInterestCategoryOptions("", new GeoPosition(-100, -100)), Context.NONE)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get point of interest category tree @@ -285,13 +300,16 @@ public void testAsyncInvalidSearchPointOfInterestCategoryWithResponse(HttpClient @MethodSource("com.azure.maps.search.TestUtils#getTestParameters") public void testAsyncSearchPointOfInterestCategoryTree(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.getPointOfInterestCategoryTree()).assertNext(actualResults -> { - try { - validateSearchPointOfInterestCategoryTree(TestUtils.getExpectedSearchPointOfInterestCategoryTreeResults(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get PointOfInterestCategoryTreeResult from json file"); - } - }).verifyComplete(); + StepVerifier.create(client.getPointOfInterestCategoryTree()) + .assertNext(actualResults -> { + try { + validateSearchPointOfInterestCategoryTree(TestUtils.getExpectedSearchPointOfInterestCategoryTreeResults(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get PointOfInterestCategoryTreeResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get point of interest category tree with response @@ -307,7 +325,8 @@ public void testAsyncSearchPointOfInterestCategoryTreeWithResponse(HttpClient ht Assertions.fail("Unable to get PointOfInterestCategoryTreeResult from json file"); } }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async search address @@ -315,13 +334,16 @@ public void testAsyncSearchPointOfInterestCategoryTreeWithResponse(HttpClient ht @MethodSource("com.azure.maps.search.TestUtils#getTestParameters") public void testAsyncSearchAddress(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.searchAddress(new SearchAddressOptions("NE 24th Street, Redmond, WA 98052"))).assertNext(actualResults -> { - try { - validateSearchAddress(TestUtils.getExpectedSearchAddressResults(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get SearchAddressResult from json file"); - } - }).verifyComplete(); + StepVerifier.create(client.searchAddress(new SearchAddressOptions("NE 24th Street, Redmond, WA 98052"))) + .assertNext(actualResults -> { + try { + validateSearchAddress(TestUtils.getExpectedSearchAddressResults(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get SearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async search address with response @@ -338,7 +360,8 @@ public void testAsyncSearchAddressWithResponse(HttpClient httpClient, MapsSearch Assertions.fail("Unable to get SearchAddressResult from json file"); } }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -347,10 +370,11 @@ public void testAsyncSearchAddressWithResponse(HttpClient httpClient, MapsSearch public void testAsyncInvalidSearchAddressWithResponse(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.searchAddressWithResponse(new SearchAddressOptions(""), Context.NONE)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async reverse search address @@ -358,14 +382,16 @@ public void testAsyncInvalidSearchAddressWithResponse(HttpClient httpClient, Map @MethodSource("com.azure.maps.search.TestUtils#getTestParameters") public void testAsyncReverseSearchAddress(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.reverseSearchAddress( - new ReverseSearchAddressOptions(new GeoPosition(-121.89, 37.337)))).assertNext(actualResults -> { + StepVerifier.create(client.reverseSearchAddress(new ReverseSearchAddressOptions(new GeoPosition(-121.89, 37.337)))) + .assertNext(actualResults -> { try { validateReverseSearchAddress(TestUtils.getExpectedReverseSearchAddressResults(), actualResults); } catch (IOException e) { Assertions.fail("Unable to get ReverseSearchAddressResult from json file"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async reverse search address with response @@ -374,16 +400,16 @@ public void testAsyncReverseSearchAddress(HttpClient httpClient, MapsSearchServi @MethodSource("com.azure.maps.search.TestUtils#getTestParameters") public void testAsyncReverseSearchAddressWithResponse(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.reverseSearchAddressWithResponse( - new ReverseSearchAddressOptions(new GeoPosition(-121.89, 37.337)), Context.NONE)) - .assertNext(response -> { - try { - validateReverseSearchAddressWithResponse(TestUtils.getExpectedReverseSearchAddressResults(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get ReverseSearchAddressResult from json file"); - } - }) - .verifyComplete(); + StepVerifier.create(client.reverseSearchAddressWithResponse(new ReverseSearchAddressOptions(new GeoPosition(-121.89, 37.337)), Context.NONE)) + .assertNext(response -> { + try { + validateReverseSearchAddressWithResponse(TestUtils.getExpectedReverseSearchAddressResults(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get ReverseSearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -391,12 +417,12 @@ public void testAsyncReverseSearchAddressWithResponse(HttpClient httpClient, Map @MethodSource("com.azure.maps.search.TestUtils#getTestParameters") public void testAsyncInvalidReverseSearchAddressWithResponse(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.reverseSearchAddressWithResponse( - new ReverseSearchAddressOptions(new GeoPosition(-121.89, -100)), Context.NONE)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + StepVerifier.create(client.reverseSearchAddressWithResponse(new ReverseSearchAddressOptions(new GeoPosition(-121.89, -100)), Context.NONE)) + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async reverse search cross street address @@ -405,13 +431,16 @@ public void testAsyncInvalidReverseSearchAddressWithResponse(HttpClient httpClie public void testAsyncReverseSearchCrossStreetAddress(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.reverseSearchCrossStreetAddress( - new ReverseSearchCrossStreetAddressOptions(new GeoPosition(-121.89, 37.337)))).assertNext(actualResults -> { + new ReverseSearchCrossStreetAddressOptions(new GeoPosition(-121.89, 37.337)))) + .assertNext(actualResults -> { try { validateReverseSearchCrossStreetAddress(TestUtils.getExpectedReverseSearchCrossStreetAddressResults(), actualResults); } catch (IOException e) { Assertions.fail("Unable to get ReverseSearchCrossStreetAddressResult from json file"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async reverse search cross street address with response @@ -422,13 +451,15 @@ public void testAsyncReverseSearchCrossStreetAddressWithResponse(HttpClient http MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.reverseSearchCrossStreetAddressWithResponse( new ReverseSearchCrossStreetAddressOptions(new GeoPosition(-121.89, 37.337)), Context.NONE)) - .assertNext(response -> { - try { - validateReverseSearchCrossStreetAddressWithResponse(TestUtils.getExpectedReverseSearchCrossStreetAddressResults(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get ReverseSearchCrossStreetAddressResult from json file"); - } - }).verifyComplete(); + .assertNext(response -> { + try { + validateReverseSearchCrossStreetAddressWithResponse(TestUtils.getExpectedReverseSearchCrossStreetAddressResults(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get ReverseSearchCrossStreetAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -438,10 +469,11 @@ public void testAsyncInvalidReverseSearchCrossStreetAddressWithResponse(HttpClie MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.reverseSearchCrossStreetAddressWithResponse( new ReverseSearchCrossStreetAddressOptions(new GeoPosition(-121.89, -100)), Context.NONE)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async search structured address @@ -449,13 +481,16 @@ public void testAsyncInvalidReverseSearchCrossStreetAddressWithResponse(HttpClie @MethodSource("com.azure.maps.search.TestUtils#getTestParameters") public void testAsyncSearchStructuredAddress(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.searchStructuredAddress(new StructuredAddress("US"), null)).assertNext(actualResults -> { - try { - validateSearchStructuredAddress(TestUtils.getExpectedSearchStructuredAddress(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get SearchAddressResult from json file"); - } - }).verifyComplete(); + StepVerifier.create(client.searchStructuredAddress(new StructuredAddress("US"), null)) + .assertNext(actualResults -> { + try { + validateSearchStructuredAddress(TestUtils.getExpectedSearchStructuredAddress(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get SearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async search structured address with response @@ -464,17 +499,16 @@ public void testAsyncSearchStructuredAddress(HttpClient httpClient, MapsSearchSe @MethodSource("com.azure.maps.search.TestUtils#getTestParameters") public void testAsyncSearchStructuredAddressWithResponse(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); - StepVerifier.create(client.searchStructuredAddressWithResponse( - new StructuredAddress("US"), - new SearchStructuredAddressOptions(), null)) - .assertNext(response -> { - try { - validateSearchStructuredAddressWithResponse(TestUtils.getExpectedSearchStructuredAddress(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get SearchAddressResult from json file"); - } - }) - .verifyComplete(); + StepVerifier.create(client.searchStructuredAddressWithResponse(new StructuredAddress("US"), new SearchStructuredAddressOptions(), null)) + .assertNext(response -> { + try { + validateSearchStructuredAddressWithResponse(TestUtils.getExpectedSearchStructuredAddress(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get SearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -483,10 +517,11 @@ public void testAsyncSearchStructuredAddressWithResponse(HttpClient httpClient, public void testAsyncInvalidSearchStructuredAddress(HttpClient httpClient, MapsSearchServiceVersion serviceVersion) { MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.searchStructuredAddressWithResponse(new StructuredAddress(""), null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async search inside geometry @@ -497,13 +532,16 @@ public void testAsyncSearchInsideGeometry(HttpClient httpClient, MapsSearchServi File file = new File("src/test/resources/geoobjectone.json"); GeoObject obj = TestUtils.getGeoObject(file); StepVerifier.create(client.searchInsideGeometry( - new SearchInsideGeometryOptions("pizza", obj))).assertNext(actualResults -> { + new SearchInsideGeometryOptions("pizza", obj))) + .assertNext(actualResults -> { try { validateSearchInsideGeometry(TestUtils.getExpectedSearchInsideGeometry(), actualResults); } catch (IOException e) { Assertions.fail("Unable to get SearchAddressResult from json file"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async search inside geometry with response @@ -514,15 +552,16 @@ public void testAsyncSearchInsideGeometryWithResponse(HttpClient httpClient, Map MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); File file = new File("src/test/resources/geoobjectone.json"); GeoObject obj = TestUtils.getGeoObject(file); - StepVerifier.create(client.searchInsideGeometryWithResponse( - new SearchInsideGeometryOptions("pizza", obj), null)) - .assertNext(response -> { - try { - validateSearchInsideGeometryWithResponse(TestUtils.getExpectedSearchInsideGeometry(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get SearchAddressResult from json file"); - } - }).verifyComplete(); + StepVerifier.create(client.searchInsideGeometryWithResponse(new SearchInsideGeometryOptions("pizza", obj), null)) + .assertNext(response -> { + try { + validateSearchInsideGeometryWithResponse(TestUtils.getExpectedSearchInsideGeometry(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get SearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -532,12 +571,12 @@ public void testAsyncInvalidSearchInsideGeometryWithResponse(HttpClient httpClie MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); File file = new File("src/test/resources/geoobjectone.json"); GeoObject obj = TestUtils.getGeoObject(file); - StepVerifier.create(client.searchInsideGeometryWithResponse( - new SearchInsideGeometryOptions("", obj), null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + StepVerifier.create(client.searchInsideGeometryWithResponse(new SearchInsideGeometryOptions("", obj), null)) + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async search along route @@ -548,13 +587,16 @@ public void testAsyncSearchAlongRoute(HttpClient httpClient, MapsSearchServiceVe MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); File file = new File("src/test/resources/geolinestringone.json"); GeoLineString obj = TestUtils.getGeoLineString(file); - StepVerifier.create(client.searchAlongRoute(new SearchAlongRouteOptions("burger", 1000, obj))).assertNext(actualResults -> { - try { - validateSearchAlongRoute(TestUtils.getExpectedSearchAlongRoute(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get SearchAddressResult from json file"); - } - }).verifyComplete(); + StepVerifier.create(client.searchAlongRoute(new SearchAlongRouteOptions("burger", 1000, obj))) + .assertNext(actualResults -> { + try { + validateSearchAlongRoute(TestUtils.getExpectedSearchAlongRoute(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get SearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async search along route with response @@ -566,16 +608,16 @@ public void testAsyncSearchAlongRouteWithResponse(HttpClient httpClient, MapsSea MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); File file = new File("src/test/resources/geolinestringone.json"); GeoLineString obj = TestUtils.getGeoLineString(file); - StepVerifier.create(client.searchAlongRouteWithResponse( - new SearchAlongRouteOptions("burger", 1000, obj), null)) - .assertNext(response -> { - try { - validateSearchAlongRouteWithResponse(TestUtils.getExpectedSearchAlongRoute(), 200, response); - } catch (IOException e) { - Assertions.fail("Unable to get SearchAddressResult from json file"); - } - }) - .verifyComplete(); + StepVerifier.create(client.searchAlongRouteWithResponse(new SearchAlongRouteOptions("burger", 1000, obj), null)) + .assertNext(response -> { + try { + validateSearchAlongRouteWithResponse(TestUtils.getExpectedSearchAlongRoute(), 200, response); + } catch (IOException e) { + Assertions.fail("Unable to get SearchAddressResult from json file"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -585,12 +627,12 @@ public void testAsyncInvalidSearchAlongRouteWithResponse(HttpClient httpClient, MapsSearchAsyncClient client = getMapsSearchAsyncClient(httpClient, serviceVersion); File file = new File("src/test/resources/geolinestringone.json"); GeoLineString obj = TestUtils.getGeoLineString(file); - StepVerifier.create(client.searchAlongRouteWithResponse( - new SearchAlongRouteOptions("", 1000, obj), null)) - .verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + StepVerifier.create(client.searchAlongRouteWithResponse(new SearchAlongRouteOptions("", 1000, obj), null)) + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async begin fuzzy search batch diff --git a/sdk/maps/azure-maps-timezone/src/test/java/com/azure/maps/timezone/TimeZoneAsyncClientTest.java b/sdk/maps/azure-maps-timezone/src/test/java/com/azure/maps/timezone/TimeZoneAsyncClientTest.java index 93875d17b650..0cbcdd15d23b 100644 --- a/sdk/maps/azure-maps-timezone/src/test/java/com/azure/maps/timezone/TimeZoneAsyncClientTest.java +++ b/sdk/maps/azure-maps-timezone/src/test/java/com/azure/maps/timezone/TimeZoneAsyncClientTest.java @@ -9,9 +9,7 @@ import com.azure.maps.timezone.models.TimeZoneCoordinateOptions; import com.azure.maps.timezone.models.TimeZoneIdOptions; import com.azure.maps.timezone.models.TimeZoneOptions; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; @@ -23,16 +21,7 @@ public class TimeZoneAsyncClientTest extends TimeZoneClientTestBase { private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; - - @BeforeAll - public static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private TimeZoneAsyncClient getTimeZoneAsyncClient(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) { return getTimeZoneAsyncClientBuilder(httpClient, serviceVersion).buildAsyncClient(); @@ -41,7 +30,7 @@ private TimeZoneAsyncClient getTimeZoneAsyncClient(HttpClient httpClient, TimeZo // Test async get timezone by id @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.timezone.TestUtils#getTestParameters") - public void testAsyncGetDataForPoints(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) throws IOException { + public void testAsyncGetDataForPoints(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) { TimeZoneAsyncClient client = getTimeZoneAsyncClient(httpClient, serviceVersion); TimeZoneIdOptions options = new TimeZoneIdOptions("Asia/Bahrain").setOptions(TimeZoneOptions.ALL).setLanguage(null) .setTimestamp(null).setDaylightSavingsTime(null).setDaylightSavingsTimeLastingYears(null); @@ -52,7 +41,9 @@ public void testAsyncGetDataForPoints(HttpClient httpClient, TimeZoneServiceVers } catch (IOException e) { Assertions.fail("Unable to get timezone by id"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get timezone by id with response @@ -70,7 +61,9 @@ public void testAsyncGetDataForPointsWithResponse(HttpClient httpClient, TimeZon } catch (IOException e) { Assertions.fail("Unable to get timezone by id"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -81,16 +74,17 @@ public void testAsyncInvalidGetDataForPointsWithResponse(HttpClient httpClient, TimeZoneIdOptions options = new TimeZoneIdOptions("").setOptions(TimeZoneOptions.ALL).setLanguage(null) .setTimestamp(null).setDaylightSavingsTime(null).setDaylightSavingsTimeLastingYears(null); StepVerifier.create(client.getTimezoneByIdWithResponse(options, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get timezone by coordinates @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.timezone.TestUtils#getTestParameters") - public void testAsyncGetTimezoneByCoordinates(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) throws IOException { + public void testAsyncGetTimezoneByCoordinates(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) { TimeZoneAsyncClient client = getTimeZoneAsyncClient(httpClient, serviceVersion); GeoPosition coordinate = new GeoPosition(-122, 47.0); TimeZoneCoordinateOptions options = new TimeZoneCoordinateOptions(coordinate).setTimezoneOptions(TimeZoneOptions.ALL); @@ -101,7 +95,9 @@ public void testAsyncGetTimezoneByCoordinates(HttpClient httpClient, TimeZoneSer } catch (IOException e) { Assertions.fail("Unable to get timezone by coordinates"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get timezone by coordinates with response @@ -119,7 +115,9 @@ public void testAsyncGetTimezoneByCoordinatesWithResponse(HttpClient httpClient, } catch (IOException e) { Assertions.fail("Unable to get timezone by coordinates"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -130,16 +128,17 @@ public void testInvalidAsyncGetTimezoneByCoordinatesWithResponse(HttpClient http GeoPosition coordinate = new GeoPosition(-10000, 47.0); TimeZoneCoordinateOptions options = new TimeZoneCoordinateOptions(coordinate).setTimezoneOptions(TimeZoneOptions.ALL); StepVerifier.create(client.getTimezoneByCoordinatesWithResponse(options, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get windows timezone ids @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.timezone.TestUtils#getTestParameters") - public void testAsyncGetWindowsTimezoneIds(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) throws IOException { + public void testAsyncGetWindowsTimezoneIds(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) { TimeZoneAsyncClient client = getTimeZoneAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getWindowsTimezoneIds()) .assertNext(actualResults -> { @@ -148,7 +147,9 @@ public void testAsyncGetWindowsTimezoneIds(HttpClient httpClient, TimeZoneServic } catch (IOException e) { Assertions.fail("Unable to get windows timezone ids"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get windows timezone ids with response @@ -164,13 +165,15 @@ public void testInvalidAsyncGetWindowsTimezoneIds(HttpClient httpClient, TimeZon } catch (IOException e) { Assertions.fail("Unable to get windows timezone ids"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get iana timezone ids @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.timezone.TestUtils#getTestParameters") - public void testAsyncGetIanaTimezoneIds(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) throws IOException { + public void testAsyncGetIanaTimezoneIds(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) { TimeZoneAsyncClient client = getTimeZoneAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getIanaTimezoneIds()) .assertNext(actualResults -> { @@ -179,7 +182,9 @@ public void testAsyncGetIanaTimezoneIds(HttpClient httpClient, TimeZoneServiceVe } catch (IOException e) { Assertions.fail("Unable to get iana timezone ids"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get iana timezone ids with response @@ -195,13 +200,15 @@ public void testGetIanaTimezoneIdsWithResponseWithResponse(HttpClient httpClient } catch (IOException e) { Assertions.fail("Unable to get iana timezone ids"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get iana version @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.timezone.TestUtils#getTestParameters") - public void testAsyncGetIanaVersion(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) throws IOException { + public void testAsyncGetIanaVersion(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) { TimeZoneAsyncClient client = getTimeZoneAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getIanaVersion()) .assertNext(actualResults -> { @@ -210,7 +217,9 @@ public void testAsyncGetIanaVersion(HttpClient httpClient, TimeZoneServiceVersio } catch (IOException e) { Assertions.fail("Unable to get iana version"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get iana version with response @@ -226,13 +235,15 @@ public void testAsyncGetIanaVersionWithResponse(HttpClient httpClient, TimeZoneS } catch (IOException e) { Assertions.fail("Unable to get iana version"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get convert windows timezone to iana @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.timezone.TestUtils#getTestParameters") - public void testAsyncGetConvertWindowsTimezoneToIana(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) throws IOException { + public void testAsyncGetConvertWindowsTimezoneToIana(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) { TimeZoneAsyncClient client = getTimeZoneAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.convertWindowsTimezoneToIana("pacific standard time", null)) .assertNext(actualResults -> { @@ -241,7 +252,9 @@ public void testAsyncGetConvertWindowsTimezoneToIana(HttpClient httpClient, Time } catch (IOException e) { Assertions.fail("Unable to get convert windows timezone to iana"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get convert windows timezone to iana with response @@ -257,7 +270,9 @@ public void testAsyncGetConvertWindowsTimezoneToIanaWithResponse(HttpClient http } catch (IOException e) { Assertions.fail("Unable to get convert windows timezone to iana"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -266,9 +281,10 @@ public void testAsyncGetConvertWindowsTimezoneToIanaWithResponse(HttpClient http public void testAsyncInvalidGetConvertWindowsTimezoneToIanaWithResponse(HttpClient httpClient, TimeZoneServiceVersion serviceVersion) { TimeZoneAsyncClient client = getTimeZoneAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.convertWindowsTimezoneToIanaWithResponse("", null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/maps/azure-maps-traffic/src/test/java/com/azure/maps/traffic/TrafficAsyncClientTest.java b/sdk/maps/azure-maps-traffic/src/test/java/com/azure/maps/traffic/TrafficAsyncClientTest.java index d942c84e13ef..49d08b7972ca 100644 --- a/sdk/maps/azure-maps-traffic/src/test/java/com/azure/maps/traffic/TrafficAsyncClientTest.java +++ b/sdk/maps/azure-maps-traffic/src/test/java/com/azure/maps/traffic/TrafficAsyncClientTest.java @@ -19,9 +19,7 @@ import com.azure.maps.traffic.models.TrafficFlowTileStyle; import com.azure.maps.traffic.models.TrafficIncidentDetailOptions; import com.azure.maps.traffic.models.TrafficIncidentViewportOptions; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; @@ -33,16 +31,7 @@ public class TrafficAsyncClientTest extends TrafficClientTestBase { private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; - - @BeforeAll - public static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private TrafficAsyncClient getTrafficAsyncClient(HttpClient httpClient, TrafficServiceVersion serviceVersion) { return getTrafficAsyncClientBuilder(httpClient, serviceVersion).buildAsyncClient(); @@ -63,7 +52,9 @@ public void testAsyncGetTrafficFlowTile(HttpClient httpClient, TrafficServiceVer } catch (IOException e) { Assertions.fail("Unable to get traffic flow tile"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get traffic flow tile with response @@ -81,7 +72,9 @@ public void testAsyncGetTrafficFlowTileWithResponse(HttpClient httpClient, Traff } catch (IOException e) { Assertions.fail("unable to traffic flow tile with response"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -92,10 +85,12 @@ public void testAsyncInvalidGetTrafficFlowTileWithResponse(HttpClient httpClient TrafficFlowTileOptions trafficFlowTileOptions = new TrafficFlowTileOptions().setZoom(-1000) .setFormat(TileFormat.PNG).setTrafficFlowTileStyle(TrafficFlowTileStyle.RELATIVE_DELAY) .setTileIndex(new TileIndex().setX(2044).setY(1360)); - StepVerifier.create(client.getTrafficFlowTileWithResponse(trafficFlowTileOptions)).verifyErrorSatisfies(ex -> { - final HttpResponseException httpResponseException = (HttpResponseException) ex; - assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + StepVerifier.create(client.getTrafficFlowTileWithResponse(trafficFlowTileOptions)) + .expectErrorSatisfies(ex -> { + final HttpResponseException httpResponseException = (HttpResponseException) ex; + assertEquals(400, httpResponseException.getResponse().getStatusCode()); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get traffic flow segment @@ -112,7 +107,9 @@ public void testAsyncGetTrafficFlowSegment(HttpClient httpClient, TrafficService } catch (IOException e) { Assertions.fail("Unable to get traffic flow segment"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get traffic flow segment with response @@ -130,7 +127,9 @@ public void testAsyncGetTrafficFlowSegmentWithResponse(HttpClient httpClient, Tr } catch (IOException e) { Assertions.fail("unable to traffic flow segment with response"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -141,10 +140,11 @@ public void testAsyncInvalidGetTrafficFlowSegmentWithResponse(HttpClient httpCli TrafficFlowSegmentOptions trafficFlowSegmentOptions = new TrafficFlowSegmentOptions().setTrafficFlowSegmentStyle(TrafficFlowSegmentStyle.ABSOLUTE).setOpenLr(false) .setZoom(-1000).setCoordinates(new GeoPosition(45, 45)).setThickness(2).setUnit(SpeedUnit.MPH); StepVerifier.create(client.getTrafficFlowSegmentWithResponse(trafficFlowSegmentOptions)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get traffic incident detail empty poi @@ -165,7 +165,9 @@ public void testAsyncGetTrafficIncidentDetail(HttpClient httpClient, TrafficServ } catch (IOException e) { Assertions.fail("Unable to get traffic incident detail"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get traffic incident detail empty poi with response @@ -186,7 +188,9 @@ public void testAsyncGetTrafficIncidentDetailWithResponse(HttpClient httpClient, } catch (IOException e) { Assertions.fail("unable to traffic incident detail with response"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -200,10 +204,11 @@ public void testAsyncInvalidGetTrafficIncidentDetailWithResponse(HttpClient http .setBoundingZoom(-1000).setTrafficmodelId("1335294634919").setExpandCluster(false).setOriginalPosition(false) .setIncidentGeometryType(IncidentGeometryType.ORIGINAL).setLanguage("en").setProjectionStandard(ProjectionStandard.EPSG900913); StepVerifier.create(client.getTrafficIncidentDetailWithResponse(trafficIncidentDetailOptions)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get traffic incident viewport @@ -220,7 +225,9 @@ public void testAsyncGetTrafficIncidentViewport(HttpClient httpClient, TrafficSe } catch (IOException e) { Assertions.fail("Unable to get traffic incident viewport"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get traffic incident viewport with response @@ -238,7 +245,9 @@ public void testAsyncGetTrafficIncidentViewportWithResponse(HttpClient httpClien } catch (IOException e) { Assertions.fail("unable to traffic incident viewport with response"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -249,9 +258,10 @@ public void testAsyncInvalidGetTrafficIncidentViewportWithResponse(HttpClient ht TrafficIncidentViewportOptions trafficIncidentViewportOptions = new TrafficIncidentViewportOptions().setBoundingBox(new GeoBoundingBox(45, 45, 45, 45)).setOverview(new GeoBoundingBox(45, 45, 45, 45)) .setBoundingZoom(-1000).setOverviewZoom(2).setCopyright(true); StepVerifier.create(client.getTrafficIncidentViewportWithResponse(trafficIncidentViewportOptions)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/maps/azure-maps-weather/src/test/java/com/azure/maps/weather/WeatherAsyncClientTest.java b/sdk/maps/azure-maps-weather/src/test/java/com/azure/maps/weather/WeatherAsyncClientTest.java index 9a539cfdab04..c9c1934eb19b 100644 --- a/sdk/maps/azure-maps-weather/src/test/java/com/azure/maps/weather/WeatherAsyncClientTest.java +++ b/sdk/maps/azure-maps-weather/src/test/java/com/azure/maps/weather/WeatherAsyncClientTest.java @@ -13,9 +13,7 @@ import com.azure.maps.weather.models.TropicalStormForecastOptions; import com.azure.maps.weather.models.TropicalStormLocationOptions; import com.azure.maps.weather.models.Waypoint; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; @@ -30,16 +28,7 @@ public class WeatherAsyncClientTest extends WeatherTestBase { private static final String DISPLAY_NAME_WITH_ARGUMENTS = "{displayName} with [{arguments}]"; - - @BeforeAll - public static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private WeatherAsyncClient getWeatherAsyncClient(HttpClient httpClient, WeatherServiceVersion serviceVersion) { return getWeatherAsyncClientBuilder(httpClient, serviceVersion).buildAsyncClient(); @@ -48,16 +37,18 @@ private WeatherAsyncClient getWeatherAsyncClient(HttpClient httpClient, WeatherS // Test async get hourly forecast @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetHourlyForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetHourlyForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getHourlyForecast(new GeoPosition(-122.138874, 47.632346), null, 12, null)) - .assertNext(actualResults -> { - try { - validateGetHourlyForecast(TestUtils.getExpectedHourlyForecast(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get hourly forecast"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetHourlyForecast(TestUtils.getExpectedHourlyForecast(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get hourly forecast"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get hourly forecast with response @@ -73,7 +64,9 @@ public void testAsyncGetHourlyForecastWithResponse(HttpClient httpClient, Weathe } catch (IOException e) { Assertions.fail("unable to get hourly forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -82,25 +75,28 @@ public void testAsyncGetHourlyForecastWithResponse(HttpClient httpClient, Weathe public void testAsyncInvalidGetHourlyForecastWithResponse(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getHourlyForecastWithResponse(new GeoPosition(-100000, 47.632346), null, 12, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get minute forecast @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetMinuteForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetMinuteForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getMinuteForecast(new GeoPosition(-122.138874, 47.632346), 15, null)) - .assertNext(actualResults -> { - try { - validateGetMinuteForecast(TestUtils.getExpectedMinuteForecast(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get minute forecast"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetMinuteForecast(TestUtils.getExpectedMinuteForecast(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get minute forecast"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get minute forecast with response @@ -116,7 +112,9 @@ public void testAsyncGetMinuteForecastWithResponse(HttpClient httpClient, Weathe } catch (IOException e) { Assertions.fail("unable to get minute forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -125,25 +123,28 @@ public void testAsyncGetMinuteForecastWithResponse(HttpClient httpClient, Weathe public void testAsyncInvalidGetMinuteForecastWithResponse(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getMinuteForecastWithResponse(new GeoPosition(-1000000, 47.632346), 15, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get quarter day forecast @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetQuarterDayForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetQuarterDayForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getQuarterDayForecast(new GeoPosition(-122.138874, 47.632346), null, 1, null)) - .assertNext(actualResults -> { - try { - validateGetQuarterDayForecast(TestUtils.getExpectedQuarterDayForecast(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get quarter day forecast"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetQuarterDayForecast(TestUtils.getExpectedQuarterDayForecast(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get quarter day forecast"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get quarter day forecast with response @@ -159,7 +160,9 @@ public void testAsyncGetQuarterDayForecastWithResponse(HttpClient httpClient, We } catch (IOException e) { Assertions.fail("unable to get quarter day forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -168,25 +171,28 @@ public void testAsyncGetQuarterDayForecastWithResponse(HttpClient httpClient, We public void testAsyncInvalidGetQuarterDayForecastWithResponse(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getQuarterDayForecastWithResponse(new GeoPosition(-1000000, 47.632346), null, 1, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get current conditions @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetCurrentConditions(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetCurrentConditions(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCurrentConditions(new GeoPosition(-122.125679, 47.641268), null, null, null, null)) - .assertNext(actualResults -> { - try { - validateGetCurrentConditions(TestUtils.getExpectedCurrentConditions(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get current conditions"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetCurrentConditions(TestUtils.getExpectedCurrentConditions(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get current conditions"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get minute forecast with response @@ -202,7 +208,9 @@ public void testAsyncGetCurrentConditionsWithResponse(HttpClient httpClient, Wea } catch (IOException e) { Assertions.fail("unable to get current condition"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -211,25 +219,28 @@ public void testAsyncGetCurrentConditionsWithResponse(HttpClient httpClient, Wea public void testAsyncInvalidGetCurrentConditionsWithResponse(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCurrentConditionsWithResponse(new GeoPosition(-100000, 47.641268), null, null, null, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get daily forecast @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetDailyForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetDailyForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getDailyForecast(new GeoPosition(30.0734812, 62.6490341), null, 5, null)) - .assertNext(actualResults -> { - try { - validateGetDailyForecast(TestUtils.getExpectedDailyForecast(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get daily forecast"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetDailyForecast(TestUtils.getExpectedDailyForecast(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get daily forecast"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get daily forecast with response @@ -245,7 +256,9 @@ public void testAsyncGetDailyForecastWithResponse(HttpClient httpClient, Weather } catch (IOException e) { Assertions.fail("unable to get daily forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -254,16 +267,17 @@ public void testAsyncGetDailyForecastWithResponse(HttpClient httpClient, Weather public void testAsyncInvalidGetDailyForecastWithResponse(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getDailyForecastWithResponse(new GeoPosition(-1000000, 62.6490341), null, 5, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get weather along route @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetWeatherAlongRoute(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetWeatherAlongRoute(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); List waypoints = Arrays.asList( new Waypoint(new GeoPosition(-77.037, 38.907), 0.0), @@ -275,13 +289,15 @@ public void testAsyncGetWeatherAlongRoute(HttpClient httpClient, WeatherServiceV new Waypoint(new GeoPosition(-76.612, 39.287), 60.0) ); StepVerifier.create(client.getWeatherAlongRoute(waypoints, "en")) - .assertNext(actualResults -> { - try { - validateGetExpectedWeatherAlongRoute(TestUtils.getExpectedWeatherAlongRoute(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get weather along route"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetExpectedWeatherAlongRoute(TestUtils.getExpectedWeatherAlongRoute(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get weather along route"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get weather along route with response @@ -306,7 +322,9 @@ public void testAsyncGetWeatherAlongRouteWithResponse(HttpClient httpClient, Wea } catch (IOException e) { Assertions.fail("unable to get weather along route"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -324,25 +342,28 @@ public void testInvalidAsyncGetWeatherAlongRouteWithResponse(HttpClient httpClie new Waypoint(new GeoPosition(-76.612, 39.287), 60.0) ); StepVerifier.create(client.getWeatherAlongRouteWithResponse(waypoints, "en", null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get severe weather alerts @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetSevereWeatherAlerts(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetSevereWeatherAlerts(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getSevereWeatherAlerts(new GeoPosition(-85.06431274043842, 30.324604968788467), null, true)) - .assertNext(actualResults -> { - try { - validateGetSevereWeatherAlerts(TestUtils.getExpectedSevereWeatherAlerts(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get severe weather alerts"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetSevereWeatherAlerts(TestUtils.getExpectedSevereWeatherAlerts(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get severe weather alerts"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get severe weather alert with response @@ -358,7 +379,9 @@ public void testAsyncGetSevereWeatherAlertsWithResponse(HttpClient httpClient, W } catch (IOException e) { Assertions.fail("unable to get severe weather alerts"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -367,25 +390,28 @@ public void testAsyncGetSevereWeatherAlertsWithResponse(HttpClient httpClient, W public void testAsyncInvalidGetSevereWeatherAlertsWithResponse(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getSevereWeatherAlertsWithResponse(new GeoPosition(-100000, 30.324604968788467), null, true, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get daily indices @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetDailyIndices(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetDailyIndices(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getDailyIndices(new GeoPosition(-79.37849, 43.84745), null, null, null, 11)) - .assertNext(actualResults -> { - try { - validateGetDailyIndices(TestUtils.getExpectedDailyIndices(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get daily indices"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetDailyIndices(TestUtils.getExpectedDailyIndices(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get daily indices"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get daily indices with response @@ -401,7 +427,9 @@ public void testAsyncGetDailyIndicesWithResponse(HttpClient httpClient, WeatherS } catch (IOException e) { Assertions.fail("unable to get daily indices"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -410,25 +438,28 @@ public void testAsyncGetDailyIndicesWithResponse(HttpClient httpClient, WeatherS public void testAsyncInvalidGetDailyIndicesWithResponse(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getDailyIndicesWithResponse(new GeoPosition(-100000, 43.84745), null, null, null, 11, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get tropical storm active @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetTropicalStormActive(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetTropicalStormActive(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getTropicalStormActive()) - .assertNext(actualResults -> { - try { - validateGetExpectedTropicalStormActive(TestUtils.getExpectedTropicalStormActive(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get tropical storm active"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetExpectedTropicalStormActive(TestUtils.getExpectedTropicalStormActive(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get tropical storm active"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get tropical storm active with response @@ -444,25 +475,29 @@ public void testAsyncGetTropicalStormActiveWithResponse(HttpClient httpClient, W } catch (IOException e) { Assertions.fail("unable to get tropical storm active"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async search tropical storm @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncSearchTropicalStorm(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncSearchTropicalStorm(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); ActiveStormResult result = client.getTropicalStormActive().block(); if (result.getActiveStorms().size() > 0) { ActiveStorm storm = result.getActiveStorms().get(0); StepVerifier.create(client.searchTropicalStorm(storm.getYear(), storm.getBasinId(), storm.getGovId())) - .assertNext(actualResults -> { - try { - validateGetSearchTropicalStorm(TestUtils.getExpectedSearchTropicalStorm(), actualResults); - } catch (IOException e) { - Assertions.fail("Unable to get search tropical storm"); - } - }).verifyComplete(); + .assertNext(actualResults -> { + try { + validateGetSearchTropicalStorm(TestUtils.getExpectedSearchTropicalStorm(), actualResults); + } catch (IOException e) { + Assertions.fail("Unable to get search tropical storm"); + } + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } @@ -482,7 +517,9 @@ public void testAsyncSearchTropicalStormWithResponse(HttpClient httpClient, Weat } catch (IOException e) { Assertions.fail("unable to get search tropical storm"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } @@ -495,17 +532,18 @@ public void testAsyncInvalidSearchTropicalStormWithResponse(HttpClient httpClien if (result.getActiveStorms().size() > 0) { ActiveStorm storm = result.getActiveStorms().get(0); StepVerifier.create(client.searchTropicalStormWithResponse(-1, storm.getBasinId(), storm.getGovId())) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } } // Test async get tropical storm forecast @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetTropicalStormForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetTropicalStormForecast(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); ActiveStormResult result = client.getTropicalStormActive().block(); if (result.getActiveStorms().size() > 0) { @@ -520,7 +558,9 @@ public void testAsyncGetTropicalStormForecast(HttpClient httpClient, WeatherServ } catch (IOException e) { Assertions.fail("Unable to get tropical storm forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } @@ -543,7 +583,9 @@ public void testAsyncGetTropicalStormForecastWithResponse(HttpClient httpClient, } catch (IOException e) { Assertions.fail("unable to get tropical storm forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } @@ -559,17 +601,18 @@ public void testAsyncInvalidGetTropicalStormForecastWithResponse(HttpClient http storm.getBasinId(), storm.getGovId()) .setIncludeWindowGeometry(true); StepVerifier.create(client.getTropicalStormForecastWithResponse(forecastOptions, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } } // Test async get tropical storm locations @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetTropicalStormLocations(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetTropicalStormLocations(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); ActiveStormResult result = client.getTropicalStormActive().block(); if (result.getActiveStorms().size() > 0) { @@ -583,7 +626,9 @@ public void testAsyncGetTropicalStormLocations(HttpClient httpClient, WeatherSer } catch (IOException e) { Assertions.fail("Unable to get tropical storm locations"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } @@ -605,7 +650,9 @@ public void testAsyncGetTropicalStormLocationsWithResponse(HttpClient httpClient } catch (IOException e) { Assertions.fail("unable to get tropical storm locations"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } @@ -620,17 +667,18 @@ public void testAsyncInvalidGetTropicalStormLocationsWithResponse(HttpClient htt TropicalStormLocationOptions locationOptions = new TropicalStormLocationOptions(-1, storm.getBasinId(), storm.getGovId()); StepVerifier.create(client.getTropicalStormLocationsWithResponse(locationOptions, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } } // Test async get current air quality @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetCurrentAirQuality(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetCurrentAirQuality(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCurrentAirQuality(new GeoPosition(-122.138874, 47.632346), "es", false)) .assertNext(actualResults -> { @@ -639,7 +687,9 @@ public void testAsyncGetCurrentAirQuality(HttpClient httpClient, WeatherServiceV } catch (IOException e) { Assertions.fail("Unable to get current air quality"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get current air quality with response @@ -655,7 +705,9 @@ public void testAsyncGetCurrentAirQualityWithResponse(HttpClient httpClient, Wea } catch (IOException e) { Assertions.fail("unable to get current air quality"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -664,16 +716,17 @@ public void testAsyncGetCurrentAirQualityWithResponse(HttpClient httpClient, Wea public void testAsyncInvalidGetCurrentAirQualityWithResponse(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getCurrentAirQualityWithResponse(new GeoPosition(-1000000, 47.632346), "es", false, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get air quality daily forecasts @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetAirQualityDailyForecasts(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetAirQualityDailyForecasts(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getAirQualityDailyForecasts(new GeoPosition(-122.138874, 47.632346), "en", DailyDuration.TWO_DAYS)) .assertNext(actualResults -> { @@ -682,7 +735,9 @@ public void testAsyncGetAirQualityDailyForecasts(HttpClient httpClient, WeatherS } catch (IOException e) { Assertions.fail("Unable to get air quality daily forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get air quality daily forecast with response @@ -699,7 +754,9 @@ public void testAsyncGetAirQualityDailyForecastsWithResponse(HttpClient httpClie } catch (IOException e) { Assertions.fail("unable to get air quality daily forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -709,16 +766,17 @@ public void testAsyncInvalidGetAirQualityDailyForecastsWithResponse(HttpClient h WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getAirQualityDailyForecastsWithResponse( new GeoPosition(-100000, 47.632346), "en", DailyDuration.TWO_DAYS, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get air quality hourly forecasts @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetAirQualityHourlyForecasts(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetAirQualityHourlyForecasts(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getAirQualityHourlyForecasts( new GeoPosition(-122.138874, 47.632346), "fr", HourlyDuration.ONE_HOUR, false)) @@ -728,7 +786,9 @@ public void testAsyncGetAirQualityHourlyForecasts(HttpClient httpClient, Weather } catch (IOException e) { Assertions.fail("Unable to get air quality hourly forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get air quality hourly forecasts with response @@ -745,7 +805,9 @@ public void testAsyncGetAirQualityHourlyForecastsWithResponse(HttpClient httpCli } catch (IOException e) { Assertions.fail("unable to get air quality hourly forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -755,16 +817,17 @@ public void testAsyncInvalidGetAirQualityHourlyForecastsWithResponse(HttpClient WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); StepVerifier.create(client.getAirQualityHourlyForecastsWithResponse( new GeoPosition(-100000, 47.632346), "fr", HourlyDuration.ONE_HOUR, false, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get daily historical actuals @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetDailyHistoricalActuals(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetDailyHistoricalActuals(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); LocalDate before = testResourceNamer.now().toLocalDate().minusDays(30); LocalDate today = testResourceNamer.now().toLocalDate(); @@ -775,7 +838,9 @@ public void testAsyncGetDailyHistoricalActuals(HttpClient httpClient, WeatherSer } catch (IOException e) { Assertions.fail("Unable to get daily historical actuals forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get daily historical actuals with response @@ -793,7 +858,9 @@ public void testAsyncGetDailyHistoricalActualsWithResponse(HttpClient httpClient } catch (IOException e) { Assertions.fail("unable to get daily historical actuals forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -804,16 +871,17 @@ public void testAsyncInvalidGetDailyHistoricalActualsWithResponse(HttpClient htt LocalDate before = testResourceNamer.now().toLocalDate().minusDays(30); LocalDate today = testResourceNamer.now().toLocalDate(); StepVerifier.create(client.getDailyHistoricalActualsWithResponse(new GeoPosition(-100000, 62.6490341), before, today, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get daily historical records @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetDailyHistoricalRecords(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetDailyHistoricalRecords(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); LocalDate beforeYears = testResourceNamer.now().toLocalDate().minusYears(10); LocalDate afterYears = beforeYears.plusDays(30); @@ -824,7 +892,9 @@ public void testAsyncGetDailyHistoricalRecords(HttpClient httpClient, WeatherSer } catch (IOException e) { Assertions.fail("Unable to get daily historical records forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get daily historical records with response @@ -842,7 +912,9 @@ public void testAsyncGetDailyHistoricalRecordsWithResponse(HttpClient httpClient } catch (IOException e) { Assertions.fail("unable to get daily historical records forecast"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -853,16 +925,17 @@ public void testAsyncInvalidGetDailyHistoricalRecordsWithResponse(HttpClient htt LocalDate beforeYears = testResourceNamer.now().toLocalDate().minusYears(10); LocalDate afterYears = beforeYears.plusDays(30); StepVerifier.create(client.getDailyHistoricalRecordsWithResponse(new GeoPosition(-1000000, 39.952583), beforeYears, afterYears, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } // Test async get daily historical normals @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.maps.weather.TestUtils#getTestParameters") - public void testAsyncGetDailyHistoricalNormals(HttpClient httpClient, WeatherServiceVersion serviceVersion) throws IOException { + public void testAsyncGetDailyHistoricalNormals(HttpClient httpClient, WeatherServiceVersion serviceVersion) { WeatherAsyncClient client = getWeatherAsyncClient(httpClient, serviceVersion); LocalDate before = testResourceNamer.now().toLocalDate().minusDays(30); LocalDate today = testResourceNamer.now().toLocalDate(); @@ -873,7 +946,9 @@ public void testAsyncGetDailyHistoricalNormals(HttpClient httpClient, WeatherSer } catch (IOException e) { Assertions.fail("Unable to get daily historical normals result"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Test async get daily historical normals with response @@ -891,7 +966,9 @@ public void testAsyncGetDailyHistoricalNormalsWithResponse(HttpClient httpClient } catch (IOException e) { Assertions.fail("unable to get daily historical normals result"); } - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Case 2: 400 invalid input @@ -902,9 +979,10 @@ public void testAsyncInvalidGetDailyHistoricalNormalsWithResponse(HttpClient htt LocalDate before = testResourceNamer.now().toLocalDate().minusDays(30); LocalDate today = testResourceNamer.now().toLocalDate(); StepVerifier.create(client.getDailyHistoricalNormalsWithResponse(new GeoPosition(-100000, 62.6490341), before, today, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md b/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md index 50cb21585369..57160f06e783 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/CHANGELOG.md @@ -11,6 +11,15 @@ ### Other Changes - Integrated sync stack workflow for synchronous APIs +## 1.1.18 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.1.17 (2023-08-18) ### Other Changes diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md b/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md index f93416205199..beb57b11c098 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/README.md @@ -112,7 +112,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java index c59d827ce0ad..83799967bfad 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertAsyncTest.java @@ -6,33 +6,16 @@ import com.azure.ai.metricsadvisor.models.AnomalyAlert; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; -import com.azure.core.test.TestBase; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public final class AlertAsyncTest extends AlertTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Disabled @@ -47,8 +30,9 @@ public void listAlerts(HttpClient httpClient, MetricsAdvisorServiceVersion servi Assertions.assertNotNull(alertsFlux); StepVerifier.create(alertsFlux) - .assertNext(alert -> assertAlertOutput(alert)) + .assertNext(this::assertAlertOutput) .expectNextCount(ListAlertsOutput.INSTANCE.expectedAlerts - 1) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java index 77dd6323b245..bbdc7d9965e6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AlertTest.java @@ -6,34 +6,16 @@ import com.azure.ai.metricsadvisor.models.AnomalyAlert; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.test.TestBase; import com.azure.core.util.Context; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public final class AlertTest extends AlertTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Disabled diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java index 3fbdb1009dc2..f15f95eeda56 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertAsyncTest.java @@ -11,12 +11,9 @@ import com.azure.ai.metricsadvisor.administration.models.MetricAnomalyAlertScope; import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; import com.azure.core.http.HttpClient; -import com.azure.core.test.TestBase; import com.azure.core.test.annotation.DoNotRecord; import com.azure.core.util.CoreUtils; import io.netty.handler.codec.http.HttpResponseStatus; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -24,7 +21,6 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -33,7 +29,6 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID_ERROR; @@ -43,17 +38,6 @@ public class AnomalyAlertAsyncTest extends AnomalyAlertTestBase { private MetricsAdvisorAdministrationAsyncClient client; - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies the result of the list anomaly alert configuration method when no options specified. */ @@ -61,7 +45,7 @@ static void afterAll() { @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Disabled public void testListAnomalyAlert(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { - final AtomicReference> expectedAnomalyAlertIdList = new AtomicReference>(); + final AtomicReference> expectedAnomalyAlertIdList = new AtomicReference<>(); try { // Arrange client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, false).buildAsyncClient(); @@ -79,7 +63,8 @@ public void testListAnomalyAlert(HttpClient httpClient, MetricsAdvisorServiceVer .getMetricAlertConfigurations().get(i.get()).getDetectionConfigurationId(), new ListAnomalyAlertConfigsOptions())) .thenConsumeWhile(actualAnomalyAlertList::add) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); expectedAnomalyAlertIdList.set(expectedAnomalyAlertList.stream() .map(AnomalyAlertConfiguration::getId) @@ -100,7 +85,9 @@ public void testListAnomalyAlert(HttpClient httpClient, MetricsAdvisorServiceVer } finally { if (!CoreUtils.isNullOrEmpty(expectedAnomalyAlertIdList.get())) { expectedAnomalyAlertIdList.get().forEach(inputConfigId -> - StepVerifier.create(client.deleteAlertConfig(inputConfigId)).verifyComplete()); + StepVerifier.create(client.deleteAlertConfig(inputConfigId)) + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } } } @@ -121,7 +108,7 @@ public void getAnomalyAlertNullId() { StepVerifier.create(client.getAlertConfig(null)) .expectErrorMatches(throwable -> throwable instanceof NullPointerException && throwable.getMessage().equals("'alertConfigurationId' is required.")) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -137,7 +124,7 @@ public void getAnomalyAlertInvalidId() { StepVerifier.create(client.getAlertConfig(INCORRECT_UUID)) .expectErrorMatches(throwable -> throwable instanceof IllegalArgumentException && throwable.getMessage().equals(INCORRECT_UUID_ERROR)) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -165,12 +152,18 @@ public void getAnomalyAlertValidId(HttpClient httpClient, MetricsAdvisorServiceV assertEquals(anomalyAlertConfigurationResponse.getStatusCode(), HttpResponseStatus.OK.code()); validateAnomalyAlertResult(createdAnomalyAlert, anomalyAlertConfigurationResponse.getValue()); }); + // TODO (alzimmer): This test needs to be recorded again as it was never verifying, therefore never + // subscribing to the reactive API call. +// .expectComplete() +// .verify(DEFAULT_TIMEOUT); }); } finally { if (!CoreUtils.isNullOrEmpty(alertConfigurationId.get())) { Mono deleteAnomalyAlertConfig = client.deleteAlertConfig(alertConfigurationId.get()); - StepVerifier.create(deleteAnomalyAlertConfig).verifyComplete(); + StepVerifier.create(deleteAnomalyAlertConfig) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -196,12 +189,15 @@ public void createAnomalyAlertConfiguration(HttpClient httpClient, MetricsAdviso alertConfigurationId.set(createdAnomalyAlert.getId()); validateAnomalyAlertResult(inputAnomalyAlert, createdAnomalyAlert); }) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } finally { if (!CoreUtils.isNullOrEmpty(alertConfigurationId.get())) { Mono deleteAnomalyAlertConfig = client.deleteAlertConfig(alertConfigurationId.get()); - StepVerifier.create(deleteAnomalyAlertConfig).verifyComplete(); + StepVerifier.create(deleteAnomalyAlertConfig) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -222,15 +218,17 @@ public void deleteAnomalyAlertWithResponse(HttpClient httpClient, MetricsAdvisor assertNotNull(createdAnomalyAlert); StepVerifier.create(client.deleteAlertConfigWithResponse(createdAnomalyAlert.getId())) .assertNext(response -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), response.getStatusCode())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(client.getAlertConfigWithResponse(createdAnomalyAlert.getId())) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { assertEquals(MetricsAdvisorResponseException.class, throwable.getClass()); final MetricsAdvisorResponseException errorCodeException = (MetricsAdvisorResponseException) throwable; assertEquals(HttpResponseStatus.NOT_FOUND.code(), errorCodeException.getResponse().getStatusCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); }); } @@ -274,20 +272,25 @@ public void updateAnomalyAlertHappyPath(HttpClient httpClient, MetricsAdvisorSer .addMetricAlertConfiguration(metricAnomalyAlertConfiguration2), updatedAnomalyAlert); assertEquals(MetricAlertConfigurationsOperator.XOR.toString(), updatedAnomalyAlert.getCrossMetricsOperator().toString()); - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); // clear the set configurations, not allowed StepVerifier.create(client.updateAlertConfig( createdAnomalyAlert.setMetricAlertConfigurations(null))) - .verifyErrorSatisfies(throwable -> assertEquals( + .expectErrorSatisfies(throwable -> assertEquals( "'alertConfiguration.metricAnomalyAlertConfigurations' is required and cannot be empty", - throwable.getMessage())); + throwable.getMessage())) + .verify(DEFAULT_TIMEOUT); }); } finally { if (!CoreUtils.isNullOrEmpty(alertConfigId.get())) { Mono deleteAnomalyAlertConfig = client.deleteAlertConfig(alertConfigId.get()); - StepVerifier.create(deleteAnomalyAlertConfig).verifyComplete(); + StepVerifier.create(deleteAnomalyAlertConfig) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -315,13 +318,16 @@ public void updateAnomalyAlertHappyPath(HttpClient httpClient, MetricsAdvisorSer // createdAnomalyAlert.setDescription("updated_description") // .setCrossMetricsOperator(MetricAnomalyAlertConfigurationsOperator.XOR))) // .assertNext(updatedAnomalyAlert -> - // assertEquals("updated_description", updatedAnomalyAlert.getDescription())).verifyComplete(); + // assertEquals("updated_description", updatedAnomalyAlert.getDescription())).verifyComplete() + // .expectComplete() + // .verify(DEFAULT_TIMEOUT); // // // clear the set description, not allowed // StepVerifier.create(client.updateAnomalyAlertConfig( // createdAnomalyAlert.setDescription(null))) // .assertNext(anomalyAlertConfiguration -> assertNull(anomalyAlertConfiguration.getDescription())) - // .verifyComplete(); + // .expectComplete() + // .verify(DEFAULT_TIMEOUT); // // }); // client.deleteAnomalyAlertConfigWithResponse(inputAnomalyAlertConfigId.get()).block(); @@ -351,14 +357,17 @@ public void updateAnomalyAlertRemoveHooks(HttpClient httpClient, MetricsAdvisorS createdAnomalyAlert.setHookIdsToAlert(hookIds))) .assertNext(updatedAnomalyAlert -> assertEquals(0, updatedAnomalyAlert.getHookIdsToAlert().size())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }); } finally { if (!CoreUtils.isNullOrEmpty(alertConfigId.get())) { Mono deleteAnomalyAlertConfig = client.deleteAlertConfig(alertConfigId.get()); - StepVerifier.create(deleteAnomalyAlertConfig).verifyComplete(); + StepVerifier.create(deleteAnomalyAlertConfig) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java index 993e23ac5ea2..b643e4aaab7e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyAlertTest.java @@ -12,20 +12,15 @@ import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; -import com.azure.core.test.TestBase; import com.azure.core.test.annotation.DoNotRecord; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import io.netty.handler.codec.http.HttpResponseStatus; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -34,7 +29,6 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID_ERROR; @@ -44,17 +38,6 @@ public final class AnomalyAlertTest extends AnomalyAlertTestBase { private MetricsAdvisorAdministrationClient client; - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies the result of the list anomaly alert configuration method when no options specified. */ @@ -62,7 +45,7 @@ static void afterAll() { @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Disabled public void testListAnomalyAlert(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { - AtomicReference> expectedAnomalyAlertIdList = new AtomicReference>(); + AtomicReference> expectedAnomalyAlertIdList = new AtomicReference<>(); try { // Arrange client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, true).buildClient(); @@ -215,11 +198,9 @@ public void deleteAnomalyAlertWithResponse(HttpClient httpClient, MetricsAdvisor assertEquals(response.getStatusCode(), HttpResponseStatus.NO_CONTENT.code()); // Act & Assert - Exception exception = assertThrows(MetricsAdvisorResponseException.class, () -> - client.getAlertConfig(createdAnomalyAlert.getId())); - assertEquals(MetricsAdvisorResponseException.class, exception.getClass()); - final MetricsAdvisorResponseException errorCodeException = ((MetricsAdvisorResponseException) exception); - assertEquals(HttpResponseStatus.NOT_FOUND.code(), errorCodeException.getResponse().getStatusCode()); + MetricsAdvisorResponseException exception = assertThrows(MetricsAdvisorResponseException.class, + () -> client.getAlertConfig(createdAnomalyAlert.getId())); + assertEquals(HttpResponseStatus.NOT_FOUND.code(), exception.getResponse().getStatusCode()); }); } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java index baeb693a7486..e03e0040ea29 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesAsyncTest.java @@ -5,32 +5,17 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; -import com.azure.core.test.TestBase; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; -import java.time.Duration; import java.util.ArrayList; import java.util.List; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public final class AnomalyDimensionValuesAsyncTest extends AnomalyDimensionValuesTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @@ -50,7 +35,8 @@ public void listAnomalyDimensionValues(HttpClient httpClient, List dimensions = new ArrayList<>(); StepVerifier.create(dimensionValuesFlux) .thenConsumeWhile(dimensions::add) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); Assertions.assertEquals(ListAnomalyDimensionValuesOutput.INSTANCE.expectedValues, dimensions.size()); } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java index 019f627f7ee9..0ad3f6b0a6e9 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTest.java @@ -6,29 +6,13 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public final class AnomalyDimensionValuesTest extends AnomalyDimensionValuesTestBase { - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Override diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java index b99154a189ff..9d7c4535b81e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyDimensionValuesTestBase.java @@ -16,7 +16,6 @@ import static com.azure.ai.metricsadvisor.MetricsSeriesTestBase.TIME_SERIES_START_TIME; public abstract class AnomalyDimensionValuesTestBase extends MetricsAdvisorClientTestBase { - @Test public abstract void listAnomalyDimensionValues(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java index 4bafc60598ac..00f6fc990992 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedAsyncTest.java @@ -6,32 +6,14 @@ import com.azure.ai.metricsadvisor.models.AnomalyIncident; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; -import com.azure.core.test.TestBase; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public class AnomalyIncidentDetectedAsyncTest extends IncidentDetectedTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Override @@ -46,8 +28,6 @@ public void listIncidentsDetected(HttpClient httpClient, MetricsAdvisorServiceVe Assertions.assertNotNull(incidentsFlux); - incidentsFlux.toIterable().forEach(incident -> { - assertListIncidentsDetectedOutput(incident); - }); + incidentsFlux.toIterable().forEach(this::assertListIncidentsDetectedOutput); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java index 4d3cb2bf42ef..dea822b7747e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentDetectedTest.java @@ -6,32 +6,14 @@ import com.azure.ai.metricsadvisor.models.AnomalyIncident; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.test.TestBase; import com.azure.core.util.Context; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public class AnomalyIncidentDetectedTest extends IncidentDetectedTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") public void listIncidentsDetected(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java index d021ef5c9cf0..8ba9bca88c82 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertAsyncTest.java @@ -6,32 +6,15 @@ import com.azure.ai.metricsadvisor.models.AnomalyIncident; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; -import com.azure.core.test.TestBase; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public class AnomalyIncidentForAlertAsyncTest extends IncidentForAlertTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Disabled @@ -47,8 +30,9 @@ public void listIncidentsForAlert(HttpClient httpClient, MetricsAdvisorServiceVe Assertions.assertNotNull(incidentsFlux); StepVerifier.create(incidentsFlux) - .assertNext(incident -> assertListIncidentsForAlertOutput(incident)) + .assertNext(this::assertListIncidentsForAlertOutput) .expectNextCount(ListIncidentsForAlertOutput.INSTANCE.expectedIncidents - 1) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java index f7b14f17816c..2b84f0593913 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentForAlertTest.java @@ -8,34 +8,16 @@ import com.azure.ai.metricsadvisor.models.AnomalyIncident; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.test.TestBase; import com.azure.core.util.Context; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public class AnomalyIncidentForAlertTest extends IncidentForAlertTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Disabled diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java index 5f25ea9886a4..011d15f34acb 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseAsyncTest.java @@ -5,35 +5,19 @@ import com.azure.ai.metricsadvisor.models.IncidentRootCause; import com.azure.core.http.HttpClient; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; -import java.time.Duration; import java.util.ArrayList; import java.util.List; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; public class AnomalyIncidentRootCauseAsyncTest extends IncidentRootCauseTestBase { - private MetricsAdvisorAsyncClient client; - - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies the root causes for an incident. */ @@ -41,13 +25,15 @@ static void afterAll() { @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") public void listIncidentRootCauses(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { - client = getMetricsAdvisorBuilder(httpClient, serviceVersion, false).buildAsyncClient(); + MetricsAdvisorAsyncClient client = + getMetricsAdvisorBuilder(httpClient, serviceVersion, false).buildAsyncClient(); List actualIncidentRootCauses = new ArrayList<>(); StepVerifier.create(client.listIncidentRootCauses( INCIDENT_ROOT_CAUSE_CONFIGURATION_ID, INCIDENT_ROOT_CAUSE_ID)) .thenConsumeWhile(actualIncidentRootCauses::add) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertNotNull(actualIncidentRootCauses); assertEquals(1, actualIncidentRootCauses.size()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java index a113c229d04d..5d6ed433ef53 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/AnomalyIncidentRootCauseTest.java @@ -5,35 +5,18 @@ import com.azure.ai.metricsadvisor.models.IncidentRootCause; import com.azure.core.http.HttpClient; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.util.List; import java.util.stream.Collectors; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; public class AnomalyIncidentRootCauseTest extends IncidentRootCauseTestBase { - private MetricsAdvisorClient client; - - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies the root causes for an incident. */ @@ -41,7 +24,7 @@ static void afterAll() { @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") public void listIncidentRootCauses(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { - client = getMetricsAdvisorBuilder(httpClient, serviceVersion, true).buildClient(); + MetricsAdvisorClient client = getMetricsAdvisorBuilder(httpClient, serviceVersion, true).buildClient(); List actualIncidentRootCauses = client.listIncidentRootCauses( INCIDENT_ROOT_CAUSE_CONFIGURATION_ID, INCIDENT_ROOT_CAUSE_ID) .stream() diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java index f0be59e341bf..d9f7630110c9 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/CredentialsTests.java @@ -13,15 +13,15 @@ public void testKeyUpdate() { final MetricsAdvisorKeyCredential credential = new MetricsAdvisorKeyCredential("sub-id-1", "key-1"); - Assertions.assertTrue(credential.getKeys().getSubscriptionKey().equals("sub-id-1")); - Assertions.assertTrue(credential.getKeys().getApiKey().equals("key-1")); + Assertions.assertEquals("sub-id-1", credential.getKeys().getSubscriptionKey()); + Assertions.assertEquals("key-1", credential.getKeys().getApiKey()); credential.updateKey(null, null); Assertions.assertNull(credential.getKeys().getSubscriptionKey()); Assertions.assertNull(credential.getKeys().getApiKey()); credential.updateKey("sub-id-2", "key-2"); - Assertions.assertTrue(credential.getKeys().getSubscriptionKey().equals("sub-id-2")); - Assertions.assertTrue(credential.getKeys().getApiKey().equals("key-2")); + Assertions.assertEquals("sub-id-2", credential.getKeys().getSubscriptionKey()); + Assertions.assertEquals("key-2", credential.getKeys().getApiKey()); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java index 50f2cdcd3561..de5c8ece1871 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedAsyncClientTest.java @@ -13,19 +13,15 @@ import com.azure.ai.metricsadvisor.models.MetricsAdvisorError; import com.azure.ai.metricsadvisor.models.MetricsAdvisorResponseException; import com.azure.core.http.HttpClient; -import com.azure.core.test.TestBase; import com.azure.core.test.annotation.DoNotRecord; import com.azure.core.util.CoreUtils; import io.netty.handler.codec.http.HttpResponseStatus; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -35,7 +31,6 @@ import java.util.stream.Collectors; import static com.azure.ai.metricsadvisor.TestUtils.DATAFEED_ID_REQUIRED_ERROR; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID_ERROR; @@ -59,24 +54,13 @@ public class DataFeedAsyncClientTest extends DataFeedTestBase { private MetricsAdvisorAdministrationAsyncClient client; - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies the result of the list data feed method when no options specified. */ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") void testListDataFeed(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { - final AtomicReference> expectedDataFeedIdList = new AtomicReference>(); + final AtomicReference> expectedDataFeedIdList = new AtomicReference<>(); try { // Arrange client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, false).buildAsyncClient(); @@ -94,7 +78,8 @@ void testListDataFeed(HttpClient httpClient, MetricsAdvisorServiceVersion servic .setListDataFeedFilter(new ListDataFeedFilter().setDataFeedGranularityType(DAILY) .setName("java_")))) .thenConsumeWhile(actualDataFeedList::add) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertNotNull(actualDataFeedList); final List actualList = actualDataFeedList.stream() @@ -114,7 +99,8 @@ void testListDataFeed(HttpClient httpClient, MetricsAdvisorServiceVersion servic } finally { if (!CoreUtils.isNullOrEmpty(expectedDataFeedIdList.get())) { expectedDataFeedIdList.get().forEach(dataFeedId -> - StepVerifier.create(client.deleteDataFeed(dataFeedId)).verifyComplete()); + StepVerifier.create(client.deleteDataFeed(dataFeedId)).expectComplete() + .verify(DEFAULT_TIMEOUT)); } } } @@ -133,7 +119,8 @@ void testListDataFeedTop3(HttpClient httpClient, MetricsAdvisorServiceVersion se StepVerifier.create(client.listDataFeeds(new ListDataFeedOptions().setMaxPageSize(3)).byPage().take(4)) .thenConsumeWhile(dataFeedPagedResponse -> 3 >= dataFeedPagedResponse.getValue().size()) // page size should be less than or equal to 3 - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -143,7 +130,7 @@ void testListDataFeedTop3(HttpClient httpClient, MetricsAdvisorServiceVersion se @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") void testListDataFeedFilterByCreator(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { - final AtomicReference dataFeedId = new AtomicReference(); + final AtomicReference dataFeedId = new AtomicReference<>(); try { // Arrange client = getMetricsAdvisorAdministrationBuilder(httpClient, serviceVersion, false).buildAsyncClient(); @@ -165,13 +152,16 @@ void testListDataFeedFilterByCreator(HttpClient httpClient, MetricsAdvisorServic .forEach(dataFeed -> createdDataFeed.getCreator().equals(dataFeed.getCreator())); return true; }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }, POSTGRE_SQL_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); - StepVerifier.create(deleteDataFeed).verifyComplete(); + StepVerifier.create(deleteDataFeed) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -190,12 +180,14 @@ void testListDataFeedFilterByCreator(HttpClient httpClient, MetricsAdvisorServic // // StepVerifier.create(client.listDataFeeds()) // .thenConsumeWhile(expectedList::add) - // .verifyComplete(); + // .expectComplete() + // .verify(DEFAULT_TIMEOUT); // // // Act & Assert // StepVerifier.create(client.listDataFeeds(new ListDataFeedOptions().setSkip(3))) // .thenConsumeWhile(actualDataFeedList::add) - // .verifyComplete(); + // .expectComplete() + // .verify(DEFAULT_TIMEOUT); // // assertEquals(expectedList.size(), actualDataFeedList.size() + 3); // } @@ -216,7 +208,8 @@ void testListDataFeedFilterBySourceType(HttpClient httpClient, MetricsAdvisorSer .setListDataFeedFilter(new ListDataFeedFilter() .setDataFeedSourceType(AZURE_BLOB)))) .thenConsumeWhile(dataFeed -> AZURE_BLOB.equals(dataFeed.getSourceType())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -238,7 +231,8 @@ void testListDataFeedFilterByStatus(HttpClient httpClient, MetricsAdvisorService dataFeedPagedResponse.getValue().forEach(dataFeed -> ACTIVE.equals(dataFeed.getStatus())); return true; }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -259,7 +253,8 @@ void testListDataFeedFilterByGranularityType(HttpClient httpClient, MetricsAdvis .forEach(dataFeed -> DAILY.equals(dataFeed.getGranularity().getGranularityType())); return true; }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -287,13 +282,15 @@ void testListDataFeedFilterByName(HttpClient httpClient, MetricsAdvisorServiceVe dataFeedId.set(dataFeed.getId()); assertEquals(filterName, dataFeed.getName()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }, SQL_SERVER_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -313,7 +310,7 @@ public void getDataFeedNullId() { StepVerifier.create(client.getDataFeed(null)) .expectErrorMatches(throwable -> throwable instanceof NullPointerException && throwable.getMessage().equals(DATAFEED_ID_REQUIRED_ERROR)) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -329,7 +326,7 @@ public void getDataFeedInvalidId() { StepVerifier.create(client.getDataFeed(INCORRECT_UUID)) .expectErrorMatches(throwable -> throwable instanceof IllegalArgumentException && throwable.getMessage().equals(INCORRECT_UUID_ERROR)) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -354,12 +351,17 @@ public void getDataFeedValidId(HttpClient httpClient, MetricsAdvisorServiceVersi assertEquals(dataFeedResponse.getStatusCode(), HttpResponseStatus.OK.code()); validateDataFeedResult(createdDataFeed, dataFeedResponse.getValue(), SQL_SERVER_DB); }); + // TODO (alzimmer): This test needs to be recorded again as it was never verifying, therefore never + // subscribing to the reactive API call. +// .expectComplete() +// .verify(DEFAULT_TIMEOUT); }, SQL_SERVER_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -384,13 +386,15 @@ public void createSQLServerDataFeed(HttpClient httpClient, MetricsAdvisorService dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, SQL_SERVER_DB); }) - .verifyComplete(), SQL_SERVER_DB); + .expectComplete() + .verify(DEFAULT_TIMEOUT), SQL_SERVER_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -413,13 +417,15 @@ public void createBlobDataFeed(HttpClient httpClient, MetricsAdvisorServiceVersi dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, AZURE_BLOB); }) - .verifyComplete(), AZURE_BLOB); + .expectComplete() + .verify(DEFAULT_TIMEOUT), AZURE_BLOB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -442,12 +448,14 @@ public void createCosmosDataFeed(HttpClient httpClient, MetricsAdvisorServiceVer dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, AZURE_COSMOS_DB); }) - .verifyComplete(), AZURE_COSMOS_DB); + .expectComplete() + .verify(DEFAULT_TIMEOUT), AZURE_COSMOS_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -470,12 +478,14 @@ public void createAppInsightsDataFeed(HttpClient httpClient, MetricsAdvisorServi dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, AZURE_APP_INSIGHTS); }) - .verifyComplete(), AZURE_APP_INSIGHTS); + .expectComplete() + .verify(DEFAULT_TIMEOUT), AZURE_APP_INSIGHTS); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -498,12 +508,14 @@ public void createExplorerDataFeed(HttpClient httpClient, MetricsAdvisorServiceV dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, AZURE_DATA_EXPLORER); }) - .verifyComplete(), AZURE_DATA_EXPLORER); + .expectComplete() + .verify(DEFAULT_TIMEOUT), AZURE_DATA_EXPLORER); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -527,12 +539,14 @@ public void createAzureTableDataFeed(HttpClient httpClient, MetricsAdvisorServic dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, AZURE_TABLE); }) - .verifyComplete(), AZURE_TABLE); + .expectComplete() + .verify(DEFAULT_TIMEOUT), AZURE_TABLE); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -555,13 +569,15 @@ public void createInfluxDataFeed(HttpClient httpClient, MetricsAdvisorServiceVer dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, INFLUX_DB); }) - .verifyComplete(), INFLUX_DB); + .expectComplete() + .verify(DEFAULT_TIMEOUT), INFLUX_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -585,13 +601,15 @@ public void createMongoDBDataFeed(HttpClient httpClient, MetricsAdvisorServiceVe dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, MONGO_DB); }) - .verifyComplete(), MONGO_DB); + .expectComplete() + .verify(DEFAULT_TIMEOUT), MONGO_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -614,13 +632,15 @@ public void createMYSQLDataFeed(HttpClient httpClient, MetricsAdvisorServiceVers dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, MYSQL_DB); }) - .verifyComplete(), MYSQL_DB); + .expectComplete() + .verify(DEFAULT_TIMEOUT), MYSQL_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -644,13 +664,15 @@ public void createPostgreSQLDataFeed(HttpClient httpClient, MetricsAdvisorServic dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, POSTGRE_SQL_DB); }) - .verifyComplete(), POSTGRE_SQL_DB); + .expectComplete() + .verify(DEFAULT_TIMEOUT), POSTGRE_SQL_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -674,12 +696,14 @@ public void createDataLakeStorageDataFeed(HttpClient httpClient, MetricsAdvisorS dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, AZURE_DATA_LAKE_STORAGE_GEN2); }) - .verifyComplete(), AZURE_DATA_LAKE_STORAGE_GEN2); + .expectComplete() + .verify(DEFAULT_TIMEOUT), AZURE_DATA_LAKE_STORAGE_GEN2); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -703,12 +727,14 @@ public void createLogAnalyticsDataFeed(HttpClient httpClient, MetricsAdvisorServ dataFeedId.set(createdDataFeed.getId()); validateDataFeedResult(expectedDataFeed, createdDataFeed, AZURE_LOG_ANALYTICS); }) - .verifyComplete(), AZURE_LOG_ANALYTICS); + .expectComplete() + .verify(DEFAULT_TIMEOUT), AZURE_LOG_ANALYTICS); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -728,7 +754,7 @@ public void deleteIncorrectDataFeedId() { StepVerifier.create(client.deleteDataFeed(INCORRECT_UUID)) .expectErrorMatches(throwable -> throwable instanceof IllegalArgumentException && throwable.getMessage().equals(INCORRECT_UUID_ERROR)) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -745,15 +771,17 @@ public void deleteDataFeedIdWithResponse(HttpClient httpClient, MetricsAdvisorSe assertNotNull(createdDataFeed); StepVerifier.create(client.deleteDataFeedWithResponse(createdDataFeed.getId())) .assertNext(response -> assertEquals(response.getStatusCode(), HttpResponseStatus.NO_CONTENT.code())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(client.getDataFeedWithResponse(createdDataFeed.getId())) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { assertEquals(MetricsAdvisorResponseException.class, throwable.getClass()); final MetricsAdvisorError errorCode = ((MetricsAdvisorResponseException) throwable).getValue(); assertEquals(errorCode.getMessage(), "datafeedId is invalid."); - }); + }) + .verify(DEFAULT_TIMEOUT); }, SQL_SERVER_DB); } @@ -782,14 +810,17 @@ public void updateDataFeedHappyPath(HttpClient httpClient, MetricsAdvisorService .assertNext(updatedDataFeed -> { assertEquals(updatedName, updatedDataFeed.getName()); validateDataFeedResult(expectedDataFeed, updatedDataFeed, SQL_SERVER_DB); - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); }, SQL_SERVER_DB); } finally { if (!CoreUtils.isNullOrEmpty(dataFeedId.get())) { Mono deleteDataFeed = client.deleteDataFeed(dataFeedId.get()); StepVerifier.create(deleteDataFeed) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java index 6dcd3335ae8c..f30aa119852c 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedClientTest.java @@ -23,14 +23,10 @@ import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import io.netty.handler.codec.http.HttpResponseStatus; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -41,7 +37,6 @@ import java.util.stream.Collectors; import static com.azure.ai.metricsadvisor.TestUtils.DATAFEED_ID_REQUIRED_ERROR; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID_ERROR; @@ -67,16 +62,6 @@ public class DataFeedClientTest extends DataFeedTestBase { private MetricsAdvisorAdministrationClient client; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies the result of the list data feed method when no options specified. */ diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java index ebb2948c8a82..b072b2fa56e6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationAsyncTest.java @@ -4,38 +4,21 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationAsyncClient; -import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.Response; -import com.azure.core.test.TestBase; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public final class DataFeedIngestionOperationAsyncTest extends DataFeedIngestionOperationTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Override @@ -54,7 +37,8 @@ public void listIngestionStatus(HttpClient httpClient, MetricsAdvisorServiceVers assertListIngestionStatusOutput(ingestionStatus); return true; }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -70,8 +54,9 @@ public void getIngestionProgress(HttpClient httpClient, MetricsAdvisorServiceVer Assertions.assertNotNull(ingestionProgressMono); StepVerifier.create(ingestionProgressMono) - .assertNext(ingestionProgress -> assertListIngestionProgressOutput(ingestionProgress)) - .verifyComplete(); + .assertNext(this::assertListIngestionProgressOutput) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -89,7 +74,8 @@ public void refreshIngestion(HttpClient httpClient, MetricsAdvisorServiceVersion Assertions.assertNotNull(refreshIngestionMono); StepVerifier.create(refreshIngestionMono) - .assertNext(response -> assertRefreshIngestionInputOutput(response)) - .verifyComplete(); + .assertNext(this::assertRefreshIngestionInputOutput) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java index cc0790c550c6..d8ae035e0c5b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DataFeedIngestionOperationTest.java @@ -4,38 +4,20 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClient; -import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionProgress; +import com.azure.ai.metricsadvisor.administration.models.DataFeedIngestionStatus; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; -import com.azure.core.test.TestBase; import com.azure.core.util.Context; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public class DataFeedIngestionOperationTest extends DataFeedIngestionOperationTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Override diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java index 019de4f3b62a..672d6d8b7a68 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DatasourceCredentialAsyncTest.java @@ -7,39 +7,23 @@ import com.azure.ai.metricsadvisor.administration.models.DataSourceAuthenticationType; import com.azure.ai.metricsadvisor.administration.models.DataSourceCredentialEntity; import com.azure.core.http.HttpClient; -import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertEquals; public class DatasourceCredentialAsyncTest extends DatasourceCredentialTestBase { private MetricsAdvisorAdministrationAsyncClient client; - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Override @@ -57,13 +41,15 @@ void createSqlConnectionString(HttpClient httpClient, MetricsAdvisorServiceVersi createdCredential, DataSourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); }) - .verifyComplete(), DataSourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); + .expectComplete() + .verify(DEFAULT_TIMEOUT), DataSourceAuthenticationType.AZURE_SQL_CONNECTION_STRING); } finally { if (!CoreUtils.isNullOrEmpty(credentialId.get())) { Mono deleteCredential = client.deleteDataSourceCredential(credentialId.get()); StepVerifier.create(deleteCredential) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -85,13 +71,15 @@ void createDataLakeGen2SharedKey(HttpClient httpClient, MetricsAdvisorServiceVer createdCredential, DataSourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); }) - .verifyComplete(), DataSourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); + .expectComplete() + .verify(DEFAULT_TIMEOUT), DataSourceAuthenticationType.DATA_LAKE_GEN2_SHARED_KEY); } finally { if (!CoreUtils.isNullOrEmpty(credentialId.get())) { Mono deleteCredential = client.deleteDataSourceCredential(credentialId.get()); StepVerifier.create(deleteCredential) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -113,13 +101,15 @@ void createServicePrincipal(HttpClient httpClient, MetricsAdvisorServiceVersion createdCredential, DataSourceAuthenticationType.SERVICE_PRINCIPAL); }) - .verifyComplete(), DataSourceAuthenticationType.SERVICE_PRINCIPAL); + .expectComplete() + .verify(DEFAULT_TIMEOUT), DataSourceAuthenticationType.SERVICE_PRINCIPAL); } finally { if (!CoreUtils.isNullOrEmpty(credentialId.get())) { Mono deleteCredential = client.deleteDataSourceCredential(credentialId.get()); StepVerifier.create(deleteCredential) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -141,13 +131,15 @@ void createServicePrincipalInKV(HttpClient httpClient, MetricsAdvisorServiceVers createdCredential, DataSourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); }) - .verifyComplete(), DataSourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); + .expectComplete() + .verify(DEFAULT_TIMEOUT), DataSourceAuthenticationType.SERVICE_PRINCIPAL_IN_KV); } finally { if (!CoreUtils.isNullOrEmpty(credentialId.get())) { Mono deleteCredential = client.deleteDataSourceCredential(credentialId.get()); StepVerifier.create(deleteCredential) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } } @@ -173,14 +165,16 @@ void testListDataSourceCredentials(HttpClient httpClient, MetricsAdvisorServiceV retrievedCredentialList.add(e); return retrievedCredentialList.size() < inputCredentialList.size(); }) - .thenCancel().verify(); + .thenCancel().verify(DEFAULT_TIMEOUT); assertEquals(inputCredentialList.size(), retrievedCredentialList.size()); }); } finally { if (!CoreUtils.isNullOrEmpty(createdCredentialIdList.get())) { createdCredentialIdList.get().forEach(credentialId -> - StepVerifier.create(client.deleteDataSourceCredential(credentialId)).verifyComplete()); + StepVerifier.create(client.deleteDataSourceCredential(credentialId)) + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java index aebf70051e7f..aabfe55356f6 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationAsyncTest.java @@ -9,33 +9,19 @@ import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; import com.azure.ai.metricsadvisor.administration.models.ListDetectionConfigsOptions; import com.azure.core.http.HttpClient; -import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; -import java.time.Duration; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertNotNull; public class DetectionConfigurationAsyncTest extends DetectionConfigurationTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @@ -63,12 +49,14 @@ public void createDetectionConfigurationForWholeSeries(HttpClient httpClient, id.set(configuration.getId()); super.assertCreateDetectionConfigurationForWholeSeriesOutput(configuration, costMetricId); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } finally { if (!CoreUtils.isNullOrEmpty(id.get())) { StepVerifier.create(client.deleteDetectionConfig(id.get())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } if (dataFeed != null) { super.deleteDateFeed(dataFeed, httpClient, serviceVersion); @@ -102,11 +90,13 @@ public void createDetectionConfigurationForSeriesAndGroup(HttpClient httpClient, id.set(configuration.getId()); super.assertCreateDetectionConfigurationForSeriesAndGroupOutput(configuration, costMetricId); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } finally { if (!CoreUtils.isNullOrEmpty(id.get())) { StepVerifier.create(client.deleteDetectionConfig(id.get())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } if (dataFeed != null) { super.deleteDateFeed(dataFeed, httpClient, serviceVersion); @@ -141,18 +131,21 @@ public void createDetectionConfigurationForMultipleSeriesAndGroup(HttpClient htt id.set(configuration.getId()); super.assertCreateDetectionConfigurationForMultipleSeriesAndGroupOutput(configuration, costMetricId); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(client.listDetectionConfigs(costMetricId, new ListDetectionConfigsOptions())) // Expect 2 config: Default + the one just created. - .assertNext(configuration -> assertNotNull(configuration)) - .assertNext(configuration -> assertNotNull(configuration)) - .verifyComplete(); + .assertNext(Assertions::assertNotNull) + .assertNext(Assertions::assertNotNull) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } finally { if (!CoreUtils.isNullOrEmpty(id.get())) { StepVerifier.create(client.deleteDetectionConfig(id.get())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } if (dataFeed != null) { super.deleteDateFeed(dataFeed, httpClient, serviceVersion); @@ -186,7 +179,8 @@ public void updateDetectionConfiguration(HttpClient httpClient, MetricsAdvisorSe assertNotNull(configuration); configs[0] = configuration; }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertNotNull(configs[0]); AnomalyDetectionConfiguration config = configs[0]; @@ -203,11 +197,13 @@ public void updateDetectionConfiguration(HttpClient httpClient, MetricsAdvisorSe id.set(configuration.getId()); super.assertUpdateDetectionConfigurationOutput(configuration, costMetricId); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } finally { if (!CoreUtils.isNullOrEmpty(id.get())) { StepVerifier.create(client.deleteDetectionConfig(id.get())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } if (dataFeed != null) { super.deleteDateFeed(dataFeed, httpClient, serviceVersion); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java index 8ea2d5276986..0f0d20f260a3 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/DetectionConfigurationTest.java @@ -8,36 +8,19 @@ import com.azure.ai.metricsadvisor.administration.models.DataFeed; import com.azure.ai.metricsadvisor.administration.models.DataFeedMetric; import com.azure.core.http.HttpClient; -import com.azure.core.test.TestBase; import com.azure.core.util.CoreUtils; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertNotNull; public class DetectionConfigurationTest extends DetectionConfigurationTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Override @@ -142,7 +125,7 @@ public void createDetectionConfigurationForMultipleSeriesAndGroup(HttpClient htt id.set(configuration.getId()); client.listDetectionConfigs(costMetricId) - .forEach(config -> Assertions.assertNotNull(config)); + .forEach(Assertions::assertNotNull); } finally { if (!CoreUtils.isNullOrEmpty(id.get())) { client.deleteDetectionConfig(id.get()); diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java index ca0f6020341c..402845abc0c8 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackAsyncTest.java @@ -10,17 +10,13 @@ import com.azure.ai.metricsadvisor.models.ListMetricFeedbackOptions; import com.azure.ai.metricsadvisor.models.MetricFeedback; import com.azure.core.http.HttpClient; -import com.azure.core.test.TestBase; import io.netty.handler.codec.http.HttpResponseStatus; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; -import java.time.Duration; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.Arrays; @@ -30,7 +26,6 @@ import java.util.stream.Collectors; import static com.azure.ai.metricsadvisor.MetricsSeriesTestBase.METRIC_ID; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID; import static com.azure.ai.metricsadvisor.TestUtils.INCORRECT_UUID_ERROR; @@ -43,17 +38,6 @@ public class FeedbackAsyncTest extends FeedbackTestBase { private MetricsAdvisorAsyncClient client; - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies the result of the list metric feedback method when no options specified. */ @@ -87,7 +71,8 @@ void testListMetricFeedback(HttpClient httpClient, MetricsAdvisorServiceVersion metricFeedbackPagedResponse.getValue().forEach(actualMetricFeedbackList::add); return true; }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); final List expectedMetricFeedbackIdList = expectedMetricFeedbackList.stream() .map(MetricFeedback::getId) @@ -138,7 +123,8 @@ void testListMetricFeedbackFilterByDimensionFilter(HttpClient httpClient, Metric .setMaxPageSize(10))) .thenConsumeWhile(metricFeedback -> metricFeedback.getDimensionFilter().asMap().keySet().stream().anyMatch(DIMENSION_FILTER::containsKey)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }, ANOMALY); } @@ -166,7 +152,8 @@ void testListMetricFeedbackFilterByFeedbackType(HttpClient httpClient, MetricsAd } return matched; }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); Assertions.assertTrue(count[0] > 0); } @@ -192,7 +179,8 @@ void testListMetricFeedbackFilterStartTime(HttpClient httpClient, MetricsAdvisor .thenConsumeWhile(metricFeedback -> metricFeedback.getCreatedTime().isAfter(createdMetricFeedback.getCreatedTime()) || metricFeedback.getCreatedTime().isEqual(createdMetricFeedback.getCreatedTime())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }, ANOMALY); } @@ -212,7 +200,7 @@ public void getMetricFeedbackNullId(HttpClient httpClient, MetricsAdvisorService StepVerifier.create(client.getFeedback(null)) .expectErrorMatches(throwable -> throwable instanceof NullPointerException && throwable.getMessage().equals("'feedbackId' is required.")) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -228,7 +216,7 @@ public void getMetricFeedbackInvalidId(HttpClient httpClient, MetricsAdvisorServ StepVerifier.create(client.getFeedback(INCORRECT_UUID)) .expectErrorMatches(throwable -> throwable instanceof IllegalArgumentException && throwable.getMessage().equals(INCORRECT_UUID_ERROR)) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -250,7 +238,8 @@ public void getMetricFeedbackValidId(HttpClient httpClient, MetricsAdvisorServic assertEquals(metricFeedbackResponse.getStatusCode(), HttpResponseStatus.OK.code()); validateMetricFeedbackResult(getCommentFeedback(), metricFeedbackResponse.getValue(), COMMENT); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }, COMMENT); } @@ -271,7 +260,8 @@ public void createCommentMetricFeedback(HttpClient httpClient, MetricsAdvisorSer StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, COMMENT)) - .verifyComplete(), COMMENT); + .expectComplete() + .verify(DEFAULT_TIMEOUT), COMMENT); } /** @@ -289,7 +279,8 @@ public void createAnomalyFeedback(HttpClient httpClient, MetricsAdvisorServiceVe StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, ANOMALY)) - .verifyComplete(), ANOMALY); + .expectComplete() + .verify(DEFAULT_TIMEOUT), ANOMALY); } /** @@ -307,7 +298,8 @@ public void createPeriodMetricFeedback(HttpClient httpClient, MetricsAdvisorServ StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, PERIOD)) - .verifyComplete(), PERIOD); + .expectComplete() + .verify(DEFAULT_TIMEOUT), PERIOD); } /** @@ -323,6 +315,7 @@ public void createChangePointMetricFeedback(HttpClient httpClient, MetricsAdviso // Act & Assert StepVerifier.create(client.addFeedback(METRIC_ID, expectedMetricFeedback)) .assertNext(createdMetricFeedback -> validateMetricFeedbackResult(expectedMetricFeedback, createdMetricFeedback, CHANGE_POINT)) - .verifyComplete(), CHANGE_POINT); + .expectComplete() + .verify(DEFAULT_TIMEOUT), CHANGE_POINT); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java index dd413c7c8171..0d8a9b846623 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/FeedbackTest.java @@ -14,15 +14,11 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import io.netty.handler.codec.http.HttpResponseStatus; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.Arrays; @@ -32,7 +28,6 @@ import java.util.stream.Collectors; import static com.azure.ai.metricsadvisor.MetricsSeriesTestBase.METRIC_ID; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static com.azure.ai.metricsadvisor.models.FeedbackType.ANOMALY; import static com.azure.ai.metricsadvisor.models.FeedbackType.CHANGE_POINT; @@ -45,16 +40,6 @@ public class FeedbackTest extends FeedbackTestBase { private MetricsAdvisorClient client; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies the result of the list metric feedback method when no options specified. */ diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java index 1c3b381f3ab2..93d0f86a912a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataAsyncTest.java @@ -6,33 +6,16 @@ import com.azure.ai.metricsadvisor.models.MetricEnrichedSeriesData; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedFlux; -import com.azure.core.test.TestBase; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; -import java.time.Duration; - -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public class MetricEnrichedSeriesDataAsyncTest extends MetricEnrichedSeriesDataTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Disabled @@ -49,9 +32,8 @@ public void getEnrichedSeriesData(HttpClient httpClient, MetricsAdvisorServiceVe Assertions.assertNotNull(enrichedDataFlux); StepVerifier.create(enrichedDataFlux) - .assertNext(enrichedSeriesData -> { - assertGetEnrichedSeriesDataOutput(enrichedSeriesData); - }) - .verifyComplete(); + .assertNext(this::assertGetEnrichedSeriesDataOutput) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java index 554e17944759..dedb9860710b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricEnrichedSeriesDataTest.java @@ -6,35 +6,17 @@ import com.azure.ai.metricsadvisor.models.MetricEnrichedSeriesData; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.test.TestBase; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.util.List; import java.util.stream.Collectors; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public final class MetricEnrichedSeriesDataTest extends MetricEnrichedSeriesDataTestBase { - - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @Disabled diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java index 6382c7b38a57..43cbbfb99e6a 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java @@ -16,13 +16,16 @@ import com.azure.core.util.Configuration; import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.Duration; import java.util.Arrays; import static com.azure.ai.metricsadvisor.MetricsAdvisorClientBuilderTest.PLAYBACK_ENDPOINT; import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_ENDPOINT; +import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.getEmailSanitizers; public abstract class MetricsAdvisorAdministrationClientTestBase extends TestProxyTestBase { + protected static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS); @Override protected void beforeTest() { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java index 63930b72c59b..7ddcc1cac28d 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java @@ -15,12 +15,15 @@ import com.azure.core.util.Configuration; import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.Duration; import java.util.Arrays; import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_ENDPOINT; +import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.getEmailSanitizers; public abstract class MetricsAdvisorClientTestBase extends TestProxyTestBase { + protected static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS); @Override protected void beforeTest() { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java index 15c2f1292a44..21cf4f60e237 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesAsyncTest.java @@ -8,20 +8,15 @@ import com.azure.ai.metricsadvisor.models.ListMetricSeriesDefinitionOptions; import com.azure.ai.metricsadvisor.models.MetricSeriesDefinition; import com.azure.core.http.HttpClient; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; -import java.time.Duration; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -30,16 +25,6 @@ public class MetricsSeriesAsyncTest extends MetricsSeriesTestBase { private MetricsAdvisorAsyncClient client; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies all the dimension values returned for a metric. */ @@ -47,10 +32,11 @@ static void afterAll() { @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") public void listMetricDimensionValues(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVersion) { client = getMetricsAdvisorBuilder(httpClient, serviceVersion, false).buildAsyncClient(); - List actualDimensionValues = new ArrayList(); + List actualDimensionValues = new ArrayList<>(); StepVerifier.create(client.listMetricDimensionValues(METRIC_ID, DIMENSION_NAME)) .thenConsumeWhile(actualDimensionValues::add) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertEquals(EXPECTED_DIMENSION_VALUES_COUNT, actualDimensionValues.size()); } @@ -71,7 +57,8 @@ public void listMetricSeriesData(HttpClient httpClient, MetricsAdvisorServiceVer assertNotNull(metricSeriesData.getTimestamps()); assertNotNull(metricSeriesData.getMetricValues()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -85,7 +72,8 @@ public void listMetricSeriesDefinitions(HttpClient httpClient, MetricsAdvisorSer .take(LISTING_SERIES_DEFINITIONS_LIMIT)) .thenConsumeWhile(metricSeriesDefinition -> metricSeriesDefinition.getMetricId() != null && metricSeriesDefinition.getSeriesKey() != null) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -98,11 +86,10 @@ public void listMetricSeriesDefinitionsDimensionFilter(HttpClient httpClient, Me List actualMetricSeriesDefinitions = new ArrayList<>(); StepVerifier.create(client.listMetricSeriesDefinitions(METRIC_ID, TIME_SERIES_START_TIME, new ListMetricSeriesDefinitionOptions() - .setDimensionCombinationToFilter(new HashMap>() {{ - put("Dim1", Collections.singletonList("JPN")); - }}))) + .setDimensionCombinationToFilter(Collections.singletonMap("Dim1", Collections.singletonList("JPN"))))) .thenConsumeWhile(actualMetricSeriesDefinitions::add) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); actualMetricSeriesDefinitions.forEach(metricSeriesDefinition -> { final String dimensionFilterValue = metricSeriesDefinition.getSeriesKey().asMap().get("Dim1"); @@ -124,7 +111,8 @@ public void listMetricEnrichmentStatus(HttpClient httpClient, MetricsAdvisorServ OffsetDateTime.parse("2021-10-01T00:00:00Z"), OffsetDateTime.parse("2021-10-30T00:00:00Z"), ListEnrichmentStatusInput.INSTANCE.options)) .thenConsumeWhile(enrichmentStatuses::add) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); enrichmentStatuses.forEach(MetricsSeriesTestBase::validateEnrichmentStatus); } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java index 37994d9905ea..15943707df57 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsSeriesTest.java @@ -9,20 +9,14 @@ import com.azure.ai.metricsadvisor.models.MetricSeriesDefinition; import com.azure.core.http.HttpClient; import com.azure.core.util.Context; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.time.OffsetDateTime; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.stream.Collectors; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -30,16 +24,6 @@ public class MetricsSeriesTest extends MetricsSeriesTestBase { private MetricsAdvisorClient client; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies all the dimension values returned for a metric. */ @@ -96,9 +80,8 @@ public void listMetricSeriesDefinitionsDimensionFilter(HttpClient httpClient, List actualMetricSeriesDefinitions = client.listMetricSeriesDefinitions(METRIC_ID, TIME_SERIES_START_TIME, new ListMetricSeriesDefinitionOptions() - .setDimensionCombinationToFilter(new HashMap>() {{ - put("Dim1", Collections.singletonList("JPN")); - }}), Context.NONE) + .setDimensionCombinationToFilter(Collections.singletonMap("Dim1", Collections.singletonList("JPN"))), + Context.NONE) .stream().collect(Collectors.toList()); actualMetricSeriesDefinitions.forEach(metricSeriesDefinition -> { diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java index 2af86fe58f09..fd976fbbb90e 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookAsyncTest.java @@ -8,34 +8,19 @@ import com.azure.ai.metricsadvisor.administration.models.NotificationHook; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; -import com.azure.core.test.TestBase; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import java.time.Duration; import java.util.ArrayList; import java.util.List; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public final class NotificationHookAsyncTest extends NotificationHookTestBase { - @BeforeAll - static void beforeAll() { - TestBase.setupClass(); - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") @@ -52,12 +37,14 @@ void createEmailHook(HttpClient httpClient, MetricsAdvisorServiceVersion service assertCreateEmailHookOutput(hook); hookId[0] = hook.getId(); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); Mono deleteHookMono = client.deleteHook(hookId[0]); StepVerifier.create(deleteHookMono) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -75,12 +62,14 @@ void createWebHook(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVe assertCreateWebHookOutput(hook); hookId[0] = hook.getId(); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); Mono deleteHookMono = client.deleteHook(hookId[0]); StepVerifier.create(deleteHookMono) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -92,15 +81,13 @@ void testListHook(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVer String[] hookId = new String[2]; StepVerifier.create(client.createHook(ListHookInput.INSTANCE.emailHook)) - .consumeNextWith(hook -> { - hookId[0] = hook.getId(); - }) - .verifyComplete(); + .consumeNextWith(hook -> hookId[0] = hook.getId()) + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(client.createHook(ListHookInput.INSTANCE.webHook)) - .consumeNextWith(hook -> { - hookId[1] = hook.getId(); - }) - .verifyComplete(); + .consumeNextWith(hook -> hookId[1] = hook.getId()) + .expectComplete() + .verify(DEFAULT_TIMEOUT); Assertions.assertNotNull(hookId[0]); Assertions.assertNotNull(hookId[1]); @@ -108,7 +95,8 @@ void testListHook(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVer List notificationHookList = new ArrayList<>(); StepVerifier.create(client.listHooks(new ListHookOptions().setHookNameFilter("java_test"))) .thenConsumeWhile(notificationHookList::add) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertListHookOutput(notificationHookList); @@ -117,13 +105,16 @@ void testListHook(HttpClient httpClient, MetricsAdvisorServiceVersion serviceVer .setHookNameFilter("java_test") .setMaxPageSize(ListHookInput.INSTANCE.pageSize)).byPage()) .thenConsumeWhile(hookPageList::add) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertPagedListHookOutput(hookPageList); StepVerifier.create(client.deleteHook(hookId[0])) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(client.deleteHook(hookId[1])) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java index 7d16f0fb949b..10c9982168e0 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTest.java @@ -9,31 +9,17 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedResponse; import com.azure.core.util.Context; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import reactor.test.StepVerifier; -import java.time.Duration; import java.util.List; import java.util.stream.Collectors; -import static com.azure.ai.metricsadvisor.TestUtils.DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS; import static com.azure.ai.metricsadvisor.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; public final class NotificationHookTest extends NotificationHookTestBase { - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(DEFAULT_SUBSCRIBER_TIMEOUT_SECONDS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("com.azure.ai.metricsadvisor.TestUtils#getTestParameters") diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java index 88654cef380a..251e62957030 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/NotificationHookTestBase.java @@ -10,6 +10,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.rest.PagedResponse; import com.azure.core.test.TestMode; +import com.azure.core.util.CoreUtils; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -24,7 +25,7 @@ public abstract class NotificationHookTestBase extends MetricsAdvisorAdministrat protected static class CreateEmailHookInput { static final CreateEmailHookInput INSTANCE = new CreateEmailHookInput(); - String name = UUID.randomUUID().toString(); + String name = CoreUtils.randomUuid().toString(); String email1 = "simpleuser0@hotmail.com"; String email2 = "simpleuser1@hotmail.com"; String description = "alert_us!"; diff --git a/sdk/mixedreality/azure-mixedreality-authentication/CHANGELOG.md b/sdk/mixedreality/azure-mixedreality-authentication/CHANGELOG.md index fd60b8ea136f..f4f51083f15b 100644 --- a/sdk/mixedreality/azure-mixedreality-authentication/CHANGELOG.md +++ b/sdk/mixedreality/azure-mixedreality-authentication/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.2.17 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.2.16 (2023-08-18) ### Other Changes diff --git a/sdk/monitor/azure-monitor-ingestion-perf/pom.xml b/sdk/monitor/azure-monitor-ingestion-perf/pom.xml index 5bca40c6f996..d64fd0063f67 100644 --- a/sdk/monitor/azure-monitor-ingestion-perf/pom.xml +++ b/sdk/monitor/azure-monitor-ingestion-perf/pom.xml @@ -31,7 +31,7 @@ com.azure azure-monitor-ingestion - 1.1.0-beta.1 + 1.2.0-beta.1 com.azure diff --git a/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md b/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md index b482945ec9d7..4e890103b0bb 100644 --- a/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-ingestion/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.2.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,18 @@ ### Other Changes +## 1.1.0 (2023-09-13) + +### Features Added +- `LogsIngestionClient` now implements `AutoCloseable` interface and can be used in try-with-resources block. + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.0.6 (2023-08-18) ### Other Changes diff --git a/sdk/monitor/azure-monitor-ingestion/README.md b/sdk/monitor/azure-monitor-ingestion/README.md index 0c6da96b35dd..14b4031fd32a 100644 --- a/sdk/monitor/azure-monitor-ingestion/README.md +++ b/sdk/monitor/azure-monitor-ingestion/README.md @@ -57,7 +57,7 @@ add the direct dependency to your project as follows. com.azure azure-monitor-ingestion - 1.0.5 + 1.1.0 ``` [//]: # ({x-version-update-end}) @@ -76,7 +76,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) @@ -152,7 +152,7 @@ client library. DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); LogsIngestionClient client = new LogsIngestionClientBuilder() - .endpoint("") .credential(tokenCredential) .buildClient(); @@ -171,7 +171,7 @@ can be concurrently sent to the service as shown in the example below. DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); LogsIngestionClient client = new LogsIngestionClientBuilder() - .endpoint("") .credential(tokenCredential) .buildClient(); @@ -194,7 +194,7 @@ not provided, the upload method will throw an aggregate exception that includes DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); LogsIngestionClient client = new LogsIngestionClientBuilder() - .endpoint("") .credential(tokenCredential) .buildClient(); diff --git a/sdk/monitor/azure-monitor-ingestion/TROUBLESHOOTING.md b/sdk/monitor/azure-monitor-ingestion/TROUBLESHOOTING.md index acf9f27a175e..602de3f3a09c 100644 --- a/sdk/monitor/azure-monitor-ingestion/TROUBLESHOOTING.md +++ b/sdk/monitor/azure-monitor-ingestion/TROUBLESHOOTING.md @@ -34,6 +34,7 @@ Reviewing the HTTP request sent or response received over the wire to/from the A ```java readme-sample-enablehttplogging LogsIngestionClient logsIngestionClient = new LogsIngestionClientBuilder() + .endpoint("") .credential(credential) .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .buildClient(); @@ -112,7 +113,7 @@ To set the concurrency, use the `UploadLogsOptions` type's `setMaxConcurrency` m DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); LogsIngestionClient client = new LogsIngestionClientBuilder() - .endpoint("") .credential(tokenCredential) .buildClient(); diff --git a/sdk/monitor/azure-monitor-ingestion/pom.xml b/sdk/monitor/azure-monitor-ingestion/pom.xml index 54f03335dfc4..31a847d0567e 100644 --- a/sdk/monitor/azure-monitor-ingestion/pom.xml +++ b/sdk/monitor/azure-monitor-ingestion/pom.xml @@ -7,7 +7,7 @@ com.azure azure-monitor-ingestion - 1.1.0-beta.1 + 1.2.0-beta.1 jar Microsoft Azure SDK for Azure Monitor Data Ingestion diff --git a/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionAsyncClient.java b/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionAsyncClient.java index 47f7d74e577b..bfc615856518 100644 --- a/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionAsyncClient.java +++ b/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionAsyncClient.java @@ -6,17 +6,20 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.credential.TokenCredential; 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.HttpHeader; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.monitor.ingestion.implementation.Batcher; import com.azure.monitor.ingestion.implementation.IngestionUsingDataCollectionRulesAsyncClient; +import com.azure.monitor.ingestion.implementation.IngestionUsingDataCollectionRulesClient; import com.azure.monitor.ingestion.implementation.LogsIngestionRequest; import com.azure.monitor.ingestion.implementation.UploadLogsResponseHolder; import com.azure.monitor.ingestion.models.LogsUploadError; @@ -38,7 +41,20 @@ import static com.azure.monitor.ingestion.implementation.Utils.gzipRequest; /** - * The asynchronous client for uploading logs to Azure Monitor. + * This class provides an asynchronous client for uploading custom logs to an Azure Monitor Log Analytics workspace. + * + *

    Getting Started

    + * + *

    To create an instance of the {@link LogsIngestionClient}, use the {@link LogsIngestionClientBuilder} and configure + * the various options provided by the builder to customize the client as per your requirements. There are two required + * properties that should be set to build a client: + *

      + *
    1. {@code endpoint} - The data collection endpoint. + * See {@link LogsIngestionClientBuilder#endpoint(String) endpoint} method for more details.
    2. + *
    3. {@code credential} - The AAD authentication credential that has the "Monitoring Metrics Publisher" role assigned to it. + * Azure Identity + * provides a variety of AAD credential types that can be used. See {@link LogsIngestionClientBuilder#credential(TokenCredential) credential } method for more details.
    4. + *
    * *

    Instantiating an asynchronous Logs ingestion client

    * @@ -49,11 +65,19 @@ * .buildAsyncClient(); * * + * + * @see LogsIngestionClientBuilder + * @see LogsIngestionClient + * @see com.azure.monitor.ingestion */ @ServiceClient(isAsync = true, builder = LogsIngestionClientBuilder.class) public final class LogsIngestionAsyncClient { private final IngestionUsingDataCollectionRulesAsyncClient service; + /** + * Creates a {@link LogsIngestionAsyncClient} that sends requests to the data collection endpoint. + * @param service The {@link IngestionUsingDataCollectionRulesClient} that the client routes its request through. + */ LogsIngestionAsyncClient(IngestionUsingDataCollectionRulesAsyncClient service) { this.service = service; } @@ -63,6 +87,12 @@ public final class LogsIngestionAsyncClient { * too large to be sent as a single request to the Azure Monitor service. In such cases, this method will split * the input logs into multiple smaller requests before sending to the service. * + *

    + * Each log in the input collection must be a valid JSON object. The JSON object should match the + * schema defined + * by the stream name. The stream's schema can be found in the Azure portal. + *

    + * *

    Upload logs to Azure Monitor

    * *
    @@ -88,7 +118,17 @@ public Mono upload(String ruleId, String streamName, Iterable logs
         /**
          * Uploads logs to Azure Monitor with specified data collection rule id and stream name. The input logs may be
          * too large to be sent as a single request to the Azure Monitor service. In such cases, this method will split
    -     * the input logs into multiple smaller requests before sending to the service.
    +     * the input logs into multiple smaller requests before sending to the service. If an
    +     * {@link LogsUploadOptions#setLogsUploadErrorConsumer(Consumer) error handler} is set,
    +     * then the service errors are surfaced to the error handler and the subscriber of this method won't receive an
    +     * error signal.
    +     *
    +     * 

    + * Each log in the input collection must be a valid JSON object. The JSON object should match the + * schema defined + * by the stream name. The stream's schema can be found in the Azure portal. + *

    + * * *

    Upload logs to Azure Monitor

    * @@ -116,7 +156,17 @@ public Mono upload(String ruleId, String streamName, } /** - * See error response code and error response message for more detail. + * This method is used to upload logs to Azure Monitor Log Analytics with specified data collection rule id and stream name. This + * upload method provides a more granular control of the HTTP request sent to the service. Use {@link RequestOptions} + * to configure the HTTP request. + * + *

    + * The input logs should be a JSON array with each element in the array + * matching the schema defined + * by the stream name. The stream's schema can be found in the Azure portal. This content will be gzipped before sending to the service. + * If the content is already gzipped, then set the {@code Content-Encoding} header to {@code gzip} using {@link RequestOptions#setHeader(HttpHeaderName, String) requestOptions} + * and pass the content as is. + *

    * *

    Header Parameters * diff --git a/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionClient.java b/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionClient.java index a77732dcafe5..a4f00d5021af 100644 --- a/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionClient.java +++ b/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionClient.java @@ -6,11 +6,13 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.credential.TokenCredential; 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.HttpHeader; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; @@ -40,7 +42,20 @@ import static com.azure.monitor.ingestion.implementation.Utils.registerShutdownHook; /** - * The synchronous client for uploading logs to Azure Monitor. + * This class provides a synchronous client for uploading custom logs to an Azure Monitor Log Analytics workspace. + * + *

    Getting Started

    + * + *

    To create an instance of the {@link LogsIngestionClient}, use the {@link LogsIngestionClientBuilder} and configure + * the various options provided by the builder to customize the client as per your requirements. There are two required + * properties that should be set to build a client: + *

      + *
    1. {@code endpoint} - The data collection endpoint. + * See {@link LogsIngestionClientBuilder#endpoint(String) endpoint} method for more details.
    2. + *
    3. {@code credential} - The AAD authentication credential that has the "Monitoring Metrics Publisher" role assigned to it. + * Azure Identity + * provides a variety of AAD credential types that can be used. See {@link LogsIngestionClientBuilder#credential(TokenCredential) credential } method for more details.
    4. + *
    * *

    Instantiating a synchronous Logs ingestion client

    * @@ -51,6 +66,10 @@ * .buildClient(); * * + * + * @see LogsIngestionClientBuilder + * @see LogsIngestionAsyncClient + * @see com.azure.monitor.ingestion */ @ServiceClient(builder = LogsIngestionClientBuilder.class) public final class LogsIngestionClient implements AutoCloseable { @@ -61,6 +80,11 @@ public final class LogsIngestionClient implements AutoCloseable { private final ExecutorService threadPool; private final Thread shutdownHook; + /** + * Creates a {@link LogsIngestionClient} that sends requests to the data collection endpoint. + * + * @param client The {@link IngestionUsingDataCollectionRulesClient} that the client routes its request through. + */ LogsIngestionClient(IngestionUsingDataCollectionRulesClient client) { this.client = client; this.threadPool = createThreadPool(); @@ -70,7 +94,14 @@ public final class LogsIngestionClient implements AutoCloseable { /** * Uploads logs to Azure Monitor with specified data collection rule id and stream name. The input logs may be * too large to be sent as a single request to the Azure Monitor service. In such cases, this method will split - * the input logs into multiple smaller requests before sending to the service. + * the input logs into multiple smaller requests before sending to the service. This method will block until all + * the logs are uploaded or an error occurs. + * + *

    + * Each log in the input collection must be a valid JSON object. The JSON object should match the + * schema defined + * by the stream name. The stream's schema can be found in the Azure portal. + *

    * *

    Upload logs to Azure Monitor

    * @@ -96,7 +127,15 @@ public void upload(String ruleId, String streamName, Iterable logs) { /** * Uploads logs to Azure Monitor with specified data collection rule id and stream name. The input logs may be * too large to be sent as a single request to the Azure Monitor service. In such cases, this method will split - * the input logs into multiple smaller requests before sending to the service. + * the input logs into multiple smaller requests before sending to the service. This method will block until all + * the logs are uploaded or an error occurs. If an {@link LogsUploadOptions#setLogsUploadErrorConsumer(Consumer) error handler} is set, + * then the service errors are surfaced to the error handler and this method won't throw an exception. + * + *

    + * Each log in the input collection must be a valid JSON object. The JSON object should match the + * schema defined + * by the stream name. The stream's schema can be found in the Azure portal. + *

    * *

    Upload logs to Azure Monitor

    * @@ -125,7 +164,15 @@ public void upload(String ruleId, String streamName, /** * Uploads logs to Azure Monitor with specified data collection rule id and stream name. The input logs may be * too large to be sent as a single request to the Azure Monitor service. In such cases, this method will split - * the input logs into multiple smaller requests before sending to the service. + * the input logs into multiple smaller requests before sending to the service. This method will block until all + * the logs are uploaded or an error occurs. If an {@link LogsUploadOptions#setLogsUploadErrorConsumer(Consumer) error handler} is set, + * then the service errors are surfaced to the error handler and this method won't throw an exception. + * + *

    + * Each log in the input collection must be a valid JSON object. The JSON object should match the + * schema defined + * by the stream name. The stream's schema can be found in the Azure portal. + *

    * * @param ruleId the data collection rule id that is configured to collect and transform the logs. * @param streamName the stream name configured in data collection rule that matches defines the structure of the @@ -199,7 +246,17 @@ private UploadLogsResponseHolder uploadToService(String ruleId, String streamNam } /** - * See error response code and error response message for more detail. + * This method is used to upload logs to Azure Monitor Log Analytics with specified data collection rule id and stream name. This + * upload method provides a more granular control of the HTTP request sent to the service. Use {@link RequestOptions} + * to configure the HTTP request. + * + *

    + * The input logs should be a JSON array with each element in the array + * matching the schema defined + * by the stream name. The stream's schema can be found in the Azure portal. This content will be gzipped before sending to the service. + * If the content is already gzipped, then set the {@code Content-Encoding} header to {@code gzip} using {@link RequestOptions#setHeader(HttpHeaderName, String) requestOptions} + * and pass the content as is. + *

    * *

    Header Parameters * diff --git a/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionClientBuilder.java b/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionClientBuilder.java index 2be134357337..7e2491d133f4 100644 --- a/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionClientBuilder.java +++ b/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/LogsIngestionClientBuilder.java @@ -25,9 +25,17 @@ import java.net.URL; /** - * Fluent builder for creating instances of {@link LogsIngestionClient} and {@link LogsIngestionAsyncClient}. To - * create a client, {@link #endpoint data collection endpoint} and {@link #credential(TokenCredential) - * AAD token} are required. + * Fluent builder for creating instances of {@link LogsIngestionClient} and {@link LogsIngestionAsyncClient}. The + * builder provides various options to customize the client as per your requirements. + * + *

    There are two required properties that should be set to build a client: + *

      + *
    1. {@code endpoint} - The data collection endpoint. + * See {@link LogsIngestionClientBuilder#endpoint(String) endpoint} method for more details.
    2. + *
    3. {@code credential} - The AAD authentication credential that has the "Monitoring Metrics Publisher" role assigned to it. + * Azure Identity + * provides a variety of AAD credential types that can be used. See {@link LogsIngestionClientBuilder#credential(TokenCredential) credential } method for more details.
    4. + *
    * *

    Instantiating an asynchronous Logs ingestion client

    * @@ -59,8 +67,8 @@ public final class LogsIngestionClientBuilder implements ConfigurationTraitdata collection endpoint. + * @param endpoint the data collection endpoint. * @return the updated {@link LogsIngestionClientBuilder}. */ @Override @@ -76,9 +84,7 @@ public LogsIngestionClientBuilder endpoint(String endpoint) { } /** - * Sets The HTTP pipeline to send requests through. - * @param pipeline the pipeline value. - * @return the updated {@link LogsIngestionClientBuilder}. + * {@inheritDoc} */ @Override public LogsIngestionClientBuilder pipeline(HttpPipeline pipeline) { @@ -87,9 +93,7 @@ public LogsIngestionClientBuilder pipeline(HttpPipeline pipeline) { } /** - * Sets The HTTP client used to send the request. - * @param httpClient the httpClient value. - * @return the updated {@link LogsIngestionClientBuilder}. + * {@inheritDoc} */ @Override public LogsIngestionClientBuilder httpClient(HttpClient httpClient) { @@ -98,9 +102,7 @@ public LogsIngestionClientBuilder httpClient(HttpClient httpClient) { } /** - * Sets The configuration store that is used during construction of the service client. - * @param configuration the configuration value. - * @return the updated {@link LogsIngestionClientBuilder}. + * {@inheritDoc} */ @Override public LogsIngestionClientBuilder configuration(Configuration configuration) { @@ -109,9 +111,7 @@ public LogsIngestionClientBuilder configuration(Configuration configuration) { } /** - * Sets The logging configuration for HTTP requests and responses. - * @param httpLogOptions the httpLogOptions value. - * @return the updated {@link LogsIngestionClientBuilder}. + * {@inheritDoc} */ @Override public LogsIngestionClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { @@ -130,9 +130,7 @@ public LogsIngestionClientBuilder retryPolicy(RetryPolicy retryPolicy) { } /** - * Adds a custom Http pipeline policy. - * @param customPolicy The custom Http pipeline policy to add. - * @return the updated {@link LogsIngestionClientBuilder}. + * {@inheritDoc} */ @Override public LogsIngestionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { @@ -141,9 +139,7 @@ public LogsIngestionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { } /** - * Sets the retry options for this client. - * @param retryOptions the retry options for this client. - * @return the updated {@link LogsIngestionClientBuilder}. + * {@inheritDoc} */ @Override public LogsIngestionClientBuilder retryOptions(RetryOptions retryOptions) { @@ -152,7 +148,10 @@ public LogsIngestionClientBuilder retryOptions(RetryOptions retryOptions) { } /** - * Sets The TokenCredential used for authentication. + * Sets the AAD authentication credential that has the "Monitoring Metrics Publisher" role assigned to it. + * Azure Identity + * provides a variety of AAD credential types that can be used. + * * @param tokenCredential the tokenCredential value. * @return the updated {@link LogsIngestionClientBuilder}. */ @@ -164,9 +163,7 @@ public LogsIngestionClientBuilder credential(TokenCredential tokenCredential) { } /** - * Set the {@link ClientOptions} used for creating the client. - * @param clientOptions The {@link ClientOptions}. - * @return the updated {@link LogsIngestionClientBuilder}. + * {@inheritDoc} */ @Override public LogsIngestionClientBuilder clientOptions(ClientOptions clientOptions) { @@ -175,7 +172,9 @@ public LogsIngestionClientBuilder clientOptions(ClientOptions clientOptions) { } /** - * The service version to use when creating the client. + * The service version to use when creating the client. By default, the latest service version is used. + * This is the value returned by the {@link LogsIngestionServiceVersion#getLatest() getLatest} method. + * * @param serviceVersion The {@link LogsIngestionServiceVersion}. * @return the updated {@link LogsIngestionClientBuilder}. */ diff --git a/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/package-info.java b/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/package-info.java index 5c2cc6c1c015..c9c525e63a42 100644 --- a/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/package-info.java +++ b/sdk/monitor/azure-monitor-ingestion/src/main/java/com/azure/monitor/ingestion/package-info.java @@ -2,6 +2,56 @@ // Licensed under the MIT License. /** - * Package containing client classes for uploading logs to Azure Monitor. + * The Azure Monitor Ingestion client library is used to send custom logs to an [Azure Monitor](https://learn.microsoft.com/azure/azure-monitor/overview) + * Log Analytics workspace. + * + *

    Getting Started

    + * + *

    Create the client

    + * An authenticated client is required to upload logs to Azure Monitor Log Analytics workspace. This package includes both synchronous and + * asynchronous forms of the clients. Use {@link com.azure.monitor.ingestion.LogsIngestionClientBuilder LogsIngestionClientBuilder} to + * customize and create an instance of {@link com.azure.monitor.ingestion.LogsIngestionClient LogsIngestionClient} or + * {@link com.azure.monitor.ingestion.LogsIngestionAsyncClient LogsIngestionAsyncClient}. + * + *

    Authenticate the client

    + *

    + * The {@code LogsIngestionClient} and {@code LogsIngestionAsyncClient} can be authenticated using Azure Active Directory. + * To authenticate with Azure Active Directory, create a {@link com.azure.core.credential.TokenCredential TokenCredential} + * that can be passed to the {@code LogsIngestionClientBuilder}. The Azure Identity library provides implementations of + * {@code TokenCredential} for multiple authentication flows. See + * Azure Identity + * for more information. + * + *

    Key Concepts

    + *

    Data Collection Endpoint

    + * Data Collection Endpoints (DCEs) allow you to uniquely configure ingestion settings for Azure Monitor. + * This article + * provides an overview of data collection endpoints including their contents and structure and how you can create and work with them. + * + * + *

    Data Collection Rule

    + *

    + * Data collection rules (DCR) define data collected by Azure Monitor and specify how and where that data should be sent + * or stored. The REST API call must specify a DCR to use. A single DCE can support multiple DCRs, so you can specify a different DCR for different sources and target tables. + *

    + * The DCR must understand the structure of the input data and the structure of the target table. If the two don't match, + * it can use a transformation to convert the source data to match the target table. You may also use the transform to filter source data and perform any other calculations or conversions. + *

    + * For more details, see Data collection rules + * in Azure Monitor. For information on how to retrieve a DCR ID, + * see this tutorial. + * + *

    Log Analytics Workspace Tables

    + * Custom logs can send data to any custom table that you create and to certain built-in tables in your Log Analytics + * workspace. The target table must exist before you can send data to it. The following built-in tables are currently supported: + *
      + *
    1. CommonSecurityLog
    2. + *
    3. SecurityEvents
    4. + *
    5. Syslog
    6. + *
    7. WindowsEvents
    8. + *
    + *

    Logs retrieval

    + * The logs that were uploaded using this library can be queried using the + * Azure Monitor Query client library. */ package com.azure.monitor.ingestion; diff --git a/sdk/monitor/azure-monitor-ingestion/src/samples/java/com/azure/monitor/ingestion/ReadmeSamples.java b/sdk/monitor/azure-monitor-ingestion/src/samples/java/com/azure/monitor/ingestion/ReadmeSamples.java index a9a7592731a9..4fe706484b9e 100644 --- a/sdk/monitor/azure-monitor-ingestion/src/samples/java/com/azure/monitor/ingestion/ReadmeSamples.java +++ b/sdk/monitor/azure-monitor-ingestion/src/samples/java/com/azure/monitor/ingestion/ReadmeSamples.java @@ -53,7 +53,7 @@ public void uploadLogs() { DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); LogsIngestionClient client = new LogsIngestionClientBuilder() - .endpoint("") .credential(tokenCredential) .buildClient(); @@ -71,7 +71,7 @@ public void uploadLogsWithMaxConcurrency() { DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); LogsIngestionClient client = new LogsIngestionClientBuilder() - .endpoint("") .credential(tokenCredential) .buildClient(); @@ -93,7 +93,7 @@ public void uploadLogsWithErrorHandler() { DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); LogsIngestionClient client = new LogsIngestionClientBuilder() - .endpoint("") .credential(tokenCredential) .buildClient(); @@ -120,6 +120,7 @@ public void tsgEnableHttpLogging() { // BEGIN: readme-sample-enablehttplogging LogsIngestionClient logsIngestionClient = new LogsIngestionClientBuilder() + .endpoint("") .credential(credential) .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .buildClient(); diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml b/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml index 0d757b833438..0a6e552ab27e 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/pom.xml @@ -133,13 +133,13 @@ com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 test com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 test @@ -157,7 +157,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.16.9 + 1.17.0 test diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/statsbeat/CustomDimensions.java b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/statsbeat/CustomDimensions.java index bcad2abf6322..e3c54fc67427 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/statsbeat/CustomDimensions.java +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/statsbeat/CustomDimensions.java @@ -21,22 +21,22 @@ public class CustomDimensions { CustomDimensions() { String qualifiedSdkVersion = PropertyHelper.getQualifiedSdkVersionString(); - if (qualifiedSdkVersion.startsWith("awr")) { + if (qualifiedSdkVersion.startsWith("aw")) { resourceProvider = ResourceProvider.RP_APPSVC; operatingSystem = OperatingSystem.OS_WINDOWS; - } else if (qualifiedSdkVersion.startsWith("alr")) { + } else if (qualifiedSdkVersion.startsWith("al")) { resourceProvider = ResourceProvider.RP_APPSVC; operatingSystem = OperatingSystem.OS_LINUX; - } else if (qualifiedSdkVersion.startsWith("kwr")) { + } else if (qualifiedSdkVersion.startsWith("kw")) { resourceProvider = ResourceProvider.RP_AKS; operatingSystem = OperatingSystem.OS_WINDOWS; - } else if (qualifiedSdkVersion.startsWith("klr")) { + } else if (qualifiedSdkVersion.startsWith("kl")) { resourceProvider = ResourceProvider.RP_AKS; operatingSystem = OperatingSystem.OS_LINUX; - } else if (qualifiedSdkVersion.startsWith("fwr")) { + } else if (qualifiedSdkVersion.startsWith("fw")) { resourceProvider = ResourceProvider.RP_FUNCTIONS; operatingSystem = OperatingSystem.OS_WINDOWS; - } else if (qualifiedSdkVersion.startsWith("flr")) { + } else if (qualifiedSdkVersion.startsWith("fl")) { resourceProvider = ResourceProvider.RP_FUNCTIONS; operatingSystem = OperatingSystem.OS_LINUX; } else { @@ -47,7 +47,7 @@ public class CustomDimensions { sdkVersion = qualifiedSdkVersion.substring(qualifiedSdkVersion.lastIndexOf(':') + 1); runtimeVersion = System.getProperty("java.version"); - attachType = "codeless"; + attachType = RpAttachType.getRpAttachType(); language = "java"; } diff --git a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/statsbeat/RpAttachType.java b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/statsbeat/RpAttachType.java index ef91ae5d69db..4e3340dfa9c7 100644 --- a/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/statsbeat/RpAttachType.java +++ b/sdk/monitor/azure-monitor-opentelemetry-exporter/src/main/java/com/azure/monitor/opentelemetry/exporter/implementation/statsbeat/RpAttachType.java @@ -5,17 +5,22 @@ // Manual, StandaloneAuto, IntegratedAuto public enum RpAttachType { - MANUAL, // Manually writing code to start collecting telemetry, e.g. via azure-monitor-opentelemetry-exporter - STANDALONE_AUTO, // RP attach is enabled via a custom JAVA_OPTS - INTEGRATED_AUTO; // RP attach is on by default + MANUAL("Manual"), // Manually writing code to start collecting telemetry, e.g. via azure-monitor-opentelemetry-exporter + STANDALONE_AUTO("StandaloneAuto"), // RP attach is enabled via a custom JAVA_OPTS or on premise resources + INTEGRATED_AUTO("IntegratedAuto"); // RP attach is on by default private static volatile RpAttachType attachType; + private final String label; + + private RpAttachType(String label) { + this.label = label; + } public static void setRpAttachType(RpAttachType type) { attachType = type; } - public static RpAttachType getRpAttachType() { - return attachType; + public static String getRpAttachType() { + return attachType != null ? attachType.label : null; } } diff --git a/sdk/monitor/azure-monitor-query-perf/pom.xml b/sdk/monitor/azure-monitor-query-perf/pom.xml index 7a956ee3d552..039015ba3a83 100644 --- a/sdk/monitor/azure-monitor-query-perf/pom.xml +++ b/sdk/monitor/azure-monitor-query-perf/pom.xml @@ -31,7 +31,7 @@ com.azure azure-monitor-query - 1.3.0-beta.2 + 1.3.0-beta.3 com.azure diff --git a/sdk/monitor/azure-monitor-query/CHANGELOG.md b/sdk/monitor/azure-monitor-query/CHANGELOG.md index d2fe1bc3921c..955da2ab222c 100644 --- a/sdk/monitor/azure-monitor-query/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-query/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.3.0-beta.2 (Unreleased) +## 1.3.0-beta.3 (Unreleased) ### Features Added @@ -10,6 +10,29 @@ ### Other Changes +## 1.2.5 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + +## 1.3.0-beta.2 (2023-09-13) + +### Features Added + +- Added `MetricsQueryOptions` to `MetricsBatchQueryClient` and `MetricsBatchQueryAsyncClient` to support batch querying metrics with +additional options. + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.2.4 (2023-08-18) ### Other Changes diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index a6d76eccefae..a8e9dbfcafe3 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -66,7 +66,7 @@ add the direct dependency to your project as follows. com.azure azure-monitor-query - 1.3.0-beta.1 + 1.3.0-beta.2 ``` @@ -87,7 +87,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/monitor/azure-monitor-query/pom.xml b/sdk/monitor/azure-monitor-query/pom.xml index e9bafb3b71dd..3ef6fdc518e5 100644 --- a/sdk/monitor/azure-monitor-query/pom.xml +++ b/sdk/monitor/azure-monitor-query/pom.xml @@ -11,7 +11,7 @@ com.azure azure-monitor-query - 1.3.0-beta.2 + 1.3.0-beta.3 Microsoft Azure SDK for Azure Monitor Logs and Metrics Query This package contains the Microsoft Azure SDK for querying Azure Monitor's Logs and Metrics data sources. @@ -88,7 +88,7 @@ com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 test diff --git a/sdk/monitor/azure-monitor-query/src/samples/java/README.md b/sdk/monitor/azure-monitor-query/src/samples/java/README.md index fe63ac258c68..77e0760cdc88 100644 --- a/sdk/monitor/azure-monitor-query/src/samples/java/README.md +++ b/sdk/monitor/azure-monitor-query/src/samples/java/README.md @@ -41,12 +41,12 @@ This workaround allows you to avoid the cost of exporting data to a storage acco **Disclaimer:** This approach of splitting data retrieval into smaller queries is useful when dealing with a few GBs of data or a few million records per hour. For larger data sets, [exporting][logs_data_export] is recommended. -We've provided a sample that demonstrates how to split a large query into a batch query based on the number of rows. The sample can be found here. -We've also provided a sample that demonstrates how to split a large query into a batch query based on the size of the data returned. The sample can be found here. +We've provided a sample that demonstrates how to split a large query into a batch query based on the number of rows. The sample can be found [here][split_query_by_rows]. +We've also provided a sample that demonstrates how to split a large query into a batch query based on the size of the data returned. The sample can be found [here][split_query_by_bytes]. -These sample shows how to partition a large query into smaller queries using the `LogsBatchQuery` class. The partitioning is based on the timestamp "TimeGenerated". +These samples show how to partition a large query into smaller queries using the `LogsBatchQuery` class. The partitioning is based on the timestamp "TimeGenerated". -This sample is suitable for simple data retrieval queries that utilize a subset of KQL operators. The subset of supported KQL operators can be found [here][kql_language_subset]. +These samples are suitable for simple data retrieval queries that utilize a subset of KQL operators. The subset of supported KQL operators can be found [here][kql_language_subset]. ## Troubleshooting @@ -75,3 +75,5 @@ Guidelines][SDK_README_CONTRIBUTING] for more information. [monitor_service_limits]: https://learn.microsoft.com/azure/azure-monitor/service-limits#la-query-api [logs_data_export]: https://learn.microsoft.com/azure/azure-monitor/logs/logs-data-export?tabs=portal [kql_language_subset]: https://learn.microsoft.com/azure/azure-monitor/logs/basic-logs-query?tabs=portal-1#kql-language-limits +[split_query_by_rows]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-query/src/samples/java/com/azure/monitor/query/SplitQueryByRowCountSample.java +[split_query_by_bytes]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-monitor-query/src/samples/java/com/azure/monitor/query/SplitQueryByByteSizeSample.java diff --git a/sdk/openai/azure-ai-openai/CHANGELOG.md b/sdk/openai/azure-ai-openai/CHANGELOG.md index c82b24b6462f..17fd66287871 100644 --- a/sdk/openai/azure-ai-openai/CHANGELOG.md +++ b/sdk/openai/azure-ai-openai/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.5 (Unreleased) +## 1.0.0-beta.6 (Unreleased) ### Features Added @@ -10,6 +10,32 @@ ### Other Changes +## 1.0.0-beta.5 (2023-09-22) + +### Features Added + +- Added support for `Whisper` endpoints. +- Translation and Transcription of audio files is available. +- The above features are available both in Azure and non-Azure OpenAI. +- Added more convenience methods, which are wrappers around the existing`get{ChatCompletions|Completions|Embeddings}WithResponse` + methods with concrete data types instead of using `BinaryData` as the return data type. For example, a new method + introduced is + - Async: `Mono> getChatCompletionsWithResponse(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, RequestOptions requestOptions)` + - Sync: `Response getChatCompletionsWithResponse(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, RequestOptions requestOptions)` + + Same methods are added for `Completions` and `Embeddings` endpoints as well. + +### Breaking Changes + +- Replaced usage of class `AzureKeyCredential` by `KeyCredential`. + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.0.0-beta.4 (2023-08-28) ### Features Added diff --git a/sdk/openai/azure-ai-openai/README.md b/sdk/openai/azure-ai-openai/README.md index 2371d9320b52..413d05800f8b 100644 --- a/sdk/openai/azure-ai-openai/README.md +++ b/sdk/openai/azure-ai-openai/README.md @@ -19,6 +19,8 @@ For concrete examples you can have a look at the following links. Some of the mo * [Streaming chat completions sample](#streaming-chat-completions "Streaming chat completions") * [Embeddings sample](#text-embeddings "Text Embeddings") * [Image Generation sample](#image-generation "Image Generation") +* [Audio Transcription sample](#audio-transcription "Audio Transcription") +* [Audio Translation sample](#audio-translation "Audio Translation") If you want to see the full code for these snippets check out our [samples folder][samples_folder]. @@ -40,7 +42,7 @@ If you want to see the full code for these snippets check out our [samples folde com.azure azure-ai-openai - 1.0.0-beta.4 + 1.0.0-beta.5 ``` [//]: # ({x-version-update-end}) @@ -100,7 +102,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) @@ -150,6 +152,8 @@ The following sections provide several code snippets covering some of the most c * [Streaming chat completions sample](#streaming-chat-completions "Streaming chat completions") * [Embeddings sample](#text-embeddings "Text Embeddings") * [Image Generation sample](#image-generation "Image Generation") +* [Audio Transcription sample](#audio-transcription "Audio Transcription") +* [Audio Translation sample](#audio-translation "Audio Translation") ### Text completions @@ -286,6 +290,44 @@ for (ImageLocation imageLocation : images.getData()) { For a complete sample example, see sample [Image Generation][sample_image_generation]. +### Audio Transcription +The OpenAI service starts supporting `audio transcription` with the introduction of `Whisper` models. +The following code snippet shows how to use the service to transcribe audio. + +```java readme-sample-audioTranscription +String fileName = "{your-file-name}"; +Path filePath = Paths.get("{your-file-path}" + fileName); + +byte[] file = BinaryData.fromFile(filePath).toBytes(); +AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file) + .setResponseFormat(AudioTranscriptionFormat.JSON); + +AudioTranscription transcription = client.getAudioTranscription("{deploymentOrModelId}", fileName, transcriptionOptions); + +System.out.println("Transcription: " + transcription.getText()); +``` +For a complete sample example, see sample [Audio Transcription][sample_audio_transcription]. +Please refer to the service documentation for a conceptual discussion of [Whisper][microsoft_docs_whisper_model]. + +### Audio Translation +The OpenAI service starts supporting `audio translation` with the introduction of `Whisper` models. +The following code snippet shows how to use the service to translate audio. + +```java readme-sample-audioTranslation +String fileName = "{your-file-name}"; +Path filePath = Paths.get("{your-file-path}" + fileName); + +byte[] file = BinaryData.fromFile(filePath).toBytes(); +AudioTranslationOptions translationOptions = new AudioTranslationOptions(file) + .setResponseFormat(AudioTranslationFormat.JSON); + +AudioTranslation translation = client.getAudioTranslation("{deploymentOrModelId}", fileName, translationOptions); + +System.out.println("Translation: " + translation.getText()); +``` +For a complete sample example, see sample [Audio Translation][sample_audio_translation]. +Please refer to the service documentation for a conceptual discussion of [Whisper][microsoft_docs_whisper_model]. + ## Troubleshooting ### Enable client logging You can set the `AZURE_LOG_LEVEL` environment variable to view logging statements made in the client library. For @@ -327,6 +369,7 @@ For details on contributing to this repository, see the [contributing guide](htt [logLevels]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java [microsoft_docs_openai_completion]: https://learn.microsoft.com/azure/cognitive-services/openai/how-to/completions [microsoft_docs_openai_embedding]: https://learn.microsoft.com/azure/cognitive-services/openai/concepts/understand-embeddings +[microsoft_docs_whisper_model]: https://learn.microsoft.com/azure/ai-services/openai/whisper-quickstart?tabs=command-line [non_azure_openai_authentication]: https://platform.openai.com/docs/api-reference/authentication [performance_tuning]: https://github.com/Azure/azure-sdk-for-java/wiki/Performance-Tuning [product_documentation]: https://azure.microsoft.com/services/ @@ -342,6 +385,8 @@ For details on contributing to this repository, see the [contributing guide](htt [sample_get_completions_streaming]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetCompletionsStreamSample.java [sample_get_embedding]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetEmbeddingsSample.java [sample_image_generation]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetImagesSample.java +[sample_audio_transcription]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranscriptionSample.java +[sample_audio_translation]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranslationSample.java [openai_client_async]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIAsyncClient.java [openai_client_builder]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java [openai_client_sync]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClient.java diff --git a/sdk/openai/azure-ai-openai/assets.json b/sdk/openai/azure-ai-openai/assets.json index 4a830f321b44..510bfafa7ca9 100644 --- a/sdk/openai/azure-ai-openai/assets.json +++ b/sdk/openai/azure-ai-openai/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/openai/azure-ai-openai", - "Tag": "java/openai/azure-ai-openai_57107e7a09" + "Tag": "java/openai/azure-ai-openai_2290060af1" } diff --git a/sdk/openai/azure-ai-openai/pom.xml b/sdk/openai/azure-ai-openai/pom.xml index a4faf8030825..3307c124475f 100644 --- a/sdk/openai/azure-ai-openai/pom.xml +++ b/sdk/openai/azure-ai-openai/pom.xml @@ -14,7 +14,7 @@ com.azure azure-ai-openai - 1.0.0-beta.5 + 1.0.0-beta.6 jar Microsoft Azure Client Library For OpenAI @@ -67,11 +67,6 @@ azure-core-http-netty 1.13.7 - - com.azure - azure-core-experimental - 1.0.0-beta.43 - diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIAsyncClient.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIAsyncClient.java index 42355fa64518..cd4833a1cd28 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIAsyncClient.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIAsyncClient.java @@ -3,10 +3,22 @@ // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.ai.openai; +import static com.azure.ai.openai.implementation.AudioTranscriptionValidator.validateAudioResponseFormatForTranscription; +import static com.azure.ai.openai.implementation.AudioTranscriptionValidator.validateAudioResponseFormatForTranscriptionText; +import static com.azure.ai.openai.implementation.AudioTranslationValidator.validateAudioResponseFormatForTranslation; +import static com.azure.ai.openai.implementation.AudioTranslationValidator.validateAudioResponseFormatForTranslationText; +import static com.azure.core.util.FluxUtil.monoError; + import com.azure.ai.openai.implementation.CompletionsUtils; +import com.azure.ai.openai.implementation.MultipartDataHelper; +import com.azure.ai.openai.implementation.MultipartDataSerializationResult; import com.azure.ai.openai.implementation.NonAzureOpenAIClientImpl; import com.azure.ai.openai.implementation.OpenAIClientImpl; import com.azure.ai.openai.implementation.OpenAIServerSentEvents; +import com.azure.ai.openai.models.AudioTranscription; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.ai.openai.models.AudioTranslation; +import com.azure.ai.openai.models.AudioTranslationOptions; import com.azure.ai.openai.models.ChatCompletions; import com.azure.ai.openai.models.ChatCompletionsOptions; import com.azure.ai.openai.models.Completions; @@ -26,8 +38,10 @@ import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.BinaryData; import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; @@ -39,6 +53,8 @@ public final class OpenAIAsyncClient { @Generated private final OpenAIClientImpl serviceClient; + private static final ClientLogger LOGGER = new ClientLogger(OpenAIAsyncClient.class); + private final NonAzureOpenAIClientImpl openAIServiceClient; /** @@ -298,6 +314,235 @@ public Mono> getChatCompletionsWithResponse( deploymentOrModelName, chatCompletionsOptions, requestOptions); } + /** + * Return the embeddings for a given prompt. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     user: String (Optional)
    +     *     model: String (Optional)
    +     *     input (Required): [
    +     *         String (Required)
    +     *     ]
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     data (Required): [
    +     *          (Required){
    +     *             embedding (Required): [
    +     *                 double (Required)
    +     *             ]
    +     *             index: int (Required)
    +     *         }
    +     *     ]
    +     *     usage (Required): {
    +     *         prompt_tokens: int (Required)
    +     *         total_tokens: int (Required)
    +     *     }
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param embeddingsOptions The configuration information for an embeddings request. Embeddings measure the + * relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar + * scenarios. + * @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 representation of the response data from an embeddings request. Embeddings measure the relatedness of + * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getEmbeddingsWithResponse( + String deploymentOrModelName, EmbeddingsOptions embeddingsOptions, RequestOptions requestOptions) { + return getEmbeddingsWithResponse( + deploymentOrModelName, BinaryData.fromObject(embeddingsOptions), requestOptions) + .map(response -> new SimpleResponse<>(response, response.getValue().toObject(Embeddings.class))); + } + + /** + * Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text + * that continues from or "completes" provided prompt data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     prompt (Required): [
    +     *         String (Required)
    +     *     ]
    +     *     max_tokens: Integer (Optional)
    +     *     temperature: Double (Optional)
    +     *     top_p: Double (Optional)
    +     *     logit_bias (Optional): {
    +     *         String: int (Optional)
    +     *     }
    +     *     user: String (Optional)
    +     *     n: Integer (Optional)
    +     *     logprobs: Integer (Optional)
    +     *     echo: Boolean (Optional)
    +     *     stop (Optional): [
    +     *         String (Optional)
    +     *     ]
    +     *     presence_penalty: Double (Optional)
    +     *     frequency_penalty: Double (Optional)
    +     *     best_of: Integer (Optional)
    +     *     stream: Boolean (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     id: String (Required)
    +     *     created: int (Required)
    +     *     choices (Required): [
    +     *          (Required){
    +     *             text: String (Required)
    +     *             index: int (Required)
    +     *             logprobs (Required): {
    +     *                 tokens (Required): [
    +     *                     String (Required)
    +     *                 ]
    +     *                 token_logprobs (Required): [
    +     *                     double (Required)
    +     *                 ]
    +     *                 top_logprobs (Required): [
    +     *                      (Required){
    +     *                         String: double (Required)
    +     *                     }
    +     *                 ]
    +     *                 text_offset (Required): [
    +     *                     int (Required)
    +     *                 ]
    +     *             }
    +     *             finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
    +     *         }
    +     *     ]
    +     *     usage (Required): {
    +     *         completion_tokens: int (Required)
    +     *         prompt_tokens: int (Required)
    +     *         total_tokens: int (Required)
    +     *     }
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param completionsOptions The configuration information for a completions request. Completions support a wide + * variety of tasks and generate text that continues from or "completes" provided prompt data. + * @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 completions for the provided input prompts. Completions support a wide variety of tasks and generate text + * that continues from or "completes" provided prompt data along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCompletionsWithResponse( + String deploymentOrModelName, CompletionsOptions completionsOptions, RequestOptions requestOptions) { + return getCompletionsWithResponse( + deploymentOrModelName, BinaryData.fromObject(completionsOptions), requestOptions) + .map(response -> new SimpleResponse<>(response, response.getValue().toObject(Completions.class))); + } + + /** + * Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate + * text that continues from or "completes" provided prompt data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     messages (Required): [
    +     *          (Required){
    +     *             role: String(system/assistant/user) (Required)
    +     *             content: String (Optional)
    +     *         }
    +     *     ]
    +     *     max_tokens: Integer (Optional)
    +     *     temperature: Double (Optional)
    +     *     top_p: Double (Optional)
    +     *     logit_bias (Optional): {
    +     *         String: int (Optional)
    +     *     }
    +     *     user: String (Optional)
    +     *     n: Integer (Optional)
    +     *     stop (Optional): [
    +     *         String (Optional)
    +     *     ]
    +     *     presence_penalty: Double (Optional)
    +     *     frequency_penalty: Double (Optional)
    +     *     stream: Boolean (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     id: String (Required)
    +     *     created: int (Required)
    +     *     choices (Required): [
    +     *          (Required){
    +     *             message (Optional): {
    +     *                 role: String(system/assistant/user) (Required)
    +     *                 content: String (Optional)
    +     *             }
    +     *             index: int (Required)
    +     *             finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
    +     *             delta (Optional): {
    +     *                 role: String(system/assistant/user) (Optional)
    +     *                 content: String (Optional)
    +     *             }
    +     *         }
    +     *     ]
    +     *     usage (Required): {
    +     *         completion_tokens: int (Required)
    +     *         prompt_tokens: int (Required)
    +     *         total_tokens: int (Required)
    +     *     }
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param chatCompletionsOptions The configuration information for a chat completions request. Completions support a + * wide variety of tasks and generate text that continues from or "completes" provided prompt data. + * @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 chat completions for the provided chat messages. Completions support a wide variety of tasks and generate + * text that continues from or "completes" provided prompt data along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getChatCompletionsWithResponse( + String deploymentOrModelName, + ChatCompletionsOptions chatCompletionsOptions, + RequestOptions requestOptions) { + return getChatCompletionsWithResponse( + deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions) + .map(response -> new SimpleResponse<>(response, response.getValue().toObject(ChatCompletions.class))); + } + /** * Return the embeddings for a given prompt. * @@ -428,10 +673,8 @@ public Mono getChatCompletions( String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions) { RequestOptions requestOptions = new RequestOptions(); if (chatCompletionsOptions.getDataSources() == null || chatCompletionsOptions.getDataSources().isEmpty()) { - return getChatCompletionsWithResponse( - deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ChatCompletions.class)); + return getChatCompletionsWithResponse(deploymentOrModelName, chatCompletionsOptions, requestOptions) + .flatMap(FluxUtil::toMono); } else { return getChatCompletionsWithAzureExtensionsWithResponse( deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions) @@ -530,7 +773,13 @@ public Mono getImages(ImageGenerationOptions imageGenerationOptio *
    {@code
          * {
          *     id: String (Required)
    -     *     status: String (Required)
    +     *     created: long (Required)
    +     *     expires: Long (Optional)
    +     *     result (Optional): {
    +     *         created: long (Required)
    +     *         data: DataModelBase (Required)
    +     *     }
    +     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
          *     error (Optional): {
          *         code: String (Required)
          *         message: String (Required)
    @@ -552,7 +801,8 @@ public Mono getImages(ImageGenerationOptions imageGenerationOptio
          * @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 the {@link PollerFlux} for polling of status details for long running operations.
    +     * @return the {@link PollerFlux} for polling of a polling status update or final response payload for an image
    +     *     operation.
          */
         @Generated
         @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    @@ -651,10 +901,22 @@ PollerFlux beginBeginAzureBatchImageGeneration(
          *                 violence (Optional): (recursive schema, see violence above)
          *                 hate (Optional): (recursive schema, see hate above)
          *                 self_harm (Optional): (recursive schema, see self_harm above)
    +     *                 error (Optional): {
    +     *                     code: String (Required)
    +     *                     message: String (Required)
    +     *                     target: String (Optional)
    +     *                     details (Optional): [
    +     *                         (recursive schema, see above)
    +     *                     ]
    +     *                     innererror (Optional): {
    +     *                         code: String (Optional)
    +     *                         innererror (Optional): (recursive schema, see innererror above)
    +     *                     }
    +     *                 }
          *             }
          *         }
          *     ]
    -     *     prompt_annotations (Optional): [
    +     *     prompt_filter_results (Optional): [
          *          (Optional){
          *             prompt_index: int (Required)
          *             content_filter_results (Optional): (recursive schema, see content_filter_results above)
    @@ -688,4 +950,608 @@ Mono> getChatCompletionsWithAzureExtensionsWithResponse(
             return this.serviceClient.getChatCompletionsWithAzureExtensionsWithResponseAsync(
                     deploymentOrModelName, chatCompletionsOptions, requestOptions);
         }
    +
    +    /**
    +     * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
    +     * written language corresponding to the language it was spoken in.
    +     *
    +     * 

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranscriptionAsResponseObjectWithResponse( + String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + return this.serviceClient.getAudioTranscriptionAsResponseObjectWithResponseAsync( + deploymentOrModelName, audioTranscriptionOptions, requestOptions); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in + * the written language corresponding to the language it was spoken in. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions} + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return {@link AudioTranscription} transcribed text and associated metadata from provided spoken audio data on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAudioTranscription( + String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions) { + return getAudioTranscriptionWithResponse(deploymentOrModelName, fileName, audioTranscriptionOptions, null) + .map(Response::getValue); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in + * the written language corresponding to the language it was spoken in. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions} + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return {@link AudioTranscription} transcribed text and associated metadata from provided spoken audio data on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranscriptionWithResponse( + String deploymentOrModelName, + String fileName, + AudioTranscriptionOptions audioTranscriptionOptions, + RequestOptions requestOptions) { + // checking allowed formats for a JSON response + try { + validateAudioResponseFormatForTranscription(audioTranscriptionOptions); + } catch (IllegalArgumentException e) { + return monoError(LOGGER, e); + } + // embedding the `model` in the request for non-Azure case + if (this.openAIServiceClient != null) { + audioTranscriptionOptions.setModel(deploymentOrModelName); + } + final MultipartDataHelper helper = new MultipartDataHelper(); + final MultipartDataSerializationResult result = helper.serializeRequest(audioTranscriptionOptions, fileName); + final BinaryData data = result.getData(); + requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary()); + Mono> response = + openAIServiceClient != null + ? this.openAIServiceClient.getAudioTranscriptionAsResponseObjectWithResponseAsync( + deploymentOrModelName, data, requestOptions) + : this.serviceClient.getAudioTranscriptionAsResponseObjectWithResponseAsync( + deploymentOrModelName, data, requestOptions); + return response.map( + responseBinaryData -> + new SimpleResponse<>( + responseBinaryData, responseBinaryData.getValue().toObject(AudioTranscription.class))); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in + * the written language corresponding to the language it was spoken in. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions} + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transcribed text and associated metadata from provided spoken audio data on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAudioTranscriptionText( + String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions) { + return getAudioTranscriptionTextWithResponse(deploymentOrModelName, fileName, audioTranscriptionOptions, null) + .map(Response::getValue); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in + * the written language corresponding to the language it was spoken in. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions} + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transcribed text and associated metadata from provided spoken audio file data along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranscriptionTextWithResponse( + String deploymentOrModelName, + String fileName, + AudioTranscriptionOptions audioTranscriptionOptions, + RequestOptions requestOptions) { + // checking allowed formats for a plain text response + try { + validateAudioResponseFormatForTranscriptionText(audioTranscriptionOptions); + } catch (IllegalArgumentException e) { + return monoError(LOGGER, e); + } + // embedding the `model` in the request for non-Azure case + if (this.openAIServiceClient != null) { + audioTranscriptionOptions.setModel(deploymentOrModelName); + } + final MultipartDataHelper helper = new MultipartDataHelper(); + final MultipartDataSerializationResult result = helper.serializeRequest(audioTranscriptionOptions, fileName); + final BinaryData data = result.getData(); + requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary()); + Mono> response = + openAIServiceClient != null + ? this.openAIServiceClient.getAudioTranscriptionAsPlainTextWithResponseAsync( + deploymentOrModelName, data, requestOptions) + : this.serviceClient.getAudioTranscriptionAsPlainTextWithResponseAsync( + deploymentOrModelName, data, requestOptions); + return response.map(dataResponse -> new SimpleResponse<>(dataResponse, dataResponse.getValue().toString())); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio file data. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions} + * @param audioTranslationOptions The configuration information for an audio translation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return {@link AudioTranslation} english language transcribed text and associated metadata from provided spoken + * audio file data on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAudioTranslation( + String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions) { + return getAudioTranslationWithResponse(deploymentOrModelName, fileName, audioTranslationOptions, null) + .map(Response::getValue); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio file data. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions} + * @param audioTranslationOptions The configuration information for an audio translation request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return {@link AudioTranslation} english language transcribed text and associated metadata from provided spoken + * audio file data along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranslationWithResponse( + String deploymentOrModelName, + String fileName, + AudioTranslationOptions audioTranslationOptions, + RequestOptions requestOptions) { + // checking allowed formats for a JSON response + try { + validateAudioResponseFormatForTranslation(audioTranslationOptions); + } catch (IllegalArgumentException e) { + return monoError(LOGGER, e); + } + // embedding the `model` in the request for non-Azure case + if (this.openAIServiceClient != null) { + audioTranslationOptions.setModel(deploymentOrModelName); + } + final MultipartDataHelper helper = new MultipartDataHelper(); + final MultipartDataSerializationResult result = helper.serializeRequest(audioTranslationOptions, fileName); + final BinaryData data = result.getData(); + requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary()); + Mono> response = + openAIServiceClient != null + ? this.openAIServiceClient.getAudioTranslationAsResponseObjectWithResponseAsync( + deploymentOrModelName, data, requestOptions) + : this.serviceClient.getAudioTranslationAsResponseObjectWithResponseAsync( + deploymentOrModelName, data, requestOptions); + return response.map( + responseBinaryData -> + new SimpleResponse<>( + responseBinaryData, responseBinaryData.getValue().toObject(AudioTranslation.class))); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio file data. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return english language transcribed text and associated metadata from provided spoken audio file data on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAudioTranslationText( + String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions) { + return getAudioTranslationTextWithResponse(deploymentOrModelName, fileName, audioTranslationOptions, null) + .map(Response::getValue); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio file data. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return english language transcribed text and associated metadata from provided spoken audio file data on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranslationTextWithResponse( + String deploymentOrModelName, + String fileName, + AudioTranslationOptions audioTranslationOptions, + RequestOptions requestOptions) { + // checking allowed formats for a JSON response + try { + validateAudioResponseFormatForTranslationText(audioTranslationOptions); + } catch (IllegalArgumentException e) { + return monoError(LOGGER, e); + } + // embedding the `model` in the request for non-Azure case + if (this.openAIServiceClient != null) { + audioTranslationOptions.setModel(deploymentOrModelName); + } + final MultipartDataHelper helper = new MultipartDataHelper(); + final MultipartDataSerializationResult result = helper.serializeRequest(audioTranslationOptions, fileName); + final BinaryData data = result.getData(); + requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary()); + Mono> response = + openAIServiceClient != null + ? this.openAIServiceClient.getAudioTranslationAsPlainTextWithResponseAsync( + deploymentOrModelName, data, requestOptions) + : this.serviceClient.getAudioTranslationAsPlainTextWithResponseAsync( + deploymentOrModelName, data, requestOptions); + return response.map( + responseBinaryData -> + new SimpleResponse<>(responseBinaryData, responseBinaryData.getValue().toString())); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranscriptionAsPlainTextWithResponse( + String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + return this.serviceClient.getAudioTranscriptionAsPlainTextWithResponseAsync( + deploymentOrModelName, audioTranscriptionOptions, requestOptions); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranslationAsResponseObjectWithResponse( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + return this.serviceClient.getAudioTranslationAsResponseObjectWithResponseAsync( + deploymentOrModelName, audioTranslationOptions, requestOptions); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranslationAsPlainTextWithResponse( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + return this.serviceClient.getAudioTranslationAsPlainTextWithResponseAsync( + deploymentOrModelName, audioTranslationOptions, requestOptions); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transcribed text and associated metadata from provided spoken audio data on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAudioTranscriptionAsResponseObject( + String deploymentOrModelName, AudioTranscriptionOptions audioTranscriptionOptions) { + // Generated convenience method for getAudioTranscriptionAsResponseObjectWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAudioTranscriptionAsResponseObjectWithResponse( + deploymentOrModelName, BinaryData.fromObject(audioTranscriptionOptions), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AudioTranscription.class)); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transcribed text and associated metadata from provided spoken audio data on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAudioTranscriptionAsPlainText( + String deploymentOrModelName, AudioTranscriptionOptions audioTranscriptionOptions) { + // Generated convenience method for getAudioTranscriptionAsPlainTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAudioTranscriptionAsPlainTextWithResponse( + deploymentOrModelName, BinaryData.fromObject(audioTranscriptionOptions), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(String.class)); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return english language transcribed text and associated metadata from provided spoken audio data on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAudioTranslationAsResponseObject( + String deploymentOrModelName, AudioTranslationOptions audioTranslationOptions) { + // Generated convenience method for getAudioTranslationAsResponseObjectWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAudioTranslationAsResponseObjectWithResponse( + deploymentOrModelName, BinaryData.fromObject(audioTranslationOptions), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AudioTranslation.class)); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return english language transcribed text and associated metadata from provided spoken audio data on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAudioTranslationAsPlainText( + String deploymentOrModelName, AudioTranslationOptions audioTranslationOptions) { + // Generated convenience method for getAudioTranslationAsPlainTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAudioTranslationAsPlainTextWithResponse( + deploymentOrModelName, BinaryData.fromObject(audioTranslationOptions), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(String.class)); + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClient.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClient.java index 138b05addadc..d0212436b147 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClient.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClient.java @@ -3,10 +3,21 @@ // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.ai.openai; +import static com.azure.ai.openai.implementation.AudioTranscriptionValidator.validateAudioResponseFormatForTranscription; +import static com.azure.ai.openai.implementation.AudioTranscriptionValidator.validateAudioResponseFormatForTranscriptionText; +import static com.azure.ai.openai.implementation.AudioTranslationValidator.validateAudioResponseFormatForTranslation; +import static com.azure.ai.openai.implementation.AudioTranslationValidator.validateAudioResponseFormatForTranslationText; + import com.azure.ai.openai.implementation.CompletionsUtils; +import com.azure.ai.openai.implementation.MultipartDataHelper; +import com.azure.ai.openai.implementation.MultipartDataSerializationResult; import com.azure.ai.openai.implementation.NonAzureOpenAIClientImpl; import com.azure.ai.openai.implementation.OpenAIClientImpl; import com.azure.ai.openai.implementation.OpenAIServerSentEvents; +import com.azure.ai.openai.models.AudioTranscription; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.ai.openai.models.AudioTranslation; +import com.azure.ai.openai.models.AudioTranslationOptions; import com.azure.ai.openai.models.ChatCompletions; import com.azure.ai.openai.models.ChatCompletionsOptions; import com.azure.ai.openai.models.Completions; @@ -26,6 +37,7 @@ import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.BinaryData; import com.azure.core.util.IterableStream; import com.azure.core.util.logging.ClientLogger; @@ -292,6 +304,236 @@ public Response getChatCompletionsWithResponse( deploymentOrModelName, chatCompletionsOptions, requestOptions); } + /** + * Return the embeddings for a given prompt. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     user: String (Optional)
    +     *     model: String (Optional)
    +     *     input (Required): [
    +     *         String (Required)
    +     *     ]
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     data (Required): [
    +     *          (Required){
    +     *             embedding (Required): [
    +     *                 double (Required)
    +     *             ]
    +     *             index: int (Required)
    +     *         }
    +     *     ]
    +     *     usage (Required): {
    +     *         prompt_tokens: int (Required)
    +     *         total_tokens: int (Required)
    +     *     }
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param embeddingsOptions The configuration information for an embeddings request. Embeddings measure the + * relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar + * scenarios. + * @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 representation of the response data from an embeddings request. Embeddings measure the relatedness of + * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEmbeddingsWithResponse( + String deploymentOrModelName, EmbeddingsOptions embeddingsOptions, RequestOptions requestOptions) { + Response response = + getEmbeddingsWithResponse( + deploymentOrModelName, BinaryData.fromObject(embeddingsOptions), requestOptions); + return new SimpleResponse<>(response, response.getValue().toObject(Embeddings.class)); + } + + /** + * Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text + * that continues from or "completes" provided prompt data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     prompt (Required): [
    +     *         String (Required)
    +     *     ]
    +     *     max_tokens: Integer (Optional)
    +     *     temperature: Double (Optional)
    +     *     top_p: Double (Optional)
    +     *     logit_bias (Optional): {
    +     *         String: int (Optional)
    +     *     }
    +     *     user: String (Optional)
    +     *     n: Integer (Optional)
    +     *     logprobs: Integer (Optional)
    +     *     echo: Boolean (Optional)
    +     *     stop (Optional): [
    +     *         String (Optional)
    +     *     ]
    +     *     presence_penalty: Double (Optional)
    +     *     frequency_penalty: Double (Optional)
    +     *     best_of: Integer (Optional)
    +     *     stream: Boolean (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     id: String (Required)
    +     *     created: int (Required)
    +     *     choices (Required): [
    +     *          (Required){
    +     *             text: String (Required)
    +     *             index: int (Required)
    +     *             logprobs (Required): {
    +     *                 tokens (Required): [
    +     *                     String (Required)
    +     *                 ]
    +     *                 token_logprobs (Required): [
    +     *                     double (Required)
    +     *                 ]
    +     *                 top_logprobs (Required): [
    +     *                      (Required){
    +     *                         String: double (Required)
    +     *                     }
    +     *                 ]
    +     *                 text_offset (Required): [
    +     *                     int (Required)
    +     *                 ]
    +     *             }
    +     *             finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
    +     *         }
    +     *     ]
    +     *     usage (Required): {
    +     *         completion_tokens: int (Required)
    +     *         prompt_tokens: int (Required)
    +     *         total_tokens: int (Required)
    +     *     }
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param completionsOptions The configuration information for a completions request. Completions support a wide + * variety of tasks and generate text that continues from or "completes" provided prompt data. + * @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 completions for the provided input prompts. Completions support a wide variety of tasks and generate text + * that continues from or "completes" provided prompt data along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCompletionsWithResponse( + String deploymentOrModelName, CompletionsOptions completionsOptions, RequestOptions requestOptions) { + Response response = + getCompletionsWithResponse( + deploymentOrModelName, BinaryData.fromObject(completionsOptions), requestOptions); + return new SimpleResponse<>(response, response.getValue().toObject(Completions.class)); + } + + /** + * Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate + * text that continues from or "completes" provided prompt data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     messages (Required): [
    +     *          (Required){
    +     *             role: String(system/assistant/user) (Required)
    +     *             content: String (Optional)
    +     *         }
    +     *     ]
    +     *     max_tokens: Integer (Optional)
    +     *     temperature: Double (Optional)
    +     *     top_p: Double (Optional)
    +     *     logit_bias (Optional): {
    +     *         String: int (Optional)
    +     *     }
    +     *     user: String (Optional)
    +     *     n: Integer (Optional)
    +     *     stop (Optional): [
    +     *         String (Optional)
    +     *     ]
    +     *     presence_penalty: Double (Optional)
    +     *     frequency_penalty: Double (Optional)
    +     *     stream: Boolean (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     id: String (Required)
    +     *     created: int (Required)
    +     *     choices (Required): [
    +     *          (Required){
    +     *             message (Optional): {
    +     *                 role: String(system/assistant/user) (Required)
    +     *                 content: String (Optional)
    +     *             }
    +     *             index: int (Required)
    +     *             finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
    +     *             delta (Optional): {
    +     *                 role: String(system/assistant/user) (Optional)
    +     *                 content: String (Optional)
    +     *             }
    +     *         }
    +     *     ]
    +     *     usage (Required): {
    +     *         completion_tokens: int (Required)
    +     *         prompt_tokens: int (Required)
    +     *         total_tokens: int (Required)
    +     *     }
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param chatCompletionsOptions The configuration information for a chat completions request. Completions support a + * wide variety of tasks and generate text that continues from or "completes" provided prompt data. + * @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 chat completions for the provided chat messages. Completions support a wide variety of tasks and generate + * text that continues from or "completes" provided prompt data along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getChatCompletionsWithResponse( + String deploymentOrModelName, + ChatCompletionsOptions chatCompletionsOptions, + RequestOptions requestOptions) { + Response response = + getChatCompletionsWithResponse( + deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions); + return new SimpleResponse<>(response, response.getValue().toObject(ChatCompletions.class)); + } + /** * Return the embeddings for a given prompt. * @@ -423,10 +665,8 @@ public ChatCompletions getChatCompletions( String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions) { RequestOptions requestOptions = new RequestOptions(); if (chatCompletionsOptions.getDataSources() == null || chatCompletionsOptions.getDataSources().isEmpty()) { - return getChatCompletionsWithResponse( - deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions) - .getValue() - .toObject(ChatCompletions.class); + return getChatCompletionsWithResponse(deploymentOrModelName, chatCompletionsOptions, requestOptions) + .getValue(); } else { return getChatCompletionsWithAzureExtensionsWithResponse( deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions) @@ -529,7 +769,13 @@ public ImageResponse getImages(ImageGenerationOptions imageGenerationOptions) { *
    {@code
          * {
          *     id: String (Required)
    -     *     status: String (Required)
    +     *     created: long (Required)
    +     *     expires: Long (Optional)
    +     *     result (Optional): {
    +     *         created: long (Required)
    +     *         data: DataModelBase (Required)
    +     *     }
    +     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
          *     error (Optional): {
          *         code: String (Required)
          *         message: String (Required)
    @@ -551,7 +797,8 @@ public ImageResponse getImages(ImageGenerationOptions imageGenerationOptions) {
          * @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 the {@link SyncPoller} for polling of status details for long running operations.
    +     * @return the {@link SyncPoller} for polling of a polling status update or final response payload for an image
    +     *     operation.
          */
         @Generated
         @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    @@ -650,10 +897,22 @@ SyncPoller beginBeginAzureBatchImageGeneration(
          *                 violence (Optional): (recursive schema, see violence above)
          *                 hate (Optional): (recursive schema, see hate above)
          *                 self_harm (Optional): (recursive schema, see self_harm above)
    +     *                 error (Optional): {
    +     *                     code: String (Required)
    +     *                     message: String (Required)
    +     *                     target: String (Optional)
    +     *                     details (Optional): [
    +     *                         (recursive schema, see above)
    +     *                     ]
    +     *                     innererror (Optional): {
    +     *                         code: String (Optional)
    +     *                         innererror (Optional): (recursive schema, see innererror above)
    +     *                     }
    +     *                 }
          *             }
          *         }
          *     ]
    -     *     prompt_annotations (Optional): [
    +     *     prompt_filter_results (Optional): [
          *          (Optional){
          *             prompt_index: int (Required)
          *             content_filter_results (Optional): (recursive schema, see content_filter_results above)
    @@ -687,4 +946,574 @@ Response getChatCompletionsWithAzureExtensionsWithResponse(
             return this.serviceClient.getChatCompletionsWithAzureExtensionsWithResponse(
                     deploymentOrModelName, chatCompletionsOptions, requestOptions);
         }
    +
    +    /**
    +     * Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in
    +     * the written language corresponding to the language it was spoken in.
    +     *
    +     * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
    +     *     (when using non-Azure OpenAI) to use for this request.
    +     * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}.
    +     * @param audioTranscriptionOptions The configuration information for an audio transcription request.
    +     * @throws IllegalArgumentException thrown if parameters fail the validation.
    +     * @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.
    +     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
    +     * @return {@link AudioTranscription} transcribed text and associated metadata from provided spoken audio data.
    +     */
    +    @ServiceMethod(returns = ReturnType.SINGLE)
    +    public AudioTranscription getAudioTranscription(
    +            String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions) {
    +        return getAudioTranscriptionWithResponse(deploymentOrModelName, fileName, audioTranscriptionOptions, null)
    +                .getValue();
    +    }
    +
    +    /**
    +     * Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in
    +     * the written language corresponding to the language it was spoken in.
    +     *
    +     * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
    +     *     (when using non-Azure OpenAI) to use for this request.
    +     * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}.
    +     * @param audioTranscriptionOptions The configuration information for an audio transcription request.
    +     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
    +     * @throws IllegalArgumentException thrown if parameters fail the validation.
    +     * @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.
    +     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
    +     * @return {@link AudioTranscription} transcribed text and associated metadata from provided spoken audio data along
    +     *     with {@link Response}.
    +     */
    +    @ServiceMethod(returns = ReturnType.SINGLE)
    +    public Response getAudioTranscriptionWithResponse(
    +            String deploymentOrModelName,
    +            String fileName,
    +            AudioTranscriptionOptions audioTranscriptionOptions,
    +            RequestOptions requestOptions) {
    +        // checking allowed formats for a JSON response
    +        validateAudioResponseFormatForTranscription(audioTranscriptionOptions);
    +        // embedding the `model` in the request for non-Azure case
    +        if (this.openAIServiceClient != null) {
    +            audioTranscriptionOptions.setModel(deploymentOrModelName);
    +        }
    +        final MultipartDataHelper helper = new MultipartDataHelper();
    +        final MultipartDataSerializationResult result = helper.serializeRequest(audioTranscriptionOptions, fileName);
    +        final BinaryData data = result.getData();
    +        requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
    +        Response response =
    +                openAIServiceClient != null
    +                        ? this.openAIServiceClient.getAudioTranscriptionAsPlainTextWithResponse(
    +                                deploymentOrModelName, data, requestOptions)
    +                        : this.serviceClient.getAudioTranscriptionAsPlainTextWithResponse(
    +                                deploymentOrModelName, data, requestOptions);
    +        return new SimpleResponse<>(response, response.getValue().toObject(AudioTranscription.class));
    +    }
    +
    +    /**
    +     * Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in
    +     * the written language corresponding to the language it was spoken in.
    +     *
    +     * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
    +     *     (when using non-Azure OpenAI) to use for this request.
    +     * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}.
    +     * @param audioTranscriptionOptions The configuration information for an audio transcription request.
    +     * @throws IllegalArgumentException thrown if parameters fail the validation.
    +     * @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.
    +     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
    +     * @return transcribed text and associated metadata from provided spoken audio data.
    +     */
    +    @ServiceMethod(returns = ReturnType.SINGLE)
    +    public String getAudioTranscriptionText(
    +            String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions) {
    +        return getAudioTranscriptionTextWithResponse(deploymentOrModelName, fileName, audioTranscriptionOptions, null)
    +                .getValue();
    +    }
    +
    +    /**
    +     * Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in
    +     * the written language corresponding to the language it was spoken in.
    +     *
    +     * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
    +     *     (when using non-Azure OpenAI) to use for this request.
    +     * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}.
    +     * @param audioTranscriptionOptions The configuration information for an audio transcription request.
    +     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
    +     * @throws IllegalArgumentException thrown if parameters fail the validation.
    +     * @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.
    +     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
    +     * @return transcribed text and associated metadata from provided spoken audio data.
    +     */
    +    @ServiceMethod(returns = ReturnType.SINGLE)
    +    public Response getAudioTranscriptionTextWithResponse(
    +            String deploymentOrModelName,
    +            String fileName,
    +            AudioTranscriptionOptions audioTranscriptionOptions,
    +            RequestOptions requestOptions) {
    +        // checking allowed formats for a plain text response
    +        validateAudioResponseFormatForTranscriptionText(audioTranscriptionOptions);
    +        // embedding the `model` in the request for non-Azure case
    +        if (this.openAIServiceClient != null) {
    +            audioTranscriptionOptions.setModel(deploymentOrModelName);
    +        }
    +        final MultipartDataHelper helper = new MultipartDataHelper();
    +        final MultipartDataSerializationResult result = helper.serializeRequest(audioTranscriptionOptions, fileName);
    +        final BinaryData data = result.getData();
    +        requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
    +        Response response =
    +                openAIServiceClient != null
    +                        ? this.openAIServiceClient.getAudioTranscriptionAsPlainTextWithResponse(
    +                                deploymentOrModelName, data, requestOptions)
    +                        : this.serviceClient.getAudioTranscriptionAsPlainTextWithResponse(
    +                                deploymentOrModelName, data, requestOptions);
    +        return new SimpleResponse<>(response, response.getValue().toString());
    +    }
    +
    +    /**
    +     * Gets English language transcribed text and associated metadata from provided spoken audio file data.
    +     *
    +     * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
    +     *     (when using non-Azure OpenAI) to use for this request.
    +     * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
    +     * @param audioTranslationOptions The configuration information for an audio translation request.
    +     * @throws IllegalArgumentException thrown if parameters fail the validation.
    +     * @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.
    +     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
    +     * @return {@link AudioTranscription} english language transcribed text and associated metadata from provided spoken
    +     *     audio file data.
    +     */
    +    @ServiceMethod(returns = ReturnType.SINGLE)
    +    public AudioTranslation getAudioTranslation(
    +            String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions) {
    +        return getAudioTranslationWithResponse(deploymentOrModelName, fileName, audioTranslationOptions, null)
    +                .getValue();
    +    }
    +
    +    /**
    +     * Gets English language transcribed text and associated metadata from provided spoken audio file data.
    +     *
    +     * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
    +     *     (when using non-Azure OpenAI) to use for this request.
    +     * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
    +     * @param audioTranslationOptions The configuration information for an audio translation request.
    +     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
    +     * @throws IllegalArgumentException thrown if parameters fail the validation.
    +     * @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.
    +     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
    +     * @return {@link AudioTranslation} english language transcribed text and associated metadata from provided spoken
    +     *     audio file data along with {@link Response}.
    +     */
    +    @ServiceMethod(returns = ReturnType.SINGLE)
    +    public Response getAudioTranslationWithResponse(
    +            String deploymentOrModelName,
    +            String fileName,
    +            AudioTranslationOptions audioTranslationOptions,
    +            RequestOptions requestOptions) {
    +        // checking allowed formats for a JSON response
    +        validateAudioResponseFormatForTranslation(audioTranslationOptions);
    +        // embedding the `model` in the request for non-Azure case
    +        if (this.openAIServiceClient != null) {
    +            audioTranslationOptions.setModel(deploymentOrModelName);
    +        }
    +        final MultipartDataHelper helper = new MultipartDataHelper();
    +        final MultipartDataSerializationResult result = helper.serializeRequest(audioTranslationOptions, fileName);
    +        final BinaryData data = result.getData();
    +        requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
    +        Response response =
    +                openAIServiceClient != null
    +                        ? this.openAIServiceClient.getAudioTranslationAsPlainTextWithResponse(
    +                                deploymentOrModelName, data, requestOptions)
    +                        : this.serviceClient.getAudioTranslationAsPlainTextWithResponse(
    +                                deploymentOrModelName, data, requestOptions);
    +        return new SimpleResponse<>(response, response.getValue().toObject(AudioTranslation.class));
    +    }
    +
    +    /**
    +     * Gets English language transcribed text and associated metadata from provided spoken audio file data.
    +     *
    +     * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
    +     *     (when using non-Azure OpenAI) to use for this request.
    +     * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
    +     * @param audioTranslationOptions The configuration information for an audio translation request.
    +     * @throws IllegalArgumentException thrown if parameters fail the validation.
    +     * @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.
    +     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
    +     * @return english language transcribed text and associated metadata from provided spoken audio file data.
    +     */
    +    @ServiceMethod(returns = ReturnType.SINGLE)
    +    public String getAudioTranslationText(
    +            String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions) {
    +        return getAudioTranslationTextWithResponse(deploymentOrModelName, fileName, audioTranslationOptions, null)
    +                .getValue();
    +    }
    +
    +    /**
    +     * Gets English language transcribed text and associated metadata from provided spoken audio file data.
    +     *
    +     * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
    +     *     (when using non-Azure OpenAI) to use for this request.
    +     * @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
    +     * @param audioTranslationOptions The configuration information for an audio translation request.
    +     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
    +     * @throws IllegalArgumentException thrown if parameters fail the validation.
    +     * @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.
    +     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
    +     * @return english language transcribed text and associated metadata from provided spoken audio file data along with
    +     *     {@link Response}.
    +     */
    +    @ServiceMethod(returns = ReturnType.SINGLE)
    +    public Response getAudioTranslationTextWithResponse(
    +            String deploymentOrModelName,
    +            String fileName,
    +            AudioTranslationOptions audioTranslationOptions,
    +            RequestOptions requestOptions) {
    +        // checking allowed formats for a plain text response
    +        validateAudioResponseFormatForTranslationText(audioTranslationOptions);
    +        // embedding the `model` in the request for non-Azure case
    +        if (this.openAIServiceClient != null) {
    +            audioTranslationOptions.setModel(deploymentOrModelName);
    +        }
    +        final MultipartDataHelper helper = new MultipartDataHelper();
    +        final MultipartDataSerializationResult result = helper.serializeRequest(audioTranslationOptions, fileName);
    +        final BinaryData data = result.getData();
    +        requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
    +        Response response =
    +                openAIServiceClient != null
    +                        ? this.openAIServiceClient.getAudioTranslationAsPlainTextWithResponse(
    +                                deploymentOrModelName, data, requestOptions)
    +                        : this.serviceClient.getAudioTranslationAsPlainTextWithResponse(
    +                                deploymentOrModelName, data, requestOptions);
    +        return new SimpleResponse<>(response, response.getValue().toString());
    +    }
    +
    +    /**
    +     * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
    +     * written language corresponding to the language it was spoken in.
    +     *
    +     * 

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranscriptionAsResponseObjectWithResponse( + String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + return this.serviceClient.getAudioTranscriptionAsResponseObjectWithResponse( + deploymentOrModelName, audioTranscriptionOptions, requestOptions); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranscriptionAsPlainTextWithResponse( + String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + return this.serviceClient.getAudioTranscriptionAsPlainTextWithResponse( + deploymentOrModelName, audioTranscriptionOptions, requestOptions); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranslationAsResponseObjectWithResponse( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + return this.serviceClient.getAudioTranslationAsResponseObjectWithResponse( + deploymentOrModelName, audioTranslationOptions, requestOptions); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranslationAsPlainTextWithResponse( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + return this.serviceClient.getAudioTranslationAsPlainTextWithResponse( + deploymentOrModelName, audioTranslationOptions, requestOptions); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transcribed text and associated metadata from provided spoken audio data. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AudioTranscription getAudioTranscriptionAsResponseObject( + String deploymentOrModelName, AudioTranscriptionOptions audioTranscriptionOptions) { + // Generated convenience method for getAudioTranscriptionAsResponseObjectWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAudioTranscriptionAsResponseObjectWithResponse( + deploymentOrModelName, BinaryData.fromObject(audioTranscriptionOptions), requestOptions) + .getValue() + .toObject(AudioTranscription.class); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transcribed text and associated metadata from provided spoken audio data. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public String getAudioTranscriptionAsPlainText( + String deploymentOrModelName, AudioTranscriptionOptions audioTranscriptionOptions) { + // Generated convenience method for getAudioTranscriptionAsPlainTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAudioTranscriptionAsPlainTextWithResponse( + deploymentOrModelName, BinaryData.fromObject(audioTranscriptionOptions), requestOptions) + .getValue() + .toObject(String.class); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return english language transcribed text and associated metadata from provided spoken audio data. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AudioTranslation getAudioTranslationAsResponseObject( + String deploymentOrModelName, AudioTranslationOptions audioTranslationOptions) { + // Generated convenience method for getAudioTranslationAsResponseObjectWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAudioTranslationAsResponseObjectWithResponse( + deploymentOrModelName, BinaryData.fromObject(audioTranslationOptions), requestOptions) + .getValue() + .toObject(AudioTranslation.class); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return english language transcribed text and associated metadata from provided spoken audio data. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public String getAudioTranslationAsPlainText( + String deploymentOrModelName, AudioTranslationOptions audioTranslationOptions) { + // Generated convenience method for getAudioTranslationAsPlainTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAudioTranslationAsPlainTextWithResponse( + deploymentOrModelName, BinaryData.fromObject(audioTranslationOptions), requestOptions) + .getValue() + .toObject(String.class); + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java index 88e9058a854d..4925b8065c95 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java @@ -9,12 +9,11 @@ import com.azure.ai.openai.implementation.OpenAIClientImpl; import com.azure.core.annotation.Generated; import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.AzureKeyCredentialTrait; import com.azure.core.client.traits.ConfigurationTrait; import com.azure.core.client.traits.EndpointTrait; import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.KeyCredentialTrait; import com.azure.core.client.traits.TokenCredentialTrait; -import com.azure.core.credential.AzureKeyCredential; import com.azure.core.credential.KeyCredential; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; @@ -53,7 +52,7 @@ public final class OpenAIClientBuilder implements HttpTrait, ConfigurationTrait, TokenCredentialTrait, - AzureKeyCredentialTrait, + KeyCredentialTrait, EndpointTrait { @Generated private static final String SDK_NAME = "name"; @@ -177,26 +176,12 @@ public OpenAIClientBuilder credential(TokenCredential tokenCredential) { return this; } - /* - * The AzureKeyCredential used for authentication. - */ - @Generated private AzureKeyCredential azureKeyCredential; - - /** {@inheritDoc}. */ - @Override - public OpenAIClientBuilder credential(AzureKeyCredential azureKeyCredential) { - return this.credential((KeyCredential) azureKeyCredential); - } - /** The KeyCredential used for OpenAi authentication. It could be either of Azure or Non-Azure OpenAI API key. */ private KeyCredential keyCredential; - /** - * The KeyCredential used for OpenAi authentication. It could be either of Azure or Non-Azure OpenAI API key. - * - * @param keyCredential The credential for OpenAI authentication. - * @return the object itself. - */ + /** {@inheritDoc}. */ + @Generated + @Override public OpenAIClientBuilder credential(KeyCredential keyCredential) { this.keyCredential = keyCredential; return this; diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java index 9844431603fa..3027940ba21f 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java @@ -21,7 +21,10 @@ public enum OpenAIServiceVersion implements ServiceVersion { V2023_07_01_PREVIEW("2023-07-01-preview"), /** Enum value 2023-08-01-preview. */ - V2023_08_01_PREVIEW("2023-08-01-preview"); + V2023_08_01_PREVIEW("2023-08-01-preview"), + + /** Enum value 2023-09-01-preview. */ + V2023_09_01_PREVIEW("2023-09-01-preview"); private final String version; @@ -41,6 +44,6 @@ public String getVersion() { * @return The latest {@link OpenAIServiceVersion}. */ public static OpenAIServiceVersion getLatest() { - return V2023_08_01_PREVIEW; + return V2023_09_01_PREVIEW; } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/AudioTranscriptionValidator.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/AudioTranscriptionValidator.java new file mode 100644 index 000000000000..c4b7181dfac6 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/AudioTranscriptionValidator.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.implementation; + +import com.azure.ai.openai.models.AudioTranscriptionFormat; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.core.util.logging.ClientLogger; + +import java.util.ArrayList; +import java.util.List; + +/** + * Validator class for audio transcription. + */ +public final class AudioTranscriptionValidator { + private static final ClientLogger LOGGER = new ClientLogger(AudioTranscriptionValidator.class); + + /** + * Validate the audio response format for transcription. + * + * @param audioTranscriptionOptions The audio transcription options. + */ + public static void validateAudioResponseFormatForTranscription(AudioTranscriptionOptions audioTranscriptionOptions) { + List acceptedFormats = new ArrayList<>(); + acceptedFormats.add(AudioTranscriptionFormat.JSON); + acceptedFormats.add(AudioTranscriptionFormat.VERBOSE_JSON); + AudioTranscriptionFormat responseFormat = audioTranscriptionOptions.getResponseFormat(); + if (!acceptedFormats.contains(responseFormat)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "This operation does not support the requested audio format: " + responseFormat + + ", supported formats: JSON, VERBOSE_JSON.")); + } + } + + /** + * Validate the audio response format for transcription text. + * + * @param audioTranscriptionOptions The audio transcription options. + */ + public static void validateAudioResponseFormatForTranscriptionText(AudioTranscriptionOptions audioTranscriptionOptions) { + List acceptedFormats = new ArrayList<>(); + acceptedFormats.add(AudioTranscriptionFormat.TEXT); + acceptedFormats.add(AudioTranscriptionFormat.VTT); + acceptedFormats.add(AudioTranscriptionFormat.SRT); + AudioTranscriptionFormat responseFormat = audioTranscriptionOptions.getResponseFormat(); + if (!acceptedFormats.contains(responseFormat)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "This operation does not support the requested audio format: " + responseFormat + + ", supported formats: TEXT, VTT, SRT.")); + } + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/AudioTranslationValidator.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/AudioTranslationValidator.java new file mode 100644 index 000000000000..b83c323dc57e --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/AudioTranslationValidator.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.implementation; + +import com.azure.ai.openai.models.AudioTranslationFormat; +import com.azure.ai.openai.models.AudioTranslationOptions; +import com.azure.core.util.logging.ClientLogger; + +import java.util.ArrayList; +import java.util.List; + +/** + * Validator class for audio translation. + */ +public class AudioTranslationValidator { + private static final ClientLogger LOGGER = new ClientLogger(AudioTranslationValidator.class); + + /** + * Validate the audio response format for translation. + * + * @param audioTranslationOptions The audio translation options. + */ + public static void validateAudioResponseFormatForTranslation(AudioTranslationOptions audioTranslationOptions) { + List acceptedFormats = new ArrayList<>(); + acceptedFormats.add(AudioTranslationFormat.JSON); + acceptedFormats.add(AudioTranslationFormat.VERBOSE_JSON); + AudioTranslationFormat responseFormat = audioTranslationOptions.getResponseFormat(); + if (!acceptedFormats.contains(responseFormat)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "This operation does not support the requested audio format: " + responseFormat + + ", supported formats: JSON, VERBOSE_JSON.")); + } + } + + /** + * Validate the audio response format for translation text. + * + * @param audioTranslationOptions The audio translation options. + */ + public static void validateAudioResponseFormatForTranslationText(AudioTranslationOptions audioTranslationOptions) { + List acceptedFormats = new ArrayList<>(); + acceptedFormats.add(AudioTranslationFormat.TEXT); + acceptedFormats.add(AudioTranslationFormat.VTT); + acceptedFormats.add(AudioTranslationFormat.SRT); + AudioTranslationFormat responseFormat = audioTranslationOptions.getResponseFormat(); + if (!acceptedFormats.contains(responseFormat)) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "This operation does not support the requested audio format: " + responseFormat + + ", supported formats: TEXT, VTT, SRT.")); + } + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/MultipartDataHelper.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/MultipartDataHelper.java new file mode 100644 index 000000000000..1e057024d2da --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/MultipartDataHelper.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.implementation; + +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.ai.openai.models.AudioTranslationOptions; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * Helper class for marshaling {@link AudioTranscriptionOptions} and {@link AudioTranslationOptions} objects to be used + * in multipart HTTP requests according to RFC7578. + */ +public class MultipartDataHelper { + private static final ClientLogger LOGGER = new ClientLogger(MultipartDataHelper.class); + + /** + * Value to be used as part of the divider for the multipart requests. + */ + private final String boundary; + + /** + * The actual part separator in the request. This is obtained by prepending "--" to the "boundary". + */ + private final String partSeparator; + + /** + * The marker for the ending of a multipart request. This is obtained by post-pending "--" to the "partSeparator". + */ + private final String endMarker; + + /** + * Charset used for encoding the multipart HTTP request. + */ + private final Charset encoderCharset = StandardCharsets.UTF_8; + + /** + * Line separator for the multipart HTTP request. + */ + private static final String CRLF = "\r\n"; + + /** + * Default constructor used in the code. The boundary is a random value. + */ + public MultipartDataHelper() { + // TODO: We can't use randomly generated UUIDs for now. Generating a test session record won't match the + // newly generated UUID for the test run instance this(UUID.randomUUID().toString().substring(0, 16)); + this("29580623-3d02-4a"); + } + + /** + * Constructor accepting a boundary generator. Used for testing. + * + * @param boundary The value to be used as "boundary". + */ + public MultipartDataHelper(String boundary) { + this.boundary = boundary; + partSeparator = "--" + boundary; + endMarker = partSeparator + "--"; + } + + /** + * Gets the "boundary" value. + * + * @return the "boundary" value. + */ + public String getBoundary() { + return boundary; + } + + /** + * This method marshals the passed request into ready to be sent. + * + * @param requestOptions Object to be marshalled for the multipart HTTP request. + * @param fileName The name of the file that is being sent as a part of this request. + * @param {@link AudioTranscriptionOptions} and {@link AudioTranslationOptions} are the only types supported. + * This represents the type information of the request object. + * @return the marshalled data and its length. + */ + public MultipartDataSerializationResult serializeRequest(T requestOptions, String fileName) { + if (requestOptions instanceof AudioTranslationOptions) { + AudioTranslationOptions audioTranslationOptions = (AudioTranslationOptions) requestOptions; + byte[] file = audioTranslationOptions.getFile(); + List fields = formatAudioTranslationOptions(audioTranslationOptions); + return serializeRequestFields(file, fields, fileName); + } else if (requestOptions instanceof AudioTranscriptionOptions) { + AudioTranscriptionOptions audioTranscriptionOptions = (AudioTranscriptionOptions) requestOptions; + byte[] file = audioTranscriptionOptions.getFile(); + List fields = formatAudioTranscriptionOptions(audioTranscriptionOptions); + return serializeRequestFields(file, fields, fileName); + } else { + throw LOGGER.logThrowableAsError(new IllegalArgumentException( + "Only AudioTranslationOptions and AudioTranscriptionOptions currently supported")); + } + } + + /** + * This helper method marshals the passed request fields. + * + * @param file is the byte[] representation of the file in the request object. + * @param fields a list of the members other than the file in the request object. + * @param fileName the name of the file passed in the "file" field of the request object. + * @return a structure containing the marshalled data and its length. + */ + private MultipartDataSerializationResult serializeRequestFields(byte[] file, List fields, String fileName) { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + + // Multipart preamble + String fileFieldPreamble = partSeparator + + CRLF + "Content-Disposition: form-data; name=\"file\"; filename=\"" + + fileName + "\"" + + CRLF + "Content-Type: application/octet-stream" + CRLF + CRLF; + try { + // Writing the file into the request as a byte stream + byteArrayOutputStream.write(fileFieldPreamble.getBytes(encoderCharset)); + byteArrayOutputStream.write(file); + + // Adding other fields to the request + for (MultipartField field : fields) { + byteArrayOutputStream.write(serializeField(field)); + } + byteArrayOutputStream.write((CRLF + endMarker).getBytes(encoderCharset)); + } catch (IOException e) { + throw new RuntimeException(e); + } + + byte[] totalData = byteArrayOutputStream.toByteArray(); + return new MultipartDataSerializationResult(BinaryData.fromBytes(totalData), totalData.length); + } + + /** + * Adds member fields apart from the file to the multipart HTTP request. + * + * @param audioTranslationOptions The configuration information for an audio translation request. + * @return a list of the fields in the request (except for "file"). + */ + private List formatAudioTranslationOptions(AudioTranslationOptions audioTranslationOptions) { + List fields = new ArrayList<>(); + if (audioTranslationOptions.getResponseFormat() != null) { + fields.add(new MultipartField( + "response_format", + audioTranslationOptions.getResponseFormat().toString())); + } + if (audioTranslationOptions.getModel() != null) { + fields.add(new MultipartField("model", + audioTranslationOptions.getModel() + )); + } + if (audioTranslationOptions.getPrompt() != null) { + fields.add(new MultipartField("prompt", + audioTranslationOptions.getPrompt())); + } + if (audioTranslationOptions.getTemperature() != null) { + fields.add(new MultipartField("temperature", + String.valueOf(audioTranslationOptions.getTemperature()))); + } + return fields; + } + + /** + * Adds member fields apart from the file to the multipart HTTP request. + * + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @return a list of the fields in the request (except for "file"). + */ + private List formatAudioTranscriptionOptions(AudioTranscriptionOptions audioTranscriptionOptions) { + List fields = new ArrayList<>(); + if (audioTranscriptionOptions.getResponseFormat() != null) { + fields.add(new MultipartField("response_format", + audioTranscriptionOptions.getResponseFormat().toString())); + } + if (audioTranscriptionOptions.getModel() != null) { + fields.add(new MultipartField("model", + audioTranscriptionOptions.getModel() + )); + } + if (audioTranscriptionOptions.getPrompt() != null) { + fields.add(new MultipartField("prompt", + audioTranscriptionOptions.getPrompt())); + } + if (audioTranscriptionOptions.getTemperature() != null) { + fields.add(new MultipartField("temperature", + String.valueOf(audioTranscriptionOptions.getTemperature()))); + } + if (audioTranscriptionOptions.getLanguage() != null) { + fields.add(new MultipartField("language", + audioTranscriptionOptions.getLanguage())); + } + return fields; + } + + /** + * This method formats a field for a multipart HTTP request and returns its byte[] representation. + * + * @param field the field of the request to be marshalled. + * @return byte[] representation of a field for a multipart HTTP request. + */ + private byte[] serializeField(MultipartField field) { + String serialized = CRLF + partSeparator + + CRLF + "Content-Disposition: form-data; name=\"" + + field.getWireName() + "\"" + CRLF + CRLF + + field.getValue(); + + return serialized.getBytes(encoderCharset); + } + + /** + * Get the request options for multipart form data. + * + * @param requestOptions The request options. + * @param result The multipart data serialization result. + * @param multipartBoundary The multipart boundary. + * @return The request options. + */ + public RequestOptions getRequestOptionsForMultipartFormData(RequestOptions requestOptions, + MultipartDataSerializationResult result, String multipartBoundary) { + if (requestOptions == null) { + requestOptions = + new RequestOptions() + .setHeader( + HttpHeaderName.CONTENT_TYPE, + "multipart/form-data;" + " boundary=" + multipartBoundary) + .setHeader(HttpHeaderName.CONTENT_LENGTH, String.valueOf(result.getDataLength())); + } + return requestOptions; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/MultipartDataSerializationResult.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/MultipartDataSerializationResult.java new file mode 100644 index 000000000000..1150b879b6b6 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/MultipartDataSerializationResult.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.implementation; + +import com.azure.core.util.BinaryData; + +/** + * This class is used as a stand-in representation of marshalled data to be used in an HTTP multipart request. + */ +public class MultipartDataSerializationResult { + + /** + * Represents the length of the content of this request. The value is to be used for the "Content-Length" header + * of the HTTP request + */ + private final long dataLength; + + /** + * The multipart form data of the request. + */ + private final BinaryData data; + + /** + * Constructor bundling both data and its length + * @param data the multipart form data of the request + * @param contentLength the length of the multipart form data of the request + */ + public MultipartDataSerializationResult(BinaryData data, long contentLength) { + this.dataLength = contentLength; + this.data = data; + } + + /** + * + * @return the result of marshaling a multipart HTTP request + */ + public BinaryData getData() { + return data; + } + + /** + * + * @return the length of a multipart HTTP request data + */ + public long getDataLength() { + return dataLength; + } + +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/MultipartField.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/MultipartField.java new file mode 100644 index 000000000000..1ad618b7ceb6 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/MultipartField.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.implementation; + +/** + * A field of a request for a multipart HTTP request. + */ +public class MultipartField { + + /** + * The JSON key name of this field. + */ + private final String wireName; + + /** + * The JSON value of this field. + */ + private final String value; + + /** + * + * @param wireName The JSON key name of this field. + * @param value The JSON value of this field. + */ + public MultipartField(String wireName, String value) { + this.wireName = wireName; + this.value = value; + } + + /** + * + * @return The JSON key name of this field. + */ + public String getWireName() { + return wireName; + } + + /** + * + * @return The JSON value of this field. + */ + public String getValue() { + return value; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/NonAzureOpenAIClientImpl.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/NonAzureOpenAIClientImpl.java index 5ecd55ec21b3..8fd0413c128e 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/NonAzureOpenAIClientImpl.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/NonAzureOpenAIClientImpl.java @@ -243,6 +243,158 @@ Response generateImageSync( @BodyParam("application/json") BinaryData imageGenerationOptions, RequestOptions requestOptions, Context context); + + @Post("/audio/transcriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAudioTranscriptionAsResponseObject( + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, + RequestOptions requestOptions, + Context context); + + @Post("/audio/transcriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAudioTranscriptionAsResponseObjectSync( + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, + RequestOptions requestOptions, + Context context); + + @Post("/audio/transcriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAudioTranscriptionAsPlainText( + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, + RequestOptions requestOptions, + Context context); + + @Post("/audio/transcriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAudioTranscriptionAsPlainTextSync( + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, + RequestOptions requestOptions, + Context context); + + @Post("/audio/translations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAudioTranslationAsResponseObject( + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, + RequestOptions requestOptions, + Context context); + + @Post("/audio/translations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAudioTranslationAsResponseObjectSync( + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, + RequestOptions requestOptions, + Context context); + + @Post("/audio/translations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAudioTranslationAsPlainText( + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, + RequestOptions requestOptions, + Context context); + + @Post("/audio/translations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAudioTranslationAsPlainTextSync( + @HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, + RequestOptions requestOptions, + Context context); } /** @@ -891,7 +1043,7 @@ public Response generateImageWithResponse( * * @param inputJson JSON submitted by the client * @param modelId The LLM model ID to be injected in the JSON - * @return + * @return an updated version of the JSON with the key "model" and its corresponding value "modelId" added */ private static BinaryData addModelIdJson(BinaryData inputJson, String modelId) throws JsonProcessingException { JsonNode jsonNode = JSON_MAPPER.readTree(inputJson.toString()); @@ -905,4 +1057,446 @@ private static BinaryData addModelIdJson(BinaryData inputJson, String modelId) t return inputJson; } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param modelId Specifies the model name to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranscriptionAsResponseObjectWithResponseAsync( + String modelId, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAudioTranscriptionAsResponseObject( + OPEN_AI_ENDPOINT, + accept, + audioTranscriptionOptions, + requestOptions, + context)); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param modelId Specifies the model name to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranscriptionAsResponseObjectWithResponse( + String modelId, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAudioTranscriptionAsResponseObjectSync( + OPEN_AI_ENDPOINT, + accept, + audioTranscriptionOptions, + requestOptions, + Context.NONE); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param modelId Specifies the model name to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranscriptionAsPlainTextWithResponseAsync( + String modelId, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAudioTranscriptionAsPlainText( + OPEN_AI_ENDPOINT, + accept, + audioTranscriptionOptions, + requestOptions, + context)); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param modelId Specifies the model name to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranscriptionAsPlainTextWithResponse( + String modelId, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAudioTranscriptionAsPlainTextSync( + OPEN_AI_ENDPOINT, + accept, + audioTranscriptionOptions, + requestOptions, + Context.NONE); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies the model name to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranslationAsResponseObjectWithResponseAsync( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAudioTranslationAsResponseObject( + OPEN_AI_ENDPOINT, + accept, + audioTranslationOptions, + requestOptions, + context)); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param modelId Specifies the model name to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranslationAsResponseObjectWithResponse( + String modelId, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAudioTranslationAsResponseObjectSync( + OPEN_AI_ENDPOINT, + accept, + audioTranslationOptions, + requestOptions, + Context.NONE); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param modelId Specifies the model name to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranslationAsPlainTextWithResponseAsync( + String modelId, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAudioTranslationAsPlainText( + OPEN_AI_ENDPOINT, + accept, + audioTranslationOptions, + requestOptions, + context)); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param modelId Specifies the model name to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranslationAsPlainTextWithResponse( + String modelId, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAudioTranslationAsPlainTextSync( + OPEN_AI_ENDPOINT, + accept, + audioTranslationOptions, + requestOptions, + Context.NONE); + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java index d99101686256..30b57196bfd9 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java @@ -360,6 +360,182 @@ Response beginAzureBatchImageGenerationSync( @BodyParam("application/json") BinaryData imageGenerationOptions, RequestOptions requestOptions, Context context); + + @Post("/deployments/{deploymentId}/audio/transcriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAudioTranscriptionAsPlainText( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData audioTranscriptionOptions, + RequestOptions requestOptions, + Context context); + + @Post("/deployments/{deploymentId}/audio/transcriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAudioTranscriptionAsPlainTextSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData audioTranscriptionOptions, + RequestOptions requestOptions, + Context context); + + // @Multipart not supported by RestProxy + @Post("/deployments/{deploymentId}/audio/transcriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAudioTranscriptionAsResponseObject( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, + @HeaderParam("content-type") String contentType, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, + RequestOptions requestOptions, + Context context); + + // @Multipart not supported by RestProxy + @Post("/deployments/{deploymentId}/audio/transcriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAudioTranscriptionAsResponseObjectSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, + @HeaderParam("content-type") String contentType, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, + RequestOptions requestOptions, + Context context); + + @Post("/deployments/{deploymentId}/audio/translations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAudioTranslationAsPlainText( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData audioTranslationOptions, + RequestOptions requestOptions, + Context context); + + @Post("/deployments/{deploymentId}/audio/translations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAudioTranslationAsPlainTextSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, + @HeaderParam("accept") String accept, + @BodyParam("application/json") BinaryData audioTranslationOptions, + RequestOptions requestOptions, + Context context); + + // @Multipart not supported by RestProxy + @Post("/deployments/{deploymentId}/audio/translations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAudioTranslationAsResponseObject( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, + @HeaderParam("content-type") String contentType, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, + RequestOptions requestOptions, + Context context); + + // @Multipart not supported by RestProxy + @Post("/deployments/{deploymentId}/audio/translations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType( + value = ClientAuthenticationException.class, + code = {401}) + @UnexpectedResponseExceptionType( + value = ResourceNotFoundException.class, + code = {404}) + @UnexpectedResponseExceptionType( + value = ResourceModifiedException.class, + code = {409}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAudioTranslationAsResponseObjectSync( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, + @HeaderParam("content-type") String contentType, + @HeaderParam("accept") String accept, + @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, + RequestOptions requestOptions, + Context context); } /** @@ -526,7 +702,7 @@ public Response getEmbeddingsWithResponse( * { * id: String (Required) * created: long (Required) - * prompt_annotations (Optional): [ + * prompt_filter_results (Optional): [ * (Optional){ * prompt_index: int (Required) * content_filter_results (Optional): { @@ -537,6 +713,18 @@ public Response getEmbeddingsWithResponse( * violence (Optional): (recursive schema, see violence above) * hate (Optional): (recursive schema, see hate above) * self_harm (Optional): (recursive schema, see self_harm above) + * error (Optional): { + * code: String (Required) + * message: String (Required) + * target: String (Optional) + * details (Optional): [ + * (recursive schema, see above) + * ] + * innererror (Optional): { + * code: String (Optional) + * innererror (Optional): (recursive schema, see innererror above) + * } + * } * } * } * ] @@ -639,7 +827,7 @@ public Mono> getCompletionsWithResponseAsync( * { * id: String (Required) * created: long (Required) - * prompt_annotations (Optional): [ + * prompt_filter_results (Optional): [ * (Optional){ * prompt_index: int (Required) * content_filter_results (Optional): { @@ -650,6 +838,18 @@ public Mono> getCompletionsWithResponseAsync( * violence (Optional): (recursive schema, see violence above) * hate (Optional): (recursive schema, see hate above) * self_harm (Optional): (recursive schema, see self_harm above) + * error (Optional): { + * code: String (Required) + * message: String (Required) + * target: String (Optional) + * details (Optional): [ + * (recursive schema, see above) + * ] + * innererror (Optional): { + * code: String (Optional) + * innererror (Optional): (recursive schema, see innererror above) + * } + * } * } * } * ] @@ -800,10 +1000,22 @@ public Response getCompletionsWithResponse( * violence (Optional): (recursive schema, see violence above) * hate (Optional): (recursive schema, see hate above) * self_harm (Optional): (recursive schema, see self_harm above) + * error (Optional): { + * code: String (Required) + * message: String (Required) + * target: String (Optional) + * details (Optional): [ + * (recursive schema, see above) + * ] + * innererror (Optional): { + * code: String (Optional) + * innererror (Optional): (recursive schema, see innererror above) + * } + * } * } * } * ] - * prompt_annotations (Optional): [ + * prompt_filter_results (Optional): [ * (Optional){ * prompt_index: int (Required) * content_filter_results (Optional): (recursive schema, see content_filter_results above) @@ -935,10 +1147,22 @@ public Mono> getChatCompletionsWithResponseAsync( * violence (Optional): (recursive schema, see violence above) * hate (Optional): (recursive schema, see hate above) * self_harm (Optional): (recursive schema, see self_harm above) + * error (Optional): { + * code: String (Required) + * message: String (Required) + * target: String (Optional) + * details (Optional): [ + * (recursive schema, see above) + * ] + * innererror (Optional): { + * code: String (Optional) + * innererror (Optional): (recursive schema, see innererror above) + * } + * } * } * } * ] - * prompt_annotations (Optional): [ + * prompt_filter_results (Optional): [ * (Optional){ * prompt_index: int (Required) * content_filter_results (Optional): (recursive schema, see content_filter_results above) @@ -1068,10 +1292,22 @@ public Response getChatCompletionsWithResponse( * violence (Optional): (recursive schema, see violence above) * hate (Optional): (recursive schema, see hate above) * self_harm (Optional): (recursive schema, see self_harm above) + * error (Optional): { + * code: String (Required) + * message: String (Required) + * target: String (Optional) + * details (Optional): [ + * (recursive schema, see above) + * ] + * innererror (Optional): { + * code: String (Optional) + * innererror (Optional): (recursive schema, see innererror above) + * } + * } * } * } * ] - * prompt_annotations (Optional): [ + * prompt_filter_results (Optional): [ * (Optional){ * prompt_index: int (Required) * content_filter_results (Optional): (recursive schema, see content_filter_results above) @@ -1204,10 +1440,22 @@ public Mono> getChatCompletionsWithAzureExtensionsWithRespo * violence (Optional): (recursive schema, see violence above) * hate (Optional): (recursive schema, see hate above) * self_harm (Optional): (recursive schema, see self_harm above) + * error (Optional): { + * code: String (Required) + * message: String (Required) + * target: String (Optional) + * details (Optional): [ + * (recursive schema, see above) + * ] + * innererror (Optional): { + * code: String (Optional) + * innererror (Optional): (recursive schema, see innererror above) + * } + * } * } * } * ] - * prompt_annotations (Optional): [ + * prompt_filter_results (Optional): [ * (Optional){ * prompt_index: int (Required) * content_filter_results (Optional): (recursive schema, see content_filter_results above) @@ -1268,7 +1516,13 @@ public Response getChatCompletionsWithAzureExtensionsWithResponse( *
    {@code
          * {
          *     id: String (Required)
    -     *     status: String (Required)
    +     *     created: long (Required)
    +     *     expires: Long (Optional)
    +     *     result (Optional): {
    +     *         created: long (Required)
    +     *         data: DataModelBase (Required)
    +     *     }
    +     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
          *     error (Optional): {
          *         code: String (Required)
          *         message: String (Required)
    @@ -1290,8 +1544,8 @@ public Response getChatCompletionsWithAzureExtensionsWithResponse(
          * @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 status details for long running operations along with {@link Response} on successful completion of {@link
    -     *     Mono}.
    +     * @return a polling status update or final response payload for an image operation along with {@link Response} on
    +     *     successful completion of {@link Mono}.
          */
         @ServiceMethod(returns = ReturnType.SINGLE)
         private Mono> beginAzureBatchImageGenerationWithResponseAsync(
    @@ -1328,7 +1582,13 @@ private Mono> beginAzureBatchImageGenerationWithResponseAsy
          * 
    {@code
          * {
          *     id: String (Required)
    -     *     status: String (Required)
    +     *     created: long (Required)
    +     *     expires: Long (Optional)
    +     *     result (Optional): {
    +     *         created: long (Required)
    +     *         data: DataModelBase (Required)
    +     *     }
    +     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
          *     error (Optional): {
          *         code: String (Required)
          *         message: String (Required)
    @@ -1350,7 +1610,7 @@ private Mono> beginAzureBatchImageGenerationWithResponseAsy
          * @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 status details for long running operations along with {@link Response}.
    +     * @return a polling status update or final response payload for an image operation along with {@link Response}.
          */
         @ServiceMethod(returns = ReturnType.SINGLE)
         private Response beginAzureBatchImageGenerationWithResponse(
    @@ -1385,7 +1645,13 @@ private Response beginAzureBatchImageGenerationWithResponse(
          * 
    {@code
          * {
          *     id: String (Required)
    -     *     status: String (Required)
    +     *     created: long (Required)
    +     *     expires: Long (Optional)
    +     *     result (Optional): {
    +     *         created: long (Required)
    +     *         data: DataModelBase (Required)
    +     *     }
    +     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
          *     error (Optional): {
          *         code: String (Required)
          *         message: String (Required)
    @@ -1407,7 +1673,8 @@ private Response beginAzureBatchImageGenerationWithResponse(
          * @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 the {@link PollerFlux} for polling of status details for long running operations.
    +     * @return the {@link PollerFlux} for polling of a polling status update or final response payload for an image
    +     *     operation.
          */
         @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
         public PollerFlux beginBeginAzureBatchImageGenerationAsync(
    @@ -1446,7 +1713,13 @@ public PollerFlux beginBeginAzureBatchImageGenerationAsy
          * 
    {@code
          * {
          *     id: String (Required)
    -     *     status: String (Required)
    +     *     created: long (Required)
    +     *     expires: Long (Optional)
    +     *     result (Optional): {
    +     *         created: long (Required)
    +     *         data: DataModelBase (Required)
    +     *     }
    +     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
          *     error (Optional): {
          *         code: String (Required)
          *         message: String (Required)
    @@ -1468,7 +1741,8 @@ public PollerFlux beginBeginAzureBatchImageGenerationAsy
          * @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 the {@link SyncPoller} for polling of status details for long running operations.
    +     * @return the {@link SyncPoller} for polling of a polling status update or final response payload for an image
    +     *     operation.
          */
         @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
         public SyncPoller beginBeginAzureBatchImageGeneration(
    @@ -1486,4 +1760,478 @@ public SyncPoller beginBeginAzureBatchImageGeneration(
                     TypeReference.createInstance(BinaryData.class),
                     TypeReference.createInstance(BinaryData.class));
         }
    +
    +    /**
    +     * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
    +     * written language corresponding to the language it was spoken in.
    +     *
    +     * 

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranscriptionAsPlainTextWithResponseAsync( + String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAudioTranscriptionAsPlainText( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + accept, + audioTranscriptionOptions, + requestOptions, + context)); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranscriptionAsPlainTextWithResponse( + String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAudioTranscriptionAsPlainTextSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + accept, + audioTranscriptionOptions, + requestOptions, + Context.NONE); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranscriptionAsResponseObjectWithResponseAsync( + String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAudioTranscriptionAsResponseObject( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + contentType, + accept, + audioTranscriptionOptions, + requestOptions, + context)); + } + + /** + * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the + * written language corresponding to the language it was spoken in. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     language: String (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranscriptionOptions The configuration information for an audio transcription request. + * @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 transcribed text and associated metadata from provided spoken audio data along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranscriptionAsResponseObjectWithResponse( + String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + final String accept = "application/json"; + return service.getAudioTranscriptionAsResponseObjectSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + contentType, + accept, + audioTranscriptionOptions, + requestOptions, + Context.NONE); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranslationAsPlainTextWithResponseAsync( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAudioTranslationAsPlainText( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + accept, + audioTranslationOptions, + requestOptions, + context)); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * String
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranslationAsPlainTextWithResponse( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAudioTranslationAsPlainTextSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + accept, + audioTranslationOptions, + requestOptions, + Context.NONE); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAudioTranslationAsResponseObjectWithResponseAsync( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getAudioTranslationAsResponseObject( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + contentType, + accept, + audioTranslationOptions, + requestOptions, + context)); + } + + /** + * Gets English language transcribed text and associated metadata from provided spoken audio data. + * + *

    Request Body Schema + * + *

    {@code
    +     * {
    +     *     file: byte[] (Required)
    +     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
    +     *     prompt: String (Optional)
    +     *     temperature: Double (Optional)
    +     *     model: String (Optional)
    +     * }
    +     * }
    + * + *

    Response Body Schema + * + *

    {@code
    +     * {
    +     *     text: String (Required)
    +     *     task: String(transcribe/translate) (Optional)
    +     *     language: String (Optional)
    +     *     duration: Double (Optional)
    +     *     segments (Optional): [
    +     *          (Optional){
    +     *             id: int (Required)
    +     *             start: double (Required)
    +     *             end: double (Required)
    +     *             text: String (Required)
    +     *             temperature: double (Required)
    +     *             avg_logprob: double (Required)
    +     *             compression_ratio: double (Required)
    +     *             no_speech_prob: double (Required)
    +     *             tokens (Required): [
    +     *                 int (Required)
    +     *             ]
    +     *             seek: int (Required)
    +     *         }
    +     *     ]
    +     * }
    +     * }
    + * + * @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name + * (when using non-Azure OpenAI) to use for this request. + * @param audioTranslationOptions The configuration information for an audio translation request. + * @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 english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAudioTranslationAsResponseObjectWithResponse( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + final String accept = "application/json"; + return service.getAudioTranslationAsResponseObjectSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + contentType, + accept, + audioTranslationOptions, + requestOptions, + Context.NONE); + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTaskLabel.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTaskLabel.java new file mode 100644 index 000000000000..36f8361ad2a4 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTaskLabel.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.ai.openai.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines the possible descriptors for available audio operation responses. */ +public final class AudioTaskLabel extends ExpandableStringEnum { + + /** Accompanying response data resulted from an audio transcription task. */ + @Generated public static final AudioTaskLabel TRANSCRIBE = fromString("transcribe"); + + /** Accompanying response data resulted from an audio translation task. */ + @Generated public static final AudioTaskLabel TRANSLATE = fromString("translate"); + + /** + * Creates a new instance of AudioTaskLabel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AudioTaskLabel() {} + + /** + * Creates or finds a AudioTaskLabel from its string representation. + * + * @param name a name to look for. + * @return the corresponding AudioTaskLabel. + */ + @Generated + @JsonCreator + public static AudioTaskLabel fromString(String name) { + return fromString(name, AudioTaskLabel.class); + } + + /** + * Gets known AudioTaskLabel values. + * + * @return known AudioTaskLabel values. + */ + @Generated + public static Collection values() { + return values(AudioTaskLabel.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscription.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscription.java new file mode 100644 index 000000000000..8d7b085ce8af --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscription.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.ai.openai.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** Result information for an operation that transcribed spoken audio into written text. */ +@Immutable +public final class AudioTranscription { + + /* + * The transcribed text for the provided audio data. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The label that describes which operation type generated the accompanying response data. + */ + @Generated + @JsonProperty(value = "task") + private AudioTaskLabel task; + + /* + * The spoken language that was detected in the transcribed audio data. + * This is expressed as a two-letter ISO-639-1 language code like 'en' or 'fr'. + */ + @Generated + @JsonProperty(value = "language") + private String language; + + /* + * The total duration of the audio processed to produce accompanying transcription information. + */ + @Generated + @JsonProperty(value = "duration") + private Double duration; + + /* + * A collection of information about the timing, probabilities, and other detail of each processed audio segment. + */ + @Generated + @JsonProperty(value = "segments") + private List segments; + + /** + * Creates an instance of AudioTranscription class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + private AudioTranscription(@JsonProperty(value = "text") String text) { + this.text = text; + } + + /** + * Get the text property: The transcribed text for the provided audio data. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the task property: The label that describes which operation type generated the accompanying response data. + * + * @return the task value. + */ + @Generated + public AudioTaskLabel getTask() { + return this.task; + } + + /** + * Get the language property: The spoken language that was detected in the transcribed audio data. This is expressed + * as a two-letter ISO-639-1 language code like 'en' or 'fr'. + * + * @return the language value. + */ + @Generated + public String getLanguage() { + return this.language; + } + + /** + * Get the duration property: The total duration of the audio processed to produce accompanying transcription + * information. + * + * @return the duration value. + */ + @Generated + public Duration getDuration() { + if (this.duration == null) { + return null; + } + return Duration.ofNanos((long) (this.duration * 1000_000_000L)); + } + + /** + * Get the segments property: A collection of information about the timing, probabilities, and other detail of each + * processed audio segment. + * + * @return the segments value. + */ + @Generated + public List getSegments() { + return this.segments; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscriptionFormat.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscriptionFormat.java new file mode 100644 index 000000000000..8429c748e7ca --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscriptionFormat.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.ai.openai.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines available options for the underlying response format of output transcription information. */ +public final class AudioTranscriptionFormat extends ExpandableStringEnum { + + /** Use a response body that is a JSON object containing a single 'text' field for the transcription. */ + @Generated public static final AudioTranscriptionFormat JSON = fromString("json"); + + /** + * Use a response body that is a JSON object containing transcription text along with timing, segments, and other + * metadata. + */ + @Generated public static final AudioTranscriptionFormat VERBOSE_JSON = fromString("verbose_json"); + + /** Use a response body that is plain text containing the raw, unannotated transcription. */ + @Generated public static final AudioTranscriptionFormat TEXT = fromString("text"); + + /** Use a response body that is plain text in SubRip (SRT) format that also includes timing information. */ + @Generated public static final AudioTranscriptionFormat SRT = fromString("srt"); + + /** + * Use a response body that is plain text in Web Video Text Tracks (VTT) format that also includes timing + * information. + */ + @Generated public static final AudioTranscriptionFormat VTT = fromString("vtt"); + + /** + * Creates a new instance of AudioTranscriptionFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AudioTranscriptionFormat() {} + + /** + * Creates or finds a AudioTranscriptionFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding AudioTranscriptionFormat. + */ + @Generated + @JsonCreator + public static AudioTranscriptionFormat fromString(String name) { + return fromString(name, AudioTranscriptionFormat.class); + } + + /** + * Gets known AudioTranscriptionFormat values. + * + * @return known AudioTranscriptionFormat values. + */ + @Generated + public static Collection values() { + return values(AudioTranscriptionFormat.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscriptionOptions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscriptionOptions.java new file mode 100644 index 000000000000..7d72fd5ea891 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscriptionOptions.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.ai.openai.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The configuration information for an audio transcription request. */ +@Fluent +public final class AudioTranscriptionOptions { + + /* + * The audio data to transcribe. This must be the binary content of a file in one of the supported media formats: + * flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. + */ + @Generated + @JsonProperty(value = "file") + private byte[] file; + + /* + * The requested format of the transcription response data, which will influence the content and detail of the + * result. + */ + @Generated + @JsonProperty(value = "response_format") + private AudioTranscriptionFormat responseFormat; + + /* + * The primary spoken language of the audio data to be transcribed, supplied as a two-letter ISO-639-1 language + * code + * such as 'en' or 'fr'. + * Providing this known input language is optional but may improve the accuracy and/or latency of transcription. + */ + @Generated + @JsonProperty(value = "language") + private String language; + + /* + * An optional hint to guide the model's style or continue from a prior audio segment. The written language of the + * prompt should match the primary spoken language of the audio data. + */ + @Generated + @JsonProperty(value = "prompt") + private String prompt; + + /* + * The sampling temperature, between 0 and 1. + * Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused + * and deterministic. + * If set to 0, the model will use log probability to automatically increase the temperature until certain + * thresholds are hit. + */ + @Generated + @JsonProperty(value = "temperature") + private Double temperature; + + /* + * The model to use for this transcription request. + */ + @Generated + @JsonProperty(value = "model") + private String model; + + /** + * Creates an instance of AudioTranscriptionOptions class. + * + * @param file the file value to set. + */ + @Generated + @JsonCreator + public AudioTranscriptionOptions(@JsonProperty(value = "file") byte[] file) { + this.file = file; + } + + /** + * Get the file property: The audio data to transcribe. This must be the binary content of a file in one of the + * supported media formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. + * + * @return the file value. + */ + @Generated + public byte[] getFile() { + return CoreUtils.clone(this.file); + } + + /** + * Get the responseFormat property: The requested format of the transcription response data, which will influence + * the content and detail of the result. + * + * @return the responseFormat value. + */ + @Generated + public AudioTranscriptionFormat getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: The requested format of the transcription response data, which will influence + * the content and detail of the result. + * + * @param responseFormat the responseFormat value to set. + * @return the AudioTranscriptionOptions object itself. + */ + @Generated + public AudioTranscriptionOptions setResponseFormat(AudioTranscriptionFormat responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + /** + * Get the language property: The primary spoken language of the audio data to be transcribed, supplied as a + * two-letter ISO-639-1 language code such as 'en' or 'fr'. Providing this known input language is optional but may + * improve the accuracy and/or latency of transcription. + * + * @return the language value. + */ + @Generated + public String getLanguage() { + return this.language; + } + + /** + * Set the language property: The primary spoken language of the audio data to be transcribed, supplied as a + * two-letter ISO-639-1 language code such as 'en' or 'fr'. Providing this known input language is optional but may + * improve the accuracy and/or latency of transcription. + * + * @param language the language value to set. + * @return the AudioTranscriptionOptions object itself. + */ + @Generated + public AudioTranscriptionOptions setLanguage(String language) { + this.language = language; + return this; + } + + /** + * Get the prompt property: An optional hint to guide the model's style or continue from a prior audio segment. The + * written language of the prompt should match the primary spoken language of the audio data. + * + * @return the prompt value. + */ + @Generated + public String getPrompt() { + return this.prompt; + } + + /** + * Set the prompt property: An optional hint to guide the model's style or continue from a prior audio segment. The + * written language of the prompt should match the primary spoken language of the audio data. + * + * @param prompt the prompt value to set. + * @return the AudioTranscriptionOptions object itself. + */ + @Generated + public AudioTranscriptionOptions setPrompt(String prompt) { + this.prompt = prompt; + return this; + } + + /** + * Get the temperature property: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the + * output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the + * model will use log probability to automatically increase the temperature until certain thresholds are hit. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the + * output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the + * model will use log probability to automatically increase the temperature until certain thresholds are hit. + * + * @param temperature the temperature value to set. + * @return the AudioTranscriptionOptions object itself. + */ + @Generated + public AudioTranscriptionOptions setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the model property: The model to use for this transcription request. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Set the model property: The model to use for this transcription request. + * + * @param model the model value to set. + * @return the AudioTranscriptionOptions object itself. + */ + @Generated + public AudioTranscriptionOptions setModel(String model) { + this.model = model; + return this; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscriptionSegment.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscriptionSegment.java new file mode 100644 index 000000000000..87e289da3b0e --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranscriptionSegment.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.ai.openai.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** + * Extended information about a single segment of transcribed audio data. Segments generally represent roughly 5-10 + * seconds of speech. Segment boundaries typically occur between words but not necessarily sentences. + */ +@Immutable +public final class AudioTranscriptionSegment { + + /* + * The 0-based index of this segment within a transcription. + */ + @Generated + @JsonProperty(value = "id") + private int id; + + /* + * The time at which this segment started relative to the beginning of the transcribed audio. + */ + @Generated + @JsonProperty(value = "start") + private double start; + + /* + * The time at which this segment ended relative to the beginning of the transcribed audio. + */ + @Generated + @JsonProperty(value = "end") + private double end; + + /* + * The transcribed text that was part of this audio segment. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The temperature score associated with this audio segment. + */ + @Generated + @JsonProperty(value = "temperature") + private double temperature; + + /* + * The average log probability associated with this audio segment. + */ + @Generated + @JsonProperty(value = "avg_logprob") + private double avgLogprob; + + /* + * The compression ratio of this audio segment. + */ + @Generated + @JsonProperty(value = "compression_ratio") + private double compressionRatio; + + /* + * The probability of no speech detection within this audio segment. + */ + @Generated + @JsonProperty(value = "no_speech_prob") + private double noSpeechProb; + + /* + * The token IDs matching the transcribed text in this audio segment. + */ + @Generated + @JsonProperty(value = "tokens") + private List tokens; + + /* + * The seek position associated with the processing of this audio segment. + * Seek positions are expressed as hundredths of seconds. + * The model may process several segments from a single seek position, so while the seek position will never + * represent + * a later time than the segment's start, the segment's start may represent a significantly later time than the + * segment's associated seek position. + */ + @Generated + @JsonProperty(value = "seek") + private int seek; + + /** + * Creates an instance of AudioTranscriptionSegment class. + * + * @param id the id value to set. + * @param start the start value to set. + * @param end the end value to set. + * @param text the text value to set. + * @param temperature the temperature value to set. + * @param avgLogprob the avgLogprob value to set. + * @param compressionRatio the compressionRatio value to set. + * @param noSpeechProb the noSpeechProb value to set. + * @param tokens the tokens value to set. + * @param seek the seek value to set. + */ + @Generated + private AudioTranscriptionSegment( + int id, + Duration start, + Duration end, + String text, + double temperature, + double avgLogprob, + double compressionRatio, + double noSpeechProb, + List tokens, + int seek) { + this.id = id; + this.start = (double) start.toNanos() / 1000_000_000L; + this.end = (double) end.toNanos() / 1000_000_000L; + this.text = text; + this.temperature = temperature; + this.avgLogprob = avgLogprob; + this.compressionRatio = compressionRatio; + this.noSpeechProb = noSpeechProb; + this.tokens = tokens; + this.seek = seek; + } + + @Generated + @JsonCreator + private AudioTranscriptionSegment( + @JsonProperty(value = "id") int id, + @JsonProperty(value = "start") double start, + @JsonProperty(value = "end") double end, + @JsonProperty(value = "text") String text, + @JsonProperty(value = "temperature") double temperature, + @JsonProperty(value = "avg_logprob") double avgLogprob, + @JsonProperty(value = "compression_ratio") double compressionRatio, + @JsonProperty(value = "no_speech_prob") double noSpeechProb, + @JsonProperty(value = "tokens") List tokens, + @JsonProperty(value = "seek") int seek) { + this( + id, + Duration.ofNanos((long) (start * 1000_000_000L)), + Duration.ofNanos((long) (end * 1000_000_000L)), + text, + temperature, + avgLogprob, + compressionRatio, + noSpeechProb, + tokens, + seek); + } + + /** + * Get the id property: The 0-based index of this segment within a transcription. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the start property: The time at which this segment started relative to the beginning of the transcribed + * audio. + * + * @return the start value. + */ + @Generated + public Duration getStart() { + return Duration.ofNanos((long) (this.start * 1000_000_000L)); + } + + /** + * Get the end property: The time at which this segment ended relative to the beginning of the transcribed audio. + * + * @return the end value. + */ + @Generated + public Duration getEnd() { + return Duration.ofNanos((long) (this.end * 1000_000_000L)); + } + + /** + * Get the text property: The transcribed text that was part of this audio segment. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the temperature property: The temperature score associated with this audio segment. + * + * @return the temperature value. + */ + @Generated + public double getTemperature() { + return this.temperature; + } + + /** + * Get the avgLogprob property: The average log probability associated with this audio segment. + * + * @return the avgLogprob value. + */ + @Generated + public double getAvgLogprob() { + return this.avgLogprob; + } + + /** + * Get the compressionRatio property: The compression ratio of this audio segment. + * + * @return the compressionRatio value. + */ + @Generated + public double getCompressionRatio() { + return this.compressionRatio; + } + + /** + * Get the noSpeechProb property: The probability of no speech detection within this audio segment. + * + * @return the noSpeechProb value. + */ + @Generated + public double getNoSpeechProb() { + return this.noSpeechProb; + } + + /** + * Get the tokens property: The token IDs matching the transcribed text in this audio segment. + * + * @return the tokens value. + */ + @Generated + public List getTokens() { + return this.tokens; + } + + /** + * Get the seek property: The seek position associated with the processing of this audio segment. Seek positions are + * expressed as hundredths of seconds. The model may process several segments from a single seek position, so while + * the seek position will never represent a later time than the segment's start, the segment's start may represent a + * significantly later time than the segment's associated seek position. + * + * @return the seek value. + */ + @Generated + public int getSeek() { + return this.seek; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslation.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslation.java new file mode 100644 index 000000000000..7c798bbbec16 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslation.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.ai.openai.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** Result information for an operation that translated spoken audio into written text. */ +@Immutable +public final class AudioTranslation { + + /* + * The translated text for the provided audio data. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The label that describes which operation type generated the accompanying response data. + */ + @Generated + @JsonProperty(value = "task") + private AudioTaskLabel task; + + /* + * The spoken language that was detected in the translated audio data. + * This is expressed as a two-letter ISO-639-1 language code like 'en' or 'fr'. + */ + @Generated + @JsonProperty(value = "language") + private String language; + + /* + * The total duration of the audio processed to produce accompanying translation information. + */ + @Generated + @JsonProperty(value = "duration") + private Double duration; + + /* + * A collection of information about the timing, probabilities, and other detail of each processed audio segment. + */ + @Generated + @JsonProperty(value = "segments") + private List segments; + + /** + * Creates an instance of AudioTranslation class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + private AudioTranslation(@JsonProperty(value = "text") String text) { + this.text = text; + } + + /** + * Get the text property: The translated text for the provided audio data. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the task property: The label that describes which operation type generated the accompanying response data. + * + * @return the task value. + */ + @Generated + public AudioTaskLabel getTask() { + return this.task; + } + + /** + * Get the language property: The spoken language that was detected in the translated audio data. This is expressed + * as a two-letter ISO-639-1 language code like 'en' or 'fr'. + * + * @return the language value. + */ + @Generated + public String getLanguage() { + return this.language; + } + + /** + * Get the duration property: The total duration of the audio processed to produce accompanying translation + * information. + * + * @return the duration value. + */ + @Generated + public Duration getDuration() { + if (this.duration == null) { + return null; + } + return Duration.ofNanos((long) (this.duration * 1000_000_000L)); + } + + /** + * Get the segments property: A collection of information about the timing, probabilities, and other detail of each + * processed audio segment. + * + * @return the segments value. + */ + @Generated + public List getSegments() { + return this.segments; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationFormat.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationFormat.java new file mode 100644 index 000000000000..eb9b53a3c2cc --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationFormat.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.ai.openai.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines available options for the underlying response format of output translation information. */ +public final class AudioTranslationFormat extends ExpandableStringEnum { + + /** Use a response body that is a JSON object containing a single 'text' field for the translation. */ + @Generated public static final AudioTranslationFormat JSON = fromString("json"); + + /** + * Use a response body that is a JSON object containing translation text along with timing, segments, and other + * metadata. + */ + @Generated public static final AudioTranslationFormat VERBOSE_JSON = fromString("verbose_json"); + + /** Use a response body that is plain text containing the raw, unannotated translation. */ + @Generated public static final AudioTranslationFormat TEXT = fromString("text"); + + /** Use a response body that is plain text in SubRip (SRT) format that also includes timing information. */ + @Generated public static final AudioTranslationFormat SRT = fromString("srt"); + + /** + * Use a response body that is plain text in Web Video Text Tracks (VTT) format that also includes timing + * information. + */ + @Generated public static final AudioTranslationFormat VTT = fromString("vtt"); + + /** + * Creates a new instance of AudioTranslationFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AudioTranslationFormat() {} + + /** + * Creates or finds a AudioTranslationFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding AudioTranslationFormat. + */ + @Generated + @JsonCreator + public static AudioTranslationFormat fromString(String name) { + return fromString(name, AudioTranslationFormat.class); + } + + /** + * Gets known AudioTranslationFormat values. + * + * @return known AudioTranslationFormat values. + */ + @Generated + public static Collection values() { + return values(AudioTranslationFormat.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationOptions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationOptions.java new file mode 100644 index 000000000000..8f883813827b --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationOptions.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.ai.openai.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The configuration information for an audio translation request. */ +@Fluent +public final class AudioTranslationOptions { + + /* + * The audio data to translate. This must be the binary content of a file in one of the supported media formats: + * flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. + */ + @Generated + @JsonProperty(value = "file") + private byte[] file; + + /* + * The requested format of the translation response data, which will influence the content and detail of the + * result. + */ + @Generated + @JsonProperty(value = "response_format") + private AudioTranslationFormat responseFormat; + + /* + * An optional hint to guide the model's style or continue from a prior audio segment. The written language of the + * prompt should match the primary spoken language of the audio data. + */ + @Generated + @JsonProperty(value = "prompt") + private String prompt; + + /* + * The sampling temperature, between 0 and 1. + * Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused + * and deterministic. + * If set to 0, the model will use log probability to automatically increase the temperature until certain + * thresholds are hit. + */ + @Generated + @JsonProperty(value = "temperature") + private Double temperature; + + /* + * The model to use for this translation request. + */ + @Generated + @JsonProperty(value = "model") + private String model; + + /** + * Creates an instance of AudioTranslationOptions class. + * + * @param file the file value to set. + */ + @Generated + @JsonCreator + public AudioTranslationOptions(@JsonProperty(value = "file") byte[] file) { + this.file = file; + } + + /** + * Get the file property: The audio data to translate. This must be the binary content of a file in one of the + * supported media formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. + * + * @return the file value. + */ + @Generated + public byte[] getFile() { + return CoreUtils.clone(this.file); + } + + /** + * Get the responseFormat property: The requested format of the translation response data, which will influence the + * content and detail of the result. + * + * @return the responseFormat value. + */ + @Generated + public AudioTranslationFormat getResponseFormat() { + return this.responseFormat; + } + + /** + * Get the prompt property: An optional hint to guide the model's style or continue from a prior audio segment. The + * written language of the prompt should match the primary spoken language of the audio data. + * + * @return the prompt value. + */ + @Generated + public String getPrompt() { + return this.prompt; + } + + /** + * Set the prompt property: An optional hint to guide the model's style or continue from a prior audio segment. The + * written language of the prompt should match the primary spoken language of the audio data. + * + * @param prompt the prompt value to set. + * @return the AudioTranslationOptions object itself. + */ + @Generated + public AudioTranslationOptions setPrompt(String prompt) { + this.prompt = prompt; + return this; + } + + /** + * Get the temperature property: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the + * output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the + * model will use log probability to automatically increase the temperature until certain thresholds are hit. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the + * output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the + * model will use log probability to automatically increase the temperature until certain thresholds are hit. + * + * @param temperature the temperature value to set. + * @return the AudioTranslationOptions object itself. + */ + @Generated + public AudioTranslationOptions setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the model property: The model to use for this translation request. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Set the model property: The model to use for this translation request. + * + * @param model the model value to set. + * @return the AudioTranslationOptions object itself. + */ + @Generated + public AudioTranslationOptions setModel(String model) { + this.model = model; + return this; + } + + /** + * Set the responseFormat property: The requested format of the translation response data, which will influence the + * content and detail of the result. + * + * @param responseFormat the responseFormat value to set. + * @return the AudioTranslationOptions object itself. + */ + @Generated + public AudioTranslationOptions setResponseFormat(AudioTranslationFormat responseFormat) { + this.responseFormat = responseFormat; + return this; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationSegment.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationSegment.java new file mode 100644 index 000000000000..fcfac6d1332d --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/AudioTranslationSegment.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. +package com.azure.ai.openai.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** + * Extended information about a single segment of translated audio data. Segments generally represent roughly 5-10 + * seconds of speech. Segment boundaries typically occur between words but not necessarily sentences. + */ +@Immutable +public final class AudioTranslationSegment { + + /* + * The 0-based index of this segment within a translation. + */ + @Generated + @JsonProperty(value = "id") + private int id; + + /* + * The time at which this segment started relative to the beginning of the translated audio. + */ + @Generated + @JsonProperty(value = "start") + private double start; + + /* + * The time at which this segment ended relative to the beginning of the translated audio. + */ + @Generated + @JsonProperty(value = "end") + private double end; + + /* + * The translated text that was part of this audio segment. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The temperature score associated with this audio segment. + */ + @Generated + @JsonProperty(value = "temperature") + private double temperature; + + /* + * The average log probability associated with this audio segment. + */ + @Generated + @JsonProperty(value = "avg_logprob") + private double avgLogprob; + + /* + * The compression ratio of this audio segment. + */ + @Generated + @JsonProperty(value = "compression_ratio") + private double compressionRatio; + + /* + * The probability of no speech detection within this audio segment. + */ + @Generated + @JsonProperty(value = "no_speech_prob") + private double noSpeechProb; + + /* + * The token IDs matching the translated text in this audio segment. + */ + @Generated + @JsonProperty(value = "tokens") + private List tokens; + + /* + * The seek position associated with the processing of this audio segment. + * Seek positions are expressed as hundredths of seconds. + * The model may process several segments from a single seek position, so while the seek position will never + * represent + * a later time than the segment's start, the segment's start may represent a significantly later time than the + * segment's associated seek position. + */ + @Generated + @JsonProperty(value = "seek") + private int seek; + + /** + * Creates an instance of AudioTranslationSegment class. + * + * @param id the id value to set. + * @param start the start value to set. + * @param end the end value to set. + * @param text the text value to set. + * @param temperature the temperature value to set. + * @param avgLogprob the avgLogprob value to set. + * @param compressionRatio the compressionRatio value to set. + * @param noSpeechProb the noSpeechProb value to set. + * @param tokens the tokens value to set. + * @param seek the seek value to set. + */ + @Generated + private AudioTranslationSegment( + int id, + Duration start, + Duration end, + String text, + double temperature, + double avgLogprob, + double compressionRatio, + double noSpeechProb, + List tokens, + int seek) { + this.id = id; + this.start = (double) start.toNanos() / 1000_000_000L; + this.end = (double) end.toNanos() / 1000_000_000L; + this.text = text; + this.temperature = temperature; + this.avgLogprob = avgLogprob; + this.compressionRatio = compressionRatio; + this.noSpeechProb = noSpeechProb; + this.tokens = tokens; + this.seek = seek; + } + + @Generated + @JsonCreator + private AudioTranslationSegment( + @JsonProperty(value = "id") int id, + @JsonProperty(value = "start") double start, + @JsonProperty(value = "end") double end, + @JsonProperty(value = "text") String text, + @JsonProperty(value = "temperature") double temperature, + @JsonProperty(value = "avg_logprob") double avgLogprob, + @JsonProperty(value = "compression_ratio") double compressionRatio, + @JsonProperty(value = "no_speech_prob") double noSpeechProb, + @JsonProperty(value = "tokens") List tokens, + @JsonProperty(value = "seek") int seek) { + this( + id, + Duration.ofNanos((long) (start * 1000_000_000L)), + Duration.ofNanos((long) (end * 1000_000_000L)), + text, + temperature, + avgLogprob, + compressionRatio, + noSpeechProb, + tokens, + seek); + } + + /** + * Get the id property: The 0-based index of this segment within a translation. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the start property: The time at which this segment started relative to the beginning of the translated audio. + * + * @return the start value. + */ + @Generated + public Duration getStart() { + return Duration.ofNanos((long) (this.start * 1000_000_000L)); + } + + /** + * Get the end property: The time at which this segment ended relative to the beginning of the translated audio. + * + * @return the end value. + */ + @Generated + public Duration getEnd() { + return Duration.ofNanos((long) (this.end * 1000_000_000L)); + } + + /** + * Get the text property: The translated text that was part of this audio segment. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the temperature property: The temperature score associated with this audio segment. + * + * @return the temperature value. + */ + @Generated + public double getTemperature() { + return this.temperature; + } + + /** + * Get the avgLogprob property: The average log probability associated with this audio segment. + * + * @return the avgLogprob value. + */ + @Generated + public double getAvgLogprob() { + return this.avgLogprob; + } + + /** + * Get the compressionRatio property: The compression ratio of this audio segment. + * + * @return the compressionRatio value. + */ + @Generated + public double getCompressionRatio() { + return this.compressionRatio; + } + + /** + * Get the noSpeechProb property: The probability of no speech detection within this audio segment. + * + * @return the noSpeechProb value. + */ + @Generated + public double getNoSpeechProb() { + return this.noSpeechProb; + } + + /** + * Get the tokens property: The token IDs matching the translated text in this audio segment. + * + * @return the tokens value. + */ + @Generated + public List getTokens() { + return this.tokens; + } + + /** + * Get the seek property: The seek position associated with the processing of this audio segment. Seek positions are + * expressed as hundredths of seconds. The model may process several segments from a single seek position, so while + * the seek position will never represent a later time than the segment's start, the segment's start may represent a + * significantly later time than the segment's associated seek position. + * + * @return the seek value. + */ + @Generated + public int getSeek() { + return this.seek; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletions.java index 130e19328391..d3609f04ac02 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletions.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletions.java @@ -99,18 +99,30 @@ public OffsetDateTime getCreatedAt() { * results for different prompts may arrive at different times or in different orders. */ @Generated - @JsonProperty(value = "prompt_annotations") + @JsonProperty(value = "prompt_filter_results") private List promptFilterResults; + /** + * Backing member for the prompt filtering result during the rename transition. More details here + * + * @deprecated This field is only used for deserialization. + */ + @Deprecated + @JsonProperty(value = "prompt_annotations") + private List promptAnnotations; + /** * Get the promptFilterResults property: Content filtering results for zero or more prompts in the request. In a * streaming request, results for different prompts may arrive at different times or in different orders. * * @return the promptFilterResults value. */ - @Generated public List getPromptFilterResults() { - return this.promptFilterResults; + if (this.promptFilterResults != null) { + return this.promptFilterResults; + } + return this.promptAnnotations; } /** diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Completions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Completions.java index 3b190350fba9..d5e2bacc8c6c 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Completions.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Completions.java @@ -80,18 +80,30 @@ public CompletionsUsage getUsage() { * results for different prompts may arrive at different times or in different orders. */ @Generated - @JsonProperty(value = "prompt_annotations") + @JsonProperty(value = "prompt_filter_results") private List promptFilterResults; + /** + * Backing member for the prompt filtering result during the rename transition. More details here + * + * @deprecated This field is only used for deserialization. + */ + @Deprecated + @JsonProperty(value = "prompt_annotations") + private List promptAnnotations; + /** * Get the promptFilterResults property: Content filtering results for zero or more prompts in the request. In a * streaming request, results for different prompts may arrive at different times or in different orders. * * @return the promptFilterResults value. */ - @Generated public List getPromptFilterResults() { - return this.promptFilterResults; + if (this.promptFilterResults != null) { + return this.promptFilterResults; + } + return this.promptAnnotations; } /* diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResults.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResults.java index 65883af4465f..2c1c3c668bd3 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResults.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResults.java @@ -5,6 +5,7 @@ import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; import com.fasterxml.jackson.annotation.JsonProperty; /** Information about the content filtering category, if it has been detected. */ @@ -98,4 +99,23 @@ public ContentFilterResult getSelfHarm() { /** Creates an instance of ContentFilterResults class. */ @Generated private ContentFilterResults() {} + + /* + * Describes an error returned if the content filtering system is + * down or otherwise unable to complete the operation in time. + */ + @Generated + @JsonProperty(value = "error") + private ResponseError error; + + /** + * Get the error property: Describes an error returned if the content filtering system is down or otherwise unable + * to complete the operation in time. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/module-info.java b/sdk/openai/azure-ai-openai/src/main/java/module-info.java index 07571db1c578..c8eafa553ff1 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/module-info.java +++ b/sdk/openai/azure-ai-openai/src/main/java/module-info.java @@ -4,11 +4,9 @@ module com.azure.ai.openai { requires transitive com.azure.core; - requires transitive com.azure.core.experimental; exports com.azure.ai.openai; exports com.azure.ai.openai.models; - exports com.azure.ai.openai.implementation.models; opens com.azure.ai.openai.models to com.azure.core, diff --git a/sdk/openai/azure-ai-openai/src/samples/README.md b/sdk/openai/azure-ai-openai/src/samples/README.md index cf37cf05b527..fa5a898c27eb 100644 --- a/sdk/openai/azure-ai-openai/src/samples/README.md +++ b/sdk/openai/azure-ai-openai/src/samples/README.md @@ -28,12 +28,16 @@ Synchronous: - [Chat Completions][sample_get_chat_completions] - [Embeddings][sample_get_embedding] - [Image Generation][sample_image_generation] +- [Audio Transcription][sample_audio_transcription] +- [Audio Translation][sample_audio_translation] Asynchronous: - [Text Completions][async_sample_get_completions] - [Chat Completions][async_sample_get_chat_completions] - [Embeddings][async_sample_get_embedding] - [Image Generation][async_sample_image_generation] +- [Audio Transcription][async_sample_audio_transcription] +- [Audio Translation][async_sample_audio_translation] Cookbook: - [Chat bot][cookbook_chat_bot] @@ -66,11 +70,15 @@ This project welcomes contributions and suggestions. Find [more contributing][SD [async_sample_get_chat_completions]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetChatCompletionsAsyncSample.java [async_sample_get_embedding]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetEmbeddingsAsyncSample.java [async_sample_image_generation]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetImagesAsyncSample.java +[async_sample_audio_transcription]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranscriptionAsyncSample.java +[async_sample_audio_translation]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranslationAsyncSample.java [sample_get_completions]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetCompletionsSample.java [sample_get_chat_completions]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetChatCompletionsSample.java [sample_get_embedding]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetEmbeddingsSample.java [sample_image_generation]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/GetImagesSample.java +[sample_audio_transcription]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranscriptionSample.java +[sample_audio_translation]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranslationSample.java [cookbook_chat_bot]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/ChatbotSample.java [cookbook_chat_bot_with_key]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/ChatbotWithKeySample.java diff --git a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/ChatCompletionsWithYourData.java b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/ChatCompletionsWithYourData.java index 0d732704c90c..fecaa9dccf77 100644 --- a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/ChatCompletionsWithYourData.java +++ b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/ChatCompletionsWithYourData.java @@ -29,7 +29,7 @@ public class ChatCompletionsWithYourData { * * @param args Unused. Arguments to the program. */ - public static void main(String[] args){ + public static void main(String[] args) { String azureOpenaiKey = "{azure-open-ai-key}"; String endpoint = "{azure-open-ai-endpoint}"; String deploymentOrModelId = "{azure-open-ai-deployment-model-id}"; diff --git a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/SummarizeTextSample.java b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/SummarizeTextSample.java index 372a4cb1f7a6..ebaf0982754d 100644 --- a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/SummarizeTextSample.java +++ b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/SummarizeTextSample.java @@ -49,5 +49,4 @@ public static void main(String[] args) throws InterruptedException { // .subscribe() will turn this into a synchronous call. TimeUnit.SECONDS.sleep(10); } - } diff --git a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/impl/ReadmeSamples.java b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/impl/ReadmeSamples.java index 3384e3cb3e2f..df80c246ad77 100644 --- a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/impl/ReadmeSamples.java +++ b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/impl/ReadmeSamples.java @@ -6,6 +6,12 @@ import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClient; import com.azure.ai.openai.OpenAIClientBuilder; +import com.azure.ai.openai.models.AudioTranscription; +import com.azure.ai.openai.models.AudioTranscriptionFormat; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.ai.openai.models.AudioTranslation; +import com.azure.ai.openai.models.AudioTranslationFormat; +import com.azure.ai.openai.models.AudioTranslationOptions; import com.azure.ai.openai.models.ChatChoice; import com.azure.ai.openai.models.ChatCompletions; import com.azure.ai.openai.models.ChatCompletionsOptions; @@ -25,11 +31,14 @@ import com.azure.core.credential.TokenCredential; import com.azure.core.http.ProxyOptions; import com.azure.core.models.ResponseError; +import com.azure.core.util.BinaryData; import com.azure.core.util.HttpClientOptions; import com.azure.core.util.IterableStream; import com.azure.identity.DefaultAzureCredentialBuilder; import java.net.InetSocketAddress; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -221,4 +230,34 @@ public void imageGeneration() { } // END: readme-sample-imageGeneration } + + public void audioTranscription() { + // BEGIN: readme-sample-audioTranscription + String fileName = "{your-file-name}"; + Path filePath = Paths.get("{your-file-path}" + fileName); + + byte[] file = BinaryData.fromFile(filePath).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file) + .setResponseFormat(AudioTranscriptionFormat.JSON); + + AudioTranscription transcription = client.getAudioTranscription("{deploymentOrModelId}", fileName, transcriptionOptions); + + System.out.println("Transcription: " + transcription.getText()); + // END: readme-sample-audioTranscription + } + + public void audioTranslation() { + // BEGIN: readme-sample-audioTranslation + String fileName = "{your-file-name}"; + Path filePath = Paths.get("{your-file-path}" + fileName); + + byte[] file = BinaryData.fromFile(filePath).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file) + .setResponseFormat(AudioTranslationFormat.JSON); + + AudioTranslation translation = client.getAudioTranslation("{deploymentOrModelId}", fileName, translationOptions); + + System.out.println("Translation: " + translation.getText()); + // END: readme-sample-audioTranslation + } } diff --git a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/resources/JP_it_is_rainy_today.wav b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/resources/JP_it_is_rainy_today.wav new file mode 100644 index 000000000000..5970c85ec1cd Binary files /dev/null and b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/resources/JP_it_is_rainy_today.wav differ diff --git a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/resources/batman.wav b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/resources/batman.wav new file mode 100644 index 000000000000..4c0b7248a39c Binary files /dev/null and b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/resources/batman.wav differ diff --git a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranscriptionAsyncSample.java b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranscriptionAsyncSample.java new file mode 100644 index 000000000000..fbebd49b5965 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranscriptionAsyncSample.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.usage; + +import com.azure.ai.openai.OpenAIAsyncClient; +import com.azure.ai.openai.OpenAIClientBuilder; +import com.azure.ai.openai.models.AudioTranscriptionFormat; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.util.BinaryData; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.concurrent.TimeUnit; + +/** + * An asynchronous sample demonstrates how to transcript a given audio file. + */ +public class AudioTranscriptionAsyncSample { + /** + * Runs the sample algorithm and demonstrates how to transcript a given audio file. + * + * @param args Unused. Arguments to the program. + */ + public static void main(String[] args) throws InterruptedException { + String azureOpenaiKey = "{azure-open-ai-key}"; + String endpoint = "{azure-open-ai-endpoint}"; + String deploymentOrModelId = "{azure-open-ai-deployment-model-id}"; + String fileName = "batman.wav"; + Path filePath = Paths.get("src/samples/java/com/azure/ai/openai/resources/" + fileName); + + OpenAIAsyncClient client = new OpenAIClientBuilder() + .endpoint(endpoint) + .credential(new AzureKeyCredential(azureOpenaiKey)) + .buildAsyncClient(); + + byte[] file = BinaryData.fromFile(filePath).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file) + .setResponseFormat(AudioTranscriptionFormat.JSON); + + client.getAudioTranscription(deploymentOrModelId, fileName, transcriptionOptions) + .subscribe(transcription -> { + System.out.println("Transcription: " + transcription.getText()); + }); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + TimeUnit.SECONDS.sleep(10); + } +} diff --git a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranscriptionSample.java b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranscriptionSample.java new file mode 100644 index 000000000000..e16238116533 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranscriptionSample.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.usage; + +import com.azure.ai.openai.OpenAIClient; +import com.azure.ai.openai.OpenAIClientBuilder; +import com.azure.ai.openai.models.AudioTranscription; +import com.azure.ai.openai.models.AudioTranscriptionFormat; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.util.BinaryData; + +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * A sample demonstrates how to transcript a given audio file. + */ +public class AudioTranscriptionSample { + /** + * Runs the sample algorithm and demonstrates how to get the images for a given prompt. + * + * @param args Unused. Arguments to the program. + */ + public static void main(String[] args) { + String azureOpenaiKey = "{azure-open-ai-key}"; + String endpoint = "{azure-open-ai-endpoint}"; + String deploymentOrModelId = "{azure-open-ai-deployment-model-id}"; + String fileName = "batman.wav"; + Path filePath = Paths.get("src/samples/java/com/azure/ai/openai/resources/" + fileName); + + OpenAIClient client = new OpenAIClientBuilder() + .endpoint(endpoint) + .credential(new AzureKeyCredential(azureOpenaiKey)) + .buildClient(); + + byte[] file = BinaryData.fromFile(filePath).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file) + .setResponseFormat(AudioTranscriptionFormat.JSON); + + AudioTranscription transcription = client.getAudioTranscription(deploymentOrModelId, fileName, transcriptionOptions); + + System.out.println("Transcription: " + transcription.getText()); + } +} diff --git a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranslationAsyncSample.java b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranslationAsyncSample.java new file mode 100644 index 000000000000..4bc25c36ec9a --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranslationAsyncSample.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.usage; + +import com.azure.ai.openai.OpenAIAsyncClient; +import com.azure.ai.openai.OpenAIClientBuilder; +import com.azure.ai.openai.models.AudioTranslationFormat; +import com.azure.ai.openai.models.AudioTranslationOptions; +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.util.BinaryData; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.concurrent.TimeUnit; + +/** + * An asynchronous sample demonstrates how to translate a given audio file. + */ +public class AudioTranslationAsyncSample { + /** + * Runs the sample algorithm and demonstrates how to translate a given audio file. + * + * @param args Unused. Arguments to the program. + */ + public static void main(String[] args) throws InterruptedException { + String azureOpenaiKey = "{azure-open-ai-key}"; + String endpoint = "{azure-open-ai-endpoint}"; + String deploymentOrModelId = "{azure-open-ai-deployment-model-id}"; + String fileName = "JP_it_is_rainy_today.wav"; + Path filePath = Paths.get("src/samples/java/com/azure/ai/openai/resources/" + fileName); + + OpenAIAsyncClient client = new OpenAIClientBuilder() + .endpoint(endpoint) + .credential(new AzureKeyCredential(azureOpenaiKey)) + .buildAsyncClient(); + byte[] file = BinaryData.fromFile(filePath).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file) + .setResponseFormat(AudioTranslationFormat.JSON); + + client.getAudioTranslation(deploymentOrModelId, fileName, translationOptions) + .subscribe(translation -> { + System.out.println("Translation: " + translation.getText()); + }); + + // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep + // the thread so the program does not end before the send operation is complete. Using .block() instead of + // .subscribe() will turn this into a synchronous call. + TimeUnit.SECONDS.sleep(10); + } +} diff --git a/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranslationSample.java b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranslationSample.java new file mode 100644 index 000000000000..e4abc86227ea --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/samples/java/com/azure/ai/openai/usage/AudioTranslationSample.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.usage; + +import com.azure.ai.openai.OpenAIClient; +import com.azure.ai.openai.OpenAIClientBuilder; +import com.azure.ai.openai.models.AudioTranslation; +import com.azure.ai.openai.models.AudioTranslationFormat; +import com.azure.ai.openai.models.AudioTranslationOptions; +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.util.BinaryData; + +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * A sample demonstrates how to translate a given audio file. + */ +public class AudioTranslationSample { + /** + * Runs the sample algorithm and demonstrates how to translate a given audio file. + * + * @param args Unused. Arguments to the program. + */ + public static void main(String[] args) { + String azureOpenaiKey = "{azure-open-ai-key}"; + String endpoint = "{azure-open-ai-endpoint}"; + String deploymentOrModelId = "{azure-open-ai-deployment-model-id}"; + String fileName = "JP_it_is_rainy_today.wav"; + Path filePath = Paths.get("src/samples/java/com/azure/ai/openai/resources/" + fileName); + + OpenAIClient client = new OpenAIClientBuilder() + .endpoint(endpoint) + .credential(new AzureKeyCredential(azureOpenaiKey)) + .buildClient(); + byte[] file = BinaryData.fromFile(filePath).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file) + .setResponseFormat(AudioTranslationFormat.JSON); + + AudioTranslation translation = client.getAudioTranslation(deploymentOrModelId, fileName, translationOptions); + + System.out.println("Translation: " + translation.getText()); + } +} diff --git a/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/NonAzureOpenAIAsyncClientTest.java b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/NonAzureOpenAIAsyncClientTest.java index 7cc7ec3429c6..39702cd343ff 100644 --- a/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/NonAzureOpenAIAsyncClientTest.java +++ b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/NonAzureOpenAIAsyncClientTest.java @@ -4,6 +4,11 @@ package com.azure.ai.openai; import com.azure.ai.openai.functions.MyFunctionCallArguments; +import com.azure.ai.openai.models.AudioTaskLabel; +import com.azure.ai.openai.models.AudioTranscriptionFormat; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.ai.openai.models.AudioTranslationFormat; +import com.azure.ai.openai.models.AudioTranslationOptions; import com.azure.ai.openai.models.ChatChoice; import com.azure.ai.openai.models.ChatCompletions; import com.azure.ai.openai.models.ChatCompletionsOptions; @@ -25,6 +30,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import static com.azure.ai.openai.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -322,4 +328,281 @@ public void testCompletionContentFiltering(HttpClient httpClient, OpenAIServiceV }).verifyComplete(); }); } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.JSON); + + StepVerifier.create(client.getAudioTranscription(deploymentName, fileName, transcriptionOptions)) + .assertNext(transcription -> + assertAudioTranscriptionSimpleJson(transcription, BATMAN_TRANSCRIPTION)) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionVerboseJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.VERBOSE_JSON); + + StepVerifier.create(client.getAudioTranscription(deploymentName, fileName, transcriptionOptions)) + .assertNext(transcription -> + assertAudioTranscriptionVerboseJson(transcription, BATMAN_TRANSCRIPTION, AudioTaskLabel.TRANSCRIBE)) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionTextPlain(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.TEXT); + + StepVerifier.create(client.getAudioTranscriptionText(deploymentName, fileName, transcriptionOptions)) + .assertNext(transcription -> + // A plain/text request adds a line break as an artifact. Also observed for translations + assertEquals(BATMAN_TRANSCRIPTION + "\n", transcription)) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionSrt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.SRT); + + StepVerifier.create(client.getAudioTranscriptionText(modelId, fileName, transcriptionOptions)) + .assertNext(translation -> { + // Sequence number + assertTrue(translation.contains("1\n")); + // First sequence starts at timestamp 0 + assertTrue(translation.contains("00:00:00,000 --> ")); + // Contains at least one expected word + assertTrue(translation.contains("Batman")); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionVtt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.VTT); + + StepVerifier.create(client.getAudioTranscriptionText(modelId, fileName, transcriptionOptions)) + .assertNext(translation -> { + // Start value according to spec + assertTrue(translation.startsWith("WEBVTT\n")); + // First sequence starts at timestamp 0. Note: unlike SRT, the millisecond separator is a "." + assertTrue(translation.contains("00:00:00.000 --> ")); + // Contains at least one expected word + assertTrue(translation.contains("Batman")); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionTextWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + List wrongFormats = Arrays.asList( + AudioTranscriptionFormat.JSON, + AudioTranscriptionFormat.VERBOSE_JSON + ); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + + for (AudioTranscriptionFormat format: wrongFormats) { + transcriptionOptions.setResponseFormat(format); + StepVerifier.create(client.getAudioTranscriptionText(modelId, fileName, transcriptionOptions)) + .verifyErrorSatisfies(error -> assertTrue(error instanceof IllegalArgumentException)); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionJsonWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + List wrongFormats = Arrays.asList( + AudioTranscriptionFormat.TEXT, + AudioTranscriptionFormat.SRT, + AudioTranscriptionFormat.VTT + ); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + + for (AudioTranscriptionFormat format: wrongFormats) { + transcriptionOptions.setResponseFormat(format); + StepVerifier.create(client.getAudioTranscription(modelId, fileName, transcriptionOptions)) + .verifyErrorSatisfies(error -> assertTrue(error instanceof IllegalArgumentException)); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.JSON); + + StepVerifier.create(client.getAudioTranslation(modelId, fileName, translationOptions)) + .assertNext(translation -> + assertAudioTranslationSimpleJson(translation, "It's raining today.")) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationVerboseJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.VERBOSE_JSON); + + StepVerifier.create(client.getAudioTranslation(modelId, fileName, translationOptions)) + .assertNext(translation -> + assertAudioTranslationVerboseJson(translation, "It's raining today.", AudioTaskLabel.TRANSLATE)) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationTextPlain(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.TEXT); + + StepVerifier.create(client.getAudioTranslationText(modelId, fileName, translationOptions)) + .assertNext(translation -> { + assertEquals("It's raining today.\n", translation); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationSrt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.SRT); + + StepVerifier.create(client.getAudioTranslationText(modelId, fileName, translationOptions)) + .assertNext(translation -> { + // Sequence number + assertTrue(translation.contains("1\n")); + // First sequence starts at timestamp 0 + assertTrue(translation.contains("00:00:00,000 --> ")); + // Actual translation value + assertTrue(translation.contains("It's raining today.")); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationVtt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.VTT); + + StepVerifier.create(client.getAudioTranslationText(modelId, fileName, translationOptions)) + .assertNext(translation -> { + // Start value according to spec + assertTrue(translation.startsWith("WEBVTT\n")); + // First sequence starts at timestamp 0. Note: unlike SRT, the millisecond separator is a "." + assertTrue(translation.contains("00:00:00.000 --> ")); + // Actual translation value + assertTrue(translation.contains("It's raining today.")); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationTextWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + List wrongFormats = Arrays.asList( + AudioTranslationFormat.JSON, + AudioTranslationFormat.VERBOSE_JSON + ); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + + for (AudioTranslationFormat format: wrongFormats) { + translationOptions.setResponseFormat(format); + StepVerifier.create(client.getAudioTranslationText(modelId, fileName, translationOptions)) + .verifyErrorSatisfies(error -> assertTrue(error instanceof IllegalArgumentException)); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationJsonWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAIAsyncClient(httpClient); + List wrongFormats = Arrays.asList( + AudioTranslationFormat.TEXT, + AudioTranslationFormat.SRT, + AudioTranslationFormat.VTT + ); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + + for (AudioTranslationFormat format: wrongFormats) { + translationOptions.setResponseFormat(format); + StepVerifier.create(client.getAudioTranslation(modelId, fileName, translationOptions)) + .verifyErrorSatisfies(error -> assertTrue(error instanceof IllegalArgumentException)); + } + }); + } } diff --git a/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/NonAzureOpenAISyncClientTest.java b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/NonAzureOpenAISyncClientTest.java index 43af2bf9bc43..f0c41f3432a0 100644 --- a/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/NonAzureOpenAISyncClientTest.java +++ b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/NonAzureOpenAISyncClientTest.java @@ -4,6 +4,13 @@ package com.azure.ai.openai; import com.azure.ai.openai.functions.MyFunctionCallArguments; +import com.azure.ai.openai.models.AudioTaskLabel; +import com.azure.ai.openai.models.AudioTranscription; +import com.azure.ai.openai.models.AudioTranscriptionFormat; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.ai.openai.models.AudioTranslation; +import com.azure.ai.openai.models.AudioTranslationFormat; +import com.azure.ai.openai.models.AudioTranslationOptions; import com.azure.ai.openai.models.ChatChoice; import com.azure.ai.openai.models.ChatCompletions; import com.azure.ai.openai.models.ChatCompletionsOptions; @@ -25,6 +32,7 @@ import org.junit.jupiter.params.provider.MethodSource; import java.util.Arrays; +import java.util.List; import static com.azure.ai.openai.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -274,4 +282,265 @@ public void testCompletionContentFiltering(HttpClient httpClient, OpenAIServiceV assertNull(completions.getChoices().get(0).getContentFilterResults()); }); } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.JSON); + + AudioTranscription transcription = client.getAudioTranscription(modelId, fileName, transcriptionOptions); + assertAudioTranscriptionSimpleJson(transcription, BATMAN_TRANSCRIPTION); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionVerboseJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.VERBOSE_JSON); + + AudioTranscription transcription = client.getAudioTranscription(modelId, fileName, transcriptionOptions); + assertAudioTranscriptionVerboseJson(transcription, BATMAN_TRANSCRIPTION, AudioTaskLabel.TRANSCRIBE); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionTextPlain(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.TEXT); + + String transcription = client.getAudioTranscriptionText(modelId, fileName, transcriptionOptions); + // A plain/text request adds a line break as an artifact. Also observed for translations + assertEquals(BATMAN_TRANSCRIPTION + "\n", transcription); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionSrt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.SRT); + + String transcription = client.getAudioTranscriptionText(modelId, fileName, transcriptionOptions); + // Sequence number + assertTrue(transcription.contains("1\n")); + // First sequence starts at timestamp 0 + assertTrue(transcription.contains("00:00:00,000 --> ")); + // Contains one expected word + assertTrue(transcription.contains("Batman")); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionVtt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.VTT); + + String transcription = client.getAudioTranscriptionText(modelId, fileName, transcriptionOptions); + // Start value according to spec + assertTrue(transcription.startsWith("WEBVTT\n")); + // First sequence starts at timestamp 0. Note: unlike SRT, the millisecond separator is a "." + assertTrue(transcription.contains("00:00:00.000 --> ")); + // Contains at least one expected word + assertTrue(transcription.contains("Batman")); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionTextWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + List wrongFormats = Arrays.asList( + AudioTranscriptionFormat.JSON, + AudioTranscriptionFormat.VERBOSE_JSON + ); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + + for (AudioTranscriptionFormat format: wrongFormats) { + transcriptionOptions.setResponseFormat(format); + assertThrows(IllegalArgumentException.class, () -> { + client.getAudioTranscriptionText(modelId, fileName, transcriptionOptions); + }); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionJsonWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + List wrongFormats = Arrays.asList( + AudioTranscriptionFormat.TEXT, + AudioTranscriptionFormat.SRT, + AudioTranscriptionFormat.VTT + ); + + getAudioTranscriptionRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + + for (AudioTranscriptionFormat format: wrongFormats) { + transcriptionOptions.setResponseFormat(format); + assertThrows(IllegalArgumentException.class, () -> { + client.getAudioTranscription(modelId, fileName, transcriptionOptions); + }); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.JSON); + + AudioTranslation translation = client.getAudioTranslation(modelId, fileName, translationOptions); + assertAudioTranslationSimpleJson(translation, "It's raining today."); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationVerboseJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.VERBOSE_JSON); + + AudioTranslation translation = client.getAudioTranslation(modelId, fileName, translationOptions); + assertAudioTranslationVerboseJson(translation, "It's raining today.", AudioTaskLabel.TRANSLATE); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationTextPlain(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.TEXT); + + String transcription = client.getAudioTranslationText(modelId, fileName, translationOptions); + assertEquals("It's raining today.\n", transcription); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationSrt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.SRT); + + String transcription = client.getAudioTranslationText(modelId, fileName, translationOptions); + // Sequence number + assertTrue(transcription.contains("1\n")); + // First sequence starts at timestamp 0 + assertTrue(transcription.contains("00:00:00,000 --> ")); + // Actual translation value + assertTrue(transcription.contains("It's raining today.")); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationVtt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.VTT); + + String transcription = client.getAudioTranslationText(modelId, fileName, translationOptions); + // Start value according to spec + assertTrue(transcription.startsWith("WEBVTT\n")); + // First sequence starts at timestamp 0. Note: unlike SRT, the millisecond separator is a "." + assertTrue(transcription.contains("00:00:00.000 --> ")); + // Actual translation value + assertTrue(transcription.contains("It's raining today.")); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationTextWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + List wrongFormats = Arrays.asList( + AudioTranslationFormat.JSON, + AudioTranslationFormat.VERBOSE_JSON + ); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + + for (AudioTranslationFormat format: wrongFormats) { + translationOptions.setResponseFormat(format); + assertThrows(IllegalArgumentException.class, () -> { + client.getAudioTranslationText(modelId, fileName, translationOptions); + }); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationJsonWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getNonAzureOpenAISyncClient(httpClient); + List wrongFormats = Arrays.asList( + AudioTranslationFormat.TEXT, + AudioTranslationFormat.SRT, + AudioTranslationFormat.VTT + ); + + getAudioTranslationRunnerForNonAzure((modelId, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + + for (AudioTranslationFormat format: wrongFormats) { + translationOptions.setResponseFormat(format); + assertThrows(IllegalArgumentException.class, () -> { + client.getAudioTranslation(modelId, fileName, translationOptions); + }); + } + }); + } } diff --git a/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/OpenAIAsyncClientTest.java b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/OpenAIAsyncClientTest.java index 0c99aa4a6fb4..98d92ace7c0e 100644 --- a/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/OpenAIAsyncClientTest.java +++ b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/OpenAIAsyncClientTest.java @@ -4,6 +4,11 @@ package com.azure.ai.openai; import com.azure.ai.openai.functions.MyFunctionCallArguments; +import com.azure.ai.openai.models.AudioTaskLabel; +import com.azure.ai.openai.models.AudioTranscriptionFormat; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.ai.openai.models.AudioTranslationFormat; +import com.azure.ai.openai.models.AudioTranslationOptions; import com.azure.ai.openai.models.AzureChatExtensionConfiguration; import com.azure.ai.openai.models.AzureChatExtensionType; import com.azure.ai.openai.models.AzureCognitiveSearchChatExtensionConfiguration; @@ -31,6 +36,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; +import java.util.List; import static com.azure.ai.openai.TestUtils.DISPLAY_NAME_WITH_ARGUMENTS; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -383,8 +389,6 @@ public void testCompletionStreamContentFiltering(HttpClient httpClient, OpenAISe client = getOpenAIAsyncClient(httpClient, serviceVersion); getCompletionsContentFilterRunner((modelId, prompt) -> { CompletionsOptions completionsOptions = new CompletionsOptions(Arrays.asList(prompt)); - // work around for this model, there seem to be some issues with Completions in gpt-turbo models - completionsOptions.setMaxTokens(2000); StepVerifier.create(client.getCompletionsStream(modelId, completionsOptions)) .recordWith(ArrayList::new) .thenConsumeWhile(chatCompletions -> { @@ -398,14 +402,16 @@ public void testCompletionStreamContentFiltering(HttpClient httpClient, OpenAISe for (Iterator it = messageList.iterator(); it.hasNext();) { Completions completions = it.next(); if (i == 0) { - // The first stream message has the prompt filter result + System.out.println("First stream message"); assertEquals(1, completions.getPromptFilterResults().size()); assertSafeContentFilterResults(completions.getPromptFilterResults().get(0).getContentFilterResults()); } else if (i == messageList.size() - 1) { // The last stream message is empty with all the filters set to null assertEquals(1, completions.getChoices().size()); Choice choice = completions.getChoices().get(0); - + // TODO: service issue: we could have "length" as the finish reason. + // Non-Streaming happens less frequency than streaming API. + // https://github.com/Azure/azure-sdk-for-java/issues/36894 assertEquals(CompletionsFinishReason.fromString("stop"), choice.getFinishReason()); assertNotNull(choice.getText()); @@ -475,4 +481,281 @@ public void testChatCompletionsStreamingBasicSearchExtension(HttpClient httpClie .verifyComplete(); }); } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.JSON); + + StepVerifier.create(client.getAudioTranscription(deploymentName, fileName, transcriptionOptions)) + .assertNext(transcription -> + assertAudioTranscriptionSimpleJson(transcription, BATMAN_TRANSCRIPTION)) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionVerboseJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.VERBOSE_JSON); + + StepVerifier.create(client.getAudioTranscription(deploymentName, fileName, transcriptionOptions)) + .assertNext(transcription -> + assertAudioTranscriptionVerboseJson(transcription, BATMAN_TRANSCRIPTION, AudioTaskLabel.TRANSCRIBE)) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionTextPlain(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.TEXT); + + StepVerifier.create(client.getAudioTranscriptionText(deploymentName, fileName, transcriptionOptions)) + .assertNext(transcription -> + // A plain/text request adds a line break as an artifact. Also observed for translations + assertEquals(BATMAN_TRANSCRIPTION + "\n", transcription)) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionSrt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.SRT); + + StepVerifier.create(client.getAudioTranscriptionText(deploymentName, fileName, transcriptionOptions)) + .assertNext(translation -> { + // 1st Sequence number + assertTrue(translation.contains("1\n")); + // First sequence starts at timestamp 0 + assertTrue(translation.contains("00:00:00,000 --> ")); + // Transcription contains at least one expected word + assertTrue(translation.contains("Batman")); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionVtt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.VTT); + + StepVerifier.create(client.getAudioTranscriptionText(deploymentName, fileName, transcriptionOptions)) + .assertNext(translation -> { + // Start value according to spec + assertTrue(translation.startsWith("WEBVTT\n")); + // First sequence starts at timestamp 0. Note: unlike SRT, the millisecond separator is a "." + assertTrue(translation.contains("00:00:00.000 --> ")); + // Transcription contains at least one expected word + assertTrue(translation.contains("Batman")); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionTextWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + List wrongFormats = Arrays.asList( + AudioTranscriptionFormat.JSON, + AudioTranscriptionFormat.VERBOSE_JSON + ); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + + for (AudioTranscriptionFormat format: wrongFormats) { + transcriptionOptions.setResponseFormat(format); + StepVerifier.create(client.getAudioTranscriptionText(deploymentName, fileName, transcriptionOptions)) + .verifyErrorSatisfies(error -> assertTrue(error instanceof IllegalArgumentException)); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionJsonWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + List wrongFormats = Arrays.asList( + AudioTranscriptionFormat.TEXT, + AudioTranscriptionFormat.SRT, + AudioTranscriptionFormat.VTT + ); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + + for (AudioTranscriptionFormat format: wrongFormats) { + transcriptionOptions.setResponseFormat(format); + StepVerifier.create(client.getAudioTranscription(deploymentName, fileName, transcriptionOptions)) + .verifyErrorSatisfies(error -> assertTrue(error instanceof IllegalArgumentException)); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.JSON); + + StepVerifier.create(client.getAudioTranslation(deploymentName, fileName, translationOptions)) + .assertNext(translation -> + assertAudioTranslationSimpleJson(translation, "It's raining today.")) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationVerboseJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.VERBOSE_JSON); + + StepVerifier.create(client.getAudioTranslation(deploymentName, fileName, translationOptions)) + .assertNext(translation -> + assertAudioTranslationVerboseJson(translation, "It's raining today.", AudioTaskLabel.TRANSLATE)) + .verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationTextPlain(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.TEXT); + + StepVerifier.create(client.getAudioTranslationText(deploymentName, fileName, translationOptions)) + .assertNext(translation -> { + assertEquals("It's raining today.\n", translation); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationSrt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.SRT); + + StepVerifier.create(client.getAudioTranslationText(deploymentName, fileName, translationOptions)) + .assertNext(translation -> { + // Sequence number + assertTrue(translation.contains("1\n")); + // First sequence starts at timestamp 0 + assertTrue(translation.contains("00:00:00,000 --> ")); + // Actual translation value + assertTrue(translation.contains("It's raining today.")); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationVtt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.VTT); + + StepVerifier.create(client.getAudioTranslationText(deploymentName, fileName, translationOptions)) + .assertNext(translation -> { + // Start value according to spec + assertTrue(translation.startsWith("WEBVTT\n")); + // First sequence starts at timestamp 0. Note: unlike SRT, the millisecond separator is a "." + assertTrue(translation.contains("00:00:00.000 --> ")); + // Actual translation value + assertTrue(translation.contains("It's raining today.")); + }).verifyComplete(); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationTextWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + List wrongFormats = Arrays.asList( + AudioTranslationFormat.JSON, + AudioTranslationFormat.VERBOSE_JSON + ); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + + for (AudioTranslationFormat format: wrongFormats) { + translationOptions.setResponseFormat(format); + StepVerifier.create(client.getAudioTranslationText(deploymentName, fileName, translationOptions)) + .verifyErrorSatisfies(error -> assertTrue(error instanceof IllegalArgumentException)); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationJsonWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIAsyncClient(httpClient, serviceVersion); + List wrongFormats = Arrays.asList( + AudioTranslationFormat.TEXT, + AudioTranslationFormat.SRT, + AudioTranslationFormat.VTT + ); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + + for (AudioTranslationFormat format: wrongFormats) { + translationOptions.setResponseFormat(format); + StepVerifier.create(client.getAudioTranslation(deploymentName, fileName, translationOptions)) + .verifyErrorSatisfies(error -> assertTrue(error instanceof IllegalArgumentException)); + } + }); + } } diff --git a/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/OpenAIClientTestBase.java b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/OpenAIClientTestBase.java index 9b8cb0014cd0..58258f8049ac 100644 --- a/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/OpenAIClientTestBase.java +++ b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/OpenAIClientTestBase.java @@ -5,6 +5,9 @@ package com.azure.ai.openai; import com.azure.ai.openai.functions.Parameters; +import com.azure.ai.openai.models.AudioTaskLabel; +import com.azure.ai.openai.models.AudioTranscription; +import com.azure.ai.openai.models.AudioTranslation; import com.azure.ai.openai.models.AzureChatExtensionsMessageContext; import com.azure.ai.openai.models.ChatChoice; import com.azure.ai.openai.models.ChatCompletions; @@ -26,6 +29,8 @@ import com.azure.core.credential.AzureKeyCredential; import com.azure.core.credential.KeyCredential; import com.azure.core.http.HttpClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.rest.Response; import com.azure.core.test.TestMode; import com.azure.core.test.TestProxyTestBase; @@ -35,6 +40,8 @@ import com.azure.core.util.Configuration; import org.junit.jupiter.api.Test; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -55,7 +62,7 @@ public abstract class OpenAIClientTestBase extends TestProxyTestBase { OpenAIClientBuilder getOpenAIClientBuilder(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { OpenAIClientBuilder builder = new OpenAIClientBuilder() -// .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .httpClient(httpClient) .serviceVersion(serviceVersion); @@ -122,7 +129,6 @@ protected String getAzureCognitiveSearchKey() { } } - @Test public abstract void testGetCompletions(HttpClient httpClient, OpenAIServiceVersion serviceVersion); @@ -195,7 +201,7 @@ void getChatCompletionsContentFilterRunner(BiConsumer> } void getCompletionsContentFilterRunner(BiConsumer testRunner) { - testRunner.accept("gpt-35-turbo", "What is 3 times 4?"); + testRunner.accept("text-davinci-003", "What is 3 times 4?"); } void getChatCompletionsContentFilterRunnerForNonAzure(BiConsumer> testRunner) { @@ -206,6 +212,22 @@ void getCompletionsContentFilterRunnerForNonAzure(BiConsumer tes testRunner.accept("text-davinci-002", "What is 3 times 4?"); } + void getAudioTranscriptionRunner(BiConsumer testRunner) { + testRunner.accept("whisper-deployment", "batman.wav"); + } + + void getAudioTranslationRunner(BiConsumer testRunner) { + testRunner.accept("whisper-deployment", "JP_it_is_rainy_today.wav"); + } + + void getAudioTranscriptionRunnerForNonAzure(BiConsumer testRunner) { + testRunner.accept("whisper-1", "batman.wav"); + } + + void getAudioTranslationRunnerForNonAzure(BiConsumer testRunner) { + testRunner.accept("whisper-1", "JP_it_is_rainy_today.wav"); + } + private List getChatMessages() { List chatMessages = new ArrayList<>(); chatMessages.add(new ChatMessage(ChatRole.SYSTEM, "You are a helpful assistant. You will talk like a pirate.")); @@ -229,6 +251,10 @@ private ChatCompletionsOptions getChatMessagesWithFunction() { return chatCompletionOptions; } + static Path openTestResourceFile(String fileName) { + return Paths.get("src/test/resources/" + fileName); + } + static void assertCompletions(int choicesPerPrompt, Completions actual) { assertCompletions(choicesPerPrompt, "stop", actual); } @@ -413,4 +439,61 @@ static void assertChatCompletionsStreamingCognitiveSearch(Stream { - IterableStream resultCompletions = client.getCompletionsStream(deploymentId, new CompletionsOptions(prompt)); + getCompletionsContentFilterRunner((deploymentId, prompt) -> { + IterableStream resultCompletions = client.getCompletionsStream(deploymentId, + new CompletionsOptions(Arrays.asList(prompt)).setMaxTokens(2000)); assertTrue(resultCompletions.stream().toArray().length > 1); int i = 0; int totalCompletions = resultCompletions.stream().toArray().length; @@ -331,6 +340,7 @@ public void testCompletionStreamContentFiltering(HttpClient httpClient, OpenAISe Completions completions = it.next(); assertCompletionsStream(completions); if (i == 0) { + System.out.println("First stream message"); // The first stream message has the prompt filter result assertEquals(1, completions.getPromptFilterResults().size()); assertSafeContentFilterResults(completions.getPromptFilterResults().get(0).getContentFilterResults()); @@ -338,7 +348,8 @@ public void testCompletionStreamContentFiltering(HttpClient httpClient, OpenAISe // The last stream message is empty with all the filters set to null assertEquals(1, completions.getChoices().size()); Choice choice = completions.getChoices().get(0); - + // TODO: service issue: we could have "length" as the finish reason. + // Non-Streaming happens less frequency than streaming API. assertEquals(CompletionsFinishReason.fromString("stop"), choice.getFinishReason()); assertNotNull(choice.getText()); @@ -402,4 +413,263 @@ public void testChatCompletionsStreamingBasicSearchExtension(HttpClient httpClie assertChatCompletionsStreamingCognitiveSearch(resultChatCompletions.stream()); }); } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.JSON); + + AudioTranscription transcription = client.getAudioTranscription(deploymentName, fileName, transcriptionOptions); + assertAudioTranscriptionSimpleJson(transcription, BATMAN_TRANSCRIPTION); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionVerboseJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.VERBOSE_JSON); + + AudioTranscription transcription = client.getAudioTranscription(deploymentName, fileName, transcriptionOptions); + assertAudioTranscriptionVerboseJson(transcription, BATMAN_TRANSCRIPTION, AudioTaskLabel.TRANSCRIBE); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionTextPlain(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.TEXT); + + String transcription = client.getAudioTranscriptionText(deploymentName, fileName, transcriptionOptions); + // A plain/text request adds a line break as an artifact. Also observed for translations + assertEquals(BATMAN_TRANSCRIPTION + "\n", transcription); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionSrt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.SRT); + + String transcription = client.getAudioTranscriptionText(deploymentName, fileName, transcriptionOptions); + // Contains at least one sequence + assertTrue(transcription.contains("1\n")); + // First sequence starts at timestamp 0 + assertTrue(transcription.contains("00:00:00,000 --> ")); + // Contains at least one expected word + assertTrue(transcription.contains("Batman")); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionVtt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setResponseFormat(AudioTranscriptionFormat.VTT); + + String transcription = client.getAudioTranscriptionText(deploymentName, fileName, transcriptionOptions); + // Start value according to spec + assertTrue(transcription.startsWith("WEBVTT\n")); + // First sequence starts at timestamp 0. Note: unlike SRT, the millisecond separator is a "." + assertTrue(transcription.contains("00:00:00.000 --> ")); + // Contains at least one expected word in the transcription + assertTrue(transcription.contains("Batman")); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionTextWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + List wrongFormats = Arrays.asList( + AudioTranscriptionFormat.JSON, + AudioTranscriptionFormat.VERBOSE_JSON + ); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions audioTranscriptionOptions = new AudioTranscriptionOptions(file); + + for (AudioTranscriptionFormat format: wrongFormats) { + audioTranscriptionOptions.setResponseFormat(format); + assertThrows(IllegalArgumentException.class, () -> + client.getAudioTranscriptionText(deploymentName, fileName, audioTranscriptionOptions)); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranscriptionJsonWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + List wrongFormats = Arrays.asList( + AudioTranscriptionFormat.TEXT, + AudioTranscriptionFormat.SRT, + AudioTranscriptionFormat.VTT + ); + + getAudioTranscriptionRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranscriptionOptions audioTranscriptionOptions = new AudioTranscriptionOptions(file); + + for (AudioTranscriptionFormat format: wrongFormats) { + audioTranscriptionOptions.setResponseFormat(format); + assertThrows(IllegalArgumentException.class, () -> + client.getAudioTranscription(deploymentName, fileName, audioTranscriptionOptions)); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.JSON); + + AudioTranslation translation = client.getAudioTranslation(deploymentName, fileName, translationOptions); + assertAudioTranslationSimpleJson(translation, "It's raining today."); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationVerboseJson(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.VERBOSE_JSON); + + AudioTranslation translation = client.getAudioTranslation(deploymentName, fileName, translationOptions); + assertAudioTranslationVerboseJson(translation, "It's raining today.", AudioTaskLabel.TRANSLATE); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationTextPlain(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.TEXT); + + String transcription = client.getAudioTranslationText(deploymentName, fileName, translationOptions); + assertEquals("It's raining today.\n", transcription); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationSrt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.SRT); + + String transcription = client.getAudioTranslationText(deploymentName, fileName, translationOptions); + // Sequence number + assertTrue(transcription.contains("1\n")); + // First sequence starts at timestamp 0 + assertTrue(transcription.contains("00:00:00,000 --> ")); + // Actual translation value + assertTrue(transcription.contains("It's raining today.")); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationVtt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setResponseFormat(AudioTranslationFormat.VTT); + + String transcription = client.getAudioTranslationText(deploymentName, fileName, translationOptions); + // Start value according to spec + assertTrue(transcription.startsWith("WEBVTT\n")); + // First sequence starts at timestamp 0. Note: unlike SRT, the millisecond separator is a "." + assertTrue(transcription.contains("00:00:00.000 --> ")); + // Actual translation value + assertTrue(transcription.contains("It's raining today.")); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationTextWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + List wrongFormats = Arrays.asList( + AudioTranslationFormat.JSON, + AudioTranslationFormat.VERBOSE_JSON + ); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + + for (AudioTranslationFormat format: wrongFormats) { + translationOptions.setResponseFormat(format); + assertThrows(IllegalArgumentException.class, () -> { + client.getAudioTranslationText(deploymentName, fileName, translationOptions); + }); + } + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetAudioTranslationJsonWrongFormats(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + List wrongFormats = Arrays.asList( + AudioTranslationFormat.TEXT, + AudioTranslationFormat.SRT, + AudioTranslationFormat.VTT + ); + + getAudioTranslationRunner((deploymentName, fileName) -> { + byte[] file = BinaryData.fromFile(openTestResourceFile(fileName)).toBytes(); + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + + for (AudioTranslationFormat format: wrongFormats) { + translationOptions.setResponseFormat(format); + assertThrows(IllegalArgumentException.class, () -> { + client.getAudioTranslation(deploymentName, fileName, translationOptions); + }); + } + }); + } } diff --git a/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/implementation/MultipartDataHelperTest.java b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/implementation/MultipartDataHelperTest.java new file mode 100644 index 000000000000..bad9dce4a3d3 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/implementation/MultipartDataHelperTest.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.openai.implementation; + +import com.azure.ai.openai.models.AudioTranscriptionFormat; +import com.azure.ai.openai.models.AudioTranscriptionOptions; +import com.azure.ai.openai.models.AudioTranslationFormat; +import com.azure.ai.openai.models.AudioTranslationOptions; +import com.azure.ai.openai.models.EmbeddingsOptions; +import org.junit.jupiter.api.Test; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * Unit tests for {@link MultipartDataHelper} + */ +public class MultipartDataHelperTest { + + private static final String TEST_BOUNDARY = "test-boundary"; + + @Test + public void serializeAudioTranslationOptionsAllFields() { + MultipartDataHelper helper = new MultipartDataHelper(TEST_BOUNDARY); + byte[] file = new byte[] {73, 32, 115, 104, 111, 117, 108, 100, 32, 104, 97, 118, 101, 32, 116, 104, 111, 117, + 103, 104, 116, 32, 111, 102, 32, 97, 32, 103, 111, 111, 100, 32, 101, 97, 115, 116, 101, 114, 32, 101, + 103, 103}; + String fileName = "file_name.wav"; + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + translationOptions.setModel("model_name") + .setPrompt("prompt text") + .setResponseFormat(AudioTranslationFormat.TEXT) + .setTemperature(0.1); + MultipartDataSerializationResult actual = helper.serializeRequest(translationOptions, fileName); + + String expected = multipartFileSegment(fileName, file) + + fieldFormData("response_format", "text") + + fieldFormData("model", "model_name") + + fieldFormData("prompt", "prompt text") + + fieldFormData("temperature", "0.1") + + closingMarker(); + + assertEquals(expected, actual.getData().toString()); + assertEquals(expected.getBytes(StandardCharsets.US_ASCII).length, actual.getDataLength()); + } + + @Test + public void serializeAudioTranscriptionOptionsAllFields() { + MultipartDataHelper helper = new MultipartDataHelper(TEST_BOUNDARY); + byte[] file = new byte[] {73, 32, 115, 104, 111, 117, 108, 100, 32, 104, 97, 118, 101, 32, 116, 104, 111, 117, + 103, 104, 116, 32, 111, 102, 32, 97, 32, 103, 111, 111, 100, 32, 101, 97, 115, 116, 101, 114, 32, 101, + 103, 103}; + String fileName = "file_name.wav"; + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + transcriptionOptions.setModel("model_name") + .setPrompt("prompt text") + .setResponseFormat(AudioTranscriptionFormat.TEXT) + .setLanguage("en") + .setTemperature(0.1); + MultipartDataSerializationResult actual = helper.serializeRequest(transcriptionOptions, fileName); + + String expected = multipartFileSegment(fileName, file) + + fieldFormData("response_format", "text") + + fieldFormData("model", "model_name") + + fieldFormData("prompt", "prompt text") + + fieldFormData("temperature", "0.1") + + fieldFormData("language", "en") + + closingMarker(); + + assertEquals(expected, actual.getData().toString()); + assertEquals(expected.getBytes(StandardCharsets.US_ASCII).length, actual.getDataLength()); + } + + @Test + public void serializeAudioTranslationOptionsNoFields() { + MultipartDataHelper helper = new MultipartDataHelper(TEST_BOUNDARY); + byte[] file = new byte[] {}; + String fileName = "file_name.wav"; + AudioTranslationOptions translationOptions = new AudioTranslationOptions(file); + MultipartDataSerializationResult actual = helper.serializeRequest(translationOptions, fileName); + + String expected = multipartFileSegment(fileName, file) + + closingMarker(); + + assertEquals(expected, actual.getData().toString()); + assertEquals(expected.getBytes(StandardCharsets.US_ASCII).length, actual.getDataLength()); + } + + @Test + public void serializeAudioTranscriptionOptionsNoFields() { + MultipartDataHelper helper = new MultipartDataHelper(TEST_BOUNDARY); + byte[] file = new byte[] {}; + String fileName = "file_name.wav"; + AudioTranscriptionOptions transcriptionOptions = new AudioTranscriptionOptions(file); + MultipartDataSerializationResult actual = helper.serializeRequest(transcriptionOptions, fileName); + + String expected = multipartFileSegment(fileName, file) + + closingMarker(); + + assertEquals(expected, actual.getData().toString()); + assertEquals(expected.getBytes(StandardCharsets.US_ASCII).length, actual.getDataLength()); + } + + @Test + public void serializeUnsupportedType() { + assertThrows(IllegalArgumentException.class, () -> { + MultipartDataHelper helper = new MultipartDataHelper(TEST_BOUNDARY); + EmbeddingsOptions embeddingsOptions = new EmbeddingsOptions(new ArrayList<>()); + helper.serializeRequest(embeddingsOptions, "path/to/file"); + }); + } + + private static String fieldFormData(String fieldName, String fieldValue) { + return "\r\n--test-boundary" + + "\r\nContent-Disposition: form-data; name=\"" + fieldName + "\"\r\n\r\n" + + fieldValue; + } + + private static String multipartFileSegment(String fileName, byte[] fileBytes) { + return "--test-boundary\r\n" + + "Content-Disposition: form-data; name=\"file\"; filename=\"" + fileName + "\"\r\n" + + "Content-Type: application/octet-stream\r\n\r\n" + + new String(fileBytes, StandardCharsets.US_ASCII); + } + + private static String closingMarker() { + return "\r\n--test-boundary--"; + } +} diff --git a/sdk/openai/azure-ai-openai/src/test/resources/JP_it_is_rainy_today.wav b/sdk/openai/azure-ai-openai/src/test/resources/JP_it_is_rainy_today.wav new file mode 100644 index 000000000000..5970c85ec1cd Binary files /dev/null and b/sdk/openai/azure-ai-openai/src/test/resources/JP_it_is_rainy_today.wav differ diff --git a/sdk/openai/azure-ai-openai/src/test/resources/batman.wav b/sdk/openai/azure-ai-openai/src/test/resources/batman.wav new file mode 100644 index 000000000000..4c0b7248a39c Binary files /dev/null and b/sdk/openai/azure-ai-openai/src/test/resources/batman.wav differ diff --git a/sdk/openai/azure-ai-openai/tsp-location.yaml b/sdk/openai/azure-ai-openai/tsp-location.yaml index 368074679599..9dbc49d97eac 100644 --- a/sdk/openai/azure-ai-openai/tsp-location.yaml +++ b/sdk/openai/azure-ai-openai/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/cognitiveservices/OpenAI.Inference additionalDirectories: - specification/cognitiveservices/OpenAI.Authoring -commit: b646a42aa3b7a0ce488d05f1724827ea41d12cf1 +commit: 90247ef2960fbe11e8639c796f9bf1d2c90bb79f repo: Azure/azure-rest-api-specs diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/CHANGELOG.md b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/CHANGELOG.md new file mode 100644 index 000000000000..1e4cec15007d --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/CHANGELOG.md @@ -0,0 +1,15 @@ +# Release History + +## 1.0.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 1.0.0-beta.1 (2023-09-27) + +- Azure Resource Manager Playwright Testing client library for Java. This package contains Microsoft Azure SDK for Playwright Testing Management SDK. Azure Playwright testing management service. Package tag package-2023-10-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/README.md b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/README.md new file mode 100644 index 000000000000..81bdfd784fe3 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/README.md @@ -0,0 +1,107 @@ +# Azure Resource Manager Playwright Testing client library for Java + +Azure Resource Manager Playwright Testing client library for Java. + +This package contains Microsoft Azure SDK for Playwright Testing Management SDK. Azure Playwright testing management service. Package tag package-2023-10-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-playwrighttesting;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-playwrighttesting + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +PlaywrightTestingManager manager = PlaywrightTestingManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +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 . + +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 repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fplaywrighttesting%2Fazure-resourcemanager-playwrighttesting%2FREADME.png) diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/SAMPLE.md b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/SAMPLE.md new file mode 100644 index 000000000000..c7088dc5185d --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/SAMPLE.md @@ -0,0 +1,248 @@ +# Code snippets and samples + + +## Accounts + +- [CreateOrUpdate](#accounts_createorupdate) +- [Delete](#accounts_delete) +- [GetByResourceGroup](#accounts_getbyresourcegroup) +- [List](#accounts_list) +- [ListByResourceGroup](#accounts_listbyresourcegroup) +- [Update](#accounts_update) + +## Operations + +- [List](#operations_list) + +## Quotas + +- [Get](#quotas_get) +- [ListBySubscription](#quotas_listbysubscription) +### Accounts_CreateOrUpdate + +```java +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Accounts CreateOrUpdate. */ +public final class AccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_CreateOrUpdate.json + */ + /** + * Sample code: Accounts_CreateOrUpdate. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsCreateOrUpdate( + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager + .accounts() + .define("myPlaywrightAccount") + .withRegion("westus") + .withExistingResourceGroup("dummyrg") + .withTags(mapOf("Team", "Dev Exp")) + .withRegionalAffinity(EnablementStatus.ENABLED) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Accounts_Delete + +```java +/** Samples for Accounts Delete. */ +public final class AccountsDeleteSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Delete.json + */ + /** + * Sample code: Accounts_Delete. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsDelete(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.accounts().delete("dummyrg", "myPlaywrightAccount", com.azure.core.util.Context.NONE); + } +} +``` + +### Accounts_GetByResourceGroup + +```java +/** Samples for Accounts GetByResourceGroup. */ +public final class AccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json + */ + /** + * Sample code: Accounts_Get. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsGet(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager + .accounts() + .getByResourceGroupWithResponse("dummyrg", "myPlaywrightAccount", com.azure.core.util.Context.NONE); + } +} +``` + +### Accounts_List + +```java +/** Samples for Accounts List. */ +public final class AccountsListSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListBySubscription.json + */ + /** + * Sample code: Accounts_ListBySubscription. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsListBySubscription( + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.accounts().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Accounts_ListByResourceGroup + +```java +/** Samples for Accounts ListByResourceGroup. */ +public final class AccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListByResourceGroup.json + */ + /** + * Sample code: Accounts_ListByResourceGroup. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsListByResourceGroup( + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.accounts().listByResourceGroup("dummyrg", com.azure.core.util.Context.NONE); + } +} +``` + +### Accounts_Update + +```java +import com.azure.resourcemanager.playwrighttesting.models.Account; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Accounts Update. */ +public final class AccountsUpdateSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Update.json + */ + /** + * Sample code: Accounts_Update. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsUpdate(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("dummyrg", "myPlaywrightAccount", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("Division", "LT", "Team", "Dev Exp")) + .withRegionalAffinity(EnablementStatus.ENABLED) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void operationsList(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Quotas_Get + +```java +import com.azure.resourcemanager.playwrighttesting.models.QuotaNames; + +/** Samples for Quotas Get. */ +public final class QuotasGetSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json + */ + /** + * Sample code: Quotas_Get. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void quotasGet(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.quotas().getWithResponse("eastus", QuotaNames.SCALABLE_EXECUTION, com.azure.core.util.Context.NONE); + } +} +``` + +### Quotas_ListBySubscription + +```java +/** Samples for Quotas ListBySubscription. */ +public final class QuotasListBySubscriptionSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_ListBySubscription.json + */ + /** + * Sample code: Quotas_ListBySubscription. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void quotasListBySubscription( + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.quotas().listBySubscription("eastus", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/pom.xml b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/pom.xml new file mode 100644 index 000000000000..1d4395f09199 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/pom.xml @@ -0,0 +1,98 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-playwrighttesting + 1.0.0-beta.2 + jar + + Microsoft Azure SDK for Playwright Testing Management + This package contains Microsoft Azure SDK for Playwright Testing Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Playwright testing management service. Package tag package-2023-10-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.43.0 + + + com.azure + azure-core-management + 1.11.5 + + + com.azure + azure-core-test + 1.20.0 + test + + + com.azure + azure-identity + 1.10.1 + test + + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + org.mockito + mockito-core + 4.11.0 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + + + diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/PlaywrightTestingManager.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/PlaywrightTestingManager.java new file mode 100644 index 000000000000..1076ea2e5856 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/PlaywrightTestingManager.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +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.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.playwrighttesting.fluent.PlaywrightTestingMgmtClient; +import com.azure.resourcemanager.playwrighttesting.implementation.AccountsImpl; +import com.azure.resourcemanager.playwrighttesting.implementation.OperationsImpl; +import com.azure.resourcemanager.playwrighttesting.implementation.PlaywrightTestingMgmtClientBuilder; +import com.azure.resourcemanager.playwrighttesting.implementation.QuotasImpl; +import com.azure.resourcemanager.playwrighttesting.models.Accounts; +import com.azure.resourcemanager.playwrighttesting.models.Operations; +import com.azure.resourcemanager.playwrighttesting.models.Quotas; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to PlaywrightTestingManager. Azure Playwright testing management service. */ +public final class PlaywrightTestingManager { + private Operations operations; + + private Accounts accounts; + + private Quotas quotas; + + private final PlaywrightTestingMgmtClient clientObject; + + private PlaywrightTestingManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new PlaywrightTestingMgmtClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Playwright Testing service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Playwright Testing service API instance. + */ + public static PlaywrightTestingManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Playwright Testing service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Playwright Testing service API instance. + */ + public static PlaywrightTestingManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new PlaywrightTestingManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create PlaywrightTestingManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new PlaywrightTestingManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * 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; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Playwright Testing service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Playwright Testing service API instance. + */ + public PlaywrightTestingManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.playwrighttesting") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new PlaywrightTestingManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Accounts. It manages Account. + * + * @return Resource collection API of Accounts. + */ + public Accounts accounts() { + if (this.accounts == null) { + this.accounts = new AccountsImpl(clientObject.getAccounts(), this); + } + return accounts; + } + + /** + * Gets the resource collection API of Quotas. + * + * @return Resource collection API of Quotas. + */ + public Quotas quotas() { + if (this.quotas == null) { + this.quotas = new QuotasImpl(clientObject.getQuotas(), this); + } + return quotas; + } + + /** + * Gets wrapped service client PlaywrightTestingMgmtClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client PlaywrightTestingMgmtClient. + */ + public PlaywrightTestingMgmtClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/AccountsClient.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/AccountsClient.java new file mode 100644 index 000000000000..974bb24bc8f1 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/AccountsClient.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountInner; +import com.azure.resourcemanager.playwrighttesting.models.AccountUpdate; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public interface AccountsClient { + /** + * List Account resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Account resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String name, Context context); + + /** + * Get a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner getByResourceGroup(String resourceGroupName, String name); + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccountInner> beginCreateOrUpdate( + String resourceGroupName, String name, AccountInner resource); + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccountInner> beginCreateOrUpdate( + String resourceGroupName, String name, AccountInner resource, Context context); + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner createOrUpdate(String resourceGroupName, String name, AccountInner resource); + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner createOrUpdate(String resourceGroupName, String name, AccountInner resource, Context context); + + /** + * Update a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String name, AccountUpdate properties, Context context); + + /** + * Update a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner update(String resourceGroupName, String name, AccountUpdate properties); + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String name); + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String name, Context context); + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String name); + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String name, Context context); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/OperationsClient.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/OperationsClient.java new file mode 100644 index 000000000000..dd9aef72b527 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.playwrighttesting.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/PlaywrightTestingMgmtClient.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/PlaywrightTestingMgmtClient.java new file mode 100644 index 000000000000..30b4e00f643d --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/PlaywrightTestingMgmtClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for PlaywrightTestingMgmtClient class. */ +public interface PlaywrightTestingMgmtClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + AccountsClient getAccounts(); + + /** + * Gets the QuotasClient object to access its operations. + * + * @return the QuotasClient object. + */ + QuotasClient getQuotas(); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/QuotasClient.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/QuotasClient.java new file mode 100644 index 000000000000..2106958352a1 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/QuotasClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaInner; +import com.azure.resourcemanager.playwrighttesting.models.QuotaNames; + +/** An instance of this class provides access to all the operations defined in QuotasClient. */ +public interface QuotasClient { + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String location); + + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String location, Context context); + + /** + * Get quota by name. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param name The quota name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, QuotaNames name, Context context); + + /** + * Get quota by name. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param name The quota name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QuotaInner get(String location, QuotaNames name); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/AccountInner.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/AccountInner.java new file mode 100644 index 000000000000..8a366fcb16b2 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/AccountInner.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import com.azure.resourcemanager.playwrighttesting.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An account resource. */ +@Fluent +public final class AccountInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private AccountProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of AccountInner class. */ + public AccountInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private AccountProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public AccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AccountInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the dashboardUri property: The Playwright testing dashboard URI for the account resource. + * + * @return the dashboardUri value. + */ + public String dashboardUri() { + return this.innerProperties() == null ? null : this.innerProperties().dashboardUri(); + } + + /** + * Get the regionalAffinity property: This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + * latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially + * created. + * + * @return the regionalAffinity value. + */ + public EnablementStatus regionalAffinity() { + return this.innerProperties() == null ? null : this.innerProperties().regionalAffinity(); + } + + /** + * Set the regionalAffinity property: This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + * latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially + * created. + * + * @param regionalAffinity the regionalAffinity value to set. + * @return the AccountInner object itself. + */ + public AccountInner withRegionalAffinity(EnablementStatus regionalAffinity) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withRegionalAffinity(regionalAffinity); + return this; + } + + /** + * Get the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test completion + * durations. + * + * @return the scalableExecution value. + */ + public EnablementStatus scalableExecution() { + return this.innerProperties() == null ? null : this.innerProperties().scalableExecution(); + } + + /** + * Set the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test completion + * durations. + * + * @param scalableExecution the scalableExecution value to set. + * @return the AccountInner object itself. + */ + public AccountInner withScalableExecution(EnablementStatus scalableExecution) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withScalableExecution(scalableExecution); + return this; + } + + /** + * Get the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @return the reporting value. + */ + public EnablementStatus reporting() { + return this.innerProperties() == null ? null : this.innerProperties().reporting(); + } + + /** + * Set the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @param reporting the reporting value to set. + * @return the AccountInner object itself. + */ + public AccountInner withReporting(EnablementStatus reporting) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withReporting(reporting); + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/AccountProperties.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/AccountProperties.java new file mode 100644 index 000000000000..8b6d5d194582 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/AccountProperties.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import com.azure.resourcemanager.playwrighttesting.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Account properties. */ +@Fluent +public final class AccountProperties { + /* + * The Playwright testing dashboard URI for the account resource. + */ + @JsonProperty(value = "dashboardUri", access = JsonProperty.Access.WRITE_ONLY) + private String dashboardUri; + + /* + * This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, + * workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to + * browsers in the Azure region in which the workspace was initially created. + */ + @JsonProperty(value = "regionalAffinity") + private EnablementStatus regionalAffinity; + + /* + * When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of + * parallel workers for a test run, significantly minimizing test completion durations. + */ + @JsonProperty(value = "scalableExecution") + private EnablementStatus scalableExecution; + + /* + * When enabled, this feature allows the workspace to upload and display test results, including artifacts like + * traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + */ + @JsonProperty(value = "reporting") + private EnablementStatus reporting; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of AccountProperties class. */ + public AccountProperties() { + } + + /** + * Get the dashboardUri property: The Playwright testing dashboard URI for the account resource. + * + * @return the dashboardUri value. + */ + public String dashboardUri() { + return this.dashboardUri; + } + + /** + * Get the regionalAffinity property: This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + * latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially + * created. + * + * @return the regionalAffinity value. + */ + public EnablementStatus regionalAffinity() { + return this.regionalAffinity; + } + + /** + * Set the regionalAffinity property: This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + * latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially + * created. + * + * @param regionalAffinity the regionalAffinity value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withRegionalAffinity(EnablementStatus regionalAffinity) { + this.regionalAffinity = regionalAffinity; + return this; + } + + /** + * Get the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test completion + * durations. + * + * @return the scalableExecution value. + */ + public EnablementStatus scalableExecution() { + return this.scalableExecution; + } + + /** + * Set the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test completion + * durations. + * + * @param scalableExecution the scalableExecution value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withScalableExecution(EnablementStatus scalableExecution) { + this.scalableExecution = scalableExecution; + return this; + } + + /** + * Get the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @return the reporting value. + */ + public EnablementStatus reporting() { + return this.reporting; + } + + /** + * Set the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @param reporting the reporting value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withReporting(EnablementStatus reporting) { + this.reporting = reporting; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/AccountUpdateProperties.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/AccountUpdateProperties.java new file mode 100644 index 000000000000..ba744fd5a4e5 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/AccountUpdateProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The updatable properties of the Account. */ +@Fluent +public final class AccountUpdateProperties { + /* + * This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, + * workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to + * browsers in the Azure region in which the workspace was initially created. + */ + @JsonProperty(value = "regionalAffinity") + private EnablementStatus regionalAffinity; + + /* + * When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of + * parallel workers for a test run, significantly minimizing test completion durations. + */ + @JsonProperty(value = "scalableExecution") + private EnablementStatus scalableExecution; + + /* + * When enabled, this feature allows the workspace to upload and display test results, including artifacts like + * traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + */ + @JsonProperty(value = "reporting") + private EnablementStatus reporting; + + /** Creates an instance of AccountUpdateProperties class. */ + public AccountUpdateProperties() { + } + + /** + * Get the regionalAffinity property: This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + * latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially + * created. + * + * @return the regionalAffinity value. + */ + public EnablementStatus regionalAffinity() { + return this.regionalAffinity; + } + + /** + * Set the regionalAffinity property: This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + * latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially + * created. + * + * @param regionalAffinity the regionalAffinity value to set. + * @return the AccountUpdateProperties object itself. + */ + public AccountUpdateProperties withRegionalAffinity(EnablementStatus regionalAffinity) { + this.regionalAffinity = regionalAffinity; + return this; + } + + /** + * Get the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test completion + * durations. + * + * @return the scalableExecution value. + */ + public EnablementStatus scalableExecution() { + return this.scalableExecution; + } + + /** + * Set the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test completion + * durations. + * + * @param scalableExecution the scalableExecution value to set. + * @return the AccountUpdateProperties object itself. + */ + public AccountUpdateProperties withScalableExecution(EnablementStatus scalableExecution) { + this.scalableExecution = scalableExecution; + return this; + } + + /** + * Get the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @return the reporting value. + */ + public EnablementStatus reporting() { + return this.reporting; + } + + /** + * Set the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @param reporting the reporting value to set. + * @return the AccountUpdateProperties object itself. + */ + public AccountUpdateProperties withReporting(EnablementStatus reporting) { + this.reporting = reporting; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/OperationInner.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/OperationInner.java new file mode 100644 index 000000000000..69e5228328e0 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.playwrighttesting.models.ActionType; +import com.azure.resourcemanager.playwrighttesting.models.OperationDisplay; +import com.azure.resourcemanager.playwrighttesting.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

    Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/QuotaInner.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/QuotaInner.java new file mode 100644 index 000000000000..aaa6da1a529e --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/QuotaInner.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.playwrighttesting.models.FreeTrialProperties; +import com.azure.resourcemanager.playwrighttesting.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A quota resource. */ +@Fluent +public final class QuotaInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private QuotaProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of QuotaInner class. */ + public QuotaInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private QuotaProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the freeTrial property: The free-trial quota. + * + * @return the freeTrial value. + */ + public FreeTrialProperties freeTrial() { + return this.innerProperties() == null ? null : this.innerProperties().freeTrial(); + } + + /** + * Set the freeTrial property: The free-trial quota. + * + * @param freeTrial the freeTrial value to set. + * @return the QuotaInner object itself. + */ + public QuotaInner withFreeTrial(FreeTrialProperties freeTrial) { + if (this.innerProperties() == null) { + this.innerProperties = new QuotaProperties(); + } + this.innerProperties().withFreeTrial(freeTrial); + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/QuotaProperties.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/QuotaProperties.java new file mode 100644 index 000000000000..a2dea8d0cb5f --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/QuotaProperties.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.playwrighttesting.models.FreeTrialProperties; +import com.azure.resourcemanager.playwrighttesting.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Quota properties. */ +@Fluent +public final class QuotaProperties { + /* + * The free-trial quota. + */ + @JsonProperty(value = "freeTrial") + private FreeTrialProperties freeTrial; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of QuotaProperties class. */ + public QuotaProperties() { + } + + /** + * Get the freeTrial property: The free-trial quota. + * + * @return the freeTrial value. + */ + public FreeTrialProperties freeTrial() { + return this.freeTrial; + } + + /** + * Set the freeTrial property: The free-trial quota. + * + * @param freeTrial the freeTrial value to set. + * @return the QuotaProperties object itself. + */ + public QuotaProperties withFreeTrial(FreeTrialProperties freeTrial) { + this.freeTrial = freeTrial; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (freeTrial() != null) { + freeTrial().validate(); + } + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/package-info.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/package-info.java new file mode 100644 index 000000000000..7c5ac5b9fcdc --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for PlaywrightTestingMgmtClient. Azure Playwright testing management + * service. + */ +package com.azure.resourcemanager.playwrighttesting.fluent.models; diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/package-info.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/package-info.java new file mode 100644 index 000000000000..67d0c17047be --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/fluent/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for PlaywrightTestingMgmtClient. Azure Playwright testing management service. + */ +package com.azure.resourcemanager.playwrighttesting.fluent; diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/AccountImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/AccountImpl.java new file mode 100644 index 000000000000..561e22421c52 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/AccountImpl.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountInner; +import com.azure.resourcemanager.playwrighttesting.models.Account; +import com.azure.resourcemanager.playwrighttesting.models.AccountUpdate; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import com.azure.resourcemanager.playwrighttesting.models.ProvisioningState; +import java.util.Collections; +import java.util.Map; + +public final class AccountImpl implements Account, Account.Definition, Account.Update { + private AccountInner innerObject; + + private final com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String dashboardUri() { + return this.innerModel().dashboardUri(); + } + + public EnablementStatus regionalAffinity() { + return this.innerModel().regionalAffinity(); + } + + public EnablementStatus scalableExecution() { + return this.innerModel().scalableExecution(); + } + + public EnablementStatus reporting() { + return this.innerModel().reporting(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AccountInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String name; + + private AccountUpdate updateProperties; + + public AccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Account create() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .createOrUpdate(resourceGroupName, name, this.innerModel(), Context.NONE); + return this; + } + + public Account create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .createOrUpdate(resourceGroupName, name, this.innerModel(), context); + return this; + } + + AccountImpl(String name, com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager) { + this.innerObject = new AccountInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public AccountImpl update() { + this.updateProperties = new AccountUpdate(); + return this; + } + + public Account apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .updateWithResponse(resourceGroupName, name, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public Account apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .updateWithResponse(resourceGroupName, name, updateProperties, context) + .getValue(); + return this; + } + + AccountImpl( + AccountInner innerObject, com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "accounts"); + } + + public Account refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, name, Context.NONE) + .getValue(); + return this; + } + + public Account refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, name, context) + .getValue(); + return this; + } + + public AccountImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AccountImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AccountImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public AccountImpl withRegionalAffinity(EnablementStatus regionalAffinity) { + if (isInCreateMode()) { + this.innerModel().withRegionalAffinity(regionalAffinity); + return this; + } else { + this.updateProperties.withRegionalAffinity(regionalAffinity); + return this; + } + } + + public AccountImpl withScalableExecution(EnablementStatus scalableExecution) { + if (isInCreateMode()) { + this.innerModel().withScalableExecution(scalableExecution); + return this; + } else { + this.updateProperties.withScalableExecution(scalableExecution); + return this; + } + } + + public AccountImpl withReporting(EnablementStatus reporting) { + if (isInCreateMode()) { + this.innerModel().withReporting(reporting); + return this; + } else { + this.updateProperties.withReporting(reporting); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/AccountsClientImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/AccountsClientImpl.java new file mode 100644 index 000000000000..c24449cbc5ec --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/AccountsClientImpl.java @@ -0,0 +1,1413 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.playwrighttesting.fluent.AccountsClient; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountInner; +import com.azure.resourcemanager.playwrighttesting.models.AccountListResult; +import com.azure.resourcemanager.playwrighttesting.models.AccountUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public final class AccountsClientImpl implements AccountsClient { + /** The proxy service used to perform REST calls. */ + private final AccountsService service; + + /** The service client containing this operation class. */ + private final PlaywrightTestingMgmtClientImpl client; + + /** + * Initializes an instance of AccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccountsClientImpl(PlaywrightTestingMgmtClientImpl client) { + this.service = RestProxy.create(AccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PlaywrightTestingMgmtClientAccounts to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PlaywrightTestingMgm") + public interface AccountsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @BodyParam("application/json") AccountInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @BodyParam("application/json") AccountUpdate properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Account resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Account resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Account resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Account resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Account resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List Account resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + accept, + context); + } + + /** + * Get a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String name) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String name, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name, context).block(); + } + + /** + * Get a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner getByResourceGroup(String resourceGroupName, String name) { + return getByResourceGroupWithResponse(resourceGroupName, name, Context.NONE).getValue(); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String name, AccountInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String name, AccountInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + resource, + accept, + context); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccountInner> beginCreateOrUpdateAsync( + String resourceGroupName, String name, AccountInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, name, resource); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccountInner.class, AccountInner.class, this.client.getContext()); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccountInner> beginCreateOrUpdateAsync( + String resourceGroupName, String name, AccountInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, name, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccountInner.class, AccountInner.class, context); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccountInner> beginCreateOrUpdate( + String resourceGroupName, String name, AccountInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, name, resource).getSyncPoller(); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccountInner> beginCreateOrUpdate( + String resourceGroupName, String name, AccountInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, name, resource, context).getSyncPoller(); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String name, AccountInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, name, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String name, AccountInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, name, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner createOrUpdate(String resourceGroupName, String name, AccountInner resource) { + return createOrUpdateAsync(resourceGroupName, name, resource).block(); + } + + /** + * Create a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner createOrUpdate(String resourceGroupName, String name, AccountInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, name, resource, context).block(); + } + + /** + * Update a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String name, AccountUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String name, AccountUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + properties, + accept, + context); + } + + /** + * Update a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String name, AccountUpdate properties) { + return updateWithResponseAsync(resourceGroupName, name, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String name, AccountUpdate properties, Context context) { + return updateWithResponseAsync(resourceGroupName, name, properties, context).block(); + } + + /** + * Update a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner update(String resourceGroupName, String name, AccountUpdate properties) { + return updateWithResponse(resourceGroupName, name, properties, Context.NONE).getValue(); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + accept, + context); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, name); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String name) { + return this.beginDeleteAsync(resourceGroupName, name).getSyncPoller(); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String name, Context context) { + return this.beginDeleteAsync(resourceGroupName, name, context).getSyncPoller(); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String name) { + return beginDeleteAsync(resourceGroupName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, name, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String name) { + deleteAsync(resourceGroupName, name).block(); + } + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String name, Context context) { + deleteAsync(resourceGroupName, name, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/AccountsImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/AccountsImpl.java new file mode 100644 index 000000000000..52b534a5b2a2 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/AccountsImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.playwrighttesting.fluent.AccountsClient; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountInner; +import com.azure.resourcemanager.playwrighttesting.models.Account; +import com.azure.resourcemanager.playwrighttesting.models.Accounts; + +public final class AccountsImpl implements Accounts { + private static final ClientLogger LOGGER = new ClientLogger(AccountsImpl.class); + + private final AccountsClient innerClient; + + private final com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager; + + public AccountsImpl( + AccountsClient innerClient, + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String name, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Account getByResourceGroup(String resourceGroupName, String name) { + AccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, name); + if (inner != null) { + return new AccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String name) { + this.serviceClient().delete(resourceGroupName, name); + } + + public void delete(String resourceGroupName, String name, Context context) { + this.serviceClient().delete(resourceGroupName, name, context); + } + + public Account getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "accounts"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "accounts"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, name, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "accounts"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.delete(resourceGroupName, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "accounts"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.delete(resourceGroupName, name, context); + } + + private AccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager() { + return this.serviceManager; + } + + public AccountImpl define(String name) { + return new AccountImpl(name, this.manager()); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/OperationImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/OperationImpl.java new file mode 100644 index 000000000000..653ecfc62fc4 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/OperationImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.resourcemanager.playwrighttesting.fluent.models.OperationInner; +import com.azure.resourcemanager.playwrighttesting.models.ActionType; +import com.azure.resourcemanager.playwrighttesting.models.Operation; +import com.azure.resourcemanager.playwrighttesting.models.OperationDisplay; +import com.azure.resourcemanager.playwrighttesting.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager; + + OperationImpl( + OperationInner innerObject, + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/OperationsClientImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..c4e625ca971d --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/OperationsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.playwrighttesting.fluent.OperationsClient; +import com.azure.resourcemanager.playwrighttesting.fluent.models.OperationInner; +import com.azure.resourcemanager.playwrighttesting.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final PlaywrightTestingMgmtClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(PlaywrightTestingMgmtClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PlaywrightTestingMgmtClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PlaywrightTestingMgm") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.AzurePlaywrightService/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/OperationsImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/OperationsImpl.java new file mode 100644 index 000000000000..bcc01acfc94e --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.playwrighttesting.fluent.OperationsClient; +import com.azure.resourcemanager.playwrighttesting.fluent.models.OperationInner; +import com.azure.resourcemanager.playwrighttesting.models.Operation; +import com.azure.resourcemanager.playwrighttesting.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/PlaywrightTestingMgmtClientBuilder.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/PlaywrightTestingMgmtClientBuilder.java new file mode 100644 index 000000000000..2d0f7192f0f5 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/PlaywrightTestingMgmtClientBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the PlaywrightTestingMgmtClientImpl type. */ +@ServiceClientBuilder(serviceClients = {PlaywrightTestingMgmtClientImpl.class}) +public final class PlaywrightTestingMgmtClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the PlaywrightTestingMgmtClientBuilder. + */ + public PlaywrightTestingMgmtClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the PlaywrightTestingMgmtClientBuilder. + */ + public PlaywrightTestingMgmtClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the PlaywrightTestingMgmtClientBuilder. + */ + public PlaywrightTestingMgmtClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the PlaywrightTestingMgmtClientBuilder. + */ + public PlaywrightTestingMgmtClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the PlaywrightTestingMgmtClientBuilder. + */ + public PlaywrightTestingMgmtClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the PlaywrightTestingMgmtClientBuilder. + */ + public PlaywrightTestingMgmtClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of PlaywrightTestingMgmtClientImpl with the provided parameters. + * + * @return an instance of PlaywrightTestingMgmtClientImpl. + */ + public PlaywrightTestingMgmtClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + PlaywrightTestingMgmtClientImpl client = + new PlaywrightTestingMgmtClientImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + this.subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/PlaywrightTestingMgmtClientImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/PlaywrightTestingMgmtClientImpl.java new file mode 100644 index 000000000000..91eeba04d9cd --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/PlaywrightTestingMgmtClientImpl.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.playwrighttesting.fluent.AccountsClient; +import com.azure.resourcemanager.playwrighttesting.fluent.OperationsClient; +import com.azure.resourcemanager.playwrighttesting.fluent.PlaywrightTestingMgmtClient; +import com.azure.resourcemanager.playwrighttesting.fluent.QuotasClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the PlaywrightTestingMgmtClientImpl type. */ +@ServiceClient(builder = PlaywrightTestingMgmtClientBuilder.class) +public final class PlaywrightTestingMgmtClientImpl implements PlaywrightTestingMgmtClient { + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The AccountsClient object to access its operations. */ + private final AccountsClient accounts; + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + public AccountsClient getAccounts() { + return this.accounts; + } + + /** The QuotasClient object to access its operations. */ + private final QuotasClient quotas; + + /** + * Gets the QuotasClient object to access its operations. + * + * @return the QuotasClient object. + */ + public QuotasClient getQuotas() { + return this.quotas; + } + + /** + * Initializes an instance of PlaywrightTestingMgmtClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + PlaywrightTestingMgmtClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2023-10-01-preview"; + this.operations = new OperationsClientImpl(this); + this.accounts = new AccountsClientImpl(this); + this.quotas = new QuotasClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PlaywrightTestingMgmtClientImpl.class); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/QuotaImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/QuotaImpl.java new file mode 100644 index 000000000000..5be6cb19aa9a --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/QuotaImpl.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaInner; +import com.azure.resourcemanager.playwrighttesting.models.FreeTrialProperties; +import com.azure.resourcemanager.playwrighttesting.models.ProvisioningState; +import com.azure.resourcemanager.playwrighttesting.models.Quota; + +public final class QuotaImpl implements Quota { + private QuotaInner innerObject; + + private final com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager; + + QuotaImpl( + QuotaInner innerObject, com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public FreeTrialProperties freeTrial() { + return this.innerModel().freeTrial(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public QuotaInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/QuotasClientImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/QuotasClientImpl.java new file mode 100644 index 000000000000..8c27a2ad5ddc --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/QuotasClientImpl.java @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.playwrighttesting.fluent.QuotasClient; +import com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaInner; +import com.azure.resourcemanager.playwrighttesting.models.QuotaListResult; +import com.azure.resourcemanager.playwrighttesting.models.QuotaNames; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in QuotasClient. */ +public final class QuotasClientImpl implements QuotasClient { + /** The proxy service used to perform REST calls. */ + private final QuotasService service; + + /** The service client containing this operation class. */ + private final PlaywrightTestingMgmtClientImpl client; + + /** + * Initializes an instance of QuotasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QuotasClientImpl(PlaywrightTestingMgmtClientImpl client) { + this.service = RestProxy.create(QuotasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PlaywrightTestingMgmtClientQuotas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PlaywrightTestingMgm") + public interface QuotasService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @PathParam("name") QuotaNames name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscription( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscription( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String location) { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(location), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String location, Context context) { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(location, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String location) { + return new PagedIterable<>(listBySubscriptionAsync(location)); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String location, Context context) { + return new PagedIterable<>(listBySubscriptionAsync(location, context)); + } + + /** + * Get quota by name. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param name The quota name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota by name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, QuotaNames name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + name, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get quota by name. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param name The quota name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota by name along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, QuotaNames name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + location, + name, + accept, + context); + } + + /** + * Get quota by name. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param name The quota name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota by name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, QuotaNames name) { + return getWithResponseAsync(location, name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get quota by name. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param name The quota name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota by name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, QuotaNames name, Context context) { + return getWithResponseAsync(location, name, context).block(); + } + + /** + * Get quota by name. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param name The quota name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QuotaInner get(String location, QuotaNames name) { + return getWithResponse(location, name, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/QuotasImpl.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/QuotasImpl.java new file mode 100644 index 000000000000..444400b71c92 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/QuotasImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.playwrighttesting.fluent.QuotasClient; +import com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaInner; +import com.azure.resourcemanager.playwrighttesting.models.Quota; +import com.azure.resourcemanager.playwrighttesting.models.QuotaNames; +import com.azure.resourcemanager.playwrighttesting.models.Quotas; + +public final class QuotasImpl implements Quotas { + private static final ClientLogger LOGGER = new ClientLogger(QuotasImpl.class); + + private final QuotasClient innerClient; + + private final com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager; + + public QuotasImpl( + QuotasClient innerClient, com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySubscription(String location) { + PagedIterable inner = this.serviceClient().listBySubscription(location); + return Utils.mapPage(inner, inner1 -> new QuotaImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String location, Context context) { + PagedIterable inner = this.serviceClient().listBySubscription(location, context); + return Utils.mapPage(inner, inner1 -> new QuotaImpl(inner1, this.manager())); + } + + public Response getWithResponse(String location, QuotaNames name, Context context) { + Response inner = this.serviceClient().getWithResponse(location, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QuotaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Quota get(String location, QuotaNames name) { + QuotaInner inner = this.serviceClient().get(location, name); + if (inner != null) { + return new QuotaImpl(inner, this.manager()); + } else { + return null; + } + } + + private QuotasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/Utils.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/Utils.java new file mode 100644 index 000000000000..e7001f36cc1c --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +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; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/package-info.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/package-info.java new file mode 100644 index 000000000000..97bcd06b23bb --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/implementation/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for PlaywrightTestingMgmtClient. Azure Playwright testing management service. + */ +package com.azure.resourcemanager.playwrighttesting.implementation; diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Account.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Account.java new file mode 100644 index 000000000000..4a23b4b67a53 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Account.java @@ -0,0 +1,359 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountInner; +import java.util.Map; + +/** An immutable client-side representation of Account. */ +public interface Account { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the dashboardUri property: The Playwright testing dashboard URI for the account resource. + * + * @return the dashboardUri value. + */ + String dashboardUri(); + + /** + * Gets the regionalAffinity property: This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + * latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially + * created. + * + * @return the regionalAffinity value. + */ + EnablementStatus regionalAffinity(); + + /** + * Gets the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted + * browsers. This can increase the number of parallel workers for a test run, significantly minimizing test + * completion durations. + * + * @return the scalableExecution value. + */ + EnablementStatus scalableExecution(); + + /** + * Gets the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @return the reporting value. + */ + EnablementStatus reporting(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.playwrighttesting.fluent.models.AccountInner object. + * + * @return the inner object. + */ + AccountInner innerModel(); + + /** The entirety of the Account definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + + /** The Account definition stages. */ + interface DefinitionStages { + /** The first stage of the Account definition. */ + interface Blank extends WithLocation { + } + + /** The stage of the Account definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** The stage of the Account definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Account definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithRegionalAffinity, + DefinitionStages.WithScalableExecution, + DefinitionStages.WithReporting { + /** + * Executes the create request. + * + * @return the created resource. + */ + Account create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Account create(Context context); + } + + /** The stage of the Account definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** The stage of the Account definition allowing to specify regionalAffinity. */ + interface WithRegionalAffinity { + /** + * Specifies the regionalAffinity property: This property sets the connection region for Playwright client + * workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, + * ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the + * workspace was initially created.. + * + * @param regionalAffinity This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring + * lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace + * was initially created. + * @return the next definition stage. + */ + WithCreate withRegionalAffinity(EnablementStatus regionalAffinity); + } + + /** The stage of the Account definition allowing to specify scalableExecution. */ + interface WithScalableExecution { + /** + * Specifies the scalableExecution property: When enabled, Playwright client workers can connect to + * cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly + * minimizing test completion durations.. + * + * @param scalableExecution When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test + * completion durations. + * @return the next definition stage. + */ + WithCreate withScalableExecution(EnablementStatus scalableExecution); + } + + /** The stage of the Account definition allowing to specify reporting. */ + interface WithReporting { + /** + * Specifies the reporting property: When enabled, this feature allows the workspace to upload and display + * test results, including artifacts like traces and screenshots, in the Playwright portal. This enables + * faster and more efficient troubleshooting.. + * + * @param reporting When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and + * more efficient troubleshooting. + * @return the next definition stage. + */ + WithCreate withReporting(EnablementStatus reporting); + } + } + + /** + * Begins update for the Account resource. + * + * @return the stage of resource update. + */ + Account.Update update(); + + /** The template for Account update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithRegionalAffinity, + UpdateStages.WithScalableExecution, + UpdateStages.WithReporting { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Account apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Account apply(Context context); + } + + /** The Account update stages. */ + interface UpdateStages { + /** The stage of the Account update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** The stage of the Account update allowing to specify regionalAffinity. */ + interface WithRegionalAffinity { + /** + * Specifies the regionalAffinity property: This property sets the connection region for Playwright client + * workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, + * ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the + * workspace was initially created.. + * + * @param regionalAffinity This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring + * lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace + * was initially created. + * @return the next definition stage. + */ + Update withRegionalAffinity(EnablementStatus regionalAffinity); + } + + /** The stage of the Account update allowing to specify scalableExecution. */ + interface WithScalableExecution { + /** + * Specifies the scalableExecution property: When enabled, Playwright client workers can connect to + * cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly + * minimizing test completion durations.. + * + * @param scalableExecution When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test + * completion durations. + * @return the next definition stage. + */ + Update withScalableExecution(EnablementStatus scalableExecution); + } + + /** The stage of the Account update allowing to specify reporting. */ + interface WithReporting { + /** + * Specifies the reporting property: When enabled, this feature allows the workspace to upload and display + * test results, including artifacts like traces and screenshots, in the Playwright portal. This enables + * faster and more efficient troubleshooting.. + * + * @param reporting When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and + * more efficient troubleshooting. + * @return the next definition stage. + */ + Update withReporting(EnablementStatus reporting); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Account refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Account refresh(Context context); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/AccountListResult.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/AccountListResult.java new file mode 100644 index 000000000000..44f89f8ed062 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/AccountListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Account list operation. */ +@Fluent +public final class AccountListResult { + /* + * The Account items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AccountListResult class. */ + public AccountListResult() { + } + + /** + * Get the value property: The Account items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Account items on this page. + * + * @param value the value value to set. + * @return the AccountListResult object itself. + */ + public AccountListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the AccountListResult object itself. + */ + public AccountListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model AccountListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AccountListResult.class); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/AccountUpdate.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/AccountUpdate.java new file mode 100644 index 000000000000..944793c658b1 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/AccountUpdate.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The type used for update operations of the Account. */ +@Fluent +public final class AccountUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The updatable properties of the Account. + */ + @JsonProperty(value = "properties") + private AccountUpdateProperties innerProperties; + + /** Creates an instance of AccountUpdate class. */ + public AccountUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the AccountUpdate object itself. + */ + public AccountUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The updatable properties of the Account. + * + * @return the innerProperties value. + */ + private AccountUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the regionalAffinity property: This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + * latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially + * created. + * + * @return the regionalAffinity value. + */ + public EnablementStatus regionalAffinity() { + return this.innerProperties() == null ? null : this.innerProperties().regionalAffinity(); + } + + /** + * Set the regionalAffinity property: This property sets the connection region for Playwright client workers to + * cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower + * latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially + * created. + * + * @param regionalAffinity the regionalAffinity value to set. + * @return the AccountUpdate object itself. + */ + public AccountUpdate withRegionalAffinity(EnablementStatus regionalAffinity) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountUpdateProperties(); + } + this.innerProperties().withRegionalAffinity(regionalAffinity); + return this; + } + + /** + * Get the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test completion + * durations. + * + * @return the scalableExecution value. + */ + public EnablementStatus scalableExecution() { + return this.innerProperties() == null ? null : this.innerProperties().scalableExecution(); + } + + /** + * Set the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test completion + * durations. + * + * @param scalableExecution the scalableExecution value to set. + * @return the AccountUpdate object itself. + */ + public AccountUpdate withScalableExecution(EnablementStatus scalableExecution) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountUpdateProperties(); + } + this.innerProperties().withScalableExecution(scalableExecution); + return this; + } + + /** + * Get the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @return the reporting value. + */ + public EnablementStatus reporting() { + return this.innerProperties() == null ? null : this.innerProperties().reporting(); + } + + /** + * Set the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @param reporting the reporting value to set. + * @return the AccountUpdate object itself. + */ + public AccountUpdate withReporting(EnablementStatus reporting) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountUpdateProperties(); + } + this.innerProperties().withReporting(reporting); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Accounts.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Accounts.java new file mode 100644 index 000000000000..817cbffb33d1 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Accounts.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Accounts. */ +public interface Accounts { + /** + * List Account resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List Account resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Account resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Account list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String name, Context context); + + /** + * Get a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account. + */ + Account getByResourceGroup(String resourceGroupName, String name); + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String name); + + /** + * Delete a Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String name, Context context); + + /** + * Get a Account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account along with {@link Response}. + */ + Account getById(String id); + + /** + * Get a Account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Account along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Account resource. + * + * @param name resource name. + * @return the first stage of the new Account definition. + */ + Account.DefinitionStages.Blank define(String name); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/ActionType.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/ActionType.java new file mode 100644 index 000000000000..a29437068429 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/EnablementStatus.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/EnablementStatus.java new file mode 100644 index 000000000000..2a144fdc5f5a --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/EnablementStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The enablement status of a feature. */ +public final class EnablementStatus extends ExpandableStringEnum { + /** Static value Enabled for EnablementStatus. */ + public static final EnablementStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for EnablementStatus. */ + public static final EnablementStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of EnablementStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnablementStatus() { + } + + /** + * Creates or finds a EnablementStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnablementStatus. + */ + @JsonCreator + public static EnablementStatus fromString(String name) { + return fromString(name, EnablementStatus.class); + } + + /** + * Gets known EnablementStatus values. + * + * @return known EnablementStatus values. + */ + public static Collection values() { + return values(EnablementStatus.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/FreeTrialProperties.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/FreeTrialProperties.java new file mode 100644 index 000000000000..5944a3cc225e --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/FreeTrialProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import java.time.OffsetDateTime; + +/** The free-trial properties. */ +@Immutable +public final class FreeTrialProperties { + /* + * The playwright account id. + */ + @JsonProperty(value = "accountId", required = true, access = JsonProperty.Access.WRITE_ONLY) + private String accountId; + + /* + * The free-trial createdAt utcDateTime. + */ + @JsonProperty(value = "createdAt", required = true, access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdAt; + + /* + * The free-trial expiryAt utcDateTime. + */ + @JsonProperty(value = "expiryAt", required = true, access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expiryAt; + + /* + * The free-trial allocated limit value eg. allocated free minutes. + */ + @JsonProperty(value = "allocatedValue", required = true, access = JsonProperty.Access.WRITE_ONLY) + private int allocatedValue; + + /* + * The free-trial used value eg. used free minutes. + */ + @JsonProperty(value = "usedValue", required = true, access = JsonProperty.Access.WRITE_ONLY) + private int usedValue; + + /* + * The free-trial percentage used. + */ + @JsonProperty(value = "percentageUsed", required = true, access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal percentageUsed; + + /* + * The free-trial state. + */ + @JsonProperty(value = "state", required = true, access = JsonProperty.Access.WRITE_ONLY) + private FreeTrialState state; + + /** Creates an instance of FreeTrialProperties class. */ + public FreeTrialProperties() { + } + + /** + * Get the accountId property: The playwright account id. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the createdAt property: The free-trial createdAt utcDateTime. + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Get the expiryAt property: The free-trial expiryAt utcDateTime. + * + * @return the expiryAt value. + */ + public OffsetDateTime expiryAt() { + return this.expiryAt; + } + + /** + * Get the allocatedValue property: The free-trial allocated limit value eg. allocated free minutes. + * + * @return the allocatedValue value. + */ + public int allocatedValue() { + return this.allocatedValue; + } + + /** + * Get the usedValue property: The free-trial used value eg. used free minutes. + * + * @return the usedValue value. + */ + public int usedValue() { + return this.usedValue; + } + + /** + * Get the percentageUsed property: The free-trial percentage used. + * + * @return the percentageUsed value. + */ + public BigDecimal percentageUsed() { + return this.percentageUsed; + } + + /** + * Get the state property: The free-trial state. + * + * @return the state value. + */ + public FreeTrialState state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/FreeTrialState.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/FreeTrialState.java new file mode 100644 index 000000000000..a119fa50e886 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/FreeTrialState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The free-trial state. */ +public final class FreeTrialState extends ExpandableStringEnum { + /** Static value Active for FreeTrialState. */ + public static final FreeTrialState ACTIVE = fromString("Active"); + + /** Static value Expired for FreeTrialState. */ + public static final FreeTrialState EXPIRED = fromString("Expired"); + + /** + * Creates a new instance of FreeTrialState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FreeTrialState() { + } + + /** + * Creates or finds a FreeTrialState from its string representation. + * + * @param name a name to look for. + * @return the corresponding FreeTrialState. + */ + @JsonCreator + public static FreeTrialState fromString(String name) { + return fromString(name, FreeTrialState.class); + } + + /** + * Gets known FreeTrialState values. + * + * @return known FreeTrialState values. + */ + public static Collection values() { + return values(FreeTrialState.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Operation.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Operation.java new file mode 100644 index 000000000000..b4c80c593ef8 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.resourcemanager.playwrighttesting.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.playwrighttesting.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/OperationDisplay.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/OperationDisplay.java new file mode 100644 index 000000000000..6ae7c0644d6a --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/OperationListResult.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/OperationListResult.java new file mode 100644 index 000000000000..dfa4da419998 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/OperationListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.playwrighttesting.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Operations.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Operations.java new file mode 100644 index 000000000000..bc131a56c05d --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Origin.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Origin.java new file mode 100644 index 000000000000..171a13de53cd --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Origin.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/ProvisioningState.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/ProvisioningState.java new file mode 100644 index 000000000000..9482f727613e --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/ProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The status of the current operation. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Quota.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Quota.java new file mode 100644 index 000000000000..9cd1ec81e977 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Quota.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaInner; + +/** An immutable client-side representation of Quota. */ +public interface Quota { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the freeTrial property: The free-trial quota. + * + * @return the freeTrial value. + */ + FreeTrialProperties freeTrial(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaInner object. + * + * @return the inner object. + */ + QuotaInner innerModel(); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/QuotaListResult.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/QuotaListResult.java new file mode 100644 index 000000000000..83bb7fefff05 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/QuotaListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Quota list operation. */ +@Fluent +public final class QuotaListResult { + /* + * The Quota items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of QuotaListResult class. */ + public QuotaListResult() { + } + + /** + * Get the value property: The Quota items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Quota items on this page. + * + * @param value the value value to set. + * @return the QuotaListResult object itself. + */ + public QuotaListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the QuotaListResult object itself. + */ + public QuotaListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model QuotaListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(QuotaListResult.class); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/QuotaNames.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/QuotaNames.java new file mode 100644 index 000000000000..65672219a515 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/QuotaNames.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for QuotaNames. */ +public final class QuotaNames extends ExpandableStringEnum { + /** Static value ScalableExecution for QuotaNames. */ + public static final QuotaNames SCALABLE_EXECUTION = fromString("ScalableExecution"); + + /** + * Creates a new instance of QuotaNames value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public QuotaNames() { + } + + /** + * Creates or finds a QuotaNames from its string representation. + * + * @param name a name to look for. + * @return the corresponding QuotaNames. + */ + @JsonCreator + public static QuotaNames fromString(String name) { + return fromString(name, QuotaNames.class); + } + + /** + * Gets known QuotaNames values. + * + * @return known QuotaNames values. + */ + public static Collection values() { + return values(QuotaNames.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Quotas.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Quotas.java new file mode 100644 index 000000000000..56d8b7da4246 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/Quotas.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Quotas. */ +public interface Quotas { + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(String location); + + /** + * List quotas for a given subscription Id. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Quota list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(String location, Context context); + + /** + * Get quota by name. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param name The quota name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota by name along with {@link Response}. + */ + Response getWithResponse(String location, QuotaNames name, Context context); + + /** + * Get quota by name. + * + * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. + * @param name The quota name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota by name. + */ + Quota get(String location, QuotaNames name); +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/package-info.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/package-info.java new file mode 100644 index 000000000000..1296669efdcd --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for PlaywrightTestingMgmtClient. Azure Playwright testing management service. */ +package com.azure.resourcemanager.playwrighttesting.models; diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/package-info.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/package-info.java new file mode 100644 index 000000000000..c1489f8c52a5 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/com/azure/resourcemanager/playwrighttesting/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for PlaywrightTestingMgmtClient. Azure Playwright testing management service. */ +package com.azure.resourcemanager.playwrighttesting; diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/module-info.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/module-info.java new file mode 100644 index 000000000000..b5cbdc9f224b --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.playwrighttesting { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.playwrighttesting; + exports com.azure.resourcemanager.playwrighttesting.fluent; + exports com.azure.resourcemanager.playwrighttesting.fluent.models; + exports com.azure.resourcemanager.playwrighttesting.models; + + opens com.azure.resourcemanager.playwrighttesting.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.playwrighttesting.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsCreateOrUpdateSamples.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..536bda8ebc55 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsCreateOrUpdateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Accounts CreateOrUpdate. */ +public final class AccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_CreateOrUpdate.json + */ + /** + * Sample code: Accounts_CreateOrUpdate. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsCreateOrUpdate( + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager + .accounts() + .define("myPlaywrightAccount") + .withRegion("westus") + .withExistingResourceGroup("dummyrg") + .withTags(mapOf("Team", "Dev Exp")) + .withRegionalAffinity(EnablementStatus.ENABLED) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsDeleteSamples.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsDeleteSamples.java new file mode 100644 index 000000000000..054624313ab9 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +/** Samples for Accounts Delete. */ +public final class AccountsDeleteSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Delete.json + */ + /** + * Sample code: Accounts_Delete. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsDelete(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.accounts().delete("dummyrg", "myPlaywrightAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsGetByResourceGroupSamples.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..c09fc355a905 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +/** Samples for Accounts GetByResourceGroup. */ +public final class AccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json + */ + /** + * Sample code: Accounts_Get. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsGet(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager + .accounts() + .getByResourceGroupWithResponse("dummyrg", "myPlaywrightAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListByResourceGroupSamples.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListByResourceGroupSamples.java new file mode 100644 index 000000000000..b4b67b2a3a8a --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +/** Samples for Accounts ListByResourceGroup. */ +public final class AccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListByResourceGroup.json + */ + /** + * Sample code: Accounts_ListByResourceGroup. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsListByResourceGroup( + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.accounts().listByResourceGroup("dummyrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListSamples.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListSamples.java new file mode 100644 index 000000000000..0dee2e5683e2 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +/** Samples for Accounts List. */ +public final class AccountsListSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListBySubscription.json + */ + /** + * Sample code: Accounts_ListBySubscription. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsListBySubscription( + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.accounts().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsUpdateSamples.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsUpdateSamples.java new file mode 100644 index 000000000000..2e81197ccf3c --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.resourcemanager.playwrighttesting.models.Account; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Accounts Update. */ +public final class AccountsUpdateSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Update.json + */ + /** + * Sample code: Accounts_Update. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void accountsUpdate(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("dummyrg", "myPlaywrightAccount", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("Division", "LT", "Team", "Dev Exp")) + .withRegionalAffinity(EnablementStatus.ENABLED) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/OperationsListSamples.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/OperationsListSamples.java new file mode 100644 index 000000000000..8e2ee64569b1 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/OperationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void operationsList(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasGetSamples.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasGetSamples.java new file mode 100644 index 000000000000..514a3fa17d92 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.resourcemanager.playwrighttesting.models.QuotaNames; + +/** Samples for Quotas Get. */ +public final class QuotasGetSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json + */ + /** + * Sample code: Quotas_Get. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void quotasGet(com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.quotas().getWithResponse("eastus", QuotaNames.SCALABLE_EXECUTION, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasListBySubscriptionSamples.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasListBySubscriptionSamples.java new file mode 100644 index 000000000000..9d4d4cf053b0 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/samples/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasListBySubscriptionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +/** Samples for Quotas ListBySubscription. */ +public final class QuotasListBySubscriptionSamples { + /* + * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_ListBySubscription.json + */ + /** + * Sample code: Quotas_ListBySubscription. + * + * @param manager Entry point to PlaywrightTestingManager. + */ + public static void quotasListBySubscription( + com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager manager) { + manager.quotas().listBySubscription("eastus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountInnerTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountInnerTests.java new file mode 100644 index 000000000000..66f0908277fe --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountInnerTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountInner; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AccountInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountInner model = + BinaryData + .fromString( + "{\"properties\":{\"dashboardUri\":\"s\",\"regionalAffinity\":\"Disabled\",\"scalableExecution\":\"Enabled\",\"reporting\":\"Enabled\",\"provisioningState\":\"Canceled\"},\"location\":\"htnapczwlokjyem\",\"tags\":{\"joxzjnchgejspodm\":\"ni\",\"h\":\"ilzyd\"},\"id\":\"jwyahuxinpmqnja\",\"name\":\"wixjsprozvcp\",\"type\":\"tegjvwmf\"}") + .toObject(AccountInner.class); + Assertions.assertEquals("htnapczwlokjyem", model.location()); + Assertions.assertEquals("ni", model.tags().get("joxzjnchgejspodm")); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.scalableExecution()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.reporting()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountInner model = + new AccountInner() + .withLocation("htnapczwlokjyem") + .withTags(mapOf("joxzjnchgejspodm", "ni", "h", "ilzyd")) + .withRegionalAffinity(EnablementStatus.DISABLED) + .withScalableExecution(EnablementStatus.ENABLED) + .withReporting(EnablementStatus.ENABLED); + model = BinaryData.fromObject(model).toObject(AccountInner.class); + Assertions.assertEquals("htnapczwlokjyem", model.location()); + Assertions.assertEquals("ni", model.tags().get("joxzjnchgejspodm")); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.scalableExecution()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.reporting()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountListResultTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountListResultTests.java new file mode 100644 index 000000000000..cc01f77fbcef --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountListResultTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountInner; +import com.azure.resourcemanager.playwrighttesting.models.AccountListResult; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AccountListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountListResult model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"dashboardUri\":\"ithxqhabifpi\",\"regionalAffinity\":\"Enabled\",\"scalableExecution\":\"Enabled\",\"reporting\":\"Enabled\",\"provisioningState\":\"Failed\"},\"location\":\"pqxu\",\"tags\":{\"n\":\"y\"},\"id\":\"wby\",\"name\":\"rkxvdum\",\"type\":\"grtfwvu\"}],\"nextLink\":\"gaudcc\"}") + .toObject(AccountListResult.class); + Assertions.assertEquals("pqxu", model.value().get(0).location()); + Assertions.assertEquals("y", model.value().get(0).tags().get("n")); + Assertions.assertEquals(EnablementStatus.ENABLED, model.value().get(0).regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.value().get(0).scalableExecution()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.value().get(0).reporting()); + Assertions.assertEquals("gaudcc", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountListResult model = + new AccountListResult() + .withValue( + Arrays + .asList( + new AccountInner() + .withLocation("pqxu") + .withTags(mapOf("n", "y")) + .withRegionalAffinity(EnablementStatus.ENABLED) + .withScalableExecution(EnablementStatus.ENABLED) + .withReporting(EnablementStatus.ENABLED))) + .withNextLink("gaudcc"); + model = BinaryData.fromObject(model).toObject(AccountListResult.class); + Assertions.assertEquals("pqxu", model.value().get(0).location()); + Assertions.assertEquals("y", model.value().get(0).tags().get("n")); + Assertions.assertEquals(EnablementStatus.ENABLED, model.value().get(0).regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.value().get(0).scalableExecution()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.value().get(0).reporting()); + Assertions.assertEquals("gaudcc", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountPropertiesTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountPropertiesTests.java new file mode 100644 index 000000000000..31bd43834690 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountPropertiesTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountProperties; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import org.junit.jupiter.api.Assertions; + +public final class AccountPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountProperties model = + BinaryData + .fromString( + "{\"dashboardUri\":\"t\",\"regionalAffinity\":\"Disabled\",\"scalableExecution\":\"Disabled\",\"reporting\":\"Disabled\",\"provisioningState\":\"Failed\"}") + .toObject(AccountProperties.class); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.scalableExecution()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.reporting()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountProperties model = + new AccountProperties() + .withRegionalAffinity(EnablementStatus.DISABLED) + .withScalableExecution(EnablementStatus.DISABLED) + .withReporting(EnablementStatus.DISABLED); + model = BinaryData.fromObject(model).toObject(AccountProperties.class); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.scalableExecution()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.reporting()); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountUpdatePropertiesTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountUpdatePropertiesTests.java new file mode 100644 index 000000000000..6bd2c3d49644 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountUpdatePropertiesTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.AccountUpdateProperties; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import org.junit.jupiter.api.Assertions; + +public final class AccountUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountUpdateProperties model = + BinaryData + .fromString( + "{\"regionalAffinity\":\"Enabled\",\"scalableExecution\":\"Disabled\",\"reporting\":\"Disabled\"}") + .toObject(AccountUpdateProperties.class); + Assertions.assertEquals(EnablementStatus.ENABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.scalableExecution()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.reporting()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountUpdateProperties model = + new AccountUpdateProperties() + .withRegionalAffinity(EnablementStatus.ENABLED) + .withScalableExecution(EnablementStatus.DISABLED) + .withReporting(EnablementStatus.DISABLED); + model = BinaryData.fromObject(model).toObject(AccountUpdateProperties.class); + Assertions.assertEquals(EnablementStatus.ENABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.scalableExecution()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.reporting()); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountUpdateTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountUpdateTests.java new file mode 100644 index 000000000000..7bb6c78d6d24 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountUpdateTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.models.AccountUpdate; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AccountUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountUpdate model = + BinaryData + .fromString( + "{\"tags\":{\"wrwclxxwrljd\":\"ntnbybkzg\",\"kwt\":\"uskcqvkocrcj\",\"ssainqpjwnzll\":\"hxbnjbiksqrg\"},\"properties\":{\"regionalAffinity\":\"Disabled\",\"scalableExecution\":\"Disabled\",\"reporting\":\"Disabled\"}}") + .toObject(AccountUpdate.class); + Assertions.assertEquals("ntnbybkzg", model.tags().get("wrwclxxwrljd")); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.scalableExecution()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.reporting()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountUpdate model = + new AccountUpdate() + .withTags(mapOf("wrwclxxwrljd", "ntnbybkzg", "kwt", "uskcqvkocrcj", "ssainqpjwnzll", "hxbnjbiksqrg")) + .withRegionalAffinity(EnablementStatus.DISABLED) + .withScalableExecution(EnablementStatus.DISABLED) + .withReporting(EnablementStatus.DISABLED); + model = BinaryData.fromObject(model).toObject(AccountUpdate.class); + Assertions.assertEquals("ntnbybkzg", model.tags().get("wrwclxxwrljd")); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.scalableExecution()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.reporting()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateMockTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsCreateOrUpdateMockTests.java similarity index 60% rename from sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateMockTests.java rename to sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsCreateOrUpdateMockTests.java index 15f916194c5f..9cddc452d6d8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/test/java/com/azure/resourcemanager/communication/generated/DomainsCreateOrUpdateMockTests.java +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsCreateOrUpdateMockTests.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.communication.generated; +package com.azure.resourcemanager.playwrighttesting.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; @@ -11,10 +11,9 @@ import com.azure.core.http.HttpResponse; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.communication.CommunicationManager; -import com.azure.resourcemanager.communication.models.DomainManagement; -import com.azure.resourcemanager.communication.models.DomainResource; -import com.azure.resourcemanager.communication.models.UserEngagementTracking; +import com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager; +import com.azure.resourcemanager.playwrighttesting.models.Account; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -27,7 +26,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public final class DomainsCreateOrUpdateMockTests { +public final class AccountsCreateOrUpdateMockTests { @Test public void testCreateOrUpdate() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); @@ -35,7 +34,7 @@ public void testCreateOrUpdate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"dataLocation\":\"ilpjzuaejxdult\",\"fromSenderDomain\":\"zbbtdzumveek\",\"mailFromSenderDomain\":\"wozuhkf\",\"domainManagement\":\"AzureManaged\",\"verificationStates\":{},\"verificationRecords\":{},\"userEngagementTracking\":\"Enabled\"},\"location\":\"uwaboekqvke\",\"tags\":{\"wyjsflhhcaalnjix\":\"mvb\"},\"id\":\"sxyawjoyaqcs\",\"name\":\"yjpkiidzyexz\",\"type\":\"eli\"}"; + "{\"properties\":{\"dashboardUri\":\"bdxkqpxokaj\",\"regionalAffinity\":\"Enabled\",\"scalableExecution\":\"Disabled\",\"reporting\":\"Enabled\",\"provisioningState\":\"Succeeded\"},\"location\":\"txgcpodgmaajr\",\"tags\":{\"vmclw\":\"jwzrl\",\"aqsqsycbkbfk\":\"ijcoejctb\"},\"id\":\"ukdkexxppofmxa\",\"name\":\"c\",\"type\":\"jpgd\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -55,31 +54,34 @@ public void testCreateOrUpdate() throws Exception { return Mono.just(httpResponse); })); - CommunicationManager manager = - CommunicationManager + PlaywrightTestingManager manager = + PlaywrightTestingManager .configure() .withHttpClient(httpClient) .authenticate( tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - DomainResource response = + Account response = manager - .domains() - .define("gibtnm") - .withRegion("qpsrknftguvri") - .withExistingEmailService("c", "wxzvlvqhjkb") - .withTags(mapOf("iwwroyqbexrmc", "rwmdyvxqtay", "v", "ibycno", "zhpvgqzcjrvxd", "nmefqsgzvahapj")) - .withDomainManagement(DomainManagement.CUSTOMER_MANAGED_IN_EXCHANGE_ONLINE) - .withUserEngagementTracking(UserEngagementTracking.ENABLED) + .accounts() + .define("bznorcjxvsnby") + .withRegion("fblj") + .withExistingResourceGroup("gr") + .withTags(mapOf("qajzyulpkudjkr", "btoqcjmkljavbqid", "e", "khbzhfepgzg", "scpai", "zloc")) + .withRegionalAffinity(EnablementStatus.DISABLED) + .withScalableExecution(EnablementStatus.DISABLED) + .withReporting(EnablementStatus.ENABLED) .create(); - Assertions.assertEquals("uwaboekqvke", response.location()); - Assertions.assertEquals("mvb", response.tags().get("wyjsflhhcaalnjix")); - Assertions.assertEquals(DomainManagement.AZURE_MANAGED, response.domainManagement()); - Assertions.assertEquals(UserEngagementTracking.ENABLED, response.userEngagementTracking()); + Assertions.assertEquals("txgcpodgmaajr", response.location()); + Assertions.assertEquals("jwzrl", response.tags().get("vmclw")); + Assertions.assertEquals(EnablementStatus.ENABLED, response.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, response.scalableExecution()); + Assertions.assertEquals(EnablementStatus.ENABLED, response.reporting()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsDeleteMockTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsDeleteMockTests.java new file mode 100644 index 000000000000..a5c551d4980e --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsDeleteMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccountsDeleteMockTests { + @Test + public void testDelete() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + PlaywrightTestingManager manager = + PlaywrightTestingManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.accounts().delete("dqxhcrmnohjtckwh", "soifiyipjxsqw", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsGetByResourceGroupWithResponseMockTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..a0b55a2f3cb5 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager; +import com.azure.resourcemanager.playwrighttesting.models.Account; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccountsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"dashboardUri\":\"zxufiz\",\"regionalAffinity\":\"Enabled\",\"scalableExecution\":\"Enabled\",\"reporting\":\"Enabled\",\"provisioningState\":\"Failed\"},\"location\":\"dfvzwdzuhty\",\"tags\":{\"hwxmnteiwa\":\"sdkf\",\"fsrpymzidnse\":\"pvkmijcmmxdcuf\",\"yc\":\"cxtbzsg\",\"mdwzjeiachboo\":\"sne\"},\"id\":\"flnrosfqpteehzz\",\"name\":\"ypyqrimzinp\",\"type\":\"swjdkirso\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + PlaywrightTestingManager manager = + PlaywrightTestingManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Account response = + manager + .accounts() + .getByResourceGroupWithResponse("uouq", "prwzwbnguitnwui", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dfvzwdzuhty", response.location()); + Assertions.assertEquals("sdkf", response.tags().get("hwxmnteiwa")); + Assertions.assertEquals(EnablementStatus.ENABLED, response.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, response.scalableExecution()); + Assertions.assertEquals(EnablementStatus.ENABLED, response.reporting()); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListByResourceGroupMockTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListByResourceGroupMockTests.java new file mode 100644 index 000000000000..67d50ed4c0f3 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListByResourceGroupMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager; +import com.azure.resourcemanager.playwrighttesting.models.Account; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccountsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"dashboardUri\":\"bciqfouflm\",\"regionalAffinity\":\"Enabled\",\"scalableExecution\":\"Disabled\",\"reporting\":\"Enabled\",\"provisioningState\":\"Canceled\"},\"location\":\"lougpbkw\",\"tags\":{\"umkdosvqwhbmd\":\"tduqktapspwgcuer\",\"bhtqqrolfpfpsa\":\"bbjfddgmbmbexp\",\"jgzjaoyfhrtx\":\"gbquxigj\",\"fqawrlyxw\":\"lnerkujysvleju\"},\"id\":\"kcprbnw\",\"name\":\"xgjvtbv\",\"type\":\"ysszdnrujqguh\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + PlaywrightTestingManager manager = + PlaywrightTestingManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.accounts().listByResourceGroup("qsrxybzqqed", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("lougpbkw", response.iterator().next().location()); + Assertions.assertEquals("tduqktapspwgcuer", response.iterator().next().tags().get("umkdosvqwhbmd")); + Assertions.assertEquals(EnablementStatus.ENABLED, response.iterator().next().regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, response.iterator().next().scalableExecution()); + Assertions.assertEquals(EnablementStatus.ENABLED, response.iterator().next().reporting()); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListMockTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListMockTests.java new file mode 100644 index 000000000000..397934bf493c --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/AccountsListMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager; +import com.azure.resourcemanager.playwrighttesting.models.Account; +import com.azure.resourcemanager.playwrighttesting.models.EnablementStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccountsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"dashboardUri\":\"qxhocdgeablgphut\",\"regionalAffinity\":\"Enabled\",\"scalableExecution\":\"Disabled\",\"reporting\":\"Disabled\",\"provisioningState\":\"Succeeded\"},\"location\":\"yiftyhxhuro\",\"tags\":{\"cukjf\":\"yxolniwp\",\"lryplwckbasyy\":\"giawx\",\"jkot\":\"nddhsgcbacph\"},\"id\":\"nqgoulzndli\",\"name\":\"wyqkgfgibm\",\"type\":\"dgak\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + PlaywrightTestingManager manager = + PlaywrightTestingManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.accounts().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("yiftyhxhuro", response.iterator().next().location()); + Assertions.assertEquals("yxolniwp", response.iterator().next().tags().get("cukjf")); + Assertions.assertEquals(EnablementStatus.ENABLED, response.iterator().next().regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, response.iterator().next().scalableExecution()); + Assertions.assertEquals(EnablementStatus.DISABLED, response.iterator().next().reporting()); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/FreeTrialPropertiesTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/FreeTrialPropertiesTests.java new file mode 100644 index 000000000000..036139abfe28 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/FreeTrialPropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.models.FreeTrialProperties; + +public final class FreeTrialPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FreeTrialProperties model = + BinaryData + .fromString( + "{\"accountId\":\"qjbasvms\",\"createdAt\":\"2021-01-21T06:57:24Z\",\"expiryAt\":\"2021-08-09T10:57:51Z\",\"allocatedValue\":2070892597,\"usedValue\":2084272233,\"state\":\"Expired\"}") + .toObject(FreeTrialProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FreeTrialProperties model = new FreeTrialProperties(); + model = BinaryData.fromObject(model).toObject(FreeTrialProperties.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationDisplayTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..a423fb330fc0 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationDisplayTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = + BinaryData + .fromString( + "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") + .toObject(OperationDisplay.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationDisplay model = new OperationDisplay(); + model = BinaryData.fromObject(model).toObject(OperationDisplay.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationInnerTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationInnerTests.java new file mode 100644 index 000000000000..de1d1193160b --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationInnerTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.OperationInner; +import com.azure.resourcemanager.playwrighttesting.models.OperationDisplay; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = + BinaryData + .fromString( + "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); + model = BinaryData.fromObject(model).toObject(OperationInner.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationListResultTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationListResultTests.java new file mode 100644 index 000000000000..1f2a14460b0b --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationListResultTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.models.OperationListResult; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = + BinaryData + .fromString( + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") + .toObject(OperationListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationListResult model = new OperationListResult(); + model = BinaryData.fromObject(model).toObject(OperationListResult.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationsListMockTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..bcb2a9d72a01 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/OperationsListMockTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager; +import com.azure.resourcemanager.playwrighttesting.models.Operation; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"name\":\"kyqduujit\",\"isDataAction\":false,\"display\":{\"provider\":\"zevndhkrwpdappds\",\"resource\":\"kvwrwjfeu\",\"operation\":\"hutje\",\"description\":\"mrldhu\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + PlaywrightTestingManager manager = + PlaywrightTestingManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotaInnerTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotaInnerTests.java new file mode 100644 index 000000000000..77965fe70d6a --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotaInnerTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaInner; +import com.azure.resourcemanager.playwrighttesting.models.FreeTrialProperties; + +public final class QuotaInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + QuotaInner model = + BinaryData + .fromString( + "{\"properties\":{\"freeTrial\":{\"accountId\":\"uvamiheognarxzxt\",\"createdAt\":\"2021-08-08T21:36:05Z\",\"expiryAt\":\"2021-07-28T01:15:26Z\",\"allocatedValue\":1638968400,\"usedValue\":1544576839,\"state\":\"Active\"},\"provisioningState\":\"Canceled\"},\"id\":\"evcciqihnhun\",\"name\":\"bwjzr\",\"type\":\"fygxgispemvtzfk\"}") + .toObject(QuotaInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + QuotaInner model = new QuotaInner().withFreeTrial(new FreeTrialProperties()); + model = BinaryData.fromObject(model).toObject(QuotaInner.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotaListResultTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotaListResultTests.java new file mode 100644 index 000000000000..e66a2a7d7c7a --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotaListResultTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaInner; +import com.azure.resourcemanager.playwrighttesting.models.FreeTrialProperties; +import com.azure.resourcemanager.playwrighttesting.models.QuotaListResult; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class QuotaListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + QuotaListResult model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"freeTrial\":{\"accountId\":\"uvm\",\"createdAt\":\"2021-07-02T09:33:18Z\",\"expiryAt\":\"2021-08-30T14:27:09Z\",\"allocatedValue\":1523765181,\"usedValue\":37430274,\"state\":\"Active\"},\"provisioningState\":\"Succeeded\"},\"id\":\"dio\",\"name\":\"jpslwejd\",\"type\":\"vwryoqpso\"},{\"properties\":{\"freeTrial\":{\"accountId\":\"tazak\",\"createdAt\":\"2020-12-25T20:04:21Z\",\"expiryAt\":\"2021-11-13T06:20:15Z\",\"allocatedValue\":1063449943,\"usedValue\":1628568580,\"state\":\"Expired\"},\"provisioningState\":\"Deleting\"},\"id\":\"ffdfdosygexpa\",\"name\":\"jakhmsbzjh\",\"type\":\"rzevdphlxaol\"},{\"properties\":{\"freeTrial\":{\"accountId\":\"trg\",\"createdAt\":\"2021-10-25T01:14:42Z\",\"expiryAt\":\"2020-12-22T15:41:37Z\",\"allocatedValue\":1007211846,\"usedValue\":139321967,\"state\":\"Expired\"},\"provisioningState\":\"Accepted\"},\"id\":\"n\",\"name\":\"gvfcj\",\"type\":\"wzo\"},{\"properties\":{\"freeTrial\":{\"accountId\":\"tfell\",\"createdAt\":\"2021-11-29T23:11Z\",\"expiryAt\":\"2021-05-19T06:23:52Z\",\"allocatedValue\":1541264855,\"usedValue\":348508366,\"state\":\"Active\"},\"provisioningState\":\"Accepted\"},\"id\":\"eqfpj\",\"name\":\"jlxofpdvhpfxxyp\",\"type\":\"ninmayhuyb\"}],\"nextLink\":\"podepoo\"}") + .toObject(QuotaListResult.class); + Assertions.assertEquals("podepoo", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + QuotaListResult model = + new QuotaListResult() + .withValue( + Arrays + .asList( + new QuotaInner().withFreeTrial(new FreeTrialProperties()), + new QuotaInner().withFreeTrial(new FreeTrialProperties()), + new QuotaInner().withFreeTrial(new FreeTrialProperties()), + new QuotaInner().withFreeTrial(new FreeTrialProperties()))) + .withNextLink("podepoo"); + model = BinaryData.fromObject(model).toObject(QuotaListResult.class); + Assertions.assertEquals("podepoo", model.nextLink()); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotaPropertiesTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotaPropertiesTests.java new file mode 100644 index 000000000000..289a6731928c --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotaPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwrighttesting.fluent.models.QuotaProperties; +import com.azure.resourcemanager.playwrighttesting.models.FreeTrialProperties; + +public final class QuotaPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + QuotaProperties model = + BinaryData + .fromString( + "{\"freeTrial\":{\"accountId\":\"ubljofxqe\",\"createdAt\":\"2021-05-14T22:11:20Z\",\"expiryAt\":\"2021-02-25T06:04:33Z\",\"allocatedValue\":1330720242,\"usedValue\":56034680,\"state\":\"Active\"},\"provisioningState\":\"Canceled\"}") + .toObject(QuotaProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + QuotaProperties model = new QuotaProperties().withFreeTrial(new FreeTrialProperties()); + model = BinaryData.fromObject(model).toObject(QuotaProperties.class); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasGetWithResponseMockTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasGetWithResponseMockTests.java new file mode 100644 index 000000000000..a673834a5477 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasGetWithResponseMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager; +import com.azure.resourcemanager.playwrighttesting.models.Quota; +import com.azure.resourcemanager.playwrighttesting.models.QuotaNames; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class QuotasGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"freeTrial\":{\"accountId\":\"dglmjthjqkwp\",\"createdAt\":\"2021-11-24T17:43:24Z\",\"expiryAt\":\"2021-11-30T09:09:34Z\",\"allocatedValue\":1516038621,\"usedValue\":1222275240,\"state\":\"Active\"},\"provisioningState\":\"Failed\"},\"id\":\"wqvhkhixuigdt\",\"name\":\"pbobjo\",\"type\":\"hm\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + PlaywrightTestingManager manager = + PlaywrightTestingManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Quota response = + manager + .quotas() + .getWithResponse("btwnpzaoqvuhrhcf", QuotaNames.SCALABLE_EXECUTION, com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasListBySubscriptionMockTests.java b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasListBySubscriptionMockTests.java new file mode 100644 index 000000000000..3228f343603c --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/java/com/azure/resourcemanager/playwrighttesting/generated/QuotasListBySubscriptionMockTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.playwrighttesting.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.playwrighttesting.PlaywrightTestingManager; +import com.azure.resourcemanager.playwrighttesting.models.Quota; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class QuotasListBySubscriptionMockTests { + @Test + public void testListBySubscription() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"freeTrial\":{\"accountId\":\"hvpmoue\",\"createdAt\":\"2021-09-12T01:29:13Z\",\"expiryAt\":\"2021-06-30T20:07:19Z\",\"allocatedValue\":2146697807,\"usedValue\":9507758,\"state\":\"Active\"},\"provisioningState\":\"Deleting\"},\"id\":\"ojnxqbzvdd\",\"name\":\"t\",\"type\":\"ndei\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + PlaywrightTestingManager manager = + PlaywrightTestingManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.quotas().listBySubscription("toc", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000000..1f0955d450f0 --- /dev/null +++ b/sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline diff --git a/sdk/playwrighttesting/ci.yml b/sdk/playwrighttesting/ci.yml new file mode 100644 index 000000000000..f670b553927e --- /dev/null +++ b/sdk/playwrighttesting/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/playwrighttesting/ci.yml + - sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/ + exclude: + - sdk/playwrighttesting/pom.xml + - sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/playwrighttesting/ci.yml + - sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/ + exclude: + - sdk/playwrighttesting/pom.xml + - sdk/playwrighttesting/azure-resourcemanager-playwrighttesting/pom.xml + +parameters: + - name: release_azureresourcemanagerplaywrighttesting + displayName: azure-resourcemanager-playwrighttesting + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: playwrighttesting + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-playwrighttesting + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerplaywrighttesting + releaseInBatch: ${{ parameters.release_azureresourcemanagerplaywrighttesting }} diff --git a/sdk/playwrighttesting/pom.xml b/sdk/playwrighttesting/pom.xml new file mode 100644 index 000000000000..9279109bf1d8 --- /dev/null +++ b/sdk/playwrighttesting/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-playwrighttesting-service + pom + 1.0.0 + + + azure-resourcemanager-playwrighttesting + + diff --git a/sdk/purview/azure-analytics-purview-administration/README.md b/sdk/purview/azure-analytics-purview-administration/README.md index 59eaa6eff751..25f604a97465 100644 --- a/sdk/purview/azure-analytics-purview-administration/README.md +++ b/sdk/purview/azure-analytics-purview-administration/README.md @@ -48,7 +48,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/purview/azure-analytics-purview-catalog/README.md b/sdk/purview/azure-analytics-purview-catalog/README.md index 2d5dded3ba5c..a7134cff448a 100644 --- a/sdk/purview/azure-analytics-purview-catalog/README.md +++ b/sdk/purview/azure-analytics-purview-catalog/README.md @@ -49,7 +49,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/purview/azure-analytics-purview-scanning/README.md b/sdk/purview/azure-analytics-purview-scanning/README.md index b3ccd2c7b0ce..fb393f1606dd 100644 --- a/sdk/purview/azure-analytics-purview-scanning/README.md +++ b/sdk/purview/azure-analytics-purview-scanning/README.md @@ -50,7 +50,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/purview/azure-analytics-purview-workflow/README.md b/sdk/purview/azure-analytics-purview-workflow/README.md index 911e67aba821..7e63bf2d82b2 100644 --- a/sdk/purview/azure-analytics-purview-workflow/README.md +++ b/sdk/purview/azure-analytics-purview-workflow/README.md @@ -29,7 +29,7 @@ To use the [UsernamePasswordCredential][username_password_credential] provider s com.azure azure-identity - 1.10.0 + 1.10.1 ``` diff --git a/sdk/quantum/azure-quantum-jobs/pom.xml b/sdk/quantum/azure-quantum-jobs/pom.xml index c720041e546c..aed6cd635105 100644 --- a/sdk/quantum/azure-quantum-jobs/pom.xml +++ b/sdk/quantum/azure-quantum-jobs/pom.xml @@ -78,7 +78,7 @@ com.azure azure-storage-blob - 12.23.1 + 12.24.0 test diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/CHANGELOG.md b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/CHANGELOG.md index 648c01a9d32e..b096c319970a 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/CHANGELOG.md +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.1.0-beta.1 (Unreleased) ### Features Added @@ -10,6 +10,114 @@ ### Other Changes +## 1.0.0 (2023-09-22) + +- Azure Resource Manager SiteRecovery client library for Java. This package contains Microsoft Azure SDK for SiteRecovery Management SDK. Package tag package-2023-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Features Added + +* `models.OSUpgradeSupportedVersions` was added + +* `models.ChurnOptionSelected` was added + +* `models.GatewayOperationDetails` was added + +* `models.VMwareCbtSecurityProfileProperties` was added + +* `models.ApplianceMonitoringDetails` was added + +* `models.A2AFabricSpecificLocationDetails` was added + +* `models.SecurityType` was added + +* `models.DataStoreUtilizationDetails` was added + +* `models.ApplianceResourceDetails` was added + +#### `models.InMageAzureV2ReplicationDetails` was modified + +* `osName()` was added +* `allAvailableOSUpgradeConfigurations()` was added +* `withSupportedOSVersions(java.util.List)` was added +* `supportedOSVersions()` was added +* `withAllAvailableOSUpgradeConfigurations(java.util.List)` was added + +#### `models.HyperVReplicaAzureReplicationDetails` was modified + +* `withAllAvailableOSUpgradeConfigurations(java.util.List)` was added +* `allAvailableOSUpgradeConfigurations()` was added + +#### `models.AzureFabricSpecificDetails` was modified + +* `withLocationDetails(java.util.List)` was added +* `locationDetails()` was added + +#### `models.A2AReplicationDetails` was modified + +* `churnOptionSelected()` was added + +#### `models.VMwareCbtProtectedDiskDetails` was modified + +* `gatewayOperationDetails()` was added + +#### `models.VMwareCbtTestMigrateInput` was modified + +* `osUpgradeVersion()` was added +* `withOsUpgradeVersion(java.lang.String)` was added + +#### `models.InMageAzureV2TestFailoverInput` was modified + +* `osUpgradeVersion()` was added +* `withOsUpgradeVersion(java.lang.String)` was added + +#### `models.VMwareCbtEnableMigrationInput` was modified + +* `withTargetVmSecurityProfile(models.VMwareCbtSecurityProfileProperties)` was added +* `withConfidentialVmKeyVaultId(java.lang.String)` was added +* `targetVmSecurityProfile()` was added +* `confidentialVmKeyVaultId()` was added + +#### `models.VMwareCbtMigrateInput` was modified + +* `withOsUpgradeVersion(java.lang.String)` was added +* `osUpgradeVersion()` was added + +#### `models.HyperVReplicaAzureTestFailoverInput` was modified + +* `osUpgradeVersion()` was added +* `withOsUpgradeVersion(java.lang.String)` was added + +#### `models.InMageAzureV2UnplannedFailoverInput` was modified + +* `osUpgradeVersion()` was added +* `withOsUpgradeVersion(java.lang.String)` was added + +#### `models.VMwareCbtProtectionContainerMappingDetails` was modified + +* `withExcludedSkus(java.util.List)` was added +* `excludedSkus()` was added + +#### `models.HyperVReplicaAzurePlannedFailoverProviderInput` was modified + +* `withOsUpgradeVersion(java.lang.String)` was added +* `osUpgradeVersion()` was added + +#### `models.VMwareCbtMigrationDetails` was modified + +* `gatewayOperationDetails()` was added +* `isCheckSumResyncCycle()` was added +* `targetVmSecurityProfile()` was added +* `withTargetVmSecurityProfile(models.VMwareCbtSecurityProfileProperties)` was added +* `osName()` was added +* `operationName()` was added +* `applianceMonitoringDetails()` was added +* `confidentialVmKeyVaultId()` was added +* `withConfidentialVmKeyVaultId(java.lang.String)` was added +* `supportedOSVersions()` was added +* `deltaSyncProgressPercentage()` was added +* `withSupportedOSVersions(java.util.List)` was added +* `deltaSyncRetryCount()` was added + ## 1.0.0-beta.1 (2023-01-11) - Azure Resource Manager SiteRecovery client library for Java. This package contains Microsoft Azure SDK for SiteRecovery Management SDK. Package tag package-2022-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/README.md b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/README.md index 6271aa16fe5d..a48072171ce6 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/README.md +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/README.md @@ -2,7 +2,7 @@ Azure Resource Manager SiteRecovery client library for Java. -This package contains Microsoft Azure SDK for SiteRecovery Management SDK. Package tag package-2022-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for SiteRecovery Management SDK. Package tag package-2023-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-recoveryservicessiterecovery - 1.0.0-beta.1 + 1.0.0 ``` [//]: # ({x-version-update-end}) @@ -103,3 +103,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Frecoveryservicessiterecovery%2Fazure-resourcemanager-recoveryservicessiterecovery%2FREADME.png) diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/SAMPLE.md b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/SAMPLE.md index 284283f86f76..d61da488b63f 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/SAMPLE.md +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/SAMPLE.md @@ -227,7 +227,7 @@ /** Samples for MigrationRecoveryPoints Get. */ public final class MigrationRecoveryPointsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/MigrationRecoveryPoints_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/MigrationRecoveryPoints_Get.json */ /** * Sample code: Gets a recovery point for a migration item. @@ -256,7 +256,7 @@ public final class MigrationRecoveryPointsGetSamples { /** Samples for MigrationRecoveryPoints ListByReplicationMigrationItems. */ public final class MigrationRecoveryPointsListByReplicationMigrati { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/MigrationRecoveryPoints_ListByReplicationMigrationItems.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/MigrationRecoveryPoints_ListByReplicationMigrationItems.json */ /** * Sample code: Gets the recovery points for a migration item. @@ -284,7 +284,7 @@ public final class MigrationRecoveryPointsListByReplicationMigrati { /** Samples for Operations ListByResourceGroup. */ public final class OperationsListByResourceGroupSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/Operations_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/Operations_List.json */ /** * Sample code: Returns the list of available operations. @@ -304,7 +304,7 @@ public final class OperationsListByResourceGroupSamples { /** Samples for RecoveryPoints Get. */ public final class RecoveryPointsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/RecoveryPoints_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/RecoveryPoints_Get.json */ /** * Sample code: Gets a recovery point. @@ -333,7 +333,7 @@ public final class RecoveryPointsGetSamples { /** Samples for RecoveryPoints ListByReplicationProtectedItems. */ public final class RecoveryPointsListByReplicationProtectedItemsSa { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/RecoveryPoints_ListByReplicationProtectedItems.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/RecoveryPoints_ListByReplicationProtectedItems.json */ /** * Sample code: Gets the list of recovery points for a replication protected item. @@ -364,7 +364,7 @@ import java.util.Arrays; /** Samples for ReplicationAlertSettings Create. */ public final class ReplicationAlertSettingsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_Create.json */ /** * Sample code: Configures email notifications for this vault. @@ -393,7 +393,7 @@ public final class ReplicationAlertSettingsCreateSamples { /** Samples for ReplicationAlertSettings Get. */ public final class ReplicationAlertSettingsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_Get.json */ /** * Sample code: Gets an email notification(alert) configuration. @@ -415,7 +415,7 @@ public final class ReplicationAlertSettingsGetSamples { /** Samples for ReplicationAlertSettings List. */ public final class ReplicationAlertSettingsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_List.json */ /** * Sample code: Gets the list of configured email notification(alert) configurations. @@ -435,7 +435,7 @@ public final class ReplicationAlertSettingsListSamples { /** Samples for ReplicationAppliances List. */ public final class ReplicationAppliancesListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAppliances_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAppliances_List.json */ /** * Sample code: Gets the list of appliances. @@ -455,7 +455,7 @@ public final class ReplicationAppliancesListSamples { /** Samples for ReplicationEligibilityResultsOperation Get. */ public final class ReplicationEligibilityResultsOperationGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEligibilityResults_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEligibilityResults_Get.json */ /** * Sample code: Gets the validation errors in case the VM is unsuitable for protection. @@ -477,7 +477,7 @@ public final class ReplicationEligibilityResultsOperationGetSamples { /** Samples for ReplicationEligibilityResultsOperation List. */ public final class ReplicationEligibilityResultsOperationListSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEligibilityResults_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEligibilityResults_List.json */ /** * Sample code: Gets the validation errors in case the VM is unsuitable for protection. @@ -499,7 +499,7 @@ public final class ReplicationEligibilityResultsOperationListSampl { /** Samples for ReplicationEvents Get. */ public final class ReplicationEventsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEvents_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEvents_Get.json */ /** * Sample code: Get the details of an Azure Site recovery event. @@ -522,7 +522,7 @@ public final class ReplicationEventsGetSamples { /** Samples for ReplicationEvents List. */ public final class ReplicationEventsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEvents_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEvents_List.json */ /** * Sample code: Gets the list of Azure Site Recovery events. @@ -542,7 +542,7 @@ public final class ReplicationEventsListSamples { /** Samples for ReplicationFabrics CheckConsistency. */ public final class ReplicationFabricsCheckConsistencySamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_CheckConsistency.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_CheckConsistency.json */ /** * Sample code: Checks the consistency of the ASR fabric. @@ -567,7 +567,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpeci /** Samples for ReplicationFabrics Create. */ public final class ReplicationFabricsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Create.json */ /** * Sample code: Creates an Azure Site Recovery fabric. @@ -592,7 +592,7 @@ public final class ReplicationFabricsCreateSamples { /** Samples for ReplicationFabrics Delete. */ public final class ReplicationFabricsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Delete.json */ /** * Sample code: Deletes the site. @@ -612,7 +612,7 @@ public final class ReplicationFabricsDeleteSamples { /** Samples for ReplicationFabrics Get. */ public final class ReplicationFabricsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Get.json */ /** * Sample code: Gets the details of an ASR fabric. @@ -634,7 +634,7 @@ public final class ReplicationFabricsGetSamples { /** Samples for ReplicationFabrics List. */ public final class ReplicationFabricsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_List.json */ /** * Sample code: Gets the list of ASR fabrics. @@ -654,7 +654,7 @@ public final class ReplicationFabricsListSamples { /** Samples for ReplicationFabrics MigrateToAad. */ public final class ReplicationFabricsMigrateToAadSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_MigrateToAad.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_MigrateToAad.json */ /** * Sample code: Migrates the site to AAD. @@ -676,7 +676,7 @@ public final class ReplicationFabricsMigrateToAadSamples { /** Samples for ReplicationFabrics Purge. */ public final class ReplicationFabricsPurgeSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Purge.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Purge.json */ /** * Sample code: Purges the site. @@ -700,7 +700,7 @@ import java.util.Arrays; /** Samples for ReplicationFabrics ReassociateGateway. */ public final class ReplicationFabricsReassociateGatewaySamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_ReassociateGateway.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_ReassociateGateway.json */ /** * Sample code: Perform failover of the process server. @@ -737,7 +737,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.RenewCertif /** Samples for ReplicationFabrics RenewCertificate. */ public final class ReplicationFabricsRenewCertificateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_RenewCertificate.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_RenewCertificate.json */ /** * Sample code: Renews certificate for the fabric. @@ -765,7 +765,7 @@ public final class ReplicationFabricsRenewCertificateSamples { /** Samples for ReplicationJobs Cancel. */ public final class ReplicationJobsCancelSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Cancel.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Cancel.json */ /** * Sample code: Cancels the specified job. @@ -790,7 +790,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobQueryPar /** Samples for ReplicationJobs Export. */ public final class ReplicationJobsExportSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Export.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Export.json */ /** * Sample code: Exports the details of the Azure Site Recovery jobs of the vault. @@ -820,7 +820,7 @@ public final class ReplicationJobsExportSamples { /** Samples for ReplicationJobs Get. */ public final class ReplicationJobsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Get.json */ /** * Sample code: Gets the job details. @@ -843,7 +843,7 @@ public final class ReplicationJobsGetSamples { /** Samples for ReplicationJobs List. */ public final class ReplicationJobsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_List.json */ /** * Sample code: Gets the list of jobs. @@ -863,7 +863,7 @@ public final class ReplicationJobsListSamples { /** Samples for ReplicationJobs Restart. */ public final class ReplicationJobsRestartSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Restart.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Restart.json */ /** * Sample code: Restarts the specified job. @@ -889,7 +889,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeJobPa /** Samples for ReplicationJobs Resume. */ public final class ReplicationJobsResumeSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Resume.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Resume.json */ /** * Sample code: Resumes the specified job. @@ -916,7 +916,7 @@ public final class ReplicationJobsResumeSamples { /** Samples for ReplicationLogicalNetworks Get. */ public final class ReplicationLogicalNetworksGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationLogicalNetworks_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationLogicalNetworks_Get.json */ /** * Sample code: Gets a logical network with specified server id and logical network name. @@ -943,7 +943,7 @@ public final class ReplicationLogicalNetworksGetSamples { /** Samples for ReplicationLogicalNetworks ListByReplicationFabrics. */ public final class ReplicationLogicalNetworksListByReplicationFabr { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationLogicalNetworks_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationLogicalNetworks_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of logical networks under a fabric. @@ -970,7 +970,7 @@ import java.util.Arrays; /** Samples for ReplicationMigrationItems Create. */ public final class ReplicationMigrationItemsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Create.json */ /** * Sample code: Enables migration. @@ -1020,7 +1020,7 @@ public final class ReplicationMigrationItemsCreateSamples { /** Samples for ReplicationMigrationItems Delete. */ public final class ReplicationMigrationItemsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Delete.json */ /** * Sample code: Delete the migration item. @@ -1049,7 +1049,7 @@ public final class ReplicationMigrationItemsDeleteSamples { /** Samples for ReplicationMigrationItems Get. */ public final class ReplicationMigrationItemsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Get.json */ /** * Sample code: Gets the details of a migration item. @@ -1077,7 +1077,7 @@ public final class ReplicationMigrationItemsGetSamples { /** Samples for ReplicationMigrationItems List. */ public final class ReplicationMigrationItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_List.json */ /** * Sample code: Gets the list of migration items in the vault. @@ -1099,7 +1099,7 @@ public final class ReplicationMigrationItemsListSamples { /** Samples for ReplicationMigrationItems ListByReplicationProtectionContainers. */ public final class ReplicationMigrationItemsListByReplicationProte { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_ListByReplicationProtectionContainers.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_ListByReplicationProtectionContainers.json */ /** * Sample code: Gets the list of migration items in the protection container. @@ -1133,7 +1133,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtMi /** Samples for ReplicationMigrationItems Migrate. */ public final class ReplicationMigrationItemsMigrateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Migrate.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Migrate.json */ /** * Sample code: Migrate item. @@ -1167,7 +1167,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.PauseReplic /** Samples for ReplicationMigrationItems PauseReplication. */ public final class ReplicationMigrationItemsPauseReplicationSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_PauseReplication.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_PauseReplication.json */ /** * Sample code: Pause replication. @@ -1201,7 +1201,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtRe /** Samples for ReplicationMigrationItems ResumeReplication. */ public final class ReplicationMigrationItemsResumeReplicationSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_ResumeReplication.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_ResumeReplication.json */ /** * Sample code: Resume replication. @@ -1238,7 +1238,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtRe /** Samples for ReplicationMigrationItems Resync. */ public final class ReplicationMigrationItemsResyncSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Resync.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Resync.json */ /** * Sample code: Resynchronizes replication. @@ -1274,7 +1274,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtTe /** Samples for ReplicationMigrationItems TestMigrate. */ public final class ReplicationMigrationItemsTestMigrateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_TestMigrate.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_TestMigrate.json */ /** * Sample code: Test migrate item. @@ -1314,7 +1314,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrate /** Samples for ReplicationMigrationItems TestMigrateCleanup. */ public final class ReplicationMigrationItemsTestMigrateCleanupSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_TestMigrateCleanup.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_TestMigrateCleanup.json */ /** * Sample code: Test migrate cleanup. @@ -1348,7 +1348,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtUp /** Samples for ReplicationMigrationItems Update. */ public final class ReplicationMigrationItemsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Update.json */ /** * Sample code: Updates migration item. @@ -1387,7 +1387,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmToAzureC /** Samples for ReplicationNetworkMappings Create. */ public final class ReplicationNetworkMappingsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Create.json */ /** * Sample code: Creates network mapping. @@ -1421,7 +1421,7 @@ public final class ReplicationNetworkMappingsCreateSamples { /** Samples for ReplicationNetworkMappings Delete. */ public final class ReplicationNetworkMappingsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Delete.json */ /** * Sample code: Delete network mapping. @@ -1449,7 +1449,7 @@ public final class ReplicationNetworkMappingsDeleteSamples { /** Samples for ReplicationNetworkMappings Get. */ public final class ReplicationNetworkMappingsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Get.json */ /** * Sample code: Gets network mapping by name. @@ -1477,7 +1477,7 @@ public final class ReplicationNetworkMappingsGetSamples { /** Samples for ReplicationNetworkMappings List. */ public final class ReplicationNetworkMappingsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_List.json */ /** * Sample code: Gets all the network mappings under a vault. @@ -1499,7 +1499,7 @@ public final class ReplicationNetworkMappingsListSamples { /** Samples for ReplicationNetworkMappings ListByReplicationNetworks. */ public final class ReplicationNetworkMappingsListByReplicationNetw { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_ListByReplicationNetworks.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_ListByReplicationNetworks.json */ /** * Sample code: Gets all the network mappings under a network. @@ -1530,7 +1530,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmToAzureU /** Samples for ReplicationNetworkMappings Update. */ public final class ReplicationNetworkMappingsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Update.json */ /** * Sample code: Updates network mapping. @@ -1569,7 +1569,7 @@ public final class ReplicationNetworkMappingsUpdateSamples { /** Samples for ReplicationNetworks Get. */ public final class ReplicationNetworksGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_Get.json */ /** * Sample code: Gets a network with specified server id and network name. @@ -1596,7 +1596,7 @@ public final class ReplicationNetworksGetSamples { /** Samples for ReplicationNetworks List. */ public final class ReplicationNetworksListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_List.json */ /** * Sample code: Gets the list of networks. View-only API. @@ -1616,7 +1616,7 @@ public final class ReplicationNetworksListSamples { /** Samples for ReplicationNetworks ListByReplicationFabrics. */ public final class ReplicationNetworksListByReplicationFabricsSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of networks under a fabric. @@ -1645,7 +1645,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVRepli /** Samples for ReplicationPolicies Create. */ public final class ReplicationPoliciesCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Create.json */ /** * Sample code: Creates the policy. @@ -1671,7 +1671,7 @@ public final class ReplicationPoliciesCreateSamples { /** Samples for ReplicationPolicies Delete. */ public final class ReplicationPoliciesDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Delete.json */ /** * Sample code: Delete the policy. @@ -1693,7 +1693,7 @@ public final class ReplicationPoliciesDeleteSamples { /** Samples for ReplicationPolicies Get. */ public final class ReplicationPoliciesGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Get.json */ /** * Sample code: Gets the requested policy. @@ -1715,7 +1715,7 @@ public final class ReplicationPoliciesGetSamples { /** Samples for ReplicationPolicies List. */ public final class ReplicationPoliciesListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_List.json */ /** * Sample code: Gets the list of replication policies. @@ -1739,7 +1739,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdatePolic /** Samples for ReplicationPolicies Update. */ public final class ReplicationPoliciesUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Update.json */ /** * Sample code: Updates the policy. @@ -1768,7 +1768,7 @@ public final class ReplicationPoliciesUpdateSamples { /** Samples for ReplicationProtectableItems Get. */ public final class ReplicationProtectableItemsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectableItems_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectableItems_Get.json */ /** * Sample code: Gets the details of a protectable item. @@ -1796,7 +1796,7 @@ public final class ReplicationProtectableItemsGetSamples { /** Samples for ReplicationProtectableItems ListByReplicationProtectionContainers. */ public final class ReplicationProtectableItemsListByReplicationPro { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectableItems_ListByReplicationProtectionContainers.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectableItems_ListByReplicationProtectionContainers.json */ /** * Sample code: Gets the list of protectable items. @@ -1832,7 +1832,7 @@ import java.util.Arrays; /** Samples for ReplicationProtectedItems AddDisks. */ public final class ReplicationProtectedItemsAddDisksSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_AddDisks.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_AddDisks.json */ /** * Sample code: Add disk(s) for protection. @@ -1879,7 +1879,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVRepli /** Samples for ReplicationProtectedItems ApplyRecoveryPoint. */ public final class ReplicationProtectedItemsApplyRecoveryPointSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ApplyRecoveryPoint.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_ApplyRecoveryPoint.json */ /** * Sample code: Change or apply recovery point. @@ -1916,7 +1916,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVRepli /** Samples for ReplicationProtectedItems Create. */ public final class ReplicationProtectedItemsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Create.json */ /** * Sample code: Enables protection. @@ -1952,7 +1952,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.DisableProt /** Samples for ReplicationProtectedItems Delete. */ public final class ReplicationProtectedItemsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Delete.json */ /** * Sample code: Disables protection. @@ -1984,7 +1984,7 @@ public final class ReplicationProtectedItemsDeleteSamples { /** Samples for ReplicationProtectedItems FailoverCancel. */ public final class ReplicationProtectedItemsFailoverCancelSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_FailoverCancel.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_FailoverCancel.json */ /** * Sample code: Execute cancel failover. @@ -2012,7 +2012,7 @@ public final class ReplicationProtectedItemsFailoverCancelSamples { /** Samples for ReplicationProtectedItems FailoverCommit. */ public final class ReplicationProtectedItemsFailoverCommitSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_FailoverCommit.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_FailoverCommit.json */ /** * Sample code: Execute commit failover. @@ -2040,7 +2040,7 @@ public final class ReplicationProtectedItemsFailoverCommitSamples { /** Samples for ReplicationProtectedItems Get. */ public final class ReplicationProtectedItemsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Get.json */ /** * Sample code: Gets the details of a Replication protected item. @@ -2068,7 +2068,7 @@ public final class ReplicationProtectedItemsGetSamples { /** Samples for ReplicationProtectedItems List. */ public final class ReplicationProtectedItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_List.json */ /** * Sample code: Gets the list of replication protected items. @@ -2090,7 +2090,7 @@ public final class ReplicationProtectedItemsListSamples { /** Samples for ReplicationProtectedItems ListByReplicationProtectionContainers. */ public final class ReplicationProtectedItemsListByReplicationProte { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ListByReplicationProtectionContainers.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_ListByReplicationProtectionContainers.json */ /** * Sample code: Gets the list of Replication protected items. @@ -2121,7 +2121,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.PlannedFail /** Samples for ReplicationProtectedItems PlannedFailover. */ public final class ReplicationProtectedItemsPlannedFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_PlannedFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_PlannedFailover.json */ /** * Sample code: Execute planned failover. @@ -2154,7 +2154,7 @@ public final class ReplicationProtectedItemsPlannedFailoverSamples { /** Samples for ReplicationProtectedItems Purge. */ public final class ReplicationProtectedItemsPurgeSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Purge.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Purge.json */ /** * Sample code: Purges protection. @@ -2187,7 +2187,7 @@ import java.util.Arrays; /** Samples for ReplicationProtectedItems RemoveDisks. */ public final class ReplicationProtectedItemsRemoveDisksSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_RemoveDisks.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_RemoveDisks.json */ /** * Sample code: Removes disk(s). @@ -2222,7 +2222,7 @@ public final class ReplicationProtectedItemsRemoveDisksSamples { /** Samples for ReplicationProtectedItems RepairReplication. */ public final class ReplicationProtectedItemsRepairReplicationSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_RepairReplication.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_RepairReplication.json */ /** * Sample code: Resynchronize or repair replication. @@ -2254,7 +2254,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReverseRepl /** Samples for ReplicationProtectedItems Reprotect. */ public final class ReplicationProtectedItemsReprotectSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Reprotect.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Reprotect.json */ /** * Sample code: Execute Reverse Replication\Reprotect. @@ -2292,7 +2292,7 @@ import java.util.Arrays; /** Samples for ReplicationProtectedItems ResolveHealthErrors. */ public final class ReplicationProtectedItemsResolveHealthErrorsSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ResolveHealthErrors.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_ResolveHealthErrors.json */ /** * Sample code: Resolve health errors. @@ -2328,7 +2328,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProvi /** Samples for ReplicationProtectedItems SwitchProvider. */ public final class ReplicationProtectedItemsSwitchProviderSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_SwitchProvider.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_SwitchProvider.json */ /** * Sample code: Execute switch provider. @@ -2371,7 +2371,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailove /** Samples for ReplicationProtectedItems TestFailover. */ public final class ReplicationProtectedItemsTestFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_TestFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_TestFailover.json */ /** * Sample code: Execute test failover. @@ -2410,7 +2410,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailove /** Samples for ReplicationProtectedItems TestFailoverCleanup. */ public final class ReplicationProtectedItemsTestFailoverCleanupSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_TestFailoverCleanup.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_TestFailoverCleanup.json */ /** * Sample code: Execute test failover cleanup. @@ -2444,7 +2444,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.UnplannedFa /** Samples for ReplicationProtectedItems UnplannedFailover. */ public final class ReplicationProtectedItemsUnplannedFailoverSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UnplannedFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_UnplannedFailover.json */ /** * Sample code: Execute unplanned failover. @@ -2486,7 +2486,7 @@ import java.util.Arrays; /** Samples for ReplicationProtectedItems Update. */ public final class ReplicationProtectedItemsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Update.json */ /** * Sample code: Updates the replication protected Item settings. @@ -2546,7 +2546,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateAppli /** Samples for ReplicationProtectedItems UpdateAppliance. */ public final class ReplicationProtectedItemsUpdateApplianceSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UpdateAppliance.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_UpdateAppliance.json */ /** * Sample code: Updates appliance for replication protected Item. @@ -2583,7 +2583,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMobil /** Samples for ReplicationProtectedItems UpdateMobilityService. */ public final class ReplicationProtectedItemsUpdateMobilityServiceS { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UpdateMobilityService.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_UpdateMobilityService.json */ /** * Sample code: Update the mobility service on a protected item. @@ -2616,7 +2616,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.Replication /** Samples for ReplicationProtectionContainerMappings Create. */ public final class ReplicationProtectionContainerMappingsCreateSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Create.json */ /** * Sample code: Create protection container mapping. @@ -2651,7 +2651,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.Replication /** Samples for ReplicationProtectionContainerMappings Delete. */ public final class ReplicationProtectionContainerMappingsDeleteSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Delete.json */ /** * Sample code: Remove protection container mapping. @@ -2683,7 +2683,7 @@ public final class ReplicationProtectionContainerMappingsDeleteSam { /** Samples for ReplicationProtectionContainerMappings Get. */ public final class ReplicationProtectionContainerMappingsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Get.json */ /** * Sample code: Gets a protection container mapping. @@ -2711,7 +2711,7 @@ public final class ReplicationProtectionContainerMappingsGetSamples { /** Samples for ReplicationProtectionContainerMappings List. */ public final class ReplicationProtectionContainerMappingsListSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_List.json */ /** * Sample code: Gets the list of all protection container mappings in a vault. @@ -2733,7 +2733,7 @@ public final class ReplicationProtectionContainerMappingsListSampl { /** Samples for ReplicationProtectionContainerMappings ListByReplicationProtectionContainers. */ public final class ReplicationProtectionContainerMappingsListByRep { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json */ /** * Sample code: Gets the list of protection container mappings for a protection container. @@ -2760,7 +2760,7 @@ public final class ReplicationProtectionContainerMappingsListByRep { /** Samples for ReplicationProtectionContainerMappings Purge. */ public final class ReplicationProtectionContainerMappingsPurgeSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Purge.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Purge.json */ /** * Sample code: Purge protection container mapping. @@ -2793,7 +2793,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateProte /** Samples for ReplicationProtectionContainerMappings Update. */ public final class ReplicationProtectionContainerMappingsUpdateSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Update.json */ /** * Sample code: Update protection container mapping. @@ -2837,7 +2837,7 @@ import java.util.Arrays; /** Samples for ReplicationProtectionContainers Create. */ public final class ReplicationProtectionContainersCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Create.json */ /** * Sample code: Create a protection container. @@ -2864,7 +2864,7 @@ public final class ReplicationProtectionContainersCreateSamples { /** Samples for ReplicationProtectionContainers Delete. */ public final class ReplicationProtectionContainersDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Delete.json */ /** * Sample code: Removes a protection container. @@ -2894,7 +2894,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiscoverPro /** Samples for ReplicationProtectionContainers DiscoverProtectableItem. */ public final class ReplicationProtectionContainersDiscoverProtecta { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_DiscoverProtectableItem.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_DiscoverProtectableItem.json */ /** * Sample code: Adds a protectable item to the replication protection container. @@ -2927,7 +2927,7 @@ public final class ReplicationProtectionContainersDiscoverProtecta { /** Samples for ReplicationProtectionContainers Get. */ public final class ReplicationProtectionContainersGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Get.json */ /** * Sample code: Gets the protection container details. @@ -2954,7 +2954,7 @@ public final class ReplicationProtectionContainersGetSamples { /** Samples for ReplicationProtectionContainers List. */ public final class ReplicationProtectionContainersListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_List.json */ /** * Sample code: Gets the list of all protection containers in a vault. @@ -2974,7 +2974,7 @@ public final class ReplicationProtectionContainersListSamples { /** Samples for ReplicationProtectionContainers ListByReplicationFabrics. */ public final class ReplicationProtectionContainersListByReplicatio { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of protection container for a fabric. @@ -3000,7 +3000,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProte /** Samples for ReplicationProtectionContainers SwitchProtection. */ public final class ReplicationProtectionContainersSwitchProtection { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_SwitchProtection.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_SwitchProtection.json */ /** * Sample code: Switches protection from one container to another or one replication provider to another. @@ -3019,6 +3019,7 @@ public final class ReplicationProtectionContainersSwitchProtection { new SwitchProtectionInput() .withProperties( new SwitchProtectionInputProperties() + .withReplicationProtectedItemName("a2aSwapOsVm") .withProviderSpecificDetails(new A2ASwitchProtectionInput())), com.azure.core.util.Context.NONE); } @@ -3035,7 +3036,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProte /** Samples for ReplicationProtectionIntents Create. */ public final class ReplicationProtectionIntentsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_Create.json */ /** * Sample code: Create protection intent Resource. @@ -3071,7 +3072,7 @@ public final class ReplicationProtectionIntentsCreateSamples { /** Samples for ReplicationProtectionIntents Get. */ public final class ReplicationProtectionIntentsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_Get.json */ /** * Sample code: Gets the details of a Replication protection intent item. @@ -3093,7 +3094,7 @@ public final class ReplicationProtectionIntentsGetSamples { /** Samples for ReplicationProtectionIntents List. */ public final class ReplicationProtectionIntentsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_List.json */ /** * Sample code: Gets the list of replication protection intent objects. @@ -3122,7 +3123,7 @@ import java.util.Arrays; /** Samples for ReplicationRecoveryPlans Create. */ public final class ReplicationRecoveryPlansCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Create.json */ /** * Sample code: Creates a recovery plan with the given details. @@ -3166,7 +3167,7 @@ public final class ReplicationRecoveryPlansCreateSamples { /** Samples for ReplicationRecoveryPlans Delete. */ public final class ReplicationRecoveryPlansDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Delete.json */ /** * Sample code: Deletes the specified recovery plan. @@ -3188,7 +3189,7 @@ public final class ReplicationRecoveryPlansDeleteSamples { /** Samples for ReplicationRecoveryPlans FailoverCancel. */ public final class ReplicationRecoveryPlansFailoverCancelSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_FailoverCancel.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_FailoverCancel.json */ /** * Sample code: Execute cancel failover of the recovery plan. @@ -3210,7 +3211,7 @@ public final class ReplicationRecoveryPlansFailoverCancelSamples { /** Samples for ReplicationRecoveryPlans FailoverCommit. */ public final class ReplicationRecoveryPlansFailoverCommitSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_FailoverCommit.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_FailoverCommit.json */ /** * Sample code: Execute commit failover of the recovery plan. @@ -3232,7 +3233,7 @@ public final class ReplicationRecoveryPlansFailoverCommitSamples { /** Samples for ReplicationRecoveryPlans Get. */ public final class ReplicationRecoveryPlansGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Get.json */ /** * Sample code: Gets the requested recovery plan. @@ -3254,7 +3255,7 @@ public final class ReplicationRecoveryPlansGetSamples { /** Samples for ReplicationRecoveryPlans List. */ public final class ReplicationRecoveryPlansListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_List.json */ /** * Sample code: Gets the list of recovery plans. @@ -3280,7 +3281,7 @@ import java.util.Arrays; /** Samples for ReplicationRecoveryPlans PlannedFailover. */ public final class ReplicationRecoveryPlansPlannedFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_PlannedFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_PlannedFailover.json */ /** * Sample code: Execute planned failover of the recovery plan. @@ -3312,7 +3313,7 @@ public final class ReplicationRecoveryPlansPlannedFailoverSamples { /** Samples for ReplicationRecoveryPlans Reprotect. */ public final class ReplicationRecoveryPlansReprotectSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Reprotect.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Reprotect.json */ /** * Sample code: Execute reprotect of the recovery plan. @@ -3340,7 +3341,7 @@ import java.util.Arrays; /** Samples for ReplicationRecoveryPlans TestFailover. */ public final class ReplicationRecoveryPlansTestFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_TestFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_TestFailover.json */ /** * Sample code: Execute test failover of the recovery plan. @@ -3378,7 +3379,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPla /** Samples for ReplicationRecoveryPlans TestFailoverCleanup. */ public final class ReplicationRecoveryPlansTestFailoverCleanupSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_TestFailoverCleanup.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_TestFailoverCleanup.json */ /** * Sample code: Execute test failover cleanup of the recovery plan. @@ -3414,7 +3415,7 @@ import java.util.Arrays; /** Samples for ReplicationRecoveryPlans UnplannedFailover. */ public final class ReplicationRecoveryPlansUnplannedFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_UnplannedFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_UnplannedFailover.json */ /** * Sample code: Execute unplanned failover of the recovery plan. @@ -3454,7 +3455,7 @@ import java.util.Arrays; /** Samples for ReplicationRecoveryPlans Update. */ public final class ReplicationRecoveryPlansUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Update.json */ /** * Sample code: Updates the given recovery plan. @@ -3521,7 +3522,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.IdentityPro /** Samples for ReplicationRecoveryServicesProviders Create. */ public final class ReplicationRecoveryServicesProvidersCreateSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Create.json */ /** * Sample code: Adds a recovery services provider. @@ -3562,7 +3563,7 @@ public final class ReplicationRecoveryServicesProvidersCreateSampl { /** Samples for ReplicationRecoveryServicesProviders Delete. */ public final class ReplicationRecoveryServicesProvidersDeleteSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Delete.json */ /** * Sample code: Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is @@ -3592,7 +3593,7 @@ public final class ReplicationRecoveryServicesProvidersDeleteSampl { /** Samples for ReplicationRecoveryServicesProviders Get. */ public final class ReplicationRecoveryServicesProvidersGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Get.json */ /** * Sample code: Gets the details of a recovery services provider. @@ -3619,7 +3620,7 @@ public final class ReplicationRecoveryServicesProvidersGetSamples { /** Samples for ReplicationRecoveryServicesProviders List. */ public final class ReplicationRecoveryServicesProvidersListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_List.json */ /** * Sample code: Gets the list of registered recovery services providers in the vault. This is a view only api. @@ -3641,7 +3642,7 @@ public final class ReplicationRecoveryServicesProvidersListSamples { /** Samples for ReplicationRecoveryServicesProviders ListByReplicationFabrics. */ public final class ReplicationRecoveryServicesProvidersListByRepli { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of registered recovery services providers for the fabric. @@ -3663,7 +3664,7 @@ public final class ReplicationRecoveryServicesProvidersListByRepli { /** Samples for ReplicationRecoveryServicesProviders Purge. */ public final class ReplicationRecoveryServicesProvidersPurgeSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Purge.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Purge.json */ /** * Sample code: Purges recovery service provider from fabric. @@ -3690,7 +3691,7 @@ public final class ReplicationRecoveryServicesProvidersPurgeSamples { /** Samples for ReplicationRecoveryServicesProviders RefreshProvider. */ public final class ReplicationRecoveryServicesProvidersRefreshProv { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_RefreshProvider.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_RefreshProvider.json */ /** * Sample code: Refresh details from the recovery services provider. @@ -3717,7 +3718,7 @@ public final class ReplicationRecoveryServicesProvidersRefreshProv { /** Samples for ReplicationVaultHealth Get. */ public final class ReplicationVaultHealthGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultHealth_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultHealth_Get.json */ /** * Sample code: Gets the health summary for the vault. @@ -3739,7 +3740,7 @@ public final class ReplicationVaultHealthGetSamples { /** Samples for ReplicationVaultHealth Refresh. */ public final class ReplicationVaultHealthRefreshSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultHealth_Refresh.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultHealth_Refresh.json */ /** * Sample code: Refreshes health summary of the vault. @@ -3761,7 +3762,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSettin /** Samples for ReplicationVaultSetting Create. */ public final class ReplicationVaultSettingCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_Create.json */ /** * Sample code: Updates vault setting. A vault setting object is a singleton per vault and it is always present by @@ -3790,7 +3791,7 @@ public final class ReplicationVaultSettingCreateSamples { /** Samples for ReplicationVaultSetting Get. */ public final class ReplicationVaultSettingGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_Get.json */ /** * Sample code: Gets the vault setting. @@ -3812,7 +3813,7 @@ public final class ReplicationVaultSettingGetSamples { /** Samples for ReplicationVaultSetting List. */ public final class ReplicationVaultSettingListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_List.json */ /** * Sample code: Gets the list of vault setting. @@ -3834,7 +3835,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddVCenterR /** Samples for ReplicationvCenters Create. */ public final class ReplicationvCentersCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Create.json */ /** * Sample code: Add vCenter. @@ -3864,7 +3865,7 @@ public final class ReplicationvCentersCreateSamples { /** Samples for ReplicationvCenters Delete. */ public final class ReplicationvCentersDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Delete.json */ /** * Sample code: Remove vCenter operation. @@ -3886,7 +3887,7 @@ public final class ReplicationvCentersDeleteSamples { /** Samples for ReplicationvCenters Get. */ public final class ReplicationvCentersGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Get.json */ /** * Sample code: Gets the details of a vCenter. @@ -3908,7 +3909,7 @@ public final class ReplicationvCentersGetSamples { /** Samples for ReplicationvCenters List. */ public final class ReplicationvCentersListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_List.json */ /** * Sample code: Gets the list of vCenter registered under the vault. @@ -3928,7 +3929,7 @@ public final class ReplicationvCentersListSamples { /** Samples for ReplicationvCenters ListByReplicationFabrics. */ public final class ReplicationvCentersListByReplicationFabricsSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of vCenter registered under a fabric. @@ -3953,7 +3954,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.VCenter; /** Samples for ReplicationvCenters Update. */ public final class ReplicationvCentersUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Update.json */ /** * Sample code: Update vCenter operation. @@ -3981,7 +3982,7 @@ import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageMapp /** Samples for StorageClassificationMappings Create. */ public final class StorageClassificationMappingsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Create.json */ /** * Sample code: Create storage classification mapping. @@ -4013,7 +4014,7 @@ public final class StorageClassificationMappingsCreateSamples { /** Samples for StorageClassificationMappings Delete. */ public final class StorageClassificationMappingsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Delete.json */ /** * Sample code: Delete a storage classification mapping. @@ -4041,7 +4042,7 @@ public final class StorageClassificationMappingsDeleteSamples { /** Samples for StorageClassificationMappings Get. */ public final class StorageClassificationMappingsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Get.json */ /** * Sample code: Gets the details of a storage classification mapping. @@ -4069,7 +4070,7 @@ public final class StorageClassificationMappingsGetSamples { /** Samples for StorageClassificationMappings List. */ public final class StorageClassificationMappingsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_List.json */ /** * Sample code: Gets the list of storage classification mappings objects under a vault. @@ -4089,7 +4090,7 @@ public final class StorageClassificationMappingsListSamples { /** Samples for StorageClassificationMappings ListByReplicationStorageClassifications. */ public final class StorageClassificationMappingsListByReplicationS { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json */ /** * Sample code: Gets the list of storage classification mappings objects under a storage. @@ -4116,7 +4117,7 @@ public final class StorageClassificationMappingsListByReplicationS { /** Samples for StorageClassifications Get. */ public final class StorageClassificationsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_Get.json */ /** * Sample code: Gets the details of a storage classification. @@ -4143,7 +4144,7 @@ public final class StorageClassificationsGetSamples { /** Samples for StorageClassifications List. */ public final class StorageClassificationsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_List.json */ /** * Sample code: Gets the list of storage classification objects under a vault. @@ -4163,7 +4164,7 @@ public final class StorageClassificationsListSamples { /** Samples for StorageClassifications ListByReplicationFabrics. */ public final class StorageClassificationsListByReplicationFabricsS { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of storage classification objects under a fabric. @@ -4189,7 +4190,7 @@ public final class StorageClassificationsListByReplicationFabricsS { /** Samples for SupportedOperatingSystemsOperation Get. */ public final class SupportedOperatingSystemsOperationGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/SupportedOperatingSystems_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/SupportedOperatingSystems_Get.json */ /** * Sample code: Gets the data of supported operating systems by SRS. @@ -4211,7 +4212,7 @@ public final class SupportedOperatingSystemsOperationGetSamples { /** Samples for TargetComputeSizes ListByReplicationProtectedItems. */ public final class TargetComputeSizesListByReplicationProtectedIte { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/TargetComputeSizes_ListByReplicationProtectedItems.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/TargetComputeSizes_ListByReplicationProtectedItems.json */ /** * Sample code: Gets the list of target compute sizes for the replication protected item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/pom.xml b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/pom.xml index 9e8e0d56bb07..9067134504c2 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/pom.xml +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/pom.xml @@ -1,3 +1,8 @@ + 4.0.0 @@ -9,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-recoveryservicessiterecovery - 1.0.0-beta.2 + 1.1.0-beta.1 jar Microsoft Azure SDK for SiteRecovery Management - This package contains Microsoft Azure SDK for SiteRecovery Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2022-10. + This package contains Microsoft Azure SDK for SiteRecovery Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2023-06. https://github.com/Azure/azure-sdk-for-java @@ -38,7 +43,8 @@ UTF-8 - true + 0 + 0 @@ -51,5 +57,41 @@ azure-core-management 1.11.5 + + com.azure + azure-core-test + 1.20.0 + test + + + com.azure + azure-identity + 1.10.1 + test + + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + org.mockito + mockito-core + 4.11.0 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/SiteRecoveryManager.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/SiteRecoveryManager.java index a51d74a42d6a..f7b088f95703 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/SiteRecoveryManager.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/SiteRecoveryManager.java @@ -311,7 +311,7 @@ public SiteRecoveryManager authenticate(TokenCredential credential, AzureProfile .append("-") .append("com.azure.resourcemanager.recoveryservicessiterecovery") .append("/") - .append("1.0.0-beta.1"); + .append("1.0.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -728,8 +728,10 @@ public ReplicationVaultSettings replicationVaultSettings() { } /** - * @return Wrapped service client SiteRecoveryManagementClient providing direct access to the underlying - * auto-generated API implementation, based on Azure REST API. + * Gets wrapped service client SiteRecoveryManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client SiteRecoveryManagementClient. */ public SiteRecoveryManagementClient serviceClient() { return this.clientObject; diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/MigrationRecoveryPointsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/MigrationRecoveryPointsClientImpl.java index 8245f9931caf..8ff804f7af5a 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/MigrationRecoveryPointsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/MigrationRecoveryPointsClientImpl.java @@ -59,9 +59,7 @@ public final class MigrationRecoveryPointsClientImpl implements MigrationRecover public interface MigrationRecoveryPointsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationMigrationItems( @@ -78,10 +76,7 @@ Mono> listByReplicationMigrationItems @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints" - + "/{migrationRecoveryPointName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrationRecoveryPoints/{migrationRecoveryPointName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/OperationsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/OperationsClientImpl.java index b733f95bc11e..8c1c0a449816 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/OperationsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/OperationsClientImpl.java @@ -58,8 +58,7 @@ public final class OperationsClientImpl implements OperationsClient { public interface OperationsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/operations") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/operations") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/RecoveryPointsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/RecoveryPointsClientImpl.java index 4126e89b8e3d..9ac13f9f75d8 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/RecoveryPointsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/RecoveryPointsClientImpl.java @@ -58,9 +58,7 @@ public final class RecoveryPointsClientImpl implements RecoveryPointsClient { public interface RecoveryPointsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationProtectedItems( @@ -77,10 +75,7 @@ Mono> listByReplicationProtectedItems( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints" - + "/{recoveryPointName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/recoveryPoints/{recoveryPointName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationAlertSettingsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationAlertSettingsClientImpl.java index 06b233307eb1..319c813b6e06 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationAlertSettingsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationAlertSettingsClientImpl.java @@ -62,8 +62,7 @@ public final class ReplicationAlertSettingsClientImpl implements ReplicationAler public interface ReplicationAlertSettingsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationAlertSettings") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -77,8 +76,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -93,8 +91,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAlertSettings/{alertSettingName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> create( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationAppliancesClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationAppliancesClientImpl.java index 0f5b5529dbb8..0ee0fa5d1788 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationAppliancesClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationAppliancesClientImpl.java @@ -59,8 +59,7 @@ public final class ReplicationAppliancesClientImpl implements ReplicationApplian public interface ReplicationAppliancesService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationAppliances") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationAppliances") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationEligibilityResultsOperationsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationEligibilityResultsOperationsClientImpl.java index cd0359964d0d..180925e7b97d 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationEligibilityResultsOperationsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationEligibilityResultsOperationsClientImpl.java @@ -62,9 +62,7 @@ public final class ReplicationEligibilityResultsOperationsClientImpl public interface ReplicationEligibilityResultsOperationsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" - + "/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices" - + "/replicationEligibilityResults") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -78,9 +76,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute" - + "/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices" - + "/replicationEligibilityResults/default") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{virtualMachineName}/providers/Microsoft.RecoveryServices/replicationEligibilityResults/default") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationEventsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationEventsClientImpl.java index ae6f6ec9260e..5986bbb89321 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationEventsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationEventsClientImpl.java @@ -58,8 +58,7 @@ public final class ReplicationEventsClientImpl implements ReplicationEventsClien public interface ReplicationEventsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationEvents") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -74,8 +73,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationEvents/{eventName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationEvents/{eventName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationFabricsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationFabricsClientImpl.java index 1135870f731e..35a5eea60c06 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationFabricsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationFabricsClientImpl.java @@ -70,8 +70,7 @@ public final class ReplicationFabricsClientImpl implements ReplicationFabricsCli public interface ReplicationFabricsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -85,8 +84,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -102,8 +100,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -119,8 +116,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> purge( @@ -134,8 +130,7 @@ Mono>> purge( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/checkConsistency") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> checkConsistency( @@ -150,8 +145,7 @@ Mono>> checkConsistency( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/migratetoaad") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> migrateToAad( @@ -165,8 +159,7 @@ Mono>> migrateToAad( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/reassociateGateway") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> reassociateGateway( @@ -182,8 +175,7 @@ Mono>> reassociateGateway( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/remove") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/remove") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -197,8 +189,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/renewCertificate") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> renewCertificate( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationJobsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationJobsClientImpl.java index 84a638a146b1..75db52c09416 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationJobsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationJobsClientImpl.java @@ -67,8 +67,7 @@ public final class ReplicationJobsClientImpl implements ReplicationJobsClient { public interface ReplicationJobsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationJobs") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -83,8 +82,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationJobs/{jobName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -99,8 +97,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationJobs/{jobName}/cancel") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/cancel") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> cancel( @@ -115,8 +112,7 @@ Mono>> cancel( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationJobs/{jobName}/restart") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/restart") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> restart( @@ -131,8 +127,7 @@ Mono>> restart( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationJobs/{jobName}/resume") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/{jobName}/resume") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> resume( @@ -148,8 +143,7 @@ Mono>> resume( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationJobs/export") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationJobs/export") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> export( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationLogicalNetworksClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationLogicalNetworksClientImpl.java index 94bfb4d69a8f..3961aa5ffafa 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationLogicalNetworksClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationLogicalNetworksClientImpl.java @@ -60,8 +60,7 @@ public final class ReplicationLogicalNetworksClientImpl implements ReplicationLo public interface ReplicationLogicalNetworksService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationFabrics( @@ -76,9 +75,7 @@ Mono> listByReplicationFabrics( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks" - + "/{logicalNetworkName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationLogicalNetworks/{logicalNetworkName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationMigrationItemsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationMigrationItemsClientImpl.java index c1a823c6503f..a293b8b980cb 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationMigrationItemsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationMigrationItemsClientImpl.java @@ -78,9 +78,7 @@ public final class ReplicationMigrationItemsClientImpl implements ReplicationMig public interface ReplicationMigrationItemsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationProtectionContainers( @@ -99,9 +97,7 @@ Mono> listByReplicationProtectionContainers( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -118,9 +114,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -138,9 +132,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -157,9 +149,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @@ -177,9 +167,7 @@ Mono>> update( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/migrate") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> migrate( @@ -197,9 +185,7 @@ Mono>> migrate( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/pauseReplication") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> pauseReplication( @@ -217,9 +203,7 @@ Mono>> pauseReplication( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resumeReplication") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> resumeReplication( @@ -237,9 +221,7 @@ Mono>> resumeReplication( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/resync") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> resync( @@ -257,9 +239,7 @@ Mono>> resync( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrate") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> testMigrate( @@ -277,9 +257,7 @@ Mono>> testMigrate( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationMigrationItems/{migrationItemName}/testMigrateCleanup") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> testMigrateCleanup( @@ -297,8 +275,7 @@ Mono>> testMigrateCleanup( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationMigrationItems") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationMigrationItems") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationNetworkMappingsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationNetworkMappingsClientImpl.java index 064062b10a71..359f524c2194 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationNetworkMappingsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationNetworkMappingsClientImpl.java @@ -71,9 +71,7 @@ public final class ReplicationNetworkMappingsClientImpl implements ReplicationNe public interface ReplicationNetworkMappingsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}" - + "/replicationNetworkMappings") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationNetworks( @@ -89,9 +87,7 @@ Mono> listByReplicationNetworks( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}" - + "/replicationNetworkMappings/{networkMappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -108,9 +104,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}" - + "/replicationNetworkMappings/{networkMappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -128,9 +122,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}" - + "/replicationNetworkMappings/{networkMappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -146,9 +138,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}" - + "/replicationNetworkMappings/{networkMappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}/replicationNetworkMappings/{networkMappingName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @@ -166,8 +156,7 @@ Mono>> update( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationNetworkMappings") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworkMappings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationNetworksClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationNetworksClientImpl.java index 5e693d7480a1..88f35dbede7a 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationNetworksClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationNetworksClientImpl.java @@ -58,8 +58,7 @@ public final class ReplicationNetworksClientImpl implements ReplicationNetworksC public interface ReplicationNetworksService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationFabrics( @@ -74,8 +73,7 @@ Mono> listByReplicationFabrics( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationNetworks/{networkName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -91,8 +89,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationNetworks") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationNetworks") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationPoliciesClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationPoliciesClientImpl.java index 82c4aaa5e0a9..fdf4f180f292 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationPoliciesClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationPoliciesClientImpl.java @@ -69,8 +69,7 @@ public final class ReplicationPoliciesClientImpl implements ReplicationPoliciesC public interface ReplicationPoliciesService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationPolicies") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -84,8 +83,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationPolicies/{policyName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -100,8 +98,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationPolicies/{policyName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -117,8 +114,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationPolicies/{policyName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -132,8 +128,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationPolicies/{policyName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationPolicies/{policyName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectableItemsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectableItemsClientImpl.java index 5cd8179a1de0..a6b79c6a474c 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectableItemsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectableItemsClientImpl.java @@ -60,9 +60,7 @@ public final class ReplicationProtectableItemsClientImpl implements ReplicationP public interface ReplicationProtectableItemsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectableItems") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationProtectionContainers( @@ -81,9 +79,7 @@ Mono> listByReplicationProtectionContainers( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectableItems/{protectableItemName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectableItems/{protectableItemName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectedItemsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectedItemsClientImpl.java index cff0c557513e..15f13ae8d1ba 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectedItemsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectedItemsClientImpl.java @@ -85,9 +85,7 @@ public final class ReplicationProtectedItemsClientImpl implements ReplicationPro public interface ReplicationProtectedItemsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationProtectionContainers( @@ -103,9 +101,7 @@ Mono> listByReplicationProtectionCo @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -122,9 +118,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -142,9 +136,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> purge( @@ -160,9 +152,7 @@ Mono>> purge( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @@ -180,9 +170,7 @@ Mono>> update( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/addDisks") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> addDisks( @@ -200,10 +188,7 @@ Mono>> addDisks( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - + "/applyRecoveryPoint") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/applyRecoveryPoint") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> applyRecoveryPoint( @@ -221,9 +206,7 @@ Mono>> applyRecoveryPoint( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCancel") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> failoverCancel( @@ -240,9 +223,7 @@ Mono>> failoverCancel( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/failoverCommit") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> failoverCommit( @@ -259,9 +240,7 @@ Mono>> failoverCommit( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/plannedFailover") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> plannedFailover( @@ -279,9 +258,7 @@ Mono>> plannedFailover( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/remove") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -298,9 +275,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/removeDisks") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> removeDisks( @@ -318,10 +293,7 @@ Mono>> removeDisks( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - + "/repairReplication") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/repairReplication") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> repairReplication( @@ -338,9 +310,7 @@ Mono>> repairReplication( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/reProtect") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> reprotect( @@ -358,10 +328,7 @@ Mono>> reprotect( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - + "/resolveHealthErrors") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/resolveHealthErrors") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> resolveHealthErrors( @@ -379,9 +346,7 @@ Mono>> resolveHealthErrors( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/switchProvider") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> switchProvider( @@ -399,9 +364,7 @@ Mono>> switchProvider( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailover") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> testFailover( @@ -419,10 +382,7 @@ Mono>> testFailover( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - + "/testFailoverCleanup") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/testFailoverCleanup") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> testFailoverCleanup( @@ -440,10 +400,7 @@ Mono>> testFailoverCleanup( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - + "/unplannedFailover") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/unplannedFailover") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> unplannedFailover( @@ -461,9 +418,7 @@ Mono>> unplannedFailover( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateAppliance") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> updateAppliance( @@ -481,10 +436,7 @@ Mono>> updateAppliance( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - + "/updateMobilityService") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/updateMobilityService") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> updateMobilityService( @@ -502,8 +454,7 @@ Mono>> updateMobilityService( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationProtectedItems") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectedItems") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionContainerMappingsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionContainerMappingsClientImpl.java index e48e24e65215..bab1b3da710e 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionContainerMappingsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionContainerMappingsClientImpl.java @@ -79,9 +79,7 @@ public final class ReplicationProtectionContainerMappingsClientImpl public interface ReplicationProtectionContainerMappingsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectionContainerMappings") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationProtectionContainers( @@ -97,9 +95,7 @@ Mono> listByReplicationProtection @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -116,9 +112,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -136,9 +130,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> purge( @@ -154,9 +146,7 @@ Mono>> purge( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @@ -174,9 +164,7 @@ Mono>> update( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectionContainerMappings/{mappingName}/remove") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -193,8 +181,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationProtectionContainerMappings") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainerMappings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionContainersClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionContainersClientImpl.java index 34a5f2f7aeed..5fa30a0ee93d 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionContainersClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionContainersClientImpl.java @@ -73,8 +73,7 @@ public final class ReplicationProtectionContainersClientImpl implements Replicat public interface ReplicationProtectionContainersService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationFabrics( @@ -89,9 +88,7 @@ Mono> listByReplicationFabrics( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -107,9 +104,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -126,9 +121,7 @@ Mono>> create( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/discoverProtectableItem") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/discoverProtectableItem") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> discoverProtectableItem( @@ -145,9 +138,7 @@ Mono>> discoverProtectableItem( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/remove") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/remove") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -162,9 +153,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/switchprotection") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/switchprotection") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> switchProtection( @@ -181,8 +170,7 @@ Mono>> switchProtection( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationProtectionContainers") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionContainers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionIntentsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionIntentsClientImpl.java index 5e4b4b57b9eb..5f21ba2dfa36 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionIntentsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationProtectionIntentsClientImpl.java @@ -63,8 +63,7 @@ public final class ReplicationProtectionIntentsClientImpl implements Replication public interface ReplicationProtectionIntentsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationProtectionIntents") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -80,8 +79,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -96,8 +94,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationProtectionIntents/{intentObjectName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> create( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationRecoveryPlansClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationRecoveryPlansClientImpl.java index 86c494659527..df59e275bd15 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationRecoveryPlansClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationRecoveryPlansClientImpl.java @@ -75,8 +75,7 @@ public final class ReplicationRecoveryPlansClientImpl implements ReplicationReco public interface ReplicationRecoveryPlansService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -90,8 +89,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -106,8 +104,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -123,8 +120,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -138,8 +134,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @@ -155,8 +150,7 @@ Mono>> update( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCancel") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> failoverCancel( @@ -171,8 +165,7 @@ Mono>> failoverCancel( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/failoverCommit") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> failoverCommit( @@ -187,8 +180,7 @@ Mono>> failoverCommit( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/plannedFailover") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> plannedFailover( @@ -204,8 +196,7 @@ Mono>> plannedFailover( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/reProtect") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> reprotect( @@ -220,8 +211,7 @@ Mono>> reprotect( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailover") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> testFailover( @@ -237,8 +227,7 @@ Mono>> testFailover( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/testFailoverCleanup") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> testFailoverCleanup( @@ -254,8 +243,7 @@ Mono>> testFailoverCleanup( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryPlans/{recoveryPlanName}/unplannedFailover") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> unplannedFailover( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationRecoveryServicesProvidersClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationRecoveryServicesProvidersClientImpl.java index c26ab6338fa7..29b65ff4a89b 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationRecoveryServicesProvidersClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationRecoveryServicesProvidersClientImpl.java @@ -76,8 +76,7 @@ public final class ReplicationRecoveryServicesProvidersClientImpl public interface ReplicationRecoveryServicesProvidersService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationFabrics( @@ -92,9 +91,7 @@ Mono> listByReplicationFabrics( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders" - + "/{providerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -110,9 +107,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders" - + "/{providerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -129,9 +124,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders" - + "/{providerName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> purge( @@ -146,9 +139,7 @@ Mono>> purge( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders" - + "/{providerName}/refreshProvider") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/refreshProvider") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> refreshProvider( @@ -164,9 +155,7 @@ Mono>> refreshProvider( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders" - + "/{providerName}/remove") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationRecoveryServicesProviders/{providerName}/remove") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -181,8 +170,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationRecoveryServicesProviders") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationRecoveryServicesProviders") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationVaultHealthsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationVaultHealthsClientImpl.java index cbf8a53bd418..c5bf6c17426c 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationVaultHealthsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationVaultHealthsClientImpl.java @@ -60,8 +60,7 @@ public final class ReplicationVaultHealthsClientImpl implements ReplicationVault public interface ReplicationVaultHealthsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationVaultHealth") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -75,8 +74,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationVaultHealth/default/refresh") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultHealth/default/refresh") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> refresh( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationVaultSettingsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationVaultSettingsClientImpl.java index be9c4325ff1d..e2929e594499 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationVaultSettingsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationVaultSettingsClientImpl.java @@ -67,8 +67,7 @@ public final class ReplicationVaultSettingsClientImpl implements ReplicationVaul public interface ReplicationVaultSettingsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationVaultSettings") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -82,8 +81,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -98,8 +96,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationVaultSettings/{vaultSettingName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationvCentersClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationvCentersClientImpl.java index 92ab6a5ca52e..a0ff36e4b02f 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationvCentersClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/ReplicationvCentersClientImpl.java @@ -69,8 +69,7 @@ public final class ReplicationvCentersClientImpl implements ReplicationvCentersC public interface ReplicationvCentersService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationFabrics( @@ -85,8 +84,7 @@ Mono> listByReplicationFabrics( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -102,8 +100,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -120,8 +117,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -136,8 +132,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationvCenters/{vcenterName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @@ -154,8 +149,7 @@ Mono>> update( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationvCenters") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationvCenters") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SiteRecoveryManagementClientBuilder.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SiteRecoveryManagementClientBuilder.java index 8de5df53e087..73093202a961 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SiteRecoveryManagementClientBuilder.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SiteRecoveryManagementClientBuilder.java @@ -137,7 +137,7 @@ public SiteRecoveryManagementClientImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SiteRecoveryManagementClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SiteRecoveryManagementClientImpl.java index 99059f9c0c46..7aaf73bd1eaa 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SiteRecoveryManagementClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SiteRecoveryManagementClientImpl.java @@ -493,7 +493,7 @@ public ReplicationVaultSettingsClient getReplicationVaultSettings() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2022-10-01"; + this.apiVersion = "2023-06-01"; this.operations = new OperationsClientImpl(this); this.replicationAlertSettings = new ReplicationAlertSettingsClientImpl(this); this.replicationAppliances = new ReplicationAppliancesClientImpl(this); diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/StorageClassificationMappingsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/StorageClassificationMappingsClientImpl.java index d2522f37111d..e9e2c08869eb 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/StorageClassificationMappingsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/StorageClassificationMappingsClientImpl.java @@ -71,9 +71,7 @@ public final class StorageClassificationMappingsClientImpl implements StorageCla public interface StorageClassificationMappingsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications" - + "/{storageClassificationName}/replicationStorageClassificationMappings") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationStorageClassifications( @@ -89,10 +87,7 @@ Mono> listByReplicationStorageC @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications" - + "/{storageClassificationName}/replicationStorageClassificationMappings" - + "/{storageClassificationMappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -109,10 +104,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications" - + "/{storageClassificationName}/replicationStorageClassificationMappings" - + "/{storageClassificationMappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -130,10 +122,7 @@ Mono>> create( @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications" - + "/{storageClassificationName}/replicationStorageClassificationMappings" - + "/{storageClassificationMappingName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}/replicationStorageClassificationMappings/{storageClassificationMappingName}") @ExpectedResponses({202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -149,8 +138,7 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationStorageClassificationMappings") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassificationMappings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/StorageClassificationsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/StorageClassificationsClientImpl.java index 34cb29fc31be..ffe500dcfbc0 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/StorageClassificationsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/StorageClassificationsClientImpl.java @@ -59,8 +59,7 @@ public final class StorageClassificationsClientImpl implements StorageClassifica public interface StorageClassificationsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationFabrics( @@ -75,9 +74,7 @@ Mono> listByReplicationFabrics( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications" - + "/{storageClassificationName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationStorageClassifications/{storageClassificationName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -93,8 +90,7 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationStorageClassifications") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationStorageClassifications") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SupportedOperatingSystemsOperationsClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SupportedOperatingSystemsOperationsClientImpl.java index ba90a803f256..1d59b5e4a33a 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SupportedOperatingSystemsOperationsClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/SupportedOperatingSystemsOperationsClientImpl.java @@ -59,8 +59,7 @@ public final class SupportedOperatingSystemsOperationsClientImpl implements Supp public interface SupportedOperatingSystemsOperationsService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationSupportedOperatingSystems") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationSupportedOperatingSystems") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/TargetComputeSizesClientImpl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/TargetComputeSizesClientImpl.java index 0cf47b7e7ced..6963bfd96052 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/TargetComputeSizesClientImpl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/implementation/TargetComputeSizesClientImpl.java @@ -58,10 +58,7 @@ public final class TargetComputeSizesClientImpl implements TargetComputeSizesCli public interface TargetComputeSizesService { @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices" - + "/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers" - + "/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}" - + "/targetComputeSizes") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{resourceName}/replicationFabrics/{fabricName}/replicationProtectionContainers/{protectionContainerName}/replicationProtectedItems/{replicatedProtectedItemName}/targetComputeSizes") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByReplicationProtectedItems( diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/A2AFabricSpecificLocationDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/A2AFabricSpecificLocationDetails.java new file mode 100644 index 000000000000..1e40a449e68c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/A2AFabricSpecificLocationDetails.java @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ExtendedLocation details data. */ +@Fluent +public final class A2AFabricSpecificLocationDetails { + /* + * The initial source zone info. + */ + @JsonProperty(value = "initialPrimaryZone") + private String initialPrimaryZone; + + /* + * The initial target zone info. + */ + @JsonProperty(value = "initialRecoveryZone") + private String initialRecoveryZone; + + /* + * The initial primary ExtendedLocation. + */ + @JsonProperty(value = "initialPrimaryExtendedLocation") + private ExtendedLocation initialPrimaryExtendedLocation; + + /* + * The initial recovery ExtendedLocation. + */ + @JsonProperty(value = "initialRecoveryExtendedLocation") + private ExtendedLocation initialRecoveryExtendedLocation; + + /* + * Initial primary fabric location info. + */ + @JsonProperty(value = "initialPrimaryFabricLocation") + private String initialPrimaryFabricLocation; + + /* + * The initial recovery fabric location info. + */ + @JsonProperty(value = "initialRecoveryFabricLocation") + private String initialRecoveryFabricLocation; + + /* + * Source zone info. + */ + @JsonProperty(value = "primaryZone") + private String primaryZone; + + /* + * The target zone info. + */ + @JsonProperty(value = "recoveryZone") + private String recoveryZone; + + /* + * The primary ExtendedLocation. + */ + @JsonProperty(value = "primaryExtendedLocation") + private ExtendedLocation primaryExtendedLocation; + + /* + * The recovery ExtendedLocation. + */ + @JsonProperty(value = "recoveryExtendedLocation") + private ExtendedLocation recoveryExtendedLocation; + + /* + * Primary fabric location info. + */ + @JsonProperty(value = "primaryFabricLocation") + private String primaryFabricLocation; + + /* + * The recovery fabric location info. + */ + @JsonProperty(value = "recoveryFabricLocation") + private String recoveryFabricLocation; + + /** Creates an instance of A2AFabricSpecificLocationDetails class. */ + public A2AFabricSpecificLocationDetails() { + } + + /** + * Get the initialPrimaryZone property: The initial source zone info. + * + * @return the initialPrimaryZone value. + */ + public String initialPrimaryZone() { + return this.initialPrimaryZone; + } + + /** + * Set the initialPrimaryZone property: The initial source zone info. + * + * @param initialPrimaryZone the initialPrimaryZone value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withInitialPrimaryZone(String initialPrimaryZone) { + this.initialPrimaryZone = initialPrimaryZone; + return this; + } + + /** + * Get the initialRecoveryZone property: The initial target zone info. + * + * @return the initialRecoveryZone value. + */ + public String initialRecoveryZone() { + return this.initialRecoveryZone; + } + + /** + * Set the initialRecoveryZone property: The initial target zone info. + * + * @param initialRecoveryZone the initialRecoveryZone value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withInitialRecoveryZone(String initialRecoveryZone) { + this.initialRecoveryZone = initialRecoveryZone; + return this; + } + + /** + * Get the initialPrimaryExtendedLocation property: The initial primary ExtendedLocation. + * + * @return the initialPrimaryExtendedLocation value. + */ + public ExtendedLocation initialPrimaryExtendedLocation() { + return this.initialPrimaryExtendedLocation; + } + + /** + * Set the initialPrimaryExtendedLocation property: The initial primary ExtendedLocation. + * + * @param initialPrimaryExtendedLocation the initialPrimaryExtendedLocation value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withInitialPrimaryExtendedLocation( + ExtendedLocation initialPrimaryExtendedLocation) { + this.initialPrimaryExtendedLocation = initialPrimaryExtendedLocation; + return this; + } + + /** + * Get the initialRecoveryExtendedLocation property: The initial recovery ExtendedLocation. + * + * @return the initialRecoveryExtendedLocation value. + */ + public ExtendedLocation initialRecoveryExtendedLocation() { + return this.initialRecoveryExtendedLocation; + } + + /** + * Set the initialRecoveryExtendedLocation property: The initial recovery ExtendedLocation. + * + * @param initialRecoveryExtendedLocation the initialRecoveryExtendedLocation value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withInitialRecoveryExtendedLocation( + ExtendedLocation initialRecoveryExtendedLocation) { + this.initialRecoveryExtendedLocation = initialRecoveryExtendedLocation; + return this; + } + + /** + * Get the initialPrimaryFabricLocation property: Initial primary fabric location info. + * + * @return the initialPrimaryFabricLocation value. + */ + public String initialPrimaryFabricLocation() { + return this.initialPrimaryFabricLocation; + } + + /** + * Set the initialPrimaryFabricLocation property: Initial primary fabric location info. + * + * @param initialPrimaryFabricLocation the initialPrimaryFabricLocation value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withInitialPrimaryFabricLocation(String initialPrimaryFabricLocation) { + this.initialPrimaryFabricLocation = initialPrimaryFabricLocation; + return this; + } + + /** + * Get the initialRecoveryFabricLocation property: The initial recovery fabric location info. + * + * @return the initialRecoveryFabricLocation value. + */ + public String initialRecoveryFabricLocation() { + return this.initialRecoveryFabricLocation; + } + + /** + * Set the initialRecoveryFabricLocation property: The initial recovery fabric location info. + * + * @param initialRecoveryFabricLocation the initialRecoveryFabricLocation value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withInitialRecoveryFabricLocation(String initialRecoveryFabricLocation) { + this.initialRecoveryFabricLocation = initialRecoveryFabricLocation; + return this; + } + + /** + * Get the primaryZone property: Source zone info. + * + * @return the primaryZone value. + */ + public String primaryZone() { + return this.primaryZone; + } + + /** + * Set the primaryZone property: Source zone info. + * + * @param primaryZone the primaryZone value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withPrimaryZone(String primaryZone) { + this.primaryZone = primaryZone; + return this; + } + + /** + * Get the recoveryZone property: The target zone info. + * + * @return the recoveryZone value. + */ + public String recoveryZone() { + return this.recoveryZone; + } + + /** + * Set the recoveryZone property: The target zone info. + * + * @param recoveryZone the recoveryZone value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withRecoveryZone(String recoveryZone) { + this.recoveryZone = recoveryZone; + return this; + } + + /** + * Get the primaryExtendedLocation property: The primary ExtendedLocation. + * + * @return the primaryExtendedLocation value. + */ + public ExtendedLocation primaryExtendedLocation() { + return this.primaryExtendedLocation; + } + + /** + * Set the primaryExtendedLocation property: The primary ExtendedLocation. + * + * @param primaryExtendedLocation the primaryExtendedLocation value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withPrimaryExtendedLocation(ExtendedLocation primaryExtendedLocation) { + this.primaryExtendedLocation = primaryExtendedLocation; + return this; + } + + /** + * Get the recoveryExtendedLocation property: The recovery ExtendedLocation. + * + * @return the recoveryExtendedLocation value. + */ + public ExtendedLocation recoveryExtendedLocation() { + return this.recoveryExtendedLocation; + } + + /** + * Set the recoveryExtendedLocation property: The recovery ExtendedLocation. + * + * @param recoveryExtendedLocation the recoveryExtendedLocation value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withRecoveryExtendedLocation(ExtendedLocation recoveryExtendedLocation) { + this.recoveryExtendedLocation = recoveryExtendedLocation; + return this; + } + + /** + * Get the primaryFabricLocation property: Primary fabric location info. + * + * @return the primaryFabricLocation value. + */ + public String primaryFabricLocation() { + return this.primaryFabricLocation; + } + + /** + * Set the primaryFabricLocation property: Primary fabric location info. + * + * @param primaryFabricLocation the primaryFabricLocation value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withPrimaryFabricLocation(String primaryFabricLocation) { + this.primaryFabricLocation = primaryFabricLocation; + return this; + } + + /** + * Get the recoveryFabricLocation property: The recovery fabric location info. + * + * @return the recoveryFabricLocation value. + */ + public String recoveryFabricLocation() { + return this.recoveryFabricLocation; + } + + /** + * Set the recoveryFabricLocation property: The recovery fabric location info. + * + * @param recoveryFabricLocation the recoveryFabricLocation value to set. + * @return the A2AFabricSpecificLocationDetails object itself. + */ + public A2AFabricSpecificLocationDetails withRecoveryFabricLocation(String recoveryFabricLocation) { + this.recoveryFabricLocation = recoveryFabricLocation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (initialPrimaryExtendedLocation() != null) { + initialPrimaryExtendedLocation().validate(); + } + if (initialRecoveryExtendedLocation() != null) { + initialRecoveryExtendedLocation().validate(); + } + if (primaryExtendedLocation() != null) { + primaryExtendedLocation().validate(); + } + if (recoveryExtendedLocation() != null) { + recoveryExtendedLocation().validate(); + } + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/A2AReplicationDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/A2AReplicationDetails.java index 16b771c299af..5b1b73f05143 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/A2AReplicationDetails.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/A2AReplicationDetails.java @@ -336,6 +336,12 @@ public final class A2AReplicationDetails extends ReplicationProviderSpecificSett @JsonProperty(value = "recoveryCapacityReservationGroupId") private String recoveryCapacityReservationGroupId; + /* + * A value indicating the churn option selected by user. + */ + @JsonProperty(value = "churnOptionSelected", access = JsonProperty.Access.WRITE_ONLY) + private ChurnOptionSelected churnOptionSelected; + /** Creates an instance of A2AReplicationDetails class. */ public A2AReplicationDetails() { } @@ -1340,6 +1346,15 @@ public A2AReplicationDetails withRecoveryCapacityReservationGroupId(String recov return this; } + /** + * Get the churnOptionSelected property: A value indicating the churn option selected by user. + * + * @return the churnOptionSelected value. + */ + public ChurnOptionSelected churnOptionSelected() { + return this.churnOptionSelected; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Alert.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Alert.java index b6ea7c18b529..4dd3062f0a84 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Alert.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Alert.java @@ -70,11 +70,13 @@ public interface Alert { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The Alert definition stages. */ interface DefinitionStages { /** The first stage of the Alert definition. */ interface Blank extends WithParentResource { } + /** The stage of the Alert definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -86,6 +88,7 @@ interface WithParentResource { */ WithCreate withExistingVault(String resourceName, String resourceGroupName); } + /** * The stage of the Alert definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. @@ -106,6 +109,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ Alert create(Context context); } + /** The stage of the Alert definition allowing to specify properties. */ interface WithProperties { /** @@ -117,6 +121,7 @@ interface WithProperties { WithCreate withProperties(ConfigureAlertRequestProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ApplianceMonitoringDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ApplianceMonitoringDetails.java new file mode 100644 index 000000000000..003470f8162b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ApplianceMonitoringDetails.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Appliance details of the migration item. */ +@Immutable +public final class ApplianceMonitoringDetails { + /* + * The appliance CPU details. + */ + @JsonProperty(value = "cpuDetails", access = JsonProperty.Access.WRITE_ONLY) + private ApplianceResourceDetails cpuDetails; + + /* + * The appliance RAM details. + */ + @JsonProperty(value = "ramDetails", access = JsonProperty.Access.WRITE_ONLY) + private ApplianceResourceDetails ramDetails; + + /* + * The appliance datastore snapshot details. + */ + @JsonProperty(value = "datastoreSnapshot", access = JsonProperty.Access.WRITE_ONLY) + private List datastoreSnapshot; + + /* + * The disk replication details. + */ + @JsonProperty(value = "disksReplicationDetails", access = JsonProperty.Access.WRITE_ONLY) + private ApplianceResourceDetails disksReplicationDetails; + + /* + * The ESXi NFC buffer details. + */ + @JsonProperty(value = "esxiNfcBuffer", access = JsonProperty.Access.WRITE_ONLY) + private ApplianceResourceDetails esxiNfcBuffer; + + /* + * The appliance network bandwidth details. + */ + @JsonProperty(value = "networkBandwidth", access = JsonProperty.Access.WRITE_ONLY) + private ApplianceResourceDetails networkBandwidth; + + /** Creates an instance of ApplianceMonitoringDetails class. */ + public ApplianceMonitoringDetails() { + } + + /** + * Get the cpuDetails property: The appliance CPU details. + * + * @return the cpuDetails value. + */ + public ApplianceResourceDetails cpuDetails() { + return this.cpuDetails; + } + + /** + * Get the ramDetails property: The appliance RAM details. + * + * @return the ramDetails value. + */ + public ApplianceResourceDetails ramDetails() { + return this.ramDetails; + } + + /** + * Get the datastoreSnapshot property: The appliance datastore snapshot details. + * + * @return the datastoreSnapshot value. + */ + public List datastoreSnapshot() { + return this.datastoreSnapshot; + } + + /** + * Get the disksReplicationDetails property: The disk replication details. + * + * @return the disksReplicationDetails value. + */ + public ApplianceResourceDetails disksReplicationDetails() { + return this.disksReplicationDetails; + } + + /** + * Get the esxiNfcBuffer property: The ESXi NFC buffer details. + * + * @return the esxiNfcBuffer value. + */ + public ApplianceResourceDetails esxiNfcBuffer() { + return this.esxiNfcBuffer; + } + + /** + * Get the networkBandwidth property: The appliance network bandwidth details. + * + * @return the networkBandwidth value. + */ + public ApplianceResourceDetails networkBandwidth() { + return this.networkBandwidth; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (cpuDetails() != null) { + cpuDetails().validate(); + } + if (ramDetails() != null) { + ramDetails().validate(); + } + if (datastoreSnapshot() != null) { + datastoreSnapshot().forEach(e -> e.validate()); + } + if (disksReplicationDetails() != null) { + disksReplicationDetails().validate(); + } + if (esxiNfcBuffer() != null) { + esxiNfcBuffer().validate(); + } + if (networkBandwidth() != null) { + networkBandwidth().validate(); + } + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ApplianceResourceDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ApplianceResourceDetails.java new file mode 100644 index 000000000000..dfe8031e8165 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ApplianceResourceDetails.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of the appliance resource. */ +@Immutable +public final class ApplianceResourceDetails { + /* + * A value indicating the total capacity of appliance resource. + */ + @JsonProperty(value = "capacity", access = JsonProperty.Access.WRITE_ONLY) + private Long capacity; + + /* + * A value indicating the utilization percentage by gateway agent on appliance. + */ + @JsonProperty(value = "processUtilization", access = JsonProperty.Access.WRITE_ONLY) + private Double processUtilization; + + /* + * A value indicating the total utilization percentage for all processes on the appliance. + */ + @JsonProperty(value = "totalUtilization", access = JsonProperty.Access.WRITE_ONLY) + private Double totalUtilization; + + /* + * A value indicating the status of appliance resource. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** Creates an instance of ApplianceResourceDetails class. */ + public ApplianceResourceDetails() { + } + + /** + * Get the capacity property: A value indicating the total capacity of appliance resource. + * + * @return the capacity value. + */ + public Long capacity() { + return this.capacity; + } + + /** + * Get the processUtilization property: A value indicating the utilization percentage by gateway agent on appliance. + * + * @return the processUtilization value. + */ + public Double processUtilization() { + return this.processUtilization; + } + + /** + * Get the totalUtilization property: A value indicating the total utilization percentage for all processes on the + * appliance. + * + * @return the totalUtilization value. + */ + public Double totalUtilization() { + return this.totalUtilization; + } + + /** + * Get the status property: A value indicating the status of appliance resource. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/AzureFabricSpecificDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/AzureFabricSpecificDetails.java index 96f3407ee3e5..11c6d133aa58 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/AzureFabricSpecificDetails.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/AzureFabricSpecificDetails.java @@ -39,6 +39,12 @@ public final class AzureFabricSpecificDetails extends FabricSpecificDetails { @JsonProperty(value = "extendedLocations") private List extendedLocations; + /* + * The location details. + */ + @JsonProperty(value = "locationDetails") + private List locationDetails; + /** Creates an instance of AzureFabricSpecificDetails class. */ public AzureFabricSpecificDetails() { } @@ -123,6 +129,26 @@ public AzureFabricSpecificDetails withExtendedLocations(List locationDetails() { + return this.locationDetails; + } + + /** + * Set the locationDetails property: The location details. + * + * @param locationDetails the locationDetails value to set. + * @return the AzureFabricSpecificDetails object itself. + */ + public AzureFabricSpecificDetails withLocationDetails(List locationDetails) { + this.locationDetails = locationDetails; + return this; + } + /** * Validates the instance. * @@ -137,5 +163,8 @@ public void validate() { if (extendedLocations() != null) { extendedLocations().forEach(e -> e.validate()); } + if (locationDetails() != null) { + locationDetails().forEach(e -> e.validate()); + } } } diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ChurnOptionSelected.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ChurnOptionSelected.java new file mode 100644 index 000000000000..78e3fa5785b0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ChurnOptionSelected.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** A value indicating the churn option selected by user. */ +public final class ChurnOptionSelected extends ExpandableStringEnum { + /** Static value Normal for ChurnOptionSelected. */ + public static final ChurnOptionSelected NORMAL = fromString("Normal"); + + /** Static value High for ChurnOptionSelected. */ + public static final ChurnOptionSelected HIGH = fromString("High"); + + /** + * Creates a new instance of ChurnOptionSelected value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ChurnOptionSelected() { + } + + /** + * Creates or finds a ChurnOptionSelected from its string representation. + * + * @param name a name to look for. + * @return the corresponding ChurnOptionSelected. + */ + @JsonCreator + public static ChurnOptionSelected fromString(String name) { + return fromString(name, ChurnOptionSelected.class); + } + + /** + * Gets known ChurnOptionSelected values. + * + * @return known ChurnOptionSelected values. + */ + public static Collection values() { + return values(ChurnOptionSelected.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/DataStoreUtilizationDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/DataStoreUtilizationDetails.java new file mode 100644 index 000000000000..46b8a96a7241 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/DataStoreUtilizationDetails.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of the appliance resource. */ +@Immutable +public final class DataStoreUtilizationDetails { + /* + * The total count of snapshots supported by the datastore. + */ + @JsonProperty(value = "totalSnapshotsSupported", access = JsonProperty.Access.WRITE_ONLY) + private Long totalSnapshotsSupported; + + /* + * The total snapshots created for server migration in the datastore. + */ + @JsonProperty(value = "totalSnapshotsCreated", access = JsonProperty.Access.WRITE_ONLY) + private Long totalSnapshotsCreated; + + /* + * The datastore name. + */ + @JsonProperty(value = "dataStoreName", access = JsonProperty.Access.WRITE_ONLY) + private String dataStoreName; + + /** Creates an instance of DataStoreUtilizationDetails class. */ + public DataStoreUtilizationDetails() { + } + + /** + * Get the totalSnapshotsSupported property: The total count of snapshots supported by the datastore. + * + * @return the totalSnapshotsSupported value. + */ + public Long totalSnapshotsSupported() { + return this.totalSnapshotsSupported; + } + + /** + * Get the totalSnapshotsCreated property: The total snapshots created for server migration in the datastore. + * + * @return the totalSnapshotsCreated value. + */ + public Long totalSnapshotsCreated() { + return this.totalSnapshotsCreated; + } + + /** + * Get the dataStoreName property: The datastore name. + * + * @return the dataStoreName value. + */ + public String dataStoreName() { + return this.dataStoreName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Fabric.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Fabric.java index 0be5f3520da0..36aa30a083a6 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Fabric.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Fabric.java @@ -70,11 +70,13 @@ public interface Fabric { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The Fabric definition stages. */ interface DefinitionStages { /** The first stage of the Fabric definition. */ interface Blank extends WithParentResource { } + /** The stage of the Fabric definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -86,6 +88,7 @@ interface WithParentResource { */ WithCreate withExistingVault(String resourceName, String resourceGroupName); } + /** * The stage of the Fabric definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. @@ -106,6 +109,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ Fabric create(Context context); } + /** The stage of the Fabric definition allowing to specify properties. */ interface WithProperties { /** @@ -117,6 +121,7 @@ interface WithProperties { WithCreate withProperties(FabricCreationInputProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/GatewayOperationDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/GatewayOperationDetails.java new file mode 100644 index 000000000000..c31e5eef97ba --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/GatewayOperationDetails.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Details of the gateway operation. */ +@Immutable +public final class GatewayOperationDetails { + /* + * A value indicating the state of gateway operation. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * A value indicating the progress percentage of gateway operation. + */ + @JsonProperty(value = "progressPercentage", access = JsonProperty.Access.WRITE_ONLY) + private Integer progressPercentage; + + /* + * A value indicating the time elapsed for the operation in milliseconds. + */ + @JsonProperty(value = "timeElapsed", access = JsonProperty.Access.WRITE_ONLY) + private Long timeElapsed; + + /* + * A value indicating the time remaining for the operation in milliseconds. + */ + @JsonProperty(value = "timeRemaining", access = JsonProperty.Access.WRITE_ONLY) + private Long timeRemaining; + + /* + * A value indicating the upload speed in bytes per second. + */ + @JsonProperty(value = "uploadSpeed", access = JsonProperty.Access.WRITE_ONLY) + private Long uploadSpeed; + + /* + * A value indicating the ESXi host name. + */ + @JsonProperty(value = "hostName", access = JsonProperty.Access.WRITE_ONLY) + private String hostname; + + /* + * A value indicating the datastore collection. + */ + @JsonProperty(value = "dataStores", access = JsonProperty.Access.WRITE_ONLY) + private List dataStores; + + /* + * A value indicating the VMware read throughput in bytes per second. + */ + @JsonProperty(value = "vmwareReadThroughput", access = JsonProperty.Access.WRITE_ONLY) + private Long vmwareReadThroughput; + + /** Creates an instance of GatewayOperationDetails class. */ + public GatewayOperationDetails() { + } + + /** + * Get the state property: A value indicating the state of gateway operation. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the progressPercentage property: A value indicating the progress percentage of gateway operation. + * + * @return the progressPercentage value. + */ + public Integer progressPercentage() { + return this.progressPercentage; + } + + /** + * Get the timeElapsed property: A value indicating the time elapsed for the operation in milliseconds. + * + * @return the timeElapsed value. + */ + public Long timeElapsed() { + return this.timeElapsed; + } + + /** + * Get the timeRemaining property: A value indicating the time remaining for the operation in milliseconds. + * + * @return the timeRemaining value. + */ + public Long timeRemaining() { + return this.timeRemaining; + } + + /** + * Get the uploadSpeed property: A value indicating the upload speed in bytes per second. + * + * @return the uploadSpeed value. + */ + public Long uploadSpeed() { + return this.uploadSpeed; + } + + /** + * Get the hostname property: A value indicating the ESXi host name. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Get the dataStores property: A value indicating the datastore collection. + * + * @return the dataStores value. + */ + public List dataStores() { + return this.dataStores; + } + + /** + * Get the vmwareReadThroughput property: A value indicating the VMware read throughput in bytes per second. + * + * @return the vmwareReadThroughput value. + */ + public Long vmwareReadThroughput() { + return this.vmwareReadThroughput; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzurePlannedFailoverProviderInput.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzurePlannedFailoverProviderInput.java index ea22ab7357e1..1b816978bb1b 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzurePlannedFailoverProviderInput.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzurePlannedFailoverProviderInput.java @@ -33,6 +33,12 @@ public final class HyperVReplicaAzurePlannedFailoverProviderInput extends Planne @JsonProperty(value = "recoveryPointId") private String recoveryPointId; + /* + * A value indicating the inplace OS Upgrade version. + */ + @JsonProperty(value = "osUpgradeVersion") + private String osUpgradeVersion; + /** Creates an instance of HyperVReplicaAzurePlannedFailoverProviderInput class. */ public HyperVReplicaAzurePlannedFailoverProviderInput() { } @@ -101,6 +107,26 @@ public HyperVReplicaAzurePlannedFailoverProviderInput withRecoveryPointId(String return this; } + /** + * Get the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @return the osUpgradeVersion value. + */ + public String osUpgradeVersion() { + return this.osUpgradeVersion; + } + + /** + * Set the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @param osUpgradeVersion the osUpgradeVersion value to set. + * @return the HyperVReplicaAzurePlannedFailoverProviderInput object itself. + */ + public HyperVReplicaAzurePlannedFailoverProviderInput withOsUpgradeVersion(String osUpgradeVersion) { + this.osUpgradeVersion = osUpgradeVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzureReplicationDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzureReplicationDetails.java index e6fd3ddb9114..feadaf19e768 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzureReplicationDetails.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzureReplicationDetails.java @@ -222,6 +222,12 @@ public final class HyperVReplicaAzureReplicationDetails extends ReplicationProvi @JsonProperty(value = "protectedManagedDisks") private List protectedManagedDisks; + /* + * A value indicating all available inplace OS Upgrade configurations. + */ + @JsonProperty(value = "allAvailableOSUpgradeConfigurations") + private List allAvailableOSUpgradeConfigurations; + /** Creates an instance of HyperVReplicaAzureReplicationDetails class. */ public HyperVReplicaAzureReplicationDetails() { } @@ -886,6 +892,29 @@ public HyperVReplicaAzureReplicationDetails withProtectedManagedDisks( return this; } + /** + * Get the allAvailableOSUpgradeConfigurations property: A value indicating all available inplace OS Upgrade + * configurations. + * + * @return the allAvailableOSUpgradeConfigurations value. + */ + public List allAvailableOSUpgradeConfigurations() { + return this.allAvailableOSUpgradeConfigurations; + } + + /** + * Set the allAvailableOSUpgradeConfigurations property: A value indicating all available inplace OS Upgrade + * configurations. + * + * @param allAvailableOSUpgradeConfigurations the allAvailableOSUpgradeConfigurations value to set. + * @return the HyperVReplicaAzureReplicationDetails object itself. + */ + public HyperVReplicaAzureReplicationDetails withAllAvailableOSUpgradeConfigurations( + List allAvailableOSUpgradeConfigurations) { + this.allAvailableOSUpgradeConfigurations = allAvailableOSUpgradeConfigurations; + return this; + } + /** * Validates the instance. * @@ -909,5 +938,8 @@ public void validate() { if (protectedManagedDisks() != null) { protectedManagedDisks().forEach(e -> e.validate()); } + if (allAvailableOSUpgradeConfigurations() != null) { + allAvailableOSUpgradeConfigurations().forEach(e -> e.validate()); + } } } diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzureTestFailoverInput.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzureTestFailoverInput.java index 2deee826fb5d..4398e11234e1 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzureTestFailoverInput.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/HyperVReplicaAzureTestFailoverInput.java @@ -33,6 +33,12 @@ public final class HyperVReplicaAzureTestFailoverInput extends TestFailoverProvi @JsonProperty(value = "recoveryPointId") private String recoveryPointId; + /* + * A value indicating the inplace OS Upgrade version. + */ + @JsonProperty(value = "osUpgradeVersion") + private String osUpgradeVersion; + /** Creates an instance of HyperVReplicaAzureTestFailoverInput class. */ public HyperVReplicaAzureTestFailoverInput() { } @@ -99,6 +105,26 @@ public HyperVReplicaAzureTestFailoverInput withRecoveryPointId(String recoveryPo return this; } + /** + * Get the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @return the osUpgradeVersion value. + */ + public String osUpgradeVersion() { + return this.osUpgradeVersion; + } + + /** + * Set the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @param osUpgradeVersion the osUpgradeVersion value to set. + * @return the HyperVReplicaAzureTestFailoverInput object itself. + */ + public HyperVReplicaAzureTestFailoverInput withOsUpgradeVersion(String osUpgradeVersion) { + this.osUpgradeVersion = osUpgradeVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2ReplicationDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2ReplicationDetails.java index a85b0ca1b544..d43cfa8c2612 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2ReplicationDetails.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2ReplicationDetails.java @@ -427,6 +427,24 @@ public final class InMageAzureV2ReplicationDetails extends ReplicationProviderSp @JsonProperty(value = "switchProviderDetails") private InMageAzureV2SwitchProviderDetails switchProviderDetails; + /* + * A value indicating the inplace OS Upgrade version. + */ + @JsonProperty(value = "supportedOSVersions") + private List supportedOSVersions; + + /* + * A value indicating all available inplace OS Upgrade configurations. + */ + @JsonProperty(value = "allAvailableOSUpgradeConfigurations") + private List allAvailableOSUpgradeConfigurations; + + /* + * The name of the OS on the VM. + */ + @JsonProperty(value = "osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + /** Creates an instance of InMageAzureV2ReplicationDetails class. */ public InMageAzureV2ReplicationDetails() { } @@ -1780,6 +1798,58 @@ public InMageAzureV2ReplicationDetails withSwitchProviderDetails( return this; } + /** + * Get the supportedOSVersions property: A value indicating the inplace OS Upgrade version. + * + * @return the supportedOSVersions value. + */ + public List supportedOSVersions() { + return this.supportedOSVersions; + } + + /** + * Set the supportedOSVersions property: A value indicating the inplace OS Upgrade version. + * + * @param supportedOSVersions the supportedOSVersions value to set. + * @return the InMageAzureV2ReplicationDetails object itself. + */ + public InMageAzureV2ReplicationDetails withSupportedOSVersions(List supportedOSVersions) { + this.supportedOSVersions = supportedOSVersions; + return this; + } + + /** + * Get the allAvailableOSUpgradeConfigurations property: A value indicating all available inplace OS Upgrade + * configurations. + * + * @return the allAvailableOSUpgradeConfigurations value. + */ + public List allAvailableOSUpgradeConfigurations() { + return this.allAvailableOSUpgradeConfigurations; + } + + /** + * Set the allAvailableOSUpgradeConfigurations property: A value indicating all available inplace OS Upgrade + * configurations. + * + * @param allAvailableOSUpgradeConfigurations the allAvailableOSUpgradeConfigurations value to set. + * @return the InMageAzureV2ReplicationDetails object itself. + */ + public InMageAzureV2ReplicationDetails withAllAvailableOSUpgradeConfigurations( + List allAvailableOSUpgradeConfigurations) { + this.allAvailableOSUpgradeConfigurations = allAvailableOSUpgradeConfigurations; + return this; + } + + /** + * Get the osName property: The name of the OS on the VM. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + /** * Validates the instance. * @@ -1809,5 +1879,8 @@ public void validate() { if (switchProviderDetails() != null) { switchProviderDetails().validate(); } + if (allAvailableOSUpgradeConfigurations() != null) { + allAvailableOSUpgradeConfigurations().forEach(e -> e.validate()); + } } } diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2TestFailoverInput.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2TestFailoverInput.java index d9d1def23ddd..7ea4af5f05bb 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2TestFailoverInput.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2TestFailoverInput.java @@ -21,6 +21,12 @@ public final class InMageAzureV2TestFailoverInput extends TestFailoverProviderSp @JsonProperty(value = "recoveryPointId") private String recoveryPointId; + /* + * A value indicating the inplace OS Upgrade version. + */ + @JsonProperty(value = "osUpgradeVersion") + private String osUpgradeVersion; + /** Creates an instance of InMageAzureV2TestFailoverInput class. */ public InMageAzureV2TestFailoverInput() { } @@ -47,6 +53,26 @@ public InMageAzureV2TestFailoverInput withRecoveryPointId(String recoveryPointId return this; } + /** + * Get the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @return the osUpgradeVersion value. + */ + public String osUpgradeVersion() { + return this.osUpgradeVersion; + } + + /** + * Set the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @param osUpgradeVersion the osUpgradeVersion value to set. + * @return the InMageAzureV2TestFailoverInput object itself. + */ + public InMageAzureV2TestFailoverInput withOsUpgradeVersion(String osUpgradeVersion) { + this.osUpgradeVersion = osUpgradeVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2UnplannedFailoverInput.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2UnplannedFailoverInput.java index 5f95e2bb12b9..a6a6ad24fce0 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2UnplannedFailoverInput.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/InMageAzureV2UnplannedFailoverInput.java @@ -21,6 +21,12 @@ public final class InMageAzureV2UnplannedFailoverInput extends UnplannedFailover @JsonProperty(value = "recoveryPointId") private String recoveryPointId; + /* + * A value indicating the inplace OS Upgrade version. + */ + @JsonProperty(value = "osUpgradeVersion") + private String osUpgradeVersion; + /** Creates an instance of InMageAzureV2UnplannedFailoverInput class. */ public InMageAzureV2UnplannedFailoverInput() { } @@ -47,6 +53,26 @@ public InMageAzureV2UnplannedFailoverInput withRecoveryPointId(String recoveryPo return this; } + /** + * Get the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @return the osUpgradeVersion value. + */ + public String osUpgradeVersion() { + return this.osUpgradeVersion; + } + + /** + * Set the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @param osUpgradeVersion the osUpgradeVersion value to set. + * @return the InMageAzureV2UnplannedFailoverInput object itself. + */ + public InMageAzureV2UnplannedFailoverInput withOsUpgradeVersion(String osUpgradeVersion) { + this.osUpgradeVersion = osUpgradeVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/MigrationItem.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/MigrationItem.java index 6686535b493b..47619e3f6528 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/MigrationItem.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/MigrationItem.java @@ -80,11 +80,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The MigrationItem definition stages. */ interface DefinitionStages { /** The first stage of the MigrationItem definition. */ interface Blank extends WithParentResource { } + /** The stage of the MigrationItem definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -99,6 +101,7 @@ interface WithParentResource { WithProperties withExistingReplicationProtectionContainer( String resourceName, String resourceGroupName, String fabricName, String protectionContainerName); } + /** The stage of the MigrationItem definition allowing to specify properties. */ interface WithProperties { /** @@ -109,6 +112,7 @@ interface WithProperties { */ WithCreate withProperties(EnableMigrationInputProperties properties); } + /** * The stage of the MigrationItem definition which contains all the minimum required properties for the resource * to be created, but also allows for any other optional properties to be specified. @@ -130,6 +134,7 @@ interface WithCreate { MigrationItem create(Context context); } } + /** * Begins update for the MigrationItem resource. * @@ -154,6 +159,7 @@ interface Update extends UpdateStages.WithProperties { */ MigrationItem apply(Context context); } + /** The MigrationItem update stages. */ interface UpdateStages { /** The stage of the MigrationItem update allowing to specify properties. */ @@ -167,6 +173,7 @@ interface WithProperties { Update withProperties(UpdateMigrationItemInputProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/NetworkMapping.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/NetworkMapping.java index 7780908240da..7cc5c32f39a7 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/NetworkMapping.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/NetworkMapping.java @@ -80,11 +80,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The NetworkMapping definition stages. */ interface DefinitionStages { /** The first stage of the NetworkMapping definition. */ interface Blank extends WithParentResource { } + /** The stage of the NetworkMapping definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -99,6 +101,7 @@ interface WithParentResource { WithProperties withExistingReplicationNetwork( String resourceName, String resourceGroupName, String fabricName, String networkName); } + /** The stage of the NetworkMapping definition allowing to specify properties. */ interface WithProperties { /** @@ -109,6 +112,7 @@ interface WithProperties { */ WithCreate withProperties(CreateNetworkMappingInputProperties properties); } + /** * The stage of the NetworkMapping definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -130,6 +134,7 @@ interface WithCreate { NetworkMapping create(Context context); } } + /** * Begins update for the NetworkMapping resource. * @@ -154,6 +159,7 @@ interface Update extends UpdateStages.WithProperties { */ NetworkMapping apply(Context context); } + /** The NetworkMapping update stages. */ interface UpdateStages { /** The stage of the NetworkMapping update allowing to specify properties. */ @@ -167,6 +173,7 @@ interface WithProperties { Update withProperties(UpdateNetworkMappingInputProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/OSUpgradeSupportedVersions.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/OSUpgradeSupportedVersions.java new file mode 100644 index 000000000000..61aa5f98578b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/OSUpgradeSupportedVersions.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Supported OS upgrade versions. */ +@Immutable +public final class OSUpgradeSupportedVersions { + /* + * The source OS version name. + */ + @JsonProperty(value = "supportedSourceOsVersion", access = JsonProperty.Access.WRITE_ONLY) + private String supportedSourceOsVersion; + + /* + * The target OS version names. + */ + @JsonProperty(value = "supportedTargetOsVersions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedTargetOsVersions; + + /** Creates an instance of OSUpgradeSupportedVersions class. */ + public OSUpgradeSupportedVersions() { + } + + /** + * Get the supportedSourceOsVersion property: The source OS version name. + * + * @return the supportedSourceOsVersion value. + */ + public String supportedSourceOsVersion() { + return this.supportedSourceOsVersion; + } + + /** + * Get the supportedTargetOsVersions property: The target OS version names. + * + * @return the supportedTargetOsVersions value. + */ + public List supportedTargetOsVersions() { + return this.supportedTargetOsVersions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Policy.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Policy.java index 2f4cc168d0f0..6f4f45e002bc 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Policy.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/Policy.java @@ -77,11 +77,13 @@ public interface Policy { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The Policy definition stages. */ interface DefinitionStages { /** The first stage of the Policy definition. */ interface Blank extends WithParentResource { } + /** The stage of the Policy definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -93,6 +95,7 @@ interface WithParentResource { */ WithCreate withExistingVault(String resourceName, String resourceGroupName); } + /** * The stage of the Policy definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. @@ -113,6 +116,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ Policy create(Context context); } + /** The stage of the Policy definition allowing to specify properties. */ interface WithProperties { /** @@ -124,6 +128,7 @@ interface WithProperties { WithCreate withProperties(CreatePolicyInputProperties properties); } } + /** * Begins update for the Policy resource. * @@ -148,6 +153,7 @@ interface Update extends UpdateStages.WithProperties { */ Policy apply(Context context); } + /** The Policy update stages. */ interface UpdateStages { /** The stage of the Policy update allowing to specify properties. */ @@ -161,6 +167,7 @@ interface WithProperties { Update withProperties(UpdatePolicyInputProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ProtectionContainer.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ProtectionContainer.java index 99498f5a2d73..e08aeb44a671 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ProtectionContainer.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ProtectionContainer.java @@ -71,11 +71,13 @@ public interface ProtectionContainer { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The ProtectionContainer definition stages. */ interface DefinitionStages { /** The first stage of the ProtectionContainer definition. */ interface Blank extends WithParentResource { } + /** The stage of the ProtectionContainer definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -88,6 +90,7 @@ interface WithParentResource { */ WithCreate withExistingReplicationFabric(String resourceName, String resourceGroupName, String fabricName); } + /** * The stage of the ProtectionContainer definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -108,6 +111,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ ProtectionContainer create(Context context); } + /** The stage of the ProtectionContainer definition allowing to specify properties. */ interface WithProperties { /** @@ -119,6 +123,7 @@ interface WithProperties { WithCreate withProperties(CreateProtectionContainerInputProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ProtectionContainerMapping.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ProtectionContainerMapping.java index d6e5e8e2e76b..44621cf682ff 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ProtectionContainerMapping.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ProtectionContainerMapping.java @@ -78,11 +78,13 @@ public interface ProtectionContainerMapping { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The ProtectionContainerMapping definition stages. */ interface DefinitionStages { /** The first stage of the ProtectionContainerMapping definition. */ interface Blank extends WithParentResource { } + /** The stage of the ProtectionContainerMapping definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -97,6 +99,7 @@ interface WithParentResource { WithCreate withExistingReplicationProtectionContainer( String resourceName, String resourceGroupName, String fabricName, String protectionContainerName); } + /** * The stage of the ProtectionContainerMapping definition which contains all the minimum required properties for * the resource to be created, but also allows for any other optional properties to be specified. @@ -117,6 +120,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ ProtectionContainerMapping create(Context context); } + /** The stage of the ProtectionContainerMapping definition allowing to specify properties. */ interface WithProperties { /** @@ -128,6 +132,7 @@ interface WithProperties { WithCreate withProperties(CreateProtectionContainerMappingInputProperties properties); } } + /** * Begins update for the ProtectionContainerMapping resource. * @@ -152,6 +157,7 @@ interface Update extends UpdateStages.WithProperties { */ ProtectionContainerMapping apply(Context context); } + /** The ProtectionContainerMapping update stages. */ interface UpdateStages { /** The stage of the ProtectionContainerMapping update allowing to specify properties. */ @@ -165,6 +171,7 @@ interface WithProperties { Update withProperties(UpdateProtectionContainerMappingInputProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/RecoveryPlan.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/RecoveryPlan.java index d43508d34ad2..663c86131c67 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/RecoveryPlan.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/RecoveryPlan.java @@ -80,11 +80,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The RecoveryPlan definition stages. */ interface DefinitionStages { /** The first stage of the RecoveryPlan definition. */ interface Blank extends WithParentResource { } + /** The stage of the RecoveryPlan definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -96,6 +98,7 @@ interface WithParentResource { */ WithProperties withExistingVault(String resourceName, String resourceGroupName); } + /** The stage of the RecoveryPlan definition allowing to specify properties. */ interface WithProperties { /** @@ -106,6 +109,7 @@ interface WithProperties { */ WithCreate withProperties(CreateRecoveryPlanInputProperties properties); } + /** * The stage of the RecoveryPlan definition which contains all the minimum required properties for the resource * to be created, but also allows for any other optional properties to be specified. @@ -127,6 +131,7 @@ interface WithCreate { RecoveryPlan create(Context context); } } + /** * Begins update for the RecoveryPlan resource. * @@ -151,6 +156,7 @@ interface Update extends UpdateStages.WithProperties { */ RecoveryPlan apply(Context context); } + /** The RecoveryPlan update stages. */ interface UpdateStages { /** The stage of the RecoveryPlan update allowing to specify properties. */ @@ -164,6 +170,7 @@ interface WithProperties { Update withProperties(UpdateRecoveryPlanInputProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/RecoveryServicesProvider.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/RecoveryServicesProvider.java index 722126ee3605..cff58fd601ae 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/RecoveryServicesProvider.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/RecoveryServicesProvider.java @@ -74,11 +74,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The RecoveryServicesProvider definition stages. */ interface DefinitionStages { /** The first stage of the RecoveryServicesProvider definition. */ interface Blank extends WithParentResource { } + /** The stage of the RecoveryServicesProvider definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -92,6 +94,7 @@ interface WithParentResource { WithProperties withExistingReplicationFabric( String resourceName, String resourceGroupName, String fabricName); } + /** The stage of the RecoveryServicesProvider definition allowing to specify properties. */ interface WithProperties { /** @@ -102,6 +105,7 @@ interface WithProperties { */ WithCreate withProperties(AddRecoveryServicesProviderInputProperties properties); } + /** * The stage of the RecoveryServicesProvider definition which contains all the minimum required properties for * the resource to be created, but also allows for any other optional properties to be specified. @@ -123,6 +127,7 @@ interface WithCreate { RecoveryServicesProvider create(Context context); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ReplicationProtectedItem.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ReplicationProtectedItem.java index bd59bcf829ba..af256d75ccad 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ReplicationProtectedItem.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ReplicationProtectedItem.java @@ -78,11 +78,13 @@ public interface ReplicationProtectedItem { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The ReplicationProtectedItem definition stages. */ interface DefinitionStages { /** The first stage of the ReplicationProtectedItem definition. */ interface Blank extends WithParentResource { } + /** The stage of the ReplicationProtectedItem definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -97,6 +99,7 @@ interface WithParentResource { WithCreate withExistingReplicationProtectionContainer( String resourceName, String resourceGroupName, String fabricName, String protectionContainerName); } + /** * The stage of the ReplicationProtectedItem definition which contains all the minimum required properties for * the resource to be created, but also allows for any other optional properties to be specified. @@ -117,6 +120,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ ReplicationProtectedItem create(Context context); } + /** The stage of the ReplicationProtectedItem definition allowing to specify properties. */ interface WithProperties { /** @@ -128,6 +132,7 @@ interface WithProperties { WithCreate withProperties(EnableProtectionInputProperties properties); } } + /** * Begins update for the ReplicationProtectedItem resource. * @@ -152,6 +157,7 @@ interface Update extends UpdateStages.WithProperties { */ ReplicationProtectedItem apply(Context context); } + /** The ReplicationProtectedItem update stages. */ interface UpdateStages { /** The stage of the ReplicationProtectedItem update allowing to specify properties. */ @@ -165,6 +171,7 @@ interface WithProperties { Update withProperties(UpdateReplicationProtectedItemInputProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ReplicationProtectionIntent.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ReplicationProtectionIntent.java index 67c5009a7193..489f7a29c174 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ReplicationProtectionIntent.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/ReplicationProtectionIntent.java @@ -71,11 +71,13 @@ public interface ReplicationProtectionIntent { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The ReplicationProtectionIntent definition stages. */ interface DefinitionStages { /** The first stage of the ReplicationProtectionIntent definition. */ interface Blank extends WithParentResource { } + /** The stage of the ReplicationProtectionIntent definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -87,6 +89,7 @@ interface WithParentResource { */ WithCreate withExistingVault(String resourceName, String resourceGroupName); } + /** * The stage of the ReplicationProtectionIntent definition which contains all the minimum required properties * for the resource to be created, but also allows for any other optional properties to be specified. @@ -107,6 +110,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ ReplicationProtectionIntent create(Context context); } + /** The stage of the ReplicationProtectionIntent definition allowing to specify properties. */ interface WithProperties { /** @@ -118,6 +122,7 @@ interface WithProperties { WithCreate withProperties(CreateProtectionIntentProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/SecurityType.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/SecurityType.java new file mode 100644 index 000000000000..fbe5a338d865 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/SecurityType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The target VM security type. */ +public final class SecurityType extends ExpandableStringEnum { + /** Static value None for SecurityType. */ + public static final SecurityType NONE = fromString("None"); + + /** Static value TrustedLaunch for SecurityType. */ + public static final SecurityType TRUSTED_LAUNCH = fromString("TrustedLaunch"); + + /** Static value ConfidentialVM for SecurityType. */ + public static final SecurityType CONFIDENTIAL_VM = fromString("ConfidentialVM"); + + /** + * Creates a new instance of SecurityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecurityType() { + } + + /** + * Creates or finds a SecurityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityType. + */ + @JsonCreator + public static SecurityType fromString(String name) { + return fromString(name, SecurityType.class); + } + + /** + * Gets known SecurityType values. + * + * @return known SecurityType values. + */ + public static Collection values() { + return values(SecurityType.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/StorageClassificationMapping.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/StorageClassificationMapping.java index ff4b9ac2b8a7..b9ef42556206 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/StorageClassificationMapping.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/StorageClassificationMapping.java @@ -71,11 +71,13 @@ public interface StorageClassificationMapping { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The StorageClassificationMapping definition stages. */ interface DefinitionStages { /** The first stage of the StorageClassificationMapping definition. */ interface Blank extends WithParentResource { } + /** The stage of the StorageClassificationMapping definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -90,6 +92,7 @@ interface WithParentResource { WithCreate withExistingReplicationStorageClassification( String resourceName, String resourceGroupName, String fabricName, String storageClassificationName); } + /** * The stage of the StorageClassificationMapping definition which contains all the minimum required properties * for the resource to be created, but also allows for any other optional properties to be specified. @@ -110,6 +113,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ StorageClassificationMapping create(Context context); } + /** The stage of the StorageClassificationMapping definition allowing to specify properties. */ interface WithProperties { /** @@ -121,6 +125,7 @@ interface WithProperties { WithCreate withProperties(StorageMappingInputProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VCenter.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VCenter.java index c65312172df3..5c74278ae8b9 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VCenter.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VCenter.java @@ -77,11 +77,13 @@ public interface VCenter { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The VCenter definition stages. */ interface DefinitionStages { /** The first stage of the VCenter definition. */ interface Blank extends WithParentResource { } + /** The stage of the VCenter definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -94,6 +96,7 @@ interface WithParentResource { */ WithCreate withExistingReplicationFabric(String resourceName, String resourceGroupName, String fabricName); } + /** * The stage of the VCenter definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. @@ -114,6 +117,7 @@ interface WithCreate extends DefinitionStages.WithProperties { */ VCenter create(Context context); } + /** The stage of the VCenter definition allowing to specify properties. */ interface WithProperties { /** @@ -125,6 +129,7 @@ interface WithProperties { WithCreate withProperties(AddVCenterRequestProperties properties); } } + /** * Begins update for the VCenter resource. * @@ -149,6 +154,7 @@ interface Update extends UpdateStages.WithProperties { */ VCenter apply(Context context); } + /** The VCenter update stages. */ interface UpdateStages { /** The stage of the VCenter update allowing to specify properties. */ @@ -162,6 +168,7 @@ interface WithProperties { Update withProperties(UpdateVCenterRequestProperties properties); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtEnableMigrationInput.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtEnableMigrationInput.java index 487bb378469c..4ade11aa136b 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtEnableMigrationInput.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtEnableMigrationInput.java @@ -120,6 +120,18 @@ public final class VMwareCbtEnableMigrationInput extends EnableMigrationProvider @JsonProperty(value = "targetProximityPlacementGroupId") private String targetProximityPlacementGroupId; + /* + * The confidential VM key vault Id for ADE installation. + */ + @JsonProperty(value = "confidentialVmKeyVaultId") + private String confidentialVmKeyVaultId; + + /* + * The target VM security profile. + */ + @JsonProperty(value = "targetVmSecurityProfile") + private VMwareCbtSecurityProfileProperties targetVmSecurityProfile; + /* * The target boot diagnostics storage account ARM Id. */ @@ -504,6 +516,47 @@ public VMwareCbtEnableMigrationInput withTargetProximityPlacementGroupId(String return this; } + /** + * Get the confidentialVmKeyVaultId property: The confidential VM key vault Id for ADE installation. + * + * @return the confidentialVmKeyVaultId value. + */ + public String confidentialVmKeyVaultId() { + return this.confidentialVmKeyVaultId; + } + + /** + * Set the confidentialVmKeyVaultId property: The confidential VM key vault Id for ADE installation. + * + * @param confidentialVmKeyVaultId the confidentialVmKeyVaultId value to set. + * @return the VMwareCbtEnableMigrationInput object itself. + */ + public VMwareCbtEnableMigrationInput withConfidentialVmKeyVaultId(String confidentialVmKeyVaultId) { + this.confidentialVmKeyVaultId = confidentialVmKeyVaultId; + return this; + } + + /** + * Get the targetVmSecurityProfile property: The target VM security profile. + * + * @return the targetVmSecurityProfile value. + */ + public VMwareCbtSecurityProfileProperties targetVmSecurityProfile() { + return this.targetVmSecurityProfile; + } + + /** + * Set the targetVmSecurityProfile property: The target VM security profile. + * + * @param targetVmSecurityProfile the targetVmSecurityProfile value to set. + * @return the VMwareCbtEnableMigrationInput object itself. + */ + public VMwareCbtEnableMigrationInput withTargetVmSecurityProfile( + VMwareCbtSecurityProfileProperties targetVmSecurityProfile) { + this.targetVmSecurityProfile = targetVmSecurityProfile; + return this; + } + /** * Get the targetBootDiagnosticsStorageAccountId property: The target boot diagnostics storage account ARM Id. * @@ -671,6 +724,9 @@ public void validate() { new IllegalArgumentException( "Missing required property targetNetworkId in model VMwareCbtEnableMigrationInput")); } + if (targetVmSecurityProfile() != null) { + targetVmSecurityProfile().validate(); + } } private static final ClientLogger LOGGER = new ClientLogger(VMwareCbtEnableMigrationInput.class); diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtMigrateInput.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtMigrateInput.java index fa7bfdc745a5..db054a438efb 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtMigrateInput.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtMigrateInput.java @@ -21,6 +21,12 @@ public final class VMwareCbtMigrateInput extends MigrateProviderSpecificInput { @JsonProperty(value = "performShutdown", required = true) private String performShutdown; + /* + * A value indicating the inplace OS Upgrade version. + */ + @JsonProperty(value = "osUpgradeVersion") + private String osUpgradeVersion; + /** Creates an instance of VMwareCbtMigrateInput class. */ public VMwareCbtMigrateInput() { } @@ -45,6 +51,26 @@ public VMwareCbtMigrateInput withPerformShutdown(String performShutdown) { return this; } + /** + * Get the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @return the osUpgradeVersion value. + */ + public String osUpgradeVersion() { + return this.osUpgradeVersion; + } + + /** + * Set the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @param osUpgradeVersion the osUpgradeVersion value to set. + * @return the VMwareCbtMigrateInput object itself. + */ + public VMwareCbtMigrateInput withOsUpgradeVersion(String osUpgradeVersion) { + this.osUpgradeVersion = osUpgradeVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtMigrationDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtMigrationDetails.java index aea6dcbca74e..127811a11ceb 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtMigrationDetails.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtMigrationDetails.java @@ -30,6 +30,12 @@ public final class VMwareCbtMigrationDetails extends MigrationProviderSpecificSe @JsonProperty(value = "osType", access = JsonProperty.Access.WRITE_ONLY) private String osType; + /* + * The name of the OS on the VM. + */ + @JsonProperty(value = "osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + /* * The firmware type. */ @@ -114,6 +120,18 @@ public final class VMwareCbtMigrationDetails extends MigrationProviderSpecificSe @JsonProperty(value = "targetProximityPlacementGroupId") private String targetProximityPlacementGroupId; + /* + * The confidential VM key vault Id for ADE installation. + */ + @JsonProperty(value = "confidentialVmKeyVaultId") + private String confidentialVmKeyVaultId; + + /* + * The target VM security profile. + */ + @JsonProperty(value = "targetVmSecurityProfile") + private VMwareCbtSecurityProfileProperties targetVmSecurityProfile; + /* * The target boot diagnostics storage account ARM Id. */ @@ -200,6 +218,18 @@ public final class VMwareCbtMigrationDetails extends MigrationProviderSpecificSe @JsonProperty(value = "resumeProgressPercentage", access = JsonProperty.Access.WRITE_ONLY) private Integer resumeProgressPercentage; + /* + * The delta sync progress percentage. + */ + @JsonProperty(value = "deltaSyncProgressPercentage", access = JsonProperty.Access.WRITE_ONLY) + private Integer deltaSyncProgressPercentage; + + /* + * A value indicating whether checksum resync cycle is in progress. + */ + @JsonProperty(value = "isCheckSumResyncCycle", access = JsonProperty.Access.WRITE_ONLY) + private String isCheckSumResyncCycle; + /* * The initial seeding retry count. */ @@ -218,6 +248,12 @@ public final class VMwareCbtMigrationDetails extends MigrationProviderSpecificSe @JsonProperty(value = "resumeRetryCount", access = JsonProperty.Access.WRITE_ONLY) private Long resumeRetryCount; + /* + * The delta sync retry count. + */ + @JsonProperty(value = "deltaSyncRetryCount", access = JsonProperty.Access.WRITE_ONLY) + private Long deltaSyncRetryCount; + /* * A value indicating whether resync is required. */ @@ -250,6 +286,30 @@ public final class VMwareCbtMigrationDetails extends MigrationProviderSpecificSe @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map targetDiskTags; + /* + * A value indicating the inplace OS Upgrade version. + */ + @JsonProperty(value = "supportedOSVersions") + private List supportedOSVersions; + + /* + * A value indicating the appliance monitoring details. + */ + @JsonProperty(value = "applianceMonitoringDetails", access = JsonProperty.Access.WRITE_ONLY) + private ApplianceMonitoringDetails applianceMonitoringDetails; + + /* + * A value indicating the gateway operation details. + */ + @JsonProperty(value = "gatewayOperationDetails", access = JsonProperty.Access.WRITE_ONLY) + private GatewayOperationDetails gatewayOperationDetails; + + /* + * A value indicating the SRS operation name. + */ + @JsonProperty(value = "operationName", access = JsonProperty.Access.WRITE_ONLY) + private String operationName; + /** Creates an instance of VMwareCbtMigrationDetails class. */ public VMwareCbtMigrationDetails() { } @@ -272,6 +332,15 @@ public String osType() { return this.osType; } + /** + * Get the osName property: The name of the OS on the VM. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + /** * Get the firmwareType property: The firmware type. * @@ -487,6 +556,47 @@ public VMwareCbtMigrationDetails withTargetProximityPlacementGroupId(String targ return this; } + /** + * Get the confidentialVmKeyVaultId property: The confidential VM key vault Id for ADE installation. + * + * @return the confidentialVmKeyVaultId value. + */ + public String confidentialVmKeyVaultId() { + return this.confidentialVmKeyVaultId; + } + + /** + * Set the confidentialVmKeyVaultId property: The confidential VM key vault Id for ADE installation. + * + * @param confidentialVmKeyVaultId the confidentialVmKeyVaultId value to set. + * @return the VMwareCbtMigrationDetails object itself. + */ + public VMwareCbtMigrationDetails withConfidentialVmKeyVaultId(String confidentialVmKeyVaultId) { + this.confidentialVmKeyVaultId = confidentialVmKeyVaultId; + return this; + } + + /** + * Get the targetVmSecurityProfile property: The target VM security profile. + * + * @return the targetVmSecurityProfile value. + */ + public VMwareCbtSecurityProfileProperties targetVmSecurityProfile() { + return this.targetVmSecurityProfile; + } + + /** + * Set the targetVmSecurityProfile property: The target VM security profile. + * + * @param targetVmSecurityProfile the targetVmSecurityProfile value to set. + * @return the VMwareCbtMigrationDetails object itself. + */ + public VMwareCbtMigrationDetails withTargetVmSecurityProfile( + VMwareCbtSecurityProfileProperties targetVmSecurityProfile) { + this.targetVmSecurityProfile = targetVmSecurityProfile; + return this; + } + /** * Get the targetBootDiagnosticsStorageAccountId property: The target boot diagnostics storage account ARM Id. * @@ -691,6 +801,24 @@ public Integer resumeProgressPercentage() { return this.resumeProgressPercentage; } + /** + * Get the deltaSyncProgressPercentage property: The delta sync progress percentage. + * + * @return the deltaSyncProgressPercentage value. + */ + public Integer deltaSyncProgressPercentage() { + return this.deltaSyncProgressPercentage; + } + + /** + * Get the isCheckSumResyncCycle property: A value indicating whether checksum resync cycle is in progress. + * + * @return the isCheckSumResyncCycle value. + */ + public String isCheckSumResyncCycle() { + return this.isCheckSumResyncCycle; + } + /** * Get the initialSeedingRetryCount property: The initial seeding retry count. * @@ -718,6 +846,15 @@ public Long resumeRetryCount() { return this.resumeRetryCount; } + /** + * Get the deltaSyncRetryCount property: The delta sync retry count. + * + * @return the deltaSyncRetryCount value. + */ + public Long deltaSyncRetryCount() { + return this.deltaSyncRetryCount; + } + /** * Get the resyncRequired property: A value indicating whether resync is required. * @@ -796,6 +933,53 @@ public VMwareCbtMigrationDetails withTargetDiskTags(Map targetDi return this; } + /** + * Get the supportedOSVersions property: A value indicating the inplace OS Upgrade version. + * + * @return the supportedOSVersions value. + */ + public List supportedOSVersions() { + return this.supportedOSVersions; + } + + /** + * Set the supportedOSVersions property: A value indicating the inplace OS Upgrade version. + * + * @param supportedOSVersions the supportedOSVersions value to set. + * @return the VMwareCbtMigrationDetails object itself. + */ + public VMwareCbtMigrationDetails withSupportedOSVersions(List supportedOSVersions) { + this.supportedOSVersions = supportedOSVersions; + return this; + } + + /** + * Get the applianceMonitoringDetails property: A value indicating the appliance monitoring details. + * + * @return the applianceMonitoringDetails value. + */ + public ApplianceMonitoringDetails applianceMonitoringDetails() { + return this.applianceMonitoringDetails; + } + + /** + * Get the gatewayOperationDetails property: A value indicating the gateway operation details. + * + * @return the gatewayOperationDetails value. + */ + public GatewayOperationDetails gatewayOperationDetails() { + return this.gatewayOperationDetails; + } + + /** + * Get the operationName property: A value indicating the SRS operation name. + * + * @return the operationName value. + */ + public String operationName() { + return this.operationName; + } + /** * Validates the instance. * @@ -804,11 +988,20 @@ public VMwareCbtMigrationDetails withTargetDiskTags(Map targetDi @Override public void validate() { super.validate(); + if (targetVmSecurityProfile() != null) { + targetVmSecurityProfile().validate(); + } if (protectedDisks() != null) { protectedDisks().forEach(e -> e.validate()); } if (vmNics() != null) { vmNics().forEach(e -> e.validate()); } + if (applianceMonitoringDetails() != null) { + applianceMonitoringDetails().validate(); + } + if (gatewayOperationDetails() != null) { + gatewayOperationDetails().validate(); + } } } diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtProtectedDiskDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtProtectedDiskDetails.java index 5a28e520637f..84b7145165fa 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtProtectedDiskDetails.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtProtectedDiskDetails.java @@ -94,6 +94,12 @@ public final class VMwareCbtProtectedDiskDetails { @JsonProperty(value = "targetDiskName") private String targetDiskName; + /* + * A value indicating the gateway operation details. + */ + @JsonProperty(value = "gatewayOperationDetails", access = JsonProperty.Access.WRITE_ONLY) + private GatewayOperationDetails gatewayOperationDetails; + /** Creates an instance of VMwareCbtProtectedDiskDetails class. */ public VMwareCbtProtectedDiskDetails() { } @@ -246,11 +252,23 @@ public VMwareCbtProtectedDiskDetails withTargetDiskName(String targetDiskName) { return this; } + /** + * Get the gatewayOperationDetails property: A value indicating the gateway operation details. + * + * @return the gatewayOperationDetails value. + */ + public GatewayOperationDetails gatewayOperationDetails() { + return this.gatewayOperationDetails; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (gatewayOperationDetails() != null) { + gatewayOperationDetails().validate(); + } } } diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtProtectionContainerMappingDetails.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtProtectionContainerMappingDetails.java index eabd230de645..9b855b4f62e7 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtProtectionContainerMappingDetails.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtProtectionContainerMappingDetails.java @@ -4,17 +4,18 @@ package com.azure.resourcemanager.recoveryservicessiterecovery.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; import java.util.Map; /** VMwareCbt provider specific container mapping details. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "instanceType") @JsonTypeName("VMwareCbt") -@Immutable +@Fluent public final class VMwareCbtProtectionContainerMappingDetails extends ProtectionContainerMappingProviderSpecificDetails { /* @@ -60,6 +61,12 @@ public final class VMwareCbtProtectionContainerMappingDetails @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map roleSizeToNicCountMap; + /* + * The SKUs to be excluded. + */ + @JsonProperty(value = "excludedSkus") + private List excludedSkus; + /** Creates an instance of VMwareCbtProtectionContainerMappingDetails class. */ public VMwareCbtProtectionContainerMappingDetails() { } @@ -127,6 +134,26 @@ public Map roleSizeToNicCountMap() { return this.roleSizeToNicCountMap; } + /** + * Get the excludedSkus property: The SKUs to be excluded. + * + * @return the excludedSkus value. + */ + public List excludedSkus() { + return this.excludedSkus; + } + + /** + * Set the excludedSkus property: The SKUs to be excluded. + * + * @param excludedSkus the excludedSkus value to set. + * @return the VMwareCbtProtectionContainerMappingDetails object itself. + */ + public VMwareCbtProtectionContainerMappingDetails withExcludedSkus(List excludedSkus) { + this.excludedSkus = excludedSkus; + return this; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtSecurityProfileProperties.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtSecurityProfileProperties.java new file mode 100644 index 000000000000..0b6b55d116d9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtSecurityProfileProperties.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** VMwareCbt security profile input. */ +@Fluent +public final class VMwareCbtSecurityProfileProperties { + /* + * The target VM security type. + */ + @JsonProperty(value = "targetVmSecurityType") + private SecurityType targetVmSecurityType; + + /* + * A value indicating whether secure boot to be enabled. + */ + @JsonProperty(value = "isTargetVmSecureBootEnabled") + private String isTargetVmSecureBootEnabled; + + /* + * A value indicating whether trusted platform module to be enabled. + */ + @JsonProperty(value = "isTargetVmTpmEnabled") + private String isTargetVmTpmEnabled; + + /* + * A value indicating whether integrity monitoring to be enabled. + */ + @JsonProperty(value = "isTargetVmIntegrityMonitoringEnabled") + private String isTargetVmIntegrityMonitoringEnabled; + + /* + * A value indicating whether confidential compute encryption to be enabled. + */ + @JsonProperty(value = "isTargetVmConfidentialEncryptionEnabled") + private String isTargetVmConfidentialEncryptionEnabled; + + /** Creates an instance of VMwareCbtSecurityProfileProperties class. */ + public VMwareCbtSecurityProfileProperties() { + } + + /** + * Get the targetVmSecurityType property: The target VM security type. + * + * @return the targetVmSecurityType value. + */ + public SecurityType targetVmSecurityType() { + return this.targetVmSecurityType; + } + + /** + * Set the targetVmSecurityType property: The target VM security type. + * + * @param targetVmSecurityType the targetVmSecurityType value to set. + * @return the VMwareCbtSecurityProfileProperties object itself. + */ + public VMwareCbtSecurityProfileProperties withTargetVmSecurityType(SecurityType targetVmSecurityType) { + this.targetVmSecurityType = targetVmSecurityType; + return this; + } + + /** + * Get the isTargetVmSecureBootEnabled property: A value indicating whether secure boot to be enabled. + * + * @return the isTargetVmSecureBootEnabled value. + */ + public String isTargetVmSecureBootEnabled() { + return this.isTargetVmSecureBootEnabled; + } + + /** + * Set the isTargetVmSecureBootEnabled property: A value indicating whether secure boot to be enabled. + * + * @param isTargetVmSecureBootEnabled the isTargetVmSecureBootEnabled value to set. + * @return the VMwareCbtSecurityProfileProperties object itself. + */ + public VMwareCbtSecurityProfileProperties withIsTargetVmSecureBootEnabled(String isTargetVmSecureBootEnabled) { + this.isTargetVmSecureBootEnabled = isTargetVmSecureBootEnabled; + return this; + } + + /** + * Get the isTargetVmTpmEnabled property: A value indicating whether trusted platform module to be enabled. + * + * @return the isTargetVmTpmEnabled value. + */ + public String isTargetVmTpmEnabled() { + return this.isTargetVmTpmEnabled; + } + + /** + * Set the isTargetVmTpmEnabled property: A value indicating whether trusted platform module to be enabled. + * + * @param isTargetVmTpmEnabled the isTargetVmTpmEnabled value to set. + * @return the VMwareCbtSecurityProfileProperties object itself. + */ + public VMwareCbtSecurityProfileProperties withIsTargetVmTpmEnabled(String isTargetVmTpmEnabled) { + this.isTargetVmTpmEnabled = isTargetVmTpmEnabled; + return this; + } + + /** + * Get the isTargetVmIntegrityMonitoringEnabled property: A value indicating whether integrity monitoring to be + * enabled. + * + * @return the isTargetVmIntegrityMonitoringEnabled value. + */ + public String isTargetVmIntegrityMonitoringEnabled() { + return this.isTargetVmIntegrityMonitoringEnabled; + } + + /** + * Set the isTargetVmIntegrityMonitoringEnabled property: A value indicating whether integrity monitoring to be + * enabled. + * + * @param isTargetVmIntegrityMonitoringEnabled the isTargetVmIntegrityMonitoringEnabled value to set. + * @return the VMwareCbtSecurityProfileProperties object itself. + */ + public VMwareCbtSecurityProfileProperties withIsTargetVmIntegrityMonitoringEnabled( + String isTargetVmIntegrityMonitoringEnabled) { + this.isTargetVmIntegrityMonitoringEnabled = isTargetVmIntegrityMonitoringEnabled; + return this; + } + + /** + * Get the isTargetVmConfidentialEncryptionEnabled property: A value indicating whether confidential compute + * encryption to be enabled. + * + * @return the isTargetVmConfidentialEncryptionEnabled value. + */ + public String isTargetVmConfidentialEncryptionEnabled() { + return this.isTargetVmConfidentialEncryptionEnabled; + } + + /** + * Set the isTargetVmConfidentialEncryptionEnabled property: A value indicating whether confidential compute + * encryption to be enabled. + * + * @param isTargetVmConfidentialEncryptionEnabled the isTargetVmConfidentialEncryptionEnabled value to set. + * @return the VMwareCbtSecurityProfileProperties object itself. + */ + public VMwareCbtSecurityProfileProperties withIsTargetVmConfidentialEncryptionEnabled( + String isTargetVmConfidentialEncryptionEnabled) { + this.isTargetVmConfidentialEncryptionEnabled = isTargetVmConfidentialEncryptionEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtTestMigrateInput.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtTestMigrateInput.java index a20f4a564195..1afdbc9fa826 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtTestMigrateInput.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VMwareCbtTestMigrateInput.java @@ -34,6 +34,12 @@ public final class VMwareCbtTestMigrateInput extends TestMigrateProviderSpecific @JsonProperty(value = "vmNics") private List vmNics; + /* + * A value indicating the inplace OS Upgrade version. + */ + @JsonProperty(value = "osUpgradeVersion") + private String osUpgradeVersion; + /** Creates an instance of VMwareCbtTestMigrateInput class. */ public VMwareCbtTestMigrateInput() { } @@ -98,6 +104,26 @@ public VMwareCbtTestMigrateInput withVmNics(List vmNics) { return this; } + /** + * Get the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @return the osUpgradeVersion value. + */ + public String osUpgradeVersion() { + return this.osUpgradeVersion; + } + + /** + * Set the osUpgradeVersion property: A value indicating the inplace OS Upgrade version. + * + * @param osUpgradeVersion the osUpgradeVersion value to set. + * @return the VMwareCbtTestMigrateInput object itself. + */ + public VMwareCbtTestMigrateInput withOsUpgradeVersion(String osUpgradeVersion) { + this.osUpgradeVersion = osUpgradeVersion; + return this; + } + /** * Validates the instance. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VaultSetting.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VaultSetting.java index b75b2170c4bf..900418d4c5e7 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VaultSetting.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/main/java/com/azure/resourcemanager/recoveryservicessiterecovery/models/VaultSetting.java @@ -73,11 +73,13 @@ interface Definition DefinitionStages.WithProperties, DefinitionStages.WithCreate { } + /** The VaultSetting definition stages. */ interface DefinitionStages { /** The first stage of the VaultSetting definition. */ interface Blank extends WithParentResource { } + /** The stage of the VaultSetting definition allowing to specify parent resource. */ interface WithParentResource { /** @@ -89,6 +91,7 @@ interface WithParentResource { */ WithProperties withExistingVault(String resourceName, String resourceGroupName); } + /** The stage of the VaultSetting definition allowing to specify properties. */ interface WithProperties { /** @@ -99,6 +102,7 @@ interface WithProperties { */ WithCreate withProperties(VaultSettingCreationInputProperties properties); } + /** * The stage of the VaultSetting definition which contains all the minimum required properties for the resource * to be created, but also allows for any other optional properties to be specified. @@ -120,6 +124,7 @@ interface WithCreate { VaultSetting create(Context context); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsGetSamples.java index b931635bc243..2b345644eabd 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for MigrationRecoveryPoints Get. */ public final class MigrationRecoveryPointsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/MigrationRecoveryPoints_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/MigrationRecoveryPoints_Get.json */ /** * Sample code: Gets a recovery point for a migration item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsListByReplicationMigrati.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsListByReplicationMigrati.java index c76f7413cb2e..96f2bd192ec7 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsListByReplicationMigrati.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsListByReplicationMigrati.java @@ -7,7 +7,7 @@ /** Samples for MigrationRecoveryPoints ListByReplicationMigrationItems. */ public final class MigrationRecoveryPointsListByReplicationMigrati { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/MigrationRecoveryPoints_ListByReplicationMigrationItems.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/MigrationRecoveryPoints_ListByReplicationMigrationItems.json */ /** * Sample code: Gets the recovery points for a migration item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsListByResourceGroupSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsListByResourceGroupSamples.java index 241e6a96139b..1d551be0850e 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsListByResourceGroupSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Operations ListByResourceGroup. */ public final class OperationsListByResourceGroupSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/Operations_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/Operations_List.json */ /** * Sample code: Returns the list of available operations. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsGetSamples.java index ea50f0218416..2a88a3e670de 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for RecoveryPoints Get. */ public final class RecoveryPointsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/RecoveryPoints_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/RecoveryPoints_Get.json */ /** * Sample code: Gets a recovery point. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsListByReplicationProtectedItemsSa.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsListByReplicationProtectedItemsSa.java index 8ecbda66c2f3..e6126ef10b03 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsListByReplicationProtectedItemsSa.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsListByReplicationProtectedItemsSa.java @@ -7,7 +7,7 @@ /** Samples for RecoveryPoints ListByReplicationProtectedItems. */ public final class RecoveryPointsListByReplicationProtectedItemsSa { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/RecoveryPoints_ListByReplicationProtectedItems.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/RecoveryPoints_ListByReplicationProtectedItems.json */ /** * Sample code: Gets the list of recovery points for a replication protected item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsCreateSamples.java index e52ea69e0a73..30af43274ab8 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsCreateSamples.java @@ -10,7 +10,7 @@ /** Samples for ReplicationAlertSettings Create. */ public final class ReplicationAlertSettingsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_Create.json */ /** * Sample code: Configures email notifications for this vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsGetSamples.java index 493e630f400b..335075d34533 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationAlertSettings Get. */ public final class ReplicationAlertSettingsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_Get.json */ /** * Sample code: Gets an email notification(alert) configuration. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsListSamples.java index 8240be41fd94..1eb2c4ef7aec 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationAlertSettings List. */ public final class ReplicationAlertSettingsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAlertSettings_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAlertSettings_List.json */ /** * Sample code: Gets the list of configured email notification(alert) configurations. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancesListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancesListSamples.java index 6dd4621bcca9..c619e757d32a 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancesListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancesListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationAppliances List. */ public final class ReplicationAppliancesListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationAppliances_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationAppliances_List.json */ /** * Sample code: Gets the list of appliances. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEligibilityResultsOperationGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEligibilityResultsOperationGetSamples.java index 03092d331310..3e765cacdee4 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEligibilityResultsOperationGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEligibilityResultsOperationGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationEligibilityResultsOperation Get. */ public final class ReplicationEligibilityResultsOperationGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEligibilityResults_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEligibilityResults_Get.json */ /** * Sample code: Gets the validation errors in case the VM is unsuitable for protection. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEligibilityResultsOperationListSampl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEligibilityResultsOperationListSampl.java index 0172ae1b5ff9..f19e7414b179 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEligibilityResultsOperationListSampl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEligibilityResultsOperationListSampl.java @@ -7,7 +7,7 @@ /** Samples for ReplicationEligibilityResultsOperation List. */ public final class ReplicationEligibilityResultsOperationListSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEligibilityResults_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEligibilityResults_List.json */ /** * Sample code: Gets the validation errors in case the VM is unsuitable for protection. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEventsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEventsGetSamples.java index c9d2b5ba2903..36ab3903cb7d 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEventsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEventsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationEvents Get. */ public final class ReplicationEventsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEvents_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEvents_Get.json */ /** * Sample code: Get the details of an Azure Site recovery event. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEventsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEventsListSamples.java index f24bc5668496..a5a0616fd945 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEventsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationEventsListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationEvents List. */ public final class ReplicationEventsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationEvents_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationEvents_List.json */ /** * Sample code: Gets the list of Azure Site Recovery events. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsCheckConsistencySamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsCheckConsistencySamples.java index edaf628b6c19..fd8b8804e73d 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsCheckConsistencySamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsCheckConsistencySamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationFabrics CheckConsistency. */ public final class ReplicationFabricsCheckConsistencySamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_CheckConsistency.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_CheckConsistency.json */ /** * Sample code: Checks the consistency of the ASR fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsCreateSamples.java index 5539f21e554f..1648d9549ecf 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsCreateSamples.java @@ -10,7 +10,7 @@ /** Samples for ReplicationFabrics Create. */ public final class ReplicationFabricsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Create.json */ /** * Sample code: Creates an Azure Site Recovery fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsDeleteSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsDeleteSamples.java index e4851f458772..f1093d0c5b4e 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsDeleteSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationFabrics Delete. */ public final class ReplicationFabricsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Delete.json */ /** * Sample code: Deletes the site. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsGetSamples.java index b45e19b7cd80..e36ccc51972b 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationFabrics Get. */ public final class ReplicationFabricsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Get.json */ /** * Sample code: Gets the details of an ASR fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsListSamples.java index ca6f3126d447..5c76aea9bc73 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationFabrics List. */ public final class ReplicationFabricsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_List.json */ /** * Sample code: Gets the list of ASR fabrics. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsMigrateToAadSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsMigrateToAadSamples.java index c080cb968449..d679fa7fd0e3 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsMigrateToAadSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsMigrateToAadSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationFabrics MigrateToAad. */ public final class ReplicationFabricsMigrateToAadSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_MigrateToAad.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_MigrateToAad.json */ /** * Sample code: Migrates the site to AAD. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsPurgeSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsPurgeSamples.java index 6935cb59e170..95742312779a 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsPurgeSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsPurgeSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationFabrics Purge. */ public final class ReplicationFabricsPurgeSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_Purge.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_Purge.json */ /** * Sample code: Purges the site. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsReassociateGatewaySamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsReassociateGatewaySamples.java index e910ce3e178e..b87572cc1d12 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsReassociateGatewaySamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsReassociateGatewaySamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationFabrics ReassociateGateway. */ public final class ReplicationFabricsReassociateGatewaySamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_ReassociateGateway.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_ReassociateGateway.json */ /** * Sample code: Perform failover of the process server. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsRenewCertificateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsRenewCertificateSamples.java index bdaf5c9936d7..1946e161c78b 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsRenewCertificateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationFabricsRenewCertificateSamples.java @@ -10,7 +10,7 @@ /** Samples for ReplicationFabrics RenewCertificate. */ public final class ReplicationFabricsRenewCertificateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationFabrics_RenewCertificate.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationFabrics_RenewCertificate.json */ /** * Sample code: Renews certificate for the fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsCancelSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsCancelSamples.java index 2952941e3526..33c00b26aa42 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsCancelSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsCancelSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationJobs Cancel. */ public final class ReplicationJobsCancelSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Cancel.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Cancel.json */ /** * Sample code: Cancels the specified job. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsExportSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsExportSamples.java index 2a92966d7e3b..06d95a58df75 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsExportSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsExportSamples.java @@ -9,7 +9,7 @@ /** Samples for ReplicationJobs Export. */ public final class ReplicationJobsExportSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Export.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Export.json */ /** * Sample code: Exports the details of the Azure Site Recovery jobs of the vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsGetSamples.java index f87f8f404c52..c1d6bf96dec7 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationJobs Get. */ public final class ReplicationJobsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Get.json */ /** * Sample code: Gets the job details. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsListSamples.java index cba2f0ea82e8..563c5a0997ee 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationJobs List. */ public final class ReplicationJobsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_List.json */ /** * Sample code: Gets the list of jobs. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsRestartSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsRestartSamples.java index 75f555511096..94d0742ea969 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsRestartSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsRestartSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationJobs Restart. */ public final class ReplicationJobsRestartSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Restart.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Restart.json */ /** * Sample code: Restarts the specified job. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsResumeSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsResumeSamples.java index 7e5fb9e2c9c6..32d98ae9694b 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsResumeSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationJobsResumeSamples.java @@ -10,7 +10,7 @@ /** Samples for ReplicationJobs Resume. */ public final class ReplicationJobsResumeSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationJobs_Resume.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationJobs_Resume.json */ /** * Sample code: Resumes the specified job. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksGetSamples.java index 598823500b7f..3acbe2aeaa03 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationLogicalNetworks Get. */ public final class ReplicationLogicalNetworksGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationLogicalNetworks_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationLogicalNetworks_Get.json */ /** * Sample code: Gets a logical network with specified server id and logical network name. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksListByReplicationFabr.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksListByReplicationFabr.java index 6f25c15b9c56..1728b0e79826 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksListByReplicationFabr.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksListByReplicationFabr.java @@ -7,7 +7,7 @@ /** Samples for ReplicationLogicalNetworks ListByReplicationFabrics. */ public final class ReplicationLogicalNetworksListByReplicationFabr { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationLogicalNetworks_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationLogicalNetworks_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of logical networks under a fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsCreateSamples.java index a6bdf52b86d8..17f651aa54b6 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsCreateSamples.java @@ -12,7 +12,7 @@ /** Samples for ReplicationMigrationItems Create. */ public final class ReplicationMigrationItemsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Create.json */ /** * Sample code: Enables migration. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsDeleteSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsDeleteSamples.java index 9a509db3b85d..2a7b85971a31 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsDeleteSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationMigrationItems Delete. */ public final class ReplicationMigrationItemsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Delete.json */ /** * Sample code: Delete the migration item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsGetSamples.java index b78c7d545207..782170ee0adc 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationMigrationItems Get. */ public final class ReplicationMigrationItemsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Get.json */ /** * Sample code: Gets the details of a migration item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsListByReplicationProte.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsListByReplicationProte.java index 745c22980866..4dfc35aa9708 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsListByReplicationProte.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsListByReplicationProte.java @@ -7,7 +7,7 @@ /** Samples for ReplicationMigrationItems ListByReplicationProtectionContainers. */ public final class ReplicationMigrationItemsListByReplicationProte { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_ListByReplicationProtectionContainers.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_ListByReplicationProtectionContainers.json */ /** * Sample code: Gets the list of migration items in the protection container. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsListSamples.java index 251430516e7c..68884e6cbc66 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationMigrationItems List. */ public final class ReplicationMigrationItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_List.json */ /** * Sample code: Gets the list of migration items in the vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsMigrateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsMigrateSamples.java index 9abbdaefa83d..32d8a6177255 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsMigrateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsMigrateSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationMigrationItems Migrate. */ public final class ReplicationMigrationItemsMigrateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Migrate.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Migrate.json */ /** * Sample code: Migrate item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsPauseReplicationSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsPauseReplicationSamples.java index 59946e780e32..10610d3e55aa 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsPauseReplicationSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsPauseReplicationSamples.java @@ -10,7 +10,7 @@ /** Samples for ReplicationMigrationItems PauseReplication. */ public final class ReplicationMigrationItemsPauseReplicationSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_PauseReplication.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_PauseReplication.json */ /** * Sample code: Pause replication. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsResumeReplicationSampl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsResumeReplicationSampl.java index e77ae45ba128..4f91464a737d 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsResumeReplicationSampl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsResumeReplicationSampl.java @@ -11,7 +11,7 @@ /** Samples for ReplicationMigrationItems ResumeReplication. */ public final class ReplicationMigrationItemsResumeReplicationSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_ResumeReplication.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_ResumeReplication.json */ /** * Sample code: Resume replication. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsResyncSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsResyncSamples.java index bde8f923d1f4..116de21e7261 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsResyncSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsResyncSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationMigrationItems Resync. */ public final class ReplicationMigrationItemsResyncSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Resync.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Resync.json */ /** * Sample code: Resynchronizes replication. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsTestMigrateCleanupSamp.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsTestMigrateCleanupSamp.java index 28eb313f496a..63d5bb38c3a2 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsTestMigrateCleanupSamp.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsTestMigrateCleanupSamp.java @@ -10,7 +10,7 @@ /** Samples for ReplicationMigrationItems TestMigrateCleanup. */ public final class ReplicationMigrationItemsTestMigrateCleanupSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_TestMigrateCleanup.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_TestMigrateCleanup.json */ /** * Sample code: Test migrate cleanup. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsTestMigrateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsTestMigrateSamples.java index 74f80f1114be..fc86f550026a 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsTestMigrateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsTestMigrateSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationMigrationItems TestMigrate. */ public final class ReplicationMigrationItemsTestMigrateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_TestMigrate.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_TestMigrate.json */ /** * Sample code: Test migrate item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsUpdateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsUpdateSamples.java index 66b89ac643a2..43a11bd9dccc 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsUpdateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationMigrationItemsUpdateSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationMigrationItems Update. */ public final class ReplicationMigrationItemsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationMigrationItems_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationMigrationItems_Update.json */ /** * Sample code: Updates migration item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsCreateSamples.java index bd69152b397e..0415780fc2f2 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsCreateSamples.java @@ -10,7 +10,7 @@ /** Samples for ReplicationNetworkMappings Create. */ public final class ReplicationNetworkMappingsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Create.json */ /** * Sample code: Creates network mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsDeleteSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsDeleteSamples.java index 292b486d2e24..d13daf899a25 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsDeleteSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationNetworkMappings Delete. */ public final class ReplicationNetworkMappingsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Delete.json */ /** * Sample code: Delete network mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsGetSamples.java index c7ebcf4cfd86..7b5bb0c46df7 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationNetworkMappings Get. */ public final class ReplicationNetworkMappingsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Get.json */ /** * Sample code: Gets network mapping by name. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListByReplicationNetw.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListByReplicationNetw.java index d93d55512b96..464013778143 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListByReplicationNetw.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListByReplicationNetw.java @@ -7,7 +7,7 @@ /** Samples for ReplicationNetworkMappings ListByReplicationNetworks. */ public final class ReplicationNetworkMappingsListByReplicationNetw { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_ListByReplicationNetworks.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_ListByReplicationNetworks.json */ /** * Sample code: Gets all the network mappings under a network. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListSamples.java index 05bf95febc44..4a952d713425 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationNetworkMappings List. */ public final class ReplicationNetworkMappingsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_List.json */ /** * Sample code: Gets all the network mappings under a vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsUpdateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsUpdateSamples.java index cae10aaf54cd..8b01330b2b54 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsUpdateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsUpdateSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationNetworkMappings Update. */ public final class ReplicationNetworkMappingsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworkMappings_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworkMappings_Update.json */ /** * Sample code: Updates network mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksGetSamples.java index 33482928e17c..42f70ef3afc3 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationNetworks Get. */ public final class ReplicationNetworksGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_Get.json */ /** * Sample code: Gets a network with specified server id and network name. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListByReplicationFabricsSamp.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListByReplicationFabricsSamp.java index f0ca4e8cb778..0d410132ad60 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListByReplicationFabricsSamp.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListByReplicationFabricsSamp.java @@ -7,7 +7,7 @@ /** Samples for ReplicationNetworks ListByReplicationFabrics. */ public final class ReplicationNetworksListByReplicationFabricsSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of networks under a fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListSamples.java index e25e5be35917..0a142e61fd5f 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationNetworks List. */ public final class ReplicationNetworksListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationNetworks_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationNetworks_List.json */ /** * Sample code: Gets the list of networks. View-only API. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesCreateSamples.java index 8f431509e29f..1c41f9e57945 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesCreateSamples.java @@ -10,7 +10,7 @@ /** Samples for ReplicationPolicies Create. */ public final class ReplicationPoliciesCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Create.json */ /** * Sample code: Creates the policy. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesDeleteSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesDeleteSamples.java index 574625833d9a..2e988ec73999 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesDeleteSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationPolicies Delete. */ public final class ReplicationPoliciesDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Delete.json */ /** * Sample code: Delete the policy. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesGetSamples.java index d18c4271d378..d2eaeee1cbd4 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationPolicies Get. */ public final class ReplicationPoliciesGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Get.json */ /** * Sample code: Gets the requested policy. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesListSamples.java index 72dd336d18ad..4d2aa03f46b6 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationPolicies List. */ public final class ReplicationPoliciesListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_List.json */ /** * Sample code: Gets the list of replication policies. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesUpdateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesUpdateSamples.java index 2a32d6464762..3a424199b438 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesUpdateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesUpdateSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationPolicies Update. */ public final class ReplicationPoliciesUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationPolicies_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationPolicies_Update.json */ /** * Sample code: Updates the policy. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsGetSamples.java index 0748d0907d99..9f3e2225a1ce 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectableItems Get. */ public final class ReplicationProtectableItemsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectableItems_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectableItems_Get.json */ /** * Sample code: Gets the details of a protectable item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsListByReplicationPro.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsListByReplicationPro.java index c2a335867055..49d139f2e1ea 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsListByReplicationPro.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsListByReplicationPro.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectableItems ListByReplicationProtectionContainers. */ public final class ReplicationProtectableItemsListByReplicationPro { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectableItems_ListByReplicationProtectionContainers.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectableItems_ListByReplicationProtectionContainers.json */ /** * Sample code: Gets the list of protectable items. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsAddDisksSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsAddDisksSamples.java index 788bf72c7c68..28cf1cf2cf8c 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsAddDisksSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsAddDisksSamples.java @@ -13,7 +13,7 @@ /** Samples for ReplicationProtectedItems AddDisks. */ public final class ReplicationProtectedItemsAddDisksSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_AddDisks.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_AddDisks.json */ /** * Sample code: Add disk(s) for protection. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsApplyRecoveryPointSamp.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsApplyRecoveryPointSamp.java index 4bc54653fd22..eaab00b2bf30 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsApplyRecoveryPointSamp.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsApplyRecoveryPointSamp.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectedItems ApplyRecoveryPoint. */ public final class ReplicationProtectedItemsApplyRecoveryPointSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ApplyRecoveryPoint.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_ApplyRecoveryPoint.json */ /** * Sample code: Change or apply recovery point. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsCreateSamples.java index 5c0d62ba4f6e..5c884ceb2e98 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsCreateSamples.java @@ -10,7 +10,7 @@ /** Samples for ReplicationProtectedItems Create. */ public final class ReplicationProtectedItemsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Create.json */ /** * Sample code: Enables protection. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsDeleteSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsDeleteSamples.java index f77d396fdbdd..12b229c85c6b 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsDeleteSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsDeleteSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectedItems Delete. */ public final class ReplicationProtectedItemsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Delete.json */ /** * Sample code: Disables protection. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsFailoverCancelSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsFailoverCancelSamples.java index 10c368851dc0..50705a660eee 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsFailoverCancelSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsFailoverCancelSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectedItems FailoverCancel. */ public final class ReplicationProtectedItemsFailoverCancelSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_FailoverCancel.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_FailoverCancel.json */ /** * Sample code: Execute cancel failover. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsFailoverCommitSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsFailoverCommitSamples.java index 171039cf07ef..ca1a187826a7 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsFailoverCommitSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsFailoverCommitSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectedItems FailoverCommit. */ public final class ReplicationProtectedItemsFailoverCommitSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_FailoverCommit.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_FailoverCommit.json */ /** * Sample code: Execute commit failover. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsGetSamples.java index 8d700a8cc6d1..c723bf435f9c 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectedItems Get. */ public final class ReplicationProtectedItemsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Get.json */ /** * Sample code: Gets the details of a Replication protected item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsListByReplicationProte.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsListByReplicationProte.java index 04f3f79e7e58..0f675352865d 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsListByReplicationProte.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsListByReplicationProte.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectedItems ListByReplicationProtectionContainers. */ public final class ReplicationProtectedItemsListByReplicationProte { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ListByReplicationProtectionContainers.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_ListByReplicationProtectionContainers.json */ /** * Sample code: Gets the list of Replication protected items. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsListSamples.java index e33041cf37e6..207367cf1c36 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectedItems List. */ public final class ReplicationProtectedItemsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_List.json */ /** * Sample code: Gets the list of replication protected items. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsPlannedFailoverSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsPlannedFailoverSamples.java index fde14a1d9dd7..c8c6e0717f31 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsPlannedFailoverSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsPlannedFailoverSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectedItems PlannedFailover. */ public final class ReplicationProtectedItemsPlannedFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_PlannedFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_PlannedFailover.json */ /** * Sample code: Execute planned failover. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsPurgeSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsPurgeSamples.java index 7a71e3c4a975..550e0ad9d6dc 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsPurgeSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsPurgeSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectedItems Purge. */ public final class ReplicationProtectedItemsPurgeSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Purge.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Purge.json */ /** * Sample code: Purges protection. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsRemoveDisksSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsRemoveDisksSamples.java index ea35524a9921..0cf9556012fd 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsRemoveDisksSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsRemoveDisksSamples.java @@ -12,7 +12,7 @@ /** Samples for ReplicationProtectedItems RemoveDisks. */ public final class ReplicationProtectedItemsRemoveDisksSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_RemoveDisks.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_RemoveDisks.json */ /** * Sample code: Removes disk(s). diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsRepairReplicationSampl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsRepairReplicationSampl.java index bf7b21e62c0f..9163c488c31e 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsRepairReplicationSampl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsRepairReplicationSampl.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectedItems RepairReplication. */ public final class ReplicationProtectedItemsRepairReplicationSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_RepairReplication.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_RepairReplication.json */ /** * Sample code: Resynchronize or repair replication. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsReprotectSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsReprotectSamples.java index e8e58ae031dd..f6eb1e105175 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsReprotectSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsReprotectSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectedItems Reprotect. */ public final class ReplicationProtectedItemsReprotectSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Reprotect.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Reprotect.json */ /** * Sample code: Execute Reverse Replication\Reprotect. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsResolveHealthErrorsSam.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsResolveHealthErrorsSam.java index 89cf5838e939..59e28d3861fa 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsResolveHealthErrorsSam.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsResolveHealthErrorsSam.java @@ -12,7 +12,7 @@ /** Samples for ReplicationProtectedItems ResolveHealthErrors. */ public final class ReplicationProtectedItemsResolveHealthErrorsSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_ResolveHealthErrors.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_ResolveHealthErrors.json */ /** * Sample code: Resolve health errors. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsSwitchProviderSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsSwitchProviderSamples.java index d674f73dede5..687d8c6b7961 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsSwitchProviderSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsSwitchProviderSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectedItems SwitchProvider. */ public final class ReplicationProtectedItemsSwitchProviderSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_SwitchProvider.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_SwitchProvider.json */ /** * Sample code: Execute switch provider. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsTestFailoverCleanupSam.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsTestFailoverCleanupSam.java index d5ee574c843b..6fe0b40c6223 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsTestFailoverCleanupSam.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsTestFailoverCleanupSam.java @@ -10,7 +10,7 @@ /** Samples for ReplicationProtectedItems TestFailoverCleanup. */ public final class ReplicationProtectedItemsTestFailoverCleanupSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_TestFailoverCleanup.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_TestFailoverCleanup.json */ /** * Sample code: Execute test failover cleanup. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsTestFailoverSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsTestFailoverSamples.java index 2ecdc11a1e41..bcee75838d72 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsTestFailoverSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsTestFailoverSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectedItems TestFailover. */ public final class ReplicationProtectedItemsTestFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_TestFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_TestFailover.json */ /** * Sample code: Execute test failover. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUnplannedFailoverSampl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUnplannedFailoverSampl.java index f50856b4867c..0e313d486a17 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUnplannedFailoverSampl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUnplannedFailoverSampl.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectedItems UnplannedFailover. */ public final class ReplicationProtectedItemsUnplannedFailoverSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UnplannedFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_UnplannedFailover.json */ /** * Sample code: Execute unplanned failover. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateApplianceSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateApplianceSamples.java index 3da314bbd0d4..db11681350ee 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateApplianceSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateApplianceSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectedItems UpdateAppliance. */ public final class ReplicationProtectedItemsUpdateApplianceSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UpdateAppliance.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_UpdateAppliance.json */ /** * Sample code: Updates appliance for replication protected Item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateMobilityServiceS.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateMobilityServiceS.java index 58dac1a806ee..5858cde5684c 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateMobilityServiceS.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateMobilityServiceS.java @@ -10,7 +10,7 @@ /** Samples for ReplicationProtectedItems UpdateMobilityService. */ public final class ReplicationProtectedItemsUpdateMobilityServiceS { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_UpdateMobilityService.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_UpdateMobilityService.json */ /** * Sample code: Update the mobility service on a protected item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateSamples.java index 3d8ef3bdfd21..2dd5a3c35c07 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectedItemsUpdateSamples.java @@ -15,7 +15,7 @@ /** Samples for ReplicationProtectedItems Update. */ public final class ReplicationProtectedItemsUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectedItems_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectedItems_Update.json */ /** * Sample code: Updates the replication protected Item settings. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsCreateSam.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsCreateSam.java index f2a37ac40bc7..6b097836e317 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsCreateSam.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsCreateSam.java @@ -10,7 +10,7 @@ /** Samples for ReplicationProtectionContainerMappings Create. */ public final class ReplicationProtectionContainerMappingsCreateSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Create.json */ /** * Sample code: Create protection container mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsDeleteSam.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsDeleteSam.java index 3f9b1b9c568b..033db715afda 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsDeleteSam.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsDeleteSam.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectionContainerMappings Delete. */ public final class ReplicationProtectionContainerMappingsDeleteSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Delete.json */ /** * Sample code: Remove protection container mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsGetSamples.java index 4a0a77635dba..fa5ef1bc08e0 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionContainerMappings Get. */ public final class ReplicationProtectionContainerMappingsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Get.json */ /** * Sample code: Gets a protection container mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsListByRep.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsListByRep.java index 26168f0f1b74..86961b3c609c 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsListByRep.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsListByRep.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionContainerMappings ListByReplicationProtectionContainers. */ public final class ReplicationProtectionContainerMappingsListByRep { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_ListByReplicationProtectionContainers.json */ /** * Sample code: Gets the list of protection container mappings for a protection container. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsListSampl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsListSampl.java index 9ed725d4d673..35f297d07fae 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsListSampl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsListSampl.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionContainerMappings List. */ public final class ReplicationProtectionContainerMappingsListSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_List.json */ /** * Sample code: Gets the list of all protection container mappings in a vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsPurgeSamp.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsPurgeSamp.java index 56abc8f6544f..eb2c56682c7c 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsPurgeSamp.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsPurgeSamp.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionContainerMappings Purge. */ public final class ReplicationProtectionContainerMappingsPurgeSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Purge.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Purge.json */ /** * Sample code: Purge protection container mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsUpdateSam.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsUpdateSam.java index b3274d5fd591..043400117ab9 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsUpdateSam.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainerMappingsUpdateSam.java @@ -12,7 +12,7 @@ /** Samples for ReplicationProtectionContainerMappings Update. */ public final class ReplicationProtectionContainerMappingsUpdateSam { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainerMappings_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainerMappings_Update.json */ /** * Sample code: Update protection container mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersCreateSamples.java index 49174fb5eab1..3035ba068284 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersCreateSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectionContainers Create. */ public final class ReplicationProtectionContainersCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Create.json */ /** * Sample code: Create a protection container. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersDeleteSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersDeleteSamples.java index d705b5d3299a..bef84791bd83 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersDeleteSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionContainers Delete. */ public final class ReplicationProtectionContainersDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Delete.json */ /** * Sample code: Removes a protection container. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersDiscoverProtecta.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersDiscoverProtecta.java index 9b2239ba419d..71f8bbd8155b 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersDiscoverProtecta.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersDiscoverProtecta.java @@ -10,7 +10,7 @@ /** Samples for ReplicationProtectionContainers DiscoverProtectableItem. */ public final class ReplicationProtectionContainersDiscoverProtecta { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_DiscoverProtectableItem.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_DiscoverProtectableItem.json */ /** * Sample code: Adds a protectable item to the replication protection container. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersGetSamples.java index 7b9f3753904d..b3690b64a76d 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionContainers Get. */ public final class ReplicationProtectionContainersGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_Get.json */ /** * Sample code: Gets the protection container details. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListByReplicatio.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListByReplicatio.java index 576e3e23d9f5..ec986d15847a 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListByReplicatio.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListByReplicatio.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionContainers ListByReplicationFabrics. */ public final class ReplicationProtectionContainersListByReplicatio { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of protection container for a fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListSamples.java index 7b2688aa2832..edc39f5ea5f6 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionContainers List. */ public final class ReplicationProtectionContainersListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_List.json */ /** * Sample code: Gets the list of all protection containers in a vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersSwitchProtection.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersSwitchProtection.java index 2f48d808ddff..dfaee3ad0c69 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersSwitchProtection.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersSwitchProtection.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectionContainers SwitchProtection. */ public final class ReplicationProtectionContainersSwitchProtection { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionContainers_SwitchProtection.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionContainers_SwitchProtection.json */ /** * Sample code: Switches protection from one container to another or one replication provider to another. @@ -30,6 +30,7 @@ public static void switchesProtectionFromOneContainerToAnotherOrOneReplicationPr new SwitchProtectionInput() .withProperties( new SwitchProtectionInputProperties() + .withReplicationProtectedItemName("a2aSwapOsVm") .withProviderSpecificDetails(new A2ASwitchProtectionInput())), com.azure.core.util.Context.NONE); } diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsCreateSamples.java index 39bf2370bff3..37536b3adaa1 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsCreateSamples.java @@ -11,7 +11,7 @@ /** Samples for ReplicationProtectionIntents Create. */ public final class ReplicationProtectionIntentsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_Create.json */ /** * Sample code: Create protection intent Resource. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsGetSamples.java index 7154206eab4e..0bf06b6bebc4 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionIntents Get. */ public final class ReplicationProtectionIntentsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_Get.json */ /** * Sample code: Gets the details of a Replication protection intent item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsListSamples.java index 578fc7de6993..85f40ffefd12 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationProtectionIntents List. */ public final class ReplicationProtectionIntentsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationProtectionIntents_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationProtectionIntents_List.json */ /** * Sample code: Gets the list of replication protection intent objects. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansCreateSamples.java index 0fc803515db8..866c237d7694 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansCreateSamples.java @@ -14,7 +14,7 @@ /** Samples for ReplicationRecoveryPlans Create. */ public final class ReplicationRecoveryPlansCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Create.json */ /** * Sample code: Creates a recovery plan with the given details. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansDeleteSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansDeleteSamples.java index ca541894e08d..b599c6e51105 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansDeleteSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryPlans Delete. */ public final class ReplicationRecoveryPlansDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Delete.json */ /** * Sample code: Deletes the specified recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCancelSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCancelSamples.java index b02f808bbeb7..9553a4a368bd 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCancelSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCancelSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryPlans FailoverCancel. */ public final class ReplicationRecoveryPlansFailoverCancelSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_FailoverCancel.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_FailoverCancel.json */ /** * Sample code: Execute cancel failover of the recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCommitSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCommitSamples.java index 8ec4ed6c94f5..4f98458167fe 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCommitSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCommitSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryPlans FailoverCommit. */ public final class ReplicationRecoveryPlansFailoverCommitSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_FailoverCommit.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_FailoverCommit.json */ /** * Sample code: Execute commit failover of the recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansGetSamples.java index dd35f6cea362..f69b08f0e693 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryPlans Get. */ public final class ReplicationRecoveryPlansGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Get.json */ /** * Sample code: Gets the requested recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansListSamples.java index 963d060deb60..451f6a34b9c0 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryPlans List. */ public final class ReplicationRecoveryPlansListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_List.json */ /** * Sample code: Gets the list of recovery plans. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansPlannedFailoverSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansPlannedFailoverSamples.java index d325e6b897ee..91aa7efaea77 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansPlannedFailoverSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansPlannedFailoverSamples.java @@ -13,7 +13,7 @@ /** Samples for ReplicationRecoveryPlans PlannedFailover. */ public final class ReplicationRecoveryPlansPlannedFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_PlannedFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_PlannedFailover.json */ /** * Sample code: Execute planned failover of the recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansReprotectSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansReprotectSamples.java index 9f496bad9997..da33b8472e84 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansReprotectSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansReprotectSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryPlans Reprotect. */ public final class ReplicationRecoveryPlansReprotectSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Reprotect.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Reprotect.json */ /** * Sample code: Execute reprotect of the recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverCleanupSamp.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverCleanupSamp.java index 2887ebe062fc..3b58570a8c04 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverCleanupSamp.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverCleanupSamp.java @@ -10,7 +10,7 @@ /** Samples for ReplicationRecoveryPlans TestFailoverCleanup. */ public final class ReplicationRecoveryPlansTestFailoverCleanupSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_TestFailoverCleanup.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_TestFailoverCleanup.json */ /** * Sample code: Execute test failover cleanup of the recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverSamples.java index afff81593947..5ae27e15c386 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverSamples.java @@ -13,7 +13,7 @@ /** Samples for ReplicationRecoveryPlans TestFailover. */ public final class ReplicationRecoveryPlansTestFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_TestFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_TestFailover.json */ /** * Sample code: Execute test failover of the recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUnplannedFailoverSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUnplannedFailoverSamples.java index 65672c28390a..1f861442528f 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUnplannedFailoverSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUnplannedFailoverSamples.java @@ -14,7 +14,7 @@ /** Samples for ReplicationRecoveryPlans UnplannedFailover. */ public final class ReplicationRecoveryPlansUnplannedFailoverSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_UnplannedFailover.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_UnplannedFailover.json */ /** * Sample code: Execute unplanned failover of the recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUpdateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUpdateSamples.java index d9c76d5b26cb..8bd4b7b90bf9 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUpdateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUpdateSamples.java @@ -14,7 +14,7 @@ /** Samples for ReplicationRecoveryPlans Update. */ public final class ReplicationRecoveryPlansUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryPlans_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryPlans_Update.json */ /** * Sample code: Updates the given recovery plan. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersCreateSampl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersCreateSampl.java index 8c9cc0c342db..3678629a60cf 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersCreateSampl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersCreateSampl.java @@ -10,7 +10,7 @@ /** Samples for ReplicationRecoveryServicesProviders Create. */ public final class ReplicationRecoveryServicesProvidersCreateSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Create.json */ /** * Sample code: Adds a recovery services provider. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersDeleteSampl.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersDeleteSampl.java index f0c95411d569..b7bae07a04dc 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersDeleteSampl.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersDeleteSampl.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryServicesProviders Delete. */ public final class ReplicationRecoveryServicesProvidersDeleteSampl { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Delete.json */ /** * Sample code: Deletes provider from fabric. Note: Deleting provider for any fabric other than SingleHost is diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersGetSamples.java index bb72954bcb90..680b6a2b32da 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryServicesProviders Get. */ public final class ReplicationRecoveryServicesProvidersGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Get.json */ /** * Sample code: Gets the details of a recovery services provider. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersListByRepli.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersListByRepli.java index 7b08470c91c1..dac0a7c1f7f7 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersListByRepli.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersListByRepli.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryServicesProviders ListByReplicationFabrics. */ public final class ReplicationRecoveryServicesProvidersListByRepli { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of registered recovery services providers for the fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersListSamples.java index 320adfc42f20..48c78ae0dd71 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryServicesProviders List. */ public final class ReplicationRecoveryServicesProvidersListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_List.json */ /** * Sample code: Gets the list of registered recovery services providers in the vault. This is a view only api. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersPurgeSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersPurgeSamples.java index 40b277df51ea..1bdf97dc1ab6 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersPurgeSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersPurgeSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryServicesProviders Purge. */ public final class ReplicationRecoveryServicesProvidersPurgeSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_Purge.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_Purge.json */ /** * Sample code: Purges recovery service provider from fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersRefreshProv.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersRefreshProv.java index 7f6cbc01d30d..3fc37203ad05 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersRefreshProv.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryServicesProvidersRefreshProv.java @@ -7,7 +7,7 @@ /** Samples for ReplicationRecoveryServicesProviders RefreshProvider. */ public final class ReplicationRecoveryServicesProvidersRefreshProv { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationRecoveryServicesProviders_RefreshProvider.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationRecoveryServicesProviders_RefreshProvider.json */ /** * Sample code: Refresh details from the recovery services provider. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultHealthGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultHealthGetSamples.java index 3a6bc8436281..42893fe1d8be 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultHealthGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultHealthGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationVaultHealth Get. */ public final class ReplicationVaultHealthGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultHealth_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultHealth_Get.json */ /** * Sample code: Gets the health summary for the vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultHealthRefreshSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultHealthRefreshSamples.java index 90285d82b8f1..91213e45985d 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultHealthRefreshSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultHealthRefreshSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationVaultHealth Refresh. */ public final class ReplicationVaultHealthRefreshSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultHealth_Refresh.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultHealth_Refresh.json */ /** * Sample code: Refreshes health summary of the vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingCreateSamples.java index 5d65360667a5..9d6fd5ce55b9 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingCreateSamples.java @@ -9,7 +9,7 @@ /** Samples for ReplicationVaultSetting Create. */ public final class ReplicationVaultSettingCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_Create.json */ /** * Sample code: Updates vault setting. A vault setting object is a singleton per vault and it is always present by diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingGetSamples.java index 860e27c47190..ab22e596f203 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationVaultSetting Get. */ public final class ReplicationVaultSettingGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_Get.json */ /** * Sample code: Gets the vault setting. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingListSamples.java index 2d360a619bc3..c57c4dd93386 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationVaultSetting List. */ public final class ReplicationVaultSettingListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationVaultSetting_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationVaultSetting_List.json */ /** * Sample code: Gets the list of vault setting. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersCreateSamples.java index 207a47a72792..7aa80e8a7716 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersCreateSamples.java @@ -9,7 +9,7 @@ /** Samples for ReplicationvCenters Create. */ public final class ReplicationvCentersCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Create.json */ /** * Sample code: Add vCenter. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersDeleteSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersDeleteSamples.java index 1c1c4479f466..24e969799d42 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersDeleteSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationvCenters Delete. */ public final class ReplicationvCentersDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Delete.json */ /** * Sample code: Remove vCenter operation. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersGetSamples.java index a8826ce53e33..db02be24bbed 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersGetSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationvCenters Get. */ public final class ReplicationvCentersGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Get.json */ /** * Sample code: Gets the details of a vCenter. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersListByReplicationFabricsSamp.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersListByReplicationFabricsSamp.java index 5b5e8545c44f..195539aef818 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersListByReplicationFabricsSamp.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersListByReplicationFabricsSamp.java @@ -7,7 +7,7 @@ /** Samples for ReplicationvCenters ListByReplicationFabrics. */ public final class ReplicationvCentersListByReplicationFabricsSamp { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of vCenter registered under a fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersListSamples.java index add8b9113839..deb2bf9c3045 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersListSamples.java @@ -7,7 +7,7 @@ /** Samples for ReplicationvCenters List. */ public final class ReplicationvCentersListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_List.json */ /** * Sample code: Gets the list of vCenter registered under the vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersUpdateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersUpdateSamples.java index baacf1fe4f86..563f4e86e666 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersUpdateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationvCentersUpdateSamples.java @@ -10,7 +10,7 @@ /** Samples for ReplicationvCenters Update. */ public final class ReplicationvCentersUpdateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationvCenters_Update.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationvCenters_Update.json */ /** * Sample code: Update vCenter operation. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsCreateSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsCreateSamples.java index a77e4f83e327..850fa60cd2a2 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsCreateSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsCreateSamples.java @@ -9,7 +9,7 @@ /** Samples for StorageClassificationMappings Create. */ public final class StorageClassificationMappingsCreateSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Create.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Create.json */ /** * Sample code: Create storage classification mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsDeleteSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsDeleteSamples.java index f7167708252f..c1b516b13bb0 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsDeleteSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for StorageClassificationMappings Delete. */ public final class StorageClassificationMappingsDeleteSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Delete.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Delete.json */ /** * Sample code: Delete a storage classification mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsGetSamples.java index 43f335a9dd9c..c31c5597b47f 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for StorageClassificationMappings Get. */ public final class StorageClassificationMappingsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_Get.json */ /** * Sample code: Gets the details of a storage classification mapping. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListByReplicationS.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListByReplicationS.java index 2784ebee2a18..066e8786448e 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListByReplicationS.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListByReplicationS.java @@ -7,7 +7,7 @@ /** Samples for StorageClassificationMappings ListByReplicationStorageClassifications. */ public final class StorageClassificationMappingsListByReplicationS { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_ListByReplicationStorageClassifications.json */ /** * Sample code: Gets the list of storage classification mappings objects under a storage. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListSamples.java index a4751a4de397..c01fb0e4dd6b 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListSamples.java @@ -7,7 +7,7 @@ /** Samples for StorageClassificationMappings List. */ public final class StorageClassificationMappingsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassificationMappings_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassificationMappings_List.json */ /** * Sample code: Gets the list of storage classification mappings objects under a vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsGetSamples.java index fd5beddb3b91..cbecfb3fc30a 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for StorageClassifications Get. */ public final class StorageClassificationsGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_Get.json */ /** * Sample code: Gets the details of a storage classification. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListByReplicationFabricsS.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListByReplicationFabricsS.java index f60d74d8b4e1..672cd2e9b0f0 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListByReplicationFabricsS.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListByReplicationFabricsS.java @@ -7,7 +7,7 @@ /** Samples for StorageClassifications ListByReplicationFabrics. */ public final class StorageClassificationsListByReplicationFabricsS { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_ListByReplicationFabrics.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_ListByReplicationFabrics.json */ /** * Sample code: Gets the list of storage classification objects under a fabric. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListSamples.java index 899d7559a9f3..a1c939fcbae8 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for StorageClassifications List. */ public final class StorageClassificationsListSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/ReplicationStorageClassifications_List.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/ReplicationStorageClassifications_List.json */ /** * Sample code: Gets the list of storage classification objects under a vault. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOperatingSystemsOperationGetSamples.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOperatingSystemsOperationGetSamples.java index dddd8e550357..81a8357b71ee 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOperatingSystemsOperationGetSamples.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOperatingSystemsOperationGetSamples.java @@ -7,7 +7,7 @@ /** Samples for SupportedOperatingSystemsOperation Get. */ public final class SupportedOperatingSystemsOperationGetSamples { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/SupportedOperatingSystems_Get.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/SupportedOperatingSystems_Get.json */ /** * Sample code: Gets the data of supported operating systems by SRS. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizesListByReplicationProtectedIte.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizesListByReplicationProtectedIte.java index 5463f9ba760c..0aca367f1227 100644 --- a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizesListByReplicationProtectedIte.java +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/samples/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizesListByReplicationProtectedIte.java @@ -7,7 +7,7 @@ /** Samples for TargetComputeSizes ListByReplicationProtectedItems. */ public final class TargetComputeSizesListByReplicationProtectedIte { /* - * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2022-10-01/examples/TargetComputeSizes_ListByReplicationProtectedItems.json + * x-ms-original-file: specification/recoveryservicessiterecovery/resource-manager/Microsoft.RecoveryServices/stable/2023-06-01/examples/TargetComputeSizes_ListByReplicationProtectedItems.json */ /** * Sample code: Gets the list of target compute sizes for the replication protected item. diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AApplyRecoveryPointInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AApplyRecoveryPointInputTests.java new file mode 100644 index 000000000000..4d28ac5fd7d2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AApplyRecoveryPointInputTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AApplyRecoveryPointInput; + +public final class A2AApplyRecoveryPointInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AApplyRecoveryPointInput model = + BinaryData.fromString("{\"instanceType\":\"A2A\"}").toObject(A2AApplyRecoveryPointInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AApplyRecoveryPointInput model = new A2AApplyRecoveryPointInput(); + model = BinaryData.fromObject(model).toObject(A2AApplyRecoveryPointInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AContainerCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AContainerCreationInputTests.java new file mode 100644 index 000000000000..dc37e6969a50 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AContainerCreationInputTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AContainerCreationInput; + +public final class A2AContainerCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AContainerCreationInput model = + BinaryData.fromString("{\"instanceType\":\"A2A\"}").toObject(A2AContainerCreationInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AContainerCreationInput model = new A2AContainerCreationInput(); + model = BinaryData.fromObject(model).toObject(A2AContainerCreationInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AContainerMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AContainerMappingInputTests.java new file mode 100644 index 000000000000..6185c439e00e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AContainerMappingInputTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AContainerMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AgentAutoUpdateStatus; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType; +import org.junit.jupiter.api.Assertions; + +public final class A2AContainerMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AContainerMappingInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"agentAutoUpdateStatus\":\"Enabled\",\"automationAccountArmId\":\"goaqylkjztj\",\"automationAccountAuthenticationType\":\"SystemAssignedIdentity\"}") + .toObject(A2AContainerMappingInput.class); + Assertions.assertEquals(AgentAutoUpdateStatus.ENABLED, model.agentAutoUpdateStatus()); + Assertions.assertEquals("goaqylkjztj", model.automationAccountArmId()); + Assertions + .assertEquals( + AutomationAccountAuthenticationType.SYSTEM_ASSIGNED_IDENTITY, + model.automationAccountAuthenticationType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AContainerMappingInput model = + new A2AContainerMappingInput() + .withAgentAutoUpdateStatus(AgentAutoUpdateStatus.ENABLED) + .withAutomationAccountArmId("goaqylkjztj") + .withAutomationAccountAuthenticationType(AutomationAccountAuthenticationType.SYSTEM_ASSIGNED_IDENTITY); + model = BinaryData.fromObject(model).toObject(A2AContainerMappingInput.class); + Assertions.assertEquals(AgentAutoUpdateStatus.ENABLED, model.agentAutoUpdateStatus()); + Assertions.assertEquals("goaqylkjztj", model.automationAccountArmId()); + Assertions + .assertEquals( + AutomationAccountAuthenticationType.SYSTEM_ASSIGNED_IDENTITY, + model.automationAccountAuthenticationType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationApplyRecoveryPointInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationApplyRecoveryPointInputTests.java new file mode 100644 index 000000000000..51070bac2da3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationApplyRecoveryPointInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2ACrossClusterMigrationApplyRecoveryPointInput; + +public final class A2ACrossClusterMigrationApplyRecoveryPointInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2ACrossClusterMigrationApplyRecoveryPointInput model = + BinaryData + .fromString("{\"instanceType\":\"A2ACrossClusterMigration\"}") + .toObject(A2ACrossClusterMigrationApplyRecoveryPointInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2ACrossClusterMigrationApplyRecoveryPointInput model = new A2ACrossClusterMigrationApplyRecoveryPointInput(); + model = BinaryData.fromObject(model).toObject(A2ACrossClusterMigrationApplyRecoveryPointInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationContainerCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationContainerCreationInputTests.java new file mode 100644 index 000000000000..c857a859e022 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationContainerCreationInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2ACrossClusterMigrationContainerCreationInput; + +public final class A2ACrossClusterMigrationContainerCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2ACrossClusterMigrationContainerCreationInput model = + BinaryData + .fromString("{\"instanceType\":\"A2ACrossClusterMigration\"}") + .toObject(A2ACrossClusterMigrationContainerCreationInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2ACrossClusterMigrationContainerCreationInput model = new A2ACrossClusterMigrationContainerCreationInput(); + model = BinaryData.fromObject(model).toObject(A2ACrossClusterMigrationContainerCreationInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationEnableProtectionInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationEnableProtectionInputTests.java new file mode 100644 index 000000000000..23d11f415853 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationEnableProtectionInputTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2ACrossClusterMigrationEnableProtectionInput; +import org.junit.jupiter.api.Assertions; + +public final class A2ACrossClusterMigrationEnableProtectionInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2ACrossClusterMigrationEnableProtectionInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2ACrossClusterMigration\",\"fabricObjectId\":\"lickduoi\",\"recoveryContainerId\":\"amt\"}") + .toObject(A2ACrossClusterMigrationEnableProtectionInput.class); + Assertions.assertEquals("lickduoi", model.fabricObjectId()); + Assertions.assertEquals("amt", model.recoveryContainerId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2ACrossClusterMigrationEnableProtectionInput model = + new A2ACrossClusterMigrationEnableProtectionInput() + .withFabricObjectId("lickduoi") + .withRecoveryContainerId("amt"); + model = BinaryData.fromObject(model).toObject(A2ACrossClusterMigrationEnableProtectionInput.class); + Assertions.assertEquals("lickduoi", model.fabricObjectId()); + Assertions.assertEquals("amt", model.recoveryContainerId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationPolicyCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationPolicyCreationInputTests.java new file mode 100644 index 000000000000..b47cdf9583d3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationPolicyCreationInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2ACrossClusterMigrationPolicyCreationInput; + +public final class A2ACrossClusterMigrationPolicyCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2ACrossClusterMigrationPolicyCreationInput model = + BinaryData + .fromString("{\"instanceType\":\"A2ACrossClusterMigration\"}") + .toObject(A2ACrossClusterMigrationPolicyCreationInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2ACrossClusterMigrationPolicyCreationInput model = new A2ACrossClusterMigrationPolicyCreationInput(); + model = BinaryData.fromObject(model).toObject(A2ACrossClusterMigrationPolicyCreationInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationReplicationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationReplicationDetailsTests.java new file mode 100644 index 000000000000..2b21b6cdb6ca --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ACrossClusterMigrationReplicationDetailsTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2ACrossClusterMigrationReplicationDetails; +import org.junit.jupiter.api.Assertions; + +public final class A2ACrossClusterMigrationReplicationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2ACrossClusterMigrationReplicationDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"A2ACrossClusterMigration\",\"fabricObjectId\":\"sknxrwzawnvsbcf\",\"primaryFabricLocation\":\"agxnvhycvdimw\",\"osType\":\"regzgyufutrwpwer\",\"vmProtectionState\":\"kzkdhmeott\",\"vmProtectionStateDescription\":\"jyosxwwh\",\"lifecycleId\":\"jtfvpndpmiljpn\"}") + .toObject(A2ACrossClusterMigrationReplicationDetails.class); + Assertions.assertEquals("sknxrwzawnvsbcf", model.fabricObjectId()); + Assertions.assertEquals("agxnvhycvdimw", model.primaryFabricLocation()); + Assertions.assertEquals("regzgyufutrwpwer", model.osType()); + Assertions.assertEquals("kzkdhmeott", model.vmProtectionState()); + Assertions.assertEquals("jyosxwwh", model.vmProtectionStateDescription()); + Assertions.assertEquals("jtfvpndpmiljpn", model.lifecycleId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2ACrossClusterMigrationReplicationDetails model = + new A2ACrossClusterMigrationReplicationDetails() + .withFabricObjectId("sknxrwzawnvsbcf") + .withPrimaryFabricLocation("agxnvhycvdimw") + .withOsType("regzgyufutrwpwer") + .withVmProtectionState("kzkdhmeott") + .withVmProtectionStateDescription("jyosxwwh") + .withLifecycleId("jtfvpndpmiljpn"); + model = BinaryData.fromObject(model).toObject(A2ACrossClusterMigrationReplicationDetails.class); + Assertions.assertEquals("sknxrwzawnvsbcf", model.fabricObjectId()); + Assertions.assertEquals("agxnvhycvdimw", model.primaryFabricLocation()); + Assertions.assertEquals("regzgyufutrwpwer", model.osType()); + Assertions.assertEquals("kzkdhmeott", model.vmProtectionState()); + Assertions.assertEquals("jyosxwwh", model.vmProtectionStateDescription()); + Assertions.assertEquals("jtfvpndpmiljpn", model.lifecycleId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AEventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AEventDetailsTests.java new file mode 100644 index 000000000000..94705f3c4f8c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AEventDetailsTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AEventDetails; +import org.junit.jupiter.api.Assertions; + +public final class A2AEventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AEventDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"protectedItemName\":\"skndnelqkaadlknw\",\"fabricObjectId\":\"anniyopetxivcnr\",\"fabricName\":\"xnucaephblkwqp\",\"fabricLocation\":\"vbqsdt\",\"remoteFabricName\":\"bctvivuzqym\",\"remoteFabricLocation\":\"owog\"}") + .toObject(A2AEventDetails.class); + Assertions.assertEquals("skndnelqkaadlknw", model.protectedItemName()); + Assertions.assertEquals("anniyopetxivcnr", model.fabricObjectId()); + Assertions.assertEquals("xnucaephblkwqp", model.fabricName()); + Assertions.assertEquals("vbqsdt", model.fabricLocation()); + Assertions.assertEquals("bctvivuzqym", model.remoteFabricName()); + Assertions.assertEquals("owog", model.remoteFabricLocation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AEventDetails model = + new A2AEventDetails() + .withProtectedItemName("skndnelqkaadlknw") + .withFabricObjectId("anniyopetxivcnr") + .withFabricName("xnucaephblkwqp") + .withFabricLocation("vbqsdt") + .withRemoteFabricName("bctvivuzqym") + .withRemoteFabricLocation("owog"); + model = BinaryData.fromObject(model).toObject(A2AEventDetails.class); + Assertions.assertEquals("skndnelqkaadlknw", model.protectedItemName()); + Assertions.assertEquals("anniyopetxivcnr", model.fabricObjectId()); + Assertions.assertEquals("xnucaephblkwqp", model.fabricName()); + Assertions.assertEquals("vbqsdt", model.fabricLocation()); + Assertions.assertEquals("bctvivuzqym", model.remoteFabricName()); + Assertions.assertEquals("owog", model.remoteFabricLocation()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AExtendedLocationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AExtendedLocationDetailsTests.java new file mode 100644 index 000000000000..f710b21db146 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AExtendedLocationDetailsTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AExtendedLocationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocationType; +import org.junit.jupiter.api.Assertions; + +public final class A2AExtendedLocationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AExtendedLocationDetails model = + BinaryData + .fromString( + "{\"primaryExtendedLocation\":{\"name\":\"it\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"zvbrzcdbanfzndsc\",\"type\":\"EdgeZone\"}}") + .toObject(A2AExtendedLocationDetails.class); + Assertions.assertEquals("it", model.primaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.primaryExtendedLocation().type()); + Assertions.assertEquals("zvbrzcdbanfzndsc", model.recoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.recoveryExtendedLocation().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AExtendedLocationDetails model = + new A2AExtendedLocationDetails() + .withPrimaryExtendedLocation( + new ExtendedLocation().withName("it").withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation().withName("zvbrzcdbanfzndsc").withType(ExtendedLocationType.EDGE_ZONE)); + model = BinaryData.fromObject(model).toObject(A2AExtendedLocationDetails.class); + Assertions.assertEquals("it", model.primaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.primaryExtendedLocation().type()); + Assertions.assertEquals("zvbrzcdbanfzndsc", model.recoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.recoveryExtendedLocation().type()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AFabricSpecificLocationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AFabricSpecificLocationDetailsTests.java new file mode 100644 index 000000000000..57b53e97bc51 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AFabricSpecificLocationDetailsTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AFabricSpecificLocationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocationType; +import org.junit.jupiter.api.Assertions; + +public final class A2AFabricSpecificLocationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AFabricSpecificLocationDetails model = + BinaryData + .fromString( + "{\"initialPrimaryZone\":\"eatkdbmwnrdj\",\"initialRecoveryZone\":\"bqbnaomhjrmkuh\",\"initialPrimaryExtendedLocation\":{\"name\":\"xljalfihc\",\"type\":\"EdgeZone\"},\"initialRecoveryExtendedLocation\":{\"name\":\"bc\",\"type\":\"EdgeZone\"},\"initialPrimaryFabricLocation\":\"de\",\"initialRecoveryFabricLocation\":\"qcwgaxfgvaknokz\",\"primaryZone\":\"jzrltixldzy\",\"recoveryZone\":\"ytpqsixymmpujiv\",\"primaryExtendedLocation\":{\"name\":\"lkjuvsmbmslzoyov\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"bpqvybefg\",\"type\":\"EdgeZone\"},\"primaryFabricLocation\":\"nokcv\",\"recoveryFabricLocation\":\"ubseskvcuartr\"}") + .toObject(A2AFabricSpecificLocationDetails.class); + Assertions.assertEquals("eatkdbmwnrdj", model.initialPrimaryZone()); + Assertions.assertEquals("bqbnaomhjrmkuh", model.initialRecoveryZone()); + Assertions.assertEquals("xljalfihc", model.initialPrimaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.initialPrimaryExtendedLocation().type()); + Assertions.assertEquals("bc", model.initialRecoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.initialRecoveryExtendedLocation().type()); + Assertions.assertEquals("de", model.initialPrimaryFabricLocation()); + Assertions.assertEquals("qcwgaxfgvaknokz", model.initialRecoveryFabricLocation()); + Assertions.assertEquals("jzrltixldzy", model.primaryZone()); + Assertions.assertEquals("ytpqsixymmpujiv", model.recoveryZone()); + Assertions.assertEquals("lkjuvsmbmslzoyov", model.primaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.primaryExtendedLocation().type()); + Assertions.assertEquals("bpqvybefg", model.recoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.recoveryExtendedLocation().type()); + Assertions.assertEquals("nokcv", model.primaryFabricLocation()); + Assertions.assertEquals("ubseskvcuartr", model.recoveryFabricLocation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AFabricSpecificLocationDetails model = + new A2AFabricSpecificLocationDetails() + .withInitialPrimaryZone("eatkdbmwnrdj") + .withInitialRecoveryZone("bqbnaomhjrmkuh") + .withInitialPrimaryExtendedLocation( + new ExtendedLocation().withName("xljalfihc").withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialRecoveryExtendedLocation( + new ExtendedLocation().withName("bc").withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialPrimaryFabricLocation("de") + .withInitialRecoveryFabricLocation("qcwgaxfgvaknokz") + .withPrimaryZone("jzrltixldzy") + .withRecoveryZone("ytpqsixymmpujiv") + .withPrimaryExtendedLocation( + new ExtendedLocation().withName("lkjuvsmbmslzoyov").withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation().withName("bpqvybefg").withType(ExtendedLocationType.EDGE_ZONE)) + .withPrimaryFabricLocation("nokcv") + .withRecoveryFabricLocation("ubseskvcuartr"); + model = BinaryData.fromObject(model).toObject(A2AFabricSpecificLocationDetails.class); + Assertions.assertEquals("eatkdbmwnrdj", model.initialPrimaryZone()); + Assertions.assertEquals("bqbnaomhjrmkuh", model.initialRecoveryZone()); + Assertions.assertEquals("xljalfihc", model.initialPrimaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.initialPrimaryExtendedLocation().type()); + Assertions.assertEquals("bc", model.initialRecoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.initialRecoveryExtendedLocation().type()); + Assertions.assertEquals("de", model.initialPrimaryFabricLocation()); + Assertions.assertEquals("qcwgaxfgvaknokz", model.initialRecoveryFabricLocation()); + Assertions.assertEquals("jzrltixldzy", model.primaryZone()); + Assertions.assertEquals("ytpqsixymmpujiv", model.recoveryZone()); + Assertions.assertEquals("lkjuvsmbmslzoyov", model.primaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.primaryExtendedLocation().type()); + Assertions.assertEquals("bpqvybefg", model.recoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.recoveryExtendedLocation().type()); + Assertions.assertEquals("nokcv", model.primaryFabricLocation()); + Assertions.assertEquals("ubseskvcuartr", model.recoveryFabricLocation()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2APolicyCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2APolicyCreationInputTests.java new file mode 100644 index 000000000000..1ba62b7dd6b3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2APolicyCreationInputTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2APolicyCreationInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SetMultiVmSyncStatus; +import org.junit.jupiter.api.Assertions; + +public final class A2APolicyCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2APolicyCreationInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"recoveryPointHistory\":723936709,\"crashConsistentFrequencyInMinutes\":1450165650,\"appConsistentFrequencyInMinutes\":1593194036,\"multiVmSyncStatus\":\"Disable\"}") + .toObject(A2APolicyCreationInput.class); + Assertions.assertEquals(723936709, model.recoveryPointHistory()); + Assertions.assertEquals(1450165650, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(1593194036, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(SetMultiVmSyncStatus.DISABLE, model.multiVmSyncStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2APolicyCreationInput model = + new A2APolicyCreationInput() + .withRecoveryPointHistory(723936709) + .withCrashConsistentFrequencyInMinutes(1450165650) + .withAppConsistentFrequencyInMinutes(1593194036) + .withMultiVmSyncStatus(SetMultiVmSyncStatus.DISABLE); + model = BinaryData.fromObject(model).toObject(A2APolicyCreationInput.class); + Assertions.assertEquals(723936709, model.recoveryPointHistory()); + Assertions.assertEquals(1450165650, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(1593194036, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(SetMultiVmSyncStatus.DISABLE, model.multiVmSyncStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2APolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2APolicyDetailsTests.java new file mode 100644 index 000000000000..179efe9cc429 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2APolicyDetailsTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2APolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class A2APolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2APolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"recoveryPointThresholdInMinutes\":1604436828,\"recoveryPointHistory\":1284284541,\"appConsistentFrequencyInMinutes\":409182858,\"multiVmSyncStatus\":\"qi\",\"crashConsistentFrequencyInMinutes\":1105579119}") + .toObject(A2APolicyDetails.class); + Assertions.assertEquals(1604436828, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(1284284541, model.recoveryPointHistory()); + Assertions.assertEquals(409182858, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("qi", model.multiVmSyncStatus()); + Assertions.assertEquals(1105579119, model.crashConsistentFrequencyInMinutes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2APolicyDetails model = + new A2APolicyDetails() + .withRecoveryPointThresholdInMinutes(1604436828) + .withRecoveryPointHistory(1284284541) + .withAppConsistentFrequencyInMinutes(409182858) + .withMultiVmSyncStatus("qi") + .withCrashConsistentFrequencyInMinutes(1105579119); + model = BinaryData.fromObject(model).toObject(A2APolicyDetails.class); + Assertions.assertEquals(1604436828, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(1284284541, model.recoveryPointHistory()); + Assertions.assertEquals(409182858, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("qi", model.multiVmSyncStatus()); + Assertions.assertEquals(1105579119, model.crashConsistentFrequencyInMinutes()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AProtectionContainerMappingDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AProtectionContainerMappingDetailsTests.java new file mode 100644 index 000000000000..3bd718ebbbf8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AProtectionContainerMappingDetailsTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AProtectionContainerMappingDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AgentAutoUpdateStatus; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType; +import org.junit.jupiter.api.Assertions; + +public final class A2AProtectionContainerMappingDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AProtectionContainerMappingDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"agentAutoUpdateStatus\":\"Enabled\",\"automationAccountArmId\":\"xawoijpodtblxp\",\"automationAccountAuthenticationType\":\"SystemAssignedIdentity\",\"scheduleName\":\"djodqhy\",\"jobScheduleName\":\"ncn\"}") + .toObject(A2AProtectionContainerMappingDetails.class); + Assertions.assertEquals(AgentAutoUpdateStatus.ENABLED, model.agentAutoUpdateStatus()); + Assertions.assertEquals("xawoijpodtblxp", model.automationAccountArmId()); + Assertions + .assertEquals( + AutomationAccountAuthenticationType.SYSTEM_ASSIGNED_IDENTITY, + model.automationAccountAuthenticationType()); + Assertions.assertEquals("djodqhy", model.scheduleName()); + Assertions.assertEquals("ncn", model.jobScheduleName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AProtectionContainerMappingDetails model = + new A2AProtectionContainerMappingDetails() + .withAgentAutoUpdateStatus(AgentAutoUpdateStatus.ENABLED) + .withAutomationAccountArmId("xawoijpodtblxp") + .withAutomationAccountAuthenticationType(AutomationAccountAuthenticationType.SYSTEM_ASSIGNED_IDENTITY) + .withScheduleName("djodqhy") + .withJobScheduleName("ncn"); + model = BinaryData.fromObject(model).toObject(A2AProtectionContainerMappingDetails.class); + Assertions.assertEquals(AgentAutoUpdateStatus.ENABLED, model.agentAutoUpdateStatus()); + Assertions.assertEquals("xawoijpodtblxp", model.automationAccountArmId()); + Assertions + .assertEquals( + AutomationAccountAuthenticationType.SYSTEM_ASSIGNED_IDENTITY, + model.automationAccountAuthenticationType()); + Assertions.assertEquals("djodqhy", model.scheduleName()); + Assertions.assertEquals("ncn", model.jobScheduleName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AProtectionIntentDiskInputDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AProtectionIntentDiskInputDetailsTests.java new file mode 100644 index 000000000000..fbdd975aed51 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AProtectionIntentDiskInputDetailsTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AProtectionIntentDiskInputDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageAccountCustomDetails; +import org.junit.jupiter.api.Assertions; + +public final class A2AProtectionIntentDiskInputDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AProtectionIntentDiskInputDetails model = + BinaryData + .fromString( + "{\"diskUri\":\"atbwbqam\",\"recoveryAzureStorageAccountCustomInput\":{\"resourceType\":\"StorageAccountCustomDetails\"},\"primaryStagingStorageAccountCustomInput\":{\"resourceType\":\"StorageAccountCustomDetails\"}}") + .toObject(A2AProtectionIntentDiskInputDetails.class); + Assertions.assertEquals("atbwbqam", model.diskUri()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AProtectionIntentDiskInputDetails model = + new A2AProtectionIntentDiskInputDetails() + .withDiskUri("atbwbqam") + .withRecoveryAzureStorageAccountCustomInput(new StorageAccountCustomDetails()) + .withPrimaryStagingStorageAccountCustomInput(new StorageAccountCustomDetails()); + model = BinaryData.fromObject(model).toObject(A2AProtectionIntentDiskInputDetails.class); + Assertions.assertEquals("atbwbqam", model.diskUri()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ARecoveryPointDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ARecoveryPointDetailsTests.java new file mode 100644 index 000000000000..d65d3f601e4d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ARecoveryPointDetailsTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2ARecoveryPointDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPointSyncType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class A2ARecoveryPointDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2ARecoveryPointDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"recoveryPointSyncType\":\"PerVmRecoveryPoint\",\"disks\":[\"llizhce\",\"moqodka\",\"ppyi\"]}") + .toObject(A2ARecoveryPointDetails.class); + Assertions.assertEquals(RecoveryPointSyncType.PER_VM_RECOVERY_POINT, model.recoveryPointSyncType()); + Assertions.assertEquals("llizhce", model.disks().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2ARecoveryPointDetails model = + new A2ARecoveryPointDetails() + .withRecoveryPointSyncType(RecoveryPointSyncType.PER_VM_RECOVERY_POINT) + .withDisks(Arrays.asList("llizhce", "moqodka", "ppyi")); + model = BinaryData.fromObject(model).toObject(A2ARecoveryPointDetails.class); + Assertions.assertEquals(RecoveryPointSyncType.PER_VM_RECOVERY_POINT, model.recoveryPointSyncType()); + Assertions.assertEquals("llizhce", model.disks().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ARemoveDisksInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ARemoveDisksInputTests.java new file mode 100644 index 000000000000..9b4414f1bec2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ARemoveDisksInputTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2ARemoveDisksInput; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class A2ARemoveDisksInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2ARemoveDisksInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"vmDisksUris\":[\"qladywrxwhydtlu\",\"vadswzs\",\"uyem\",\"owuowh\"],\"vmManagedDisksIds\":[\"nwyrmouv\"]}") + .toObject(A2ARemoveDisksInput.class); + Assertions.assertEquals("qladywrxwhydtlu", model.vmDisksUris().get(0)); + Assertions.assertEquals("nwyrmouv", model.vmManagedDisksIds().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2ARemoveDisksInput model = + new A2ARemoveDisksInput() + .withVmDisksUris(Arrays.asList("qladywrxwhydtlu", "vadswzs", "uyem", "owuowh")) + .withVmManagedDisksIds(Arrays.asList("nwyrmouv")); + model = BinaryData.fromObject(model).toObject(A2ARemoveDisksInput.class); + Assertions.assertEquals("qladywrxwhydtlu", model.vmDisksUris().get(0)); + Assertions.assertEquals("nwyrmouv", model.vmManagedDisksIds().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AReprotectInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AReprotectInputTests.java new file mode 100644 index 000000000000..c0602a93787b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AReprotectInputTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AReprotectInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AVmDiskInputDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class A2AReprotectInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AReprotectInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"recoveryContainerId\":\"uhvajmailfemjjza\",\"vmDisks\":[{\"diskUri\":\"jiqul\",\"recoveryAzureStorageAccountId\":\"qx\",\"primaryStagingAzureStorageAccountId\":\"dmvr\"},{\"diskUri\":\"cm\",\"recoveryAzureStorageAccountId\":\"erndbrnyeofltfnn\",\"primaryStagingAzureStorageAccountId\":\"rkadjfynnfmuiiir\"},{\"diskUri\":\"pfoh\",\"recoveryAzureStorageAccountId\":\"kfkxbbcbrwjiut\",\"primaryStagingAzureStorageAccountId\":\"njizb\"}],\"recoveryResourceGroupId\":\"woiymrvz\",\"recoveryCloudServiceId\":\"uyrsrziuctix\",\"recoveryAvailabilitySetId\":\"d\",\"policyId\":\"ifrevk\"}") + .toObject(A2AReprotectInput.class); + Assertions.assertEquals("uhvajmailfemjjza", model.recoveryContainerId()); + Assertions.assertEquals("jiqul", model.vmDisks().get(0).diskUri()); + Assertions.assertEquals("qx", model.vmDisks().get(0).recoveryAzureStorageAccountId()); + Assertions.assertEquals("dmvr", model.vmDisks().get(0).primaryStagingAzureStorageAccountId()); + Assertions.assertEquals("woiymrvz", model.recoveryResourceGroupId()); + Assertions.assertEquals("uyrsrziuctix", model.recoveryCloudServiceId()); + Assertions.assertEquals("d", model.recoveryAvailabilitySetId()); + Assertions.assertEquals("ifrevk", model.policyId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AReprotectInput model = + new A2AReprotectInput() + .withRecoveryContainerId("uhvajmailfemjjza") + .withVmDisks( + Arrays + .asList( + new A2AVmDiskInputDetails() + .withDiskUri("jiqul") + .withRecoveryAzureStorageAccountId("qx") + .withPrimaryStagingAzureStorageAccountId("dmvr"), + new A2AVmDiskInputDetails() + .withDiskUri("cm") + .withRecoveryAzureStorageAccountId("erndbrnyeofltfnn") + .withPrimaryStagingAzureStorageAccountId("rkadjfynnfmuiiir"), + new A2AVmDiskInputDetails() + .withDiskUri("pfoh") + .withRecoveryAzureStorageAccountId("kfkxbbcbrwjiut") + .withPrimaryStagingAzureStorageAccountId("njizb"))) + .withRecoveryResourceGroupId("woiymrvz") + .withRecoveryCloudServiceId("uyrsrziuctix") + .withRecoveryAvailabilitySetId("d") + .withPolicyId("ifrevk"); + model = BinaryData.fromObject(model).toObject(A2AReprotectInput.class); + Assertions.assertEquals("uhvajmailfemjjza", model.recoveryContainerId()); + Assertions.assertEquals("jiqul", model.vmDisks().get(0).diskUri()); + Assertions.assertEquals("qx", model.vmDisks().get(0).recoveryAzureStorageAccountId()); + Assertions.assertEquals("dmvr", model.vmDisks().get(0).primaryStagingAzureStorageAccountId()); + Assertions.assertEquals("woiymrvz", model.recoveryResourceGroupId()); + Assertions.assertEquals("uyrsrziuctix", model.recoveryCloudServiceId()); + Assertions.assertEquals("d", model.recoveryAvailabilitySetId()); + Assertions.assertEquals("ifrevk", model.policyId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ATestFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ATestFailoverInputTests.java new file mode 100644 index 000000000000..8a3bdafd7852 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2ATestFailoverInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2ATestFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class A2ATestFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2ATestFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"recoveryPointId\":\"omeikjcl\",\"cloudServiceCreationOption\":\"acnmwpfsuqtaaz\"}") + .toObject(A2ATestFailoverInput.class); + Assertions.assertEquals("omeikjcl", model.recoveryPointId()); + Assertions.assertEquals("acnmwpfsuqtaaz", model.cloudServiceCreationOption()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2ATestFailoverInput model = + new A2ATestFailoverInput().withRecoveryPointId("omeikjcl").withCloudServiceCreationOption("acnmwpfsuqtaaz"); + model = BinaryData.fromObject(model).toObject(A2ATestFailoverInput.class); + Assertions.assertEquals("omeikjcl", model.recoveryPointId()); + Assertions.assertEquals("acnmwpfsuqtaaz", model.cloudServiceCreationOption()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AUnplannedFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AUnplannedFailoverInputTests.java new file mode 100644 index 000000000000..c7001da9bb48 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AUnplannedFailoverInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AUnplannedFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class A2AUnplannedFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AUnplannedFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"recoveryPointId\":\"bxyxoy\",\"cloudServiceCreationOption\":\"uqqiqezxlhd\"}") + .toObject(A2AUnplannedFailoverInput.class); + Assertions.assertEquals("bxyxoy", model.recoveryPointId()); + Assertions.assertEquals("uqqiqezxlhd", model.cloudServiceCreationOption()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AUnplannedFailoverInput model = + new A2AUnplannedFailoverInput().withRecoveryPointId("bxyxoy").withCloudServiceCreationOption("uqqiqezxlhd"); + model = BinaryData.fromObject(model).toObject(A2AUnplannedFailoverInput.class); + Assertions.assertEquals("bxyxoy", model.recoveryPointId()); + Assertions.assertEquals("uqqiqezxlhd", model.cloudServiceCreationOption()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AUnprotectedDiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AUnprotectedDiskDetailsTests.java new file mode 100644 index 000000000000..1ffa5b6b6708 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AUnprotectedDiskDetailsTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AUnprotectedDiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AutoProtectionOfDataDisk; +import org.junit.jupiter.api.Assertions; + +public final class A2AUnprotectedDiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AUnprotectedDiskDetails model = + BinaryData + .fromString("{\"diskLunId\":86261319,\"diskAutoProtectionStatus\":\"Disabled\"}") + .toObject(A2AUnprotectedDiskDetails.class); + Assertions.assertEquals(86261319, model.diskLunId()); + Assertions.assertEquals(AutoProtectionOfDataDisk.DISABLED, model.diskAutoProtectionStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AUnprotectedDiskDetails model = + new A2AUnprotectedDiskDetails() + .withDiskLunId(86261319) + .withDiskAutoProtectionStatus(AutoProtectionOfDataDisk.DISABLED); + model = BinaryData.fromObject(model).toObject(A2AUnprotectedDiskDetails.class); + Assertions.assertEquals(86261319, model.diskLunId()); + Assertions.assertEquals(AutoProtectionOfDataDisk.DISABLED, model.diskAutoProtectionStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AUpdateContainerMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AUpdateContainerMappingInputTests.java new file mode 100644 index 000000000000..ca7c6cadd622 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AUpdateContainerMappingInputTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AUpdateContainerMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AgentAutoUpdateStatus; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AutomationAccountAuthenticationType; +import org.junit.jupiter.api.Assertions; + +public final class A2AUpdateContainerMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AUpdateContainerMappingInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"agentAutoUpdateStatus\":\"Enabled\",\"automationAccountArmId\":\"cadwvpsozjii\",\"automationAccountAuthenticationType\":\"RunAsAccount\"}") + .toObject(A2AUpdateContainerMappingInput.class); + Assertions.assertEquals(AgentAutoUpdateStatus.ENABLED, model.agentAutoUpdateStatus()); + Assertions.assertEquals("cadwvpsozjii", model.automationAccountArmId()); + Assertions + .assertEquals( + AutomationAccountAuthenticationType.RUN_AS_ACCOUNT, model.automationAccountAuthenticationType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AUpdateContainerMappingInput model = + new A2AUpdateContainerMappingInput() + .withAgentAutoUpdateStatus(AgentAutoUpdateStatus.ENABLED) + .withAutomationAccountArmId("cadwvpsozjii") + .withAutomationAccountAuthenticationType(AutomationAccountAuthenticationType.RUN_AS_ACCOUNT); + model = BinaryData.fromObject(model).toObject(A2AUpdateContainerMappingInput.class); + Assertions.assertEquals(AgentAutoUpdateStatus.ENABLED, model.agentAutoUpdateStatus()); + Assertions.assertEquals("cadwvpsozjii", model.automationAccountArmId()); + Assertions + .assertEquals( + AutomationAccountAuthenticationType.RUN_AS_ACCOUNT, model.automationAccountAuthenticationType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AVmDiskInputDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AVmDiskInputDetailsTests.java new file mode 100644 index 000000000000..b0571d95f7ac --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AVmDiskInputDetailsTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AVmDiskInputDetails; +import org.junit.jupiter.api.Assertions; + +public final class A2AVmDiskInputDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AVmDiskInputDetails model = + BinaryData + .fromString( + "{\"diskUri\":\"qdx\",\"recoveryAzureStorageAccountId\":\"urnpnuhzafccnuh\",\"primaryStagingAzureStorageAccountId\":\"i\"}") + .toObject(A2AVmDiskInputDetails.class); + Assertions.assertEquals("qdx", model.diskUri()); + Assertions.assertEquals("urnpnuhzafccnuh", model.recoveryAzureStorageAccountId()); + Assertions.assertEquals("i", model.primaryStagingAzureStorageAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AVmDiskInputDetails model = + new A2AVmDiskInputDetails() + .withDiskUri("qdx") + .withRecoveryAzureStorageAccountId("urnpnuhzafccnuh") + .withPrimaryStagingAzureStorageAccountId("i"); + model = BinaryData.fromObject(model).toObject(A2AVmDiskInputDetails.class); + Assertions.assertEquals("qdx", model.diskUri()); + Assertions.assertEquals("urnpnuhzafccnuh", model.recoveryAzureStorageAccountId()); + Assertions.assertEquals("i", model.primaryStagingAzureStorageAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AZoneDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AZoneDetailsTests.java new file mode 100644 index 000000000000..4cabefd49400 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/A2AZoneDetailsTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AZoneDetails; +import org.junit.jupiter.api.Assertions; + +public final class A2AZoneDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + A2AZoneDetails model = + BinaryData.fromString("{\"source\":\"rl\",\"target\":\"zji\"}").toObject(A2AZoneDetails.class); + Assertions.assertEquals("rl", model.source()); + Assertions.assertEquals("zji", model.target()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + A2AZoneDetails model = new A2AZoneDetails().withSource("rl").withTarget("zji"); + model = BinaryData.fromObject(model).toObject(A2AZoneDetails.class); + Assertions.assertEquals("rl", model.source()); + Assertions.assertEquals("zji", model.target()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddDisksInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddDisksInputPropertiesTests.java new file mode 100644 index 000000000000..d67776d32dc5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddDisksInputPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddDisksInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput; + +public final class AddDisksInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AddDisksInputProperties model = + BinaryData + .fromString("{\"providerSpecificDetails\":{\"instanceType\":\"AddDisksProviderSpecificInput\"}}") + .toObject(AddDisksInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AddDisksInputProperties model = + new AddDisksInputProperties().withProviderSpecificDetails(new AddDisksProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(AddDisksInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddDisksInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddDisksInputTests.java new file mode 100644 index 000000000000..8e6fdf28e8bd --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddDisksInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddDisksInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddDisksInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput; + +public final class AddDisksInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AddDisksInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"AddDisksProviderSpecificInput\"}}}") + .toObject(AddDisksInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AddDisksInput model = + new AddDisksInput() + .withProperties( + new AddDisksInputProperties().withProviderSpecificDetails(new AddDisksProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(AddDisksInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddDisksProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddDisksProviderSpecificInputTests.java new file mode 100644 index 000000000000..7f656d743a07 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddDisksProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddDisksProviderSpecificInput; + +public final class AddDisksProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AddDisksProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"AddDisksProviderSpecificInput\"}") + .toObject(AddDisksProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AddDisksProviderSpecificInput model = new AddDisksProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(AddDisksProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddRecoveryServicesProviderInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddRecoveryServicesProviderInputPropertiesTests.java new file mode 100644 index 000000000000..fff77c4c2901 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddRecoveryServicesProviderInputPropertiesTests.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IdentityProviderInput; +import org.junit.jupiter.api.Assertions; + +public final class AddRecoveryServicesProviderInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AddRecoveryServicesProviderInputProperties model = + BinaryData + .fromString( + "{\"machineName\":\"ysownbtgkbug\",\"machineId\":\"qctojcmisof\",\"biosId\":\"ypefojyqdhcupl\",\"authenticationIdentityInput\":{\"tenantId\":\"plcwkhi\",\"applicationId\":\"ihlhzdsqtzb\",\"objectId\":\"rgnowcjhfgm\",\"audience\":\"ecactx\",\"aadAuthority\":\"wotey\"},\"resourceAccessIdentityInput\":{\"tenantId\":\"wcluqovekqvgq\",\"applicationId\":\"uwifzmpjwyiv\",\"objectId\":\"ikf\",\"audience\":\"cvhrfsp\",\"aadAuthority\":\"uagrttikteusqc\"},\"dataPlaneAuthenticationIdentityInput\":{\"tenantId\":\"vyklxuby\",\"applicationId\":\"affmmfblcqc\",\"objectId\":\"ubgq\",\"audience\":\"brta\",\"aadAuthority\":\"metttwgd\"}}") + .toObject(AddRecoveryServicesProviderInputProperties.class); + Assertions.assertEquals("ysownbtgkbug", model.machineName()); + Assertions.assertEquals("qctojcmisof", model.machineId()); + Assertions.assertEquals("ypefojyqdhcupl", model.biosId()); + Assertions.assertEquals("plcwkhi", model.authenticationIdentityInput().tenantId()); + Assertions.assertEquals("ihlhzdsqtzb", model.authenticationIdentityInput().applicationId()); + Assertions.assertEquals("rgnowcjhfgm", model.authenticationIdentityInput().objectId()); + Assertions.assertEquals("ecactx", model.authenticationIdentityInput().audience()); + Assertions.assertEquals("wotey", model.authenticationIdentityInput().aadAuthority()); + Assertions.assertEquals("wcluqovekqvgq", model.resourceAccessIdentityInput().tenantId()); + Assertions.assertEquals("uwifzmpjwyiv", model.resourceAccessIdentityInput().applicationId()); + Assertions.assertEquals("ikf", model.resourceAccessIdentityInput().objectId()); + Assertions.assertEquals("cvhrfsp", model.resourceAccessIdentityInput().audience()); + Assertions.assertEquals("uagrttikteusqc", model.resourceAccessIdentityInput().aadAuthority()); + Assertions.assertEquals("vyklxuby", model.dataPlaneAuthenticationIdentityInput().tenantId()); + Assertions.assertEquals("affmmfblcqc", model.dataPlaneAuthenticationIdentityInput().applicationId()); + Assertions.assertEquals("ubgq", model.dataPlaneAuthenticationIdentityInput().objectId()); + Assertions.assertEquals("brta", model.dataPlaneAuthenticationIdentityInput().audience()); + Assertions.assertEquals("metttwgd", model.dataPlaneAuthenticationIdentityInput().aadAuthority()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AddRecoveryServicesProviderInputProperties model = + new AddRecoveryServicesProviderInputProperties() + .withMachineName("ysownbtgkbug") + .withMachineId("qctojcmisof") + .withBiosId("ypefojyqdhcupl") + .withAuthenticationIdentityInput( + new IdentityProviderInput() + .withTenantId("plcwkhi") + .withApplicationId("ihlhzdsqtzb") + .withObjectId("rgnowcjhfgm") + .withAudience("ecactx") + .withAadAuthority("wotey")) + .withResourceAccessIdentityInput( + new IdentityProviderInput() + .withTenantId("wcluqovekqvgq") + .withApplicationId("uwifzmpjwyiv") + .withObjectId("ikf") + .withAudience("cvhrfsp") + .withAadAuthority("uagrttikteusqc")) + .withDataPlaneAuthenticationIdentityInput( + new IdentityProviderInput() + .withTenantId("vyklxuby") + .withApplicationId("affmmfblcqc") + .withObjectId("ubgq") + .withAudience("brta") + .withAadAuthority("metttwgd")); + model = BinaryData.fromObject(model).toObject(AddRecoveryServicesProviderInputProperties.class); + Assertions.assertEquals("ysownbtgkbug", model.machineName()); + Assertions.assertEquals("qctojcmisof", model.machineId()); + Assertions.assertEquals("ypefojyqdhcupl", model.biosId()); + Assertions.assertEquals("plcwkhi", model.authenticationIdentityInput().tenantId()); + Assertions.assertEquals("ihlhzdsqtzb", model.authenticationIdentityInput().applicationId()); + Assertions.assertEquals("rgnowcjhfgm", model.authenticationIdentityInput().objectId()); + Assertions.assertEquals("ecactx", model.authenticationIdentityInput().audience()); + Assertions.assertEquals("wotey", model.authenticationIdentityInput().aadAuthority()); + Assertions.assertEquals("wcluqovekqvgq", model.resourceAccessIdentityInput().tenantId()); + Assertions.assertEquals("uwifzmpjwyiv", model.resourceAccessIdentityInput().applicationId()); + Assertions.assertEquals("ikf", model.resourceAccessIdentityInput().objectId()); + Assertions.assertEquals("cvhrfsp", model.resourceAccessIdentityInput().audience()); + Assertions.assertEquals("uagrttikteusqc", model.resourceAccessIdentityInput().aadAuthority()); + Assertions.assertEquals("vyklxuby", model.dataPlaneAuthenticationIdentityInput().tenantId()); + Assertions.assertEquals("affmmfblcqc", model.dataPlaneAuthenticationIdentityInput().applicationId()); + Assertions.assertEquals("ubgq", model.dataPlaneAuthenticationIdentityInput().objectId()); + Assertions.assertEquals("brta", model.dataPlaneAuthenticationIdentityInput().audience()); + Assertions.assertEquals("metttwgd", model.dataPlaneAuthenticationIdentityInput().aadAuthority()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddRecoveryServicesProviderInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddRecoveryServicesProviderInputTests.java new file mode 100644 index 000000000000..d8e3be1ea2a8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddRecoveryServicesProviderInputTests.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddRecoveryServicesProviderInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IdentityProviderInput; +import org.junit.jupiter.api.Assertions; + +public final class AddRecoveryServicesProviderInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AddRecoveryServicesProviderInput model = + BinaryData + .fromString( + "{\"properties\":{\"machineName\":\"xg\",\"machineId\":\"oyxcdyuib\",\"biosId\":\"fdn\",\"authenticationIdentityInput\":{\"tenantId\":\"zydvfvf\",\"applicationId\":\"jnaeois\",\"objectId\":\"vhmgorffukis\",\"audience\":\"vwmzhwplefaxvxil\",\"aadAuthority\":\"btgn\"},\"resourceAccessIdentityInput\":{\"tenantId\":\"nzeyqxtjj\",\"applicationId\":\"zqlqhyc\",\"objectId\":\"vodggxdbee\",\"audience\":\"mieknlraria\",\"aadAuthority\":\"wiuagydwqf\"},\"dataPlaneAuthenticationIdentityInput\":{\"tenantId\":\"lyr\",\"applicationId\":\"giagtcojo\",\"objectId\":\"qwogfnzjvus\",\"audience\":\"zldmozuxy\",\"aadAuthority\":\"fsbtkad\"}}}") + .toObject(AddRecoveryServicesProviderInput.class); + Assertions.assertEquals("xg", model.properties().machineName()); + Assertions.assertEquals("oyxcdyuib", model.properties().machineId()); + Assertions.assertEquals("fdn", model.properties().biosId()); + Assertions.assertEquals("zydvfvf", model.properties().authenticationIdentityInput().tenantId()); + Assertions.assertEquals("jnaeois", model.properties().authenticationIdentityInput().applicationId()); + Assertions.assertEquals("vhmgorffukis", model.properties().authenticationIdentityInput().objectId()); + Assertions.assertEquals("vwmzhwplefaxvxil", model.properties().authenticationIdentityInput().audience()); + Assertions.assertEquals("btgn", model.properties().authenticationIdentityInput().aadAuthority()); + Assertions.assertEquals("nzeyqxtjj", model.properties().resourceAccessIdentityInput().tenantId()); + Assertions.assertEquals("zqlqhyc", model.properties().resourceAccessIdentityInput().applicationId()); + Assertions.assertEquals("vodggxdbee", model.properties().resourceAccessIdentityInput().objectId()); + Assertions.assertEquals("mieknlraria", model.properties().resourceAccessIdentityInput().audience()); + Assertions.assertEquals("wiuagydwqf", model.properties().resourceAccessIdentityInput().aadAuthority()); + Assertions.assertEquals("lyr", model.properties().dataPlaneAuthenticationIdentityInput().tenantId()); + Assertions.assertEquals("giagtcojo", model.properties().dataPlaneAuthenticationIdentityInput().applicationId()); + Assertions.assertEquals("qwogfnzjvus", model.properties().dataPlaneAuthenticationIdentityInput().objectId()); + Assertions.assertEquals("zldmozuxy", model.properties().dataPlaneAuthenticationIdentityInput().audience()); + Assertions.assertEquals("fsbtkad", model.properties().dataPlaneAuthenticationIdentityInput().aadAuthority()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AddRecoveryServicesProviderInput model = + new AddRecoveryServicesProviderInput() + .withProperties( + new AddRecoveryServicesProviderInputProperties() + .withMachineName("xg") + .withMachineId("oyxcdyuib") + .withBiosId("fdn") + .withAuthenticationIdentityInput( + new IdentityProviderInput() + .withTenantId("zydvfvf") + .withApplicationId("jnaeois") + .withObjectId("vhmgorffukis") + .withAudience("vwmzhwplefaxvxil") + .withAadAuthority("btgn")) + .withResourceAccessIdentityInput( + new IdentityProviderInput() + .withTenantId("nzeyqxtjj") + .withApplicationId("zqlqhyc") + .withObjectId("vodggxdbee") + .withAudience("mieknlraria") + .withAadAuthority("wiuagydwqf")) + .withDataPlaneAuthenticationIdentityInput( + new IdentityProviderInput() + .withTenantId("lyr") + .withApplicationId("giagtcojo") + .withObjectId("qwogfnzjvus") + .withAudience("zldmozuxy") + .withAadAuthority("fsbtkad"))); + model = BinaryData.fromObject(model).toObject(AddRecoveryServicesProviderInput.class); + Assertions.assertEquals("xg", model.properties().machineName()); + Assertions.assertEquals("oyxcdyuib", model.properties().machineId()); + Assertions.assertEquals("fdn", model.properties().biosId()); + Assertions.assertEquals("zydvfvf", model.properties().authenticationIdentityInput().tenantId()); + Assertions.assertEquals("jnaeois", model.properties().authenticationIdentityInput().applicationId()); + Assertions.assertEquals("vhmgorffukis", model.properties().authenticationIdentityInput().objectId()); + Assertions.assertEquals("vwmzhwplefaxvxil", model.properties().authenticationIdentityInput().audience()); + Assertions.assertEquals("btgn", model.properties().authenticationIdentityInput().aadAuthority()); + Assertions.assertEquals("nzeyqxtjj", model.properties().resourceAccessIdentityInput().tenantId()); + Assertions.assertEquals("zqlqhyc", model.properties().resourceAccessIdentityInput().applicationId()); + Assertions.assertEquals("vodggxdbee", model.properties().resourceAccessIdentityInput().objectId()); + Assertions.assertEquals("mieknlraria", model.properties().resourceAccessIdentityInput().audience()); + Assertions.assertEquals("wiuagydwqf", model.properties().resourceAccessIdentityInput().aadAuthority()); + Assertions.assertEquals("lyr", model.properties().dataPlaneAuthenticationIdentityInput().tenantId()); + Assertions.assertEquals("giagtcojo", model.properties().dataPlaneAuthenticationIdentityInput().applicationId()); + Assertions.assertEquals("qwogfnzjvus", model.properties().dataPlaneAuthenticationIdentityInput().objectId()); + Assertions.assertEquals("zldmozuxy", model.properties().dataPlaneAuthenticationIdentityInput().audience()); + Assertions.assertEquals("fsbtkad", model.properties().dataPlaneAuthenticationIdentityInput().aadAuthority()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddVCenterRequestPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddVCenterRequestPropertiesTests.java new file mode 100644 index 000000000000..b57b4d32be3d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddVCenterRequestPropertiesTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddVCenterRequestProperties; +import org.junit.jupiter.api.Assertions; + +public final class AddVCenterRequestPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AddVCenterRequestProperties model = + BinaryData + .fromString( + "{\"friendlyName\":\"dhzmmesckdlp\",\"ipAddress\":\"zrcxfailcfxwmdbo\",\"processServerId\":\"fgsftufqob\",\"port\":\"lnacgcc\",\"runAsAccountId\":\"nhxk\"}") + .toObject(AddVCenterRequestProperties.class); + Assertions.assertEquals("dhzmmesckdlp", model.friendlyName()); + Assertions.assertEquals("zrcxfailcfxwmdbo", model.ipAddress()); + Assertions.assertEquals("fgsftufqob", model.processServerId()); + Assertions.assertEquals("lnacgcc", model.port()); + Assertions.assertEquals("nhxk", model.runAsAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AddVCenterRequestProperties model = + new AddVCenterRequestProperties() + .withFriendlyName("dhzmmesckdlp") + .withIpAddress("zrcxfailcfxwmdbo") + .withProcessServerId("fgsftufqob") + .withPort("lnacgcc") + .withRunAsAccountId("nhxk"); + model = BinaryData.fromObject(model).toObject(AddVCenterRequestProperties.class); + Assertions.assertEquals("dhzmmesckdlp", model.friendlyName()); + Assertions.assertEquals("zrcxfailcfxwmdbo", model.ipAddress()); + Assertions.assertEquals("fgsftufqob", model.processServerId()); + Assertions.assertEquals("lnacgcc", model.port()); + Assertions.assertEquals("nhxk", model.runAsAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddVCenterRequestTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddVCenterRequestTests.java new file mode 100644 index 000000000000..9a94780cdd21 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AddVCenterRequestTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddVCenterRequest; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AddVCenterRequestProperties; +import org.junit.jupiter.api.Assertions; + +public final class AddVCenterRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AddVCenterRequest model = + BinaryData + .fromString( + "{\"properties\":{\"friendlyName\":\"awddjibab\",\"ipAddress\":\"ititvtzeexavoxt\",\"processServerId\":\"lecdmdqbw\",\"port\":\"pqtgsfjac\",\"runAsAccountId\":\"lhhxudbxvodhtnsi\"}}") + .toObject(AddVCenterRequest.class); + Assertions.assertEquals("awddjibab", model.properties().friendlyName()); + Assertions.assertEquals("ititvtzeexavoxt", model.properties().ipAddress()); + Assertions.assertEquals("lecdmdqbw", model.properties().processServerId()); + Assertions.assertEquals("pqtgsfjac", model.properties().port()); + Assertions.assertEquals("lhhxudbxvodhtnsi", model.properties().runAsAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AddVCenterRequest model = + new AddVCenterRequest() + .withProperties( + new AddVCenterRequestProperties() + .withFriendlyName("awddjibab") + .withIpAddress("ititvtzeexavoxt") + .withProcessServerId("lecdmdqbw") + .withPort("pqtgsfjac") + .withRunAsAccountId("lhhxudbxvodhtnsi")); + model = BinaryData.fromObject(model).toObject(AddVCenterRequest.class); + Assertions.assertEquals("awddjibab", model.properties().friendlyName()); + Assertions.assertEquals("ititvtzeexavoxt", model.properties().ipAddress()); + Assertions.assertEquals("lecdmdqbw", model.properties().processServerId()); + Assertions.assertEquals("pqtgsfjac", model.properties().port()); + Assertions.assertEquals("lhhxudbxvodhtnsi", model.properties().runAsAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AgentDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AgentDetailsTests.java new file mode 100644 index 000000000000..2d50564ba70f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AgentDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AgentDetails; + +public final class AgentDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentDetails model = + BinaryData + .fromString( + "{\"agentId\":\"qfhefkwabsol\",\"machineId\":\"nqqlmgnl\",\"biosId\":\"sjxtel\",\"fqdn\":\"hvuqbo\",\"disks\":[{\"diskId\":\"zqocarku\",\"diskName\":\"bc\",\"isOSDisk\":\"dtsnxawqytllhdyz\",\"capacityInBytes\":4408018623458565457,\"lunId\":790899458}]}") + .toObject(AgentDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AgentDetails model = new AgentDetails(); + model = BinaryData.fromObject(model).toObject(AgentDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AgentDiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AgentDiskDetailsTests.java new file mode 100644 index 000000000000..f22bbf493713 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AgentDiskDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AgentDiskDetails; + +public final class AgentDiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentDiskDetails model = + BinaryData + .fromString( + "{\"diskId\":\"nxakckyw\",\"diskName\":\"x\",\"isOSDisk\":\"abjkdtfohfao\",\"capacityInBytes\":5659515679437313606,\"lunId\":1355433605}") + .toObject(AgentDiskDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AgentDiskDetails model = new AgentDiskDetails(); + model = BinaryData.fromObject(model).toObject(AgentDiskDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AlertCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AlertCollectionTests.java new file mode 100644 index 000000000000..6e7ac7c852b9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AlertCollectionTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.AlertInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AlertCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AlertProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AlertCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AlertCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"sendToOwners\":\"n\",\"customEmailAddresses\":[\"ybrk\"],\"locale\":\"dumjgrtfwvuk\"},\"location\":\"audccsnhs\",\"id\":\"cnyejhkryhtnapcz\",\"name\":\"lokjyemkk\",\"type\":\"ni\"}],\"nextLink\":\"oxzjnchgejspod\"}") + .toObject(AlertCollection.class); + Assertions.assertEquals("n", model.value().get(0).properties().sendToOwners()); + Assertions.assertEquals("ybrk", model.value().get(0).properties().customEmailAddresses().get(0)); + Assertions.assertEquals("dumjgrtfwvuk", model.value().get(0).properties().locale()); + Assertions.assertEquals("audccsnhs", model.value().get(0).location()); + Assertions.assertEquals("oxzjnchgejspod", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AlertCollection model = + new AlertCollection() + .withValue( + Arrays + .asList( + new AlertInner() + .withProperties( + new AlertProperties() + .withSendToOwners("n") + .withCustomEmailAddresses(Arrays.asList("ybrk")) + .withLocale("dumjgrtfwvuk")) + .withLocation("audccsnhs"))) + .withNextLink("oxzjnchgejspod"); + model = BinaryData.fromObject(model).toObject(AlertCollection.class); + Assertions.assertEquals("n", model.value().get(0).properties().sendToOwners()); + Assertions.assertEquals("ybrk", model.value().get(0).properties().customEmailAddresses().get(0)); + Assertions.assertEquals("dumjgrtfwvuk", model.value().get(0).properties().locale()); + Assertions.assertEquals("audccsnhs", model.value().get(0).location()); + Assertions.assertEquals("oxzjnchgejspod", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AlertInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AlertInnerTests.java new file mode 100644 index 000000000000..d90709c65828 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AlertInnerTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.AlertInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AlertProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AlertInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AlertInner model = + BinaryData + .fromString( + "{\"properties\":{\"sendToOwners\":\"lzydehojwyahux\",\"customEmailAddresses\":[\"mqnjaqw\",\"xj\"],\"locale\":\"r\"},\"location\":\"vcputegj\",\"id\":\"wmfdatscmdvpjhul\",\"name\":\"uuvmkjozkrwfnd\",\"type\":\"odjpslwejd\"}") + .toObject(AlertInner.class); + Assertions.assertEquals("lzydehojwyahux", model.properties().sendToOwners()); + Assertions.assertEquals("mqnjaqw", model.properties().customEmailAddresses().get(0)); + Assertions.assertEquals("r", model.properties().locale()); + Assertions.assertEquals("vcputegj", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AlertInner model = + new AlertInner() + .withProperties( + new AlertProperties() + .withSendToOwners("lzydehojwyahux") + .withCustomEmailAddresses(Arrays.asList("mqnjaqw", "xj")) + .withLocale("r")) + .withLocation("vcputegj"); + model = BinaryData.fromObject(model).toObject(AlertInner.class); + Assertions.assertEquals("lzydehojwyahux", model.properties().sendToOwners()); + Assertions.assertEquals("mqnjaqw", model.properties().customEmailAddresses().get(0)); + Assertions.assertEquals("r", model.properties().locale()); + Assertions.assertEquals("vcputegj", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AlertPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AlertPropertiesTests.java new file mode 100644 index 000000000000..e742b212525a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AlertPropertiesTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AlertProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AlertPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AlertProperties model = + BinaryData + .fromString( + "{\"sendToOwners\":\"wryoqpsoacc\",\"customEmailAddresses\":[\"akl\",\"lahbcryff\",\"fdosyg\"],\"locale\":\"paojakhmsbzjh\"}") + .toObject(AlertProperties.class); + Assertions.assertEquals("wryoqpsoacc", model.sendToOwners()); + Assertions.assertEquals("akl", model.customEmailAddresses().get(0)); + Assertions.assertEquals("paojakhmsbzjh", model.locale()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AlertProperties model = + new AlertProperties() + .withSendToOwners("wryoqpsoacc") + .withCustomEmailAddresses(Arrays.asList("akl", "lahbcryff", "fdosyg")) + .withLocale("paojakhmsbzjh"); + model = BinaryData.fromObject(model).toObject(AlertProperties.class); + Assertions.assertEquals("wryoqpsoacc", model.sendToOwners()); + Assertions.assertEquals("akl", model.customEmailAddresses().get(0)); + Assertions.assertEquals("paojakhmsbzjh", model.locale()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceCollectionTests.java new file mode 100644 index 000000000000..69236532cc47 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceCollectionTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.ReplicationApplianceInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplianceCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplianceSpecificDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationApplianceProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApplianceCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplianceCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"ApplianceSpecificDetails\"}}},{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"ApplianceSpecificDetails\"}}},{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"ApplianceSpecificDetails\"}}}],\"nextLink\":\"nuvamiheogna\"}") + .toObject(ApplianceCollection.class); + Assertions.assertEquals("nuvamiheogna", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplianceCollection model = + new ApplianceCollection() + .withValue( + Arrays + .asList( + new ReplicationApplianceInner() + .withProperties( + new ReplicationApplianceProperties() + .withProviderSpecificDetails(new ApplianceSpecificDetails())), + new ReplicationApplianceInner() + .withProperties( + new ReplicationApplianceProperties() + .withProviderSpecificDetails(new ApplianceSpecificDetails())), + new ReplicationApplianceInner() + .withProperties( + new ReplicationApplianceProperties() + .withProviderSpecificDetails(new ApplianceSpecificDetails())))) + .withNextLink("nuvamiheogna"); + model = BinaryData.fromObject(model).toObject(ApplianceCollection.class); + Assertions.assertEquals("nuvamiheogna", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceMonitoringDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceMonitoringDetailsTests.java new file mode 100644 index 000000000000..bcc65437c57d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceMonitoringDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplianceMonitoringDetails; + +public final class ApplianceMonitoringDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplianceMonitoringDetails model = + BinaryData + .fromString( + "{\"cpuDetails\":{\"capacity\":8662079962112784708,\"processUtilization\":0.6405594211104648,\"totalUtilization\":82.0905475524268,\"status\":\"kcrr\"},\"ramDetails\":{\"capacity\":8013743376353139388,\"processUtilization\":1.694855656985783,\"totalUtilization\":1.5593173023171092,\"status\":\"ddacbcbgydlqidy\"},\"datastoreSnapshot\":[{\"totalSnapshotsSupported\":7488275222478686566,\"totalSnapshotsCreated\":2902686094359114858,\"dataStoreName\":\"kfbn\"},{\"totalSnapshotsSupported\":7259499785959731497,\"totalSnapshotsCreated\":4333536385090972582,\"dataStoreName\":\"bnfnqtxjtoma\"},{\"totalSnapshotsSupported\":45293283846031932,\"totalSnapshotsCreated\":4569715227142190855,\"dataStoreName\":\"epl\"}],\"disksReplicationDetails\":{\"capacity\":8132115358222180607,\"processUtilization\":1.9623944997706366,\"totalUtilization\":8.026231357545443,\"status\":\"exa\"},\"esxiNfcBuffer\":{\"capacity\":4341656564886470437,\"processUtilization\":40.02295487844362,\"totalUtilization\":89.70679469125682,\"status\":\"ycs\"},\"networkBandwidth\":{\"capacity\":5138554080249609396,\"processUtilization\":20.180830067778864,\"totalUtilization\":22.17605778669388,\"status\":\"ehzptdmk\"}}") + .toObject(ApplianceMonitoringDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplianceMonitoringDetails model = new ApplianceMonitoringDetails(); + model = BinaryData.fromObject(model).toObject(ApplianceMonitoringDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceResourceDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceResourceDetailsTests.java new file mode 100644 index 000000000000..d0c00c7dac7e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceResourceDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplianceResourceDetails; + +public final class ApplianceResourceDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplianceResourceDetails model = + BinaryData + .fromString( + "{\"capacity\":7882439676090099182,\"processUtilization\":40.0101712180558,\"totalUtilization\":83.56402796641234,\"status\":\"efgybpmfbfununmp\"}") + .toObject(ApplianceResourceDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplianceResourceDetails model = new ApplianceResourceDetails(); + model = BinaryData.fromObject(model).toObject(ApplianceResourceDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceSpecificDetailsTests.java new file mode 100644 index 000000000000..9c7f1502b7bd --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplianceSpecificDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplianceSpecificDetails; + +public final class ApplianceSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplianceSpecificDetails model = + BinaryData + .fromString("{\"instanceType\":\"ApplianceSpecificDetails\"}") + .toObject(ApplianceSpecificDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplianceSpecificDetails model = new ApplianceSpecificDetails(); + model = BinaryData.fromObject(model).toObject(ApplianceSpecificDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplyRecoveryPointInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplyRecoveryPointInputPropertiesTests.java new file mode 100644 index 000000000000..d273fdc916ef --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplyRecoveryPointInputPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplyRecoveryPointInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class ApplyRecoveryPointInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplyRecoveryPointInputProperties model = + BinaryData + .fromString( + "{\"recoveryPointId\":\"rddh\",\"providerSpecificDetails\":{\"instanceType\":\"ApplyRecoveryPointProviderSpecificInput\"}}") + .toObject(ApplyRecoveryPointInputProperties.class); + Assertions.assertEquals("rddh", model.recoveryPointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplyRecoveryPointInputProperties model = + new ApplyRecoveryPointInputProperties() + .withRecoveryPointId("rddh") + .withProviderSpecificDetails(new ApplyRecoveryPointProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(ApplyRecoveryPointInputProperties.class); + Assertions.assertEquals("rddh", model.recoveryPointId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplyRecoveryPointInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplyRecoveryPointInputTests.java new file mode 100644 index 000000000000..135b653fcae1 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplyRecoveryPointInputTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplyRecoveryPointInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplyRecoveryPointInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class ApplyRecoveryPointInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplyRecoveryPointInput model = + BinaryData + .fromString( + "{\"properties\":{\"recoveryPointId\":\"nrojlpijnkr\",\"providerSpecificDetails\":{\"instanceType\":\"ApplyRecoveryPointProviderSpecificInput\"}}}") + .toObject(ApplyRecoveryPointInput.class); + Assertions.assertEquals("nrojlpijnkr", model.properties().recoveryPointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplyRecoveryPointInput model = + new ApplyRecoveryPointInput() + .withProperties( + new ApplyRecoveryPointInputProperties() + .withRecoveryPointId("nrojlpijnkr") + .withProviderSpecificDetails(new ApplyRecoveryPointProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(ApplyRecoveryPointInput.class); + Assertions.assertEquals("nrojlpijnkr", model.properties().recoveryPointId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplyRecoveryPointProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplyRecoveryPointProviderSpecificInputTests.java new file mode 100644 index 000000000000..9297b3900da1 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ApplyRecoveryPointProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplyRecoveryPointProviderSpecificInput; + +public final class ApplyRecoveryPointProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApplyRecoveryPointProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"ApplyRecoveryPointProviderSpecificInput\"}") + .toObject(ApplyRecoveryPointProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApplyRecoveryPointProviderSpecificInput model = new ApplyRecoveryPointProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(ApplyRecoveryPointProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AsrJobDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AsrJobDetailsTests.java new file mode 100644 index 000000000000..3d54848da425 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AsrJobDetailsTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AsrJobDetails; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AsrJobDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AsrJobDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"AsrJobDetails\",\"affectedObjectDetails\":{\"mhmjpjs\":\"wnphbkgfyrto\",\"mseharx\":\"dfpdqwtygevg\",\"n\":\"fv\",\"mbpjptnvwjh\":\"x\"}}") + .toObject(AsrJobDetails.class); + Assertions.assertEquals("wnphbkgfyrto", model.affectedObjectDetails().get("mhmjpjs")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AsrJobDetails model = + new AsrJobDetails() + .withAffectedObjectDetails( + mapOf("mhmjpjs", "wnphbkgfyrto", "mseharx", "dfpdqwtygevg", "n", "fv", "mbpjptnvwjh", "x")); + model = BinaryData.fromObject(model).toObject(AsrJobDetails.class); + Assertions.assertEquals("wnphbkgfyrto", model.affectedObjectDetails().get("mhmjpjs")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AutomationRunbookTaskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AutomationRunbookTaskDetailsTests.java new file mode 100644 index 000000000000..d84d1911fb9f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AutomationRunbookTaskDetailsTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AutomationRunbookTaskDetails; +import org.junit.jupiter.api.Assertions; + +public final class AutomationRunbookTaskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AutomationRunbookTaskDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"AutomationRunbookTaskDetails\",\"name\":\"idqpxlbtpakftn\",\"cloudServiceName\":\"twmykyut\",\"subscriptionId\":\"mdwmf\",\"accountName\":\"pycvjqdvdwkqpldr\",\"runbookId\":\"fgnaavuagnteta\",\"runbookName\":\"tnpdctuhspfefy\",\"jobId\":\"duyeuyl\",\"jobOutput\":\"hmtybkcgsuthhll\",\"isPrimarySideScript\":false}") + .toObject(AutomationRunbookTaskDetails.class); + Assertions.assertEquals("idqpxlbtpakftn", model.name()); + Assertions.assertEquals("twmykyut", model.cloudServiceName()); + Assertions.assertEquals("mdwmf", model.subscriptionId()); + Assertions.assertEquals("pycvjqdvdwkqpldr", model.accountName()); + Assertions.assertEquals("fgnaavuagnteta", model.runbookId()); + Assertions.assertEquals("tnpdctuhspfefy", model.runbookName()); + Assertions.assertEquals("duyeuyl", model.jobId()); + Assertions.assertEquals("hmtybkcgsuthhll", model.jobOutput()); + Assertions.assertEquals(false, model.isPrimarySideScript()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AutomationRunbookTaskDetails model = + new AutomationRunbookTaskDetails() + .withName("idqpxlbtpakftn") + .withCloudServiceName("twmykyut") + .withSubscriptionId("mdwmf") + .withAccountName("pycvjqdvdwkqpldr") + .withRunbookId("fgnaavuagnteta") + .withRunbookName("tnpdctuhspfefy") + .withJobId("duyeuyl") + .withJobOutput("hmtybkcgsuthhll") + .withIsPrimarySideScript(false); + model = BinaryData.fromObject(model).toObject(AutomationRunbookTaskDetails.class); + Assertions.assertEquals("idqpxlbtpakftn", model.name()); + Assertions.assertEquals("twmykyut", model.cloudServiceName()); + Assertions.assertEquals("mdwmf", model.subscriptionId()); + Assertions.assertEquals("pycvjqdvdwkqpldr", model.accountName()); + Assertions.assertEquals("fgnaavuagnteta", model.runbookId()); + Assertions.assertEquals("tnpdctuhspfefy", model.runbookName()); + Assertions.assertEquals("duyeuyl", model.jobId()); + Assertions.assertEquals("hmtybkcgsuthhll", model.jobOutput()); + Assertions.assertEquals(false, model.isPrimarySideScript()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureFabricCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureFabricCreationInputTests.java new file mode 100644 index 000000000000..5ce47e6e71d9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureFabricCreationInputTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AzureFabricCreationInput; +import org.junit.jupiter.api.Assertions; + +public final class AzureFabricCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureFabricCreationInput model = + BinaryData + .fromString("{\"instanceType\":\"Azure\",\"location\":\"nefxexlfciatx\"}") + .toObject(AzureFabricCreationInput.class); + Assertions.assertEquals("nefxexlfciatx", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureFabricCreationInput model = new AzureFabricCreationInput().withLocation("nefxexlfciatx"); + model = BinaryData.fromObject(model).toObject(AzureFabricCreationInput.class); + Assertions.assertEquals("nefxexlfciatx", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureFabricSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureFabricSpecificDetailsTests.java new file mode 100644 index 000000000000..f5c4022ae8e7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureFabricSpecificDetailsTests.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AExtendedLocationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AFabricSpecificLocationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2AZoneDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AzureFabricSpecificDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocationType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AzureFabricSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureFabricSpecificDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"Azure\",\"location\":\"rrlkmdskjhhx\",\"containerIds\":[\"jfoxcxscvslxl\",\"uavkrmukm\"],\"zones\":[{\"source\":\"xett\",\"target\":\"lojfkqidnqto\"},{\"source\":\"jhqxc\",\"target\":\"htkbtnq\"},{\"source\":\"ngldmbiipsn\",\"target\":\"wl\"}],\"extendedLocations\":[{\"primaryExtendedLocation\":{\"name\":\"xhhllxricct\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"uqqoaj\",\"type\":\"EdgeZone\"}},{\"primaryExtendedLocation\":{\"name\":\"y\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"srwvaexhdctrce\",\"type\":\"EdgeZone\"}},{\"primaryExtendedLocation\":{\"name\":\"brupobehdmljza\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"me\",\"type\":\"EdgeZone\"}}],\"locationDetails\":[{\"initialPrimaryZone\":\"bn\",\"initialRecoveryZone\":\"phepifexleqirc\",\"initialPrimaryExtendedLocation\":{\"name\":\"cly\",\"type\":\"EdgeZone\"},\"initialRecoveryExtendedLocation\":{\"name\":\"x\",\"type\":\"EdgeZone\"},\"initialPrimaryFabricLocation\":\"jlvczu\",\"initialRecoveryFabricLocation\":\"ac\",\"primaryZone\":\"nettepdjxqeskoy\",\"recoveryZone\":\"iylpck\",\"primaryExtendedLocation\":{\"name\":\"wsedvesk\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"gqphrgfnzhctmjts\",\"type\":\"EdgeZone\"},\"primaryFabricLocation\":\"bcbcpz\",\"recoveryFabricLocation\":\"pzeqacdldtz\"},{\"initialPrimaryZone\":\"ypefcpczshnuqnda\",\"initialRecoveryZone\":\"upfkhuytuszxhmtv\",\"initialPrimaryExtendedLocation\":{\"name\":\"egw\",\"type\":\"EdgeZone\"},\"initialRecoveryExtendedLocation\":{\"name\":\"kvzwydw\",\"type\":\"EdgeZone\"},\"initialPrimaryFabricLocation\":\"aokgkskjivbsshaj\",\"initialRecoveryFabricLocation\":\"u\",\"primaryZone\":\"eexpgeumi\",\"recoveryZone\":\"wuit\",\"primaryExtendedLocation\":{\"name\":\"exyionofninbd\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"xcwqqrsmpc\",\"type\":\"EdgeZone\"},\"primaryFabricLocation\":\"rtugavbzbcyks\",\"recoveryFabricLocation\":\"mf\"},{\"initialPrimaryZone\":\"dr\",\"initialRecoveryZone\":\"fcmkr\",\"initialPrimaryExtendedLocation\":{\"name\":\"sjcwjjxsgmbawvif\",\"type\":\"EdgeZone\"},\"initialRecoveryExtendedLocation\":{\"name\":\"eci\",\"type\":\"EdgeZone\"},\"initialPrimaryFabricLocation\":\"cjxwkloozrvtxvcm\",\"initialRecoveryFabricLocation\":\"unlcpxxv\",\"primaryZone\":\"yeyng\",\"recoveryZone\":\"vrquv\",\"primaryExtendedLocation\":{\"name\":\"gglpmcrdcuelj\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"hxmfqryarvsxzqb\",\"type\":\"EdgeZone\"},\"primaryFabricLocation\":\"jkayspthzo\",\"recoveryFabricLocation\":\"btl\"},{\"initialPrimaryZone\":\"tgblioskkfmk\",\"initialRecoveryZone\":\"djxyxgbkkqvjcteo\",\"initialPrimaryExtendedLocation\":{\"name\":\"l\",\"type\":\"EdgeZone\"},\"initialRecoveryExtendedLocation\":{\"name\":\"skkzpxvjnzdpvo\",\"type\":\"EdgeZone\"},\"initialPrimaryFabricLocation\":\"hpcnabxzfsn\",\"initialRecoveryFabricLocation\":\"ytexvzilmhivzk\",\"primaryZone\":\"wncknr\",\"recoveryZone\":\"ajlskzptj\",\"primaryExtendedLocation\":{\"name\":\"lwe\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"rthxqlehmcg\",\"type\":\"EdgeZone\"},\"primaryFabricLocation\":\"inue\",\"recoveryFabricLocation\":\"kamvfe\"}]}") + .toObject(AzureFabricSpecificDetails.class); + Assertions.assertEquals("rrlkmdskjhhx", model.location()); + Assertions.assertEquals("jfoxcxscvslxl", model.containerIds().get(0)); + Assertions.assertEquals("xett", model.zones().get(0).source()); + Assertions.assertEquals("lojfkqidnqto", model.zones().get(0).target()); + Assertions.assertEquals("xhhllxricct", model.extendedLocations().get(0).primaryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.extendedLocations().get(0).primaryExtendedLocation().type()); + Assertions.assertEquals("uqqoaj", model.extendedLocations().get(0).recoveryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.extendedLocations().get(0).recoveryExtendedLocation().type()); + Assertions.assertEquals("bn", model.locationDetails().get(0).initialPrimaryZone()); + Assertions.assertEquals("phepifexleqirc", model.locationDetails().get(0).initialRecoveryZone()); + Assertions.assertEquals("cly", model.locationDetails().get(0).initialPrimaryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.locationDetails().get(0).initialPrimaryExtendedLocation().type()); + Assertions.assertEquals("x", model.locationDetails().get(0).initialRecoveryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, + model.locationDetails().get(0).initialRecoveryExtendedLocation().type()); + Assertions.assertEquals("jlvczu", model.locationDetails().get(0).initialPrimaryFabricLocation()); + Assertions.assertEquals("ac", model.locationDetails().get(0).initialRecoveryFabricLocation()); + Assertions.assertEquals("nettepdjxqeskoy", model.locationDetails().get(0).primaryZone()); + Assertions.assertEquals("iylpck", model.locationDetails().get(0).recoveryZone()); + Assertions.assertEquals("wsedvesk", model.locationDetails().get(0).primaryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.locationDetails().get(0).primaryExtendedLocation().type()); + Assertions.assertEquals("gqphrgfnzhctmjts", model.locationDetails().get(0).recoveryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.locationDetails().get(0).recoveryExtendedLocation().type()); + Assertions.assertEquals("bcbcpz", model.locationDetails().get(0).primaryFabricLocation()); + Assertions.assertEquals("pzeqacdldtz", model.locationDetails().get(0).recoveryFabricLocation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureFabricSpecificDetails model = + new AzureFabricSpecificDetails() + .withLocation("rrlkmdskjhhx") + .withContainerIds(Arrays.asList("jfoxcxscvslxl", "uavkrmukm")) + .withZones( + Arrays + .asList( + new A2AZoneDetails().withSource("xett").withTarget("lojfkqidnqto"), + new A2AZoneDetails().withSource("jhqxc").withTarget("htkbtnq"), + new A2AZoneDetails().withSource("ngldmbiipsn").withTarget("wl"))) + .withExtendedLocations( + Arrays + .asList( + new A2AExtendedLocationDetails() + .withPrimaryExtendedLocation( + new ExtendedLocation() + .withName("xhhllxricct") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation().withName("uqqoaj").withType(ExtendedLocationType.EDGE_ZONE)), + new A2AExtendedLocationDetails() + .withPrimaryExtendedLocation( + new ExtendedLocation().withName("y").withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation() + .withName("srwvaexhdctrce") + .withType(ExtendedLocationType.EDGE_ZONE)), + new A2AExtendedLocationDetails() + .withPrimaryExtendedLocation( + new ExtendedLocation() + .withName("brupobehdmljza") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation().withName("me").withType(ExtendedLocationType.EDGE_ZONE)))) + .withLocationDetails( + Arrays + .asList( + new A2AFabricSpecificLocationDetails() + .withInitialPrimaryZone("bn") + .withInitialRecoveryZone("phepifexleqirc") + .withInitialPrimaryExtendedLocation( + new ExtendedLocation().withName("cly").withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialRecoveryExtendedLocation( + new ExtendedLocation().withName("x").withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialPrimaryFabricLocation("jlvczu") + .withInitialRecoveryFabricLocation("ac") + .withPrimaryZone("nettepdjxqeskoy") + .withRecoveryZone("iylpck") + .withPrimaryExtendedLocation( + new ExtendedLocation() + .withName("wsedvesk") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation() + .withName("gqphrgfnzhctmjts") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withPrimaryFabricLocation("bcbcpz") + .withRecoveryFabricLocation("pzeqacdldtz"), + new A2AFabricSpecificLocationDetails() + .withInitialPrimaryZone("ypefcpczshnuqnda") + .withInitialRecoveryZone("upfkhuytuszxhmtv") + .withInitialPrimaryExtendedLocation( + new ExtendedLocation().withName("egw").withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialRecoveryExtendedLocation( + new ExtendedLocation().withName("kvzwydw").withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialPrimaryFabricLocation("aokgkskjivbsshaj") + .withInitialRecoveryFabricLocation("u") + .withPrimaryZone("eexpgeumi") + .withRecoveryZone("wuit") + .withPrimaryExtendedLocation( + new ExtendedLocation() + .withName("exyionofninbd") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation() + .withName("xcwqqrsmpc") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withPrimaryFabricLocation("rtugavbzbcyks") + .withRecoveryFabricLocation("mf"), + new A2AFabricSpecificLocationDetails() + .withInitialPrimaryZone("dr") + .withInitialRecoveryZone("fcmkr") + .withInitialPrimaryExtendedLocation( + new ExtendedLocation() + .withName("sjcwjjxsgmbawvif") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialRecoveryExtendedLocation( + new ExtendedLocation().withName("eci").withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialPrimaryFabricLocation("cjxwkloozrvtxvcm") + .withInitialRecoveryFabricLocation("unlcpxxv") + .withPrimaryZone("yeyng") + .withRecoveryZone("vrquv") + .withPrimaryExtendedLocation( + new ExtendedLocation() + .withName("gglpmcrdcuelj") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation() + .withName("hxmfqryarvsxzqb") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withPrimaryFabricLocation("jkayspthzo") + .withRecoveryFabricLocation("btl"), + new A2AFabricSpecificLocationDetails() + .withInitialPrimaryZone("tgblioskkfmk") + .withInitialRecoveryZone("djxyxgbkkqvjcteo") + .withInitialPrimaryExtendedLocation( + new ExtendedLocation().withName("l").withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialRecoveryExtendedLocation( + new ExtendedLocation() + .withName("skkzpxvjnzdpvo") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withInitialPrimaryFabricLocation("hpcnabxzfsn") + .withInitialRecoveryFabricLocation("ytexvzilmhivzk") + .withPrimaryZone("wncknr") + .withRecoveryZone("ajlskzptj") + .withPrimaryExtendedLocation( + new ExtendedLocation().withName("lwe").withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation() + .withName("rthxqlehmcg") + .withType(ExtendedLocationType.EDGE_ZONE)) + .withPrimaryFabricLocation("inue") + .withRecoveryFabricLocation("kamvfe"))); + model = BinaryData.fromObject(model).toObject(AzureFabricSpecificDetails.class); + Assertions.assertEquals("rrlkmdskjhhx", model.location()); + Assertions.assertEquals("jfoxcxscvslxl", model.containerIds().get(0)); + Assertions.assertEquals("xett", model.zones().get(0).source()); + Assertions.assertEquals("lojfkqidnqto", model.zones().get(0).target()); + Assertions.assertEquals("xhhllxricct", model.extendedLocations().get(0).primaryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.extendedLocations().get(0).primaryExtendedLocation().type()); + Assertions.assertEquals("uqqoaj", model.extendedLocations().get(0).recoveryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.extendedLocations().get(0).recoveryExtendedLocation().type()); + Assertions.assertEquals("bn", model.locationDetails().get(0).initialPrimaryZone()); + Assertions.assertEquals("phepifexleqirc", model.locationDetails().get(0).initialRecoveryZone()); + Assertions.assertEquals("cly", model.locationDetails().get(0).initialPrimaryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.locationDetails().get(0).initialPrimaryExtendedLocation().type()); + Assertions.assertEquals("x", model.locationDetails().get(0).initialRecoveryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, + model.locationDetails().get(0).initialRecoveryExtendedLocation().type()); + Assertions.assertEquals("jlvczu", model.locationDetails().get(0).initialPrimaryFabricLocation()); + Assertions.assertEquals("ac", model.locationDetails().get(0).initialRecoveryFabricLocation()); + Assertions.assertEquals("nettepdjxqeskoy", model.locationDetails().get(0).primaryZone()); + Assertions.assertEquals("iylpck", model.locationDetails().get(0).recoveryZone()); + Assertions.assertEquals("wsedvesk", model.locationDetails().get(0).primaryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.locationDetails().get(0).primaryExtendedLocation().type()); + Assertions.assertEquals("gqphrgfnzhctmjts", model.locationDetails().get(0).recoveryExtendedLocation().name()); + Assertions + .assertEquals( + ExtendedLocationType.EDGE_ZONE, model.locationDetails().get(0).recoveryExtendedLocation().type()); + Assertions.assertEquals("bcbcpz", model.locationDetails().get(0).primaryFabricLocation()); + Assertions.assertEquals("pzeqacdldtz", model.locationDetails().get(0).recoveryFabricLocation()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureCreateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureCreateNetworkMappingInputTests.java new file mode 100644 index 000000000000..2c149ee54bcf --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureCreateNetworkMappingInputTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AzureToAzureCreateNetworkMappingInput; +import org.junit.jupiter.api.Assertions; + +public final class AzureToAzureCreateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureToAzureCreateNetworkMappingInput model = + BinaryData + .fromString("{\"instanceType\":\"AzureToAzure\",\"primaryNetworkId\":\"vq\"}") + .toObject(AzureToAzureCreateNetworkMappingInput.class); + Assertions.assertEquals("vq", model.primaryNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureToAzureCreateNetworkMappingInput model = + new AzureToAzureCreateNetworkMappingInput().withPrimaryNetworkId("vq"); + model = BinaryData.fromObject(model).toObject(AzureToAzureCreateNetworkMappingInput.class); + Assertions.assertEquals("vq", model.primaryNetworkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureNetworkMappingSettingsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureNetworkMappingSettingsTests.java new file mode 100644 index 000000000000..9e19acc1e681 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureNetworkMappingSettingsTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AzureToAzureNetworkMappingSettings; +import org.junit.jupiter.api.Assertions; + +public final class AzureToAzureNetworkMappingSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureToAzureNetworkMappingSettings model = + BinaryData + .fromString( + "{\"instanceType\":\"AzureToAzure\",\"primaryFabricLocation\":\"tmbqdabzfivfok\",\"recoveryFabricLocation\":\"sthhzagjfwy\"}") + .toObject(AzureToAzureNetworkMappingSettings.class); + Assertions.assertEquals("tmbqdabzfivfok", model.primaryFabricLocation()); + Assertions.assertEquals("sthhzagjfwy", model.recoveryFabricLocation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureToAzureNetworkMappingSettings model = + new AzureToAzureNetworkMappingSettings() + .withPrimaryFabricLocation("tmbqdabzfivfok") + .withRecoveryFabricLocation("sthhzagjfwy"); + model = BinaryData.fromObject(model).toObject(AzureToAzureNetworkMappingSettings.class); + Assertions.assertEquals("tmbqdabzfivfok", model.primaryFabricLocation()); + Assertions.assertEquals("sthhzagjfwy", model.recoveryFabricLocation()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureUpdateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureUpdateNetworkMappingInputTests.java new file mode 100644 index 000000000000..78a3dbe4cf14 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureUpdateNetworkMappingInputTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AzureToAzureUpdateNetworkMappingInput; +import org.junit.jupiter.api.Assertions; + +public final class AzureToAzureUpdateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureToAzureUpdateNetworkMappingInput model = + BinaryData + .fromString("{\"instanceType\":\"AzureToAzure\",\"primaryNetworkId\":\"lhgenuzejgvkv\"}") + .toObject(AzureToAzureUpdateNetworkMappingInput.class); + Assertions.assertEquals("lhgenuzejgvkv", model.primaryNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureToAzureUpdateNetworkMappingInput model = + new AzureToAzureUpdateNetworkMappingInput().withPrimaryNetworkId("lhgenuzejgvkv"); + model = BinaryData.fromObject(model).toObject(AzureToAzureUpdateNetworkMappingInput.class); + Assertions.assertEquals("lhgenuzejgvkv", model.primaryNetworkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureVmSyncedConfigDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureVmSyncedConfigDetailsTests.java new file mode 100644 index 000000000000..37af91133e6a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureToAzureVmSyncedConfigDetailsTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AzureToAzureVmSyncedConfigDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InputEndpoint; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureToAzureVmSyncedConfigDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureToAzureVmSyncedConfigDetails model = + BinaryData + .fromString( + "{\"tags\":{\"jceatlijjjrtva\":\"flwfgziiuci\",\"xk\":\"caszk\",\"ignohi\":\"ccxetyvkun\",\"indedvabbx\":\"kgqogjw\"},\"inputEndpoints\":[{\"endpointName\":\"dei\",\"privatePort\":1416675602,\"publicPort\":277548984,\"protocol\":\"cfxzirzzih\"},{\"endpointName\":\"ypusuvjslczwci\",\"privatePort\":73772123,\"publicPort\":1150687421,\"protocol\":\"fryvdmvxadqac\"}]}") + .toObject(AzureToAzureVmSyncedConfigDetails.class); + Assertions.assertEquals("flwfgziiuci", model.tags().get("jceatlijjjrtva")); + Assertions.assertEquals("dei", model.inputEndpoints().get(0).endpointName()); + Assertions.assertEquals(1416675602, model.inputEndpoints().get(0).privatePort()); + Assertions.assertEquals(277548984, model.inputEndpoints().get(0).publicPort()); + Assertions.assertEquals("cfxzirzzih", model.inputEndpoints().get(0).protocol()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureToAzureVmSyncedConfigDetails model = + new AzureToAzureVmSyncedConfigDetails() + .withTags( + mapOf( + "jceatlijjjrtva", + "flwfgziiuci", + "xk", + "caszk", + "ignohi", + "ccxetyvkun", + "indedvabbx", + "kgqogjw")) + .withInputEndpoints( + Arrays + .asList( + new InputEndpoint() + .withEndpointName("dei") + .withPrivatePort(1416675602) + .withPublicPort(277548984) + .withProtocol("cfxzirzzih"), + new InputEndpoint() + .withEndpointName("ypusuvjslczwci") + .withPrivatePort(73772123) + .withPublicPort(1150687421) + .withProtocol("fryvdmvxadqac"))); + model = BinaryData.fromObject(model).toObject(AzureToAzureVmSyncedConfigDetails.class); + Assertions.assertEquals("flwfgziiuci", model.tags().get("jceatlijjjrtva")); + Assertions.assertEquals("dei", model.inputEndpoints().get(0).endpointName()); + Assertions.assertEquals(1416675602, model.inputEndpoints().get(0).privatePort()); + Assertions.assertEquals(277548984, model.inputEndpoints().get(0).publicPort()); + Assertions.assertEquals("cfxzirzzih", model.inputEndpoints().get(0).protocol()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureVmDiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureVmDiskDetailsTests.java new file mode 100644 index 000000000000..c03c9055f775 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/AzureVmDiskDetailsTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AzureVmDiskDetails; +import org.junit.jupiter.api.Assertions; + +public final class AzureVmDiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureVmDiskDetails model = + BinaryData + .fromString( + "{\"vhdType\":\"aqszllrzl\",\"vhdId\":\"mdqgmihzpimcqr\",\"diskId\":\"xtminklogxsvtzar\",\"vhdName\":\"vqnsqk\",\"maxSizeMB\":\"mbjwzzoslpkyb\",\"targetDiskLocation\":\"lwkzpgajsqjcem\",\"targetDiskName\":\"mfuvqarwzxuqr\",\"lunId\":\"lui\",\"diskEncryptionSetId\":\"bwxsfgtdm\",\"customTargetDiskName\":\"xekr\"}") + .toObject(AzureVmDiskDetails.class); + Assertions.assertEquals("aqszllrzl", model.vhdType()); + Assertions.assertEquals("mdqgmihzpimcqr", model.vhdId()); + Assertions.assertEquals("xtminklogxsvtzar", model.diskId()); + Assertions.assertEquals("vqnsqk", model.vhdName()); + Assertions.assertEquals("mbjwzzoslpkyb", model.maxSizeMB()); + Assertions.assertEquals("lwkzpgajsqjcem", model.targetDiskLocation()); + Assertions.assertEquals("mfuvqarwzxuqr", model.targetDiskName()); + Assertions.assertEquals("lui", model.lunId()); + Assertions.assertEquals("bwxsfgtdm", model.diskEncryptionSetId()); + Assertions.assertEquals("xekr", model.customTargetDiskName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureVmDiskDetails model = + new AzureVmDiskDetails() + .withVhdType("aqszllrzl") + .withVhdId("mdqgmihzpimcqr") + .withDiskId("xtminklogxsvtzar") + .withVhdName("vqnsqk") + .withMaxSizeMB("mbjwzzoslpkyb") + .withTargetDiskLocation("lwkzpgajsqjcem") + .withTargetDiskName("mfuvqarwzxuqr") + .withLunId("lui") + .withDiskEncryptionSetId("bwxsfgtdm") + .withCustomTargetDiskName("xekr"); + model = BinaryData.fromObject(model).toObject(AzureVmDiskDetails.class); + Assertions.assertEquals("aqszllrzl", model.vhdType()); + Assertions.assertEquals("mdqgmihzpimcqr", model.vhdId()); + Assertions.assertEquals("xtminklogxsvtzar", model.diskId()); + Assertions.assertEquals("vqnsqk", model.vhdName()); + Assertions.assertEquals("mbjwzzoslpkyb", model.maxSizeMB()); + Assertions.assertEquals("lwkzpgajsqjcem", model.targetDiskLocation()); + Assertions.assertEquals("mfuvqarwzxuqr", model.targetDiskName()); + Assertions.assertEquals("lui", model.lunId()); + Assertions.assertEquals("bwxsfgtdm", model.diskEncryptionSetId()); + Assertions.assertEquals("xekr", model.customTargetDiskName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ComputeSizeErrorDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ComputeSizeErrorDetailsTests.java new file mode 100644 index 000000000000..5829c37db9f2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ComputeSizeErrorDetailsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ComputeSizeErrorDetails; +import org.junit.jupiter.api.Assertions; + +public final class ComputeSizeErrorDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ComputeSizeErrorDetails model = + BinaryData + .fromString("{\"message\":\"miloxggdufiqndie\",\"severity\":\"ao\"}") + .toObject(ComputeSizeErrorDetails.class); + Assertions.assertEquals("miloxggdufiqndie", model.message()); + Assertions.assertEquals("ao", model.severity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ComputeSizeErrorDetails model = + new ComputeSizeErrorDetails().withMessage("miloxggdufiqndie").withSeverity("ao"); + model = BinaryData.fromObject(model).toObject(ComputeSizeErrorDetails.class); + Assertions.assertEquals("miloxggdufiqndie", model.message()); + Assertions.assertEquals("ao", model.severity()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConfigurationSettingsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConfigurationSettingsTests.java new file mode 100644 index 000000000000..4dfe1916e603 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConfigurationSettingsTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ConfigurationSettings; + +public final class ConfigurationSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConfigurationSettings model = + BinaryData.fromString("{\"instanceType\":\"ConfigurationSettings\"}").toObject(ConfigurationSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConfigurationSettings model = new ConfigurationSettings(); + model = BinaryData.fromObject(model).toObject(ConfigurationSettings.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConfigureAlertRequestPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConfigureAlertRequestPropertiesTests.java new file mode 100644 index 000000000000..f11de8a888e2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConfigureAlertRequestPropertiesTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ConfigureAlertRequestPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConfigureAlertRequestProperties model = + BinaryData + .fromString( + "{\"sendToOwners\":\"fziton\",\"customEmailAddresses\":[\"fpjkjlxofp\",\"vhpfxxypininmay\"],\"locale\":\"ybb\"}") + .toObject(ConfigureAlertRequestProperties.class); + Assertions.assertEquals("fziton", model.sendToOwners()); + Assertions.assertEquals("fpjkjlxofp", model.customEmailAddresses().get(0)); + Assertions.assertEquals("ybb", model.locale()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConfigureAlertRequestProperties model = + new ConfigureAlertRequestProperties() + .withSendToOwners("fziton") + .withCustomEmailAddresses(Arrays.asList("fpjkjlxofp", "vhpfxxypininmay")) + .withLocale("ybb"); + model = BinaryData.fromObject(model).toObject(ConfigureAlertRequestProperties.class); + Assertions.assertEquals("fziton", model.sendToOwners()); + Assertions.assertEquals("fpjkjlxofp", model.customEmailAddresses().get(0)); + Assertions.assertEquals("ybb", model.locale()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConfigureAlertRequestTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConfigureAlertRequestTests.java new file mode 100644 index 000000000000..99cd21d79116 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConfigureAlertRequestTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ConfigureAlertRequest; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ConfigureAlertRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConfigureAlertRequest model = + BinaryData + .fromString( + "{\"properties\":{\"sendToOwners\":\"evdphlxaol\",\"customEmailAddresses\":[\"trg\",\"jbp\",\"zfsinzgvf\",\"jrwzox\"],\"locale\":\"tfell\"}}") + .toObject(ConfigureAlertRequest.class); + Assertions.assertEquals("evdphlxaol", model.properties().sendToOwners()); + Assertions.assertEquals("trg", model.properties().customEmailAddresses().get(0)); + Assertions.assertEquals("tfell", model.properties().locale()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConfigureAlertRequest model = + new ConfigureAlertRequest() + .withProperties( + new ConfigureAlertRequestProperties() + .withSendToOwners("evdphlxaol") + .withCustomEmailAddresses(Arrays.asList("trg", "jbp", "zfsinzgvf", "jrwzox")) + .withLocale("tfell")); + model = BinaryData.fromObject(model).toObject(ConfigureAlertRequest.class); + Assertions.assertEquals("evdphlxaol", model.properties().sendToOwners()); + Assertions.assertEquals("trg", model.properties().customEmailAddresses().get(0)); + Assertions.assertEquals("tfell", model.properties().locale()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConsistencyCheckTaskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConsistencyCheckTaskDetailsTests.java new file mode 100644 index 000000000000..b414eb34c6b2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ConsistencyCheckTaskDetailsTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ConsistencyCheckTaskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InconsistentVmDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ConsistencyCheckTaskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConsistencyCheckTaskDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"ConsistencyCheckTaskDetails\",\"vmDetails\":[{\"vmName\":\"kbudbtwaokb\",\"cloudName\":\"lyttaaknwfr\",\"details\":[\"sm\",\"p\",\"ujd\"],\"errorIds\":[\"toleksc\",\"ctnanqimwbzxp\",\"cldpkawn\"]}]}") + .toObject(ConsistencyCheckTaskDetails.class); + Assertions.assertEquals("kbudbtwaokb", model.vmDetails().get(0).vmName()); + Assertions.assertEquals("lyttaaknwfr", model.vmDetails().get(0).cloudName()); + Assertions.assertEquals("sm", model.vmDetails().get(0).details().get(0)); + Assertions.assertEquals("toleksc", model.vmDetails().get(0).errorIds().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConsistencyCheckTaskDetails model = + new ConsistencyCheckTaskDetails() + .withVmDetails( + Arrays + .asList( + new InconsistentVmDetails() + .withVmName("kbudbtwaokb") + .withCloudName("lyttaaknwfr") + .withDetails(Arrays.asList("sm", "p", "ujd")) + .withErrorIds(Arrays.asList("toleksc", "ctnanqimwbzxp", "cldpkawn")))); + model = BinaryData.fromObject(model).toObject(ConsistencyCheckTaskDetails.class); + Assertions.assertEquals("kbudbtwaokb", model.vmDetails().get(0).vmName()); + Assertions.assertEquals("lyttaaknwfr", model.vmDetails().get(0).cloudName()); + Assertions.assertEquals("sm", model.vmDetails().get(0).details().get(0)); + Assertions.assertEquals("toleksc", model.vmDetails().get(0).errorIds().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateNetworkMappingInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateNetworkMappingInputPropertiesTests.java new file mode 100644 index 000000000000..b043d5a42ed9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateNetworkMappingInputPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput; +import org.junit.jupiter.api.Assertions; + +public final class CreateNetworkMappingInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateNetworkMappingInputProperties model = + BinaryData + .fromString( + "{\"recoveryFabricName\":\"j\",\"recoveryNetworkId\":\"dpydn\",\"fabricSpecificDetails\":{\"instanceType\":\"FabricSpecificCreateNetworkMappingInput\"}}") + .toObject(CreateNetworkMappingInputProperties.class); + Assertions.assertEquals("j", model.recoveryFabricName()); + Assertions.assertEquals("dpydn", model.recoveryNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateNetworkMappingInputProperties model = + new CreateNetworkMappingInputProperties() + .withRecoveryFabricName("j") + .withRecoveryNetworkId("dpydn") + .withFabricSpecificDetails(new FabricSpecificCreateNetworkMappingInput()); + model = BinaryData.fromObject(model).toObject(CreateNetworkMappingInputProperties.class); + Assertions.assertEquals("j", model.recoveryFabricName()); + Assertions.assertEquals("dpydn", model.recoveryNetworkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateNetworkMappingInputTests.java new file mode 100644 index 000000000000..4164b93fcfd9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateNetworkMappingInputTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateNetworkMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput; +import org.junit.jupiter.api.Assertions; + +public final class CreateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateNetworkMappingInput model = + BinaryData + .fromString( + "{\"properties\":{\"recoveryFabricName\":\"yp\",\"recoveryNetworkId\":\"rbpizc\",\"fabricSpecificDetails\":{\"instanceType\":\"FabricSpecificCreateNetworkMappingInput\"}}}") + .toObject(CreateNetworkMappingInput.class); + Assertions.assertEquals("yp", model.properties().recoveryFabricName()); + Assertions.assertEquals("rbpizc", model.properties().recoveryNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateNetworkMappingInput model = + new CreateNetworkMappingInput() + .withProperties( + new CreateNetworkMappingInputProperties() + .withRecoveryFabricName("yp") + .withRecoveryNetworkId("rbpizc") + .withFabricSpecificDetails(new FabricSpecificCreateNetworkMappingInput())); + model = BinaryData.fromObject(model).toObject(CreateNetworkMappingInput.class); + Assertions.assertEquals("yp", model.properties().recoveryFabricName()); + Assertions.assertEquals("rbpizc", model.properties().recoveryNetworkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreatePolicyInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreatePolicyInputPropertiesTests.java new file mode 100644 index 000000000000..dbffc01f93b3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreatePolicyInputPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreatePolicyInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificInput; + +public final class CreatePolicyInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreatePolicyInputProperties model = + BinaryData + .fromString("{\"providerSpecificInput\":{\"instanceType\":\"PolicyProviderSpecificInput\"}}") + .toObject(CreatePolicyInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreatePolicyInputProperties model = + new CreatePolicyInputProperties().withProviderSpecificInput(new PolicyProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(CreatePolicyInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreatePolicyInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreatePolicyInputTests.java new file mode 100644 index 000000000000..b4ed4f6728b2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreatePolicyInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreatePolicyInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreatePolicyInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificInput; + +public final class CreatePolicyInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreatePolicyInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificInput\":{\"instanceType\":\"PolicyProviderSpecificInput\"}}}") + .toObject(CreatePolicyInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreatePolicyInput model = + new CreatePolicyInput() + .withProperties( + new CreatePolicyInputProperties().withProviderSpecificInput(new PolicyProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(CreatePolicyInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerInputPropertiesTests.java new file mode 100644 index 000000000000..87507729a49e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerInputPropertiesTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput; +import java.util.Arrays; + +public final class CreateProtectionContainerInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateProtectionContainerInputProperties model = + BinaryData + .fromString( + "{\"providerSpecificInput\":[{\"instanceType\":\"ReplicationProviderSpecificContainerCreationInput\"},{\"instanceType\":\"ReplicationProviderSpecificContainerCreationInput\"},{\"instanceType\":\"ReplicationProviderSpecificContainerCreationInput\"}]}") + .toObject(CreateProtectionContainerInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateProtectionContainerInputProperties model = + new CreateProtectionContainerInputProperties() + .withProviderSpecificInput( + Arrays + .asList( + new ReplicationProviderSpecificContainerCreationInput(), + new ReplicationProviderSpecificContainerCreationInput(), + new ReplicationProviderSpecificContainerCreationInput())); + model = BinaryData.fromObject(model).toObject(CreateProtectionContainerInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerInputTests.java new file mode 100644 index 000000000000..ea819842dcc7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerInputTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionContainerInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput; +import java.util.Arrays; + +public final class CreateProtectionContainerInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateProtectionContainerInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificInput\":[{\"instanceType\":\"ReplicationProviderSpecificContainerCreationInput\"},{\"instanceType\":\"ReplicationProviderSpecificContainerCreationInput\"},{\"instanceType\":\"ReplicationProviderSpecificContainerCreationInput\"}]}}") + .toObject(CreateProtectionContainerInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateProtectionContainerInput model = + new CreateProtectionContainerInput() + .withProperties( + new CreateProtectionContainerInputProperties() + .withProviderSpecificInput( + Arrays + .asList( + new ReplicationProviderSpecificContainerCreationInput(), + new ReplicationProviderSpecificContainerCreationInput(), + new ReplicationProviderSpecificContainerCreationInput()))); + model = BinaryData.fromObject(model).toObject(CreateProtectionContainerInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerMappingInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerMappingInputPropertiesTests.java new file mode 100644 index 000000000000..1e8b62c8da1c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerMappingInputPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput; +import org.junit.jupiter.api.Assertions; + +public final class CreateProtectionContainerMappingInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateProtectionContainerMappingInputProperties model = + BinaryData + .fromString( + "{\"targetProtectionContainerId\":\"qbmfpjbabwidf\",\"policyId\":\"sspuunnoxyhkx\",\"providerSpecificInput\":{\"instanceType\":\"ReplicationProviderSpecificContainerMappingInput\"}}") + .toObject(CreateProtectionContainerMappingInputProperties.class); + Assertions.assertEquals("qbmfpjbabwidf", model.targetProtectionContainerId()); + Assertions.assertEquals("sspuunnoxyhkx", model.policyId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateProtectionContainerMappingInputProperties model = + new CreateProtectionContainerMappingInputProperties() + .withTargetProtectionContainerId("qbmfpjbabwidf") + .withPolicyId("sspuunnoxyhkx") + .withProviderSpecificInput(new ReplicationProviderSpecificContainerMappingInput()); + model = BinaryData.fromObject(model).toObject(CreateProtectionContainerMappingInputProperties.class); + Assertions.assertEquals("qbmfpjbabwidf", model.targetProtectionContainerId()); + Assertions.assertEquals("sspuunnoxyhkx", model.policyId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerMappingInputTests.java new file mode 100644 index 000000000000..71539d5c35a4 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionContainerMappingInputTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionContainerMappingInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput; +import org.junit.jupiter.api.Assertions; + +public final class CreateProtectionContainerMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateProtectionContainerMappingInput model = + BinaryData + .fromString( + "{\"properties\":{\"targetProtectionContainerId\":\"smystuluqypfc\",\"policyId\":\"er\",\"providerSpecificInput\":{\"instanceType\":\"ReplicationProviderSpecificContainerMappingInput\"}}}") + .toObject(CreateProtectionContainerMappingInput.class); + Assertions.assertEquals("smystuluqypfc", model.properties().targetProtectionContainerId()); + Assertions.assertEquals("er", model.properties().policyId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateProtectionContainerMappingInput model = + new CreateProtectionContainerMappingInput() + .withProperties( + new CreateProtectionContainerMappingInputProperties() + .withTargetProtectionContainerId("smystuluqypfc") + .withPolicyId("er") + .withProviderSpecificInput(new ReplicationProviderSpecificContainerMappingInput())); + model = BinaryData.fromObject(model).toObject(CreateProtectionContainerMappingInput.class); + Assertions.assertEquals("smystuluqypfc", model.properties().targetProtectionContainerId()); + Assertions.assertEquals("er", model.properties().policyId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionIntentInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionIntentInputTests.java new file mode 100644 index 000000000000..0371d53b88eb --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionIntentInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionIntentInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionIntentProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails; + +public final class CreateProtectionIntentInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateProtectionIntentInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"CreateProtectionIntentProviderSpecificDetails\"}}}") + .toObject(CreateProtectionIntentInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateProtectionIntentInput model = + new CreateProtectionIntentInput() + .withProperties( + new CreateProtectionIntentProperties() + .withProviderSpecificDetails(new CreateProtectionIntentProviderSpecificDetails())); + model = BinaryData.fromObject(model).toObject(CreateProtectionIntentInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionIntentPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionIntentPropertiesTests.java new file mode 100644 index 000000000000..5788c56bc462 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionIntentPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionIntentProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails; + +public final class CreateProtectionIntentPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateProtectionIntentProperties model = + BinaryData + .fromString( + "{\"providerSpecificDetails\":{\"instanceType\":\"CreateProtectionIntentProviderSpecificDetails\"}}") + .toObject(CreateProtectionIntentProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateProtectionIntentProperties model = + new CreateProtectionIntentProperties() + .withProviderSpecificDetails(new CreateProtectionIntentProviderSpecificDetails()); + model = BinaryData.fromObject(model).toObject(CreateProtectionIntentProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionIntentProviderSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionIntentProviderSpecificDetailsTests.java new file mode 100644 index 000000000000..09e3b49f6b22 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateProtectionIntentProviderSpecificDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionIntentProviderSpecificDetails; + +public final class CreateProtectionIntentProviderSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateProtectionIntentProviderSpecificDetails model = + BinaryData + .fromString("{\"instanceType\":\"CreateProtectionIntentProviderSpecificDetails\"}") + .toObject(CreateProtectionIntentProviderSpecificDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateProtectionIntentProviderSpecificDetails model = new CreateProtectionIntentProviderSpecificDetails(); + model = BinaryData.fromObject(model).toObject(CreateProtectionIntentProviderSpecificDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateRecoveryPlanInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateRecoveryPlanInputPropertiesTests.java new file mode 100644 index 000000000000..e0fdd0929b08 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateRecoveryPlanInputPropertiesTests.java @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverDeploymentModel; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroup; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CreateRecoveryPlanInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateRecoveryPlanInputProperties model = + BinaryData + .fromString( + "{\"primaryFabricId\":\"ijp\",\"recoveryFabricId\":\"gsksrfhf\",\"failoverDeploymentModel\":\"NotApplicable\",\"groups\":[{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{\"id\":\"xwcdomm\",\"virtualMachineId\":\"fqawzfgbrttui\"},{\"id\":\"lkiexhajlfnthiq\",\"virtualMachineId\":\"uttdiygbp\"}],\"startGroupActions\":[{\"actionName\":\"swmtxk\",\"failoverTypes\":[\"PlannedFailover\",\"RepairReplication\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jlmec\",\"failoverTypes\":[\"ReverseReplicate\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"ezaifghtmo\",\"failoverTypes\":[\"PlannedFailover\",\"CancelFailover\",\"RepairReplication\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"bkrkjj\",\"failoverTypes\":[\"PlannedFailover\",\"CancelFailover\",\"RepairReplication\",\"TestFailoverCleanup\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"qoewdogiyetesy\",\"failoverTypes\":[\"Failback\",\"ReverseReplicate\",\"UnplannedFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"t\",\"failoverTypes\":[\"Failback\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{\"id\":\"etnjuhpsprkz\",\"virtualMachineId\":\"upia\"},{\"id\":\"xnafbw\",\"virtualMachineId\":\"oohtuovmaonurjtu\"},{\"id\":\"hihpvecmsl\",\"virtualMachineId\":\"bl\"}],\"startGroupActions\":[{\"actionName\":\"lt\",\"failoverTypes\":[\"DisableProtection\",\"CancelFailover\",\"TestFailoverCleanup\",\"TestFailoverCleanup\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"gctmgxuupbezq\",\"failoverTypes\":[\"PlannedFailover\",\"TestFailoverCleanup\",\"Commit\",\"TestFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"qkkyihztgeqmg\",\"failoverTypes\":[\"UnplannedFailover\",\"FinalizeFailback\",\"ReverseReplicate\",\"CancelFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"lcecfeh\",\"failoverTypes\":[\"TestFailoverCleanup\",\"TestFailoverCleanup\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"uhicqllizstacsjv\",\"failoverTypes\":[\"Failback\",\"SwitchProtection\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"wqejpmvsse\",\"failoverTypes\":[\"DisableProtection\",\"ChangePit\",\"CompleteMigration\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"cxtczhupeukn\",\"failoverTypes\":[\"TestFailover\",\"CancelFailover\",\"FinalizeFailback\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{\"id\":\"fbocyvhh\",\"virtualMachineId\":\"rtywi\"},{\"id\":\"mhlaku\",\"virtualMachineId\":\"gbhgau\"}],\"startGroupActions\":[{\"actionName\":\"ixmxufrsryjqgdkf\",\"failoverTypes\":[\"ChangePit\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"oqbvjhvefgwbmqj\",\"failoverTypes\":[\"CompleteMigration\",\"Commit\",\"TestFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ay\",\"failoverTypes\":[\"Commit\",\"CancelFailover\",\"FinalizeFailback\",\"CancelFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"b\",\"failoverTypes\":[\"FinalizeFailback\",\"ChangePit\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"fkmbtsuahxsgxj\",\"failoverTypes\":[\"FinalizeFailback\",\"PlannedFailover\",\"Commit\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{\"id\":\"wsdrnpxqwodif\",\"virtualMachineId\":\"xcjr\"},{\"id\":\"uabwibvjogjo\",\"virtualMachineId\":\"cyefoyzbamwine\"}],\"startGroupActions\":[{\"actionName\":\"fkak\",\"failoverTypes\":[\"FinalizeFailback\",\"UnplannedFailover\",\"CancelFailover\",\"Failback\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"lz\",\"failoverTypes\":[\"UnplannedFailover\",\"CancelFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"uxgvttxpnr\",\"failoverTypes\":[\"Failback\",\"UnplannedFailover\",\"FinalizeFailback\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"rekidswysk\",\"failoverTypes\":[\"CompleteMigration\",\"SwitchProtection\",\"CompleteMigration\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"kutvlxhrpqhv\",\"failoverTypes\":[\"CancelFailover\",\"TestFailover\",\"PlannedFailover\",\"DisableProtection\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"hbcdsziry\",\"failoverTypes\":[\"DisableProtection\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificInput\":[{\"instanceType\":\"RecoveryPlanProviderSpecificInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificInput\"}]}") + .toObject(CreateRecoveryPlanInputProperties.class); + Assertions.assertEquals("ijp", model.primaryFabricId()); + Assertions.assertEquals("gsksrfhf", model.recoveryFabricId()); + Assertions.assertEquals(FailoverDeploymentModel.NOT_APPLICABLE, model.failoverDeploymentModel()); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, model.groups().get(0).groupType()); + Assertions.assertEquals("xwcdomm", model.groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals("fqawzfgbrttui", model.groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("swmtxk", model.groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + model.groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("ezaifghtmo", model.groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + model.groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateRecoveryPlanInputProperties model = + new CreateRecoveryPlanInputProperties() + .withPrimaryFabricId("ijp") + .withRecoveryFabricId("gsksrfhf") + .withFailoverDeploymentModel(FailoverDeploymentModel.NOT_APPLICABLE) + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("xwcdomm") + .withVirtualMachineId("fqawzfgbrttui"), + new RecoveryPlanProtectedItem() + .withId("lkiexhajlfnthiq") + .withVirtualMachineId("uttdiygbp"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("swmtxk") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.REPAIR_REPLICATION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("jlmec") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.REVERSE_REPLICATE)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("ezaifghtmo") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.REPAIR_REPLICATION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("bkrkjj") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.REPAIR_REPLICATION, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("qoewdogiyetesy") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FAILBACK, + ReplicationProtectedItemOperation.REVERSE_REPLICATE, + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("t") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.FAILBACK)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("etnjuhpsprkz") + .withVirtualMachineId("upia"), + new RecoveryPlanProtectedItem() + .withId("xnafbw") + .withVirtualMachineId("oohtuovmaonurjtu"), + new RecoveryPlanProtectedItem() + .withId("hihpvecmsl") + .withVirtualMachineId("bl"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("lt") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.DISABLE_PROTECTION, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("gctmgxuupbezq") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.TEST_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("qkkyihztgeqmg") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.REVERSE_REPLICATE, + ReplicationProtectedItemOperation.CANCEL_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("lcecfeh") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("uhicqllizstacsjv") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FAILBACK, + ReplicationProtectedItemOperation.SWITCH_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("wqejpmvsse") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.DISABLE_PROTECTION, + ReplicationProtectedItemOperation.CHANGE_PIT, + ReplicationProtectedItemOperation.COMPLETE_MIGRATION)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("cxtczhupeukn") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.TEST_FAILOVER, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("fbocyvhh") + .withVirtualMachineId("rtywi"), + new RecoveryPlanProtectedItem() + .withId("mhlaku") + .withVirtualMachineId("gbhgau"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("ixmxufrsryjqgdkf") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("oqbvjhvefgwbmqj") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMPLETE_MIGRATION, + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.TEST_FAILOVER)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("ay") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CANCEL_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("b") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CHANGE_PIT, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("fkmbtsuahxsgxj") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.COMMIT)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("wsdrnpxqwodif") + .withVirtualMachineId("xcjr"), + new RecoveryPlanProtectedItem() + .withId("uabwibvjogjo") + .withVirtualMachineId("cyefoyzbamwine"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("fkak") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.FAILBACK)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("lz") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.CANCEL_FAILOVER)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("uxgvttxpnr") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FAILBACK, + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("rekidswysk") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMPLETE_MIGRATION, + ReplicationProtectedItemOperation.SWITCH_PROTECTION, + ReplicationProtectedItemOperation.COMPLETE_MIGRATION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("kutvlxhrpqhv") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.TEST_FAILOVER, + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.DISABLE_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("hbcdsziry") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.DISABLE_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))))) + .withProviderSpecificInput( + Arrays.asList(new RecoveryPlanProviderSpecificInput(), new RecoveryPlanProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(CreateRecoveryPlanInputProperties.class); + Assertions.assertEquals("ijp", model.primaryFabricId()); + Assertions.assertEquals("gsksrfhf", model.recoveryFabricId()); + Assertions.assertEquals(FailoverDeploymentModel.NOT_APPLICABLE, model.failoverDeploymentModel()); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, model.groups().get(0).groupType()); + Assertions.assertEquals("xwcdomm", model.groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals("fqawzfgbrttui", model.groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("swmtxk", model.groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + model.groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("ezaifghtmo", model.groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + model.groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateRecoveryPlanInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateRecoveryPlanInputTests.java new file mode 100644 index 000000000000..dc9564bfd2cf --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CreateRecoveryPlanInputTests.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateRecoveryPlanInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverDeploymentModel; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroup; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CreateRecoveryPlanInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreateRecoveryPlanInput model = + BinaryData + .fromString( + "{\"properties\":{\"primaryFabricId\":\"gvoavyunssxlgh\",\"recoveryFabricId\":\"ee\",\"failoverDeploymentModel\":\"NotApplicable\",\"groups\":[{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{\"id\":\"seksgbux\",\"virtualMachineId\":\"tu\"},{\"id\":\"dhga\",\"virtualMachineId\":\"pirpiwrqof\"}],\"startGroupActions\":[{\"actionName\":\"pmjnlexwhcb\",\"failoverTypes\":[\"CancelFailover\",\"ChangePit\",\"CancelFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"uuerctatoyi\",\"failoverTypes\":[\"UnplannedFailover\",\"DisableProtection\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"lc\",\"failoverTypes\":[\"UnplannedFailover\",\"Commit\",\"TestFailoverCleanup\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{\"id\":\"fsrucv\",\"virtualMachineId\":\"rpcjttbstvjeaqnr\"}],\"startGroupActions\":[{\"actionName\":\"fkoxmlghktuidvr\",\"failoverTypes\":[\"PlannedFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"exymzvla\",\"failoverTypes\":[\"DisableProtection\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"sgnyyuuzivensrp\",\"failoverTypes\":[\"FinalizeFailback\",\"FinalizeFailback\",\"ChangePit\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificInput\":[{\"instanceType\":\"RecoveryPlanProviderSpecificInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificInput\"}]}}") + .toObject(CreateRecoveryPlanInput.class); + Assertions.assertEquals("gvoavyunssxlgh", model.properties().primaryFabricId()); + Assertions.assertEquals("ee", model.properties().recoveryFabricId()); + Assertions.assertEquals(FailoverDeploymentModel.NOT_APPLICABLE, model.properties().failoverDeploymentModel()); + Assertions.assertEquals(RecoveryPlanGroupType.SHUTDOWN, model.properties().groups().get(0).groupType()); + Assertions.assertEquals("seksgbux", model.properties().groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals( + "tu", model.properties().groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions + .assertEquals("pmjnlexwhcb", model.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + model.properties().groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.properties().groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions + .assertEquals("uuerctatoyi", model.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + model.properties().groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.properties().groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreateRecoveryPlanInput model = + new CreateRecoveryPlanInput() + .withProperties( + new CreateRecoveryPlanInputProperties() + .withPrimaryFabricId("gvoavyunssxlgh") + .withRecoveryFabricId("ee") + .withFailoverDeploymentModel(FailoverDeploymentModel.NOT_APPLICABLE) + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.SHUTDOWN) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("seksgbux") + .withVirtualMachineId("tu"), + new RecoveryPlanProtectedItem() + .withId("dhga") + .withVirtualMachineId("pirpiwrqof"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("pmjnlexwhcb") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.CHANGE_PIT, + ReplicationProtectedItemOperation.CANCEL_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("uuerctatoyi") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation + .DISABLE_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("lc") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation + .TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("fsrucv") + .withVirtualMachineId("rpcjttbstvjeaqnr"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("fkoxmlghktuidvr") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.PLANNED_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("exymzvla") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .DISABLE_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("sgnyyuuzivensrp") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))))) + .withProviderSpecificInput( + Arrays + .asList( + new RecoveryPlanProviderSpecificInput(), + new RecoveryPlanProviderSpecificInput(), + new RecoveryPlanProviderSpecificInput()))); + model = BinaryData.fromObject(model).toObject(CreateRecoveryPlanInput.class); + Assertions.assertEquals("gvoavyunssxlgh", model.properties().primaryFabricId()); + Assertions.assertEquals("ee", model.properties().recoveryFabricId()); + Assertions.assertEquals(FailoverDeploymentModel.NOT_APPLICABLE, model.properties().failoverDeploymentModel()); + Assertions.assertEquals(RecoveryPlanGroupType.SHUTDOWN, model.properties().groups().get(0).groupType()); + Assertions.assertEquals("seksgbux", model.properties().groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals( + "tu", model.properties().groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions + .assertEquals("pmjnlexwhcb", model.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + model.properties().groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.properties().groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions + .assertEquals("uuerctatoyi", model.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + model.properties().groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.properties().groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CriticalJobHistoryDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CriticalJobHistoryDetailsTests.java new file mode 100644 index 000000000000..0ab0c5c53fb5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CriticalJobHistoryDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CriticalJobHistoryDetails; + +public final class CriticalJobHistoryDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CriticalJobHistoryDetails model = + BinaryData + .fromString( + "{\"jobName\":\"iplrbpbewtghfgb\",\"jobId\":\"gw\",\"startTime\":\"2021-01-14T04:37:45Z\",\"jobStatus\":\"v\"}") + .toObject(CriticalJobHistoryDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CriticalJobHistoryDetails model = new CriticalJobHistoryDetails(); + model = BinaryData.fromObject(model).toObject(CriticalJobHistoryDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CurrentJobDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CurrentJobDetailsTests.java new file mode 100644 index 000000000000..49f82bf89730 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CurrentJobDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CurrentJobDetails; + +public final class CurrentJobDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CurrentJobDetails model = + BinaryData + .fromString("{\"jobName\":\"obbc\",\"jobId\":\"s\",\"startTime\":\"2021-04-25T18:58:37Z\"}") + .toObject(CurrentJobDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CurrentJobDetails model = new CurrentJobDetails(); + model = BinaryData.fromObject(model).toObject(CurrentJobDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CurrentScenarioDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CurrentScenarioDetailsTests.java new file mode 100644 index 000000000000..f636da36ecc9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/CurrentScenarioDetailsTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CurrentScenarioDetails; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class CurrentScenarioDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CurrentScenarioDetails model = + BinaryData + .fromString( + "{\"scenarioName\":\"epxgyqagvr\",\"jobId\":\"npkukghimdblx\",\"startTime\":\"2021-02-15T12:58:28Z\"}") + .toObject(CurrentScenarioDetails.class); + Assertions.assertEquals("epxgyqagvr", model.scenarioName()); + Assertions.assertEquals("npkukghimdblx", model.jobId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-15T12:58:28Z"), model.startTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CurrentScenarioDetails model = + new CurrentScenarioDetails() + .withScenarioName("epxgyqagvr") + .withJobId("npkukghimdblx") + .withStartTime(OffsetDateTime.parse("2021-02-15T12:58:28Z")); + model = BinaryData.fromObject(model).toObject(CurrentScenarioDetails.class); + Assertions.assertEquals("epxgyqagvr", model.scenarioName()); + Assertions.assertEquals("npkukghimdblx", model.jobId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-15T12:58:28Z"), model.startTime()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DataStoreTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DataStoreTests.java new file mode 100644 index 000000000000..a8850d48f777 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DataStoreTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DataStore; +import org.junit.jupiter.api.Assertions; + +public final class DataStoreTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataStore model = + BinaryData + .fromString( + "{\"symbolicName\":\"ogfuyzwvbhlim\",\"uuid\":\"qecroodl\",\"capacity\":\"cdrdaasaxxo\",\"freeSpace\":\"mfkwiyjvzuk\",\"type\":\"r\"}") + .toObject(DataStore.class); + Assertions.assertEquals("ogfuyzwvbhlim", model.symbolicName()); + Assertions.assertEquals("qecroodl", model.uuid()); + Assertions.assertEquals("cdrdaasaxxo", model.capacity()); + Assertions.assertEquals("mfkwiyjvzuk", model.freeSpace()); + Assertions.assertEquals("r", model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataStore model = + new DataStore() + .withSymbolicName("ogfuyzwvbhlim") + .withUuid("qecroodl") + .withCapacity("cdrdaasaxxo") + .withFreeSpace("mfkwiyjvzuk") + .withType("r"); + model = BinaryData.fromObject(model).toObject(DataStore.class); + Assertions.assertEquals("ogfuyzwvbhlim", model.symbolicName()); + Assertions.assertEquals("qecroodl", model.uuid()); + Assertions.assertEquals("cdrdaasaxxo", model.capacity()); + Assertions.assertEquals("mfkwiyjvzuk", model.freeSpace()); + Assertions.assertEquals("r", model.type()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DataStoreUtilizationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DataStoreUtilizationDetailsTests.java new file mode 100644 index 000000000000..d2eefe7dc8b0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DataStoreUtilizationDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DataStoreUtilizationDetails; + +public final class DataStoreUtilizationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataStoreUtilizationDetails model = + BinaryData + .fromString( + "{\"totalSnapshotsSupported\":3097932904552377371,\"totalSnapshotsCreated\":4245389434648384828,\"dataStoreName\":\"kdschlzvfictnkjj\"}") + .toObject(DataStoreUtilizationDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataStoreUtilizationDetails model = new DataStoreUtilizationDetails(); + model = BinaryData.fromObject(model).toObject(DataStoreUtilizationDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisableProtectionInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisableProtectionInputPropertiesTests.java new file mode 100644 index 000000000000..36cabd91d386 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisableProtectionInputPropertiesTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DisableProtectionInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DisableProtectionReason; +import org.junit.jupiter.api.Assertions; + +public final class DisableProtectionInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DisableProtectionInputProperties model = + BinaryData + .fromString( + "{\"disableProtectionReason\":\"NotSpecified\",\"replicationProviderInput\":{\"instanceType\":\"DisableProtectionProviderSpecificInput\"}}") + .toObject(DisableProtectionInputProperties.class); + Assertions.assertEquals(DisableProtectionReason.NOT_SPECIFIED, model.disableProtectionReason()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DisableProtectionInputProperties model = + new DisableProtectionInputProperties() + .withDisableProtectionReason(DisableProtectionReason.NOT_SPECIFIED) + .withReplicationProviderInput(new DisableProtectionProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(DisableProtectionInputProperties.class); + Assertions.assertEquals(DisableProtectionReason.NOT_SPECIFIED, model.disableProtectionReason()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisableProtectionInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisableProtectionInputTests.java new file mode 100644 index 000000000000..1a3a4feaae5f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisableProtectionInputTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DisableProtectionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DisableProtectionInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DisableProtectionReason; +import org.junit.jupiter.api.Assertions; + +public final class DisableProtectionInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DisableProtectionInput model = + BinaryData + .fromString( + "{\"properties\":{\"disableProtectionReason\":\"NotSpecified\",\"replicationProviderInput\":{\"instanceType\":\"DisableProtectionProviderSpecificInput\"}}}") + .toObject(DisableProtectionInput.class); + Assertions.assertEquals(DisableProtectionReason.NOT_SPECIFIED, model.properties().disableProtectionReason()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DisableProtectionInput model = + new DisableProtectionInput() + .withProperties( + new DisableProtectionInputProperties() + .withDisableProtectionReason(DisableProtectionReason.NOT_SPECIFIED) + .withReplicationProviderInput(new DisableProtectionProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(DisableProtectionInput.class); + Assertions.assertEquals(DisableProtectionReason.NOT_SPECIFIED, model.properties().disableProtectionReason()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisableProtectionProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisableProtectionProviderSpecificInputTests.java new file mode 100644 index 000000000000..8fa8510d3782 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisableProtectionProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DisableProtectionProviderSpecificInput; + +public final class DisableProtectionProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DisableProtectionProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"DisableProtectionProviderSpecificInput\"}") + .toObject(DisableProtectionProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DisableProtectionProviderSpecificInput model = new DisableProtectionProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(DisableProtectionProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiscoverProtectableItemRequestPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiscoverProtectableItemRequestPropertiesTests.java new file mode 100644 index 000000000000..adf6cf353fa4 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiscoverProtectableItemRequestPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiscoverProtectableItemRequestProperties; +import org.junit.jupiter.api.Assertions; + +public final class DiscoverProtectableItemRequestPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoverProtectableItemRequestProperties model = + BinaryData + .fromString("{\"friendlyName\":\"aiuebbaumnyqu\",\"ipAddress\":\"deoj\",\"osType\":\"bckhsmtxpsi\"}") + .toObject(DiscoverProtectableItemRequestProperties.class); + Assertions.assertEquals("aiuebbaumnyqu", model.friendlyName()); + Assertions.assertEquals("deoj", model.ipAddress()); + Assertions.assertEquals("bckhsmtxpsi", model.osType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoverProtectableItemRequestProperties model = + new DiscoverProtectableItemRequestProperties() + .withFriendlyName("aiuebbaumnyqu") + .withIpAddress("deoj") + .withOsType("bckhsmtxpsi"); + model = BinaryData.fromObject(model).toObject(DiscoverProtectableItemRequestProperties.class); + Assertions.assertEquals("aiuebbaumnyqu", model.friendlyName()); + Assertions.assertEquals("deoj", model.ipAddress()); + Assertions.assertEquals("bckhsmtxpsi", model.osType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiscoverProtectableItemRequestTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiscoverProtectableItemRequestTests.java new file mode 100644 index 000000000000..b4e759c0ebbb --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiscoverProtectableItemRequestTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiscoverProtectableItemRequest; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiscoverProtectableItemRequestProperties; +import org.junit.jupiter.api.Assertions; + +public final class DiscoverProtectableItemRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoverProtectableItemRequest model = + BinaryData + .fromString( + "{\"properties\":{\"friendlyName\":\"sxnkjzkdeslpvlo\",\"ipAddress\":\"i\",\"osType\":\"ghxpkdw\"}}") + .toObject(DiscoverProtectableItemRequest.class); + Assertions.assertEquals("sxnkjzkdeslpvlo", model.properties().friendlyName()); + Assertions.assertEquals("i", model.properties().ipAddress()); + Assertions.assertEquals("ghxpkdw", model.properties().osType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoverProtectableItemRequest model = + new DiscoverProtectableItemRequest() + .withProperties( + new DiscoverProtectableItemRequestProperties() + .withFriendlyName("sxnkjzkdeslpvlo") + .withIpAddress("i") + .withOsType("ghxpkdw")); + model = BinaryData.fromObject(model).toObject(DiscoverProtectableItemRequest.class); + Assertions.assertEquals("sxnkjzkdeslpvlo", model.properties().friendlyName()); + Assertions.assertEquals("i", model.properties().ipAddress()); + Assertions.assertEquals("ghxpkdw", model.properties().osType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiskDetailsTests.java new file mode 100644 index 000000000000..e5cb6cc50a2d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiskDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskDetails; +import org.junit.jupiter.api.Assertions; + +public final class DiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiskDetails model = + BinaryData + .fromString( + "{\"maxSizeMB\":3920956440221145049,\"vhdType\":\"zm\",\"vhdId\":\"k\",\"vhdName\":\"wsxvjab\"}") + .toObject(DiskDetails.class); + Assertions.assertEquals(3920956440221145049L, model.maxSizeMB()); + Assertions.assertEquals("zm", model.vhdType()); + Assertions.assertEquals("k", model.vhdId()); + Assertions.assertEquals("wsxvjab", model.vhdName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiskDetails model = + new DiskDetails() + .withMaxSizeMB(3920956440221145049L) + .withVhdType("zm") + .withVhdId("k") + .withVhdName("wsxvjab"); + model = BinaryData.fromObject(model).toObject(DiskDetails.class); + Assertions.assertEquals(3920956440221145049L, model.maxSizeMB()); + Assertions.assertEquals("zm", model.vhdType()); + Assertions.assertEquals("k", model.vhdId()); + Assertions.assertEquals("wsxvjab", model.vhdName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiskVolumeDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiskVolumeDetailsTests.java new file mode 100644 index 000000000000..51882edd7569 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DiskVolumeDetailsTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskVolumeDetails; +import org.junit.jupiter.api.Assertions; + +public final class DiskVolumeDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiskVolumeDetails model = + BinaryData.fromString("{\"label\":\"qa\",\"name\":\"yvymcnudndo\"}").toObject(DiskVolumeDetails.class); + Assertions.assertEquals("qa", model.label()); + Assertions.assertEquals("yvymcnudndo", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiskVolumeDetails model = new DiskVolumeDetails().withLabel("qa").withName("yvymcnudndo"); + model = BinaryData.fromObject(model).toObject(DiskVolumeDetails.class); + Assertions.assertEquals("qa", model.label()); + Assertions.assertEquals("yvymcnudndo", model.name()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisplayTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisplayTests.java new file mode 100644 index 000000000000..ce1ad5cc4a07 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/DisplayTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Display; +import org.junit.jupiter.api.Assertions; + +public final class DisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Display model = + BinaryData + .fromString( + "{\"provider\":\"a\",\"resource\":\"th\",\"operation\":\"hab\",\"description\":\"pikxwczbyscnpqxu\"}") + .toObject(Display.class); + Assertions.assertEquals("a", model.provider()); + Assertions.assertEquals("th", model.resource()); + Assertions.assertEquals("hab", model.operation()); + Assertions.assertEquals("pikxwczbyscnpqxu", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Display model = + new Display().withProvider("a").withResource("th").withOperation("hab").withDescription("pikxwczbyscnpqxu"); + model = BinaryData.fromObject(model).toObject(Display.class); + Assertions.assertEquals("a", model.provider()); + Assertions.assertEquals("th", model.resource()); + Assertions.assertEquals("hab", model.operation()); + Assertions.assertEquals("pikxwczbyscnpqxu", model.description()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableMigrationInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableMigrationInputPropertiesTests.java new file mode 100644 index 000000000000..012d9ac27e61 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableMigrationInputPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableMigrationInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class EnableMigrationInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnableMigrationInputProperties model = + BinaryData + .fromString( + "{\"policyId\":\"waloayqcgwr\",\"providerSpecificDetails\":{\"instanceType\":\"EnableMigrationProviderSpecificInput\"}}") + .toObject(EnableMigrationInputProperties.class); + Assertions.assertEquals("waloayqcgwr", model.policyId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnableMigrationInputProperties model = + new EnableMigrationInputProperties() + .withPolicyId("waloayqcgwr") + .withProviderSpecificDetails(new EnableMigrationProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(EnableMigrationInputProperties.class); + Assertions.assertEquals("waloayqcgwr", model.policyId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableMigrationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableMigrationInputTests.java new file mode 100644 index 000000000000..2b08ca874293 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableMigrationInputTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableMigrationInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableMigrationInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class EnableMigrationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnableMigrationInput model = + BinaryData + .fromString( + "{\"properties\":{\"policyId\":\"hjkbegibtnmxieb\",\"providerSpecificDetails\":{\"instanceType\":\"EnableMigrationProviderSpecificInput\"}}}") + .toObject(EnableMigrationInput.class); + Assertions.assertEquals("hjkbegibtnmxieb", model.properties().policyId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnableMigrationInput model = + new EnableMigrationInput() + .withProperties( + new EnableMigrationInputProperties() + .withPolicyId("hjkbegibtnmxieb") + .withProviderSpecificDetails(new EnableMigrationProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(EnableMigrationInput.class); + Assertions.assertEquals("hjkbegibtnmxieb", model.properties().policyId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableMigrationProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableMigrationProviderSpecificInputTests.java new file mode 100644 index 000000000000..1cb067f4305e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableMigrationProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableMigrationProviderSpecificInput; + +public final class EnableMigrationProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnableMigrationProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"EnableMigrationProviderSpecificInput\"}") + .toObject(EnableMigrationProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnableMigrationProviderSpecificInput model = new EnableMigrationProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(EnableMigrationProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableProtectionInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableProtectionInputPropertiesTests.java new file mode 100644 index 000000000000..db2cd844e7a7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableProtectionInputPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableProtectionInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class EnableProtectionInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnableProtectionInputProperties model = + BinaryData + .fromString( + "{\"policyId\":\"rey\",\"protectableItemId\":\"zi\",\"providerSpecificDetails\":{\"instanceType\":\"EnableProtectionProviderSpecificInput\"}}") + .toObject(EnableProtectionInputProperties.class); + Assertions.assertEquals("rey", model.policyId()); + Assertions.assertEquals("zi", model.protectableItemId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnableProtectionInputProperties model = + new EnableProtectionInputProperties() + .withPolicyId("rey") + .withProtectableItemId("zi") + .withProviderSpecificDetails(new EnableProtectionProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(EnableProtectionInputProperties.class); + Assertions.assertEquals("rey", model.policyId()); + Assertions.assertEquals("zi", model.protectableItemId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableProtectionInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableProtectionInputTests.java new file mode 100644 index 000000000000..bd70a458a8b7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableProtectionInputTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableProtectionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableProtectionInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class EnableProtectionInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnableProtectionInput model = + BinaryData + .fromString( + "{\"properties\":{\"policyId\":\"njhf\",\"protectableItemId\":\"wmszkk\",\"providerSpecificDetails\":{\"instanceType\":\"EnableProtectionProviderSpecificInput\"}}}") + .toObject(EnableProtectionInput.class); + Assertions.assertEquals("njhf", model.properties().policyId()); + Assertions.assertEquals("wmszkk", model.properties().protectableItemId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnableProtectionInput model = + new EnableProtectionInput() + .withProperties( + new EnableProtectionInputProperties() + .withPolicyId("njhf") + .withProtectableItemId("wmszkk") + .withProviderSpecificDetails(new EnableProtectionProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(EnableProtectionInput.class); + Assertions.assertEquals("njhf", model.properties().policyId()); + Assertions.assertEquals("wmszkk", model.properties().protectableItemId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableProtectionProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableProtectionProviderSpecificInputTests.java new file mode 100644 index 000000000000..c3f53534934f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EnableProtectionProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EnableProtectionProviderSpecificInput; + +public final class EnableProtectionProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnableProtectionProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"EnableProtectionProviderSpecificInput\"}") + .toObject(EnableProtectionProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnableProtectionProviderSpecificInput model = new EnableProtectionProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(EnableProtectionProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EncryptionDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EncryptionDetailsTests.java new file mode 100644 index 000000000000..184786a247d9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EncryptionDetailsTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EncryptionDetails; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class EncryptionDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EncryptionDetails model = + BinaryData + .fromString( + "{\"kekState\":\"soodqxhcrmnoh\",\"kekCertThumbprint\":\"ckwhds\",\"kekCertExpiryDate\":\"2021-07-22T01:38:16Z\"}") + .toObject(EncryptionDetails.class); + Assertions.assertEquals("soodqxhcrmnoh", model.kekState()); + Assertions.assertEquals("ckwhds", model.kekCertThumbprint()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-22T01:38:16Z"), model.kekCertExpiryDate()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EncryptionDetails model = + new EncryptionDetails() + .withKekState("soodqxhcrmnoh") + .withKekCertThumbprint("ckwhds") + .withKekCertExpiryDate(OffsetDateTime.parse("2021-07-22T01:38:16Z")); + model = BinaryData.fromObject(model).toObject(EncryptionDetails.class); + Assertions.assertEquals("soodqxhcrmnoh", model.kekState()); + Assertions.assertEquals("ckwhds", model.kekCertThumbprint()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-22T01:38:16Z"), model.kekCertExpiryDate()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EventProviderSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EventProviderSpecificDetailsTests.java new file mode 100644 index 000000000000..e4fa2fa5d0eb --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EventProviderSpecificDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EventProviderSpecificDetails; + +public final class EventProviderSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EventProviderSpecificDetails model = + BinaryData + .fromString("{\"instanceType\":\"EventProviderSpecificDetails\"}") + .toObject(EventProviderSpecificDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EventProviderSpecificDetails model = new EventProviderSpecificDetails(); + model = BinaryData.fromObject(model).toObject(EventProviderSpecificDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EventSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EventSpecificDetailsTests.java new file mode 100644 index 000000000000..5f20ea737738 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/EventSpecificDetailsTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EventSpecificDetails; + +public final class EventSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EventSpecificDetails model = + BinaryData.fromString("{\"instanceType\":\"EventSpecificDetails\"}").toObject(EventSpecificDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EventSpecificDetails model = new EventSpecificDetails(); + model = BinaryData.fromObject(model).toObject(EventSpecificDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingProtectionProfileTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingProtectionProfileTests.java new file mode 100644 index 000000000000..b5abeb604042 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingProtectionProfileTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExistingProtectionProfile; +import org.junit.jupiter.api.Assertions; + +public final class ExistingProtectionProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExistingProtectionProfile model = + BinaryData + .fromString("{\"resourceType\":\"Existing\",\"protectionProfileId\":\"zi\"}") + .toObject(ExistingProtectionProfile.class); + Assertions.assertEquals("zi", model.protectionProfileId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExistingProtectionProfile model = new ExistingProtectionProfile().withProtectionProfileId("zi"); + model = BinaryData.fromObject(model).toObject(ExistingProtectionProfile.class); + Assertions.assertEquals("zi", model.protectionProfileId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryAvailabilitySetTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryAvailabilitySetTests.java new file mode 100644 index 000000000000..bfc0e2b7ed8b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryAvailabilitySetTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExistingRecoveryAvailabilitySet; +import org.junit.jupiter.api.Assertions; + +public final class ExistingRecoveryAvailabilitySetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExistingRecoveryAvailabilitySet model = + BinaryData + .fromString("{\"resourceType\":\"Existing\",\"recoveryAvailabilitySetId\":\"qimiymqr\"}") + .toObject(ExistingRecoveryAvailabilitySet.class); + Assertions.assertEquals("qimiymqr", model.recoveryAvailabilitySetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExistingRecoveryAvailabilitySet model = + new ExistingRecoveryAvailabilitySet().withRecoveryAvailabilitySetId("qimiymqr"); + model = BinaryData.fromObject(model).toObject(ExistingRecoveryAvailabilitySet.class); + Assertions.assertEquals("qimiymqr", model.recoveryAvailabilitySetId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryProximityPlacementGroupTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryProximityPlacementGroupTests.java new file mode 100644 index 000000000000..14a0c636ca9e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryProximityPlacementGroupTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExistingRecoveryProximityPlacementGroup; +import org.junit.jupiter.api.Assertions; + +public final class ExistingRecoveryProximityPlacementGroupTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExistingRecoveryProximityPlacementGroup model = + BinaryData + .fromString("{\"resourceType\":\"Existing\",\"recoveryProximityPlacementGroupId\":\"guhfupe\"}") + .toObject(ExistingRecoveryProximityPlacementGroup.class); + Assertions.assertEquals("guhfupe", model.recoveryProximityPlacementGroupId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExistingRecoveryProximityPlacementGroup model = + new ExistingRecoveryProximityPlacementGroup().withRecoveryProximityPlacementGroupId("guhfupe"); + model = BinaryData.fromObject(model).toObject(ExistingRecoveryProximityPlacementGroup.class); + Assertions.assertEquals("guhfupe", model.recoveryProximityPlacementGroupId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryResourceGroupTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryResourceGroupTests.java new file mode 100644 index 000000000000..5882afb4395a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryResourceGroupTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExistingRecoveryResourceGroup; +import org.junit.jupiter.api.Assertions; + +public final class ExistingRecoveryResourceGroupTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExistingRecoveryResourceGroup model = + BinaryData + .fromString("{\"resourceType\":\"Existing\",\"recoveryResourceGroupId\":\"svvoqsbpkflanfk\"}") + .toObject(ExistingRecoveryResourceGroup.class); + Assertions.assertEquals("svvoqsbpkflanfk", model.recoveryResourceGroupId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExistingRecoveryResourceGroup model = + new ExistingRecoveryResourceGroup().withRecoveryResourceGroupId("svvoqsbpkflanfk"); + model = BinaryData.fromObject(model).toObject(ExistingRecoveryResourceGroup.class); + Assertions.assertEquals("svvoqsbpkflanfk", model.recoveryResourceGroupId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryVirtualNetworkTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryVirtualNetworkTests.java new file mode 100644 index 000000000000..42917fb98df6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingRecoveryVirtualNetworkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExistingRecoveryVirtualNetwork; +import org.junit.jupiter.api.Assertions; + +public final class ExistingRecoveryVirtualNetworkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExistingRecoveryVirtualNetwork model = + BinaryData + .fromString( + "{\"resourceType\":\"Existing\",\"recoveryVirtualNetworkId\":\"xsyaowuzowpuoh\",\"recoverySubnetName\":\"cprgukxrztiochl\"}") + .toObject(ExistingRecoveryVirtualNetwork.class); + Assertions.assertEquals("xsyaowuzowpuoh", model.recoveryVirtualNetworkId()); + Assertions.assertEquals("cprgukxrztiochl", model.recoverySubnetName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExistingRecoveryVirtualNetwork model = + new ExistingRecoveryVirtualNetwork() + .withRecoveryVirtualNetworkId("xsyaowuzowpuoh") + .withRecoverySubnetName("cprgukxrztiochl"); + model = BinaryData.fromObject(model).toObject(ExistingRecoveryVirtualNetwork.class); + Assertions.assertEquals("xsyaowuzowpuoh", model.recoveryVirtualNetworkId()); + Assertions.assertEquals("cprgukxrztiochl", model.recoverySubnetName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingStorageAccountTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingStorageAccountTests.java new file mode 100644 index 000000000000..2bace3b34570 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExistingStorageAccountTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExistingStorageAccount; +import org.junit.jupiter.api.Assertions; + +public final class ExistingStorageAccountTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExistingStorageAccount model = + BinaryData + .fromString("{\"resourceType\":\"Existing\",\"azureStorageAccountId\":\"tixmqrudjiz\"}") + .toObject(ExistingStorageAccount.class); + Assertions.assertEquals("tixmqrudjiz", model.azureStorageAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExistingStorageAccount model = new ExistingStorageAccount().withAzureStorageAccountId("tixmqrudjiz"); + model = BinaryData.fromObject(model).toObject(ExistingStorageAccount.class); + Assertions.assertEquals("tixmqrudjiz", model.azureStorageAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExtendedLocationTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExtendedLocationTests.java new file mode 100644 index 000000000000..af0d123306e7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ExtendedLocationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocationType; +import org.junit.jupiter.api.Assertions; + +public final class ExtendedLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExtendedLocation model = + BinaryData.fromString("{\"name\":\"moenodnaien\",\"type\":\"EdgeZone\"}").toObject(ExtendedLocation.class); + Assertions.assertEquals("moenodnaien", model.name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExtendedLocation model = + new ExtendedLocation().withName("moenodnaien").withType(ExtendedLocationType.EDGE_ZONE); + model = BinaryData.fromObject(model).toObject(ExtendedLocation.class); + Assertions.assertEquals("moenodnaien", model.name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.type()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricCreationInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricCreationInputPropertiesTests.java new file mode 100644 index 000000000000..172f95c222d0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricCreationInputPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricCreationInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificCreationInput; + +public final class FabricCreationInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricCreationInputProperties model = + BinaryData + .fromString("{\"customDetails\":{\"instanceType\":\"FabricSpecificCreationInput\"}}") + .toObject(FabricCreationInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricCreationInputProperties model = + new FabricCreationInputProperties().withCustomDetails(new FabricSpecificCreationInput()); + model = BinaryData.fromObject(model).toObject(FabricCreationInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricCreationInputTests.java new file mode 100644 index 000000000000..b8e2047ea20a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricCreationInputTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricCreationInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricCreationInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificCreationInput; + +public final class FabricCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricCreationInput model = + BinaryData + .fromString("{\"properties\":{\"customDetails\":{\"instanceType\":\"FabricSpecificCreationInput\"}}}") + .toObject(FabricCreationInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricCreationInput model = + new FabricCreationInput() + .withProperties( + new FabricCreationInputProperties().withCustomDetails(new FabricSpecificCreationInput())); + model = BinaryData.fromObject(model).toObject(FabricCreationInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricReplicationGroupTaskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricReplicationGroupTaskDetailsTests.java new file mode 100644 index 000000000000..2067587830ed --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricReplicationGroupTaskDetailsTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricReplicationGroupTaskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobEntity; +import org.junit.jupiter.api.Assertions; + +public final class FabricReplicationGroupTaskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricReplicationGroupTaskDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"FabricReplicationGroupTaskDetails\",\"skippedReason\":\"nmfbc\",\"skippedReasonString\":\"qktkrumzuedkyzbf\",\"jobTask\":{\"jobId\":\"vqkxiuxqggvq\",\"jobFriendlyName\":\"hyhlwcjsqg\",\"targetObjectId\":\"hffbxrq\",\"targetObjectName\":\"ijpeuql\",\"targetInstanceType\":\"x\",\"jobScenarioName\":\"ztv\"}}") + .toObject(FabricReplicationGroupTaskDetails.class); + Assertions.assertEquals("vqkxiuxqggvq", model.jobTask().jobId()); + Assertions.assertEquals("hyhlwcjsqg", model.jobTask().jobFriendlyName()); + Assertions.assertEquals("hffbxrq", model.jobTask().targetObjectId()); + Assertions.assertEquals("ijpeuql", model.jobTask().targetObjectName()); + Assertions.assertEquals("x", model.jobTask().targetInstanceType()); + Assertions.assertEquals("ztv", model.jobTask().jobScenarioName()); + Assertions.assertEquals("nmfbc", model.skippedReason()); + Assertions.assertEquals("qktkrumzuedkyzbf", model.skippedReasonString()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricReplicationGroupTaskDetails model = + new FabricReplicationGroupTaskDetails() + .withJobTask( + new JobEntity() + .withJobId("vqkxiuxqggvq") + .withJobFriendlyName("hyhlwcjsqg") + .withTargetObjectId("hffbxrq") + .withTargetObjectName("ijpeuql") + .withTargetInstanceType("x") + .withJobScenarioName("ztv")) + .withSkippedReason("nmfbc") + .withSkippedReasonString("qktkrumzuedkyzbf"); + model = BinaryData.fromObject(model).toObject(FabricReplicationGroupTaskDetails.class); + Assertions.assertEquals("vqkxiuxqggvq", model.jobTask().jobId()); + Assertions.assertEquals("hyhlwcjsqg", model.jobTask().jobFriendlyName()); + Assertions.assertEquals("hffbxrq", model.jobTask().targetObjectId()); + Assertions.assertEquals("ijpeuql", model.jobTask().targetObjectName()); + Assertions.assertEquals("x", model.jobTask().targetInstanceType()); + Assertions.assertEquals("ztv", model.jobTask().jobScenarioName()); + Assertions.assertEquals("nmfbc", model.skippedReason()); + Assertions.assertEquals("qktkrumzuedkyzbf", model.skippedReasonString()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificCreateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificCreateNetworkMappingInputTests.java new file mode 100644 index 000000000000..af1d0b420aca --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificCreateNetworkMappingInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput; + +public final class FabricSpecificCreateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricSpecificCreateNetworkMappingInput model = + BinaryData + .fromString("{\"instanceType\":\"FabricSpecificCreateNetworkMappingInput\"}") + .toObject(FabricSpecificCreateNetworkMappingInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricSpecificCreateNetworkMappingInput model = new FabricSpecificCreateNetworkMappingInput(); + model = BinaryData.fromObject(model).toObject(FabricSpecificCreateNetworkMappingInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificCreationInputTests.java new file mode 100644 index 000000000000..cf9eaabb84d9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificCreationInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificCreationInput; + +public final class FabricSpecificCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricSpecificCreationInput model = + BinaryData + .fromString("{\"instanceType\":\"FabricSpecificCreationInput\"}") + .toObject(FabricSpecificCreationInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricSpecificCreationInput model = new FabricSpecificCreationInput(); + model = BinaryData.fromObject(model).toObject(FabricSpecificCreationInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificDetailsTests.java new file mode 100644 index 000000000000..451152209941 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificDetailsTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificDetails; + +public final class FabricSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricSpecificDetails model = + BinaryData.fromString("{\"instanceType\":\"FabricSpecificDetails\"}").toObject(FabricSpecificDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricSpecificDetails model = new FabricSpecificDetails(); + model = BinaryData.fromObject(model).toObject(FabricSpecificDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificUpdateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificUpdateNetworkMappingInputTests.java new file mode 100644 index 000000000000..c5e2b609b260 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FabricSpecificUpdateNetworkMappingInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput; + +public final class FabricSpecificUpdateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricSpecificUpdateNetworkMappingInput model = + BinaryData + .fromString("{\"instanceType\":\"FabricSpecificUpdateNetworkMappingInput\"}") + .toObject(FabricSpecificUpdateNetworkMappingInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricSpecificUpdateNetworkMappingInput model = new FabricSpecificUpdateNetworkMappingInput(); + model = BinaryData.fromObject(model).toObject(FabricSpecificUpdateNetworkMappingInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverJobDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverJobDetailsTests.java new file mode 100644 index 000000000000..bd6221d1fde2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverJobDetailsTests.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverJobDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FailoverJobDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverJobDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"FailoverJobDetails\",\"protectedItemDetails\":[{\"name\":\"jcciklhsyek\",\"friendlyName\":\"renxolriyehqbe\",\"testVmName\":\"dlh\",\"testVmFriendlyName\":\"wbdbfg\",\"networkConnectionStatus\":\"punytjl\",\"networkFriendlyName\":\"smmpathubt\",\"subnet\":\"deani\",\"recoveryPointId\":\"llbvgwzsfftedous\",\"recoveryPointTime\":\"2021-07-21T04:35:12Z\"},{\"name\":\"tgravaqogf\",\"friendlyName\":\"ebauzlqbtx\",\"testVmName\":\"pfhnjzudrt\",\"testVmFriendlyName\":\"kgmeb\",\"networkConnectionStatus\":\"whczzqrhmng\",\"networkFriendlyName\":\"edygisrzwnykdi\",\"subnet\":\"chl\",\"recoveryPointId\":\"pwctofl\",\"recoveryPointTime\":\"2021-07-22T16:13:46Z\"},{\"name\":\"cdhz\",\"friendlyName\":\"kbrfgdrwji\",\"testVmName\":\"whfjsrwqrxe\",\"testVmFriendlyName\":\"gcwvrrmdqntycna\",\"networkConnectionStatus\":\"hvmaxgnuyeamcmhu\",\"networkFriendlyName\":\"jecehokwc\",\"subnet\":\"twloesqr\",\"recoveryPointId\":\"vrbnyrukoil\",\"recoveryPointTime\":\"2021-09-21T11:09:08Z\"}],\"affectedObjectDetails\":{\"lh\":\"wjleip\"}}") + .toObject(FailoverJobDetails.class); + Assertions.assertEquals("wjleip", model.affectedObjectDetails().get("lh")); + Assertions.assertEquals("jcciklhsyek", model.protectedItemDetails().get(0).name()); + Assertions.assertEquals("renxolriyehqbe", model.protectedItemDetails().get(0).friendlyName()); + Assertions.assertEquals("dlh", model.protectedItemDetails().get(0).testVmName()); + Assertions.assertEquals("wbdbfg", model.protectedItemDetails().get(0).testVmFriendlyName()); + Assertions.assertEquals("punytjl", model.protectedItemDetails().get(0).networkConnectionStatus()); + Assertions.assertEquals("smmpathubt", model.protectedItemDetails().get(0).networkFriendlyName()); + Assertions.assertEquals("deani", model.protectedItemDetails().get(0).subnet()); + Assertions.assertEquals("llbvgwzsfftedous", model.protectedItemDetails().get(0).recoveryPointId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-07-21T04:35:12Z"), model.protectedItemDetails().get(0).recoveryPointTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FailoverJobDetails model = + new FailoverJobDetails() + .withAffectedObjectDetails(mapOf("lh", "wjleip")) + .withProtectedItemDetails( + Arrays + .asList( + new FailoverReplicationProtectedItemDetails() + .withName("jcciklhsyek") + .withFriendlyName("renxolriyehqbe") + .withTestVmName("dlh") + .withTestVmFriendlyName("wbdbfg") + .withNetworkConnectionStatus("punytjl") + .withNetworkFriendlyName("smmpathubt") + .withSubnet("deani") + .withRecoveryPointId("llbvgwzsfftedous") + .withRecoveryPointTime(OffsetDateTime.parse("2021-07-21T04:35:12Z")), + new FailoverReplicationProtectedItemDetails() + .withName("tgravaqogf") + .withFriendlyName("ebauzlqbtx") + .withTestVmName("pfhnjzudrt") + .withTestVmFriendlyName("kgmeb") + .withNetworkConnectionStatus("whczzqrhmng") + .withNetworkFriendlyName("edygisrzwnykdi") + .withSubnet("chl") + .withRecoveryPointId("pwctofl") + .withRecoveryPointTime(OffsetDateTime.parse("2021-07-22T16:13:46Z")), + new FailoverReplicationProtectedItemDetails() + .withName("cdhz") + .withFriendlyName("kbrfgdrwji") + .withTestVmName("whfjsrwqrxe") + .withTestVmFriendlyName("gcwvrrmdqntycna") + .withNetworkConnectionStatus("hvmaxgnuyeamcmhu") + .withNetworkFriendlyName("jecehokwc") + .withSubnet("twloesqr") + .withRecoveryPointId("vrbnyrukoil") + .withRecoveryPointTime(OffsetDateTime.parse("2021-09-21T11:09:08Z")))); + model = BinaryData.fromObject(model).toObject(FailoverJobDetails.class); + Assertions.assertEquals("wjleip", model.affectedObjectDetails().get("lh")); + Assertions.assertEquals("jcciklhsyek", model.protectedItemDetails().get(0).name()); + Assertions.assertEquals("renxolriyehqbe", model.protectedItemDetails().get(0).friendlyName()); + Assertions.assertEquals("dlh", model.protectedItemDetails().get(0).testVmName()); + Assertions.assertEquals("wbdbfg", model.protectedItemDetails().get(0).testVmFriendlyName()); + Assertions.assertEquals("punytjl", model.protectedItemDetails().get(0).networkConnectionStatus()); + Assertions.assertEquals("smmpathubt", model.protectedItemDetails().get(0).networkFriendlyName()); + Assertions.assertEquals("deani", model.protectedItemDetails().get(0).subnet()); + Assertions.assertEquals("llbvgwzsfftedous", model.protectedItemDetails().get(0).recoveryPointId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-07-21T04:35:12Z"), model.protectedItemDetails().get(0).recoveryPointTime()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverProcessServerRequestPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverProcessServerRequestPropertiesTests.java new file mode 100644 index 000000000000..53a04e7335f5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverProcessServerRequestPropertiesTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverProcessServerRequestProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class FailoverProcessServerRequestPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverProcessServerRequestProperties model = + BinaryData + .fromString( + "{\"containerName\":\"l\",\"sourceProcessServerId\":\"u\",\"targetProcessServerId\":\"krlkhbzhfepg\",\"vmsToMigrate\":[\"e\"],\"updateType\":\"locx\"}") + .toObject(FailoverProcessServerRequestProperties.class); + Assertions.assertEquals("l", model.containerName()); + Assertions.assertEquals("u", model.sourceProcessServerId()); + Assertions.assertEquals("krlkhbzhfepg", model.targetProcessServerId()); + Assertions.assertEquals("e", model.vmsToMigrate().get(0)); + Assertions.assertEquals("locx", model.updateType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FailoverProcessServerRequestProperties model = + new FailoverProcessServerRequestProperties() + .withContainerName("l") + .withSourceProcessServerId("u") + .withTargetProcessServerId("krlkhbzhfepg") + .withVmsToMigrate(Arrays.asList("e")) + .withUpdateType("locx"); + model = BinaryData.fromObject(model).toObject(FailoverProcessServerRequestProperties.class); + Assertions.assertEquals("l", model.containerName()); + Assertions.assertEquals("u", model.sourceProcessServerId()); + Assertions.assertEquals("krlkhbzhfepg", model.targetProcessServerId()); + Assertions.assertEquals("e", model.vmsToMigrate().get(0)); + Assertions.assertEquals("locx", model.updateType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverProcessServerRequestTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverProcessServerRequestTests.java new file mode 100644 index 000000000000..f66a8bde5bea --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverProcessServerRequestTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverProcessServerRequest; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverProcessServerRequestProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class FailoverProcessServerRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverProcessServerRequest model = + BinaryData + .fromString( + "{\"properties\":{\"containerName\":\"xsqwpgrjbznorc\",\"sourceProcessServerId\":\"vsnb\",\"targetProcessServerId\":\"qabnmoc\",\"vmsToMigrate\":[\"shurzafbljjgpbto\"],\"updateType\":\"jmkljavbqidtqajz\"}}") + .toObject(FailoverProcessServerRequest.class); + Assertions.assertEquals("xsqwpgrjbznorc", model.properties().containerName()); + Assertions.assertEquals("vsnb", model.properties().sourceProcessServerId()); + Assertions.assertEquals("qabnmoc", model.properties().targetProcessServerId()); + Assertions.assertEquals("shurzafbljjgpbto", model.properties().vmsToMigrate().get(0)); + Assertions.assertEquals("jmkljavbqidtqajz", model.properties().updateType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FailoverProcessServerRequest model = + new FailoverProcessServerRequest() + .withProperties( + new FailoverProcessServerRequestProperties() + .withContainerName("xsqwpgrjbznorc") + .withSourceProcessServerId("vsnb") + .withTargetProcessServerId("qabnmoc") + .withVmsToMigrate(Arrays.asList("shurzafbljjgpbto")) + .withUpdateType("jmkljavbqidtqajz")); + model = BinaryData.fromObject(model).toObject(FailoverProcessServerRequest.class); + Assertions.assertEquals("xsqwpgrjbznorc", model.properties().containerName()); + Assertions.assertEquals("vsnb", model.properties().sourceProcessServerId()); + Assertions.assertEquals("qabnmoc", model.properties().targetProcessServerId()); + Assertions.assertEquals("shurzafbljjgpbto", model.properties().vmsToMigrate().get(0)); + Assertions.assertEquals("jmkljavbqidtqajz", model.properties().updateType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverReplicationProtectedItemDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverReplicationProtectedItemDetailsTests.java new file mode 100644 index 000000000000..fe5b707af3c5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/FailoverReplicationProtectedItemDetailsTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class FailoverReplicationProtectedItemDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FailoverReplicationProtectedItemDetails model = + BinaryData + .fromString( + "{\"name\":\"xpzruzythqkk\",\"friendlyName\":\"bg\",\"testVmName\":\"ellv\",\"testVmFriendlyName\":\"nxdmnitmujdtv\",\"networkConnectionStatus\":\"lyymffhmjpddny\",\"networkFriendlyName\":\"zuvrzmzqmz\",\"subnet\":\"rb\",\"recoveryPointId\":\"vnmdyfoeboj\",\"recoveryPointTime\":\"2021-06-09T22:38:27Z\"}") + .toObject(FailoverReplicationProtectedItemDetails.class); + Assertions.assertEquals("xpzruzythqkk", model.name()); + Assertions.assertEquals("bg", model.friendlyName()); + Assertions.assertEquals("ellv", model.testVmName()); + Assertions.assertEquals("nxdmnitmujdtv", model.testVmFriendlyName()); + Assertions.assertEquals("lyymffhmjpddny", model.networkConnectionStatus()); + Assertions.assertEquals("zuvrzmzqmz", model.networkFriendlyName()); + Assertions.assertEquals("rb", model.subnet()); + Assertions.assertEquals("vnmdyfoeboj", model.recoveryPointId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-09T22:38:27Z"), model.recoveryPointTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FailoverReplicationProtectedItemDetails model = + new FailoverReplicationProtectedItemDetails() + .withName("xpzruzythqkk") + .withFriendlyName("bg") + .withTestVmName("ellv") + .withTestVmFriendlyName("nxdmnitmujdtv") + .withNetworkConnectionStatus("lyymffhmjpddny") + .withNetworkFriendlyName("zuvrzmzqmz") + .withSubnet("rb") + .withRecoveryPointId("vnmdyfoeboj") + .withRecoveryPointTime(OffsetDateTime.parse("2021-06-09T22:38:27Z")); + model = BinaryData.fromObject(model).toObject(FailoverReplicationProtectedItemDetails.class); + Assertions.assertEquals("xpzruzythqkk", model.name()); + Assertions.assertEquals("bg", model.friendlyName()); + Assertions.assertEquals("ellv", model.testVmName()); + Assertions.assertEquals("nxdmnitmujdtv", model.testVmFriendlyName()); + Assertions.assertEquals("lyymffhmjpddny", model.networkConnectionStatus()); + Assertions.assertEquals("zuvrzmzqmz", model.networkFriendlyName()); + Assertions.assertEquals("rb", model.subnet()); + Assertions.assertEquals("vnmdyfoeboj", model.recoveryPointId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-09T22:38:27Z"), model.recoveryPointTime()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/GatewayOperationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/GatewayOperationDetailsTests.java new file mode 100644 index 000000000000..c5f31bd3bb89 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/GatewayOperationDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.GatewayOperationDetails; + +public final class GatewayOperationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GatewayOperationDetails model = + BinaryData + .fromString( + "{\"state\":\"g\",\"progressPercentage\":2029904789,\"timeElapsed\":322502128306108788,\"timeRemaining\":7668781915393184343,\"uploadSpeed\":826381918369159803,\"hostName\":\"ilaywkdcwm\",\"dataStores\":[\"ri\",\"mhxdqaolfy\",\"nkkbjpjvlywltmfw\",\"bbjwhlw\"],\"vmwareReadThroughput\":8018197232244540786}") + .toObject(GatewayOperationDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GatewayOperationDetails model = new GatewayOperationDetails(); + model = BinaryData.fromObject(model).toObject(GatewayOperationDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVHostDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVHostDetailsTests.java new file mode 100644 index 000000000000..589d1a1104c0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVHostDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVHostDetails; + +public final class HyperVHostDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVHostDetails model = + BinaryData + .fromString("{\"id\":\"zocrdzgczeu\",\"name\":\"g\",\"marsAgentVersion\":\"ncaqttiekoifu\"}") + .toObject(HyperVHostDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVHostDetails model = new HyperVHostDetails(); + model = BinaryData.fromObject(model).toObject(HyperVHostDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplica2012EventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplica2012EventDetailsTests.java new file mode 100644 index 000000000000..0fa1051a5e9f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplica2012EventDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplica2012EventDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplica2012EventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplica2012EventDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplica2012\",\"containerName\":\"yttzgixgyrih\",\"fabricName\":\"mgb\",\"remoteContainerName\":\"lqtxnrflkndrn\",\"remoteFabricName\":\"gfjo\"}") + .toObject(HyperVReplica2012EventDetails.class); + Assertions.assertEquals("yttzgixgyrih", model.containerName()); + Assertions.assertEquals("mgb", model.fabricName()); + Assertions.assertEquals("lqtxnrflkndrn", model.remoteContainerName()); + Assertions.assertEquals("gfjo", model.remoteFabricName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplica2012EventDetails model = + new HyperVReplica2012EventDetails() + .withContainerName("yttzgixgyrih") + .withFabricName("mgb") + .withRemoteContainerName("lqtxnrflkndrn") + .withRemoteFabricName("gfjo"); + model = BinaryData.fromObject(model).toObject(HyperVReplica2012EventDetails.class); + Assertions.assertEquals("yttzgixgyrih", model.containerName()); + Assertions.assertEquals("mgb", model.fabricName()); + Assertions.assertEquals("lqtxnrflkndrn", model.remoteContainerName()); + Assertions.assertEquals("gfjo", model.remoteFabricName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplica2012R2EventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplica2012R2EventDetailsTests.java new file mode 100644 index 000000000000..22acda13fd69 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplica2012R2EventDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplica2012R2EventDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplica2012R2EventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplica2012R2EventDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplica2012R2\",\"containerName\":\"daqotwfh\",\"fabricName\":\"xwgsa\",\"remoteContainerName\":\"c\",\"remoteFabricName\":\"owzafczu\"}") + .toObject(HyperVReplica2012R2EventDetails.class); + Assertions.assertEquals("daqotwfh", model.containerName()); + Assertions.assertEquals("xwgsa", model.fabricName()); + Assertions.assertEquals("c", model.remoteContainerName()); + Assertions.assertEquals("owzafczu", model.remoteFabricName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplica2012R2EventDetails model = + new HyperVReplica2012R2EventDetails() + .withContainerName("daqotwfh") + .withFabricName("xwgsa") + .withRemoteContainerName("c") + .withRemoteFabricName("owzafczu"); + model = BinaryData.fromObject(model).toObject(HyperVReplica2012R2EventDetails.class); + Assertions.assertEquals("daqotwfh", model.containerName()); + Assertions.assertEquals("xwgsa", model.fabricName()); + Assertions.assertEquals("c", model.remoteContainerName()); + Assertions.assertEquals("owzafczu", model.remoteFabricName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureApplyRecoveryPointInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureApplyRecoveryPointInputTests.java new file mode 100644 index 000000000000..6ca0be4ebd19 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureApplyRecoveryPointInputTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureApplyRecoveryPointInput; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureApplyRecoveryPointInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureApplyRecoveryPointInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"primaryKekCertificatePfx\":\"ljcirvpefycdvei\",\"secondaryKekCertificatePfx\":\"tjnsx\"}") + .toObject(HyperVReplicaAzureApplyRecoveryPointInput.class); + Assertions.assertEquals("ljcirvpefycdvei", model.primaryKekCertificatePfx()); + Assertions.assertEquals("tjnsx", model.secondaryKekCertificatePfx()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureApplyRecoveryPointInput model = + new HyperVReplicaAzureApplyRecoveryPointInput() + .withPrimaryKekCertificatePfx("ljcirvpefycdvei") + .withSecondaryKekCertificatePfx("tjnsx"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureApplyRecoveryPointInput.class); + Assertions.assertEquals("ljcirvpefycdvei", model.primaryKekCertificatePfx()); + Assertions.assertEquals("tjnsx", model.secondaryKekCertificatePfx()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureDiskInputDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureDiskInputDetailsTests.java new file mode 100644 index 000000000000..ec09de9ebf89 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureDiskInputDetailsTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskAccountType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureDiskInputDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureDiskInputDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureDiskInputDetails model = + BinaryData + .fromString( + "{\"diskId\":\"jlnsj\",\"logStorageAccountId\":\"ju\",\"diskType\":\"StandardSSD_LRS\",\"diskEncryptionSetId\":\"xqvmvuay\"}") + .toObject(HyperVReplicaAzureDiskInputDetails.class); + Assertions.assertEquals("jlnsj", model.diskId()); + Assertions.assertEquals("ju", model.logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.diskType()); + Assertions.assertEquals("xqvmvuay", model.diskEncryptionSetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureDiskInputDetails model = + new HyperVReplicaAzureDiskInputDetails() + .withDiskId("jlnsj") + .withLogStorageAccountId("ju") + .withDiskType(DiskAccountType.STANDARD_SSD_LRS) + .withDiskEncryptionSetId("xqvmvuay"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureDiskInputDetails.class); + Assertions.assertEquals("jlnsj", model.diskId()); + Assertions.assertEquals("ju", model.logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.diskType()); + Assertions.assertEquals("xqvmvuay", model.diskEncryptionSetId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureEnableProtectionInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureEnableProtectionInputTests.java new file mode 100644 index 000000000000..3f5fc32b7a26 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureEnableProtectionInputTests.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskAccountType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureDiskInputDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureEnableProtectionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LicenseType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SqlServerLicenseType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureEnableProtectionInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureEnableProtectionInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"hvHostVmId\":\"adxkxeqbwpntghy\",\"vmName\":\"a\",\"osType\":\"drnxsluvlzla\",\"vhdId\":\"t\",\"targetStorageAccountId\":\"pbqhvfdqqjwkr\",\"targetAzureNetworkId\":\"zdanojis\",\"targetAzureSubnetId\":\"lmvokat\",\"enableRdpOnTargetOption\":\"tjctibpvbkaeh\",\"targetAzureVmName\":\"mzy\",\"logStorageAccountId\":\"fwakw\",\"disksToInclude\":[\"vmakxhysowljuxl\",\"bectvtfjmskdch\"],\"targetAzureV1ResourceGroupId\":\"iubavlzwpvgm\",\"targetAzureV2ResourceGroupId\":\"lkzazmgok\",\"useManagedDisks\":\"gjqafkmkrokzr\",\"targetAvailabilitySetId\":\"qetwpqrtvaozn\",\"targetAvailabilityZone\":\"ixiezeag\",\"licenseType\":\"NotSpecified\",\"sqlServerLicenseType\":\"NotSpecified\",\"targetVmSize\":\"ugedh\",\"targetProximityPlacementGroupId\":\"jstlzmblsyj\",\"useManagedDisksForReplication\":\"olctae\",\"diskType\":\"Standard_LRS\",\"disksToIncludeForManagedDisks\":[{\"diskId\":\"edjc\",\"logStorageAccountId\":\"tb\",\"diskType\":\"StandardSSD_LRS\",\"diskEncryptionSetId\":\"gdxzvsgeafgfoseh\"},{\"diskId\":\"zsxezppkkwaae\",\"logStorageAccountId\":\"yfjlpzeqto\",\"diskType\":\"Premium_LRS\",\"diskEncryptionSetId\":\"ixlajmllpquevham\"}],\"diskEncryptionSetId\":\"wg\",\"targetVmTags\":{\"qovchiqbp\":\"mkekxpkzwaqxo\"},\"seedManagedDiskTags\":{\"ztekxbyjgmsfep\":\"idu\",\"dicxdw\":\"yihpqadagrh\",\"vcxjsgbipcukdvek\":\"jfowxwy\",\"scrdp\":\"buhoduchv\"},\"targetManagedDiskTags\":{\"szekbh\":\"dyjdussp\",\"hbfrnuybfflj\":\"lkaaggkr\"},\"targetNicTags\":{\"srexxfavs\":\"mreoagsqtaad\",\"l\":\"wudohzilfm\"}}") + .toObject(HyperVReplicaAzureEnableProtectionInput.class); + Assertions.assertEquals("adxkxeqbwpntghy", model.hvHostVmId()); + Assertions.assertEquals("a", model.vmName()); + Assertions.assertEquals("drnxsluvlzla", model.osType()); + Assertions.assertEquals("t", model.vhdId()); + Assertions.assertEquals("pbqhvfdqqjwkr", model.targetStorageAccountId()); + Assertions.assertEquals("zdanojis", model.targetAzureNetworkId()); + Assertions.assertEquals("lmvokat", model.targetAzureSubnetId()); + Assertions.assertEquals("tjctibpvbkaeh", model.enableRdpOnTargetOption()); + Assertions.assertEquals("mzy", model.targetAzureVmName()); + Assertions.assertEquals("fwakw", model.logStorageAccountId()); + Assertions.assertEquals("vmakxhysowljuxl", model.disksToInclude().get(0)); + Assertions.assertEquals("iubavlzwpvgm", model.targetAzureV1ResourceGroupId()); + Assertions.assertEquals("lkzazmgok", model.targetAzureV2ResourceGroupId()); + Assertions.assertEquals("gjqafkmkrokzr", model.useManagedDisks()); + Assertions.assertEquals("qetwpqrtvaozn", model.targetAvailabilitySetId()); + Assertions.assertEquals("ixiezeag", model.targetAvailabilityZone()); + Assertions.assertEquals(LicenseType.NOT_SPECIFIED, model.licenseType()); + Assertions.assertEquals(SqlServerLicenseType.NOT_SPECIFIED, model.sqlServerLicenseType()); + Assertions.assertEquals("ugedh", model.targetVmSize()); + Assertions.assertEquals("jstlzmblsyj", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("olctae", model.useManagedDisksForReplication()); + Assertions.assertEquals(DiskAccountType.STANDARD_LRS, model.diskType()); + Assertions.assertEquals("edjc", model.disksToIncludeForManagedDisks().get(0).diskId()); + Assertions.assertEquals("tb", model.disksToIncludeForManagedDisks().get(0).logStorageAccountId()); + Assertions + .assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.disksToIncludeForManagedDisks().get(0).diskType()); + Assertions.assertEquals("gdxzvsgeafgfoseh", model.disksToIncludeForManagedDisks().get(0).diskEncryptionSetId()); + Assertions.assertEquals("wg", model.diskEncryptionSetId()); + Assertions.assertEquals("mkekxpkzwaqxo", model.targetVmTags().get("qovchiqbp")); + Assertions.assertEquals("idu", model.seedManagedDiskTags().get("ztekxbyjgmsfep")); + Assertions.assertEquals("dyjdussp", model.targetManagedDiskTags().get("szekbh")); + Assertions.assertEquals("mreoagsqtaad", model.targetNicTags().get("srexxfavs")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureEnableProtectionInput model = + new HyperVReplicaAzureEnableProtectionInput() + .withHvHostVmId("adxkxeqbwpntghy") + .withVmName("a") + .withOsType("drnxsluvlzla") + .withVhdId("t") + .withTargetStorageAccountId("pbqhvfdqqjwkr") + .withTargetAzureNetworkId("zdanojis") + .withTargetAzureSubnetId("lmvokat") + .withEnableRdpOnTargetOption("tjctibpvbkaeh") + .withTargetAzureVmName("mzy") + .withLogStorageAccountId("fwakw") + .withDisksToInclude(Arrays.asList("vmakxhysowljuxl", "bectvtfjmskdch")) + .withTargetAzureV1ResourceGroupId("iubavlzwpvgm") + .withTargetAzureV2ResourceGroupId("lkzazmgok") + .withUseManagedDisks("gjqafkmkrokzr") + .withTargetAvailabilitySetId("qetwpqrtvaozn") + .withTargetAvailabilityZone("ixiezeag") + .withLicenseType(LicenseType.NOT_SPECIFIED) + .withSqlServerLicenseType(SqlServerLicenseType.NOT_SPECIFIED) + .withTargetVmSize("ugedh") + .withTargetProximityPlacementGroupId("jstlzmblsyj") + .withUseManagedDisksForReplication("olctae") + .withDiskType(DiskAccountType.STANDARD_LRS) + .withDisksToIncludeForManagedDisks( + Arrays + .asList( + new HyperVReplicaAzureDiskInputDetails() + .withDiskId("edjc") + .withLogStorageAccountId("tb") + .withDiskType(DiskAccountType.STANDARD_SSD_LRS) + .withDiskEncryptionSetId("gdxzvsgeafgfoseh"), + new HyperVReplicaAzureDiskInputDetails() + .withDiskId("zsxezppkkwaae") + .withLogStorageAccountId("yfjlpzeqto") + .withDiskType(DiskAccountType.PREMIUM_LRS) + .withDiskEncryptionSetId("ixlajmllpquevham"))) + .withDiskEncryptionSetId("wg") + .withTargetVmTags(mapOf("qovchiqbp", "mkekxpkzwaqxo")) + .withSeedManagedDiskTags( + mapOf( + "ztekxbyjgmsfep", + "idu", + "dicxdw", + "yihpqadagrh", + "vcxjsgbipcukdvek", + "jfowxwy", + "scrdp", + "buhoduchv")) + .withTargetManagedDiskTags(mapOf("szekbh", "dyjdussp", "hbfrnuybfflj", "lkaaggkr")) + .withTargetNicTags(mapOf("srexxfavs", "mreoagsqtaad", "l", "wudohzilfm")); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureEnableProtectionInput.class); + Assertions.assertEquals("adxkxeqbwpntghy", model.hvHostVmId()); + Assertions.assertEquals("a", model.vmName()); + Assertions.assertEquals("drnxsluvlzla", model.osType()); + Assertions.assertEquals("t", model.vhdId()); + Assertions.assertEquals("pbqhvfdqqjwkr", model.targetStorageAccountId()); + Assertions.assertEquals("zdanojis", model.targetAzureNetworkId()); + Assertions.assertEquals("lmvokat", model.targetAzureSubnetId()); + Assertions.assertEquals("tjctibpvbkaeh", model.enableRdpOnTargetOption()); + Assertions.assertEquals("mzy", model.targetAzureVmName()); + Assertions.assertEquals("fwakw", model.logStorageAccountId()); + Assertions.assertEquals("vmakxhysowljuxl", model.disksToInclude().get(0)); + Assertions.assertEquals("iubavlzwpvgm", model.targetAzureV1ResourceGroupId()); + Assertions.assertEquals("lkzazmgok", model.targetAzureV2ResourceGroupId()); + Assertions.assertEquals("gjqafkmkrokzr", model.useManagedDisks()); + Assertions.assertEquals("qetwpqrtvaozn", model.targetAvailabilitySetId()); + Assertions.assertEquals("ixiezeag", model.targetAvailabilityZone()); + Assertions.assertEquals(LicenseType.NOT_SPECIFIED, model.licenseType()); + Assertions.assertEquals(SqlServerLicenseType.NOT_SPECIFIED, model.sqlServerLicenseType()); + Assertions.assertEquals("ugedh", model.targetVmSize()); + Assertions.assertEquals("jstlzmblsyj", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("olctae", model.useManagedDisksForReplication()); + Assertions.assertEquals(DiskAccountType.STANDARD_LRS, model.diskType()); + Assertions.assertEquals("edjc", model.disksToIncludeForManagedDisks().get(0).diskId()); + Assertions.assertEquals("tb", model.disksToIncludeForManagedDisks().get(0).logStorageAccountId()); + Assertions + .assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.disksToIncludeForManagedDisks().get(0).diskType()); + Assertions.assertEquals("gdxzvsgeafgfoseh", model.disksToIncludeForManagedDisks().get(0).diskEncryptionSetId()); + Assertions.assertEquals("wg", model.diskEncryptionSetId()); + Assertions.assertEquals("mkekxpkzwaqxo", model.targetVmTags().get("qovchiqbp")); + Assertions.assertEquals("idu", model.seedManagedDiskTags().get("ztekxbyjgmsfep")); + Assertions.assertEquals("dyjdussp", model.targetManagedDiskTags().get("szekbh")); + Assertions.assertEquals("mreoagsqtaad", model.targetNicTags().get("srexxfavs")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureEventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureEventDetailsTests.java new file mode 100644 index 000000000000..789adf168aaa --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureEventDetailsTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureEventDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureEventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureEventDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"containerName\":\"psimsf\",\"fabricName\":\"pofqpmbhy\",\"remoteContainerName\":\"sdrmmttjxophgerh\"}") + .toObject(HyperVReplicaAzureEventDetails.class); + Assertions.assertEquals("psimsf", model.containerName()); + Assertions.assertEquals("pofqpmbhy", model.fabricName()); + Assertions.assertEquals("sdrmmttjxophgerh", model.remoteContainerName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureEventDetails model = + new HyperVReplicaAzureEventDetails() + .withContainerName("psimsf") + .withFabricName("pofqpmbhy") + .withRemoteContainerName("sdrmmttjxophgerh"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureEventDetails.class); + Assertions.assertEquals("psimsf", model.containerName()); + Assertions.assertEquals("pofqpmbhy", model.fabricName()); + Assertions.assertEquals("sdrmmttjxophgerh", model.remoteContainerName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureFailbackProviderInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureFailbackProviderInputTests.java new file mode 100644 index 000000000000..7bafbd12bae6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureFailbackProviderInputTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureFailbackProviderInput; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureFailbackProviderInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureFailbackProviderInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzureFailback\",\"dataSyncOption\":\"vgohtw\",\"recoveryVmCreationOption\":\"qilrixysfn\",\"providerIdForAlternateRecovery\":\"sqywwwmhkru\"}") + .toObject(HyperVReplicaAzureFailbackProviderInput.class); + Assertions.assertEquals("vgohtw", model.dataSyncOption()); + Assertions.assertEquals("qilrixysfn", model.recoveryVmCreationOption()); + Assertions.assertEquals("sqywwwmhkru", model.providerIdForAlternateRecovery()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureFailbackProviderInput model = + new HyperVReplicaAzureFailbackProviderInput() + .withDataSyncOption("vgohtw") + .withRecoveryVmCreationOption("qilrixysfn") + .withProviderIdForAlternateRecovery("sqywwwmhkru"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureFailbackProviderInput.class); + Assertions.assertEquals("vgohtw", model.dataSyncOption()); + Assertions.assertEquals("qilrixysfn", model.recoveryVmCreationOption()); + Assertions.assertEquals("sqywwwmhkru", model.providerIdForAlternateRecovery()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureManagedDiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureManagedDiskDetailsTests.java new file mode 100644 index 000000000000..75b19292e947 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureManagedDiskDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureManagedDiskDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureManagedDiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureManagedDiskDetails model = + BinaryData + .fromString( + "{\"diskId\":\"edrympmlqo\",\"seedManagedDiskId\":\"hzdue\",\"replicaDiskType\":\"hapfjiik\",\"diskEncryptionSetId\":\"diqfliejhpclbi\"}") + .toObject(HyperVReplicaAzureManagedDiskDetails.class); + Assertions.assertEquals("edrympmlqo", model.diskId()); + Assertions.assertEquals("hzdue", model.seedManagedDiskId()); + Assertions.assertEquals("hapfjiik", model.replicaDiskType()); + Assertions.assertEquals("diqfliejhpclbi", model.diskEncryptionSetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureManagedDiskDetails model = + new HyperVReplicaAzureManagedDiskDetails() + .withDiskId("edrympmlqo") + .withSeedManagedDiskId("hzdue") + .withReplicaDiskType("hapfjiik") + .withDiskEncryptionSetId("diqfliejhpclbi"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureManagedDiskDetails.class); + Assertions.assertEquals("edrympmlqo", model.diskId()); + Assertions.assertEquals("hzdue", model.seedManagedDiskId()); + Assertions.assertEquals("hapfjiik", model.replicaDiskType()); + Assertions.assertEquals("diqfliejhpclbi", model.diskEncryptionSetId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzurePlannedFailoverProviderInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzurePlannedFailoverProviderInputTests.java new file mode 100644 index 000000000000..2b74aeff0e2d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzurePlannedFailoverProviderInputTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzurePlannedFailoverProviderInput; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzurePlannedFailoverProviderInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzurePlannedFailoverProviderInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"primaryKekCertificatePfx\":\"fsbw\",\"secondaryKekCertificatePfx\":\"ivbvzi\",\"recoveryPointId\":\"wxgoooxzpra\",\"osUpgradeVersion\":\"s\"}") + .toObject(HyperVReplicaAzurePlannedFailoverProviderInput.class); + Assertions.assertEquals("fsbw", model.primaryKekCertificatePfx()); + Assertions.assertEquals("ivbvzi", model.secondaryKekCertificatePfx()); + Assertions.assertEquals("wxgoooxzpra", model.recoveryPointId()); + Assertions.assertEquals("s", model.osUpgradeVersion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzurePlannedFailoverProviderInput model = + new HyperVReplicaAzurePlannedFailoverProviderInput() + .withPrimaryKekCertificatePfx("fsbw") + .withSecondaryKekCertificatePfx("ivbvzi") + .withRecoveryPointId("wxgoooxzpra") + .withOsUpgradeVersion("s"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzurePlannedFailoverProviderInput.class); + Assertions.assertEquals("fsbw", model.primaryKekCertificatePfx()); + Assertions.assertEquals("ivbvzi", model.secondaryKekCertificatePfx()); + Assertions.assertEquals("wxgoooxzpra", model.recoveryPointId()); + Assertions.assertEquals("s", model.osUpgradeVersion()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzurePolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzurePolicyDetailsTests.java new file mode 100644 index 000000000000..cf848717690c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzurePolicyDetailsTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzurePolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzurePolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzurePolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"recoveryPointHistoryDurationInHours\":779585791,\"applicationConsistentSnapshotFrequencyInHours\":1492620534,\"replicationInterval\":2041507399,\"onlineReplicationStartTime\":\"igjsugswhgs\",\"encryption\":\"dkwwn\",\"activeStorageAccountId\":\"foct\"}") + .toObject(HyperVReplicaAzurePolicyDetails.class); + Assertions.assertEquals(779585791, model.recoveryPointHistoryDurationInHours()); + Assertions.assertEquals(1492620534, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals(2041507399, model.replicationInterval()); + Assertions.assertEquals("igjsugswhgs", model.onlineReplicationStartTime()); + Assertions.assertEquals("dkwwn", model.encryption()); + Assertions.assertEquals("foct", model.activeStorageAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzurePolicyDetails model = + new HyperVReplicaAzurePolicyDetails() + .withRecoveryPointHistoryDurationInHours(779585791) + .withApplicationConsistentSnapshotFrequencyInHours(1492620534) + .withReplicationInterval(2041507399) + .withOnlineReplicationStartTime("igjsugswhgs") + .withEncryption("dkwwn") + .withActiveStorageAccountId("foct"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzurePolicyDetails.class); + Assertions.assertEquals(779585791, model.recoveryPointHistoryDurationInHours()); + Assertions.assertEquals(1492620534, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals(2041507399, model.replicationInterval()); + Assertions.assertEquals("igjsugswhgs", model.onlineReplicationStartTime()); + Assertions.assertEquals("dkwwn", model.encryption()); + Assertions.assertEquals("foct", model.activeStorageAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzurePolicyInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzurePolicyInputTests.java new file mode 100644 index 000000000000..18f2d0bde8bf --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzurePolicyInputTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzurePolicyInput; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzurePolicyInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzurePolicyInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"recoveryPointHistoryDuration\":498645411,\"applicationConsistentSnapshotFrequencyInHours\":2120923366,\"replicationInterval\":394441796,\"onlineReplicationStartTime\":\"wsxbgnvkervqc\",\"storageAccounts\":[\"dhrsxqvzvsp\",\"bdsrgfajglzrsu\",\"klrxhjnltce\",\"jdvqy\"]}") + .toObject(HyperVReplicaAzurePolicyInput.class); + Assertions.assertEquals(498645411, model.recoveryPointHistoryDuration()); + Assertions.assertEquals(2120923366, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals(394441796, model.replicationInterval()); + Assertions.assertEquals("wsxbgnvkervqc", model.onlineReplicationStartTime()); + Assertions.assertEquals("dhrsxqvzvsp", model.storageAccounts().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzurePolicyInput model = + new HyperVReplicaAzurePolicyInput() + .withRecoveryPointHistoryDuration(498645411) + .withApplicationConsistentSnapshotFrequencyInHours(2120923366) + .withReplicationInterval(394441796) + .withOnlineReplicationStartTime("wsxbgnvkervqc") + .withStorageAccounts(Arrays.asList("dhrsxqvzvsp", "bdsrgfajglzrsu", "klrxhjnltce", "jdvqy")); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzurePolicyInput.class); + Assertions.assertEquals(498645411, model.recoveryPointHistoryDuration()); + Assertions.assertEquals(2120923366, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals(394441796, model.replicationInterval()); + Assertions.assertEquals("wsxbgnvkervqc", model.onlineReplicationStartTime()); + Assertions.assertEquals("dhrsxqvzvsp", model.storageAccounts().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureReplicationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureReplicationDetailsTests.java new file mode 100644 index 000000000000..73d03f8387d9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureReplicationDetailsTests.java @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AzureVmDiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureManagedDiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureReplicationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InitialReplicationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSUpgradeSupportedVersions; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMNicDetails; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureReplicationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureReplicationDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"azureVmDiskDetails\":[{\"vhdType\":\"qkwaruwd\",\"vhdId\":\"qzxoebwgjxbi\",\"diskId\":\"nbau\",\"vhdName\":\"tzvp\",\"maxSizeMB\":\"lozkxbzrp\",\"targetDiskLocation\":\"plssanbtttk\",\"targetDiskName\":\"uxunrswg\",\"lunId\":\"jhboyikebhuhks\",\"diskEncryptionSetId\":\"wlokhueoijyzcq\",\"customTargetDiskName\":\"zqzu\"}],\"recoveryAzureVmName\":\"s\",\"recoveryAzureVMSize\":\"ej\",\"recoveryAzureStorageAccount\":\"dwtfx\",\"recoveryAzureLogStorageAccountId\":\"pqa\",\"lastReplicatedTime\":\"2021-12-08T02:26:36Z\",\"rpoInSeconds\":5044054827498032259,\"lastRpoCalculatedTime\":\"2021-10-17T04:21:19Z\",\"vmId\":\"bmxsnxoc\",\"vmProtectionState\":\"llojkpoyhgwwdj\",\"vmProtectionStateDescription\":\"dbdljz\",\"initialReplicationDetails\":{\"initialReplicationType\":\"rcvuqbsgzlrqhb\",\"initialReplicationProgressPercentage\":\"qogdx\"},\"vmNics\":[{\"nicId\":\"p\",\"replicaNicId\":\"x\",\"sourceNicArmId\":\"lflec\",\"vMNetworkName\":\"inxojjlux\",\"recoveryVMNetworkId\":\"hilzzdzzq\",\"ipConfigs\":[{\"name\":\"za\",\"isPrimary\":true,\"subnetName\":\"ibqlotokhtvwtaz\",\"staticIPAddress\":\"cqwwxwj\",\"ipAddressType\":\"fgwhnkbtlwljs\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"sn\",\"recoveryStaticIPAddress\":\"kpwolg\",\"recoveryIPAddressType\":\"ubxbteogfgfiijr\",\"recoveryPublicIPAddressId\":\"wlefksxqceazfpxg\",\"recoveryLBBackendAddressPoolIds\":[\"vzvluyq\",\"aiossscyvaifp\"],\"tfoSubnetName\":\"acvfyeowps\",\"tfoStaticIPAddress\":\"tjdhsoymhpvtyq\",\"tfoPublicIPAddressId\":\"tehdpboujs\",\"tfoLBBackendAddressPoolIds\":[\"vvdshxcdedsue\",\"ygnxcgjtfrnqukt\",\"fnslnlrxsmy\",\"trwntfmtbgw\"]},{\"name\":\"xwnaz\",\"isPrimary\":true,\"subnetName\":\"drey\",\"staticIPAddress\":\"whsetwwjwzzqs\",\"ipAddressType\":\"zuukykcyqhyqq\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"ykeys\",\"recoveryStaticIPAddress\":\"wfopazdazg\",\"recoveryIPAddressType\":\"qgpewqcfutmdpvoz\",\"recoveryPublicIPAddressId\":\"qjbknl\",\"recoveryLBBackendAddressPoolIds\":[\"ctzeyowmndc\",\"v\",\"wzqauxzanhmkvf\",\"uwkudrbcp\"],\"tfoSubnetName\":\"xudqyemebunaucmc\",\"tfoStaticIPAddress\":\"tneemmjauwcgxef\",\"tfoPublicIPAddressId\":\"haitranize\",\"tfoLBBackendAddressPoolIds\":[\"udasmxubvfbng\",\"coce\",\"hpriylfm\"]}],\"selectionType\":\"trauds\",\"recoveryNetworkSecurityGroupId\":\"lcdculregpq\",\"enableAcceleratedNetworkingOnRecovery\":false,\"tfoVMNetworkId\":\"hvrztnvg\",\"tfoNetworkSecurityGroupId\":\"hqrdgrtwmewjzlpy\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"zzwjcayerzrran\",\"recoveryNicResourceGroupName\":\"bylpolwzr\",\"reuseExistingNic\":true,\"tfoRecoveryNicName\":\"l\",\"tfoRecoveryNicResourceGroupName\":\"nkfscjfn\",\"tfoReuseExistingNic\":true,\"targetNicName\":\"uagfqwtltngv\"},{\"nicId\":\"e\",\"replicaNicId\":\"trklzmijajwol\",\"sourceNicArmId\":\"s\",\"vMNetworkName\":\"ghmp\",\"recoveryVMNetworkId\":\"wl\",\"ipConfigs\":[{\"name\":\"igt\",\"isPrimary\":true,\"subnetName\":\"bxqla\",\"staticIPAddress\":\"nssovyxpav\",\"ipAddressType\":\"nievwffc\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"zslp\",\"recoveryStaticIPAddress\":\"gcbdsvalpnptw\",\"recoveryIPAddressType\":\"kx\",\"recoveryPublicIPAddressId\":\"azwu\",\"recoveryLBBackendAddressPoolIds\":[\"qvn\",\"obfelhldiuhz\",\"gqlmfaewzgi\"],\"tfoSubnetName\":\"jpxpqhttqhnmhkre\",\"tfoStaticIPAddress\":\"dsuxheqdgcrux\",\"tfoPublicIPAddressId\":\"inymmqgwokmikp\",\"tfoLBBackendAddressPoolIds\":[\"bmjxuvjipf\",\"vhax\",\"vwzaehp\"]},{\"name\":\"thd\",\"isPrimary\":true,\"subnetName\":\"etatlakf\",\"staticIPAddress\":\"ixwgiksbbvtooxrp\",\"ipAddressType\":\"wp\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"jtnhtukfac\",\"recoveryStaticIPAddress\":\"mbf\",\"recoveryIPAddressType\":\"umeezbxvqxb\",\"recoveryPublicIPAddressId\":\"vwcga\",\"recoveryLBBackendAddressPoolIds\":[\"mtmjzw\",\"uqgovsxpwwztjfm\",\"khtgfredmlscgrll\",\"cnaovjo\"],\"tfoSubnetName\":\"zhpabac\",\"tfoStaticIPAddress\":\"lyotg\",\"tfoPublicIPAddressId\":\"sxnsrqorcge\",\"tfoLBBackendAddressPoolIds\":[\"c\",\"bxeetqujxcxxqn\",\"cqjkedwqu\",\"cgojmrv\"]},{\"name\":\"wjongzs\",\"isPrimary\":false,\"subnetName\":\"rsilcchskxxkansb\",\"staticIPAddress\":\"ia\",\"ipAddressType\":\"vtojrulfuctejr\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"jzhxlyubqjrost\",\"recoveryStaticIPAddress\":\"jeqmtzzbeqrzt\",\"recoveryIPAddressType\":\"alx\",\"recoveryPublicIPAddressId\":\"habsrwrsnrh\",\"recoveryLBBackendAddressPoolIds\":[\"tiwkkvyan\"],\"tfoSubnetName\":\"vvcsemsvuvdjkqxe\",\"tfoStaticIPAddress\":\"mmlivrjjxnw\",\"tfoPublicIPAddressId\":\"chp\",\"tfoLBBackendAddressPoolIds\":[\"lehzlxpgfq\",\"wzpwiibel\",\"cerwkwbpjxljtxbu\",\"qtbxxniuisdzh\"]}],\"selectionType\":\"d\",\"recoveryNetworkSecurityGroupId\":\"pagsecnad\",\"enableAcceleratedNetworkingOnRecovery\":true,\"tfoVMNetworkId\":\"r\",\"tfoNetworkSecurityGroupId\":\"fllmqiy\",\"enableAcceleratedNetworkingOnTfo\":true,\"recoveryNicName\":\"ellnkkii\",\"recoveryNicResourceGroupName\":\"mtum\",\"reuseExistingNic\":false,\"tfoRecoveryNicName\":\"djf\",\"tfoRecoveryNicResourceGroupName\":\"xroq\",\"tfoReuseExistingNic\":true,\"targetNicName\":\"lr\"}],\"selectedRecoveryAzureNetworkId\":\"ncanlduwzor\",\"selectedSourceNicId\":\"bm\",\"encryption\":\"qk\",\"oSDetails\":{\"osType\":\"mxkqvf\",\"productType\":\"pdxcltuubwy\",\"osEdition\":\"jbowcpj\",\"oSVersion\":\"uqgixex\",\"oSMajorVersion\":\"dfbwljav\",\"oSMinorVersion\":\"erkjddv\"},\"sourceVmRamSizeInMB\":436483933,\"sourceVmCpuCount\":1692980760,\"enableRdpOnTargetOption\":\"ftcvbii\",\"recoveryAzureResourceGroupId\":\"ksdwgdnk\",\"recoveryAvailabilitySetId\":\"gmwdh\",\"targetAvailabilityZone\":\"buvczldbglzoutb\",\"targetProximityPlacementGroupId\":\"qgz\",\"useManagedDisks\":\"ajclyzgsnorbjg\",\"licenseType\":\"zjotvmrxkhlo\",\"sqlServerLicenseType\":\"vjb\",\"lastRecoveryPointReceived\":\"2021-05-11T18:13:33Z\",\"targetVmTags\":{\"iyu\":\"qayfl\",\"rswhbuubpyro\":\"snuudtelvhyibdr\"},\"seedManagedDiskTags\":{\"czevjnn\":\"oxztfwfqch\",\"mhzcgkrepdqh\":\"tagfyvrtpqp\",\"mvxqab\":\"yhwqw\",\"eoxinhgre\":\"km\"},\"targetManagedDiskTags\":{\"angp\":\"whlpuzjpceezn\",\"phmsexroq\":\"bfaxyxzlbc\",\"nfee\":\"ndktxfv\"},\"targetNicTags\":{\"bgnixxoww\":\"krie\",\"p\":\"kyfwnwpiwxeiicr\",\"dm\":\"pk\"},\"protectedManagedDisks\":[{\"diskId\":\"jvskwsdgkjg\",\"seedManagedDiskId\":\"cwrase\",\"replicaDiskType\":\"efcvo\",\"diskEncryptionSetId\":\"woqartwy\"},{\"diskId\":\"i\",\"seedManagedDiskId\":\"advatdavuqmcb\",\"replicaDiskType\":\"sfobjl\",\"diskEncryptionSetId\":\"vjezcjumvpsim\"},{\"diskId\":\"yoi\",\"seedManagedDiskId\":\"kmi\",\"replicaDiskType\":\"nnraclibbfqpspkl\",\"diskEncryptionSetId\":\"ydgnha\"},{\"diskId\":\"wuk\",\"seedManagedDiskId\":\"zgpmnma\",\"replicaDiskType\":\"ddqil\",\"diskEncryptionSetId\":\"d\"}],\"allAvailableOSUpgradeConfigurations\":[{\"supportedSourceOsVersion\":\"fpcvstclgqrvwerf\",\"supportedTargetOsVersions\":[\"smtbljjehhcif\",\"wdv\",\"tbrekqhsqhtf\"]}]}") + .toObject(HyperVReplicaAzureReplicationDetails.class); + Assertions.assertEquals("qkwaruwd", model.azureVmDiskDetails().get(0).vhdType()); + Assertions.assertEquals("qzxoebwgjxbi", model.azureVmDiskDetails().get(0).vhdId()); + Assertions.assertEquals("nbau", model.azureVmDiskDetails().get(0).diskId()); + Assertions.assertEquals("tzvp", model.azureVmDiskDetails().get(0).vhdName()); + Assertions.assertEquals("lozkxbzrp", model.azureVmDiskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("plssanbtttk", model.azureVmDiskDetails().get(0).targetDiskLocation()); + Assertions.assertEquals("uxunrswg", model.azureVmDiskDetails().get(0).targetDiskName()); + Assertions.assertEquals("jhboyikebhuhks", model.azureVmDiskDetails().get(0).lunId()); + Assertions.assertEquals("wlokhueoijyzcq", model.azureVmDiskDetails().get(0).diskEncryptionSetId()); + Assertions.assertEquals("zqzu", model.azureVmDiskDetails().get(0).customTargetDiskName()); + Assertions.assertEquals("s", model.recoveryAzureVmName()); + Assertions.assertEquals("ej", model.recoveryAzureVMSize()); + Assertions.assertEquals("dwtfx", model.recoveryAzureStorageAccount()); + Assertions.assertEquals("pqa", model.recoveryAzureLogStorageAccountId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-08T02:26:36Z"), model.lastReplicatedTime()); + Assertions.assertEquals(5044054827498032259L, model.rpoInSeconds()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T04:21:19Z"), model.lastRpoCalculatedTime()); + Assertions.assertEquals("bmxsnxoc", model.vmId()); + Assertions.assertEquals("llojkpoyhgwwdj", model.vmProtectionState()); + Assertions.assertEquals("dbdljz", model.vmProtectionStateDescription()); + Assertions.assertEquals("rcvuqbsgzlrqhb", model.initialReplicationDetails().initialReplicationType()); + Assertions.assertEquals("qogdx", model.initialReplicationDetails().initialReplicationProgressPercentage()); + Assertions.assertEquals("p", model.vmNics().get(0).nicId()); + Assertions.assertEquals("x", model.vmNics().get(0).replicaNicId()); + Assertions.assertEquals("lflec", model.vmNics().get(0).sourceNicArmId()); + Assertions.assertEquals("inxojjlux", model.vmNics().get(0).vMNetworkName()); + Assertions.assertEquals("hilzzdzzq", model.vmNics().get(0).recoveryVMNetworkId()); + Assertions.assertEquals("za", model.vmNics().get(0).ipConfigs().get(0).name()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("ibqlotokhtvwtaz", model.vmNics().get(0).ipConfigs().get(0).subnetName()); + Assertions.assertEquals("cqwwxwj", model.vmNics().get(0).ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("fgwhnkbtlwljs", model.vmNics().get(0).ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("sn", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("kpwolg", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("ubxbteogfgfiijr", model.vmNics().get(0).ipConfigs().get(0).recoveryIpAddressType()); + Assertions + .assertEquals("wlefksxqceazfpxg", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals("vzvluyq", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("acvfyeowps", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("tjdhsoymhpvtyq", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("tehdpboujs", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions + .assertEquals( + "vvdshxcdedsue", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("trauds", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("lcdculregpq", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("hvrztnvg", model.vmNics().get(0).tfoVMNetworkId()); + Assertions.assertEquals("hqrdgrtwmewjzlpy", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("zzwjcayerzrran", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("bylpolwzr", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("l", model.vmNics().get(0).tfoRecoveryNicName()); + Assertions.assertEquals("nkfscjfn", model.vmNics().get(0).tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("uagfqwtltngv", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("ncanlduwzor", model.selectedRecoveryAzureNetworkId()); + Assertions.assertEquals("bm", model.selectedSourceNicId()); + Assertions.assertEquals("qk", model.encryption()); + Assertions.assertEquals("mxkqvf", model.oSDetails().osType()); + Assertions.assertEquals("pdxcltuubwy", model.oSDetails().productType()); + Assertions.assertEquals("jbowcpj", model.oSDetails().osEdition()); + Assertions.assertEquals("uqgixex", model.oSDetails().oSVersion()); + Assertions.assertEquals("dfbwljav", model.oSDetails().oSMajorVersion()); + Assertions.assertEquals("erkjddv", model.oSDetails().oSMinorVersion()); + Assertions.assertEquals(436483933, model.sourceVmRamSizeInMB()); + Assertions.assertEquals(1692980760, model.sourceVmCpuCount()); + Assertions.assertEquals("ftcvbii", model.enableRdpOnTargetOption()); + Assertions.assertEquals("ksdwgdnk", model.recoveryAzureResourceGroupId()); + Assertions.assertEquals("gmwdh", model.recoveryAvailabilitySetId()); + Assertions.assertEquals("buvczldbglzoutb", model.targetAvailabilityZone()); + Assertions.assertEquals("qgz", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("ajclyzgsnorbjg", model.useManagedDisks()); + Assertions.assertEquals("zjotvmrxkhlo", model.licenseType()); + Assertions.assertEquals("vjb", model.sqlServerLicenseType()); + Assertions.assertEquals("qayfl", model.targetVmTags().get("iyu")); + Assertions.assertEquals("oxztfwfqch", model.seedManagedDiskTags().get("czevjnn")); + Assertions.assertEquals("whlpuzjpceezn", model.targetManagedDiskTags().get("angp")); + Assertions.assertEquals("krie", model.targetNicTags().get("bgnixxoww")); + Assertions.assertEquals("jvskwsdgkjg", model.protectedManagedDisks().get(0).diskId()); + Assertions.assertEquals("cwrase", model.protectedManagedDisks().get(0).seedManagedDiskId()); + Assertions.assertEquals("efcvo", model.protectedManagedDisks().get(0).replicaDiskType()); + Assertions.assertEquals("woqartwy", model.protectedManagedDisks().get(0).diskEncryptionSetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureReplicationDetails model = + new HyperVReplicaAzureReplicationDetails() + .withAzureVmDiskDetails( + Arrays + .asList( + new AzureVmDiskDetails() + .withVhdType("qkwaruwd") + .withVhdId("qzxoebwgjxbi") + .withDiskId("nbau") + .withVhdName("tzvp") + .withMaxSizeMB("lozkxbzrp") + .withTargetDiskLocation("plssanbtttk") + .withTargetDiskName("uxunrswg") + .withLunId("jhboyikebhuhks") + .withDiskEncryptionSetId("wlokhueoijyzcq") + .withCustomTargetDiskName("zqzu"))) + .withRecoveryAzureVmName("s") + .withRecoveryAzureVMSize("ej") + .withRecoveryAzureStorageAccount("dwtfx") + .withRecoveryAzureLogStorageAccountId("pqa") + .withLastReplicatedTime(OffsetDateTime.parse("2021-12-08T02:26:36Z")) + .withRpoInSeconds(5044054827498032259L) + .withLastRpoCalculatedTime(OffsetDateTime.parse("2021-10-17T04:21:19Z")) + .withVmId("bmxsnxoc") + .withVmProtectionState("llojkpoyhgwwdj") + .withVmProtectionStateDescription("dbdljz") + .withInitialReplicationDetails( + new InitialReplicationDetails() + .withInitialReplicationType("rcvuqbsgzlrqhb") + .withInitialReplicationProgressPercentage("qogdx")) + .withVmNics( + Arrays + .asList( + new VMNicDetails() + .withNicId("p") + .withReplicaNicId("x") + .withSourceNicArmId("lflec") + .withVMNetworkName("inxojjlux") + .withRecoveryVMNetworkId("hilzzdzzq") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("za") + .withIsPrimary(true) + .withSubnetName("ibqlotokhtvwtaz") + .withStaticIpAddress("cqwwxwj") + .withIpAddressType("fgwhnkbtlwljs") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("sn") + .withRecoveryStaticIpAddress("kpwolg") + .withRecoveryIpAddressType("ubxbteogfgfiijr") + .withRecoveryPublicIpAddressId("wlefksxqceazfpxg") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("vzvluyq", "aiossscyvaifp")) + .withTfoSubnetName("acvfyeowps") + .withTfoStaticIpAddress("tjdhsoymhpvtyq") + .withTfoPublicIpAddressId("tehdpboujs") + .withTfoLBBackendAddressPoolIds( + Arrays + .asList( + "vvdshxcdedsue", + "ygnxcgjtfrnqukt", + "fnslnlrxsmy", + "trwntfmtbgw")), + new IpConfigDetails() + .withName("xwnaz") + .withIsPrimary(true) + .withSubnetName("drey") + .withStaticIpAddress("whsetwwjwzzqs") + .withIpAddressType("zuukykcyqhyqq") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("ykeys") + .withRecoveryStaticIpAddress("wfopazdazg") + .withRecoveryIpAddressType("qgpewqcfutmdpvoz") + .withRecoveryPublicIpAddressId("qjbknl") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("ctzeyowmndc", "v", "wzqauxzanhmkvf", "uwkudrbcp")) + .withTfoSubnetName("xudqyemebunaucmc") + .withTfoStaticIpAddress("tneemmjauwcgxef") + .withTfoPublicIpAddressId("haitranize") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("udasmxubvfbng", "coce", "hpriylfm")))) + .withSelectionType("trauds") + .withRecoveryNetworkSecurityGroupId("lcdculregpq") + .withEnableAcceleratedNetworkingOnRecovery(false) + .withTfoVMNetworkId("hvrztnvg") + .withTfoNetworkSecurityGroupId("hqrdgrtwmewjzlpy") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("zzwjcayerzrran") + .withRecoveryNicResourceGroupName("bylpolwzr") + .withReuseExistingNic(true) + .withTfoRecoveryNicName("l") + .withTfoRecoveryNicResourceGroupName("nkfscjfn") + .withTfoReuseExistingNic(true) + .withTargetNicName("uagfqwtltngv"), + new VMNicDetails() + .withNicId("e") + .withReplicaNicId("trklzmijajwol") + .withSourceNicArmId("s") + .withVMNetworkName("ghmp") + .withRecoveryVMNetworkId("wl") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("igt") + .withIsPrimary(true) + .withSubnetName("bxqla") + .withStaticIpAddress("nssovyxpav") + .withIpAddressType("nievwffc") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("zslp") + .withRecoveryStaticIpAddress("gcbdsvalpnptw") + .withRecoveryIpAddressType("kx") + .withRecoveryPublicIpAddressId("azwu") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("qvn", "obfelhldiuhz", "gqlmfaewzgi")) + .withTfoSubnetName("jpxpqhttqhnmhkre") + .withTfoStaticIpAddress("dsuxheqdgcrux") + .withTfoPublicIpAddressId("inymmqgwokmikp") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("bmjxuvjipf", "vhax", "vwzaehp")), + new IpConfigDetails() + .withName("thd") + .withIsPrimary(true) + .withSubnetName("etatlakf") + .withStaticIpAddress("ixwgiksbbvtooxrp") + .withIpAddressType("wp") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("jtnhtukfac") + .withRecoveryStaticIpAddress("mbf") + .withRecoveryIpAddressType("umeezbxvqxb") + .withRecoveryPublicIpAddressId("vwcga") + .withRecoveryLBBackendAddressPoolIds( + Arrays + .asList( + "mtmjzw", "uqgovsxpwwztjfm", "khtgfredmlscgrll", "cnaovjo")) + .withTfoSubnetName("zhpabac") + .withTfoStaticIpAddress("lyotg") + .withTfoPublicIpAddressId("sxnsrqorcge") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("c", "bxeetqujxcxxqn", "cqjkedwqu", "cgojmrv")), + new IpConfigDetails() + .withName("wjongzs") + .withIsPrimary(false) + .withSubnetName("rsilcchskxxkansb") + .withStaticIpAddress("ia") + .withIpAddressType("vtojrulfuctejr") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("jzhxlyubqjrost") + .withRecoveryStaticIpAddress("jeqmtzzbeqrzt") + .withRecoveryIpAddressType("alx") + .withRecoveryPublicIpAddressId("habsrwrsnrh") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("tiwkkvyan")) + .withTfoSubnetName("vvcsemsvuvdjkqxe") + .withTfoStaticIpAddress("mmlivrjjxnw") + .withTfoPublicIpAddressId("chp") + .withTfoLBBackendAddressPoolIds( + Arrays + .asList( + "lehzlxpgfq", + "wzpwiibel", + "cerwkwbpjxljtxbu", + "qtbxxniuisdzh")))) + .withSelectionType("d") + .withRecoveryNetworkSecurityGroupId("pagsecnad") + .withEnableAcceleratedNetworkingOnRecovery(true) + .withTfoVMNetworkId("r") + .withTfoNetworkSecurityGroupId("fllmqiy") + .withEnableAcceleratedNetworkingOnTfo(true) + .withRecoveryNicName("ellnkkii") + .withRecoveryNicResourceGroupName("mtum") + .withReuseExistingNic(false) + .withTfoRecoveryNicName("djf") + .withTfoRecoveryNicResourceGroupName("xroq") + .withTfoReuseExistingNic(true) + .withTargetNicName("lr"))) + .withSelectedRecoveryAzureNetworkId("ncanlduwzor") + .withSelectedSourceNicId("bm") + .withEncryption("qk") + .withOSDetails( + new OSDetails() + .withOsType("mxkqvf") + .withProductType("pdxcltuubwy") + .withOsEdition("jbowcpj") + .withOSVersion("uqgixex") + .withOSMajorVersion("dfbwljav") + .withOSMinorVersion("erkjddv")) + .withSourceVmRamSizeInMB(436483933) + .withSourceVmCpuCount(1692980760) + .withEnableRdpOnTargetOption("ftcvbii") + .withRecoveryAzureResourceGroupId("ksdwgdnk") + .withRecoveryAvailabilitySetId("gmwdh") + .withTargetAvailabilityZone("buvczldbglzoutb") + .withTargetProximityPlacementGroupId("qgz") + .withUseManagedDisks("ajclyzgsnorbjg") + .withLicenseType("zjotvmrxkhlo") + .withSqlServerLicenseType("vjb") + .withTargetVmTags(mapOf("iyu", "qayfl", "rswhbuubpyro", "snuudtelvhyibdr")) + .withSeedManagedDiskTags( + mapOf("czevjnn", "oxztfwfqch", "mhzcgkrepdqh", "tagfyvrtpqp", "mvxqab", "yhwqw", "eoxinhgre", "km")) + .withTargetManagedDiskTags(mapOf("angp", "whlpuzjpceezn", "phmsexroq", "bfaxyxzlbc", "nfee", "ndktxfv")) + .withTargetNicTags(mapOf("bgnixxoww", "krie", "p", "kyfwnwpiwxeiicr", "dm", "pk")) + .withProtectedManagedDisks( + Arrays + .asList( + new HyperVReplicaAzureManagedDiskDetails() + .withDiskId("jvskwsdgkjg") + .withSeedManagedDiskId("cwrase") + .withReplicaDiskType("efcvo") + .withDiskEncryptionSetId("woqartwy"), + new HyperVReplicaAzureManagedDiskDetails() + .withDiskId("i") + .withSeedManagedDiskId("advatdavuqmcb") + .withReplicaDiskType("sfobjl") + .withDiskEncryptionSetId("vjezcjumvpsim"), + new HyperVReplicaAzureManagedDiskDetails() + .withDiskId("yoi") + .withSeedManagedDiskId("kmi") + .withReplicaDiskType("nnraclibbfqpspkl") + .withDiskEncryptionSetId("ydgnha"), + new HyperVReplicaAzureManagedDiskDetails() + .withDiskId("wuk") + .withSeedManagedDiskId("zgpmnma") + .withReplicaDiskType("ddqil") + .withDiskEncryptionSetId("d"))) + .withAllAvailableOSUpgradeConfigurations(Arrays.asList(new OSUpgradeSupportedVersions())); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureReplicationDetails.class); + Assertions.assertEquals("qkwaruwd", model.azureVmDiskDetails().get(0).vhdType()); + Assertions.assertEquals("qzxoebwgjxbi", model.azureVmDiskDetails().get(0).vhdId()); + Assertions.assertEquals("nbau", model.azureVmDiskDetails().get(0).diskId()); + Assertions.assertEquals("tzvp", model.azureVmDiskDetails().get(0).vhdName()); + Assertions.assertEquals("lozkxbzrp", model.azureVmDiskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("plssanbtttk", model.azureVmDiskDetails().get(0).targetDiskLocation()); + Assertions.assertEquals("uxunrswg", model.azureVmDiskDetails().get(0).targetDiskName()); + Assertions.assertEquals("jhboyikebhuhks", model.azureVmDiskDetails().get(0).lunId()); + Assertions.assertEquals("wlokhueoijyzcq", model.azureVmDiskDetails().get(0).diskEncryptionSetId()); + Assertions.assertEquals("zqzu", model.azureVmDiskDetails().get(0).customTargetDiskName()); + Assertions.assertEquals("s", model.recoveryAzureVmName()); + Assertions.assertEquals("ej", model.recoveryAzureVMSize()); + Assertions.assertEquals("dwtfx", model.recoveryAzureStorageAccount()); + Assertions.assertEquals("pqa", model.recoveryAzureLogStorageAccountId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-08T02:26:36Z"), model.lastReplicatedTime()); + Assertions.assertEquals(5044054827498032259L, model.rpoInSeconds()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T04:21:19Z"), model.lastRpoCalculatedTime()); + Assertions.assertEquals("bmxsnxoc", model.vmId()); + Assertions.assertEquals("llojkpoyhgwwdj", model.vmProtectionState()); + Assertions.assertEquals("dbdljz", model.vmProtectionStateDescription()); + Assertions.assertEquals("rcvuqbsgzlrqhb", model.initialReplicationDetails().initialReplicationType()); + Assertions.assertEquals("qogdx", model.initialReplicationDetails().initialReplicationProgressPercentage()); + Assertions.assertEquals("p", model.vmNics().get(0).nicId()); + Assertions.assertEquals("x", model.vmNics().get(0).replicaNicId()); + Assertions.assertEquals("lflec", model.vmNics().get(0).sourceNicArmId()); + Assertions.assertEquals("inxojjlux", model.vmNics().get(0).vMNetworkName()); + Assertions.assertEquals("hilzzdzzq", model.vmNics().get(0).recoveryVMNetworkId()); + Assertions.assertEquals("za", model.vmNics().get(0).ipConfigs().get(0).name()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("ibqlotokhtvwtaz", model.vmNics().get(0).ipConfigs().get(0).subnetName()); + Assertions.assertEquals("cqwwxwj", model.vmNics().get(0).ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("fgwhnkbtlwljs", model.vmNics().get(0).ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("sn", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("kpwolg", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("ubxbteogfgfiijr", model.vmNics().get(0).ipConfigs().get(0).recoveryIpAddressType()); + Assertions + .assertEquals("wlefksxqceazfpxg", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals("vzvluyq", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("acvfyeowps", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("tjdhsoymhpvtyq", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("tehdpboujs", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions + .assertEquals( + "vvdshxcdedsue", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("trauds", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("lcdculregpq", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("hvrztnvg", model.vmNics().get(0).tfoVMNetworkId()); + Assertions.assertEquals("hqrdgrtwmewjzlpy", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("zzwjcayerzrran", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("bylpolwzr", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("l", model.vmNics().get(0).tfoRecoveryNicName()); + Assertions.assertEquals("nkfscjfn", model.vmNics().get(0).tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("uagfqwtltngv", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("ncanlduwzor", model.selectedRecoveryAzureNetworkId()); + Assertions.assertEquals("bm", model.selectedSourceNicId()); + Assertions.assertEquals("qk", model.encryption()); + Assertions.assertEquals("mxkqvf", model.oSDetails().osType()); + Assertions.assertEquals("pdxcltuubwy", model.oSDetails().productType()); + Assertions.assertEquals("jbowcpj", model.oSDetails().osEdition()); + Assertions.assertEquals("uqgixex", model.oSDetails().oSVersion()); + Assertions.assertEquals("dfbwljav", model.oSDetails().oSMajorVersion()); + Assertions.assertEquals("erkjddv", model.oSDetails().oSMinorVersion()); + Assertions.assertEquals(436483933, model.sourceVmRamSizeInMB()); + Assertions.assertEquals(1692980760, model.sourceVmCpuCount()); + Assertions.assertEquals("ftcvbii", model.enableRdpOnTargetOption()); + Assertions.assertEquals("ksdwgdnk", model.recoveryAzureResourceGroupId()); + Assertions.assertEquals("gmwdh", model.recoveryAvailabilitySetId()); + Assertions.assertEquals("buvczldbglzoutb", model.targetAvailabilityZone()); + Assertions.assertEquals("qgz", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("ajclyzgsnorbjg", model.useManagedDisks()); + Assertions.assertEquals("zjotvmrxkhlo", model.licenseType()); + Assertions.assertEquals("vjb", model.sqlServerLicenseType()); + Assertions.assertEquals("qayfl", model.targetVmTags().get("iyu")); + Assertions.assertEquals("oxztfwfqch", model.seedManagedDiskTags().get("czevjnn")); + Assertions.assertEquals("whlpuzjpceezn", model.targetManagedDiskTags().get("angp")); + Assertions.assertEquals("krie", model.targetNicTags().get("bgnixxoww")); + Assertions.assertEquals("jvskwsdgkjg", model.protectedManagedDisks().get(0).diskId()); + Assertions.assertEquals("cwrase", model.protectedManagedDisks().get(0).seedManagedDiskId()); + Assertions.assertEquals("efcvo", model.protectedManagedDisks().get(0).replicaDiskType()); + Assertions.assertEquals("woqartwy", model.protectedManagedDisks().get(0).diskEncryptionSetId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureReprotectInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureReprotectInputTests.java new file mode 100644 index 000000000000..c969ff917e06 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureReprotectInputTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureReprotectInput; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureReprotectInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureReprotectInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"hvHostVmId\":\"zbnobr\",\"vmName\":\"pbcjtrpzuyudivbx\",\"osType\":\"sqeaeonqelwg\",\"vHDId\":\"uruzy\",\"storageAccountId\":\"arogatmolji\",\"logStorageAccountId\":\"mpinmzvfkneerzzt\"}") + .toObject(HyperVReplicaAzureReprotectInput.class); + Assertions.assertEquals("zbnobr", model.hvHostVmId()); + Assertions.assertEquals("pbcjtrpzuyudivbx", model.vmName()); + Assertions.assertEquals("sqeaeonqelwg", model.osType()); + Assertions.assertEquals("uruzy", model.vHDId()); + Assertions.assertEquals("arogatmolji", model.storageAccountId()); + Assertions.assertEquals("mpinmzvfkneerzzt", model.logStorageAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureReprotectInput model = + new HyperVReplicaAzureReprotectInput() + .withHvHostVmId("zbnobr") + .withVmName("pbcjtrpzuyudivbx") + .withOsType("sqeaeonqelwg") + .withVHDId("uruzy") + .withStorageAccountId("arogatmolji") + .withLogStorageAccountId("mpinmzvfkneerzzt"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureReprotectInput.class); + Assertions.assertEquals("zbnobr", model.hvHostVmId()); + Assertions.assertEquals("pbcjtrpzuyudivbx", model.vmName()); + Assertions.assertEquals("sqeaeonqelwg", model.osType()); + Assertions.assertEquals("uruzy", model.vHDId()); + Assertions.assertEquals("arogatmolji", model.storageAccountId()); + Assertions.assertEquals("mpinmzvfkneerzzt", model.logStorageAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureTestFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureTestFailoverInputTests.java new file mode 100644 index 000000000000..b5069b30deac --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureTestFailoverInputTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureTestFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureTestFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureTestFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"primaryKekCertificatePfx\":\"nsjulugdybnh\",\"secondaryKekCertificatePfx\":\"lelfjhkeizcpih\",\"recoveryPointId\":\"miw\",\"osUpgradeVersion\":\"kpty\"}") + .toObject(HyperVReplicaAzureTestFailoverInput.class); + Assertions.assertEquals("nsjulugdybnh", model.primaryKekCertificatePfx()); + Assertions.assertEquals("lelfjhkeizcpih", model.secondaryKekCertificatePfx()); + Assertions.assertEquals("miw", model.recoveryPointId()); + Assertions.assertEquals("kpty", model.osUpgradeVersion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureTestFailoverInput model = + new HyperVReplicaAzureTestFailoverInput() + .withPrimaryKekCertificatePfx("nsjulugdybnh") + .withSecondaryKekCertificatePfx("lelfjhkeizcpih") + .withRecoveryPointId("miw") + .withOsUpgradeVersion("kpty"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureTestFailoverInput.class); + Assertions.assertEquals("nsjulugdybnh", model.primaryKekCertificatePfx()); + Assertions.assertEquals("lelfjhkeizcpih", model.secondaryKekCertificatePfx()); + Assertions.assertEquals("miw", model.recoveryPointId()); + Assertions.assertEquals("kpty", model.osUpgradeVersion()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureUnplannedFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureUnplannedFailoverInputTests.java new file mode 100644 index 000000000000..bd91154e24d0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaAzureUnplannedFailoverInputTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureUnplannedFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaAzureUnplannedFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaAzureUnplannedFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"primaryKekCertificatePfx\":\"ydbjzcqymlcf\",\"secondaryKekCertificatePfx\":\"hmhsurlgwqkpm\",\"recoveryPointId\":\"pstauol\"}") + .toObject(HyperVReplicaAzureUnplannedFailoverInput.class); + Assertions.assertEquals("ydbjzcqymlcf", model.primaryKekCertificatePfx()); + Assertions.assertEquals("hmhsurlgwqkpm", model.secondaryKekCertificatePfx()); + Assertions.assertEquals("pstauol", model.recoveryPointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaAzureUnplannedFailoverInput model = + new HyperVReplicaAzureUnplannedFailoverInput() + .withPrimaryKekCertificatePfx("ydbjzcqymlcf") + .withSecondaryKekCertificatePfx("hmhsurlgwqkpm") + .withRecoveryPointId("pstauol"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaAzureUnplannedFailoverInput.class); + Assertions.assertEquals("ydbjzcqymlcf", model.primaryKekCertificatePfx()); + Assertions.assertEquals("hmhsurlgwqkpm", model.secondaryKekCertificatePfx()); + Assertions.assertEquals("pstauol", model.recoveryPointId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBaseEventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBaseEventDetailsTests.java new file mode 100644 index 000000000000..571c063f52e3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBaseEventDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaBaseEventDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaBaseEventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaBaseEventDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaBaseEventDetails\",\"containerName\":\"xke\",\"fabricName\":\"iraabmdlqjbedpf\",\"remoteContainerName\":\"lhupmomihzbdnpxp\",\"remoteFabricName\":\"dpr\"}") + .toObject(HyperVReplicaBaseEventDetails.class); + Assertions.assertEquals("xke", model.containerName()); + Assertions.assertEquals("iraabmdlqjbedpf", model.fabricName()); + Assertions.assertEquals("lhupmomihzbdnpxp", model.remoteContainerName()); + Assertions.assertEquals("dpr", model.remoteFabricName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaBaseEventDetails model = + new HyperVReplicaBaseEventDetails() + .withContainerName("xke") + .withFabricName("iraabmdlqjbedpf") + .withRemoteContainerName("lhupmomihzbdnpxp") + .withRemoteFabricName("dpr"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaBaseEventDetails.class); + Assertions.assertEquals("xke", model.containerName()); + Assertions.assertEquals("iraabmdlqjbedpf", model.fabricName()); + Assertions.assertEquals("lhupmomihzbdnpxp", model.remoteContainerName()); + Assertions.assertEquals("dpr", model.remoteFabricName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBasePolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBasePolicyDetailsTests.java new file mode 100644 index 000000000000..9eb97271cd9d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBasePolicyDetailsTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaBasePolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaBasePolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaBasePolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaBasePolicyDetails\",\"recoveryPoints\":656606105,\"applicationConsistentSnapshotFrequencyInHours\":287145648,\"compression\":\"icghfl\",\"initialReplicationMethod\":\"fss\",\"onlineReplicationStartTime\":\"ghsfxrkbhammgmqf\",\"offlineReplicationImportPath\":\"fgvqcpdw\",\"offlineReplicationExportPath\":\"quxweyslandkd\",\"replicationPort\":27796894,\"allowedAuthenticationType\":654444535,\"replicaDeletionOption\":\"hghcgawnrrnqu\"}") + .toObject(HyperVReplicaBasePolicyDetails.class); + Assertions.assertEquals(656606105, model.recoveryPoints()); + Assertions.assertEquals(287145648, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("icghfl", model.compression()); + Assertions.assertEquals("fss", model.initialReplicationMethod()); + Assertions.assertEquals("ghsfxrkbhammgmqf", model.onlineReplicationStartTime()); + Assertions.assertEquals("fgvqcpdw", model.offlineReplicationImportPath()); + Assertions.assertEquals("quxweyslandkd", model.offlineReplicationExportPath()); + Assertions.assertEquals(27796894, model.replicationPort()); + Assertions.assertEquals(654444535, model.allowedAuthenticationType()); + Assertions.assertEquals("hghcgawnrrnqu", model.replicaDeletionOption()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaBasePolicyDetails model = + new HyperVReplicaBasePolicyDetails() + .withRecoveryPoints(656606105) + .withApplicationConsistentSnapshotFrequencyInHours(287145648) + .withCompression("icghfl") + .withInitialReplicationMethod("fss") + .withOnlineReplicationStartTime("ghsfxrkbhammgmqf") + .withOfflineReplicationImportPath("fgvqcpdw") + .withOfflineReplicationExportPath("quxweyslandkd") + .withReplicationPort(27796894) + .withAllowedAuthenticationType(654444535) + .withReplicaDeletionOption("hghcgawnrrnqu"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaBasePolicyDetails.class); + Assertions.assertEquals(656606105, model.recoveryPoints()); + Assertions.assertEquals(287145648, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("icghfl", model.compression()); + Assertions.assertEquals("fss", model.initialReplicationMethod()); + Assertions.assertEquals("ghsfxrkbhammgmqf", model.onlineReplicationStartTime()); + Assertions.assertEquals("fgvqcpdw", model.offlineReplicationImportPath()); + Assertions.assertEquals("quxweyslandkd", model.offlineReplicationExportPath()); + Assertions.assertEquals(27796894, model.replicationPort()); + Assertions.assertEquals(654444535, model.allowedAuthenticationType()); + Assertions.assertEquals("hghcgawnrrnqu", model.replicaDeletionOption()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBaseReplicationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBaseReplicationDetailsTests.java new file mode 100644 index 000000000000..9b376fad1cff --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBaseReplicationDetailsTests.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaBaseReplicationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InitialReplicationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMNicDetails; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaBaseReplicationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaBaseReplicationDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaBaseReplicationDetails\",\"lastReplicatedTime\":\"2021-02-01T01:04:29Z\",\"vmNics\":[{\"nicId\":\"reimseob\",\"replicaNicId\":\"xstcyilbvzm\",\"sourceNicArmId\":\"cjzlquzexokjxebj\",\"vMNetworkName\":\"zinzabwmvogljsvl\",\"recoveryVMNetworkId\":\"idnwceha\",\"ipConfigs\":[{\"name\":\"yzltgiomqo\",\"isPrimary\":true,\"subnetName\":\"iaeapfs\",\"staticIPAddress\":\"gdtpe\",\"ipAddressType\":\"acyh\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"pqqncju\",\"recoveryStaticIPAddress\":\"hjozf\",\"recoveryIPAddressType\":\"cwmbupyvqyvli\",\"recoveryPublicIPAddressId\":\"ipsejbsvsia\",\"recoveryLBBackendAddressPoolIds\":[\"whddzydisnuepyw\",\"jlnldpxottdiiaoc\",\"ibz\",\"ihweeb\"],\"tfoSubnetName\":\"hryvcjwqwoqsra\",\"tfoStaticIPAddress\":\"hdhzybspijhfr\",\"tfoPublicIPAddressId\":\"dkkagvwukhsusmm\",\"tfoLBBackendAddressPoolIds\":[\"mzhwilzzhni\"]}],\"selectionType\":\"riprlkdneytt\",\"recoveryNetworkSecurityGroupId\":\"cxiv\",\"enableAcceleratedNetworkingOnRecovery\":false,\"tfoVMNetworkId\":\"tpumltwjfluxynb\",\"tfoNetworkSecurityGroupId\":\"zlqywauyqn\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"mocgjshg\",\"recoveryNicResourceGroupName\":\"a\",\"reuseExistingNic\":false,\"tfoRecoveryNicName\":\"ixq\",\"tfoRecoveryNicResourceGroupName\":\"gljkybsj\",\"tfoReuseExistingNic\":false,\"targetNicName\":\"vtzqnrbctbhp\"},{\"nicId\":\"xpc\",\"replicaNicId\":\"dnyeita\",\"sourceNicArmId\":\"qady\",\"vMNetworkName\":\"jahwriuomzczf\",\"recoveryVMNetworkId\":\"ceevsa\",\"ipConfigs\":[{\"name\":\"p\",\"isPrimary\":false,\"subnetName\":\"khfjqebglcxkx\",\"staticIPAddress\":\"zromvygys\",\"ipAddressType\":\"tme\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"vpinkzpatqt\",\"recoveryStaticIPAddress\":\"swxspvckojaz\",\"recoveryIPAddressType\":\"gspftesu\",\"recoveryPublicIPAddressId\":\"pvpvd\",\"recoveryLBBackendAddressPoolIds\":[\"tcovqseusrfjb\",\"xzfxn\"],\"tfoSubnetName\":\"lbmuos\",\"tfoStaticIPAddress\":\"jmdihdcyyyzlw\",\"tfoPublicIPAddressId\":\"wzjnufz\",\"tfoLBBackendAddressPoolIds\":[\"m\"]},{\"name\":\"gnnbzrtf\",\"isPrimary\":true,\"subnetName\":\"uubjtvgjsxmty\",\"staticIPAddress\":\"vavdp\",\"ipAddressType\":\"obt\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"its\",\"recoveryStaticIPAddress\":\"ofw\",\"recoveryIPAddressType\":\"m\",\"recoveryPublicIPAddressId\":\"scauwazcgwdfr\",\"recoveryLBBackendAddressPoolIds\":[\"ybjpozoks\"],\"tfoSubnetName\":\"gllixdgbyfgwew\",\"tfoStaticIPAddress\":\"j\",\"tfoPublicIPAddressId\":\"prwpxsoohu\",\"tfoLBBackendAddressPoolIds\":[\"cskltezuuggg\",\"lfb\"]},{\"name\":\"dc\",\"isPrimary\":false,\"subnetName\":\"rtmdylperpil\",\"staticIPAddress\":\"jzgc\",\"ipAddressType\":\"cmfpfbodet\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"gvtshu\",\"recoveryStaticIPAddress\":\"t\",\"recoveryIPAddressType\":\"ivmuqkevzgjyp\",\"recoveryPublicIPAddressId\":\"hxmpdxxz\",\"recoveryLBBackendAddressPoolIds\":[\"wzjwotnxlkfhg\",\"h\",\"foxqwecrsn\",\"pcs\"],\"tfoSubnetName\":\"qxovppqibukk\",\"tfoStaticIPAddress\":\"zrlrmlccmetjs\",\"tfoPublicIPAddressId\":\"ivfqbqnasdsy\",\"tfoLBBackendAddressPoolIds\":[\"sieuscpl\",\"yvdgxlyzk\",\"itdshezsvkolru\",\"jovmozsaye\"]},{\"name\":\"azwzlpzbtzuykyki\",\"isPrimary\":false,\"subnetName\":\"yepfn\",\"staticIPAddress\":\"mbezacfpztg\",\"ipAddressType\":\"wyqejgaao\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"kppgkqzkcyzm\",\"recoveryStaticIPAddress\":\"ngdyfcixrhlcq\",\"recoveryIPAddressType\":\"oejgoiutgwrmkah\",\"recoveryPublicIPAddressId\":\"hazyntacihnco\",\"recoveryLBBackendAddressPoolIds\":[\"pnmliq\",\"v\",\"bhikeaqgr\"],\"tfoSubnetName\":\"pomxpu\",\"tfoStaticIPAddress\":\"tsdfjyieso\",\"tfoPublicIPAddressId\":\"iqbuou\",\"tfoLBBackendAddressPoolIds\":[\"yzgleofjs\"]}],\"selectionType\":\"bwwzvdajf\",\"recoveryNetworkSecurityGroupId\":\"n\",\"enableAcceleratedNetworkingOnRecovery\":true,\"tfoVMNetworkId\":\"ciqgjjrlhiqlwixv\",\"tfoNetworkSecurityGroupId\":\"ougu\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"opgjttba\",\"recoveryNicResourceGroupName\":\"alapdlndbe\",\"reuseExistingNic\":true,\"tfoRecoveryNicName\":\"ixv\",\"tfoRecoveryNicResourceGroupName\":\"wy\",\"tfoReuseExistingNic\":false,\"targetNicName\":\"fqvz\"}],\"vmId\":\"msp\",\"vmProtectionState\":\"zfe\",\"vmProtectionStateDescription\":\"jljmphfkyezol\",\"initialReplicationDetails\":{\"initialReplicationType\":\"mi\",\"initialReplicationProgressPercentage\":\"ydoccnxshanzb\"},\"vMDiskDetails\":[{\"maxSizeMB\":8904392733364237803,\"vhdType\":\"tecaa\",\"vhdId\":\"dohzniucbdaombwi\",\"vhdName\":\"jdllwktle\"}]}") + .toObject(HyperVReplicaBaseReplicationDetails.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-01T01:04:29Z"), model.lastReplicatedTime()); + Assertions.assertEquals("reimseob", model.vmNics().get(0).nicId()); + Assertions.assertEquals("xstcyilbvzm", model.vmNics().get(0).replicaNicId()); + Assertions.assertEquals("cjzlquzexokjxebj", model.vmNics().get(0).sourceNicArmId()); + Assertions.assertEquals("zinzabwmvogljsvl", model.vmNics().get(0).vMNetworkName()); + Assertions.assertEquals("idnwceha", model.vmNics().get(0).recoveryVMNetworkId()); + Assertions.assertEquals("yzltgiomqo", model.vmNics().get(0).ipConfigs().get(0).name()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("iaeapfs", model.vmNics().get(0).ipConfigs().get(0).subnetName()); + Assertions.assertEquals("gdtpe", model.vmNics().get(0).ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("acyh", model.vmNics().get(0).ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("pqqncju", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("hjozf", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("cwmbupyvqyvli", model.vmNics().get(0).ipConfigs().get(0).recoveryIpAddressType()); + Assertions.assertEquals("ipsejbsvsia", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals( + "whddzydisnuepyw", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("hryvcjwqwoqsra", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("hdhzybspijhfr", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("dkkagvwukhsusmm", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions + .assertEquals("mzhwilzzhni", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("riprlkdneytt", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("cxiv", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("tpumltwjfluxynb", model.vmNics().get(0).tfoVMNetworkId()); + Assertions.assertEquals("zlqywauyqn", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("mocgjshg", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("a", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("ixq", model.vmNics().get(0).tfoRecoveryNicName()); + Assertions.assertEquals("gljkybsj", model.vmNics().get(0).tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("vtzqnrbctbhp", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("msp", model.vmId()); + Assertions.assertEquals("zfe", model.vmProtectionState()); + Assertions.assertEquals("jljmphfkyezol", model.vmProtectionStateDescription()); + Assertions.assertEquals("mi", model.initialReplicationDetails().initialReplicationType()); + Assertions + .assertEquals("ydoccnxshanzb", model.initialReplicationDetails().initialReplicationProgressPercentage()); + Assertions.assertEquals(8904392733364237803L, model.vMDiskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("tecaa", model.vMDiskDetails().get(0).vhdType()); + Assertions.assertEquals("dohzniucbdaombwi", model.vMDiskDetails().get(0).vhdId()); + Assertions.assertEquals("jdllwktle", model.vMDiskDetails().get(0).vhdName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaBaseReplicationDetails model = + new HyperVReplicaBaseReplicationDetails() + .withLastReplicatedTime(OffsetDateTime.parse("2021-02-01T01:04:29Z")) + .withVmNics( + Arrays + .asList( + new VMNicDetails() + .withNicId("reimseob") + .withReplicaNicId("xstcyilbvzm") + .withSourceNicArmId("cjzlquzexokjxebj") + .withVMNetworkName("zinzabwmvogljsvl") + .withRecoveryVMNetworkId("idnwceha") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("yzltgiomqo") + .withIsPrimary(true) + .withSubnetName("iaeapfs") + .withStaticIpAddress("gdtpe") + .withIpAddressType("acyh") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("pqqncju") + .withRecoveryStaticIpAddress("hjozf") + .withRecoveryIpAddressType("cwmbupyvqyvli") + .withRecoveryPublicIpAddressId("ipsejbsvsia") + .withRecoveryLBBackendAddressPoolIds( + Arrays + .asList("whddzydisnuepyw", "jlnldpxottdiiaoc", "ibz", "ihweeb")) + .withTfoSubnetName("hryvcjwqwoqsra") + .withTfoStaticIpAddress("hdhzybspijhfr") + .withTfoPublicIpAddressId("dkkagvwukhsusmm") + .withTfoLBBackendAddressPoolIds(Arrays.asList("mzhwilzzhni")))) + .withSelectionType("riprlkdneytt") + .withRecoveryNetworkSecurityGroupId("cxiv") + .withEnableAcceleratedNetworkingOnRecovery(false) + .withTfoVMNetworkId("tpumltwjfluxynb") + .withTfoNetworkSecurityGroupId("zlqywauyqn") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("mocgjshg") + .withRecoveryNicResourceGroupName("a") + .withReuseExistingNic(false) + .withTfoRecoveryNicName("ixq") + .withTfoRecoveryNicResourceGroupName("gljkybsj") + .withTfoReuseExistingNic(false) + .withTargetNicName("vtzqnrbctbhp"), + new VMNicDetails() + .withNicId("xpc") + .withReplicaNicId("dnyeita") + .withSourceNicArmId("qady") + .withVMNetworkName("jahwriuomzczf") + .withRecoveryVMNetworkId("ceevsa") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("p") + .withIsPrimary(false) + .withSubnetName("khfjqebglcxkx") + .withStaticIpAddress("zromvygys") + .withIpAddressType("tme") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("vpinkzpatqt") + .withRecoveryStaticIpAddress("swxspvckojaz") + .withRecoveryIpAddressType("gspftesu") + .withRecoveryPublicIpAddressId("pvpvd") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("tcovqseusrfjb", "xzfxn")) + .withTfoSubnetName("lbmuos") + .withTfoStaticIpAddress("jmdihdcyyyzlw") + .withTfoPublicIpAddressId("wzjnufz") + .withTfoLBBackendAddressPoolIds(Arrays.asList("m")), + new IpConfigDetails() + .withName("gnnbzrtf") + .withIsPrimary(true) + .withSubnetName("uubjtvgjsxmty") + .withStaticIpAddress("vavdp") + .withIpAddressType("obt") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("its") + .withRecoveryStaticIpAddress("ofw") + .withRecoveryIpAddressType("m") + .withRecoveryPublicIpAddressId("scauwazcgwdfr") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("ybjpozoks")) + .withTfoSubnetName("gllixdgbyfgwew") + .withTfoStaticIpAddress("j") + .withTfoPublicIpAddressId("prwpxsoohu") + .withTfoLBBackendAddressPoolIds(Arrays.asList("cskltezuuggg", "lfb")), + new IpConfigDetails() + .withName("dc") + .withIsPrimary(false) + .withSubnetName("rtmdylperpil") + .withStaticIpAddress("jzgc") + .withIpAddressType("cmfpfbodet") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("gvtshu") + .withRecoveryStaticIpAddress("t") + .withRecoveryIpAddressType("ivmuqkevzgjyp") + .withRecoveryPublicIpAddressId("hxmpdxxz") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("wzjwotnxlkfhg", "h", "foxqwecrsn", "pcs")) + .withTfoSubnetName("qxovppqibukk") + .withTfoStaticIpAddress("zrlrmlccmetjs") + .withTfoPublicIpAddressId("ivfqbqnasdsy") + .withTfoLBBackendAddressPoolIds( + Arrays + .asList( + "sieuscpl", "yvdgxlyzk", "itdshezsvkolru", "jovmozsaye")), + new IpConfigDetails() + .withName("azwzlpzbtzuykyki") + .withIsPrimary(false) + .withSubnetName("yepfn") + .withStaticIpAddress("mbezacfpztg") + .withIpAddressType("wyqejgaao") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("kppgkqzkcyzm") + .withRecoveryStaticIpAddress("ngdyfcixrhlcq") + .withRecoveryIpAddressType("oejgoiutgwrmkah") + .withRecoveryPublicIpAddressId("hazyntacihnco") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("pnmliq", "v", "bhikeaqgr")) + .withTfoSubnetName("pomxpu") + .withTfoStaticIpAddress("tsdfjyieso") + .withTfoPublicIpAddressId("iqbuou") + .withTfoLBBackendAddressPoolIds(Arrays.asList("yzgleofjs")))) + .withSelectionType("bwwzvdajf") + .withRecoveryNetworkSecurityGroupId("n") + .withEnableAcceleratedNetworkingOnRecovery(true) + .withTfoVMNetworkId("ciqgjjrlhiqlwixv") + .withTfoNetworkSecurityGroupId("ougu") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("opgjttba") + .withRecoveryNicResourceGroupName("alapdlndbe") + .withReuseExistingNic(true) + .withTfoRecoveryNicName("ixv") + .withTfoRecoveryNicResourceGroupName("wy") + .withTfoReuseExistingNic(false) + .withTargetNicName("fqvz"))) + .withVmId("msp") + .withVmProtectionState("zfe") + .withVmProtectionStateDescription("jljmphfkyezol") + .withInitialReplicationDetails( + new InitialReplicationDetails() + .withInitialReplicationType("mi") + .withInitialReplicationProgressPercentage("ydoccnxshanzb")) + .withVMDiskDetails( + Arrays + .asList( + new DiskDetails() + .withMaxSizeMB(8904392733364237803L) + .withVhdType("tecaa") + .withVhdId("dohzniucbdaombwi") + .withVhdName("jdllwktle"))); + model = BinaryData.fromObject(model).toObject(HyperVReplicaBaseReplicationDetails.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-01T01:04:29Z"), model.lastReplicatedTime()); + Assertions.assertEquals("reimseob", model.vmNics().get(0).nicId()); + Assertions.assertEquals("xstcyilbvzm", model.vmNics().get(0).replicaNicId()); + Assertions.assertEquals("cjzlquzexokjxebj", model.vmNics().get(0).sourceNicArmId()); + Assertions.assertEquals("zinzabwmvogljsvl", model.vmNics().get(0).vMNetworkName()); + Assertions.assertEquals("idnwceha", model.vmNics().get(0).recoveryVMNetworkId()); + Assertions.assertEquals("yzltgiomqo", model.vmNics().get(0).ipConfigs().get(0).name()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("iaeapfs", model.vmNics().get(0).ipConfigs().get(0).subnetName()); + Assertions.assertEquals("gdtpe", model.vmNics().get(0).ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("acyh", model.vmNics().get(0).ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("pqqncju", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("hjozf", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("cwmbupyvqyvli", model.vmNics().get(0).ipConfigs().get(0).recoveryIpAddressType()); + Assertions.assertEquals("ipsejbsvsia", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals( + "whddzydisnuepyw", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("hryvcjwqwoqsra", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("hdhzybspijhfr", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("dkkagvwukhsusmm", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions + .assertEquals("mzhwilzzhni", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("riprlkdneytt", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("cxiv", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("tpumltwjfluxynb", model.vmNics().get(0).tfoVMNetworkId()); + Assertions.assertEquals("zlqywauyqn", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("mocgjshg", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("a", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("ixq", model.vmNics().get(0).tfoRecoveryNicName()); + Assertions.assertEquals("gljkybsj", model.vmNics().get(0).tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("vtzqnrbctbhp", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("msp", model.vmId()); + Assertions.assertEquals("zfe", model.vmProtectionState()); + Assertions.assertEquals("jljmphfkyezol", model.vmProtectionStateDescription()); + Assertions.assertEquals("mi", model.initialReplicationDetails().initialReplicationType()); + Assertions + .assertEquals("ydoccnxshanzb", model.initialReplicationDetails().initialReplicationProgressPercentage()); + Assertions.assertEquals(8904392733364237803L, model.vMDiskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("tecaa", model.vMDiskDetails().get(0).vhdType()); + Assertions.assertEquals("dohzniucbdaombwi", model.vMDiskDetails().get(0).vhdId()); + Assertions.assertEquals("jdllwktle", model.vMDiskDetails().get(0).vhdName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBluePolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBluePolicyDetailsTests.java new file mode 100644 index 000000000000..1aa923249679 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBluePolicyDetailsTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaBluePolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaBluePolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaBluePolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplica2012R2\",\"replicationFrequencyInSeconds\":2136761436,\"recoveryPoints\":1535856297,\"applicationConsistentSnapshotFrequencyInHours\":834618815,\"compression\":\"uajgcqwulynk\",\"initialReplicationMethod\":\"cfdruwsikxx\",\"onlineReplicationStartTime\":\"lhuulriqb\",\"offlineReplicationImportPath\":\"kvjgbzs\",\"offlineReplicationExportPath\":\"br\",\"replicationPort\":1636269751,\"allowedAuthenticationType\":1781145950,\"replicaDeletionOption\":\"hcdjwsuoardnagt\"}") + .toObject(HyperVReplicaBluePolicyDetails.class); + Assertions.assertEquals(2136761436, model.replicationFrequencyInSeconds()); + Assertions.assertEquals(1535856297, model.recoveryPoints()); + Assertions.assertEquals(834618815, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("uajgcqwulynk", model.compression()); + Assertions.assertEquals("cfdruwsikxx", model.initialReplicationMethod()); + Assertions.assertEquals("lhuulriqb", model.onlineReplicationStartTime()); + Assertions.assertEquals("kvjgbzs", model.offlineReplicationImportPath()); + Assertions.assertEquals("br", model.offlineReplicationExportPath()); + Assertions.assertEquals(1636269751, model.replicationPort()); + Assertions.assertEquals(1781145950, model.allowedAuthenticationType()); + Assertions.assertEquals("hcdjwsuoardnagt", model.replicaDeletionOption()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaBluePolicyDetails model = + new HyperVReplicaBluePolicyDetails() + .withReplicationFrequencyInSeconds(2136761436) + .withRecoveryPoints(1535856297) + .withApplicationConsistentSnapshotFrequencyInHours(834618815) + .withCompression("uajgcqwulynk") + .withInitialReplicationMethod("cfdruwsikxx") + .withOnlineReplicationStartTime("lhuulriqb") + .withOfflineReplicationImportPath("kvjgbzs") + .withOfflineReplicationExportPath("br") + .withReplicationPort(1636269751) + .withAllowedAuthenticationType(1781145950) + .withReplicaDeletionOption("hcdjwsuoardnagt"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaBluePolicyDetails.class); + Assertions.assertEquals(2136761436, model.replicationFrequencyInSeconds()); + Assertions.assertEquals(1535856297, model.recoveryPoints()); + Assertions.assertEquals(834618815, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("uajgcqwulynk", model.compression()); + Assertions.assertEquals("cfdruwsikxx", model.initialReplicationMethod()); + Assertions.assertEquals("lhuulriqb", model.onlineReplicationStartTime()); + Assertions.assertEquals("kvjgbzs", model.offlineReplicationImportPath()); + Assertions.assertEquals("br", model.offlineReplicationExportPath()); + Assertions.assertEquals(1636269751, model.replicationPort()); + Assertions.assertEquals(1781145950, model.allowedAuthenticationType()); + Assertions.assertEquals("hcdjwsuoardnagt", model.replicaDeletionOption()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBluePolicyInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBluePolicyInputTests.java new file mode 100644 index 000000000000..63962b9d148c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBluePolicyInputTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaBluePolicyInput; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaBluePolicyInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaBluePolicyInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplica2012R2\",\"replicationFrequencyInSeconds\":635322642,\"recoveryPoints\":1923596622,\"applicationConsistentSnapshotFrequencyInHours\":1537790283,\"compression\":\"nrholhujb\",\"initialReplicationMethod\":\"xiplkysolsyj\",\"onlineReplicationStartTime\":\"xslwhd\",\"offlineReplicationImportPath\":\"vhtbbzjhfvh\",\"offlineReplicationExportPath\":\"zb\",\"replicationPort\":1668972402,\"allowedAuthenticationType\":1931538005,\"replicaDeletion\":\"ihotjecohmxv\"}") + .toObject(HyperVReplicaBluePolicyInput.class); + Assertions.assertEquals(1923596622, model.recoveryPoints()); + Assertions.assertEquals(1537790283, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("nrholhujb", model.compression()); + Assertions.assertEquals("xiplkysolsyj", model.initialReplicationMethod()); + Assertions.assertEquals("xslwhd", model.onlineReplicationStartTime()); + Assertions.assertEquals("vhtbbzjhfvh", model.offlineReplicationImportPath()); + Assertions.assertEquals("zb", model.offlineReplicationExportPath()); + Assertions.assertEquals(1668972402, model.replicationPort()); + Assertions.assertEquals(1931538005, model.allowedAuthenticationType()); + Assertions.assertEquals("ihotjecohmxv", model.replicaDeletion()); + Assertions.assertEquals(635322642, model.replicationFrequencyInSeconds()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaBluePolicyInput model = + new HyperVReplicaBluePolicyInput() + .withRecoveryPoints(1923596622) + .withApplicationConsistentSnapshotFrequencyInHours(1537790283) + .withCompression("nrholhujb") + .withInitialReplicationMethod("xiplkysolsyj") + .withOnlineReplicationStartTime("xslwhd") + .withOfflineReplicationImportPath("vhtbbzjhfvh") + .withOfflineReplicationExportPath("zb") + .withReplicationPort(1668972402) + .withAllowedAuthenticationType(1931538005) + .withReplicaDeletion("ihotjecohmxv") + .withReplicationFrequencyInSeconds(635322642); + model = BinaryData.fromObject(model).toObject(HyperVReplicaBluePolicyInput.class); + Assertions.assertEquals(1923596622, model.recoveryPoints()); + Assertions.assertEquals(1537790283, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("nrholhujb", model.compression()); + Assertions.assertEquals("xiplkysolsyj", model.initialReplicationMethod()); + Assertions.assertEquals("xslwhd", model.onlineReplicationStartTime()); + Assertions.assertEquals("vhtbbzjhfvh", model.offlineReplicationImportPath()); + Assertions.assertEquals("zb", model.offlineReplicationExportPath()); + Assertions.assertEquals(1668972402, model.replicationPort()); + Assertions.assertEquals(1931538005, model.allowedAuthenticationType()); + Assertions.assertEquals("ihotjecohmxv", model.replicaDeletion()); + Assertions.assertEquals(635322642, model.replicationFrequencyInSeconds()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBlueReplicationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBlueReplicationDetailsTests.java new file mode 100644 index 000000000000..f8ae772a1e3c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaBlueReplicationDetailsTests.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaBlueReplicationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InitialReplicationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMNicDetails; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaBlueReplicationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaBlueReplicationDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplica2012R2\",\"lastReplicatedTime\":\"2021-05-25T03:28:24Z\",\"vmNics\":[{\"nicId\":\"guwrjm\",\"replicaNicId\":\"vbtuqkxximwg\",\"sourceNicArmId\":\"ldeko\",\"vMNetworkName\":\"gxieqfkyfhi\",\"recoveryVMNetworkId\":\"jaqupbyynvskpaj\",\"ipConfigs\":[{\"name\":\"umexmj\",\"isPrimary\":true,\"subnetName\":\"ccwkqmtx\",\"staticIPAddress\":\"eqi\",\"ipAddressType\":\"rpilgftrqrejdaah\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"ldahlfxlmu\",\"recoveryStaticIPAddress\":\"muadjnfsncski\",\"recoveryIPAddressType\":\"shjgczetybnxg\",\"recoveryPublicIPAddressId\":\"lcgctjchfjv\",\"recoveryLBBackendAddressPoolIds\":[\"j\",\"ebecuvlbefv\",\"cljkxpyl\"],\"tfoSubnetName\":\"oxz\",\"tfoStaticIPAddress\":\"psyxjije\",\"tfoPublicIPAddressId\":\"dvrbke\",\"tfoLBBackendAddressPoolIds\":[\"dkgaw\",\"wjxildfkcefeyg\",\"q\",\"jo\"]},{\"name\":\"fmn\",\"isPrimary\":false,\"subnetName\":\"jnxumentq\",\"staticIPAddress\":\"tw\",\"ipAddressType\":\"mxymulwivqtowlhl\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"ybajasqubf\",\"recoveryStaticIPAddress\":\"cywhj\",\"recoveryIPAddressType\":\"mchqoht\",\"recoveryPublicIPAddressId\":\"cpupukiy\",\"recoveryLBBackendAddressPoolIds\":[\"pwdlvwti\",\"smosaonhqnam\",\"pultas\",\"aekewnazea\"],\"tfoSubnetName\":\"kajlcyizy\",\"tfoStaticIPAddress\":\"cvxodkrvfsxxby\",\"tfoPublicIPAddressId\":\"sqlv\",\"tfoLBBackendAddressPoolIds\":[\"pwgoljt\",\"xnmxsdobygoogxqa\",\"j\",\"vaz\"]}],\"selectionType\":\"fucsaodjnosdkvi\",\"recoveryNetworkSecurityGroupId\":\"asgmatrnzpd\",\"enableAcceleratedNetworkingOnRecovery\":false,\"tfoVMNetworkId\":\"akt\",\"tfoNetworkSecurityGroupId\":\"ktz\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"yfpqd\",\"recoveryNicResourceGroupName\":\"kpp\",\"reuseExistingNic\":false,\"tfoRecoveryNicName\":\"tfvpctfjikff\",\"tfoRecoveryNicResourceGroupName\":\"g\",\"tfoReuseExistingNic\":true,\"targetNicName\":\"nwhvuldbkkejj\"},{\"nicId\":\"igaw\",\"replicaNicId\":\"zmxjqif\",\"sourceNicArmId\":\"jjsbcmlzaahzbhur\",\"vMNetworkName\":\"lkolirhhmoj\",\"recoveryVMNetworkId\":\"u\",\"ipConfigs\":[{\"name\":\"zcvaaxoialahfxwc\",\"isPrimary\":false,\"subnetName\":\"xkukm\",\"staticIPAddress\":\"zynuh\",\"ipAddressType\":\"qeq\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"ljqkxyrqolnthbb\",\"recoveryStaticIPAddress\":\"gzukw\",\"recoveryIPAddressType\":\"nzkjthfceyjn\",\"recoveryPublicIPAddressId\":\"mlfuyfjbp\",\"recoveryLBBackendAddressPoolIds\":[\"dhlrufzcqyjmq\",\"fuiocuselq\",\"rsazrhxud\"],\"tfoSubnetName\":\"mdtff\",\"tfoStaticIPAddress\":\"jmr\",\"tfoPublicIPAddressId\":\"hmwdmdlgyqixokw\",\"tfoLBBackendAddressPoolIds\":[\"whvagnqfq\",\"dlcvmyo\"]}],\"selectionType\":\"aymjchtvsnvlaq\",\"recoveryNetworkSecurityGroupId\":\"z\",\"enableAcceleratedNetworkingOnRecovery\":true,\"tfoVMNetworkId\":\"atuwqkokbc\",\"tfoNetworkSecurityGroupId\":\"thymgobl\",\"enableAcceleratedNetworkingOnTfo\":true,\"recoveryNicName\":\"wgwima\",\"recoveryNicResourceGroupName\":\"eakhtmhobcya\",\"reuseExistingNic\":true,\"tfoRecoveryNicName\":\"qtvkh\",\"tfoRecoveryNicResourceGroupName\":\"oog\",\"tfoReuseExistingNic\":false,\"targetNicName\":\"aoaqymhccto\"},{\"nicId\":\"o\",\"replicaNicId\":\"rnskby\",\"sourceNicArmId\":\"uhczy\",\"vMNetworkName\":\"vhajpxec\",\"recoveryVMNetworkId\":\"nwh\",\"ipConfigs\":[{\"name\":\"awmvgxs\",\"isPrimary\":true,\"subnetName\":\"pwirfljfewxqouo\",\"staticIPAddress\":\"dnmckap\",\"ipAddressType\":\"knq\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"encdgmoqueqihkky\",\"recoveryStaticIPAddress\":\"ltjouwhldxwh\",\"recoveryIPAddressType\":\"proqk\",\"recoveryPublicIPAddressId\":\"fxmcvprstvk\",\"recoveryLBBackendAddressPoolIds\":[\"fjtdyot\"],\"tfoSubnetName\":\"lfa\",\"tfoStaticIPAddress\":\"occqrqxw\",\"tfoPublicIPAddressId\":\"jtdrhutf\",\"tfoLBBackendAddressPoolIds\":[\"dtxopgehpadkmdzg\"]},{\"name\":\"zxvctkbbxuharls\",\"isPrimary\":true,\"subnetName\":\"clabv\",\"staticIPAddress\":\"ngsux\",\"ipAddressType\":\"zb\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"ogh\",\"recoveryStaticIPAddress\":\"a\",\"recoveryIPAddressType\":\"janormovdxxu\",\"recoveryPublicIPAddressId\":\"tujmoil\",\"recoveryLBBackendAddressPoolIds\":[\"emhdeeljslky\",\"zdsfzjuegr\"],\"tfoSubnetName\":\"htslejtvxj\",\"tfoStaticIPAddress\":\"vgjbfio\",\"tfoPublicIPAddressId\":\"njodfcbjqqwmtq\",\"tfoLBBackendAddressPoolIds\":[\"xsazuxejgw\",\"cywnfyszza\",\"zsinqbdnddb\"]},{\"name\":\"zsyvrmkjm\",\"isPrimary\":true,\"subnetName\":\"chwudlxee\",\"staticIPAddress\":\"tpmnoe\",\"ipAddressType\":\"qlfm\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"oyrfgxk\",\"recoveryStaticIPAddress\":\"pmypgfq\",\"recoveryIPAddressType\":\"tyw\",\"recoveryPublicIPAddressId\":\"a\",\"recoveryLBBackendAddressPoolIds\":[\"ejpewpyjlfxampqc\"],\"tfoSubnetName\":\"g\",\"tfoStaticIPAddress\":\"qxbpiatwfauje\",\"tfoPublicIPAddressId\":\"d\",\"tfoLBBackendAddressPoolIds\":[\"r\"]}],\"selectionType\":\"gddhjkrukizyhgs\",\"recoveryNetworkSecurityGroupId\":\"nqskt\",\"enableAcceleratedNetworkingOnRecovery\":true,\"tfoVMNetworkId\":\"jbqggweeiwdhdm\",\"tfoNetworkSecurityGroupId\":\"gbfzu\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"unmlhxdfbklcii\",\"recoveryNicResourceGroupName\":\"gjsysmvxodgwxfkz\",\"reuseExistingNic\":true,\"tfoRecoveryNicName\":\"uvbdujgcwxvec\",\"tfoRecoveryNicResourceGroupName\":\"wjtrdxriza\",\"tfoReuseExistingNic\":false,\"targetNicName\":\"iarks\"},{\"nicId\":\"pgdqxwabzrw\",\"replicaNicId\":\"rxhaclcdosqkp\",\"sourceNicArmId\":\"qgki\",\"vMNetworkName\":\"mainwhed\",\"recoveryVMNetworkId\":\"pbqwuntobu\",\"ipConfigs\":[{\"name\":\"zelwgvydjufbnkl\",\"isPrimary\":false,\"subnetName\":\"peg\",\"staticIPAddress\":\"dabalfdxaglzfytl\",\"ipAddressType\":\"lqhopxouvmrs\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"kyypzkgxfxfmy\",\"recoveryStaticIPAddress\":\"sdbpokszanmh\",\"recoveryIPAddressType\":\"pter\",\"recoveryPublicIPAddressId\":\"uwkirk\",\"recoveryLBBackendAddressPoolIds\":[\"ztsdetjygow\"],\"tfoSubnetName\":\"cq\",\"tfoStaticIPAddress\":\"lzkgysdgzyybzo\",\"tfoPublicIPAddressId\":\"v\",\"tfoLBBackendAddressPoolIds\":[\"tvdxxhe\",\"gmlilwzghjhjvmab\",\"zbwaybfmdafbgym\"]}],\"selectionType\":\"napreojxrjnbsco\",\"recoveryNetworkSecurityGroupId\":\"avip\",\"enableAcceleratedNetworkingOnRecovery\":false,\"tfoVMNetworkId\":\"hbjizqfsgnwdx\",\"tfoNetworkSecurityGroupId\":\"dpq\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"orxipmlnfyzavfr\",\"recoveryNicResourceGroupName\":\"picdbk\",\"reuseExistingNic\":true,\"tfoRecoveryNicName\":\"aq\",\"tfoRecoveryNicResourceGroupName\":\"mqazpdgonjh\",\"tfoReuseExistingNic\":false,\"targetNicName\":\"hmgpczqulpt\"}],\"vmId\":\"vcpxtzhigqqbtimp\",\"vmProtectionState\":\"blornsih\",\"vmProtectionStateDescription\":\"uds\",\"initialReplicationDetails\":{\"initialReplicationType\":\"uaawja\",\"initialReplicationProgressPercentage\":\"wj\"},\"vMDiskDetails\":[{\"maxSizeMB\":2866605353999992316,\"vhdType\":\"iixyxvqbanosj\",\"vhdId\":\"irnb\",\"vhdName\":\"gm\"},{\"maxSizeMB\":5846955284321514944,\"vhdType\":\"mynltwmpftmfoeaj\",\"vhdId\":\"syxwetamfdd\",\"vhdName\":\"lkpzwbhnrecchd\"},{\"maxSizeMB\":8883677654958515035,\"vhdType\":\"hkahmjedbiucvkh\",\"vhdId\":\"mjpjbweunxcq\",\"vhdName\":\"ihufoihp\"}]}") + .toObject(HyperVReplicaBlueReplicationDetails.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-25T03:28:24Z"), model.lastReplicatedTime()); + Assertions.assertEquals("guwrjm", model.vmNics().get(0).nicId()); + Assertions.assertEquals("vbtuqkxximwg", model.vmNics().get(0).replicaNicId()); + Assertions.assertEquals("ldeko", model.vmNics().get(0).sourceNicArmId()); + Assertions.assertEquals("gxieqfkyfhi", model.vmNics().get(0).vMNetworkName()); + Assertions.assertEquals("jaqupbyynvskpaj", model.vmNics().get(0).recoveryVMNetworkId()); + Assertions.assertEquals("umexmj", model.vmNics().get(0).ipConfigs().get(0).name()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("ccwkqmtx", model.vmNics().get(0).ipConfigs().get(0).subnetName()); + Assertions.assertEquals("eqi", model.vmNics().get(0).ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("rpilgftrqrejdaah", model.vmNics().get(0).ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("ldahlfxlmu", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("muadjnfsncski", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("shjgczetybnxg", model.vmNics().get(0).ipConfigs().get(0).recoveryIpAddressType()); + Assertions.assertEquals("lcgctjchfjv", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions.assertEquals("j", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("oxz", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("psyxjije", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("dvrbke", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("dkgaw", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("fucsaodjnosdkvi", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("asgmatrnzpd", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("akt", model.vmNics().get(0).tfoVMNetworkId()); + Assertions.assertEquals("ktz", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("yfpqd", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("kpp", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("tfvpctfjikff", model.vmNics().get(0).tfoRecoveryNicName()); + Assertions.assertEquals("g", model.vmNics().get(0).tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("nwhvuldbkkejj", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("vcpxtzhigqqbtimp", model.vmId()); + Assertions.assertEquals("blornsih", model.vmProtectionState()); + Assertions.assertEquals("uds", model.vmProtectionStateDescription()); + Assertions.assertEquals("uaawja", model.initialReplicationDetails().initialReplicationType()); + Assertions.assertEquals("wj", model.initialReplicationDetails().initialReplicationProgressPercentage()); + Assertions.assertEquals(2866605353999992316L, model.vMDiskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("iixyxvqbanosj", model.vMDiskDetails().get(0).vhdType()); + Assertions.assertEquals("irnb", model.vMDiskDetails().get(0).vhdId()); + Assertions.assertEquals("gm", model.vMDiskDetails().get(0).vhdName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaBlueReplicationDetails model = + new HyperVReplicaBlueReplicationDetails() + .withLastReplicatedTime(OffsetDateTime.parse("2021-05-25T03:28:24Z")) + .withVmNics( + Arrays + .asList( + new VMNicDetails() + .withNicId("guwrjm") + .withReplicaNicId("vbtuqkxximwg") + .withSourceNicArmId("ldeko") + .withVMNetworkName("gxieqfkyfhi") + .withRecoveryVMNetworkId("jaqupbyynvskpaj") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("umexmj") + .withIsPrimary(true) + .withSubnetName("ccwkqmtx") + .withStaticIpAddress("eqi") + .withIpAddressType("rpilgftrqrejdaah") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("ldahlfxlmu") + .withRecoveryStaticIpAddress("muadjnfsncski") + .withRecoveryIpAddressType("shjgczetybnxg") + .withRecoveryPublicIpAddressId("lcgctjchfjv") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("j", "ebecuvlbefv", "cljkxpyl")) + .withTfoSubnetName("oxz") + .withTfoStaticIpAddress("psyxjije") + .withTfoPublicIpAddressId("dvrbke") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("dkgaw", "wjxildfkcefeyg", "q", "jo")), + new IpConfigDetails() + .withName("fmn") + .withIsPrimary(false) + .withSubnetName("jnxumentq") + .withStaticIpAddress("tw") + .withIpAddressType("mxymulwivqtowlhl") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("ybajasqubf") + .withRecoveryStaticIpAddress("cywhj") + .withRecoveryIpAddressType("mchqoht") + .withRecoveryPublicIpAddressId("cpupukiy") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("pwdlvwti", "smosaonhqnam", "pultas", "aekewnazea")) + .withTfoSubnetName("kajlcyizy") + .withTfoStaticIpAddress("cvxodkrvfsxxby") + .withTfoPublicIpAddressId("sqlv") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("pwgoljt", "xnmxsdobygoogxqa", "j", "vaz")))) + .withSelectionType("fucsaodjnosdkvi") + .withRecoveryNetworkSecurityGroupId("asgmatrnzpd") + .withEnableAcceleratedNetworkingOnRecovery(false) + .withTfoVMNetworkId("akt") + .withTfoNetworkSecurityGroupId("ktz") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("yfpqd") + .withRecoveryNicResourceGroupName("kpp") + .withReuseExistingNic(false) + .withTfoRecoveryNicName("tfvpctfjikff") + .withTfoRecoveryNicResourceGroupName("g") + .withTfoReuseExistingNic(true) + .withTargetNicName("nwhvuldbkkejj"), + new VMNicDetails() + .withNicId("igaw") + .withReplicaNicId("zmxjqif") + .withSourceNicArmId("jjsbcmlzaahzbhur") + .withVMNetworkName("lkolirhhmoj") + .withRecoveryVMNetworkId("u") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("zcvaaxoialahfxwc") + .withIsPrimary(false) + .withSubnetName("xkukm") + .withStaticIpAddress("zynuh") + .withIpAddressType("qeq") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("ljqkxyrqolnthbb") + .withRecoveryStaticIpAddress("gzukw") + .withRecoveryIpAddressType("nzkjthfceyjn") + .withRecoveryPublicIpAddressId("mlfuyfjbp") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("dhlrufzcqyjmq", "fuiocuselq", "rsazrhxud")) + .withTfoSubnetName("mdtff") + .withTfoStaticIpAddress("jmr") + .withTfoPublicIpAddressId("hmwdmdlgyqixokw") + .withTfoLBBackendAddressPoolIds(Arrays.asList("whvagnqfq", "dlcvmyo")))) + .withSelectionType("aymjchtvsnvlaq") + .withRecoveryNetworkSecurityGroupId("z") + .withEnableAcceleratedNetworkingOnRecovery(true) + .withTfoVMNetworkId("atuwqkokbc") + .withTfoNetworkSecurityGroupId("thymgobl") + .withEnableAcceleratedNetworkingOnTfo(true) + .withRecoveryNicName("wgwima") + .withRecoveryNicResourceGroupName("eakhtmhobcya") + .withReuseExistingNic(true) + .withTfoRecoveryNicName("qtvkh") + .withTfoRecoveryNicResourceGroupName("oog") + .withTfoReuseExistingNic(false) + .withTargetNicName("aoaqymhccto"), + new VMNicDetails() + .withNicId("o") + .withReplicaNicId("rnskby") + .withSourceNicArmId("uhczy") + .withVMNetworkName("vhajpxec") + .withRecoveryVMNetworkId("nwh") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("awmvgxs") + .withIsPrimary(true) + .withSubnetName("pwirfljfewxqouo") + .withStaticIpAddress("dnmckap") + .withIpAddressType("knq") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("encdgmoqueqihkky") + .withRecoveryStaticIpAddress("ltjouwhldxwh") + .withRecoveryIpAddressType("proqk") + .withRecoveryPublicIpAddressId("fxmcvprstvk") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("fjtdyot")) + .withTfoSubnetName("lfa") + .withTfoStaticIpAddress("occqrqxw") + .withTfoPublicIpAddressId("jtdrhutf") + .withTfoLBBackendAddressPoolIds(Arrays.asList("dtxopgehpadkmdzg")), + new IpConfigDetails() + .withName("zxvctkbbxuharls") + .withIsPrimary(true) + .withSubnetName("clabv") + .withStaticIpAddress("ngsux") + .withIpAddressType("zb") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("ogh") + .withRecoveryStaticIpAddress("a") + .withRecoveryIpAddressType("janormovdxxu") + .withRecoveryPublicIpAddressId("tujmoil") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("emhdeeljslky", "zdsfzjuegr")) + .withTfoSubnetName("htslejtvxj") + .withTfoStaticIpAddress("vgjbfio") + .withTfoPublicIpAddressId("njodfcbjqqwmtq") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("xsazuxejgw", "cywnfyszza", "zsinqbdnddb")), + new IpConfigDetails() + .withName("zsyvrmkjm") + .withIsPrimary(true) + .withSubnetName("chwudlxee") + .withStaticIpAddress("tpmnoe") + .withIpAddressType("qlfm") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("oyrfgxk") + .withRecoveryStaticIpAddress("pmypgfq") + .withRecoveryIpAddressType("tyw") + .withRecoveryPublicIpAddressId("a") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("ejpewpyjlfxampqc")) + .withTfoSubnetName("g") + .withTfoStaticIpAddress("qxbpiatwfauje") + .withTfoPublicIpAddressId("d") + .withTfoLBBackendAddressPoolIds(Arrays.asList("r")))) + .withSelectionType("gddhjkrukizyhgs") + .withRecoveryNetworkSecurityGroupId("nqskt") + .withEnableAcceleratedNetworkingOnRecovery(true) + .withTfoVMNetworkId("jbqggweeiwdhdm") + .withTfoNetworkSecurityGroupId("gbfzu") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("unmlhxdfbklcii") + .withRecoveryNicResourceGroupName("gjsysmvxodgwxfkz") + .withReuseExistingNic(true) + .withTfoRecoveryNicName("uvbdujgcwxvec") + .withTfoRecoveryNicResourceGroupName("wjtrdxriza") + .withTfoReuseExistingNic(false) + .withTargetNicName("iarks"), + new VMNicDetails() + .withNicId("pgdqxwabzrw") + .withReplicaNicId("rxhaclcdosqkp") + .withSourceNicArmId("qgki") + .withVMNetworkName("mainwhed") + .withRecoveryVMNetworkId("pbqwuntobu") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("zelwgvydjufbnkl") + .withIsPrimary(false) + .withSubnetName("peg") + .withStaticIpAddress("dabalfdxaglzfytl") + .withIpAddressType("lqhopxouvmrs") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("kyypzkgxfxfmy") + .withRecoveryStaticIpAddress("sdbpokszanmh") + .withRecoveryIpAddressType("pter") + .withRecoveryPublicIpAddressId("uwkirk") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("ztsdetjygow")) + .withTfoSubnetName("cq") + .withTfoStaticIpAddress("lzkgysdgzyybzo") + .withTfoPublicIpAddressId("v") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("tvdxxhe", "gmlilwzghjhjvmab", "zbwaybfmdafbgym")))) + .withSelectionType("napreojxrjnbsco") + .withRecoveryNetworkSecurityGroupId("avip") + .withEnableAcceleratedNetworkingOnRecovery(false) + .withTfoVMNetworkId("hbjizqfsgnwdx") + .withTfoNetworkSecurityGroupId("dpq") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("orxipmlnfyzavfr") + .withRecoveryNicResourceGroupName("picdbk") + .withReuseExistingNic(true) + .withTfoRecoveryNicName("aq") + .withTfoRecoveryNicResourceGroupName("mqazpdgonjh") + .withTfoReuseExistingNic(false) + .withTargetNicName("hmgpczqulpt"))) + .withVmId("vcpxtzhigqqbtimp") + .withVmProtectionState("blornsih") + .withVmProtectionStateDescription("uds") + .withInitialReplicationDetails( + new InitialReplicationDetails() + .withInitialReplicationType("uaawja") + .withInitialReplicationProgressPercentage("wj")) + .withVMDiskDetails( + Arrays + .asList( + new DiskDetails() + .withMaxSizeMB(2866605353999992316L) + .withVhdType("iixyxvqbanosj") + .withVhdId("irnb") + .withVhdName("gm"), + new DiskDetails() + .withMaxSizeMB(5846955284321514944L) + .withVhdType("mynltwmpftmfoeaj") + .withVhdId("syxwetamfdd") + .withVhdName("lkpzwbhnrecchd"), + new DiskDetails() + .withMaxSizeMB(8883677654958515035L) + .withVhdType("hkahmjedbiucvkh") + .withVhdId("mjpjbweunxcq") + .withVhdName("ihufoihp"))); + model = BinaryData.fromObject(model).toObject(HyperVReplicaBlueReplicationDetails.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-25T03:28:24Z"), model.lastReplicatedTime()); + Assertions.assertEquals("guwrjm", model.vmNics().get(0).nicId()); + Assertions.assertEquals("vbtuqkxximwg", model.vmNics().get(0).replicaNicId()); + Assertions.assertEquals("ldeko", model.vmNics().get(0).sourceNicArmId()); + Assertions.assertEquals("gxieqfkyfhi", model.vmNics().get(0).vMNetworkName()); + Assertions.assertEquals("jaqupbyynvskpaj", model.vmNics().get(0).recoveryVMNetworkId()); + Assertions.assertEquals("umexmj", model.vmNics().get(0).ipConfigs().get(0).name()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("ccwkqmtx", model.vmNics().get(0).ipConfigs().get(0).subnetName()); + Assertions.assertEquals("eqi", model.vmNics().get(0).ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("rpilgftrqrejdaah", model.vmNics().get(0).ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("ldahlfxlmu", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("muadjnfsncski", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("shjgczetybnxg", model.vmNics().get(0).ipConfigs().get(0).recoveryIpAddressType()); + Assertions.assertEquals("lcgctjchfjv", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions.assertEquals("j", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("oxz", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("psyxjije", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("dvrbke", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("dkgaw", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("fucsaodjnosdkvi", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("asgmatrnzpd", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("akt", model.vmNics().get(0).tfoVMNetworkId()); + Assertions.assertEquals("ktz", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("yfpqd", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("kpp", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("tfvpctfjikff", model.vmNics().get(0).tfoRecoveryNicName()); + Assertions.assertEquals("g", model.vmNics().get(0).tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("nwhvuldbkkejj", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("vcpxtzhigqqbtimp", model.vmId()); + Assertions.assertEquals("blornsih", model.vmProtectionState()); + Assertions.assertEquals("uds", model.vmProtectionStateDescription()); + Assertions.assertEquals("uaawja", model.initialReplicationDetails().initialReplicationType()); + Assertions.assertEquals("wj", model.initialReplicationDetails().initialReplicationProgressPercentage()); + Assertions.assertEquals(2866605353999992316L, model.vMDiskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("iixyxvqbanosj", model.vMDiskDetails().get(0).vhdType()); + Assertions.assertEquals("irnb", model.vMDiskDetails().get(0).vhdId()); + Assertions.assertEquals("gm", model.vMDiskDetails().get(0).vhdName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaPolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaPolicyDetailsTests.java new file mode 100644 index 000000000000..c1ac392cd53b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaPolicyDetailsTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaPolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaPolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaPolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplica2012\",\"recoveryPoints\":1458640473,\"applicationConsistentSnapshotFrequencyInHours\":1422455142,\"compression\":\"gnzuzpbgkzcsc\",\"initialReplicationMethod\":\"uzvkunhdimjuk\",\"onlineReplicationStartTime\":\"r\",\"offlineReplicationImportPath\":\"a\",\"offlineReplicationExportPath\":\"pucdocf\",\"replicationPort\":1596172374,\"allowedAuthenticationType\":657887640,\"replicaDeletionOption\":\"f\"}") + .toObject(HyperVReplicaPolicyDetails.class); + Assertions.assertEquals(1458640473, model.recoveryPoints()); + Assertions.assertEquals(1422455142, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("gnzuzpbgkzcsc", model.compression()); + Assertions.assertEquals("uzvkunhdimjuk", model.initialReplicationMethod()); + Assertions.assertEquals("r", model.onlineReplicationStartTime()); + Assertions.assertEquals("a", model.offlineReplicationImportPath()); + Assertions.assertEquals("pucdocf", model.offlineReplicationExportPath()); + Assertions.assertEquals(1596172374, model.replicationPort()); + Assertions.assertEquals(657887640, model.allowedAuthenticationType()); + Assertions.assertEquals("f", model.replicaDeletionOption()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaPolicyDetails model = + new HyperVReplicaPolicyDetails() + .withRecoveryPoints(1458640473) + .withApplicationConsistentSnapshotFrequencyInHours(1422455142) + .withCompression("gnzuzpbgkzcsc") + .withInitialReplicationMethod("uzvkunhdimjuk") + .withOnlineReplicationStartTime("r") + .withOfflineReplicationImportPath("a") + .withOfflineReplicationExportPath("pucdocf") + .withReplicationPort(1596172374) + .withAllowedAuthenticationType(657887640) + .withReplicaDeletionOption("f"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaPolicyDetails.class); + Assertions.assertEquals(1458640473, model.recoveryPoints()); + Assertions.assertEquals(1422455142, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("gnzuzpbgkzcsc", model.compression()); + Assertions.assertEquals("uzvkunhdimjuk", model.initialReplicationMethod()); + Assertions.assertEquals("r", model.onlineReplicationStartTime()); + Assertions.assertEquals("a", model.offlineReplicationImportPath()); + Assertions.assertEquals("pucdocf", model.offlineReplicationExportPath()); + Assertions.assertEquals(1596172374, model.replicationPort()); + Assertions.assertEquals(657887640, model.allowedAuthenticationType()); + Assertions.assertEquals("f", model.replicaDeletionOption()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaPolicyInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaPolicyInputTests.java new file mode 100644 index 000000000000..c5d42a7b9e94 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaPolicyInputTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaPolicyInput; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaPolicyInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaPolicyInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplica2012\",\"recoveryPoints\":1848793230,\"applicationConsistentSnapshotFrequencyInHours\":60033751,\"compression\":\"apbxwieexuyade\",\"initialReplicationMethod\":\"tfo\",\"onlineReplicationStartTime\":\"k\",\"offlineReplicationImportPath\":\"imyc\",\"offlineReplicationExportPath\":\"r\",\"replicationPort\":360310908,\"allowedAuthenticationType\":1678727382,\"replicaDeletion\":\"nnuifersej\"}") + .toObject(HyperVReplicaPolicyInput.class); + Assertions.assertEquals(1848793230, model.recoveryPoints()); + Assertions.assertEquals(60033751, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("apbxwieexuyade", model.compression()); + Assertions.assertEquals("tfo", model.initialReplicationMethod()); + Assertions.assertEquals("k", model.onlineReplicationStartTime()); + Assertions.assertEquals("imyc", model.offlineReplicationImportPath()); + Assertions.assertEquals("r", model.offlineReplicationExportPath()); + Assertions.assertEquals(360310908, model.replicationPort()); + Assertions.assertEquals(1678727382, model.allowedAuthenticationType()); + Assertions.assertEquals("nnuifersej", model.replicaDeletion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaPolicyInput model = + new HyperVReplicaPolicyInput() + .withRecoveryPoints(1848793230) + .withApplicationConsistentSnapshotFrequencyInHours(60033751) + .withCompression("apbxwieexuyade") + .withInitialReplicationMethod("tfo") + .withOnlineReplicationStartTime("k") + .withOfflineReplicationImportPath("imyc") + .withOfflineReplicationExportPath("r") + .withReplicationPort(360310908) + .withAllowedAuthenticationType(1678727382) + .withReplicaDeletion("nnuifersej"); + model = BinaryData.fromObject(model).toObject(HyperVReplicaPolicyInput.class); + Assertions.assertEquals(1848793230, model.recoveryPoints()); + Assertions.assertEquals(60033751, model.applicationConsistentSnapshotFrequencyInHours()); + Assertions.assertEquals("apbxwieexuyade", model.compression()); + Assertions.assertEquals("tfo", model.initialReplicationMethod()); + Assertions.assertEquals("k", model.onlineReplicationStartTime()); + Assertions.assertEquals("imyc", model.offlineReplicationImportPath()); + Assertions.assertEquals("r", model.offlineReplicationExportPath()); + Assertions.assertEquals(360310908, model.replicationPort()); + Assertions.assertEquals(1678727382, model.allowedAuthenticationType()); + Assertions.assertEquals("nnuifersej", model.replicaDeletion()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaReplicationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaReplicationDetailsTests.java new file mode 100644 index 000000000000..bde760499fd5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVReplicaReplicationDetailsTests.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaReplicationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InitialReplicationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMNicDetails; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class HyperVReplicaReplicationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVReplicaReplicationDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplica2012\",\"lastReplicatedTime\":\"2021-02-08T01:34:17Z\",\"vmNics\":[{\"nicId\":\"lvzkl\",\"replicaNicId\":\"bgikyjtkakvlbi\",\"sourceNicArmId\":\"jvpzaptuoskaoiz\",\"vMNetworkName\":\"xwfgcdiykkcx\",\"recoveryVMNetworkId\":\"ujvqynvavit\",\"ipConfigs\":[{\"name\":\"qohhihra\",\"isPrimary\":false,\"subnetName\":\"drwjcljbrhlh\",\"staticIPAddress\":\"zadbwe\",\"ipAddressType\":\"inafhxrzfrm\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"ucwviqllukhkrcq\",\"recoveryStaticIPAddress\":\"cbvzarmqcb\",\"recoveryIPAddressType\":\"kst\",\"recoveryPublicIPAddressId\":\"nvago\",\"recoveryLBBackendAddressPoolIds\":[\"hdrx\",\"rdvcehqwhit\"],\"tfoSubnetName\":\"mxgnmguzbuwv\",\"tfoStaticIPAddress\":\"balkjnbkbdhl\",\"tfoPublicIPAddressId\":\"q\",\"tfoLBBackendAddressPoolIds\":[\"kqsy\",\"xiynecovagzk\",\"eubanlxunpqcc\",\"qiawzl\"]},{\"name\":\"laslgacizux\",\"isPrimary\":false,\"subnetName\":\"wp\",\"staticIPAddress\":\"saudoejtighsx\",\"ipAddressType\":\"ytnkqb\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"ovu\",\"recoveryStaticIPAddress\":\"xhmehjnhjiotif\",\"recoveryIPAddressType\":\"bcngkegxc\",\"recoveryPublicIPAddressId\":\"xbbfetwil\",\"recoveryLBBackendAddressPoolIds\":[\"oxpdxq\"],\"tfoSubnetName\":\"r\",\"tfoStaticIPAddress\":\"qownkiuajewnahw\",\"tfoPublicIPAddressId\":\"jjmztnlmsoodtmv\",\"tfoLBBackendAddressPoolIds\":[\"hdyswcrptveajc\",\"xvl\",\"srg\",\"rfizr\"]}],\"selectionType\":\"wlp\",\"recoveryNetworkSecurityGroupId\":\"uqhrlmcskykp\",\"enableAcceleratedNetworkingOnRecovery\":false,\"tfoVMNetworkId\":\"ixcnpcf\",\"tfoNetworkSecurityGroupId\":\"kpyyc\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"pjprdpwr\",\"recoveryNicResourceGroupName\":\"fpcfjf\",\"reuseExistingNic\":true,\"tfoRecoveryNicName\":\"z\",\"tfoRecoveryNicResourceGroupName\":\"kgyepe\",\"tfoReuseExistingNic\":true,\"targetNicName\":\"nidmdiaw\"},{\"nicId\":\"xkzrn\",\"replicaNicId\":\"kctd\",\"sourceNicArmId\":\"osgwqpsqazihqo\",\"vMNetworkName\":\"qgcnbhcbmjk\",\"recoveryVMNetworkId\":\"ibniynts\",\"ipConfigs\":[{\"name\":\"mef\",\"isPrimary\":false,\"subnetName\":\"moogjrhskbwgm\",\"staticIPAddress\":\"rulcfogx\",\"ipAddressType\":\"xnwjtpfdzxcouz\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"wakukzkdtzxs\",\"recoveryStaticIPAddress\":\"dnlwglihezomuc\",\"recoveryIPAddressType\":\"g\",\"recoveryPublicIPAddressId\":\"nione\",\"recoveryLBBackendAddressPoolIds\":[\"dr\"],\"tfoSubnetName\":\"uenxkgtlzlmt\",\"tfoStaticIPAddress\":\"xcznnhzkb\",\"tfoPublicIPAddressId\":\"mxlxmwtygeq\",\"tfoLBBackendAddressPoolIds\":[\"itoqcahfsg\"]},{\"name\":\"mlree\",\"isPrimary\":true,\"subnetName\":\"sszvlcw\",\"staticIPAddress\":\"solntfxxcrqmipf\",\"ipAddressType\":\"foygizmshxxba\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"ulnvgskj\",\"recoveryStaticIPAddress\":\"xjdzjs\",\"recoveryIPAddressType\":\"nvhxqqmqip\",\"recoveryPublicIPAddressId\":\"dhfnzocxmtfshksn\",\"recoveryLBBackendAddressPoolIds\":[\"spamwbwmbnls\",\"cefiqdkt\",\"tkvi\",\"lpfliwoyn\"],\"tfoSubnetName\":\"uzhwvladpcmhjhau\",\"tfoStaticIPAddress\":\"b\",\"tfoPublicIPAddressId\":\"kymffztsils\",\"tfoLBBackendAddressPoolIds\":[\"syeiih\"]},{\"name\":\"mkouihyeseuugci\",\"isPrimary\":true,\"subnetName\":\"gsmgb\",\"staticIPAddress\":\"tdwrqbebjnfve\",\"ipAddressType\":\"abtvkbi\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"tfgfic\",\"recoveryStaticIPAddress\":\"yhizpaczmu\",\"recoveryIPAddressType\":\"cakznhokhoitwhrj\",\"recoveryPublicIPAddressId\":\"mmazdnckid\",\"recoveryLBBackendAddressPoolIds\":[\"glhzqp\",\"zbawkikcdgfh\"],\"tfoSubnetName\":\"sd\",\"tfoStaticIPAddress\":\"ey\",\"tfoPublicIPAddressId\":\"xdede\",\"tfoLBBackendAddressPoolIds\":[\"wh\",\"gxsur\",\"jqrshz\"]}],\"selectionType\":\"g\",\"recoveryNetworkSecurityGroupId\":\"lcxiqqzjko\",\"enableAcceleratedNetworkingOnRecovery\":true,\"tfoVMNetworkId\":\"n\",\"tfoNetworkSecurityGroupId\":\"gl\",\"enableAcceleratedNetworkingOnTfo\":true,\"recoveryNicName\":\"gd\",\"recoveryNicResourceGroupName\":\"ivj\",\"reuseExistingNic\":false,\"tfoRecoveryNicName\":\"dqqigdydkghpc\",\"tfoRecoveryNicResourceGroupName\":\"wqirvtktyhhm\",\"tfoReuseExistingNic\":true,\"targetNicName\":\"apj\"},{\"nicId\":\"odmkrrwepgqv\",\"replicaNicId\":\"kqlujqgira\",\"sourceNicArmId\":\"lyvxchp\",\"vMNetworkName\":\"ctsfaeuhwwsknst\",\"recoveryVMNetworkId\":\"uzhasupmlppdpgz\",\"ipConfigs\":[{\"name\":\"z\",\"isPrimary\":false,\"subnetName\":\"rkptgongruats\",\"staticIPAddress\":\"y\",\"ipAddressType\":\"qheni\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"ngu\",\"recoveryStaticIPAddress\":\"byjdeayscse\",\"recoveryIPAddressType\":\"zjemexmnvkvm\",\"recoveryPublicIPAddressId\":\"rxl\",\"recoveryLBBackendAddressPoolIds\":[\"m\",\"pm\",\"rdlhvdvmiphbe\",\"eqjzm\"],\"tfoSubnetName\":\"dclacroczfmun\",\"tfoStaticIPAddress\":\"keluxz\",\"tfoPublicIPAddressId\":\"xzezbzuzudlevzs\",\"tfoLBBackendAddressPoolIds\":[\"cgwfsgqkstyecu\",\"yu\",\"jparda\"]},{\"name\":\"jcfmazpzdqw\",\"isPrimary\":false,\"subnetName\":\"mcokxizeku\",\"staticIPAddress\":\"rjwuca\",\"ipAddressType\":\"zvajbvbnkrdem\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"ckzidgzwdydami\",\"recoveryStaticIPAddress\":\"pztdivyk\",\"recoveryIPAddressType\":\"kqejtpjfojiunr\",\"recoveryPublicIPAddressId\":\"hxuk\",\"recoveryLBBackendAddressPoolIds\":[\"kdtoiboancdr\"],\"tfoSubnetName\":\"anvxuldxonckb\",\"tfoStaticIPAddress\":\"blfxlupibaqzi\",\"tfoPublicIPAddressId\":\"zpzwegh\",\"tfoLBBackendAddressPoolIds\":[\"bogvgfklqiy\",\"dve\",\"elsbfvd\"]},{\"name\":\"rk\",\"isPrimary\":false,\"subnetName\":\"tznsvl\",\"staticIPAddress\":\"smovpi\",\"ipAddressType\":\"ndnoxaxnrqaq\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"dxolousdv\",\"recoveryStaticIPAddress\":\"ptqmawzjdrpiz\",\"recoveryIPAddressType\":\"l\",\"recoveryPublicIPAddressId\":\"ctsdbtqgkujds\",\"recoveryLBBackendAddressPoolIds\":[\"r\",\"w\"],\"tfoSubnetName\":\"urbti\",\"tfoStaticIPAddress\":\"pdyarikeejdpd\",\"tfoPublicIPAddressId\":\"twmmkfqbriqu\",\"tfoLBBackendAddressPoolIds\":[\"trj\",\"eqkvyhzokpoyu\",\"h\",\"ensnaa\"]},{\"name\":\"hmpoe\",\"isPrimary\":false,\"subnetName\":\"pwsadaxjsumxpe\",\"staticIPAddress\":\"oio\",\"ipAddressType\":\"rmfqzwq\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"eedcnwmywx\",\"recoveryStaticIPAddress\":\"zkvemy\",\"recoveryIPAddressType\":\"pczaqpqif\",\"recoveryPublicIPAddressId\":\"m\",\"recoveryLBBackendAddressPoolIds\":[\"wtxzuisam\"],\"tfoSubnetName\":\"at\",\"tfoStaticIPAddress\":\"zexroqsqjgh\",\"tfoPublicIPAddressId\":\"thsplwsttxsr\",\"tfoLBBackendAddressPoolIds\":[\"qpaniceovxgzwhs\"]}],\"selectionType\":\"rujmti\",\"recoveryNetworkSecurityGroupId\":\"s\",\"enableAcceleratedNetworkingOnRecovery\":false,\"tfoVMNetworkId\":\"ohzixyqhfnkvycqq\",\"tfoNetworkSecurityGroupId\":\"seip\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"zxhrptyodlhkfktl\",\"recoveryNicResourceGroupName\":\"dsobjopnouhbq\",\"reuseExistingNic\":false,\"tfoRecoveryNicName\":\"xs\",\"tfoRecoveryNicResourceGroupName\":\"uzyigfcvcewbwqhd\",\"tfoReuseExistingNic\":false,\"targetNicName\":\"atm\"}],\"vmId\":\"c\",\"vmProtectionState\":\"zdfsqxhyqmr\",\"vmProtectionStateDescription\":\"parn\",\"initialReplicationDetails\":{\"initialReplicationType\":\"rsz\",\"initialReplicationProgressPercentage\":\"wtdrcwg\"},\"vMDiskDetails\":[{\"maxSizeMB\":4300016577167436223,\"vhdType\":\"hhfi\",\"vhdId\":\"cfculzj\",\"vhdName\":\"hp\"}]}") + .toObject(HyperVReplicaReplicationDetails.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-08T01:34:17Z"), model.lastReplicatedTime()); + Assertions.assertEquals("lvzkl", model.vmNics().get(0).nicId()); + Assertions.assertEquals("bgikyjtkakvlbi", model.vmNics().get(0).replicaNicId()); + Assertions.assertEquals("jvpzaptuoskaoiz", model.vmNics().get(0).sourceNicArmId()); + Assertions.assertEquals("xwfgcdiykkcx", model.vmNics().get(0).vMNetworkName()); + Assertions.assertEquals("ujvqynvavit", model.vmNics().get(0).recoveryVMNetworkId()); + Assertions.assertEquals("qohhihra", model.vmNics().get(0).ipConfigs().get(0).name()); + Assertions.assertEquals(false, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("drwjcljbrhlh", model.vmNics().get(0).ipConfigs().get(0).subnetName()); + Assertions.assertEquals("zadbwe", model.vmNics().get(0).ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("inafhxrzfrm", model.vmNics().get(0).ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(false, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("ucwviqllukhkrcq", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("cbvzarmqcb", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("kst", model.vmNics().get(0).ipConfigs().get(0).recoveryIpAddressType()); + Assertions.assertEquals("nvago", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals("hdrx", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("mxgnmguzbuwv", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("balkjnbkbdhl", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("q", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("kqsy", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("wlp", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("uqhrlmcskykp", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("ixcnpcf", model.vmNics().get(0).tfoVMNetworkId()); + Assertions.assertEquals("kpyyc", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("pjprdpwr", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("fpcfjf", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("z", model.vmNics().get(0).tfoRecoveryNicName()); + Assertions.assertEquals("kgyepe", model.vmNics().get(0).tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("nidmdiaw", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("c", model.vmId()); + Assertions.assertEquals("zdfsqxhyqmr", model.vmProtectionState()); + Assertions.assertEquals("parn", model.vmProtectionStateDescription()); + Assertions.assertEquals("rsz", model.initialReplicationDetails().initialReplicationType()); + Assertions.assertEquals("wtdrcwg", model.initialReplicationDetails().initialReplicationProgressPercentage()); + Assertions.assertEquals(4300016577167436223L, model.vMDiskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("hhfi", model.vMDiskDetails().get(0).vhdType()); + Assertions.assertEquals("cfculzj", model.vMDiskDetails().get(0).vhdId()); + Assertions.assertEquals("hp", model.vMDiskDetails().get(0).vhdName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVReplicaReplicationDetails model = + new HyperVReplicaReplicationDetails() + .withLastReplicatedTime(OffsetDateTime.parse("2021-02-08T01:34:17Z")) + .withVmNics( + Arrays + .asList( + new VMNicDetails() + .withNicId("lvzkl") + .withReplicaNicId("bgikyjtkakvlbi") + .withSourceNicArmId("jvpzaptuoskaoiz") + .withVMNetworkName("xwfgcdiykkcx") + .withRecoveryVMNetworkId("ujvqynvavit") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("qohhihra") + .withIsPrimary(false) + .withSubnetName("drwjcljbrhlh") + .withStaticIpAddress("zadbwe") + .withIpAddressType("inafhxrzfrm") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("ucwviqllukhkrcq") + .withRecoveryStaticIpAddress("cbvzarmqcb") + .withRecoveryIpAddressType("kst") + .withRecoveryPublicIpAddressId("nvago") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("hdrx", "rdvcehqwhit")) + .withTfoSubnetName("mxgnmguzbuwv") + .withTfoStaticIpAddress("balkjnbkbdhl") + .withTfoPublicIpAddressId("q") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("kqsy", "xiynecovagzk", "eubanlxunpqcc", "qiawzl")), + new IpConfigDetails() + .withName("laslgacizux") + .withIsPrimary(false) + .withSubnetName("wp") + .withStaticIpAddress("saudoejtighsx") + .withIpAddressType("ytnkqb") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("ovu") + .withRecoveryStaticIpAddress("xhmehjnhjiotif") + .withRecoveryIpAddressType("bcngkegxc") + .withRecoveryPublicIpAddressId("xbbfetwil") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("oxpdxq")) + .withTfoSubnetName("r") + .withTfoStaticIpAddress("qownkiuajewnahw") + .withTfoPublicIpAddressId("jjmztnlmsoodtmv") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("hdyswcrptveajc", "xvl", "srg", "rfizr")))) + .withSelectionType("wlp") + .withRecoveryNetworkSecurityGroupId("uqhrlmcskykp") + .withEnableAcceleratedNetworkingOnRecovery(false) + .withTfoVMNetworkId("ixcnpcf") + .withTfoNetworkSecurityGroupId("kpyyc") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("pjprdpwr") + .withRecoveryNicResourceGroupName("fpcfjf") + .withReuseExistingNic(true) + .withTfoRecoveryNicName("z") + .withTfoRecoveryNicResourceGroupName("kgyepe") + .withTfoReuseExistingNic(true) + .withTargetNicName("nidmdiaw"), + new VMNicDetails() + .withNicId("xkzrn") + .withReplicaNicId("kctd") + .withSourceNicArmId("osgwqpsqazihqo") + .withVMNetworkName("qgcnbhcbmjk") + .withRecoveryVMNetworkId("ibniynts") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("mef") + .withIsPrimary(false) + .withSubnetName("moogjrhskbwgm") + .withStaticIpAddress("rulcfogx") + .withIpAddressType("xnwjtpfdzxcouz") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("wakukzkdtzxs") + .withRecoveryStaticIpAddress("dnlwglihezomuc") + .withRecoveryIpAddressType("g") + .withRecoveryPublicIpAddressId("nione") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("dr")) + .withTfoSubnetName("uenxkgtlzlmt") + .withTfoStaticIpAddress("xcznnhzkb") + .withTfoPublicIpAddressId("mxlxmwtygeq") + .withTfoLBBackendAddressPoolIds(Arrays.asList("itoqcahfsg")), + new IpConfigDetails() + .withName("mlree") + .withIsPrimary(true) + .withSubnetName("sszvlcw") + .withStaticIpAddress("solntfxxcrqmipf") + .withIpAddressType("foygizmshxxba") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("ulnvgskj") + .withRecoveryStaticIpAddress("xjdzjs") + .withRecoveryIpAddressType("nvhxqqmqip") + .withRecoveryPublicIpAddressId("dhfnzocxmtfshksn") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("spamwbwmbnls", "cefiqdkt", "tkvi", "lpfliwoyn")) + .withTfoSubnetName("uzhwvladpcmhjhau") + .withTfoStaticIpAddress("b") + .withTfoPublicIpAddressId("kymffztsils") + .withTfoLBBackendAddressPoolIds(Arrays.asList("syeiih")), + new IpConfigDetails() + .withName("mkouihyeseuugci") + .withIsPrimary(true) + .withSubnetName("gsmgb") + .withStaticIpAddress("tdwrqbebjnfve") + .withIpAddressType("abtvkbi") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("tfgfic") + .withRecoveryStaticIpAddress("yhizpaczmu") + .withRecoveryIpAddressType("cakznhokhoitwhrj") + .withRecoveryPublicIpAddressId("mmazdnckid") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("glhzqp", "zbawkikcdgfh")) + .withTfoSubnetName("sd") + .withTfoStaticIpAddress("ey") + .withTfoPublicIpAddressId("xdede") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("wh", "gxsur", "jqrshz")))) + .withSelectionType("g") + .withRecoveryNetworkSecurityGroupId("lcxiqqzjko") + .withEnableAcceleratedNetworkingOnRecovery(true) + .withTfoVMNetworkId("n") + .withTfoNetworkSecurityGroupId("gl") + .withEnableAcceleratedNetworkingOnTfo(true) + .withRecoveryNicName("gd") + .withRecoveryNicResourceGroupName("ivj") + .withReuseExistingNic(false) + .withTfoRecoveryNicName("dqqigdydkghpc") + .withTfoRecoveryNicResourceGroupName("wqirvtktyhhm") + .withTfoReuseExistingNic(true) + .withTargetNicName("apj"), + new VMNicDetails() + .withNicId("odmkrrwepgqv") + .withReplicaNicId("kqlujqgira") + .withSourceNicArmId("lyvxchp") + .withVMNetworkName("ctsfaeuhwwsknst") + .withRecoveryVMNetworkId("uzhasupmlppdpgz") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("z") + .withIsPrimary(false) + .withSubnetName("rkptgongruats") + .withStaticIpAddress("y") + .withIpAddressType("qheni") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("ngu") + .withRecoveryStaticIpAddress("byjdeayscse") + .withRecoveryIpAddressType("zjemexmnvkvm") + .withRecoveryPublicIpAddressId("rxl") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("m", "pm", "rdlhvdvmiphbe", "eqjzm")) + .withTfoSubnetName("dclacroczfmun") + .withTfoStaticIpAddress("keluxz") + .withTfoPublicIpAddressId("xzezbzuzudlevzs") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("cgwfsgqkstyecu", "yu", "jparda")), + new IpConfigDetails() + .withName("jcfmazpzdqw") + .withIsPrimary(false) + .withSubnetName("mcokxizeku") + .withStaticIpAddress("rjwuca") + .withIpAddressType("zvajbvbnkrdem") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("ckzidgzwdydami") + .withRecoveryStaticIpAddress("pztdivyk") + .withRecoveryIpAddressType("kqejtpjfojiunr") + .withRecoveryPublicIpAddressId("hxuk") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("kdtoiboancdr")) + .withTfoSubnetName("anvxuldxonckb") + .withTfoStaticIpAddress("blfxlupibaqzi") + .withTfoPublicIpAddressId("zpzwegh") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("bogvgfklqiy", "dve", "elsbfvd")), + new IpConfigDetails() + .withName("rk") + .withIsPrimary(false) + .withSubnetName("tznsvl") + .withStaticIpAddress("smovpi") + .withIpAddressType("ndnoxaxnrqaq") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("dxolousdv") + .withRecoveryStaticIpAddress("ptqmawzjdrpiz") + .withRecoveryIpAddressType("l") + .withRecoveryPublicIpAddressId("ctsdbtqgkujds") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("r", "w")) + .withTfoSubnetName("urbti") + .withTfoStaticIpAddress("pdyarikeejdpd") + .withTfoPublicIpAddressId("twmmkfqbriqu") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("trj", "eqkvyhzokpoyu", "h", "ensnaa")), + new IpConfigDetails() + .withName("hmpoe") + .withIsPrimary(false) + .withSubnetName("pwsadaxjsumxpe") + .withStaticIpAddress("oio") + .withIpAddressType("rmfqzwq") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("eedcnwmywx") + .withRecoveryStaticIpAddress("zkvemy") + .withRecoveryIpAddressType("pczaqpqif") + .withRecoveryPublicIpAddressId("m") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("wtxzuisam")) + .withTfoSubnetName("at") + .withTfoStaticIpAddress("zexroqsqjgh") + .withTfoPublicIpAddressId("thsplwsttxsr") + .withTfoLBBackendAddressPoolIds(Arrays.asList("qpaniceovxgzwhs")))) + .withSelectionType("rujmti") + .withRecoveryNetworkSecurityGroupId("s") + .withEnableAcceleratedNetworkingOnRecovery(false) + .withTfoVMNetworkId("ohzixyqhfnkvycqq") + .withTfoNetworkSecurityGroupId("seip") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("zxhrptyodlhkfktl") + .withRecoveryNicResourceGroupName("dsobjopnouhbq") + .withReuseExistingNic(false) + .withTfoRecoveryNicName("xs") + .withTfoRecoveryNicResourceGroupName("uzyigfcvcewbwqhd") + .withTfoReuseExistingNic(false) + .withTargetNicName("atm"))) + .withVmId("c") + .withVmProtectionState("zdfsqxhyqmr") + .withVmProtectionStateDescription("parn") + .withInitialReplicationDetails( + new InitialReplicationDetails() + .withInitialReplicationType("rsz") + .withInitialReplicationProgressPercentage("wtdrcwg")) + .withVMDiskDetails( + Arrays + .asList( + new DiskDetails() + .withMaxSizeMB(4300016577167436223L) + .withVhdType("hhfi") + .withVhdId("cfculzj") + .withVhdName("hp"))); + model = BinaryData.fromObject(model).toObject(HyperVReplicaReplicationDetails.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-08T01:34:17Z"), model.lastReplicatedTime()); + Assertions.assertEquals("lvzkl", model.vmNics().get(0).nicId()); + Assertions.assertEquals("bgikyjtkakvlbi", model.vmNics().get(0).replicaNicId()); + Assertions.assertEquals("jvpzaptuoskaoiz", model.vmNics().get(0).sourceNicArmId()); + Assertions.assertEquals("xwfgcdiykkcx", model.vmNics().get(0).vMNetworkName()); + Assertions.assertEquals("ujvqynvavit", model.vmNics().get(0).recoveryVMNetworkId()); + Assertions.assertEquals("qohhihra", model.vmNics().get(0).ipConfigs().get(0).name()); + Assertions.assertEquals(false, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("drwjcljbrhlh", model.vmNics().get(0).ipConfigs().get(0).subnetName()); + Assertions.assertEquals("zadbwe", model.vmNics().get(0).ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("inafhxrzfrm", model.vmNics().get(0).ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(false, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("ucwviqllukhkrcq", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("cbvzarmqcb", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("kst", model.vmNics().get(0).ipConfigs().get(0).recoveryIpAddressType()); + Assertions.assertEquals("nvago", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals("hdrx", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("mxgnmguzbuwv", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("balkjnbkbdhl", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("q", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("kqsy", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("wlp", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("uqhrlmcskykp", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("ixcnpcf", model.vmNics().get(0).tfoVMNetworkId()); + Assertions.assertEquals("kpyyc", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("pjprdpwr", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("fpcfjf", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("z", model.vmNics().get(0).tfoRecoveryNicName()); + Assertions.assertEquals("kgyepe", model.vmNics().get(0).tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("nidmdiaw", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("c", model.vmId()); + Assertions.assertEquals("zdfsqxhyqmr", model.vmProtectionState()); + Assertions.assertEquals("parn", model.vmProtectionStateDescription()); + Assertions.assertEquals("rsz", model.initialReplicationDetails().initialReplicationType()); + Assertions.assertEquals("wtdrcwg", model.initialReplicationDetails().initialReplicationProgressPercentage()); + Assertions.assertEquals(4300016577167436223L, model.vMDiskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("hhfi", model.vMDiskDetails().get(0).vhdType()); + Assertions.assertEquals("cfculzj", model.vMDiskDetails().get(0).vhdId()); + Assertions.assertEquals("hp", model.vMDiskDetails().get(0).vhdName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVSiteDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVSiteDetailsTests.java new file mode 100644 index 000000000000..f5ef19bfa070 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVSiteDetailsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVHostDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVSiteDetails; +import java.util.Arrays; + +public final class HyperVSiteDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVSiteDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVSite\",\"hyperVHosts\":[{\"id\":\"yldqpzfzxsox\",\"name\":\"unjlzkdrocq\",\"marsAgentVersion\":\"ytqqtcmi\"},{\"id\":\"w\",\"name\":\"vn\",\"marsAgentVersion\":\"ylajam\"},{\"id\":\"jyh\",\"name\":\"p\",\"marsAgentVersion\":\"rryklleynqan\"}]}") + .toObject(HyperVSiteDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVSiteDetails model = + new HyperVSiteDetails() + .withHyperVHosts( + Arrays.asList(new HyperVHostDetails(), new HyperVHostDetails(), new HyperVHostDetails())); + model = BinaryData.fromObject(model).toObject(HyperVSiteDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVVirtualMachineDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVVirtualMachineDetailsTests.java new file mode 100644 index 000000000000..a33ea29176c9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/HyperVVirtualMachineDetailsTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVVirtualMachineDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PresenceStatus; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class HyperVVirtualMachineDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HyperVVirtualMachineDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVVirtualMachine\",\"sourceItemId\":\"igglclwalhvub\",\"generation\":\"zphetxdqcm\",\"osDetails\":{\"osType\":\"ajqzj\",\"productType\":\"lecxbibiwks\",\"osEdition\":\"gyxs\",\"oSVersion\":\"pzvoikv\",\"oSMajorVersion\":\"wczfzwushlcx\",\"oSMinorVersion\":\"lalhhezpfkiss\"},\"diskDetails\":[{\"maxSizeMB\":8933439553335588786,\"vhdType\":\"aoq\",\"vhdId\":\"gpto\",\"vhdName\":\"jq\"},{\"maxSizeMB\":8153507398057204968,\"vhdType\":\"nlrtbfijzz\",\"vhdId\":\"o\",\"vhdName\":\"olbuauktwieope\"},{\"maxSizeMB\":6227229278544049294,\"vhdType\":\"dwrswyiljpi\",\"vhdId\":\"gxyxyauxredd\",\"vhdName\":\"mcnltmwytkujsqyc\"}],\"hasPhysicalDisk\":\"NotPresent\",\"hasFibreChannelAdapter\":\"Present\",\"hasSharedVhd\":\"Present\",\"hyperVHostId\":\"qgpwbmwhr\"}") + .toObject(HyperVVirtualMachineDetails.class); + Assertions.assertEquals("igglclwalhvub", model.sourceItemId()); + Assertions.assertEquals("zphetxdqcm", model.generation()); + Assertions.assertEquals("ajqzj", model.osDetails().osType()); + Assertions.assertEquals("lecxbibiwks", model.osDetails().productType()); + Assertions.assertEquals("gyxs", model.osDetails().osEdition()); + Assertions.assertEquals("pzvoikv", model.osDetails().oSVersion()); + Assertions.assertEquals("wczfzwushlcx", model.osDetails().oSMajorVersion()); + Assertions.assertEquals("lalhhezpfkiss", model.osDetails().oSMinorVersion()); + Assertions.assertEquals(8933439553335588786L, model.diskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("aoq", model.diskDetails().get(0).vhdType()); + Assertions.assertEquals("gpto", model.diskDetails().get(0).vhdId()); + Assertions.assertEquals("jq", model.diskDetails().get(0).vhdName()); + Assertions.assertEquals(PresenceStatus.NOT_PRESENT, model.hasPhysicalDisk()); + Assertions.assertEquals(PresenceStatus.PRESENT, model.hasFibreChannelAdapter()); + Assertions.assertEquals(PresenceStatus.PRESENT, model.hasSharedVhd()); + Assertions.assertEquals("qgpwbmwhr", model.hyperVHostId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HyperVVirtualMachineDetails model = + new HyperVVirtualMachineDetails() + .withSourceItemId("igglclwalhvub") + .withGeneration("zphetxdqcm") + .withOsDetails( + new OSDetails() + .withOsType("ajqzj") + .withProductType("lecxbibiwks") + .withOsEdition("gyxs") + .withOSVersion("pzvoikv") + .withOSMajorVersion("wczfzwushlcx") + .withOSMinorVersion("lalhhezpfkiss")) + .withDiskDetails( + Arrays + .asList( + new DiskDetails() + .withMaxSizeMB(8933439553335588786L) + .withVhdType("aoq") + .withVhdId("gpto") + .withVhdName("jq"), + new DiskDetails() + .withMaxSizeMB(8153507398057204968L) + .withVhdType("nlrtbfijzz") + .withVhdId("o") + .withVhdName("olbuauktwieope"), + new DiskDetails() + .withMaxSizeMB(6227229278544049294L) + .withVhdType("dwrswyiljpi") + .withVhdId("gxyxyauxredd") + .withVhdName("mcnltmwytkujsqyc"))) + .withHasPhysicalDisk(PresenceStatus.NOT_PRESENT) + .withHasFibreChannelAdapter(PresenceStatus.PRESENT) + .withHasSharedVhd(PresenceStatus.PRESENT) + .withHyperVHostId("qgpwbmwhr"); + model = BinaryData.fromObject(model).toObject(HyperVVirtualMachineDetails.class); + Assertions.assertEquals("igglclwalhvub", model.sourceItemId()); + Assertions.assertEquals("zphetxdqcm", model.generation()); + Assertions.assertEquals("ajqzj", model.osDetails().osType()); + Assertions.assertEquals("lecxbibiwks", model.osDetails().productType()); + Assertions.assertEquals("gyxs", model.osDetails().osEdition()); + Assertions.assertEquals("pzvoikv", model.osDetails().oSVersion()); + Assertions.assertEquals("wczfzwushlcx", model.osDetails().oSMajorVersion()); + Assertions.assertEquals("lalhhezpfkiss", model.osDetails().oSMinorVersion()); + Assertions.assertEquals(8933439553335588786L, model.diskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("aoq", model.diskDetails().get(0).vhdType()); + Assertions.assertEquals("gpto", model.diskDetails().get(0).vhdId()); + Assertions.assertEquals("jq", model.diskDetails().get(0).vhdName()); + Assertions.assertEquals(PresenceStatus.NOT_PRESENT, model.hasPhysicalDisk()); + Assertions.assertEquals(PresenceStatus.PRESENT, model.hasFibreChannelAdapter()); + Assertions.assertEquals(PresenceStatus.PRESENT, model.hasSharedVhd()); + Assertions.assertEquals("qgpwbmwhr", model.hyperVHostId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IdentityProviderDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IdentityProviderDetailsTests.java new file mode 100644 index 000000000000..a500dffefb26 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IdentityProviderDetailsTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IdentityProviderDetails; +import org.junit.jupiter.api.Assertions; + +public final class IdentityProviderDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IdentityProviderDetails model = + BinaryData + .fromString( + "{\"tenantId\":\"brn\",\"applicationId\":\"u\",\"objectId\":\"prafwgckhoc\",\"audience\":\"d\",\"aadAuthority\":\"fwafqrouda\"}") + .toObject(IdentityProviderDetails.class); + Assertions.assertEquals("brn", model.tenantId()); + Assertions.assertEquals("u", model.applicationId()); + Assertions.assertEquals("prafwgckhoc", model.objectId()); + Assertions.assertEquals("d", model.audience()); + Assertions.assertEquals("fwafqrouda", model.aadAuthority()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IdentityProviderDetails model = + new IdentityProviderDetails() + .withTenantId("brn") + .withApplicationId("u") + .withObjectId("prafwgckhoc") + .withAudience("d") + .withAadAuthority("fwafqrouda"); + model = BinaryData.fromObject(model).toObject(IdentityProviderDetails.class); + Assertions.assertEquals("brn", model.tenantId()); + Assertions.assertEquals("u", model.applicationId()); + Assertions.assertEquals("prafwgckhoc", model.objectId()); + Assertions.assertEquals("d", model.audience()); + Assertions.assertEquals("fwafqrouda", model.aadAuthority()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IdentityProviderInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IdentityProviderInputTests.java new file mode 100644 index 000000000000..432ff267c579 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IdentityProviderInputTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IdentityProviderInput; +import org.junit.jupiter.api.Assertions; + +public final class IdentityProviderInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IdentityProviderInput model = + BinaryData + .fromString( + "{\"tenantId\":\"lqxihhrmooiz\",\"applicationId\":\"seypxiutcxapz\",\"objectId\":\"y\",\"audience\":\"petogebjox\",\"aadAuthority\":\"lhvnhlab\"}") + .toObject(IdentityProviderInput.class); + Assertions.assertEquals("lqxihhrmooiz", model.tenantId()); + Assertions.assertEquals("seypxiutcxapz", model.applicationId()); + Assertions.assertEquals("y", model.objectId()); + Assertions.assertEquals("petogebjox", model.audience()); + Assertions.assertEquals("lhvnhlab", model.aadAuthority()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IdentityProviderInput model = + new IdentityProviderInput() + .withTenantId("lqxihhrmooiz") + .withApplicationId("seypxiutcxapz") + .withObjectId("y") + .withAudience("petogebjox") + .withAadAuthority("lhvnhlab"); + model = BinaryData.fromObject(model).toObject(IdentityProviderInput.class); + Assertions.assertEquals("lqxihhrmooiz", model.tenantId()); + Assertions.assertEquals("seypxiutcxapz", model.applicationId()); + Assertions.assertEquals("y", model.objectId()); + Assertions.assertEquals("petogebjox", model.audience()); + Assertions.assertEquals("lhvnhlab", model.aadAuthority()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAgentDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAgentDetailsTests.java new file mode 100644 index 000000000000..cec068518ae3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAgentDetailsTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAgentDetails; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class InMageAgentDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAgentDetails model = + BinaryData + .fromString( + "{\"agentVersion\":\"wyambhba\",\"agentUpdateStatus\":\"bz\",\"postUpdateRebootStatus\":\"k\",\"agentExpiryDate\":\"2021-01-13T18:27:32Z\"}") + .toObject(InMageAgentDetails.class); + Assertions.assertEquals("wyambhba", model.agentVersion()); + Assertions.assertEquals("bz", model.agentUpdateStatus()); + Assertions.assertEquals("k", model.postUpdateRebootStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-13T18:27:32Z"), model.agentExpiryDate()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAgentDetails model = + new InMageAgentDetails() + .withAgentVersion("wyambhba") + .withAgentUpdateStatus("bz") + .withPostUpdateRebootStatus("k") + .withAgentExpiryDate(OffsetDateTime.parse("2021-01-13T18:27:32Z")); + model = BinaryData.fromObject(model).toObject(InMageAgentDetails.class); + Assertions.assertEquals("wyambhba", model.agentVersion()); + Assertions.assertEquals("bz", model.agentUpdateStatus()); + Assertions.assertEquals("k", model.postUpdateRebootStatus()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-13T18:27:32Z"), model.agentExpiryDate()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2ApplyRecoveryPointInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2ApplyRecoveryPointInputTests.java new file mode 100644 index 000000000000..a24bd6b2622b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2ApplyRecoveryPointInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2ApplyRecoveryPointInput; + +public final class InMageAzureV2ApplyRecoveryPointInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2ApplyRecoveryPointInput model = + BinaryData + .fromString("{\"instanceType\":\"InMageAzureV2\"}") + .toObject(InMageAzureV2ApplyRecoveryPointInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2ApplyRecoveryPointInput model = new InMageAzureV2ApplyRecoveryPointInput(); + model = BinaryData.fromObject(model).toObject(InMageAzureV2ApplyRecoveryPointInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2DiskInputDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2DiskInputDetailsTests.java new file mode 100644 index 000000000000..812691f3533e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2DiskInputDetailsTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskAccountType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2DiskInputDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2DiskInputDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2DiskInputDetails model = + BinaryData + .fromString( + "{\"diskId\":\"ibhlenntrv\",\"logStorageAccountId\":\"psabdu\",\"diskType\":\"Premium_LRS\",\"diskEncryptionSetId\":\"lghnysvlp\"}") + .toObject(InMageAzureV2DiskInputDetails.class); + Assertions.assertEquals("ibhlenntrv", model.diskId()); + Assertions.assertEquals("psabdu", model.logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.PREMIUM_LRS, model.diskType()); + Assertions.assertEquals("lghnysvlp", model.diskEncryptionSetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2DiskInputDetails model = + new InMageAzureV2DiskInputDetails() + .withDiskId("ibhlenntrv") + .withLogStorageAccountId("psabdu") + .withDiskType(DiskAccountType.PREMIUM_LRS) + .withDiskEncryptionSetId("lghnysvlp"); + model = BinaryData.fromObject(model).toObject(InMageAzureV2DiskInputDetails.class); + Assertions.assertEquals("ibhlenntrv", model.diskId()); + Assertions.assertEquals("psabdu", model.logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.PREMIUM_LRS, model.diskType()); + Assertions.assertEquals("lghnysvlp", model.diskEncryptionSetId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2EnableProtectionInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2EnableProtectionInputTests.java new file mode 100644 index 000000000000..7c6b1323a786 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2EnableProtectionInputTests.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskAccountType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2DiskInputDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2EnableProtectionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LicenseType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SqlServerLicenseType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2EnableProtectionInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2EnableProtectionInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"masterTargetId\":\"uukppdixqb\",\"processServerId\":\"xvhhyqq\",\"storageAccountId\":\"at\",\"runAsAccountId\":\"rznmginmtsdixc\",\"multiVmGroupId\":\"kibmgjymn\",\"multiVmGroupName\":\"cag\",\"disksToInclude\":[{\"diskId\":\"cqzoofjnqjsve\",\"logStorageAccountId\":\"bhtleberpy\",\"diskType\":\"StandardSSD_LRS\",\"diskEncryptionSetId\":\"nfqnwj\"},{\"diskId\":\"xowkdnj\",\"logStorageAccountId\":\"gkr\",\"diskType\":\"StandardSSD_LRS\",\"diskEncryptionSetId\":\"hycpnowawonoe\"}],\"targetAzureNetworkId\":\"guqlhfwa\",\"targetAzureSubnetId\":\"jzmpy\",\"enableRdpOnTargetOption\":\"uyfazbkoc\",\"targetAzureVmName\":\"gvthrmxkbcjww\",\"logStorageAccountId\":\"omraw\",\"targetAzureV1ResourceGroupId\":\"keboo\",\"targetAzureV2ResourceGroupId\":\"l\",\"diskType\":\"StandardSSD_LRS\",\"targetAvailabilitySetId\":\"gaedaoiq\",\"targetAvailabilityZone\":\"mgd\",\"targetProximityPlacementGroupId\":\"gabdxfkuzbwjeco\",\"licenseType\":\"NoLicenseType\",\"sqlServerLicenseType\":\"NotSpecified\",\"targetVmSize\":\"qbpel\",\"diskEncryptionSetId\":\"ibncgagdvcd\",\"targetVmTags\":{\"df\":\"tzbpyfao\"},\"seedManagedDiskTags\":{\"rf\":\"ncwmhjob\",\"dc\":\"ri\",\"f\":\"h\",\"oorssatfy\":\"cvbzwgwhgkgsoa\"},\"targetManagedDiskTags\":{\"dqn\":\"ufdmxuq\",\"fqayopbtsix\":\"sttuxv\",\"jay\":\"gvbhxmndztgs\"},\"targetNicTags\":{\"q\":\"rxneibpgbrhbj\",\"nmotpuwnnoh\":\"nh\",\"wyiulaynosu\":\"mzngocfrjuy\"}}") + .toObject(InMageAzureV2EnableProtectionInput.class); + Assertions.assertEquals("uukppdixqb", model.masterTargetId()); + Assertions.assertEquals("xvhhyqq", model.processServerId()); + Assertions.assertEquals("at", model.storageAccountId()); + Assertions.assertEquals("rznmginmtsdixc", model.runAsAccountId()); + Assertions.assertEquals("kibmgjymn", model.multiVmGroupId()); + Assertions.assertEquals("cag", model.multiVmGroupName()); + Assertions.assertEquals("cqzoofjnqjsve", model.disksToInclude().get(0).diskId()); + Assertions.assertEquals("bhtleberpy", model.disksToInclude().get(0).logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.disksToInclude().get(0).diskType()); + Assertions.assertEquals("nfqnwj", model.disksToInclude().get(0).diskEncryptionSetId()); + Assertions.assertEquals("guqlhfwa", model.targetAzureNetworkId()); + Assertions.assertEquals("jzmpy", model.targetAzureSubnetId()); + Assertions.assertEquals("uyfazbkoc", model.enableRdpOnTargetOption()); + Assertions.assertEquals("gvthrmxkbcjww", model.targetAzureVmName()); + Assertions.assertEquals("omraw", model.logStorageAccountId()); + Assertions.assertEquals("keboo", model.targetAzureV1ResourceGroupId()); + Assertions.assertEquals("l", model.targetAzureV2ResourceGroupId()); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.diskType()); + Assertions.assertEquals("gaedaoiq", model.targetAvailabilitySetId()); + Assertions.assertEquals("mgd", model.targetAvailabilityZone()); + Assertions.assertEquals("gabdxfkuzbwjeco", model.targetProximityPlacementGroupId()); + Assertions.assertEquals(LicenseType.NO_LICENSE_TYPE, model.licenseType()); + Assertions.assertEquals(SqlServerLicenseType.NOT_SPECIFIED, model.sqlServerLicenseType()); + Assertions.assertEquals("qbpel", model.targetVmSize()); + Assertions.assertEquals("ibncgagdvcd", model.diskEncryptionSetId()); + Assertions.assertEquals("tzbpyfao", model.targetVmTags().get("df")); + Assertions.assertEquals("ncwmhjob", model.seedManagedDiskTags().get("rf")); + Assertions.assertEquals("ufdmxuq", model.targetManagedDiskTags().get("dqn")); + Assertions.assertEquals("rxneibpgbrhbj", model.targetNicTags().get("q")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2EnableProtectionInput model = + new InMageAzureV2EnableProtectionInput() + .withMasterTargetId("uukppdixqb") + .withProcessServerId("xvhhyqq") + .withStorageAccountId("at") + .withRunAsAccountId("rznmginmtsdixc") + .withMultiVmGroupId("kibmgjymn") + .withMultiVmGroupName("cag") + .withDisksToInclude( + Arrays + .asList( + new InMageAzureV2DiskInputDetails() + .withDiskId("cqzoofjnqjsve") + .withLogStorageAccountId("bhtleberpy") + .withDiskType(DiskAccountType.STANDARD_SSD_LRS) + .withDiskEncryptionSetId("nfqnwj"), + new InMageAzureV2DiskInputDetails() + .withDiskId("xowkdnj") + .withLogStorageAccountId("gkr") + .withDiskType(DiskAccountType.STANDARD_SSD_LRS) + .withDiskEncryptionSetId("hycpnowawonoe"))) + .withTargetAzureNetworkId("guqlhfwa") + .withTargetAzureSubnetId("jzmpy") + .withEnableRdpOnTargetOption("uyfazbkoc") + .withTargetAzureVmName("gvthrmxkbcjww") + .withLogStorageAccountId("omraw") + .withTargetAzureV1ResourceGroupId("keboo") + .withTargetAzureV2ResourceGroupId("l") + .withDiskType(DiskAccountType.STANDARD_SSD_LRS) + .withTargetAvailabilitySetId("gaedaoiq") + .withTargetAvailabilityZone("mgd") + .withTargetProximityPlacementGroupId("gabdxfkuzbwjeco") + .withLicenseType(LicenseType.NO_LICENSE_TYPE) + .withSqlServerLicenseType(SqlServerLicenseType.NOT_SPECIFIED) + .withTargetVmSize("qbpel") + .withDiskEncryptionSetId("ibncgagdvcd") + .withTargetVmTags(mapOf("df", "tzbpyfao")) + .withSeedManagedDiskTags(mapOf("rf", "ncwmhjob", "dc", "ri", "f", "h", "oorssatfy", "cvbzwgwhgkgsoa")) + .withTargetManagedDiskTags(mapOf("dqn", "ufdmxuq", "fqayopbtsix", "sttuxv", "jay", "gvbhxmndztgs")) + .withTargetNicTags(mapOf("q", "rxneibpgbrhbj", "nmotpuwnnoh", "nh", "wyiulaynosu", "mzngocfrjuy")); + model = BinaryData.fromObject(model).toObject(InMageAzureV2EnableProtectionInput.class); + Assertions.assertEquals("uukppdixqb", model.masterTargetId()); + Assertions.assertEquals("xvhhyqq", model.processServerId()); + Assertions.assertEquals("at", model.storageAccountId()); + Assertions.assertEquals("rznmginmtsdixc", model.runAsAccountId()); + Assertions.assertEquals("kibmgjymn", model.multiVmGroupId()); + Assertions.assertEquals("cag", model.multiVmGroupName()); + Assertions.assertEquals("cqzoofjnqjsve", model.disksToInclude().get(0).diskId()); + Assertions.assertEquals("bhtleberpy", model.disksToInclude().get(0).logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.disksToInclude().get(0).diskType()); + Assertions.assertEquals("nfqnwj", model.disksToInclude().get(0).diskEncryptionSetId()); + Assertions.assertEquals("guqlhfwa", model.targetAzureNetworkId()); + Assertions.assertEquals("jzmpy", model.targetAzureSubnetId()); + Assertions.assertEquals("uyfazbkoc", model.enableRdpOnTargetOption()); + Assertions.assertEquals("gvthrmxkbcjww", model.targetAzureVmName()); + Assertions.assertEquals("omraw", model.logStorageAccountId()); + Assertions.assertEquals("keboo", model.targetAzureV1ResourceGroupId()); + Assertions.assertEquals("l", model.targetAzureV2ResourceGroupId()); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.diskType()); + Assertions.assertEquals("gaedaoiq", model.targetAvailabilitySetId()); + Assertions.assertEquals("mgd", model.targetAvailabilityZone()); + Assertions.assertEquals("gabdxfkuzbwjeco", model.targetProximityPlacementGroupId()); + Assertions.assertEquals(LicenseType.NO_LICENSE_TYPE, model.licenseType()); + Assertions.assertEquals(SqlServerLicenseType.NOT_SPECIFIED, model.sqlServerLicenseType()); + Assertions.assertEquals("qbpel", model.targetVmSize()); + Assertions.assertEquals("ibncgagdvcd", model.diskEncryptionSetId()); + Assertions.assertEquals("tzbpyfao", model.targetVmTags().get("df")); + Assertions.assertEquals("ncwmhjob", model.seedManagedDiskTags().get("rf")); + Assertions.assertEquals("ufdmxuq", model.targetManagedDiskTags().get("dqn")); + Assertions.assertEquals("rxneibpgbrhbj", model.targetNicTags().get("q")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2EventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2EventDetailsTests.java new file mode 100644 index 000000000000..244b45fab1b3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2EventDetailsTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2EventDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2EventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2EventDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"eventType\":\"fhaxttpf\",\"category\":\"wgsghqucumldd\",\"component\":\"qm\",\"correctiveAction\":\"feothxu\",\"details\":\"igrjdljlkqhvkrbz\",\"summary\":\"astax\",\"siteName\":\"pruulhg\"}") + .toObject(InMageAzureV2EventDetails.class); + Assertions.assertEquals("fhaxttpf", model.eventType()); + Assertions.assertEquals("wgsghqucumldd", model.category()); + Assertions.assertEquals("qm", model.component()); + Assertions.assertEquals("feothxu", model.correctiveAction()); + Assertions.assertEquals("igrjdljlkqhvkrbz", model.details()); + Assertions.assertEquals("astax", model.summary()); + Assertions.assertEquals("pruulhg", model.siteName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2EventDetails model = + new InMageAzureV2EventDetails() + .withEventType("fhaxttpf") + .withCategory("wgsghqucumldd") + .withComponent("qm") + .withCorrectiveAction("feothxu") + .withDetails("igrjdljlkqhvkrbz") + .withSummary("astax") + .withSiteName("pruulhg"); + model = BinaryData.fromObject(model).toObject(InMageAzureV2EventDetails.class); + Assertions.assertEquals("fhaxttpf", model.eventType()); + Assertions.assertEquals("wgsghqucumldd", model.category()); + Assertions.assertEquals("qm", model.component()); + Assertions.assertEquals("feothxu", model.correctiveAction()); + Assertions.assertEquals("igrjdljlkqhvkrbz", model.details()); + Assertions.assertEquals("astax", model.summary()); + Assertions.assertEquals("pruulhg", model.siteName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2ManagedDiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2ManagedDiskDetailsTests.java new file mode 100644 index 000000000000..7fe1f5513cc2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2ManagedDiskDetailsTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2ManagedDiskDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2ManagedDiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2ManagedDiskDetails model = + BinaryData + .fromString( + "{\"diskId\":\"oizwxvs\",\"seedManagedDiskId\":\"sgfy\",\"replicaDiskType\":\"ky\",\"diskEncryptionSetId\":\"gafxczvf\",\"targetDiskName\":\"kwrt\"}") + .toObject(InMageAzureV2ManagedDiskDetails.class); + Assertions.assertEquals("oizwxvs", model.diskId()); + Assertions.assertEquals("sgfy", model.seedManagedDiskId()); + Assertions.assertEquals("ky", model.replicaDiskType()); + Assertions.assertEquals("gafxczvf", model.diskEncryptionSetId()); + Assertions.assertEquals("kwrt", model.targetDiskName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2ManagedDiskDetails model = + new InMageAzureV2ManagedDiskDetails() + .withDiskId("oizwxvs") + .withSeedManagedDiskId("sgfy") + .withReplicaDiskType("ky") + .withDiskEncryptionSetId("gafxczvf") + .withTargetDiskName("kwrt"); + model = BinaryData.fromObject(model).toObject(InMageAzureV2ManagedDiskDetails.class); + Assertions.assertEquals("oizwxvs", model.diskId()); + Assertions.assertEquals("sgfy", model.seedManagedDiskId()); + Assertions.assertEquals("ky", model.replicaDiskType()); + Assertions.assertEquals("gafxczvf", model.diskEncryptionSetId()); + Assertions.assertEquals("kwrt", model.targetDiskName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2PolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2PolicyDetailsTests.java new file mode 100644 index 000000000000..d145317f2267 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2PolicyDetailsTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2PolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2PolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2PolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"crashConsistentFrequencyInMinutes\":699440843,\"recoveryPointThresholdInMinutes\":1580992750,\"recoveryPointHistory\":893679063,\"appConsistentFrequencyInMinutes\":710111101,\"multiVmSyncStatus\":\"tlh\"}") + .toObject(InMageAzureV2PolicyDetails.class); + Assertions.assertEquals(699440843, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(1580992750, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(893679063, model.recoveryPointHistory()); + Assertions.assertEquals(710111101, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("tlh", model.multiVmSyncStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2PolicyDetails model = + new InMageAzureV2PolicyDetails() + .withCrashConsistentFrequencyInMinutes(699440843) + .withRecoveryPointThresholdInMinutes(1580992750) + .withRecoveryPointHistory(893679063) + .withAppConsistentFrequencyInMinutes(710111101) + .withMultiVmSyncStatus("tlh"); + model = BinaryData.fromObject(model).toObject(InMageAzureV2PolicyDetails.class); + Assertions.assertEquals(699440843, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(1580992750, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(893679063, model.recoveryPointHistory()); + Assertions.assertEquals(710111101, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("tlh", model.multiVmSyncStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2PolicyInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2PolicyInputTests.java new file mode 100644 index 000000000000..56b7f0ed70da --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2PolicyInputTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2PolicyInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SetMultiVmSyncStatus; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2PolicyInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2PolicyInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"recoveryPointThresholdInMinutes\":1444761559,\"recoveryPointHistory\":2116742025,\"crashConsistentFrequencyInMinutes\":852718126,\"appConsistentFrequencyInMinutes\":1922243610,\"multiVmSyncStatus\":\"Enable\"}") + .toObject(InMageAzureV2PolicyInput.class); + Assertions.assertEquals(1444761559, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(2116742025, model.recoveryPointHistory()); + Assertions.assertEquals(852718126, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(1922243610, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(SetMultiVmSyncStatus.ENABLE, model.multiVmSyncStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2PolicyInput model = + new InMageAzureV2PolicyInput() + .withRecoveryPointThresholdInMinutes(1444761559) + .withRecoveryPointHistory(2116742025) + .withCrashConsistentFrequencyInMinutes(852718126) + .withAppConsistentFrequencyInMinutes(1922243610) + .withMultiVmSyncStatus(SetMultiVmSyncStatus.ENABLE); + model = BinaryData.fromObject(model).toObject(InMageAzureV2PolicyInput.class); + Assertions.assertEquals(1444761559, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(2116742025, model.recoveryPointHistory()); + Assertions.assertEquals(852718126, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(1922243610, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(SetMultiVmSyncStatus.ENABLE, model.multiVmSyncStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2RecoveryPointDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2RecoveryPointDetailsTests.java new file mode 100644 index 000000000000..cec083d302c7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2RecoveryPointDetailsTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2RecoveryPointDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2RecoveryPointDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2RecoveryPointDetails model = + BinaryData + .fromString("{\"instanceType\":\"InMageAzureV2\",\"isMultiVmSyncPoint\":\"ihqlcoqks\"}") + .toObject(InMageAzureV2RecoveryPointDetails.class); + Assertions.assertEquals("ihqlcoqks", model.isMultiVmSyncPoint()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2RecoveryPointDetails model = + new InMageAzureV2RecoveryPointDetails().withIsMultiVmSyncPoint("ihqlcoqks"); + model = BinaryData.fromObject(model).toObject(InMageAzureV2RecoveryPointDetails.class); + Assertions.assertEquals("ihqlcoqks", model.isMultiVmSyncPoint()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2ReprotectInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2ReprotectInputTests.java new file mode 100644 index 000000000000..86d4f6b211c1 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2ReprotectInputTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2ReprotectInput; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2ReprotectInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2ReprotectInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"masterTargetId\":\"sqsqkpdmioyjpnml\",\"processServerId\":\"qcpszp\",\"storageAccountId\":\"vqdvrdmvxyrxdhg\",\"runAsAccountId\":\"oj\",\"policyId\":\"aotcgbzxmbtp\",\"logStorageAccountId\":\"foioyidoxzn\",\"disksToInclude\":[\"dtmuuvd\",\"wsxmrszb\"]}") + .toObject(InMageAzureV2ReprotectInput.class); + Assertions.assertEquals("sqsqkpdmioyjpnml", model.masterTargetId()); + Assertions.assertEquals("qcpszp", model.processServerId()); + Assertions.assertEquals("vqdvrdmvxyrxdhg", model.storageAccountId()); + Assertions.assertEquals("oj", model.runAsAccountId()); + Assertions.assertEquals("aotcgbzxmbtp", model.policyId()); + Assertions.assertEquals("foioyidoxzn", model.logStorageAccountId()); + Assertions.assertEquals("dtmuuvd", model.disksToInclude().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2ReprotectInput model = + new InMageAzureV2ReprotectInput() + .withMasterTargetId("sqsqkpdmioyjpnml") + .withProcessServerId("qcpszp") + .withStorageAccountId("vqdvrdmvxyrxdhg") + .withRunAsAccountId("oj") + .withPolicyId("aotcgbzxmbtp") + .withLogStorageAccountId("foioyidoxzn") + .withDisksToInclude(Arrays.asList("dtmuuvd", "wsxmrszb")); + model = BinaryData.fromObject(model).toObject(InMageAzureV2ReprotectInput.class); + Assertions.assertEquals("sqsqkpdmioyjpnml", model.masterTargetId()); + Assertions.assertEquals("qcpszp", model.processServerId()); + Assertions.assertEquals("vqdvrdmvxyrxdhg", model.storageAccountId()); + Assertions.assertEquals("oj", model.runAsAccountId()); + Assertions.assertEquals("aotcgbzxmbtp", model.policyId()); + Assertions.assertEquals("foioyidoxzn", model.logStorageAccountId()); + Assertions.assertEquals("dtmuuvd", model.disksToInclude().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2SwitchProviderDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2SwitchProviderDetailsTests.java new file mode 100644 index 000000000000..7a594f4cc5e9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2SwitchProviderDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderDetails; + +public final class InMageAzureV2SwitchProviderDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2SwitchProviderDetails model = + BinaryData + .fromString( + "{\"targetVaultId\":\"asmcolmugpyvaos\",\"targetResourceId\":\"l\",\"targetFabricId\":\"zxeygzvtye\",\"targetApplianceId\":\"hubnobgu\"}") + .toObject(InMageAzureV2SwitchProviderDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2SwitchProviderDetails model = new InMageAzureV2SwitchProviderDetails(); + model = BinaryData.fromObject(model).toObject(InMageAzureV2SwitchProviderDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2SwitchProviderInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2SwitchProviderInputTests.java new file mode 100644 index 000000000000..eb45d7efd72d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2SwitchProviderInputTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2SwitchProviderInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2SwitchProviderInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2SwitchProviderInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"targetVaultID\":\"nimx\",\"targetFabricID\":\"pnerxrzut\",\"targetApplianceID\":\"lcurzaqmnbx\"}") + .toObject(InMageAzureV2SwitchProviderInput.class); + Assertions.assertEquals("nimx", model.targetVaultId()); + Assertions.assertEquals("pnerxrzut", model.targetFabricId()); + Assertions.assertEquals("lcurzaqmnbx", model.targetApplianceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2SwitchProviderInput model = + new InMageAzureV2SwitchProviderInput() + .withTargetVaultId("nimx") + .withTargetFabricId("pnerxrzut") + .withTargetApplianceId("lcurzaqmnbx"); + model = BinaryData.fromObject(model).toObject(InMageAzureV2SwitchProviderInput.class); + Assertions.assertEquals("nimx", model.targetVaultId()); + Assertions.assertEquals("pnerxrzut", model.targetFabricId()); + Assertions.assertEquals("lcurzaqmnbx", model.targetApplianceId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2TestFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2TestFailoverInputTests.java new file mode 100644 index 000000000000..53c46079dc91 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2TestFailoverInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2TestFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2TestFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2TestFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"recoveryPointId\":\"ehtd\",\"osUpgradeVersion\":\"mbnvynfaooeacted\"}") + .toObject(InMageAzureV2TestFailoverInput.class); + Assertions.assertEquals("ehtd", model.recoveryPointId()); + Assertions.assertEquals("mbnvynfaooeacted", model.osUpgradeVersion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2TestFailoverInput model = + new InMageAzureV2TestFailoverInput().withRecoveryPointId("ehtd").withOsUpgradeVersion("mbnvynfaooeacted"); + model = BinaryData.fromObject(model).toObject(InMageAzureV2TestFailoverInput.class); + Assertions.assertEquals("ehtd", model.recoveryPointId()); + Assertions.assertEquals("mbnvynfaooeacted", model.osUpgradeVersion()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2UnplannedFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2UnplannedFailoverInputTests.java new file mode 100644 index 000000000000..5afe13ac9a43 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2UnplannedFailoverInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2UnplannedFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2UnplannedFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2UnplannedFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"recoveryPointId\":\"lsk\",\"osUpgradeVersion\":\"ddida\"}") + .toObject(InMageAzureV2UnplannedFailoverInput.class); + Assertions.assertEquals("lsk", model.recoveryPointId()); + Assertions.assertEquals("ddida", model.osUpgradeVersion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2UnplannedFailoverInput model = + new InMageAzureV2UnplannedFailoverInput().withRecoveryPointId("lsk").withOsUpgradeVersion("ddida"); + model = BinaryData.fromObject(model).toObject(InMageAzureV2UnplannedFailoverInput.class); + Assertions.assertEquals("lsk", model.recoveryPointId()); + Assertions.assertEquals("ddida", model.osUpgradeVersion()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2UpdateReplicationProtectedItemInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2UpdateReplicationProtectedItemInputTests.java new file mode 100644 index 000000000000..8e765aa6dbfb --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageAzureV2UpdateReplicationProtectedItemInputTests.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageAzureV2UpdateReplicationProtectedItemInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SqlServerLicenseType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateDiskInput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class InMageAzureV2UpdateReplicationProtectedItemInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageAzureV2UpdateReplicationProtectedItemInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"recoveryAzureV1ResourceGroupId\":\"llrqmtlpbyxro\",\"recoveryAzureV2ResourceGroupId\":\"uyqyp\",\"useManagedDisks\":\"mnoiicsudy\",\"targetProximityPlacementGroupId\":\"rjjtalxrdsjrho\",\"targetAvailabilityZone\":\"qwgusxxhdo\",\"targetVmTags\":{\"bdmvsby\":\"wyblv\",\"kmkwjfbo\":\"daelqpv\",\"v\":\"loggdusxursu\",\"qrizfwihvaan\":\"xcjkcoqwczsy\"},\"targetManagedDiskTags\":{\"bbaex\":\"nhjrfdmfd\",\"vmuafmc\":\"jfwtgdfkkaui\",\"vpltidajjvy\":\"fedyuep\"},\"targetNicTags\":{\"yelsyasvfnk\":\"cfkumcfjxo\",\"jekrknfd\":\"myg\",\"lcr\":\"ugjqyckgtxkrdt\",\"tcsubmzoo\":\"jdkl\"},\"sqlServerLicenseType\":\"NotSpecified\",\"vmDisks\":[{\"diskId\":\"chkxfpwhdysl\",\"targetDiskName\":\"lglmnnkkwayqsh\"}]}") + .toObject(InMageAzureV2UpdateReplicationProtectedItemInput.class); + Assertions.assertEquals("llrqmtlpbyxro", model.recoveryAzureV1ResourceGroupId()); + Assertions.assertEquals("uyqyp", model.recoveryAzureV2ResourceGroupId()); + Assertions.assertEquals("mnoiicsudy", model.useManagedDisks()); + Assertions.assertEquals("rjjtalxrdsjrho", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("qwgusxxhdo", model.targetAvailabilityZone()); + Assertions.assertEquals("wyblv", model.targetVmTags().get("bdmvsby")); + Assertions.assertEquals("nhjrfdmfd", model.targetManagedDiskTags().get("bbaex")); + Assertions.assertEquals("cfkumcfjxo", model.targetNicTags().get("yelsyasvfnk")); + Assertions.assertEquals(SqlServerLicenseType.NOT_SPECIFIED, model.sqlServerLicenseType()); + Assertions.assertEquals("chkxfpwhdysl", model.vmDisks().get(0).diskId()); + Assertions.assertEquals("lglmnnkkwayqsh", model.vmDisks().get(0).targetDiskName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageAzureV2UpdateReplicationProtectedItemInput model = + new InMageAzureV2UpdateReplicationProtectedItemInput() + .withRecoveryAzureV1ResourceGroupId("llrqmtlpbyxro") + .withRecoveryAzureV2ResourceGroupId("uyqyp") + .withUseManagedDisks("mnoiicsudy") + .withTargetProximityPlacementGroupId("rjjtalxrdsjrho") + .withTargetAvailabilityZone("qwgusxxhdo") + .withTargetVmTags( + mapOf( + "bdmvsby", "wyblv", "kmkwjfbo", "daelqpv", "v", "loggdusxursu", "qrizfwihvaan", "xcjkcoqwczsy")) + .withTargetManagedDiskTags( + mapOf("bbaex", "nhjrfdmfd", "vmuafmc", "jfwtgdfkkaui", "vpltidajjvy", "fedyuep")) + .withTargetNicTags( + mapOf("yelsyasvfnk", "cfkumcfjxo", "jekrknfd", "myg", "lcr", "ugjqyckgtxkrdt", "tcsubmzoo", "jdkl")) + .withSqlServerLicenseType(SqlServerLicenseType.NOT_SPECIFIED) + .withVmDisks( + Arrays + .asList(new UpdateDiskInput().withDiskId("chkxfpwhdysl").withTargetDiskName("lglmnnkkwayqsh"))); + model = BinaryData.fromObject(model).toObject(InMageAzureV2UpdateReplicationProtectedItemInput.class); + Assertions.assertEquals("llrqmtlpbyxro", model.recoveryAzureV1ResourceGroupId()); + Assertions.assertEquals("uyqyp", model.recoveryAzureV2ResourceGroupId()); + Assertions.assertEquals("mnoiicsudy", model.useManagedDisks()); + Assertions.assertEquals("rjjtalxrdsjrho", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("qwgusxxhdo", model.targetAvailabilityZone()); + Assertions.assertEquals("wyblv", model.targetVmTags().get("bdmvsby")); + Assertions.assertEquals("nhjrfdmfd", model.targetManagedDiskTags().get("bbaex")); + Assertions.assertEquals("cfkumcfjxo", model.targetNicTags().get("yelsyasvfnk")); + Assertions.assertEquals(SqlServerLicenseType.NOT_SPECIFIED, model.sqlServerLicenseType()); + Assertions.assertEquals("chkxfpwhdysl", model.vmDisks().get(0).diskId()); + Assertions.assertEquals("lglmnnkkwayqsh", model.vmDisks().get(0).targetDiskName()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageBasePolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageBasePolicyDetailsTests.java new file mode 100644 index 000000000000..6623cfc4cacd --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageBasePolicyDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageBasePolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageBasePolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageBasePolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageBasePolicyDetails\",\"recoveryPointThresholdInMinutes\":1501835760,\"recoveryPointHistory\":1196368599,\"appConsistentFrequencyInMinutes\":612698857,\"multiVmSyncStatus\":\"tb\"}") + .toObject(InMageBasePolicyDetails.class); + Assertions.assertEquals(1501835760, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(1196368599, model.recoveryPointHistory()); + Assertions.assertEquals(612698857, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("tb", model.multiVmSyncStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageBasePolicyDetails model = + new InMageBasePolicyDetails() + .withRecoveryPointThresholdInMinutes(1501835760) + .withRecoveryPointHistory(1196368599) + .withAppConsistentFrequencyInMinutes(612698857) + .withMultiVmSyncStatus("tb"); + model = BinaryData.fromObject(model).toObject(InMageBasePolicyDetails.class); + Assertions.assertEquals(1501835760, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(1196368599, model.recoveryPointHistory()); + Assertions.assertEquals(612698857, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("tb", model.multiVmSyncStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDisableProtectionProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDisableProtectionProviderSpecificInputTests.java new file mode 100644 index 000000000000..3ab607fee22a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDisableProtectionProviderSpecificInputTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageDisableProtectionProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageDisableProtectionProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageDisableProtectionProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"InMage\",\"replicaVmDeletionStatus\":\"q\"}") + .toObject(InMageDisableProtectionProviderSpecificInput.class); + Assertions.assertEquals("q", model.replicaVmDeletionStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageDisableProtectionProviderSpecificInput model = + new InMageDisableProtectionProviderSpecificInput().withReplicaVmDeletionStatus("q"); + model = BinaryData.fromObject(model).toObject(InMageDisableProtectionProviderSpecificInput.class); + Assertions.assertEquals("q", model.replicaVmDeletionStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDiskDetailsTests.java new file mode 100644 index 000000000000..156854ed9bcc --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDiskDetailsTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskVolumeDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageDiskDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class InMageDiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageDiskDetails model = + BinaryData + .fromString( + "{\"diskId\":\"kgxqwqueuuylztpz\",\"diskName\":\"zevjykofve\",\"diskSizeInMB\":\"fkhkqtwqlep\",\"diskType\":\"zkca\",\"diskConfiguration\":\"wz\",\"volumeList\":[{\"label\":\"gffjw\",\"name\":\"nrtwz\"},{\"label\":\"qkifmxawostfz\",\"name\":\"hrkmjqncfv\"},{\"label\":\"cnhemvwfnq\",\"name\":\"ypvndrw\"},{\"label\":\"od\",\"name\":\"grssgw\"}]}") + .toObject(InMageDiskDetails.class); + Assertions.assertEquals("kgxqwqueuuylztpz", model.diskId()); + Assertions.assertEquals("zevjykofve", model.diskName()); + Assertions.assertEquals("fkhkqtwqlep", model.diskSizeInMB()); + Assertions.assertEquals("zkca", model.diskType()); + Assertions.assertEquals("wz", model.diskConfiguration()); + Assertions.assertEquals("gffjw", model.volumeList().get(0).label()); + Assertions.assertEquals("nrtwz", model.volumeList().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageDiskDetails model = + new InMageDiskDetails() + .withDiskId("kgxqwqueuuylztpz") + .withDiskName("zevjykofve") + .withDiskSizeInMB("fkhkqtwqlep") + .withDiskType("zkca") + .withDiskConfiguration("wz") + .withVolumeList( + Arrays + .asList( + new DiskVolumeDetails().withLabel("gffjw").withName("nrtwz"), + new DiskVolumeDetails().withLabel("qkifmxawostfz").withName("hrkmjqncfv"), + new DiskVolumeDetails().withLabel("cnhemvwfnq").withName("ypvndrw"), + new DiskVolumeDetails().withLabel("od").withName("grssgw"))); + model = BinaryData.fromObject(model).toObject(InMageDiskDetails.class); + Assertions.assertEquals("kgxqwqueuuylztpz", model.diskId()); + Assertions.assertEquals("zevjykofve", model.diskName()); + Assertions.assertEquals("fkhkqtwqlep", model.diskSizeInMB()); + Assertions.assertEquals("zkca", model.diskType()); + Assertions.assertEquals("wz", model.diskConfiguration()); + Assertions.assertEquals("gffjw", model.volumeList().get(0).label()); + Assertions.assertEquals("nrtwz", model.volumeList().get(0).name()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDiskExclusionInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDiskExclusionInputTests.java new file mode 100644 index 000000000000..a6dda2e23e54 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDiskExclusionInputTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageDiskExclusionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class InMageDiskExclusionInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageDiskExclusionInput model = + BinaryData + .fromString( + "{\"volumeOptions\":[{\"volumeLabel\":\"injmuymve\",\"onlyExcludeIfSingleVolume\":\"ztscbgmusaictds\"},{\"volumeLabel\":\"kzzohnrddc\",\"onlyExcludeIfSingleVolume\":\"eqozrehlbz\"},{\"volumeLabel\":\"xbnjrqvzyuexoz\",\"onlyExcludeIfSingleVolume\":\"ynp\"},{\"volumeLabel\":\"eudpab\",\"onlyExcludeIfSingleVolume\":\"euwzosgyjxvc\"}],\"diskSignatureOptions\":[{\"diskSignature\":\"rmrexzvdube\"},{\"diskSignature\":\"zygba\"}]}") + .toObject(InMageDiskExclusionInput.class); + Assertions.assertEquals("injmuymve", model.volumeOptions().get(0).volumeLabel()); + Assertions.assertEquals("ztscbgmusaictds", model.volumeOptions().get(0).onlyExcludeIfSingleVolume()); + Assertions.assertEquals("rmrexzvdube", model.diskSignatureOptions().get(0).diskSignature()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageDiskExclusionInput model = + new InMageDiskExclusionInput() + .withVolumeOptions( + Arrays + .asList( + new InMageVolumeExclusionOptions() + .withVolumeLabel("injmuymve") + .withOnlyExcludeIfSingleVolume("ztscbgmusaictds"), + new InMageVolumeExclusionOptions() + .withVolumeLabel("kzzohnrddc") + .withOnlyExcludeIfSingleVolume("eqozrehlbz"), + new InMageVolumeExclusionOptions() + .withVolumeLabel("xbnjrqvzyuexoz") + .withOnlyExcludeIfSingleVolume("ynp"), + new InMageVolumeExclusionOptions() + .withVolumeLabel("eudpab") + .withOnlyExcludeIfSingleVolume("euwzosgyjxvc"))) + .withDiskSignatureOptions( + Arrays + .asList( + new InMageDiskSignatureExclusionOptions().withDiskSignature("rmrexzvdube"), + new InMageDiskSignatureExclusionOptions().withDiskSignature("zygba"))); + model = BinaryData.fromObject(model).toObject(InMageDiskExclusionInput.class); + Assertions.assertEquals("injmuymve", model.volumeOptions().get(0).volumeLabel()); + Assertions.assertEquals("ztscbgmusaictds", model.volumeOptions().get(0).onlyExcludeIfSingleVolume()); + Assertions.assertEquals("rmrexzvdube", model.diskSignatureOptions().get(0).diskSignature()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDiskSignatureExclusionOptionsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDiskSignatureExclusionOptionsTests.java new file mode 100644 index 000000000000..4994bcc26383 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageDiskSignatureExclusionOptionsTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions; +import org.junit.jupiter.api.Assertions; + +public final class InMageDiskSignatureExclusionOptionsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageDiskSignatureExclusionOptions model = + BinaryData + .fromString("{\"diskSignature\":\"fvppkeqsifj\"}") + .toObject(InMageDiskSignatureExclusionOptions.class); + Assertions.assertEquals("fvppkeqsifj", model.diskSignature()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageDiskSignatureExclusionOptions model = + new InMageDiskSignatureExclusionOptions().withDiskSignature("fvppkeqsifj"); + model = BinaryData.fromObject(model).toObject(InMageDiskSignatureExclusionOptions.class); + Assertions.assertEquals("fvppkeqsifj", model.diskSignature()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageEnableProtectionInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageEnableProtectionInputTests.java new file mode 100644 index 000000000000..56f4011324ce --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageEnableProtectionInputTests.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageDiskExclusionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageEnableProtectionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class InMageEnableProtectionInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageEnableProtectionInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMage\",\"vmFriendlyName\":\"lng\",\"masterTargetId\":\"gnhrkombcdtajdo\",\"processServerId\":\"ggorwjoqt\",\"retentionDrive\":\"otpvclp\",\"runAsAccountId\":\"yrlmwkptsk\",\"multiVmGroupId\":\"xjgvh\",\"multiVmGroupName\":\"ccbmkakm\",\"datastoreName\":\"okbputm\",\"diskExclusionInput\":{\"volumeOptions\":[{\"volumeLabel\":\"akmlwktfowzkroyr\",\"onlyExcludeIfSingleVolume\":\"r\"},{\"volumeLabel\":\"lzqjimejtgzjxx\",\"onlyExcludeIfSingleVolume\":\"e\"}],\"diskSignatureOptions\":[{\"diskSignature\":\"qloiwyayyziv\"},{\"diskSignature\":\"itcdqlhchwhrk\"},{\"diskSignature\":\"l\"},{\"diskSignature\":\"fibfiplhx\"}]},\"disksToInclude\":[\"mycjowlyey\"]}") + .toObject(InMageEnableProtectionInput.class); + Assertions.assertEquals("lng", model.vmFriendlyName()); + Assertions.assertEquals("gnhrkombcdtajdo", model.masterTargetId()); + Assertions.assertEquals("ggorwjoqt", model.processServerId()); + Assertions.assertEquals("otpvclp", model.retentionDrive()); + Assertions.assertEquals("yrlmwkptsk", model.runAsAccountId()); + Assertions.assertEquals("xjgvh", model.multiVmGroupId()); + Assertions.assertEquals("ccbmkakm", model.multiVmGroupName()); + Assertions.assertEquals("okbputm", model.datastoreName()); + Assertions.assertEquals("akmlwktfowzkroyr", model.diskExclusionInput().volumeOptions().get(0).volumeLabel()); + Assertions.assertEquals("r", model.diskExclusionInput().volumeOptions().get(0).onlyExcludeIfSingleVolume()); + Assertions + .assertEquals("qloiwyayyziv", model.diskExclusionInput().diskSignatureOptions().get(0).diskSignature()); + Assertions.assertEquals("mycjowlyey", model.disksToInclude().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageEnableProtectionInput model = + new InMageEnableProtectionInput() + .withVmFriendlyName("lng") + .withMasterTargetId("gnhrkombcdtajdo") + .withProcessServerId("ggorwjoqt") + .withRetentionDrive("otpvclp") + .withRunAsAccountId("yrlmwkptsk") + .withMultiVmGroupId("xjgvh") + .withMultiVmGroupName("ccbmkakm") + .withDatastoreName("okbputm") + .withDiskExclusionInput( + new InMageDiskExclusionInput() + .withVolumeOptions( + Arrays + .asList( + new InMageVolumeExclusionOptions() + .withVolumeLabel("akmlwktfowzkroyr") + .withOnlyExcludeIfSingleVolume("r"), + new InMageVolumeExclusionOptions() + .withVolumeLabel("lzqjimejtgzjxx") + .withOnlyExcludeIfSingleVolume("e"))) + .withDiskSignatureOptions( + Arrays + .asList( + new InMageDiskSignatureExclusionOptions().withDiskSignature("qloiwyayyziv"), + new InMageDiskSignatureExclusionOptions().withDiskSignature("itcdqlhchwhrk"), + new InMageDiskSignatureExclusionOptions().withDiskSignature("l"), + new InMageDiskSignatureExclusionOptions().withDiskSignature("fibfiplhx")))) + .withDisksToInclude(Arrays.asList("mycjowlyey")); + model = BinaryData.fromObject(model).toObject(InMageEnableProtectionInput.class); + Assertions.assertEquals("lng", model.vmFriendlyName()); + Assertions.assertEquals("gnhrkombcdtajdo", model.masterTargetId()); + Assertions.assertEquals("ggorwjoqt", model.processServerId()); + Assertions.assertEquals("otpvclp", model.retentionDrive()); + Assertions.assertEquals("yrlmwkptsk", model.runAsAccountId()); + Assertions.assertEquals("xjgvh", model.multiVmGroupId()); + Assertions.assertEquals("ccbmkakm", model.multiVmGroupName()); + Assertions.assertEquals("okbputm", model.datastoreName()); + Assertions.assertEquals("akmlwktfowzkroyr", model.diskExclusionInput().volumeOptions().get(0).volumeLabel()); + Assertions.assertEquals("r", model.diskExclusionInput().volumeOptions().get(0).onlyExcludeIfSingleVolume()); + Assertions + .assertEquals("qloiwyayyziv", model.diskExclusionInput().diskSignatureOptions().get(0).diskSignature()); + Assertions.assertEquals("mycjowlyey", model.disksToInclude().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMagePolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMagePolicyDetailsTests.java new file mode 100644 index 000000000000..5e927fe0403f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMagePolicyDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMagePolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMagePolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMagePolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"InMage\",\"recoveryPointThresholdInMinutes\":841361482,\"recoveryPointHistory\":1070639613,\"appConsistentFrequencyInMinutes\":977949832,\"multiVmSyncStatus\":\"ac\"}") + .toObject(InMagePolicyDetails.class); + Assertions.assertEquals(841361482, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(1070639613, model.recoveryPointHistory()); + Assertions.assertEquals(977949832, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("ac", model.multiVmSyncStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMagePolicyDetails model = + new InMagePolicyDetails() + .withRecoveryPointThresholdInMinutes(841361482) + .withRecoveryPointHistory(1070639613) + .withAppConsistentFrequencyInMinutes(977949832) + .withMultiVmSyncStatus("ac"); + model = BinaryData.fromObject(model).toObject(InMagePolicyDetails.class); + Assertions.assertEquals(841361482, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(1070639613, model.recoveryPointHistory()); + Assertions.assertEquals(977949832, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("ac", model.multiVmSyncStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMagePolicyInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMagePolicyInputTests.java new file mode 100644 index 000000000000..80bf65698fc3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMagePolicyInputTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMagePolicyInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SetMultiVmSyncStatus; +import org.junit.jupiter.api.Assertions; + +public final class InMagePolicyInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMagePolicyInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMage\",\"recoveryPointThresholdInMinutes\":1710079987,\"recoveryPointHistory\":902786810,\"appConsistentFrequencyInMinutes\":1471706402,\"multiVmSyncStatus\":\"Enable\"}") + .toObject(InMagePolicyInput.class); + Assertions.assertEquals(1710079987, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(902786810, model.recoveryPointHistory()); + Assertions.assertEquals(1471706402, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(SetMultiVmSyncStatus.ENABLE, model.multiVmSyncStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMagePolicyInput model = + new InMagePolicyInput() + .withRecoveryPointThresholdInMinutes(1710079987) + .withRecoveryPointHistory(902786810) + .withAppConsistentFrequencyInMinutes(1471706402) + .withMultiVmSyncStatus(SetMultiVmSyncStatus.ENABLE); + model = BinaryData.fromObject(model).toObject(InMagePolicyInput.class); + Assertions.assertEquals(1710079987, model.recoveryPointThresholdInMinutes()); + Assertions.assertEquals(902786810, model.recoveryPointHistory()); + Assertions.assertEquals(1471706402, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(SetMultiVmSyncStatus.ENABLE, model.multiVmSyncStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmApplyRecoveryPointInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmApplyRecoveryPointInputTests.java new file mode 100644 index 000000000000..b550c78d1dfc --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmApplyRecoveryPointInputTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmApplyRecoveryPointInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmApplyRecoveryPointInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmApplyRecoveryPointInput model = + BinaryData + .fromString("{\"instanceType\":\"InMageRcm\",\"recoveryPointId\":\"mvhzfovanyrvaprt\"}") + .toObject(InMageRcmApplyRecoveryPointInput.class); + Assertions.assertEquals("mvhzfovanyrvaprt", model.recoveryPointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmApplyRecoveryPointInput model = + new InMageRcmApplyRecoveryPointInput().withRecoveryPointId("mvhzfovanyrvaprt"); + model = BinaryData.fromObject(model).toObject(InMageRcmApplyRecoveryPointInput.class); + Assertions.assertEquals("mvhzfovanyrvaprt", model.recoveryPointId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmDiscoveredProtectedVmDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmDiscoveredProtectedVmDetailsTests.java new file mode 100644 index 000000000000..0818289e6cf9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmDiscoveredProtectedVmDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmDiscoveredProtectedVmDetails; + +public final class InMageRcmDiscoveredProtectedVmDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmDiscoveredProtectedVmDetails model = + BinaryData + .fromString( + "{\"vCenterId\":\"l\",\"vCenterFqdn\":\"ewikfyaqandmym\",\"datastores\":[\"qjumovs\",\"bpbvzopaxmf\"],\"ipAddresses\":[\"mcwoxfaxd\",\"nqifb\",\"atroiaue\"],\"vmwareToolsStatus\":\"gmocpcjycboelrgt\",\"powerStatus\":\"fldsiuorin\",\"vmFqdn\":\"cedpksriwmmtmqrx\",\"osName\":\"qvvyczyay\",\"createdTimestamp\":\"2021-05-28T18:44:37Z\",\"updatedTimestamp\":\"2021-06-17T16:30:32Z\",\"isDeleted\":false,\"lastDiscoveryTimeInUtc\":\"2020-12-27T23:56:34Z\"}") + .toObject(InMageRcmDiscoveredProtectedVmDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmDiscoveredProtectedVmDetails model = new InMageRcmDiscoveredProtectedVmDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmDiscoveredProtectedVmDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmDiskInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmDiskInputTests.java new file mode 100644 index 000000000000..eca893ebeae4 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmDiskInputTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskAccountType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmDiskInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmDiskInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmDiskInput model = + BinaryData + .fromString( + "{\"diskId\":\"ahr\",\"logStorageAccountId\":\"gpx\",\"diskType\":\"Standard_LRS\",\"diskEncryptionSetId\":\"plnupoyryef\"}") + .toObject(InMageRcmDiskInput.class); + Assertions.assertEquals("ahr", model.diskId()); + Assertions.assertEquals("gpx", model.logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_LRS, model.diskType()); + Assertions.assertEquals("plnupoyryef", model.diskEncryptionSetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmDiskInput model = + new InMageRcmDiskInput() + .withDiskId("ahr") + .withLogStorageAccountId("gpx") + .withDiskType(DiskAccountType.STANDARD_LRS) + .withDiskEncryptionSetId("plnupoyryef"); + model = BinaryData.fromObject(model).toObject(InMageRcmDiskInput.class); + Assertions.assertEquals("ahr", model.diskId()); + Assertions.assertEquals("gpx", model.logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_LRS, model.diskType()); + Assertions.assertEquals("plnupoyryef", model.diskEncryptionSetId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmDisksDefaultInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmDisksDefaultInputTests.java new file mode 100644 index 000000000000..f8209f6d53d5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmDisksDefaultInputTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskAccountType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmDisksDefaultInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmDisksDefaultInput model = + BinaryData + .fromString( + "{\"logStorageAccountId\":\"mwovyztxlnomfpb\",\"diskType\":\"StandardSSD_LRS\",\"diskEncryptionSetId\":\"egvyieztkutnj\"}") + .toObject(InMageRcmDisksDefaultInput.class); + Assertions.assertEquals("mwovyztxlnomfpb", model.logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.diskType()); + Assertions.assertEquals("egvyieztkutnj", model.diskEncryptionSetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmDisksDefaultInput model = + new InMageRcmDisksDefaultInput() + .withLogStorageAccountId("mwovyztxlnomfpb") + .withDiskType(DiskAccountType.STANDARD_SSD_LRS) + .withDiskEncryptionSetId("egvyieztkutnj"); + model = BinaryData.fromObject(model).toObject(InMageRcmDisksDefaultInput.class); + Assertions.assertEquals("mwovyztxlnomfpb", model.logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.diskType()); + Assertions.assertEquals("egvyieztkutnj", model.diskEncryptionSetId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmEnableProtectionInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmEnableProtectionInputTests.java new file mode 100644 index 000000000000..3795970c787d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmEnableProtectionInputTests.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskAccountType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmDiskInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmDisksDefaultInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmEnableProtectionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LicenseType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmEnableProtectionInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmEnableProtectionInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcm\",\"fabricDiscoveryMachineId\":\"llukkreh\",\"disksToInclude\":[{\"diskId\":\"mjodu\",\"logStorageAccountId\":\"fvulxfaryr\",\"diskType\":\"Standard_LRS\",\"diskEncryptionSetId\":\"gdezvjqwahoy\"},{\"diskId\":\"yaxqvjweiwtczkd\",\"logStorageAccountId\":\"nvovbooqbmdqrxy\",\"diskType\":\"StandardSSD_LRS\",\"diskEncryptionSetId\":\"et\"},{\"diskId\":\"cflwtjdtlr\",\"logStorageAccountId\":\"e\",\"diskType\":\"Premium_LRS\",\"diskEncryptionSetId\":\"y\"}],\"disksDefault\":{\"logStorageAccountId\":\"uxdtzcq\",\"diskType\":\"Standard_LRS\",\"diskEncryptionSetId\":\"dudgcozzomeh\"},\"targetResourceGroupId\":\"lantolamlb\",\"targetNetworkId\":\"uxkqllczipvwdt\",\"testNetworkId\":\"kzdqiqdlratrkwxo\",\"targetSubnetName\":\"wxsuy\",\"testSubnetName\":\"nhrfgslgl\",\"targetVmName\":\"ry\",\"targetVmSize\":\"zihuioaeo\",\"licenseType\":\"NoLicenseType\",\"targetAvailabilitySetId\":\"tfeyvk\",\"targetAvailabilityZone\":\"gdd\",\"targetProximityPlacementGroupId\":\"hdccxb\",\"targetBootDiagnosticsStorageAccountId\":\"uqutkzwtjww\",\"runAsAccountId\":\"zytijcx\",\"processServerId\":\"nondegjdyd\",\"multiVmGroupName\":\"kkkbjuckcatuqbh\"}") + .toObject(InMageRcmEnableProtectionInput.class); + Assertions.assertEquals("llukkreh", model.fabricDiscoveryMachineId()); + Assertions.assertEquals("mjodu", model.disksToInclude().get(0).diskId()); + Assertions.assertEquals("fvulxfaryr", model.disksToInclude().get(0).logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_LRS, model.disksToInclude().get(0).diskType()); + Assertions.assertEquals("gdezvjqwahoy", model.disksToInclude().get(0).diskEncryptionSetId()); + Assertions.assertEquals("uxdtzcq", model.disksDefault().logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_LRS, model.disksDefault().diskType()); + Assertions.assertEquals("dudgcozzomeh", model.disksDefault().diskEncryptionSetId()); + Assertions.assertEquals("lantolamlb", model.targetResourceGroupId()); + Assertions.assertEquals("uxkqllczipvwdt", model.targetNetworkId()); + Assertions.assertEquals("kzdqiqdlratrkwxo", model.testNetworkId()); + Assertions.assertEquals("wxsuy", model.targetSubnetName()); + Assertions.assertEquals("nhrfgslgl", model.testSubnetName()); + Assertions.assertEquals("ry", model.targetVmName()); + Assertions.assertEquals("zihuioaeo", model.targetVmSize()); + Assertions.assertEquals(LicenseType.NO_LICENSE_TYPE, model.licenseType()); + Assertions.assertEquals("tfeyvk", model.targetAvailabilitySetId()); + Assertions.assertEquals("gdd", model.targetAvailabilityZone()); + Assertions.assertEquals("hdccxb", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("uqutkzwtjww", model.targetBootDiagnosticsStorageAccountId()); + Assertions.assertEquals("zytijcx", model.runAsAccountId()); + Assertions.assertEquals("nondegjdyd", model.processServerId()); + Assertions.assertEquals("kkkbjuckcatuqbh", model.multiVmGroupName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmEnableProtectionInput model = + new InMageRcmEnableProtectionInput() + .withFabricDiscoveryMachineId("llukkreh") + .withDisksToInclude( + Arrays + .asList( + new InMageRcmDiskInput() + .withDiskId("mjodu") + .withLogStorageAccountId("fvulxfaryr") + .withDiskType(DiskAccountType.STANDARD_LRS) + .withDiskEncryptionSetId("gdezvjqwahoy"), + new InMageRcmDiskInput() + .withDiskId("yaxqvjweiwtczkd") + .withLogStorageAccountId("nvovbooqbmdqrxy") + .withDiskType(DiskAccountType.STANDARD_SSD_LRS) + .withDiskEncryptionSetId("et"), + new InMageRcmDiskInput() + .withDiskId("cflwtjdtlr") + .withLogStorageAccountId("e") + .withDiskType(DiskAccountType.PREMIUM_LRS) + .withDiskEncryptionSetId("y"))) + .withDisksDefault( + new InMageRcmDisksDefaultInput() + .withLogStorageAccountId("uxdtzcq") + .withDiskType(DiskAccountType.STANDARD_LRS) + .withDiskEncryptionSetId("dudgcozzomeh")) + .withTargetResourceGroupId("lantolamlb") + .withTargetNetworkId("uxkqllczipvwdt") + .withTestNetworkId("kzdqiqdlratrkwxo") + .withTargetSubnetName("wxsuy") + .withTestSubnetName("nhrfgslgl") + .withTargetVmName("ry") + .withTargetVmSize("zihuioaeo") + .withLicenseType(LicenseType.NO_LICENSE_TYPE) + .withTargetAvailabilitySetId("tfeyvk") + .withTargetAvailabilityZone("gdd") + .withTargetProximityPlacementGroupId("hdccxb") + .withTargetBootDiagnosticsStorageAccountId("uqutkzwtjww") + .withRunAsAccountId("zytijcx") + .withProcessServerId("nondegjdyd") + .withMultiVmGroupName("kkkbjuckcatuqbh"); + model = BinaryData.fromObject(model).toObject(InMageRcmEnableProtectionInput.class); + Assertions.assertEquals("llukkreh", model.fabricDiscoveryMachineId()); + Assertions.assertEquals("mjodu", model.disksToInclude().get(0).diskId()); + Assertions.assertEquals("fvulxfaryr", model.disksToInclude().get(0).logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_LRS, model.disksToInclude().get(0).diskType()); + Assertions.assertEquals("gdezvjqwahoy", model.disksToInclude().get(0).diskEncryptionSetId()); + Assertions.assertEquals("uxdtzcq", model.disksDefault().logStorageAccountId()); + Assertions.assertEquals(DiskAccountType.STANDARD_LRS, model.disksDefault().diskType()); + Assertions.assertEquals("dudgcozzomeh", model.disksDefault().diskEncryptionSetId()); + Assertions.assertEquals("lantolamlb", model.targetResourceGroupId()); + Assertions.assertEquals("uxkqllczipvwdt", model.targetNetworkId()); + Assertions.assertEquals("kzdqiqdlratrkwxo", model.testNetworkId()); + Assertions.assertEquals("wxsuy", model.targetSubnetName()); + Assertions.assertEquals("nhrfgslgl", model.testSubnetName()); + Assertions.assertEquals("ry", model.targetVmName()); + Assertions.assertEquals("zihuioaeo", model.targetVmSize()); + Assertions.assertEquals(LicenseType.NO_LICENSE_TYPE, model.licenseType()); + Assertions.assertEquals("tfeyvk", model.targetAvailabilitySetId()); + Assertions.assertEquals("gdd", model.targetAvailabilityZone()); + Assertions.assertEquals("hdccxb", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("uqutkzwtjww", model.targetBootDiagnosticsStorageAccountId()); + Assertions.assertEquals("zytijcx", model.runAsAccountId()); + Assertions.assertEquals("nondegjdyd", model.processServerId()); + Assertions.assertEquals("kkkbjuckcatuqbh", model.multiVmGroupName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmEventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmEventDetailsTests.java new file mode 100644 index 000000000000..919a4fd32f2d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmEventDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmEventDetails; + +public final class InMageRcmEventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmEventDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcm\",\"protectedItemName\":\"wcnxtpzdlyseid\",\"vmName\":\"akatprytg\",\"latestAgentVersion\":\"zbqfdpfawrptvcsh\",\"jobId\":\"utzcttbqgdirda\",\"fabricName\":\"tzjgcfjfxtbwj\",\"applianceName\":\"rmuydgfttmdofg\",\"serverType\":\"agfuoftnxod\",\"componentDisplayName\":\"m\"}") + .toObject(InMageRcmEventDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmEventDetails model = new InMageRcmEventDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmEventDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFabricCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFabricCreationInputTests.java new file mode 100644 index 000000000000..4dccae511cd6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFabricCreationInputTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IdentityProviderInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFabricCreationInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmFabricCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFabricCreationInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcm\",\"vmwareSiteId\":\"aj\",\"physicalSiteId\":\"iygmgs\",\"sourceAgentIdentity\":{\"tenantId\":\"vmdmzenlr\",\"applicationId\":\"tgfczljdncidtjva\",\"objectId\":\"yyznmrgcdogcvuc\",\"audience\":\"ytoxuwhttnzq\",\"aadAuthority\":\"aqm\"}}") + .toObject(InMageRcmFabricCreationInput.class); + Assertions.assertEquals("aj", model.vmwareSiteId()); + Assertions.assertEquals("iygmgs", model.physicalSiteId()); + Assertions.assertEquals("vmdmzenlr", model.sourceAgentIdentity().tenantId()); + Assertions.assertEquals("tgfczljdncidtjva", model.sourceAgentIdentity().applicationId()); + Assertions.assertEquals("yyznmrgcdogcvuc", model.sourceAgentIdentity().objectId()); + Assertions.assertEquals("ytoxuwhttnzq", model.sourceAgentIdentity().audience()); + Assertions.assertEquals("aqm", model.sourceAgentIdentity().aadAuthority()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFabricCreationInput model = + new InMageRcmFabricCreationInput() + .withVmwareSiteId("aj") + .withPhysicalSiteId("iygmgs") + .withSourceAgentIdentity( + new IdentityProviderInput() + .withTenantId("vmdmzenlr") + .withApplicationId("tgfczljdncidtjva") + .withObjectId("yyznmrgcdogcvuc") + .withAudience("ytoxuwhttnzq") + .withAadAuthority("aqm")); + model = BinaryData.fromObject(model).toObject(InMageRcmFabricCreationInput.class); + Assertions.assertEquals("aj", model.vmwareSiteId()); + Assertions.assertEquals("iygmgs", model.physicalSiteId()); + Assertions.assertEquals("vmdmzenlr", model.sourceAgentIdentity().tenantId()); + Assertions.assertEquals("tgfczljdncidtjva", model.sourceAgentIdentity().applicationId()); + Assertions.assertEquals("yyznmrgcdogcvuc", model.sourceAgentIdentity().objectId()); + Assertions.assertEquals("ytoxuwhttnzq", model.sourceAgentIdentity().audience()); + Assertions.assertEquals("aqm", model.sourceAgentIdentity().aadAuthority()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackDiscoveredProtectedVmDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackDiscoveredProtectedVmDetailsTests.java new file mode 100644 index 000000000000..9a9f9cd9b65d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackDiscoveredProtectedVmDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackDiscoveredProtectedVmDetails; + +public final class InMageRcmFailbackDiscoveredProtectedVmDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackDiscoveredProtectedVmDetails model = + BinaryData + .fromString( + "{\"vCenterId\":\"zkdolrndwdbvxvza\",\"vCenterFqdn\":\"doyqx\",\"datastores\":[\"kft\",\"mcxqqxmyzklao\",\"n\",\"ohrvmz\"],\"ipAddresses\":[\"azad\",\"vznllaslkskhjqj\",\"vbaihxjt\",\"zgtai\"],\"vmwareToolsStatus\":\"b\",\"powerStatus\":\"roigbsfsgsaenwld\",\"vmFqdn\":\"hljqlxsp\",\"osName\":\"jc\",\"createdTimestamp\":\"2021-06-14T00:46:05Z\",\"updatedTimestamp\":\"2021-03-22T03:50:23Z\",\"isDeleted\":true,\"lastDiscoveryTimeInUtc\":\"2021-08-20T07:36Z\"}") + .toObject(InMageRcmFailbackDiscoveredProtectedVmDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackDiscoveredProtectedVmDetails model = new InMageRcmFailbackDiscoveredProtectedVmDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackDiscoveredProtectedVmDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackEventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackEventDetailsTests.java new file mode 100644 index 000000000000..1645a0b93f80 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackEventDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackEventDetails; + +public final class InMageRcmFailbackEventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackEventDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcmFailback\",\"protectedItemName\":\"hsxrznmgsdaluyc\",\"vmName\":\"efrbhseuerbg\",\"applianceName\":\"ebjludc\",\"serverType\":\"tujraxdtpryjm\",\"componentDisplayName\":\"nsewouxl\"}") + .toObject(InMageRcmFailbackEventDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackEventDetails model = new InMageRcmFailbackEventDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackEventDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackMobilityAgentDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackMobilityAgentDetailsTests.java new file mode 100644 index 000000000000..690a947b8644 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackMobilityAgentDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackMobilityAgentDetails; + +public final class InMageRcmFailbackMobilityAgentDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackMobilityAgentDetails model = + BinaryData + .fromString( + "{\"version\":\"s\",\"latestVersion\":\"yljurkeposehqqyl\",\"driverVersion\":\"ctwjwdsdlzm\",\"latestUpgradableVersionWithoutReboot\":\"erxxxoteehkhowgo\",\"agentVersionExpiryDate\":\"2021-04-11T20:48:45Z\",\"driverVersionExpiryDate\":\"2021-03-02T05:47:55Z\",\"lastHeartbeatUtc\":\"2021-02-03T22:17:50Z\",\"reasonsBlockingUpgrade\":[\"AgentNoHeartbeat\"],\"isUpgradeable\":\"pnp\"}") + .toObject(InMageRcmFailbackMobilityAgentDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackMobilityAgentDetails model = new InMageRcmFailbackMobilityAgentDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackMobilityAgentDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackNicDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackNicDetailsTests.java new file mode 100644 index 000000000000..f31d976b3f93 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackNicDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackNicDetails; + +public final class InMageRcmFailbackNicDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackNicDetails model = + BinaryData + .fromString( + "{\"macAddress\":\"aqawbmpspfeylql\",\"networkName\":\"vvujex\",\"adapterType\":\"glxrkgjnm\",\"sourceIpAddress\":\"aslavxj\"}") + .toObject(InMageRcmFailbackNicDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackNicDetails model = new InMageRcmFailbackNicDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackNicDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackPlannedFailoverProviderInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackPlannedFailoverProviderInputTests.java new file mode 100644 index 000000000000..8ea77fb3f9c9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackPlannedFailoverProviderInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackPlannedFailoverProviderInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmFailbackPlannedFailoverProviderInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackPlannedFailoverProviderInput model = + BinaryData + .fromString("{\"instanceType\":\"InMageRcmFailback\",\"recoveryPointType\":\"CrashConsistent\"}") + .toObject(InMageRcmFailbackPlannedFailoverProviderInput.class); + Assertions.assertEquals(InMageRcmFailbackRecoveryPointType.CRASH_CONSISTENT, model.recoveryPointType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackPlannedFailoverProviderInput model = + new InMageRcmFailbackPlannedFailoverProviderInput() + .withRecoveryPointType(InMageRcmFailbackRecoveryPointType.CRASH_CONSISTENT); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackPlannedFailoverProviderInput.class); + Assertions.assertEquals(InMageRcmFailbackRecoveryPointType.CRASH_CONSISTENT, model.recoveryPointType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackPolicyCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackPolicyCreationInputTests.java new file mode 100644 index 000000000000..dd4f6a2f6bc5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackPolicyCreationInputTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackPolicyCreationInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmFailbackPolicyCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackPolicyCreationInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcmFailback\",\"crashConsistentFrequencyInMinutes\":10286473,\"appConsistentFrequencyInMinutes\":875885958}") + .toObject(InMageRcmFailbackPolicyCreationInput.class); + Assertions.assertEquals(10286473, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(875885958, model.appConsistentFrequencyInMinutes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackPolicyCreationInput model = + new InMageRcmFailbackPolicyCreationInput() + .withCrashConsistentFrequencyInMinutes(10286473) + .withAppConsistentFrequencyInMinutes(875885958); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackPolicyCreationInput.class); + Assertions.assertEquals(10286473, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(875885958, model.appConsistentFrequencyInMinutes()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackPolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackPolicyDetailsTests.java new file mode 100644 index 000000000000..60ce18c778e0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackPolicyDetailsTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackPolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmFailbackPolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackPolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcmFailback\",\"appConsistentFrequencyInMinutes\":1741536205,\"crashConsistentFrequencyInMinutes\":516106077}") + .toObject(InMageRcmFailbackPolicyDetails.class); + Assertions.assertEquals(1741536205, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(516106077, model.crashConsistentFrequencyInMinutes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackPolicyDetails model = + new InMageRcmFailbackPolicyDetails() + .withAppConsistentFrequencyInMinutes(1741536205) + .withCrashConsistentFrequencyInMinutes(516106077); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackPolicyDetails.class); + Assertions.assertEquals(1741536205, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(516106077, model.crashConsistentFrequencyInMinutes()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackProtectedDiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackProtectedDiskDetailsTests.java new file mode 100644 index 000000000000..438fc0c1512e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackProtectedDiskDetailsTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackProtectedDiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails; + +public final class InMageRcmFailbackProtectedDiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackProtectedDiskDetails model = + BinaryData + .fromString( + "{\"diskId\":\"lvs\",\"diskName\":\"ywjopac\",\"isOSDisk\":\"hydv\",\"capacityInBytes\":7196910522233474156,\"diskUuid\":\"gpmillxgjs\",\"dataPendingInLogDataStoreInMB\":70.24965275674056,\"dataPendingAtSourceAgentInMB\":88.82129123990158,\"isInitialReplicationComplete\":\"iobijeiydyeuynhb\",\"irDetails\":{\"progressHealth\":\"InProgress\",\"transferredBytes\":8991689761064995996,\"last15MinutesTransferredBytes\":870519523900353978,\"lastDataTransferTimeUtc\":\"opdweoft\",\"processedBytes\":6885598853699298526,\"startTime\":\"igsioctqkm\",\"lastRefreshTime\":\"a\",\"progressPercentage\":1045792223},\"resyncDetails\":{\"progressHealth\":\"NoProgress\",\"transferredBytes\":5944613768997801995,\"last15MinutesTransferredBytes\":8824443803915143462,\"lastDataTransferTimeUtc\":\"sstfjxtvlxx\",\"processedBytes\":5911202779481860995,\"startTime\":\"rr\",\"lastRefreshTime\":\"mxeezwyh\",\"progressPercentage\":1081801760},\"lastSyncTime\":\"2021-10-30T12:38:01Z\"}") + .toObject(InMageRcmFailbackProtectedDiskDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackProtectedDiskDetails model = + new InMageRcmFailbackProtectedDiskDetails() + .withIrDetails(new InMageRcmFailbackSyncDetails()) + .withResyncDetails(new InMageRcmFailbackSyncDetails()); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackProtectedDiskDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackReplicationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackReplicationDetailsTests.java new file mode 100644 index 000000000000..64cba357184f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackReplicationDetailsTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackDiscoveredProtectedVmDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackMobilityAgentDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackNicDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackProtectedDiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackReplicationDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails; +import java.util.Arrays; + +public final class InMageRcmFailbackReplicationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackReplicationDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcmFailback\",\"internalIdentifier\":\"kwuyck\",\"azureVirtualMachineId\":\"nensmuffi\",\"multiVmGroupName\":\"bctvbpzuj\",\"reprotectAgentId\":\"totdxposcslh\",\"reprotectAgentName\":\"usiecktybhjuxid\",\"osType\":\"xomi\",\"logStorageAccountId\":\"dxjxdu\",\"targetvCenterId\":\"wjwi\",\"targetDataStoreName\":\"qrslaate\",\"targetVmName\":\"wuj\",\"initialReplicationProgressPercentage\":1719572322,\"initialReplicationProcessedBytes\":2452628822919259817,\"initialReplicationTransferredBytes\":7089184561517940356,\"initialReplicationProgressHealth\":\"InProgress\",\"resyncProgressPercentage\":863933371,\"resyncProcessedBytes\":5368716982368064306,\"resyncTransferredBytes\":9053528371962850431,\"resyncProgressHealth\":\"NoProgress\",\"resyncRequired\":\"bkkteo\",\"resyncState\":\"None\",\"protectedDisks\":[{\"diskId\":\"korvvm\",\"diskName\":\"cof\",\"isOSDisk\":\"h\",\"capacityInBytes\":8046745281500152828,\"diskUuid\":\"snqliwkmzojfe\",\"dataPendingInLogDataStoreInMB\":62.18165218206391,\"dataPendingAtSourceAgentInMB\":10.8838970496698,\"isInitialReplicationComplete\":\"knazgbjbhrpgiqst\",\"irDetails\":{\"progressHealth\":\"NoProgress\",\"transferredBytes\":2601716801597782877,\"last15MinutesTransferredBytes\":6484962639003043577,\"lastDataTransferTimeUtc\":\"p\",\"processedBytes\":7215078064868025353,\"startTime\":\"f\",\"lastRefreshTime\":\"ksldttohqclnaih\",\"progressPercentage\":670450081},\"resyncDetails\":{\"progressHealth\":\"InProgress\",\"transferredBytes\":4232005255626679607,\"last15MinutesTransferredBytes\":8113305415938188854,\"lastDataTransferTimeUtc\":\"p\",\"processedBytes\":5677806131765604590,\"startTime\":\"oi\",\"lastRefreshTime\":\"trawrqkza\",\"progressPercentage\":505721663},\"lastSyncTime\":\"2021-11-01T13:53:11Z\"}],\"mobilityAgentDetails\":{\"version\":\"klwzlw\",\"latestVersion\":\"prnejzltkaszf\",\"driverVersion\":\"xscbduxapgrcqe\",\"latestUpgradableVersionWithoutReboot\":\"vrdjomln\",\"agentVersionExpiryDate\":\"2021-01-15T20:00:26Z\",\"driverVersionExpiryDate\":\"2021-01-31T05:26:55Z\",\"lastHeartbeatUtc\":\"2021-02-13T00:13:07Z\",\"reasonsBlockingUpgrade\":[\"RebootRequired\",\"RcmProxyNoHeartbeat\",\"InvalidAgentVersion\"],\"isUpgradeable\":\"esdfedsb\"},\"vmNics\":[{\"macAddress\":\"coinmphymcqi\",\"networkName\":\"ltvdhqnufbx\",\"adapterType\":\"iibntojo\",\"sourceIpAddress\":\"nybydhuihaouwud\"},{\"macAddress\":\"aorhjkehwvumo\",\"networkName\":\"ircamqprlo\",\"adapterType\":\"ugejcvjkjyczcmt\",\"sourceIpAddress\":\"elajdyol\"},{\"macAddress\":\"qy\",\"networkName\":\"fmzsizzhravr\",\"adapterType\":\"kjymgqbgcxh\",\"sourceIpAddress\":\"xgzxlermkmer\"},{\"macAddress\":\"skirhn\",\"networkName\":\"pkcbkfukdljq\",\"adapterType\":\"tsdyds\",\"sourceIpAddress\":\"pafyalo\"}],\"lastPlannedFailoverStartTime\":\"2021-03-06T00:52:24Z\",\"lastPlannedFailoverStatus\":\"Succeeded\",\"discoveredVmDetails\":{\"vCenterId\":\"nyufpqzstif\",\"vCenterFqdn\":\"fyjfd\",\"datastores\":[\"yvndjokgwesym\",\"qh\",\"qpfzlpejtznxlue\"],\"ipAddresses\":[\"q\",\"bgsimwejlwbkbp\",\"zobdwbcp\",\"aswkuhydtnaczkf\"],\"vmwareToolsStatus\":\"atgawphnsk\",\"powerStatus\":\"dwgtqcumecsaa\",\"vmFqdn\":\"oqbd\",\"osName\":\"ycsbskowkrbhzhr\",\"createdTimestamp\":\"2021-05-08T23:12:06Z\",\"updatedTimestamp\":\"2021-03-04T08:22:41Z\",\"isDeleted\":true,\"lastDiscoveryTimeInUtc\":\"2020-12-21T04:50:26Z\"},\"lastUsedPolicyId\":\"asfgqgucyhfaimqv\",\"lastUsedPolicyFriendlyName\":\"uozkgyf\",\"isAgentRegistrationSuccessfulAfterFailover\":true}") + .toObject(InMageRcmFailbackReplicationDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackReplicationDetails model = + new InMageRcmFailbackReplicationDetails() + .withProtectedDisks( + Arrays + .asList( + new InMageRcmFailbackProtectedDiskDetails() + .withIrDetails(new InMageRcmFailbackSyncDetails()) + .withResyncDetails(new InMageRcmFailbackSyncDetails()))) + .withMobilityAgentDetails(new InMageRcmFailbackMobilityAgentDetails()) + .withVmNics( + Arrays + .asList( + new InMageRcmFailbackNicDetails(), + new InMageRcmFailbackNicDetails(), + new InMageRcmFailbackNicDetails(), + new InMageRcmFailbackNicDetails())) + .withDiscoveredVmDetails(new InMageRcmFailbackDiscoveredProtectedVmDetails()); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackReplicationDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackReprotectInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackReprotectInputTests.java new file mode 100644 index 000000000000..0af2da4cda34 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackReprotectInputTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackReprotectInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmFailbackReprotectInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackReprotectInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcmFailback\",\"processServerId\":\"e\",\"runAsAccountId\":\"fm\",\"policyId\":\"mskkixvlzjxplhpe\"}") + .toObject(InMageRcmFailbackReprotectInput.class); + Assertions.assertEquals("e", model.processServerId()); + Assertions.assertEquals("fm", model.runAsAccountId()); + Assertions.assertEquals("mskkixvlzjxplhpe", model.policyId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackReprotectInput model = + new InMageRcmFailbackReprotectInput() + .withProcessServerId("e") + .withRunAsAccountId("fm") + .withPolicyId("mskkixvlzjxplhpe"); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackReprotectInput.class); + Assertions.assertEquals("e", model.processServerId()); + Assertions.assertEquals("fm", model.runAsAccountId()); + Assertions.assertEquals("mskkixvlzjxplhpe", model.policyId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackSyncDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackSyncDetailsTests.java new file mode 100644 index 000000000000..5217614379c0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmFailbackSyncDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackSyncDetails; + +public final class InMageRcmFailbackSyncDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmFailbackSyncDetails model = + BinaryData + .fromString( + "{\"progressHealth\":\"SlowProgress\",\"transferredBytes\":1904677758535173364,\"last15MinutesTransferredBytes\":8784333877422486679,\"lastDataTransferTimeUtc\":\"hc\",\"processedBytes\":2105673643027071231,\"startTime\":\"dkgd\",\"lastRefreshTime\":\"szwcan\",\"progressPercentage\":830454539}") + .toObject(InMageRcmFailbackSyncDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmFailbackSyncDetails model = new InMageRcmFailbackSyncDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmFailbackSyncDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmMobilityAgentDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmMobilityAgentDetailsTests.java new file mode 100644 index 000000000000..f9ce94eedc3f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmMobilityAgentDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmMobilityAgentDetails; + +public final class InMageRcmMobilityAgentDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmMobilityAgentDetails model = + BinaryData + .fromString( + "{\"version\":\"ielbqrv\",\"latestVersion\":\"qvknmpecqxgiq\",\"latestAgentReleaseDate\":\"ifubnsnstlpwqp\",\"driverVersion\":\"xjkhtupsv\",\"latestUpgradableVersionWithoutReboot\":\"uweuiy\",\"agentVersionExpiryDate\":\"2021-02-16T23:45:49Z\",\"driverVersionExpiryDate\":\"2021-01-05T18:40:56Z\",\"lastHeartbeatUtc\":\"2021-09-02T16:14:15Z\",\"reasonsBlockingUpgrade\":[\"DistroIsNotReported\"],\"isUpgradeable\":\"evyllznfhkqyt\"}") + .toObject(InMageRcmMobilityAgentDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmMobilityAgentDetails model = new InMageRcmMobilityAgentDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmMobilityAgentDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmNicDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmNicDetailsTests.java new file mode 100644 index 000000000000..f02fbc1666ec --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmNicDetailsTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EthernetAddressType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmNicDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmNicDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmNicDetails model = + BinaryData + .fromString( + "{\"nicId\":\"tadopgfzdg\",\"isPrimaryNic\":\"c\",\"isSelectedForFailover\":\"rsvloy\",\"sourceIPAddress\":\"igqkzjuqwqa\",\"sourceIPAddressType\":\"Dynamic\",\"sourceNetworkId\":\"x\",\"sourceSubnetName\":\"xhyoip\",\"targetIPAddress\":\"dbgsosc\",\"targetIPAddressType\":\"Static\",\"targetSubnetName\":\"zfvbennmfkbpj\",\"testSubnetName\":\"tekwwnthropm\",\"testIPAddress\":\"d\",\"testIPAddressType\":\"Dynamic\"}") + .toObject(InMageRcmNicDetails.class); + Assertions.assertEquals("c", model.isPrimaryNic()); + Assertions.assertEquals("rsvloy", model.isSelectedForFailover()); + Assertions.assertEquals("dbgsosc", model.targetIpAddress()); + Assertions.assertEquals(EthernetAddressType.STATIC, model.targetIpAddressType()); + Assertions.assertEquals("zfvbennmfkbpj", model.targetSubnetName()); + Assertions.assertEquals("tekwwnthropm", model.testSubnetName()); + Assertions.assertEquals("d", model.testIpAddress()); + Assertions.assertEquals(EthernetAddressType.DYNAMIC, model.testIpAddressType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmNicDetails model = + new InMageRcmNicDetails() + .withIsPrimaryNic("c") + .withIsSelectedForFailover("rsvloy") + .withTargetIpAddress("dbgsosc") + .withTargetIpAddressType(EthernetAddressType.STATIC) + .withTargetSubnetName("zfvbennmfkbpj") + .withTestSubnetName("tekwwnthropm") + .withTestIpAddress("d") + .withTestIpAddressType(EthernetAddressType.DYNAMIC); + model = BinaryData.fromObject(model).toObject(InMageRcmNicDetails.class); + Assertions.assertEquals("c", model.isPrimaryNic()); + Assertions.assertEquals("rsvloy", model.isSelectedForFailover()); + Assertions.assertEquals("dbgsosc", model.targetIpAddress()); + Assertions.assertEquals(EthernetAddressType.STATIC, model.targetIpAddressType()); + Assertions.assertEquals("zfvbennmfkbpj", model.targetSubnetName()); + Assertions.assertEquals("tekwwnthropm", model.testSubnetName()); + Assertions.assertEquals("d", model.testIpAddress()); + Assertions.assertEquals(EthernetAddressType.DYNAMIC, model.testIpAddressType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmNicInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmNicInputTests.java new file mode 100644 index 000000000000..2c5ae59378bc --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmNicInputTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmNicInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmNicInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmNicInput model = + BinaryData + .fromString( + "{\"nicId\":\"urz\",\"isPrimaryNic\":\"vktjhffecqkoq\",\"isSelectedForFailover\":\"uergaghpuzxkpye\",\"targetSubnetName\":\"fdyldhgyed\",\"targetStaticIPAddress\":\"zqiyuqhtder\",\"testSubnetName\":\"n\",\"testStaticIPAddress\":\"a\"}") + .toObject(InMageRcmNicInput.class); + Assertions.assertEquals("urz", model.nicId()); + Assertions.assertEquals("vktjhffecqkoq", model.isPrimaryNic()); + Assertions.assertEquals("uergaghpuzxkpye", model.isSelectedForFailover()); + Assertions.assertEquals("fdyldhgyed", model.targetSubnetName()); + Assertions.assertEquals("zqiyuqhtder", model.targetStaticIpAddress()); + Assertions.assertEquals("n", model.testSubnetName()); + Assertions.assertEquals("a", model.testStaticIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmNicInput model = + new InMageRcmNicInput() + .withNicId("urz") + .withIsPrimaryNic("vktjhffecqkoq") + .withIsSelectedForFailover("uergaghpuzxkpye") + .withTargetSubnetName("fdyldhgyed") + .withTargetStaticIpAddress("zqiyuqhtder") + .withTestSubnetName("n") + .withTestStaticIpAddress("a"); + model = BinaryData.fromObject(model).toObject(InMageRcmNicInput.class); + Assertions.assertEquals("urz", model.nicId()); + Assertions.assertEquals("vktjhffecqkoq", model.isPrimaryNic()); + Assertions.assertEquals("uergaghpuzxkpye", model.isSelectedForFailover()); + Assertions.assertEquals("fdyldhgyed", model.targetSubnetName()); + Assertions.assertEquals("zqiyuqhtder", model.targetStaticIpAddress()); + Assertions.assertEquals("n", model.testSubnetName()); + Assertions.assertEquals("a", model.testStaticIpAddress()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmPolicyCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmPolicyCreationInputTests.java new file mode 100644 index 000000000000..3f59b41d4277 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmPolicyCreationInputTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmPolicyCreationInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmPolicyCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmPolicyCreationInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcm\",\"recoveryPointHistoryInMinutes\":1480236782,\"crashConsistentFrequencyInMinutes\":1722632251,\"appConsistentFrequencyInMinutes\":2131568654,\"enableMultiVmSync\":\"yxedznmx\"}") + .toObject(InMageRcmPolicyCreationInput.class); + Assertions.assertEquals(1480236782, model.recoveryPointHistoryInMinutes()); + Assertions.assertEquals(1722632251, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(2131568654, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("yxedznmx", model.enableMultiVmSync()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmPolicyCreationInput model = + new InMageRcmPolicyCreationInput() + .withRecoveryPointHistoryInMinutes(1480236782) + .withCrashConsistentFrequencyInMinutes(1722632251) + .withAppConsistentFrequencyInMinutes(2131568654) + .withEnableMultiVmSync("yxedznmx"); + model = BinaryData.fromObject(model).toObject(InMageRcmPolicyCreationInput.class); + Assertions.assertEquals(1480236782, model.recoveryPointHistoryInMinutes()); + Assertions.assertEquals(1722632251, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(2131568654, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals("yxedznmx", model.enableMultiVmSync()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmPolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmPolicyDetailsTests.java new file mode 100644 index 000000000000..018b77b95bfe --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmPolicyDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmPolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmPolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmPolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcm\",\"recoveryPointHistoryInMinutes\":1469596791,\"appConsistentFrequencyInMinutes\":1577824897,\"crashConsistentFrequencyInMinutes\":2133269081,\"enableMultiVmSync\":\"vmyifopxf\"}") + .toObject(InMageRcmPolicyDetails.class); + Assertions.assertEquals(1469596791, model.recoveryPointHistoryInMinutes()); + Assertions.assertEquals(1577824897, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(2133269081, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals("vmyifopxf", model.enableMultiVmSync()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmPolicyDetails model = + new InMageRcmPolicyDetails() + .withRecoveryPointHistoryInMinutes(1469596791) + .withAppConsistentFrequencyInMinutes(1577824897) + .withCrashConsistentFrequencyInMinutes(2133269081) + .withEnableMultiVmSync("vmyifopxf"); + model = BinaryData.fromObject(model).toObject(InMageRcmPolicyDetails.class); + Assertions.assertEquals(1469596791, model.recoveryPointHistoryInMinutes()); + Assertions.assertEquals(1577824897, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(2133269081, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals("vmyifopxf", model.enableMultiVmSync()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmProtectedDiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmProtectedDiskDetailsTests.java new file mode 100644 index 000000000000..260f40e779a9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmProtectedDiskDetailsTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskAccountType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmProtectedDiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmSyncDetails; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmProtectedDiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmProtectedDiskDetails model = + BinaryData + .fromString( + "{\"diskId\":\"tpdyzoutxfptof\",\"diskName\":\"nuywe\",\"isOSDisk\":\"gvad\",\"capacityInBytes\":9185978745071534533,\"logStorageAccountId\":\"vkgjpytpmpvd\",\"diskEncryptionSetId\":\"gehlufbortbnu\",\"seedManagedDiskId\":\"faxzsvbxxyjissk\",\"seedBlobUri\":\"qocl\",\"targetManagedDiskId\":\"ioewyhxes\",\"diskType\":\"StandardSSD_LRS\",\"dataPendingInLogDataStoreInMB\":56.49629137496913,\"dataPendingAtSourceAgentInMB\":18.951668101900808,\"isInitialReplicationComplete\":\"qfbdxmdses\",\"irDetails\":{\"progressHealth\":\"NoProgress\",\"transferredBytes\":3596991969048751162,\"last15MinutesTransferredBytes\":4059127042163303518,\"lastDataTransferTimeUtc\":\"lpdib\",\"processedBytes\":1471676215734551835,\"startTime\":\"eatnejrnminzq\",\"lastRefreshTime\":\"gtkihonikzsr\",\"progressPercentage\":785240806},\"resyncDetails\":{\"progressHealth\":\"Queued\",\"transferredBytes\":778176165721909518,\"last15MinutesTransferredBytes\":3766908090253531975,\"lastDataTransferTimeUtc\":\"ogkensckhbmcar\",\"processedBytes\":5626892338199425573,\"startTime\":\"xkwyk\",\"lastRefreshTime\":\"dndx\",\"progressPercentage\":470451433}}") + .toObject(InMageRcmProtectedDiskDetails.class); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.diskType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmProtectedDiskDetails model = + new InMageRcmProtectedDiskDetails() + .withDiskType(DiskAccountType.STANDARD_SSD_LRS) + .withIrDetails(new InMageRcmSyncDetails()) + .withResyncDetails(new InMageRcmSyncDetails()); + model = BinaryData.fromObject(model).toObject(InMageRcmProtectedDiskDetails.class); + Assertions.assertEquals(DiskAccountType.STANDARD_SSD_LRS, model.diskType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmProtectionContainerMappingDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmProtectionContainerMappingDetailsTests.java new file mode 100644 index 000000000000..e0ab071107ed --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmProtectionContainerMappingDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmProtectionContainerMappingDetails; + +public final class InMageRcmProtectionContainerMappingDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmProtectionContainerMappingDetails model = + BinaryData + .fromString("{\"instanceType\":\"InMageRcm\",\"enableAgentAutoUpgrade\":\"bgacnr\"}") + .toObject(InMageRcmProtectionContainerMappingDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmProtectionContainerMappingDetails model = new InMageRcmProtectionContainerMappingDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmProtectionContainerMappingDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmRecoveryPointDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmRecoveryPointDetailsTests.java new file mode 100644 index 000000000000..3ce1c6361f3b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmRecoveryPointDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmRecoveryPointDetails; + +public final class InMageRcmRecoveryPointDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmRecoveryPointDetails model = + BinaryData + .fromString("{\"instanceType\":\"InMageRcm\",\"isMultiVmSyncPoint\":\"dtncmsps\"}") + .toObject(InMageRcmRecoveryPointDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmRecoveryPointDetails model = new InMageRcmRecoveryPointDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmRecoveryPointDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmReprotectInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmReprotectInputTests.java new file mode 100644 index 000000000000..138c00e5e75d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmReprotectInputTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmReprotectInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmReprotectInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmReprotectInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcm\",\"reprotectAgentId\":\"cwwtzqzclo\",\"datastoreName\":\"hy\",\"logStorageAccountId\":\"pgidhzgyresgzsdt\",\"policyId\":\"byorjplb\"}") + .toObject(InMageRcmReprotectInput.class); + Assertions.assertEquals("cwwtzqzclo", model.reprotectAgentId()); + Assertions.assertEquals("hy", model.datastoreName()); + Assertions.assertEquals("pgidhzgyresgzsdt", model.logStorageAccountId()); + Assertions.assertEquals("byorjplb", model.policyId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmReprotectInput model = + new InMageRcmReprotectInput() + .withReprotectAgentId("cwwtzqzclo") + .withDatastoreName("hy") + .withLogStorageAccountId("pgidhzgyresgzsdt") + .withPolicyId("byorjplb"); + model = BinaryData.fromObject(model).toObject(InMageRcmReprotectInput.class); + Assertions.assertEquals("cwwtzqzclo", model.reprotectAgentId()); + Assertions.assertEquals("hy", model.datastoreName()); + Assertions.assertEquals("pgidhzgyresgzsdt", model.logStorageAccountId()); + Assertions.assertEquals("byorjplb", model.policyId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmSyncDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmSyncDetailsTests.java new file mode 100644 index 000000000000..51896eff0d33 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmSyncDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmSyncDetails; + +public final class InMageRcmSyncDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmSyncDetails model = + BinaryData + .fromString( + "{\"progressHealth\":\"SlowProgress\",\"transferredBytes\":8514603100054710213,\"last15MinutesTransferredBytes\":468712523679187650,\"lastDataTransferTimeUtc\":\"t\",\"processedBytes\":7769561351472935025,\"startTime\":\"scdx\",\"lastRefreshTime\":\"rnjr\",\"progressPercentage\":1625515673}") + .toObject(InMageRcmSyncDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmSyncDetails model = new InMageRcmSyncDetails(); + model = BinaryData.fromObject(model).toObject(InMageRcmSyncDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmTestFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmTestFailoverInputTests.java new file mode 100644 index 000000000000..712577ddd3c0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmTestFailoverInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmTestFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmTestFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmTestFailoverInput model = + BinaryData + .fromString("{\"instanceType\":\"InMageRcm\",\"networkId\":\"ychakvy\",\"recoveryPointId\":\"bqvum\"}") + .toObject(InMageRcmTestFailoverInput.class); + Assertions.assertEquals("ychakvy", model.networkId()); + Assertions.assertEquals("bqvum", model.recoveryPointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmTestFailoverInput model = + new InMageRcmTestFailoverInput().withNetworkId("ychakvy").withRecoveryPointId("bqvum"); + model = BinaryData.fromObject(model).toObject(InMageRcmTestFailoverInput.class); + Assertions.assertEquals("ychakvy", model.networkId()); + Assertions.assertEquals("bqvum", model.recoveryPointId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmUnplannedFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmUnplannedFailoverInputTests.java new file mode 100644 index 000000000000..7d47b7b0ba02 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmUnplannedFailoverInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmUnplannedFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmUnplannedFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmUnplannedFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcm\",\"performShutdown\":\"xqjsiuepm\",\"recoveryPointId\":\"fnzlpqmp\"}") + .toObject(InMageRcmUnplannedFailoverInput.class); + Assertions.assertEquals("xqjsiuepm", model.performShutdown()); + Assertions.assertEquals("fnzlpqmp", model.recoveryPointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmUnplannedFailoverInput model = + new InMageRcmUnplannedFailoverInput().withPerformShutdown("xqjsiuepm").withRecoveryPointId("fnzlpqmp"); + model = BinaryData.fromObject(model).toObject(InMageRcmUnplannedFailoverInput.class); + Assertions.assertEquals("xqjsiuepm", model.performShutdown()); + Assertions.assertEquals("fnzlpqmp", model.recoveryPointId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmUpdateContainerMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmUpdateContainerMappingInputTests.java new file mode 100644 index 000000000000..a86f93f470fb --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmUpdateContainerMappingInputTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmUpdateContainerMappingInput; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmUpdateContainerMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmUpdateContainerMappingInput model = + BinaryData + .fromString("{\"instanceType\":\"InMageRcm\",\"enableAgentAutoUpgrade\":\"ulbl\"}") + .toObject(InMageRcmUpdateContainerMappingInput.class); + Assertions.assertEquals("ulbl", model.enableAgentAutoUpgrade()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmUpdateContainerMappingInput model = + new InMageRcmUpdateContainerMappingInput().withEnableAgentAutoUpgrade("ulbl"); + model = BinaryData.fromObject(model).toObject(InMageRcmUpdateContainerMappingInput.class); + Assertions.assertEquals("ulbl", model.enableAgentAutoUpgrade()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmUpdateReplicationProtectedItemInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmUpdateReplicationProtectedItemInputTests.java new file mode 100644 index 000000000000..5bb94a530383 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageRcmUpdateReplicationProtectedItemInputTests.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmNicInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmUpdateReplicationProtectedItemInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LicenseType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class InMageRcmUpdateReplicationProtectedItemInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageRcmUpdateReplicationProtectedItemInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcm\",\"targetVmName\":\"tuxy\",\"targetVmSize\":\"hfcaeo\",\"targetResourceGroupId\":\"fqd\",\"targetAvailabilitySetId\":\"jflobhahqmomf\",\"targetAvailabilityZone\":\"o\",\"targetProximityPlacementGroupId\":\"fr\",\"targetBootDiagnosticsStorageAccountId\":\"gbmxldjmz\",\"targetNetworkId\":\"bjesylslur\",\"testNetworkId\":\"fygpnyhgd\",\"vmNics\":[{\"nicId\":\"sc\",\"isPrimaryNic\":\"gqyvouprsytqzss\",\"isSelectedForFailover\":\"mgw\",\"targetSubnetName\":\"ivrxpfduiol\",\"targetStaticIPAddress\":\"yqvpbfjpo\",\"testSubnetName\":\"ucfzluczdquu\",\"testStaticIPAddress\":\"ormvh\"},{\"nicId\":\"zielbprnq\",\"isPrimaryNic\":\"jywzcqyg\",\"isSelectedForFailover\":\"nwsvhbngqiwye\",\"targetSubnetName\":\"ob\",\"targetStaticIPAddress\":\"rpnrehkunsbfjh\",\"testSubnetName\":\"w\",\"testStaticIPAddress\":\"kvegeattbzkgtzq\"}],\"licenseType\":\"NoLicenseType\"}") + .toObject(InMageRcmUpdateReplicationProtectedItemInput.class); + Assertions.assertEquals("tuxy", model.targetVmName()); + Assertions.assertEquals("hfcaeo", model.targetVmSize()); + Assertions.assertEquals("fqd", model.targetResourceGroupId()); + Assertions.assertEquals("jflobhahqmomf", model.targetAvailabilitySetId()); + Assertions.assertEquals("o", model.targetAvailabilityZone()); + Assertions.assertEquals("fr", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("gbmxldjmz", model.targetBootDiagnosticsStorageAccountId()); + Assertions.assertEquals("bjesylslur", model.targetNetworkId()); + Assertions.assertEquals("fygpnyhgd", model.testNetworkId()); + Assertions.assertEquals("sc", model.vmNics().get(0).nicId()); + Assertions.assertEquals("gqyvouprsytqzss", model.vmNics().get(0).isPrimaryNic()); + Assertions.assertEquals("mgw", model.vmNics().get(0).isSelectedForFailover()); + Assertions.assertEquals("ivrxpfduiol", model.vmNics().get(0).targetSubnetName()); + Assertions.assertEquals("yqvpbfjpo", model.vmNics().get(0).targetStaticIpAddress()); + Assertions.assertEquals("ucfzluczdquu", model.vmNics().get(0).testSubnetName()); + Assertions.assertEquals("ormvh", model.vmNics().get(0).testStaticIpAddress()); + Assertions.assertEquals(LicenseType.NO_LICENSE_TYPE, model.licenseType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageRcmUpdateReplicationProtectedItemInput model = + new InMageRcmUpdateReplicationProtectedItemInput() + .withTargetVmName("tuxy") + .withTargetVmSize("hfcaeo") + .withTargetResourceGroupId("fqd") + .withTargetAvailabilitySetId("jflobhahqmomf") + .withTargetAvailabilityZone("o") + .withTargetProximityPlacementGroupId("fr") + .withTargetBootDiagnosticsStorageAccountId("gbmxldjmz") + .withTargetNetworkId("bjesylslur") + .withTestNetworkId("fygpnyhgd") + .withVmNics( + Arrays + .asList( + new InMageRcmNicInput() + .withNicId("sc") + .withIsPrimaryNic("gqyvouprsytqzss") + .withIsSelectedForFailover("mgw") + .withTargetSubnetName("ivrxpfduiol") + .withTargetStaticIpAddress("yqvpbfjpo") + .withTestSubnetName("ucfzluczdquu") + .withTestStaticIpAddress("ormvh"), + new InMageRcmNicInput() + .withNicId("zielbprnq") + .withIsPrimaryNic("jywzcqyg") + .withIsSelectedForFailover("nwsvhbngqiwye") + .withTargetSubnetName("ob") + .withTargetStaticIpAddress("rpnrehkunsbfjh") + .withTestSubnetName("w") + .withTestStaticIpAddress("kvegeattbzkgtzq"))) + .withLicenseType(LicenseType.NO_LICENSE_TYPE); + model = BinaryData.fromObject(model).toObject(InMageRcmUpdateReplicationProtectedItemInput.class); + Assertions.assertEquals("tuxy", model.targetVmName()); + Assertions.assertEquals("hfcaeo", model.targetVmSize()); + Assertions.assertEquals("fqd", model.targetResourceGroupId()); + Assertions.assertEquals("jflobhahqmomf", model.targetAvailabilitySetId()); + Assertions.assertEquals("o", model.targetAvailabilityZone()); + Assertions.assertEquals("fr", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("gbmxldjmz", model.targetBootDiagnosticsStorageAccountId()); + Assertions.assertEquals("bjesylslur", model.targetNetworkId()); + Assertions.assertEquals("fygpnyhgd", model.testNetworkId()); + Assertions.assertEquals("sc", model.vmNics().get(0).nicId()); + Assertions.assertEquals("gqyvouprsytqzss", model.vmNics().get(0).isPrimaryNic()); + Assertions.assertEquals("mgw", model.vmNics().get(0).isSelectedForFailover()); + Assertions.assertEquals("ivrxpfduiol", model.vmNics().get(0).targetSubnetName()); + Assertions.assertEquals("yqvpbfjpo", model.vmNics().get(0).targetStaticIpAddress()); + Assertions.assertEquals("ucfzluczdquu", model.vmNics().get(0).testSubnetName()); + Assertions.assertEquals("ormvh", model.vmNics().get(0).testStaticIpAddress()); + Assertions.assertEquals(LicenseType.NO_LICENSE_TYPE, model.licenseType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageReprotectInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageReprotectInputTests.java new file mode 100644 index 000000000000..b895639a754e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageReprotectInputTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageDiskExclusionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageDiskSignatureExclusionOptions; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageReprotectInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class InMageReprotectInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageReprotectInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMage\",\"masterTargetId\":\"ujjgnfgrzxbarc\",\"processServerId\":\"paefzqsy\",\"retentionDrive\":\"jwenjcytesmf\",\"runAsAccountId\":\"r\",\"datastoreName\":\"odqhuauzmzivrt\",\"diskExclusionInput\":{\"volumeOptions\":[{\"volumeLabel\":\"ezvhj\",\"onlyExcludeIfSingleVolume\":\"xdyyrud\"},{\"volumeLabel\":\"hswtvdkxbqssgfe\",\"onlyExcludeIfSingleVolume\":\"fdxbvwfqjchiv\"},{\"volumeLabel\":\"ija\",\"onlyExcludeIfSingleVolume\":\"ndmuvardlmz\"}],\"diskSignatureOptions\":[{\"diskSignature\":\"r\"}]},\"profileId\":\"muhcuhtuzl\",\"disksToInclude\":[\"yo\",\"garp\",\"ctwrapcz\",\"ojqyvzes\"]}") + .toObject(InMageReprotectInput.class); + Assertions.assertEquals("ujjgnfgrzxbarc", model.masterTargetId()); + Assertions.assertEquals("paefzqsy", model.processServerId()); + Assertions.assertEquals("jwenjcytesmf", model.retentionDrive()); + Assertions.assertEquals("r", model.runAsAccountId()); + Assertions.assertEquals("odqhuauzmzivrt", model.datastoreName()); + Assertions.assertEquals("ezvhj", model.diskExclusionInput().volumeOptions().get(0).volumeLabel()); + Assertions + .assertEquals("xdyyrud", model.diskExclusionInput().volumeOptions().get(0).onlyExcludeIfSingleVolume()); + Assertions.assertEquals("r", model.diskExclusionInput().diskSignatureOptions().get(0).diskSignature()); + Assertions.assertEquals("muhcuhtuzl", model.profileId()); + Assertions.assertEquals("yo", model.disksToInclude().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageReprotectInput model = + new InMageReprotectInput() + .withMasterTargetId("ujjgnfgrzxbarc") + .withProcessServerId("paefzqsy") + .withRetentionDrive("jwenjcytesmf") + .withRunAsAccountId("r") + .withDatastoreName("odqhuauzmzivrt") + .withDiskExclusionInput( + new InMageDiskExclusionInput() + .withVolumeOptions( + Arrays + .asList( + new InMageVolumeExclusionOptions() + .withVolumeLabel("ezvhj") + .withOnlyExcludeIfSingleVolume("xdyyrud"), + new InMageVolumeExclusionOptions() + .withVolumeLabel("hswtvdkxbqssgfe") + .withOnlyExcludeIfSingleVolume("fdxbvwfqjchiv"), + new InMageVolumeExclusionOptions() + .withVolumeLabel("ija") + .withOnlyExcludeIfSingleVolume("ndmuvardlmz"))) + .withDiskSignatureOptions( + Arrays.asList(new InMageDiskSignatureExclusionOptions().withDiskSignature("r")))) + .withProfileId("muhcuhtuzl") + .withDisksToInclude(Arrays.asList("yo", "garp", "ctwrapcz", "ojqyvzes")); + model = BinaryData.fromObject(model).toObject(InMageReprotectInput.class); + Assertions.assertEquals("ujjgnfgrzxbarc", model.masterTargetId()); + Assertions.assertEquals("paefzqsy", model.processServerId()); + Assertions.assertEquals("jwenjcytesmf", model.retentionDrive()); + Assertions.assertEquals("r", model.runAsAccountId()); + Assertions.assertEquals("odqhuauzmzivrt", model.datastoreName()); + Assertions.assertEquals("ezvhj", model.diskExclusionInput().volumeOptions().get(0).volumeLabel()); + Assertions + .assertEquals("xdyyrud", model.diskExclusionInput().volumeOptions().get(0).onlyExcludeIfSingleVolume()); + Assertions.assertEquals("r", model.diskExclusionInput().diskSignatureOptions().get(0).diskSignature()); + Assertions.assertEquals("muhcuhtuzl", model.profileId()); + Assertions.assertEquals("yo", model.disksToInclude().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageTestFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageTestFailoverInputTests.java new file mode 100644 index 000000000000..48ccf95df41d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageTestFailoverInputTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageTestFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPointType; +import org.junit.jupiter.api.Assertions; + +public final class InMageTestFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageTestFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMage\",\"recoveryPointType\":\"Custom\",\"recoveryPointId\":\"snj\"}") + .toObject(InMageTestFailoverInput.class); + Assertions.assertEquals(RecoveryPointType.CUSTOM, model.recoveryPointType()); + Assertions.assertEquals("snj", model.recoveryPointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageTestFailoverInput model = + new InMageTestFailoverInput().withRecoveryPointType(RecoveryPointType.CUSTOM).withRecoveryPointId("snj"); + model = BinaryData.fromObject(model).toObject(InMageTestFailoverInput.class); + Assertions.assertEquals(RecoveryPointType.CUSTOM, model.recoveryPointType()); + Assertions.assertEquals("snj", model.recoveryPointId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageUnplannedFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageUnplannedFailoverInputTests.java new file mode 100644 index 000000000000..074194952920 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageUnplannedFailoverInputTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageUnplannedFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPointType; +import org.junit.jupiter.api.Assertions; + +public final class InMageUnplannedFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageUnplannedFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMage\",\"recoveryPointType\":\"LatestTag\",\"recoveryPointId\":\"aadcndazabundt\"}") + .toObject(InMageUnplannedFailoverInput.class); + Assertions.assertEquals(RecoveryPointType.LATEST_TAG, model.recoveryPointType()); + Assertions.assertEquals("aadcndazabundt", model.recoveryPointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageUnplannedFailoverInput model = + new InMageUnplannedFailoverInput() + .withRecoveryPointType(RecoveryPointType.LATEST_TAG) + .withRecoveryPointId("aadcndazabundt"); + model = BinaryData.fromObject(model).toObject(InMageUnplannedFailoverInput.class); + Assertions.assertEquals(RecoveryPointType.LATEST_TAG, model.recoveryPointType()); + Assertions.assertEquals("aadcndazabundt", model.recoveryPointId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageVolumeExclusionOptionsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageVolumeExclusionOptionsTests.java new file mode 100644 index 000000000000..1ad138cfd0b6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InMageVolumeExclusionOptionsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageVolumeExclusionOptions; +import org.junit.jupiter.api.Assertions; + +public final class InMageVolumeExclusionOptionsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InMageVolumeExclusionOptions model = + BinaryData + .fromString("{\"volumeLabel\":\"vecovsdqhzr\",\"onlyExcludeIfSingleVolume\":\"bakrli\"}") + .toObject(InMageVolumeExclusionOptions.class); + Assertions.assertEquals("vecovsdqhzr", model.volumeLabel()); + Assertions.assertEquals("bakrli", model.onlyExcludeIfSingleVolume()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InMageVolumeExclusionOptions model = + new InMageVolumeExclusionOptions().withVolumeLabel("vecovsdqhzr").withOnlyExcludeIfSingleVolume("bakrli"); + model = BinaryData.fromObject(model).toObject(InMageVolumeExclusionOptions.class); + Assertions.assertEquals("vecovsdqhzr", model.volumeLabel()); + Assertions.assertEquals("bakrli", model.onlyExcludeIfSingleVolume()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InconsistentVmDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InconsistentVmDetailsTests.java new file mode 100644 index 000000000000..7b7a6af273bb --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InconsistentVmDetailsTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InconsistentVmDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class InconsistentVmDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InconsistentVmDetails model = + BinaryData + .fromString( + "{\"vmName\":\"laimouxwk\",\"cloudName\":\"mud\",\"details\":[\"oibi\",\"ziuswsw\",\"rk\",\"qsj\"],\"errorIds\":[\"qqvyfscyrfw\",\"iv\"]}") + .toObject(InconsistentVmDetails.class); + Assertions.assertEquals("laimouxwk", model.vmName()); + Assertions.assertEquals("mud", model.cloudName()); + Assertions.assertEquals("oibi", model.details().get(0)); + Assertions.assertEquals("qqvyfscyrfw", model.errorIds().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InconsistentVmDetails model = + new InconsistentVmDetails() + .withVmName("laimouxwk") + .withCloudName("mud") + .withDetails(Arrays.asList("oibi", "ziuswsw", "rk", "qsj")) + .withErrorIds(Arrays.asList("qqvyfscyrfw", "iv")); + model = BinaryData.fromObject(model).toObject(InconsistentVmDetails.class); + Assertions.assertEquals("laimouxwk", model.vmName()); + Assertions.assertEquals("mud", model.cloudName()); + Assertions.assertEquals("oibi", model.details().get(0)); + Assertions.assertEquals("qqvyfscyrfw", model.errorIds().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InitialReplicationDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InitialReplicationDetailsTests.java new file mode 100644 index 000000000000..66eb05d460b2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InitialReplicationDetailsTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InitialReplicationDetails; +import org.junit.jupiter.api.Assertions; + +public final class InitialReplicationDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InitialReplicationDetails model = + BinaryData + .fromString("{\"initialReplicationType\":\"pqbye\",\"initialReplicationProgressPercentage\":\"wy\"}") + .toObject(InitialReplicationDetails.class); + Assertions.assertEquals("pqbye", model.initialReplicationType()); + Assertions.assertEquals("wy", model.initialReplicationProgressPercentage()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InitialReplicationDetails model = + new InitialReplicationDetails() + .withInitialReplicationType("pqbye") + .withInitialReplicationProgressPercentage("wy"); + model = BinaryData.fromObject(model).toObject(InitialReplicationDetails.class); + Assertions.assertEquals("pqbye", model.initialReplicationType()); + Assertions.assertEquals("wy", model.initialReplicationProgressPercentage()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InputEndpointTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InputEndpointTests.java new file mode 100644 index 000000000000..9914afcecbea --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/InputEndpointTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InputEndpoint; +import org.junit.jupiter.api.Assertions; + +public final class InputEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InputEndpoint model = + BinaryData + .fromString( + "{\"endpointName\":\"gna\",\"privatePort\":58413214,\"publicPort\":45173211,\"protocol\":\"bktyjmfc\"}") + .toObject(InputEndpoint.class); + Assertions.assertEquals("gna", model.endpointName()); + Assertions.assertEquals(58413214, model.privatePort()); + Assertions.assertEquals(45173211, model.publicPort()); + Assertions.assertEquals("bktyjmfc", model.protocol()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InputEndpoint model = + new InputEndpoint() + .withEndpointName("gna") + .withPrivatePort(58413214) + .withPublicPort(45173211) + .withProtocol("bktyjmfc"); + model = BinaryData.fromObject(model).toObject(InputEndpoint.class); + Assertions.assertEquals("gna", model.endpointName()); + Assertions.assertEquals(58413214, model.privatePort()); + Assertions.assertEquals(45173211, model.publicPort()); + Assertions.assertEquals("bktyjmfc", model.protocol()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IpConfigDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IpConfigDetailsTests.java new file mode 100644 index 000000000000..6c4a18720c59 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IpConfigDetailsTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class IpConfigDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IpConfigDetails model = + BinaryData + .fromString( + "{\"name\":\"r\",\"isPrimary\":true,\"subnetName\":\"gaxwmzwdfkbnrzo\",\"staticIPAddress\":\"dltb\",\"ipAddressType\":\"tqjfgxxsaet\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"vpyigdaqq\",\"recoveryStaticIPAddress\":\"zdcduwjoedxng\",\"recoveryIPAddressType\":\"aifpaurwwgil\",\"recoveryPublicIPAddressId\":\"qqa\",\"recoveryLBBackendAddressPoolIds\":[\"kxwxdcvjwcyziake\",\"iqch\",\"rtui\",\"dsiwdfmmp\"],\"tfoSubnetName\":\"zzwvywrgyng\",\"tfoStaticIPAddress\":\"grpxncakiqaondjr\",\"tfoPublicIPAddressId\":\"lamgglvlmfejdo\",\"tfoLBBackendAddressPoolIds\":[\"kgltyg\",\"hqfgqkayejsx\"]}") + .toObject(IpConfigDetails.class); + Assertions.assertEquals("r", model.name()); + Assertions.assertEquals(true, model.isPrimary()); + Assertions.assertEquals("gaxwmzwdfkbnrzo", model.subnetName()); + Assertions.assertEquals("dltb", model.staticIpAddress()); + Assertions.assertEquals("tqjfgxxsaet", model.ipAddressType()); + Assertions.assertEquals(false, model.isSeletedForFailover()); + Assertions.assertEquals("vpyigdaqq", model.recoverySubnetName()); + Assertions.assertEquals("zdcduwjoedxng", model.recoveryStaticIpAddress()); + Assertions.assertEquals("aifpaurwwgil", model.recoveryIpAddressType()); + Assertions.assertEquals("qqa", model.recoveryPublicIpAddressId()); + Assertions.assertEquals("kxwxdcvjwcyziake", model.recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("zzwvywrgyng", model.tfoSubnetName()); + Assertions.assertEquals("grpxncakiqaondjr", model.tfoStaticIpAddress()); + Assertions.assertEquals("lamgglvlmfejdo", model.tfoPublicIpAddressId()); + Assertions.assertEquals("kgltyg", model.tfoLBBackendAddressPoolIds().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IpConfigDetails model = + new IpConfigDetails() + .withName("r") + .withIsPrimary(true) + .withSubnetName("gaxwmzwdfkbnrzo") + .withStaticIpAddress("dltb") + .withIpAddressType("tqjfgxxsaet") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("vpyigdaqq") + .withRecoveryStaticIpAddress("zdcduwjoedxng") + .withRecoveryIpAddressType("aifpaurwwgil") + .withRecoveryPublicIpAddressId("qqa") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("kxwxdcvjwcyziake", "iqch", "rtui", "dsiwdfmmp")) + .withTfoSubnetName("zzwvywrgyng") + .withTfoStaticIpAddress("grpxncakiqaondjr") + .withTfoPublicIpAddressId("lamgglvlmfejdo") + .withTfoLBBackendAddressPoolIds(Arrays.asList("kgltyg", "hqfgqkayejsx")); + model = BinaryData.fromObject(model).toObject(IpConfigDetails.class); + Assertions.assertEquals("r", model.name()); + Assertions.assertEquals(true, model.isPrimary()); + Assertions.assertEquals("gaxwmzwdfkbnrzo", model.subnetName()); + Assertions.assertEquals("dltb", model.staticIpAddress()); + Assertions.assertEquals("tqjfgxxsaet", model.ipAddressType()); + Assertions.assertEquals(false, model.isSeletedForFailover()); + Assertions.assertEquals("vpyigdaqq", model.recoverySubnetName()); + Assertions.assertEquals("zdcduwjoedxng", model.recoveryStaticIpAddress()); + Assertions.assertEquals("aifpaurwwgil", model.recoveryIpAddressType()); + Assertions.assertEquals("qqa", model.recoveryPublicIpAddressId()); + Assertions.assertEquals("kxwxdcvjwcyziake", model.recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("zzwvywrgyng", model.tfoSubnetName()); + Assertions.assertEquals("grpxncakiqaondjr", model.tfoStaticIpAddress()); + Assertions.assertEquals("lamgglvlmfejdo", model.tfoPublicIpAddressId()); + Assertions.assertEquals("kgltyg", model.tfoLBBackendAddressPoolIds().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IpConfigInputDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IpConfigInputDetailsTests.java new file mode 100644 index 000000000000..64f5fac0f7a7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/IpConfigInputDetailsTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigInputDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class IpConfigInputDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IpConfigInputDetails model = + BinaryData + .fromString( + "{\"ipConfigName\":\"pelmcuvhixbjxyf\",\"isPrimary\":false,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"ool\",\"recoveryStaticIPAddress\":\"tpkiwkkbnujry\",\"recoveryPublicIPAddressId\":\"tylbfpncurdoiw\",\"recoveryLBBackendAddressPoolIds\":[\"htywubxcbihwq\",\"nfdn\"],\"tfoSubnetName\":\"jchrdgoihxumw\",\"tfoStaticIPAddress\":\"ond\",\"tfoPublicIPAddressId\":\"luudfdlwggytsb\",\"tfoLBBackendAddressPoolIds\":[\"vvt\",\"seinqfiuf\",\"qknp\",\"rgnepttwqmsniffc\"]}") + .toObject(IpConfigInputDetails.class); + Assertions.assertEquals("pelmcuvhixbjxyf", model.ipConfigName()); + Assertions.assertEquals(false, model.isPrimary()); + Assertions.assertEquals(false, model.isSeletedForFailover()); + Assertions.assertEquals("ool", model.recoverySubnetName()); + Assertions.assertEquals("tpkiwkkbnujry", model.recoveryStaticIpAddress()); + Assertions.assertEquals("tylbfpncurdoiw", model.recoveryPublicIpAddressId()); + Assertions.assertEquals("htywubxcbihwq", model.recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("jchrdgoihxumw", model.tfoSubnetName()); + Assertions.assertEquals("ond", model.tfoStaticIpAddress()); + Assertions.assertEquals("luudfdlwggytsb", model.tfoPublicIpAddressId()); + Assertions.assertEquals("vvt", model.tfoLBBackendAddressPoolIds().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IpConfigInputDetails model = + new IpConfigInputDetails() + .withIpConfigName("pelmcuvhixbjxyf") + .withIsPrimary(false) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("ool") + .withRecoveryStaticIpAddress("tpkiwkkbnujry") + .withRecoveryPublicIpAddressId("tylbfpncurdoiw") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("htywubxcbihwq", "nfdn")) + .withTfoSubnetName("jchrdgoihxumw") + .withTfoStaticIpAddress("ond") + .withTfoPublicIpAddressId("luudfdlwggytsb") + .withTfoLBBackendAddressPoolIds(Arrays.asList("vvt", "seinqfiuf", "qknp", "rgnepttwqmsniffc")); + model = BinaryData.fromObject(model).toObject(IpConfigInputDetails.class); + Assertions.assertEquals("pelmcuvhixbjxyf", model.ipConfigName()); + Assertions.assertEquals(false, model.isPrimary()); + Assertions.assertEquals(false, model.isSeletedForFailover()); + Assertions.assertEquals("ool", model.recoverySubnetName()); + Assertions.assertEquals("tpkiwkkbnujry", model.recoveryStaticIpAddress()); + Assertions.assertEquals("tylbfpncurdoiw", model.recoveryPublicIpAddressId()); + Assertions.assertEquals("htywubxcbihwq", model.recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("jchrdgoihxumw", model.tfoSubnetName()); + Assertions.assertEquals("ond", model.tfoStaticIpAddress()); + Assertions.assertEquals("luudfdlwggytsb", model.tfoPublicIpAddressId()); + Assertions.assertEquals("vvt", model.tfoLBBackendAddressPoolIds().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobCollectionTests.java new file mode 100644 index 000000000000..c361165fedaa --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobCollectionTests.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.JobInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AsrTask; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.GroupTaskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobErrorDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProviderError; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ServiceError; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TaskTypeDetails; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class JobCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JobCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"activityId\":\"jeuut\",\"scenarioName\":\"xezw\",\"friendlyName\":\"okvbwnhhtqlgehg\",\"state\":\"ipifhpfeoajvg\",\"stateDescription\":\"txjcsheafidlt\",\"tasks\":[{\"taskId\":\"esmkssjhoiftxfkf\",\"name\":\"gpr\",\"startTime\":\"2021-06-29T04:06:59Z\",\"endTime\":\"2021-04-05T10:55:26Z\",\"allowedActions\":[\"cbiqtgdqoh\"],\"friendlyName\":\"wsldrizetpwbr\",\"state\":\"llibphbqzmizak\",\"stateDescription\":\"ankjpdnjzh\",\"taskType\":\"oylhjlmuoyxprimr\",\"customDetails\":{\"instanceType\":\"TaskTypeDetails\"},\"groupTaskCustomDetails\":{\"instanceType\":\"GroupTaskDetails\"},\"errors\":[{},{}]}],\"errors\":[{\"serviceErrorDetails\":{},\"providerErrorDetails\":{},\"errorLevel\":\"islstv\",\"creationTime\":\"2021-10-17T18:13:46Z\",\"taskId\":\"wxdzaumweoohgu\"},{\"serviceErrorDetails\":{},\"providerErrorDetails\":{},\"errorLevel\":\"boyjathwt\",\"creationTime\":\"2021-03-19T17:17:36Z\",\"taskId\":\"a\"},{\"serviceErrorDetails\":{},\"providerErrorDetails\":{},\"errorLevel\":\"dxmeb\",\"creationTime\":\"2021-01-03T03:25:45Z\",\"taskId\":\"jpahlxvea\"},{\"serviceErrorDetails\":{},\"providerErrorDetails\":{},\"errorLevel\":\"nmwmqtibx\",\"creationTime\":\"2021-03-01T23:53:32Z\",\"taskId\":\"dt\"}],\"startTime\":\"2021-11-15T06:45:30Z\",\"endTime\":\"2021-02-14T10:50:47Z\",\"allowedActions\":[\"ijaeukm\"],\"targetObjectId\":\"ieekpndzaa\",\"targetObjectName\":\"udqmeqwigpibudq\",\"targetInstanceType\":\"xebeybpmz\",\"customDetails\":{\"instanceType\":\"JobDetails\",\"affectedObjectDetails\":{\"aqi\":\"ff\",\"ioqaqhvs\":\"mhh\"}}},\"location\":\"fuqyrxpdlcgqlsi\",\"id\":\"mjqfrddgamquhio\",\"name\":\"rsjuivfcdisyir\",\"type\":\"xzhczexrxz\"},{\"properties\":{\"activityId\":\"rtrhqvwrevkhgnl\",\"scenarioName\":\"onzlr\",\"friendlyName\":\"qywncvjtsz\",\"state\":\"fizehtdhgbjk\",\"stateDescription\":\"eljeamurvzmlovua\",\"tasks\":[{\"taskId\":\"cxlpmjerb\",\"name\":\"elvidizozsdbccx\",\"startTime\":\"2021-04-03T14:05:40Z\",\"endTime\":\"2021-06-04T20:01:35Z\",\"allowedActions\":[\"nwncypuuw\",\"ltv\",\"qjctzenkeif\",\"zhmkdasvflyh\"],\"friendlyName\":\"cu\",\"state\":\"hxgsrboldfor\",\"stateDescription\":\"wjlvizbfhfov\",\"taskType\":\"cqpbtuo\",\"customDetails\":{\"instanceType\":\"TaskTypeDetails\"},\"groupTaskCustomDetails\":{\"instanceType\":\"GroupTaskDetails\"},\"errors\":[{}]},{\"taskId\":\"bbelawumuaslzk\",\"name\":\"rwoycqucwyh\",\"startTime\":\"2021-12-05T11:23:21Z\",\"endTime\":\"2021-01-03T22:26:02Z\",\"allowedActions\":[\"kywuhpsvfuu\",\"utlwexxwla\",\"niexzsrzpgepq\"],\"friendlyName\":\"bb\",\"state\":\"pgdakchzyvli\",\"stateDescription\":\"nrkcxkj\",\"taskType\":\"nxm\",\"customDetails\":{\"instanceType\":\"TaskTypeDetails\"},\"groupTaskCustomDetails\":{\"instanceType\":\"GroupTaskDetails\"},\"errors\":[{},{},{}]},{\"taskId\":\"qrntv\",\"name\":\"ijpstte\",\"startTime\":\"2021-11-08T06:52:34Z\",\"endTime\":\"2021-02-04T20:26:02Z\",\"allowedActions\":[\"yyufmhruncuw\",\"qspkcdqzhlctd\"],\"friendlyName\":\"nqndyfpchrqbn\",\"state\":\"rcgegydcwboxjum\",\"stateDescription\":\"qoli\",\"taskType\":\"raiouaubrjtl\",\"customDetails\":{\"instanceType\":\"TaskTypeDetails\"},\"groupTaskCustomDetails\":{\"instanceType\":\"GroupTaskDetails\"},\"errors\":[{},{},{}]},{\"taskId\":\"jrngif\",\"name\":\"z\",\"startTime\":\"2021-09-29T00:55:24Z\",\"endTime\":\"2021-10-27T11:43:24Z\",\"allowedActions\":[\"uimzdlyjd\"],\"friendlyName\":\"wmkyoqufdvruzsl\",\"state\":\"j\",\"stateDescription\":\"ctfnmdxotng\",\"taskType\":\"gugey\",\"customDetails\":{\"instanceType\":\"TaskTypeDetails\"},\"groupTaskCustomDetails\":{\"instanceType\":\"GroupTaskDetails\"},\"errors\":[{},{}]}],\"errors\":[{\"serviceErrorDetails\":{},\"providerErrorDetails\":{},\"errorLevel\":\"absnmfpp\",\"creationTime\":\"2021-09-09T02:17:02Z\",\"taskId\":\"evy\"}],\"startTime\":\"2021-01-30T15:37:24Z\",\"endTime\":\"2021-07-27T14:52:36Z\",\"allowedActions\":[\"czbgomfgbeg\",\"qgleohibetnluank\"],\"targetObjectId\":\"fxeeebtijvacvbm\",\"targetObjectName\":\"bqqxlaj\",\"targetInstanceType\":\"wxacevehj\",\"customDetails\":{\"instanceType\":\"JobDetails\",\"affectedObjectDetails\":{\"faey\":\"oafgaoql\",\"hriypoqeyhlqhy\":\"inmfgvxirp\",\"nuciqdsmexiit\":\"prlpy\",\"stgnl\":\"fuxtyasiibmiybnn\"}}},\"location\":\"nmgixh\",\"id\":\"mavmq\",\"name\":\"oudorhcgyyp\",\"type\":\"otwypundmb\"},{\"properties\":{\"activityId\":\"gcmjkavl\",\"scenarioName\":\"rb\",\"friendlyName\":\"tp\",\"state\":\"tzfjltf\",\"stateDescription\":\"zcyjtot\",\"tasks\":[{\"taskId\":\"vpbdbzqgq\",\"name\":\"hedsvqwthmkyib\",\"startTime\":\"2021-03-21T07:03:22Z\",\"endTime\":\"2021-11-13T09:58:30Z\",\"allowedActions\":[\"qcwdhoh\",\"dtmcd\",\"sufco\",\"dxbzlmcmuap\"],\"friendlyName\":\"hdbevwqqxeyskon\",\"state\":\"inkfkbgbz\",\"stateDescription\":\"wxeqocljmygvkzqk\",\"taskType\":\"eokbze\",\"customDetails\":{\"instanceType\":\"TaskTypeDetails\"},\"groupTaskCustomDetails\":{\"instanceType\":\"GroupTaskDetails\"},\"errors\":[{},{}]}],\"errors\":[{\"serviceErrorDetails\":{},\"providerErrorDetails\":{},\"errorLevel\":\"tleipqxbkw\",\"creationTime\":\"2021-04-24T16:12:29Z\",\"taskId\":\"zvd\"},{\"serviceErrorDetails\":{},\"providerErrorDetails\":{},\"errorLevel\":\"ixz\",\"creationTime\":\"2021-05-22T10:48:30Z\",\"taskId\":\"odawopqhewjptmcg\"}],\"startTime\":\"2021-04-24T18:57:19Z\",\"endTime\":\"2021-03-17T12:43:28Z\",\"allowedActions\":[\"lnd\"],\"targetObjectId\":\"tutmzl\",\"targetObjectName\":\"ojlvfhrbbpneqvc\",\"targetInstanceType\":\"yyurmochpprprsnm\",\"customDetails\":{\"instanceType\":\"JobDetails\",\"affectedObjectDetails\":{\"kpbz\":\"zejnhl\",\"a\":\"cpilj\",\"chndbnwie\":\"zv\"}}},\"location\":\"lewjwiuubwef\",\"id\":\"sfapaqtferrq\",\"name\":\"ex\",\"type\":\"kmfx\"}],\"nextLink\":\"jwogqqnobpudc\"}") + .toObject(JobCollection.class); + Assertions.assertEquals("jeuut", model.value().get(0).properties().activityId()); + Assertions.assertEquals("xezw", model.value().get(0).properties().scenarioName()); + Assertions.assertEquals("okvbwnhhtqlgehg", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("ipifhpfeoajvg", model.value().get(0).properties().state()); + Assertions.assertEquals("txjcsheafidlt", model.value().get(0).properties().stateDescription()); + Assertions.assertEquals("esmkssjhoiftxfkf", model.value().get(0).properties().tasks().get(0).taskId()); + Assertions.assertEquals("gpr", model.value().get(0).properties().tasks().get(0).name()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-06-29T04:06:59Z"), + model.value().get(0).properties().tasks().get(0).startTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-05T10:55:26Z"), + model.value().get(0).properties().tasks().get(0).endTime()); + Assertions.assertEquals("cbiqtgdqoh", model.value().get(0).properties().tasks().get(0).allowedActions().get(0)); + Assertions.assertEquals("wsldrizetpwbr", model.value().get(0).properties().tasks().get(0).friendlyName()); + Assertions.assertEquals("llibphbqzmizak", model.value().get(0).properties().tasks().get(0).state()); + Assertions.assertEquals("ankjpdnjzh", model.value().get(0).properties().tasks().get(0).stateDescription()); + Assertions.assertEquals("oylhjlmuoyxprimr", model.value().get(0).properties().tasks().get(0).taskType()); + Assertions.assertEquals("islstv", model.value().get(0).properties().errors().get(0).errorLevel()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-10-17T18:13:46Z"), + model.value().get(0).properties().errors().get(0).creationTime()); + Assertions.assertEquals("wxdzaumweoohgu", model.value().get(0).properties().errors().get(0).taskId()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-11-15T06:45:30Z"), model.value().get(0).properties().startTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-02-14T10:50:47Z"), model.value().get(0).properties().endTime()); + Assertions.assertEquals("ijaeukm", model.value().get(0).properties().allowedActions().get(0)); + Assertions.assertEquals("ieekpndzaa", model.value().get(0).properties().targetObjectId()); + Assertions.assertEquals("udqmeqwigpibudq", model.value().get(0).properties().targetObjectName()); + Assertions.assertEquals("xebeybpmz", model.value().get(0).properties().targetInstanceType()); + Assertions + .assertEquals("ff", model.value().get(0).properties().customDetails().affectedObjectDetails().get("aqi")); + Assertions.assertEquals("fuqyrxpdlcgqlsi", model.value().get(0).location()); + Assertions.assertEquals("jwogqqnobpudc", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JobCollection model = + new JobCollection() + .withValue( + Arrays + .asList( + new JobInner() + .withProperties( + new JobProperties() + .withActivityId("jeuut") + .withScenarioName("xezw") + .withFriendlyName("okvbwnhhtqlgehg") + .withState("ipifhpfeoajvg") + .withStateDescription("txjcsheafidlt") + .withTasks( + Arrays + .asList( + new AsrTask() + .withTaskId("esmkssjhoiftxfkf") + .withName("gpr") + .withStartTime(OffsetDateTime.parse("2021-06-29T04:06:59Z")) + .withEndTime(OffsetDateTime.parse("2021-04-05T10:55:26Z")) + .withAllowedActions(Arrays.asList("cbiqtgdqoh")) + .withFriendlyName("wsldrizetpwbr") + .withState("llibphbqzmizak") + .withStateDescription("ankjpdnjzh") + .withTaskType("oylhjlmuoyxprimr") + .withCustomDetails(new TaskTypeDetails()) + .withGroupTaskCustomDetails(new GroupTaskDetails()) + .withErrors( + Arrays + .asList(new JobErrorDetails(), new JobErrorDetails())))) + .withErrors( + Arrays + .asList( + new JobErrorDetails() + .withServiceErrorDetails(new ServiceError()) + .withProviderErrorDetails(new ProviderError()) + .withErrorLevel("islstv") + .withCreationTime(OffsetDateTime.parse("2021-10-17T18:13:46Z")) + .withTaskId("wxdzaumweoohgu"), + new JobErrorDetails() + .withServiceErrorDetails(new ServiceError()) + .withProviderErrorDetails(new ProviderError()) + .withErrorLevel("boyjathwt") + .withCreationTime(OffsetDateTime.parse("2021-03-19T17:17:36Z")) + .withTaskId("a"), + new JobErrorDetails() + .withServiceErrorDetails(new ServiceError()) + .withProviderErrorDetails(new ProviderError()) + .withErrorLevel("dxmeb") + .withCreationTime(OffsetDateTime.parse("2021-01-03T03:25:45Z")) + .withTaskId("jpahlxvea"), + new JobErrorDetails() + .withServiceErrorDetails(new ServiceError()) + .withProviderErrorDetails(new ProviderError()) + .withErrorLevel("nmwmqtibx") + .withCreationTime(OffsetDateTime.parse("2021-03-01T23:53:32Z")) + .withTaskId("dt"))) + .withStartTime(OffsetDateTime.parse("2021-11-15T06:45:30Z")) + .withEndTime(OffsetDateTime.parse("2021-02-14T10:50:47Z")) + .withAllowedActions(Arrays.asList("ijaeukm")) + .withTargetObjectId("ieekpndzaa") + .withTargetObjectName("udqmeqwigpibudq") + .withTargetInstanceType("xebeybpmz") + .withCustomDetails( + new JobDetails() + .withAffectedObjectDetails(mapOf("aqi", "ff", "ioqaqhvs", "mhh")))) + .withLocation("fuqyrxpdlcgqlsi"), + new JobInner() + .withProperties( + new JobProperties() + .withActivityId("rtrhqvwrevkhgnl") + .withScenarioName("onzlr") + .withFriendlyName("qywncvjtsz") + .withState("fizehtdhgbjk") + .withStateDescription("eljeamurvzmlovua") + .withTasks( + Arrays + .asList( + new AsrTask() + .withTaskId("cxlpmjerb") + .withName("elvidizozsdbccx") + .withStartTime(OffsetDateTime.parse("2021-04-03T14:05:40Z")) + .withEndTime(OffsetDateTime.parse("2021-06-04T20:01:35Z")) + .withAllowedActions( + Arrays + .asList( + "nwncypuuw", "ltv", "qjctzenkeif", "zhmkdasvflyh")) + .withFriendlyName("cu") + .withState("hxgsrboldfor") + .withStateDescription("wjlvizbfhfov") + .withTaskType("cqpbtuo") + .withCustomDetails(new TaskTypeDetails()) + .withGroupTaskCustomDetails(new GroupTaskDetails()) + .withErrors(Arrays.asList(new JobErrorDetails())), + new AsrTask() + .withTaskId("bbelawumuaslzk") + .withName("rwoycqucwyh") + .withStartTime(OffsetDateTime.parse("2021-12-05T11:23:21Z")) + .withEndTime(OffsetDateTime.parse("2021-01-03T22:26:02Z")) + .withAllowedActions( + Arrays.asList("kywuhpsvfuu", "utlwexxwla", "niexzsrzpgepq")) + .withFriendlyName("bb") + .withState("pgdakchzyvli") + .withStateDescription("nrkcxkj") + .withTaskType("nxm") + .withCustomDetails(new TaskTypeDetails()) + .withGroupTaskCustomDetails(new GroupTaskDetails()) + .withErrors( + Arrays + .asList( + new JobErrorDetails(), + new JobErrorDetails(), + new JobErrorDetails())), + new AsrTask() + .withTaskId("qrntv") + .withName("ijpstte") + .withStartTime(OffsetDateTime.parse("2021-11-08T06:52:34Z")) + .withEndTime(OffsetDateTime.parse("2021-02-04T20:26:02Z")) + .withAllowedActions( + Arrays.asList("yyufmhruncuw", "qspkcdqzhlctd")) + .withFriendlyName("nqndyfpchrqbn") + .withState("rcgegydcwboxjum") + .withStateDescription("qoli") + .withTaskType("raiouaubrjtl") + .withCustomDetails(new TaskTypeDetails()) + .withGroupTaskCustomDetails(new GroupTaskDetails()) + .withErrors( + Arrays + .asList( + new JobErrorDetails(), + new JobErrorDetails(), + new JobErrorDetails())), + new AsrTask() + .withTaskId("jrngif") + .withName("z") + .withStartTime(OffsetDateTime.parse("2021-09-29T00:55:24Z")) + .withEndTime(OffsetDateTime.parse("2021-10-27T11:43:24Z")) + .withAllowedActions(Arrays.asList("uimzdlyjd")) + .withFriendlyName("wmkyoqufdvruzsl") + .withState("j") + .withStateDescription("ctfnmdxotng") + .withTaskType("gugey") + .withCustomDetails(new TaskTypeDetails()) + .withGroupTaskCustomDetails(new GroupTaskDetails()) + .withErrors( + Arrays + .asList(new JobErrorDetails(), new JobErrorDetails())))) + .withErrors( + Arrays + .asList( + new JobErrorDetails() + .withServiceErrorDetails(new ServiceError()) + .withProviderErrorDetails(new ProviderError()) + .withErrorLevel("absnmfpp") + .withCreationTime(OffsetDateTime.parse("2021-09-09T02:17:02Z")) + .withTaskId("evy"))) + .withStartTime(OffsetDateTime.parse("2021-01-30T15:37:24Z")) + .withEndTime(OffsetDateTime.parse("2021-07-27T14:52:36Z")) + .withAllowedActions(Arrays.asList("czbgomfgbeg", "qgleohibetnluank")) + .withTargetObjectId("fxeeebtijvacvbm") + .withTargetObjectName("bqqxlaj") + .withTargetInstanceType("wxacevehj") + .withCustomDetails( + new JobDetails() + .withAffectedObjectDetails( + mapOf( + "faey", + "oafgaoql", + "hriypoqeyhlqhy", + "inmfgvxirp", + "nuciqdsmexiit", + "prlpy", + "stgnl", + "fuxtyasiibmiybnn")))) + .withLocation("nmgixh"), + new JobInner() + .withProperties( + new JobProperties() + .withActivityId("gcmjkavl") + .withScenarioName("rb") + .withFriendlyName("tp") + .withState("tzfjltf") + .withStateDescription("zcyjtot") + .withTasks( + Arrays + .asList( + new AsrTask() + .withTaskId("vpbdbzqgq") + .withName("hedsvqwthmkyib") + .withStartTime(OffsetDateTime.parse("2021-03-21T07:03:22Z")) + .withEndTime(OffsetDateTime.parse("2021-11-13T09:58:30Z")) + .withAllowedActions( + Arrays.asList("qcwdhoh", "dtmcd", "sufco", "dxbzlmcmuap")) + .withFriendlyName("hdbevwqqxeyskon") + .withState("inkfkbgbz") + .withStateDescription("wxeqocljmygvkzqk") + .withTaskType("eokbze") + .withCustomDetails(new TaskTypeDetails()) + .withGroupTaskCustomDetails(new GroupTaskDetails()) + .withErrors( + Arrays + .asList(new JobErrorDetails(), new JobErrorDetails())))) + .withErrors( + Arrays + .asList( + new JobErrorDetails() + .withServiceErrorDetails(new ServiceError()) + .withProviderErrorDetails(new ProviderError()) + .withErrorLevel("tleipqxbkw") + .withCreationTime(OffsetDateTime.parse("2021-04-24T16:12:29Z")) + .withTaskId("zvd"), + new JobErrorDetails() + .withServiceErrorDetails(new ServiceError()) + .withProviderErrorDetails(new ProviderError()) + .withErrorLevel("ixz") + .withCreationTime(OffsetDateTime.parse("2021-05-22T10:48:30Z")) + .withTaskId("odawopqhewjptmcg"))) + .withStartTime(OffsetDateTime.parse("2021-04-24T18:57:19Z")) + .withEndTime(OffsetDateTime.parse("2021-03-17T12:43:28Z")) + .withAllowedActions(Arrays.asList("lnd")) + .withTargetObjectId("tutmzl") + .withTargetObjectName("ojlvfhrbbpneqvc") + .withTargetInstanceType("yyurmochpprprsnm") + .withCustomDetails( + new JobDetails() + .withAffectedObjectDetails( + mapOf("kpbz", "zejnhl", "a", "cpilj", "chndbnwie", "zv")))) + .withLocation("lewjwiuubwef"))) + .withNextLink("jwogqqnobpudc"); + model = BinaryData.fromObject(model).toObject(JobCollection.class); + Assertions.assertEquals("jeuut", model.value().get(0).properties().activityId()); + Assertions.assertEquals("xezw", model.value().get(0).properties().scenarioName()); + Assertions.assertEquals("okvbwnhhtqlgehg", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("ipifhpfeoajvg", model.value().get(0).properties().state()); + Assertions.assertEquals("txjcsheafidlt", model.value().get(0).properties().stateDescription()); + Assertions.assertEquals("esmkssjhoiftxfkf", model.value().get(0).properties().tasks().get(0).taskId()); + Assertions.assertEquals("gpr", model.value().get(0).properties().tasks().get(0).name()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-06-29T04:06:59Z"), + model.value().get(0).properties().tasks().get(0).startTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-05T10:55:26Z"), + model.value().get(0).properties().tasks().get(0).endTime()); + Assertions.assertEquals("cbiqtgdqoh", model.value().get(0).properties().tasks().get(0).allowedActions().get(0)); + Assertions.assertEquals("wsldrizetpwbr", model.value().get(0).properties().tasks().get(0).friendlyName()); + Assertions.assertEquals("llibphbqzmizak", model.value().get(0).properties().tasks().get(0).state()); + Assertions.assertEquals("ankjpdnjzh", model.value().get(0).properties().tasks().get(0).stateDescription()); + Assertions.assertEquals("oylhjlmuoyxprimr", model.value().get(0).properties().tasks().get(0).taskType()); + Assertions.assertEquals("islstv", model.value().get(0).properties().errors().get(0).errorLevel()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-10-17T18:13:46Z"), + model.value().get(0).properties().errors().get(0).creationTime()); + Assertions.assertEquals("wxdzaumweoohgu", model.value().get(0).properties().errors().get(0).taskId()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-11-15T06:45:30Z"), model.value().get(0).properties().startTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-02-14T10:50:47Z"), model.value().get(0).properties().endTime()); + Assertions.assertEquals("ijaeukm", model.value().get(0).properties().allowedActions().get(0)); + Assertions.assertEquals("ieekpndzaa", model.value().get(0).properties().targetObjectId()); + Assertions.assertEquals("udqmeqwigpibudq", model.value().get(0).properties().targetObjectName()); + Assertions.assertEquals("xebeybpmz", model.value().get(0).properties().targetInstanceType()); + Assertions + .assertEquals("ff", model.value().get(0).properties().customDetails().affectedObjectDetails().get("aqi")); + Assertions.assertEquals("fuqyrxpdlcgqlsi", model.value().get(0).location()); + Assertions.assertEquals("jwogqqnobpudc", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobDetailsTests.java new file mode 100644 index 000000000000..53ea8feee881 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobDetailsTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobDetails; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class JobDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JobDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"JobDetails\",\"affectedObjectDetails\":{\"jwpfilkm\":\"qlafcbahhpzpofoi\",\"dviauogp\":\"kholvd\",\"kyefchnmnahmnxhk\":\"uartvti\",\"ooxf\":\"jqirwrw\"}}") + .toObject(JobDetails.class); + Assertions.assertEquals("qlafcbahhpzpofoi", model.affectedObjectDetails().get("jwpfilkm")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JobDetails model = + new JobDetails() + .withAffectedObjectDetails( + mapOf( + "jwpfilkm", + "qlafcbahhpzpofoi", + "dviauogp", + "kholvd", + "kyefchnmnahmnxhk", + "uartvti", + "ooxf", + "jqirwrw")); + model = BinaryData.fromObject(model).toObject(JobDetails.class); + Assertions.assertEquals("qlafcbahhpzpofoi", model.affectedObjectDetails().get("jwpfilkm")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobEntityTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobEntityTests.java new file mode 100644 index 000000000000..b11c328c008a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobEntityTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobEntity; +import org.junit.jupiter.api.Assertions; + +public final class JobEntityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JobEntity model = + BinaryData + .fromString( + "{\"jobId\":\"xpno\",\"jobFriendlyName\":\"oanfbcswqagyw\",\"targetObjectId\":\"xigvjrktpgaeuk\",\"targetObjectName\":\"wohpmwhqnucs\",\"targetInstanceType\":\"hsidsjtdlpbnin\",\"jobScenarioName\":\"azlsvbzfcpuo\"}") + .toObject(JobEntity.class); + Assertions.assertEquals("xpno", model.jobId()); + Assertions.assertEquals("oanfbcswqagyw", model.jobFriendlyName()); + Assertions.assertEquals("xigvjrktpgaeuk", model.targetObjectId()); + Assertions.assertEquals("wohpmwhqnucs", model.targetObjectName()); + Assertions.assertEquals("hsidsjtdlpbnin", model.targetInstanceType()); + Assertions.assertEquals("azlsvbzfcpuo", model.jobScenarioName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JobEntity model = + new JobEntity() + .withJobId("xpno") + .withJobFriendlyName("oanfbcswqagyw") + .withTargetObjectId("xigvjrktpgaeuk") + .withTargetObjectName("wohpmwhqnucs") + .withTargetInstanceType("hsidsjtdlpbnin") + .withJobScenarioName("azlsvbzfcpuo"); + model = BinaryData.fromObject(model).toObject(JobEntity.class); + Assertions.assertEquals("xpno", model.jobId()); + Assertions.assertEquals("oanfbcswqagyw", model.jobFriendlyName()); + Assertions.assertEquals("xigvjrktpgaeuk", model.targetObjectId()); + Assertions.assertEquals("wohpmwhqnucs", model.targetObjectName()); + Assertions.assertEquals("hsidsjtdlpbnin", model.targetInstanceType()); + Assertions.assertEquals("azlsvbzfcpuo", model.jobScenarioName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobQueryParameterTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobQueryParameterTests.java new file mode 100644 index 000000000000..742e34049d53 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobQueryParameterTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExportJobOutputSerializationType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobQueryParameter; +import org.junit.jupiter.api.Assertions; + +public final class JobQueryParameterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JobQueryParameter model = + BinaryData + .fromString( + "{\"startTime\":\"amhsycxhxzgazt\",\"endTime\":\"boi\",\"fabricId\":\"mfqhppubowse\",\"affectedObjectTypes\":\"fgkmtdhern\",\"jobStatus\":\"tcjuahokqto\",\"jobOutputType\":\"Excel\",\"jobName\":\"xof\",\"timezoneOffset\":37.56433108394144}") + .toObject(JobQueryParameter.class); + Assertions.assertEquals("amhsycxhxzgazt", model.startTime()); + Assertions.assertEquals("boi", model.endTime()); + Assertions.assertEquals("mfqhppubowse", model.fabricId()); + Assertions.assertEquals("fgkmtdhern", model.affectedObjectTypes()); + Assertions.assertEquals("tcjuahokqto", model.jobStatus()); + Assertions.assertEquals(ExportJobOutputSerializationType.EXCEL, model.jobOutputType()); + Assertions.assertEquals("xof", model.jobName()); + Assertions.assertEquals(37.56433108394144D, model.timezoneOffset()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JobQueryParameter model = + new JobQueryParameter() + .withStartTime("amhsycxhxzgazt") + .withEndTime("boi") + .withFabricId("mfqhppubowse") + .withAffectedObjectTypes("fgkmtdhern") + .withJobStatus("tcjuahokqto") + .withJobOutputType(ExportJobOutputSerializationType.EXCEL) + .withJobName("xof") + .withTimezoneOffset(37.56433108394144D); + model = BinaryData.fromObject(model).toObject(JobQueryParameter.class); + Assertions.assertEquals("amhsycxhxzgazt", model.startTime()); + Assertions.assertEquals("boi", model.endTime()); + Assertions.assertEquals("mfqhppubowse", model.fabricId()); + Assertions.assertEquals("fgkmtdhern", model.affectedObjectTypes()); + Assertions.assertEquals("tcjuahokqto", model.jobStatus()); + Assertions.assertEquals(ExportJobOutputSerializationType.EXCEL, model.jobOutputType()); + Assertions.assertEquals("xof", model.jobName()); + Assertions.assertEquals(37.56433108394144D, model.timezoneOffset()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobStatusEventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobStatusEventDetailsTests.java new file mode 100644 index 000000000000..3a8d578b3077 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobStatusEventDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobStatusEventDetails; +import org.junit.jupiter.api.Assertions; + +public final class JobStatusEventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JobStatusEventDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"JobStatus\",\"jobId\":\"wkaupwhlz\",\"jobFriendlyName\":\"kremgjl\",\"jobStatus\":\"vdorsirx\",\"affectedObjectType\":\"yrkqa\"}") + .toObject(JobStatusEventDetails.class); + Assertions.assertEquals("wkaupwhlz", model.jobId()); + Assertions.assertEquals("kremgjl", model.jobFriendlyName()); + Assertions.assertEquals("vdorsirx", model.jobStatus()); + Assertions.assertEquals("yrkqa", model.affectedObjectType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JobStatusEventDetails model = + new JobStatusEventDetails() + .withJobId("wkaupwhlz") + .withJobFriendlyName("kremgjl") + .withJobStatus("vdorsirx") + .withAffectedObjectType("yrkqa"); + model = BinaryData.fromObject(model).toObject(JobStatusEventDetails.class); + Assertions.assertEquals("wkaupwhlz", model.jobId()); + Assertions.assertEquals("kremgjl", model.jobFriendlyName()); + Assertions.assertEquals("vdorsirx", model.jobStatus()); + Assertions.assertEquals("yrkqa", model.affectedObjectType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobTaskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobTaskDetailsTests.java new file mode 100644 index 000000000000..d1e056597f3a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/JobTaskDetailsTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobEntity; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobTaskDetails; +import org.junit.jupiter.api.Assertions; + +public final class JobTaskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + JobTaskDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"JobTaskDetails\",\"jobTask\":{\"jobId\":\"wwmjs\",\"jobFriendlyName\":\"na\",\"targetObjectId\":\"amecle\",\"targetObjectName\":\"oulndhzyoeojhto\",\"targetInstanceType\":\"h\",\"jobScenarioName\":\"idmytzln\"}}") + .toObject(JobTaskDetails.class); + Assertions.assertEquals("wwmjs", model.jobTask().jobId()); + Assertions.assertEquals("na", model.jobTask().jobFriendlyName()); + Assertions.assertEquals("amecle", model.jobTask().targetObjectId()); + Assertions.assertEquals("oulndhzyoeojhto", model.jobTask().targetObjectName()); + Assertions.assertEquals("h", model.jobTask().targetInstanceType()); + Assertions.assertEquals("idmytzln", model.jobTask().jobScenarioName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + JobTaskDetails model = + new JobTaskDetails() + .withJobTask( + new JobEntity() + .withJobId("wwmjs") + .withJobFriendlyName("na") + .withTargetObjectId("amecle") + .withTargetObjectName("oulndhzyoeojhto") + .withTargetInstanceType("h") + .withJobScenarioName("idmytzln")); + model = BinaryData.fromObject(model).toObject(JobTaskDetails.class); + Assertions.assertEquals("wwmjs", model.jobTask().jobId()); + Assertions.assertEquals("na", model.jobTask().jobFriendlyName()); + Assertions.assertEquals("amecle", model.jobTask().targetObjectId()); + Assertions.assertEquals("oulndhzyoeojhto", model.jobTask().targetObjectName()); + Assertions.assertEquals("h", model.jobTask().targetInstanceType()); + Assertions.assertEquals("idmytzln", model.jobTask().jobScenarioName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/LogicalNetworkCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/LogicalNetworkCollectionTests.java new file mode 100644 index 000000000000..d557742f8ba7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/LogicalNetworkCollectionTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.LogicalNetworkInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LogicalNetworkCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LogicalNetworkProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class LogicalNetworkCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogicalNetworkCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"friendlyName\":\"j\",\"networkVirtualizationStatus\":\"dxob\",\"logicalNetworkUsage\":\"dxkqpx\",\"logicalNetworkDefinitionsStatus\":\"ajionpimexgstxg\"},\"location\":\"odgmaajrmvdjwz\",\"id\":\"lovmclwhijcoe\",\"name\":\"ctbzaq\",\"type\":\"qsycbkbfkgu\"}],\"nextLink\":\"kexxppof\"}") + .toObject(LogicalNetworkCollection.class); + Assertions.assertEquals("j", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("dxob", model.value().get(0).properties().networkVirtualizationStatus()); + Assertions.assertEquals("dxkqpx", model.value().get(0).properties().logicalNetworkUsage()); + Assertions.assertEquals("ajionpimexgstxg", model.value().get(0).properties().logicalNetworkDefinitionsStatus()); + Assertions.assertEquals("odgmaajrmvdjwz", model.value().get(0).location()); + Assertions.assertEquals("kexxppof", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogicalNetworkCollection model = + new LogicalNetworkCollection() + .withValue( + Arrays + .asList( + new LogicalNetworkInner() + .withProperties( + new LogicalNetworkProperties() + .withFriendlyName("j") + .withNetworkVirtualizationStatus("dxob") + .withLogicalNetworkUsage("dxkqpx") + .withLogicalNetworkDefinitionsStatus("ajionpimexgstxg")) + .withLocation("odgmaajrmvdjwz"))) + .withNextLink("kexxppof"); + model = BinaryData.fromObject(model).toObject(LogicalNetworkCollection.class); + Assertions.assertEquals("j", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("dxob", model.value().get(0).properties().networkVirtualizationStatus()); + Assertions.assertEquals("dxkqpx", model.value().get(0).properties().logicalNetworkUsage()); + Assertions.assertEquals("ajionpimexgstxg", model.value().get(0).properties().logicalNetworkDefinitionsStatus()); + Assertions.assertEquals("odgmaajrmvdjwz", model.value().get(0).location()); + Assertions.assertEquals("kexxppof", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/LogicalNetworkInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/LogicalNetworkInnerTests.java new file mode 100644 index 000000000000..8a6f20d840f0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/LogicalNetworkInnerTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.LogicalNetworkInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LogicalNetworkProperties; +import org.junit.jupiter.api.Assertions; + +public final class LogicalNetworkInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogicalNetworkInner model = + BinaryData + .fromString( + "{\"properties\":{\"friendlyName\":\"x\",\"networkVirtualizationStatus\":\"jpgd\",\"logicalNetworkUsage\":\"ocjjxhvpmouexh\",\"logicalNetworkDefinitionsStatus\":\"xibqeojnx\"},\"location\":\"zvddntwndeicbtwn\",\"id\":\"zao\",\"name\":\"vuhrhcffcyddgl\",\"type\":\"jthjqkwpyei\"}") + .toObject(LogicalNetworkInner.class); + Assertions.assertEquals("x", model.properties().friendlyName()); + Assertions.assertEquals("jpgd", model.properties().networkVirtualizationStatus()); + Assertions.assertEquals("ocjjxhvpmouexh", model.properties().logicalNetworkUsage()); + Assertions.assertEquals("xibqeojnx", model.properties().logicalNetworkDefinitionsStatus()); + Assertions.assertEquals("zvddntwndeicbtwn", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogicalNetworkInner model = + new LogicalNetworkInner() + .withProperties( + new LogicalNetworkProperties() + .withFriendlyName("x") + .withNetworkVirtualizationStatus("jpgd") + .withLogicalNetworkUsage("ocjjxhvpmouexh") + .withLogicalNetworkDefinitionsStatus("xibqeojnx")) + .withLocation("zvddntwndeicbtwn"); + model = BinaryData.fromObject(model).toObject(LogicalNetworkInner.class); + Assertions.assertEquals("x", model.properties().friendlyName()); + Assertions.assertEquals("jpgd", model.properties().networkVirtualizationStatus()); + Assertions.assertEquals("ocjjxhvpmouexh", model.properties().logicalNetworkUsage()); + Assertions.assertEquals("xibqeojnx", model.properties().logicalNetworkDefinitionsStatus()); + Assertions.assertEquals("zvddntwndeicbtwn", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/LogicalNetworkPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/LogicalNetworkPropertiesTests.java new file mode 100644 index 000000000000..94c3c040b5c9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/LogicalNetworkPropertiesTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LogicalNetworkProperties; +import org.junit.jupiter.api.Assertions; + +public final class LogicalNetworkPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogicalNetworkProperties model = + BinaryData + .fromString( + "{\"friendlyName\":\"mqc\",\"networkVirtualizationStatus\":\"q\",\"logicalNetworkUsage\":\"khixuigdtopbo\",\"logicalNetworkDefinitionsStatus\":\"og\"}") + .toObject(LogicalNetworkProperties.class); + Assertions.assertEquals("mqc", model.friendlyName()); + Assertions.assertEquals("q", model.networkVirtualizationStatus()); + Assertions.assertEquals("khixuigdtopbo", model.logicalNetworkUsage()); + Assertions.assertEquals("og", model.logicalNetworkDefinitionsStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogicalNetworkProperties model = + new LogicalNetworkProperties() + .withFriendlyName("mqc") + .withNetworkVirtualizationStatus("q") + .withLogicalNetworkUsage("khixuigdtopbo") + .withLogicalNetworkDefinitionsStatus("og"); + model = BinaryData.fromObject(model).toObject(LogicalNetworkProperties.class); + Assertions.assertEquals("mqc", model.friendlyName()); + Assertions.assertEquals("q", model.networkVirtualizationStatus()); + Assertions.assertEquals("khixuigdtopbo", model.logicalNetworkUsage()); + Assertions.assertEquals("og", model.logicalNetworkDefinitionsStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ManualActionTaskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ManualActionTaskDetailsTests.java new file mode 100644 index 000000000000..ae7a01de0871 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ManualActionTaskDetailsTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ManualActionTaskDetails; +import org.junit.jupiter.api.Assertions; + +public final class ManualActionTaskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManualActionTaskDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"ManualActionTaskDetails\",\"name\":\"fajfreprfvmki\",\"instructions\":\"teyrqshi\",\"observation\":\"cejo\"}") + .toObject(ManualActionTaskDetails.class); + Assertions.assertEquals("fajfreprfvmki", model.name()); + Assertions.assertEquals("teyrqshi", model.instructions()); + Assertions.assertEquals("cejo", model.observation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManualActionTaskDetails model = + new ManualActionTaskDetails() + .withName("fajfreprfvmki") + .withInstructions("teyrqshi") + .withObservation("cejo"); + model = BinaryData.fromObject(model).toObject(ManualActionTaskDetails.class); + Assertions.assertEquals("fajfreprfvmki", model.name()); + Assertions.assertEquals("teyrqshi", model.instructions()); + Assertions.assertEquals("cejo", model.observation()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrateInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrateInputPropertiesTests.java new file mode 100644 index 000000000000..35e66efddf7f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrateInputPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrateInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrateProviderSpecificInput; + +public final class MigrateInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MigrateInputProperties model = + BinaryData + .fromString("{\"providerSpecificDetails\":{\"instanceType\":\"MigrateProviderSpecificInput\"}}") + .toObject(MigrateInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MigrateInputProperties model = + new MigrateInputProperties().withProviderSpecificDetails(new MigrateProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(MigrateInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrateInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrateInputTests.java new file mode 100644 index 000000000000..623195c0ecdf --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrateInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrateInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrateInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrateProviderSpecificInput; + +public final class MigrateInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MigrateInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"MigrateProviderSpecificInput\"}}}") + .toObject(MigrateInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MigrateInput model = + new MigrateInput() + .withProperties( + new MigrateInputProperties().withProviderSpecificDetails(new MigrateProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(MigrateInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrateProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrateProviderSpecificInputTests.java new file mode 100644 index 000000000000..0fa0824a917b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrateProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrateProviderSpecificInput; + +public final class MigrateProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MigrateProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"MigrateProviderSpecificInput\"}") + .toObject(MigrateProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MigrateProviderSpecificInput model = new MigrateProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(MigrateProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationProviderSpecificSettingsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationProviderSpecificSettingsTests.java new file mode 100644 index 000000000000..fd37f824a93b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationProviderSpecificSettingsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrationProviderSpecificSettings; + +public final class MigrationProviderSpecificSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MigrationProviderSpecificSettings model = + BinaryData + .fromString("{\"instanceType\":\"MigrationProviderSpecificSettings\"}") + .toObject(MigrationProviderSpecificSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MigrationProviderSpecificSettings model = new MigrationProviderSpecificSettings(); + model = BinaryData.fromObject(model).toObject(MigrationProviderSpecificSettings.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointCollectionTests.java new file mode 100644 index 000000000000..79d5ee070458 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointCollectionTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.MigrationRecoveryPointInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrationRecoveryPointCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MigrationRecoveryPointCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MigrationRecoveryPointCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"recoveryPointTime\":\"2021-08-18T20:27:18Z\",\"recoveryPointType\":\"ApplicationConsistent\"},\"location\":\"htxongmtsavjc\",\"id\":\"pwxqp\",\"name\":\"rknftguvriuhprwm\",\"type\":\"yvxqtayriwwroy\"},{\"properties\":{\"recoveryPointTime\":\"2021-11-30T11:12:46Z\",\"recoveryPointType\":\"NotSpecified\"},\"location\":\"qibycnojvknm\",\"id\":\"fqsgzvahapjy\",\"name\":\"hpvgqz\",\"type\":\"j\"},{\"properties\":{\"recoveryPointTime\":\"2021-04-03T19:52:37Z\",\"recoveryPointType\":\"NotSpecified\"},\"location\":\"mwlxk\",\"id\":\"ug\",\"name\":\"hzovawjvzunlut\",\"type\":\"nnprn\"}],\"nextLink\":\"peilpjzuaejxdu\"}") + .toObject(MigrationRecoveryPointCollection.class); + Assertions.assertEquals("htxongmtsavjc", model.value().get(0).location()); + Assertions.assertEquals("peilpjzuaejxdu", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MigrationRecoveryPointCollection model = + new MigrationRecoveryPointCollection() + .withValue( + Arrays + .asList( + new MigrationRecoveryPointInner() + .withProperties(new MigrationRecoveryPointProperties()) + .withLocation("htxongmtsavjc"), + new MigrationRecoveryPointInner() + .withProperties(new MigrationRecoveryPointProperties()) + .withLocation("qibycnojvknm"), + new MigrationRecoveryPointInner() + .withProperties(new MigrationRecoveryPointProperties()) + .withLocation("mwlxk"))) + .withNextLink("peilpjzuaejxdu"); + model = BinaryData.fromObject(model).toObject(MigrationRecoveryPointCollection.class); + Assertions.assertEquals("htxongmtsavjc", model.value().get(0).location()); + Assertions.assertEquals("peilpjzuaejxdu", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointInnerTests.java new file mode 100644 index 000000000000..0786df08ddd3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointInnerTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.MigrationRecoveryPointInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties; +import org.junit.jupiter.api.Assertions; + +public final class MigrationRecoveryPointInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MigrationRecoveryPointInner model = + BinaryData + .fromString( + "{\"properties\":{\"recoveryPointTime\":\"2021-03-19T18:16:56Z\",\"recoveryPointType\":\"NotSpecified\"},\"location\":\"tdzumveekgpw\",\"id\":\"zuhkfpbsjyof\",\"name\":\"xl\",\"type\":\"us\"}") + .toObject(MigrationRecoveryPointInner.class); + Assertions.assertEquals("tdzumveekgpw", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MigrationRecoveryPointInner model = + new MigrationRecoveryPointInner() + .withProperties(new MigrationRecoveryPointProperties()) + .withLocation("tdzumveekgpw"); + model = BinaryData.fromObject(model).toObject(MigrationRecoveryPointInner.class); + Assertions.assertEquals("tdzumveekgpw", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointPropertiesTests.java new file mode 100644 index 000000000000..975d6de0d1fb --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointPropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrationRecoveryPointProperties; + +public final class MigrationRecoveryPointPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MigrationRecoveryPointProperties model = + BinaryData + .fromString( + "{\"recoveryPointTime\":\"2021-04-08T00:20:33Z\",\"recoveryPointType\":\"ApplicationConsistent\"}") + .toObject(MigrationRecoveryPointProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MigrationRecoveryPointProperties model = new MigrationRecoveryPointProperties(); + model = BinaryData.fromObject(model).toObject(MigrationRecoveryPointProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsGetWithResponseMockTests.java new file mode 100644 index 000000000000..35d1edad032b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MigrationRecoveryPointsGetWithResponseMockTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MigrationRecoveryPoint; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MigrationRecoveryPointsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"recoveryPointTime\":\"2021-05-17T00:20:24Z\",\"recoveryPointType\":\"ApplicationConsistent\"},\"location\":\"hlsfjfouqjpzhea\",\"id\":\"uvkqxqkvadmj\",\"name\":\"ymudj\",\"type\":\"aajzdebhsermcl\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + MigrationRecoveryPoint response = + manager + .migrationRecoveryPoints() + .getWithResponse( + "bfb", + "divixzhpjgqzmiao", + "weacfxaubu", + "ruetcnx", + "iqzzdckhsqdrrjsu", + "nowobwx", + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("hlsfjfouqjpzhea", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MobilityServiceUpdateTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MobilityServiceUpdateTests.java new file mode 100644 index 000000000000..e0e6fd9a7a55 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/MobilityServiceUpdateTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MobilityServiceUpdate; +import org.junit.jupiter.api.Assertions; + +public final class MobilityServiceUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MobilityServiceUpdate model = + BinaryData + .fromString("{\"version\":\"cdsgxceluji\",\"rebootStatus\":\"lluunxh\",\"osType\":\"lfxzfwuge\"}") + .toObject(MobilityServiceUpdate.class); + Assertions.assertEquals("cdsgxceluji", model.version()); + Assertions.assertEquals("lluunxh", model.rebootStatus()); + Assertions.assertEquals("lfxzfwuge", model.osType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MobilityServiceUpdate model = + new MobilityServiceUpdate().withVersion("cdsgxceluji").withRebootStatus("lluunxh").withOsType("lfxzfwuge"); + model = BinaryData.fromObject(model).toObject(MobilityServiceUpdate.class); + Assertions.assertEquals("cdsgxceluji", model.version()); + Assertions.assertEquals("lluunxh", model.rebootStatus()); + Assertions.assertEquals("lfxzfwuge", model.osType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkCollectionTests.java new file mode 100644 index 000000000000..f11ae3c3c861 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkCollectionTests.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.NetworkInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Subnet; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class NetworkCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"fabricType\":\"a\",\"subnets\":[{\"name\":\"rzayv\",\"friendlyName\":\"pgvdf\",\"addressList\":[\"tkftutqxlngx\",\"efgugnxk\",\"xdqmidtthzrvqdra\",\"hjybigehoqfbo\"]},{\"name\":\"kanyktzlcuiywg\",\"friendlyName\":\"wgndrvynhzgpp\",\"addressList\":[\"gyncocpecfvmmc\",\"ofsx\",\"zevgb\"]},{\"name\":\"jqabcypmivkwlzuv\",\"friendlyName\":\"fwnfnb\",\"addressList\":[\"ionle\",\"x\"]}],\"friendlyName\":\"qgtz\",\"networkType\":\"pnqbqqwxrjfe\"},\"location\":\"lnwsubisn\",\"id\":\"ampmngnz\",\"name\":\"c\",\"type\":\"aqw\"}],\"nextLink\":\"chcbonqvpkvlrxnj\"}") + .toObject(NetworkCollection.class); + Assertions.assertEquals("a", model.value().get(0).properties().fabricType()); + Assertions.assertEquals("rzayv", model.value().get(0).properties().subnets().get(0).name()); + Assertions.assertEquals("pgvdf", model.value().get(0).properties().subnets().get(0).friendlyName()); + Assertions + .assertEquals("tkftutqxlngx", model.value().get(0).properties().subnets().get(0).addressList().get(0)); + Assertions.assertEquals("qgtz", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("pnqbqqwxrjfe", model.value().get(0).properties().networkType()); + Assertions.assertEquals("lnwsubisn", model.value().get(0).location()); + Assertions.assertEquals("chcbonqvpkvlrxnj", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkCollection model = + new NetworkCollection() + .withValue( + Arrays + .asList( + new NetworkInner() + .withProperties( + new NetworkProperties() + .withFabricType("a") + .withSubnets( + Arrays + .asList( + new Subnet() + .withName("rzayv") + .withFriendlyName("pgvdf") + .withAddressList( + Arrays + .asList( + "tkftutqxlngx", + "efgugnxk", + "xdqmidtthzrvqdra", + "hjybigehoqfbo")), + new Subnet() + .withName("kanyktzlcuiywg") + .withFriendlyName("wgndrvynhzgpp") + .withAddressList( + Arrays.asList("gyncocpecfvmmc", "ofsx", "zevgb")), + new Subnet() + .withName("jqabcypmivkwlzuv") + .withFriendlyName("fwnfnb") + .withAddressList(Arrays.asList("ionle", "x")))) + .withFriendlyName("qgtz") + .withNetworkType("pnqbqqwxrjfe")) + .withLocation("lnwsubisn"))) + .withNextLink("chcbonqvpkvlrxnj"); + model = BinaryData.fromObject(model).toObject(NetworkCollection.class); + Assertions.assertEquals("a", model.value().get(0).properties().fabricType()); + Assertions.assertEquals("rzayv", model.value().get(0).properties().subnets().get(0).name()); + Assertions.assertEquals("pgvdf", model.value().get(0).properties().subnets().get(0).friendlyName()); + Assertions + .assertEquals("tkftutqxlngx", model.value().get(0).properties().subnets().get(0).addressList().get(0)); + Assertions.assertEquals("qgtz", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("pnqbqqwxrjfe", model.value().get(0).properties().networkType()); + Assertions.assertEquals("lnwsubisn", model.value().get(0).location()); + Assertions.assertEquals("chcbonqvpkvlrxnj", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkInnerTests.java new file mode 100644 index 000000000000..5adce1b41910 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkInnerTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.NetworkInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Subnet; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class NetworkInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkInner model = + BinaryData + .fromString( + "{\"properties\":{\"fabricType\":\"eipheoflokeyy\",\"subnets\":[{\"name\":\"bdlwtgrhpdjpj\",\"friendlyName\":\"asxazjpqyegualhb\",\"addressList\":[\"e\",\"jzzvdud\"]}],\"friendlyName\":\"dslfhotwmcy\",\"networkType\":\"wlbjnpgacftade\"},\"location\":\"nltyfsoppusuesnz\",\"id\":\"dejbavo\",\"name\":\"xzdmohctb\",\"type\":\"vudwx\"}") + .toObject(NetworkInner.class); + Assertions.assertEquals("eipheoflokeyy", model.properties().fabricType()); + Assertions.assertEquals("bdlwtgrhpdjpj", model.properties().subnets().get(0).name()); + Assertions.assertEquals("asxazjpqyegualhb", model.properties().subnets().get(0).friendlyName()); + Assertions.assertEquals("e", model.properties().subnets().get(0).addressList().get(0)); + Assertions.assertEquals("dslfhotwmcy", model.properties().friendlyName()); + Assertions.assertEquals("wlbjnpgacftade", model.properties().networkType()); + Assertions.assertEquals("nltyfsoppusuesnz", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkInner model = + new NetworkInner() + .withProperties( + new NetworkProperties() + .withFabricType("eipheoflokeyy") + .withSubnets( + Arrays + .asList( + new Subnet() + .withName("bdlwtgrhpdjpj") + .withFriendlyName("asxazjpqyegualhb") + .withAddressList(Arrays.asList("e", "jzzvdud")))) + .withFriendlyName("dslfhotwmcy") + .withNetworkType("wlbjnpgacftade")) + .withLocation("nltyfsoppusuesnz"); + model = BinaryData.fromObject(model).toObject(NetworkInner.class); + Assertions.assertEquals("eipheoflokeyy", model.properties().fabricType()); + Assertions.assertEquals("bdlwtgrhpdjpj", model.properties().subnets().get(0).name()); + Assertions.assertEquals("asxazjpqyegualhb", model.properties().subnets().get(0).friendlyName()); + Assertions.assertEquals("e", model.properties().subnets().get(0).addressList().get(0)); + Assertions.assertEquals("dslfhotwmcy", model.properties().friendlyName()); + Assertions.assertEquals("wlbjnpgacftade", model.properties().networkType()); + Assertions.assertEquals("nltyfsoppusuesnz", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingCollectionTests.java new file mode 100644 index 000000000000..7b71b9877918 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingCollectionTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.NetworkMappingInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMappingCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMappingProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class NetworkMappingCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkMappingCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"state\":\"yiuokktwh\",\"primaryNetworkFriendlyName\":\"xw\",\"primaryNetworkId\":\"wqsmbsur\",\"primaryFabricFriendlyName\":\"imoryocfsfksym\",\"recoveryNetworkFriendlyName\":\"ys\",\"recoveryNetworkId\":\"i\",\"recoveryFabricArmId\":\"xhqyudxorrqnb\",\"recoveryFabricFriendlyName\":\"czvyifq\",\"fabricSpecificSettings\":{\"instanceType\":\"NetworkMappingFabricSpecificSettings\"}},\"location\":\"dvjsllrmvvdf\",\"id\":\"atkpnp\",\"name\":\"lexxbczwtru\",\"type\":\"iqzbq\"}],\"nextLink\":\"sovmyokacspkwl\"}") + .toObject(NetworkMappingCollection.class); + Assertions.assertEquals("yiuokktwh", model.value().get(0).properties().state()); + Assertions.assertEquals("xw", model.value().get(0).properties().primaryNetworkFriendlyName()); + Assertions.assertEquals("wqsmbsur", model.value().get(0).properties().primaryNetworkId()); + Assertions.assertEquals("imoryocfsfksym", model.value().get(0).properties().primaryFabricFriendlyName()); + Assertions.assertEquals("ys", model.value().get(0).properties().recoveryNetworkFriendlyName()); + Assertions.assertEquals("i", model.value().get(0).properties().recoveryNetworkId()); + Assertions.assertEquals("xhqyudxorrqnb", model.value().get(0).properties().recoveryFabricArmId()); + Assertions.assertEquals("czvyifq", model.value().get(0).properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("dvjsllrmvvdf", model.value().get(0).location()); + Assertions.assertEquals("sovmyokacspkwl", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkMappingCollection model = + new NetworkMappingCollection() + .withValue( + Arrays + .asList( + new NetworkMappingInner() + .withProperties( + new NetworkMappingProperties() + .withState("yiuokktwh") + .withPrimaryNetworkFriendlyName("xw") + .withPrimaryNetworkId("wqsmbsur") + .withPrimaryFabricFriendlyName("imoryocfsfksym") + .withRecoveryNetworkFriendlyName("ys") + .withRecoveryNetworkId("i") + .withRecoveryFabricArmId("xhqyudxorrqnb") + .withRecoveryFabricFriendlyName("czvyifq") + .withFabricSpecificSettings(new NetworkMappingFabricSpecificSettings())) + .withLocation("dvjsllrmvvdf"))) + .withNextLink("sovmyokacspkwl"); + model = BinaryData.fromObject(model).toObject(NetworkMappingCollection.class); + Assertions.assertEquals("yiuokktwh", model.value().get(0).properties().state()); + Assertions.assertEquals("xw", model.value().get(0).properties().primaryNetworkFriendlyName()); + Assertions.assertEquals("wqsmbsur", model.value().get(0).properties().primaryNetworkId()); + Assertions.assertEquals("imoryocfsfksym", model.value().get(0).properties().primaryFabricFriendlyName()); + Assertions.assertEquals("ys", model.value().get(0).properties().recoveryNetworkFriendlyName()); + Assertions.assertEquals("i", model.value().get(0).properties().recoveryNetworkId()); + Assertions.assertEquals("xhqyudxorrqnb", model.value().get(0).properties().recoveryFabricArmId()); + Assertions.assertEquals("czvyifq", model.value().get(0).properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("dvjsllrmvvdf", model.value().get(0).location()); + Assertions.assertEquals("sovmyokacspkwl", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingFabricSpecificSettingsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingFabricSpecificSettingsTests.java new file mode 100644 index 000000000000..cdb8bd875155 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingFabricSpecificSettingsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings; + +public final class NetworkMappingFabricSpecificSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkMappingFabricSpecificSettings model = + BinaryData + .fromString("{\"instanceType\":\"NetworkMappingFabricSpecificSettings\"}") + .toObject(NetworkMappingFabricSpecificSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkMappingFabricSpecificSettings model = new NetworkMappingFabricSpecificSettings(); + model = BinaryData.fromObject(model).toObject(NetworkMappingFabricSpecificSettings.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingInnerTests.java new file mode 100644 index 000000000000..9f3dc1d1a193 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingInnerTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.NetworkMappingInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMappingProperties; +import org.junit.jupiter.api.Assertions; + +public final class NetworkMappingInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkMappingInner model = + BinaryData + .fromString( + "{\"properties\":{\"state\":\"obpxjmflbvvn\",\"primaryNetworkFriendlyName\":\"rkcciwwzjuqk\",\"primaryNetworkId\":\"sa\",\"primaryFabricFriendlyName\":\"wkuofoskghsauu\",\"recoveryNetworkFriendlyName\":\"jmvxie\",\"recoveryNetworkId\":\"ugidyjrr\",\"recoveryFabricArmId\":\"y\",\"recoveryFabricFriendlyName\":\"svexcsonpclhoco\",\"fabricSpecificSettings\":{\"instanceType\":\"NetworkMappingFabricSpecificSettings\"}},\"location\":\"kevle\",\"id\":\"gz\",\"name\":\"buhfmvfaxkffeiit\",\"type\":\"lvmezyvshxmzsbbz\"}") + .toObject(NetworkMappingInner.class); + Assertions.assertEquals("obpxjmflbvvn", model.properties().state()); + Assertions.assertEquals("rkcciwwzjuqk", model.properties().primaryNetworkFriendlyName()); + Assertions.assertEquals("sa", model.properties().primaryNetworkId()); + Assertions.assertEquals("wkuofoskghsauu", model.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("jmvxie", model.properties().recoveryNetworkFriendlyName()); + Assertions.assertEquals("ugidyjrr", model.properties().recoveryNetworkId()); + Assertions.assertEquals("y", model.properties().recoveryFabricArmId()); + Assertions.assertEquals("svexcsonpclhoco", model.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("kevle", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkMappingInner model = + new NetworkMappingInner() + .withProperties( + new NetworkMappingProperties() + .withState("obpxjmflbvvn") + .withPrimaryNetworkFriendlyName("rkcciwwzjuqk") + .withPrimaryNetworkId("sa") + .withPrimaryFabricFriendlyName("wkuofoskghsauu") + .withRecoveryNetworkFriendlyName("jmvxie") + .withRecoveryNetworkId("ugidyjrr") + .withRecoveryFabricArmId("y") + .withRecoveryFabricFriendlyName("svexcsonpclhoco") + .withFabricSpecificSettings(new NetworkMappingFabricSpecificSettings())) + .withLocation("kevle"); + model = BinaryData.fromObject(model).toObject(NetworkMappingInner.class); + Assertions.assertEquals("obpxjmflbvvn", model.properties().state()); + Assertions.assertEquals("rkcciwwzjuqk", model.properties().primaryNetworkFriendlyName()); + Assertions.assertEquals("sa", model.properties().primaryNetworkId()); + Assertions.assertEquals("wkuofoskghsauu", model.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("jmvxie", model.properties().recoveryNetworkFriendlyName()); + Assertions.assertEquals("ugidyjrr", model.properties().recoveryNetworkId()); + Assertions.assertEquals("y", model.properties().recoveryFabricArmId()); + Assertions.assertEquals("svexcsonpclhoco", model.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("kevle", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingPropertiesTests.java new file mode 100644 index 000000000000..393817821052 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkMappingPropertiesTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMappingFabricSpecificSettings; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMappingProperties; +import org.junit.jupiter.api.Assertions; + +public final class NetworkMappingPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkMappingProperties model = + BinaryData + .fromString( + "{\"state\":\"gigr\",\"primaryNetworkFriendlyName\":\"burvjxxjnspy\",\"primaryNetworkId\":\"tko\",\"primaryFabricFriendlyName\":\"kouknvudwtiu\",\"recoveryNetworkFriendlyName\":\"ldngkpoci\",\"recoveryNetworkId\":\"z\",\"recoveryFabricArmId\":\"o\",\"recoveryFabricFriendlyName\":\"ukgjnpiucgygevq\",\"fabricSpecificSettings\":{\"instanceType\":\"NetworkMappingFabricSpecificSettings\"}}") + .toObject(NetworkMappingProperties.class); + Assertions.assertEquals("gigr", model.state()); + Assertions.assertEquals("burvjxxjnspy", model.primaryNetworkFriendlyName()); + Assertions.assertEquals("tko", model.primaryNetworkId()); + Assertions.assertEquals("kouknvudwtiu", model.primaryFabricFriendlyName()); + Assertions.assertEquals("ldngkpoci", model.recoveryNetworkFriendlyName()); + Assertions.assertEquals("z", model.recoveryNetworkId()); + Assertions.assertEquals("o", model.recoveryFabricArmId()); + Assertions.assertEquals("ukgjnpiucgygevq", model.recoveryFabricFriendlyName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkMappingProperties model = + new NetworkMappingProperties() + .withState("gigr") + .withPrimaryNetworkFriendlyName("burvjxxjnspy") + .withPrimaryNetworkId("tko") + .withPrimaryFabricFriendlyName("kouknvudwtiu") + .withRecoveryNetworkFriendlyName("ldngkpoci") + .withRecoveryNetworkId("z") + .withRecoveryFabricArmId("o") + .withRecoveryFabricFriendlyName("ukgjnpiucgygevq") + .withFabricSpecificSettings(new NetworkMappingFabricSpecificSettings()); + model = BinaryData.fromObject(model).toObject(NetworkMappingProperties.class); + Assertions.assertEquals("gigr", model.state()); + Assertions.assertEquals("burvjxxjnspy", model.primaryNetworkFriendlyName()); + Assertions.assertEquals("tko", model.primaryNetworkId()); + Assertions.assertEquals("kouknvudwtiu", model.primaryFabricFriendlyName()); + Assertions.assertEquals("ldngkpoci", model.recoveryNetworkFriendlyName()); + Assertions.assertEquals("z", model.recoveryNetworkId()); + Assertions.assertEquals("o", model.recoveryFabricArmId()); + Assertions.assertEquals("ukgjnpiucgygevq", model.recoveryFabricFriendlyName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkPropertiesTests.java new file mode 100644 index 000000000000..af16dcb956db --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NetworkPropertiesTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Subnet; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class NetworkPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkProperties model = + BinaryData + .fromString( + "{\"fabricType\":\"dnvowg\",\"subnets\":[{\"name\":\"gwdkcglhsl\",\"friendlyName\":\"jdyggdtji\",\"addressList\":[\"kuofqweykhme\"]},{\"name\":\"vfyexfw\",\"friendlyName\":\"bcibvyvdcsitynn\",\"addressList\":[\"dectehfiqsc\",\"eypvhezrkg\",\"hcjrefovgmk\",\"sle\"]},{\"name\":\"vxyqjpkcattpngjc\",\"friendlyName\":\"czsqpjhvm\",\"addressList\":[\"v\",\"ysou\",\"q\"]}],\"friendlyName\":\"a\",\"networkType\":\"ae\"}") + .toObject(NetworkProperties.class); + Assertions.assertEquals("dnvowg", model.fabricType()); + Assertions.assertEquals("gwdkcglhsl", model.subnets().get(0).name()); + Assertions.assertEquals("jdyggdtji", model.subnets().get(0).friendlyName()); + Assertions.assertEquals("kuofqweykhme", model.subnets().get(0).addressList().get(0)); + Assertions.assertEquals("a", model.friendlyName()); + Assertions.assertEquals("ae", model.networkType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkProperties model = + new NetworkProperties() + .withFabricType("dnvowg") + .withSubnets( + Arrays + .asList( + new Subnet() + .withName("gwdkcglhsl") + .withFriendlyName("jdyggdtji") + .withAddressList(Arrays.asList("kuofqweykhme")), + new Subnet() + .withName("vfyexfw") + .withFriendlyName("bcibvyvdcsitynn") + .withAddressList(Arrays.asList("dectehfiqsc", "eypvhezrkg", "hcjrefovgmk", "sle")), + new Subnet() + .withName("vxyqjpkcattpngjc") + .withFriendlyName("czsqpjhvm") + .withAddressList(Arrays.asList("v", "ysou", "q")))) + .withFriendlyName("a") + .withNetworkType("ae"); + model = BinaryData.fromObject(model).toObject(NetworkProperties.class); + Assertions.assertEquals("dnvowg", model.fabricType()); + Assertions.assertEquals("gwdkcglhsl", model.subnets().get(0).name()); + Assertions.assertEquals("jdyggdtji", model.subnets().get(0).friendlyName()); + Assertions.assertEquals("kuofqweykhme", model.subnets().get(0).addressList().get(0)); + Assertions.assertEquals("a", model.friendlyName()); + Assertions.assertEquals("ae", model.networkType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NewProtectionProfileTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NewProtectionProfileTests.java new file mode 100644 index 000000000000..53e04d3e1a28 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NewProtectionProfileTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NewProtectionProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SetMultiVmSyncStatus; +import org.junit.jupiter.api.Assertions; + +public final class NewProtectionProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NewProtectionProfile model = + BinaryData + .fromString( + "{\"resourceType\":\"New\",\"policyName\":\"pc\",\"recoveryPointHistory\":1754737974,\"crashConsistentFrequencyInMinutes\":381406744,\"appConsistentFrequencyInMinutes\":198630766,\"multiVmSyncStatus\":\"Enable\"}") + .toObject(NewProtectionProfile.class); + Assertions.assertEquals("pc", model.policyName()); + Assertions.assertEquals(1754737974, model.recoveryPointHistory()); + Assertions.assertEquals(381406744, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(198630766, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(SetMultiVmSyncStatus.ENABLE, model.multiVmSyncStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NewProtectionProfile model = + new NewProtectionProfile() + .withPolicyName("pc") + .withRecoveryPointHistory(1754737974) + .withCrashConsistentFrequencyInMinutes(381406744) + .withAppConsistentFrequencyInMinutes(198630766) + .withMultiVmSyncStatus(SetMultiVmSyncStatus.ENABLE); + model = BinaryData.fromObject(model).toObject(NewProtectionProfile.class); + Assertions.assertEquals("pc", model.policyName()); + Assertions.assertEquals(1754737974, model.recoveryPointHistory()); + Assertions.assertEquals(381406744, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(198630766, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(SetMultiVmSyncStatus.ENABLE, model.multiVmSyncStatus()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NewRecoveryVirtualNetworkTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NewRecoveryVirtualNetworkTests.java new file mode 100644 index 000000000000..f54ce3cd880c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/NewRecoveryVirtualNetworkTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NewRecoveryVirtualNetwork; +import org.junit.jupiter.api.Assertions; + +public final class NewRecoveryVirtualNetworkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NewRecoveryVirtualNetwork model = + BinaryData + .fromString( + "{\"resourceType\":\"New\",\"recoveryVirtualNetworkResourceGroupName\":\"vfpsj\",\"recoveryVirtualNetworkName\":\"ngsy\"}") + .toObject(NewRecoveryVirtualNetwork.class); + Assertions.assertEquals("vfpsj", model.recoveryVirtualNetworkResourceGroupName()); + Assertions.assertEquals("ngsy", model.recoveryVirtualNetworkName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NewRecoveryVirtualNetwork model = + new NewRecoveryVirtualNetwork() + .withRecoveryVirtualNetworkResourceGroupName("vfpsj") + .withRecoveryVirtualNetworkName("ngsy"); + model = BinaryData.fromObject(model).toObject(NewRecoveryVirtualNetwork.class); + Assertions.assertEquals("vfpsj", model.recoveryVirtualNetworkResourceGroupName()); + Assertions.assertEquals("ngsy", model.recoveryVirtualNetworkName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSDetailsTests.java new file mode 100644 index 000000000000..24632628e99a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSDetailsTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSDetails; +import org.junit.jupiter.api.Assertions; + +public final class OSDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OSDetails model = + BinaryData + .fromString( + "{\"osType\":\"dqigmg\",\"productType\":\"inztxl\",\"osEdition\":\"khnjcmrnkfm\",\"oSVersion\":\"cqtwmlmhjnqtq\",\"oSMajorVersion\":\"hj\",\"oSMinorVersion\":\"vragpokddx\"}") + .toObject(OSDetails.class); + Assertions.assertEquals("dqigmg", model.osType()); + Assertions.assertEquals("inztxl", model.productType()); + Assertions.assertEquals("khnjcmrnkfm", model.osEdition()); + Assertions.assertEquals("cqtwmlmhjnqtq", model.oSVersion()); + Assertions.assertEquals("hj", model.oSMajorVersion()); + Assertions.assertEquals("vragpokddx", model.oSMinorVersion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OSDetails model = + new OSDetails() + .withOsType("dqigmg") + .withProductType("inztxl") + .withOsEdition("khnjcmrnkfm") + .withOSVersion("cqtwmlmhjnqtq") + .withOSMajorVersion("hj") + .withOSMinorVersion("vragpokddx"); + model = BinaryData.fromObject(model).toObject(OSDetails.class); + Assertions.assertEquals("dqigmg", model.osType()); + Assertions.assertEquals("inztxl", model.productType()); + Assertions.assertEquals("khnjcmrnkfm", model.osEdition()); + Assertions.assertEquals("cqtwmlmhjnqtq", model.oSVersion()); + Assertions.assertEquals("hj", model.oSMajorVersion()); + Assertions.assertEquals("vragpokddx", model.oSMinorVersion()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSDiskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSDiskDetailsTests.java new file mode 100644 index 000000000000..bb54622bed93 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSDiskDetailsTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSDiskDetails; +import org.junit.jupiter.api.Assertions; + +public final class OSDiskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OSDiskDetails model = + BinaryData + .fromString("{\"osVhdId\":\"hrjqfyaytvslyek\",\"osType\":\"niuarlcjiwgsxfai\",\"vhdName\":\"wd\"}") + .toObject(OSDiskDetails.class); + Assertions.assertEquals("hrjqfyaytvslyek", model.osVhdId()); + Assertions.assertEquals("niuarlcjiwgsxfai", model.osType()); + Assertions.assertEquals("wd", model.vhdName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OSDiskDetails model = + new OSDiskDetails().withOsVhdId("hrjqfyaytvslyek").withOsType("niuarlcjiwgsxfai").withVhdName("wd"); + model = BinaryData.fromObject(model).toObject(OSDiskDetails.class); + Assertions.assertEquals("hrjqfyaytvslyek", model.osVhdId()); + Assertions.assertEquals("niuarlcjiwgsxfai", model.osType()); + Assertions.assertEquals("wd", model.vhdName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSUpgradeSupportedVersionsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSUpgradeSupportedVersionsTests.java new file mode 100644 index 000000000000..a101c46a2444 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSUpgradeSupportedVersionsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSUpgradeSupportedVersions; + +public final class OSUpgradeSupportedVersionsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OSUpgradeSupportedVersions model = + BinaryData + .fromString( + "{\"supportedSourceOsVersion\":\"hhkvguavtptbk\",\"supportedTargetOsVersions\":[\"qynspgbvoffb\",\"kwvdxa\",\"xqokmyrlji\"]}") + .toObject(OSUpgradeSupportedVersions.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OSUpgradeSupportedVersions model = new OSUpgradeSupportedVersions(); + model = BinaryData.fromObject(model).toObject(OSUpgradeSupportedVersions.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSVersionWrapperTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSVersionWrapperTests.java new file mode 100644 index 000000000000..4f7de78fa02f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OSVersionWrapperTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSVersionWrapper; +import org.junit.jupiter.api.Assertions; + +public final class OSVersionWrapperTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OSVersionWrapper model = + BinaryData.fromString("{\"version\":\"wjh\",\"servicePack\":\"biwetpo\"}").toObject(OSVersionWrapper.class); + Assertions.assertEquals("wjh", model.version()); + Assertions.assertEquals("biwetpo", model.servicePack()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OSVersionWrapper model = new OSVersionWrapper().withVersion("wjh").withServicePack("biwetpo"); + model = BinaryData.fromObject(model).toObject(OSVersionWrapper.class); + Assertions.assertEquals("wjh", model.version()); + Assertions.assertEquals("biwetpo", model.servicePack()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsDiscoveryCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsDiscoveryCollectionTests.java new file mode 100644 index 000000000000..02d37ab340e2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsDiscoveryCollectionTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.OperationsDiscoveryInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Display; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OperationsDiscoveryCollection; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OperationsDiscoveryCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationsDiscoveryCollection model = + BinaryData + .fromString( + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"display\":{\"provider\":\"zopbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"ownoizhw\",\"properties\":\"dataxybqsoqij\"},{\"name\":\"dmbpazlobcufpdz\",\"display\":{\"provider\":\"t\",\"resource\":\"qjnqglhqgnufoooj\",\"operation\":\"ifsqesaagdfmg\",\"description\":\"lhjxr\"},\"origin\":\"kwm\",\"properties\":\"dataktsizntocipaou\"},{\"name\":\"psqucmpoyf\",\"display\":{\"provider\":\"ogknygjofjdd\",\"resource\":\"s\",\"operation\":\"eupewnwreitjz\",\"description\":\"lusarh\"},\"origin\":\"fcqhsmyurkd\",\"properties\":\"datalx\"}],\"nextLink\":\"kuksjtxukcdm\"}") + .toObject(OperationsDiscoveryCollection.class); + Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); + Assertions.assertEquals("zopbsphrupidgs", model.value().get(0).display().provider()); + Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource()); + Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); + Assertions.assertEquals("zehtbmu", model.value().get(0).display().description()); + Assertions.assertEquals("ownoizhw", model.value().get(0).origin()); + Assertions.assertEquals("kuksjtxukcdm", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationsDiscoveryCollection model = + new OperationsDiscoveryCollection() + .withValue( + Arrays + .asList( + new OperationsDiscoveryInner() + .withName("quvgjxpybczme") + .withDisplay( + new Display() + .withProvider("zopbsphrupidgs") + .withResource("bejhphoycmsxa") + .withOperation("hdxbmtqio") + .withDescription("zehtbmu")) + .withOrigin("ownoizhw") + .withProperties("dataxybqsoqij"), + new OperationsDiscoveryInner() + .withName("dmbpazlobcufpdz") + .withDisplay( + new Display() + .withProvider("t") + .withResource("qjnqglhqgnufoooj") + .withOperation("ifsqesaagdfmg") + .withDescription("lhjxr")) + .withOrigin("kwm") + .withProperties("dataktsizntocipaou"), + new OperationsDiscoveryInner() + .withName("psqucmpoyf") + .withDisplay( + new Display() + .withProvider("ogknygjofjdd") + .withResource("s") + .withOperation("eupewnwreitjz") + .withDescription("lusarh")) + .withOrigin("fcqhsmyurkd") + .withProperties("datalx"))) + .withNextLink("kuksjtxukcdm"); + model = BinaryData.fromObject(model).toObject(OperationsDiscoveryCollection.class); + Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); + Assertions.assertEquals("zopbsphrupidgs", model.value().get(0).display().provider()); + Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource()); + Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); + Assertions.assertEquals("zehtbmu", model.value().get(0).display().description()); + Assertions.assertEquals("ownoizhw", model.value().get(0).origin()); + Assertions.assertEquals("kuksjtxukcdm", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsDiscoveryInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsDiscoveryInnerTests.java new file mode 100644 index 000000000000..cb9cb452a860 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsDiscoveryInnerTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.OperationsDiscoveryInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Display; +import org.junit.jupiter.api.Assertions; + +public final class OperationsDiscoveryInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationsDiscoveryInner model = + BinaryData + .fromString( + "{\"name\":\"rcryuanzwuxzdxta\",\"display\":{\"provider\":\"hmwhfpmrqo\",\"resource\":\"tu\",\"operation\":\"nryrtihf\",\"description\":\"ijbpzvgnwzsymgl\"},\"origin\":\"fcyzkohdbihanufh\",\"properties\":\"databj\"}") + .toObject(OperationsDiscoveryInner.class); + Assertions.assertEquals("rcryuanzwuxzdxta", model.name()); + Assertions.assertEquals("hmwhfpmrqo", model.display().provider()); + Assertions.assertEquals("tu", model.display().resource()); + Assertions.assertEquals("nryrtihf", model.display().operation()); + Assertions.assertEquals("ijbpzvgnwzsymgl", model.display().description()); + Assertions.assertEquals("fcyzkohdbihanufh", model.origin()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationsDiscoveryInner model = + new OperationsDiscoveryInner() + .withName("rcryuanzwuxzdxta") + .withDisplay( + new Display() + .withProvider("hmwhfpmrqo") + .withResource("tu") + .withOperation("nryrtihf") + .withDescription("ijbpzvgnwzsymgl")) + .withOrigin("fcyzkohdbihanufh") + .withProperties("databj"); + model = BinaryData.fromObject(model).toObject(OperationsDiscoveryInner.class); + Assertions.assertEquals("rcryuanzwuxzdxta", model.name()); + Assertions.assertEquals("hmwhfpmrqo", model.display().provider()); + Assertions.assertEquals("tu", model.display().resource()); + Assertions.assertEquals("nryrtihf", model.display().operation()); + Assertions.assertEquals("ijbpzvgnwzsymgl", model.display().description()); + Assertions.assertEquals("fcyzkohdbihanufh", model.origin()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsListByResourceGroupMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsListByResourceGroupMockTests.java new file mode 100644 index 000000000000..63c405b940c6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/OperationsListByResourceGroupMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OperationsDiscovery; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OperationsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"name\":\"oojjfuktub\",\"display\":{\"provider\":\"nhgbtzvxxvsbc\",\"resource\":\"fkrfnkcni\",\"operation\":\"swxmfurqm\",\"description\":\"wwp\"},\"origin\":\"um\",\"properties\":\"dataahbqsvnkxm\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.operations().listByResourceGroup("flbrouszxacdwuko", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("oojjfuktub", response.iterator().next().name()); + Assertions.assertEquals("nhgbtzvxxvsbc", response.iterator().next().display().provider()); + Assertions.assertEquals("fkrfnkcni", response.iterator().next().display().resource()); + Assertions.assertEquals("swxmfurqm", response.iterator().next().display().operation()); + Assertions.assertEquals("wwp", response.iterator().next().display().description()); + Assertions.assertEquals("um", response.iterator().next().origin()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PauseReplicationInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PauseReplicationInputPropertiesTests.java new file mode 100644 index 000000000000..a4457923e919 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PauseReplicationInputPropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PauseReplicationInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class PauseReplicationInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PauseReplicationInputProperties model = + BinaryData.fromString("{\"instanceType\":\"qvkelnsm\"}").toObject(PauseReplicationInputProperties.class); + Assertions.assertEquals("qvkelnsm", model.instanceType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PauseReplicationInputProperties model = new PauseReplicationInputProperties().withInstanceType("qvkelnsm"); + model = BinaryData.fromObject(model).toObject(PauseReplicationInputProperties.class); + Assertions.assertEquals("qvkelnsm", model.instanceType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PauseReplicationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PauseReplicationInputTests.java new file mode 100644 index 000000000000..a8da5f4a354e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PauseReplicationInputTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PauseReplicationInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PauseReplicationInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class PauseReplicationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PauseReplicationInput model = + BinaryData + .fromString("{\"properties\":{\"instanceType\":\"waboe\"}}") + .toObject(PauseReplicationInput.class); + Assertions.assertEquals("waboe", model.properties().instanceType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PauseReplicationInput model = + new PauseReplicationInput().withProperties(new PauseReplicationInputProperties().withInstanceType("waboe")); + model = BinaryData.fromObject(model).toObject(PauseReplicationInput.class); + Assertions.assertEquals("waboe", model.properties().instanceType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PlannedFailoverInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PlannedFailoverInputPropertiesTests.java new file mode 100644 index 000000000000..caf84395d09e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PlannedFailoverInputPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PlannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class PlannedFailoverInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlannedFailoverInputProperties model = + BinaryData + .fromString( + "{\"failoverDirection\":\"qyzhf\",\"providerSpecificDetails\":{\"instanceType\":\"PlannedFailoverProviderSpecificFailoverInput\"}}") + .toObject(PlannedFailoverInputProperties.class); + Assertions.assertEquals("qyzhf", model.failoverDirection()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlannedFailoverInputProperties model = + new PlannedFailoverInputProperties() + .withFailoverDirection("qyzhf") + .withProviderSpecificDetails(new PlannedFailoverProviderSpecificFailoverInput()); + model = BinaryData.fromObject(model).toObject(PlannedFailoverInputProperties.class); + Assertions.assertEquals("qyzhf", model.failoverDirection()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PlannedFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PlannedFailoverInputTests.java new file mode 100644 index 000000000000..c1d3423e53e8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PlannedFailoverInputTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PlannedFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PlannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class PlannedFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlannedFailoverInput model = + BinaryData + .fromString( + "{\"properties\":{\"failoverDirection\":\"tizzronasxif\",\"providerSpecificDetails\":{\"instanceType\":\"PlannedFailoverProviderSpecificFailoverInput\"}}}") + .toObject(PlannedFailoverInput.class); + Assertions.assertEquals("tizzronasxif", model.properties().failoverDirection()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlannedFailoverInput model = + new PlannedFailoverInput() + .withProperties( + new PlannedFailoverInputProperties() + .withFailoverDirection("tizzronasxif") + .withProviderSpecificDetails(new PlannedFailoverProviderSpecificFailoverInput())); + model = BinaryData.fromObject(model).toObject(PlannedFailoverInput.class); + Assertions.assertEquals("tizzronasxif", model.properties().failoverDirection()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PlannedFailoverProviderSpecificFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PlannedFailoverProviderSpecificFailoverInputTests.java new file mode 100644 index 000000000000..23ae739bef37 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PlannedFailoverProviderSpecificFailoverInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PlannedFailoverProviderSpecificFailoverInput; + +public final class PlannedFailoverProviderSpecificFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlannedFailoverProviderSpecificFailoverInput model = + BinaryData + .fromString("{\"instanceType\":\"PlannedFailoverProviderSpecificFailoverInput\"}") + .toObject(PlannedFailoverProviderSpecificFailoverInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlannedFailoverProviderSpecificFailoverInput model = new PlannedFailoverProviderSpecificFailoverInput(); + model = BinaryData.fromObject(model).toObject(PlannedFailoverProviderSpecificFailoverInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyCollectionTests.java new file mode 100644 index 000000000000..b06c32d5464d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyCollectionTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.PolicyInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PolicyCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PolicyCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"friendlyName\":\"ulaiywzejywhs\",\"providerSpecificDetails\":{\"instanceType\":\"PolicyProviderSpecificDetails\"}},\"location\":\"ojpllndnpdwrpqaf\",\"id\":\"fugsnnfhyetefy\",\"name\":\"oc\",\"type\":\"ctfjgtixr\"},{\"properties\":{\"friendlyName\":\"uyturml\",\"providerSpecificDetails\":{\"instanceType\":\"PolicyProviderSpecificDetails\"}},\"location\":\"wolba\",\"id\":\"iropionszon\",\"name\":\"pngajin\",\"type\":\"ixjawrtm\"},{\"properties\":{\"friendlyName\":\"myccx\",\"providerSpecificDetails\":{\"instanceType\":\"PolicyProviderSpecificDetails\"}},\"location\":\"coxovn\",\"id\":\"khenlus\",\"name\":\"nrd\",\"type\":\"jxtxrdc\"},{\"properties\":{\"friendlyName\":\"vidttgepuslvyjt\",\"providerSpecificDetails\":{\"instanceType\":\"PolicyProviderSpecificDetails\"}},\"location\":\"wkasiziesf\",\"id\":\"ughtuqfecjxeygtu\",\"name\":\"xu\",\"type\":\"cbuewmrswnjlxuz\"}],\"nextLink\":\"wpusxjbaqehg\"}") + .toObject(PolicyCollection.class); + Assertions.assertEquals("ulaiywzejywhs", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("ojpllndnpdwrpqaf", model.value().get(0).location()); + Assertions.assertEquals("wpusxjbaqehg", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PolicyCollection model = + new PolicyCollection() + .withValue( + Arrays + .asList( + new PolicyInner() + .withProperties( + new PolicyProperties() + .withFriendlyName("ulaiywzejywhs") + .withProviderSpecificDetails(new PolicyProviderSpecificDetails())) + .withLocation("ojpllndnpdwrpqaf"), + new PolicyInner() + .withProperties( + new PolicyProperties() + .withFriendlyName("uyturml") + .withProviderSpecificDetails(new PolicyProviderSpecificDetails())) + .withLocation("wolba"), + new PolicyInner() + .withProperties( + new PolicyProperties() + .withFriendlyName("myccx") + .withProviderSpecificDetails(new PolicyProviderSpecificDetails())) + .withLocation("coxovn"), + new PolicyInner() + .withProperties( + new PolicyProperties() + .withFriendlyName("vidttgepuslvyjt") + .withProviderSpecificDetails(new PolicyProviderSpecificDetails())) + .withLocation("wkasiziesf"))) + .withNextLink("wpusxjbaqehg"); + model = BinaryData.fromObject(model).toObject(PolicyCollection.class); + Assertions.assertEquals("ulaiywzejywhs", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("ojpllndnpdwrpqaf", model.value().get(0).location()); + Assertions.assertEquals("wpusxjbaqehg", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyInnerTests.java new file mode 100644 index 000000000000..954fb66cbc20 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyInnerTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.PolicyInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails; +import org.junit.jupiter.api.Assertions; + +public final class PolicyInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PolicyInner model = + BinaryData + .fromString( + "{\"properties\":{\"friendlyName\":\"hzjqatucoige\",\"providerSpecificDetails\":{\"instanceType\":\"PolicyProviderSpecificDetails\"}},\"location\":\"cnwfepbnwgfmxjg\",\"id\":\"g\",\"name\":\"jbgdlfgtdysnaquf\",\"type\":\"qbctqha\"}") + .toObject(PolicyInner.class); + Assertions.assertEquals("hzjqatucoige", model.properties().friendlyName()); + Assertions.assertEquals("cnwfepbnwgfmxjg", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PolicyInner model = + new PolicyInner() + .withProperties( + new PolicyProperties() + .withFriendlyName("hzjqatucoige") + .withProviderSpecificDetails(new PolicyProviderSpecificDetails())) + .withLocation("cnwfepbnwgfmxjg"); + model = BinaryData.fromObject(model).toObject(PolicyInner.class); + Assertions.assertEquals("hzjqatucoige", model.properties().friendlyName()); + Assertions.assertEquals("cnwfepbnwgfmxjg", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyPropertiesTests.java new file mode 100644 index 000000000000..abaa7e0688af --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails; +import org.junit.jupiter.api.Assertions; + +public final class PolicyPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PolicyProperties model = + BinaryData + .fromString( + "{\"friendlyName\":\"jrwdkqz\",\"providerSpecificDetails\":{\"instanceType\":\"PolicyProviderSpecificDetails\"}}") + .toObject(PolicyProperties.class); + Assertions.assertEquals("jrwdkqz", model.friendlyName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PolicyProperties model = + new PolicyProperties() + .withFriendlyName("jrwdkqz") + .withProviderSpecificDetails(new PolicyProviderSpecificDetails()); + model = BinaryData.fromObject(model).toObject(PolicyProperties.class); + Assertions.assertEquals("jrwdkqz", model.friendlyName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyProviderSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyProviderSpecificDetailsTests.java new file mode 100644 index 000000000000..c0cbe368c8ee --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyProviderSpecificDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificDetails; + +public final class PolicyProviderSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PolicyProviderSpecificDetails model = + BinaryData + .fromString("{\"instanceType\":\"PolicyProviderSpecificDetails\"}") + .toObject(PolicyProviderSpecificDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PolicyProviderSpecificDetails model = new PolicyProviderSpecificDetails(); + model = BinaryData.fromObject(model).toObject(PolicyProviderSpecificDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyProviderSpecificInputTests.java new file mode 100644 index 000000000000..f3fe65ba14b8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/PolicyProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificInput; + +public final class PolicyProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PolicyProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"PolicyProviderSpecificInput\"}") + .toObject(PolicyProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PolicyProviderSpecificInput model = new PolicyProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(PolicyProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectableItemCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectableItemCollectionTests.java new file mode 100644 index 000000000000..fc2faaa824ef --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectableItemCollectionTests.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.ProtectableItemInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ConfigurationSettings; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectableItemCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectableItemProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProtectableItemCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectableItemCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"friendlyName\":\"qcslyjpkiid\",\"protectionStatus\":\"exznelixhnr\",\"replicationProtectedItemId\":\"folhbnxknal\",\"recoveryServicesProviderId\":\"lp\",\"protectionReadinessErrors\":[\"dtpnapnyiropuhp\",\"gvpgy\",\"gqgitxmedjvcsl\"],\"supportedReplicationProviders\":[\"wwncwzzhxgk\",\"rmgucnap\"],\"customDetails\":{\"instanceType\":\"ConfigurationSettings\"}},\"location\":\"oellwp\",\"id\":\"fdygpfqbuaceopz\",\"name\":\"qrhhu\",\"type\":\"opppcqeq\"},{\"properties\":{\"friendlyName\":\"z\",\"protectionStatus\":\"hzxct\",\"replicationProtectedItemId\":\"gbkdmoizpos\",\"recoveryServicesProviderId\":\"grcfb\",\"protectionReadinessErrors\":[\"mfqjhhkxbp\",\"jy\",\"jhxxjyn\",\"u\"],\"supportedReplicationProviders\":[\"krtswbxqz\"],\"customDetails\":{\"instanceType\":\"ConfigurationSettings\"}},\"location\":\"jfauvjfdxxi\",\"id\":\"e\",\"name\":\"vtcqaqtdo\",\"type\":\"mcbxvwvxysl\"},{\"properties\":{\"friendlyName\":\"sfxobl\",\"protectionStatus\":\"k\",\"replicationProtectedItemId\":\"mpew\",\"recoveryServicesProviderId\":\"fbkrvrnsvs\",\"protectionReadinessErrors\":[\"ohxcrsbfova\",\"rruvwbhsq\"],\"supportedReplicationProviders\":[\"bcgjbirxbp\",\"bsrfbj\",\"dtws\"],\"customDetails\":{\"instanceType\":\"ConfigurationSettings\"}},\"location\":\"ftpvjzbexil\",\"id\":\"znfqqnvwpmqtar\",\"name\":\"oujmkcjhwqytj\",\"type\":\"ybn\"},{\"properties\":{\"friendlyName\":\"wgdrjervnaenqp\",\"protectionStatus\":\"indoygmifthnzd\",\"replicationProtectedItemId\":\"sl\",\"recoveryServicesProviderId\":\"ayqigynduhav\",\"protectionReadinessErrors\":[\"kthumaqolbgycdui\",\"r\"],\"supportedReplicationProviders\":[\"cym\",\"aolps\",\"lqlfm\",\"dnbbglzps\"],\"customDetails\":{\"instanceType\":\"ConfigurationSettings\"}},\"location\":\"d\",\"id\":\"cwyhzdxssa\",\"name\":\"bzmnvdfznud\",\"type\":\"od\"}],\"nextLink\":\"zbn\"}") + .toObject(ProtectableItemCollection.class); + Assertions.assertEquals("qcslyjpkiid", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("exznelixhnr", model.value().get(0).properties().protectionStatus()); + Assertions.assertEquals("folhbnxknal", model.value().get(0).properties().replicationProtectedItemId()); + Assertions.assertEquals("lp", model.value().get(0).properties().recoveryServicesProviderId()); + Assertions + .assertEquals("dtpnapnyiropuhp", model.value().get(0).properties().protectionReadinessErrors().get(0)); + Assertions + .assertEquals("wwncwzzhxgk", model.value().get(0).properties().supportedReplicationProviders().get(0)); + Assertions.assertEquals("oellwp", model.value().get(0).location()); + Assertions.assertEquals("zbn", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectableItemCollection model = + new ProtectableItemCollection() + .withValue( + Arrays + .asList( + new ProtectableItemInner() + .withProperties( + new ProtectableItemProperties() + .withFriendlyName("qcslyjpkiid") + .withProtectionStatus("exznelixhnr") + .withReplicationProtectedItemId("folhbnxknal") + .withRecoveryServicesProviderId("lp") + .withProtectionReadinessErrors( + Arrays.asList("dtpnapnyiropuhp", "gvpgy", "gqgitxmedjvcsl")) + .withSupportedReplicationProviders(Arrays.asList("wwncwzzhxgk", "rmgucnap")) + .withCustomDetails(new ConfigurationSettings())) + .withLocation("oellwp"), + new ProtectableItemInner() + .withProperties( + new ProtectableItemProperties() + .withFriendlyName("z") + .withProtectionStatus("hzxct") + .withReplicationProtectedItemId("gbkdmoizpos") + .withRecoveryServicesProviderId("grcfb") + .withProtectionReadinessErrors( + Arrays.asList("mfqjhhkxbp", "jy", "jhxxjyn", "u")) + .withSupportedReplicationProviders(Arrays.asList("krtswbxqz")) + .withCustomDetails(new ConfigurationSettings())) + .withLocation("jfauvjfdxxi"), + new ProtectableItemInner() + .withProperties( + new ProtectableItemProperties() + .withFriendlyName("sfxobl") + .withProtectionStatus("k") + .withReplicationProtectedItemId("mpew") + .withRecoveryServicesProviderId("fbkrvrnsvs") + .withProtectionReadinessErrors(Arrays.asList("ohxcrsbfova", "rruvwbhsq")) + .withSupportedReplicationProviders( + Arrays.asList("bcgjbirxbp", "bsrfbj", "dtws")) + .withCustomDetails(new ConfigurationSettings())) + .withLocation("ftpvjzbexil"), + new ProtectableItemInner() + .withProperties( + new ProtectableItemProperties() + .withFriendlyName("wgdrjervnaenqp") + .withProtectionStatus("indoygmifthnzd") + .withReplicationProtectedItemId("sl") + .withRecoveryServicesProviderId("ayqigynduhav") + .withProtectionReadinessErrors(Arrays.asList("kthumaqolbgycdui", "r")) + .withSupportedReplicationProviders( + Arrays.asList("cym", "aolps", "lqlfm", "dnbbglzps")) + .withCustomDetails(new ConfigurationSettings())) + .withLocation("d"))) + .withNextLink("zbn"); + model = BinaryData.fromObject(model).toObject(ProtectableItemCollection.class); + Assertions.assertEquals("qcslyjpkiid", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("exznelixhnr", model.value().get(0).properties().protectionStatus()); + Assertions.assertEquals("folhbnxknal", model.value().get(0).properties().replicationProtectedItemId()); + Assertions.assertEquals("lp", model.value().get(0).properties().recoveryServicesProviderId()); + Assertions + .assertEquals("dtpnapnyiropuhp", model.value().get(0).properties().protectionReadinessErrors().get(0)); + Assertions + .assertEquals("wwncwzzhxgk", model.value().get(0).properties().supportedReplicationProviders().get(0)); + Assertions.assertEquals("oellwp", model.value().get(0).location()); + Assertions.assertEquals("zbn", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectableItemInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectableItemInnerTests.java new file mode 100644 index 000000000000..916b2ecd01c8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectableItemInnerTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.ProtectableItemInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ConfigurationSettings; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectableItemProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProtectableItemInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectableItemInner model = + BinaryData + .fromString( + "{\"properties\":{\"friendlyName\":\"ylpstdbhhxsrzdz\",\"protectionStatus\":\"erscdntne\",\"replicationProtectedItemId\":\"iwjmygtdssls\",\"recoveryServicesProviderId\":\"mweriofzpy\",\"protectionReadinessErrors\":[\"mwabnetshhszhedp\",\"vwiwubmwmbesld\"],\"supportedReplicationProviders\":[\"wtppjflcxogaoko\",\"z\"],\"customDetails\":{\"instanceType\":\"ConfigurationSettings\"}},\"location\":\"ikvmkqzeqqk\",\"id\":\"l\",\"name\":\"fzxmhhvhgureodkw\",\"type\":\"bdagxt\"}") + .toObject(ProtectableItemInner.class); + Assertions.assertEquals("ylpstdbhhxsrzdz", model.properties().friendlyName()); + Assertions.assertEquals("erscdntne", model.properties().protectionStatus()); + Assertions.assertEquals("iwjmygtdssls", model.properties().replicationProtectedItemId()); + Assertions.assertEquals("mweriofzpy", model.properties().recoveryServicesProviderId()); + Assertions.assertEquals("mwabnetshhszhedp", model.properties().protectionReadinessErrors().get(0)); + Assertions.assertEquals("wtppjflcxogaoko", model.properties().supportedReplicationProviders().get(0)); + Assertions.assertEquals("ikvmkqzeqqk", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectableItemInner model = + new ProtectableItemInner() + .withProperties( + new ProtectableItemProperties() + .withFriendlyName("ylpstdbhhxsrzdz") + .withProtectionStatus("erscdntne") + .withReplicationProtectedItemId("iwjmygtdssls") + .withRecoveryServicesProviderId("mweriofzpy") + .withProtectionReadinessErrors(Arrays.asList("mwabnetshhszhedp", "vwiwubmwmbesld")) + .withSupportedReplicationProviders(Arrays.asList("wtppjflcxogaoko", "z")) + .withCustomDetails(new ConfigurationSettings())) + .withLocation("ikvmkqzeqqk"); + model = BinaryData.fromObject(model).toObject(ProtectableItemInner.class); + Assertions.assertEquals("ylpstdbhhxsrzdz", model.properties().friendlyName()); + Assertions.assertEquals("erscdntne", model.properties().protectionStatus()); + Assertions.assertEquals("iwjmygtdssls", model.properties().replicationProtectedItemId()); + Assertions.assertEquals("mweriofzpy", model.properties().recoveryServicesProviderId()); + Assertions.assertEquals("mwabnetshhszhedp", model.properties().protectionReadinessErrors().get(0)); + Assertions.assertEquals("wtppjflcxogaoko", model.properties().supportedReplicationProviders().get(0)); + Assertions.assertEquals("ikvmkqzeqqk", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectableItemPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectableItemPropertiesTests.java new file mode 100644 index 000000000000..30bbb7f9b0d5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectableItemPropertiesTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ConfigurationSettings; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectableItemProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProtectableItemPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectableItemProperties model = + BinaryData + .fromString( + "{\"friendlyName\":\"qdxbxwa\",\"protectionStatus\":\"ogqxndlkzgxhuri\",\"replicationProtectedItemId\":\"bpodxunkbebxm\",\"recoveryServicesProviderId\":\"yyntwl\",\"protectionReadinessErrors\":[\"tkoievseotgq\",\"l\"],\"supportedReplicationProviders\":[\"u\",\"lauwzizxbmpgcjef\",\"zmuvpbttdumorppx\",\"bmnzbtbhjpgl\"],\"customDetails\":{\"instanceType\":\"ConfigurationSettings\"}}") + .toObject(ProtectableItemProperties.class); + Assertions.assertEquals("qdxbxwa", model.friendlyName()); + Assertions.assertEquals("ogqxndlkzgxhuri", model.protectionStatus()); + Assertions.assertEquals("bpodxunkbebxm", model.replicationProtectedItemId()); + Assertions.assertEquals("yyntwl", model.recoveryServicesProviderId()); + Assertions.assertEquals("tkoievseotgq", model.protectionReadinessErrors().get(0)); + Assertions.assertEquals("u", model.supportedReplicationProviders().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectableItemProperties model = + new ProtectableItemProperties() + .withFriendlyName("qdxbxwa") + .withProtectionStatus("ogqxndlkzgxhuri") + .withReplicationProtectedItemId("bpodxunkbebxm") + .withRecoveryServicesProviderId("yyntwl") + .withProtectionReadinessErrors(Arrays.asList("tkoievseotgq", "l")) + .withSupportedReplicationProviders( + Arrays.asList("u", "lauwzizxbmpgcjef", "zmuvpbttdumorppx", "bmnzbtbhjpgl")) + .withCustomDetails(new ConfigurationSettings()); + model = BinaryData.fromObject(model).toObject(ProtectableItemProperties.class); + Assertions.assertEquals("qdxbxwa", model.friendlyName()); + Assertions.assertEquals("ogqxndlkzgxhuri", model.protectionStatus()); + Assertions.assertEquals("bpodxunkbebxm", model.replicationProtectedItemId()); + Assertions.assertEquals("yyntwl", model.recoveryServicesProviderId()); + Assertions.assertEquals("tkoievseotgq", model.protectionReadinessErrors().get(0)); + Assertions.assertEquals("u", model.supportedReplicationProviders().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerCollectionTests.java new file mode 100644 index 000000000000..d50f75cf0da2 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerCollectionTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.ProtectionContainerInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainerCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainerProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProtectionContainerCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionContainerCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"fabricFriendlyName\":\"lpbuxwgipwhonowk\",\"friendlyName\":\"hwankixzbinjepu\",\"fabricType\":\"mryw\",\"protectedItemCount\":2134987728,\"pairingStatus\":\"qftiy\",\"role\":\"rnkcqvyxlw\",\"fabricSpecificDetails\":{\"instanceType\":\"sicohoqqnwvlry\"}},\"location\":\"w\",\"id\":\"heun\",\"name\":\"mqhgyxzkonocuk\",\"type\":\"klyaxuconu\"},{\"properties\":{\"fabricFriendlyName\":\"fkbey\",\"friendlyName\":\"wrmjmwvvjektc\",\"fabricType\":\"enhwlrs\",\"protectedItemCount\":1160903159,\"pairingStatus\":\"pwvlqdq\",\"role\":\"iqylihkaetck\",\"fabricSpecificDetails\":{\"instanceType\":\"civfsnkymuctq\"}},\"location\":\"fbebrjcxer\",\"id\":\"uwutttxfvjrbi\",\"name\":\"phxepcyvahf\",\"type\":\"ljkyqxjvuuj\"},{\"properties\":{\"fabricFriendlyName\":\"dokgjl\",\"friendlyName\":\"oxgvclt\",\"fabricType\":\"sncghkjeszz\",\"protectedItemCount\":1537141479,\"pairingStatus\":\"htxfvgxbfsmxnehm\",\"role\":\"ec\",\"fabricSpecificDetails\":{\"instanceType\":\"debfqkkrbmpukgri\"}},\"location\":\"lzlfbxzpuz\",\"id\":\"cispnqzahmgkbr\",\"name\":\"yydhibnuqqk\",\"type\":\"ik\"},{\"properties\":{\"fabricFriendlyName\":\"gvtqagnbuynh\",\"friendlyName\":\"gg\",\"fabricType\":\"bfs\",\"protectedItemCount\":600405260,\"pairingStatus\":\"utrc\",\"role\":\"na\",\"fabricSpecificDetails\":{\"instanceType\":\"hj\"}},\"location\":\"nmpxttdb\",\"id\":\"rbnlankxmyskp\",\"name\":\"henbtkcxywnytn\",\"type\":\"synlqidybyxczfc\"}],\"nextLink\":\"aaxdbabphlwrq\"}") + .toObject(ProtectionContainerCollection.class); + Assertions.assertEquals("lpbuxwgipwhonowk", model.value().get(0).properties().fabricFriendlyName()); + Assertions.assertEquals("hwankixzbinjepu", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("mryw", model.value().get(0).properties().fabricType()); + Assertions.assertEquals(2134987728, model.value().get(0).properties().protectedItemCount()); + Assertions.assertEquals("qftiy", model.value().get(0).properties().pairingStatus()); + Assertions.assertEquals("rnkcqvyxlw", model.value().get(0).properties().role()); + Assertions.assertEquals("w", model.value().get(0).location()); + Assertions.assertEquals("aaxdbabphlwrq", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionContainerCollection model = + new ProtectionContainerCollection() + .withValue( + Arrays + .asList( + new ProtectionContainerInner() + .withProperties( + new ProtectionContainerProperties() + .withFabricFriendlyName("lpbuxwgipwhonowk") + .withFriendlyName("hwankixzbinjepu") + .withFabricType("mryw") + .withProtectedItemCount(2134987728) + .withPairingStatus("qftiy") + .withRole("rnkcqvyxlw") + .withFabricSpecificDetails(new ProtectionContainerFabricSpecificDetails())) + .withLocation("w"), + new ProtectionContainerInner() + .withProperties( + new ProtectionContainerProperties() + .withFabricFriendlyName("fkbey") + .withFriendlyName("wrmjmwvvjektc") + .withFabricType("enhwlrs") + .withProtectedItemCount(1160903159) + .withPairingStatus("pwvlqdq") + .withRole("iqylihkaetck") + .withFabricSpecificDetails(new ProtectionContainerFabricSpecificDetails())) + .withLocation("fbebrjcxer"), + new ProtectionContainerInner() + .withProperties( + new ProtectionContainerProperties() + .withFabricFriendlyName("dokgjl") + .withFriendlyName("oxgvclt") + .withFabricType("sncghkjeszz") + .withProtectedItemCount(1537141479) + .withPairingStatus("htxfvgxbfsmxnehm") + .withRole("ec") + .withFabricSpecificDetails(new ProtectionContainerFabricSpecificDetails())) + .withLocation("lzlfbxzpuz"), + new ProtectionContainerInner() + .withProperties( + new ProtectionContainerProperties() + .withFabricFriendlyName("gvtqagnbuynh") + .withFriendlyName("gg") + .withFabricType("bfs") + .withProtectedItemCount(600405260) + .withPairingStatus("utrc") + .withRole("na") + .withFabricSpecificDetails(new ProtectionContainerFabricSpecificDetails())) + .withLocation("nmpxttdb"))) + .withNextLink("aaxdbabphlwrq"); + model = BinaryData.fromObject(model).toObject(ProtectionContainerCollection.class); + Assertions.assertEquals("lpbuxwgipwhonowk", model.value().get(0).properties().fabricFriendlyName()); + Assertions.assertEquals("hwankixzbinjepu", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("mryw", model.value().get(0).properties().fabricType()); + Assertions.assertEquals(2134987728, model.value().get(0).properties().protectedItemCount()); + Assertions.assertEquals("qftiy", model.value().get(0).properties().pairingStatus()); + Assertions.assertEquals("rnkcqvyxlw", model.value().get(0).properties().role()); + Assertions.assertEquals("w", model.value().get(0).location()); + Assertions.assertEquals("aaxdbabphlwrq", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerFabricSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerFabricSpecificDetailsTests.java new file mode 100644 index 000000000000..f60b01a1d154 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerFabricSpecificDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails; + +public final class ProtectionContainerFabricSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionContainerFabricSpecificDetails model = + BinaryData + .fromString("{\"instanceType\":\"vmkfssxqu\"}") + .toObject(ProtectionContainerFabricSpecificDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionContainerFabricSpecificDetails model = new ProtectionContainerFabricSpecificDetails(); + model = BinaryData.fromObject(model).toObject(ProtectionContainerFabricSpecificDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerInnerTests.java new file mode 100644 index 000000000000..45824bc6e63b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerInnerTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.ProtectionContainerInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainerProperties; +import org.junit.jupiter.api.Assertions; + +public final class ProtectionContainerInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionContainerInner model = + BinaryData + .fromString( + "{\"properties\":{\"fabricFriendlyName\":\"tsthsucocm\",\"friendlyName\":\"yazttbtwwrqpue\",\"fabricType\":\"kzywbiex\",\"protectedItemCount\":1206070255,\"pairingStatus\":\"ue\",\"role\":\"ibx\",\"fabricSpecificDetails\":{\"instanceType\":\"bhqwalmuzyoxa\"}},\"location\":\"dkzjancuxrh\",\"id\":\"wbavxbniwdj\",\"name\":\"wz\",\"type\":\"s\"}") + .toObject(ProtectionContainerInner.class); + Assertions.assertEquals("tsthsucocm", model.properties().fabricFriendlyName()); + Assertions.assertEquals("yazttbtwwrqpue", model.properties().friendlyName()); + Assertions.assertEquals("kzywbiex", model.properties().fabricType()); + Assertions.assertEquals(1206070255, model.properties().protectedItemCount()); + Assertions.assertEquals("ue", model.properties().pairingStatus()); + Assertions.assertEquals("ibx", model.properties().role()); + Assertions.assertEquals("dkzjancuxrh", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionContainerInner model = + new ProtectionContainerInner() + .withProperties( + new ProtectionContainerProperties() + .withFabricFriendlyName("tsthsucocm") + .withFriendlyName("yazttbtwwrqpue") + .withFabricType("kzywbiex") + .withProtectedItemCount(1206070255) + .withPairingStatus("ue") + .withRole("ibx") + .withFabricSpecificDetails(new ProtectionContainerFabricSpecificDetails())) + .withLocation("dkzjancuxrh"); + model = BinaryData.fromObject(model).toObject(ProtectionContainerInner.class); + Assertions.assertEquals("tsthsucocm", model.properties().fabricFriendlyName()); + Assertions.assertEquals("yazttbtwwrqpue", model.properties().friendlyName()); + Assertions.assertEquals("kzywbiex", model.properties().fabricType()); + Assertions.assertEquals(1206070255, model.properties().protectedItemCount()); + Assertions.assertEquals("ue", model.properties().pairingStatus()); + Assertions.assertEquals("ibx", model.properties().role()); + Assertions.assertEquals("dkzjancuxrh", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerMappingProviderSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerMappingProviderSpecificDetailsTests.java new file mode 100644 index 000000000000..103c744eae3a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerMappingProviderSpecificDetailsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainerMappingProviderSpecificDetails; + +public final class ProtectionContainerMappingProviderSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionContainerMappingProviderSpecificDetails model = + BinaryData + .fromString("{\"instanceType\":\"ProtectionContainerMappingProviderSpecificDetails\"}") + .toObject(ProtectionContainerMappingProviderSpecificDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionContainerMappingProviderSpecificDetails model = + new ProtectionContainerMappingProviderSpecificDetails(); + model = BinaryData.fromObject(model).toObject(ProtectionContainerMappingProviderSpecificDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerPropertiesTests.java new file mode 100644 index 000000000000..4fdd51b01c83 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionContainerPropertiesTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainerFabricSpecificDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainerProperties; +import org.junit.jupiter.api.Assertions; + +public final class ProtectionContainerPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionContainerProperties model = + BinaryData + .fromString( + "{\"fabricFriendlyName\":\"pgn\",\"friendlyName\":\"txhp\",\"fabricType\":\"bzpfzab\",\"protectedItemCount\":687811406,\"pairingStatus\":\"hxw\",\"role\":\"tyq\",\"fabricSpecificDetails\":{\"instanceType\":\"bbovplwzbhvgyugu\"}}") + .toObject(ProtectionContainerProperties.class); + Assertions.assertEquals("pgn", model.fabricFriendlyName()); + Assertions.assertEquals("txhp", model.friendlyName()); + Assertions.assertEquals("bzpfzab", model.fabricType()); + Assertions.assertEquals(687811406, model.protectedItemCount()); + Assertions.assertEquals("hxw", model.pairingStatus()); + Assertions.assertEquals("tyq", model.role()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionContainerProperties model = + new ProtectionContainerProperties() + .withFabricFriendlyName("pgn") + .withFriendlyName("txhp") + .withFabricType("bzpfzab") + .withProtectedItemCount(687811406) + .withPairingStatus("hxw") + .withRole("tyq") + .withFabricSpecificDetails(new ProtectionContainerFabricSpecificDetails()); + model = BinaryData.fromObject(model).toObject(ProtectionContainerProperties.class); + Assertions.assertEquals("pgn", model.fabricFriendlyName()); + Assertions.assertEquals("txhp", model.friendlyName()); + Assertions.assertEquals("bzpfzab", model.fabricType()); + Assertions.assertEquals(687811406, model.protectedItemCount()); + Assertions.assertEquals("hxw", model.pairingStatus()); + Assertions.assertEquals("tyq", model.role()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionProfileCustomDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionProfileCustomDetailsTests.java new file mode 100644 index 000000000000..c299947f7285 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProtectionProfileCustomDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionProfileCustomDetails; + +public final class ProtectionProfileCustomDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProtectionProfileCustomDetails model = + BinaryData + .fromString("{\"resourceType\":\"ProtectionProfileCustomDetails\"}") + .toObject(ProtectionProfileCustomDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProtectionProfileCustomDetails model = new ProtectionProfileCustomDetails(); + model = BinaryData.fromObject(model).toObject(ProtectionProfileCustomDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProviderSpecificRecoveryPointDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProviderSpecificRecoveryPointDetailsTests.java new file mode 100644 index 000000000000..73325ba44bda --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ProviderSpecificRecoveryPointDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails; + +public final class ProviderSpecificRecoveryPointDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProviderSpecificRecoveryPointDetails model = + BinaryData + .fromString("{\"instanceType\":\"ProviderSpecificRecoveryPointDetails\"}") + .toObject(ProviderSpecificRecoveryPointDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProviderSpecificRecoveryPointDetails model = new ProviderSpecificRecoveryPointDetails(); + model = BinaryData.fromObject(model).toObject(ProviderSpecificRecoveryPointDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryAvailabilitySetCustomDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryAvailabilitySetCustomDetailsTests.java new file mode 100644 index 000000000000..85ce7cc7d605 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryAvailabilitySetCustomDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryAvailabilitySetCustomDetails; + +public final class RecoveryAvailabilitySetCustomDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryAvailabilitySetCustomDetails model = + BinaryData + .fromString("{\"resourceType\":\"RecoveryAvailabilitySetCustomDetails\"}") + .toObject(RecoveryAvailabilitySetCustomDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryAvailabilitySetCustomDetails model = new RecoveryAvailabilitySetCustomDetails(); + model = BinaryData.fromObject(model).toObject(RecoveryAvailabilitySetCustomDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanA2ADetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanA2ADetailsTests.java new file mode 100644 index 000000000000..46e549dcfcd4 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanA2ADetailsTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocationType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanA2ADetails; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanA2ADetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanA2ADetails model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"primaryZone\":\"tnsugisno\",\"recoveryZone\":\"nwnghojov\",\"primaryExtendedLocation\":{\"name\":\"y\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"cjixxf\",\"type\":\"EdgeZone\"}}") + .toObject(RecoveryPlanA2ADetails.class); + Assertions.assertEquals("tnsugisno", model.primaryZone()); + Assertions.assertEquals("nwnghojov", model.recoveryZone()); + Assertions.assertEquals("y", model.primaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.primaryExtendedLocation().type()); + Assertions.assertEquals("cjixxf", model.recoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.recoveryExtendedLocation().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanA2ADetails model = + new RecoveryPlanA2ADetails() + .withPrimaryZone("tnsugisno") + .withRecoveryZone("nwnghojov") + .withPrimaryExtendedLocation( + new ExtendedLocation().withName("y").withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation().withName("cjixxf").withType(ExtendedLocationType.EDGE_ZONE)); + model = BinaryData.fromObject(model).toObject(RecoveryPlanA2ADetails.class); + Assertions.assertEquals("tnsugisno", model.primaryZone()); + Assertions.assertEquals("nwnghojov", model.recoveryZone()); + Assertions.assertEquals("y", model.primaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.primaryExtendedLocation().type()); + Assertions.assertEquals("cjixxf", model.recoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.recoveryExtendedLocation().type()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanA2AFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanA2AFailoverInputTests.java new file mode 100644 index 000000000000..e0afc519967c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanA2AFailoverInputTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.A2ARpRecoveryPointType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.MultiVmSyncPointOption; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanA2AFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanA2AFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanA2AFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"recoveryPointType\":\"LatestApplicationConsistent\",\"cloudServiceCreationOption\":\"rtnuguefxxijteb\",\"multiVmSyncPointOption\":\"UsePerVmRecoveryPoint\"}") + .toObject(RecoveryPlanA2AFailoverInput.class); + Assertions.assertEquals(A2ARpRecoveryPointType.LATEST_APPLICATION_CONSISTENT, model.recoveryPointType()); + Assertions.assertEquals("rtnuguefxxijteb", model.cloudServiceCreationOption()); + Assertions.assertEquals(MultiVmSyncPointOption.USE_PER_VM_RECOVERY_POINT, model.multiVmSyncPointOption()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanA2AFailoverInput model = + new RecoveryPlanA2AFailoverInput() + .withRecoveryPointType(A2ARpRecoveryPointType.LATEST_APPLICATION_CONSISTENT) + .withCloudServiceCreationOption("rtnuguefxxijteb") + .withMultiVmSyncPointOption(MultiVmSyncPointOption.USE_PER_VM_RECOVERY_POINT); + model = BinaryData.fromObject(model).toObject(RecoveryPlanA2AFailoverInput.class); + Assertions.assertEquals(A2ARpRecoveryPointType.LATEST_APPLICATION_CONSISTENT, model.recoveryPointType()); + Assertions.assertEquals("rtnuguefxxijteb", model.cloudServiceCreationOption()); + Assertions.assertEquals(MultiVmSyncPointOption.USE_PER_VM_RECOVERY_POINT, model.multiVmSyncPointOption()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanA2AInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanA2AInputTests.java new file mode 100644 index 000000000000..5813aabc923e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanA2AInputTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ExtendedLocationType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanA2AInput; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanA2AInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanA2AInput model = + BinaryData + .fromString( + "{\"instanceType\":\"A2A\",\"primaryZone\":\"wetkrhlolmc\",\"recoveryZone\":\"epfgsvbbvaqdl\",\"primaryExtendedLocation\":{\"name\":\"petlrn\",\"type\":\"EdgeZone\"},\"recoveryExtendedLocation\":{\"name\":\"tawevxehu\",\"type\":\"EdgeZone\"}}") + .toObject(RecoveryPlanA2AInput.class); + Assertions.assertEquals("wetkrhlolmc", model.primaryZone()); + Assertions.assertEquals("epfgsvbbvaqdl", model.recoveryZone()); + Assertions.assertEquals("petlrn", model.primaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.primaryExtendedLocation().type()); + Assertions.assertEquals("tawevxehu", model.recoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.recoveryExtendedLocation().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanA2AInput model = + new RecoveryPlanA2AInput() + .withPrimaryZone("wetkrhlolmc") + .withRecoveryZone("epfgsvbbvaqdl") + .withPrimaryExtendedLocation( + new ExtendedLocation().withName("petlrn").withType(ExtendedLocationType.EDGE_ZONE)) + .withRecoveryExtendedLocation( + new ExtendedLocation().withName("tawevxehu").withType(ExtendedLocationType.EDGE_ZONE)); + model = BinaryData.fromObject(model).toObject(RecoveryPlanA2AInput.class); + Assertions.assertEquals("wetkrhlolmc", model.primaryZone()); + Assertions.assertEquals("epfgsvbbvaqdl", model.recoveryZone()); + Assertions.assertEquals("petlrn", model.primaryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.primaryExtendedLocation().type()); + Assertions.assertEquals("tawevxehu", model.recoveryExtendedLocation().name()); + Assertions.assertEquals(ExtendedLocationType.EDGE_ZONE, model.recoveryExtendedLocation().type()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanActionDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanActionDetailsTests.java new file mode 100644 index 000000000000..56eb4f922d84 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanActionDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; + +public final class RecoveryPlanActionDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanActionDetails model = + BinaryData + .fromString("{\"instanceType\":\"RecoveryPlanActionDetails\"}") + .toObject(RecoveryPlanActionDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanActionDetails model = new RecoveryPlanActionDetails(); + model = BinaryData.fromObject(model).toObject(RecoveryPlanActionDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanActionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanActionTests.java new file mode 100644 index 000000000000..9da602bc6451 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanActionTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanActionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanAction model = + BinaryData + .fromString( + "{\"actionName\":\"tod\",\"failoverTypes\":[\"RepairReplication\",\"UnplannedFailover\",\"TestFailoverCleanup\",\"PlannedFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}") + .toObject(RecoveryPlanAction.class); + Assertions.assertEquals("tod", model.actionName()); + Assertions.assertEquals(ReplicationProtectedItemOperation.REPAIR_REPLICATION, model.failoverTypes().get(0)); + Assertions.assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.failoverDirections().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanAction model = + new RecoveryPlanAction() + .withActionName("tod") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.REPAIR_REPLICATION, + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.PLANNED_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()); + model = BinaryData.fromObject(model).toObject(RecoveryPlanAction.class); + Assertions.assertEquals("tod", model.actionName()); + Assertions.assertEquals(ReplicationProtectedItemOperation.REPAIR_REPLICATION, model.failoverTypes().get(0)); + Assertions.assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.failoverDirections().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanAutomationRunbookActionDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanAutomationRunbookActionDetailsTests.java new file mode 100644 index 000000000000..bb129e27a27c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanAutomationRunbookActionDetailsTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionLocation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAutomationRunbookActionDetails; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanAutomationRunbookActionDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanAutomationRunbookActionDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"AutomationRunbookActionDetails\",\"runbookId\":\"xljzvdovbrbl\",\"timeout\":\"lprdaqccddcbnygd\",\"fabricLocation\":\"Primary\"}") + .toObject(RecoveryPlanAutomationRunbookActionDetails.class); + Assertions.assertEquals("xljzvdovbrbl", model.runbookId()); + Assertions.assertEquals("lprdaqccddcbnygd", model.timeout()); + Assertions.assertEquals(RecoveryPlanActionLocation.PRIMARY, model.fabricLocation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanAutomationRunbookActionDetails model = + new RecoveryPlanAutomationRunbookActionDetails() + .withRunbookId("xljzvdovbrbl") + .withTimeout("lprdaqccddcbnygd") + .withFabricLocation(RecoveryPlanActionLocation.PRIMARY); + model = BinaryData.fromObject(model).toObject(RecoveryPlanAutomationRunbookActionDetails.class); + Assertions.assertEquals("xljzvdovbrbl", model.runbookId()); + Assertions.assertEquals("lprdaqccddcbnygd", model.timeout()); + Assertions.assertEquals(RecoveryPlanActionLocation.PRIMARY, model.fabricLocation()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanCollectionTests.java new file mode 100644 index 000000000000..7304c55b3ecd --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanCollectionTests.java @@ -0,0 +1,790 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.RecoveryPlanInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CurrentScenarioDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroup; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"friendlyName\":\"khgb\",\"primaryFabricId\":\"ta\",\"primaryFabricFriendlyName\":\"rfdl\",\"recoveryFabricId\":\"kh\",\"recoveryFabricFriendlyName\":\"rne\",\"failoverDeploymentModel\":\"jcpeogkhnmg\",\"replicationProviders\":[\"uxddbhfh\",\"fpazjzoywjxhpd\",\"lontacnpq\",\"tehtuevrhrljyoog\"],\"allowedOperations\":[\"nsduugwbsre\",\"rfqkfuar\",\"nlvhhtklnvnafvv\",\"yfedevjbo\"],\"lastPlannedFailoverTime\":\"2021-06-07T05:21:39Z\",\"lastUnplannedFailoverTime\":\"2021-09-09T03:44:16Z\",\"lastTestFailoverTime\":\"2021-02-13T17:58:26Z\",\"currentScenario\":{\"scenarioName\":\"khminqcymc\",\"jobId\":\"gn\",\"startTime\":\"2021-04-29T07:37:31Z\"},\"currentScenarioStatus\":\"ewuninvud\",\"currentScenarioStatusDescription\":\"h\",\"groups\":[{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"rqctmxxdtdd\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"flhuytxzv\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"zna\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"xbannovvoxc\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"prwnwvroevytlyo\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"rrrouuxvnsa\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"o\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"izrxklob\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"xnazpmkml\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"vevfxz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"hbzxli\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"hrdd\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"tfgxqbawpcb\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"nzqcy\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"qofyuicdhzbdy\",\"id\":\"wwgbdv\",\"name\":\"bid\",\"type\":\"hmwffplfmuv\"},{\"properties\":{\"friendlyName\":\"kccrrvwey\",\"primaryFabricId\":\"oy\",\"primaryFabricFriendlyName\":\"k\",\"recoveryFabricId\":\"aimmoiroqb\",\"recoveryFabricFriendlyName\":\"hbragapyyr\",\"failoverDeploymentModel\":\"svbpavbopfppdbwn\",\"replicationProviders\":[\"ahxku\",\"asjcaacfdmmcpu\",\"mehqepvufh\",\"zeh\"],\"allowedOperations\":[\"oqhnlb\",\"nbldxeaclgschori\"],\"lastPlannedFailoverTime\":\"2021-03-13T23:48:24Z\",\"lastUnplannedFailoverTime\":\"2021-07-09T02:56:18Z\",\"lastTestFailoverTime\":\"2021-11-28T04:18:19Z\",\"currentScenario\":{\"scenarioName\":\"cso\",\"jobId\":\"dpuviyf\",\"startTime\":\"2021-07-10T14:09:36Z\"},\"currentScenarioStatus\":\"eolhbhlvbmx\",\"currentScenarioStatusDescription\":\"ibsxtkcud\",\"groups\":[{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"iowl\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jxnqp\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"wgfstmhqykizm\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"aoaf\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"luqvoxmycjimryv\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"gc\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"mzgwe\",\"id\":\"ydsx\",\"name\":\"efoh\",\"type\":\"cbvopwndyqleallk\"},{\"properties\":{\"friendlyName\":\"khlowkxxpv\",\"primaryFabricId\":\"dfjmzsyzfhotlh\",\"primaryFabricFriendlyName\":\"cyychunsjlp\",\"recoveryFabricId\":\"twszhvvuic\",\"recoveryFabricFriendlyName\":\"vtrrmhwrbfdpyflu\",\"failoverDeploymentModel\":\"vjglrocuyzlwhhme\",\"replicationProviders\":[\"oclu\",\"n\"],\"allowedOperations\":[\"emc\",\"jk\",\"mykyujxsglhs\"],\"lastPlannedFailoverTime\":\"2021-06-30T11:59:37Z\",\"lastUnplannedFailoverTime\":\"2021-09-26T10:44:20Z\",\"lastTestFailoverTime\":\"2021-04-08T08:51:31Z\",\"currentScenario\":{\"scenarioName\":\"bkzudnigrfihot\",\"jobId\":\"wlpxuzzjg\",\"startTime\":\"2021-05-28T23:16:03Z\"},\"currentScenarioStatus\":\"qyhqo\",\"currentScenarioStatusDescription\":\"ihiqakydiw\",\"groups\":[{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"qtvhcspodaqax\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ipietgbe\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"ulbmoichdlp\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"fpubntnbatz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"iqsowsaaelc\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"hplrvkmjcwmjvlg\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ggcvk\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"y\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"izrzb\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"fxsfuztlvtmv\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"gbwidqlvh\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"fizr\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jfnmjmvlwyz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"iblkujr\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"lfojuidjp\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"jucejikzoeovvtz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"je\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jklntikyj\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{},{},{}],\"startGroupActions\":[{\"actionName\":\"zolxrzvhqjwtr\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"tgvgzp\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"rrkolawjmjs\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"okcdxfzzzwyjaf\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"tlhguynuchl\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"mltx\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"whmozusgzvlnsnnj\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"folpymwamxqzra\",\"id\":\"p\",\"name\":\"dphtv\",\"type\":\"ulajvlejchc\"},{\"properties\":{\"friendlyName\":\"zknmzlanrupd\",\"primaryFabricId\":\"nphcnzqtpjhmqrh\",\"primaryFabricFriendlyName\":\"hlaiwd\",\"recoveryFabricId\":\"smlzzhzdtxetlgy\",\"recoveryFabricFriendlyName\":\"hqvlnnpxybafiqg\",\"failoverDeploymentModel\":\"arbgjekgl\",\"replicationProviders\":[\"yulidwcwvm\"],\"allowedOperations\":[\"jonfhjirwgdnqzbr\"],\"lastPlannedFailoverTime\":\"2021-08-15T23:23:18Z\",\"lastUnplannedFailoverTime\":\"2021-02-01T12:15:25Z\",\"lastTestFailoverTime\":\"2021-01-01T19:33:39Z\",\"currentScenario\":{\"scenarioName\":\"ksjcitdigs\",\"jobId\":\"dglj\",\"startTime\":\"2021-04-10T15:56:09Z\"},\"currentScenarioStatus\":\"ua\",\"currentScenarioStatusDescription\":\"tomflrytswfpf\",\"groups\":[{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"skw\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"qjjyslurl\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"shhkvpedw\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"srhmpqvww\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"kondcb\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"wimuvqej\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"so\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{}],\"startGroupActions\":[{\"actionName\":\"a\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"sinuqtljqobbpih\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"ecybmrqbrj\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"bmpxdlvykfrexc\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"s\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"qwjksghudgz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{},{}],\"startGroupActions\":[{\"actionName\":\"gsv\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"u\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"kxibdafh\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"kmdyomkxfbvfbh\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"rhpw\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"mawzovgk\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"ui\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jcjcazt\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"wsnsqowx\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"comlikytwvczc\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"cvejyfdvlvhbwrn\",\"id\":\"xt\",\"name\":\"ddpqt\",\"type\":\"ehnmnaoyankco\"}],\"nextLink\":\"swankltytmh\"}") + .toObject(RecoveryPlanCollection.class); + Assertions.assertEquals("khgb", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("ta", model.value().get(0).properties().primaryFabricId()); + Assertions.assertEquals("rfdl", model.value().get(0).properties().primaryFabricFriendlyName()); + Assertions.assertEquals("kh", model.value().get(0).properties().recoveryFabricId()); + Assertions.assertEquals("rne", model.value().get(0).properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("jcpeogkhnmg", model.value().get(0).properties().failoverDeploymentModel()); + Assertions.assertEquals("uxddbhfh", model.value().get(0).properties().replicationProviders().get(0)); + Assertions.assertEquals("nsduugwbsre", model.value().get(0).properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-06-07T05:21:39Z"), + model.value().get(0).properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-09-09T03:44:16Z"), + model.value().get(0).properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-02-13T17:58:26Z"), model.value().get(0).properties().lastTestFailoverTime()); + Assertions.assertEquals("khminqcymc", model.value().get(0).properties().currentScenario().scenarioName()); + Assertions.assertEquals("gn", model.value().get(0).properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-29T07:37:31Z"), + model.value().get(0).properties().currentScenario().startTime()); + Assertions.assertEquals("ewuninvud", model.value().get(0).properties().currentScenarioStatus()); + Assertions.assertEquals("h", model.value().get(0).properties().currentScenarioStatusDescription()); + Assertions + .assertEquals( + RecoveryPlanGroupType.FAILOVER, model.value().get(0).properties().groups().get(0).groupType()); + Assertions + .assertEquals( + "rqctmxxdtdd", + model.value().get(0).properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + "prwnwvroevytlyo", + model.value().get(0).properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("qofyuicdhzbdy", model.value().get(0).location()); + Assertions.assertEquals("swankltytmh", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanCollection model = + new RecoveryPlanCollection() + .withValue( + Arrays + .asList( + new RecoveryPlanInner() + .withProperties( + new RecoveryPlanProperties() + .withFriendlyName("khgb") + .withPrimaryFabricId("ta") + .withPrimaryFabricFriendlyName("rfdl") + .withRecoveryFabricId("kh") + .withRecoveryFabricFriendlyName("rne") + .withFailoverDeploymentModel("jcpeogkhnmg") + .withReplicationProviders( + Arrays + .asList("uxddbhfh", "fpazjzoywjxhpd", "lontacnpq", "tehtuevrhrljyoog")) + .withAllowedOperations( + Arrays.asList("nsduugwbsre", "rfqkfuar", "nlvhhtklnvnafvv", "yfedevjbo")) + .withLastPlannedFailoverTime(OffsetDateTime.parse("2021-06-07T05:21:39Z")) + .withLastUnplannedFailoverTime(OffsetDateTime.parse("2021-09-09T03:44:16Z")) + .withLastTestFailoverTime(OffsetDateTime.parse("2021-02-13T17:58:26Z")) + .withCurrentScenario( + new CurrentScenarioDetails() + .withScenarioName("khminqcymc") + .withJobId("gn") + .withStartTime(OffsetDateTime.parse("2021-04-29T07:37:31Z"))) + .withCurrentScenarioStatus("ewuninvud") + .withCurrentScenarioStatusDescription("h") + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("rqctmxxdtdd") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("flhuytxzv") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("zna") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("xbannovvoxc") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("prwnwvroevytlyo") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("rrrouuxvnsa") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.SHUTDOWN) + .withReplicationProtectedItems( + Arrays.asList(new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("o") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("izrxklob") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("xnazpmkml") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("vevfxz") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("hbzxli") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("hrdd") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("tfgxqbawpcb") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("nzqcy") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))))) + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificDetails(), + new RecoveryPlanProviderSpecificDetails(), + new RecoveryPlanProviderSpecificDetails()))) + .withLocation("qofyuicdhzbdy"), + new RecoveryPlanInner() + .withProperties( + new RecoveryPlanProperties() + .withFriendlyName("kccrrvwey") + .withPrimaryFabricId("oy") + .withPrimaryFabricFriendlyName("k") + .withRecoveryFabricId("aimmoiroqb") + .withRecoveryFabricFriendlyName("hbragapyyr") + .withFailoverDeploymentModel("svbpavbopfppdbwn") + .withReplicationProviders( + Arrays.asList("ahxku", "asjcaacfdmmcpu", "mehqepvufh", "zeh")) + .withAllowedOperations(Arrays.asList("oqhnlb", "nbldxeaclgschori")) + .withLastPlannedFailoverTime(OffsetDateTime.parse("2021-03-13T23:48:24Z")) + .withLastUnplannedFailoverTime(OffsetDateTime.parse("2021-07-09T02:56:18Z")) + .withLastTestFailoverTime(OffsetDateTime.parse("2021-11-28T04:18:19Z")) + .withCurrentScenario( + new CurrentScenarioDetails() + .withScenarioName("cso") + .withJobId("dpuviyf") + .withStartTime(OffsetDateTime.parse("2021-07-10T14:09:36Z"))) + .withCurrentScenarioStatus("eolhbhlvbmx") + .withCurrentScenarioStatusDescription("ibsxtkcud") + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("iowl") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("jxnqp") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("wgfstmhqykizm") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("aoaf") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("luqvoxmycjimryv") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("gc") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))))) + .withProviderSpecificDetails( + Arrays.asList(new RecoveryPlanProviderSpecificDetails()))) + .withLocation("mzgwe"), + new RecoveryPlanInner() + .withProperties( + new RecoveryPlanProperties() + .withFriendlyName("khlowkxxpv") + .withPrimaryFabricId("dfjmzsyzfhotlh") + .withPrimaryFabricFriendlyName("cyychunsjlp") + .withRecoveryFabricId("twszhvvuic") + .withRecoveryFabricFriendlyName("vtrrmhwrbfdpyflu") + .withFailoverDeploymentModel("vjglrocuyzlwhhme") + .withReplicationProviders(Arrays.asList("oclu", "n")) + .withAllowedOperations(Arrays.asList("emc", "jk", "mykyujxsglhs")) + .withLastPlannedFailoverTime(OffsetDateTime.parse("2021-06-30T11:59:37Z")) + .withLastUnplannedFailoverTime(OffsetDateTime.parse("2021-09-26T10:44:20Z")) + .withLastTestFailoverTime(OffsetDateTime.parse("2021-04-08T08:51:31Z")) + .withCurrentScenario( + new CurrentScenarioDetails() + .withScenarioName("bkzudnigrfihot") + .withJobId("wlpxuzzjg") + .withStartTime(OffsetDateTime.parse("2021-05-28T23:16:03Z"))) + .withCurrentScenarioStatus("qyhqo") + .withCurrentScenarioStatusDescription("ihiqakydiw") + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("qtvhcspodaqax") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("ipietgbe") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("ulbmoichdlp") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("fpubntnbatz") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("iqsowsaaelc") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("hplrvkmjcwmjvlg") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("ggcvk") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("y") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("izrzb") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("fxsfuztlvtmv") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("gbwidqlvh") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays.asList(new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("fizr") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("jfnmjmvlwyz") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("iblkujr") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("lfojuidjp") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("jucejikzoeovvtz") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("je") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("jklntikyj") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("zolxrzvhqjwtr") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("tgvgzp") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("rrkolawjmjs") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("okcdxfzzzwyjaf") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("tlhguynuchl") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("mltx") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("whmozusgzvlnsnnj") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))))) + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificDetails(), + new RecoveryPlanProviderSpecificDetails()))) + .withLocation("folpymwamxqzra"), + new RecoveryPlanInner() + .withProperties( + new RecoveryPlanProperties() + .withFriendlyName("zknmzlanrupd") + .withPrimaryFabricId("nphcnzqtpjhmqrh") + .withPrimaryFabricFriendlyName("hlaiwd") + .withRecoveryFabricId("smlzzhzdtxetlgy") + .withRecoveryFabricFriendlyName("hqvlnnpxybafiqg") + .withFailoverDeploymentModel("arbgjekgl") + .withReplicationProviders(Arrays.asList("yulidwcwvm")) + .withAllowedOperations(Arrays.asList("jonfhjirwgdnqzbr")) + .withLastPlannedFailoverTime(OffsetDateTime.parse("2021-08-15T23:23:18Z")) + .withLastUnplannedFailoverTime(OffsetDateTime.parse("2021-02-01T12:15:25Z")) + .withLastTestFailoverTime(OffsetDateTime.parse("2021-01-01T19:33:39Z")) + .withCurrentScenario( + new CurrentScenarioDetails() + .withScenarioName("ksjcitdigs") + .withJobId("dglj") + .withStartTime(OffsetDateTime.parse("2021-04-10T15:56:09Z"))) + .withCurrentScenarioStatus("ua") + .withCurrentScenarioStatusDescription("tomflrytswfpf") + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays.asList(new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("skw") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("qjjyslurl") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("shhkvpedw") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("srhmpqvww") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("kondcb") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("wimuvqej") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("so") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("a") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("sinuqtljqobbpih") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("ecybmrqbrj") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("bmpxdlvykfrexc") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("s") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("qwjksghudgz") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.SHUTDOWN) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("gsv") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("u") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("kxibdafh") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("kmdyomkxfbvfbh") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("rhpw") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("mawzovgk") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("ui") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("jcjcazt") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("wsnsqowx") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("comlikytwvczc") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails( + new RecoveryPlanActionDetails()))))) + .withProviderSpecificDetails( + Arrays.asList(new RecoveryPlanProviderSpecificDetails()))) + .withLocation("cvejyfdvlvhbwrn"))) + .withNextLink("swankltytmh"); + model = BinaryData.fromObject(model).toObject(RecoveryPlanCollection.class); + Assertions.assertEquals("khgb", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("ta", model.value().get(0).properties().primaryFabricId()); + Assertions.assertEquals("rfdl", model.value().get(0).properties().primaryFabricFriendlyName()); + Assertions.assertEquals("kh", model.value().get(0).properties().recoveryFabricId()); + Assertions.assertEquals("rne", model.value().get(0).properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("jcpeogkhnmg", model.value().get(0).properties().failoverDeploymentModel()); + Assertions.assertEquals("uxddbhfh", model.value().get(0).properties().replicationProviders().get(0)); + Assertions.assertEquals("nsduugwbsre", model.value().get(0).properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-06-07T05:21:39Z"), + model.value().get(0).properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-09-09T03:44:16Z"), + model.value().get(0).properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-02-13T17:58:26Z"), model.value().get(0).properties().lastTestFailoverTime()); + Assertions.assertEquals("khminqcymc", model.value().get(0).properties().currentScenario().scenarioName()); + Assertions.assertEquals("gn", model.value().get(0).properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-29T07:37:31Z"), + model.value().get(0).properties().currentScenario().startTime()); + Assertions.assertEquals("ewuninvud", model.value().get(0).properties().currentScenarioStatus()); + Assertions.assertEquals("h", model.value().get(0).properties().currentScenarioStatusDescription()); + Assertions + .assertEquals( + RecoveryPlanGroupType.FAILOVER, model.value().get(0).properties().groups().get(0).groupType()); + Assertions + .assertEquals( + "rqctmxxdtdd", + model.value().get(0).properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + "prwnwvroevytlyo", + model.value().get(0).properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("qofyuicdhzbdy", model.value().get(0).location()); + Assertions.assertEquals("swankltytmh", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanGroupTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanGroupTests.java new file mode 100644 index 000000000000..d6d67a3efa97 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanGroupTests.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroup; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanGroupTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanGroup model = + BinaryData + .fromString( + "{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{\"id\":\"zdcgdzbenr\",\"virtualMachineId\":\"cawetzqddt\"},{\"id\":\"fljhznamtua\",\"virtualMachineId\":\"zwcjjncqtj\"}],\"startGroupActions\":[{\"actionName\":\"zvgbgat\",\"failoverTypes\":[\"ChangePit\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"rebwggahtt\",\"failoverTypes\":[\"TestFailover\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jqfutlxj\",\"failoverTypes\":[\"SwitchProtection\",\"CancelFailover\",\"TestFailoverCleanup\",\"ReverseReplicate\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"j\",\"failoverTypes\":[\"RepairReplication\",\"CompleteMigration\",\"TestFailoverCleanup\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"cmbuocnjrohmbpy\",\"failoverTypes\":[\"SwitchProtection\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}") + .toObject(RecoveryPlanGroup.class); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, model.groupType()); + Assertions.assertEquals("zdcgdzbenr", model.replicationProtectedItems().get(0).id()); + Assertions.assertEquals("cawetzqddt", model.replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("zvgbgat", model.startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CHANGE_PIT, model.startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.startGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("rebwggahtt", model.endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.TEST_FAILOVER, model.endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.endGroupActions().get(0).failoverDirections().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanGroup model = + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem().withId("zdcgdzbenr").withVirtualMachineId("cawetzqddt"), + new RecoveryPlanProtectedItem().withId("fljhznamtua").withVirtualMachineId("zwcjjncqtj"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("zvgbgat") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.CHANGE_PIT, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections(Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("rebwggahtt") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.TEST_FAILOVER, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections(Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("jqfutlxj") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.SWITCH_PROTECTION, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.REVERSE_REPLICATE)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("j") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.REPAIR_REPLICATION, + ReplicationProtectedItemOperation.COMPLETE_MIGRATION, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("cmbuocnjrohmbpy") + .withFailoverTypes(Arrays.asList(ReplicationProtectedItemOperation.SWITCH_PROTECTION)) + .withFailoverDirections(Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))); + model = BinaryData.fromObject(model).toObject(RecoveryPlanGroup.class); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, model.groupType()); + Assertions.assertEquals("zdcgdzbenr", model.replicationProtectedItems().get(0).id()); + Assertions.assertEquals("cawetzqddt", model.replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("zvgbgat", model.startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CHANGE_PIT, model.startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.startGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("rebwggahtt", model.endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.TEST_FAILOVER, model.endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.endGroupActions().get(0).failoverDirections().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanHyperVReplicaAzureFailbackInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanHyperVReplicaAzureFailbackInputTests.java new file mode 100644 index 000000000000..bebfbd926be3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanHyperVReplicaAzureFailbackInputTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AlternateLocationRecoveryOption; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DataSyncStatus; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanHyperVReplicaAzureFailbackInput; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanHyperVReplicaAzureFailbackInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanHyperVReplicaAzureFailbackInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzureFailback\",\"dataSyncOption\":\"ForSynchronization\",\"recoveryVmCreationOption\":\"CreateVmIfNotFound\"}") + .toObject(RecoveryPlanHyperVReplicaAzureFailbackInput.class); + Assertions.assertEquals(DataSyncStatus.FOR_SYNCHRONIZATION, model.dataSyncOption()); + Assertions + .assertEquals(AlternateLocationRecoveryOption.CREATE_VM_IF_NOT_FOUND, model.recoveryVmCreationOption()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanHyperVReplicaAzureFailbackInput model = + new RecoveryPlanHyperVReplicaAzureFailbackInput() + .withDataSyncOption(DataSyncStatus.FOR_SYNCHRONIZATION) + .withRecoveryVmCreationOption(AlternateLocationRecoveryOption.CREATE_VM_IF_NOT_FOUND); + model = BinaryData.fromObject(model).toObject(RecoveryPlanHyperVReplicaAzureFailbackInput.class); + Assertions.assertEquals(DataSyncStatus.FOR_SYNCHRONIZATION, model.dataSyncOption()); + Assertions + .assertEquals(AlternateLocationRecoveryOption.CREATE_VM_IF_NOT_FOUND, model.recoveryVmCreationOption()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanHyperVReplicaAzureFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanHyperVReplicaAzureFailoverInputTests.java new file mode 100644 index 000000000000..0a141b7c5cd4 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanHyperVReplicaAzureFailoverInputTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.HyperVReplicaAzureRpRecoveryPointType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanHyperVReplicaAzureFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanHyperVReplicaAzureFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanHyperVReplicaAzureFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"HyperVReplicaAzure\",\"primaryKekCertificatePfx\":\"vtzldzchubagwn\",\"secondaryKekCertificatePfx\":\"uvigv\",\"recoveryPointType\":\"Latest\"}") + .toObject(RecoveryPlanHyperVReplicaAzureFailoverInput.class); + Assertions.assertEquals("vtzldzchubagwn", model.primaryKekCertificatePfx()); + Assertions.assertEquals("uvigv", model.secondaryKekCertificatePfx()); + Assertions.assertEquals(HyperVReplicaAzureRpRecoveryPointType.LATEST, model.recoveryPointType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanHyperVReplicaAzureFailoverInput model = + new RecoveryPlanHyperVReplicaAzureFailoverInput() + .withPrimaryKekCertificatePfx("vtzldzchubagwn") + .withSecondaryKekCertificatePfx("uvigv") + .withRecoveryPointType(HyperVReplicaAzureRpRecoveryPointType.LATEST); + model = BinaryData.fromObject(model).toObject(RecoveryPlanHyperVReplicaAzureFailoverInput.class); + Assertions.assertEquals("vtzldzchubagwn", model.primaryKekCertificatePfx()); + Assertions.assertEquals("uvigv", model.secondaryKekCertificatePfx()); + Assertions.assertEquals(HyperVReplicaAzureRpRecoveryPointType.LATEST, model.recoveryPointType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageAzureV2FailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageAzureV2FailoverInputTests.java new file mode 100644 index 000000000000..ce6bb50eeff8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageAzureV2FailoverInputTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageV2RpRecoveryPointType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanInMageAzureV2FailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanInMageAzureV2FailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanInMageAzureV2FailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageAzureV2\",\"recoveryPointType\":\"LatestApplicationConsistent\",\"useMultiVmSyncPoint\":\"bzakp\"}") + .toObject(RecoveryPlanInMageAzureV2FailoverInput.class); + Assertions.assertEquals(InMageV2RpRecoveryPointType.LATEST_APPLICATION_CONSISTENT, model.recoveryPointType()); + Assertions.assertEquals("bzakp", model.useMultiVmSyncPoint()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanInMageAzureV2FailoverInput model = + new RecoveryPlanInMageAzureV2FailoverInput() + .withRecoveryPointType(InMageV2RpRecoveryPointType.LATEST_APPLICATION_CONSISTENT) + .withUseMultiVmSyncPoint("bzakp"); + model = BinaryData.fromObject(model).toObject(RecoveryPlanInMageAzureV2FailoverInput.class); + Assertions.assertEquals(InMageV2RpRecoveryPointType.LATEST_APPLICATION_CONSISTENT, model.recoveryPointType()); + Assertions.assertEquals("bzakp", model.useMultiVmSyncPoint()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageFailoverInputTests.java new file mode 100644 index 000000000000..26e291d784a0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageFailoverInputTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanInMageFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RpInMageRecoveryPointType; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanInMageFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanInMageFailoverInput model = + BinaryData + .fromString("{\"instanceType\":\"InMage\",\"recoveryPointType\":\"LatestTag\"}") + .toObject(RecoveryPlanInMageFailoverInput.class); + Assertions.assertEquals(RpInMageRecoveryPointType.LATEST_TAG, model.recoveryPointType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanInMageFailoverInput model = + new RecoveryPlanInMageFailoverInput().withRecoveryPointType(RpInMageRecoveryPointType.LATEST_TAG); + model = BinaryData.fromObject(model).toObject(RecoveryPlanInMageFailoverInput.class); + Assertions.assertEquals(RpInMageRecoveryPointType.LATEST_TAG, model.recoveryPointType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageRcmFailbackFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageRcmFailbackFailoverInputTests.java new file mode 100644 index 000000000000..30cdaa53d922 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageRcmFailbackFailoverInputTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.InMageRcmFailbackRecoveryPointType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanInMageRcmFailbackFailoverInput; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanInMageRcmFailbackFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanInMageRcmFailbackFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcmFailback\",\"recoveryPointType\":\"ApplicationConsistent\",\"useMultiVmSyncPoint\":\"raqp\"}") + .toObject(RecoveryPlanInMageRcmFailbackFailoverInput.class); + Assertions.assertEquals(InMageRcmFailbackRecoveryPointType.APPLICATION_CONSISTENT, model.recoveryPointType()); + Assertions.assertEquals("raqp", model.useMultiVmSyncPoint()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanInMageRcmFailbackFailoverInput model = + new RecoveryPlanInMageRcmFailbackFailoverInput() + .withRecoveryPointType(InMageRcmFailbackRecoveryPointType.APPLICATION_CONSISTENT) + .withUseMultiVmSyncPoint("raqp"); + model = BinaryData.fromObject(model).toObject(RecoveryPlanInMageRcmFailbackFailoverInput.class); + Assertions.assertEquals(InMageRcmFailbackRecoveryPointType.APPLICATION_CONSISTENT, model.recoveryPointType()); + Assertions.assertEquals("raqp", model.useMultiVmSyncPoint()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageRcmFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageRcmFailoverInputTests.java new file mode 100644 index 000000000000..7da243b73928 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInMageRcmFailoverInputTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanInMageRcmFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanPointType; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanInMageRcmFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanInMageRcmFailoverInput model = + BinaryData + .fromString( + "{\"instanceType\":\"InMageRcm\",\"recoveryPointType\":\"LatestApplicationConsistent\",\"useMultiVmSyncPoint\":\"suc\"}") + .toObject(RecoveryPlanInMageRcmFailoverInput.class); + Assertions.assertEquals(RecoveryPlanPointType.LATEST_APPLICATION_CONSISTENT, model.recoveryPointType()); + Assertions.assertEquals("suc", model.useMultiVmSyncPoint()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanInMageRcmFailoverInput model = + new RecoveryPlanInMageRcmFailoverInput() + .withRecoveryPointType(RecoveryPlanPointType.LATEST_APPLICATION_CONSISTENT) + .withUseMultiVmSyncPoint("suc"); + model = BinaryData.fromObject(model).toObject(RecoveryPlanInMageRcmFailoverInput.class); + Assertions.assertEquals(RecoveryPlanPointType.LATEST_APPLICATION_CONSISTENT, model.recoveryPointType()); + Assertions.assertEquals("suc", model.useMultiVmSyncPoint()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInnerTests.java new file mode 100644 index 000000000000..b83254e65630 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanInnerTests.java @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.RecoveryPlanInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CurrentScenarioDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroup; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanInner model = + BinaryData + .fromString( + "{\"properties\":{\"friendlyName\":\"znnhd\",\"primaryFabricId\":\"ktgj\",\"primaryFabricFriendlyName\":\"gguxhemlwyw\",\"recoveryFabricId\":\"eczgfb\",\"recoveryFabricFriendlyName\":\"klelssxb\",\"failoverDeploymentModel\":\"c\",\"replicationProviders\":[\"ujksrlsmdesqplpv\",\"jcdoewb\",\"dyvt\"],\"allowedOperations\":[\"xvgpiude\",\"gfsxzec\",\"axwk\",\"fykhvuhxepmru\"],\"lastPlannedFailoverTime\":\"2021-01-01T13:09:47Z\",\"lastUnplannedFailoverTime\":\"2021-01-21T20:15:20Z\",\"lastTestFailoverTime\":\"2021-07-09T17:03:36Z\",\"currentScenario\":{\"scenarioName\":\"slujdjltym\",\"jobId\":\"vguihywar\",\"startTime\":\"2021-09-29T23:23Z\"},\"currentScenarioStatus\":\"hkixkykxdssj\",\"currentScenarioStatusDescription\":\"mmuc\",\"groups\":[{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{\"id\":\"lrmymyincqlhri\",\"virtualMachineId\":\"sl\"},{\"id\":\"iiovgqcgxu\",\"virtualMachineId\":\"qkctotiowlxte\"}],\"startGroupActions\":[{\"actionName\":\"tjgwdtguk\",\"failoverTypes\":[\"DisableProtection\",\"Commit\",\"CancelFailover\",\"Commit\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"kccuzgy\",\"failoverTypes\":[\"PlannedFailover\",\"SwitchProtection\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"lwgniiprglvawu\",\"failoverTypes\":[\"CancelFailover\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"pivlsbbjpm\",\"failoverTypes\":[\"TestFailoverCleanup\",\"CancelFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"xxkubvphavp\",\"failoverTypes\":[\"RepairReplication\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"gvgovpbbttefjo\",\"failoverTypes\":[\"Commit\",\"DisableProtection\",\"FinalizeFailback\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{\"id\":\"frdbiqmrjgeihf\",\"virtualMachineId\":\"ggwfiwz\"},{\"id\":\"mjpb\",\"virtualMachineId\":\"phmgtvljvrcmyfq\"},{\"id\":\"gxhnpomyqwcabv\",\"virtualMachineId\":\"ilee\"},{\"id\":\"swlpaugmrmfj\",\"virtualMachineId\":\"xwtoaukhfkvc\"}],\"startGroupActions\":[{\"actionName\":\"zmoaeds\",\"failoverTypes\":[\"Commit\",\"ChangePit\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"edwcgyee\",\"failoverTypes\":[\"Commit\",\"FinalizeFailback\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"g\",\"failoverTypes\":[\"PlannedFailover\",\"SwitchProtection\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"l\",\"failoverTypes\":[\"DisableProtection\",\"TestFailoverCleanup\",\"DisableProtection\",\"RepairReplication\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{\"id\":\"hvn\",\"virtualMachineId\":\"gnxkympqan\"},{\"id\":\"jk\",\"virtualMachineId\":\"tw\"},{\"id\":\"aoypny\",\"virtualMachineId\":\"shxcylhkg\"}],\"startGroupActions\":[{\"actionName\":\"ghpxycphdr\",\"failoverTypes\":[\"CompleteMigration\",\"RepairReplication\",\"ChangePit\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"omacluzvxnqmhr\",\"failoverTypes\":[\"FinalizeFailback\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"kois\",\"failoverTypes\":[\"DisableProtection\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"xuifmcsypobkdqz\",\"failoverTypes\":[\"CompleteMigration\",\"Commit\",\"ChangePit\",\"TestFailoverCleanup\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"lgtrczzy\",\"failoverTypes\":[\"DisableProtection\",\"UnplannedFailover\",\"TestFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"rkihcirld\",\"id\":\"fx\",\"name\":\"dcoxnbk\",\"type\":\"ja\"}") + .toObject(RecoveryPlanInner.class); + Assertions.assertEquals("znnhd", model.properties().friendlyName()); + Assertions.assertEquals("ktgj", model.properties().primaryFabricId()); + Assertions.assertEquals("gguxhemlwyw", model.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("eczgfb", model.properties().recoveryFabricId()); + Assertions.assertEquals("klelssxb", model.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("c", model.properties().failoverDeploymentModel()); + Assertions.assertEquals("ujksrlsmdesqplpv", model.properties().replicationProviders().get(0)); + Assertions.assertEquals("xvgpiude", model.properties().allowedOperations().get(0)); + Assertions + .assertEquals(OffsetDateTime.parse("2021-01-01T13:09:47Z"), model.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-01-21T20:15:20Z"), model.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-07-09T17:03:36Z"), model.properties().lastTestFailoverTime()); + Assertions.assertEquals("slujdjltym", model.properties().currentScenario().scenarioName()); + Assertions.assertEquals("vguihywar", model.properties().currentScenario().jobId()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-09-29T23:23Z"), model.properties().currentScenario().startTime()); + Assertions.assertEquals("hkixkykxdssj", model.properties().currentScenarioStatus()); + Assertions.assertEquals("mmuc", model.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.FAILOVER, model.properties().groups().get(0).groupType()); + Assertions + .assertEquals("lrmymyincqlhri", model.properties().groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals( + "sl", model.properties().groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions + .assertEquals("tjgwdtguk", model.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.DISABLE_PROTECTION, + model.properties().groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.properties().groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions + .assertEquals("lwgniiprglvawu", model.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + model.properties().groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.properties().groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("rkihcirld", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanInner model = + new RecoveryPlanInner() + .withProperties( + new RecoveryPlanProperties() + .withFriendlyName("znnhd") + .withPrimaryFabricId("ktgj") + .withPrimaryFabricFriendlyName("gguxhemlwyw") + .withRecoveryFabricId("eczgfb") + .withRecoveryFabricFriendlyName("klelssxb") + .withFailoverDeploymentModel("c") + .withReplicationProviders(Arrays.asList("ujksrlsmdesqplpv", "jcdoewb", "dyvt")) + .withAllowedOperations(Arrays.asList("xvgpiude", "gfsxzec", "axwk", "fykhvuhxepmru")) + .withLastPlannedFailoverTime(OffsetDateTime.parse("2021-01-01T13:09:47Z")) + .withLastUnplannedFailoverTime(OffsetDateTime.parse("2021-01-21T20:15:20Z")) + .withLastTestFailoverTime(OffsetDateTime.parse("2021-07-09T17:03:36Z")) + .withCurrentScenario( + new CurrentScenarioDetails() + .withScenarioName("slujdjltym") + .withJobId("vguihywar") + .withStartTime(OffsetDateTime.parse("2021-09-29T23:23Z"))) + .withCurrentScenarioStatus("hkixkykxdssj") + .withCurrentScenarioStatusDescription("mmuc") + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("lrmymyincqlhri") + .withVirtualMachineId("sl"), + new RecoveryPlanProtectedItem() + .withId("iiovgqcgxu") + .withVirtualMachineId("qkctotiowlxte"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("tjgwdtguk") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .DISABLE_PROTECTION, + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.COMMIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("kccuzgy") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation + .SWITCH_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("lwgniiprglvawu") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.CANCEL_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("pivlsbbjpm") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.CANCEL_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("xxkubvphavp") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .REPAIR_REPLICATION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("gvgovpbbttefjo") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation + .DISABLE_PROTECTION, + ReplicationProtectedItemOperation + .FINALIZE_FAILBACK)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("frdbiqmrjgeihf") + .withVirtualMachineId("ggwfiwz"), + new RecoveryPlanProtectedItem() + .withId("mjpb") + .withVirtualMachineId("phmgtvljvrcmyfq"), + new RecoveryPlanProtectedItem() + .withId("gxhnpomyqwcabv") + .withVirtualMachineId("ilee"), + new RecoveryPlanProtectedItem() + .withId("swlpaugmrmfj") + .withVirtualMachineId("xwtoaukhfkvc"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("zmoaeds") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("edwcgyee") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("g") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation + .SWITCH_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("l") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .DISABLE_PROTECTION, + ReplicationProtectedItemOperation + .TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation + .DISABLE_PROTECTION, + ReplicationProtectedItemOperation + .REPAIR_REPLICATION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("hvn") + .withVirtualMachineId("gnxkympqan"), + new RecoveryPlanProtectedItem() + .withId("jk") + .withVirtualMachineId("tw"), + new RecoveryPlanProtectedItem() + .withId("aoypny") + .withVirtualMachineId("shxcylhkg"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("ghpxycphdr") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .COMPLETE_MIGRATION, + ReplicationProtectedItemOperation + .REPAIR_REPLICATION, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("omacluzvxnqmhr") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .FINALIZE_FAILBACK)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("kois") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .DISABLE_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("xuifmcsypobkdqz") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .COMPLETE_MIGRATION, + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.CHANGE_PIT, + ReplicationProtectedItemOperation + .TEST_FAILOVER_CLEANUP)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("lgtrczzy") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .DISABLE_PROTECTION, + ReplicationProtectedItemOperation + .UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.TEST_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))))) + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificDetails(), + new RecoveryPlanProviderSpecificDetails(), + new RecoveryPlanProviderSpecificDetails()))) + .withLocation("rkihcirld"); + model = BinaryData.fromObject(model).toObject(RecoveryPlanInner.class); + Assertions.assertEquals("znnhd", model.properties().friendlyName()); + Assertions.assertEquals("ktgj", model.properties().primaryFabricId()); + Assertions.assertEquals("gguxhemlwyw", model.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("eczgfb", model.properties().recoveryFabricId()); + Assertions.assertEquals("klelssxb", model.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("c", model.properties().failoverDeploymentModel()); + Assertions.assertEquals("ujksrlsmdesqplpv", model.properties().replicationProviders().get(0)); + Assertions.assertEquals("xvgpiude", model.properties().allowedOperations().get(0)); + Assertions + .assertEquals(OffsetDateTime.parse("2021-01-01T13:09:47Z"), model.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-01-21T20:15:20Z"), model.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-07-09T17:03:36Z"), model.properties().lastTestFailoverTime()); + Assertions.assertEquals("slujdjltym", model.properties().currentScenario().scenarioName()); + Assertions.assertEquals("vguihywar", model.properties().currentScenario().jobId()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-09-29T23:23Z"), model.properties().currentScenario().startTime()); + Assertions.assertEquals("hkixkykxdssj", model.properties().currentScenarioStatus()); + Assertions.assertEquals("mmuc", model.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.FAILOVER, model.properties().groups().get(0).groupType()); + Assertions + .assertEquals("lrmymyincqlhri", model.properties().groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals( + "sl", model.properties().groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions + .assertEquals("tjgwdtguk", model.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.DISABLE_PROTECTION, + model.properties().groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.properties().groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions + .assertEquals("lwgniiprglvawu", model.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + model.properties().groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.properties().groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("rkihcirld", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanManualActionDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanManualActionDetailsTests.java new file mode 100644 index 000000000000..8ce03f11f087 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanManualActionDetailsTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanManualActionDetails; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanManualActionDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanManualActionDetails model = + BinaryData + .fromString("{\"instanceType\":\"ManualActionDetails\",\"description\":\"imcwqxynqjgsa\"}") + .toObject(RecoveryPlanManualActionDetails.class); + Assertions.assertEquals("imcwqxynqjgsa", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanManualActionDetails model = new RecoveryPlanManualActionDetails().withDescription("imcwqxynqjgsa"); + model = BinaryData.fromObject(model).toObject(RecoveryPlanManualActionDetails.class); + Assertions.assertEquals("imcwqxynqjgsa", model.description()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanPlannedFailoverInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanPlannedFailoverInputPropertiesTests.java new file mode 100644 index 000000000000..cb3b5bbbcc43 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanPlannedFailoverInputPropertiesTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanPlannedFailoverInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanPlannedFailoverInputProperties model = + BinaryData + .fromString( + "{\"failoverDirection\":\"PrimaryToRecovery\",\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"}]}") + .toObject(RecoveryPlanPlannedFailoverInputProperties.class); + Assertions.assertEquals(PossibleOperationsDirections.PRIMARY_TO_RECOVERY, model.failoverDirection()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanPlannedFailoverInputProperties model = + new RecoveryPlanPlannedFailoverInputProperties() + .withFailoverDirection(PossibleOperationsDirections.PRIMARY_TO_RECOVERY) + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput())); + model = BinaryData.fromObject(model).toObject(RecoveryPlanPlannedFailoverInputProperties.class); + Assertions.assertEquals(PossibleOperationsDirections.PRIMARY_TO_RECOVERY, model.failoverDirection()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanPlannedFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanPlannedFailoverInputTests.java new file mode 100644 index 000000000000..3d79cf6396b7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanPlannedFailoverInputTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanPlannedFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanPlannedFailoverInput model = + BinaryData + .fromString( + "{\"properties\":{\"failoverDirection\":\"PrimaryToRecovery\",\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"}]}}") + .toObject(RecoveryPlanPlannedFailoverInput.class); + Assertions + .assertEquals(PossibleOperationsDirections.PRIMARY_TO_RECOVERY, model.properties().failoverDirection()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanPlannedFailoverInput model = + new RecoveryPlanPlannedFailoverInput() + .withProperties( + new RecoveryPlanPlannedFailoverInputProperties() + .withFailoverDirection(PossibleOperationsDirections.PRIMARY_TO_RECOVERY) + .withProviderSpecificDetails(Arrays.asList(new RecoveryPlanProviderSpecificFailoverInput()))); + model = BinaryData.fromObject(model).toObject(RecoveryPlanPlannedFailoverInput.class); + Assertions + .assertEquals(PossibleOperationsDirections.PRIMARY_TO_RECOVERY, model.properties().failoverDirection()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanPropertiesTests.java new file mode 100644 index 000000000000..12acf3c623a8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanPropertiesTests.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CurrentScenarioDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroup; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanProperties model = + BinaryData + .fromString( + "{\"friendlyName\":\"rnnqb\",\"primaryFabricId\":\"bpizxqltgr\",\"primaryFabricFriendlyName\":\"gypxrxvbfihwuhvc\",\"recoveryFabricId\":\"fsrb\",\"recoveryFabricFriendlyName\":\"blml\",\"failoverDeploymentModel\":\"wxihs\",\"replicationProviders\":[\"wqagnepzwa\",\"lsbs\",\"qqqagwwrxaomzi\"],\"allowedOperations\":[\"rrczezkhhltnj\",\"dhqoawj\"],\"lastPlannedFailoverTime\":\"2021-05-12T17:36:56Z\",\"lastUnplannedFailoverTime\":\"2021-09-19T04:55:50Z\",\"lastTestFailoverTime\":\"2021-07-31T20:48:08Z\",\"currentScenario\":{\"scenarioName\":\"pcmsplbyrrueqth\",\"jobId\":\"gnmbscbbxigdhx\",\"startTime\":\"2021-10-27T05:31:04Z\"},\"currentScenarioStatus\":\"opedbwdpyqyybxub\",\"currentScenarioStatusDescription\":\"nafcbq\",\"groups\":[{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{\"id\":\"aqacigeleohd\",\"virtualMachineId\":\"qvwzkjopwbeonrl\"}],\"startGroupActions\":[{\"actionName\":\"dqybx\",\"failoverTypes\":[\"TestFailoverCleanup\",\"PlannedFailover\",\"PlannedFailover\",\"RepairReplication\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"qfyiaseqchkr\",\"failoverTypes\":[\"CompleteMigration\",\"UnplannedFailover\",\"UnplannedFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"uem\",\"failoverTypes\":[\"FinalizeFailback\",\"CancelFailover\",\"Commit\",\"TestFailoverCleanup\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"mnrxxbsojkl\",\"failoverTypes\":[\"CompleteMigration\",\"Failback\",\"TestFailoverCleanup\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"sprqsgnzxojpslsv\",\"failoverTypes\":[\"ReverseReplicate\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"iqwoyxqvapcoh\",\"failoverTypes\":[\"TestFailoverCleanup\",\"FinalizeFailback\",\"ReverseReplicate\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]}") + .toObject(RecoveryPlanProperties.class); + Assertions.assertEquals("rnnqb", model.friendlyName()); + Assertions.assertEquals("bpizxqltgr", model.primaryFabricId()); + Assertions.assertEquals("gypxrxvbfihwuhvc", model.primaryFabricFriendlyName()); + Assertions.assertEquals("fsrb", model.recoveryFabricId()); + Assertions.assertEquals("blml", model.recoveryFabricFriendlyName()); + Assertions.assertEquals("wxihs", model.failoverDeploymentModel()); + Assertions.assertEquals("wqagnepzwa", model.replicationProviders().get(0)); + Assertions.assertEquals("rrczezkhhltnj", model.allowedOperations().get(0)); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-12T17:36:56Z"), model.lastPlannedFailoverTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-19T04:55:50Z"), model.lastUnplannedFailoverTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T20:48:08Z"), model.lastTestFailoverTime()); + Assertions.assertEquals("pcmsplbyrrueqth", model.currentScenario().scenarioName()); + Assertions.assertEquals("gnmbscbbxigdhx", model.currentScenario().jobId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-27T05:31:04Z"), model.currentScenario().startTime()); + Assertions.assertEquals("opedbwdpyqyybxub", model.currentScenarioStatus()); + Assertions.assertEquals("nafcbq", model.currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.SHUTDOWN, model.groups().get(0).groupType()); + Assertions.assertEquals("aqacigeleohd", model.groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals( + "qvwzkjopwbeonrl", model.groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("dqybx", model.groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + model.groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("uem", model.groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + model.groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanProperties model = + new RecoveryPlanProperties() + .withFriendlyName("rnnqb") + .withPrimaryFabricId("bpizxqltgr") + .withPrimaryFabricFriendlyName("gypxrxvbfihwuhvc") + .withRecoveryFabricId("fsrb") + .withRecoveryFabricFriendlyName("blml") + .withFailoverDeploymentModel("wxihs") + .withReplicationProviders(Arrays.asList("wqagnepzwa", "lsbs", "qqqagwwrxaomzi")) + .withAllowedOperations(Arrays.asList("rrczezkhhltnj", "dhqoawj")) + .withLastPlannedFailoverTime(OffsetDateTime.parse("2021-05-12T17:36:56Z")) + .withLastUnplannedFailoverTime(OffsetDateTime.parse("2021-09-19T04:55:50Z")) + .withLastTestFailoverTime(OffsetDateTime.parse("2021-07-31T20:48:08Z")) + .withCurrentScenario( + new CurrentScenarioDetails() + .withScenarioName("pcmsplbyrrueqth") + .withJobId("gnmbscbbxigdhx") + .withStartTime(OffsetDateTime.parse("2021-10-27T05:31:04Z"))) + .withCurrentScenarioStatus("opedbwdpyqyybxub") + .withCurrentScenarioStatusDescription("nafcbq") + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.SHUTDOWN) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("aqacigeleohd") + .withVirtualMachineId("qvwzkjopwbeonrl"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("dqybx") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.REPAIR_REPLICATION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("qfyiaseqchkr") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMPLETE_MIGRATION, + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("uem") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("mnrxxbsojkl") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMPLETE_MIGRATION, + ReplicationProtectedItemOperation.FAILBACK, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("sprqsgnzxojpslsv") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.REVERSE_REPLICATE)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("iqwoyxqvapcoh") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.REVERSE_REPLICATE)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))))) + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificDetails(), + new RecoveryPlanProviderSpecificDetails(), + new RecoveryPlanProviderSpecificDetails(), + new RecoveryPlanProviderSpecificDetails())); + model = BinaryData.fromObject(model).toObject(RecoveryPlanProperties.class); + Assertions.assertEquals("rnnqb", model.friendlyName()); + Assertions.assertEquals("bpizxqltgr", model.primaryFabricId()); + Assertions.assertEquals("gypxrxvbfihwuhvc", model.primaryFabricFriendlyName()); + Assertions.assertEquals("fsrb", model.recoveryFabricId()); + Assertions.assertEquals("blml", model.recoveryFabricFriendlyName()); + Assertions.assertEquals("wxihs", model.failoverDeploymentModel()); + Assertions.assertEquals("wqagnepzwa", model.replicationProviders().get(0)); + Assertions.assertEquals("rrczezkhhltnj", model.allowedOperations().get(0)); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-12T17:36:56Z"), model.lastPlannedFailoverTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-19T04:55:50Z"), model.lastUnplannedFailoverTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T20:48:08Z"), model.lastTestFailoverTime()); + Assertions.assertEquals("pcmsplbyrrueqth", model.currentScenario().scenarioName()); + Assertions.assertEquals("gnmbscbbxigdhx", model.currentScenario().jobId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-27T05:31:04Z"), model.currentScenario().startTime()); + Assertions.assertEquals("opedbwdpyqyybxub", model.currentScenarioStatus()); + Assertions.assertEquals("nafcbq", model.currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.SHUTDOWN, model.groups().get(0).groupType()); + Assertions.assertEquals("aqacigeleohd", model.groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals( + "qvwzkjopwbeonrl", model.groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("dqybx", model.groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + model.groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("uem", model.groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + model.groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProtectedItemTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProtectedItemTests.java new file mode 100644 index 000000000000..559a5600ba66 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProtectedItemTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanProtectedItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanProtectedItem model = + BinaryData + .fromString("{\"id\":\"blydyvkf\",\"virtualMachineId\":\"rocxnehvs\"}") + .toObject(RecoveryPlanProtectedItem.class); + Assertions.assertEquals("blydyvkf", model.id()); + Assertions.assertEquals("rocxnehvs", model.virtualMachineId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanProtectedItem model = + new RecoveryPlanProtectedItem().withId("blydyvkf").withVirtualMachineId("rocxnehvs"); + model = BinaryData.fromObject(model).toObject(RecoveryPlanProtectedItem.class); + Assertions.assertEquals("blydyvkf", model.id()); + Assertions.assertEquals("rocxnehvs", model.virtualMachineId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProviderSpecificDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProviderSpecificDetailsTests.java new file mode 100644 index 000000000000..70ba986a3c55 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProviderSpecificDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificDetails; + +public final class RecoveryPlanProviderSpecificDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanProviderSpecificDetails model = + BinaryData + .fromString("{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}") + .toObject(RecoveryPlanProviderSpecificDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanProviderSpecificDetails model = new RecoveryPlanProviderSpecificDetails(); + model = BinaryData.fromObject(model).toObject(RecoveryPlanProviderSpecificDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProviderSpecificFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProviderSpecificFailoverInputTests.java new file mode 100644 index 000000000000..0fcbe6cfd5d1 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProviderSpecificFailoverInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; + +public final class RecoveryPlanProviderSpecificFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanProviderSpecificFailoverInput model = + BinaryData + .fromString("{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"}") + .toObject(RecoveryPlanProviderSpecificFailoverInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanProviderSpecificFailoverInput model = new RecoveryPlanProviderSpecificFailoverInput(); + model = BinaryData.fromObject(model).toObject(RecoveryPlanProviderSpecificFailoverInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProviderSpecificInputTests.java new file mode 100644 index 000000000000..2527921d796a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput; + +public final class RecoveryPlanProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"RecoveryPlanProviderSpecificInput\"}") + .toObject(RecoveryPlanProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanProviderSpecificInput model = new RecoveryPlanProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(RecoveryPlanProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanScriptActionDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanScriptActionDetailsTests.java new file mode 100644 index 000000000000..24bc3009aa6d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanScriptActionDetailsTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionLocation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanScriptActionDetails; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanScriptActionDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanScriptActionDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"ScriptActionDetails\",\"path\":\"kyvscbgngcrus\",\"timeout\":\"ircpgcvsvkk\",\"fabricLocation\":\"Recovery\"}") + .toObject(RecoveryPlanScriptActionDetails.class); + Assertions.assertEquals("kyvscbgngcrus", model.path()); + Assertions.assertEquals("ircpgcvsvkk", model.timeout()); + Assertions.assertEquals(RecoveryPlanActionLocation.RECOVERY, model.fabricLocation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanScriptActionDetails model = + new RecoveryPlanScriptActionDetails() + .withPath("kyvscbgngcrus") + .withTimeout("ircpgcvsvkk") + .withFabricLocation(RecoveryPlanActionLocation.RECOVERY); + model = BinaryData.fromObject(model).toObject(RecoveryPlanScriptActionDetails.class); + Assertions.assertEquals("kyvscbgngcrus", model.path()); + Assertions.assertEquals("ircpgcvsvkk", model.timeout()); + Assertions.assertEquals(RecoveryPlanActionLocation.RECOVERY, model.fabricLocation()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverCleanupInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverCleanupInputPropertiesTests.java new file mode 100644 index 000000000000..375f49701abc --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverCleanupInputPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanTestFailoverCleanupInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanTestFailoverCleanupInputProperties model = + BinaryData + .fromString("{\"comments\":\"d\"}") + .toObject(RecoveryPlanTestFailoverCleanupInputProperties.class); + Assertions.assertEquals("d", model.comments()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanTestFailoverCleanupInputProperties model = + new RecoveryPlanTestFailoverCleanupInputProperties().withComments("d"); + model = BinaryData.fromObject(model).toObject(RecoveryPlanTestFailoverCleanupInputProperties.class); + Assertions.assertEquals("d", model.comments()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverCleanupInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverCleanupInputTests.java new file mode 100644 index 000000000000..679b5d4b789c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverCleanupInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanTestFailoverCleanupInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanTestFailoverCleanupInput model = + BinaryData + .fromString("{\"properties\":{\"comments\":\"ysfaqegplwrysh\"}}") + .toObject(RecoveryPlanTestFailoverCleanupInput.class); + Assertions.assertEquals("ysfaqegplwrysh", model.properties().comments()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanTestFailoverCleanupInput model = + new RecoveryPlanTestFailoverCleanupInput() + .withProperties(new RecoveryPlanTestFailoverCleanupInputProperties().withComments("ysfaqegplwrysh")); + model = BinaryData.fromObject(model).toObject(RecoveryPlanTestFailoverCleanupInput.class); + Assertions.assertEquals("ysfaqegplwrysh", model.properties().comments()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverInputPropertiesTests.java new file mode 100644 index 000000000000..3b550da72d27 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverInputPropertiesTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanTestFailoverInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanTestFailoverInputProperties model = + BinaryData + .fromString( + "{\"failoverDirection\":\"RecoveryToPrimary\",\"networkType\":\"vqmtdwckygroejn\",\"networkId\":\"ljdjuskbrreqy\",\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"}]}") + .toObject(RecoveryPlanTestFailoverInputProperties.class); + Assertions.assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.failoverDirection()); + Assertions.assertEquals("vqmtdwckygroejn", model.networkType()); + Assertions.assertEquals("ljdjuskbrreqy", model.networkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanTestFailoverInputProperties model = + new RecoveryPlanTestFailoverInputProperties() + .withFailoverDirection(PossibleOperationsDirections.RECOVERY_TO_PRIMARY) + .withNetworkType("vqmtdwckygroejn") + .withNetworkId("ljdjuskbrreqy") + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput())); + model = BinaryData.fromObject(model).toObject(RecoveryPlanTestFailoverInputProperties.class); + Assertions.assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.failoverDirection()); + Assertions.assertEquals("vqmtdwckygroejn", model.networkType()); + Assertions.assertEquals("ljdjuskbrreqy", model.networkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverInputTests.java new file mode 100644 index 000000000000..2178dd8f75ec --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanTestFailoverInputTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanTestFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanTestFailoverInput model = + BinaryData + .fromString( + "{\"properties\":{\"failoverDirection\":\"RecoveryToPrimary\",\"networkType\":\"eshoygzcb\",\"networkId\":\"qxkfaoytehqp\",\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"}]}}") + .toObject(RecoveryPlanTestFailoverInput.class); + Assertions + .assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.properties().failoverDirection()); + Assertions.assertEquals("eshoygzcb", model.properties().networkType()); + Assertions.assertEquals("qxkfaoytehqp", model.properties().networkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanTestFailoverInput model = + new RecoveryPlanTestFailoverInput() + .withProperties( + new RecoveryPlanTestFailoverInputProperties() + .withFailoverDirection(PossibleOperationsDirections.RECOVERY_TO_PRIMARY) + .withNetworkType("eshoygzcb") + .withNetworkId("qxkfaoytehqp") + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput()))); + model = BinaryData.fromObject(model).toObject(RecoveryPlanTestFailoverInput.class); + Assertions + .assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.properties().failoverDirection()); + Assertions.assertEquals("eshoygzcb", model.properties().networkType()); + Assertions.assertEquals("qxkfaoytehqp", model.properties().networkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanUnplannedFailoverInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanUnplannedFailoverInputPropertiesTests.java new file mode 100644 index 000000000000..a6ff54d94bc8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanUnplannedFailoverInputPropertiesTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SourceSiteOperations; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanUnplannedFailoverInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanUnplannedFailoverInputProperties model = + BinaryData + .fromString( + "{\"failoverDirection\":\"RecoveryToPrimary\",\"sourceSiteOperations\":\"NotRequired\",\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"},{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"}]}") + .toObject(RecoveryPlanUnplannedFailoverInputProperties.class); + Assertions.assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.failoverDirection()); + Assertions.assertEquals(SourceSiteOperations.NOT_REQUIRED, model.sourceSiteOperations()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanUnplannedFailoverInputProperties model = + new RecoveryPlanUnplannedFailoverInputProperties() + .withFailoverDirection(PossibleOperationsDirections.RECOVERY_TO_PRIMARY) + .withSourceSiteOperations(SourceSiteOperations.NOT_REQUIRED) + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput())); + model = BinaryData.fromObject(model).toObject(RecoveryPlanUnplannedFailoverInputProperties.class); + Assertions.assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.failoverDirection()); + Assertions.assertEquals(SourceSiteOperations.NOT_REQUIRED, model.sourceSiteOperations()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanUnplannedFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanUnplannedFailoverInputTests.java new file mode 100644 index 000000000000..ebf0588c60a6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPlanUnplannedFailoverInputTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SourceSiteOperations; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPlanUnplannedFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPlanUnplannedFailoverInput model = + BinaryData + .fromString( + "{\"properties\":{\"failoverDirection\":\"RecoveryToPrimary\",\"sourceSiteOperations\":\"Required\",\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificFailoverInput\"}]}}") + .toObject(RecoveryPlanUnplannedFailoverInput.class); + Assertions + .assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.properties().failoverDirection()); + Assertions.assertEquals(SourceSiteOperations.REQUIRED, model.properties().sourceSiteOperations()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPlanUnplannedFailoverInput model = + new RecoveryPlanUnplannedFailoverInput() + .withProperties( + new RecoveryPlanUnplannedFailoverInputProperties() + .withFailoverDirection(PossibleOperationsDirections.RECOVERY_TO_PRIMARY) + .withSourceSiteOperations(SourceSiteOperations.REQUIRED) + .withProviderSpecificDetails(Arrays.asList(new RecoveryPlanProviderSpecificFailoverInput()))); + model = BinaryData.fromObject(model).toObject(RecoveryPlanUnplannedFailoverInput.class); + Assertions + .assertEquals(PossibleOperationsDirections.RECOVERY_TO_PRIMARY, model.properties().failoverDirection()); + Assertions.assertEquals(SourceSiteOperations.REQUIRED, model.properties().sourceSiteOperations()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointCollectionTests.java new file mode 100644 index 000000000000..aec2c8b3ef0f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointCollectionTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.RecoveryPointInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPointCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPointProperties; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPointCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPointCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"recoveryPointTime\":\"2021-08-08T17:45:14Z\",\"recoveryPointType\":\"zhonnxkrlgnyhmo\",\"providerSpecificDetails\":{\"instanceType\":\"ProviderSpecificRecoveryPointDetails\"}},\"location\":\"kkgthr\",\"id\":\"gh\",\"name\":\"jbdhqxvc\",\"type\":\"gf\"},{\"properties\":{\"recoveryPointTime\":\"2021-05-21T09:29:43Z\",\"recoveryPointType\":\"fbshrnsvbuswd\",\"providerSpecificDetails\":{\"instanceType\":\"ProviderSpecificRecoveryPointDetails\"}},\"location\":\"ybycnunvj\",\"id\":\"rtkfawnopq\",\"name\":\"ikyzirtxdy\",\"type\":\"x\"},{\"properties\":{\"recoveryPointTime\":\"2021-06-25T00:23:13Z\",\"recoveryPointType\":\"psew\",\"providerSpecificDetails\":{\"instanceType\":\"ProviderSpecificRecoveryPointDetails\"}},\"location\":\"ilqu\",\"id\":\"rydxtqm\",\"name\":\"eoxorggufhyao\",\"type\":\"tbghhavgrvkf\"}],\"nextLink\":\"vjzhpjbib\"}") + .toObject(RecoveryPointCollection.class); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-08-08T17:45:14Z"), model.value().get(0).properties().recoveryPointTime()); + Assertions.assertEquals("zhonnxkrlgnyhmo", model.value().get(0).properties().recoveryPointType()); + Assertions.assertEquals("kkgthr", model.value().get(0).location()); + Assertions.assertEquals("vjzhpjbib", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPointCollection model = + new RecoveryPointCollection() + .withValue( + Arrays + .asList( + new RecoveryPointInner() + .withProperties( + new RecoveryPointProperties() + .withRecoveryPointTime(OffsetDateTime.parse("2021-08-08T17:45:14Z")) + .withRecoveryPointType("zhonnxkrlgnyhmo") + .withProviderSpecificDetails(new ProviderSpecificRecoveryPointDetails())) + .withLocation("kkgthr"), + new RecoveryPointInner() + .withProperties( + new RecoveryPointProperties() + .withRecoveryPointTime(OffsetDateTime.parse("2021-05-21T09:29:43Z")) + .withRecoveryPointType("fbshrnsvbuswd") + .withProviderSpecificDetails(new ProviderSpecificRecoveryPointDetails())) + .withLocation("ybycnunvj"), + new RecoveryPointInner() + .withProperties( + new RecoveryPointProperties() + .withRecoveryPointTime(OffsetDateTime.parse("2021-06-25T00:23:13Z")) + .withRecoveryPointType("psew") + .withProviderSpecificDetails(new ProviderSpecificRecoveryPointDetails())) + .withLocation("ilqu"))) + .withNextLink("vjzhpjbib"); + model = BinaryData.fromObject(model).toObject(RecoveryPointCollection.class); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-08-08T17:45:14Z"), model.value().get(0).properties().recoveryPointTime()); + Assertions.assertEquals("zhonnxkrlgnyhmo", model.value().get(0).properties().recoveryPointType()); + Assertions.assertEquals("kkgthr", model.value().get(0).location()); + Assertions.assertEquals("vjzhpjbib", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointInnerTests.java new file mode 100644 index 000000000000..9f4bfa9dbcc5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointInnerTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.RecoveryPointInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPointProperties; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPointInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPointInner model = + BinaryData + .fromString( + "{\"properties\":{\"recoveryPointTime\":\"2021-05-29T05:16:16Z\",\"recoveryPointType\":\"umvfclu\",\"providerSpecificDetails\":{\"instanceType\":\"ProviderSpecificRecoveryPointDetails\"}},\"location\":\"wxnb\",\"id\":\"fezzxscyhwzdg\",\"name\":\"rujbzbomvzzbtdc\",\"type\":\"vp\"}") + .toObject(RecoveryPointInner.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-29T05:16:16Z"), model.properties().recoveryPointTime()); + Assertions.assertEquals("umvfclu", model.properties().recoveryPointType()); + Assertions.assertEquals("wxnb", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPointInner model = + new RecoveryPointInner() + .withProperties( + new RecoveryPointProperties() + .withRecoveryPointTime(OffsetDateTime.parse("2021-05-29T05:16:16Z")) + .withRecoveryPointType("umvfclu") + .withProviderSpecificDetails(new ProviderSpecificRecoveryPointDetails())) + .withLocation("wxnb"); + model = BinaryData.fromObject(model).toObject(RecoveryPointInner.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-29T05:16:16Z"), model.properties().recoveryPointTime()); + Assertions.assertEquals("umvfclu", model.properties().recoveryPointType()); + Assertions.assertEquals("wxnb", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointPropertiesTests.java new file mode 100644 index 000000000000..78d0f65aee67 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointPropertiesTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProviderSpecificRecoveryPointDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPointProperties; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class RecoveryPointPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryPointProperties model = + BinaryData + .fromString( + "{\"recoveryPointTime\":\"2021-04-01T22:39:22Z\",\"recoveryPointType\":\"jviylwdshfs\",\"providerSpecificDetails\":{\"instanceType\":\"ProviderSpecificRecoveryPointDetails\"}}") + .toObject(RecoveryPointProperties.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-01T22:39:22Z"), model.recoveryPointTime()); + Assertions.assertEquals("jviylwdshfs", model.recoveryPointType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryPointProperties model = + new RecoveryPointProperties() + .withRecoveryPointTime(OffsetDateTime.parse("2021-04-01T22:39:22Z")) + .withRecoveryPointType("jviylwdshfs") + .withProviderSpecificDetails(new ProviderSpecificRecoveryPointDetails()); + model = BinaryData.fromObject(model).toObject(RecoveryPointProperties.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-01T22:39:22Z"), model.recoveryPointTime()); + Assertions.assertEquals("jviylwdshfs", model.recoveryPointType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsGetWithResponseMockTests.java new file mode 100644 index 000000000000..b11fabd8dc59 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsGetWithResponseMockTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPoint; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class RecoveryPointsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"recoveryPointTime\":\"2021-04-11T08:38:28Z\",\"recoveryPointType\":\"hadxjvvl\",\"providerSpecificDetails\":{\"instanceType\":\"ProviderSpecificRecoveryPointDetails\"}},\"location\":\"weuaugtxlzncoqxt\",\"id\":\"ytz\",\"name\":\"lyldjv\",\"type\":\"mxyrazzstjvcszbd\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPoint response = + manager + .recoveryPoints() + .getWithResponse( + "szopeuku", + "dswbsskgq", + "emosq", + "fsjbpwjwz", + "gipdzym", + "khxfpz", + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions + .assertEquals(OffsetDateTime.parse("2021-04-11T08:38:28Z"), response.properties().recoveryPointTime()); + Assertions.assertEquals("hadxjvvl", response.properties().recoveryPointType()); + Assertions.assertEquals("weuaugtxlzncoqxt", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsListByReplicationProtectedItemsMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsListByReplicationProtectedItemsMockTests.java new file mode 100644 index 000000000000..627dfa051652 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryPointsListByReplicationProtectedItemsMockTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPoint; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class RecoveryPointsListByReplicationProtectedItemsMockTests { + @Test + public void testListByReplicationProtectedItems() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"recoveryPointTime\":\"2021-08-10T18:08:27Z\",\"recoveryPointType\":\"utyjukkedputocr\",\"providerSpecificDetails\":{\"instanceType\":\"ProviderSpecificRecoveryPointDetails\"}},\"location\":\"qicmdrgcuzjmvk\",\"id\":\"wrjcqhgcmljzk\",\"name\":\"qimybqjvfio\",\"type\":\"hcaqpv\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .recoveryPoints() + .listByReplicationProtectedItems( + "ehdhjofywwna", "oxlorxgsl", "c", "u", "hvpaglyyhrgma", com.azure.core.util.Context.NONE); + + Assertions + .assertEquals( + OffsetDateTime.parse("2021-08-10T18:08:27Z"), + response.iterator().next().properties().recoveryPointTime()); + Assertions.assertEquals("utyjukkedputocr", response.iterator().next().properties().recoveryPointType()); + Assertions.assertEquals("qicmdrgcuzjmvk", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryProximityPlacementGroupCustomDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryProximityPlacementGroupCustomDetailsTests.java new file mode 100644 index 000000000000..051e7d6d61d0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryProximityPlacementGroupCustomDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryProximityPlacementGroupCustomDetails; + +public final class RecoveryProximityPlacementGroupCustomDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryProximityPlacementGroupCustomDetails model = + BinaryData + .fromString("{\"resourceType\":\"RecoveryProximityPlacementGroupCustomDetails\"}") + .toObject(RecoveryProximityPlacementGroupCustomDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryProximityPlacementGroupCustomDetails model = new RecoveryProximityPlacementGroupCustomDetails(); + model = BinaryData.fromObject(model).toObject(RecoveryProximityPlacementGroupCustomDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryResourceGroupCustomDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryResourceGroupCustomDetailsTests.java new file mode 100644 index 000000000000..071978137199 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryResourceGroupCustomDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryResourceGroupCustomDetails; + +public final class RecoveryResourceGroupCustomDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryResourceGroupCustomDetails model = + BinaryData + .fromString("{\"resourceType\":\"RecoveryResourceGroupCustomDetails\"}") + .toObject(RecoveryResourceGroupCustomDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryResourceGroupCustomDetails model = new RecoveryResourceGroupCustomDetails(); + model = BinaryData.fromObject(model).toObject(RecoveryResourceGroupCustomDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryVirtualNetworkCustomDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryVirtualNetworkCustomDetailsTests.java new file mode 100644 index 000000000000..b9918840325b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RecoveryVirtualNetworkCustomDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryVirtualNetworkCustomDetails; + +public final class RecoveryVirtualNetworkCustomDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoveryVirtualNetworkCustomDetails model = + BinaryData + .fromString("{\"resourceType\":\"RecoveryVirtualNetworkCustomDetails\"}") + .toObject(RecoveryVirtualNetworkCustomDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoveryVirtualNetworkCustomDetails model = new RecoveryVirtualNetworkCustomDetails(); + model = BinaryData.fromObject(model).toObject(RecoveryVirtualNetworkCustomDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveDisksInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveDisksInputPropertiesTests.java new file mode 100644 index 000000000000..34267b5a08cc --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveDisksInputPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RemoveDisksInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput; + +public final class RemoveDisksInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RemoveDisksInputProperties model = + BinaryData + .fromString("{\"providerSpecificDetails\":{\"instanceType\":\"RemoveDisksProviderSpecificInput\"}}") + .toObject(RemoveDisksInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RemoveDisksInputProperties model = + new RemoveDisksInputProperties().withProviderSpecificDetails(new RemoveDisksProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(RemoveDisksInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveDisksInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveDisksInputTests.java new file mode 100644 index 000000000000..32f3a2d2a104 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveDisksInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RemoveDisksInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RemoveDisksInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput; + +public final class RemoveDisksInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RemoveDisksInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"RemoveDisksProviderSpecificInput\"}}}") + .toObject(RemoveDisksInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RemoveDisksInput model = + new RemoveDisksInput() + .withProperties( + new RemoveDisksInputProperties() + .withProviderSpecificDetails(new RemoveDisksProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(RemoveDisksInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveDisksProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveDisksProviderSpecificInputTests.java new file mode 100644 index 000000000000..c664f845946a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveDisksProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RemoveDisksProviderSpecificInput; + +public final class RemoveDisksProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RemoveDisksProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"RemoveDisksProviderSpecificInput\"}") + .toObject(RemoveDisksProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RemoveDisksProviderSpecificInput model = new RemoveDisksProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(RemoveDisksProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveProtectionContainerMappingInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveProtectionContainerMappingInputPropertiesTests.java new file mode 100644 index 000000000000..c3a9852998d5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveProtectionContainerMappingInputPropertiesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput; +import org.junit.jupiter.api.Assertions; + +public final class RemoveProtectionContainerMappingInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RemoveProtectionContainerMappingInputProperties model = + BinaryData + .fromString("{\"providerSpecificInput\":{\"instanceType\":\"dao\"}}") + .toObject(RemoveProtectionContainerMappingInputProperties.class); + Assertions.assertEquals("dao", model.providerSpecificInput().instanceType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RemoveProtectionContainerMappingInputProperties model = + new RemoveProtectionContainerMappingInputProperties() + .withProviderSpecificInput(new ReplicationProviderContainerUnmappingInput().withInstanceType("dao")); + model = BinaryData.fromObject(model).toObject(RemoveProtectionContainerMappingInputProperties.class); + Assertions.assertEquals("dao", model.providerSpecificInput().instanceType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveProtectionContainerMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveProtectionContainerMappingInputTests.java new file mode 100644 index 000000000000..8ca9372cc631 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RemoveProtectionContainerMappingInputTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RemoveProtectionContainerMappingInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput; +import org.junit.jupiter.api.Assertions; + +public final class RemoveProtectionContainerMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RemoveProtectionContainerMappingInput model = + BinaryData + .fromString("{\"properties\":{\"providerSpecificInput\":{\"instanceType\":\"fhoqca\"}}}") + .toObject(RemoveProtectionContainerMappingInput.class); + Assertions.assertEquals("fhoqca", model.properties().providerSpecificInput().instanceType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RemoveProtectionContainerMappingInput model = + new RemoveProtectionContainerMappingInput() + .withProperties( + new RemoveProtectionContainerMappingInputProperties() + .withProviderSpecificInput( + new ReplicationProviderContainerUnmappingInput().withInstanceType("fhoqca"))); + model = BinaryData.fromObject(model).toObject(RemoveProtectionContainerMappingInput.class); + Assertions.assertEquals("fhoqca", model.properties().providerSpecificInput().instanceType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RenewCertificateInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RenewCertificateInputPropertiesTests.java new file mode 100644 index 000000000000..af14e13a7184 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RenewCertificateInputPropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RenewCertificateInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class RenewCertificateInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RenewCertificateInputProperties model = + BinaryData.fromString("{\"renewCertificateType\":\"glu\"}").toObject(RenewCertificateInputProperties.class); + Assertions.assertEquals("glu", model.renewCertificateType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RenewCertificateInputProperties model = new RenewCertificateInputProperties().withRenewCertificateType("glu"); + model = BinaryData.fromObject(model).toObject(RenewCertificateInputProperties.class); + Assertions.assertEquals("glu", model.renewCertificateType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RenewCertificateInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RenewCertificateInputTests.java new file mode 100644 index 000000000000..67d037700754 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RenewCertificateInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RenewCertificateInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RenewCertificateInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class RenewCertificateInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RenewCertificateInput model = + BinaryData + .fromString("{\"properties\":{\"renewCertificateType\":\"aierhhb\"}}") + .toObject(RenewCertificateInput.class); + Assertions.assertEquals("aierhhb", model.properties().renewCertificateType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RenewCertificateInput model = + new RenewCertificateInput() + .withProperties(new RenewCertificateInputProperties().withRenewCertificateType("aierhhb")); + model = BinaryData.fromObject(model).toObject(RenewCertificateInput.class); + Assertions.assertEquals("aierhhb", model.properties().renewCertificateType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsCreateWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsCreateWithResponseMockTests.java new file mode 100644 index 000000000000..11fc559ad27d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsCreateWithResponseMockTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Alert; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ConfigureAlertRequestProperties; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationAlertSettingsCreateWithResponseMockTests { + @Test + public void testCreateWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"sendToOwners\":\"xbvkvwzdmvdd\",\"customEmailAddresses\":[\"rugyozzzawnjdv\"],\"locale\":\"rho\"},\"location\":\"kkvxu\",\"id\":\"dqzbvbpsuvqhx\",\"name\":\"ozf\",\"type\":\"dkwbkurklpiig\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Alert response = + manager + .replicationAlertSettings() + .define("derjennmk") + .withExistingVault("ustihtgrafjajvky", "mmjczvog") + .withProperties( + new ConfigureAlertRequestProperties() + .withSendToOwners("uwqdwxhhlbmyphf") + .withCustomEmailAddresses(Arrays.asList("pdhewokyqs", "kx", "sy")) + .withLocale("ihqbtod")) + .create(); + + Assertions.assertEquals("xbvkvwzdmvdd", response.properties().sendToOwners()); + Assertions.assertEquals("rugyozzzawnjdv", response.properties().customEmailAddresses().get(0)); + Assertions.assertEquals("rho", response.properties().locale()); + Assertions.assertEquals("kkvxu", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsGetWithResponseMockTests.java new file mode 100644 index 000000000000..86d43bd565c7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsGetWithResponseMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Alert; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationAlertSettingsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"sendToOwners\":\"xsgcemegd\",\"customEmailAddresses\":[\"y\",\"jubvfjyzuf\",\"difnivlutgg\",\"aacxauhvc\"],\"locale\":\"xhklsqxt\"},\"location\":\"yygktsrjyxxoxwf\",\"id\":\"bkvecnxfxphsowbe\",\"name\":\"snbwutlvuwm\",\"type\":\"u\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Alert response = + manager + .replicationAlertSettings() + .getWithResponse("mqmbwpp", "irxbkitzmnhit", "xjucl", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("xsgcemegd", response.properties().sendToOwners()); + Assertions.assertEquals("y", response.properties().customEmailAddresses().get(0)); + Assertions.assertEquals("xhklsqxt", response.properties().locale()); + Assertions.assertEquals("yygktsrjyxxoxwf", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsListMockTests.java new file mode 100644 index 000000000000..1c73164e1a46 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAlertSettingsListMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Alert; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationAlertSettingsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"sendToOwners\":\"tgp\",\"customEmailAddresses\":[\"wgfqvj\"],\"locale\":\"hpak\"},\"location\":\"yhls\",\"id\":\"rnfbmeqagkn\",\"name\":\"jm\",\"type\":\"bnyevztnjawrhule\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.replicationAlertSettings().list("tzuaedrlhxgcq", "yrhkvxzzmiem", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("tgp", response.iterator().next().properties().sendToOwners()); + Assertions.assertEquals("wgfqvj", response.iterator().next().properties().customEmailAddresses().get(0)); + Assertions.assertEquals("hpak", response.iterator().next().properties().locale()); + Assertions.assertEquals("yhls", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationApplianceInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationApplianceInnerTests.java new file mode 100644 index 000000000000..1e3206e2663a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationApplianceInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.ReplicationApplianceInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplianceSpecificDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationApplianceProperties; + +public final class ReplicationApplianceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationApplianceInner model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"ApplianceSpecificDetails\"}}}") + .toObject(ReplicationApplianceInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationApplianceInner model = + new ReplicationApplianceInner() + .withProperties( + new ReplicationApplianceProperties().withProviderSpecificDetails(new ApplianceSpecificDetails())); + model = BinaryData.fromObject(model).toObject(ReplicationApplianceInner.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancePropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancePropertiesTests.java new file mode 100644 index 000000000000..d6e6b16d6491 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancePropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ApplianceSpecificDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationApplianceProperties; + +public final class ReplicationAppliancePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationApplianceProperties model = + BinaryData + .fromString("{\"providerSpecificDetails\":{\"instanceType\":\"ApplianceSpecificDetails\"}}") + .toObject(ReplicationApplianceProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationApplianceProperties model = + new ReplicationApplianceProperties().withProviderSpecificDetails(new ApplianceSpecificDetails()); + model = BinaryData.fromObject(model).toObject(ReplicationApplianceProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancesListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancesListMockTests.java new file mode 100644 index 000000000000..0bf6d6bb4d17 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationAppliancesListMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationAppliance; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationAppliancesListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"ApplianceSpecificDetails\"}}}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .replicationAppliances() + .list("uzkeutuip", "clzjwaqdz", "ydewuwxyll", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationGroupDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationGroupDetailsTests.java new file mode 100644 index 000000000000..e5fbf850a2db --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationGroupDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationGroupDetails; + +public final class ReplicationGroupDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationGroupDetails model = + BinaryData + .fromString("{\"instanceType\":\"ReplicationGroupDetails\"}") + .toObject(ReplicationGroupDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationGroupDetails model = new ReplicationGroupDetails(); + model = BinaryData.fromObject(model).toObject(ReplicationGroupDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksGetWithResponseMockTests.java new file mode 100644 index 000000000000..c62f1c6b4676 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationLogicalNetworksGetWithResponseMockTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LogicalNetwork; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationLogicalNetworksGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"xwvegenlrj\",\"networkVirtualizationStatus\":\"mwevguyflnxel\",\"logicalNetworkUsage\":\"kfzcdetowwezhy\",\"logicalNetworkDefinitionsStatus\":\"di\"},\"location\":\"wqlqacs\",\"id\":\"qb\",\"name\":\"rtybcel\",\"type\":\"jnxodnjyhzfax\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + LogicalNetwork response = + manager + .replicationLogicalNetworks() + .getWithResponse("kwwnq", "qlq", "pwxtvc", "bav", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("xwvegenlrj", response.properties().friendlyName()); + Assertions.assertEquals("mwevguyflnxel", response.properties().networkVirtualizationStatus()); + Assertions.assertEquals("kfzcdetowwezhy", response.properties().logicalNetworkUsage()); + Assertions.assertEquals("di", response.properties().logicalNetworkDefinitionsStatus()); + Assertions.assertEquals("wqlqacs", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsCreateMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsCreateMockTests.java new file mode 100644 index 000000000000..1081aaaf8906 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsCreateMockTests.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateNetworkMappingInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificCreateNetworkMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMapping; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationNetworkMappingsCreateMockTests { + @Test + public void testCreate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"state\":\"k\",\"primaryNetworkFriendlyName\":\"iksy\",\"primaryNetworkId\":\"rrbnhylsbhujcydy\",\"primaryFabricFriendlyName\":\"mxvps\",\"recoveryNetworkFriendlyName\":\"zsyqagqllcbrvaid\",\"recoveryNetworkId\":\"kyhtrrqwfyyb\",\"recoveryFabricArmId\":\"mjjrnogyk\",\"recoveryFabricFriendlyName\":\"dlavsavgthk\",\"fabricSpecificSettings\":{\"instanceType\":\"NetworkMappingFabricSpecificSettings\"}},\"location\":\"euufk\",\"id\":\"zb\",\"name\":\"bxjblajybdnb\",\"type\":\"csbto\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + NetworkMapping response = + manager + .replicationNetworkMappings() + .define("xyxxhwr") + .withExistingReplicationNetwork("brhfiwltkfysunte", "hkl", "whcv", "syyhgqokjbmsrk") + .withProperties( + new CreateNetworkMappingInputProperties() + .withRecoveryFabricName("omaqsyilpzzb") + .withRecoveryNetworkId("wnrzozsxa") + .withFabricSpecificDetails(new FabricSpecificCreateNetworkMappingInput())) + .create(); + + Assertions.assertEquals("k", response.properties().state()); + Assertions.assertEquals("iksy", response.properties().primaryNetworkFriendlyName()); + Assertions.assertEquals("rrbnhylsbhujcydy", response.properties().primaryNetworkId()); + Assertions.assertEquals("mxvps", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("zsyqagqllcbrvaid", response.properties().recoveryNetworkFriendlyName()); + Assertions.assertEquals("kyhtrrqwfyyb", response.properties().recoveryNetworkId()); + Assertions.assertEquals("mjjrnogyk", response.properties().recoveryFabricArmId()); + Assertions.assertEquals("dlavsavgthk", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("euufk", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsGetWithResponseMockTests.java new file mode 100644 index 000000000000..752db8938136 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsGetWithResponseMockTests.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMapping; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationNetworkMappingsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"state\":\"ciagvkdlhu\",\"primaryNetworkFriendlyName\":\"klbjoafmjfe\",\"primaryNetworkId\":\"lvoepknarse\",\"primaryFabricFriendlyName\":\"ncsqoacbuqd\",\"recoveryNetworkFriendlyName\":\"apleq\",\"recoveryNetworkId\":\"kxen\",\"recoveryFabricArmId\":\"z\",\"recoveryFabricFriendlyName\":\"vya\",\"fabricSpecificSettings\":{\"instanceType\":\"NetworkMappingFabricSpecificSettings\"}},\"location\":\"z\",\"id\":\"uuvu\",\"name\":\"aqcwggchxvlqgf\",\"type\":\"rvecica\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + NetworkMapping response = + manager + .replicationNetworkMappings() + .getWithResponse( + "jbvyezjwjkqo", + "bwh", + "ieyozvrcwfpucwnb", + "gqefgzjvbxqcb", + "oarx", + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ciagvkdlhu", response.properties().state()); + Assertions.assertEquals("klbjoafmjfe", response.properties().primaryNetworkFriendlyName()); + Assertions.assertEquals("lvoepknarse", response.properties().primaryNetworkId()); + Assertions.assertEquals("ncsqoacbuqd", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("apleq", response.properties().recoveryNetworkFriendlyName()); + Assertions.assertEquals("kxen", response.properties().recoveryNetworkId()); + Assertions.assertEquals("z", response.properties().recoveryFabricArmId()); + Assertions.assertEquals("vya", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("z", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListMockTests.java new file mode 100644 index 000000000000..015c8cb0f7bf --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworkMappingsListMockTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.NetworkMapping; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationNetworkMappingsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"state\":\"zzkueruwcjomi\",\"primaryNetworkFriendlyName\":\"wkau\",\"primaryNetworkId\":\"twykoxvbw\",\"primaryFabricFriendlyName\":\"xxdplrelfkvga\",\"recoveryNetworkFriendlyName\":\"btuxlbpxrhrfje\",\"recoveryNetworkId\":\"azwef\",\"recoveryFabricArmId\":\"tlhqas\",\"recoveryFabricFriendlyName\":\"ostjixyz\",\"fabricSpecificSettings\":{\"instanceType\":\"NetworkMappingFabricSpecificSettings\"}},\"location\":\"i\",\"id\":\"zzdw\",\"name\":\"tacfvvtdpcbp\",\"type\":\"fomcsau\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.replicationNetworkMappings().list("vphirlzbip", "unnep", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("zzkueruwcjomi", response.iterator().next().properties().state()); + Assertions.assertEquals("wkau", response.iterator().next().properties().primaryNetworkFriendlyName()); + Assertions.assertEquals("twykoxvbw", response.iterator().next().properties().primaryNetworkId()); + Assertions.assertEquals("xxdplrelfkvga", response.iterator().next().properties().primaryFabricFriendlyName()); + Assertions + .assertEquals("btuxlbpxrhrfje", response.iterator().next().properties().recoveryNetworkFriendlyName()); + Assertions.assertEquals("azwef", response.iterator().next().properties().recoveryNetworkId()); + Assertions.assertEquals("tlhqas", response.iterator().next().properties().recoveryFabricArmId()); + Assertions.assertEquals("ostjixyz", response.iterator().next().properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("i", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksGetWithResponseMockTests.java new file mode 100644 index 000000000000..c17dfaee32ba --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksGetWithResponseMockTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Network; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationNetworksGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"fabricType\":\"pgve\",\"subnets\":[{\"name\":\"ujnjgybuxmq\",\"friendlyName\":\"gid\",\"addressList\":[\"njgcp\"]},{\"name\":\"grh\",\"friendlyName\":\"tslgsazuqznghx\",\"addressList\":[\"qzjsdkpvnr\"]},{\"name\":\"wpffxsfybn\",\"friendlyName\":\"vehoh\",\"addressList\":[\"uvbgtzqzqweuy\",\"ybnai\",\"vhpqsvbzeogeatrc\",\"qnvncprfcsjvjn\"]}],\"friendlyName\":\"iznzs\",\"networkType\":\"ibaaugicovjtm\"},\"location\":\"rmjxyvuodnxc\",\"id\":\"bassqfyylwpp\",\"name\":\"ygkbzb\",\"type\":\"o\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Network response = + manager + .replicationNetworks() + .getWithResponse("lhihqkn", "vkmnbzkopaiil", "cpu", "khquxsy", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("pgve", response.properties().fabricType()); + Assertions.assertEquals("ujnjgybuxmq", response.properties().subnets().get(0).name()); + Assertions.assertEquals("gid", response.properties().subnets().get(0).friendlyName()); + Assertions.assertEquals("njgcp", response.properties().subnets().get(0).addressList().get(0)); + Assertions.assertEquals("iznzs", response.properties().friendlyName()); + Assertions.assertEquals("ibaaugicovjtm", response.properties().networkType()); + Assertions.assertEquals("rmjxyvuodnxc", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListByReplicationFabricsMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListByReplicationFabricsMockTests.java new file mode 100644 index 000000000000..d419501a916a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListByReplicationFabricsMockTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Network; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationNetworksListByReplicationFabricsMockTests { + @Test + public void testListByReplicationFabrics() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"fabricType\":\"sorch\",\"subnets\":[{\"name\":\"o\",\"friendlyName\":\"yhl\",\"addressList\":[\"vhs\",\"b\",\"pwxslaj\"]},{\"name\":\"fzga\",\"friendlyName\":\"hawkmibuydwi\",\"addressList\":[\"icupdyt\",\"qmiuvjpl\"]},{\"name\":\"ebmhhtuq\",\"friendlyName\":\"xynof\",\"addressList\":[\"bfix\",\"gxebihexhnk\",\"ng\"]},{\"name\":\"cdolrpgupsjlbsmn\",\"friendlyName\":\"fbncuyje\",\"addressList\":[\"nhpplzhcfzxjzi\",\"ucrln\",\"wnuwkkfzzetl\",\"hdyxz\"]}],\"friendlyName\":\"wywjvrlgqpwwlzp\",\"networkType\":\"arcbcdwhslxebaja\"},\"location\":\"n\",\"id\":\"stbdoprwkampyh\",\"name\":\"pbldz\",\"type\":\"iudrcycmwhuzym\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .replicationNetworks() + .listByReplicationFabrics("kdv", "el", "modpe", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("sorch", response.iterator().next().properties().fabricType()); + Assertions.assertEquals("o", response.iterator().next().properties().subnets().get(0).name()); + Assertions.assertEquals("yhl", response.iterator().next().properties().subnets().get(0).friendlyName()); + Assertions.assertEquals("vhs", response.iterator().next().properties().subnets().get(0).addressList().get(0)); + Assertions.assertEquals("wywjvrlgqpwwlzp", response.iterator().next().properties().friendlyName()); + Assertions.assertEquals("arcbcdwhslxebaja", response.iterator().next().properties().networkType()); + Assertions.assertEquals("n", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListMockTests.java new file mode 100644 index 000000000000..639f3f50672d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationNetworksListMockTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Network; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationNetworksListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"fabricType\":\"gxqbfkce\",\"subnets\":[{\"name\":\"recjb\",\"friendlyName\":\"wevsfgdrmnszdosm\",\"addressList\":[\"svz\",\"mxtc\",\"ghndae\"]},{\"name\":\"gsulwvgseufigvfj\",\"friendlyName\":\"zkilmciwuh\",\"addressList\":[\"kypy\",\"vljlbzdlby\",\"paxhpz\"]}],\"friendlyName\":\"ov\",\"networkType\":\"wbh\"},\"location\":\"zges\",\"id\":\"hshagpa\",\"name\":\"nezpby\",\"type\":\"yvynpmggqgage\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.replicationNetworks().list("sybxhqvov", "pmhttuvsqjsrvjnq", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("gxqbfkce", response.iterator().next().properties().fabricType()); + Assertions.assertEquals("recjb", response.iterator().next().properties().subnets().get(0).name()); + Assertions + .assertEquals("wevsfgdrmnszdosm", response.iterator().next().properties().subnets().get(0).friendlyName()); + Assertions.assertEquals("svz", response.iterator().next().properties().subnets().get(0).addressList().get(0)); + Assertions.assertEquals("ov", response.iterator().next().properties().friendlyName()); + Assertions.assertEquals("wbh", response.iterator().next().properties().networkType()); + Assertions.assertEquals("zges", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesCreateMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesCreateMockTests.java new file mode 100644 index 000000000000..b43dae1ee548 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesCreateMockTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreatePolicyInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Policy; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificInput; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationPoliciesCreateMockTests { + @Test + public void testCreate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"gouxnro\",\"providerSpecificDetails\":{\"instanceType\":\"PolicyProviderSpecificDetails\"}},\"location\":\"hesywyw\",\"id\":\"vg\",\"name\":\"o\",\"type\":\"c\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Policy response = + manager + .replicationPolicies() + .define("pxwwblscrmzqu") + .withExistingVault("vgppp", "ilbdvxlfhlzzgap") + .withProperties( + new CreatePolicyInputProperties().withProviderSpecificInput(new PolicyProviderSpecificInput())) + .create(); + + Assertions.assertEquals("gouxnro", response.properties().friendlyName()); + Assertions.assertEquals("hesywyw", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesGetWithResponseMockTests.java new file mode 100644 index 000000000000..5ffd4dbe136b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesGetWithResponseMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Policy; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationPoliciesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"sychdcjggcmpncj\",\"providerSpecificDetails\":{\"instanceType\":\"PolicyProviderSpecificDetails\"}},\"location\":\"bnoq\",\"id\":\"owvfxe\",\"name\":\"tzgwjeky\",\"type\":\"irvcpol\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Policy response = + manager + .replicationPolicies() + .getWithResponse("rs", "vvmrn", "rdijox", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("sychdcjggcmpncj", response.properties().friendlyName()); + Assertions.assertEquals("bnoq", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesListMockTests.java new file mode 100644 index 000000000000..0604d12f8708 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationPoliciesListMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Policy; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationPoliciesListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"friendlyName\":\"trvgioguox\",\"providerSpecificDetails\":{\"instanceType\":\"PolicyProviderSpecificDetails\"}},\"location\":\"qo\",\"id\":\"hde\",\"name\":\"mjogxgr\",\"type\":\"gyciwbnqi\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.replicationPolicies().list("u", "riemorszffi", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("trvgioguox", response.iterator().next().properties().friendlyName()); + Assertions.assertEquals("qo", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsGetWithResponseMockTests.java new file mode 100644 index 000000000000..bbb27c456834 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectableItemsGetWithResponseMockTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectableItem; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationProtectableItemsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"dahyclxrsidoeb\",\"protectionStatus\":\"poiaffjkrtn\",\"replicationProtectedItemId\":\"evimxmaxcj\",\"recoveryServicesProviderId\":\"itygvdwds\",\"protectionReadinessErrors\":[\"bf\"],\"supportedReplicationProviders\":[\"ozbzchnqekwan\"],\"customDetails\":{\"instanceType\":\"ConfigurationSettings\"}},\"location\":\"urlcydjhtkjs\",\"id\":\"rwiyndurdonkgobx\",\"name\":\"lr\",\"type\":\"olenrswknpdr\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ProtectableItem response = + manager + .replicationProtectableItems() + .getWithResponse("wdalisd", "qngca", "dz", "nloou", "p", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dahyclxrsidoeb", response.properties().friendlyName()); + Assertions.assertEquals("poiaffjkrtn", response.properties().protectionStatus()); + Assertions.assertEquals("evimxmaxcj", response.properties().replicationProtectedItemId()); + Assertions.assertEquals("itygvdwds", response.properties().recoveryServicesProviderId()); + Assertions.assertEquals("bf", response.properties().protectionReadinessErrors().get(0)); + Assertions.assertEquals("ozbzchnqekwan", response.properties().supportedReplicationProviders().get(0)); + Assertions.assertEquals("urlcydjhtkjs", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersCreateMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersCreateMockTests.java new file mode 100644 index 000000000000..6b49bdcc28c0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersCreateMockTests.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateProtectionContainerInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainer; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationProtectionContainersCreateMockTests { + @Test + public void testCreate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"fabricFriendlyName\":\"ia\",\"friendlyName\":\"twskkfkuyikmxhh\",\"fabricType\":\"xjbjkewriglbqt\",\"protectedItemCount\":1590059701,\"pairingStatus\":\"clflxcjffzw\",\"role\":\"vdef\",\"fabricSpecificDetails\":{\"instanceType\":\"ztpcjptnntqrcjq\"}},\"location\":\"jvnpjrrh\",\"id\":\"gsjbi\",\"name\":\"agwviqehmdqvaoli\",\"type\":\"xdfsfvkjc\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ProtectionContainer response = + manager + .replicationProtectionContainers() + .define("ntjna") + .withExistingReplicationFabric("dvt", "urmd", "a") + .withProperties( + new CreateProtectionContainerInputProperties() + .withProviderSpecificInput( + Arrays + .asList( + new ReplicationProviderSpecificContainerCreationInput(), + new ReplicationProviderSpecificContainerCreationInput()))) + .create(); + + Assertions.assertEquals("ia", response.properties().fabricFriendlyName()); + Assertions.assertEquals("twskkfkuyikmxhh", response.properties().friendlyName()); + Assertions.assertEquals("xjbjkewriglbqt", response.properties().fabricType()); + Assertions.assertEquals(1590059701, response.properties().protectedItemCount()); + Assertions.assertEquals("clflxcjffzw", response.properties().pairingStatus()); + Assertions.assertEquals("vdef", response.properties().role()); + Assertions.assertEquals("jvnpjrrh", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListMockTests.java new file mode 100644 index 000000000000..08f624d231b1 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionContainersListMockTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ProtectionContainer; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationProtectionContainersListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"fabricFriendlyName\":\"w\",\"friendlyName\":\"nbmajvvyxtvvx\",\"fabricType\":\"kzixbk\",\"protectedItemCount\":2007505628,\"pairingStatus\":\"mlngfwhrm\",\"role\":\"a\",\"fabricSpecificDetails\":{\"instanceType\":\"jmwxn\"}},\"location\":\"bl\",\"id\":\"nahhs\",\"name\":\"fndcbsyhlud\",\"type\":\"jkkovohwvprj\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.replicationProtectionContainers().list("dexquaw", "xizbfzet", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("w", response.iterator().next().properties().fabricFriendlyName()); + Assertions.assertEquals("nbmajvvyxtvvx", response.iterator().next().properties().friendlyName()); + Assertions.assertEquals("kzixbk", response.iterator().next().properties().fabricType()); + Assertions.assertEquals(2007505628, response.iterator().next().properties().protectedItemCount()); + Assertions.assertEquals("mlngfwhrm", response.iterator().next().properties().pairingStatus()); + Assertions.assertEquals("a", response.iterator().next().properties().role()); + Assertions.assertEquals("bl", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentCollectionTests.java new file mode 100644 index 000000000000..43c24a75e6fa --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentCollectionTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.ReplicationProtectionIntentInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectionIntentCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ReplicationProtectionIntentCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationProtectionIntentCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"friendlyName\":\"dfzantkwcegy\",\"jobId\":\"lbnseqac\",\"jobState\":\"vpilg\",\"isActive\":false,\"creationTimeUTC\":\"jagmdi\",\"providerSpecificDetails\":{\"instanceType\":\"ReplicationProtectionIntentProviderSpecificSettings\"}},\"location\":\"eiookjbsah\",\"id\":\"tdtpdelqacslmo\",\"name\":\"oebn\",\"type\":\"xofvcjk\"},{\"properties\":{\"friendlyName\":\"razftxejwabmdujt\",\"jobId\":\"cope\",\"jobState\":\"m\",\"isActive\":false,\"creationTimeUTC\":\"u\",\"providerSpecificDetails\":{\"instanceType\":\"ReplicationProtectionIntentProviderSpecificSettings\"}},\"location\":\"kyqltqsrogt\",\"id\":\"wkffdjkt\",\"name\":\"ysidfvclgl\",\"type\":\"n\"},{\"properties\":{\"friendlyName\":\"jtkbusqogsfika\",\"jobId\":\"ansharujtjiqxfz\",\"jobState\":\"qttv\",\"isActive\":true,\"creationTimeUTC\":\"hjpenuygbq\",\"providerSpecificDetails\":{\"instanceType\":\"ReplicationProtectionIntentProviderSpecificSettings\"}},\"location\":\"ekewvnqvcdlguauc\",\"id\":\"f\",\"name\":\"jwnlax\",\"type\":\"un\"}],\"nextLink\":\"ikczvvitacgxmf\"}") + .toObject(ReplicationProtectionIntentCollection.class); + Assertions.assertEquals("dfzantkwcegy", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("eiookjbsah", model.value().get(0).location()); + Assertions.assertEquals("ikczvvitacgxmf", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationProtectionIntentCollection model = + new ReplicationProtectionIntentCollection() + .withValue( + Arrays + .asList( + new ReplicationProtectionIntentInner() + .withProperties( + new ReplicationProtectionIntentProperties() + .withFriendlyName("dfzantkwcegy") + .withProviderSpecificDetails( + new ReplicationProtectionIntentProviderSpecificSettings())) + .withLocation("eiookjbsah"), + new ReplicationProtectionIntentInner() + .withProperties( + new ReplicationProtectionIntentProperties() + .withFriendlyName("razftxejwabmdujt") + .withProviderSpecificDetails( + new ReplicationProtectionIntentProviderSpecificSettings())) + .withLocation("kyqltqsrogt"), + new ReplicationProtectionIntentInner() + .withProperties( + new ReplicationProtectionIntentProperties() + .withFriendlyName("jtkbusqogsfika") + .withProviderSpecificDetails( + new ReplicationProtectionIntentProviderSpecificSettings())) + .withLocation("ekewvnqvcdlguauc"))) + .withNextLink("ikczvvitacgxmf"); + model = BinaryData.fromObject(model).toObject(ReplicationProtectionIntentCollection.class); + Assertions.assertEquals("dfzantkwcegy", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("eiookjbsah", model.value().get(0).location()); + Assertions.assertEquals("ikczvvitacgxmf", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentInnerTests.java new file mode 100644 index 000000000000..db659e3414e8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentInnerTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.ReplicationProtectionIntentInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings; +import org.junit.jupiter.api.Assertions; + +public final class ReplicationProtectionIntentInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationProtectionIntentInner model = + BinaryData + .fromString( + "{\"properties\":{\"friendlyName\":\"er\",\"jobId\":\"tvsoxhlwntsj\",\"jobState\":\"rsxypruuu\",\"isActive\":true,\"creationTimeUTC\":\"hrszi\",\"providerSpecificDetails\":{\"instanceType\":\"ReplicationProtectionIntentProviderSpecificSettings\"}},\"location\":\"uelyetndn\",\"id\":\"fqyggagflnlgmtr\",\"name\":\"ahzjmucftb\",\"type\":\"r\"}") + .toObject(ReplicationProtectionIntentInner.class); + Assertions.assertEquals("er", model.properties().friendlyName()); + Assertions.assertEquals("uelyetndn", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationProtectionIntentInner model = + new ReplicationProtectionIntentInner() + .withProperties( + new ReplicationProtectionIntentProperties() + .withFriendlyName("er") + .withProviderSpecificDetails(new ReplicationProtectionIntentProviderSpecificSettings())) + .withLocation("uelyetndn"); + model = BinaryData.fromObject(model).toObject(ReplicationProtectionIntentInner.class); + Assertions.assertEquals("er", model.properties().friendlyName()); + Assertions.assertEquals("uelyetndn", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentPropertiesTests.java new file mode 100644 index 000000000000..a966c6312461 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectionIntentProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectionIntentProviderSpecificSettings; +import org.junit.jupiter.api.Assertions; + +public final class ReplicationProtectionIntentPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationProtectionIntentProperties model = + BinaryData + .fromString( + "{\"friendlyName\":\"rohkpigqfusu\",\"jobId\":\"zmkw\",\"jobState\":\"snoxaxmqeqa\",\"isActive\":true,\"creationTimeUTC\":\"nhg\",\"providerSpecificDetails\":{\"instanceType\":\"ReplicationProtectionIntentProviderSpecificSettings\"}}") + .toObject(ReplicationProtectionIntentProperties.class); + Assertions.assertEquals("rohkpigqfusu", model.friendlyName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationProtectionIntentProperties model = + new ReplicationProtectionIntentProperties() + .withFriendlyName("rohkpigqfusu") + .withProviderSpecificDetails(new ReplicationProtectionIntentProviderSpecificSettings()); + model = BinaryData.fromObject(model).toObject(ReplicationProtectionIntentProperties.class); + Assertions.assertEquals("rohkpigqfusu", model.friendlyName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsGetWithResponseMockTests.java new file mode 100644 index 000000000000..5ab205982f3a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsGetWithResponseMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectionIntent; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationProtectionIntentsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"cacwaaqakv\",\"jobId\":\"y\",\"jobState\":\"xra\",\"isActive\":false,\"creationTimeUTC\":\"eqbrcmmdtsh\",\"providerSpecificDetails\":{\"instanceType\":\"ReplicationProtectionIntentProviderSpecificSettings\"}},\"location\":\"xucznb\",\"id\":\"bowr\",\"name\":\"yrnmjw\",\"type\":\"owxqzkk\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ReplicationProtectionIntent response = + manager + .replicationProtectionIntents() + .getWithResponse("ilzvxotno", "lqcdvhye", "qhxytsq", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("cacwaaqakv", response.properties().friendlyName()); + Assertions.assertEquals("xucznb", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsListMockTests.java new file mode 100644 index 000000000000..82100e5f3e3e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProtectionIntentsListMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectionIntent; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationProtectionIntentsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"friendlyName\":\"mrgm\",\"jobId\":\"gtlhz\",\"jobState\":\"a\",\"isActive\":false,\"creationTimeUTC\":\"iy\",\"providerSpecificDetails\":{\"instanceType\":\"ReplicationProtectionIntentProviderSpecificSettings\"}},\"location\":\"nvzmsvzng\",\"id\":\"eqzhehgvmm\",\"name\":\"oyzgnbnypluz\",\"type\":\"pkfcdfu\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .replicationProtectionIntents() + .list("frzcwuejmxl", "zlnzyrgr", "hchraunjovlx", "tvmvzpni", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("mrgm", response.iterator().next().properties().friendlyName()); + Assertions.assertEquals("nvzmsvzng", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderContainerUnmappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderContainerUnmappingInputTests.java new file mode 100644 index 000000000000..c960312b54e9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderContainerUnmappingInputTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderContainerUnmappingInput; +import org.junit.jupiter.api.Assertions; + +public final class ReplicationProviderContainerUnmappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationProviderContainerUnmappingInput model = + BinaryData + .fromString("{\"instanceType\":\"jvlpjxxkzbr\"}") + .toObject(ReplicationProviderContainerUnmappingInput.class); + Assertions.assertEquals("jvlpjxxkzbr", model.instanceType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationProviderContainerUnmappingInput model = + new ReplicationProviderContainerUnmappingInput().withInstanceType("jvlpjxxkzbr"); + model = BinaryData.fromObject(model).toObject(ReplicationProviderContainerUnmappingInput.class); + Assertions.assertEquals("jvlpjxxkzbr", model.instanceType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderSpecificContainerCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderSpecificContainerCreationInputTests.java new file mode 100644 index 000000000000..cf38eee2b7e0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderSpecificContainerCreationInputTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerCreationInput; + +public final class ReplicationProviderSpecificContainerCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationProviderSpecificContainerCreationInput model = + BinaryData + .fromString("{\"instanceType\":\"ReplicationProviderSpecificContainerCreationInput\"}") + .toObject(ReplicationProviderSpecificContainerCreationInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationProviderSpecificContainerCreationInput model = + new ReplicationProviderSpecificContainerCreationInput(); + model = BinaryData.fromObject(model).toObject(ReplicationProviderSpecificContainerCreationInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderSpecificContainerMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderSpecificContainerMappingInputTests.java new file mode 100644 index 000000000000..d91f8f5f08b7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderSpecificContainerMappingInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificContainerMappingInput; + +public final class ReplicationProviderSpecificContainerMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationProviderSpecificContainerMappingInput model = + BinaryData + .fromString("{\"instanceType\":\"ReplicationProviderSpecificContainerMappingInput\"}") + .toObject(ReplicationProviderSpecificContainerMappingInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationProviderSpecificContainerMappingInput model = new ReplicationProviderSpecificContainerMappingInput(); + model = BinaryData.fromObject(model).toObject(ReplicationProviderSpecificContainerMappingInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderSpecificSettingsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderSpecificSettingsTests.java new file mode 100644 index 000000000000..14d38d5f1ec7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationProviderSpecificSettingsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificSettings; + +public final class ReplicationProviderSpecificSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicationProviderSpecificSettings model = + BinaryData + .fromString("{\"instanceType\":\"ReplicationProviderSpecificSettings\"}") + .toObject(ReplicationProviderSpecificSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicationProviderSpecificSettings model = new ReplicationProviderSpecificSettings(); + model = BinaryData.fromObject(model).toObject(ReplicationProviderSpecificSettings.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansCreateMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansCreateMockTests.java new file mode 100644 index 000000000000..cbd91950757a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansCreateMockTests.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.CreateRecoveryPlanInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverDeploymentModel; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroup; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificInput; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansCreateMockTests { + @Test + public void testCreate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"sfgb\",\"primaryFabricId\":\"tsaz\",\"primaryFabricFriendlyName\":\"cxlubrukhq\",\"recoveryFabricId\":\"oyrbdkgqd\",\"recoveryFabricFriendlyName\":\"vvj\",\"failoverDeploymentModel\":\"jjfexuvsveams\",\"replicationProviders\":[\"uuvhxiohg\",\"mufzuuyszhae\",\"mtyosdpxtsdy\",\"fgefvwgwp\"],\"allowedOperations\":[\"iavwmixaqg\"],\"lastPlannedFailoverTime\":\"2021-09-07T11:23:33Z\",\"lastUnplannedFailoverTime\":\"2021-08-07T10:56:29Z\",\"lastTestFailoverTime\":\"2021-04-15T08:30:28Z\",\"currentScenario\":{\"scenarioName\":\"umlkjsv\",\"jobId\":\"tmlixalphkg\",\"startTime\":\"2021-09-24T23:02:48Z\"},\"currentScenarioStatus\":\"e\",\"currentScenarioStatusDescription\":\"gdj\",\"groups\":[{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{},{}],\"startGroupActions\":[{\"actionName\":\"uyrlk\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"i\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"rmrjpjthi\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"sabcylzz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"etumzenkrd\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ues\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"oibdctjwfeb\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"qqeetsqac\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"czfro\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"raiai\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"wamptldddorz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jhnxfkffngfpi\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"loi\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"xdbktuqnbcjknrq\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"ku\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"ii\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"inlic\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"moyoioxdwff\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"ke\",\"id\":\"curr\",\"name\":\"uecokyduqzusc\",\"type\":\"lbqv\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPlan response = + manager + .replicationRecoveryPlans() + .define("uvqbeyxwrmupzpe") + .withExistingVault("gynsixgzbbnug", "quarb") + .withProperties( + new CreateRecoveryPlanInputProperties() + .withPrimaryFabricId("zbhg") + .withRecoveryFabricId("ajkvwkoc") + .withFailoverDeploymentModel(FailoverDeploymentModel.RESOURCE_MANAGER) + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem(), + new RecoveryPlanProtectedItem())) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("atbgvlp") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("gen") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("akybepsihz") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("ieoymp") + .withFailoverTypes(Arrays.asList()) + .withFailoverDirections(Arrays.asList()) + .withCustomDetails(new RecoveryPlanActionDetails()))))) + .withProviderSpecificInput(Arrays.asList(new RecoveryPlanProviderSpecificInput()))) + .create(); + + Assertions.assertEquals("sfgb", response.properties().friendlyName()); + Assertions.assertEquals("tsaz", response.properties().primaryFabricId()); + Assertions.assertEquals("cxlubrukhq", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("oyrbdkgqd", response.properties().recoveryFabricId()); + Assertions.assertEquals("vvj", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("jjfexuvsveams", response.properties().failoverDeploymentModel()); + Assertions.assertEquals("uuvhxiohg", response.properties().replicationProviders().get(0)); + Assertions.assertEquals("iavwmixaqg", response.properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-09-07T11:23:33Z"), response.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-08-07T10:56:29Z"), response.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-04-15T08:30:28Z"), response.properties().lastTestFailoverTime()); + Assertions.assertEquals("umlkjsv", response.properties().currentScenario().scenarioName()); + Assertions.assertEquals("tmlixalphkg", response.properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-09-24T23:02:48Z"), response.properties().currentScenario().startTime()); + Assertions.assertEquals("e", response.properties().currentScenarioStatus()); + Assertions.assertEquals("gdj", response.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.SHUTDOWN, response.properties().groups().get(0).groupType()); + Assertions.assertEquals("uyrlk", response.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals("rmrjpjthi", response.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("ke", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCancelMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCancelMockTests.java new file mode 100644 index 000000000000..da7f787f255a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCancelMockTests.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansFailoverCancelMockTests { + @Test + public void testFailoverCancel() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"qnugtcuyuwgnyjdi\",\"primaryFabricId\":\"ticwmlf\",\"primaryFabricFriendlyName\":\"hibfmco\",\"recoveryFabricId\":\"ktuajkufp\",\"recoveryFabricFriendlyName\":\"dgnmei\",\"failoverDeploymentModel\":\"nobbai\",\"replicationProviders\":[\"bfyqz\"],\"allowedOperations\":[\"fo\",\"gvmrkmgifmyzbu\",\"dnhhc\"],\"lastPlannedFailoverTime\":\"2021-02-14T12:12:53Z\",\"lastUnplannedFailoverTime\":\"2021-07-06T10:13:19Z\",\"lastTestFailoverTime\":\"2021-11-17T02:54:07Z\",\"currentScenario\":{\"scenarioName\":\"onhbl\",\"jobId\":\"vcnuqfpz\",\"startTime\":\"2021-03-08T11:13:57Z\"},\"currentScenarioStatus\":\"pcwtwtrchk\",\"currentScenarioStatusDescription\":\"ruawqe\",\"groups\":[{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"xipwqchfpt\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"kkvjjl\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"cu\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"bgumu\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jxxpxxizchmb\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"zgi\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"jkngzfs\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"laybhozlsb\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"fnhbvcntpoe\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ytrsljzmzui\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{},{}],\"startGroupActions\":[{\"actionName\":\"znbppmk\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"lbbnjld\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"nefwle\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"vkya\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"foy\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"zo\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"dyaepre\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"kfalw\",\"id\":\"eechcayvqbeqp\",\"name\":\"cnusnylfhi\",\"type\":\"rjriybfbydrlqllb\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPlan response = + manager + .replicationRecoveryPlans() + .failoverCancel("wq", "qcowkendgrc", "ff", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qnugtcuyuwgnyjdi", response.properties().friendlyName()); + Assertions.assertEquals("ticwmlf", response.properties().primaryFabricId()); + Assertions.assertEquals("hibfmco", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("ktuajkufp", response.properties().recoveryFabricId()); + Assertions.assertEquals("dgnmei", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("nobbai", response.properties().failoverDeploymentModel()); + Assertions.assertEquals("bfyqz", response.properties().replicationProviders().get(0)); + Assertions.assertEquals("fo", response.properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-02-14T12:12:53Z"), response.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-07-06T10:13:19Z"), response.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-11-17T02:54:07Z"), response.properties().lastTestFailoverTime()); + Assertions.assertEquals("onhbl", response.properties().currentScenario().scenarioName()); + Assertions.assertEquals("vcnuqfpz", response.properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-03-08T11:13:57Z"), response.properties().currentScenario().startTime()); + Assertions.assertEquals("pcwtwtrchk", response.properties().currentScenarioStatus()); + Assertions.assertEquals("ruawqe", response.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.SHUTDOWN, response.properties().groups().get(0).groupType()); + Assertions + .assertEquals("xipwqchfpt", response.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions.assertEquals("cu", response.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("kfalw", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCommitMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCommitMockTests.java new file mode 100644 index 000000000000..a10bc9ee3912 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansFailoverCommitMockTests.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansFailoverCommitMockTests { + @Test + public void testFailoverCommit() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"bunvnjql\",\"primaryFabricId\":\"qqvcugusqlxlxedt\",\"primaryFabricFriendlyName\":\"wlnvqacbyfisbl\",\"recoveryFabricId\":\"mpuyypaggp\",\"recoveryFabricFriendlyName\":\"hea\",\"failoverDeploymentModel\":\"zwloqrmgdhy\",\"replicationProviders\":[\"vlxtywukhjdspl\",\"itxrrgkwiyoyh\"],\"allowedOperations\":[\"vxcodwkwoytcac\",\"hsizfuewlf\",\"fiikqcdnzsfiu\",\"gne\"],\"lastPlannedFailoverTime\":\"2021-11-17T13:52:52Z\",\"lastUnplannedFailoverTime\":\"2021-06-15T11:57:20Z\",\"lastTestFailoverTime\":\"2021-02-12T22:51:57Z\",\"currentScenario\":{\"scenarioName\":\"zoahovuf\",\"jobId\":\"rxj\",\"startTime\":\"2021-04-08T07:37:54Z\"},\"currentScenarioStatus\":\"rmdwtbrnlsy\",\"currentScenarioStatusDescription\":\"a\",\"groups\":[{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{},{}],\"startGroupActions\":[{\"actionName\":\"tclpphcs\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"mry\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"pan\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"aoiz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"ngzzxqbgqnzm\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ctbxzj\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"pifpucvb\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ozwbs\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"afzsq\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"pxmiwtkqif\",\"id\":\"vrdukcd\",\"name\":\"zoxlabuxtwgbaws\",\"type\":\"ram\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPlan response = + manager + .replicationRecoveryPlans() + .failoverCommit("fsnqocybrh", "giknrlugseiqb", "oqjfeamzkuxdgpks", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("bunvnjql", response.properties().friendlyName()); + Assertions.assertEquals("qqvcugusqlxlxedt", response.properties().primaryFabricId()); + Assertions.assertEquals("wlnvqacbyfisbl", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("mpuyypaggp", response.properties().recoveryFabricId()); + Assertions.assertEquals("hea", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("zwloqrmgdhy", response.properties().failoverDeploymentModel()); + Assertions.assertEquals("vlxtywukhjdspl", response.properties().replicationProviders().get(0)); + Assertions.assertEquals("vxcodwkwoytcac", response.properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-11-17T13:52:52Z"), response.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-06-15T11:57:20Z"), response.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-02-12T22:51:57Z"), response.properties().lastTestFailoverTime()); + Assertions.assertEquals("zoahovuf", response.properties().currentScenario().scenarioName()); + Assertions.assertEquals("rxj", response.properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-08T07:37:54Z"), response.properties().currentScenario().startTime()); + Assertions.assertEquals("rmdwtbrnlsy", response.properties().currentScenarioStatus()); + Assertions.assertEquals("a", response.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, response.properties().groups().get(0).groupType()); + Assertions + .assertEquals("tclpphcs", response.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions.assertEquals("aoiz", response.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("pxmiwtkqif", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansGetWithResponseMockTests.java new file mode 100644 index 000000000000..a5e65e10a5d4 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansGetWithResponseMockTests.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"urnzoytkbe\",\"primaryFabricId\":\"yfenrozoijoxcbpk\",\"primaryFabricFriendlyName\":\"seacbt\",\"recoveryFabricId\":\"dr\",\"recoveryFabricFriendlyName\":\"nhsxwhxrztd\",\"failoverDeploymentModel\":\"r\",\"replicationProviders\":[\"k\"],\"allowedOperations\":[\"ysyajmm\"],\"lastPlannedFailoverTime\":\"2021-05-25T05:51:57Z\",\"lastUnplannedFailoverTime\":\"2021-05-15T00:16:15Z\",\"lastTestFailoverTime\":\"2021-03-10T10:19:04Z\",\"currentScenario\":{\"scenarioName\":\"ufsdbkuxkdiu\",\"jobId\":\"s\",\"startTime\":\"2020-12-22T21:14:43Z\"},\"currentScenarioStatus\":\"kscwbshfihvl\",\"currentScenarioStatusDescription\":\"ceylaulpuexyigxz\",\"groups\":[{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"spgnnd\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"fyhsb\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"hwlvsvs\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ltaprq\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"mvzrkpmonx\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"wfcuhbgftfvqukkm\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"zene\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"pdq\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"qsem\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"hhxlsube\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ztbejrdzwyktd\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"fzwufifnjwjhmj\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"qflk\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"cyk\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"bndnrihpjaxh\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"ejnoignyd\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{},{},{},{}],\"startGroupActions\":[{\"actionName\":\"bnmrmhkipjardvdp\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"gwdxmiael\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"pbie\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"l\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"dvjlpbjszqjfs\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jvaycxrwknsb\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"brzwiypz\",\"id\":\"yhkecebt\",\"name\":\"gv\",\"type\":\"tbsusfd\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPlan response = + manager + .replicationRecoveryPlans() + .getWithResponse("voyjdgfkrq", "jrvpakxrdeexw", "juguvnxbo", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("urnzoytkbe", response.properties().friendlyName()); + Assertions.assertEquals("yfenrozoijoxcbpk", response.properties().primaryFabricId()); + Assertions.assertEquals("seacbt", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("dr", response.properties().recoveryFabricId()); + Assertions.assertEquals("nhsxwhxrztd", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("r", response.properties().failoverDeploymentModel()); + Assertions.assertEquals("k", response.properties().replicationProviders().get(0)); + Assertions.assertEquals("ysyajmm", response.properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-05-25T05:51:57Z"), response.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-05-15T00:16:15Z"), response.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-03-10T10:19:04Z"), response.properties().lastTestFailoverTime()); + Assertions.assertEquals("ufsdbkuxkdiu", response.properties().currentScenario().scenarioName()); + Assertions.assertEquals("s", response.properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2020-12-22T21:14:43Z"), response.properties().currentScenario().startTime()); + Assertions.assertEquals("kscwbshfihvl", response.properties().currentScenarioStatus()); + Assertions.assertEquals("ceylaulpuexyigxz", response.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, response.properties().groups().get(0).groupType()); + Assertions + .assertEquals("spgnnd", response.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals("mvzrkpmonx", response.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("brzwiypz", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansListMockTests.java new file mode 100644 index 000000000000..fca1f95003b4 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansListMockTests.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"friendlyName\":\"p\",\"primaryFabricId\":\"u\",\"primaryFabricFriendlyName\":\"ax\",\"recoveryFabricId\":\"j\",\"recoveryFabricFriendlyName\":\"utwe\",\"failoverDeploymentModel\":\"givkteccxfnatntm\",\"replicationProviders\":[\"bqpmfhjik\",\"cnbdq\",\"tghnmelzvrchm\",\"ucgrmwyv\"],\"allowedOperations\":[\"yplgq\",\"qgrbrhhv\",\"pgtipaaoylwh\",\"mkbweasgyp\"],\"lastPlannedFailoverTime\":\"2021-09-01T04:35:06Z\",\"lastUnplannedFailoverTime\":\"2021-07-31T10:34:51Z\",\"lastTestFailoverTime\":\"2021-10-24T03:31:42Z\",\"currentScenario\":{\"scenarioName\":\"ydwqeuwdvcls\",\"jobId\":\"qdchnzib\",\"startTime\":\"2021-03-05T02:41:17Z\"},\"currentScenarioStatus\":\"srwx\",\"currentScenarioStatusDescription\":\"kwargcbgdg\",\"groups\":[{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{},{},{}],\"startGroupActions\":[{\"actionName\":\"qwq\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"kmvugflhd\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"oxu\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"nnkvthwtamvmbgy\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"xh\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"muhkezuucqicocd\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"j\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"tutpdwnee\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"my\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"lxug\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"nffaofkvfruxzkfb\",\"id\":\"hgykzovstvymdqa\",\"name\":\"mqm\",\"type\":\"rnzgubqkfnox\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.replicationRecoveryPlans().list("rm", "zvti", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("p", response.iterator().next().properties().friendlyName()); + Assertions.assertEquals("u", response.iterator().next().properties().primaryFabricId()); + Assertions.assertEquals("ax", response.iterator().next().properties().primaryFabricFriendlyName()); + Assertions.assertEquals("j", response.iterator().next().properties().recoveryFabricId()); + Assertions.assertEquals("utwe", response.iterator().next().properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("givkteccxfnatntm", response.iterator().next().properties().failoverDeploymentModel()); + Assertions.assertEquals("bqpmfhjik", response.iterator().next().properties().replicationProviders().get(0)); + Assertions.assertEquals("yplgq", response.iterator().next().properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-09-01T04:35:06Z"), + response.iterator().next().properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-07-31T10:34:51Z"), + response.iterator().next().properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-10-24T03:31:42Z"), + response.iterator().next().properties().lastTestFailoverTime()); + Assertions + .assertEquals("ydwqeuwdvcls", response.iterator().next().properties().currentScenario().scenarioName()); + Assertions.assertEquals("qdchnzib", response.iterator().next().properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-03-05T02:41:17Z"), + response.iterator().next().properties().currentScenario().startTime()); + Assertions.assertEquals("srwx", response.iterator().next().properties().currentScenarioStatus()); + Assertions + .assertEquals("kwargcbgdg", response.iterator().next().properties().currentScenarioStatusDescription()); + Assertions + .assertEquals( + RecoveryPlanGroupType.FAILOVER, response.iterator().next().properties().groups().get(0).groupType()); + Assertions + .assertEquals( + "qwq", response.iterator().next().properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + "nnkvthwtamvmbgy", + response.iterator().next().properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("nffaofkvfruxzkfb", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansPlannedFailoverMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansPlannedFailoverMockTests.java new file mode 100644 index 000000000000..e25f58ba1e25 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansPlannedFailoverMockTests.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanPlannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansPlannedFailoverMockTests { + @Test + public void testPlannedFailover() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"mcer\",\"primaryFabricId\":\"feiqb\",\"primaryFabricFriendlyName\":\"thzw\",\"recoveryFabricId\":\"pssvnonij\",\"recoveryFabricFriendlyName\":\"cj\",\"failoverDeploymentModel\":\"zjku\",\"replicationProviders\":[\"qqbt\",\"kvocu\"],\"allowedOperations\":[\"lbpwarhwettohg\",\"z\",\"xyvtkzbhizxp\",\"sddmwnfhmju\"],\"lastPlannedFailoverTime\":\"2021-03-26T04:51:04Z\",\"lastUnplannedFailoverTime\":\"2021-01-08T10:12:47Z\",\"lastTestFailoverTime\":\"2021-08-31T12:11:02Z\",\"currentScenario\":{\"scenarioName\":\"lxudhek\",\"jobId\":\"nirmidtvhjc\",\"startTime\":\"2021-06-10T15:34:30Z\"},\"currentScenarioStatus\":\"bqygkxr\",\"currentScenarioStatusDescription\":\"ojlclpumveybodhr\",\"groups\":[{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{},{}],\"startGroupActions\":[{\"actionName\":\"bcumjv\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"gpdxtsaujtco\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jybolqoxupt\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"l\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"mlkwk\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"linvamtykxsz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ekfxcs\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"ozkt\",\"id\":\"dpcz\",\"name\":\"ohplrgcnbvmhvq\",\"type\":\"kedaxkuyorfj\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPlan response = + manager + .replicationRecoveryPlans() + .plannedFailover( + "sugqcglma", + "fzto", + "xvqlauu", + new RecoveryPlanPlannedFailoverInput() + .withProperties( + new RecoveryPlanPlannedFailoverInputProperties() + .withFailoverDirection(PossibleOperationsDirections.PRIMARY_TO_RECOVERY) + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput()))), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("mcer", response.properties().friendlyName()); + Assertions.assertEquals("feiqb", response.properties().primaryFabricId()); + Assertions.assertEquals("thzw", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("pssvnonij", response.properties().recoveryFabricId()); + Assertions.assertEquals("cj", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("zjku", response.properties().failoverDeploymentModel()); + Assertions.assertEquals("qqbt", response.properties().replicationProviders().get(0)); + Assertions.assertEquals("lbpwarhwettohg", response.properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-03-26T04:51:04Z"), response.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-01-08T10:12:47Z"), response.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-08-31T12:11:02Z"), response.properties().lastTestFailoverTime()); + Assertions.assertEquals("lxudhek", response.properties().currentScenario().scenarioName()); + Assertions.assertEquals("nirmidtvhjc", response.properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-06-10T15:34:30Z"), response.properties().currentScenario().startTime()); + Assertions.assertEquals("bqygkxr", response.properties().currentScenarioStatus()); + Assertions.assertEquals("ojlclpumveybodhr", response.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, response.properties().groups().get(0).groupType()); + Assertions + .assertEquals("bcumjv", response.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions.assertEquals("mlkwk", response.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("ozkt", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansReprotectMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansReprotectMockTests.java new file mode 100644 index 000000000000..bad96f880ef7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansReprotectMockTests.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansReprotectMockTests { + @Test + public void testReprotect() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"pwnyfjcypazwiimd\",\"primaryFabricId\":\"gkooagr\",\"primaryFabricFriendlyName\":\"pamesi\",\"recoveryFabricId\":\"qadewhuwxk\",\"recoveryFabricFriendlyName\":\"iatfamrnaifllxcc\",\"failoverDeploymentModel\":\"kiyfo\",\"replicationProviders\":[\"omy\",\"xgtu\"],\"allowedOperations\":[\"fquzihirqvv\",\"e\"],\"lastPlannedFailoverTime\":\"2021-08-16T07:33:38Z\",\"lastUnplannedFailoverTime\":\"2021-05-16T08:15:32Z\",\"lastTestFailoverTime\":\"2020-12-21T05:22:34Z\",\"currentScenario\":{\"scenarioName\":\"ssgvq\",\"jobId\":\"rxrmhrraqgbbjlv\",\"startTime\":\"2021-10-25T17:42:29Z\"},\"currentScenarioStatus\":\"rxsiyzsyiumtit\",\"currentScenarioStatusDescription\":\"ycfvernnkq\",\"groups\":[{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"igdrqgzetboyz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"gnmuxp\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"wpcfmgr\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"whzbbdwrjencof\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ii\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"wibdtpljo\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"bxxcdkhxjwtkftg\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ljuepme\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"pgbmlbxjhgvtepvr\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"nudmakkshrna\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"kwohdig\",\"id\":\"yuo\",\"name\":\"ftsamo\",\"type\":\"wqbak\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPlan response = + manager.replicationRecoveryPlans().reprotect("dq", "dawe", "gavfyihu", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("pwnyfjcypazwiimd", response.properties().friendlyName()); + Assertions.assertEquals("gkooagr", response.properties().primaryFabricId()); + Assertions.assertEquals("pamesi", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("qadewhuwxk", response.properties().recoveryFabricId()); + Assertions.assertEquals("iatfamrnaifllxcc", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("kiyfo", response.properties().failoverDeploymentModel()); + Assertions.assertEquals("omy", response.properties().replicationProviders().get(0)); + Assertions.assertEquals("fquzihirqvv", response.properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-08-16T07:33:38Z"), response.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-05-16T08:15:32Z"), response.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2020-12-21T05:22:34Z"), response.properties().lastTestFailoverTime()); + Assertions.assertEquals("ssgvq", response.properties().currentScenario().scenarioName()); + Assertions.assertEquals("rxrmhrraqgbbjlv", response.properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-10-25T17:42:29Z"), response.properties().currentScenario().startTime()); + Assertions.assertEquals("rxsiyzsyiumtit", response.properties().currentScenarioStatus()); + Assertions.assertEquals("ycfvernnkq", response.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, response.properties().groups().get(0).groupType()); + Assertions + .assertEquals( + "igdrqgzetboyz", response.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + "whzbbdwrjencof", response.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("kwohdig", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverCleanupMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverCleanupMockTests.java new file mode 100644 index 000000000000..f121d79df93e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverCleanupMockTests.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverCleanupInputProperties; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansTestFailoverCleanupMockTests { + @Test + public void testTestFailoverCleanup() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"lbiqq\",\"primaryFabricId\":\"arxknfvbsym\",\"primaryFabricFriendlyName\":\"bahdbtjm\",\"recoveryFabricId\":\"zonrklbizrxh\",\"recoveryFabricFriendlyName\":\"fvpanloqovvcxgq\",\"failoverDeploymentModel\":\"uirgopgzatucu\",\"replicationProviders\":[\"uzvyjxuxchquoqhq\",\"csksxqf\",\"lrvuvdagv\"],\"allowedOperations\":[\"d\"],\"lastPlannedFailoverTime\":\"2021-04-28T08:18:31Z\",\"lastUnplannedFailoverTime\":\"2021-02-19T21:32:29Z\",\"lastTestFailoverTime\":\"2020-12-25T04:39:30Z\",\"currentScenario\":{\"scenarioName\":\"odiijcsapqhip\",\"jobId\":\"snivnmevljbcu\",\"startTime\":\"2021-08-10T00:42:25Z\"},\"currentScenarioStatus\":\"pjf\",\"currentScenarioStatusDescription\":\"wkseodvlmd\",\"groups\":[{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{},{}],\"startGroupActions\":[{\"actionName\":\"u\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"yg\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"bmum\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jvvcrsmwojm\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"wcvumnrut\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"f\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"vltjo\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"vpkbz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"tnowpajfhxsmu\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"dzglmuuzpsuhsyp\",\"id\":\"muldhfr\",\"name\":\"rkqpyfjxkby\",\"type\":\"sbuqfm\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPlan response = + manager + .replicationRecoveryPlans() + .testFailoverCleanup( + "p", + "addpxqrxipe", + "rplf", + new RecoveryPlanTestFailoverCleanupInput() + .withProperties(new RecoveryPlanTestFailoverCleanupInputProperties().withComments("vmjjfz")), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("lbiqq", response.properties().friendlyName()); + Assertions.assertEquals("arxknfvbsym", response.properties().primaryFabricId()); + Assertions.assertEquals("bahdbtjm", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("zonrklbizrxh", response.properties().recoveryFabricId()); + Assertions.assertEquals("fvpanloqovvcxgq", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("uirgopgzatucu", response.properties().failoverDeploymentModel()); + Assertions.assertEquals("uzvyjxuxchquoqhq", response.properties().replicationProviders().get(0)); + Assertions.assertEquals("d", response.properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-28T08:18:31Z"), response.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-02-19T21:32:29Z"), response.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2020-12-25T04:39:30Z"), response.properties().lastTestFailoverTime()); + Assertions.assertEquals("odiijcsapqhip", response.properties().currentScenario().scenarioName()); + Assertions.assertEquals("snivnmevljbcu", response.properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-08-10T00:42:25Z"), response.properties().currentScenario().startTime()); + Assertions.assertEquals("pjf", response.properties().currentScenarioStatus()); + Assertions.assertEquals("wkseodvlmd", response.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.FAILOVER, response.properties().groups().get(0).groupType()); + Assertions.assertEquals("u", response.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions.assertEquals("yg", response.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("dzglmuuzpsuhsyp", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverMockTests.java new file mode 100644 index 000000000000..ae64f83fe2a0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansTestFailoverMockTests.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanTestFailoverInputProperties; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansTestFailoverMockTests { + @Test + public void testTestFailover() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"pmdmwiwevves\",\"primaryFabricId\":\"hh\",\"primaryFabricFriendlyName\":\"qhdldargkwimtcce\",\"recoveryFabricId\":\"uqu\",\"recoveryFabricFriendlyName\":\"czzc\",\"failoverDeploymentModel\":\"wxvbkirgknhfw\",\"replicationProviders\":[\"wdajyd\",\"bjgipvspe\"],\"allowedOperations\":[\"hydtkbmt\",\"sd\"],\"lastPlannedFailoverTime\":\"2021-02-01T04:36:15Z\",\"lastUnplannedFailoverTime\":\"2021-10-07T22:01:48Z\",\"lastTestFailoverTime\":\"2021-11-11T09:35:50Z\",\"currentScenario\":{\"scenarioName\":\"mawo\",\"jobId\":\"cnev\",\"startTime\":\"2021-09-22T15:27:40Z\"},\"currentScenarioStatus\":\"b\",\"currentScenarioStatusDescription\":\"sclwbjgi\",\"groups\":[{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"weofvsxauphzefi\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"eyydx\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"gtiivzkd\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"exccwldgfq\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"mwtacrscfcn\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{},{}],\"startGroupActions\":[{\"actionName\":\"llmfwfpo\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"oszzw\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"xvchmubyguqh\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"nmsvj\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"grpry\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ircbajxjrbvyr\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"atxkznlwlmbx\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"gkev\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ay\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"x\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{}],\"startGroupActions\":[{\"actionName\":\"zgrgkja\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"waezplybspsbomt\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"epzimfc\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"suiwexpasckpg\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"mlyxbwslx\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"toejtqv\",\"id\":\"ctm\",\"name\":\"idkxz\",\"type\":\"oluznt\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPlan response = + manager + .replicationRecoveryPlans() + .testFailover( + "vxerowuzvrnnbeg", + "af", + "onmtoj", + new RecoveryPlanTestFailoverInput() + .withProperties( + new RecoveryPlanTestFailoverInputProperties() + .withFailoverDirection(PossibleOperationsDirections.PRIMARY_TO_RECOVERY) + .withNetworkType("dofmazhk") + .withNetworkId("sjknaq") + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput()))), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("pmdmwiwevves", response.properties().friendlyName()); + Assertions.assertEquals("hh", response.properties().primaryFabricId()); + Assertions.assertEquals("qhdldargkwimtcce", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("uqu", response.properties().recoveryFabricId()); + Assertions.assertEquals("czzc", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("wxvbkirgknhfw", response.properties().failoverDeploymentModel()); + Assertions.assertEquals("wdajyd", response.properties().replicationProviders().get(0)); + Assertions.assertEquals("hydtkbmt", response.properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-02-01T04:36:15Z"), response.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-10-07T22:01:48Z"), response.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-11-11T09:35:50Z"), response.properties().lastTestFailoverTime()); + Assertions.assertEquals("mawo", response.properties().currentScenario().scenarioName()); + Assertions.assertEquals("cnev", response.properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-09-22T15:27:40Z"), response.properties().currentScenario().startTime()); + Assertions.assertEquals("b", response.properties().currentScenarioStatus()); + Assertions.assertEquals("sclwbjgi", response.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, response.properties().groups().get(0).groupType()); + Assertions + .assertEquals( + "weofvsxauphzefi", response.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals("mwtacrscfcn", response.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("toejtqv", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUnplannedFailoverMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUnplannedFailoverMockTests.java new file mode 100644 index 000000000000..beedf5b99ab4 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationRecoveryPlansUnplannedFailoverMockTests.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlan; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProviderSpecificFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanUnplannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SourceSiteOperations; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationRecoveryPlansUnplannedFailoverMockTests { + @Test + public void testUnplannedFailover() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"ikh\",\"primaryFabricId\":\"thypepxshmrd\",\"primaryFabricFriendlyName\":\"csdvkymktc\",\"recoveryFabricId\":\"ivoxgzegnglafnf\",\"recoveryFabricFriendlyName\":\"zaghddc\",\"failoverDeploymentModel\":\"wxuxor\",\"replicationProviders\":[\"uhvemgxlss\",\"lqypvwxl\"],\"allowedOperations\":[\"vrkqv\",\"vgdojcvzfcmxmjp\"],\"lastPlannedFailoverTime\":\"2021-11-18T03:57:06Z\",\"lastUnplannedFailoverTime\":\"2021-01-12T06:14:49Z\",\"lastTestFailoverTime\":\"2021-06-13T19:20:39Z\",\"currentScenario\":{\"scenarioName\":\"ocgquqx\",\"jobId\":\"xp\",\"startTime\":\"2021-08-14T00:33Z\"},\"currentScenarioStatus\":\"qniiontqikdipk\",\"currentScenarioStatusDescription\":\"qkuzabrsoihataj\",\"groups\":[{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{},{}],\"startGroupActions\":[{\"actionName\":\"ssxylsu\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"oadoh\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jyiehkxgfuzqqnz\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"xqds\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ipdnl\",\"failoverTypes\":[],\"failoverDirections\":[],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}],\"providerSpecificDetails\":[{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"},{\"instanceType\":\"RecoveryPlanProviderSpecificDetails\"}]},\"location\":\"f\",\"id\":\"pwwgzeylzp\",\"name\":\"imxacrkt\",\"type\":\"o\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoveryPlan response = + manager + .replicationRecoveryPlans() + .unplannedFailover( + "bdjkmnxsggnow", + "hyvdbrdvsv", + "hbtyc", + new RecoveryPlanUnplannedFailoverInput() + .withProperties( + new RecoveryPlanUnplannedFailoverInputProperties() + .withFailoverDirection(PossibleOperationsDirections.PRIMARY_TO_RECOVERY) + .withSourceSiteOperations(SourceSiteOperations.REQUIRED) + .withProviderSpecificDetails( + Arrays + .asList( + new RecoveryPlanProviderSpecificFailoverInput(), + new RecoveryPlanProviderSpecificFailoverInput()))), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ikh", response.properties().friendlyName()); + Assertions.assertEquals("thypepxshmrd", response.properties().primaryFabricId()); + Assertions.assertEquals("csdvkymktc", response.properties().primaryFabricFriendlyName()); + Assertions.assertEquals("ivoxgzegnglafnf", response.properties().recoveryFabricId()); + Assertions.assertEquals("zaghddc", response.properties().recoveryFabricFriendlyName()); + Assertions.assertEquals("wxuxor", response.properties().failoverDeploymentModel()); + Assertions.assertEquals("uhvemgxlss", response.properties().replicationProviders().get(0)); + Assertions.assertEquals("vrkqv", response.properties().allowedOperations().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-11-18T03:57:06Z"), response.properties().lastPlannedFailoverTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-01-12T06:14:49Z"), response.properties().lastUnplannedFailoverTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-06-13T19:20:39Z"), response.properties().lastTestFailoverTime()); + Assertions.assertEquals("ocgquqx", response.properties().currentScenario().scenarioName()); + Assertions.assertEquals("xp", response.properties().currentScenario().jobId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-08-14T00:33Z"), response.properties().currentScenario().startTime()); + Assertions.assertEquals("qniiontqikdipk", response.properties().currentScenarioStatus()); + Assertions.assertEquals("qkuzabrsoihataj", response.properties().currentScenarioStatusDescription()); + Assertions.assertEquals(RecoveryPlanGroupType.SHUTDOWN, response.properties().groups().get(0).groupType()); + Assertions + .assertEquals("ssxylsu", response.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions.assertEquals("xqds", response.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions.assertEquals("f", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingsCreateMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingsCreateMockTests.java new file mode 100644 index 000000000000..1f7561b1673b --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingsCreateMockTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSetting; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationVaultSettingsCreateMockTests { + @Test + public void testCreate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"migrationSolutionId\":\"inrufq\",\"vmwareToAzureProviderType\":\"uygasfmhb\"},\"location\":\"ewk\",\"id\":\"natxvuzccaliry\",\"name\":\"ytc\",\"type\":\"qpjohlcbn\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + VaultSetting response = + manager + .replicationVaultSettings() + .define("mwaxsymnrtv") + .withExistingVault("zrkrztpyay", "hxl") + .withProperties( + new VaultSettingCreationInputProperties() + .withMigrationSolutionId("imavyotpcvpahh") + .withVmwareToAzureProviderType("vyqpvzxxzndw")) + .create(); + + Assertions.assertEquals("inrufq", response.properties().migrationSolutionId()); + Assertions.assertEquals("uygasfmhb", response.properties().vmwareToAzureProviderType()); + Assertions.assertEquals("ewk", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingsGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingsGetWithResponseMockTests.java new file mode 100644 index 000000000000..7e636cb8d3d5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingsGetWithResponseMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSetting; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationVaultSettingsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"migrationSolutionId\":\"z\",\"vmwareToAzureProviderType\":\"jebmuiong\"},\"location\":\"dwohoeashuxf\",\"id\":\"bjimzwynsmmp\",\"name\":\"vkyezwsey\",\"type\":\"oyjmjwqdslqreo\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + VaultSetting response = + manager + .replicationVaultSettings() + .getWithResponse( + "cidcfwoolkugzow", "mmixfzaupgblna", "jnpahzhpqscuyil", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("z", response.properties().migrationSolutionId()); + Assertions.assertEquals("jebmuiong", response.properties().vmwareToAzureProviderType()); + Assertions.assertEquals("dwohoeashuxf", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingsListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingsListMockTests.java new file mode 100644 index 000000000000..2dbc0b02b016 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReplicationVaultSettingsListMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSetting; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ReplicationVaultSettingsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"migrationSolutionId\":\"dvwojvx\",\"vmwareToAzureProviderType\":\"vhrqxrqghot\"},\"location\":\"gzickgygaw\",\"id\":\"hpwmdkyfgye\",\"name\":\"vyhvv\",\"type\":\"uqyrpubbk\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.replicationVaultSettings().list("jkhcoscoljjhcs", "zooefzsdttbq", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("dvwojvx", response.iterator().next().properties().migrationSolutionId()); + Assertions.assertEquals("vhrqxrqghot", response.iterator().next().properties().vmwareToAzureProviderType()); + Assertions.assertEquals("gzickgygaw", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResolveHealthErrorTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResolveHealthErrorTests.java new file mode 100644 index 000000000000..31a9e57bd222 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResolveHealthErrorTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResolveHealthError; +import org.junit.jupiter.api.Assertions; + +public final class ResolveHealthErrorTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResolveHealthError model = + BinaryData.fromString("{\"healthErrorId\":\"txifqj\"}").toObject(ResolveHealthError.class); + Assertions.assertEquals("txifqj", model.healthErrorId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResolveHealthError model = new ResolveHealthError().withHealthErrorId("txifqj"); + model = BinaryData.fromObject(model).toObject(ResolveHealthError.class); + Assertions.assertEquals("txifqj", model.healthErrorId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResolveHealthInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResolveHealthInputPropertiesTests.java new file mode 100644 index 000000000000..09b5bc8bb1cc --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResolveHealthInputPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResolveHealthError; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResolveHealthInputProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ResolveHealthInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResolveHealthInputProperties model = + BinaryData + .fromString("{\"healthErrors\":[{\"healthErrorId\":\"vpa\"},{\"healthErrorId\":\"sreuzvxurisjnh\"}]}") + .toObject(ResolveHealthInputProperties.class); + Assertions.assertEquals("vpa", model.healthErrors().get(0).healthErrorId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResolveHealthInputProperties model = + new ResolveHealthInputProperties() + .withHealthErrors( + Arrays + .asList( + new ResolveHealthError().withHealthErrorId("vpa"), + new ResolveHealthError().withHealthErrorId("sreuzvxurisjnh"))); + model = BinaryData.fromObject(model).toObject(ResolveHealthInputProperties.class); + Assertions.assertEquals("vpa", model.healthErrors().get(0).healthErrorId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResolveHealthInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResolveHealthInputTests.java new file mode 100644 index 000000000000..d0aae3c381ff --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResolveHealthInputTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResolveHealthError; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResolveHealthInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResolveHealthInputProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ResolveHealthInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResolveHealthInput model = + BinaryData + .fromString( + "{\"properties\":{\"healthErrors\":[{\"healthErrorId\":\"oftpipiwycz\"},{\"healthErrorId\":\"xacpqjli\"},{\"healthErrorId\":\"yuspskas\"},{\"healthErrorId\":\"lmfwdgzx\"}]}}") + .toObject(ResolveHealthInput.class); + Assertions.assertEquals("oftpipiwycz", model.properties().healthErrors().get(0).healthErrorId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResolveHealthInput model = + new ResolveHealthInput() + .withProperties( + new ResolveHealthInputProperties() + .withHealthErrors( + Arrays + .asList( + new ResolveHealthError().withHealthErrorId("oftpipiwycz"), + new ResolveHealthError().withHealthErrorId("xacpqjli"), + new ResolveHealthError().withHealthErrorId("yuspskas"), + new ResolveHealthError().withHealthErrorId("lmfwdgzx")))); + model = BinaryData.fromObject(model).toObject(ResolveHealthInput.class); + Assertions.assertEquals("oftpipiwycz", model.properties().healthErrors().get(0).healthErrorId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeJobParamsPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeJobParamsPropertiesTests.java new file mode 100644 index 000000000000..06d2e32c1e74 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeJobParamsPropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeJobParamsProperties; +import org.junit.jupiter.api.Assertions; + +public final class ResumeJobParamsPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResumeJobParamsProperties model = + BinaryData.fromString("{\"comments\":\"snewmozqvbub\"}").toObject(ResumeJobParamsProperties.class); + Assertions.assertEquals("snewmozqvbub", model.comments()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResumeJobParamsProperties model = new ResumeJobParamsProperties().withComments("snewmozqvbub"); + model = BinaryData.fromObject(model).toObject(ResumeJobParamsProperties.class); + Assertions.assertEquals("snewmozqvbub", model.comments()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeJobParamsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeJobParamsTests.java new file mode 100644 index 000000000000..83be86cea8ba --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeJobParamsTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeJobParams; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeJobParamsProperties; +import org.junit.jupiter.api.Assertions; + +public final class ResumeJobParamsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResumeJobParams model = + BinaryData.fromString("{\"properties\":{\"comments\":\"hx\"}}").toObject(ResumeJobParams.class); + Assertions.assertEquals("hx", model.properties().comments()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResumeJobParams model = + new ResumeJobParams().withProperties(new ResumeJobParamsProperties().withComments("hx")); + model = BinaryData.fromObject(model).toObject(ResumeJobParams.class); + Assertions.assertEquals("hx", model.properties().comments()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeReplicationInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeReplicationInputPropertiesTests.java new file mode 100644 index 000000000000..0da4c883acaa --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeReplicationInputPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeReplicationInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeReplicationProviderSpecificInput; + +public final class ResumeReplicationInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResumeReplicationInputProperties model = + BinaryData + .fromString( + "{\"providerSpecificDetails\":{\"instanceType\":\"ResumeReplicationProviderSpecificInput\"}}") + .toObject(ResumeReplicationInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResumeReplicationInputProperties model = + new ResumeReplicationInputProperties() + .withProviderSpecificDetails(new ResumeReplicationProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(ResumeReplicationInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeReplicationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeReplicationInputTests.java new file mode 100644 index 000000000000..5d93795c9757 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeReplicationInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeReplicationInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeReplicationInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeReplicationProviderSpecificInput; + +public final class ResumeReplicationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResumeReplicationInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"ResumeReplicationProviderSpecificInput\"}}}") + .toObject(ResumeReplicationInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResumeReplicationInput model = + new ResumeReplicationInput() + .withProperties( + new ResumeReplicationInputProperties() + .withProviderSpecificDetails(new ResumeReplicationProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(ResumeReplicationInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeReplicationProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeReplicationProviderSpecificInputTests.java new file mode 100644 index 000000000000..20f6eb0cf5a5 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResumeReplicationProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResumeReplicationProviderSpecificInput; + +public final class ResumeReplicationProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResumeReplicationProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"ResumeReplicationProviderSpecificInput\"}") + .toObject(ResumeReplicationProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResumeReplicationProviderSpecificInput model = new ResumeReplicationProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(ResumeReplicationProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResyncInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResyncInputPropertiesTests.java new file mode 100644 index 000000000000..109f1742f228 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResyncInputPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResyncInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResyncProviderSpecificInput; + +public final class ResyncInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResyncInputProperties model = + BinaryData + .fromString("{\"providerSpecificDetails\":{\"instanceType\":\"ResyncProviderSpecificInput\"}}") + .toObject(ResyncInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResyncInputProperties model = + new ResyncInputProperties().withProviderSpecificDetails(new ResyncProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(ResyncInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResyncInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResyncInputTests.java new file mode 100644 index 000000000000..52b214a2aecd --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResyncInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResyncInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResyncInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResyncProviderSpecificInput; + +public final class ResyncInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResyncInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"ResyncProviderSpecificInput\"}}}") + .toObject(ResyncInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResyncInput model = + new ResyncInput() + .withProperties( + new ResyncInputProperties().withProviderSpecificDetails(new ResyncProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(ResyncInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResyncProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResyncProviderSpecificInputTests.java new file mode 100644 index 000000000000..0a9bd42aba9d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ResyncProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ResyncProviderSpecificInput; + +public final class ResyncProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResyncProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"ResyncProviderSpecificInput\"}") + .toObject(ResyncProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResyncProviderSpecificInput model = new ResyncProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(ResyncProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RetentionVolumeTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RetentionVolumeTests.java new file mode 100644 index 000000000000..c5f415e8856d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RetentionVolumeTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RetentionVolume; +import org.junit.jupiter.api.Assertions; + +public final class RetentionVolumeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RetentionVolume model = + BinaryData + .fromString( + "{\"volumeName\":\"pqsdoc\",\"capacityInBytes\":3488715345246036434,\"freeSpaceInBytes\":3180098480061688390,\"thresholdPercentage\":1205622455}") + .toObject(RetentionVolume.class); + Assertions.assertEquals("pqsdoc", model.volumeName()); + Assertions.assertEquals(3488715345246036434L, model.capacityInBytes()); + Assertions.assertEquals(3180098480061688390L, model.freeSpaceInBytes()); + Assertions.assertEquals(1205622455, model.thresholdPercentage()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RetentionVolume model = + new RetentionVolume() + .withVolumeName("pqsdoc") + .withCapacityInBytes(3488715345246036434L) + .withFreeSpaceInBytes(3180098480061688390L) + .withThresholdPercentage(1205622455); + model = BinaryData.fromObject(model).toObject(RetentionVolume.class); + Assertions.assertEquals("pqsdoc", model.volumeName()); + Assertions.assertEquals(3488715345246036434L, model.capacityInBytes()); + Assertions.assertEquals(3180098480061688390L, model.freeSpaceInBytes()); + Assertions.assertEquals(1205622455, model.thresholdPercentage()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReverseReplicationInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReverseReplicationInputPropertiesTests.java new file mode 100644 index 000000000000..a1440adfb792 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReverseReplicationInputPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReverseReplicationInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class ReverseReplicationInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReverseReplicationInputProperties model = + BinaryData + .fromString( + "{\"failoverDirection\":\"otmrfhir\",\"providerSpecificDetails\":{\"instanceType\":\"ReverseReplicationProviderSpecificInput\"}}") + .toObject(ReverseReplicationInputProperties.class); + Assertions.assertEquals("otmrfhir", model.failoverDirection()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReverseReplicationInputProperties model = + new ReverseReplicationInputProperties() + .withFailoverDirection("otmrfhir") + .withProviderSpecificDetails(new ReverseReplicationProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(ReverseReplicationInputProperties.class); + Assertions.assertEquals("otmrfhir", model.failoverDirection()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReverseReplicationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReverseReplicationInputTests.java new file mode 100644 index 000000000000..64a9e67414c1 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReverseReplicationInputTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReverseReplicationInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReverseReplicationInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class ReverseReplicationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReverseReplicationInput model = + BinaryData + .fromString( + "{\"properties\":{\"failoverDirection\":\"aojfm\",\"providerSpecificDetails\":{\"instanceType\":\"ReverseReplicationProviderSpecificInput\"}}}") + .toObject(ReverseReplicationInput.class); + Assertions.assertEquals("aojfm", model.properties().failoverDirection()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReverseReplicationInput model = + new ReverseReplicationInput() + .withProperties( + new ReverseReplicationInputProperties() + .withFailoverDirection("aojfm") + .withProviderSpecificDetails(new ReverseReplicationProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(ReverseReplicationInput.class); + Assertions.assertEquals("aojfm", model.properties().failoverDirection()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReverseReplicationProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReverseReplicationProviderSpecificInputTests.java new file mode 100644 index 000000000000..d723fe87027c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ReverseReplicationProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReverseReplicationProviderSpecificInput; + +public final class ReverseReplicationProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReverseReplicationProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"ReverseReplicationProviderSpecificInput\"}") + .toObject(ReverseReplicationProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReverseReplicationProviderSpecificInput model = new ReverseReplicationProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(ReverseReplicationProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RunAsAccountTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RunAsAccountTests.java new file mode 100644 index 000000000000..71932a37b556 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/RunAsAccountTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RunAsAccount; +import org.junit.jupiter.api.Assertions; + +public final class RunAsAccountTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RunAsAccount model = + BinaryData + .fromString("{\"accountId\":\"iploisjkzsoxznnt\",\"accountName\":\"kvyohpsap\"}") + .toObject(RunAsAccount.class); + Assertions.assertEquals("iploisjkzsoxznnt", model.accountId()); + Assertions.assertEquals("kvyohpsap", model.accountName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RunAsAccount model = new RunAsAccount().withAccountId("iploisjkzsoxznnt").withAccountName("kvyohpsap"); + model = BinaryData.fromObject(model).toObject(RunAsAccount.class); + Assertions.assertEquals("iploisjkzsoxznnt", model.accountId()); + Assertions.assertEquals("kvyohpsap", model.accountName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ScriptActionTaskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ScriptActionTaskDetailsTests.java new file mode 100644 index 000000000000..b2b8043d0385 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/ScriptActionTaskDetailsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ScriptActionTaskDetails; +import org.junit.jupiter.api.Assertions; + +public final class ScriptActionTaskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScriptActionTaskDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"ScriptActionTaskDetails\",\"name\":\"pzwwytbdjzgh\",\"path\":\"mkgfmxpqkjnp\",\"output\":\"iwntotcxmmqmts\",\"isPrimarySideScript\":true}") + .toObject(ScriptActionTaskDetails.class); + Assertions.assertEquals("pzwwytbdjzgh", model.name()); + Assertions.assertEquals("mkgfmxpqkjnp", model.path()); + Assertions.assertEquals("iwntotcxmmqmts", model.output()); + Assertions.assertEquals(true, model.isPrimarySideScript()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ScriptActionTaskDetails model = + new ScriptActionTaskDetails() + .withName("pzwwytbdjzgh") + .withPath("mkgfmxpqkjnp") + .withOutput("iwntotcxmmqmts") + .withIsPrimarySideScript(true); + model = BinaryData.fromObject(model).toObject(ScriptActionTaskDetails.class); + Assertions.assertEquals("pzwwytbdjzgh", model.name()); + Assertions.assertEquals("mkgfmxpqkjnp", model.path()); + Assertions.assertEquals("iwntotcxmmqmts", model.output()); + Assertions.assertEquals(true, model.isPrimarySideScript()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageAccountCustomDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageAccountCustomDetailsTests.java new file mode 100644 index 000000000000..cdb4895100c4 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageAccountCustomDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageAccountCustomDetails; + +public final class StorageAccountCustomDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageAccountCustomDetails model = + BinaryData + .fromString("{\"resourceType\":\"StorageAccountCustomDetails\"}") + .toObject(StorageAccountCustomDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageAccountCustomDetails model = new StorageAccountCustomDetails(); + model = BinaryData.fromObject(model).toObject(StorageAccountCustomDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationCollectionTests.java new file mode 100644 index 000000000000..2078dd62d626 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationCollectionTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.StorageClassificationInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class StorageClassificationCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageClassificationCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"friendlyName\":\"zjcjbtr\"},\"location\":\"ehvvib\",\"id\":\"xjjs\",\"name\":\"oqbeitpkxzt\",\"type\":\"oobklftidgfcwq\"}],\"nextLink\":\"imaq\"}") + .toObject(StorageClassificationCollection.class); + Assertions.assertEquals("zjcjbtr", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("ehvvib", model.value().get(0).location()); + Assertions.assertEquals("imaq", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageClassificationCollection model = + new StorageClassificationCollection() + .withValue( + Arrays + .asList( + new StorageClassificationInner() + .withProperties(new StorageClassificationProperties().withFriendlyName("zjcjbtr")) + .withLocation("ehvvib"))) + .withNextLink("imaq"); + model = BinaryData.fromObject(model).toObject(StorageClassificationCollection.class); + Assertions.assertEquals("zjcjbtr", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals("ehvvib", model.value().get(0).location()); + Assertions.assertEquals("imaq", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationInnerTests.java new file mode 100644 index 000000000000..eecbab502d5f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationInnerTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.StorageClassificationInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationProperties; +import org.junit.jupiter.api.Assertions; + +public final class StorageClassificationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageClassificationInner model = + BinaryData + .fromString( + "{\"properties\":{\"friendlyName\":\"em\"},\"location\":\"h\",\"id\":\"hujswtwkozzwcul\",\"name\":\"bawpfajnjwltlwt\",\"type\":\"j\"}") + .toObject(StorageClassificationInner.class); + Assertions.assertEquals("em", model.properties().friendlyName()); + Assertions.assertEquals("h", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageClassificationInner model = + new StorageClassificationInner() + .withProperties(new StorageClassificationProperties().withFriendlyName("em")) + .withLocation("h"); + model = BinaryData.fromObject(model).toObject(StorageClassificationInner.class); + Assertions.assertEquals("em", model.properties().friendlyName()); + Assertions.assertEquals("h", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingCollectionTests.java new file mode 100644 index 000000000000..8f7739c431e1 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingCollectionTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.StorageClassificationMappingInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationMappingCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationMappingProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class StorageClassificationMappingCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageClassificationMappingCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"targetStorageClassificationId\":\"mlnwiaaomylweazu\"},\"location\":\"sethwwn\",\"id\":\"jhlfzswpchwahf\",\"name\":\"ousnfepgfewe\",\"type\":\"wlyxgncxyk\"},{\"properties\":{\"targetStorageClassificationId\":\"jhlimmbcxfhbcpo\"},\"location\":\"vxcjzhqizxfpxtgq\",\"id\":\"cja\",\"name\":\"ftjuh\",\"type\":\"qaz\"}],\"nextLink\":\"tgguwpijrajcivmm\"}") + .toObject(StorageClassificationMappingCollection.class); + Assertions.assertEquals("mlnwiaaomylweazu", model.value().get(0).properties().targetStorageClassificationId()); + Assertions.assertEquals("sethwwn", model.value().get(0).location()); + Assertions.assertEquals("tgguwpijrajcivmm", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageClassificationMappingCollection model = + new StorageClassificationMappingCollection() + .withValue( + Arrays + .asList( + new StorageClassificationMappingInner() + .withProperties( + new StorageClassificationMappingProperties() + .withTargetStorageClassificationId("mlnwiaaomylweazu")) + .withLocation("sethwwn"), + new StorageClassificationMappingInner() + .withProperties( + new StorageClassificationMappingProperties() + .withTargetStorageClassificationId("jhlimmbcxfhbcpo")) + .withLocation("vxcjzhqizxfpxtgq"))) + .withNextLink("tgguwpijrajcivmm"); + model = BinaryData.fromObject(model).toObject(StorageClassificationMappingCollection.class); + Assertions.assertEquals("mlnwiaaomylweazu", model.value().get(0).properties().targetStorageClassificationId()); + Assertions.assertEquals("sethwwn", model.value().get(0).location()); + Assertions.assertEquals("tgguwpijrajcivmm", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingInnerTests.java new file mode 100644 index 000000000000..5a0ea3996fd0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingInnerTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.StorageClassificationMappingInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationMappingProperties; +import org.junit.jupiter.api.Assertions; + +public final class StorageClassificationMappingInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageClassificationMappingInner model = + BinaryData + .fromString( + "{\"properties\":{\"targetStorageClassificationId\":\"cf\"},\"location\":\"rxgkne\",\"id\":\"vyi\",\"name\":\"zqodfvpgshox\",\"type\":\"sgbpfgzdjtx\"}") + .toObject(StorageClassificationMappingInner.class); + Assertions.assertEquals("cf", model.properties().targetStorageClassificationId()); + Assertions.assertEquals("rxgkne", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageClassificationMappingInner model = + new StorageClassificationMappingInner() + .withProperties(new StorageClassificationMappingProperties().withTargetStorageClassificationId("cf")) + .withLocation("rxgkne"); + model = BinaryData.fromObject(model).toObject(StorageClassificationMappingInner.class); + Assertions.assertEquals("cf", model.properties().targetStorageClassificationId()); + Assertions.assertEquals("rxgkne", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingInputTests.java new file mode 100644 index 000000000000..8501c95823a1 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageMappingInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class StorageClassificationMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageClassificationMappingInput model = + BinaryData + .fromString("{\"properties\":{\"targetStorageClassificationId\":\"a\"}}") + .toObject(StorageClassificationMappingInput.class); + Assertions.assertEquals("a", model.properties().targetStorageClassificationId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageClassificationMappingInput model = + new StorageClassificationMappingInput() + .withProperties(new StorageMappingInputProperties().withTargetStorageClassificationId("a")); + model = BinaryData.fromObject(model).toObject(StorageClassificationMappingInput.class); + Assertions.assertEquals("a", model.properties().targetStorageClassificationId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingPropertiesTests.java new file mode 100644 index 000000000000..8676ba74e538 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationMappingProperties; +import org.junit.jupiter.api.Assertions; + +public final class StorageClassificationMappingPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageClassificationMappingProperties model = + BinaryData + .fromString("{\"targetStorageClassificationId\":\"flbqvgaq\"}") + .toObject(StorageClassificationMappingProperties.class); + Assertions.assertEquals("flbqvgaq", model.targetStorageClassificationId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageClassificationMappingProperties model = + new StorageClassificationMappingProperties().withTargetStorageClassificationId("flbqvgaq"); + model = BinaryData.fromObject(model).toObject(StorageClassificationMappingProperties.class); + Assertions.assertEquals("flbqvgaq", model.targetStorageClassificationId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsCreateMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsCreateMockTests.java new file mode 100644 index 000000000000..e44eeaf0c748 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsCreateMockTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationMapping; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageMappingInputProperties; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageClassificationMappingsCreateMockTests { + @Test + public void testCreate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"targetStorageClassificationId\":\"shoxfzzjd\"},\"location\":\"pbusxy\",\"id\":\"gozwplxzgzumno\",\"name\":\"iixkkbygbgiqkw\",\"type\":\"shy\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + StorageClassificationMapping response = + manager + .storageClassificationMappings() + .define("k") + .withExistingReplicationStorageClassification("wn", "wckzeb", "bvwdxgyypmxq", "lmlnxrcatkuh") + .withProperties(new StorageMappingInputProperties().withTargetStorageClassificationId("kvvii")) + .create(); + + Assertions.assertEquals("shoxfzzjd", response.properties().targetStorageClassificationId()); + Assertions.assertEquals("pbusxy", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsGetWithResponseMockTests.java new file mode 100644 index 000000000000..febf4f07d7fa --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsGetWithResponseMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationMapping; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageClassificationMappingsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"targetStorageClassificationId\":\"sxaqqjhdfhfa\"},\"location\":\"qnjcsbozvcdqwssy\",\"id\":\"vwr\",\"name\":\"bivyw\",\"type\":\"tjnjuvtz\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + StorageClassificationMapping response = + manager + .storageClassificationMappings() + .getWithResponse("sobggva", "crqaxlmbrtvtgolm", "p", "gtla", "yxhxj", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("sxaqqjhdfhfa", response.properties().targetStorageClassificationId()); + Assertions.assertEquals("qnjcsbozvcdqwssy", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListMockTests.java new file mode 100644 index 000000000000..107712ddde09 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationMappingsListMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationMapping; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageClassificationMappingsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"targetStorageClassificationId\":\"fdz\"},\"location\":\"npbdrcibjxnnnoz\",\"id\":\"nhvdtuoam\",\"name\":\"obqehspshti\",\"type\":\"yzfeoctrz\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.storageClassificationMappings().list("j", "dlxbaeyocpkv", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("fdz", response.iterator().next().properties().targetStorageClassificationId()); + Assertions.assertEquals("npbdrcibjxnnnoz", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationPropertiesTests.java new file mode 100644 index 000000000000..936a25978fd8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassificationProperties; +import org.junit.jupiter.api.Assertions; + +public final class StorageClassificationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageClassificationProperties model = + BinaryData + .fromString("{\"friendlyName\":\"ktalhsnvkcdmxz\"}") + .toObject(StorageClassificationProperties.class); + Assertions.assertEquals("ktalhsnvkcdmxz", model.friendlyName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageClassificationProperties model = + new StorageClassificationProperties().withFriendlyName("ktalhsnvkcdmxz"); + model = BinaryData.fromObject(model).toObject(StorageClassificationProperties.class); + Assertions.assertEquals("ktalhsnvkcdmxz", model.friendlyName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsGetWithResponseMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsGetWithResponseMockTests.java new file mode 100644 index 000000000000..1b1099fe49df --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsGetWithResponseMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassification; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageClassificationsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"friendlyName\":\"ewltono\"},\"location\":\"femiwfhhawbabhz\",\"id\":\"fcdi\",\"name\":\"qnxyd\",\"type\":\"zfoi\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + StorageClassification response = + manager + .storageClassifications() + .getWithResponse("i", "wonkrnizdxywabki", "ni", "aptgvnaqyjukka", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ewltono", response.properties().friendlyName()); + Assertions.assertEquals("femiwfhhawbabhz", response.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListMockTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListMockTests.java new file mode 100644 index 000000000000..a98e4c6eeba6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageClassificationsListMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.recoveryservicessiterecovery.SiteRecoveryManager; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageClassification; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class StorageClassificationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"friendlyName\":\"qavouymkde\"},\"location\":\"xlvzpfdka\",\"id\":\"gbiwpgopqlktthb\",\"name\":\"rrmtrxgjmpdvrjz\",\"type\":\"awpewajccsdjuzm\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SiteRecoveryManager manager = + SiteRecoveryManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.storageClassifications().list("zsuspaywvslq", "ronzeafkxfmuwdb", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qavouymkde", response.iterator().next().properties().friendlyName()); + Assertions.assertEquals("xlvzpfdka", response.iterator().next().location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageMappingInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageMappingInputPropertiesTests.java new file mode 100644 index 000000000000..48392e9aea04 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/StorageMappingInputPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.StorageMappingInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class StorageMappingInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageMappingInputProperties model = + BinaryData + .fromString("{\"targetStorageClassificationId\":\"qusrdvetnws\"}") + .toObject(StorageMappingInputProperties.class); + Assertions.assertEquals("qusrdvetnws", model.targetStorageClassificationId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageMappingInputProperties model = + new StorageMappingInputProperties().withTargetStorageClassificationId("qusrdvetnws"); + model = BinaryData.fromObject(model).toObject(StorageMappingInputProperties.class); + Assertions.assertEquals("qusrdvetnws", model.targetStorageClassificationId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SubnetTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SubnetTests.java new file mode 100644 index 000000000000..a30bfe6a3e2e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SubnetTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.Subnet; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SubnetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Subnet model = + BinaryData + .fromString( + "{\"name\":\"fhyhltrpmopjmcma\",\"friendlyName\":\"okth\",\"addressList\":[\"uaodsfcpk\",\"xodpuozmyzydagfu\"]}") + .toObject(Subnet.class); + Assertions.assertEquals("fhyhltrpmopjmcma", model.name()); + Assertions.assertEquals("okth", model.friendlyName()); + Assertions.assertEquals("uaodsfcpk", model.addressList().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Subnet model = + new Subnet() + .withName("fhyhltrpmopjmcma") + .withFriendlyName("okth") + .withAddressList(Arrays.asList("uaodsfcpk", "xodpuozmyzydagfu")); + model = BinaryData.fromObject(model).toObject(Subnet.class); + Assertions.assertEquals("fhyhltrpmopjmcma", model.name()); + Assertions.assertEquals("okth", model.friendlyName()); + Assertions.assertEquals("uaodsfcpk", model.addressList().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOSDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOSDetailsTests.java new file mode 100644 index 000000000000..a9c91c2a9625 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOSDetailsTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSVersionWrapper; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SupportedOSDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SupportedOSDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SupportedOSDetails model = + BinaryData + .fromString( + "{\"osName\":\"izfavkjzwf\",\"osType\":\"yay\",\"osVersions\":[{\"version\":\"zs\",\"servicePack\":\"wxrzxmdewsrsxkrp\"},{\"version\":\"jazejwwviyoyp\",\"servicePack\":\"hbrnnhjx\"}]}") + .toObject(SupportedOSDetails.class); + Assertions.assertEquals("izfavkjzwf", model.osName()); + Assertions.assertEquals("yay", model.osType()); + Assertions.assertEquals("zs", model.osVersions().get(0).version()); + Assertions.assertEquals("wxrzxmdewsrsxkrp", model.osVersions().get(0).servicePack()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SupportedOSDetails model = + new SupportedOSDetails() + .withOsName("izfavkjzwf") + .withOsType("yay") + .withOsVersions( + Arrays + .asList( + new OSVersionWrapper().withVersion("zs").withServicePack("wxrzxmdewsrsxkrp"), + new OSVersionWrapper().withVersion("jazejwwviyoyp").withServicePack("hbrnnhjx"))); + model = BinaryData.fromObject(model).toObject(SupportedOSDetails.class); + Assertions.assertEquals("izfavkjzwf", model.osName()); + Assertions.assertEquals("yay", model.osType()); + Assertions.assertEquals("zs", model.osVersions().get(0).version()); + Assertions.assertEquals("wxrzxmdewsrsxkrp", model.osVersions().get(0).servicePack()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOSPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOSPropertiesTests.java new file mode 100644 index 000000000000..476fa974f468 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOSPropertiesTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSVersionWrapper; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SupportedOSDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SupportedOSProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SupportedOSProperty; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SupportedOSPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SupportedOSProperties model = + BinaryData + .fromString( + "{\"supportedOsList\":[{\"instanceType\":\"uuipldq\",\"supportedOs\":[{\"osName\":\"kva\",\"osType\":\"l\",\"osVersions\":[{}]},{\"osName\":\"vqyvwehtaemxhzz\",\"osType\":\"ev\",\"osVersions\":[{},{}]}]}]}") + .toObject(SupportedOSProperties.class); + Assertions.assertEquals("uuipldq", model.supportedOsList().get(0).instanceType()); + Assertions.assertEquals("kva", model.supportedOsList().get(0).supportedOs().get(0).osName()); + Assertions.assertEquals("l", model.supportedOsList().get(0).supportedOs().get(0).osType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SupportedOSProperties model = + new SupportedOSProperties() + .withSupportedOsList( + Arrays + .asList( + new SupportedOSProperty() + .withInstanceType("uuipldq") + .withSupportedOs( + Arrays + .asList( + new SupportedOSDetails() + .withOsName("kva") + .withOsType("l") + .withOsVersions(Arrays.asList(new OSVersionWrapper())), + new SupportedOSDetails() + .withOsName("vqyvwehtaemxhzz") + .withOsType("ev") + .withOsVersions( + Arrays.asList(new OSVersionWrapper(), new OSVersionWrapper())))))); + model = BinaryData.fromObject(model).toObject(SupportedOSProperties.class); + Assertions.assertEquals("uuipldq", model.supportedOsList().get(0).instanceType()); + Assertions.assertEquals("kva", model.supportedOsList().get(0).supportedOs().get(0).osName()); + Assertions.assertEquals("l", model.supportedOsList().get(0).supportedOs().get(0).osType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOSPropertyTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOSPropertyTests.java new file mode 100644 index 000000000000..65dc2540ece3 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOSPropertyTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSVersionWrapper; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SupportedOSDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SupportedOSProperty; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SupportedOSPropertyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SupportedOSProperty model = + BinaryData + .fromString( + "{\"instanceType\":\"vzrrryveimi\",\"supportedOs\":[{\"osName\":\"yzatvfuzkaft\",\"osType\":\"vru\",\"osVersions\":[{\"version\":\"syeipqd\",\"servicePack\":\"jtgrqgdgkkileplk\"},{\"version\":\"mknhwtbbaedor\",\"servicePack\":\"mqfl\"},{\"version\":\"gbdg\",\"servicePack\":\"mgxdgdhpabgd\"},{\"version\":\"jddvjsaqw\",\"servicePack\":\"mmwllc\"}]},{\"osName\":\"srsxaptefh\",\"osType\":\"cgjokjljnhvlq\",\"osVersions\":[{\"version\":\"peeksnbksdqhjv\",\"servicePack\":\"lxeslkhh\"}]},{\"osName\":\"tcpoqma\",\"osType\":\"wqjwgok\",\"osVersions\":[{\"version\":\"jj\",\"servicePack\":\"ybwfdbkjb\"},{\"version\":\"ensvkzykjtj\",\"servicePack\":\"sxfwushcdp\"},{\"version\":\"pn\",\"servicePack\":\"mgjfbpkuwxeoio\"}]}]}") + .toObject(SupportedOSProperty.class); + Assertions.assertEquals("vzrrryveimi", model.instanceType()); + Assertions.assertEquals("yzatvfuzkaft", model.supportedOs().get(0).osName()); + Assertions.assertEquals("vru", model.supportedOs().get(0).osType()); + Assertions.assertEquals("syeipqd", model.supportedOs().get(0).osVersions().get(0).version()); + Assertions.assertEquals("jtgrqgdgkkileplk", model.supportedOs().get(0).osVersions().get(0).servicePack()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SupportedOSProperty model = + new SupportedOSProperty() + .withInstanceType("vzrrryveimi") + .withSupportedOs( + Arrays + .asList( + new SupportedOSDetails() + .withOsName("yzatvfuzkaft") + .withOsType("vru") + .withOsVersions( + Arrays + .asList( + new OSVersionWrapper() + .withVersion("syeipqd") + .withServicePack("jtgrqgdgkkileplk"), + new OSVersionWrapper().withVersion("mknhwtbbaedor").withServicePack("mqfl"), + new OSVersionWrapper().withVersion("gbdg").withServicePack("mgxdgdhpabgd"), + new OSVersionWrapper().withVersion("jddvjsaqw").withServicePack("mmwllc"))), + new SupportedOSDetails() + .withOsName("srsxaptefh") + .withOsType("cgjokjljnhvlq") + .withOsVersions( + Arrays + .asList( + new OSVersionWrapper() + .withVersion("peeksnbksdqhjv") + .withServicePack("lxeslkhh"))), + new SupportedOSDetails() + .withOsName("tcpoqma") + .withOsType("wqjwgok") + .withOsVersions( + Arrays + .asList( + new OSVersionWrapper().withVersion("jj").withServicePack("ybwfdbkjb"), + new OSVersionWrapper() + .withVersion("ensvkzykjtj") + .withServicePack("sxfwushcdp"), + new OSVersionWrapper() + .withVersion("pn") + .withServicePack("mgjfbpkuwxeoio"))))); + model = BinaryData.fromObject(model).toObject(SupportedOSProperty.class); + Assertions.assertEquals("vzrrryveimi", model.instanceType()); + Assertions.assertEquals("yzatvfuzkaft", model.supportedOs().get(0).osName()); + Assertions.assertEquals("vru", model.supportedOs().get(0).osType()); + Assertions.assertEquals("syeipqd", model.supportedOs().get(0).osVersions().get(0).version()); + Assertions.assertEquals("jtgrqgdgkkileplk", model.supportedOs().get(0).osVersions().get(0).servicePack()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOperatingSystemsInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOperatingSystemsInnerTests.java new file mode 100644 index 000000000000..016fe4116ef9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SupportedOperatingSystemsInnerTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.SupportedOperatingSystemsInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSVersionWrapper; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SupportedOSDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SupportedOSProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SupportedOSProperty; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SupportedOperatingSystemsInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SupportedOperatingSystemsInner model = + BinaryData + .fromString( + "{\"properties\":{\"supportedOsList\":[{\"instanceType\":\"tdacarvvlfn\",\"supportedOs\":[{\"osName\":\"poi\",\"osType\":\"naz\",\"osVersions\":[{},{},{}]}]}]},\"location\":\"zrsq\",\"id\":\"lsxkd\",\"name\":\"wqapfgsdp\",\"type\":\"vessm\"}") + .toObject(SupportedOperatingSystemsInner.class); + Assertions.assertEquals("tdacarvvlfn", model.properties().supportedOsList().get(0).instanceType()); + Assertions.assertEquals("poi", model.properties().supportedOsList().get(0).supportedOs().get(0).osName()); + Assertions.assertEquals("naz", model.properties().supportedOsList().get(0).supportedOs().get(0).osType()); + Assertions.assertEquals("zrsq", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SupportedOperatingSystemsInner model = + new SupportedOperatingSystemsInner() + .withProperties( + new SupportedOSProperties() + .withSupportedOsList( + Arrays + .asList( + new SupportedOSProperty() + .withInstanceType("tdacarvvlfn") + .withSupportedOs( + Arrays + .asList( + new SupportedOSDetails() + .withOsName("poi") + .withOsType("naz") + .withOsVersions( + Arrays + .asList( + new OSVersionWrapper(), + new OSVersionWrapper(), + new OSVersionWrapper()))))))) + .withLocation("zrsq"); + model = BinaryData.fromObject(model).toObject(SupportedOperatingSystemsInner.class); + Assertions.assertEquals("tdacarvvlfn", model.properties().supportedOsList().get(0).instanceType()); + Assertions.assertEquals("poi", model.properties().supportedOsList().get(0).supportedOs().get(0).osName()); + Assertions.assertEquals("naz", model.properties().supportedOsList().get(0).supportedOs().get(0).osType()); + Assertions.assertEquals("zrsq", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionInputPropertiesTests.java new file mode 100644 index 000000000000..28b860e186ba --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionInputPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProtectionInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class SwitchProtectionInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchProtectionInputProperties model = + BinaryData + .fromString( + "{\"replicationProtectedItemName\":\"onbzoggculapzwy\",\"providerSpecificDetails\":{\"instanceType\":\"SwitchProtectionProviderSpecificInput\"}}") + .toObject(SwitchProtectionInputProperties.class); + Assertions.assertEquals("onbzoggculapzwy", model.replicationProtectedItemName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchProtectionInputProperties model = + new SwitchProtectionInputProperties() + .withReplicationProtectedItemName("onbzoggculapzwy") + .withProviderSpecificDetails(new SwitchProtectionProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(SwitchProtectionInputProperties.class); + Assertions.assertEquals("onbzoggculapzwy", model.replicationProtectedItemName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionInputTests.java new file mode 100644 index 000000000000..2eec399ad76e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionInputTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProtectionInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProtectionInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class SwitchProtectionInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchProtectionInput model = + BinaryData + .fromString( + "{\"properties\":{\"replicationProtectedItemName\":\"eivsiykzkdnc\",\"providerSpecificDetails\":{\"instanceType\":\"SwitchProtectionProviderSpecificInput\"}}}") + .toObject(SwitchProtectionInput.class); + Assertions.assertEquals("eivsiykzkdnc", model.properties().replicationProtectedItemName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchProtectionInput model = + new SwitchProtectionInput() + .withProperties( + new SwitchProtectionInputProperties() + .withReplicationProtectedItemName("eivsiykzkdnc") + .withProviderSpecificDetails(new SwitchProtectionProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(SwitchProtectionInput.class); + Assertions.assertEquals("eivsiykzkdnc", model.properties().replicationProtectedItemName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionJobDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionJobDetailsTests.java new file mode 100644 index 000000000000..40d61ee4123f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionJobDetailsTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProtectionJobDetails; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SwitchProtectionJobDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchProtectionJobDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"SwitchProtectionJobDetails\",\"newReplicationProtectedItemId\":\"rexw\",\"affectedObjectDetails\":{\"ubheeggzgrnqtl\":\"bexfted\",\"gjq\":\"ozuumr\"}}") + .toObject(SwitchProtectionJobDetails.class); + Assertions.assertEquals("bexfted", model.affectedObjectDetails().get("ubheeggzgrnqtl")); + Assertions.assertEquals("rexw", model.newReplicationProtectedItemId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchProtectionJobDetails model = + new SwitchProtectionJobDetails() + .withAffectedObjectDetails(mapOf("ubheeggzgrnqtl", "bexfted", "gjq", "ozuumr")) + .withNewReplicationProtectedItemId("rexw"); + model = BinaryData.fromObject(model).toObject(SwitchProtectionJobDetails.class); + Assertions.assertEquals("bexfted", model.affectedObjectDetails().get("ubheeggzgrnqtl")); + Assertions.assertEquals("rexw", model.newReplicationProtectedItemId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionProviderSpecificInputTests.java new file mode 100644 index 000000000000..4bf535635f72 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProtectionProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProtectionProviderSpecificInput; + +public final class SwitchProtectionProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchProtectionProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"SwitchProtectionProviderSpecificInput\"}") + .toObject(SwitchProtectionProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchProtectionProviderSpecificInput model = new SwitchProtectionProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(SwitchProtectionProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProviderInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProviderInputPropertiesTests.java new file mode 100644 index 000000000000..93448b6ab163 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProviderInputPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProviderInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class SwitchProviderInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchProviderInputProperties model = + BinaryData + .fromString( + "{\"targetInstanceType\":\"trgjupauutpwoqh\",\"providerSpecificDetails\":{\"instanceType\":\"SwitchProviderSpecificInput\"}}") + .toObject(SwitchProviderInputProperties.class); + Assertions.assertEquals("trgjupauutpwoqh", model.targetInstanceType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchProviderInputProperties model = + new SwitchProviderInputProperties() + .withTargetInstanceType("trgjupauutpwoqh") + .withProviderSpecificDetails(new SwitchProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(SwitchProviderInputProperties.class); + Assertions.assertEquals("trgjupauutpwoqh", model.targetInstanceType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProviderInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProviderInputTests.java new file mode 100644 index 000000000000..df1581ae8725 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProviderInputTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProviderInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProviderInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class SwitchProviderInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchProviderInput model = + BinaryData + .fromString( + "{\"properties\":{\"targetInstanceType\":\"mrhublwpc\",\"providerSpecificDetails\":{\"instanceType\":\"SwitchProviderSpecificInput\"}}}") + .toObject(SwitchProviderInput.class); + Assertions.assertEquals("mrhublwpc", model.properties().targetInstanceType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchProviderInput model = + new SwitchProviderInput() + .withProperties( + new SwitchProviderInputProperties() + .withTargetInstanceType("mrhublwpc") + .withProviderSpecificDetails(new SwitchProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(SwitchProviderInput.class); + Assertions.assertEquals("mrhublwpc", model.properties().targetInstanceType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProviderSpecificInputTests.java new file mode 100644 index 000000000000..38ffec250d75 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/SwitchProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SwitchProviderSpecificInput; + +public final class SwitchProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"SwitchProviderSpecificInput\"}") + .toObject(SwitchProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchProviderSpecificInput model = new SwitchProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(SwitchProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizeCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizeCollectionTests.java new file mode 100644 index 000000000000..eaf2a5af7525 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizeCollectionTests.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.TargetComputeSizeInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ComputeSizeErrorDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TargetComputeSizeCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TargetComputeSizeProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class TargetComputeSizeCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TargetComputeSizeCollection model = + BinaryData + .fromString( + "{\"value\":[{\"id\":\"g\",\"name\":\"pnfqntcyp\",\"type\":\"jv\",\"properties\":{\"name\":\"mwks\",\"friendlyName\":\"rcizjxvyd\",\"cpuCoresCount\":1161175344,\"vCPUsAvailable\":1238865212,\"memoryInGB\":62.392147891228966,\"maxDataDiskCount\":733359450,\"maxNicsCount\":788840144,\"errors\":[{\"message\":\"umrtwnawjsl\",\"severity\":\"wkojgcyztsfmzn\"},{\"message\":\"eqphchqnrnr\",\"severity\":\"ehuwrykqgaifmvik\"},{\"message\":\"ydv\",\"severity\":\"bejdznxcv\"},{\"message\":\"rhnj\",\"severity\":\"olvtnovqfzge\"}],\"highIopsSupported\":\"dftuljltduce\",\"hyperVGenerations\":[\"mczuo\",\"ejwcwwqiok\",\"ssxmojms\",\"p\"]}},{\"id\":\"prvkwcfzqljyxgtc\",\"name\":\"eydbsd\",\"type\":\"m\",\"properties\":{\"name\":\"aehvbbxuri\",\"friendlyName\":\"tfnhtbaxkgxywr\",\"cpuCoresCount\":1619197472,\"vCPUsAvailable\":479149992,\"memoryInGB\":98.67117973109978,\"maxDataDiskCount\":309006078,\"maxNicsCount\":1167250360,\"errors\":[{\"message\":\"ruud\",\"severity\":\"zibt\"},{\"message\":\"stgktst\",\"severity\":\"xeclzedqbcvhzlhp\"}],\"highIopsSupported\":\"dqkdlwwqfbu\",\"hyperVGenerations\":[\"xtrqjfs\",\"lmbtxhwgfwsrt\"]}}],\"nextLink\":\"coezbrhubskh\"}") + .toObject(TargetComputeSizeCollection.class); + Assertions.assertEquals("g", model.value().get(0).id()); + Assertions.assertEquals("pnfqntcyp", model.value().get(0).name()); + Assertions.assertEquals("jv", model.value().get(0).type()); + Assertions.assertEquals("mwks", model.value().get(0).properties().name()); + Assertions.assertEquals("rcizjxvyd", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals(1161175344, model.value().get(0).properties().cpuCoresCount()); + Assertions.assertEquals(62.392147891228966D, model.value().get(0).properties().memoryInGB()); + Assertions.assertEquals(733359450, model.value().get(0).properties().maxDataDiskCount()); + Assertions.assertEquals(788840144, model.value().get(0).properties().maxNicsCount()); + Assertions.assertEquals("umrtwnawjsl", model.value().get(0).properties().errors().get(0).message()); + Assertions.assertEquals("wkojgcyztsfmzn", model.value().get(0).properties().errors().get(0).severity()); + Assertions.assertEquals("dftuljltduce", model.value().get(0).properties().highIopsSupported()); + Assertions.assertEquals("mczuo", model.value().get(0).properties().hyperVGenerations().get(0)); + Assertions.assertEquals("coezbrhubskh", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TargetComputeSizeCollection model = + new TargetComputeSizeCollection() + .withValue( + Arrays + .asList( + new TargetComputeSizeInner() + .withId("g") + .withName("pnfqntcyp") + .withType("jv") + .withProperties( + new TargetComputeSizeProperties() + .withName("mwks") + .withFriendlyName("rcizjxvyd") + .withCpuCoresCount(1161175344) + .withMemoryInGB(62.392147891228966D) + .withMaxDataDiskCount(733359450) + .withMaxNicsCount(788840144) + .withErrors( + Arrays + .asList( + new ComputeSizeErrorDetails() + .withMessage("umrtwnawjsl") + .withSeverity("wkojgcyztsfmzn"), + new ComputeSizeErrorDetails() + .withMessage("eqphchqnrnr") + .withSeverity("ehuwrykqgaifmvik"), + new ComputeSizeErrorDetails() + .withMessage("ydv") + .withSeverity("bejdznxcv"), + new ComputeSizeErrorDetails() + .withMessage("rhnj") + .withSeverity("olvtnovqfzge"))) + .withHighIopsSupported("dftuljltduce") + .withHyperVGenerations(Arrays.asList("mczuo", "ejwcwwqiok", "ssxmojms", "p"))), + new TargetComputeSizeInner() + .withId("prvkwcfzqljyxgtc") + .withName("eydbsd") + .withType("m") + .withProperties( + new TargetComputeSizeProperties() + .withName("aehvbbxuri") + .withFriendlyName("tfnhtbaxkgxywr") + .withCpuCoresCount(1619197472) + .withMemoryInGB(98.67117973109978D) + .withMaxDataDiskCount(309006078) + .withMaxNicsCount(1167250360) + .withErrors( + Arrays + .asList( + new ComputeSizeErrorDetails() + .withMessage("ruud") + .withSeverity("zibt"), + new ComputeSizeErrorDetails() + .withMessage("stgktst") + .withSeverity("xeclzedqbcvhzlhp"))) + .withHighIopsSupported("dqkdlwwqfbu") + .withHyperVGenerations(Arrays.asList("xtrqjfs", "lmbtxhwgfwsrt"))))) + .withNextLink("coezbrhubskh"); + model = BinaryData.fromObject(model).toObject(TargetComputeSizeCollection.class); + Assertions.assertEquals("g", model.value().get(0).id()); + Assertions.assertEquals("pnfqntcyp", model.value().get(0).name()); + Assertions.assertEquals("jv", model.value().get(0).type()); + Assertions.assertEquals("mwks", model.value().get(0).properties().name()); + Assertions.assertEquals("rcizjxvyd", model.value().get(0).properties().friendlyName()); + Assertions.assertEquals(1161175344, model.value().get(0).properties().cpuCoresCount()); + Assertions.assertEquals(62.392147891228966D, model.value().get(0).properties().memoryInGB()); + Assertions.assertEquals(733359450, model.value().get(0).properties().maxDataDiskCount()); + Assertions.assertEquals(788840144, model.value().get(0).properties().maxNicsCount()); + Assertions.assertEquals("umrtwnawjsl", model.value().get(0).properties().errors().get(0).message()); + Assertions.assertEquals("wkojgcyztsfmzn", model.value().get(0).properties().errors().get(0).severity()); + Assertions.assertEquals("dftuljltduce", model.value().get(0).properties().highIopsSupported()); + Assertions.assertEquals("mczuo", model.value().get(0).properties().hyperVGenerations().get(0)); + Assertions.assertEquals("coezbrhubskh", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizeInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizeInnerTests.java new file mode 100644 index 000000000000..77ad3f11bb3f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizeInnerTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.TargetComputeSizeInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ComputeSizeErrorDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TargetComputeSizeProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class TargetComputeSizeInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TargetComputeSizeInner model = + BinaryData + .fromString( + "{\"id\":\"ygo\",\"name\":\"kkqfqjbvle\",\"type\":\"fmluiqtqzfavyvn\",\"properties\":{\"name\":\"bar\",\"friendlyName\":\"uayjkqa\",\"cpuCoresCount\":2002865497,\"vCPUsAvailable\":1085196762,\"memoryInGB\":51.89952430089579,\"maxDataDiskCount\":1318524891,\"maxNicsCount\":813046030,\"errors\":[{\"message\":\"ntiew\",\"severity\":\"cv\"},{\"message\":\"uwrbehwagoh\",\"severity\":\"f\"},{\"message\":\"mrqemvvhmx\",\"severity\":\"rjfut\"}],\"highIopsSupported\":\"oe\",\"hyperVGenerations\":[\"ewzcjznmwcp\",\"guaadraufactkahz\"]}}") + .toObject(TargetComputeSizeInner.class); + Assertions.assertEquals("ygo", model.id()); + Assertions.assertEquals("kkqfqjbvle", model.name()); + Assertions.assertEquals("fmluiqtqzfavyvn", model.type()); + Assertions.assertEquals("bar", model.properties().name()); + Assertions.assertEquals("uayjkqa", model.properties().friendlyName()); + Assertions.assertEquals(2002865497, model.properties().cpuCoresCount()); + Assertions.assertEquals(51.89952430089579D, model.properties().memoryInGB()); + Assertions.assertEquals(1318524891, model.properties().maxDataDiskCount()); + Assertions.assertEquals(813046030, model.properties().maxNicsCount()); + Assertions.assertEquals("ntiew", model.properties().errors().get(0).message()); + Assertions.assertEquals("cv", model.properties().errors().get(0).severity()); + Assertions.assertEquals("oe", model.properties().highIopsSupported()); + Assertions.assertEquals("ewzcjznmwcp", model.properties().hyperVGenerations().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TargetComputeSizeInner model = + new TargetComputeSizeInner() + .withId("ygo") + .withName("kkqfqjbvle") + .withType("fmluiqtqzfavyvn") + .withProperties( + new TargetComputeSizeProperties() + .withName("bar") + .withFriendlyName("uayjkqa") + .withCpuCoresCount(2002865497) + .withMemoryInGB(51.89952430089579D) + .withMaxDataDiskCount(1318524891) + .withMaxNicsCount(813046030) + .withErrors( + Arrays + .asList( + new ComputeSizeErrorDetails().withMessage("ntiew").withSeverity("cv"), + new ComputeSizeErrorDetails().withMessage("uwrbehwagoh").withSeverity("f"), + new ComputeSizeErrorDetails().withMessage("mrqemvvhmx").withSeverity("rjfut"))) + .withHighIopsSupported("oe") + .withHyperVGenerations(Arrays.asList("ewzcjznmwcp", "guaadraufactkahz"))); + model = BinaryData.fromObject(model).toObject(TargetComputeSizeInner.class); + Assertions.assertEquals("ygo", model.id()); + Assertions.assertEquals("kkqfqjbvle", model.name()); + Assertions.assertEquals("fmluiqtqzfavyvn", model.type()); + Assertions.assertEquals("bar", model.properties().name()); + Assertions.assertEquals("uayjkqa", model.properties().friendlyName()); + Assertions.assertEquals(2002865497, model.properties().cpuCoresCount()); + Assertions.assertEquals(51.89952430089579D, model.properties().memoryInGB()); + Assertions.assertEquals(1318524891, model.properties().maxDataDiskCount()); + Assertions.assertEquals(813046030, model.properties().maxNicsCount()); + Assertions.assertEquals("ntiew", model.properties().errors().get(0).message()); + Assertions.assertEquals("cv", model.properties().errors().get(0).severity()); + Assertions.assertEquals("oe", model.properties().highIopsSupported()); + Assertions.assertEquals("ewzcjznmwcp", model.properties().hyperVGenerations().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizePropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizePropertiesTests.java new file mode 100644 index 000000000000..2c292ca0e44e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TargetComputeSizePropertiesTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ComputeSizeErrorDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TargetComputeSizeProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class TargetComputeSizePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TargetComputeSizeProperties model = + BinaryData + .fromString( + "{\"name\":\"ajjziuxxpshne\",\"friendlyName\":\"ulfgslqu\",\"cpuCoresCount\":471639164,\"vCPUsAvailable\":1232938726,\"memoryInGB\":97.2663718138851,\"maxDataDiskCount\":1732882534,\"maxNicsCount\":203229589,\"errors\":[{\"message\":\"a\",\"severity\":\"juohminyflnorw\"},{\"message\":\"uvwpklvxwmyg\",\"severity\":\"pgpqchiszepnnb\"},{\"message\":\"rxgibbd\",\"severity\":\"confozauors\"},{\"message\":\"okwbqplh\",\"severity\":\"nuuepzlrp\"}],\"highIopsSupported\":\"zsoldwey\",\"hyperVGenerations\":[\"unvmnnr\",\"rbior\",\"talywjhhgdnhxms\",\"v\"]}") + .toObject(TargetComputeSizeProperties.class); + Assertions.assertEquals("ajjziuxxpshne", model.name()); + Assertions.assertEquals("ulfgslqu", model.friendlyName()); + Assertions.assertEquals(471639164, model.cpuCoresCount()); + Assertions.assertEquals(97.2663718138851D, model.memoryInGB()); + Assertions.assertEquals(1732882534, model.maxDataDiskCount()); + Assertions.assertEquals(203229589, model.maxNicsCount()); + Assertions.assertEquals("a", model.errors().get(0).message()); + Assertions.assertEquals("juohminyflnorw", model.errors().get(0).severity()); + Assertions.assertEquals("zsoldwey", model.highIopsSupported()); + Assertions.assertEquals("unvmnnr", model.hyperVGenerations().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TargetComputeSizeProperties model = + new TargetComputeSizeProperties() + .withName("ajjziuxxpshne") + .withFriendlyName("ulfgslqu") + .withCpuCoresCount(471639164) + .withMemoryInGB(97.2663718138851D) + .withMaxDataDiskCount(1732882534) + .withMaxNicsCount(203229589) + .withErrors( + Arrays + .asList( + new ComputeSizeErrorDetails().withMessage("a").withSeverity("juohminyflnorw"), + new ComputeSizeErrorDetails().withMessage("uvwpklvxwmyg").withSeverity("pgpqchiszepnnb"), + new ComputeSizeErrorDetails().withMessage("rxgibbd").withSeverity("confozauors"), + new ComputeSizeErrorDetails().withMessage("okwbqplh").withSeverity("nuuepzlrp"))) + .withHighIopsSupported("zsoldwey") + .withHyperVGenerations(Arrays.asList("unvmnnr", "rbior", "talywjhhgdnhxms", "v")); + model = BinaryData.fromObject(model).toObject(TargetComputeSizeProperties.class); + Assertions.assertEquals("ajjziuxxpshne", model.name()); + Assertions.assertEquals("ulfgslqu", model.friendlyName()); + Assertions.assertEquals(471639164, model.cpuCoresCount()); + Assertions.assertEquals(97.2663718138851D, model.memoryInGB()); + Assertions.assertEquals(1732882534, model.maxDataDiskCount()); + Assertions.assertEquals(203229589, model.maxNicsCount()); + Assertions.assertEquals("a", model.errors().get(0).message()); + Assertions.assertEquals("juohminyflnorw", model.errors().get(0).severity()); + Assertions.assertEquals("zsoldwey", model.highIopsSupported()); + Assertions.assertEquals("unvmnnr", model.hyperVGenerations().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TaskTypeDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TaskTypeDetailsTests.java new file mode 100644 index 000000000000..9ebe96d9c6e8 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TaskTypeDetailsTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TaskTypeDetails; + +public final class TaskTypeDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TaskTypeDetails model = + BinaryData.fromString("{\"instanceType\":\"TaskTypeDetails\"}").toObject(TaskTypeDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TaskTypeDetails model = new TaskTypeDetails(); + model = BinaryData.fromObject(model).toObject(TaskTypeDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverCleanupInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverCleanupInputPropertiesTests.java new file mode 100644 index 000000000000..0cb8c11c7c3e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverCleanupInputPropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverCleanupInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class TestFailoverCleanupInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestFailoverCleanupInputProperties model = + BinaryData.fromString("{\"comments\":\"wfscjfn\"}").toObject(TestFailoverCleanupInputProperties.class); + Assertions.assertEquals("wfscjfn", model.comments()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestFailoverCleanupInputProperties model = new TestFailoverCleanupInputProperties().withComments("wfscjfn"); + model = BinaryData.fromObject(model).toObject(TestFailoverCleanupInputProperties.class); + Assertions.assertEquals("wfscjfn", model.comments()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverCleanupInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverCleanupInputTests.java new file mode 100644 index 000000000000..57dbe73fad82 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverCleanupInputTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverCleanupInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverCleanupInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class TestFailoverCleanupInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestFailoverCleanupInput model = + BinaryData.fromString("{\"properties\":{\"comments\":\"icc\"}}").toObject(TestFailoverCleanupInput.class); + Assertions.assertEquals("icc", model.properties().comments()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestFailoverCleanupInput model = + new TestFailoverCleanupInput().withProperties(new TestFailoverCleanupInputProperties().withComments("icc")); + model = BinaryData.fromObject(model).toObject(TestFailoverCleanupInput.class); + Assertions.assertEquals("icc", model.properties().comments()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverInputPropertiesTests.java new file mode 100644 index 000000000000..be1f55760e8f --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverInputPropertiesTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class TestFailoverInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestFailoverInputProperties model = + BinaryData + .fromString( + "{\"failoverDirection\":\"qvci\",\"networkType\":\"ev\",\"networkId\":\"mblrrilbywd\",\"providerSpecificDetails\":{\"instanceType\":\"TestFailoverProviderSpecificInput\"}}") + .toObject(TestFailoverInputProperties.class); + Assertions.assertEquals("qvci", model.failoverDirection()); + Assertions.assertEquals("ev", model.networkType()); + Assertions.assertEquals("mblrrilbywd", model.networkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestFailoverInputProperties model = + new TestFailoverInputProperties() + .withFailoverDirection("qvci") + .withNetworkType("ev") + .withNetworkId("mblrrilbywd") + .withProviderSpecificDetails(new TestFailoverProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(TestFailoverInputProperties.class); + Assertions.assertEquals("qvci", model.failoverDirection()); + Assertions.assertEquals("ev", model.networkType()); + Assertions.assertEquals("mblrrilbywd", model.networkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverInputTests.java new file mode 100644 index 000000000000..d3fb37fb1a0d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverInputTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class TestFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestFailoverInput model = + BinaryData + .fromString( + "{\"properties\":{\"failoverDirection\":\"chvcyyysfgdo\",\"networkType\":\"ubiipuipwoqonma\",\"networkId\":\"ekni\",\"providerSpecificDetails\":{\"instanceType\":\"TestFailoverProviderSpecificInput\"}}}") + .toObject(TestFailoverInput.class); + Assertions.assertEquals("chvcyyysfgdo", model.properties().failoverDirection()); + Assertions.assertEquals("ubiipuipwoqonma", model.properties().networkType()); + Assertions.assertEquals("ekni", model.properties().networkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestFailoverInput model = + new TestFailoverInput() + .withProperties( + new TestFailoverInputProperties() + .withFailoverDirection("chvcyyysfgdo") + .withNetworkType("ubiipuipwoqonma") + .withNetworkId("ekni") + .withProviderSpecificDetails(new TestFailoverProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(TestFailoverInput.class); + Assertions.assertEquals("chvcyyysfgdo", model.properties().failoverDirection()); + Assertions.assertEquals("ubiipuipwoqonma", model.properties().networkType()); + Assertions.assertEquals("ekni", model.properties().networkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverJobDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverJobDetailsTests.java new file mode 100644 index 000000000000..d066960d3949 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverJobDetailsTests.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FailoverReplicationProtectedItemDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverJobDetails; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TestFailoverJobDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestFailoverJobDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"TestFailoverJobDetails\",\"testFailoverStatus\":\"cant\",\"comments\":\"yxzxjmkanbclazof\",\"networkName\":\"xvtemaspm\",\"networkFriendlyName\":\"ydscdkxwd\",\"networkType\":\"jcbhaahnt\",\"protectedItemDetails\":[{\"name\":\"fh\",\"friendlyName\":\"ixo\",\"testVmName\":\"kzdfiv\",\"testVmFriendlyName\":\"jybsrwz\",\"networkConnectionStatus\":\"rgt\",\"networkFriendlyName\":\"hmfppinmgi\",\"subnet\":\"smkw\",\"recoveryPointId\":\"gfragjhxerxlobkd\",\"recoveryPointTime\":\"2021-10-17T16:42:23Z\"},{\"name\":\"vmmnii\",\"friendlyName\":\"ho\",\"testVmName\":\"jn\",\"testVmFriendlyName\":\"bggicnqwlctmw\",\"networkConnectionStatus\":\"lxkrk\",\"networkFriendlyName\":\"vxrktjcjigcwtsp\",\"subnet\":\"bqxasevchefpgee\",\"recoveryPointId\":\"ybruhola\",\"recoveryPointTime\":\"2021-05-29T12:11:44Z\"}],\"affectedObjectDetails\":{\"aowcahdkm\":\"immrimaabsqqlonb\",\"zglkvbgu\":\"jsmihrijezbfsjwf\",\"gnbknhj\":\"bsvbwyot\",\"ffaspsdzkucsz\":\"clxaxw\"}}") + .toObject(TestFailoverJobDetails.class); + Assertions.assertEquals("immrimaabsqqlonb", model.affectedObjectDetails().get("aowcahdkm")); + Assertions.assertEquals("cant", model.testFailoverStatus()); + Assertions.assertEquals("yxzxjmkanbclazof", model.comments()); + Assertions.assertEquals("xvtemaspm", model.networkName()); + Assertions.assertEquals("ydscdkxwd", model.networkFriendlyName()); + Assertions.assertEquals("jcbhaahnt", model.networkType()); + Assertions.assertEquals("fh", model.protectedItemDetails().get(0).name()); + Assertions.assertEquals("ixo", model.protectedItemDetails().get(0).friendlyName()); + Assertions.assertEquals("kzdfiv", model.protectedItemDetails().get(0).testVmName()); + Assertions.assertEquals("jybsrwz", model.protectedItemDetails().get(0).testVmFriendlyName()); + Assertions.assertEquals("rgt", model.protectedItemDetails().get(0).networkConnectionStatus()); + Assertions.assertEquals("hmfppinmgi", model.protectedItemDetails().get(0).networkFriendlyName()); + Assertions.assertEquals("smkw", model.protectedItemDetails().get(0).subnet()); + Assertions.assertEquals("gfragjhxerxlobkd", model.protectedItemDetails().get(0).recoveryPointId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-10-17T16:42:23Z"), model.protectedItemDetails().get(0).recoveryPointTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestFailoverJobDetails model = + new TestFailoverJobDetails() + .withAffectedObjectDetails( + mapOf( + "aowcahdkm", + "immrimaabsqqlonb", + "zglkvbgu", + "jsmihrijezbfsjwf", + "gnbknhj", + "bsvbwyot", + "ffaspsdzkucsz", + "clxaxw")) + .withTestFailoverStatus("cant") + .withComments("yxzxjmkanbclazof") + .withNetworkName("xvtemaspm") + .withNetworkFriendlyName("ydscdkxwd") + .withNetworkType("jcbhaahnt") + .withProtectedItemDetails( + Arrays + .asList( + new FailoverReplicationProtectedItemDetails() + .withName("fh") + .withFriendlyName("ixo") + .withTestVmName("kzdfiv") + .withTestVmFriendlyName("jybsrwz") + .withNetworkConnectionStatus("rgt") + .withNetworkFriendlyName("hmfppinmgi") + .withSubnet("smkw") + .withRecoveryPointId("gfragjhxerxlobkd") + .withRecoveryPointTime(OffsetDateTime.parse("2021-10-17T16:42:23Z")), + new FailoverReplicationProtectedItemDetails() + .withName("vmmnii") + .withFriendlyName("ho") + .withTestVmName("jn") + .withTestVmFriendlyName("bggicnqwlctmw") + .withNetworkConnectionStatus("lxkrk") + .withNetworkFriendlyName("vxrktjcjigcwtsp") + .withSubnet("bqxasevchefpgee") + .withRecoveryPointId("ybruhola") + .withRecoveryPointTime(OffsetDateTime.parse("2021-05-29T12:11:44Z")))); + model = BinaryData.fromObject(model).toObject(TestFailoverJobDetails.class); + Assertions.assertEquals("immrimaabsqqlonb", model.affectedObjectDetails().get("aowcahdkm")); + Assertions.assertEquals("cant", model.testFailoverStatus()); + Assertions.assertEquals("yxzxjmkanbclazof", model.comments()); + Assertions.assertEquals("xvtemaspm", model.networkName()); + Assertions.assertEquals("ydscdkxwd", model.networkFriendlyName()); + Assertions.assertEquals("jcbhaahnt", model.networkType()); + Assertions.assertEquals("fh", model.protectedItemDetails().get(0).name()); + Assertions.assertEquals("ixo", model.protectedItemDetails().get(0).friendlyName()); + Assertions.assertEquals("kzdfiv", model.protectedItemDetails().get(0).testVmName()); + Assertions.assertEquals("jybsrwz", model.protectedItemDetails().get(0).testVmFriendlyName()); + Assertions.assertEquals("rgt", model.protectedItemDetails().get(0).networkConnectionStatus()); + Assertions.assertEquals("hmfppinmgi", model.protectedItemDetails().get(0).networkFriendlyName()); + Assertions.assertEquals("smkw", model.protectedItemDetails().get(0).subnet()); + Assertions.assertEquals("gfragjhxerxlobkd", model.protectedItemDetails().get(0).recoveryPointId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-10-17T16:42:23Z"), model.protectedItemDetails().get(0).recoveryPointTime()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverProviderSpecificInputTests.java new file mode 100644 index 000000000000..8fc24035aa84 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestFailoverProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestFailoverProviderSpecificInput; + +public final class TestFailoverProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestFailoverProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"TestFailoverProviderSpecificInput\"}") + .toObject(TestFailoverProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestFailoverProviderSpecificInput model = new TestFailoverProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(TestFailoverProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateCleanupInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateCleanupInputPropertiesTests.java new file mode 100644 index 000000000000..295eb06c372d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateCleanupInputPropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrateCleanupInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class TestMigrateCleanupInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestMigrateCleanupInputProperties model = + BinaryData.fromString("{\"comments\":\"lnjixisxya\"}").toObject(TestMigrateCleanupInputProperties.class); + Assertions.assertEquals("lnjixisxya", model.comments()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestMigrateCleanupInputProperties model = new TestMigrateCleanupInputProperties().withComments("lnjixisxya"); + model = BinaryData.fromObject(model).toObject(TestMigrateCleanupInputProperties.class); + Assertions.assertEquals("lnjixisxya", model.comments()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateCleanupInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateCleanupInputTests.java new file mode 100644 index 000000000000..f422987ee145 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateCleanupInputTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrateCleanupInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrateCleanupInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class TestMigrateCleanupInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestMigrateCleanupInput model = + BinaryData + .fromString("{\"properties\":{\"comments\":\"xwyjsflhhc\"}}") + .toObject(TestMigrateCleanupInput.class); + Assertions.assertEquals("xwyjsflhhc", model.properties().comments()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestMigrateCleanupInput model = + new TestMigrateCleanupInput() + .withProperties(new TestMigrateCleanupInputProperties().withComments("xwyjsflhhc")); + model = BinaryData.fromObject(model).toObject(TestMigrateCleanupInput.class); + Assertions.assertEquals("xwyjsflhhc", model.properties().comments()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateInputPropertiesTests.java new file mode 100644 index 000000000000..df6366b41190 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateInputPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrateInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput; + +public final class TestMigrateInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestMigrateInputProperties model = + BinaryData + .fromString("{\"providerSpecificDetails\":{\"instanceType\":\"TestMigrateProviderSpecificInput\"}}") + .toObject(TestMigrateInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestMigrateInputProperties model = + new TestMigrateInputProperties().withProviderSpecificDetails(new TestMigrateProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(TestMigrateInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateInputTests.java new file mode 100644 index 000000000000..acf2f2f5bb13 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrateInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrateInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput; + +public final class TestMigrateInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestMigrateInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"TestMigrateProviderSpecificInput\"}}}") + .toObject(TestMigrateInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestMigrateInput model = + new TestMigrateInput() + .withProperties( + new TestMigrateInputProperties() + .withProviderSpecificDetails(new TestMigrateProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(TestMigrateInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateProviderSpecificInputTests.java new file mode 100644 index 000000000000..e495827fc53e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/TestMigrateProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.TestMigrateProviderSpecificInput; + +public final class TestMigrateProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TestMigrateProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"TestMigrateProviderSpecificInput\"}") + .toObject(TestMigrateProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TestMigrateProviderSpecificInput model = new TestMigrateProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(TestMigrateProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UnplannedFailoverInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UnplannedFailoverInputPropertiesTests.java new file mode 100644 index 000000000000..d1cf371eb011 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UnplannedFailoverInputPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UnplannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class UnplannedFailoverInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UnplannedFailoverInputProperties model = + BinaryData + .fromString( + "{\"failoverDirection\":\"oxoismsksbpim\",\"sourceSiteOperations\":\"oljxkcgx\",\"providerSpecificDetails\":{\"instanceType\":\"UnplannedFailoverProviderSpecificInput\"}}") + .toObject(UnplannedFailoverInputProperties.class); + Assertions.assertEquals("oxoismsksbpim", model.failoverDirection()); + Assertions.assertEquals("oljxkcgx", model.sourceSiteOperations()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UnplannedFailoverInputProperties model = + new UnplannedFailoverInputProperties() + .withFailoverDirection("oxoismsksbpim") + .withSourceSiteOperations("oljxkcgx") + .withProviderSpecificDetails(new UnplannedFailoverProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(UnplannedFailoverInputProperties.class); + Assertions.assertEquals("oxoismsksbpim", model.failoverDirection()); + Assertions.assertEquals("oljxkcgx", model.sourceSiteOperations()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UnplannedFailoverInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UnplannedFailoverInputTests.java new file mode 100644 index 000000000000..c97dc5830e7c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UnplannedFailoverInputTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UnplannedFailoverInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UnplannedFailoverInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class UnplannedFailoverInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UnplannedFailoverInput model = + BinaryData + .fromString( + "{\"properties\":{\"failoverDirection\":\"szqujizdvoq\",\"sourceSiteOperations\":\"ibyowbblgyavutp\",\"providerSpecificDetails\":{\"instanceType\":\"UnplannedFailoverProviderSpecificInput\"}}}") + .toObject(UnplannedFailoverInput.class); + Assertions.assertEquals("szqujizdvoq", model.properties().failoverDirection()); + Assertions.assertEquals("ibyowbblgyavutp", model.properties().sourceSiteOperations()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UnplannedFailoverInput model = + new UnplannedFailoverInput() + .withProperties( + new UnplannedFailoverInputProperties() + .withFailoverDirection("szqujizdvoq") + .withSourceSiteOperations("ibyowbblgyavutp") + .withProviderSpecificDetails(new UnplannedFailoverProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(UnplannedFailoverInput.class); + Assertions.assertEquals("szqujizdvoq", model.properties().failoverDirection()); + Assertions.assertEquals("ibyowbblgyavutp", model.properties().sourceSiteOperations()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UnplannedFailoverProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UnplannedFailoverProviderSpecificInputTests.java new file mode 100644 index 000000000000..201e55c7eefa --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UnplannedFailoverProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UnplannedFailoverProviderSpecificInput; + +public final class UnplannedFailoverProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UnplannedFailoverProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"UnplannedFailoverProviderSpecificInput\"}") + .toObject(UnplannedFailoverProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UnplannedFailoverProviderSpecificInput model = new UnplannedFailoverProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(UnplannedFailoverProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateApplianceForReplicationProtectedItemInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateApplianceForReplicationProtectedItemInputTests.java new file mode 100644 index 000000000000..286ace302c63 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateApplianceForReplicationProtectedItemInputTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateApplianceForReplicationProtectedItemInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderSpecificInput; +import org.junit.jupiter.api.Assertions; + +public final class UpdateApplianceForReplicationProtectedItemInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateApplianceForReplicationProtectedItemInput model = + BinaryData + .fromString( + "{\"properties\":{\"targetApplianceId\":\"xsffgcviz\",\"providerSpecificDetails\":{\"instanceType\":\"UpdateApplianceForReplicationProtectedItemProviderSpecificInput\"}}}") + .toObject(UpdateApplianceForReplicationProtectedItemInput.class); + Assertions.assertEquals("xsffgcviz", model.properties().targetApplianceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateApplianceForReplicationProtectedItemInput model = + new UpdateApplianceForReplicationProtectedItemInput() + .withProperties( + new UpdateApplianceForReplicationProtectedItemInputProperties() + .withTargetApplianceId("xsffgcviz") + .withProviderSpecificDetails(new UpdateReplicationProtectedItemProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(UpdateApplianceForReplicationProtectedItemInput.class); + Assertions.assertEquals("xsffgcviz", model.properties().targetApplianceId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateDiskInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateDiskInputTests.java new file mode 100644 index 000000000000..a57cbe9bb1a6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateDiskInputTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateDiskInput; +import org.junit.jupiter.api.Assertions; + +public final class UpdateDiskInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateDiskInput model = + BinaryData + .fromString("{\"diskId\":\"zamicb\",\"targetDiskName\":\"wcdgzsez\"}") + .toObject(UpdateDiskInput.class); + Assertions.assertEquals("zamicb", model.diskId()); + Assertions.assertEquals("wcdgzsez", model.targetDiskName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateDiskInput model = new UpdateDiskInput().withDiskId("zamicb").withTargetDiskName("wcdgzsez"); + model = BinaryData.fromObject(model).toObject(UpdateDiskInput.class); + Assertions.assertEquals("zamicb", model.diskId()); + Assertions.assertEquals("wcdgzsez", model.targetDiskName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMigrationItemInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMigrationItemInputPropertiesTests.java new file mode 100644 index 000000000000..9889386a73c0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMigrationItemInputPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMigrationItemInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput; + +public final class UpdateMigrationItemInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateMigrationItemInputProperties model = + BinaryData + .fromString( + "{\"providerSpecificDetails\":{\"instanceType\":\"UpdateMigrationItemProviderSpecificInput\"}}") + .toObject(UpdateMigrationItemInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateMigrationItemInputProperties model = + new UpdateMigrationItemInputProperties() + .withProviderSpecificDetails(new UpdateMigrationItemProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(UpdateMigrationItemInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMigrationItemInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMigrationItemInputTests.java new file mode 100644 index 000000000000..48259fff0b0e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMigrationItemInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMigrationItemInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMigrationItemInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput; + +public final class UpdateMigrationItemInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateMigrationItemInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificDetails\":{\"instanceType\":\"UpdateMigrationItemProviderSpecificInput\"}}}") + .toObject(UpdateMigrationItemInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateMigrationItemInput model = + new UpdateMigrationItemInput() + .withProperties( + new UpdateMigrationItemInputProperties() + .withProviderSpecificDetails(new UpdateMigrationItemProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(UpdateMigrationItemInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMigrationItemProviderSpecificInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMigrationItemProviderSpecificInputTests.java new file mode 100644 index 000000000000..560fe36ad113 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMigrationItemProviderSpecificInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMigrationItemProviderSpecificInput; + +public final class UpdateMigrationItemProviderSpecificInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateMigrationItemProviderSpecificInput model = + BinaryData + .fromString("{\"instanceType\":\"UpdateMigrationItemProviderSpecificInput\"}") + .toObject(UpdateMigrationItemProviderSpecificInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateMigrationItemProviderSpecificInput model = new UpdateMigrationItemProviderSpecificInput(); + model = BinaryData.fromObject(model).toObject(UpdateMigrationItemProviderSpecificInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMobilityServiceRequestPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMobilityServiceRequestPropertiesTests.java new file mode 100644 index 000000000000..c8ad92f834fe --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMobilityServiceRequestPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMobilityServiceRequestProperties; +import org.junit.jupiter.api.Assertions; + +public final class UpdateMobilityServiceRequestPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateMobilityServiceRequestProperties model = + BinaryData + .fromString("{\"runAsAccountId\":\"tsttktlahbq\"}") + .toObject(UpdateMobilityServiceRequestProperties.class); + Assertions.assertEquals("tsttktlahbq", model.runAsAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateMobilityServiceRequestProperties model = + new UpdateMobilityServiceRequestProperties().withRunAsAccountId("tsttktlahbq"); + model = BinaryData.fromObject(model).toObject(UpdateMobilityServiceRequestProperties.class); + Assertions.assertEquals("tsttktlahbq", model.runAsAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMobilityServiceRequestTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMobilityServiceRequestTests.java new file mode 100644 index 000000000000..b92d3eb53904 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateMobilityServiceRequestTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMobilityServiceRequest; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateMobilityServiceRequestProperties; +import org.junit.jupiter.api.Assertions; + +public final class UpdateMobilityServiceRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateMobilityServiceRequest model = + BinaryData + .fromString("{\"properties\":{\"runAsAccountId\":\"bdyhgkfminsgowz\"}}") + .toObject(UpdateMobilityServiceRequest.class); + Assertions.assertEquals("bdyhgkfminsgowz", model.properties().runAsAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateMobilityServiceRequest model = + new UpdateMobilityServiceRequest() + .withProperties(new UpdateMobilityServiceRequestProperties().withRunAsAccountId("bdyhgkfminsgowz")); + model = BinaryData.fromObject(model).toObject(UpdateMobilityServiceRequest.class); + Assertions.assertEquals("bdyhgkfminsgowz", model.properties().runAsAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateNetworkMappingInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateNetworkMappingInputPropertiesTests.java new file mode 100644 index 000000000000..b594298ab7ab --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateNetworkMappingInputPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateNetworkMappingInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class UpdateNetworkMappingInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateNetworkMappingInputProperties model = + BinaryData + .fromString( + "{\"recoveryFabricName\":\"fbishcbkha\",\"recoveryNetworkId\":\"eyeam\",\"fabricSpecificDetails\":{\"instanceType\":\"FabricSpecificUpdateNetworkMappingInput\"}}") + .toObject(UpdateNetworkMappingInputProperties.class); + Assertions.assertEquals("fbishcbkha", model.recoveryFabricName()); + Assertions.assertEquals("eyeam", model.recoveryNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateNetworkMappingInputProperties model = + new UpdateNetworkMappingInputProperties() + .withRecoveryFabricName("fbishcbkha") + .withRecoveryNetworkId("eyeam") + .withFabricSpecificDetails(new FabricSpecificUpdateNetworkMappingInput()); + model = BinaryData.fromObject(model).toObject(UpdateNetworkMappingInputProperties.class); + Assertions.assertEquals("fbishcbkha", model.recoveryFabricName()); + Assertions.assertEquals("eyeam", model.recoveryNetworkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateNetworkMappingInputTests.java new file mode 100644 index 000000000000..2e57130b1adc --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateNetworkMappingInputTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.FabricSpecificUpdateNetworkMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateNetworkMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateNetworkMappingInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class UpdateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateNetworkMappingInput model = + BinaryData + .fromString( + "{\"properties\":{\"recoveryFabricName\":\"de\",\"recoveryNetworkId\":\"jzicwifsjt\",\"fabricSpecificDetails\":{\"instanceType\":\"FabricSpecificUpdateNetworkMappingInput\"}}}") + .toObject(UpdateNetworkMappingInput.class); + Assertions.assertEquals("de", model.properties().recoveryFabricName()); + Assertions.assertEquals("jzicwifsjt", model.properties().recoveryNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateNetworkMappingInput model = + new UpdateNetworkMappingInput() + .withProperties( + new UpdateNetworkMappingInputProperties() + .withRecoveryFabricName("de") + .withRecoveryNetworkId("jzicwifsjt") + .withFabricSpecificDetails(new FabricSpecificUpdateNetworkMappingInput())); + model = BinaryData.fromObject(model).toObject(UpdateNetworkMappingInput.class); + Assertions.assertEquals("de", model.properties().recoveryFabricName()); + Assertions.assertEquals("jzicwifsjt", model.properties().recoveryNetworkId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdatePolicyInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdatePolicyInputPropertiesTests.java new file mode 100644 index 000000000000..d040b531924d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdatePolicyInputPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdatePolicyInputProperties; + +public final class UpdatePolicyInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdatePolicyInputProperties model = + BinaryData + .fromString("{\"replicationProviderSettings\":{\"instanceType\":\"PolicyProviderSpecificInput\"}}") + .toObject(UpdatePolicyInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdatePolicyInputProperties model = + new UpdatePolicyInputProperties().withReplicationProviderSettings(new PolicyProviderSpecificInput()); + model = BinaryData.fromObject(model).toObject(UpdatePolicyInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdatePolicyInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdatePolicyInputTests.java new file mode 100644 index 000000000000..5fa0fb738050 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdatePolicyInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PolicyProviderSpecificInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdatePolicyInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdatePolicyInputProperties; + +public final class UpdatePolicyInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdatePolicyInput model = + BinaryData + .fromString( + "{\"properties\":{\"replicationProviderSettings\":{\"instanceType\":\"PolicyProviderSpecificInput\"}}}") + .toObject(UpdatePolicyInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdatePolicyInput model = + new UpdatePolicyInput() + .withProperties( + new UpdatePolicyInputProperties() + .withReplicationProviderSettings(new PolicyProviderSpecificInput())); + model = BinaryData.fromObject(model).toObject(UpdatePolicyInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateProtectionContainerMappingInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateProtectionContainerMappingInputPropertiesTests.java new file mode 100644 index 000000000000..0dd0ffd9f889 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateProtectionContainerMappingInputPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificUpdateContainerMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInputProperties; + +public final class UpdateProtectionContainerMappingInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateProtectionContainerMappingInputProperties model = + BinaryData + .fromString( + "{\"providerSpecificInput\":{\"instanceType\":\"ReplicationProviderSpecificUpdateContainerMappingInput\"}}") + .toObject(UpdateProtectionContainerMappingInputProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateProtectionContainerMappingInputProperties model = + new UpdateProtectionContainerMappingInputProperties() + .withProviderSpecificInput(new ReplicationProviderSpecificUpdateContainerMappingInput()); + model = BinaryData.fromObject(model).toObject(UpdateProtectionContainerMappingInputProperties.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateProtectionContainerMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateProtectionContainerMappingInputTests.java new file mode 100644 index 000000000000..3794f40c7489 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateProtectionContainerMappingInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProviderSpecificUpdateContainerMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateProtectionContainerMappingInputProperties; + +public final class UpdateProtectionContainerMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateProtectionContainerMappingInput model = + BinaryData + .fromString( + "{\"properties\":{\"providerSpecificInput\":{\"instanceType\":\"ReplicationProviderSpecificUpdateContainerMappingInput\"}}}") + .toObject(UpdateProtectionContainerMappingInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateProtectionContainerMappingInput model = + new UpdateProtectionContainerMappingInput() + .withProperties( + new UpdateProtectionContainerMappingInputProperties() + .withProviderSpecificInput(new ReplicationProviderSpecificUpdateContainerMappingInput())); + model = BinaryData.fromObject(model).toObject(UpdateProtectionContainerMappingInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateRecoveryPlanInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateRecoveryPlanInputPropertiesTests.java new file mode 100644 index 000000000000..4f009b022277 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateRecoveryPlanInputPropertiesTests.java @@ -0,0 +1,451 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroup; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateRecoveryPlanInputProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class UpdateRecoveryPlanInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateRecoveryPlanInputProperties model = + BinaryData + .fromString( + "{\"groups\":[{\"groupType\":\"Boot\",\"replicationProtectedItems\":[{\"id\":\"arnroohguab\",\"virtualMachineId\":\"ghktdpy\"}],\"startGroupActions\":[{\"actionName\":\"coe\",\"failoverTypes\":[\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"rottjzcfyjzptw\",\"failoverTypes\":[\"CompleteMigration\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"infsz\",\"failoverTypes\":[\"DisableProtection\",\"TestFailoverCleanup\",\"UnplannedFailover\",\"SwitchProtection\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"l\",\"failoverTypes\":[\"CompleteMigration\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"yypsjoqc\",\"failoverTypes\":[\"ReverseReplicate\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"zv\",\"failoverTypes\":[\"ReverseReplicate\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Shutdown\",\"replicationProtectedItems\":[{\"id\":\"mpzqjhhhq\",\"virtualMachineId\":\"w\"}],\"startGroupActions\":[{\"actionName\":\"acoyvivbsizusjs\",\"failoverTypes\":[\"CancelFailover\",\"CompleteMigration\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"ijiufehgmvfln\",\"failoverTypes\":[\"ReverseReplicate\",\"Failback\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"lniylylyfwxz\",\"failoverTypes\":[\"UnplannedFailover\",\"TestFailoverCleanup\",\"SwitchProtection\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"pgxyjtcdxabbu\",\"failoverTypes\":[\"UnplannedFailover\",\"Commit\",\"SwitchProtection\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"lqpx\",\"failoverTypes\":[\"FinalizeFailback\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"wwnlzafwxudgnh\",\"failoverTypes\":[\"TestFailoverCleanup\",\"FinalizeFailback\",\"ChangePit\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"nbwgpbemeluclv\",\"failoverTypes\":[\"UnplannedFailover\",\"UnplannedFailover\",\"DisableProtection\",\"PlannedFailover\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{\"id\":\"h\",\"virtualMachineId\":\"qfaqnvzoqg\"},{\"id\":\"pem\",\"virtualMachineId\":\"gavsczuejd\"},{\"id\":\"ptlghwzhomewjjst\",\"virtualMachineId\":\"uhqawmoaianc\"},{\"id\":\"vodrrslblxydkxr\",\"virtualMachineId\":\"vbxiwkgfbqlj\"}],\"startGroupActions\":[{\"actionName\":\"hychocokuleh\",\"failoverTypes\":[\"TestFailover\",\"PlannedFailover\",\"CompleteMigration\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"aweyur\",\"failoverTypes\":[\"UnplannedFailover\",\"CancelFailover\",\"ChangePit\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"av\",\"failoverTypes\":[\"ReverseReplicate\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"xmrgchbapxkiy\",\"failoverTypes\":[\"CancelFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"us\",\"failoverTypes\":[\"ReverseReplicate\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"oycblevpmc\",\"failoverTypes\":[\"FinalizeFailback\",\"Failback\",\"FinalizeFailback\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"xlzgsjgkzzl\",\"failoverTypes\":[\"PlannedFailover\",\"Failback\"],\"failoverDirections\":[\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]},{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{\"id\":\"wmbjlzqsczpg\",\"virtualMachineId\":\"wnapfdq\"},{\"id\":\"wf\",\"virtualMachineId\":\"tnuwjtkschgc\"},{\"id\":\"y\",\"virtualMachineId\":\"eseyqr\"},{\"id\":\"y\",\"virtualMachineId\":\"dotjvdk\"}],\"startGroupActions\":[{\"actionName\":\"ws\",\"failoverTypes\":[\"ChangePit\",\"TestFailoverCleanup\",\"Failback\",\"UnplannedFailover\"],\"failoverDirections\":[\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"vwisp\",\"failoverTypes\":[\"Commit\",\"FinalizeFailback\",\"CancelFailover\",\"Commit\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"qvtwknvgmmbugt\",\"failoverTypes\":[\"TestFailoverCleanup\",\"TestFailoverCleanup\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}]}") + .toObject(UpdateRecoveryPlanInputProperties.class); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, model.groups().get(0).groupType()); + Assertions.assertEquals("arnroohguab", model.groups().get(0).replicationProtectedItems().get(0).id()); + Assertions.assertEquals("ghktdpy", model.groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("coe", model.groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CHANGE_PIT, + model.groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("l", model.groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.COMPLETE_MIGRATION, + model.groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateRecoveryPlanInputProperties model = + new UpdateRecoveryPlanInputProperties() + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.BOOT) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("arnroohguab") + .withVirtualMachineId("ghktdpy"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("coe") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("rottjzcfyjzptw") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMPLETE_MIGRATION, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("infsz") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.DISABLE_PROTECTION, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.SWITCH_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("l") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.COMPLETE_MIGRATION)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("yypsjoqc") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.REVERSE_REPLICATE)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("zv") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.REVERSE_REPLICATE)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.SHUTDOWN) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("mpzqjhhhq") + .withVirtualMachineId("w"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("acoyvivbsizusjs") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.COMPLETE_MIGRATION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("ijiufehgmvfln") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.REVERSE_REPLICATE, + ReplicationProtectedItemOperation.FAILBACK)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("lniylylyfwxz") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.SWITCH_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("pgxyjtcdxabbu") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.SWITCH_PROTECTION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("lqpx") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("wwnlzafwxudgnh") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("nbwgpbemeluclv") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.DISABLE_PROTECTION, + ReplicationProtectedItemOperation.PLANNED_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("h") + .withVirtualMachineId("qfaqnvzoqg"), + new RecoveryPlanProtectedItem() + .withId("pem") + .withVirtualMachineId("gavsczuejd"), + new RecoveryPlanProtectedItem() + .withId("ptlghwzhomewjjst") + .withVirtualMachineId("uhqawmoaianc"), + new RecoveryPlanProtectedItem() + .withId("vodrrslblxydkxr") + .withVirtualMachineId("vbxiwkgfbqlj"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("hychocokuleh") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.TEST_FAILOVER, + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.COMPLETE_MIGRATION)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("aweyur") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("av") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.REVERSE_REPLICATE)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("xmrgchbapxkiy") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.CANCEL_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("us") + .withFailoverTypes( + Arrays.asList(ReplicationProtectedItemOperation.REVERSE_REPLICATE)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("oycblevpmc") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.FAILBACK, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("xlzgsjgkzzl") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.PLANNED_FAILOVER, + ReplicationProtectedItemOperation.FAILBACK)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))), + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("wmbjlzqsczpg") + .withVirtualMachineId("wnapfdq"), + new RecoveryPlanProtectedItem() + .withId("wf") + .withVirtualMachineId("tnuwjtkschgc"), + new RecoveryPlanProtectedItem().withId("y").withVirtualMachineId("eseyqr"), + new RecoveryPlanProtectedItem() + .withId("y") + .withVirtualMachineId("dotjvdk"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("ws") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.CHANGE_PIT, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.FAILBACK, + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER)) + .withFailoverDirections( + Arrays.asList(PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("vwisp") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.COMMIT, + ReplicationProtectedItemOperation.FINALIZE_FAILBACK, + ReplicationProtectedItemOperation.CANCEL_FAILOVER, + ReplicationProtectedItemOperation.COMMIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("qvtwknvgmmbugt") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP, + ReplicationProtectedItemOperation.TEST_FAILOVER_CLEANUP)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))))); + model = BinaryData.fromObject(model).toObject(UpdateRecoveryPlanInputProperties.class); + Assertions.assertEquals(RecoveryPlanGroupType.BOOT, model.groups().get(0).groupType()); + Assertions.assertEquals("arnroohguab", model.groups().get(0).replicationProtectedItems().get(0).id()); + Assertions.assertEquals("ghktdpy", model.groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("coe", model.groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CHANGE_PIT, + model.groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions.assertEquals("l", model.groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.COMPLETE_MIGRATION, + model.groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateRecoveryPlanInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateRecoveryPlanInputTests.java new file mode 100644 index 000000000000..381db645dc39 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateRecoveryPlanInputTests.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PossibleOperationsDirections; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanAction; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanActionDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroup; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanGroupType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.RecoveryPlanProtectedItem; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.ReplicationProtectedItemOperation; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateRecoveryPlanInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateRecoveryPlanInputProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class UpdateRecoveryPlanInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateRecoveryPlanInput model = + BinaryData + .fromString( + "{\"properties\":{\"groups\":[{\"groupType\":\"Failover\",\"replicationProtectedItems\":[{\"id\":\"kfqlwx\",\"virtualMachineId\":\"ykalsyga\"},{\"id\":\"njpnnbmj\",\"virtualMachineId\":\"ibjgsjjxxahm\"},{\"id\":\"ad\",\"virtualMachineId\":\"qegxyivpin\"},{\"id\":\"hwbjijkgqxnhmbk\",\"virtualMachineId\":\"njaujvaan\"}],\"startGroupActions\":[{\"actionName\":\"iycwkdta\",\"failoverTypes\":[\"ChangePit\",\"CompleteMigration\",\"ReverseReplicate\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"umrrqmbzm\",\"failoverTypes\":[\"ChangePit\",\"UnplannedFailover\",\"FinalizeFailback\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\",\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"jsi\",\"failoverTypes\":[\"CompleteMigration\",\"DisableProtection\",\"TestFailover\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"PrimaryToRecovery\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}},{\"actionName\":\"sokdgoge\",\"failoverTypes\":[\"ReverseReplicate\",\"CompleteMigration\",\"DisableProtection\",\"TestFailoverCleanup\"],\"failoverDirections\":[\"PrimaryToRecovery\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}],\"endGroupActions\":[{\"actionName\":\"ozkyewnfnzh\",\"failoverTypes\":[\"UnplannedFailover\",\"ChangePit\"],\"failoverDirections\":[\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\",\"RecoveryToPrimary\"],\"customDetails\":{\"instanceType\":\"RecoveryPlanActionDetails\"}}]}]}}") + .toObject(UpdateRecoveryPlanInput.class); + Assertions.assertEquals(RecoveryPlanGroupType.FAILOVER, model.properties().groups().get(0).groupType()); + Assertions.assertEquals("kfqlwx", model.properties().groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals( + "ykalsyga", model.properties().groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("iycwkdta", model.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CHANGE_PIT, + model.properties().groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.properties().groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions + .assertEquals("ozkyewnfnzh", model.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + model.properties().groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.properties().groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateRecoveryPlanInput model = + new UpdateRecoveryPlanInput() + .withProperties( + new UpdateRecoveryPlanInputProperties() + .withGroups( + Arrays + .asList( + new RecoveryPlanGroup() + .withGroupType(RecoveryPlanGroupType.FAILOVER) + .withReplicationProtectedItems( + Arrays + .asList( + new RecoveryPlanProtectedItem() + .withId("kfqlwx") + .withVirtualMachineId("ykalsyga"), + new RecoveryPlanProtectedItem() + .withId("njpnnbmj") + .withVirtualMachineId("ibjgsjjxxahm"), + new RecoveryPlanProtectedItem() + .withId("ad") + .withVirtualMachineId("qegxyivpin"), + new RecoveryPlanProtectedItem() + .withId("hwbjijkgqxnhmbk") + .withVirtualMachineId("njaujvaan"))) + .withStartGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("iycwkdta") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.CHANGE_PIT, + ReplicationProtectedItemOperation + .COMPLETE_MIGRATION, + ReplicationProtectedItemOperation + .REVERSE_REPLICATE)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("umrrqmbzm") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.CHANGE_PIT, + ReplicationProtectedItemOperation + .UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation + .FINALIZE_FAILBACK)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("jsi") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .COMPLETE_MIGRATION, + ReplicationProtectedItemOperation + .DISABLE_PROTECTION, + ReplicationProtectedItemOperation.TEST_FAILOVER)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.PRIMARY_TO_RECOVERY)) + .withCustomDetails(new RecoveryPlanActionDetails()), + new RecoveryPlanAction() + .withActionName("sokdgoge") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation.REVERSE_REPLICATE, + ReplicationProtectedItemOperation + .COMPLETE_MIGRATION, + ReplicationProtectedItemOperation + .DISABLE_PROTECTION, + ReplicationProtectedItemOperation + .TEST_FAILOVER_CLEANUP)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails()))) + .withEndGroupActions( + Arrays + .asList( + new RecoveryPlanAction() + .withActionName("ozkyewnfnzh") + .withFailoverTypes( + Arrays + .asList( + ReplicationProtectedItemOperation + .UNPLANNED_FAILOVER, + ReplicationProtectedItemOperation.CHANGE_PIT)) + .withFailoverDirections( + Arrays + .asList( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + PossibleOperationsDirections.RECOVERY_TO_PRIMARY)) + .withCustomDetails(new RecoveryPlanActionDetails())))))); + model = BinaryData.fromObject(model).toObject(UpdateRecoveryPlanInput.class); + Assertions.assertEquals(RecoveryPlanGroupType.FAILOVER, model.properties().groups().get(0).groupType()); + Assertions.assertEquals("kfqlwx", model.properties().groups().get(0).replicationProtectedItems().get(0).id()); + Assertions + .assertEquals( + "ykalsyga", model.properties().groups().get(0).replicationProtectedItems().get(0).virtualMachineId()); + Assertions.assertEquals("iycwkdta", model.properties().groups().get(0).startGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.CHANGE_PIT, + model.properties().groups().get(0).startGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.PRIMARY_TO_RECOVERY, + model.properties().groups().get(0).startGroupActions().get(0).failoverDirections().get(0)); + Assertions + .assertEquals("ozkyewnfnzh", model.properties().groups().get(0).endGroupActions().get(0).actionName()); + Assertions + .assertEquals( + ReplicationProtectedItemOperation.UNPLANNED_FAILOVER, + model.properties().groups().get(0).endGroupActions().get(0).failoverTypes().get(0)); + Assertions + .assertEquals( + PossibleOperationsDirections.RECOVERY_TO_PRIMARY, + model.properties().groups().get(0).endGroupActions().get(0).failoverDirections().get(0)); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateReplicationProtectedItemInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateReplicationProtectedItemInputPropertiesTests.java new file mode 100644 index 000000000000..19d67f3958e1 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateReplicationProtectedItemInputPropertiesTests.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigInputDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LicenseType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMNicInputDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class UpdateReplicationProtectedItemInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateReplicationProtectedItemInputProperties model = + BinaryData + .fromString( + "{\"recoveryAzureVMName\":\"lpqblylsyxk\",\"recoveryAzureVMSize\":\"nsj\",\"selectedRecoveryAzureNetworkId\":\"vti\",\"selectedTfoAzureNetworkId\":\"xsdszuempsb\",\"selectedSourceNicId\":\"f\",\"enableRdpOnTargetOption\":\"eyvpnqicvinvkj\",\"vmNics\":[{\"nicId\":\"rbuukzclewyhmlwp\",\"ipConfigs\":[{\"ipConfigName\":\"pofncck\",\"isPrimary\":false,\"isSeletedForFailover\":true,\"recoverySubnetName\":\"hxx\",\"recoveryStaticIPAddress\":\"yq\",\"recoveryPublicIPAddressId\":\"zfeqztppri\",\"recoveryLBBackendAddressPoolIds\":[\"or\",\"altol\",\"ncwsob\",\"wcsdbnwdcfhucq\"],\"tfoSubnetName\":\"fuvglsbjjca\",\"tfoStaticIPAddress\":\"xbvtvudu\",\"tfoPublicIPAddressId\":\"cormr\",\"tfoLBBackendAddressPoolIds\":[\"tvcof\",\"dflvkg\",\"u\",\"gdknnqv\"]},{\"ipConfigName\":\"znqntoru\",\"isPrimary\":true,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"mkycgra\",\"recoveryStaticIPAddress\":\"juetaebur\",\"recoveryPublicIPAddressId\":\"dmovsm\",\"recoveryLBBackendAddressPoolIds\":[\"wabm\",\"oefki\"],\"tfoSubnetName\":\"vtpuqujmqlgk\",\"tfoStaticIPAddress\":\"tndoaongbjc\",\"tfoPublicIPAddressId\":\"ujitcjedftww\",\"tfoLBBackendAddressPoolIds\":[\"kojvd\"]},{\"ipConfigName\":\"zfoqouicybxar\",\"isPrimary\":true,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"oxciqopidoamcio\",\"recoveryStaticIPAddress\":\"khazxkhnzbonlwn\",\"recoveryPublicIPAddressId\":\"egokdwbwhkszzcmr\",\"recoveryLBBackendAddressPoolIds\":[\"ztvbtqgsfr\",\"oyzko\",\"wtl\",\"nguxawqaldsy\"],\"tfoSubnetName\":\"ximerqfobwyznk\",\"tfoStaticIPAddress\":\"kutwpf\",\"tfoPublicIPAddressId\":\"a\",\"tfoLBBackendAddressPoolIds\":[\"r\",\"kdsnfdsdoakgtdl\",\"kkze\"]},{\"ipConfigName\":\"l\",\"isPrimary\":true,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"dsttwvo\",\"recoveryStaticIPAddress\":\"bbejdcngqqm\",\"recoveryPublicIPAddressId\":\"kufgmj\",\"recoveryLBBackendAddressPoolIds\":[\"rdgrtw\"],\"tfoSubnetName\":\"nuuzkopbm\",\"tfoStaticIPAddress\":\"rfdwoyu\",\"tfoPublicIPAddressId\":\"ziuiefozbhdm\",\"tfoLBBackendAddressPoolIds\":[\"mzqhoftrmaequi\"]}],\"selectionType\":\"xicslfao\",\"recoveryNetworkSecurityGroupId\":\"piyylhalnswhccsp\",\"enableAcceleratedNetworkingOnRecovery\":true,\"tfoNetworkSecurityGroupId\":\"vwitqscyw\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"oluhczbwemh\",\"recoveryNicResourceGroupName\":\"rsbrgzdwm\",\"reuseExistingNic\":true,\"tfoNicName\":\"pqwd\",\"tfoNicResourceGroupName\":\"gicccnxqhuex\",\"tfoReuseExistingNic\":true,\"targetNicName\":\"lstvlzywe\"},{\"nicId\":\"zrncsdt\",\"ipConfigs\":[{\"ipConfigName\":\"iypbsfgytgusl\",\"isPrimary\":false,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"gq\",\"recoveryStaticIPAddress\":\"yhejhzisxgfp\",\"recoveryPublicIPAddressId\":\"olppvksrpqvujz\",\"recoveryLBBackendAddressPoolIds\":[\"htwdwrftswibyrcd\",\"bhshfwpracstwity\",\"hevxcced\"],\"tfoSubnetName\":\"nmdyodnwzxl\",\"tfoStaticIPAddress\":\"cvnhltiugc\",\"tfoPublicIPAddressId\":\"avvwxqi\",\"tfoLBBackendAddressPoolIds\":[\"unyowxwl\",\"djrkvfgbvfvpd\",\"odacizs\",\"q\"]}],\"selectionType\":\"krribdeibqi\",\"recoveryNetworkSecurityGroupId\":\"kghv\",\"enableAcceleratedNetworkingOnRecovery\":true,\"tfoNetworkSecurityGroupId\":\"wm\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"ajpjo\",\"recoveryNicResourceGroupName\":\"kqnyh\",\"reuseExistingNic\":false,\"tfoNicName\":\"tjivfxzsjabib\",\"tfoNicResourceGroupName\":\"stawfsdjpvkv\",\"tfoReuseExistingNic\":true,\"targetNicName\":\"bkzbzkd\"},{\"nicId\":\"cjabudurgkakmo\",\"ipConfigs\":[{\"ipConfigName\":\"jk\",\"isPrimary\":false,\"isSeletedForFailover\":true,\"recoverySubnetName\":\"uwqlgzrfzeey\",\"recoveryStaticIPAddress\":\"izikayuhq\",\"recoveryPublicIPAddressId\":\"jbsybbqw\",\"recoveryLBBackendAddressPoolIds\":[\"ldgmfpgvmpip\"],\"tfoSubnetName\":\"ltha\",\"tfoStaticIPAddress\":\"x\",\"tfoPublicIPAddressId\":\"mwutwbdsre\",\"tfoLBBackendAddressPoolIds\":[\"rhneuyowq\",\"d\",\"ytisibir\"]},{\"ipConfigName\":\"pikpz\",\"isPrimary\":false,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"nlfzxiavrmbz\",\"recoveryStaticIPAddress\":\"okixrjqcir\",\"recoveryPublicIPAddressId\":\"pfrlazsz\",\"recoveryLBBackendAddressPoolIds\":[\"oiindfpwpjy\",\"wbtlhflsjcdh\"],\"tfoSubnetName\":\"fjvfbgofeljagr\",\"tfoStaticIPAddress\":\"qhl\",\"tfoPublicIPAddressId\":\"riiiojnalghfkv\",\"tfoLBBackendAddressPoolIds\":[\"ex\",\"owueluqh\"]}],\"selectionType\":\"hhxvrhmzkwpj\",\"recoveryNetworkSecurityGroupId\":\"wspughftqsxhqx\",\"enableAcceleratedNetworkingOnRecovery\":true,\"tfoNetworkSecurityGroupId\":\"kndxdigrjgu\",\"enableAcceleratedNetworkingOnTfo\":true,\"recoveryNicName\":\"msyqtfi\",\"recoveryNicResourceGroupName\":\"hbotzingamvppho\",\"reuseExistingNic\":false,\"tfoNicName\":\"udphqamvdkfwyn\",\"tfoNicResourceGroupName\":\"vtbvkayh\",\"tfoReuseExistingNic\":false,\"targetNicName\":\"yqiatkzwp\"}],\"licenseType\":\"WindowsServer\",\"recoveryAvailabilitySetId\":\"zcjaesgvvsccy\",\"providerSpecificDetails\":{\"instanceType\":\"UpdateReplicationProtectedItemProviderInput\"}}") + .toObject(UpdateReplicationProtectedItemInputProperties.class); + Assertions.assertEquals("lpqblylsyxk", model.recoveryAzureVMName()); + Assertions.assertEquals("nsj", model.recoveryAzureVMSize()); + Assertions.assertEquals("vti", model.selectedRecoveryAzureNetworkId()); + Assertions.assertEquals("xsdszuempsb", model.selectedTfoAzureNetworkId()); + Assertions.assertEquals("f", model.selectedSourceNicId()); + Assertions.assertEquals("eyvpnqicvinvkj", model.enableRdpOnTargetOption()); + Assertions.assertEquals("rbuukzclewyhmlwp", model.vmNics().get(0).nicId()); + Assertions.assertEquals("pofncck", model.vmNics().get(0).ipConfigs().get(0).ipConfigName()); + Assertions.assertEquals(false, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("hxx", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("yq", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("zfeqztppri", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals("or", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("fuvglsbjjca", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("xbvtvudu", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("cormr", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("tvcof", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("xicslfao", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("piyylhalnswhccsp", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(true, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("vwitqscyw", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("oluhczbwemh", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("rsbrgzdwm", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("pqwd", model.vmNics().get(0).tfoNicName()); + Assertions.assertEquals("gicccnxqhuex", model.vmNics().get(0).tfoNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("lstvlzywe", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals(LicenseType.WINDOWS_SERVER, model.licenseType()); + Assertions.assertEquals("zcjaesgvvsccy", model.recoveryAvailabilitySetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateReplicationProtectedItemInputProperties model = + new UpdateReplicationProtectedItemInputProperties() + .withRecoveryAzureVMName("lpqblylsyxk") + .withRecoveryAzureVMSize("nsj") + .withSelectedRecoveryAzureNetworkId("vti") + .withSelectedTfoAzureNetworkId("xsdszuempsb") + .withSelectedSourceNicId("f") + .withEnableRdpOnTargetOption("eyvpnqicvinvkj") + .withVmNics( + Arrays + .asList( + new VMNicInputDetails() + .withNicId("rbuukzclewyhmlwp") + .withIpConfigs( + Arrays + .asList( + new IpConfigInputDetails() + .withIpConfigName("pofncck") + .withIsPrimary(false) + .withIsSeletedForFailover(true) + .withRecoverySubnetName("hxx") + .withRecoveryStaticIpAddress("yq") + .withRecoveryPublicIpAddressId("zfeqztppri") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("or", "altol", "ncwsob", "wcsdbnwdcfhucq")) + .withTfoSubnetName("fuvglsbjjca") + .withTfoStaticIpAddress("xbvtvudu") + .withTfoPublicIpAddressId("cormr") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("tvcof", "dflvkg", "u", "gdknnqv")), + new IpConfigInputDetails() + .withIpConfigName("znqntoru") + .withIsPrimary(true) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("mkycgra") + .withRecoveryStaticIpAddress("juetaebur") + .withRecoveryPublicIpAddressId("dmovsm") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("wabm", "oefki")) + .withTfoSubnetName("vtpuqujmqlgk") + .withTfoStaticIpAddress("tndoaongbjc") + .withTfoPublicIpAddressId("ujitcjedftww") + .withTfoLBBackendAddressPoolIds(Arrays.asList("kojvd")), + new IpConfigInputDetails() + .withIpConfigName("zfoqouicybxar") + .withIsPrimary(true) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("oxciqopidoamcio") + .withRecoveryStaticIpAddress("khazxkhnzbonlwn") + .withRecoveryPublicIpAddressId("egokdwbwhkszzcmr") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("ztvbtqgsfr", "oyzko", "wtl", "nguxawqaldsy")) + .withTfoSubnetName("ximerqfobwyznk") + .withTfoStaticIpAddress("kutwpf") + .withTfoPublicIpAddressId("a") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("r", "kdsnfdsdoakgtdl", "kkze")), + new IpConfigInputDetails() + .withIpConfigName("l") + .withIsPrimary(true) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("dsttwvo") + .withRecoveryStaticIpAddress("bbejdcngqqm") + .withRecoveryPublicIpAddressId("kufgmj") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("rdgrtw")) + .withTfoSubnetName("nuuzkopbm") + .withTfoStaticIpAddress("rfdwoyu") + .withTfoPublicIpAddressId("ziuiefozbhdm") + .withTfoLBBackendAddressPoolIds(Arrays.asList("mzqhoftrmaequi")))) + .withSelectionType("xicslfao") + .withRecoveryNetworkSecurityGroupId("piyylhalnswhccsp") + .withEnableAcceleratedNetworkingOnRecovery(true) + .withTfoNetworkSecurityGroupId("vwitqscyw") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("oluhczbwemh") + .withRecoveryNicResourceGroupName("rsbrgzdwm") + .withReuseExistingNic(true) + .withTfoNicName("pqwd") + .withTfoNicResourceGroupName("gicccnxqhuex") + .withTfoReuseExistingNic(true) + .withTargetNicName("lstvlzywe"), + new VMNicInputDetails() + .withNicId("zrncsdt") + .withIpConfigs( + Arrays + .asList( + new IpConfigInputDetails() + .withIpConfigName("iypbsfgytgusl") + .withIsPrimary(false) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("gq") + .withRecoveryStaticIpAddress("yhejhzisxgfp") + .withRecoveryPublicIpAddressId("olppvksrpqvujz") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("htwdwrftswibyrcd", "bhshfwpracstwity", "hevxcced")) + .withTfoSubnetName("nmdyodnwzxl") + .withTfoStaticIpAddress("cvnhltiugc") + .withTfoPublicIpAddressId("avvwxqi") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("unyowxwl", "djrkvfgbvfvpd", "odacizs", "q")))) + .withSelectionType("krribdeibqi") + .withRecoveryNetworkSecurityGroupId("kghv") + .withEnableAcceleratedNetworkingOnRecovery(true) + .withTfoNetworkSecurityGroupId("wm") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("ajpjo") + .withRecoveryNicResourceGroupName("kqnyh") + .withReuseExistingNic(false) + .withTfoNicName("tjivfxzsjabib") + .withTfoNicResourceGroupName("stawfsdjpvkv") + .withTfoReuseExistingNic(true) + .withTargetNicName("bkzbzkd"), + new VMNicInputDetails() + .withNicId("cjabudurgkakmo") + .withIpConfigs( + Arrays + .asList( + new IpConfigInputDetails() + .withIpConfigName("jk") + .withIsPrimary(false) + .withIsSeletedForFailover(true) + .withRecoverySubnetName("uwqlgzrfzeey") + .withRecoveryStaticIpAddress("izikayuhq") + .withRecoveryPublicIpAddressId("jbsybbqw") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("ldgmfpgvmpip")) + .withTfoSubnetName("ltha") + .withTfoStaticIpAddress("x") + .withTfoPublicIpAddressId("mwutwbdsre") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("rhneuyowq", "d", "ytisibir")), + new IpConfigInputDetails() + .withIpConfigName("pikpz") + .withIsPrimary(false) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("nlfzxiavrmbz") + .withRecoveryStaticIpAddress("okixrjqcir") + .withRecoveryPublicIpAddressId("pfrlazsz") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("oiindfpwpjy", "wbtlhflsjcdh")) + .withTfoSubnetName("fjvfbgofeljagr") + .withTfoStaticIpAddress("qhl") + .withTfoPublicIpAddressId("riiiojnalghfkv") + .withTfoLBBackendAddressPoolIds(Arrays.asList("ex", "owueluqh")))) + .withSelectionType("hhxvrhmzkwpj") + .withRecoveryNetworkSecurityGroupId("wspughftqsxhqx") + .withEnableAcceleratedNetworkingOnRecovery(true) + .withTfoNetworkSecurityGroupId("kndxdigrjgu") + .withEnableAcceleratedNetworkingOnTfo(true) + .withRecoveryNicName("msyqtfi") + .withRecoveryNicResourceGroupName("hbotzingamvppho") + .withReuseExistingNic(false) + .withTfoNicName("udphqamvdkfwyn") + .withTfoNicResourceGroupName("vtbvkayh") + .withTfoReuseExistingNic(false) + .withTargetNicName("yqiatkzwp"))) + .withLicenseType(LicenseType.WINDOWS_SERVER) + .withRecoveryAvailabilitySetId("zcjaesgvvsccy") + .withProviderSpecificDetails(new UpdateReplicationProtectedItemProviderInput()); + model = BinaryData.fromObject(model).toObject(UpdateReplicationProtectedItemInputProperties.class); + Assertions.assertEquals("lpqblylsyxk", model.recoveryAzureVMName()); + Assertions.assertEquals("nsj", model.recoveryAzureVMSize()); + Assertions.assertEquals("vti", model.selectedRecoveryAzureNetworkId()); + Assertions.assertEquals("xsdszuempsb", model.selectedTfoAzureNetworkId()); + Assertions.assertEquals("f", model.selectedSourceNicId()); + Assertions.assertEquals("eyvpnqicvinvkj", model.enableRdpOnTargetOption()); + Assertions.assertEquals("rbuukzclewyhmlwp", model.vmNics().get(0).nicId()); + Assertions.assertEquals("pofncck", model.vmNics().get(0).ipConfigs().get(0).ipConfigName()); + Assertions.assertEquals(false, model.vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals(true, model.vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("hxx", model.vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("yq", model.vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("zfeqztppri", model.vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals("or", model.vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("fuvglsbjjca", model.vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("xbvtvudu", model.vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("cormr", model.vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("tvcof", model.vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("xicslfao", model.vmNics().get(0).selectionType()); + Assertions.assertEquals("piyylhalnswhccsp", model.vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(true, model.vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("vwitqscyw", model.vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("oluhczbwemh", model.vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("rsbrgzdwm", model.vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("pqwd", model.vmNics().get(0).tfoNicName()); + Assertions.assertEquals("gicccnxqhuex", model.vmNics().get(0).tfoNicResourceGroupName()); + Assertions.assertEquals(true, model.vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("lstvlzywe", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals(LicenseType.WINDOWS_SERVER, model.licenseType()); + Assertions.assertEquals("zcjaesgvvsccy", model.recoveryAvailabilitySetId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateReplicationProtectedItemInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateReplicationProtectedItemInputTests.java new file mode 100644 index 000000000000..98a8a2e24a4d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateReplicationProtectedItemInputTests.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigInputDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LicenseType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemInputProperties; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMNicInputDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class UpdateReplicationProtectedItemInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateReplicationProtectedItemInput model = + BinaryData + .fromString( + "{\"properties\":{\"recoveryAzureVMName\":\"wneaiv\",\"recoveryAzureVMSize\":\"czelpcirel\",\"selectedRecoveryAzureNetworkId\":\"eae\",\"selectedTfoAzureNetworkId\":\"abfatkl\",\"selectedSourceNicId\":\"xbjhwuaanozjosph\",\"enableRdpOnTargetOption\":\"ulpjr\",\"vmNics\":[{\"nicId\":\"l\",\"ipConfigs\":[{\"ipConfigName\":\"jwosytxitcskfck\",\"isPrimary\":true,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"kkezzikhlyfjhdgq\",\"recoveryStaticIPAddress\":\"ebdunyg\",\"recoveryPublicIPAddressId\":\"qidbqfatpxllrxcy\",\"recoveryLBBackendAddressPoolIds\":[\"a\",\"su\"],\"tfoSubnetName\":\"r\",\"tfoStaticIPAddress\":\"wdmjsjqbjhhyx\",\"tfoPublicIPAddressId\":\"wlycoduhpkxkg\",\"tfoLBBackendAddressPoolIds\":[\"re\",\"n\"]},{\"ipConfigName\":\"xqugjhkycubedd\",\"isPrimary\":true,\"isSeletedForFailover\":true,\"recoverySubnetName\":\"qmzqalkrmnjijpx\",\"recoveryStaticIPAddress\":\"q\",\"recoveryPublicIPAddressId\":\"dfnbyxbaaabjyv\",\"recoveryLBBackendAddressPoolIds\":[\"fimrzrtuzqogse\",\"nevfdnw\",\"wmewzsyy\",\"euzsoi\"],\"tfoSubnetName\":\"ud\",\"tfoStaticIPAddress\":\"rx\",\"tfoPublicIPAddressId\":\"thzvaytdwkqbrqu\",\"tfoLBBackendAddressPoolIds\":[\"xhexiilivpdti\",\"r\",\"tdqoaxoruzfgsq\"]}],\"selectionType\":\"fxrxxle\",\"recoveryNetworkSecurityGroupId\":\"ramxjezwlwnw\",\"enableAcceleratedNetworkingOnRecovery\":false,\"tfoNetworkSecurityGroupId\":\"cvydypatdoo\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"niodkooeb\",\"recoveryNicResourceGroupName\":\"ujhemmsbvdkcrodt\",\"reuseExistingNic\":true,\"tfoNicName\":\"wj\",\"tfoNicResourceGroupName\":\"lt\",\"tfoReuseExistingNic\":true,\"targetNicName\":\"vefkdlfoakggk\"}],\"licenseType\":\"NotSpecified\",\"recoveryAvailabilitySetId\":\"ao\",\"providerSpecificDetails\":{\"instanceType\":\"UpdateReplicationProtectedItemProviderInput\"}}}") + .toObject(UpdateReplicationProtectedItemInput.class); + Assertions.assertEquals("wneaiv", model.properties().recoveryAzureVMName()); + Assertions.assertEquals("czelpcirel", model.properties().recoveryAzureVMSize()); + Assertions.assertEquals("eae", model.properties().selectedRecoveryAzureNetworkId()); + Assertions.assertEquals("abfatkl", model.properties().selectedTfoAzureNetworkId()); + Assertions.assertEquals("xbjhwuaanozjosph", model.properties().selectedSourceNicId()); + Assertions.assertEquals("ulpjr", model.properties().enableRdpOnTargetOption()); + Assertions.assertEquals("l", model.properties().vmNics().get(0).nicId()); + Assertions + .assertEquals("jwosytxitcskfck", model.properties().vmNics().get(0).ipConfigs().get(0).ipConfigName()); + Assertions.assertEquals(true, model.properties().vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals(false, model.properties().vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions + .assertEquals( + "kkezzikhlyfjhdgq", model.properties().vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions + .assertEquals("ebdunyg", model.properties().vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions + .assertEquals( + "qidbqfatpxllrxcy", model.properties().vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals( + "a", model.properties().vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("r", model.properties().vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions + .assertEquals("wdmjsjqbjhhyx", model.properties().vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions + .assertEquals( + "wlycoduhpkxkg", model.properties().vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions + .assertEquals( + "re", model.properties().vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("fxrxxle", model.properties().vmNics().get(0).selectionType()); + Assertions.assertEquals("ramxjezwlwnw", model.properties().vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.properties().vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("cvydypatdoo", model.properties().vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.properties().vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("niodkooeb", model.properties().vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("ujhemmsbvdkcrodt", model.properties().vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.properties().vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("wj", model.properties().vmNics().get(0).tfoNicName()); + Assertions.assertEquals("lt", model.properties().vmNics().get(0).tfoNicResourceGroupName()); + Assertions.assertEquals(true, model.properties().vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("vefkdlfoakggk", model.properties().vmNics().get(0).targetNicName()); + Assertions.assertEquals(LicenseType.NOT_SPECIFIED, model.properties().licenseType()); + Assertions.assertEquals("ao", model.properties().recoveryAvailabilitySetId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateReplicationProtectedItemInput model = + new UpdateReplicationProtectedItemInput() + .withProperties( + new UpdateReplicationProtectedItemInputProperties() + .withRecoveryAzureVMName("wneaiv") + .withRecoveryAzureVMSize("czelpcirel") + .withSelectedRecoveryAzureNetworkId("eae") + .withSelectedTfoAzureNetworkId("abfatkl") + .withSelectedSourceNicId("xbjhwuaanozjosph") + .withEnableRdpOnTargetOption("ulpjr") + .withVmNics( + Arrays + .asList( + new VMNicInputDetails() + .withNicId("l") + .withIpConfigs( + Arrays + .asList( + new IpConfigInputDetails() + .withIpConfigName("jwosytxitcskfck") + .withIsPrimary(true) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("kkezzikhlyfjhdgq") + .withRecoveryStaticIpAddress("ebdunyg") + .withRecoveryPublicIpAddressId("qidbqfatpxllrxcy") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("a", "su")) + .withTfoSubnetName("r") + .withTfoStaticIpAddress("wdmjsjqbjhhyx") + .withTfoPublicIpAddressId("wlycoduhpkxkg") + .withTfoLBBackendAddressPoolIds(Arrays.asList("re", "n")), + new IpConfigInputDetails() + .withIpConfigName("xqugjhkycubedd") + .withIsPrimary(true) + .withIsSeletedForFailover(true) + .withRecoverySubnetName("qmzqalkrmnjijpx") + .withRecoveryStaticIpAddress("q") + .withRecoveryPublicIpAddressId("dfnbyxbaaabjyv") + .withRecoveryLBBackendAddressPoolIds( + Arrays + .asList( + "fimrzrtuzqogse", "nevfdnw", "wmewzsyy", "euzsoi")) + .withTfoSubnetName("ud") + .withTfoStaticIpAddress("rx") + .withTfoPublicIpAddressId("thzvaytdwkqbrqu") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("xhexiilivpdti", "r", "tdqoaxoruzfgsq")))) + .withSelectionType("fxrxxle") + .withRecoveryNetworkSecurityGroupId("ramxjezwlwnw") + .withEnableAcceleratedNetworkingOnRecovery(false) + .withTfoNetworkSecurityGroupId("cvydypatdoo") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("niodkooeb") + .withRecoveryNicResourceGroupName("ujhemmsbvdkcrodt") + .withReuseExistingNic(true) + .withTfoNicName("wj") + .withTfoNicResourceGroupName("lt") + .withTfoReuseExistingNic(true) + .withTargetNicName("vefkdlfoakggk"))) + .withLicenseType(LicenseType.NOT_SPECIFIED) + .withRecoveryAvailabilitySetId("ao") + .withProviderSpecificDetails(new UpdateReplicationProtectedItemProviderInput())); + model = BinaryData.fromObject(model).toObject(UpdateReplicationProtectedItemInput.class); + Assertions.assertEquals("wneaiv", model.properties().recoveryAzureVMName()); + Assertions.assertEquals("czelpcirel", model.properties().recoveryAzureVMSize()); + Assertions.assertEquals("eae", model.properties().selectedRecoveryAzureNetworkId()); + Assertions.assertEquals("abfatkl", model.properties().selectedTfoAzureNetworkId()); + Assertions.assertEquals("xbjhwuaanozjosph", model.properties().selectedSourceNicId()); + Assertions.assertEquals("ulpjr", model.properties().enableRdpOnTargetOption()); + Assertions.assertEquals("l", model.properties().vmNics().get(0).nicId()); + Assertions + .assertEquals("jwosytxitcskfck", model.properties().vmNics().get(0).ipConfigs().get(0).ipConfigName()); + Assertions.assertEquals(true, model.properties().vmNics().get(0).ipConfigs().get(0).isPrimary()); + Assertions.assertEquals(false, model.properties().vmNics().get(0).ipConfigs().get(0).isSeletedForFailover()); + Assertions + .assertEquals( + "kkezzikhlyfjhdgq", model.properties().vmNics().get(0).ipConfigs().get(0).recoverySubnetName()); + Assertions + .assertEquals("ebdunyg", model.properties().vmNics().get(0).ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions + .assertEquals( + "qidbqfatpxllrxcy", model.properties().vmNics().get(0).ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions + .assertEquals( + "a", model.properties().vmNics().get(0).ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("r", model.properties().vmNics().get(0).ipConfigs().get(0).tfoSubnetName()); + Assertions + .assertEquals("wdmjsjqbjhhyx", model.properties().vmNics().get(0).ipConfigs().get(0).tfoStaticIpAddress()); + Assertions + .assertEquals( + "wlycoduhpkxkg", model.properties().vmNics().get(0).ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions + .assertEquals( + "re", model.properties().vmNics().get(0).ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("fxrxxle", model.properties().vmNics().get(0).selectionType()); + Assertions.assertEquals("ramxjezwlwnw", model.properties().vmNics().get(0).recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.properties().vmNics().get(0).enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("cvydypatdoo", model.properties().vmNics().get(0).tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.properties().vmNics().get(0).enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("niodkooeb", model.properties().vmNics().get(0).recoveryNicName()); + Assertions.assertEquals("ujhemmsbvdkcrodt", model.properties().vmNics().get(0).recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.properties().vmNics().get(0).reuseExistingNic()); + Assertions.assertEquals("wj", model.properties().vmNics().get(0).tfoNicName()); + Assertions.assertEquals("lt", model.properties().vmNics().get(0).tfoNicResourceGroupName()); + Assertions.assertEquals(true, model.properties().vmNics().get(0).tfoReuseExistingNic()); + Assertions.assertEquals("vefkdlfoakggk", model.properties().vmNics().get(0).targetNicName()); + Assertions.assertEquals(LicenseType.NOT_SPECIFIED, model.properties().licenseType()); + Assertions.assertEquals("ao", model.properties().recoveryAvailabilitySetId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateReplicationProtectedItemProviderInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateReplicationProtectedItemProviderInputTests.java new file mode 100644 index 000000000000..6a89d10c7903 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateReplicationProtectedItemProviderInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateReplicationProtectedItemProviderInput; + +public final class UpdateReplicationProtectedItemProviderInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateReplicationProtectedItemProviderInput model = + BinaryData + .fromString("{\"instanceType\":\"UpdateReplicationProtectedItemProviderInput\"}") + .toObject(UpdateReplicationProtectedItemProviderInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateReplicationProtectedItemProviderInput model = new UpdateReplicationProtectedItemProviderInput(); + model = BinaryData.fromObject(model).toObject(UpdateReplicationProtectedItemProviderInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateVCenterRequestPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateVCenterRequestPropertiesTests.java new file mode 100644 index 000000000000..436c8802110c --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateVCenterRequestPropertiesTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateVCenterRequestProperties; +import org.junit.jupiter.api.Assertions; + +public final class UpdateVCenterRequestPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateVCenterRequestProperties model = + BinaryData + .fromString( + "{\"friendlyName\":\"whryvycytdcl\",\"ipAddress\":\"ccknfnwmbtmvp\",\"processServerId\":\"jdhttzaefedxi\",\"port\":\"hrphkmcrjdqn\",\"runAsAccountId\":\"fzpbgtgkyl\"}") + .toObject(UpdateVCenterRequestProperties.class); + Assertions.assertEquals("whryvycytdcl", model.friendlyName()); + Assertions.assertEquals("ccknfnwmbtmvp", model.ipAddress()); + Assertions.assertEquals("jdhttzaefedxi", model.processServerId()); + Assertions.assertEquals("hrphkmcrjdqn", model.port()); + Assertions.assertEquals("fzpbgtgkyl", model.runAsAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateVCenterRequestProperties model = + new UpdateVCenterRequestProperties() + .withFriendlyName("whryvycytdcl") + .withIpAddress("ccknfnwmbtmvp") + .withProcessServerId("jdhttzaefedxi") + .withPort("hrphkmcrjdqn") + .withRunAsAccountId("fzpbgtgkyl"); + model = BinaryData.fromObject(model).toObject(UpdateVCenterRequestProperties.class); + Assertions.assertEquals("whryvycytdcl", model.friendlyName()); + Assertions.assertEquals("ccknfnwmbtmvp", model.ipAddress()); + Assertions.assertEquals("jdhttzaefedxi", model.processServerId()); + Assertions.assertEquals("hrphkmcrjdqn", model.port()); + Assertions.assertEquals("fzpbgtgkyl", model.runAsAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateVCenterRequestTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateVCenterRequestTests.java new file mode 100644 index 000000000000..8c98c6f20ab6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/UpdateVCenterRequestTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateVCenterRequest; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.UpdateVCenterRequestProperties; +import org.junit.jupiter.api.Assertions; + +public final class UpdateVCenterRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateVCenterRequest model = + BinaryData + .fromString( + "{\"properties\":{\"friendlyName\":\"ytnrzvuljraae\",\"ipAddress\":\"nok\",\"processServerId\":\"ukkjqnvbroyla\",\"port\":\"ulcdisdosf\",\"runAsAccountId\":\"jsvg\"}}") + .toObject(UpdateVCenterRequest.class); + Assertions.assertEquals("ytnrzvuljraae", model.properties().friendlyName()); + Assertions.assertEquals("nok", model.properties().ipAddress()); + Assertions.assertEquals("ukkjqnvbroyla", model.properties().processServerId()); + Assertions.assertEquals("ulcdisdosf", model.properties().port()); + Assertions.assertEquals("jsvg", model.properties().runAsAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateVCenterRequest model = + new UpdateVCenterRequest() + .withProperties( + new UpdateVCenterRequestProperties() + .withFriendlyName("ytnrzvuljraae") + .withIpAddress("nok") + .withProcessServerId("ukkjqnvbroyla") + .withPort("ulcdisdosf") + .withRunAsAccountId("jsvg")); + model = BinaryData.fromObject(model).toObject(UpdateVCenterRequest.class); + Assertions.assertEquals("ytnrzvuljraae", model.properties().friendlyName()); + Assertions.assertEquals("nok", model.properties().ipAddress()); + Assertions.assertEquals("ukkjqnvbroyla", model.properties().processServerId()); + Assertions.assertEquals("ulcdisdosf", model.properties().port()); + Assertions.assertEquals("jsvg", model.properties().runAsAccountId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMNicDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMNicDetailsTests.java new file mode 100644 index 000000000000..752bb81c10eb --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMNicDetailsTests.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMNicDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VMNicDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMNicDetails model = + BinaryData + .fromString( + "{\"nicId\":\"cbhhez\",\"replicaNicId\":\"u\",\"sourceNicArmId\":\"sqxutr\",\"vMNetworkName\":\"rruyuu\",\"recoveryVMNetworkId\":\"vlm\",\"ipConfigs\":[{\"name\":\"ol\",\"isPrimary\":false,\"subnetName\":\"b\",\"staticIPAddress\":\"tpc\",\"ipAddressType\":\"hprzrvxhmtfho\",\"isSeletedForFailover\":true,\"recoverySubnetName\":\"cmj\",\"recoveryStaticIPAddress\":\"gxnoqrxtdis\",\"recoveryIPAddressType\":\"evhdlmydid\",\"recoveryPublicIPAddressId\":\"epfwwt\",\"recoveryLBBackendAddressPoolIds\":[\"o\",\"sxxh\",\"wcdbckyoik\"],\"tfoSubnetName\":\"xhn\",\"tfoStaticIPAddress\":\"knjz\",\"tfoPublicIPAddressId\":\"h\",\"tfoLBBackendAddressPoolIds\":[\"plvukaobrlbpg\"]},{\"name\":\"bagn\",\"isPrimary\":false,\"subnetName\":\"g\",\"staticIPAddress\":\"uowakyw\",\"ipAddressType\":\"hjym\",\"isSeletedForFailover\":false,\"recoverySubnetName\":\"tagdrc\",\"recoveryStaticIPAddress\":\"soljome\",\"recoveryIPAddressType\":\"fycnlb\",\"recoveryPublicIPAddressId\":\"jcodkkgjiiytssi\",\"recoveryLBBackendAddressPoolIds\":[\"bcufqbvntn\"],\"tfoSubnetName\":\"mqso\",\"tfoStaticIPAddress\":\"cekxgnly\",\"tfoPublicIPAddressId\":\"xcpwzvmdok\",\"tfoLBBackendAddressPoolIds\":[\"tiwlwxlboncqb\"]}],\"selectionType\":\"qicqchygt\",\"recoveryNetworkSecurityGroupId\":\"byjanep\",\"enableAcceleratedNetworkingOnRecovery\":false,\"tfoVMNetworkId\":\"kxyqvgxiaodetv\",\"tfoNetworkSecurityGroupId\":\"kxdxuwsaifmcwn\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"lehgcvkbc\",\"recoveryNicResourceGroupName\":\"jolgjyyxpvels\",\"reuseExistingNic\":false,\"tfoRecoveryNicName\":\"zevxoqein\",\"tfoRecoveryNicResourceGroupName\":\"waljglzoblqwaaf\",\"tfoReuseExistingNic\":false,\"targetNicName\":\"hmzyqbhdvafjrqpj\"}") + .toObject(VMNicDetails.class); + Assertions.assertEquals("cbhhez", model.nicId()); + Assertions.assertEquals("u", model.replicaNicId()); + Assertions.assertEquals("sqxutr", model.sourceNicArmId()); + Assertions.assertEquals("rruyuu", model.vMNetworkName()); + Assertions.assertEquals("vlm", model.recoveryVMNetworkId()); + Assertions.assertEquals("ol", model.ipConfigs().get(0).name()); + Assertions.assertEquals(false, model.ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("b", model.ipConfigs().get(0).subnetName()); + Assertions.assertEquals("tpc", model.ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("hprzrvxhmtfho", model.ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(true, model.ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("cmj", model.ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("gxnoqrxtdis", model.ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("evhdlmydid", model.ipConfigs().get(0).recoveryIpAddressType()); + Assertions.assertEquals("epfwwt", model.ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions.assertEquals("o", model.ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("xhn", model.ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("knjz", model.ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("h", model.ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("plvukaobrlbpg", model.ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("qicqchygt", model.selectionType()); + Assertions.assertEquals("byjanep", model.recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("kxyqvgxiaodetv", model.tfoVMNetworkId()); + Assertions.assertEquals("kxdxuwsaifmcwn", model.tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("lehgcvkbc", model.recoveryNicName()); + Assertions.assertEquals("jolgjyyxpvels", model.recoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.reuseExistingNic()); + Assertions.assertEquals("zevxoqein", model.tfoRecoveryNicName()); + Assertions.assertEquals("waljglzoblqwaaf", model.tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.tfoReuseExistingNic()); + Assertions.assertEquals("hmzyqbhdvafjrqpj", model.targetNicName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMNicDetails model = + new VMNicDetails() + .withNicId("cbhhez") + .withReplicaNicId("u") + .withSourceNicArmId("sqxutr") + .withVMNetworkName("rruyuu") + .withRecoveryVMNetworkId("vlm") + .withIpConfigs( + Arrays + .asList( + new IpConfigDetails() + .withName("ol") + .withIsPrimary(false) + .withSubnetName("b") + .withStaticIpAddress("tpc") + .withIpAddressType("hprzrvxhmtfho") + .withIsSeletedForFailover(true) + .withRecoverySubnetName("cmj") + .withRecoveryStaticIpAddress("gxnoqrxtdis") + .withRecoveryIpAddressType("evhdlmydid") + .withRecoveryPublicIpAddressId("epfwwt") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("o", "sxxh", "wcdbckyoik")) + .withTfoSubnetName("xhn") + .withTfoStaticIpAddress("knjz") + .withTfoPublicIpAddressId("h") + .withTfoLBBackendAddressPoolIds(Arrays.asList("plvukaobrlbpg")), + new IpConfigDetails() + .withName("bagn") + .withIsPrimary(false) + .withSubnetName("g") + .withStaticIpAddress("uowakyw") + .withIpAddressType("hjym") + .withIsSeletedForFailover(false) + .withRecoverySubnetName("tagdrc") + .withRecoveryStaticIpAddress("soljome") + .withRecoveryIpAddressType("fycnlb") + .withRecoveryPublicIpAddressId("jcodkkgjiiytssi") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("bcufqbvntn")) + .withTfoSubnetName("mqso") + .withTfoStaticIpAddress("cekxgnly") + .withTfoPublicIpAddressId("xcpwzvmdok") + .withTfoLBBackendAddressPoolIds(Arrays.asList("tiwlwxlboncqb")))) + .withSelectionType("qicqchygt") + .withRecoveryNetworkSecurityGroupId("byjanep") + .withEnableAcceleratedNetworkingOnRecovery(false) + .withTfoVMNetworkId("kxyqvgxiaodetv") + .withTfoNetworkSecurityGroupId("kxdxuwsaifmcwn") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("lehgcvkbc") + .withRecoveryNicResourceGroupName("jolgjyyxpvels") + .withReuseExistingNic(false) + .withTfoRecoveryNicName("zevxoqein") + .withTfoRecoveryNicResourceGroupName("waljglzoblqwaaf") + .withTfoReuseExistingNic(false) + .withTargetNicName("hmzyqbhdvafjrqpj"); + model = BinaryData.fromObject(model).toObject(VMNicDetails.class); + Assertions.assertEquals("cbhhez", model.nicId()); + Assertions.assertEquals("u", model.replicaNicId()); + Assertions.assertEquals("sqxutr", model.sourceNicArmId()); + Assertions.assertEquals("rruyuu", model.vMNetworkName()); + Assertions.assertEquals("vlm", model.recoveryVMNetworkId()); + Assertions.assertEquals("ol", model.ipConfigs().get(0).name()); + Assertions.assertEquals(false, model.ipConfigs().get(0).isPrimary()); + Assertions.assertEquals("b", model.ipConfigs().get(0).subnetName()); + Assertions.assertEquals("tpc", model.ipConfigs().get(0).staticIpAddress()); + Assertions.assertEquals("hprzrvxhmtfho", model.ipConfigs().get(0).ipAddressType()); + Assertions.assertEquals(true, model.ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("cmj", model.ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("gxnoqrxtdis", model.ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("evhdlmydid", model.ipConfigs().get(0).recoveryIpAddressType()); + Assertions.assertEquals("epfwwt", model.ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions.assertEquals("o", model.ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("xhn", model.ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("knjz", model.ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("h", model.ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("plvukaobrlbpg", model.ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("qicqchygt", model.selectionType()); + Assertions.assertEquals("byjanep", model.recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("kxyqvgxiaodetv", model.tfoVMNetworkId()); + Assertions.assertEquals("kxdxuwsaifmcwn", model.tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("lehgcvkbc", model.recoveryNicName()); + Assertions.assertEquals("jolgjyyxpvels", model.recoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.reuseExistingNic()); + Assertions.assertEquals("zevxoqein", model.tfoRecoveryNicName()); + Assertions.assertEquals("waljglzoblqwaaf", model.tfoRecoveryNicResourceGroupName()); + Assertions.assertEquals(false, model.tfoReuseExistingNic()); + Assertions.assertEquals("hmzyqbhdvafjrqpj", model.targetNicName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMNicInputDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMNicInputDetailsTests.java new file mode 100644 index 000000000000..8c32714ac5ef --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMNicInputDetailsTests.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.IpConfigInputDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMNicInputDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VMNicInputDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMNicInputDetails model = + BinaryData + .fromString( + "{\"nicId\":\"uq\",\"ipConfigs\":[{\"ipConfigName\":\"gzlvdnkfxu\",\"isPrimary\":true,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"rmuhapfcq\",\"recoveryStaticIPAddress\":\"sqxqvp\",\"recoveryPublicIPAddressId\":\"uoymgccelvezry\",\"recoveryLBBackendAddressPoolIds\":[\"mfe\",\"kerqwkyh\",\"ob\"],\"tfoSubnetName\":\"gxedkow\",\"tfoStaticIPAddress\":\"bqpc\",\"tfoPublicIPAddressId\":\"kbwcc\",\"tfoLBBackendAddressPoolIds\":[\"vcdwxlpqekftn\",\"htjsying\",\"fq\"]},{\"ipConfigName\":\"mtdh\",\"isPrimary\":true,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"gikdgsz\",\"recoveryStaticIPAddress\":\"kbir\",\"recoveryPublicIPAddressId\":\"uzhlhkjoqrv\",\"recoveryLBBackendAddressPoolIds\":[\"atjinrvgoupmfiib\",\"ggjioolvr\",\"x\",\"v\"],\"tfoSubnetName\":\"k\",\"tfoStaticIPAddress\":\"lqwjygvjayvblm\",\"tfoPublicIPAddressId\":\"k\",\"tfoLBBackendAddressPoolIds\":[\"bxvvyhg\",\"opbyrqufegxu\",\"wz\",\"bnhlmc\"]},{\"ipConfigName\":\"p\",\"isPrimary\":false,\"isSeletedForFailover\":true,\"recoverySubnetName\":\"gbmhrixkwmyi\",\"recoveryStaticIPAddress\":\"jvegrhbpnaixexcc\",\"recoveryPublicIPAddressId\":\"reaxhcexdr\",\"recoveryLBBackendAddressPoolIds\":[\"ahqkg\",\"tpwijnh\",\"jsvfycxzbfvoowv\",\"vmtgjqppy\"],\"tfoSubnetName\":\"tronzmyhgfi\",\"tfoStaticIPAddress\":\"sxkm\",\"tfoPublicIPAddressId\":\"a\",\"tfoLBBackendAddressPoolIds\":[\"rjreafxts\",\"umh\",\"glikkxwslolb\"]},{\"ipConfigName\":\"vuzlm\",\"isPrimary\":false,\"isSeletedForFailover\":false,\"recoverySubnetName\":\"tgp\",\"recoveryStaticIPAddress\":\"rpw\",\"recoveryPublicIPAddressId\":\"eznoig\",\"recoveryLBBackendAddressPoolIds\":[\"jwmwkpnbs\",\"zejjoqk\",\"gfhsxttaugzxn\",\"aa\"],\"tfoSubnetName\":\"xdtnkdmkqjjlw\",\"tfoStaticIPAddress\":\"nvrk\",\"tfoPublicIPAddressId\":\"ou\",\"tfoLBBackendAddressPoolIds\":[\"rebqaaysjk\"]}],\"selectionType\":\"qtnqtt\",\"recoveryNetworkSecurityGroupId\":\"lwfffi\",\"enableAcceleratedNetworkingOnRecovery\":true,\"tfoNetworkSecurityGroupId\":\"pqqmted\",\"enableAcceleratedNetworkingOnTfo\":false,\"recoveryNicName\":\"jihy\",\"recoveryNicResourceGroupName\":\"zphv\",\"reuseExistingNic\":true,\"tfoNicName\":\"qncygupkvi\",\"tfoNicResourceGroupName\":\"dscwxqupevzhf\",\"tfoReuseExistingNic\":true,\"targetNicName\":\"xhojuj\"}") + .toObject(VMNicInputDetails.class); + Assertions.assertEquals("uq", model.nicId()); + Assertions.assertEquals("gzlvdnkfxu", model.ipConfigs().get(0).ipConfigName()); + Assertions.assertEquals(true, model.ipConfigs().get(0).isPrimary()); + Assertions.assertEquals(false, model.ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("rmuhapfcq", model.ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("sqxqvp", model.ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("uoymgccelvezry", model.ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions.assertEquals("mfe", model.ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("gxedkow", model.ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("bqpc", model.ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("kbwcc", model.ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("vcdwxlpqekftn", model.ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("qtnqtt", model.selectionType()); + Assertions.assertEquals("lwfffi", model.recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(true, model.enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("pqqmted", model.tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("jihy", model.recoveryNicName()); + Assertions.assertEquals("zphv", model.recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.reuseExistingNic()); + Assertions.assertEquals("qncygupkvi", model.tfoNicName()); + Assertions.assertEquals("dscwxqupevzhf", model.tfoNicResourceGroupName()); + Assertions.assertEquals(true, model.tfoReuseExistingNic()); + Assertions.assertEquals("xhojuj", model.targetNicName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMNicInputDetails model = + new VMNicInputDetails() + .withNicId("uq") + .withIpConfigs( + Arrays + .asList( + new IpConfigInputDetails() + .withIpConfigName("gzlvdnkfxu") + .withIsPrimary(true) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("rmuhapfcq") + .withRecoveryStaticIpAddress("sqxqvp") + .withRecoveryPublicIpAddressId("uoymgccelvezry") + .withRecoveryLBBackendAddressPoolIds(Arrays.asList("mfe", "kerqwkyh", "ob")) + .withTfoSubnetName("gxedkow") + .withTfoStaticIpAddress("bqpc") + .withTfoPublicIpAddressId("kbwcc") + .withTfoLBBackendAddressPoolIds(Arrays.asList("vcdwxlpqekftn", "htjsying", "fq")), + new IpConfigInputDetails() + .withIpConfigName("mtdh") + .withIsPrimary(true) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("gikdgsz") + .withRecoveryStaticIpAddress("kbir") + .withRecoveryPublicIpAddressId("uzhlhkjoqrv") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("atjinrvgoupmfiib", "ggjioolvr", "x", "v")) + .withTfoSubnetName("k") + .withTfoStaticIpAddress("lqwjygvjayvblm") + .withTfoPublicIpAddressId("k") + .withTfoLBBackendAddressPoolIds( + Arrays.asList("bxvvyhg", "opbyrqufegxu", "wz", "bnhlmc")), + new IpConfigInputDetails() + .withIpConfigName("p") + .withIsPrimary(false) + .withIsSeletedForFailover(true) + .withRecoverySubnetName("gbmhrixkwmyi") + .withRecoveryStaticIpAddress("jvegrhbpnaixexcc") + .withRecoveryPublicIpAddressId("reaxhcexdr") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("ahqkg", "tpwijnh", "jsvfycxzbfvoowv", "vmtgjqppy")) + .withTfoSubnetName("tronzmyhgfi") + .withTfoStaticIpAddress("sxkm") + .withTfoPublicIpAddressId("a") + .withTfoLBBackendAddressPoolIds(Arrays.asList("rjreafxts", "umh", "glikkxwslolb")), + new IpConfigInputDetails() + .withIpConfigName("vuzlm") + .withIsPrimary(false) + .withIsSeletedForFailover(false) + .withRecoverySubnetName("tgp") + .withRecoveryStaticIpAddress("rpw") + .withRecoveryPublicIpAddressId("eznoig") + .withRecoveryLBBackendAddressPoolIds( + Arrays.asList("jwmwkpnbs", "zejjoqk", "gfhsxttaugzxn", "aa")) + .withTfoSubnetName("xdtnkdmkqjjlw") + .withTfoStaticIpAddress("nvrk") + .withTfoPublicIpAddressId("ou") + .withTfoLBBackendAddressPoolIds(Arrays.asList("rebqaaysjk")))) + .withSelectionType("qtnqtt") + .withRecoveryNetworkSecurityGroupId("lwfffi") + .withEnableAcceleratedNetworkingOnRecovery(true) + .withTfoNetworkSecurityGroupId("pqqmted") + .withEnableAcceleratedNetworkingOnTfo(false) + .withRecoveryNicName("jihy") + .withRecoveryNicResourceGroupName("zphv") + .withReuseExistingNic(true) + .withTfoNicName("qncygupkvi") + .withTfoNicResourceGroupName("dscwxqupevzhf") + .withTfoReuseExistingNic(true) + .withTargetNicName("xhojuj"); + model = BinaryData.fromObject(model).toObject(VMNicInputDetails.class); + Assertions.assertEquals("uq", model.nicId()); + Assertions.assertEquals("gzlvdnkfxu", model.ipConfigs().get(0).ipConfigName()); + Assertions.assertEquals(true, model.ipConfigs().get(0).isPrimary()); + Assertions.assertEquals(false, model.ipConfigs().get(0).isSeletedForFailover()); + Assertions.assertEquals("rmuhapfcq", model.ipConfigs().get(0).recoverySubnetName()); + Assertions.assertEquals("sqxqvp", model.ipConfigs().get(0).recoveryStaticIpAddress()); + Assertions.assertEquals("uoymgccelvezry", model.ipConfigs().get(0).recoveryPublicIpAddressId()); + Assertions.assertEquals("mfe", model.ipConfigs().get(0).recoveryLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("gxedkow", model.ipConfigs().get(0).tfoSubnetName()); + Assertions.assertEquals("bqpc", model.ipConfigs().get(0).tfoStaticIpAddress()); + Assertions.assertEquals("kbwcc", model.ipConfigs().get(0).tfoPublicIpAddressId()); + Assertions.assertEquals("vcdwxlpqekftn", model.ipConfigs().get(0).tfoLBBackendAddressPoolIds().get(0)); + Assertions.assertEquals("qtnqtt", model.selectionType()); + Assertions.assertEquals("lwfffi", model.recoveryNetworkSecurityGroupId()); + Assertions.assertEquals(true, model.enableAcceleratedNetworkingOnRecovery()); + Assertions.assertEquals("pqqmted", model.tfoNetworkSecurityGroupId()); + Assertions.assertEquals(false, model.enableAcceleratedNetworkingOnTfo()); + Assertions.assertEquals("jihy", model.recoveryNicName()); + Assertions.assertEquals("zphv", model.recoveryNicResourceGroupName()); + Assertions.assertEquals(true, model.reuseExistingNic()); + Assertions.assertEquals("qncygupkvi", model.tfoNicName()); + Assertions.assertEquals("dscwxqupevzhf", model.tfoNicResourceGroupName()); + Assertions.assertEquals(true, model.tfoReuseExistingNic()); + Assertions.assertEquals("xhojuj", model.targetNicName()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtContainerCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtContainerCreationInputTests.java new file mode 100644 index 000000000000..c6fb09fa8dc7 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtContainerCreationInputTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtContainerCreationInput; + +public final class VMwareCbtContainerCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtContainerCreationInput model = + BinaryData.fromString("{\"instanceType\":\"VMwareCbt\"}").toObject(VMwareCbtContainerCreationInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtContainerCreationInput model = new VMwareCbtContainerCreationInput(); + model = BinaryData.fromObject(model).toObject(VMwareCbtContainerCreationInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtEventDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtEventDetailsTests.java new file mode 100644 index 000000000000..09167ee1bc23 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtEventDetailsTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtEventDetails; + +public final class VMwareCbtEventDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtEventDetails model = + BinaryData + .fromString("{\"instanceType\":\"VMwareCbt\",\"migrationItemName\":\"rnxhjtlxfikjk\"}") + .toObject(VMwareCbtEventDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtEventDetails model = new VMwareCbtEventDetails(); + model = BinaryData.fromObject(model).toObject(VMwareCbtEventDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtMigrateInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtMigrateInputTests.java new file mode 100644 index 000000000000..4f1d82d14ac9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtMigrateInputTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtMigrateInput; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtMigrateInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtMigrateInput model = + BinaryData + .fromString( + "{\"instanceType\":\"VMwareCbt\",\"performShutdown\":\"ara\",\"osUpgradeVersion\":\"wuasnjeglhtrx\"}") + .toObject(VMwareCbtMigrateInput.class); + Assertions.assertEquals("ara", model.performShutdown()); + Assertions.assertEquals("wuasnjeglhtrx", model.osUpgradeVersion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtMigrateInput model = + new VMwareCbtMigrateInput().withPerformShutdown("ara").withOsUpgradeVersion("wuasnjeglhtrx"); + model = BinaryData.fromObject(model).toObject(VMwareCbtMigrateInput.class); + Assertions.assertEquals("ara", model.performShutdown()); + Assertions.assertEquals("wuasnjeglhtrx", model.osUpgradeVersion()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtNicDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtNicDetailsTests.java new file mode 100644 index 000000000000..bc47ec57e58e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtNicDetailsTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.EthernetAddressType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtNicDetails; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtNicDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtNicDetails model = + BinaryData + .fromString( + "{\"nicId\":\"ylcvwbzmfx\",\"isPrimaryNic\":\"ymfjxl\",\"sourceIPAddress\":\"ywqnpfyd\",\"sourceIPAddressType\":\"Static\",\"sourceNetworkId\":\"cnyxbyx\",\"targetIPAddress\":\"hmqyncgaullfstyy\",\"targetIPAddressType\":\"Dynamic\",\"targetSubnetName\":\"ulmwqgmhmqmiwx\",\"testNetworkId\":\"v\",\"testSubnetName\":\"ucqfgufjnbxwbm\",\"testIPAddress\":\"ukin\",\"testIPAddressType\":\"Dynamic\",\"targetNicName\":\"gde\",\"isSelectedForMigration\":\"kzou\"}") + .toObject(VMwareCbtNicDetails.class); + Assertions.assertEquals("ymfjxl", model.isPrimaryNic()); + Assertions.assertEquals("hmqyncgaullfstyy", model.targetIpAddress()); + Assertions.assertEquals(EthernetAddressType.DYNAMIC, model.targetIpAddressType()); + Assertions.assertEquals("ulmwqgmhmqmiwx", model.targetSubnetName()); + Assertions.assertEquals("v", model.testNetworkId()); + Assertions.assertEquals("ucqfgufjnbxwbm", model.testSubnetName()); + Assertions.assertEquals("ukin", model.testIpAddress()); + Assertions.assertEquals(EthernetAddressType.DYNAMIC, model.testIpAddressType()); + Assertions.assertEquals("gde", model.targetNicName()); + Assertions.assertEquals("kzou", model.isSelectedForMigration()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtNicDetails model = + new VMwareCbtNicDetails() + .withIsPrimaryNic("ymfjxl") + .withTargetIpAddress("hmqyncgaullfstyy") + .withTargetIpAddressType(EthernetAddressType.DYNAMIC) + .withTargetSubnetName("ulmwqgmhmqmiwx") + .withTestNetworkId("v") + .withTestSubnetName("ucqfgufjnbxwbm") + .withTestIpAddress("ukin") + .withTestIpAddressType(EthernetAddressType.DYNAMIC) + .withTargetNicName("gde") + .withIsSelectedForMigration("kzou"); + model = BinaryData.fromObject(model).toObject(VMwareCbtNicDetails.class); + Assertions.assertEquals("ymfjxl", model.isPrimaryNic()); + Assertions.assertEquals("hmqyncgaullfstyy", model.targetIpAddress()); + Assertions.assertEquals(EthernetAddressType.DYNAMIC, model.targetIpAddressType()); + Assertions.assertEquals("ulmwqgmhmqmiwx", model.targetSubnetName()); + Assertions.assertEquals("v", model.testNetworkId()); + Assertions.assertEquals("ucqfgufjnbxwbm", model.testSubnetName()); + Assertions.assertEquals("ukin", model.testIpAddress()); + Assertions.assertEquals(EthernetAddressType.DYNAMIC, model.testIpAddressType()); + Assertions.assertEquals("gde", model.targetNicName()); + Assertions.assertEquals("kzou", model.isSelectedForMigration()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtNicInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtNicInputTests.java new file mode 100644 index 000000000000..a9e0243db2fc --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtNicInputTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtNicInput; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtNicInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtNicInput model = + BinaryData + .fromString( + "{\"nicId\":\"vewwpzrdwcgldo\",\"isPrimaryNic\":\"gcandxfhhhtes\",\"targetSubnetName\":\"qtdn\",\"targetStaticIPAddress\":\"kkpljdsh\",\"isSelectedForMigration\":\"fkdxccyijjimhi\",\"targetNicName\":\"rqnjxmvvsduydwnw\",\"testSubnetName\":\"uhhqldrdymnswxie\",\"testStaticIPAddress\":\"wqnghxnimvyuj\"}") + .toObject(VMwareCbtNicInput.class); + Assertions.assertEquals("vewwpzrdwcgldo", model.nicId()); + Assertions.assertEquals("gcandxfhhhtes", model.isPrimaryNic()); + Assertions.assertEquals("qtdn", model.targetSubnetName()); + Assertions.assertEquals("kkpljdsh", model.targetStaticIpAddress()); + Assertions.assertEquals("fkdxccyijjimhi", model.isSelectedForMigration()); + Assertions.assertEquals("rqnjxmvvsduydwnw", model.targetNicName()); + Assertions.assertEquals("uhhqldrdymnswxie", model.testSubnetName()); + Assertions.assertEquals("wqnghxnimvyuj", model.testStaticIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtNicInput model = + new VMwareCbtNicInput() + .withNicId("vewwpzrdwcgldo") + .withIsPrimaryNic("gcandxfhhhtes") + .withTargetSubnetName("qtdn") + .withTargetStaticIpAddress("kkpljdsh") + .withIsSelectedForMigration("fkdxccyijjimhi") + .withTargetNicName("rqnjxmvvsduydwnw") + .withTestSubnetName("uhhqldrdymnswxie") + .withTestStaticIpAddress("wqnghxnimvyuj"); + model = BinaryData.fromObject(model).toObject(VMwareCbtNicInput.class); + Assertions.assertEquals("vewwpzrdwcgldo", model.nicId()); + Assertions.assertEquals("gcandxfhhhtes", model.isPrimaryNic()); + Assertions.assertEquals("qtdn", model.targetSubnetName()); + Assertions.assertEquals("kkpljdsh", model.targetStaticIpAddress()); + Assertions.assertEquals("fkdxccyijjimhi", model.isSelectedForMigration()); + Assertions.assertEquals("rqnjxmvvsduydwnw", model.targetNicName()); + Assertions.assertEquals("uhhqldrdymnswxie", model.testSubnetName()); + Assertions.assertEquals("wqnghxnimvyuj", model.testStaticIpAddress()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtPolicyCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtPolicyCreationInputTests.java new file mode 100644 index 000000000000..eaab70482fbf --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtPolicyCreationInputTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtPolicyCreationInput; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtPolicyCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtPolicyCreationInput model = + BinaryData + .fromString( + "{\"instanceType\":\"VMwareCbt\",\"recoveryPointHistoryInMinutes\":743891586,\"crashConsistentFrequencyInMinutes\":1861127701,\"appConsistentFrequencyInMinutes\":746704454}") + .toObject(VMwareCbtPolicyCreationInput.class); + Assertions.assertEquals(743891586, model.recoveryPointHistoryInMinutes()); + Assertions.assertEquals(1861127701, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(746704454, model.appConsistentFrequencyInMinutes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtPolicyCreationInput model = + new VMwareCbtPolicyCreationInput() + .withRecoveryPointHistoryInMinutes(743891586) + .withCrashConsistentFrequencyInMinutes(1861127701) + .withAppConsistentFrequencyInMinutes(746704454); + model = BinaryData.fromObject(model).toObject(VMwareCbtPolicyCreationInput.class); + Assertions.assertEquals(743891586, model.recoveryPointHistoryInMinutes()); + Assertions.assertEquals(1861127701, model.crashConsistentFrequencyInMinutes()); + Assertions.assertEquals(746704454, model.appConsistentFrequencyInMinutes()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtResumeReplicationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtResumeReplicationInputTests.java new file mode 100644 index 000000000000..7febd8692948 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtResumeReplicationInputTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtResumeReplicationInput; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtResumeReplicationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtResumeReplicationInput model = + BinaryData + .fromString("{\"instanceType\":\"VMwareCbt\",\"deleteMigrationResources\":\"ebsnz\"}") + .toObject(VMwareCbtResumeReplicationInput.class); + Assertions.assertEquals("ebsnz", model.deleteMigrationResources()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtResumeReplicationInput model = + new VMwareCbtResumeReplicationInput().withDeleteMigrationResources("ebsnz"); + model = BinaryData.fromObject(model).toObject(VMwareCbtResumeReplicationInput.class); + Assertions.assertEquals("ebsnz", model.deleteMigrationResources()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtResyncInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtResyncInputTests.java new file mode 100644 index 000000000000..0e3279312d6a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtResyncInputTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtResyncInput; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtResyncInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtResyncInput model = + BinaryData + .fromString("{\"instanceType\":\"VMwareCbt\",\"skipCbtReset\":\"wgsqufmjxcyoseqc\"}") + .toObject(VMwareCbtResyncInput.class); + Assertions.assertEquals("wgsqufmjxcyoseqc", model.skipCbtReset()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtResyncInput model = new VMwareCbtResyncInput().withSkipCbtReset("wgsqufmjxcyoseqc"); + model = BinaryData.fromObject(model).toObject(VMwareCbtResyncInput.class); + Assertions.assertEquals("wgsqufmjxcyoseqc", model.skipCbtReset()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtSecurityProfilePropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtSecurityProfilePropertiesTests.java new file mode 100644 index 000000000000..7a63eb978b5e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtSecurityProfilePropertiesTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SecurityType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtSecurityProfileProperties; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtSecurityProfilePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtSecurityProfileProperties model = + BinaryData + .fromString( + "{\"targetVmSecurityType\":\"None\",\"isTargetVmSecureBootEnabled\":\"ennqfabqca\",\"isTargetVmTpmEnabled\":\"lectcxsfmb\",\"isTargetVmIntegrityMonitoringEnabled\":\"xmsynbkd\",\"isTargetVmConfidentialEncryptionEnabled\":\"yufxuzmsvzyq\"}") + .toObject(VMwareCbtSecurityProfileProperties.class); + Assertions.assertEquals(SecurityType.NONE, model.targetVmSecurityType()); + Assertions.assertEquals("ennqfabqca", model.isTargetVmSecureBootEnabled()); + Assertions.assertEquals("lectcxsfmb", model.isTargetVmTpmEnabled()); + Assertions.assertEquals("xmsynbkd", model.isTargetVmIntegrityMonitoringEnabled()); + Assertions.assertEquals("yufxuzmsvzyq", model.isTargetVmConfidentialEncryptionEnabled()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtSecurityProfileProperties model = + new VMwareCbtSecurityProfileProperties() + .withTargetVmSecurityType(SecurityType.NONE) + .withIsTargetVmSecureBootEnabled("ennqfabqca") + .withIsTargetVmTpmEnabled("lectcxsfmb") + .withIsTargetVmIntegrityMonitoringEnabled("xmsynbkd") + .withIsTargetVmConfidentialEncryptionEnabled("yufxuzmsvzyq"); + model = BinaryData.fromObject(model).toObject(VMwareCbtSecurityProfileProperties.class); + Assertions.assertEquals(SecurityType.NONE, model.targetVmSecurityType()); + Assertions.assertEquals("ennqfabqca", model.isTargetVmSecureBootEnabled()); + Assertions.assertEquals("lectcxsfmb", model.isTargetVmTpmEnabled()); + Assertions.assertEquals("xmsynbkd", model.isTargetVmIntegrityMonitoringEnabled()); + Assertions.assertEquals("yufxuzmsvzyq", model.isTargetVmConfidentialEncryptionEnabled()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtTestMigrateInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtTestMigrateInputTests.java new file mode 100644 index 000000000000..0e1b93d4e8db --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtTestMigrateInputTests.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtNicInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtTestMigrateInput; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtTestMigrateInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtTestMigrateInput model = + BinaryData + .fromString( + "{\"instanceType\":\"VMwareCbt\",\"recoveryPointId\":\"zisvbrqgcyjpgaw\",\"networkId\":\"pkwonrzpghlr\",\"vmNics\":[{\"nicId\":\"gblxbu\",\"isPrimaryNic\":\"brvjztaflv\",\"targetSubnetName\":\"fjihvfjcqrttjfuq\",\"targetStaticIPAddress\":\"fjewfeqbavdo\",\"isSelectedForMigration\":\"wy\",\"targetNicName\":\"fm\",\"testSubnetName\":\"lvxgwzz\",\"testStaticIPAddress\":\"dtlcjgpvcqzv\"},{\"nicId\":\"rbvgwxhlxr\",\"isPrimaryNic\":\"xvmdr\",\"targetSubnetName\":\"n\",\"targetStaticIPAddress\":\"ovazoymdvhhpl\",\"isSelectedForMigration\":\"wwd\",\"targetNicName\":\"tveqmg\",\"testSubnetName\":\"swzeyxry\",\"testStaticIPAddress\":\"r\"},{\"nicId\":\"hpwbuklvsmfasgt\",\"isPrimaryNic\":\"v\",\"targetSubnetName\":\"poil\",\"targetStaticIPAddress\":\"ja\",\"isSelectedForMigration\":\"cez\",\"targetNicName\":\"ft\",\"testSubnetName\":\"l\",\"testStaticIPAddress\":\"okjyghzt\"},{\"nicId\":\"smiwtpcflc\",\"isPrimaryNic\":\"zswwvwi\",\"targetSubnetName\":\"djtvbf\",\"targetStaticIPAddress\":\"hruptsyq\",\"isSelectedForMigration\":\"nqswxdowumxquk\",\"targetNicName\":\"diohclqddn\",\"testSubnetName\":\"k\",\"testStaticIPAddress\":\"bweddpnyzc\"}],\"osUpgradeVersion\":\"jsmka\"}") + .toObject(VMwareCbtTestMigrateInput.class); + Assertions.assertEquals("zisvbrqgcyjpgaw", model.recoveryPointId()); + Assertions.assertEquals("pkwonrzpghlr", model.networkId()); + Assertions.assertEquals("gblxbu", model.vmNics().get(0).nicId()); + Assertions.assertEquals("brvjztaflv", model.vmNics().get(0).isPrimaryNic()); + Assertions.assertEquals("fjihvfjcqrttjfuq", model.vmNics().get(0).targetSubnetName()); + Assertions.assertEquals("fjewfeqbavdo", model.vmNics().get(0).targetStaticIpAddress()); + Assertions.assertEquals("wy", model.vmNics().get(0).isSelectedForMigration()); + Assertions.assertEquals("fm", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("lvxgwzz", model.vmNics().get(0).testSubnetName()); + Assertions.assertEquals("dtlcjgpvcqzv", model.vmNics().get(0).testStaticIpAddress()); + Assertions.assertEquals("jsmka", model.osUpgradeVersion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtTestMigrateInput model = + new VMwareCbtTestMigrateInput() + .withRecoveryPointId("zisvbrqgcyjpgaw") + .withNetworkId("pkwonrzpghlr") + .withVmNics( + Arrays + .asList( + new VMwareCbtNicInput() + .withNicId("gblxbu") + .withIsPrimaryNic("brvjztaflv") + .withTargetSubnetName("fjihvfjcqrttjfuq") + .withTargetStaticIpAddress("fjewfeqbavdo") + .withIsSelectedForMigration("wy") + .withTargetNicName("fm") + .withTestSubnetName("lvxgwzz") + .withTestStaticIpAddress("dtlcjgpvcqzv"), + new VMwareCbtNicInput() + .withNicId("rbvgwxhlxr") + .withIsPrimaryNic("xvmdr") + .withTargetSubnetName("n") + .withTargetStaticIpAddress("ovazoymdvhhpl") + .withIsSelectedForMigration("wwd") + .withTargetNicName("tveqmg") + .withTestSubnetName("swzeyxry") + .withTestStaticIpAddress("r"), + new VMwareCbtNicInput() + .withNicId("hpwbuklvsmfasgt") + .withIsPrimaryNic("v") + .withTargetSubnetName("poil") + .withTargetStaticIpAddress("ja") + .withIsSelectedForMigration("cez") + .withTargetNicName("ft") + .withTestSubnetName("l") + .withTestStaticIpAddress("okjyghzt"), + new VMwareCbtNicInput() + .withNicId("smiwtpcflc") + .withIsPrimaryNic("zswwvwi") + .withTargetSubnetName("djtvbf") + .withTargetStaticIpAddress("hruptsyq") + .withIsSelectedForMigration("nqswxdowumxquk") + .withTargetNicName("diohclqddn") + .withTestSubnetName("k") + .withTestStaticIpAddress("bweddpnyzc"))) + .withOsUpgradeVersion("jsmka"); + model = BinaryData.fromObject(model).toObject(VMwareCbtTestMigrateInput.class); + Assertions.assertEquals("zisvbrqgcyjpgaw", model.recoveryPointId()); + Assertions.assertEquals("pkwonrzpghlr", model.networkId()); + Assertions.assertEquals("gblxbu", model.vmNics().get(0).nicId()); + Assertions.assertEquals("brvjztaflv", model.vmNics().get(0).isPrimaryNic()); + Assertions.assertEquals("fjihvfjcqrttjfuq", model.vmNics().get(0).targetSubnetName()); + Assertions.assertEquals("fjewfeqbavdo", model.vmNics().get(0).targetStaticIpAddress()); + Assertions.assertEquals("wy", model.vmNics().get(0).isSelectedForMigration()); + Assertions.assertEquals("fm", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("lvxgwzz", model.vmNics().get(0).testSubnetName()); + Assertions.assertEquals("dtlcjgpvcqzv", model.vmNics().get(0).testStaticIpAddress()); + Assertions.assertEquals("jsmka", model.osUpgradeVersion()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtUpdateDiskInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtUpdateDiskInputTests.java new file mode 100644 index 000000000000..8490b0eb96db --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtUpdateDiskInputTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtUpdateDiskInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtUpdateDiskInput model = + BinaryData + .fromString("{\"diskId\":\"ld\",\"targetDiskName\":\"bnwvpaq\",\"isOSDisk\":\"xf\"}") + .toObject(VMwareCbtUpdateDiskInput.class); + Assertions.assertEquals("ld", model.diskId()); + Assertions.assertEquals("bnwvpaq", model.targetDiskName()); + Assertions.assertEquals("xf", model.isOSDisk()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtUpdateDiskInput model = + new VMwareCbtUpdateDiskInput().withDiskId("ld").withTargetDiskName("bnwvpaq").withIsOSDisk("xf"); + model = BinaryData.fromObject(model).toObject(VMwareCbtUpdateDiskInput.class); + Assertions.assertEquals("ld", model.diskId()); + Assertions.assertEquals("bnwvpaq", model.targetDiskName()); + Assertions.assertEquals("xf", model.isOSDisk()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtUpdateMigrationItemInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtUpdateMigrationItemInputTests.java new file mode 100644 index 000000000000..2a92ed281a8e --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareCbtUpdateMigrationItemInputTests.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.LicenseType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.SqlServerLicenseType; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtNicInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtUpdateDiskInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareCbtUpdateMigrationItemInput; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class VMwareCbtUpdateMigrationItemInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareCbtUpdateMigrationItemInput model = + BinaryData + .fromString( + "{\"instanceType\":\"VMwareCbt\",\"targetVmName\":\"igcfddofxnf\",\"targetVmSize\":\"jyyrqaedw\",\"targetResourceGroupId\":\"ocytjgoeayokrw\",\"targetAvailabilitySetId\":\"ihwpadhedbfobd\",\"targetAvailabilityZone\":\"vothmkhjaoz\",\"targetProximityPlacementGroupId\":\"wfcn\",\"targetBootDiagnosticsStorageAccountId\":\"bpoelhscmyhrhjv\",\"targetNetworkId\":\"fqbokndwp\",\"testNetworkId\":\"qwojoev\",\"vmNics\":[{\"nicId\":\"fytdxmly\",\"isPrimaryNic\":\"zlyvapbkrbuog\",\"targetSubnetName\":\"dltlcu\",\"targetStaticIPAddress\":\"izij\",\"isSelectedForMigration\":\"ylzeohlpsftq\",\"targetNicName\":\"vmhvbvvcpwtqs\",\"testSubnetName\":\"pnhmzy\",\"testStaticIPAddress\":\"fetev\"},{\"nicId\":\"ntfknwacycsyo\",\"isPrimaryNic\":\"ctkhfh\",\"targetSubnetName\":\"atvcsxr\",\"targetStaticIPAddress\":\"nmizhv\",\"isSelectedForMigration\":\"hqqwcubl\",\"targetNicName\":\"hk\",\"testSubnetName\":\"obzgott\",\"testStaticIPAddress\":\"sadzighmmtb\"},{\"nicId\":\"dvucfvvra\",\"isPrimaryNic\":\"beurdeewl\",\"targetSubnetName\":\"xpcbwkdwjyjizn\",\"targetStaticIPAddress\":\"roo\",\"isSelectedForMigration\":\"ftaspmcr\",\"targetNicName\":\"huf\",\"testSubnetName\":\"n\",\"testStaticIPAddress\":\"hminuwqxungrobgw\"}],\"vmDisks\":[{\"diskId\":\"xjwdylwxmvzjow\",\"targetDiskName\":\"geerclbl\",\"isOSDisk\":\"hpwachyeu\"},{\"diskId\":\"jwmvwryvdi\",\"targetDiskName\":\"ii\",\"isOSDisk\":\"pruccwme\"}],\"licenseType\":\"NotSpecified\",\"sqlServerLicenseType\":\"NotSpecified\",\"performAutoResync\":\"trtexegwm\",\"targetVmTags\":{\"loqkajwjuri\":\"ywiwhvycfjncind\",\"anhz\":\"rsbcl\",\"zkz\":\"knjxizbaxdy\"},\"targetDiskTags\":{\"wacyyjmlxppdndzk\":\"e\",\"cizeqqfopvnopm\":\"evuiiuiibfkcjytq\"},\"targetNicTags\":{\"zyfbkmvldzmxojz\":\"sfhoxqlyo\"}}") + .toObject(VMwareCbtUpdateMigrationItemInput.class); + Assertions.assertEquals("igcfddofxnf", model.targetVmName()); + Assertions.assertEquals("jyyrqaedw", model.targetVmSize()); + Assertions.assertEquals("ocytjgoeayokrw", model.targetResourceGroupId()); + Assertions.assertEquals("ihwpadhedbfobd", model.targetAvailabilitySetId()); + Assertions.assertEquals("vothmkhjaoz", model.targetAvailabilityZone()); + Assertions.assertEquals("wfcn", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("bpoelhscmyhrhjv", model.targetBootDiagnosticsStorageAccountId()); + Assertions.assertEquals("fqbokndwp", model.targetNetworkId()); + Assertions.assertEquals("qwojoev", model.testNetworkId()); + Assertions.assertEquals("fytdxmly", model.vmNics().get(0).nicId()); + Assertions.assertEquals("zlyvapbkrbuog", model.vmNics().get(0).isPrimaryNic()); + Assertions.assertEquals("dltlcu", model.vmNics().get(0).targetSubnetName()); + Assertions.assertEquals("izij", model.vmNics().get(0).targetStaticIpAddress()); + Assertions.assertEquals("ylzeohlpsftq", model.vmNics().get(0).isSelectedForMigration()); + Assertions.assertEquals("vmhvbvvcpwtqs", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("pnhmzy", model.vmNics().get(0).testSubnetName()); + Assertions.assertEquals("fetev", model.vmNics().get(0).testStaticIpAddress()); + Assertions.assertEquals("xjwdylwxmvzjow", model.vmDisks().get(0).diskId()); + Assertions.assertEquals("geerclbl", model.vmDisks().get(0).targetDiskName()); + Assertions.assertEquals("hpwachyeu", model.vmDisks().get(0).isOSDisk()); + Assertions.assertEquals(LicenseType.NOT_SPECIFIED, model.licenseType()); + Assertions.assertEquals(SqlServerLicenseType.NOT_SPECIFIED, model.sqlServerLicenseType()); + Assertions.assertEquals("trtexegwm", model.performAutoResync()); + Assertions.assertEquals("ywiwhvycfjncind", model.targetVmTags().get("loqkajwjuri")); + Assertions.assertEquals("e", model.targetDiskTags().get("wacyyjmlxppdndzk")); + Assertions.assertEquals("sfhoxqlyo", model.targetNicTags().get("zyfbkmvldzmxojz")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareCbtUpdateMigrationItemInput model = + new VMwareCbtUpdateMigrationItemInput() + .withTargetVmName("igcfddofxnf") + .withTargetVmSize("jyyrqaedw") + .withTargetResourceGroupId("ocytjgoeayokrw") + .withTargetAvailabilitySetId("ihwpadhedbfobd") + .withTargetAvailabilityZone("vothmkhjaoz") + .withTargetProximityPlacementGroupId("wfcn") + .withTargetBootDiagnosticsStorageAccountId("bpoelhscmyhrhjv") + .withTargetNetworkId("fqbokndwp") + .withTestNetworkId("qwojoev") + .withVmNics( + Arrays + .asList( + new VMwareCbtNicInput() + .withNicId("fytdxmly") + .withIsPrimaryNic("zlyvapbkrbuog") + .withTargetSubnetName("dltlcu") + .withTargetStaticIpAddress("izij") + .withIsSelectedForMigration("ylzeohlpsftq") + .withTargetNicName("vmhvbvvcpwtqs") + .withTestSubnetName("pnhmzy") + .withTestStaticIpAddress("fetev"), + new VMwareCbtNicInput() + .withNicId("ntfknwacycsyo") + .withIsPrimaryNic("ctkhfh") + .withTargetSubnetName("atvcsxr") + .withTargetStaticIpAddress("nmizhv") + .withIsSelectedForMigration("hqqwcubl") + .withTargetNicName("hk") + .withTestSubnetName("obzgott") + .withTestStaticIpAddress("sadzighmmtb"), + new VMwareCbtNicInput() + .withNicId("dvucfvvra") + .withIsPrimaryNic("beurdeewl") + .withTargetSubnetName("xpcbwkdwjyjizn") + .withTargetStaticIpAddress("roo") + .withIsSelectedForMigration("ftaspmcr") + .withTargetNicName("huf") + .withTestSubnetName("n") + .withTestStaticIpAddress("hminuwqxungrobgw"))) + .withVmDisks( + Arrays + .asList( + new VMwareCbtUpdateDiskInput() + .withDiskId("xjwdylwxmvzjow") + .withTargetDiskName("geerclbl") + .withIsOSDisk("hpwachyeu"), + new VMwareCbtUpdateDiskInput() + .withDiskId("jwmvwryvdi") + .withTargetDiskName("ii") + .withIsOSDisk("pruccwme"))) + .withLicenseType(LicenseType.NOT_SPECIFIED) + .withSqlServerLicenseType(SqlServerLicenseType.NOT_SPECIFIED) + .withPerformAutoResync("trtexegwm") + .withTargetVmTags(mapOf("loqkajwjuri", "ywiwhvycfjncind", "anhz", "rsbcl", "zkz", "knjxizbaxdy")) + .withTargetDiskTags(mapOf("wacyyjmlxppdndzk", "e", "cizeqqfopvnopm", "evuiiuiibfkcjytq")) + .withTargetNicTags(mapOf("zyfbkmvldzmxojz", "sfhoxqlyo")); + model = BinaryData.fromObject(model).toObject(VMwareCbtUpdateMigrationItemInput.class); + Assertions.assertEquals("igcfddofxnf", model.targetVmName()); + Assertions.assertEquals("jyyrqaedw", model.targetVmSize()); + Assertions.assertEquals("ocytjgoeayokrw", model.targetResourceGroupId()); + Assertions.assertEquals("ihwpadhedbfobd", model.targetAvailabilitySetId()); + Assertions.assertEquals("vothmkhjaoz", model.targetAvailabilityZone()); + Assertions.assertEquals("wfcn", model.targetProximityPlacementGroupId()); + Assertions.assertEquals("bpoelhscmyhrhjv", model.targetBootDiagnosticsStorageAccountId()); + Assertions.assertEquals("fqbokndwp", model.targetNetworkId()); + Assertions.assertEquals("qwojoev", model.testNetworkId()); + Assertions.assertEquals("fytdxmly", model.vmNics().get(0).nicId()); + Assertions.assertEquals("zlyvapbkrbuog", model.vmNics().get(0).isPrimaryNic()); + Assertions.assertEquals("dltlcu", model.vmNics().get(0).targetSubnetName()); + Assertions.assertEquals("izij", model.vmNics().get(0).targetStaticIpAddress()); + Assertions.assertEquals("ylzeohlpsftq", model.vmNics().get(0).isSelectedForMigration()); + Assertions.assertEquals("vmhvbvvcpwtqs", model.vmNics().get(0).targetNicName()); + Assertions.assertEquals("pnhmzy", model.vmNics().get(0).testSubnetName()); + Assertions.assertEquals("fetev", model.vmNics().get(0).testStaticIpAddress()); + Assertions.assertEquals("xjwdylwxmvzjow", model.vmDisks().get(0).diskId()); + Assertions.assertEquals("geerclbl", model.vmDisks().get(0).targetDiskName()); + Assertions.assertEquals("hpwachyeu", model.vmDisks().get(0).isOSDisk()); + Assertions.assertEquals(LicenseType.NOT_SPECIFIED, model.licenseType()); + Assertions.assertEquals(SqlServerLicenseType.NOT_SPECIFIED, model.sqlServerLicenseType()); + Assertions.assertEquals("trtexegwm", model.performAutoResync()); + Assertions.assertEquals("ywiwhvycfjncind", model.targetVmTags().get("loqkajwjuri")); + Assertions.assertEquals("e", model.targetDiskTags().get("wacyyjmlxppdndzk")); + Assertions.assertEquals("sfhoxqlyo", model.targetNicTags().get("zyfbkmvldzmxojz")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareV2FabricCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareV2FabricCreationInputTests.java new file mode 100644 index 000000000000..45d7f5f689e9 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VMwareV2FabricCreationInputTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VMwareV2FabricCreationInput; +import org.junit.jupiter.api.Assertions; + +public final class VMwareV2FabricCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMwareV2FabricCreationInput model = + BinaryData + .fromString( + "{\"instanceType\":\"VMwareV2\",\"vmwareSiteId\":\"ptchdwyq\",\"physicalSiteId\":\"dqimlgbbfjm\",\"migrationSolutionId\":\"gjvxlhmpmhe\"}") + .toObject(VMwareV2FabricCreationInput.class); + Assertions.assertEquals("ptchdwyq", model.vmwareSiteId()); + Assertions.assertEquals("dqimlgbbfjm", model.physicalSiteId()); + Assertions.assertEquals("gjvxlhmpmhe", model.migrationSolutionId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMwareV2FabricCreationInput model = + new VMwareV2FabricCreationInput() + .withVmwareSiteId("ptchdwyq") + .withPhysicalSiteId("dqimlgbbfjm") + .withMigrationSolutionId("gjvxlhmpmhe"); + model = BinaryData.fromObject(model).toObject(VMwareV2FabricCreationInput.class); + Assertions.assertEquals("ptchdwyq", model.vmwareSiteId()); + Assertions.assertEquals("dqimlgbbfjm", model.physicalSiteId()); + Assertions.assertEquals("gjvxlhmpmhe", model.migrationSolutionId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingCollectionTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingCollectionTests.java new file mode 100644 index 000000000000..3cd5ad548f0d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingCollectionTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.VaultSettingInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSettingCollection; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSettingProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VaultSettingCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VaultSettingCollection model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"migrationSolutionId\":\"v\",\"vmwareToAzureProviderType\":\"oakizvoai\"},\"location\":\"a\",\"id\":\"lnuwiguy\",\"name\":\"lykwphvxz\",\"type\":\"wxh\"},{\"properties\":{\"migrationSolutionId\":\"jtlkexaonwivkcqh\",\"vmwareToAzureProviderType\":\"hxknlccrmmkyupi\"},\"location\":\"byqjfkakfqfrkem\",\"id\":\"il\",\"name\":\"udxjascowv\",\"type\":\"djkpdxph\"},{\"properties\":{\"migrationSolutionId\":\"snmgzvyfi\",\"vmwareToAzureProviderType\":\"kzuqnwsith\"},\"location\":\"olyahluqwqulsut\",\"id\":\"jb\",\"name\":\"xykfhyq\",\"type\":\"zvqqugdrftbcvexr\"}],\"nextLink\":\"quowtljvfwhrea\"}") + .toObject(VaultSettingCollection.class); + Assertions.assertEquals("v", model.value().get(0).properties().migrationSolutionId()); + Assertions.assertEquals("oakizvoai", model.value().get(0).properties().vmwareToAzureProviderType()); + Assertions.assertEquals("a", model.value().get(0).location()); + Assertions.assertEquals("quowtljvfwhrea", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VaultSettingCollection model = + new VaultSettingCollection() + .withValue( + Arrays + .asList( + new VaultSettingInner() + .withProperties( + new VaultSettingProperties() + .withMigrationSolutionId("v") + .withVmwareToAzureProviderType("oakizvoai")) + .withLocation("a"), + new VaultSettingInner() + .withProperties( + new VaultSettingProperties() + .withMigrationSolutionId("jtlkexaonwivkcqh") + .withVmwareToAzureProviderType("hxknlccrmmkyupi")) + .withLocation("byqjfkakfqfrkem"), + new VaultSettingInner() + .withProperties( + new VaultSettingProperties() + .withMigrationSolutionId("snmgzvyfi") + .withVmwareToAzureProviderType("kzuqnwsith")) + .withLocation("olyahluqwqulsut"))) + .withNextLink("quowtljvfwhrea"); + model = BinaryData.fromObject(model).toObject(VaultSettingCollection.class); + Assertions.assertEquals("v", model.value().get(0).properties().migrationSolutionId()); + Assertions.assertEquals("oakizvoai", model.value().get(0).properties().vmwareToAzureProviderType()); + Assertions.assertEquals("a", model.value().get(0).location()); + Assertions.assertEquals("quowtljvfwhrea", model.nextLink()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingCreationInputPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingCreationInputPropertiesTests.java new file mode 100644 index 000000000000..51f8589723c6 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingCreationInputPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class VaultSettingCreationInputPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VaultSettingCreationInputProperties model = + BinaryData + .fromString("{\"migrationSolutionId\":\"yxp\",\"vmwareToAzureProviderType\":\"tweialwvskbuhzac\"}") + .toObject(VaultSettingCreationInputProperties.class); + Assertions.assertEquals("yxp", model.migrationSolutionId()); + Assertions.assertEquals("tweialwvskbuhzac", model.vmwareToAzureProviderType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VaultSettingCreationInputProperties model = + new VaultSettingCreationInputProperties() + .withMigrationSolutionId("yxp") + .withVmwareToAzureProviderType("tweialwvskbuhzac"); + model = BinaryData.fromObject(model).toObject(VaultSettingCreationInputProperties.class); + Assertions.assertEquals("yxp", model.migrationSolutionId()); + Assertions.assertEquals("tweialwvskbuhzac", model.vmwareToAzureProviderType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingCreationInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingCreationInputTests.java new file mode 100644 index 000000000000..fb543471ea12 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingCreationInputTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSettingCreationInput; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSettingCreationInputProperties; +import org.junit.jupiter.api.Assertions; + +public final class VaultSettingCreationInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VaultSettingCreationInput model = + BinaryData + .fromString( + "{\"properties\":{\"migrationSolutionId\":\"ztrgdgxvcoq\",\"vmwareToAzureProviderType\":\"sw\"}}") + .toObject(VaultSettingCreationInput.class); + Assertions.assertEquals("ztrgdgxvcoq", model.properties().migrationSolutionId()); + Assertions.assertEquals("sw", model.properties().vmwareToAzureProviderType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VaultSettingCreationInput model = + new VaultSettingCreationInput() + .withProperties( + new VaultSettingCreationInputProperties() + .withMigrationSolutionId("ztrgdgxvcoq") + .withVmwareToAzureProviderType("sw")); + model = BinaryData.fromObject(model).toObject(VaultSettingCreationInput.class); + Assertions.assertEquals("ztrgdgxvcoq", model.properties().migrationSolutionId()); + Assertions.assertEquals("sw", model.properties().vmwareToAzureProviderType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingInnerTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingInnerTests.java new file mode 100644 index 000000000000..44072fd9e5ec --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingInnerTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.fluent.models.VaultSettingInner; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSettingProperties; +import org.junit.jupiter.api.Assertions; + +public final class VaultSettingInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VaultSettingInner model = + BinaryData + .fromString( + "{\"properties\":{\"migrationSolutionId\":\"yxvrqtvbczsul\",\"vmwareToAzureProviderType\":\"gglmepjpfsey\"},\"location\":\"sa\",\"id\":\"gpszngafpg\",\"name\":\"lkvec\",\"type\":\"ujcngo\"}") + .toObject(VaultSettingInner.class); + Assertions.assertEquals("yxvrqtvbczsul", model.properties().migrationSolutionId()); + Assertions.assertEquals("gglmepjpfsey", model.properties().vmwareToAzureProviderType()); + Assertions.assertEquals("sa", model.location()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VaultSettingInner model = + new VaultSettingInner() + .withProperties( + new VaultSettingProperties() + .withMigrationSolutionId("yxvrqtvbczsul") + .withVmwareToAzureProviderType("gglmepjpfsey")) + .withLocation("sa"); + model = BinaryData.fromObject(model).toObject(VaultSettingInner.class); + Assertions.assertEquals("yxvrqtvbczsul", model.properties().migrationSolutionId()); + Assertions.assertEquals("gglmepjpfsey", model.properties().vmwareToAzureProviderType()); + Assertions.assertEquals("sa", model.location()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingPropertiesTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingPropertiesTests.java new file mode 100644 index 000000000000..0d72cf57a343 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VaultSettingPropertiesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VaultSettingProperties; +import org.junit.jupiter.api.Assertions; + +public final class VaultSettingPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VaultSettingProperties model = + BinaryData + .fromString("{\"migrationSolutionId\":\"yedmzrgj\",\"vmwareToAzureProviderType\":\"knubnoitp\"}") + .toObject(VaultSettingProperties.class); + Assertions.assertEquals("yedmzrgj", model.migrationSolutionId()); + Assertions.assertEquals("knubnoitp", model.vmwareToAzureProviderType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VaultSettingProperties model = + new VaultSettingProperties().withMigrationSolutionId("yedmzrgj").withVmwareToAzureProviderType("knubnoitp"); + model = BinaryData.fromObject(model).toObject(VaultSettingProperties.class); + Assertions.assertEquals("yedmzrgj", model.migrationSolutionId()); + Assertions.assertEquals("knubnoitp", model.vmwareToAzureProviderType()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VersionDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VersionDetailsTests.java new file mode 100644 index 000000000000..5fcd4938c586 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VersionDetailsTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.AgentVersionStatus; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VersionDetails; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class VersionDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VersionDetails model = + BinaryData + .fromString( + "{\"version\":\"avehhrvkbunzo\",\"expiryDate\":\"2021-06-10T11:46:22Z\",\"status\":\"SecurityUpdateRequired\"}") + .toObject(VersionDetails.class); + Assertions.assertEquals("avehhrvkbunzo", model.version()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-10T11:46:22Z"), model.expiryDate()); + Assertions.assertEquals(AgentVersionStatus.SECURITY_UPDATE_REQUIRED, model.status()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VersionDetails model = + new VersionDetails() + .withVersion("avehhrvkbunzo") + .withExpiryDate(OffsetDateTime.parse("2021-06-10T11:46:22Z")) + .withStatus(AgentVersionStatus.SECURITY_UPDATE_REQUIRED); + model = BinaryData.fromObject(model).toObject(VersionDetails.class); + Assertions.assertEquals("avehhrvkbunzo", model.version()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-10T11:46:22Z"), model.expiryDate()); + Assertions.assertEquals(AgentVersionStatus.SECURITY_UPDATE_REQUIRED, model.status()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VirtualMachineTaskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VirtualMachineTaskDetailsTests.java new file mode 100644 index 000000000000..cfa32c380f67 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VirtualMachineTaskDetailsTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.JobEntity; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VirtualMachineTaskDetails; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineTaskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineTaskDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"VirtualMachineTaskDetails\",\"skippedReason\":\"doaqipmnxclfrsb\",\"skippedReasonString\":\"nm\",\"jobTask\":{\"jobId\":\"vp\",\"jobFriendlyName\":\"fddtbfmekjcng\",\"targetObjectId\":\"xdvmaoyqxf\",\"targetObjectName\":\"yxzmx\",\"targetInstanceType\":\"ofxlttxo\",\"jobScenarioName\":\"tdnzujsjirkrpskc\"}}") + .toObject(VirtualMachineTaskDetails.class); + Assertions.assertEquals("vp", model.jobTask().jobId()); + Assertions.assertEquals("fddtbfmekjcng", model.jobTask().jobFriendlyName()); + Assertions.assertEquals("xdvmaoyqxf", model.jobTask().targetObjectId()); + Assertions.assertEquals("yxzmx", model.jobTask().targetObjectName()); + Assertions.assertEquals("ofxlttxo", model.jobTask().targetInstanceType()); + Assertions.assertEquals("tdnzujsjirkrpskc", model.jobTask().jobScenarioName()); + Assertions.assertEquals("doaqipmnxclfrsb", model.skippedReason()); + Assertions.assertEquals("nm", model.skippedReasonString()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineTaskDetails model = + new VirtualMachineTaskDetails() + .withJobTask( + new JobEntity() + .withJobId("vp") + .withJobFriendlyName("fddtbfmekjcng") + .withTargetObjectId("xdvmaoyqxf") + .withTargetObjectName("yxzmx") + .withTargetInstanceType("ofxlttxo") + .withJobScenarioName("tdnzujsjirkrpskc")) + .withSkippedReason("doaqipmnxclfrsb") + .withSkippedReasonString("nm"); + model = BinaryData.fromObject(model).toObject(VirtualMachineTaskDetails.class); + Assertions.assertEquals("vp", model.jobTask().jobId()); + Assertions.assertEquals("fddtbfmekjcng", model.jobTask().jobFriendlyName()); + Assertions.assertEquals("xdvmaoyqxf", model.jobTask().targetObjectId()); + Assertions.assertEquals("yxzmx", model.jobTask().targetObjectName()); + Assertions.assertEquals("ofxlttxo", model.jobTask().targetInstanceType()); + Assertions.assertEquals("tdnzujsjirkrpskc", model.jobTask().jobScenarioName()); + Assertions.assertEquals("doaqipmnxclfrsb", model.skippedReason()); + Assertions.assertEquals("nm", model.skippedReasonString()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmNicUpdatesTaskDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmNicUpdatesTaskDetailsTests.java new file mode 100644 index 000000000000..8dc10a25e676 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmNicUpdatesTaskDetailsTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmNicUpdatesTaskDetails; +import org.junit.jupiter.api.Assertions; + +public final class VmNicUpdatesTaskDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmNicUpdatesTaskDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"VmNicUpdatesTaskDetails\",\"vmId\":\"zertkounz\",\"nicId\":\"ywhubymfpopik\",\"name\":\"b\"}") + .toObject(VmNicUpdatesTaskDetails.class); + Assertions.assertEquals("zertkounz", model.vmId()); + Assertions.assertEquals("ywhubymfpopik", model.nicId()); + Assertions.assertEquals("b", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmNicUpdatesTaskDetails model = + new VmNicUpdatesTaskDetails().withVmId("zertkounz").withNicId("ywhubymfpopik").withName("b"); + model = BinaryData.fromObject(model).toObject(VmNicUpdatesTaskDetails.class); + Assertions.assertEquals("zertkounz", model.vmId()); + Assertions.assertEquals("ywhubymfpopik", model.nicId()); + Assertions.assertEquals("b", model.name()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmDetailsTests.java new file mode 100644 index 000000000000..2ff2cdd66c3a --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmDetailsTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmDetails; + +public final class VmmDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmmDetails model = BinaryData.fromString("{\"instanceType\":\"VMM\"}").toObject(VmmDetails.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmmDetails model = new VmmDetails(); + model = BinaryData.fromObject(model).toObject(VmmDetails.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToAzureCreateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToAzureCreateNetworkMappingInputTests.java new file mode 100644 index 000000000000..ed1ca22509cd --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToAzureCreateNetworkMappingInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmToAzureCreateNetworkMappingInput; + +public final class VmmToAzureCreateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmmToAzureCreateNetworkMappingInput model = + BinaryData + .fromString("{\"instanceType\":\"VmmToAzure\"}") + .toObject(VmmToAzureCreateNetworkMappingInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmmToAzureCreateNetworkMappingInput model = new VmmToAzureCreateNetworkMappingInput(); + model = BinaryData.fromObject(model).toObject(VmmToAzureCreateNetworkMappingInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToAzureNetworkMappingSettingsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToAzureNetworkMappingSettingsTests.java new file mode 100644 index 000000000000..16c1a05254de --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToAzureNetworkMappingSettingsTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmToAzureNetworkMappingSettings; + +public final class VmmToAzureNetworkMappingSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmmToAzureNetworkMappingSettings model = + BinaryData.fromString("{\"instanceType\":\"VmmToAzure\"}").toObject(VmmToAzureNetworkMappingSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmmToAzureNetworkMappingSettings model = new VmmToAzureNetworkMappingSettings(); + model = BinaryData.fromObject(model).toObject(VmmToAzureNetworkMappingSettings.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToAzureUpdateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToAzureUpdateNetworkMappingInputTests.java new file mode 100644 index 000000000000..90806361f3ea --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToAzureUpdateNetworkMappingInputTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmToAzureUpdateNetworkMappingInput; + +public final class VmmToAzureUpdateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmmToAzureUpdateNetworkMappingInput model = + BinaryData + .fromString("{\"instanceType\":\"VmmToAzure\"}") + .toObject(VmmToAzureUpdateNetworkMappingInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmmToAzureUpdateNetworkMappingInput model = new VmmToAzureUpdateNetworkMappingInput(); + model = BinaryData.fromObject(model).toObject(VmmToAzureUpdateNetworkMappingInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToVmmCreateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToVmmCreateNetworkMappingInputTests.java new file mode 100644 index 000000000000..05f712be7112 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToVmmCreateNetworkMappingInputTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmToVmmCreateNetworkMappingInput; + +public final class VmmToVmmCreateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmmToVmmCreateNetworkMappingInput model = + BinaryData.fromString("{\"instanceType\":\"VmmToVmm\"}").toObject(VmmToVmmCreateNetworkMappingInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmmToVmmCreateNetworkMappingInput model = new VmmToVmmCreateNetworkMappingInput(); + model = BinaryData.fromObject(model).toObject(VmmToVmmCreateNetworkMappingInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToVmmNetworkMappingSettingsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToVmmNetworkMappingSettingsTests.java new file mode 100644 index 000000000000..ccace83e2378 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToVmmNetworkMappingSettingsTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmToVmmNetworkMappingSettings; + +public final class VmmToVmmNetworkMappingSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmmToVmmNetworkMappingSettings model = + BinaryData.fromString("{\"instanceType\":\"VmmToVmm\"}").toObject(VmmToVmmNetworkMappingSettings.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmmToVmmNetworkMappingSettings model = new VmmToVmmNetworkMappingSettings(); + model = BinaryData.fromObject(model).toObject(VmmToVmmNetworkMappingSettings.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToVmmUpdateNetworkMappingInputTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToVmmUpdateNetworkMappingInputTests.java new file mode 100644 index 000000000000..276040803713 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmToVmmUpdateNetworkMappingInputTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmToVmmUpdateNetworkMappingInput; + +public final class VmmToVmmUpdateNetworkMappingInputTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmmToVmmUpdateNetworkMappingInput model = + BinaryData.fromString("{\"instanceType\":\"VmmToVmm\"}").toObject(VmmToVmmUpdateNetworkMappingInput.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmmToVmmUpdateNetworkMappingInput model = new VmmToVmmUpdateNetworkMappingInput(); + model = BinaryData.fromObject(model).toObject(VmmToVmmUpdateNetworkMappingInput.class); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmVirtualMachineDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmVirtualMachineDetailsTests.java new file mode 100644 index 000000000000..a61001c0611d --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmmVirtualMachineDetailsTests.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.DiskDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.OSDetails; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.PresenceStatus; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmmVirtualMachineDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VmmVirtualMachineDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmmVirtualMachineDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"VmmVirtualMachine\",\"sourceItemId\":\"mmofbnivdqtkyk\",\"generation\":\"xnlsf\",\"osDetails\":{\"osType\":\"scaccptbz\",\"productType\":\"x\",\"osEdition\":\"xxicee\",\"oSVersion\":\"jwyuveox\",\"oSMajorVersion\":\"z\",\"oSMinorVersion\":\"ahdr\"},\"diskDetails\":[{\"maxSizeMB\":2901220119484364811,\"vhdType\":\"xbiv\",\"vhdId\":\"gxmbrygmwibiosiq\",\"vhdName\":\"kqfdqwdrtx\"}],\"hasPhysicalDisk\":\"NotPresent\",\"hasFibreChannelAdapter\":\"Unknown\",\"hasSharedVhd\":\"Present\",\"hyperVHostId\":\"co\"}") + .toObject(VmmVirtualMachineDetails.class); + Assertions.assertEquals("mmofbnivdqtkyk", model.sourceItemId()); + Assertions.assertEquals("xnlsf", model.generation()); + Assertions.assertEquals("scaccptbz", model.osDetails().osType()); + Assertions.assertEquals("x", model.osDetails().productType()); + Assertions.assertEquals("xxicee", model.osDetails().osEdition()); + Assertions.assertEquals("jwyuveox", model.osDetails().oSVersion()); + Assertions.assertEquals("z", model.osDetails().oSMajorVersion()); + Assertions.assertEquals("ahdr", model.osDetails().oSMinorVersion()); + Assertions.assertEquals(2901220119484364811L, model.diskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("xbiv", model.diskDetails().get(0).vhdType()); + Assertions.assertEquals("gxmbrygmwibiosiq", model.diskDetails().get(0).vhdId()); + Assertions.assertEquals("kqfdqwdrtx", model.diskDetails().get(0).vhdName()); + Assertions.assertEquals(PresenceStatus.NOT_PRESENT, model.hasPhysicalDisk()); + Assertions.assertEquals(PresenceStatus.UNKNOWN, model.hasFibreChannelAdapter()); + Assertions.assertEquals(PresenceStatus.PRESENT, model.hasSharedVhd()); + Assertions.assertEquals("co", model.hyperVHostId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmmVirtualMachineDetails model = + new VmmVirtualMachineDetails() + .withSourceItemId("mmofbnivdqtkyk") + .withGeneration("xnlsf") + .withOsDetails( + new OSDetails() + .withOsType("scaccptbz") + .withProductType("x") + .withOsEdition("xxicee") + .withOSVersion("jwyuveox") + .withOSMajorVersion("z") + .withOSMinorVersion("ahdr")) + .withDiskDetails( + Arrays + .asList( + new DiskDetails() + .withMaxSizeMB(2901220119484364811L) + .withVhdType("xbiv") + .withVhdId("gxmbrygmwibiosiq") + .withVhdName("kqfdqwdrtx"))) + .withHasPhysicalDisk(PresenceStatus.NOT_PRESENT) + .withHasFibreChannelAdapter(PresenceStatus.UNKNOWN) + .withHasSharedVhd(PresenceStatus.PRESENT) + .withHyperVHostId("co"); + model = BinaryData.fromObject(model).toObject(VmmVirtualMachineDetails.class); + Assertions.assertEquals("mmofbnivdqtkyk", model.sourceItemId()); + Assertions.assertEquals("xnlsf", model.generation()); + Assertions.assertEquals("scaccptbz", model.osDetails().osType()); + Assertions.assertEquals("x", model.osDetails().productType()); + Assertions.assertEquals("xxicee", model.osDetails().osEdition()); + Assertions.assertEquals("jwyuveox", model.osDetails().oSVersion()); + Assertions.assertEquals("z", model.osDetails().oSMajorVersion()); + Assertions.assertEquals("ahdr", model.osDetails().oSMinorVersion()); + Assertions.assertEquals(2901220119484364811L, model.diskDetails().get(0).maxSizeMB()); + Assertions.assertEquals("xbiv", model.diskDetails().get(0).vhdType()); + Assertions.assertEquals("gxmbrygmwibiosiq", model.diskDetails().get(0).vhdId()); + Assertions.assertEquals("kqfdqwdrtx", model.diskDetails().get(0).vhdName()); + Assertions.assertEquals(PresenceStatus.NOT_PRESENT, model.hasPhysicalDisk()); + Assertions.assertEquals(PresenceStatus.UNKNOWN, model.hasFibreChannelAdapter()); + Assertions.assertEquals(PresenceStatus.PRESENT, model.hasSharedVhd()); + Assertions.assertEquals("co", model.hyperVHostId()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmwareCbtPolicyDetailsTests.java b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmwareCbtPolicyDetailsTests.java new file mode 100644 index 000000000000..b979a00dbae0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/java/com/azure/resourcemanager/recoveryservicessiterecovery/generated/VmwareCbtPolicyDetailsTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.recoveryservicessiterecovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.recoveryservicessiterecovery.models.VmwareCbtPolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class VmwareCbtPolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VmwareCbtPolicyDetails model = + BinaryData + .fromString( + "{\"instanceType\":\"VMwareCbt\",\"recoveryPointHistoryInMinutes\":565605624,\"appConsistentFrequencyInMinutes\":1535089718,\"crashConsistentFrequencyInMinutes\":1544555304}") + .toObject(VmwareCbtPolicyDetails.class); + Assertions.assertEquals(565605624, model.recoveryPointHistoryInMinutes()); + Assertions.assertEquals(1535089718, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(1544555304, model.crashConsistentFrequencyInMinutes()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VmwareCbtPolicyDetails model = + new VmwareCbtPolicyDetails() + .withRecoveryPointHistoryInMinutes(565605624) + .withAppConsistentFrequencyInMinutes(1535089718) + .withCrashConsistentFrequencyInMinutes(1544555304); + model = BinaryData.fromObject(model).toObject(VmwareCbtPolicyDetails.class); + Assertions.assertEquals(565605624, model.recoveryPointHistoryInMinutes()); + Assertions.assertEquals(1535089718, model.appConsistentFrequencyInMinutes()); + Assertions.assertEquals(1544555304, model.crashConsistentFrequencyInMinutes()); + } +} diff --git a/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000000..1f0955d450f0 --- /dev/null +++ b/sdk/recoveryservicessiterecovery/azure-resourcemanager-recoveryservicessiterecovery/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/CHANGELOG.md b/sdk/remoterendering/azure-mixedreality-remoterendering/CHANGELOG.md index 979b961ef981..469f42083c5f 100644 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/CHANGELOG.md +++ b/sdk/remoterendering/azure-mixedreality-remoterendering/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.1.22 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-mixedreality-authentication` from `1.2.15` to version `1.2.16`. + ## 1.1.21 (2023-08-18) ### Other Changes diff --git a/sdk/remoterendering/azure-mixedreality-remoterendering/pom.xml b/sdk/remoterendering/azure-mixedreality-remoterendering/pom.xml index 0cd0522db59b..0937eb467361 100644 --- a/sdk/remoterendering/azure-mixedreality-remoterendering/pom.xml +++ b/sdk/remoterendering/azure-mixedreality-remoterendering/pom.xml @@ -36,7 +36,7 @@ com.azure azure-mixedreality-authentication - 1.2.16 + 1.2.17 diff --git a/sdk/resourcemanager/README.md b/sdk/resourcemanager/README.md index d6bb2746355e..30940f1b9632 100644 --- a/sdk/resourcemanager/README.md +++ b/sdk/resourcemanager/README.md @@ -100,7 +100,7 @@ Azure Management Libraries require a `TokenCredential` implementation for authen com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/resourcemanager/api-specs.json b/sdk/resourcemanager/api-specs.json index 6537e7261b9e..ed78b50e1923 100644 --- a/sdk/resourcemanager/api-specs.json +++ b/sdk/resourcemanager/api-specs.json @@ -207,7 +207,7 @@ "dir": "azure-resourcemanager-redis", "source": "specification/redis/resource-manager/readme.md", "package": "com.azure.resourcemanager.redis", - "args": "--tag=package-2023-04 --rename-model=ErrorDetailAutoGenerated:ErrorDetail,RedisCommonPropertiesRedisConfiguration:RedisConfiguration", + "args": "--tag=package-2023-08 --rename-model=ErrorDetailAutoGenerated:ErrorDetail,RedisCommonPropertiesRedisConfiguration:RedisConfiguration --remove-inner=OperationStatusResult", "note": "run RedisConfigurationTests.generateConfigurationUtils and copy output code snippet to ConfigurationUtils" }, "relay": { @@ -252,7 +252,7 @@ "dir": "azure-resourcemanager-storage", "source": "specification/storage/resource-manager/readme.md", "package": "com.azure.resourcemanager.storage", - "args": "--tag=package-2023-01 --rename-model=AllowedMethods:CorsRuleAllowedMethodsItem,AccountType:ActiveDirectoryPropertiesAccountType" + "args": "--tag=package-2023-01 --modelerfour.lenient-model-deduplication --rename-model=AllowedMethods:CorsRuleAllowedMethodsItem,AccountType:ActiveDirectoryPropertiesAccountType" }, "storage-hybrid": { "dir": "../resourcemanagerhybrid/azure-resourcemanager-storage", @@ -264,7 +264,7 @@ "dir": "azure-resourcemanager-resources", "source": "specification/resources/resource-manager/readme.md", "package": "com.azure.resourcemanager.resources", - "args": "--tag=package-subscriptions-2022-12 --name-for-ungrouped-operations=ResourceName --remove-operation-group=Operations" + "args": "--tag=package-subscriptions-2022-12 --modelerfour.lenient-model-deduplication --name-for-ungrouped-operations=ResourceName --remove-operation-group=Operations" }, "subscriptions-hybrid": { "dir": "../resourcemanagerhybrid/azure-resourcemanager-resources", diff --git a/sdk/resourcemanager/azure-resourcemanager-appplatform/pom.xml b/sdk/resourcemanager/azure-resourcemanager-appplatform/pom.xml index 6a0c519d21ac..39a7aee6c8c0 100644 --- a/sdk/resourcemanager/azure-resourcemanager-appplatform/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-appplatform/pom.xml @@ -49,8 +49,6 @@ --add-opens com.azure.resourcemanager.appplatform/com.azure.resourcemanager.appplatform=ALL-UNNAMED --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false @@ -69,7 +67,7 @@ com.azure azure-storage-file-share - 12.19.1 + 12.20.0 com.azure @@ -104,7 +102,7 @@ com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 test diff --git a/sdk/resourcemanager/azure-resourcemanager-appservice/pom.xml b/sdk/resourcemanager/azure-resourcemanager-appservice/pom.xml index 5a4e486d4d00..97ccfd5bb4f5 100644 --- a/sdk/resourcemanager/azure-resourcemanager-appservice/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-appservice/pom.xml @@ -51,8 +51,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-authorization/pom.xml b/sdk/resourcemanager/azure-resourcemanager-authorization/pom.xml index b7bad7975d37..6ce11b097337 100644 --- a/sdk/resourcemanager/azure-resourcemanager-authorization/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-authorization/pom.xml @@ -46,8 +46,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-cdn/pom.xml b/sdk/resourcemanager/azure-resourcemanager-cdn/pom.xml index 367992a4858d..6dba3d06690c 100644 --- a/sdk/resourcemanager/azure-resourcemanager-cdn/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-cdn/pom.xml @@ -45,8 +45,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml b/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml index 63fededff5c5..6e52ee64e222 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml @@ -56,8 +56,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false @@ -126,7 +124,7 @@ com.azure azure-storage-blob - 12.23.1 + 12.24.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-containerinstance/pom.xml b/sdk/resourcemanager/azure-resourcemanager-containerinstance/pom.xml index a4e0b3a8adcf..e875a92bf930 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerinstance/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-containerinstance/pom.xml @@ -44,8 +44,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false @@ -84,7 +82,7 @@ com.azure azure-storage-file-share - 12.19.1 + 12.20.0 com.azure diff --git a/sdk/resourcemanager/azure-resourcemanager-containerregistry/pom.xml b/sdk/resourcemanager/azure-resourcemanager-containerregistry/pom.xml index 75baf4dc3266..b545085f732b 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerregistry/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-containerregistry/pom.xml @@ -42,7 +42,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - false true diff --git a/sdk/resourcemanager/azure-resourcemanager-containerservice/pom.xml b/sdk/resourcemanager/azure-resourcemanager-containerservice/pom.xml index 8d883df4d1bf..6a86fe726986 100644 --- a/sdk/resourcemanager/azure-resourcemanager-containerservice/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-containerservice/pom.xml @@ -42,8 +42,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-cosmos/pom.xml b/sdk/resourcemanager/azure-resourcemanager-cosmos/pom.xml index 681541254a83..8a6fd14ba261 100644 --- a/sdk/resourcemanager/azure-resourcemanager-cosmos/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-cosmos/pom.xml @@ -43,8 +43,6 @@ --add-opens com.azure.resourcemanager.cosmos/com.azure.resourcemanager.cosmos=ALL-UNNAMED --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-dns/pom.xml b/sdk/resourcemanager/azure-resourcemanager-dns/pom.xml index ba5cc9335c86..d39923668bb0 100644 --- a/sdk/resourcemanager/azure-resourcemanager-dns/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-dns/pom.xml @@ -45,8 +45,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-eventhubs/pom.xml b/sdk/resourcemanager/azure-resourcemanager-eventhubs/pom.xml index 3541d25db278..67a8b2889e07 100644 --- a/sdk/resourcemanager/azure-resourcemanager-eventhubs/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-eventhubs/pom.xml @@ -46,8 +46,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-keyvault/pom.xml b/sdk/resourcemanager/azure-resourcemanager-keyvault/pom.xml index 6d646c7cbb88..38d7d79769ae 100644 --- a/sdk/resourcemanager/azure-resourcemanager-keyvault/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-keyvault/pom.xml @@ -46,8 +46,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false @@ -71,7 +69,7 @@ com.azure azure-security-keyvault-keys - 4.6.5 + 4.7.0 com.azure @@ -82,7 +80,7 @@ com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 com.azure diff --git a/sdk/resourcemanager/azure-resourcemanager-monitor/pom.xml b/sdk/resourcemanager/azure-resourcemanager-monitor/pom.xml index 49f462c85d01..f88d7dee8097 100644 --- a/sdk/resourcemanager/azure-resourcemanager-monitor/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-monitor/pom.xml @@ -48,8 +48,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-msi/pom.xml b/sdk/resourcemanager/azure-resourcemanager-msi/pom.xml index fd7ddd5db9bd..851c71c57277 100644 --- a/sdk/resourcemanager/azure-resourcemanager-msi/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-msi/pom.xml @@ -44,8 +44,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-network/pom.xml b/sdk/resourcemanager/azure-resourcemanager-network/pom.xml index 15405d95322c..bc31b6d4361d 100644 --- a/sdk/resourcemanager/azure-resourcemanager-network/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-network/pom.xml @@ -51,8 +51,6 @@ --add-opens com.azure.resourcemanager.resources/com.azure.resourcemanager.resources.fluentcore.arm=ALL-UNNAMED --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false @@ -89,7 +87,7 @@ com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 test diff --git a/sdk/resourcemanager/azure-resourcemanager-privatedns/pom.xml b/sdk/resourcemanager/azure-resourcemanager-privatedns/pom.xml index b6dad0fee546..89a2a48cca82 100644 --- a/sdk/resourcemanager/azure-resourcemanager-privatedns/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-privatedns/pom.xml @@ -48,8 +48,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/CHANGELOG.md b/sdk/resourcemanager/azure-resourcemanager-redis/CHANGELOG.md index 381dc49873fc..0151c83fed64 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/CHANGELOG.md +++ b/sdk/resourcemanager/azure-resourcemanager-redis/CHANGELOG.md @@ -2,13 +2,11 @@ ## 2.31.0-beta.1 (Unreleased) -### Features Added - -### Breaking Changes +### Other Changes -### Bugs Fixed +#### Dependency Updates -### Other Changes +- Updated `api-version` to `2023-08-01`. ## 2.30.0 (2023-08-25) diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/assets.json b/sdk/resourcemanager/azure-resourcemanager-redis/assets.json index 3f3a70df0d61..916cca521e22 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/assets.json +++ b/sdk/resourcemanager/azure-resourcemanager-redis/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/resourcemanager/azure-resourcemanager-redis", - "Tag": "java/resourcemanager/azure-resourcemanager-redis_c3e59a30cb" + "Tag": "java/resourcemanager/azure-resourcemanager-redis_df48c9d2b2" } diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/pom.xml b/sdk/resourcemanager/azure-resourcemanager-redis/pom.xml index 39d211dc832c..7bf0421f4c0a 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-redis/pom.xml @@ -49,7 +49,7 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - false + true diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/AccessPoliciesClient.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/AccessPoliciesClient.java new file mode 100644 index 000000000000..e4bfa159578b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/AccessPoliciesClient.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.redis.fluent.models.RedisCacheAccessPolicyInner; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AccessPoliciesClient. */ +public interface AccessPoliciesClient { + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createUpdateWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters); + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, RedisCacheAccessPolicyInner> beginCreateUpdateAsync( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters); + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RedisCacheAccessPolicyInner> beginCreateUpdate( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters); + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RedisCacheAccessPolicyInner> beginCreateUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyName, + RedisCacheAccessPolicyInner parameters, + Context context); + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createUpdateAsync( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters); + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RedisCacheAccessPolicyInner createUpdate( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters); + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RedisCacheAccessPolicyInner createUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyName, + RedisCacheAccessPolicyInner parameters, + Context context); + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyName); + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cacheName, String accessPolicyName); + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cacheName, String accessPolicyName); + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String cacheName, String accessPolicyName, Context context); + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String cacheName, String accessPolicyName); + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cacheName, String accessPolicyName); + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cacheName, String accessPolicyName, Context context); + + /** + * Gets the detailed information about an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the detailed information about an access policy of a redis cache along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyName); + + /** + * Gets the detailed information about an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the detailed information about an access policy of a redis cache on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String cacheName, String accessPolicyName); + + /** + * Gets the detailed information about an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the detailed information about an access policy of a redis cache along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String cacheName, String accessPolicyName, Context context); + + /** + * Gets the detailed information about an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the detailed information about an access policy of a redis cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RedisCacheAccessPolicyInner get(String resourceGroupName, String cacheName, String accessPolicyName); + + /** + * Gets the list of access policies associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policies associated with this redis cache as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(String resourceGroupName, String cacheName); + + /** + * Gets the list of access policies associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policies associated with this redis cache as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String cacheName); + + /** + * Gets the list of access policies associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policies associated with this redis cache as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String cacheName, Context context); +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/AccessPolicyAssignmentsClient.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/AccessPolicyAssignmentsClient.java new file mode 100644 index 000000000000..342a9b848ec1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/AccessPolicyAssignmentsClient.java @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.redis.fluent.models.RedisCacheAccessPolicyAssignmentInner; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AccessPolicyAssignmentsClient. */ +public interface AccessPolicyAssignmentsClient { + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createUpdateWithResponseAsync( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters); + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, RedisCacheAccessPolicyAssignmentInner> + beginCreateUpdateAsync( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters); + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RedisCacheAccessPolicyAssignmentInner> + beginCreateUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters); + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RedisCacheAccessPolicyAssignmentInner> + beginCreateUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters, + Context context); + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createUpdateAsync( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters); + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RedisCacheAccessPolicyAssignmentInner createUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters); + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RedisCacheAccessPolicyAssignmentInner createUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters, + Context context); + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName); + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName); + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName); + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context); + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String cacheName, String accessPolicyAssignmentName); + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cacheName, String accessPolicyAssignmentName); + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context); + + /** + * Gets the list of assignments for an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of assignments for an access policy of a redis cache along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName); + + /** + * Gets the list of assignments for an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of assignments for an access policy of a redis cache on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName); + + /** + * Gets the list of assignments for an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of assignments for an access policy of a redis cache along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context); + + /** + * Gets the list of assignments for an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of assignments for an access policy of a redis cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RedisCacheAccessPolicyAssignmentInner get( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName); + + /** + * Gets the list of access policy assignments associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policy assignments associated with this redis cache as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(String resourceGroupName, String cacheName); + + /** + * Gets the list of access policy assignments associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policy assignments associated with this redis cache as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String cacheName); + + /** + * Gets the list of access policy assignments associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policy assignments associated with this redis cache as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String cacheName, Context context); +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/FirewallRulesClient.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/FirewallRulesClient.java index bf43837b075a..bce398bbee88 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/FirewallRulesClient.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/FirewallRulesClient.java @@ -18,7 +18,7 @@ public interface FirewallRulesClient { /** * Gets all firewall rules in the specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -31,7 +31,7 @@ public interface FirewallRulesClient { /** * Gets all firewall rules in the specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -44,7 +44,7 @@ public interface FirewallRulesClient { /** * Gets all firewall rules in the specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -58,7 +58,7 @@ public interface FirewallRulesClient { /** * Create or update a redis cache firewall rule. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -75,7 +75,7 @@ Mono> createOrUpdateWithResponseAsync( /** * Create or update a redis cache firewall rule. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -92,7 +92,7 @@ Mono createOrUpdateAsync( /** * Create or update a redis cache firewall rule. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -114,7 +114,7 @@ Response createOrUpdateWithResponse( /** * Create or update a redis cache firewall rule. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -131,7 +131,7 @@ RedisFirewallRuleInner createOrUpdate( /** * Gets a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -147,7 +147,7 @@ Mono> getWithResponseAsync( /** * Gets a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -161,7 +161,7 @@ Mono> getWithResponseAsync( /** * Gets a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param context The context to associate with this operation. @@ -177,7 +177,7 @@ Response getWithResponse( /** * Gets a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -191,7 +191,7 @@ Response getWithResponse( /** * Deletes a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -205,7 +205,7 @@ Response getWithResponse( /** * Deletes a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -219,7 +219,7 @@ Response getWithResponse( /** * Deletes a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param context The context to associate with this operation. @@ -234,7 +234,7 @@ Response getWithResponse( /** * Deletes a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/LinkedServersClient.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/LinkedServersClient.java index 80dcef1ff4c9..814de9b06e0c 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/LinkedServersClient.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/LinkedServersClient.java @@ -24,7 +24,7 @@ public interface LinkedServersClient { /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -41,7 +41,7 @@ Mono>> createWithResponseAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -58,7 +58,7 @@ PollerFlux, RedisLinkedServerWi /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -75,7 +75,7 @@ SyncPoller, RedisLinkedServerWi /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -97,7 +97,7 @@ SyncPoller, RedisLinkedServerWi /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -114,7 +114,7 @@ Mono createAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -130,7 +130,7 @@ RedisLinkedServerWithPropertiesInner create( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -151,7 +151,7 @@ RedisLinkedServerWithPropertiesInner create( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -166,7 +166,7 @@ Mono>> deleteWithResponseAsync( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -180,7 +180,7 @@ Mono>> deleteWithResponseAsync( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -194,7 +194,7 @@ Mono>> deleteWithResponseAsync( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param context The context to associate with this operation. @@ -210,7 +210,7 @@ SyncPoller, Void> beginDelete( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -224,7 +224,7 @@ SyncPoller, Void> beginDelete( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -237,7 +237,7 @@ SyncPoller, Void> beginDelete( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param context The context to associate with this operation. @@ -251,7 +251,7 @@ SyncPoller, Void> beginDelete( /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -267,7 +267,7 @@ Mono> getWithResponseAsync( /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -282,7 +282,7 @@ Mono> getWithResponseAsync( /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @param context The context to associate with this operation. @@ -299,7 +299,7 @@ Response getWithResponse( /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -313,7 +313,7 @@ Response getWithResponse( /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -327,7 +327,7 @@ Response getWithResponse( /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -341,7 +341,7 @@ Response getWithResponse( /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PatchSchedulesClient.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PatchSchedulesClient.java index 2be7680901f9..08a727214bde 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PatchSchedulesClient.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PatchSchedulesClient.java @@ -19,7 +19,7 @@ public interface PatchSchedulesClient { /** * Gets all patch schedules in the specified redis cache (there is only one). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -33,7 +33,7 @@ public interface PatchSchedulesClient { /** * Gets all patch schedules in the specified redis cache (there is only one). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -47,7 +47,7 @@ public interface PatchSchedulesClient { /** * Gets all patch schedules in the specified redis cache (there is only one). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -63,7 +63,7 @@ PagedIterable listByRedisResource( /** * Create or replace the patching schedule for Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -80,7 +80,7 @@ Mono> createOrUpdateWithResponseAsync( /** * Create or replace the patching schedule for Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -96,7 +96,7 @@ Mono createOrUpdateAsync( /** * Create or replace the patching schedule for Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -117,7 +117,7 @@ Response createOrUpdateWithResponse( /** * Create or replace the patching schedule for Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -133,7 +133,7 @@ RedisPatchScheduleInner createOrUpdate( /** * Deletes the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -147,7 +147,7 @@ RedisPatchScheduleInner createOrUpdate( /** * Deletes the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -161,7 +161,7 @@ RedisPatchScheduleInner createOrUpdate( /** * Deletes the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param context The context to associate with this operation. @@ -177,7 +177,7 @@ Response deleteWithResponse( /** * Deletes the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -190,7 +190,7 @@ Response deleteWithResponse( /** * Gets the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -206,7 +206,7 @@ Mono> getWithResponseAsync( /** * Gets the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -220,7 +220,7 @@ Mono> getWithResponseAsync( /** * Gets the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param context The context to associate with this operation. @@ -236,7 +236,7 @@ Response getWithResponse( /** * Gets the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PrivateEndpointConnectionsClient.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PrivateEndpointConnectionsClient.java index e8dcb13331d0..a8c69da33d3c 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PrivateEndpointConnectionsClient.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PrivateEndpointConnectionsClient.java @@ -23,7 +23,7 @@ public interface PrivateEndpointConnectionsClient { /** * List all the private endpoint connections associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -37,7 +37,7 @@ public interface PrivateEndpointConnectionsClient { /** * List all the private endpoint connections associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -51,7 +51,7 @@ public interface PrivateEndpointConnectionsClient { /** * List all the private endpoint connections associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -66,7 +66,7 @@ public interface PrivateEndpointConnectionsClient { /** * Gets the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -83,7 +83,7 @@ Mono> getWithResponseAsync( /** * Gets the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -100,7 +100,7 @@ Mono getAsync( /** * Gets the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -117,7 +117,7 @@ Response getWithResponse( /** * Gets the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -133,7 +133,7 @@ PrivateEndpointConnectionInner get( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -154,7 +154,7 @@ Mono>> putWithResponseAsync( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -174,7 +174,7 @@ PollerFlux, PrivateEndpointConnection /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -194,7 +194,7 @@ SyncPoller, PrivateEndpointConnection /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -216,7 +216,7 @@ SyncPoller, PrivateEndpointConnection /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -236,7 +236,7 @@ Mono putAsync( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -256,7 +256,7 @@ PrivateEndpointConnectionInner put( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -278,7 +278,7 @@ PrivateEndpointConnectionInner put( /** * Deletes the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -294,7 +294,7 @@ Mono> deleteWithResponseAsync( /** * Deletes the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -309,7 +309,7 @@ Mono> deleteWithResponseAsync( /** * Deletes the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -326,7 +326,7 @@ Response deleteWithResponse( /** * Deletes the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PrivateLinkResourcesClient.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PrivateLinkResourcesClient.java index 43e2fe3e4c3e..15728faef07a 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PrivateLinkResourcesClient.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/PrivateLinkResourcesClient.java @@ -16,7 +16,7 @@ public interface PrivateLinkResourcesClient { /** * Gets the private link resources that need to be created for a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -30,7 +30,7 @@ public interface PrivateLinkResourcesClient { /** * Gets the private link resources that need to be created for a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -44,7 +44,7 @@ public interface PrivateLinkResourcesClient { /** * Gets the private link resources that need to be created for a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/RedisClient.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/RedisClient.java index 4575e22d3654..135ab491490d 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/RedisClient.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/RedisClient.java @@ -20,6 +20,7 @@ import com.azure.resourcemanager.redis.models.CheckNameAvailabilityParameters; import com.azure.resourcemanager.redis.models.ExportRdbParameters; import com.azure.resourcemanager.redis.models.ImportRdbParameters; +import com.azure.resourcemanager.redis.models.OperationStatusResult; import com.azure.resourcemanager.redis.models.RedisCreateParameters; import com.azure.resourcemanager.redis.models.RedisRebootParameters; import com.azure.resourcemanager.redis.models.RedisRegenerateKeyParameters; @@ -89,7 +90,7 @@ public interface RedisClient /** * Gets any upgrade notifications for a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -104,7 +105,7 @@ PagedFlux listUpgradeNotificationsAsync( /** * Gets any upgrade notifications for a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -119,7 +120,7 @@ PagedIterable listUpgradeNotifications( /** * Gets any upgrade notifications for a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications. * @param context The context to associate with this operation. @@ -135,7 +136,7 @@ PagedIterable listUpgradeNotifications( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -151,7 +152,7 @@ Mono>> createWithResponseAsync( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -166,7 +167,7 @@ PollerFlux, RedisResourceInner> beginCreateAsync( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -181,7 +182,7 @@ SyncPoller, RedisResourceInner> beginCreate( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param context The context to associate with this operation. @@ -197,7 +198,7 @@ SyncPoller, RedisResourceInner> beginCreate( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -211,7 +212,7 @@ SyncPoller, RedisResourceInner> beginCreate( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -225,7 +226,7 @@ SyncPoller, RedisResourceInner> beginCreate( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param context The context to associate with this operation. @@ -240,7 +241,7 @@ SyncPoller, RedisResourceInner> beginCreate( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -256,7 +257,7 @@ Mono>> updateWithResponseAsync( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -271,7 +272,7 @@ PollerFlux, RedisResourceInner> beginUpdateAsync( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -286,7 +287,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param context The context to associate with this operation. @@ -302,7 +303,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -316,7 +317,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -330,7 +331,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param context The context to associate with this operation. @@ -345,7 +346,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -358,7 +359,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -371,7 +372,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -384,7 +385,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -398,7 +399,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -411,7 +412,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -423,7 +424,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -436,7 +437,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Gets a Redis cache (resource description). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -450,7 +451,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Gets a Redis cache (resource description). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -463,7 +464,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Gets a Redis cache (resource description). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -477,7 +478,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Gets a Redis cache (resource description). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -490,7 +491,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Lists all Redis caches in a resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -502,7 +503,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Lists all Redis caches in a resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -514,7 +515,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Lists all Redis caches in a resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -559,7 +560,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -572,7 +573,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -585,7 +586,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -599,7 +600,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -612,7 +613,7 @@ SyncPoller, RedisResourceInner> beginUpdate( /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -627,7 +628,7 @@ Mono> regenerateKeyWithResponseAsync( /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -642,7 +643,7 @@ Mono regenerateKeyAsync( /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @param context The context to associate with this operation. @@ -658,7 +659,7 @@ Response regenerateKeyWithResponse( /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -673,7 +674,7 @@ Response regenerateKeyWithResponse( * Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be * potential data loss. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -690,7 +691,7 @@ Mono> forceRebootWithResponseAsync( * Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be * potential data loss. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -706,7 +707,7 @@ Mono forceRebootAsync( * Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be * potential data loss. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @param context The context to associate with this operation. @@ -723,7 +724,7 @@ Response forceRebootWithResponse( * Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be * potential data loss. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -737,7 +738,7 @@ Response forceRebootWithResponse( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -752,7 +753,7 @@ Mono>> importDataWithResponseAsync( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -767,7 +768,7 @@ PollerFlux, Void> beginImportDataAsync( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -782,7 +783,7 @@ SyncPoller, Void> beginImportData( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param context The context to associate with this operation. @@ -798,7 +799,7 @@ SyncPoller, Void> beginImportData( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -812,7 +813,7 @@ SyncPoller, Void> beginImportData( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -825,7 +826,7 @@ SyncPoller, Void> beginImportData( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param context The context to associate with this operation. @@ -839,7 +840,7 @@ SyncPoller, Void> beginImportData( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -854,7 +855,7 @@ Mono>> exportDataWithResponseAsync( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -869,7 +870,7 @@ PollerFlux, Void> beginExportDataAsync( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -884,7 +885,7 @@ SyncPoller, Void> beginExportData( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param context The context to associate with this operation. @@ -900,7 +901,7 @@ SyncPoller, Void> beginExportData( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -914,7 +915,7 @@ SyncPoller, Void> beginExportData( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -927,7 +928,7 @@ SyncPoller, Void> beginExportData( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param context The context to associate with this operation. @@ -937,4 +938,101 @@ SyncPoller, Void> beginExportData( */ @ServiceMethod(returns = ReturnType.SINGLE) void exportData(String resourceGroupName, String name, ExportRdbParameters parameters, Context context); + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> flushCacheWithResponseAsync(String resourceGroupName, String cacheName); + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, OperationStatusResult> beginFlushCacheAsync( + String resourceGroupName, String cacheName); + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperationStatusResult> beginFlushCache( + String resourceGroupName, String cacheName); + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OperationStatusResult> beginFlushCache( + String resourceGroupName, String cacheName, Context context); + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono flushCacheAsync(String resourceGroupName, String cacheName); + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusResult flushCache(String resourceGroupName, String cacheName); + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusResult flushCache(String resourceGroupName, String cacheName, Context context); } diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/RedisManagementClient.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/RedisManagementClient.java index 86f609079acb..77bb2abed03d 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/RedisManagementClient.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/RedisManagementClient.java @@ -10,8 +10,7 @@ /** The interface for RedisManagementClient class. */ public interface RedisManagementClient { /** - * Gets Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID - * forms part of the URI for every service call. + * Gets The ID of the target subscription. * * @return the subscriptionId value. */ @@ -100,4 +99,18 @@ public interface RedisManagementClient { * @return the AsyncOperationStatusClient object. */ AsyncOperationStatusClient getAsyncOperationStatus(); + + /** + * Gets the AccessPoliciesClient object to access its operations. + * + * @return the AccessPoliciesClient object. + */ + AccessPoliciesClient getAccessPolicies(); + + /** + * Gets the AccessPolicyAssignmentsClient object to access its operations. + * + * @return the AccessPolicyAssignmentsClient object. + */ + AccessPolicyAssignmentsClient getAccessPolicyAssignments(); } diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/OperationStatusInner.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/OperationStatusInner.java index 7bec1feadda4..d5429273d6e7 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/OperationStatusInner.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/OperationStatusInner.java @@ -5,7 +5,7 @@ package com.azure.resourcemanager.redis.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.redis.models.ErrorDetail; +import com.azure.core.management.exception.ManagementError; import com.azure.resourcemanager.redis.models.OperationStatusResult; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -98,7 +98,7 @@ public OperationStatusInner withOperations(List operation /** {@inheritDoc} */ @Override - public OperationStatusInner withError(ErrorDetail error) { + public OperationStatusInner withError(ManagementError error) { super.withError(error); return this; } diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyAssignmentInner.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyAssignmentInner.java new file mode 100644 index 000000000000..ea2d96f2e853 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyAssignmentInner.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.redis.models.AccessPolicyAssignmentProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response to an operation on access policy assignment. */ +@Fluent +public final class RedisCacheAccessPolicyAssignmentInner extends ProxyResource { + /* + * Properties of an access policy assignment + */ + @JsonProperty(value = "properties") + private RedisCacheAccessPolicyAssignmentProperties innerProperties; + + /** Creates an instance of RedisCacheAccessPolicyAssignmentInner class. */ + public RedisCacheAccessPolicyAssignmentInner() { + } + + /** + * Get the innerProperties property: Properties of an access policy assignment. + * + * @return the innerProperties value. + */ + private RedisCacheAccessPolicyAssignmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the provisioningState property: Provisioning state of an access policy assignment set. + * + * @return the provisioningState value. + */ + public AccessPolicyAssignmentProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the objectId property: Object Id to assign access policy to. + * + * @return the objectId value. + */ + public String objectId() { + return this.innerProperties() == null ? null : this.innerProperties().objectId(); + } + + /** + * Set the objectId property: Object Id to assign access policy to. + * + * @param objectId the objectId value to set. + * @return the RedisCacheAccessPolicyAssignmentInner object itself. + */ + public RedisCacheAccessPolicyAssignmentInner withObjectId(String objectId) { + if (this.innerProperties() == null) { + this.innerProperties = new RedisCacheAccessPolicyAssignmentProperties(); + } + this.innerProperties().withObjectId(objectId); + return this; + } + + /** + * Get the objectIdAlias property: User friendly name for object id. Also represents username for token based + * authentication. + * + * @return the objectIdAlias value. + */ + public String objectIdAlias() { + return this.innerProperties() == null ? null : this.innerProperties().objectIdAlias(); + } + + /** + * Set the objectIdAlias property: User friendly name for object id. Also represents username for token based + * authentication. + * + * @param objectIdAlias the objectIdAlias value to set. + * @return the RedisCacheAccessPolicyAssignmentInner object itself. + */ + public RedisCacheAccessPolicyAssignmentInner withObjectIdAlias(String objectIdAlias) { + if (this.innerProperties() == null) { + this.innerProperties = new RedisCacheAccessPolicyAssignmentProperties(); + } + this.innerProperties().withObjectIdAlias(objectIdAlias); + return this; + } + + /** + * Get the accessPolicyName property: The name of the access policy that is being assigned. + * + * @return the accessPolicyName value. + */ + public String accessPolicyName() { + return this.innerProperties() == null ? null : this.innerProperties().accessPolicyName(); + } + + /** + * Set the accessPolicyName property: The name of the access policy that is being assigned. + * + * @param accessPolicyName the accessPolicyName value to set. + * @return the RedisCacheAccessPolicyAssignmentInner object itself. + */ + public RedisCacheAccessPolicyAssignmentInner withAccessPolicyName(String accessPolicyName) { + if (this.innerProperties() == null) { + this.innerProperties = new RedisCacheAccessPolicyAssignmentProperties(); + } + this.innerProperties().withAccessPolicyName(accessPolicyName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyAssignmentProperties.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyAssignmentProperties.java new file mode 100644 index 000000000000..6a4e663acfc7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyAssignmentProperties.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.redis.models.AccessPolicyAssignmentProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for an access policy assignment. */ +@Fluent +public final class RedisCacheAccessPolicyAssignmentProperties { + /* + * Provisioning state of an access policy assignment set + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private AccessPolicyAssignmentProvisioningState provisioningState; + + /* + * Object Id to assign access policy to + */ + @JsonProperty(value = "objectId", required = true) + private String objectId; + + /* + * User friendly name for object id. Also represents username for token based authentication + */ + @JsonProperty(value = "objectIdAlias", required = true) + private String objectIdAlias; + + /* + * The name of the access policy that is being assigned + */ + @JsonProperty(value = "accessPolicyName", required = true) + private String accessPolicyName; + + /** Creates an instance of RedisCacheAccessPolicyAssignmentProperties class. */ + public RedisCacheAccessPolicyAssignmentProperties() { + } + + /** + * Get the provisioningState property: Provisioning state of an access policy assignment set. + * + * @return the provisioningState value. + */ + public AccessPolicyAssignmentProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the objectId property: Object Id to assign access policy to. + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the objectId property: Object Id to assign access policy to. + * + * @param objectId the objectId value to set. + * @return the RedisCacheAccessPolicyAssignmentProperties object itself. + */ + public RedisCacheAccessPolicyAssignmentProperties withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the objectIdAlias property: User friendly name for object id. Also represents username for token based + * authentication. + * + * @return the objectIdAlias value. + */ + public String objectIdAlias() { + return this.objectIdAlias; + } + + /** + * Set the objectIdAlias property: User friendly name for object id. Also represents username for token based + * authentication. + * + * @param objectIdAlias the objectIdAlias value to set. + * @return the RedisCacheAccessPolicyAssignmentProperties object itself. + */ + public RedisCacheAccessPolicyAssignmentProperties withObjectIdAlias(String objectIdAlias) { + this.objectIdAlias = objectIdAlias; + return this; + } + + /** + * Get the accessPolicyName property: The name of the access policy that is being assigned. + * + * @return the accessPolicyName value. + */ + public String accessPolicyName() { + return this.accessPolicyName; + } + + /** + * Set the accessPolicyName property: The name of the access policy that is being assigned. + * + * @param accessPolicyName the accessPolicyName value to set. + * @return the RedisCacheAccessPolicyAssignmentProperties object itself. + */ + public RedisCacheAccessPolicyAssignmentProperties withAccessPolicyName(String accessPolicyName) { + this.accessPolicyName = accessPolicyName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (objectId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property objectId in model RedisCacheAccessPolicyAssignmentProperties")); + } + if (objectIdAlias() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property objectIdAlias in model RedisCacheAccessPolicyAssignmentProperties")); + } + if (accessPolicyName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property accessPolicyName in model" + + " RedisCacheAccessPolicyAssignmentProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RedisCacheAccessPolicyAssignmentProperties.class); +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyInner.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyInner.java new file mode 100644 index 000000000000..b20e9eb1ab96 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyInner.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.redis.models.AccessPolicyProvisioningState; +import com.azure.resourcemanager.redis.models.AccessPolicyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response to get/put access policy. */ +@Fluent +public final class RedisCacheAccessPolicyInner extends ProxyResource { + /* + * Properties of an access policy. + */ + @JsonProperty(value = "properties") + private RedisCacheAccessPolicyProperties innerProperties; + + /** Creates an instance of RedisCacheAccessPolicyInner class. */ + public RedisCacheAccessPolicyInner() { + } + + /** + * Get the innerProperties property: Properties of an access policy. + * + * @return the innerProperties value. + */ + private RedisCacheAccessPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the provisioningState property: Provisioning state of access policy. + * + * @return the provisioningState value. + */ + public AccessPolicyProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the type property: Built-In or Custom access policy. + * + * @return the type value. + */ + public AccessPolicyType typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Get the permissions property: Permissions for the access policy. Learn how to configure permissions at + * https://aka.ms/redis/AADPreRequisites. + * + * @return the permissions value. + */ + public String permissions() { + return this.innerProperties() == null ? null : this.innerProperties().permissions(); + } + + /** + * Set the permissions property: Permissions for the access policy. Learn how to configure permissions at + * https://aka.ms/redis/AADPreRequisites. + * + * @param permissions the permissions value to set. + * @return the RedisCacheAccessPolicyInner object itself. + */ + public RedisCacheAccessPolicyInner withPermissions(String permissions) { + if (this.innerProperties() == null) { + this.innerProperties = new RedisCacheAccessPolicyProperties(); + } + this.innerProperties().withPermissions(permissions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyProperties.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyProperties.java new file mode 100644 index 000000000000..da52666f7c50 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCacheAccessPolicyProperties.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.redis.models.AccessPolicyProvisioningState; +import com.azure.resourcemanager.redis.models.AccessPolicyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** All properties of an access policy. */ +@Fluent +public final class RedisCacheAccessPolicyProperties { + /* + * Provisioning state of access policy + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private AccessPolicyProvisioningState provisioningState; + + /* + * Built-In or Custom access policy + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private AccessPolicyType type; + + /* + * Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites + */ + @JsonProperty(value = "permissions", required = true) + private String permissions; + + /** Creates an instance of RedisCacheAccessPolicyProperties class. */ + public RedisCacheAccessPolicyProperties() { + } + + /** + * Get the provisioningState property: Provisioning state of access policy. + * + * @return the provisioningState value. + */ + public AccessPolicyProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the type property: Built-In or Custom access policy. + * + * @return the type value. + */ + public AccessPolicyType type() { + return this.type; + } + + /** + * Get the permissions property: Permissions for the access policy. Learn how to configure permissions at + * https://aka.ms/redis/AADPreRequisites. + * + * @return the permissions value. + */ + public String permissions() { + return this.permissions; + } + + /** + * Set the permissions property: Permissions for the access policy. Learn how to configure permissions at + * https://aka.ms/redis/AADPreRequisites. + * + * @param permissions the permissions value to set. + * @return the RedisCacheAccessPolicyProperties object itself. + */ + public RedisCacheAccessPolicyProperties withPermissions(String permissions) { + this.permissions = permissions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (permissions() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property permissions in model RedisCacheAccessPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RedisCacheAccessPolicyProperties.class); +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCreateProperties.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCreateProperties.java index abc140107df6..a83a1b8205b0 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCreateProperties.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisCreateProperties.java @@ -11,6 +11,7 @@ import com.azure.resourcemanager.redis.models.RedisConfiguration; import com.azure.resourcemanager.redis.models.Sku; import com.azure.resourcemanager.redis.models.TlsVersion; +import com.azure.resourcemanager.redis.models.UpdateChannel; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -170,6 +171,13 @@ public RedisCreateProperties withPublicNetworkAccess(PublicNetworkAccess publicN return this; } + /** {@inheritDoc} */ + @Override + public RedisCreateProperties withUpdateChannel(UpdateChannel updateChannel) { + super.withUpdateChannel(updateChannel); + return this; + } + /** * Validates the instance. * diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisPropertiesInner.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisPropertiesInner.java index da12e0a7cf46..dec736dec0a1 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisPropertiesInner.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisPropertiesInner.java @@ -12,6 +12,7 @@ import com.azure.resourcemanager.redis.models.RedisLinkedServer; import com.azure.resourcemanager.redis.models.Sku; import com.azure.resourcemanager.redis.models.TlsVersion; +import com.azure.resourcemanager.redis.models.UpdateChannel; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map; @@ -229,6 +230,13 @@ public RedisPropertiesInner withPublicNetworkAccess(PublicNetworkAccess publicNe return this; } + /** {@inheritDoc} */ + @Override + public RedisPropertiesInner withUpdateChannel(UpdateChannel updateChannel) { + super.withUpdateChannel(updateChannel); + return this; + } + /** * Validates the instance. * diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisResourceInner.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisResourceInner.java index 2631c85c07e4..8dbb5bb9269a 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisResourceInner.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisResourceInner.java @@ -15,6 +15,7 @@ import com.azure.resourcemanager.redis.models.RedisLinkedServer; import com.azure.resourcemanager.redis.models.Sku; import com.azure.resourcemanager.redis.models.TlsVersion; +import com.azure.resourcemanager.redis.models.UpdateChannel; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; import java.util.Map; @@ -477,6 +478,33 @@ public RedisResourceInner withPublicNetworkAccess(PublicNetworkAccess publicNetw return this; } + /** + * Get the updateChannel property: Optional: Specifies the update channel for the monthly Redis updates your Redis + * Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of + * 'Stable' channel caches. Default value is 'Stable'. + * + * @return the updateChannel value. + */ + public UpdateChannel updateChannel() { + return this.innerProperties() == null ? null : this.innerProperties().updateChannel(); + } + + /** + * Set the updateChannel property: Optional: Specifies the update channel for the monthly Redis updates your Redis + * Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of + * 'Stable' channel caches. Default value is 'Stable'. + * + * @param updateChannel the updateChannel value to set. + * @return the RedisResourceInner object itself. + */ + public RedisResourceInner withUpdateChannel(UpdateChannel updateChannel) { + if (this.innerProperties() == null) { + this.innerProperties = new RedisPropertiesInner(); + } + this.innerProperties().withUpdateChannel(updateChannel); + return this; + } + /** * Validates the instance. * diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisUpdateProperties.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisUpdateProperties.java index a54d0093159b..92f6e7f3da14 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisUpdateProperties.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/fluent/models/RedisUpdateProperties.java @@ -10,6 +10,7 @@ import com.azure.resourcemanager.redis.models.RedisConfiguration; import com.azure.resourcemanager.redis.models.Sku; import com.azure.resourcemanager.redis.models.TlsVersion; +import com.azure.resourcemanager.redis.models.UpdateChannel; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -109,6 +110,13 @@ public RedisUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicN return this; } + /** {@inheritDoc} */ + @Override + public RedisUpdateProperties withUpdateChannel(UpdateChannel updateChannel) { + super.withUpdateChannel(updateChannel); + return this; + } + /** * Validates the instance. * diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/AccessPoliciesClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/AccessPoliciesClientImpl.java new file mode 100644 index 000000000000..b04eeb68da12 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/AccessPoliciesClientImpl.java @@ -0,0 +1,1125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.redis.fluent.AccessPoliciesClient; +import com.azure.resourcemanager.redis.fluent.models.RedisCacheAccessPolicyInner; +import com.azure.resourcemanager.redis.models.RedisCacheAccessPolicyList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AccessPoliciesClient. */ +public final class AccessPoliciesClientImpl implements AccessPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final AccessPoliciesService service; + + /** The service client containing this operation class. */ + private final RedisManagementClientImpl client; + + /** + * Initializes an instance of AccessPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccessPoliciesClientImpl(RedisManagementClientImpl client) { + this.service = + RestProxy.create(AccessPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RedisManagementClientAccessPolicies to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RedisManagementClien") + public interface AccessPoliciesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @PathParam("accessPolicyName") String accessPolicyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") RedisCacheAccessPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @PathParam("accessPolicyName") String accessPolicyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @PathParam("accessPolicyName") String accessPolicyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createUpdateWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter accessPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdate( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateWithResponseAsync( + String resourceGroupName, + String cacheName, + String accessPolicyName, + RedisCacheAccessPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter accessPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdate( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, RedisCacheAccessPolicyInner> beginCreateUpdateAsync( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters) { + Mono>> mono = + createUpdateWithResponseAsync(resourceGroupName, cacheName, accessPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RedisCacheAccessPolicyInner.class, + RedisCacheAccessPolicyInner.class, + this.client.getContext()); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RedisCacheAccessPolicyInner> beginCreateUpdateAsync( + String resourceGroupName, + String cacheName, + String accessPolicyName, + RedisCacheAccessPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateWithResponseAsync(resourceGroupName, cacheName, accessPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RedisCacheAccessPolicyInner.class, + RedisCacheAccessPolicyInner.class, + context); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RedisCacheAccessPolicyInner> beginCreateUpdate( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters) { + return this.beginCreateUpdateAsync(resourceGroupName, cacheName, accessPolicyName, parameters).getSyncPoller(); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RedisCacheAccessPolicyInner> beginCreateUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyName, + RedisCacheAccessPolicyInner parameters, + Context context) { + return this + .beginCreateUpdateAsync(resourceGroupName, cacheName, accessPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createUpdateAsync( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters) { + return beginCreateUpdateAsync(resourceGroupName, cacheName, accessPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateAsync( + String resourceGroupName, + String cacheName, + String accessPolicyName, + RedisCacheAccessPolicyInner parameters, + Context context) { + return beginCreateUpdateAsync(resourceGroupName, cacheName, accessPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RedisCacheAccessPolicyInner createUpdate( + String resourceGroupName, String cacheName, String accessPolicyName, RedisCacheAccessPolicyInner parameters) { + return createUpdateAsync(resourceGroupName, cacheName, accessPolicyName, parameters).block(); + } + + /** + * Adds an access policy to the redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to get/put access policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RedisCacheAccessPolicyInner createUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyName, + RedisCacheAccessPolicyInner parameters, + Context context) { + return createUpdateAsync(resourceGroupName, cacheName, accessPolicyName, parameters, context).block(); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter accessPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter accessPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cacheName, String accessPolicyName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cacheName, accessPolicyName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cacheName, String accessPolicyName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, cacheName, accessPolicyName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String cacheName, String accessPolicyName) { + return this.beginDeleteAsync(resourceGroupName, cacheName, accessPolicyName).getSyncPoller(); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String cacheName, String accessPolicyName, Context context) { + return this.beginDeleteAsync(resourceGroupName, cacheName, accessPolicyName, context).getSyncPoller(); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String cacheName, String accessPolicyName) { + return beginDeleteAsync(resourceGroupName, cacheName, accessPolicyName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String cacheName, String accessPolicyName, Context context) { + return beginDeleteAsync(resourceGroupName, cacheName, accessPolicyName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cacheName, String accessPolicyName) { + deleteAsync(resourceGroupName, cacheName, accessPolicyName).block(); + } + + /** + * Deletes the access policy from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cacheName, String accessPolicyName, Context context) { + deleteAsync(resourceGroupName, cacheName, accessPolicyName, context).block(); + } + + /** + * Gets the detailed information about an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the detailed information about an access policy of a redis cache along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter accessPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the detailed information about an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the detailed information about an access policy of a redis cache along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter accessPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the detailed information about an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the detailed information about an access policy of a redis cache on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String cacheName, String accessPolicyName) { + return getWithResponseAsync(resourceGroupName, cacheName, accessPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the detailed information about an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the detailed information about an access policy of a redis cache along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String cacheName, String accessPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, cacheName, accessPolicyName, context).block(); + } + + /** + * Gets the detailed information about an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the detailed information about an access policy of a redis cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RedisCacheAccessPolicyInner get(String resourceGroupName, String cacheName, String accessPolicyName) { + return getWithResponse(resourceGroupName, cacheName, accessPolicyName, Context.NONE).getValue(); + } + + /** + * Gets the list of access policies associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policies associated with this redis cache along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String cacheName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of access policies associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policies associated with this redis cache along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String cacheName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of access policies associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policies associated with this redis cache as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String resourceGroupName, String cacheName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, cacheName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of access policies associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policies associated with this redis cache as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String cacheName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, cacheName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of access policies associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policies associated with this redis cache as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String cacheName) { + return new PagedIterable<>(listAsync(resourceGroupName, cacheName)); + } + + /** + * Gets the list of access policies associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policies associated with this redis cache as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String cacheName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, cacheName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of access policies (with properties) of a Redis cache along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of access policies (with properties) of a Redis cache along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/AccessPolicyAssignmentsClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/AccessPolicyAssignmentsClientImpl.java new file mode 100644 index 000000000000..f2a8f142634a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/AccessPolicyAssignmentsClientImpl.java @@ -0,0 +1,1164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.redis.fluent.AccessPolicyAssignmentsClient; +import com.azure.resourcemanager.redis.fluent.models.RedisCacheAccessPolicyAssignmentInner; +import com.azure.resourcemanager.redis.models.RedisCacheAccessPolicyAssignmentList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AccessPolicyAssignmentsClient. */ +public final class AccessPolicyAssignmentsClientImpl implements AccessPolicyAssignmentsClient { + /** The proxy service used to perform REST calls. */ + private final AccessPolicyAssignmentsService service; + + /** The service client containing this operation class. */ + private final RedisManagementClientImpl client; + + /** + * Initializes an instance of AccessPolicyAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccessPolicyAssignmentsClientImpl(RedisManagementClientImpl client) { + this.service = + RestProxy + .create(AccessPolicyAssignmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RedisManagementClientAccessPolicyAssignments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RedisManagementClien") + public interface AccessPolicyAssignmentsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @PathParam("accessPolicyAssignmentName") String accessPolicyAssignmentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") RedisCacheAccessPolicyAssignmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @PathParam("accessPolicyAssignmentName") String accessPolicyAssignmentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @PathParam("accessPolicyAssignmentName") String accessPolicyAssignmentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createUpdateWithResponseAsync( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter accessPolicyAssignmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createUpdate( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createUpdateWithResponseAsync( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter accessPolicyAssignmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createUpdate( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, RedisCacheAccessPolicyAssignmentInner> + beginCreateUpdateAsync( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters) { + Mono>> mono = + createUpdateWithResponseAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RedisCacheAccessPolicyAssignmentInner.class, + RedisCacheAccessPolicyAssignmentInner.class, + this.client.getContext()); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RedisCacheAccessPolicyAssignmentInner> + beginCreateUpdateAsync( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createUpdateWithResponseAsync( + resourceGroupName, cacheName, accessPolicyAssignmentName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RedisCacheAccessPolicyAssignmentInner.class, + RedisCacheAccessPolicyAssignmentInner.class, + context); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RedisCacheAccessPolicyAssignmentInner> + beginCreateUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters) { + return this + .beginCreateUpdateAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, parameters) + .getSyncPoller(); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RedisCacheAccessPolicyAssignmentInner> + beginCreateUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters, + Context context) { + return this + .beginCreateUpdateAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, parameters, context) + .getSyncPoller(); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createUpdateAsync( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters) { + return beginCreateUpdateAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createUpdateAsync( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters, + Context context) { + return beginCreateUpdateAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RedisCacheAccessPolicyAssignmentInner createUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters) { + return createUpdateAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, parameters).block(); + } + + /** + * Adds the access policy assignment to the specified users. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response to an operation on access policy assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RedisCacheAccessPolicyAssignmentInner createUpdate( + String resourceGroupName, + String cacheName, + String accessPolicyAssignmentName, + RedisCacheAccessPolicyAssignmentInner parameters, + Context context) { + return createUpdateAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, parameters, context).block(); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter accessPolicyAssignmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter accessPolicyAssignmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, cacheName, accessPolicyAssignmentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName) { + return this.beginDeleteAsync(resourceGroupName, cacheName, accessPolicyAssignmentName).getSyncPoller(); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context) { + return this.beginDeleteAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, context).getSyncPoller(); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String cacheName, String accessPolicyAssignmentName) { + return beginDeleteAsync(resourceGroupName, cacheName, accessPolicyAssignmentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context) { + return beginDeleteAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cacheName, String accessPolicyAssignmentName) { + deleteAsync(resourceGroupName, cacheName, accessPolicyAssignmentName).block(); + } + + /** + * Deletes the access policy assignment from a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context) { + deleteAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, context).block(); + } + + /** + * Gets the list of assignments for an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of assignments for an access policy of a redis cache along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter accessPolicyAssignmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of assignments for an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of assignments for an access policy of a redis cache along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (accessPolicyAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter accessPolicyAssignmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the list of assignments for an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of assignments for an access policy of a redis cache on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName) { + return getWithResponseAsync(resourceGroupName, cacheName, accessPolicyAssignmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the list of assignments for an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of assignments for an access policy of a redis cache along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName, Context context) { + return getWithResponseAsync(resourceGroupName, cacheName, accessPolicyAssignmentName, context).block(); + } + + /** + * Gets the list of assignments for an access policy of a redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of assignments for an access policy of a redis cache. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RedisCacheAccessPolicyAssignmentInner get( + String resourceGroupName, String cacheName, String accessPolicyAssignmentName) { + return getWithResponse(resourceGroupName, cacheName, accessPolicyAssignmentName, Context.NONE).getValue(); + } + + /** + * Gets the list of access policy assignments associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policy assignments associated with this redis cache along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String cacheName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of access policy assignments associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policy assignments associated with this redis cache along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String cacheName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of access policy assignments associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policy assignments associated with this redis cache as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String resourceGroupName, String cacheName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, cacheName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of access policy assignments associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policy assignments associated with this redis cache as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String cacheName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, cacheName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of access policy assignments associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policy assignments associated with this redis cache as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String cacheName) { + return new PagedIterable<>(listAsync(resourceGroupName, cacheName)); + } + + /** + * Gets the list of access policy assignments associated with this redis cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of access policy assignments associated with this redis cache as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String cacheName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, cacheName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of access policies assignments (with properties) of a Redis cache along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of access policies assignments (with properties) of a Redis cache along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/FirewallRulesClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/FirewallRulesClientImpl.java index 17ea7919f8b4..2743d07ac217 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/FirewallRulesClientImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/FirewallRulesClientImpl.java @@ -133,7 +133,7 @@ Mono> listNext( /** * Gets all firewall rules in the specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -191,7 +191,7 @@ private Mono> listSinglePageAsync( /** * Gets all firewall rules in the specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -247,7 +247,7 @@ private Mono> listSinglePageAsync( /** * Gets all firewall rules in the specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -263,7 +263,7 @@ public PagedFlux listAsync(String resourceGroupName, Str /** * Gets all firewall rules in the specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -281,7 +281,7 @@ private PagedFlux listAsync(String resourceGroupName, St /** * Gets all firewall rules in the specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -296,7 +296,7 @@ public PagedIterable list(String resourceGroupName, Stri /** * Gets all firewall rules in the specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -312,7 +312,7 @@ public PagedIterable list(String resourceGroupName, Stri /** * Create or update a redis cache firewall rule. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -373,7 +373,7 @@ public Mono> createOrUpdateWithResponseAsync( /** * Create or update a redis cache firewall rule. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -436,7 +436,7 @@ private Mono> createOrUpdateWithResponseAsync( /** * Create or update a redis cache firewall rule. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -456,7 +456,7 @@ public Mono createOrUpdateAsync( /** * Create or update a redis cache firewall rule. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -480,7 +480,7 @@ public Response createOrUpdateWithResponse( /** * Create or update a redis cache firewall rule. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -499,7 +499,7 @@ public RedisFirewallRuleInner createOrUpdate( /** * Gets a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -553,7 +553,7 @@ public Mono> getWithResponseAsync( /** * Gets a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param context The context to associate with this operation. @@ -605,7 +605,7 @@ private Mono> getWithResponseAsync( /** * Gets a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -622,7 +622,7 @@ public Mono getAsync(String resourceGroupName, String ca /** * Gets a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param context The context to associate with this operation. @@ -640,7 +640,7 @@ public Response getWithResponse( /** * Gets a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -656,7 +656,7 @@ public RedisFirewallRuleInner get(String resourceGroupName, String cacheName, St /** * Deletes a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -708,7 +708,7 @@ public Mono> deleteWithResponseAsync(String resourceGroupName, St /** * Deletes a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param context The context to associate with this operation. @@ -759,7 +759,7 @@ private Mono> deleteWithResponseAsync( /** * Deletes a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -775,7 +775,7 @@ public Mono deleteAsync(String resourceGroupName, String cacheName, String /** * Deletes a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param context The context to associate with this operation. @@ -793,7 +793,7 @@ public Response deleteWithResponse( /** * Deletes a single firewall rule in a specified redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/LinkedServersClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/LinkedServersClientImpl.java index c24d776e7b15..72f734b4e6ef 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/LinkedServersClientImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/LinkedServersClientImpl.java @@ -139,7 +139,7 @@ Mono> listNext( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -201,7 +201,7 @@ public Mono>> createWithResponseAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -265,7 +265,7 @@ private Mono>> createWithResponseAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -297,7 +297,7 @@ private Mono>> createWithResponseAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -332,7 +332,7 @@ private Mono>> createWithResponseAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -355,7 +355,7 @@ private Mono>> createWithResponseAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -380,7 +380,7 @@ private Mono>> createWithResponseAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -401,7 +401,7 @@ public Mono createAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -427,7 +427,7 @@ private Mono createAsync( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -445,7 +445,7 @@ public RedisLinkedServerWithPropertiesInner create( /** * Adds a linked server to the Redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -468,7 +468,7 @@ public RedisLinkedServerWithPropertiesInner create( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -522,7 +522,7 @@ public Mono>> deleteWithResponseAsync( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param context The context to associate with this operation. @@ -574,7 +574,7 @@ private Mono>> deleteWithResponseAsync( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -595,7 +595,7 @@ public PollerFlux, Void> beginDeleteAsync( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param context The context to associate with this operation. @@ -618,7 +618,7 @@ private PollerFlux, Void> beginDeleteAsync( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -635,7 +635,7 @@ public SyncPoller, Void> beginDelete( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param context The context to associate with this operation. @@ -653,7 +653,7 @@ public SyncPoller, Void> beginDelete( /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -671,7 +671,7 @@ public Mono deleteAsync(String resourceGroupName, String name, String link /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param context The context to associate with this operation. @@ -690,7 +690,7 @@ private Mono deleteAsync(String resourceGroupName, String name, String lin /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -705,7 +705,7 @@ public void delete(String resourceGroupName, String name, String linkedServerNam /** * Deletes the linked server from a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param context The context to associate with this operation. @@ -721,7 +721,7 @@ public void delete(String resourceGroupName, String name, String linkedServerNam /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -776,7 +776,7 @@ public Mono> getWithResponseAsync /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @param context The context to associate with this operation. @@ -829,7 +829,7 @@ private Mono> getWithResponseAsyn /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -848,7 +848,7 @@ public Mono getAsync( /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @param context The context to associate with this operation. @@ -867,7 +867,7 @@ public Response getWithResponse( /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -883,7 +883,7 @@ public RedisLinkedServerWithPropertiesInner get(String resourceGroupName, String /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -941,7 +941,7 @@ private Mono> listSinglePage /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -997,7 +997,7 @@ private Mono> listSinglePage /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1014,7 +1014,7 @@ public PagedFlux listAsync(String resource /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1034,7 +1034,7 @@ private PagedFlux listAsync( /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1050,7 +1050,7 @@ public PagedIterable list(String resourceG /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PatchSchedulesClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PatchSchedulesClientImpl.java index 10f7b9af7a51..900175cb6a79 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PatchSchedulesClientImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PatchSchedulesClientImpl.java @@ -134,7 +134,7 @@ Mono> listByRedisResourceNext( /** * Gets all patch schedules in the specified redis cache (there is only one). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -192,7 +192,7 @@ private Mono> listByRedisResourceSinglePa /** * Gets all patch schedules in the specified redis cache (there is only one). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -248,7 +248,7 @@ private Mono> listByRedisResourceSinglePa /** * Gets all patch schedules in the specified redis cache (there is only one). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -266,7 +266,7 @@ public PagedFlux listByRedisResourceAsync(String resour /** * Gets all patch schedules in the specified redis cache (there is only one). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -286,7 +286,7 @@ private PagedFlux listByRedisResourceAsync( /** * Gets all patch schedules in the specified redis cache (there is only one). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -302,7 +302,7 @@ public PagedIterable listByRedisResource(String resourc /** * Gets all patch schedules in the specified redis cache (there is only one). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -320,7 +320,7 @@ public PagedIterable listByRedisResource( /** * Create or replace the patching schedule for Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -382,7 +382,7 @@ public Mono> createOrUpdateWithResponseAsync( /** * Create or replace the patching schedule for Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -446,7 +446,7 @@ private Mono> createOrUpdateWithResponseAsync( /** * Create or replace the patching schedule for Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -465,7 +465,7 @@ public Mono createOrUpdateAsync( /** * Create or replace the patching schedule for Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -488,7 +488,7 @@ public Response createOrUpdateWithResponse( /** * Create or replace the patching schedule for Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -507,7 +507,7 @@ public RedisPatchScheduleInner createOrUpdate( /** * Deletes the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -561,7 +561,7 @@ public Mono> deleteWithResponseAsync( /** * Deletes the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param context The context to associate with this operation. @@ -613,7 +613,7 @@ private Mono> deleteWithResponseAsync( /** * Deletes the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -629,7 +629,7 @@ public Mono deleteAsync(String resourceGroupName, String name, DefaultName /** * Deletes the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param context The context to associate with this operation. @@ -647,7 +647,7 @@ public Response deleteWithResponse( /** * Deletes the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -662,7 +662,7 @@ public void delete(String resourceGroupName, String name, DefaultName defaultPar /** * Gets the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -717,7 +717,7 @@ public Mono> getWithResponseAsync( /** * Gets the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param context The context to associate with this operation. @@ -770,7 +770,7 @@ private Mono> getWithResponseAsync( /** * Gets the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -787,7 +787,7 @@ public Mono getAsync(String resourceGroupName, String n /** * Gets the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @param context The context to associate with this operation. @@ -805,7 +805,7 @@ public Response getWithResponse( /** * Gets the patching schedule of a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParameter Default string modeled as parameter for auto generation to work correctly. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PrivateEndpointConnectionsClientImpl.java index 4450904db00a..d9097439795f 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PrivateEndpointConnectionsClientImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PrivateEndpointConnectionsClientImpl.java @@ -130,7 +130,7 @@ Mono> delete( /** * List all the private endpoint connections associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -183,7 +183,7 @@ private Mono> listSinglePageAsync( /** * List all the private endpoint connections associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -234,7 +234,7 @@ private Mono> listSinglePageAsync( /** * List all the private endpoint connections associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -250,7 +250,7 @@ public PagedFlux listAsync(String resourceGroupN /** * List all the private endpoint connections associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -268,7 +268,7 @@ private PagedFlux listAsync( /** * List all the private endpoint connections associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -284,7 +284,7 @@ public PagedIterable list(String resourceGroupNa /** * List all the private endpoint connections associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -302,7 +302,7 @@ public PagedIterable list( /** * Gets the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -360,7 +360,7 @@ public Mono> getWithResponseAsync( /** * Gets the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -416,7 +416,7 @@ private Mono> getWithResponseAsync( /** * Gets the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -436,7 +436,7 @@ public Mono getAsync( /** * Gets the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -455,7 +455,7 @@ public Response getWithResponse( /** * Gets the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -473,7 +473,7 @@ public PrivateEndpointConnectionInner get( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -541,7 +541,7 @@ public Mono>> putWithResponseAsync( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -608,7 +608,7 @@ private Mono>> putWithResponseAsync( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -639,7 +639,7 @@ public PollerFlux, PrivateEndpointCon /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -673,7 +673,7 @@ private PollerFlux, PrivateEndpointCo /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -697,7 +697,7 @@ public SyncPoller, PrivateEndpointCon /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -723,7 +723,7 @@ public SyncPoller, PrivateEndpointCon /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -747,7 +747,7 @@ public Mono putAsync( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -773,7 +773,7 @@ private Mono putAsync( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -795,7 +795,7 @@ public PrivateEndpointConnectionInner put( /** * Update the state of specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -819,7 +819,7 @@ public PrivateEndpointConnectionInner put( /** * Deletes the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -876,7 +876,7 @@ public Mono> deleteWithResponseAsync( /** * Deletes the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -931,7 +931,7 @@ private Mono> deleteWithResponseAsync( /** * Deletes the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -949,7 +949,7 @@ public Mono deleteAsync(String resourceGroupName, String cacheName, String /** * Deletes the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. @@ -968,7 +968,7 @@ public Response deleteWithResponse( /** * Deletes the specified private endpoint connection associated with the redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure * resource. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PrivateLinkResourcesClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PrivateLinkResourcesClientImpl.java index 903b49a312d3..710a33f85b06 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PrivateLinkResourcesClientImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/PrivateLinkResourcesClientImpl.java @@ -75,7 +75,7 @@ Mono> listByRedisCache( /** * Gets the private link resources that need to be created for a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -128,7 +128,7 @@ private Mono> listByRedisCacheSinglePage /** * Gets the private link resources that need to be created for a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -179,7 +179,7 @@ private Mono> listByRedisCacheSinglePage /** * Gets the private link resources that need to be created for a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -195,7 +195,7 @@ public PagedFlux listByRedisCacheAsync(String resource /** * Gets the private link resources that need to be created for a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -213,7 +213,7 @@ private PagedFlux listByRedisCacheAsync( /** * Gets the private link resources that need to be created for a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -229,7 +229,7 @@ public PagedIterable listByRedisCache(String resourceG /** * Gets the private link resources that need to be created for a redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisClientImpl.java index 4ff734fa9b1e..7068ecd7932a 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisClientImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisClientImpl.java @@ -42,6 +42,7 @@ import com.azure.resourcemanager.redis.models.ExportRdbParameters; import com.azure.resourcemanager.redis.models.ImportRdbParameters; import com.azure.resourcemanager.redis.models.NotificationListResponse; +import com.azure.resourcemanager.redis.models.OperationStatusResult; import com.azure.resourcemanager.redis.models.RedisCreateParameters; import com.azure.resourcemanager.redis.models.RedisListResult; import com.azure.resourcemanager.redis.models.RedisRebootParameters; @@ -265,6 +266,20 @@ Mono>> exportData( @HeaderParam("Accept") String accept, Context context); + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/flush") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> flushCache( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cacheName") String cacheName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @@ -432,7 +447,7 @@ public void checkNameAvailability(CheckNameAvailabilityParameters parameters) { /** * Gets any upgrade notifications for a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -492,7 +507,7 @@ private Mono> listUpgradeNotificationsSi /** * Gets any upgrade notifications for a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications. * @param context The context to associate with this operation. @@ -550,7 +565,7 @@ private Mono> listUpgradeNotificationsSi /** * Gets any upgrade notifications for a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -569,7 +584,7 @@ public PagedFlux listUpgradeNotificationsAsync( /** * Gets any upgrade notifications for a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications. * @param context The context to associate with this operation. @@ -589,7 +604,7 @@ private PagedFlux listUpgradeNotificationsAsync( /** * Gets any upgrade notifications for a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -606,7 +621,7 @@ public PagedIterable listUpgradeNotifications( /** * Gets any upgrade notifications for a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications. * @param context The context to associate with this operation. @@ -624,7 +639,7 @@ public PagedIterable listUpgradeNotifications( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -680,7 +695,7 @@ public Mono>> createWithResponseAsync( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param context The context to associate with this operation. @@ -734,7 +749,7 @@ private Mono>> createWithResponseAsync( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -759,7 +774,7 @@ public PollerFlux, RedisResourceInner> beginCreat /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param context The context to associate with this operation. @@ -782,7 +797,7 @@ private PollerFlux, RedisResourceInner> beginCrea /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -799,7 +814,7 @@ public SyncPoller, RedisResourceInner> beginCreat /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param context The context to associate with this operation. @@ -817,7 +832,7 @@ public SyncPoller, RedisResourceInner> beginCreat /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -836,7 +851,7 @@ public Mono createAsync( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param context The context to associate with this operation. @@ -856,7 +871,7 @@ private Mono createAsync( /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -872,7 +887,7 @@ public RedisResourceInner create(String resourceGroupName, String name, RedisCre /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param context The context to associate with this operation. @@ -890,7 +905,7 @@ public RedisResourceInner create( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -946,7 +961,7 @@ public Mono>> updateWithResponseAsync( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param context The context to associate with this operation. @@ -1000,7 +1015,7 @@ private Mono>> updateWithResponseAsync( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1025,7 +1040,7 @@ public PollerFlux, RedisResourceInner> beginUpdat /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param context The context to associate with this operation. @@ -1048,7 +1063,7 @@ private PollerFlux, RedisResourceInner> beginUpda /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1065,7 +1080,7 @@ public SyncPoller, RedisResourceInner> beginUpdat /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param context The context to associate with this operation. @@ -1083,7 +1098,7 @@ public SyncPoller, RedisResourceInner> beginUpdat /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1102,7 +1117,7 @@ public Mono updateAsync( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param context The context to associate with this operation. @@ -1122,7 +1137,7 @@ private Mono updateAsync( /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1138,7 +1153,7 @@ public RedisResourceInner update(String resourceGroupName, String name, RedisUpd /** * Update an existing Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param context The context to associate with this operation. @@ -1156,7 +1171,7 @@ public RedisResourceInner update( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1203,7 +1218,7 @@ public Mono>> deleteWithResponseAsync(String resourceG /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1249,7 +1264,7 @@ private Mono>> deleteWithResponseAsync( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1268,7 +1283,7 @@ public PollerFlux, Void> beginDeleteAsync(String resourceGroupN /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1289,7 +1304,7 @@ private PollerFlux, Void> beginDeleteAsync( /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1304,7 +1319,7 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1320,7 +1335,7 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1335,7 +1350,7 @@ public Mono deleteAsync(String resourceGroupName, String name) { /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1351,7 +1366,7 @@ private Mono deleteAsync(String resourceGroupName, String name, Context co /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1365,7 +1380,7 @@ public void delete(String resourceGroupName, String name) { /** * Deletes a Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1380,7 +1395,7 @@ public void delete(String resourceGroupName, String name, Context context) { /** * Gets a Redis cache (resource description). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1429,7 +1444,7 @@ public Mono> getByResourceGroupWithResponseAsync( /** * Gets a Redis cache (resource description). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1476,7 +1491,7 @@ private Mono> getByResourceGroupWithResponseAsync( /** * Gets a Redis cache (resource description). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1492,7 +1507,7 @@ public Mono getByResourceGroupAsync(String resourceGroupName /** * Gets a Redis cache (resource description). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1509,7 +1524,7 @@ public Response getByResourceGroupWithResponse( /** * Gets a Redis cache (resource description). * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1524,7 +1539,7 @@ public RedisResourceInner getByResourceGroup(String resourceGroupName, String na /** * Lists all Redis caches in a resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1576,7 +1591,7 @@ private Mono> listByResourceGroupSinglePageAsy /** * Lists all Redis caches in a resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1627,7 +1642,7 @@ private Mono> listByResourceGroupSinglePageAsy /** * Lists all Redis caches in a resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1643,7 +1658,7 @@ public PagedFlux listByResourceGroupAsync(String resourceGro /** * Lists all Redis caches in a resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1660,7 +1675,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGr /** * Lists all Redis caches in a resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1674,7 +1689,7 @@ public PagedIterable listByResourceGroup(String resourceGrou /** * Lists all Redis caches in a resource group. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1832,7 +1847,7 @@ public PagedIterable list(Context context) { /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1879,7 +1894,7 @@ public Mono> listKeysWithResponseAsync(String res /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1925,7 +1940,7 @@ private Mono> listKeysWithResponseAsync( /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1940,7 +1955,7 @@ public Mono listKeysAsync(String resourceGroupName, String /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1956,7 +1971,7 @@ public Response listKeysWithResponse(String resourceGroupN /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1971,7 +1986,7 @@ public RedisAccessKeysInner listKeys(String resourceGroupName, String name) { /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2026,7 +2041,7 @@ public Mono> regenerateKeyWithResponseAsync( /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @param context The context to associate with this operation. @@ -2079,7 +2094,7 @@ private Mono> regenerateKeyWithResponseAsync( /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2097,7 +2112,7 @@ public Mono regenerateKeyAsync( /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @param context The context to associate with this operation. @@ -2115,7 +2130,7 @@ public Response regenerateKeyWithResponse( /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2133,7 +2148,7 @@ public RedisAccessKeysInner regenerateKey( * Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be * potential data loss. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2190,7 +2205,7 @@ public Mono> forceRebootWithResponseAsyn * Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be * potential data loss. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @param context The context to associate with this operation. @@ -2245,7 +2260,7 @@ private Mono> forceRebootWithResponseAsy * Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be * potential data loss. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2264,7 +2279,7 @@ public Mono forceRebootAsync( * Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be * potential data loss. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @param context The context to associate with this operation. @@ -2283,7 +2298,7 @@ public Response forceRebootWithResponse( * Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be * potential data loss. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2300,7 +2315,7 @@ public RedisForceRebootResponseInner forceReboot( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2355,7 +2370,7 @@ public Mono>> importDataWithResponseAsync( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param context The context to associate with this operation. @@ -2408,7 +2423,7 @@ private Mono>> importDataWithResponseAsync( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2429,7 +2444,7 @@ public PollerFlux, Void> beginImportDataAsync( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param context The context to associate with this operation. @@ -2452,7 +2467,7 @@ private PollerFlux, Void> beginImportDataAsync( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2469,7 +2484,7 @@ public SyncPoller, Void> beginImportData( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param context The context to associate with this operation. @@ -2487,7 +2502,7 @@ public SyncPoller, Void> beginImportData( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2505,7 +2520,7 @@ public Mono importDataAsync(String resourceGroupName, String name, ImportR /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param context The context to associate with this operation. @@ -2525,7 +2540,7 @@ private Mono importDataAsync( /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2540,7 +2555,7 @@ public void importData(String resourceGroupName, String name, ImportRdbParameter /** * Import data into Redis cache. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param context The context to associate with this operation. @@ -2556,7 +2571,7 @@ public void importData(String resourceGroupName, String name, ImportRdbParameter /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2611,7 +2626,7 @@ public Mono>> exportDataWithResponseAsync( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param context The context to associate with this operation. @@ -2664,7 +2679,7 @@ private Mono>> exportDataWithResponseAsync( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2685,7 +2700,7 @@ public PollerFlux, Void> beginExportDataAsync( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param context The context to associate with this operation. @@ -2708,7 +2723,7 @@ private PollerFlux, Void> beginExportDataAsync( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2725,7 +2740,7 @@ public SyncPoller, Void> beginExportData( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param context The context to associate with this operation. @@ -2743,7 +2758,7 @@ public SyncPoller, Void> beginExportData( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2761,7 +2776,7 @@ public Mono exportDataAsync(String resourceGroupName, String name, ExportR /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param context The context to associate with this operation. @@ -2781,7 +2796,7 @@ private Mono exportDataAsync( /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2796,7 +2811,7 @@ public void exportData(String resourceGroupName, String name, ExportRdbParameter /** * Export data from the redis cache to blobs in a container. * - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param context The context to associate with this operation. @@ -2809,6 +2824,244 @@ public void exportData(String resourceGroupName, String name, ExportRdbParameter exportDataAsync(resourceGroupName, name, parameters, context).block(); } + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> flushCacheWithResponseAsync(String resourceGroupName, String cacheName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .flushCache( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> flushCacheWithResponseAsync( + String resourceGroupName, String cacheName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cacheName == null) { + return Mono.error(new IllegalArgumentException("Parameter cacheName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .flushCache( + this.client.getEndpoint(), + resourceGroupName, + cacheName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, OperationStatusResult> beginFlushCacheAsync( + String resourceGroupName, String cacheName) { + Mono>> mono = flushCacheWithResponseAsync(resourceGroupName, cacheName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OperationStatusResult.class, + OperationStatusResult.class, + this.client.getContext()); + } + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OperationStatusResult> beginFlushCacheAsync( + String resourceGroupName, String cacheName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = flushCacheWithResponseAsync(resourceGroupName, cacheName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), OperationStatusResult.class, OperationStatusResult.class, context); + } + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperationStatusResult> beginFlushCache( + String resourceGroupName, String cacheName) { + return this.beginFlushCacheAsync(resourceGroupName, cacheName).getSyncPoller(); + } + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OperationStatusResult> beginFlushCache( + String resourceGroupName, String cacheName, Context context) { + return this.beginFlushCacheAsync(resourceGroupName, cacheName, context).getSyncPoller(); + } + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono flushCacheAsync(String resourceGroupName, String cacheName) { + return beginFlushCacheAsync(resourceGroupName, cacheName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono flushCacheAsync(String resourceGroupName, String cacheName, Context context) { + return beginFlushCacheAsync(resourceGroupName, cacheName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusResult flushCache(String resourceGroupName, String cacheName) { + return flushCacheAsync(resourceGroupName, cacheName).block(); + } + + /** + * Deletes all of the keys in a cache. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusResult flushCache(String resourceGroupName, String cacheName, Context context) { + return flushCacheAsync(resourceGroupName, cacheName, context).block(); + } + /** * Get the next page of items. * diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisManagementClientBuilder.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisManagementClientBuilder.java index 90f9cdda11d8..e40fbf3eb259 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisManagementClientBuilder.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisManagementClientBuilder.java @@ -18,14 +18,12 @@ @ServiceClientBuilder(serviceClients = {RedisManagementClientImpl.class}) public final class RedisManagementClientBuilder { /* - * Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID - * forms part of the URI for every service call. + * The ID of the target subscription. */ private String subscriptionId; /** - * Sets Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID - * forms part of the URI for every service call. + * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. * @return the RedisManagementClientBuilder. diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisManagementClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisManagementClientImpl.java index 21147fa95c6e..ab08cbfae89f 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisManagementClientImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/implementation/RedisManagementClientImpl.java @@ -8,6 +8,8 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.management.AzureEnvironment; import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.resourcemanager.redis.fluent.AccessPoliciesClient; +import com.azure.resourcemanager.redis.fluent.AccessPolicyAssignmentsClient; import com.azure.resourcemanager.redis.fluent.AsyncOperationStatusClient; import com.azure.resourcemanager.redis.fluent.FirewallRulesClient; import com.azure.resourcemanager.redis.fluent.LinkedServersClient; @@ -23,15 +25,11 @@ /** Initializes a new instance of the RedisManagementClientImpl type. */ @ServiceClient(builder = RedisManagementClientBuilder.class) public final class RedisManagementClientImpl extends AzureServiceClient implements RedisManagementClient { - /** - * Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms - * part of the URI for every service call. - */ + /** The ID of the target subscription. */ private final String subscriptionId; /** - * Gets Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID - * forms part of the URI for every service call. + * Gets The ID of the target subscription. * * @return the subscriptionId value. */ @@ -195,6 +193,30 @@ public AsyncOperationStatusClient getAsyncOperationStatus() { return this.asyncOperationStatus; } + /** The AccessPoliciesClient object to access its operations. */ + private final AccessPoliciesClient accessPolicies; + + /** + * Gets the AccessPoliciesClient object to access its operations. + * + * @return the AccessPoliciesClient object. + */ + public AccessPoliciesClient getAccessPolicies() { + return this.accessPolicies; + } + + /** The AccessPolicyAssignmentsClient object to access its operations. */ + private final AccessPolicyAssignmentsClient accessPolicyAssignments; + + /** + * Gets the AccessPolicyAssignmentsClient object to access its operations. + * + * @return the AccessPolicyAssignmentsClient object. + */ + public AccessPolicyAssignmentsClient getAccessPolicyAssignments() { + return this.accessPolicyAssignments; + } + /** * Initializes an instance of RedisManagementClient client. * @@ -202,8 +224,7 @@ public AsyncOperationStatusClient getAsyncOperationStatus() { * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param subscriptionId Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The - * subscription ID forms part of the URI for every service call. + * @param subscriptionId The ID of the target subscription. * @param endpoint server parameter. */ RedisManagementClientImpl( @@ -219,7 +240,7 @@ public AsyncOperationStatusClient getAsyncOperationStatus() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2023-04-01"; + this.apiVersion = "2023-08-01"; this.operations = new OperationsClientImpl(this); this.redis = new RedisClientImpl(this); this.firewallRules = new FirewallRulesClientImpl(this); @@ -228,5 +249,7 @@ public AsyncOperationStatusClient getAsyncOperationStatus() { this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); this.asyncOperationStatus = new AsyncOperationStatusClientImpl(this); + this.accessPolicies = new AccessPoliciesClientImpl(this); + this.accessPolicyAssignments = new AccessPolicyAssignmentsClientImpl(this); } } diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/AccessPolicyAssignmentProvisioningState.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/AccessPolicyAssignmentProvisioningState.java new file mode 100644 index 000000000000..2119b94e7b7e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/AccessPolicyAssignmentProvisioningState.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Provisioning state of an access policy assignment set. */ +public final class AccessPolicyAssignmentProvisioningState + extends ExpandableStringEnum { + /** Static value Updating for AccessPolicyAssignmentProvisioningState. */ + public static final AccessPolicyAssignmentProvisioningState UPDATING = fromString("Updating"); + + /** Static value Succeeded for AccessPolicyAssignmentProvisioningState. */ + public static final AccessPolicyAssignmentProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for AccessPolicyAssignmentProvisioningState. */ + public static final AccessPolicyAssignmentProvisioningState DELETING = fromString("Deleting"); + + /** Static value Deleted for AccessPolicyAssignmentProvisioningState. */ + public static final AccessPolicyAssignmentProvisioningState DELETED = fromString("Deleted"); + + /** Static value Canceled for AccessPolicyAssignmentProvisioningState. */ + public static final AccessPolicyAssignmentProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Failed for AccessPolicyAssignmentProvisioningState. */ + public static final AccessPolicyAssignmentProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of AccessPolicyAssignmentProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccessPolicyAssignmentProvisioningState() { + } + + /** + * Creates or finds a AccessPolicyAssignmentProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessPolicyAssignmentProvisioningState. + */ + @JsonCreator + public static AccessPolicyAssignmentProvisioningState fromString(String name) { + return fromString(name, AccessPolicyAssignmentProvisioningState.class); + } + + /** + * Gets known AccessPolicyAssignmentProvisioningState values. + * + * @return known AccessPolicyAssignmentProvisioningState values. + */ + public static Collection values() { + return values(AccessPolicyAssignmentProvisioningState.class); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/AccessPolicyProvisioningState.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/AccessPolicyProvisioningState.java new file mode 100644 index 000000000000..0c08ecf67c87 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/AccessPolicyProvisioningState.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Provisioning state of access policy. */ +public final class AccessPolicyProvisioningState extends ExpandableStringEnum { + /** Static value Updating for AccessPolicyProvisioningState. */ + public static final AccessPolicyProvisioningState UPDATING = fromString("Updating"); + + /** Static value Succeeded for AccessPolicyProvisioningState. */ + public static final AccessPolicyProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for AccessPolicyProvisioningState. */ + public static final AccessPolicyProvisioningState DELETING = fromString("Deleting"); + + /** Static value Deleted for AccessPolicyProvisioningState. */ + public static final AccessPolicyProvisioningState DELETED = fromString("Deleted"); + + /** Static value Canceled for AccessPolicyProvisioningState. */ + public static final AccessPolicyProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Failed for AccessPolicyProvisioningState. */ + public static final AccessPolicyProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of AccessPolicyProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccessPolicyProvisioningState() { + } + + /** + * Creates or finds a AccessPolicyProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessPolicyProvisioningState. + */ + @JsonCreator + public static AccessPolicyProvisioningState fromString(String name) { + return fromString(name, AccessPolicyProvisioningState.class); + } + + /** + * Gets known AccessPolicyProvisioningState values. + * + * @return known AccessPolicyProvisioningState values. + */ + public static Collection values() { + return values(AccessPolicyProvisioningState.class); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/AccessPolicyType.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/AccessPolicyType.java new file mode 100644 index 000000000000..3ed24032e9c0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/AccessPolicyType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Built-In or Custom access policy. */ +public final class AccessPolicyType extends ExpandableStringEnum { + /** Static value Custom for AccessPolicyType. */ + public static final AccessPolicyType CUSTOM = fromString("Custom"); + + /** Static value BuiltIn for AccessPolicyType. */ + public static final AccessPolicyType BUILT_IN = fromString("BuiltIn"); + + /** + * Creates a new instance of AccessPolicyType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccessPolicyType() { + } + + /** + * Creates or finds a AccessPolicyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessPolicyType. + */ + @JsonCreator + public static AccessPolicyType fromString(String name) { + return fromString(name, AccessPolicyType.class); + } + + /** + * Gets known AccessPolicyType values. + * + * @return known AccessPolicyType values. + */ + public static Collection values() { + return values(AccessPolicyType.class); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ErrorAdditionalInfo.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ErrorAdditionalInfo.java deleted file mode 100644 index 4de5ffc9575a..000000000000 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ErrorAdditionalInfo.java +++ /dev/null @@ -1,54 +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.resourcemanager.redis.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The resource management error additional info. */ -@Immutable -public final class ErrorAdditionalInfo { - /* - * The additional info type. - */ - @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) - private String type; - - /* - * The additional info. - */ - @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) - private Object info; - - /** Creates an instance of ErrorAdditionalInfo class. */ - public ErrorAdditionalInfo() { - } - - /** - * Get the type property: The additional info type. - * - * @return the type value. - */ - public String type() { - return this.type; - } - - /** - * Get the info property: The additional info. - * - * @return the info value. - */ - public Object info() { - return this.info; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ErrorDetail.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ErrorDetail.java deleted file mode 100644 index 895b2dc51493..000000000000 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ErrorDetail.java +++ /dev/null @@ -1,106 +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.resourcemanager.redis.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The error detail. */ -@Immutable -public final class ErrorDetail { - /* - * The error code. - */ - @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) - private String code; - - /* - * The error message. - */ - @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) - private String message; - - /* - * The error target. - */ - @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) - private String target; - - /* - * The error details. - */ - @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) - private List details; - - /* - * The error additional info. - */ - @JsonProperty(value = "additionalInfo", access = JsonProperty.Access.WRITE_ONLY) - private List additionalInfo; - - /** Creates an instance of ErrorDetail class. */ - public ErrorDetail() { - } - - /** - * Get the code property: The error code. - * - * @return the code value. - */ - public String code() { - return this.code; - } - - /** - * Get the message property: The error message. - * - * @return the message value. - */ - public String message() { - return this.message; - } - - /** - * Get the target property: The error target. - * - * @return the target value. - */ - public String target() { - return this.target; - } - - /** - * Get the details property: The error details. - * - * @return the details value. - */ - public List details() { - return this.details; - } - - /** - * Get the additionalInfo property: The error additional info. - * - * @return the additionalInfo value. - */ - public List additionalInfo() { - return this.additionalInfo; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (details() != null) { - details().forEach(e -> e.validate()); - } - if (additionalInfo() != null) { - additionalInfo().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/OperationStatusResult.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/OperationStatusResult.java index bfff5b7539ca..1e7be904ea2d 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/OperationStatusResult.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/OperationStatusResult.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.redis.models; import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; @@ -59,7 +60,7 @@ public class OperationStatusResult { * If present, details of the operation error. */ @JsonProperty(value = "error") - private ErrorDetail error; + private ManagementError error; /** Creates an instance of OperationStatusResult class. */ public OperationStatusResult() { @@ -210,7 +211,7 @@ public OperationStatusResult withOperations(List operatio * * @return the error value. */ - public ErrorDetail error() { + public ManagementError error() { return this.error; } @@ -220,7 +221,7 @@ public ErrorDetail error() { * @param error the error value to set. * @return the OperationStatusResult object itself. */ - public OperationStatusResult withError(ErrorDetail error) { + public OperationStatusResult withError(ManagementError error) { this.error = error; return this; } @@ -239,9 +240,6 @@ public void validate() { if (operations() != null) { operations().forEach(e -> e.validate()); } - if (error() != null) { - error().validate(); - } } private static final ClientLogger LOGGER = new ClientLogger(OperationStatusResult.class); diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ProvisioningState.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ProvisioningState.java index 42754b35e687..29950a9f56f2 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ProvisioningState.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/ProvisioningState.java @@ -46,6 +46,9 @@ public final class ProvisioningState extends ExpandableStringEnum value; + + /* + * Link for next set. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of RedisCacheAccessPolicyAssignmentList class. */ + public RedisCacheAccessPolicyAssignmentList() { + } + + /** + * Get the value property: List of access policies assignments (with properties) of a Redis cache. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of access policies assignments (with properties) of a Redis cache. + * + * @param value the value value to set. + * @return the RedisCacheAccessPolicyAssignmentList object itself. + */ + public RedisCacheAccessPolicyAssignmentList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCacheAccessPolicyList.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCacheAccessPolicyList.java new file mode 100644 index 000000000000..ff90663026d7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCacheAccessPolicyList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.redis.fluent.models.RedisCacheAccessPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of access policies (with properties) of a Redis cache. */ +@Fluent +public final class RedisCacheAccessPolicyList { + /* + * List of access policies (with properties) of a Redis cache. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of RedisCacheAccessPolicyList class. */ + public RedisCacheAccessPolicyList() { + } + + /** + * Get the value property: List of access policies (with properties) of a Redis cache. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of access policies (with properties) of a Redis cache. + * + * @param value the value value to set. + * @return the RedisCacheAccessPolicyList object itself. + */ + public RedisCacheAccessPolicyList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCommonProperties.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCommonProperties.java index 18f83ea67549..8810b328556d 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCommonProperties.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCommonProperties.java @@ -73,6 +73,14 @@ public class RedisCommonProperties { @JsonProperty(value = "publicNetworkAccess") private PublicNetworkAccess publicNetworkAccess; + /* + * Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using + * 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default + * value is 'Stable'. + */ + @JsonProperty(value = "updateChannel") + private UpdateChannel updateChannel; + /** Creates an instance of RedisCommonProperties class. */ public RedisCommonProperties() { } @@ -271,6 +279,30 @@ public RedisCommonProperties withPublicNetworkAccess(PublicNetworkAccess publicN return this; } + /** + * Get the updateChannel property: Optional: Specifies the update channel for the monthly Redis updates your Redis + * Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of + * 'Stable' channel caches. Default value is 'Stable'. + * + * @return the updateChannel value. + */ + public UpdateChannel updateChannel() { + return this.updateChannel; + } + + /** + * Set the updateChannel property: Optional: Specifies the update channel for the monthly Redis updates your Redis + * Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of + * 'Stable' channel caches. Default value is 'Stable'. + * + * @param updateChannel the updateChannel value to set. + * @return the RedisCommonProperties object itself. + */ + public RedisCommonProperties withUpdateChannel(UpdateChannel updateChannel) { + this.updateChannel = updateChannel; + return this; + } + /** * Validates the instance. * diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisConfiguration.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisConfiguration.java index 136e1a1f97fd..5b1286e170d3 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisConfiguration.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisConfiguration.java @@ -124,6 +124,12 @@ public final class RedisConfiguration { @JsonProperty(value = "storage-subscription-id") private String storageSubscriptionId; + /* + * Specifies whether AAD based authentication has been enabled or disabled for the cache + */ + @JsonProperty(value = "aad-enabled") + private String aadEnabled; + /* * All Redis Settings. Few possible keys: * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -451,6 +457,28 @@ public RedisConfiguration withStorageSubscriptionId(String storageSubscriptionId return this; } + /** + * Get the aadEnabled property: Specifies whether AAD based authentication has been enabled or disabled for the + * cache. + * + * @return the aadEnabled value. + */ + public String aadEnabled() { + return this.aadEnabled; + } + + /** + * Set the aadEnabled property: Specifies whether AAD based authentication has been enabled or disabled for the + * cache. + * + * @param aadEnabled the aadEnabled value to set. + * @return the RedisConfiguration object itself. + */ + public RedisConfiguration withAadEnabled(String aadEnabled) { + this.aadEnabled = aadEnabled; + return this; + } + /** * Get the additionalProperties property: All Redis Settings. Few possible keys: * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCreateParameters.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCreateParameters.java index 92b090f3d0ae..0188cad3bdeb 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCreateParameters.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisCreateParameters.java @@ -435,6 +435,33 @@ public RedisCreateParameters withPublicNetworkAccess(PublicNetworkAccess publicN return this; } + /** + * Get the updateChannel property: Optional: Specifies the update channel for the monthly Redis updates your Redis + * Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of + * 'Stable' channel caches. Default value is 'Stable'. + * + * @return the updateChannel value. + */ + public UpdateChannel updateChannel() { + return this.innerProperties() == null ? null : this.innerProperties().updateChannel(); + } + + /** + * Set the updateChannel property: Optional: Specifies the update channel for the monthly Redis updates your Redis + * Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of + * 'Stable' channel caches. Default value is 'Stable'. + * + * @param updateChannel the updateChannel value to set. + * @return the RedisCreateParameters object itself. + */ + public RedisCreateParameters withUpdateChannel(UpdateChannel updateChannel) { + if (this.innerProperties() == null) { + this.innerProperties = new RedisCreateProperties(); + } + this.innerProperties().withUpdateChannel(updateChannel); + return this; + } + /** * Validates the instance. * diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisUpdateParameters.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisUpdateParameters.java index d41e7cf90de5..83397073b718 100644 --- a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisUpdateParameters.java +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/RedisUpdateParameters.java @@ -329,6 +329,33 @@ public RedisUpdateParameters withPublicNetworkAccess(PublicNetworkAccess publicN return this; } + /** + * Get the updateChannel property: Optional: Specifies the update channel for the monthly Redis updates your Redis + * Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of + * 'Stable' channel caches. Default value is 'Stable'. + * + * @return the updateChannel value. + */ + public UpdateChannel updateChannel() { + return this.innerProperties() == null ? null : this.innerProperties().updateChannel(); + } + + /** + * Set the updateChannel property: Optional: Specifies the update channel for the monthly Redis updates your Redis + * Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of + * 'Stable' channel caches. Default value is 'Stable'. + * + * @param updateChannel the updateChannel value to set. + * @return the RedisUpdateParameters object itself. + */ + public RedisUpdateParameters withUpdateChannel(UpdateChannel updateChannel) { + if (this.innerProperties() == null) { + this.innerProperties = new RedisUpdateProperties(); + } + this.innerProperties().withUpdateChannel(updateChannel); + return this; + } + /** * Validates the instance. * diff --git a/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/UpdateChannel.java b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/UpdateChannel.java new file mode 100644 index 000000000000..de76b643e764 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-redis/src/main/java/com/azure/resourcemanager/redis/models/UpdateChannel.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using + * 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is + * 'Stable'. + */ +public final class UpdateChannel extends ExpandableStringEnum { + /** Static value Stable for UpdateChannel. */ + public static final UpdateChannel STABLE = fromString("Stable"); + + /** Static value Preview for UpdateChannel. */ + public static final UpdateChannel PREVIEW = fromString("Preview"); + + /** + * Creates a new instance of UpdateChannel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public UpdateChannel() { + } + + /** + * Creates or finds a UpdateChannel from its string representation. + * + * @param name a name to look for. + * @return the corresponding UpdateChannel. + */ + @JsonCreator + public static UpdateChannel fromString(String name) { + return fromString(name, UpdateChannel.class); + } + + /** + * Gets known UpdateChannel values. + * + * @return known UpdateChannel values. + */ + public static Collection values() { + return values(UpdateChannel.class); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml b/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml index 9cfff10e2837..4e70b381be4e 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-resources/pom.xml @@ -47,8 +47,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml b/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml index de021b4d0ecd..e6745bd2c042 100644 --- a/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-samples/pom.xml @@ -115,22 +115,22 @@ com.azure azure-storage-blob - 12.23.1 + 12.24.0 com.azure azure-cosmos - 4.49.0 + 4.50.0 com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 com.azure azure-messaging-servicebus - 7.14.3 + 7.14.4 io.fabric8 @@ -162,7 +162,7 @@ com.azure azure-security-keyvault-administration - 4.3.5 + 4.4.0 test diff --git a/sdk/resourcemanager/azure-resourcemanager-search/pom.xml b/sdk/resourcemanager/azure-resourcemanager-search/pom.xml index 55c87fc92283..8c3d5c91c947 100644 --- a/sdk/resourcemanager/azure-resourcemanager-search/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-search/pom.xml @@ -45,8 +45,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-servicebus/pom.xml b/sdk/resourcemanager/azure-resourcemanager-servicebus/pom.xml index dc5e77c34abc..985a0e82a23a 100644 --- a/sdk/resourcemanager/azure-resourcemanager-servicebus/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-servicebus/pom.xml @@ -45,8 +45,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-sql/pom.xml b/sdk/resourcemanager/azure-resourcemanager-sql/pom.xml index 951d4e95e0cd..c276a9fc0bf0 100644 --- a/sdk/resourcemanager/azure-resourcemanager-sql/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-sql/pom.xml @@ -47,8 +47,6 @@ --add-opens com.azure.resourcemanager.storage/com.azure.resourcemanager.storage=ALL-UNNAMED --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-storage/pom.xml b/sdk/resourcemanager/azure-resourcemanager-storage/pom.xml index 0105bdaa11fe..90a5011cb000 100644 --- a/sdk/resourcemanager/azure-resourcemanager-storage/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-storage/pom.xml @@ -48,8 +48,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED true - - false diff --git a/sdk/resourcemanager/azure-resourcemanager-trafficmanager/pom.xml b/sdk/resourcemanager/azure-resourcemanager-trafficmanager/pom.xml index df6c4a4b92f4..71a8a6e08605 100644 --- a/sdk/resourcemanager/azure-resourcemanager-trafficmanager/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-trafficmanager/pom.xml @@ -45,8 +45,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager/pom.xml b/sdk/resourcemanager/azure-resourcemanager/pom.xml index 40bd70c7e1f5..ace8616c7a0e 100644 --- a/sdk/resourcemanager/azure-resourcemanager/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager/pom.xml @@ -57,8 +57,6 @@ --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED - - false diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentCreateUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentCreateUpdateSamples.java new file mode 100644 index 000000000000..77c7ac94be6d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentCreateUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.generated; + +import com.azure.resourcemanager.redis.fluent.models.RedisCacheAccessPolicyAssignmentInner; + +/** Samples for AccessPolicyAssignment CreateUpdate. */ +public final class AccessPolicyAssignmentCreateUpdateSamples { + /* + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentCreateUpdate.json + */ + /** + * Sample code: RedisCacheAccessPolicyAssignmentCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void redisCacheAccessPolicyAssignmentCreateUpdate( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .redisCaches() + .manager() + .serviceClient() + .getAccessPolicyAssignments() + .createUpdate( + "rg1", + "cache1", + "accessPolicyAssignmentName1", + new RedisCacheAccessPolicyAssignmentInner() + .withObjectId("6497c918-11ad-41e7-1b0f-7c518a87d0b0") + .withObjectIdAlias("TestAADAppRedis") + .withAccessPolicyName("accessPolicy1"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentDeleteSamples.java new file mode 100644 index 000000000000..a2a4f022dd29 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.generated; + +/** Samples for AccessPolicyAssignment Delete. */ +public final class AccessPolicyAssignmentDeleteSamples { + /* + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentDelete.json + */ + /** + * Sample code: RedisCacheAccessPolicyAssignmentDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void redisCacheAccessPolicyAssignmentDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .redisCaches() + .manager() + .serviceClient() + .getAccessPolicyAssignments() + .delete("rg1", "cache1", "accessPolicyAssignmentName1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentGetSamples.java new file mode 100644 index 000000000000..6abcf96f2435 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.generated; + +/** Samples for AccessPolicyAssignment Get. */ +public final class AccessPolicyAssignmentGetSamples { + /* + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json + */ + /** + * Sample code: RedisCacheAccessPolicyAssignmentGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void redisCacheAccessPolicyAssignmentGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .redisCaches() + .manager() + .serviceClient() + .getAccessPolicyAssignments() + .getWithResponse("rg1", "cache1", "accessPolicyAssignmentName1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentListSamples.java new file mode 100644 index 000000000000..3f959b0a7672 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyAssignmentListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.generated; + +/** Samples for AccessPolicyAssignment List. */ +public final class AccessPolicyAssignmentListSamples { + /* + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentList.json + */ + /** + * Sample code: RedisCacheAccessPolicyAssignmentList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void redisCacheAccessPolicyAssignmentList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .redisCaches() + .manager() + .serviceClient() + .getAccessPolicyAssignments() + .list("rg1", "cache1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyCreateUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyCreateUpdateSamples.java new file mode 100644 index 000000000000..5c75e1777fdf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyCreateUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.generated; + +import com.azure.resourcemanager.redis.fluent.models.RedisCacheAccessPolicyInner; + +/** Samples for AccessPolicy CreateUpdate. */ +public final class AccessPolicyCreateUpdateSamples { + /* + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyCreateUpdate.json + */ + /** + * Sample code: RedisCacheAccessPolicyCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void redisCacheAccessPolicyCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .redisCaches() + .manager() + .serviceClient() + .getAccessPolicies() + .createUpdate( + "rg1", + "cache1", + "accessPolicy1", + new RedisCacheAccessPolicyInner().withPermissions("+get +hget"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyDeleteSamples.java new file mode 100644 index 000000000000..775b94406628 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.generated; + +/** Samples for AccessPolicy Delete. */ +public final class AccessPolicyDeleteSamples { + /* + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyDelete.json + */ + /** + * Sample code: RedisCacheAccessPolicyDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void redisCacheAccessPolicyDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .redisCaches() + .manager() + .serviceClient() + .getAccessPolicies() + .delete("rg1", "cache1", "accessPolicy1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyGetSamples.java new file mode 100644 index 000000000000..ad3a1ca79fa4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.generated; + +/** Samples for AccessPolicy Get. */ +public final class AccessPolicyGetSamples { + /* + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json + */ + /** + * Sample code: RedisCacheAccessPolicyGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void redisCacheAccessPolicyGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .redisCaches() + .manager() + .serviceClient() + .getAccessPolicies() + .getWithResponse("rg1", "cache1", "accessPolicy1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyListSamples.java new file mode 100644 index 000000000000..cd3692f4a6dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AccessPolicyListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.generated; + +/** Samples for AccessPolicy List. */ +public final class AccessPolicyListSamples { + /* + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyList.json + */ + /** + * Sample code: RedisCacheAccessPolicyList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void redisCacheAccessPolicyList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .redisCaches() + .manager() + .serviceClient() + .getAccessPolicies() + .list("rg1", "cache1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AsyncOperationStatusGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AsyncOperationStatusGetSamples.java index c82a2fcbf848..3968887510b2 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AsyncOperationStatusGetSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/AsyncOperationStatusGetSamples.java @@ -7,7 +7,7 @@ /** Samples for AsyncOperationStatus Get. */ public final class AsyncOperationStatusGetSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheAsyncOperationStatus.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAsyncOperationStatus.json */ /** * Sample code: RedisCacheAsyncOperationStatus. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesCreateOrUpdateSamples.java index fa192bceee04..430299d6a97c 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesCreateOrUpdateSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesCreateOrUpdateSamples.java @@ -9,7 +9,7 @@ /** Samples for FirewallRules CreateOrUpdate. */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleCreate.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleCreate.json */ /** * Sample code: RedisCacheFirewallRuleCreate. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesDeleteSamples.java index 04cffce7e929..62eebaac954f 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesDeleteSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for FirewallRules Delete. */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleDelete.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleDelete.json */ /** * Sample code: RedisCacheFirewallRuleDelete. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesGetSamples.java index bac9c2b06800..adc5597b2526 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesGetSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for FirewallRules Get. */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleGet.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json */ /** * Sample code: RedisCacheFirewallRuleGet. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesListSamples.java index c9f12fa3adb1..ab3baa902102 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesListSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/FirewallRulesListSamples.java @@ -7,7 +7,7 @@ /** Samples for FirewallRules List. */ public final class FirewallRulesListSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRulesList.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRulesList.json */ /** * Sample code: RedisCacheFirewallRulesList. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerCreateSamples.java index 85316b304675..03be6d5fb656 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerCreateSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerCreateSamples.java @@ -10,7 +10,7 @@ /** Samples for LinkedServer Create. */ public final class LinkedServerCreateSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Create.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Create.json */ /** * Sample code: LinkedServer_Create. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerDeleteSamples.java index 911960001eb9..f0cb51988be5 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerDeleteSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for LinkedServer Delete. */ public final class LinkedServerDeleteSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Delete.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Delete.json */ /** * Sample code: LinkedServerDelete. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerGetSamples.java index b4f1fbd6ff6b..9959feaf2588 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerGetSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerGetSamples.java @@ -7,7 +7,7 @@ /** Samples for LinkedServer Get. */ public final class LinkedServerGetSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Get.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json */ /** * Sample code: LinkedServer_Get. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerListSamples.java index 651f18eee55c..6e57dd8f23e4 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerListSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/LinkedServerListSamples.java @@ -7,7 +7,7 @@ /** Samples for LinkedServer List. */ public final class LinkedServerListSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_List.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_List.json */ /** * Sample code: LinkedServer_List. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/OperationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/OperationsListSamples.java index b7ebd9d7d025..dd77a4904517 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/OperationsListSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/OperationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheOperations.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheOperations.json */ /** * Sample code: RedisCacheOperations. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesCreateOrUpdateSamples.java index 429c4f240409..ef6c4f5aa876 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesCreateOrUpdateSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesCreateOrUpdateSamples.java @@ -14,7 +14,7 @@ /** Samples for PatchSchedules CreateOrUpdate. */ public final class PatchSchedulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json */ /** * Sample code: RedisCachePatchSchedulesCreateOrUpdate. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesDeleteSamples.java index e6c08bd937e8..187243a37c04 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesDeleteSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesDeleteSamples.java @@ -9,7 +9,7 @@ /** Samples for PatchSchedules Delete. */ public final class PatchSchedulesDeleteSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesDelete.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesDelete.json */ /** * Sample code: RedisCachePatchSchedulesDelete. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesGetSamples.java index 46b43d4071f3..3535944c8a05 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesGetSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesGetSamples.java @@ -9,7 +9,7 @@ /** Samples for PatchSchedules Get. */ public final class PatchSchedulesGetSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesGet.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json */ /** * Sample code: RedisCachePatchSchedulesGet. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesListByRedisResourceSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesListByRedisResourceSamples.java index b2c2a1e066bb..4fb68c1c5cd4 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesListByRedisResourceSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PatchSchedulesListByRedisResourceSamples.java @@ -7,7 +7,7 @@ /** Samples for PatchSchedules ListByRedisResource. */ public final class PatchSchedulesListByRedisResourceSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesList.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesList.json */ /** * Sample code: RedisCachePatchSchedulesList. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsDeleteSamples.java index d6fcf513c780..86f6c83fee7d 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsDeleteSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for PrivateEndpointConnections Delete. */ public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheDeletePrivateEndpointConnection.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDeletePrivateEndpointConnection.json */ /** * Sample code: RedisCacheDeletePrivateEndpointConnection. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsGetSamples.java index 6599495babf8..1182bddb0d4a 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsGetSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for PrivateEndpointConnections Get. */ public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGetPrivateEndpointConnection.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json */ /** * Sample code: RedisCacheGetPrivateEndpointConnection. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsListSamples.java index 76de7a681096..a2556254f5ab 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsListSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsListSamples.java @@ -7,7 +7,7 @@ /** Samples for PrivateEndpointConnections List. */ public final class PrivateEndpointConnectionsListSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListPrivateEndpointConnections.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateEndpointConnections.json */ /** * Sample code: RedisCacheListPrivateEndpointConnection. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsPutSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsPutSamples.java index da2f19d12438..7d7a7a80e239 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsPutSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateEndpointConnectionsPutSamples.java @@ -11,7 +11,7 @@ /** Samples for PrivateEndpointConnections Put. */ public final class PrivateEndpointConnectionsPutSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePutPrivateEndpointConnection.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePutPrivateEndpointConnection.json */ /** * Sample code: RedisCachePutPrivateEndpointConnection. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateLinkResourcesListByRedisCacheSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateLinkResourcesListByRedisCacheSamples.java index dfbd31a612c1..528a70e88341 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateLinkResourcesListByRedisCacheSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/PrivateLinkResourcesListByRedisCacheSamples.java @@ -7,7 +7,7 @@ /** Samples for PrivateLinkResources ListByRedisCache. */ public final class PrivateLinkResourcesListByRedisCacheSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListPrivateLinkResources.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateLinkResources.json */ /** * Sample code: StorageAccountListPrivateLinkResources. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisCheckNameAvailabilitySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisCheckNameAvailabilitySamples.java index cd878aa967c9..1633a9cbd552 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisCheckNameAvailabilitySamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisCheckNameAvailabilitySamples.java @@ -9,7 +9,7 @@ /** Samples for Redis CheckNameAvailability. */ public final class RedisCheckNameAvailabilitySamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCheckNameAvailability.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCheckNameAvailability.json */ /** * Sample code: RedisCacheCheckNameAvailability. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisCreateSamples.java index 4461be478139..5953c198370d 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisCreateSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisCreateSamples.java @@ -17,7 +17,7 @@ /** Samples for Redis Create. */ public final class RedisCreateSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreate.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreate.json */ /** * Sample code: RedisCacheCreate. @@ -51,7 +51,7 @@ public static void redisCacheCreate(com.azure.resourcemanager.AzureResourceManag } /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreateDefaultVersion.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateDefaultVersion.json */ /** * Sample code: RedisCacheCreateDefaultVersion. @@ -84,7 +84,7 @@ public static void redisCacheCreateDefaultVersion(com.azure.resourcemanager.Azur } /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreateLatestVersion.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateLatestVersion.json */ /** * Sample code: RedisCacheCreateLatestVersion. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisDeleteSamples.java index 4dbc7afdd723..1225a70f572d 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisDeleteSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for Redis Delete. */ public final class RedisDeleteSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheDelete.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDelete.json */ /** * Sample code: RedisCacheDelete. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisExportDataSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisExportDataSamples.java index e0c86b94dcd8..d379fa36fd81 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisExportDataSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisExportDataSamples.java @@ -9,7 +9,7 @@ /** Samples for Redis ExportData. */ public final class RedisExportDataSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheExport.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheExport.json */ /** * Sample code: RedisCacheExport. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisFlushCacheSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisFlushCacheSamples.java new file mode 100644 index 000000000000..0304e8f82fa4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisFlushCacheSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.redis.generated; + +/** Samples for Redis FlushCache. */ +public final class RedisFlushCacheSamples { + /* + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFlush.json + */ + /** + * Sample code: RedisCacheFlush. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void redisCacheFlush(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .redisCaches() + .manager() + .serviceClient() + .getRedis() + .flushCache("resource-group-name", "cache-name", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisForceRebootSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisForceRebootSamples.java index c5cb11dc9c79..c06a300d99a3 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisForceRebootSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisForceRebootSamples.java @@ -11,7 +11,7 @@ /** Samples for Redis ForceReboot. */ public final class RedisForceRebootSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheForceReboot.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheForceReboot.json */ /** * Sample code: RedisCacheForceReboot. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisGetByResourceGroupSamples.java index 1fc864d4636a..77eb313b5ab2 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisGetByResourceGroupSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Redis GetByResourceGroup. */ public final class RedisGetByResourceGroupSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGet.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json */ /** * Sample code: RedisCacheGet. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisImportDataSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisImportDataSamples.java index 5e26ea817095..4f3d569ad712 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisImportDataSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisImportDataSamples.java @@ -10,7 +10,7 @@ /** Samples for Redis ImportData. */ public final class RedisImportDataSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheImport.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheImport.json */ /** * Sample code: RedisCacheImport. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListByResourceGroupSamples.java index f6fde1e050de..5d42a6883c9a 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListByResourceGroupSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Redis ListByResourceGroup. */ public final class RedisListByResourceGroupSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListByResourceGroup.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListByResourceGroup.json */ /** * Sample code: RedisCacheListByResourceGroup. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListKeysSamples.java index 3f928b4f2032..d35ca5a64f35 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListKeysSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListKeysSamples.java @@ -7,7 +7,7 @@ /** Samples for Redis ListKeys. */ public final class RedisListKeysSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListKeys.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListKeys.json */ /** * Sample code: RedisCacheListKeys. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListSamples.java index 772b35ed91cc..c25f22929a92 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListSamples.java @@ -7,7 +7,7 @@ /** Samples for Redis List. */ public final class RedisListSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheList.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheList.json */ /** * Sample code: RedisCacheList. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListUpgradeNotificationsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListUpgradeNotificationsSamples.java index 2288c29e753b..600f4cb7bf7f 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListUpgradeNotificationsSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisListUpgradeNotificationsSamples.java @@ -7,7 +7,7 @@ /** Samples for Redis ListUpgradeNotifications. */ public final class RedisListUpgradeNotificationsSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListUpgradeNotifications.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListUpgradeNotifications.json */ /** * Sample code: RedisCacheListUpgradeNotifications. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisRegenerateKeySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisRegenerateKeySamples.java index c41d955405be..f92d74d2c9b4 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisRegenerateKeySamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisRegenerateKeySamples.java @@ -10,7 +10,7 @@ /** Samples for Redis RegenerateKey. */ public final class RedisRegenerateKeySamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheRegenerateKey.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheRegenerateKey.json */ /** * Sample code: RedisCacheRegenerateKey. diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisUpdateSamples.java index 06322730cc40..a7e6f0a39444 100644 --- a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisUpdateSamples.java +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/redis/generated/RedisUpdateSamples.java @@ -9,7 +9,7 @@ /** Samples for Redis Update. */ public final class RedisUpdateSamples { /* - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheUpdate.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheUpdate.json */ /** * Sample code: RedisCacheUpdate. diff --git a/sdk/resourcemanagerhybrid/README.md b/sdk/resourcemanagerhybrid/README.md index 3599e77b5f55..b37701b2c944 100644 --- a/sdk/resourcemanagerhybrid/README.md +++ b/sdk/resourcemanagerhybrid/README.md @@ -85,7 +85,7 @@ Azure Management Libraries require a `TokenCredential` implementation for authen com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-compute/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-compute/pom.xml index da1752b77b5d..28bccae4843e 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-compute/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-compute/pom.xml @@ -123,7 +123,7 @@ com.azure azure-storage-blob - 12.23.1 + 12.24.0 test diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/pom.xml index a20f2b8a52f1..94cb753e745b 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/pom.xml @@ -68,7 +68,7 @@ com.azure azure-security-keyvault-keys - 4.6.5 + 4.7.0 com.azure @@ -79,7 +79,7 @@ com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 com.azure diff --git a/sdk/resourcemanagerhybrid/azure-resourcemanager-network/pom.xml b/sdk/resourcemanagerhybrid/azure-resourcemanager-network/pom.xml index cf60cd3d65ca..33a269a27877 100644 --- a/sdk/resourcemanagerhybrid/azure-resourcemanager-network/pom.xml +++ b/sdk/resourcemanagerhybrid/azure-resourcemanager-network/pom.xml @@ -87,7 +87,7 @@ com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 test diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/CHANGELOG.md b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/CHANGELOG.md index 4c78112733b2..e0708aeafbf0 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/CHANGELOG.md +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.1.10 (2023-09-19) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-data-schemaregistry` from `1.3.9` to version `1.3.10`. +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. + ## 1.1.9 (2023-08-18) ### Other Changes @@ -28,7 +37,6 @@ - Upgraded `azure-core` from `1.40.0` to version `1.41.0`. - Upgraded `azure-data-schemaregistry` from `1.3.7` to version `1.4.0-beta.3`. - ## 1.1.7 (2023-06-20) ### Other Changes diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/README.md b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/README.md index 51c179525684..e1596e5d55ee 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/README.md +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/README.md @@ -23,7 +23,7 @@ and deserialization. com.azure azure-data-schemaregistry-apacheavro - 1.1.8 + 1.1.10 ``` [//]: # ({x-version-update-end}) @@ -51,7 +51,7 @@ with the Azure SDK, please include the `azure-identity` package: com.azure azure-identity - 1.10.0 + 1.10.1 ``` @@ -145,7 +145,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [samples_code]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples/ [azure_subscription]: https://azure.microsoft.com/free/ [apache_avro]: https://avro.apache.org/ -[api_reference_doc]: https://aka.ms/schemaregistry +[api_reference_doc]: https://azure.github.io/azure-sdk-for-java/ [azure_cli]: https://docs.microsoft.com/cli/azure [azure_portal]: https://portal.azure.com [azure_identity]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml index 908e567ee2a1..c3ad29bcd6f8 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml @@ -116,7 +116,7 @@ com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 test diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroSerializer.java b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroSerializer.java index cf973c2134db..88a1d17c7556 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroSerializer.java +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroSerializer.java @@ -74,6 +74,7 @@ * Person person = Person.newBuilder() * .setName("Chase") * .setFavouriteColour("Turquoise") + * .setFavouriteNumber(3) * .build(); * * EventData eventData = serializer.serialize(person, TypeReference.createInstance(EventData.class)); diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/package-info.java b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/package-info.java index 45f99656d223..b09e49f1b78d 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/package-info.java +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/main/java/com/azure/data/schemaregistry/apacheavro/package-info.java @@ -76,6 +76,7 @@ * Person person = Person.newBuilder() * .setName("Chase") * .setFavouriteColour("Turquoise") + * .setFavouriteNumber(3) * .build(); * * EventData eventData = serializer.serialize(person, TypeReference.createInstance(EventData.class)); diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroSerializerJavaDocCodeSamples.java b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroSerializerJavaDocCodeSamples.java index bbead2f5e774..8aba01886116 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroSerializerJavaDocCodeSamples.java +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryApacheAvroSerializerJavaDocCodeSamples.java @@ -70,6 +70,7 @@ public void serialize() { Person person = Person.newBuilder() .setName("Chase") .setFavouriteColour("Turquoise") + .setFavouriteNumber(3) .build(); MessageContent message = serializer.serialize(person, @@ -96,6 +97,7 @@ public void serializeEventData() { Person person = Person.newBuilder() .setName("Chase") .setFavouriteColour("Turquoise") + .setFavouriteNumber(3) .build(); EventData eventData = serializer.serialize(person, TypeReference.createInstance(EventData.class)); @@ -121,6 +123,7 @@ public void serializeMessageFactory() { Person person = Person.newBuilder() .setName("Chase") .setFavouriteColour("Turquoise") + .setFavouriteNumber(3) .build(); // Serializes and creates an instance of ComplexMessage using the messageFactory function. @@ -166,6 +169,7 @@ public void deserializeEventData() { Person person = Person.newBuilder() .setName("Foo Bar") .setFavouriteNumber(3) + .setFavouriteColour("Turquoise") .build(); // BEGIN: com.azure.data.schemaregistry.apacheavro.schemaregistryapacheavroserializer.deserialize-eventdata diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryWithEventHubs.java b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryWithEventHubs.java index f5860e50ea99..9483a1a25b34 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryWithEventHubs.java +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples/java/com/azure/data/schemaregistry/apacheavro/SchemaRegistryWithEventHubs.java @@ -65,8 +65,8 @@ private static void publishEventsToEventHubs(TokenCredential tokenCredential, SchemaRegistryApacheAvroSerializer serializer) { List playingCards = Arrays.asList( - PlayingCard.newBuilder().setCardValue(5).setPlayingCardSuit(PlayingCardSuit.CLUBS).build(), - PlayingCard.newBuilder().setCardValue(10).setPlayingCardSuit(PlayingCardSuit.SPADES).build() + PlayingCard.newBuilder().setIsFaceCard(true).setCardValue(5).setPlayingCardSuit(PlayingCardSuit.CLUBS).build(), + PlayingCard.newBuilder().setIsFaceCard(true).setCardValue(10).setPlayingCardSuit(PlayingCardSuit.SPADES).build() ); // Sending all events to partition 1. diff --git a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/CHANGELOG.md b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/CHANGELOG.md index 13dd08af78ab..0ebe4e3a92a4 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/CHANGELOG.md +++ b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.1 (Unreleased) +## 1.0.0-beta.2 (Unreleased) ### Features Added @@ -9,3 +9,16 @@ ### Bugs Fixed ### Other Changes + +## 1.0.0-beta.1 (2023-09-19) + +### Features Added + +- Add initial beta release for JSON schema. + +### Other Changes + +#### Dependency Updates + +- Add dependency `azure-core` version `1.43.0`. +- Add dependency `azure-data-schemaregistry` version `1.3.10`. diff --git a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/README.md b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/README.md index da82db2a1458..9f4a4843b8a8 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/README.md +++ b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/README.md @@ -50,7 +50,7 @@ with the Azure SDK, please include the `azure-identity` package: com.azure azure-identity - 1.10.0 + 1.10.1 ``` diff --git a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/pom.xml b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/pom.xml index 236bc5952d67..a421db13b70e 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/pom.xml +++ b/sdk/schemaregistry/azure-data-schemaregistry-jsonschema/pom.xml @@ -16,7 +16,7 @@ com.azure azure-data-schemaregistry-jsonschema - 1.0.0-beta.1 + 1.0.0-beta.2 Microsoft Azure client library for Schema Registry JSON Schema Serializer JSON Schema serializer for Azure Schema Registry client library @@ -97,7 +97,7 @@ com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 test diff --git a/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md b/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md index b362a1424830..f2d2f9c28767 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md +++ b/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md @@ -4,14 +4,25 @@ ### Features Added -- Add support for protobuf schema format. - ### Breaking Changes ### Bugs Fixed ### Other Changes +## 1.3.10 (2023-09-19) + +### Features Added + +- Add support for protobuf schema format. + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. + ## 1.3.9 (2023-08-18) ### Other Changes diff --git a/sdk/schemaregistry/azure-data-schemaregistry/README.md b/sdk/schemaregistry/azure-data-schemaregistry/README.md index 7aac371fe4e4..5def307613c1 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/README.md +++ b/sdk/schemaregistry/azure-data-schemaregistry/README.md @@ -54,7 +54,7 @@ add the direct dependency to your project as follows. com.azure azure-data-schemaregistry - 1.3.8 + 1.3.10 ``` [//]: # ({x-version-update-end}) @@ -75,7 +75,7 @@ To use the [DefaultAzureCredential][DefaultAzureCredential] provider shown below com.azure azure-identity - 1.10.0 + 1.10.1 ``` @@ -200,7 +200,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [source_code]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/schemaregistry/azure-data-schemaregistry/src [samples_code]: src/samples/ [azure_subscription]: https://azure.microsoft.com/free/ -[api_reference_doc]: https://aka.ms/schemaregistry +[api_reference_doc]: https://azure.github.io/azure-sdk-for-java/ [azure_cli]: https://docs.microsoft.com/cli/azure [azure_portal]: https://portal.azure.com [azure_identity]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/models/SchemaFormat.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/models/SchemaFormat.java index c47cc2791a77..6b30e0abd2c3 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/models/SchemaFormat.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/models/SchemaFormat.java @@ -34,4 +34,13 @@ public final class SchemaFormat extends ExpandableStringEnum { public static SchemaFormat fromString(String name) { return fromString(name.toLowerCase(Locale.ROOT), SchemaFormat.class); } + + /** + * Creates a new instance of Schema Format. + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SchemaFormat() { + super(); + } } diff --git a/sdk/search/azure-search-documents/CHANGELOG.md b/sdk/search/azure-search-documents/CHANGELOG.md index 0a740bfc01d7..e2b552c50c58 100644 --- a/sdk/search/azure-search-documents/CHANGELOG.md +++ b/sdk/search/azure-search-documents/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 11.6.0-beta.9 (Unreleased) +## 11.6.0-beta.10 (Unreleased) ### Features Added @@ -10,6 +10,26 @@ ### Other Changes +## 11.5.11 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. +- Upgraded `azure-core-serializer-json-jackson` from `1.4.3` to version `1.4.4`. +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. + +## 11.6.0-beta.9 (2023-09-15) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. +- Upgraded `azure-core-serializer-json-jackson` from `1.4.3` to version `1.4.4`. +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. + ## 11.5.10 (2023-08-18) ### Other Changes diff --git a/sdk/search/azure-search-documents/README.md b/sdk/search/azure-search-documents/README.md index b362d1ea6889..66a5d9af6c6f 100644 --- a/sdk/search/azure-search-documents/README.md +++ b/sdk/search/azure-search-documents/README.md @@ -73,7 +73,7 @@ add the direct dependency to your project as follows. com.azure azure-search-documents - 11.6.0-beta.8 + 11.6.0-beta.9 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/search/azure-search-documents/pom.xml b/sdk/search/azure-search-documents/pom.xml index 507a19b3eb37..7c5d44af0c78 100644 --- a/sdk/search/azure-search-documents/pom.xml +++ b/sdk/search/azure-search-documents/pom.xml @@ -16,7 +16,7 @@ com.azure azure-search-documents - 11.6.0-beta.9 + 11.6.0-beta.10 jar diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchAsyncClient.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchAsyncClient.java index 9a118fa0470f..928631565a1b 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchAsyncClient.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchAsyncClient.java @@ -749,6 +749,14 @@ Mono> getDocumentCountWithResponse(Context context) { * If {@code searchText} is set to null or {@code "*"} all documents will be matched, see * simple query * syntax in Azure Cognitive Search for more information about search query syntax. + *

    + * The {@link SearchPagedFlux} will iterate through search result pages until all search results are returned. + * Each page is determined by the {@code $skip} and {@code $top} values and the Search service has a limit on the + * number of documents that can be skipped, more information about the {@code $skip} limit can be found at + * Search Documents REST API and + * reading the {@code $skip} description. If the total number of results exceeds the {@code $skip} limit the + * {@link SearchPagedFlux} won't prevent you from exceeding the {@code $skip} limit. To prevent exceeding the limit + * you can track the number of documents returned and stop requesting new pages when the limit is reached. * *

    Code Sample

    * @@ -758,9 +766,18 @@ Mono> getDocumentCountWithResponse(Context context) { *
          * SearchPagedFlux searchPagedFlux = SEARCH_ASYNC_CLIENT.search("searchText");
          * searchPagedFlux.getTotalCount().subscribe(
    -     *     count -> System.out.printf("There are around %d results.", count)
    -     * );
    +     *     count -> System.out.printf("There are around %d results.", count));
    +     *
    +     * AtomicLong numberOfDocumentsReturned = new AtomicLong();
          * searchPagedFlux.byPage()
    +     *     .takeUntil(page -> {
    +     *         if (numberOfDocumentsReturned.addAndGet(page.getValue().size()) >= SEARCH_SKIP_LIMIT) {
    +     *             // Reached the $skip limit, stop requesting more documents.
    +     *             return true;
    +     *         }
    +     *
    +     *         return false;
    +     *     })
          *     .subscribe(resultResponse -> {
          *         for (SearchResult result: resultResponse.getValue()) {
          *             SearchDocument searchDocument = result.getDocument(SearchDocument.class);
    @@ -789,6 +806,14 @@ public SearchPagedFlux search(String searchText) {
          * If {@code searchText} is set to null or {@code "*"} all documents will be matched, see
          * simple query
          * syntax in Azure Cognitive Search for more information about search query syntax.
    +     * 

    + * The {@link SearchPagedFlux} will iterate through search result pages until all search results are returned. + * Each page is determined by the {@code $skip} and {@code $top} values and the Search service has a limit on the + * number of documents that can be skipped, more information about the {@code $skip} limit can be found at + * Search Documents REST API and + * reading the {@code $skip} description. If the total number of results exceeds the {@code $skip} limit the + * {@link SearchPagedFlux} won't prevent you from exceeding the {@code $skip} limit. To prevent exceeding the limit + * you can track the number of documents returned and stop requesting new pages when the limit is reached. * *

    Code Sample

    * @@ -801,7 +826,16 @@ public SearchPagedFlux search(String searchText) { * * pagedFlux.getTotalCount().subscribe(count -> System.out.printf("There are around %d results.", count)); * + * AtomicLong numberOfDocumentsReturned = new AtomicLong(); * pagedFlux.byPage() + * .takeUntil(page -> { + * if (numberOfDocumentsReturned.addAndGet(page.getValue().size()) >= SEARCH_SKIP_LIMIT) { + * // Reached the $skip limit, stop requesting more documents. + * return true; + * } + * + * return false; + * }) * .subscribe(searchResultResponse -> searchResultResponse.getValue().forEach(searchDocument -> { * for (Map.Entry<String, Object> keyValuePair * : searchDocument.getDocument(SearchDocument.class).entrySet()) { diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClient.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClient.java index 4c12bb22fe46..94fd4fab68cd 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClient.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/SearchClient.java @@ -682,6 +682,14 @@ public Response getDocumentCountWithResponse(Context context) { * If {@code searchText} is set to null or {@code "*"} all documents will be matched, see * simple query * syntax in Azure Cognitive Search for more information about search query syntax. + *

    + * The {@link SearchPagedIterable} will iterate through search result pages until all search results are returned. + * Each page is determined by the {@code $skip} and {@code $top} values and the Search service has a limit on the + * number of documents that can be skipped, more information about the {@code $skip} limit can be found at + * Search Documents REST API and + * reading the {@code $skip} description. If the total number of results exceeds the {@code $skip} limit the + * {@link SearchPagedIterable} won't prevent you from exceeding the {@code $skip} limit. To prevent exceeding the + * limit you can track the number of documents returned and stop requesting new pages when the limit is reached. * *

    Code Sample

    * @@ -692,8 +700,10 @@ public Response getDocumentCountWithResponse(Context context) { * SearchPagedIterable searchPagedIterable = SEARCH_CLIENT.search("searchText"); * System.out.printf("There are around %d results.", searchPagedIterable.getTotalCount()); * + * long numberOfDocumentsReturned = 0; * for (SearchPagedResponse resultResponse: searchPagedIterable.iterableByPage()) { * System.out.println("The status code of the response is " + resultResponse.getStatusCode()); + * numberOfDocumentsReturned += resultResponse.getValue().size(); * resultResponse.getValue().forEach(searchResult -> { * for (Map.Entry<String, Object> keyValuePair: searchResult * .getDocument(SearchDocument.class).entrySet()) { @@ -701,6 +711,11 @@ public Response getDocumentCountWithResponse(Context context) { * keyValuePair.getValue()); * } * }); + * + * if (numberOfDocumentsReturned >= SEARCH_SKIP_LIMIT) { + * // Reached the $skip limit, stop requesting more documents. + * break; + * } * } *
    * @@ -722,6 +737,14 @@ public SearchPagedIterable search(String searchText) { * If {@code searchText} is set to null or {@code "*"} all documents will be matched, see * simple query * syntax in Azure Cognitive Search for more information about search query syntax. + *

    + * The {@link SearchPagedIterable} will iterate through search result pages until all search results are returned. + * Each page is determined by the {@code $skip} and {@code $top} values and the Search service has a limit on the + * number of documents that can be skipped, more information about the {@code $skip} limit can be found at + * Search Documents REST API and + * reading the {@code $skip} description. If the total number of results exceeds the {@code $skip} limit the + * {@link SearchPagedIterable} won't prevent you from exceeding the {@code $skip} limit. To prevent exceeding the + * limit you can track the number of documents returned and stop requesting new pages when the limit is reached. * *

    Code Sample

    * @@ -732,8 +755,11 @@ public SearchPagedIterable search(String searchText) { * SearchPagedIterable searchPagedIterable = SEARCH_CLIENT.search("searchText", * new SearchOptions().setOrderBy("hotelId desc"), new Context(KEY_1, VALUE_1)); * System.out.printf("There are around %d results.", searchPagedIterable.getTotalCount()); + * + * long numberOfDocumentsReturned = 0; * for (SearchPagedResponse resultResponse: searchPagedIterable.iterableByPage()) { * System.out.println("The status code of the response is " + resultResponse.getStatusCode()); + * numberOfDocumentsReturned += resultResponse.getValue().size(); * resultResponse.getValue().forEach(searchResult -> { * for (Map.Entry<String, Object> keyValuePair: searchResult * .getDocument(SearchDocument.class).entrySet()) { @@ -741,6 +767,11 @@ public SearchPagedIterable search(String searchText) { * keyValuePair.getValue()); * } * }); + * + * if (numberOfDocumentsReturned >= SEARCH_SKIP_LIMIT) { + * // Reached the $skip limit, stop requesting more documents. + * break; + * } * } *
    * @@ -779,7 +810,7 @@ private SearchPagedResponse search(SearchRequest request, String continuationTok SearchPagedResponse page = new SearchPagedResponse( new SimpleResponse<>(response, getSearchResults(result, serializer)), createContinuationToken(result, serviceVersion), result.getFacets(), result.getCount(), - result.getCoverage(), result.getAnswers(), result.getSemanticPartialResponseReason(), + result.getCoverage(), result.getAnswers(), result.getSemanticPartialResponseReason(), result.getSemanticPartialResponseType()); if (continuationToken == null) { firstPageResponseWrapper.setFirstPageResponse(page); diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/batching/SearchIndexingPublisher.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/batching/SearchIndexingPublisher.java index 163be4086a04..99f196c82102 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/batching/SearchIndexingPublisher.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/implementation/batching/SearchIndexingPublisher.java @@ -27,11 +27,14 @@ import java.time.Duration; import java.util.ArrayList; import java.util.Collection; +import java.util.Deque; import java.util.HashSet; +import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Objects; import java.util.Set; +import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.Semaphore; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicInteger; @@ -69,14 +72,14 @@ public final class SearchIndexingPublisher { private final Function scaleDownFunction = size -> size / 2; private final Object actionsMutex = new Object(); - private final LinkedList> actions = new LinkedList<>(); + private final Deque> actions = new ConcurrentLinkedDeque<>(); /* * This queue keeps track of documents that are currently being sent to the service for indexing. This queue is * resilient against cases where the request timeouts or is cancelled by an external operation, preventing the * documents from being lost. */ - private final LinkedList> inFlightActions = new LinkedList<>(); + private final Deque> inFlightActions = new ConcurrentLinkedDeque<>(); private final Semaphore processingSemaphore = new Semaphore(1); @@ -157,11 +160,9 @@ public synchronized Mono addActions(Collection> actions, Co public Mono flush(boolean awaitLock, boolean isClose, Context context) { if (awaitLock) { processingSemaphore.acquireUninterruptibly(); - return flushLoop(isClose, context) - .doFinally(ignored -> processingSemaphore.release()); + return Mono.using(() -> processingSemaphore, ignored -> flushLoop(isClose, context), Semaphore::release); } else if (processingSemaphore.tryAcquire()) { - return flushLoop(isClose, context) - .doFinally(ignored -> processingSemaphore.release()); + return Mono.using(() -> processingSemaphore, ignored -> flushLoop(isClose, context), Semaphore::release); } else { LOGGER.verbose("Batch already in-flight and not waiting for completion. Performing no-op."); return Mono.empty(); @@ -224,21 +225,21 @@ private List> createBatch() { return batchActions; } - private int fillFromQueue(List> batch, List> queue, + private static int fillFromQueue(List> batch, Deque> queue, int requested, Set duplicateKeyTracker) { - int offset = 0; int actionsAdded = 0; - int queueSize = queue.size(); - while (actionsAdded < requested && offset < queueSize) { - TryTrackingIndexAction potentialDocumentToAdd = queue.get(offset++ - actionsAdded); + Iterator> iterator = queue.iterator(); + while (actionsAdded < requested && iterator.hasNext()) { + TryTrackingIndexAction potentialDocumentToAdd = iterator.next(); if (duplicateKeyTracker.contains(potentialDocumentToAdd.getKey())) { continue; } duplicateKeyTracker.add(potentialDocumentToAdd.getKey()); - batch.add(queue.remove(offset - 1 - actionsAdded)); + batch.add(potentialDocumentToAdd); + iterator.remove(); actionsAdded += 1; } @@ -330,7 +331,7 @@ private void handleResponse(List> actions, IndexBatchR return; } - List> actionsToRetry = new ArrayList<>(); + Deque> actionsToRetry = new LinkedList<>(); boolean has503 = batchResponse.getStatusCode() == HttpURLConnection.HTTP_UNAVAILABLE; if (batchResponse.getResults() == null) { /* @@ -391,6 +392,13 @@ private void handleResponse(List> actions, IndexBatchR } } + private void reinsertFailedActions(Deque> actionsToRetry) { + synchronized (actionsMutex) { + // Push all actions that need to be retried back into the queue. + actionsToRetry.descendingIterator().forEachRemaining(actions::add); + } + } + private void reinsertFailedActions(List> actionsToRetry) { synchronized (actionsMutex) { // Push all actions that need to be retried back into the queue. diff --git a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexAsyncClient.java b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexAsyncClient.java index f92dcf98887f..5babf37278e1 100644 --- a/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexAsyncClient.java +++ b/sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/SearchIndexAsyncClient.java @@ -114,7 +114,8 @@ public SearchAsyncClient getSearchAsyncClient(String indexName) { .buildAsyncClient(); } - static SearchClientBuilder getSearchClientBuilder(String indexName, String endpoint, SearchServiceVersion serviceVersion, HttpPipeline httpPipeline, JsonSerializer serializer) { + static SearchClientBuilder getSearchClientBuilder(String indexName, String endpoint, + SearchServiceVersion serviceVersion, HttpPipeline httpPipeline, JsonSerializer serializer) { return new SearchClientBuilder() .endpoint(endpoint) .indexName(indexName) diff --git a/sdk/search/azure-search-documents/src/samples/README.md b/sdk/search/azure-search-documents/src/samples/README.md index f4d4ad78ffb9..a5fe8d591499 100644 --- a/sdk/search/azure-search-documents/src/samples/README.md +++ b/sdk/search/azure-search-documents/src/samples/README.md @@ -61,7 +61,7 @@ add the direct dependency to your project as follows. com.azure azure-search-documents - 11.6.0-beta.8 + 11.6.0-beta.9 ``` [//]: # ({x-version-update-end}) @@ -96,6 +96,7 @@ The following sections provide several code snippets covering some of the most c - [Execute a search solution - run indexer and issue search queries](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/RunningSearchSolutionExample.java) - [Setting customer x-ms-client-request-id per API call](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/PerCallRequestIdExample.java) - [Index vector fields and perform vector search](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/VectorSearchExample.java). +- [Rewrite Request URL to replace OData URL syntax with standard syntax](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SearchRequestUrlRewriterPolicy.java) ## Troubleshooting Troubleshooting steps can be found [here][SDK_README_TROUBLESHOOTING]. diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SearchJavaDocCodeSnippets.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SearchJavaDocCodeSnippets.java index 599fb0110f28..bef13d1cc215 100644 --- a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SearchJavaDocCodeSnippets.java +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SearchJavaDocCodeSnippets.java @@ -58,10 +58,12 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; @SuppressWarnings("unused") public class SearchJavaDocCodeSnippets { private static final SearchClient SEARCH_CLIENT = new SearchClientBuilder().buildClient(); + private static final long SEARCH_SKIP_LIMIT = 100_000; // May change over time /** * Code snippet for creating a {@link SearchClient}. @@ -312,8 +314,10 @@ public void searchDocuments() { SearchPagedIterable searchPagedIterable = SEARCH_CLIENT.search("searchText"); System.out.printf("There are around %d results.", searchPagedIterable.getTotalCount()); + long numberOfDocumentsReturned = 0; for (SearchPagedResponse resultResponse: searchPagedIterable.iterableByPage()) { System.out.println("The status code of the response is " + resultResponse.getStatusCode()); + numberOfDocumentsReturned += resultResponse.getValue().size(); resultResponse.getValue().forEach(searchResult -> { for (Map.Entry keyValuePair: searchResult .getDocument(SearchDocument.class).entrySet()) { @@ -321,6 +325,11 @@ public void searchDocuments() { keyValuePair.getValue()); } }); + + if (numberOfDocumentsReturned >= SEARCH_SKIP_LIMIT) { + // Reached the $skip limit, stop requesting more documents. + break; + } } // END: com.azure.search.documents.SearchClient.search#String } @@ -333,8 +342,11 @@ public void searchDocumentsWithOptions() { SearchPagedIterable searchPagedIterable = SEARCH_CLIENT.search("searchText", new SearchOptions().setOrderBy("hotelId desc"), new Context(KEY_1, VALUE_1)); System.out.printf("There are around %d results.", searchPagedIterable.getTotalCount()); + + long numberOfDocumentsReturned = 0; for (SearchPagedResponse resultResponse: searchPagedIterable.iterableByPage()) { System.out.println("The status code of the response is " + resultResponse.getStatusCode()); + numberOfDocumentsReturned += resultResponse.getValue().size(); resultResponse.getValue().forEach(searchResult -> { for (Map.Entry keyValuePair: searchResult .getDocument(SearchDocument.class).entrySet()) { @@ -342,6 +354,11 @@ public void searchDocumentsWithOptions() { keyValuePair.getValue()); } }); + + if (numberOfDocumentsReturned >= SEARCH_SKIP_LIMIT) { + // Reached the $skip limit, stop requesting more documents. + break; + } } // END: com.azure.search.documents.SearchClient.search#String-SearchOptions-Context } @@ -662,9 +679,18 @@ public void searchDocumentsAsync() { // BEGIN: com.azure.search.documents.SearchAsyncClient.search#String SearchPagedFlux searchPagedFlux = SEARCH_ASYNC_CLIENT.search("searchText"); searchPagedFlux.getTotalCount().subscribe( - count -> System.out.printf("There are around %d results.", count) - ); + count -> System.out.printf("There are around %d results.", count)); + + AtomicLong numberOfDocumentsReturned = new AtomicLong(); searchPagedFlux.byPage() + .takeUntil(page -> { + if (numberOfDocumentsReturned.addAndGet(page.getValue().size()) >= SEARCH_SKIP_LIMIT) { + // Reached the $skip limit, stop requesting more documents. + return true; + } + + return false; + }) .subscribe(resultResponse -> { for (SearchResult result: resultResponse.getValue()) { SearchDocument searchDocument = result.getDocument(SearchDocument.class); @@ -686,7 +712,16 @@ public void searchDocumentsWithOptionsAsync() { pagedFlux.getTotalCount().subscribe(count -> System.out.printf("There are around %d results.", count)); + AtomicLong numberOfDocumentsReturned = new AtomicLong(); pagedFlux.byPage() + .takeUntil(page -> { + if (numberOfDocumentsReturned.addAndGet(page.getValue().size()) >= SEARCH_SKIP_LIMIT) { + // Reached the $skip limit, stop requesting more documents. + return true; + } + + return false; + }) .subscribe(searchResultResponse -> searchResultResponse.getValue().forEach(searchDocument -> { for (Map.Entry keyValuePair : searchDocument.getDocument(SearchDocument.class).entrySet()) { diff --git a/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SearchRequestUrlRewriterPolicy.java b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SearchRequestUrlRewriterPolicy.java new file mode 100644 index 000000000000..21db634519c8 --- /dev/null +++ b/sdk/search/azure-search-documents/src/samples/java/com/azure/search/documents/SearchRequestUrlRewriterPolicy.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.search.documents; + +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpPipelineNextSyncPolicy; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.util.UrlBuilder; +import reactor.core.publisher.Mono; + +/** + * This an example {@link HttpPipelinePolicy} that can rewrite request URLs to replace the OData URL syntax + * ({@code /docs('key')}) with standard URL syntax ({@code /docs/key}). + */ +public final class SearchRequestUrlRewriterPolicy implements HttpPipelinePolicy { + + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + context.setHttpRequest(rewriteUrl(context.getHttpRequest())); + return next.process(); + } + + @Override + public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next) { + context.setHttpRequest(rewriteUrl(context.getHttpRequest())); + return next.processSync(); + } + + private static HttpRequest rewriteUrl(HttpRequest request) { + UrlBuilder urlBuilder = UrlBuilder.parse(request.getUrl()); + String path = urlBuilder.getPath(); + + if (path.startsWith("/aliases('")) { + urlBuilder.setPath(createNewPath(path, "/aliases/", 10)); + } else if (path.startsWith("/datasources('")) { + urlBuilder.setPath(createNewPath(path, "/datasources/", 14)); + } else if (path.startsWith("/indexers('")) { + urlBuilder.setPath(createNewPath(path, "/indexers/", 11)); + } else if (path.startsWith("/indexes('")) { + // Indexes is special as it can be used for either the management-style APIs managing the index or with + // document retrieval. + // + // So it needs to replace the OData URL syntax for the index name and also check if it contains the + // document retrieval path. + int documentRetrievalIndex = path.indexOf("/docs('"); + if (documentRetrievalIndex != -1) { + int odataUrlClose = path.indexOf("')", 10); + StringBuilder newPath = new StringBuilder(path.length()) + .append("/indexes/") + .append(path, 10, odataUrlClose) + .append(path, odataUrlClose + 2, documentRetrievalIndex) + .append("/docs/"); + + odataUrlClose = path.indexOf("')", documentRetrievalIndex + 7); + newPath.append(path, documentRetrievalIndex + 7, odataUrlClose); + + if (odataUrlClose < path.length() - 2) { + newPath.append(path, odataUrlClose + 2, path.length()); + } + + urlBuilder.setPath(newPath.toString()); + } else { + urlBuilder.setPath(createNewPath(path, "/indexes/", 10)); + } + } else if (path.startsWith("/skillsets('")) { + urlBuilder.setPath(createNewPath(path, "/skillsets/", 12)); + } else if (path.startsWith("/synonymmaps('")) { + urlBuilder.setPath(createNewPath(path, "/synonymmaps/", 14)); + } else { + return request; + } + + return request.setUrl(urlBuilder.toString()); + } + + private static String createNewPath(String path, String pathSegment, int startIndex) { + int odataUrlClose = path.indexOf("')", startIndex); + StringBuilder newPath = + new StringBuilder(path.length()).append(pathSegment).append(path, startIndex, odataUrlClose); + + if (odataUrlClose < path.length() - 2) { + newPath.append(path, odataUrlClose + 2, path.length()); + } + + return newPath.toString(); + } +} diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchIndexingBufferedSenderTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchIndexingBufferedSenderTests.java index da88b70cded0..1171c232c234 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchIndexingBufferedSenderTests.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchIndexingBufferedSenderTests.java @@ -3,55 +3,24 @@ package com.azure.search.documents; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.policy.FixedDelay; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.test.http.MockHttpResponse; import com.azure.core.test.models.BodilessMatcher; -import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; -import com.azure.core.util.FluxUtil; import com.azure.core.util.serializer.TypeReference; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; -import com.azure.search.documents.implementation.models.IndexBatch; -import com.azure.search.documents.models.IndexAction; -import com.azure.search.documents.models.IndexActionType; -import com.azure.search.documents.models.IndexDocumentsResult; -import com.azure.search.documents.models.IndexingResult; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.function.Executable; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; -import reactor.core.publisher.Mono; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.UncheckedIOException; import java.time.Duration; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; -import java.util.stream.Stream; import static com.azure.search.documents.TestHelpers.readJsonFileToList; import static com.azure.search.documents.TestHelpers.waitForIndexing; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 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; /** @@ -317,713 +286,4 @@ public void emptyBatchIsNeverSent() { assertEquals(0, requestCount.get()); batchingClient.close(); } - - /** - * Tests that a batch can timeout while indexing. - */ - @Test - public void flushTimesOut() { - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), - createMockResponseData(0, 200))).delayElement(Duration.ofSeconds(5))) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 1)); - - assertThrows(RuntimeException.class, () -> batchingClient.flush(Duration.ofSeconds(1), Context.NONE)); - } - - /** - * Tests that a batch will retain in-flight documents if the request is cancelled before the response is handled. - */ - @Test - public void inFlightDocumentsAreRetried() { - AtomicInteger callCount = new AtomicInteger(0); - AtomicInteger addedCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - AtomicInteger errorCount = new AtomicInteger(); - AtomicInteger sentCount = new AtomicInteger(); - - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> { - Mono response = Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), - createMockResponseData(0, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200))); - if (callCount.getAndIncrement() == 0) { - return response.delayElement(Duration.ofSeconds(5)); - } else { - return response; - } - }) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .onActionAdded(ignored -> addedCount.incrementAndGet()) - .onActionSent(ignored -> sentCount.incrementAndGet()) - .onActionError(ignored -> errorCount.incrementAndGet()) - .onActionSucceeded(ignored -> successCount.incrementAndGet()) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); - - // First request is setup to timeout. - assertThrows(RuntimeException.class, () -> batchingClient.flush(Duration.ofSeconds(3), Context.NONE)); - - // Second request shouldn't timeout. - assertDoesNotThrow(() -> batchingClient.flush(Duration.ofSeconds(3), Context.NONE)); - - // Then validate that we have the expected number of requests sent and responded. - assertEquals(10, addedCount.get()); - assertEquals(20, sentCount.get()); - assertEquals(0, errorCount.get()); - assertEquals(10, successCount.get()); - } - - /** - * Tests that when a batch has some failures the indexing hook is properly notified. - */ - @Test - public void batchHasSomeFailures() { - AtomicInteger addedCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - AtomicInteger errorCount = new AtomicInteger(); - AtomicInteger sentCount = new AtomicInteger(); - - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), - createMockResponseData(0, 201, 400, 201, 404, 200, 200, 404, 400, 400, 201)))) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .onActionAdded(options -> addedCount.incrementAndGet()) - .onActionSucceeded(options -> successCount.incrementAndGet()) - .onActionError(options -> errorCount.incrementAndGet()) - .onActionSent(options -> sentCount.incrementAndGet()) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); - - // Exceptions are propagated into the onActionError. - assertDoesNotThrow((Executable) batchingClient::flush); - - assertEquals(10, addedCount.get()); - assertEquals(5, successCount.get()); - assertEquals(5, errorCount.get()); - assertEquals(10, sentCount.get()); - - /* - * No documents failed with retryable errors, so we should expect zero documents are added back into the batch. - */ - assertEquals(0, batchingClient.getActions().size()); - } - - /** - * Tests that a batch will retry documents that fail with retryable status code. - */ - @Test - public void retryableDocumentsAreAddedBackToTheBatch() { - AtomicInteger addedCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - AtomicInteger errorCount = new AtomicInteger(); - AtomicInteger sentCount = new AtomicInteger(); - - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), - createMockResponseData(0, 201, 409, 201, 422, 200, 200, 503, 409, 422, 201)))) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .onActionAdded(options -> addedCount.incrementAndGet()) - .onActionSucceeded(options -> successCount.incrementAndGet()) - .onActionError(options -> errorCount.incrementAndGet()) - .onActionSent(options -> sentCount.incrementAndGet()) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); - - // Exceptions are propagated into the onActionError. - assertDoesNotThrow((Executable) batchingClient::flush); - - assertEquals(10, addedCount.get()); - assertEquals(10, sentCount.get()); - assertEquals(5, successCount.get()); - assertEquals(0, errorCount.get()); - - /* - * 5 documents failed with retryable errors, so we should expect 5 documents are added back into the batch. - */ - assertEquals(5, batchingClient.getActions().size()); - } - - /** - * Tests that a batch splits if the service responds with a 413. - */ - @Test - public void batchSplits() { - AtomicInteger callCount = new AtomicInteger(); - AtomicInteger addedCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - AtomicInteger errorCount = new AtomicInteger(); - AtomicInteger sentCount = new AtomicInteger(); - - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> { - int count = callCount.getAndIncrement(); - if (count == 0) { - return Mono.just(new MockHttpResponse(request, 413)); - } else if (count == 1) { - return createMockBatchSplittingResponse(request, 0, 5); - } else if (count == 2) { - return createMockBatchSplittingResponse(request, 5, 5); - } else { - return Mono.error(new IllegalStateException("Unexpected request.")); - } - }).bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .initialBatchActionCount(10) - .onActionAdded(options -> addedCount.incrementAndGet()) - .onActionSucceeded(options -> successCount.incrementAndGet()) - .onActionError(options -> errorCount.incrementAndGet()) - .onActionSent(options -> sentCount.incrementAndGet()) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); - - // No exception is thrown as the batch splits and retries successfully. - assertDoesNotThrow((Executable) batchingClient::flush); - - assertEquals(10, addedCount.get()); - assertEquals(10, successCount.get()); - assertEquals(0, errorCount.get()); - assertEquals(20, sentCount.get()); - - /* - * No documents failed, so we should expect zero documents are added back into the batch. - */ - assertEquals(0, batchingClient.getActions().size()); - } - - /** - * Tests that flushing a batch doesn't include duplicate keys. - */ - @Test - public void batchTakesAllNonDuplicateKeys() { - AtomicInteger callCount = new AtomicInteger(); - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> { - int count = callCount.getAndIncrement(); - if (count == 0) { - return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), - createMockResponseData(0, 200, 200, 200, 200, 200, 200, 200, 200, 200))); - } else { - return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), - createMockResponseData(0, 200))); - } - }).bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .buildSender(); - - List> documents = readJsonFileToList(HOTELS_DATA_JSON); - documents.get(9).put("HotelId", "1"); - - batchingClient.addUploadActions(documents); - - assertDoesNotThrow((Executable) batchingClient::flush); - - /* - * One document shouldn't have been sent as it contains a duplicate key from an earlier document. - */ - assertEquals(1, batchingClient.getActions().size()); - - assertDoesNotThrow((Executable) batchingClient::flush); - - /* - * No documents should remain as no duplicate keys exists. - */ - assertEquals(0, batchingClient.getActions().size()); - } - - @Test - public void batchWithDuplicateKeysBeingRetriedTakesAllNonDuplicateKeys() { - AtomicInteger callCount = new AtomicInteger(); - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> { - int count = callCount.getAndIncrement(); - if (count == 0) { - return Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), - createMockResponseData(0, 503, 200, 200, 200, 200, 200, 200, 200, 200))); - } else { - return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), - createMockResponseData(0, 200))); - } - }).bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .buildSender(); - - List> documents = readJsonFileToList(HOTELS_DATA_JSON); - documents.get(9).put("HotelId", "1"); - - batchingClient.addUploadActions(documents); - - assertDoesNotThrow((Executable) batchingClient::flush); - - /* - * Two documents should be in the batch as one failed with a retryable status code and another wasn't sent as it - * used a duplicate key from the batch that was sent. - */ - assertEquals(2, batchingClient.getActions().size()); - - assertDoesNotThrow((Executable) batchingClient::flush); - - /* - * One document should remain in the batch as it had the same key as another document in the batch. - */ - assertEquals(1, batchingClient.getActions().size()); - - assertDoesNotThrow((Executable) batchingClient::flush); - assertDoesNotThrow((Executable) batchingClient::close); - - /* - * No documents should remain as no duplicate keys exists. - */ - assertEquals(0, batchingClient.getActions().size()); - } - - /** - * Tests that an operation will be dumped into a "dead letter" queue if it is retried too many times. - */ - @Test - public void batchRetriesUntilLimit() { - AtomicInteger addedCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - AtomicInteger errorCount = new AtomicInteger(); - AtomicInteger sentCount = new AtomicInteger(); - - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), - createMockResponseData(0, 409)))) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .maxRetriesPerAction(10) - .onActionAdded(options -> addedCount.incrementAndGet()) - .onActionSucceeded(options -> successCount.incrementAndGet()) - .onActionError(options -> errorCount.incrementAndGet()) - .onActionSent(options -> sentCount.incrementAndGet()) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 1)); - - // Batch split until it was size of one and failed. - for (int i = 0; i < 10; i++) { - assertDoesNotThrow((Executable) batchingClient::flush); - - // Document should be added back into the batch as it is retryable. - assertEquals(1, batchingClient.getActions().size()); - } - - // Final call which will trigger the retry limit for the document but doesn't throw. - assertDoesNotThrow((Executable) batchingClient::flush); - - assertEquals(1, addedCount.get()); - // Document gets sent 10 times for the number of retries that happen. - assertEquals(11, sentCount.get()); - assertEquals(1, errorCount.get()); - assertEquals(0, successCount.get()); - - /* - * All documents failed, so we should expect zero documents are added back into the batch. - */ - assertEquals(0, batchingClient.getActions().size()); - } - - /** - * Tests that a batch will split until it is a size of one if the service continues returning 413. When the service - * returns 413 on a batch size of one it will be deemed a final error state. - */ - @Test - public void batchSplitsUntilOneAndFails() { - AtomicInteger addedCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - AtomicInteger errorCount = new AtomicInteger(); - AtomicInteger sentCount = new AtomicInteger(); - - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> Mono.just(new MockHttpResponse(request, 413))) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .initialBatchActionCount(2) - .onActionAdded(options -> addedCount.incrementAndGet()) - .onActionSucceeded(options -> successCount.incrementAndGet()) - .onActionError(options -> errorCount.incrementAndGet()) - .onActionSent(options -> sentCount.incrementAndGet()) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 2)); - - // Batch split until it was size of one and fails but doesn't throw. - assertDoesNotThrow((Executable) batchingClient::flush); - - assertEquals(2, addedCount.get()); - assertEquals(2, errorCount.get()); - assertEquals(0, successCount.get()); - assertEquals(4, sentCount.get()); - - /* - * No documents failed, so we should expect zero documents are added back into the batch. - */ - assertEquals(0, batchingClient.getActions().size()); - } - - /** - * Tests that a batch will split until all sub-batches are one document and some of the sub batches fail with 413 - * while others do not. - */ - @Test - public void batchSplitsUntilOneAndPartiallyFails() { - AtomicInteger callCount = new AtomicInteger(); - AtomicInteger addedCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - AtomicInteger errorCount = new AtomicInteger(); - AtomicInteger sentCount = new AtomicInteger(); - - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> (callCount.getAndIncrement() < 2) - ? Mono.just(new MockHttpResponse(request, 413)) - : createMockBatchSplittingResponse(request, 1, 1)) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .initialBatchActionCount(2) - .onActionAdded(options -> addedCount.incrementAndGet()) - .onActionSucceeded(options -> successCount.incrementAndGet()) - .onActionError(options -> errorCount.incrementAndGet()) - .onActionSent(options -> sentCount.incrementAndGet()) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 2)); - - // Batch split until it was size of one and fails but doesn't throw. - assertDoesNotThrow((Executable) batchingClient::flush); - - assertEquals(2, addedCount.get()); - assertEquals(1, errorCount.get()); - assertEquals(1, successCount.get()); - assertEquals(4, sentCount.get()); - - /* - * No documents failed, so we should expect zero documents are added back into the batch. - */ - assertEquals(0, batchingClient.getActions().size()); - } - - @ParameterizedTest - @MethodSource("operationsThrowAfterClientIsClosedSupplier") - public void operationsThrowAfterClientIsClosed( - Consumer>> operation) { - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .buildSender(); - - batchingClient.close(); - - assertThrows(IllegalStateException.class, () -> operation.accept(batchingClient)); - - } - - static Stream>>> operationsThrowAfterClientIsClosedSupplier() { - List> simpleDocuments = Collections.singletonList(Collections.singletonMap("key", "value")); - List>> actions = simpleDocuments.stream() - .map(document -> new IndexAction>() - .setDocument(document) - .setActionType(IndexActionType.UPLOAD)) - .collect(Collectors.toList()); - - return Stream.of( - client -> client.addActions(actions), - client -> client.addActions(actions, Duration.ofSeconds(60), Context.NONE), - - client -> client.addUploadActions(simpleDocuments), - client -> client.addUploadActions(simpleDocuments, Duration.ofSeconds(60), Context.NONE), - - client -> client.addMergeOrUploadActions(simpleDocuments), - client -> client.addMergeOrUploadActions(simpleDocuments, Duration.ofSeconds(60), Context.NONE), - - client -> client.addMergeActions(simpleDocuments), - client -> client.addMergeActions(simpleDocuments, Duration.ofSeconds(60), Context.NONE), - - client -> client.addDeleteActions(simpleDocuments), - client -> client.addDeleteActions(simpleDocuments, Duration.ofSeconds(60), Context.NONE), - - SearchIndexingBufferedSender::flush, - client -> client.flush(Duration.ofSeconds(60), Context.NONE) - ); - } - - @Test - public void closingTwiceDoesNotThrow() { - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .buildSender(); - - batchingClient.close(); - - assertDoesNotThrow((Executable) batchingClient::close); - } - - @Test - public void concurrentFlushesOnlyAllowsOneProcessor() throws InterruptedException { - AtomicInteger callCount = new AtomicInteger(); - - SearchIndexingBufferedAsyncSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> { - int count = callCount.getAndIncrement(); - if (count == 0) { - return createMockBatchSplittingResponse(request, 0, 5) - .delayElement(Duration.ofSeconds(2)) - .map(Function.identity()); - } else if (count == 1) { - return createMockBatchSplittingResponse(request, 5, 5); - } else { - return Mono.error(new IllegalStateException("Unexpected request.")); - } - }).bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .initialBatchActionCount(5) - .buildAsyncSender(); - - CountDownLatch countDownLatch = new CountDownLatch(2); - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)).block(); - - AtomicLong firstFlushCompletionTime = new AtomicLong(); - batchingClient.flush() - .doFinally(ignored -> { - firstFlushCompletionTime.set(System.nanoTime()); - countDownLatch.countDown(); - }) - .subscribe(); - - AtomicLong secondFlushCompletionTime = new AtomicLong(); - batchingClient.flush() - .doFinally(ignored -> { - secondFlushCompletionTime.set(System.nanoTime()); - countDownLatch.countDown(); - }) - .subscribe(); - - countDownLatch.await(); - assertTrue(firstFlushCompletionTime.get() > secondFlushCompletionTime.get()); - } - - @Test - public void closeWillWaitForAnyCurrentFlushesToCompleteBeforeRunning() throws InterruptedException { - AtomicInteger callCount = new AtomicInteger(); - - SearchIndexingBufferedAsyncSender> batchingClient = getSearchClientBuilder("index", false) - .httpClient(request -> { - int count = callCount.getAndIncrement(); - if (count == 0) { - return createMockBatchSplittingResponse(request, 0, 5) - .delayElement(Duration.ofSeconds(2)) - .map(Function.identity()); - } else if (count == 1) { - return createMockBatchSplittingResponse(request, 5, 5); - } else { - return Mono.error(new IllegalStateException("Unexpected request.")); - } - }).bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .initialBatchActionCount(5) - .buildAsyncSender(); - - CountDownLatch countDownLatch = new CountDownLatch(2); - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)).block(); - - AtomicLong firstFlushCompletionTime = new AtomicLong(); - batchingClient.flush() - .doFinally(ignored -> { - firstFlushCompletionTime.set(System.nanoTime()); - countDownLatch.countDown(); - }) - .subscribe(); - - AtomicLong secondFlushCompletionTime = new AtomicLong(); - batchingClient.close() - .doFinally(ignored -> { - secondFlushCompletionTime.set(System.nanoTime()); - countDownLatch.countDown(); - }) - .subscribe(); - - countDownLatch.await(); - assertTrue(firstFlushCompletionTime.get() <= secondFlushCompletionTime.get()); - } - - @Test - public void serverBusyResponseRetries() { - AtomicInteger callCount = new AtomicInteger(); - AtomicInteger addedCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - AtomicInteger errorCount = new AtomicInteger(); - AtomicInteger sentCount = new AtomicInteger(); - - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .retryPolicy(new RetryPolicy(new FixedDelay(0, Duration.ZERO))) - .httpClient(request -> { - int count = callCount.getAndIncrement(); - if (count < 1) { - return Mono.just(new MockHttpResponse(request, 503)); - } else { - return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), - createMockResponseData(0, 201, 200, 201, 200, 200, 200, 201, 201, 200, 201))); - } - }).bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .onActionAdded(options -> addedCount.incrementAndGet()) - .onActionSucceeded(options -> successCount.incrementAndGet()) - .onActionError(options -> errorCount.incrementAndGet()) - .onActionSent(options -> sentCount.incrementAndGet()) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); - - // No exception is thrown as the batch splits and retries successfully. - assertDoesNotThrow((Executable) batchingClient::flush); - assertDoesNotThrow((Executable) batchingClient::flush); - - assertEquals(10, addedCount.get()); - assertEquals(10, successCount.get()); - assertEquals(0, errorCount.get()); - assertEquals(20, sentCount.get()); - - /* - * No documents failed, so we should expect zero documents are added back into the batch. - */ - assertEquals(0, batchingClient.getActions().size()); - } - - @Test - public void delayGrowsWith503Response() { - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .retryPolicy(new RetryPolicy(new FixedDelay(0, Duration.ZERO))) - .httpClient(request -> Mono.just(new MockHttpResponse(request, 503))) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); - - assertDoesNotThrow((Executable) batchingClient::flush); - Duration retryDuration = batchingClient.client.publisher.getCurrentRetryDelay(); - assertTrue(retryDuration.compareTo(Duration.ZERO) > 0); - - assertDoesNotThrow((Executable) batchingClient::flush); - assertTrue(batchingClient.client.publisher.getCurrentRetryDelay().compareTo(retryDuration) > 0); - } - - @Test - public void delayGrowsWith503BatchOperation() { - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .retryPolicy(new RetryPolicy(new FixedDelay(0, Duration.ZERO))) - .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), - createMockResponseData(0, 503)))) - .bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 1)); - - assertDoesNotThrow((Executable) batchingClient::flush); - Duration retryDuration = batchingClient.client.publisher.getCurrentRetryDelay(); - assertTrue(retryDuration.compareTo(Duration.ZERO) > 0); - - assertDoesNotThrow((Executable) batchingClient::flush); - assertTrue(batchingClient.client.publisher.getCurrentRetryDelay().compareTo(retryDuration) > 0); - } - - @Test - public void delayResetsAfterNo503s() { - AtomicInteger callCount = new AtomicInteger(); - SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder("index", false) - .retryPolicy(new RetryPolicy(new FixedDelay(0, Duration.ZERO))) - .httpClient(request -> { - int count = callCount.getAndIncrement(); - if (count == 0) { - return Mono.just(new MockHttpResponse(request, 503)); - } else { - return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), - createMockResponseData(0, 200))); - } - }).bufferedSender(HOTEL_DOCUMENT_TYPE) - .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) - .autoFlush(false) - .buildSender(); - - batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 1)); - - assertDoesNotThrow((Executable) batchingClient::flush); - Duration retryDuration = batchingClient.client.publisher.getCurrentRetryDelay(); - assertTrue(retryDuration.compareTo(Duration.ZERO) > 0); - - assertDoesNotThrow((Executable) batchingClient::flush); - assertEquals(Duration.ZERO, batchingClient.client.publisher.getCurrentRetryDelay()); - } - - /* - * Helper method that creates mock results with the status codes given. This will create a mock indexing result - * and turn it into a byte[] so it can be put in a mock response. - */ - private static byte[] createMockResponseData(int keyIdOffset, int... statusCodes) { - List results = new ArrayList<>(); - - for (int i = 0; i < statusCodes.length; i++) { - int statusCode = statusCodes[i]; - results.add(new IndexingResult(String.valueOf(keyIdOffset + i + 1), statusCode == 200 || statusCode == 201, - statusCode)); - } - - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - try (JsonWriter writer = JsonProviders.createWriter(outputStream)) { - writer.writeJson(new IndexDocumentsResult(results)).flush(); - return outputStream.toByteArray(); - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } - } - - private static Mono createMockBatchSplittingResponse(HttpRequest request, int keyIdOffset, - int expectedBatchSize) { - return FluxUtil.collectBytesInByteBufferStream(request.getBody()) - .flatMap(bodyBytes -> { - // Request documents are in a sub-node called value. - try (JsonReader reader = JsonProviders.createReader(bodyBytes)) { - IndexBatch indexBatch = IndexBatch.fromJson(reader); - - // Given the initial size was 10 and it was split we should expect 5 elements. - assertNotNull(indexBatch); - assertEquals(expectedBatchSize, indexBatch.getActions().size()); - - int[] statusCodes = new int[expectedBatchSize]; - Arrays.fill(statusCodes, 200); - - return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), - createMockResponseData(keyIdOffset, statusCodes))); - } catch (IOException ex) { - return Mono.error(ex); - } - }); - } } diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchIndexingBufferedSenderUnitTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchIndexingBufferedSenderUnitTests.java new file mode 100644 index 000000000000..0f646d198da0 --- /dev/null +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchIndexingBufferedSenderUnitTests.java @@ -0,0 +1,772 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.search.documents; + +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.FixedDelay; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import com.azure.json.JsonProviders; +import com.azure.json.JsonReader; +import com.azure.json.JsonWriter; +import com.azure.search.documents.implementation.models.IndexBatch; +import com.azure.search.documents.models.IndexAction; +import com.azure.search.documents.models.IndexActionType; +import com.azure.search.documents.models.IndexDocumentsResult; +import com.azure.search.documents.models.IndexingResult; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import reactor.core.publisher.Mono; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static com.azure.search.documents.SearchTestBase.API_KEY; +import static com.azure.search.documents.SearchTestBase.ENDPOINT; +import static com.azure.search.documents.SearchTestBase.HOTELS_DATA_JSON; +import static com.azure.search.documents.TestHelpers.readJsonFileToList; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +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 SearchIndexingBufferedSenderUnitTests { + private static final TypeReference> HOTEL_DOCUMENT_TYPE; + private static final Function, String> HOTEL_ID_KEY_RETRIEVER; + + static { + HOTEL_DOCUMENT_TYPE = new TypeReference>() { + }; + HOTEL_ID_KEY_RETRIEVER = document -> String.valueOf(document.get("HotelId")); + } + + private static SearchClientBuilder getSearchClientBuilder() { + return new SearchClientBuilder() + .endpoint(ENDPOINT) + .indexName("index") + .credential(new AzureKeyCredential(API_KEY)); + } + + /** + * Tests that a batch can timeout while indexing. + */ + @Test + public void flushTimesOut() { + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), + createMockResponseData(0, 200))).delayElement(Duration.ofSeconds(5))) + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 1)); + + assertThrows(RuntimeException.class, () -> batchingClient.flush(Duration.ofSeconds(1), Context.NONE)); + } + + /** + * Tests that a batch will retain in-flight documents if the request is cancelled before the response is handled. + */ + @Test + public void inFlightDocumentsAreRetried() { + AtomicInteger callCount = new AtomicInteger(0); + AtomicInteger addedCount = new AtomicInteger(); + AtomicInteger successCount = new AtomicInteger(); + AtomicInteger errorCount = new AtomicInteger(); + AtomicInteger sentCount = new AtomicInteger(); + + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> { + Mono response = Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), + createMockResponseData(0, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200))); + if (callCount.getAndIncrement() == 0) { + return response.delayElement(Duration.ofSeconds(5)); + } else { + return response; + } + }) + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .onActionAdded(ignored -> addedCount.incrementAndGet()) + .onActionSent(ignored -> sentCount.incrementAndGet()) + .onActionError(ignored -> errorCount.incrementAndGet()) + .onActionSucceeded(ignored -> successCount.incrementAndGet()) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); + + // First request is setup to timeout. + assertThrows(RuntimeException.class, () -> batchingClient.flush(Duration.ofSeconds(3), Context.NONE)); + + // Second request shouldn't timeout. + assertDoesNotThrow(() -> batchingClient.flush(Duration.ofSeconds(3), Context.NONE)); + + // Then validate that we have the expected number of requests sent and responded. + assertEquals(10, addedCount.get()); + assertEquals(20, sentCount.get()); + assertEquals(0, errorCount.get()); + assertEquals(10, successCount.get()); + } + + /** + * Tests that when a batch has some failures the indexing hook is properly notified. + */ + @Test + public void batchHasSomeFailures() { + AtomicInteger addedCount = new AtomicInteger(); + AtomicInteger successCount = new AtomicInteger(); + AtomicInteger errorCount = new AtomicInteger(); + AtomicInteger sentCount = new AtomicInteger(); + + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), + createMockResponseData(0, 201, 400, 201, 404, 200, 200, 404, 400, 400, 201)))) + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .onActionAdded(options -> addedCount.incrementAndGet()) + .onActionSucceeded(options -> successCount.incrementAndGet()) + .onActionError(options -> errorCount.incrementAndGet()) + .onActionSent(options -> sentCount.incrementAndGet()) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); + + // Exceptions are propagated into the onActionError. + assertDoesNotThrow((Executable) batchingClient::flush); + + assertEquals(10, addedCount.get()); + assertEquals(5, successCount.get()); + assertEquals(5, errorCount.get()); + assertEquals(10, sentCount.get()); + + /* + * No documents failed with retryable errors, so we should expect zero documents are added back into the batch. + */ + assertEquals(0, batchingClient.getActions().size()); + } + + /** + * Tests that a batch will retry documents that fail with retryable status code. + */ + @Test + public void retryableDocumentsAreAddedBackToTheBatch() { + AtomicInteger addedCount = new AtomicInteger(); + AtomicInteger successCount = new AtomicInteger(); + AtomicInteger errorCount = new AtomicInteger(); + AtomicInteger sentCount = new AtomicInteger(); + + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), + createMockResponseData(0, 201, 409, 201, 422, 200, 200, 503, 409, 422, 201)))) + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .onActionAdded(options -> addedCount.incrementAndGet()) + .onActionSucceeded(options -> successCount.incrementAndGet()) + .onActionError(options -> errorCount.incrementAndGet()) + .onActionSent(options -> sentCount.incrementAndGet()) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); + + // Exceptions are propagated into the onActionError. + assertDoesNotThrow((Executable) batchingClient::flush); + + assertEquals(10, addedCount.get()); + assertEquals(10, sentCount.get()); + assertEquals(5, successCount.get()); + assertEquals(0, errorCount.get()); + + /* + * 5 documents failed with retryable errors, so we should expect 5 documents are added back into the batch. + */ + assertEquals(5, batchingClient.getActions().size()); + } + + /** + * Tests that a batch splits if the service responds with a 413. + */ + @Test + public void batchSplits() { + AtomicInteger callCount = new AtomicInteger(); + AtomicInteger addedCount = new AtomicInteger(); + AtomicInteger successCount = new AtomicInteger(); + AtomicInteger errorCount = new AtomicInteger(); + AtomicInteger sentCount = new AtomicInteger(); + + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> { + int count = callCount.getAndIncrement(); + if (count == 0) { + return Mono.just(new MockHttpResponse(request, 413)); + } else if (count == 1) { + return createMockBatchSplittingResponse(request, 0, 5); + } else if (count == 2) { + return createMockBatchSplittingResponse(request, 5, 5); + } else { + return Mono.error(new IllegalStateException("Unexpected request.")); + } + }).bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .initialBatchActionCount(10) + .onActionAdded(options -> addedCount.incrementAndGet()) + .onActionSucceeded(options -> successCount.incrementAndGet()) + .onActionError(options -> errorCount.incrementAndGet()) + .onActionSent(options -> sentCount.incrementAndGet()) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); + + // No exception is thrown as the batch splits and retries successfully. + assertDoesNotThrow((Executable) batchingClient::flush); + + assertEquals(10, addedCount.get()); + assertEquals(10, successCount.get()); + assertEquals(0, errorCount.get()); + assertEquals(20, sentCount.get()); + + /* + * No documents failed, so we should expect zero documents are added back into the batch. + */ + assertEquals(0, batchingClient.getActions().size()); + } + + /** + * Tests that flushing a batch doesn't include duplicate keys. + */ + @Test + public void batchTakesAllNonDuplicateKeys() { + AtomicInteger callCount = new AtomicInteger(); + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> { + int count = callCount.getAndIncrement(); + if (count == 0) { + return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), + createMockResponseData(0, 200, 200, 200, 200, 200, 200, 200, 200, 200))); + } else { + return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), + createMockResponseData(0, 200))); + } + }).bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .buildSender(); + + List> documents = readJsonFileToList(HOTELS_DATA_JSON); + documents.get(9).put("HotelId", "1"); + + batchingClient.addUploadActions(documents); + + assertDoesNotThrow((Executable) batchingClient::flush); + + /* + * One document shouldn't have been sent as it contains a duplicate key from an earlier document. + */ + assertEquals(1, batchingClient.getActions().size()); + + assertDoesNotThrow((Executable) batchingClient::flush); + + /* + * No documents should remain as no duplicate keys exists. + */ + assertEquals(0, batchingClient.getActions().size()); + } + + @Test + public void batchWithDuplicateKeysBeingRetriedTakesAllNonDuplicateKeys() { + AtomicInteger callCount = new AtomicInteger(); + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> { + int count = callCount.getAndIncrement(); + if (count == 0) { + return Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), + createMockResponseData(0, 503, 200, 200, 200, 200, 200, 200, 200, 200))); + } else { + return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), + createMockResponseData(0, 200))); + } + }).bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .buildSender(); + + List> documents = readJsonFileToList(HOTELS_DATA_JSON); + documents.get(9).put("HotelId", "1"); + + batchingClient.addUploadActions(documents); + + assertDoesNotThrow((Executable) batchingClient::flush); + + /* + * Two documents should be in the batch as one failed with a retryable status code and another wasn't sent as it + * used a duplicate key from the batch that was sent. + */ + assertEquals(2, batchingClient.getActions().size()); + + assertDoesNotThrow((Executable) batchingClient::flush); + + /* + * One document should remain in the batch as it had the same key as another document in the batch. + */ + assertEquals(1, batchingClient.getActions().size()); + + assertDoesNotThrow((Executable) batchingClient::flush); + assertDoesNotThrow((Executable) batchingClient::close); + + /* + * No documents should remain as no duplicate keys exists. + */ + assertEquals(0, batchingClient.getActions().size()); + } + + /** + * Tests that an operation will be dumped into a "dead letter" queue if it is retried too many times. + */ + public void batchRetriesUntilLimit() { + AtomicInteger addedCount = new AtomicInteger(); + AtomicInteger successCount = new AtomicInteger(); + AtomicInteger errorCount = new AtomicInteger(); + AtomicInteger sentCount = new AtomicInteger(); + + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), + createMockResponseData(0, 409)))) + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .maxRetriesPerAction(10) + .onActionAdded(options -> addedCount.incrementAndGet()) + .onActionSucceeded(options -> successCount.incrementAndGet()) + .onActionError(options -> errorCount.incrementAndGet()) + .onActionSent(options -> sentCount.incrementAndGet()) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 1)); + + // Batch split until it was size of one and failed. + for (int i = 0; i < 10; i++) { + assertDoesNotThrow((Executable) batchingClient::flush); + + // Document should be added back into the batch as it is retryable. + assertEquals(1, batchingClient.getActions().size()); + } + + // Final call which will trigger the retry limit for the document but doesn't throw. + assertDoesNotThrow((Executable) batchingClient::flush); + + assertEquals(1, addedCount.get()); + assertEquals(1, errorCount.get()); + // Document gets sent 10 times for the number of retries that happen. + assertEquals(11, sentCount.get()); + assertEquals(0, successCount.get()); + + /* + * All documents failed, so we should expect zero documents are added back into the batch. + */ + assertEquals(0, batchingClient.getActions().size()); + } + + /** + * Tests that a batch will split until it is a size of one if the service continues returning 413. When the service + * returns 413 on a batch size of one it will be deemed a final error state. + */ + @Test + public void batchSplitsUntilOneAndFails() { + AtomicInteger addedCount = new AtomicInteger(); + AtomicInteger successCount = new AtomicInteger(); + AtomicInteger errorCount = new AtomicInteger(); + AtomicInteger sentCount = new AtomicInteger(); + + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> Mono.just(new MockHttpResponse(request, 413))) + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .initialBatchActionCount(2) + .onActionAdded(options -> addedCount.incrementAndGet()) + .onActionSucceeded(options -> successCount.incrementAndGet()) + .onActionError(options -> errorCount.incrementAndGet()) + .onActionSent(options -> sentCount.incrementAndGet()) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 2)); + + // Batch split until it was size of one and fails but doesn't throw. + assertDoesNotThrow((Executable) batchingClient::flush); + + assertEquals(2, addedCount.get()); + assertEquals(2, errorCount.get()); + assertEquals(0, successCount.get()); + assertEquals(4, sentCount.get()); + + /* + * No documents failed, so we should expect zero documents are added back into the batch. + */ + assertEquals(0, batchingClient.getActions().size()); + } + + /** + * Tests that a batch will split until all sub-batches are one document and some of the sub batches fail with 413 + * while others do not. + */ + @Test + public void batchSplitsUntilOneAndPartiallyFails() { + AtomicInteger callCount = new AtomicInteger(); + AtomicInteger addedCount = new AtomicInteger(); + AtomicInteger successCount = new AtomicInteger(); + AtomicInteger errorCount = new AtomicInteger(); + AtomicInteger sentCount = new AtomicInteger(); + + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> (callCount.getAndIncrement() < 2) + ? Mono.just(new MockHttpResponse(request, 413)) + : createMockBatchSplittingResponse(request, 1, 1)) + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .initialBatchActionCount(2) + .onActionAdded(options -> addedCount.incrementAndGet()) + .onActionSucceeded(options -> successCount.incrementAndGet()) + .onActionError(options -> errorCount.incrementAndGet()) + .onActionSent(options -> sentCount.incrementAndGet()) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 2)); + + // Batch split until it was size of one and fails but doesn't throw. + assertDoesNotThrow((Executable) batchingClient::flush); + + assertEquals(2, addedCount.get()); + assertEquals(1, errorCount.get()); + assertEquals(1, successCount.get()); + assertEquals(4, sentCount.get()); + + /* + * No documents failed, so we should expect zero documents are added back into the batch. + */ + assertEquals(0, batchingClient.getActions().size()); + } + + @ParameterizedTest + @MethodSource("operationsThrowAfterClientIsClosedSupplier") + public void operationsThrowAfterClientIsClosed( + Consumer>> operation) { + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .buildSender(); + + batchingClient.close(); + + assertThrows(IllegalStateException.class, () -> operation.accept(batchingClient)); + + } + + static Stream>>> operationsThrowAfterClientIsClosedSupplier() { + List> simpleDocuments = Collections.singletonList(Collections.singletonMap("key", "value")); + List>> actions = simpleDocuments.stream() + .map(document -> new IndexAction>() + .setDocument(document) + .setActionType(IndexActionType.UPLOAD)) + .collect(Collectors.toList()); + + return Stream.of( + client -> client.addActions(actions), + client -> client.addActions(actions, Duration.ofSeconds(60), Context.NONE), + + client -> client.addUploadActions(simpleDocuments), + client -> client.addUploadActions(simpleDocuments, Duration.ofSeconds(60), Context.NONE), + + client -> client.addMergeOrUploadActions(simpleDocuments), + client -> client.addMergeOrUploadActions(simpleDocuments, Duration.ofSeconds(60), Context.NONE), + + client -> client.addMergeActions(simpleDocuments), + client -> client.addMergeActions(simpleDocuments, Duration.ofSeconds(60), Context.NONE), + + client -> client.addDeleteActions(simpleDocuments), + client -> client.addDeleteActions(simpleDocuments, Duration.ofSeconds(60), Context.NONE), + + SearchIndexingBufferedSender::flush, + client -> client.flush(Duration.ofSeconds(60), Context.NONE) + ); + } + + @Test + public void closingTwiceDoesNotThrow() { + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .buildSender(); + + batchingClient.close(); + + assertDoesNotThrow((Executable) batchingClient::close); + } + + @Test + public void concurrentFlushesOnlyAllowsOneProcessor() throws InterruptedException { + AtomicInteger callCount = new AtomicInteger(); + + SearchIndexingBufferedAsyncSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> { + int count = callCount.getAndIncrement(); + if (count == 0) { + return createMockBatchSplittingResponse(request, 0, 5) + .delayElement(Duration.ofSeconds(2)) + .map(Function.identity()); + } else if (count == 1) { + return createMockBatchSplittingResponse(request, 5, 5); + } else { + return Mono.error(new IllegalStateException("Unexpected request.")); + } + }).bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .initialBatchActionCount(5) + .buildAsyncSender(); + + CountDownLatch countDownLatch = new CountDownLatch(2); + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)).block(); + + AtomicLong firstFlushCompletionTime = new AtomicLong(); + Mono.using(() -> countDownLatch, ignored -> batchingClient.flush(), latch -> { + firstFlushCompletionTime.set(System.nanoTime()); + latch.countDown(); + }).subscribe(); + + AtomicLong secondFlushCompletionTime = new AtomicLong(); + Mono.using(() -> countDownLatch, ignored -> batchingClient.flush(), latch -> { + secondFlushCompletionTime.set(System.nanoTime()); + latch.countDown(); + }).subscribe(); + + countDownLatch.await(); + assertTrue(firstFlushCompletionTime.get() > secondFlushCompletionTime.get()); + } + + @Test + public void closeWillWaitForAnyCurrentFlushesToCompleteBeforeRunning() throws InterruptedException { + AtomicInteger callCount = new AtomicInteger(); + + SearchIndexingBufferedAsyncSender> batchingClient = getSearchClientBuilder() + .httpClient(request -> { + int count = callCount.getAndIncrement(); + if (count == 0) { + return createMockBatchSplittingResponse(request, 0, 5) + .delayElement(Duration.ofSeconds(2)) + .map(Function.identity()); + } else if (count == 1) { + return createMockBatchSplittingResponse(request, 5, 5); + } else { + return Mono.error(new IllegalStateException("Unexpected request.")); + } + }).bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .initialBatchActionCount(5) + .buildAsyncSender(); + + CountDownLatch countDownLatch = new CountDownLatch(2); + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)).block(); + + AtomicLong firstFlushCompletionTime = new AtomicLong(); + Mono.using(() -> countDownLatch, ignored -> batchingClient.flush(), latch -> { + firstFlushCompletionTime.set(System.nanoTime()); + latch.countDown(); + }).subscribe(); + + AtomicLong secondFlushCompletionTime = new AtomicLong(); + Mono.using(() -> countDownLatch, ignored -> batchingClient.close(), latch -> { + secondFlushCompletionTime.set(System.nanoTime()); + latch.countDown(); + }).subscribe(); + + countDownLatch.await(); + assertTrue(firstFlushCompletionTime.get() <= secondFlushCompletionTime.get()); + } + + @Test + public void serverBusyResponseRetries() { + AtomicInteger callCount = new AtomicInteger(); + AtomicInteger addedCount = new AtomicInteger(); + AtomicInteger successCount = new AtomicInteger(); + AtomicInteger errorCount = new AtomicInteger(); + AtomicInteger sentCount = new AtomicInteger(); + + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .retryPolicy(new RetryPolicy(new FixedDelay(0, Duration.ZERO))) + .httpClient(request -> { + int count = callCount.getAndIncrement(); + if (count < 1) { + return Mono.just(new MockHttpResponse(request, 503)); + } else { + return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), + createMockResponseData(0, 201, 200, 201, 200, 200, 200, 201, 201, 200, 201))); + } + }).bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .onActionAdded(options -> addedCount.incrementAndGet()) + .onActionSucceeded(options -> successCount.incrementAndGet()) + .onActionError(options -> errorCount.incrementAndGet()) + .onActionSent(options -> sentCount.incrementAndGet()) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); + + // No exception is thrown as the batch splits and retries successfully. + assertDoesNotThrow((Executable) batchingClient::flush); + assertDoesNotThrow((Executable) batchingClient::flush); + + assertEquals(10, addedCount.get()); + assertEquals(10, successCount.get()); + assertEquals(0, errorCount.get()); + assertEquals(20, sentCount.get()); + + /* + * No documents failed, so we should expect zero documents are added back into the batch. + */ + assertEquals(0, batchingClient.getActions().size()); + } + + @Test + public void delayGrowsWith503Response() { + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .retryPolicy(new RetryPolicy(new FixedDelay(0, Duration.ZERO))) + .httpClient(request -> Mono.just(new MockHttpResponse(request, 503))) + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON)); + + assertDoesNotThrow((Executable) batchingClient::flush); + Duration retryDuration = batchingClient.client.publisher.getCurrentRetryDelay(); + assertTrue(retryDuration.compareTo(Duration.ZERO) > 0); + + assertDoesNotThrow((Executable) batchingClient::flush); + assertTrue(batchingClient.client.publisher.getCurrentRetryDelay().compareTo(retryDuration) > 0); + } + + @Test + public void delayGrowsWith503BatchOperation() { + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .retryPolicy(new RetryPolicy(new FixedDelay(0, Duration.ZERO))) + .httpClient(request -> Mono.just(new MockHttpResponse(request, 207, new HttpHeaders(), + createMockResponseData(0, 503)))) + .bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 1)); + + assertDoesNotThrow((Executable) batchingClient::flush); + Duration retryDuration = batchingClient.client.publisher.getCurrentRetryDelay(); + assertTrue(retryDuration.compareTo(Duration.ZERO) > 0); + + assertDoesNotThrow((Executable) batchingClient::flush); + assertTrue(batchingClient.client.publisher.getCurrentRetryDelay().compareTo(retryDuration) > 0); + } + + @Test + public void delayResetsAfterNo503s() { + AtomicInteger callCount = new AtomicInteger(); + SearchIndexingBufferedSender> batchingClient = getSearchClientBuilder() + .retryPolicy(new RetryPolicy(new FixedDelay(0, Duration.ZERO))) + .httpClient(request -> { + int count = callCount.getAndIncrement(); + if (count == 0) { + return Mono.just(new MockHttpResponse(request, 503)); + } else { + return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), + createMockResponseData(0, 200))); + } + }).bufferedSender(HOTEL_DOCUMENT_TYPE) + .documentKeyRetriever(HOTEL_ID_KEY_RETRIEVER) + .autoFlush(false) + .buildSender(); + + batchingClient.addUploadActions(readJsonFileToList(HOTELS_DATA_JSON).subList(0, 1)); + + assertDoesNotThrow((Executable) batchingClient::flush); + Duration retryDuration = batchingClient.client.publisher.getCurrentRetryDelay(); + assertTrue(retryDuration.compareTo(Duration.ZERO) > 0); + + assertDoesNotThrow((Executable) batchingClient::flush); + assertEquals(Duration.ZERO, batchingClient.client.publisher.getCurrentRetryDelay()); + } + + /* + * Helper method that creates mock results with the status codes given. This will create a mock indexing result + * and turn it into a byte[] so it can be put in a mock response. + */ + private static byte[] createMockResponseData(int keyIdOffset, int... statusCodes) { + List results = new ArrayList<>(); + + for (int i = 0; i < statusCodes.length; i++) { + int statusCode = statusCodes[i]; + results.add(new IndexingResult(String.valueOf(keyIdOffset + i + 1), statusCode == 200 || statusCode == 201, + statusCode)); + } + + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + try (JsonWriter writer = JsonProviders.createWriter(outputStream)) { + writer.writeJson(new IndexDocumentsResult(results)).flush(); + return outputStream.toByteArray(); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + } + + private static Mono createMockBatchSplittingResponse(HttpRequest request, int keyIdOffset, + int expectedBatchSize) { + return FluxUtil.collectBytesInByteBufferStream(request.getBody()) + .flatMap(bodyBytes -> { + // Request documents are in a sub-node called value. + try (JsonReader reader = JsonProviders.createReader(bodyBytes)) { + IndexBatch indexBatch = IndexBatch.fromJson(reader); + + // Given the initial size was 10 and it was split we should expect 5 elements. + assertNotNull(indexBatch); + assertEquals(expectedBatchSize, indexBatch.getActions().size()); + + int[] statusCodes = new int[expectedBatchSize]; + Arrays.fill(statusCodes, 200); + + return Mono.just(new MockHttpResponse(request, 200, new HttpHeaders(), + createMockResponseData(keyIdOffset, statusCodes))); + } catch (IOException ex) { + return Mono.error(ex); + } + }); + } +} diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchTestBase.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchTestBase.java index 8a7ad8162d43..3198550f22fa 100644 --- a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchTestBase.java +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/SearchTestBase.java @@ -8,6 +8,7 @@ import com.azure.core.http.policy.FixedDelay; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.test.InterceptorManager; import com.azure.core.test.TestMode; import com.azure.core.test.TestProxyTestBase; import com.azure.core.test.http.AssertingHttpClientBuilder; @@ -114,7 +115,7 @@ protected SearchIndexClientBuilder getSearchIndexClientBuilder(boolean isSync) { SearchIndexClientBuilder builder = new SearchIndexClientBuilder() .endpoint(ENDPOINT) .credential(new AzureKeyCredential(API_KEY)) - .httpClient(getHttpClient(true, isSync)); + .httpClient(getHttpClient(true, interceptorManager, isSync)); if (interceptorManager.isPlaybackMode()) { addPolicies(builder); @@ -135,7 +136,7 @@ protected SearchIndexerClientBuilder getSearchIndexerClientBuilder(boolean isSyn SearchIndexerClientBuilder builder = new SearchIndexerClientBuilder() .endpoint(ENDPOINT) .credential(new AzureKeyCredential(API_KEY)) - .httpClient(getHttpClient(true, isSync)); + .httpClient(getHttpClient(true, interceptorManager, isSync)); addPolicies(builder, policies); @@ -182,12 +183,13 @@ protected SearchClientBuilder getSearchClientBuilderWithoutAssertingClient(Strin return getSearchClientBuilderHelper(indexName, false, isSync); } - private SearchClientBuilder getSearchClientBuilderHelper(String indexName, boolean wrapWithAssertingClient, boolean isSync) { + private SearchClientBuilder getSearchClientBuilderHelper(String indexName, boolean wrapWithAssertingClient, + boolean isSync) { SearchClientBuilder builder = new SearchClientBuilder() .endpoint(ENDPOINT) .indexName(indexName) .credential(new AzureKeyCredential(API_KEY)) - .httpClient(getHttpClient(wrapWithAssertingClient, isSync)); + .httpClient(getHttpClient(wrapWithAssertingClient, interceptorManager, isSync)); if (interceptorManager.isPlaybackMode()) { return builder; @@ -202,10 +204,10 @@ private SearchClientBuilder getSearchClientBuilderHelper(String indexName, boole return builder; } - private HttpClient getHttpClient(boolean wrapWithAssertingClient, boolean isSync) { - HttpClient httpClient = (interceptorManager.isPlaybackMode()) - ? interceptorManager.getPlaybackClient() - : HttpClient.createDefault(); + private static HttpClient getHttpClient(boolean wrapWithAssertingClient, InterceptorManager interceptorManager, + boolean isSync) { + HttpClient httpClient = interceptorManager.isPlaybackMode() + ? interceptorManager.getPlaybackClient() : HttpClient.createDefault(); if (wrapWithAssertingClient) { if (!isSync) { diff --git a/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/models/SearchRequestUrlRewriterPolicyTests.java b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/models/SearchRequestUrlRewriterPolicyTests.java new file mode 100644 index 000000000000..e024b7e2d8ce --- /dev/null +++ b/sdk/search/azure-search-documents/src/test/java/com/azure/search/documents/models/SearchRequestUrlRewriterPolicyTests.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.search.documents.models; + +import com.azure.core.http.HttpClient; +import com.azure.core.test.utils.MockTokenCredential; +import com.azure.core.util.Context; +import com.azure.search.documents.SearchAsyncClient; +import com.azure.search.documents.SearchClient; +import com.azure.search.documents.SearchClientBuilder; +import com.azure.search.documents.SearchDocument; +import com.azure.search.documents.SearchRequestUrlRewriterPolicy; +import com.azure.search.documents.indexes.SearchIndexAsyncClient; +import com.azure.search.documents.indexes.SearchIndexClient; +import com.azure.search.documents.indexes.SearchIndexClientBuilder; +import com.azure.search.documents.indexes.SearchIndexerAsyncClient; +import com.azure.search.documents.indexes.SearchIndexerClient; +import com.azure.search.documents.indexes.SearchIndexerClientBuilder; +import com.azure.search.documents.indexes.models.IndexDocumentsBatch; +import com.azure.search.documents.indexes.models.SearchAlias; +import com.azure.search.documents.indexes.models.SearchIndex; +import com.azure.search.documents.indexes.models.SearchIndexer; +import com.azure.search.documents.indexes.models.SearchIndexerDataSourceConnection; +import com.azure.search.documents.indexes.models.SearchIndexerSkillset; +import com.azure.search.documents.indexes.models.SynonymMap; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.concurrent.Callable; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import static java.util.Collections.emptyList; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class SearchRequestUrlRewriterPolicyTests { + @ParameterizedTest + @MethodSource("correctUrlRewriteSupplier") + public void correctUrlRewrite(Callable apiCall, String expectedUrl) { + try { + apiCall.call(); + } catch (Exception ex) { + UrlRewriteException urlRewriteException = Assertions.assertInstanceOf(UrlRewriteException.class, ex); + assertTrue(urlRewriteException.rewrittenUrl.startsWith(expectedUrl), + () -> "Expected URL to start with " + expectedUrl + " but was " + urlRewriteException.rewrittenUrl); + } + } + + public static Stream correctUrlRewriteSupplier() { + HttpClient urlRewriteHttpClient = + request -> Mono.error(new UrlRewriteException("Url rewritten", request.getUrl().toString())); + + SearchClientBuilder searchClientBuilder = new SearchClientBuilder() + .indexName("test") + .endpoint("https://test.search.windows.net") + .credential(new MockTokenCredential()) + .addPolicy(new SearchRequestUrlRewriterPolicy()) + .httpClient(urlRewriteHttpClient); + SearchClient searchClient = searchClientBuilder.buildClient(); + SearchAsyncClient searchAsyncClient = searchClientBuilder.buildAsyncClient(); + + SearchIndexClientBuilder searchIndexClientBuilder = new SearchIndexClientBuilder() + .endpoint("https://test.search.windows.net") + .credential(new MockTokenCredential()) + .addPolicy(new SearchRequestUrlRewriterPolicy()) + .httpClient(urlRewriteHttpClient); + SearchIndexClient searchIndexClient = searchIndexClientBuilder.buildClient(); + SearchIndexAsyncClient searchIndexAsyncClient = searchIndexClientBuilder.buildAsyncClient(); + + SearchIndexerClientBuilder searchIndexerClientBuilder = new SearchIndexerClientBuilder() + .endpoint("https://test.search.windows.net") + .credential(new MockTokenCredential()) + .addPolicy(new SearchRequestUrlRewriterPolicy()) + .httpClient(urlRewriteHttpClient); + SearchIndexerClient searchIndexerClient = searchIndexerClientBuilder.buildClient(); + SearchIndexerAsyncClient searchIndexerAsyncClient = searchIndexerClientBuilder.buildAsyncClient(); + + String docsUrl = "https://test.search.windows.net/indexes/test/docs"; + + SearchIndex index = new SearchIndex("index"); + String indexUrl = "https://test.search.windows.net/indexes/index"; + + SynonymMap synonymMap = new SynonymMap("synonym"); + String synonymMapUrl = "https://test.search.windows.net/synonymmaps/synonym"; + + SearchAlias alias = new SearchAlias("alias", emptyList()); + String aliasUrl = "https://test.search.windows.net/aliases/alias"; + + SearchIndexerDataSourceConnection dataSource = new SearchIndexerDataSourceConnection("datasource"); + String dataSourceUrl = "https://test.search.windows.net/datasources/datasource"; + + SearchIndexer indexer = new SearchIndexer("indexer"); + String indexerUrl = "https://test.search.windows.net/indexers/indexer"; + + SearchIndexerSkillset skillset = new SearchIndexerSkillset("skillset"); + String skillsetUrl = "https://test.search.windows.net/skillsets/skillset"; + + return Stream.of( + Arguments.of(toCallable(() -> searchClient.indexDocumentsWithResponse(new IndexDocumentsBatch<>(), null, + Context.NONE)), docsUrl + "/search.index"), + Arguments.of(toCallable(() -> searchClient.getDocumentWithResponse("test", SearchDocument.class, null, + Context.NONE)), docsUrl + "/test"), + Arguments.of(toCallable(() -> searchClient.getDocumentCountWithResponse(Context.NONE)), + docsUrl + "/$count"), + Arguments.of(toCallable(() -> searchClient.search("search", null, Context.NONE).iterator().hasNext()), + docsUrl + "/search.post.search"), + Arguments.of(toCallable(() -> searchClient.suggest("suggest", "suggester", null, Context.NONE) + .iterator().hasNext()), docsUrl + "/seach.post.suggest"), + Arguments.of(toCallable(() -> searchClient.autocomplete("autocomplete", "suggester", null, Context.NONE) + .iterator().hasNext()), docsUrl + "/search.post.autocomplete"), + + Arguments.of(toCallable(searchAsyncClient.indexDocumentsWithResponse(new IndexDocumentsBatch<>(), null)), + docsUrl + "/search.index"), + Arguments.of(toCallable(searchAsyncClient.getDocumentWithResponse("test", SearchDocument.class, null)), + docsUrl + "/test"), + Arguments.of(toCallable(searchAsyncClient.getDocumentCountWithResponse()), docsUrl + "/$count"), + Arguments.of(toCallable(searchAsyncClient.search("search", null)), docsUrl + "/search.post.search"), + Arguments.of(toCallable(searchAsyncClient.suggest("suggest", "suggester", null)), + docsUrl + "/search.post.suggest"), + Arguments.of(toCallable(searchAsyncClient.autocomplete("autocomplete", "suggester", null)), + docsUrl + "/search.post.autocomplete"), + + Arguments.of(toCallable(() -> searchIndexClient.createIndexWithResponse(index, Context.NONE)), + "https://test.search.windows.net/indexes"), + Arguments.of(toCallable(() -> searchIndexClient.getIndexWithResponse("index", Context.NONE)), indexUrl), + Arguments.of(toCallable(() -> searchIndexClient.getIndexStatisticsWithResponse("index", Context.NONE)), + indexUrl + "/search.stats"), + Arguments.of(toCallable(() -> searchIndexClient.listIndexes(Context.NONE).iterator().hasNext()), + "https://test.search.windows.net/indexes"), + Arguments.of(toCallable(() -> searchIndexClient.listIndexNames(Context.NONE).iterator().hasNext()), + "https://test.search.windows.net/indexes"), + Arguments.of(toCallable(() -> searchIndexClient.createOrUpdateIndexWithResponse(index, false, false, + Context.NONE)), indexUrl), + Arguments.of(toCallable(() -> searchIndexClient.deleteIndexWithResponse(index, true, Context.NONE)), + indexUrl), + Arguments.of(toCallable(() -> searchIndexClient.analyzeText("index", null, Context.NONE)), + indexUrl + "/search.analyze"), + Arguments.of(toCallable(() -> searchIndexClient.createSynonymMapWithResponse(synonymMap, Context.NONE)), + "https://test.search.windows.net/synonymmaps"), + Arguments.of(toCallable(() -> searchIndexClient.getSynonymMapWithResponse("synonym", Context.NONE)), + synonymMapUrl), + Arguments.of(toCallable(() -> searchIndexClient.listSynonymMaps(Context.NONE).iterator().hasNext()), + "https://test.search.windows.net/synonymmaps"), + Arguments.of(toCallable(() -> searchIndexClient.listSynonymMapNames(Context.NONE).iterator().hasNext()), + "https://test.search.windows.net/synonymmaps"), + Arguments.of(toCallable(() -> searchIndexClient.createOrUpdateSynonymMapWithResponse(synonymMap, false, + Context.NONE)), synonymMapUrl), + Arguments.of(toCallable(() -> searchIndexClient.deleteSynonymMapWithResponse(synonymMap, true, + Context.NONE)), synonymMapUrl), + Arguments.of(toCallable(() -> searchIndexClient.getServiceStatisticsWithResponse(Context.NONE)), + "https://test.search.windows.net/servicestats"), + Arguments.of(toCallable(() -> searchIndexClient.createAliasWithResponse(alias, Context.NONE)), + "https://test.search.windows.net/aliases"), + Arguments.of(toCallable(() -> searchIndexClient.createOrUpdateAliasWithResponse(alias, false, + Context.NONE)), aliasUrl), + Arguments.of(toCallable(() -> searchIndexClient.getAliasWithResponse("alias", Context.NONE)), aliasUrl), + Arguments.of(toCallable(() -> searchIndexClient.deleteAliasWithResponse(alias, true, Context.NONE)), + aliasUrl), + Arguments.of(toCallable(() -> searchIndexClient.listAliases(Context.NONE).iterator().hasNext()), + "https://test.search.windows.net/aliases"), + + Arguments.of(toCallable(searchIndexAsyncClient.createIndexWithResponse(index)), + "https://test.search.windows.net/indexes"), + Arguments.of(toCallable(searchIndexAsyncClient.getIndexWithResponse("index")), indexUrl), + Arguments.of(toCallable(searchIndexAsyncClient.getIndexStatisticsWithResponse("index")), + indexUrl + "/search.stats"), + Arguments.of(toCallable(searchIndexAsyncClient.listIndexes()), "https://test.search.windows.net/indexes"), + Arguments.of(toCallable(searchIndexAsyncClient.listIndexNames()), + "https://test.search.windows.net/indexes"), + Arguments.of(toCallable(searchIndexAsyncClient.createOrUpdateIndexWithResponse(index, false, false)), + indexUrl), + Arguments.of(toCallable(searchIndexAsyncClient.deleteIndexWithResponse(index, true)), indexUrl), + Arguments.of(toCallable(searchIndexAsyncClient.analyzeText("index", null)), indexUrl + "/search.analyze"), + Arguments.of(toCallable(searchIndexAsyncClient.createSynonymMapWithResponse(synonymMap)), + "https://test.search.windows.net/synonymmaps"), + Arguments.of(toCallable(searchIndexAsyncClient.getSynonymMapWithResponse("synonym")), synonymMapUrl), + Arguments.of(toCallable(searchIndexAsyncClient.listSynonymMaps()), + "https://test.search.windows.net/synonymmaps"), + Arguments.of(toCallable(searchIndexAsyncClient.listSynonymMapNames()), + "https://test.search.windows.net/synonymmaps"), + Arguments.of(toCallable(searchIndexAsyncClient.createOrUpdateSynonymMapWithResponse(synonymMap, false)), + synonymMapUrl), + Arguments.of(toCallable(searchIndexAsyncClient.deleteSynonymMapWithResponse(synonymMap, true)), + synonymMapUrl), + Arguments.of(toCallable(searchIndexAsyncClient.getServiceStatisticsWithResponse()), + "https://test.search.windows.net/servicestats"), + Arguments.of(toCallable(searchIndexAsyncClient.createAliasWithResponse(alias)), + "https://test.search.windows.net/aliases"), + Arguments.of(toCallable(searchIndexAsyncClient.createOrUpdateAliasWithResponse(alias, false)), aliasUrl), + Arguments.of(toCallable(searchIndexAsyncClient.getAliasWithResponse("alias")), aliasUrl), + Arguments.of(toCallable(searchIndexAsyncClient.deleteAliasWithResponse(alias, true)), aliasUrl), + Arguments.of(toCallable(searchIndexAsyncClient.listAliases()), "https://test.search.windows.net/aliases"), + + Arguments.of(toCallable(() -> searchIndexerClient.createOrUpdateDataSourceConnectionWithResponse(dataSource, + true, Context.NONE)), dataSourceUrl), + Arguments.of(toCallable(() -> searchIndexerClient.createDataSourceConnectionWithResponse(dataSource, + Context.NONE)), "https://test.search.windows.net/datasources"), + Arguments.of(toCallable(() -> searchIndexerClient.getDataSourceConnectionWithResponse("datasource", + Context.NONE)), dataSourceUrl), + Arguments.of(toCallable(() -> searchIndexerClient.listDataSourceConnections(Context.NONE).iterator() + .hasNext()), "https://test.search.windows.net/datasources"), + Arguments.of(toCallable(() -> searchIndexerClient.listDataSourceConnectionNames(Context.NONE).iterator() + .hasNext()), "https://test.search.windows.net/datasources"), + Arguments.of(toCallable(() -> searchIndexerClient.deleteDataSourceConnectionWithResponse(dataSource, true, + Context.NONE)), dataSourceUrl), + Arguments.of(toCallable(() -> searchIndexerClient.createIndexerWithResponse(indexer, Context.NONE)), + "https://test.search.windows.net/indexers"), + Arguments.of(toCallable(() -> searchIndexerClient.createOrUpdateIndexerWithResponse(indexer, false, + Context.NONE)), indexerUrl), + Arguments.of(toCallable(() -> searchIndexerClient.listIndexers(Context.NONE).iterator().hasNext()), + "https://test.search.windows.net/indexers"), + Arguments.of(toCallable(() -> searchIndexerClient.listIndexerNames(Context.NONE).iterator().hasNext()), + "https://test.search.windows.net/indexers"), + Arguments.of(toCallable(() -> searchIndexerClient.getIndexerWithResponse("indexer", Context.NONE)), + indexerUrl), + Arguments.of(toCallable(() -> searchIndexerClient.deleteIndexerWithResponse(indexer, true, Context.NONE)), + indexerUrl), + Arguments.of(toCallable(() -> searchIndexerClient.resetIndexerWithResponse("indexer", Context.NONE)), + indexerUrl + "/search.reset"), + Arguments.of(toCallable(() -> searchIndexerClient.runIndexerWithResponse("indexer", Context.NONE)), + indexerUrl + "/search.run"), + Arguments.of(toCallable(() -> searchIndexerClient.getIndexerStatusWithResponse("indexer", Context.NONE)), + indexerUrl + "/search.status"), + Arguments.of(toCallable(() -> searchIndexerClient.resetDocumentsWithResponse(indexer, null, emptyList(), + emptyList(), Context.NONE)), indexerUrl + "/search.resetdocs"), + Arguments.of(toCallable(() -> searchIndexerClient.createSkillsetWithResponse(skillset, Context.NONE)), + "https://test.search.windows.net/skillsets"), + Arguments.of(toCallable(() -> searchIndexerClient.getSkillsetWithResponse("skillset", Context.NONE)), + skillsetUrl), + Arguments.of(toCallable(() -> searchIndexerClient.listSkillsets(Context.NONE).iterator().hasNext()), + "https://test.search.windows.net/skillsets"), + Arguments.of(toCallable(() -> searchIndexerClient.listSkillsetNames(Context.NONE).iterator().hasNext()), + "https://test.search.windows.net/skillsets"), + Arguments.of(toCallable(() -> searchIndexerClient.createOrUpdateSkillsetWithResponse(skillset, false, + Context.NONE)), skillsetUrl), + Arguments.of(toCallable(() -> searchIndexerClient.deleteSkillsetWithResponse(skillset, true, Context.NONE)), + skillsetUrl), + Arguments.of(toCallable(() -> searchIndexerClient.resetSkillsWithResponse(skillset, emptyList(), + Context.NONE)), skillsetUrl + "/search.resetskills"), + + Arguments.of(toCallable(searchIndexerAsyncClient.createOrUpdateDataSourceConnectionWithResponse(dataSource, + true)), dataSourceUrl), + Arguments.of(toCallable(searchIndexerAsyncClient.createDataSourceConnectionWithResponse(dataSource)), + "https://test.search.windows.net/datasources"), + Arguments.of(toCallable(searchIndexerAsyncClient.getDataSourceConnectionWithResponse("datasource")), + dataSourceUrl), + Arguments.of(toCallable(searchIndexerAsyncClient.listDataSourceConnections()), + "https://test.search.windows.net/datasources"), + Arguments.of(toCallable(searchIndexerAsyncClient.listDataSourceConnectionNames()), + "https://test.search.windows.net/datasources"), + Arguments.of(toCallable(searchIndexerAsyncClient.deleteDataSourceConnectionWithResponse(dataSource, true)), + dataSourceUrl), + Arguments.of(toCallable(searchIndexerAsyncClient.createIndexerWithResponse(indexer)), + "https://test.search.windows.net/indexers"), + Arguments.of(toCallable(searchIndexerAsyncClient.createOrUpdateIndexerWithResponse(indexer, false)), + indexerUrl), + Arguments.of(toCallable(searchIndexerAsyncClient.listIndexers()), + "https://test.search.windows.net/indexers"), + Arguments.of(toCallable(searchIndexerAsyncClient.listIndexerNames()), + "https://test.search.windows.net/indexers"), + Arguments.of(toCallable(searchIndexerAsyncClient.getIndexerWithResponse("indexer")), indexerUrl), + Arguments.of(toCallable(searchIndexerAsyncClient.deleteIndexerWithResponse(indexer, true)), indexerUrl), + Arguments.of(toCallable(searchIndexerAsyncClient.resetIndexerWithResponse("indexer")), + indexerUrl + "/search.reset"), + Arguments.of(toCallable(searchIndexerAsyncClient.runIndexerWithResponse("indexer")), + indexerUrl + "/search.run"), + Arguments.of(toCallable(searchIndexerAsyncClient.getIndexerStatusWithResponse("indexer")), + indexerUrl + "/search.status"), + Arguments.of(toCallable(searchIndexerAsyncClient.resetDocumentsWithResponse(indexer, null, emptyList(), + emptyList())), indexerUrl + "/search.resetdocs"), + Arguments.of(toCallable(searchIndexerAsyncClient.createSkillsetWithResponse(skillset)), + "https://test.search.windows.net/skillsets"), + Arguments.of(toCallable(searchIndexerAsyncClient.getSkillsetWithResponse("skillset")), skillsetUrl), + Arguments.of(toCallable(searchIndexerAsyncClient.listSkillsets()), + "https://test.search.windows.net/skillsets"), + Arguments.of(toCallable(searchIndexerAsyncClient.listSkillsetNames()), + "https://test.search.windows.net/skillsets"), + Arguments.of(toCallable(searchIndexerAsyncClient.createOrUpdateSkillsetWithResponse(skillset, false)), + skillsetUrl), + Arguments.of(toCallable(searchIndexerAsyncClient.deleteSkillsetWithResponse(skillset, true)), skillsetUrl), + Arguments.of(toCallable(searchIndexerAsyncClient.resetSkillsWithResponse(skillset, emptyList())), + skillsetUrl + "/search.resetskills") + ); + } + + private static Callable toCallable(Supplier apiCall) { + return () -> apiCall; + } + + private static Callable toCallable(Mono apiCall) { + return apiCall::block; + } + + private static Callable toCallable(Flux apiCall) { + return apiCall::blockFirst; + } + + private static final class UrlRewriteException extends RuntimeException { + private final String rewrittenUrl; + UrlRewriteException(String message, String rewrittenUrl) { + super(message); + + this.rewrittenUrl = rewrittenUrl; + } + } +} diff --git a/sdk/search/azure-search-perf/pom.xml b/sdk/search/azure-search-perf/pom.xml index b6721fb3fdd3..02a7451e030a 100644 --- a/sdk/search/azure-search-perf/pom.xml +++ b/sdk/search/azure-search-perf/pom.xml @@ -29,7 +29,7 @@ com.azure azure-search-documents - 11.6.0-beta.9 + 11.6.0-beta.10 diff --git a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md index a4fa7305f5d4..84abd9d68a99 100644 --- a/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md +++ b/sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md @@ -10,6 +10,20 @@ ### Other Changes +## 7.14.4 (2023-09-18) + +### Bugs Fixed + +- Fixed `NullPointerException` that happens when session processor or receiver encounters an error and distributed tracing is enabled. + ([#36800](https://github.com/Azure/azure-sdk-for-java/issues/36800)) + +### Other Changes + +#### Dependency Updates +- Upgraded `azure-core` from `1.42.0` to `1.43.0`. +- Upgraded `azure-core-amqp` from `2.8.8` to `2.8.9`. +- Upgraded `azure-identity` from `1.10.0` to `1.10.1`. + ## 7.15.0-beta.3 (2023-08-14) ### Features Added @@ -35,6 +49,7 @@ - Fixed issue causing updates to TopicProperties with AuthorizationRules to return 400 Bad request. ([#34880](https://github.com/Azure/azure-sdk-for-java/issues/34880)) + ### Other Changes #### Dependency Updates diff --git a/sdk/servicebus/azure-messaging-servicebus/README.md b/sdk/servicebus/azure-messaging-servicebus/README.md index 2b5eb2ebd5c4..72e810b9793b 100644 --- a/sdk/servicebus/azure-messaging-servicebus/README.md +++ b/sdk/servicebus/azure-messaging-servicebus/README.md @@ -69,7 +69,7 @@ add the direct dependency to your project as follows. com.azure azure-messaging-servicebus - 7.14.3 + 7.14.4 ``` [//]: # ({x-version-update-end}) @@ -116,7 +116,7 @@ platform. First, add the package: com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/servicebus/azure-messaging-servicebus/TROUBLESHOOTING.md b/sdk/servicebus/azure-messaging-servicebus/TROUBLESHOOTING.md index c0e7058ab67c..a48c5d94437d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/TROUBLESHOOTING.md +++ b/sdk/servicebus/azure-messaging-servicebus/TROUBLESHOOTING.md @@ -3,18 +3,16 @@ This troubleshooting guide covers failure investigation techniques, common errors for the credential types in the Azure Service Bus Java client library, and mitigation steps to resolve these errors. ## Table of contents -- [Implicit prefetch issue in ServiceBusReceiverClient](#implicit-prefetch-issue-in-servicebusreceiverclient) -- [Troubleshoot ServiceBusProcessorClient issues](#troubleshoot-servicebusprocessorclient-issues) - - [Client hangs or stalls with a high prefetch and maxConcurrentCall value](#client-hangs-or-stalls-with-a-high-prefetch-and-maxconcurrentcall-value) - - [Credit calculation issue](#credit-calculation-issue) -- [Autocomplete issue](#autocomplete-issue) -- [Migrate from legacy to new client library](#migrate-from-legacy-to-new-client-library) -- [Enable and configure logging](#enable-and-configure-logging) - - [Configuring Log4J 2](#configuring-log4j-2) - - [Configuring logback](#configuring-logback) - - [Enable AMQP transport logging](#enable-amqp-transport-logging) - - [Reduce logging](#reduce-logging) -- [Get additional help](#get-additional-help) +- [Troubleshooting Service Bus issues](#troubleshooting-service-bus-issues) + - [Table of contents](#table-of-contents) + - [Implicit prefetch issue in ServiceBusReceiverClient](#implicit-prefetch-issue-in-servicebusreceiverclient) + - [Troubleshoot ServiceBusProcessorClient issues](#troubleshoot-servicebusprocessorclient-issues) + - [Client hangs or stalls with a high prefetch and maxConcurrentCall value](#client-hangs-or-stalls-with-a-high-prefetch-and-maxconcurrentcall-value) + - [Credit calculation issue](#credit-calculation-issue) + - [Autocomplete issue](#autocomplete-issue) + - [Migrate from legacy to new client library](#migrate-from-legacy-to-new-client-library) + - [Enable and configure logging](#enable-and-configure-logging) + - [Get additional help](#get-additional-help) - [Filing GitHub issues](#filing-github-issues) ## Implicit prefetch issue in ServiceBusReceiverClient @@ -68,56 +66,8 @@ The [migration guide][MigrationGuide] includes steps on migrating from the legac checkpoints. ## Enable and configure logging -The Azure SDK for Java offers a consistent logging story to help troubleshoot application errors and expedite their -resolution. The logs produced will capture the flow of an application before reaching the terminal state to help locate -the root issue. View the [logging][Logging] wiki for guidance about enabling logging. - -In addition to enabling logging, setting the log level to `VERBOSE` or `DEBUG` provides insights into the library's -state. Below are sample log4j2 and logback configurations to reduce the excessive messages when verbose logging is -enabled. - -### Configuring Log4J 2 -1. Add the dependencies in your pom.xml using ones from the [logging sample pom.xml][LoggingPom] under the "Dependencies required for Log4j2" section. -2. Add [log4j2.xml][log4j2] to your `src/main/resources`. - -### Configuring logback -1. Add the dependencies in your pom.xml using ones from the [logging sample pom.xml][LoggingPom] under the "Dependencies required for logback" section. -2. Add [logback.xml][logback] to your `src/main/resources`. - -### Enable AMQP transport logging -If enabling client logging is not enough to diagnose your issues. You can enable logging to a file in the underlying -AMQP library, [Qpid Proton-J][qpid_proton_j_apache]. Qpid Proton-J uses `java.util.logging`. You can enable logging by -creating a configuration file with the contents below. Or set `proton.trace.level=ALL` and whichever configuration options -you want for the `java.util.logging.Handler` implementation. The implementation classes and their options can be found in -[Java 8 SDK javadoc][java_8_sdk_javadocs]. - -To trace the AMQP transport frames, set the environment variable: `PN_TRACE_FRM=1`. - -#### Sample "logging.properties" file -The configuration file below logs TRACE level output from proton-j to the file "proton-trace.log". - -``` -handlers=java.util.logging.FileHandler -.level=OFF -proton.trace.level=ALL -java.util.logging.FileHandler.level=ALL -java.util.logging.FileHandler.pattern=proton-trace.log -java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=[%1$tF %1$tr] %3$s %4$s: %5$s %n -``` - -### Reduce logging -One way to decrease logging is to change the verbosity. Another is to add filters that exclude logs from logger names -packages like `com.azure.messaging.servicebus` or `com.azure.core.amqp`. Examples of this can be found in the XML files -in [Configuring Log4J 2](#configuring-log4j-2) and [Configure logback](#configuring-logback). - -When submitting a bug, log messages from classes in the following packages are interesting: - -* `com.azure.core.amqp.implementation` -* `com.azure.core.amqp.implementation.handler` - * The exception is that the onDelivery message in ReceiveLinkHandler can be ignored. -* `com.azure.messaging.servicebus.implementation` +The contents have moved to: https://learn.microsoft.com/azure/developer/java/sdk/troubleshooting-messaging-service-bus-overview ## Get additional help Additional information on ways to reach out for support can be found in the [SUPPORT.md][SUPPORT] at the repo's root. @@ -143,14 +93,9 @@ When filing GitHub issues, the following details are requested: * Logs. We need DEBUG logs, but if that is not possible, INFO at least. Error and warning level logs do not provide enough information. The period of at least +/- 10 minutes from when the issue occurred. - -[log4j2]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/servicebus/azure-messaging-servicebus/docs/log4j2.xml -[logback]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/servicebus/azure-messaging-servicebus/docs/logback.xml -[LoggingPom]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/servicebus/azure-messaging-servicebus/docs/pom.xml [MigrationGuide]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/servicebus/azure-messaging-servicebus/migration-guide.md [SyncReceiveAndPrefetch]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/servicebus/azure-messaging-servicebus/docs/SyncReceiveAndPrefetch.md [Samples]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/servicebus/azure-messaging-servicebus/src/samples [SUPPORT]: https://github.com/Azure/azure-sdk-for-java/blob/main/SUPPORT.md -[Logging]: https://docs.microsoft.com/azure/developer/java/sdk/logging-overview -[java_8_sdk_javadocs]: https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html -[qpid_proton_j_apache]: https://qpid.apache.org/proton/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fservicebus%2Fazure-messaging-servicebus%2FTROUBLESHOOTING.png) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTrace.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTrace.java index 045b1abd2ee7..07ffffaeba54 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTrace.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/FluxTrace.java @@ -55,6 +55,11 @@ protected void hookOnSubscribe(Subscription subscription) { @Override protected void hookOnNext(ServiceBusMessageContext message) { + if (message == null || message.getMessage() == null) { + downstream.onNext(message); + return; + } + Context span = instrumentation.instrumentProcess("ServiceBus.process", message.getMessage(), Context.NONE); message.getMessage().setContext(span); AutoCloseable scope = tracer.makeSpanCurrent(span); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusProcessorClient.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusProcessorClient.java index b827c899229c..d0935a7f889d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusProcessorClient.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusProcessorClient.java @@ -374,7 +374,7 @@ public void onSubscribe(Subscription subscription) { @SuppressWarnings("try") @Override public void onNext(ServiceBusMessageContext serviceBusMessageContext) { - Context span = serviceBusMessageContext.getMessage().getContext(); + Context span = serviceBusMessageContext.getMessage() != null ? serviceBusMessageContext.getMessage().getContext() : Context.NONE; Exception exception = null; AutoCloseable scope = tracer.makeSpanCurrent(span); try { diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ContextAccessor.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ContextAccessor.java index 1f93428d72bf..9fdf04e7e9c8 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ContextAccessor.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ContextAccessor.java @@ -21,6 +21,7 @@ public interface SendMessageContextAccessor { } public static ServiceBusReceivedMessage setContext(ServiceBusReceivedMessage message, Context context) { + assert message != null; // message is never null on this path. return receiveAccessor.setContext(message, context); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxAutoCompleteTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxAutoCompleteTest.java index 99759b93c623..22ddce12c7bc 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxAutoCompleteTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxAutoCompleteTest.java @@ -3,10 +3,8 @@ package com.azure.messaging.servicebus; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.reactivestreams.Subscription; @@ -35,22 +33,13 @@ * Tests {@link FluxAutoComplete} for abandoning messages. */ class FluxAutoCompleteTest { + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private final Semaphore completionLock = new Semaphore(1); private final ArrayList onCompleteInvocations = new ArrayList<>(); private final ArrayList onAbandonInvocations = new ArrayList<>(); - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @AfterEach public void afterEach() { Mockito.framework().clearInlineMock(this); @@ -86,7 +75,8 @@ void completesOnSuccess() { StepVerifier.create(autoComplete) .then(() -> testPublisher.emit(context, context2)) .expectNext(context, context2) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verifyLists(onCompleteInvocations, context, context2); @@ -167,7 +157,7 @@ void doesNotContinueOnCancellation() { .then(() -> testPublisher.next(context, context2, context3, context4)) .thenConsumeWhile(m -> m != context2) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); // Assert verifyLists(onCompleteInvocations, context, context2); @@ -212,7 +202,7 @@ public Mono apply(ServiceBusMessageContext messageContext) { .then(() -> testPublisher.next(context, context2)) .expectNext(context, context2) .expectErrorSatisfies(e -> Assertions.assertEquals(testError, e)) - .verify(); + .verify(DEFAULT_TIMEOUT); // Assert verifyLists(onAbandonInvocations); @@ -241,7 +231,7 @@ void doesNotCompleteOnSettledMessage() { .expectNext(context, context2) .then(() -> testPublisher.complete()) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); // Assert verifyLists(onCompleteInvocations, context2); @@ -286,7 +276,7 @@ public Mono apply(ServiceBusMessageContext messageContext) { assertNotNull(cause); assertEquals(testError, cause); }) - .verify(); + .verify(DEFAULT_TIMEOUT); // Assert verifyLists(onCompleteInvocations, context); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxAutoLockRenewTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxAutoLockRenewTest.java index 4cb737ad9214..4e44b203539a 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxAutoLockRenewTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxAutoLockRenewTest.java @@ -13,10 +13,8 @@ import com.azure.messaging.servicebus.implementation.LockContainer; import com.azure.messaging.servicebus.implementation.instrumentation.ServiceBusTracer; import com.azure.messaging.servicebus.models.ServiceBusReceiveMode; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -68,6 +66,7 @@ public class FluxAutoLockRenewTest { private static final ClientLogger LOGGER = new ClientLogger(FluxAutoLockRenewTest.class); private static final ServiceBusTracer NOOP_TRACER = new ServiceBusTracer(null, "", ""); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private final ServiceBusReceivedMessage receivedMessage = new ServiceBusReceivedMessage(BinaryData.fromString("Some Data")); private final ServiceBusMessageContext message = new ServiceBusMessageContext(receivedMessage); private final TestPublisher messagesPublisher = TestPublisher.create(); @@ -78,16 +77,6 @@ public class FluxAutoLockRenewTest { private OffsetDateTime lockedUntil; private ReceiverOptions defaultReceiverOptions; - @BeforeAll - public static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - public static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach public void setup() { lockedUntil = OffsetDateTime.now().plusSeconds(2); @@ -127,7 +116,7 @@ public void canCancel() { }) .assertNext(actual -> Assertions.assertEquals(LOCK_TOKEN_STRING, actual.getMessage().getLockToken())) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); assertEquals(1, messageLockContainer.addOrUpdateInvocations.size(), "should have at least one invocation."); @@ -190,9 +179,7 @@ public void lockRenewedMultipleTimes() { // Act & Assert StepVerifier.create(renewOperator.take(1)) - .then(() -> { - messagesPublisher.next(message); - }) + .then(() -> messagesPublisher.next(message)) .assertNext(actual -> { OffsetDateTime previousLockedUntil = actual.getMessage().getLockedUntil(); try { @@ -204,7 +191,8 @@ public void lockRenewedMultipleTimes() { Assertions.assertEquals(LOCK_TOKEN_STRING, actual.getMessage().getLockToken()); Assertions.assertTrue(actual.getMessage().getLockedUntil().isAfter(previousLockedUntil)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertEquals(1, messageLockContainer.addOrUpdateInvocations.get(LOCK_TOKEN_STRING)); assertTrue(actualTokenRenewCalledTimes.get() >= renewedForAtLeast); @@ -235,9 +223,7 @@ public void lockRenewedMultipleTimeWithTracing() { // Act & Assert StepVerifier.create(renewOperator.take(1)) - .then(() -> { - messagesPublisher.next(message); - }) + .then(() -> messagesPublisher.next(message)) .assertNext(actual -> { OffsetDateTime previousLockedUntil = actual.getMessage().getLockedUntil(); try { @@ -249,7 +235,8 @@ public void lockRenewedMultipleTimeWithTracing() { Assertions.assertEquals(LOCK_TOKEN_STRING, actual.getMessage().getLockToken()); Assertions.assertTrue(actual.getMessage().getLockedUntil().isAfter(previousLockedUntil)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertEquals(1, messageLockContainer.addOrUpdateInvocations.get(LOCK_TOKEN_STRING)); assertTrue(actualTokenRenewCalledTimes.get() >= renewedForAtLeast); @@ -292,7 +279,8 @@ void renewFailsWithTracing() { fail(e); } }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(tracer, times(1)).extractContext(any()); @@ -315,7 +303,7 @@ void lockRenewedError() { .then(() -> messagesPublisher.next(message)) .assertNext(actual -> Assertions.assertEquals(LOCK_TOKEN_STRING, actual.getMessage().getLockToken())) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); assertTrue(errorTestContainer.addOrUpdateInvocations.containsKey(LOCK_TOKEN_STRING)); assertEquals(1, errorTestContainer.addOrUpdateInvocations.get(LOCK_TOKEN_STRING)); @@ -340,7 +328,7 @@ void messageWithError() { .then(() -> messagesPublisher.next(errorContext)) .assertNext(actual -> Assertions.assertEquals(expectedSessionId, actual.getSessionId())) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); assertFalse(errorTestContainer.addOrUpdateInvocations.containsKey(LOCK_TOKEN_STRING), "addOrUpdate should not be invoked because the context errored."); @@ -388,10 +376,9 @@ public void mapperReturnNullValue() { // Act & Assert StepVerifier.create(renewOperator.map(serviceBusReceivedMessage -> expectedMappedValue)) - .then(() -> { - messagesPublisher.next(message); - }) - .verifyError(NullPointerException.class); + .then(() -> messagesPublisher.next(message)) + .expectError(NullPointerException.class) + .verify(DEFAULT_TIMEOUT); } @Test @@ -417,18 +404,16 @@ void renewCanBeSubscribedMultipleTimes() { // Act & Assert StepVerifier.create(renewOperator.take(1)) - .then(() -> { - messagesPublisher.next(message); - }) - .assertNext(actual -> { - Assertions.assertEquals(LOCK_TOKEN_STRING, actual.getMessage().getLockToken()); - }) - .verifyComplete(); + .then(() -> messagesPublisher.next(message)) + .assertNext(actual -> Assertions.assertEquals(LOCK_TOKEN_STRING, actual.getMessage().getLockToken())) + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(renewOperator.take(1)) .then(() -> messagesPublisher.next(message)) .assertNext(actual -> Assertions.assertEquals(LOCK_TOKEN_STRING, actual.getMessage().getLockToken())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertEquals(2, messageLockContainer.addOrUpdateInvocations.get(LOCK_TOKEN_STRING)); } @@ -465,14 +450,12 @@ public void simpleFilterAndBackpressured() { StepVerifier.create(renewOperatorSource) .expectNextCount(0) .thenRequest(1) - .then(() -> { - messagesPublisher.next(message, message2, message3); - }) + .then(() -> messagesPublisher.next(message, message2, message3)) .assertNext(actual -> assertEquals(message2.getMessage().getEnqueuedSequenceNumber(), actual)) .thenRequest(1) .assertNext(actual -> assertEquals(message3.getMessage().getEnqueuedSequenceNumber(), actual)) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } /*** @@ -509,7 +492,7 @@ public void simpleMappingBackpressured() { .thenRequest(1) .assertNext(actual -> Assertions.assertEquals(expectedMappedValue, actual)) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } /*** @@ -545,7 +528,7 @@ public void simpleMappingAndFilter() { .then(() -> messagesPublisher.next(message, message2, message3)) .assertNext(actualEnqueuedSequenceNumber -> assertEquals(expectedEnqueuedSequenceNumber, actualEnqueuedSequenceNumber)) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -567,7 +550,7 @@ public void contextPropagationTest() { .then(() -> messagesPublisher.next(message)) .expectNext(message) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } /*** @@ -593,9 +576,7 @@ void autoCompleteDisabledLockRenewNotClosed() { // Act & Assert StepVerifier.create(renewOperator.take(1)) - .then(() -> { - messagesPublisher.next(message); - }) + .then(() -> messagesPublisher.next(message)) .assertNext(actual -> { OffsetDateTime previousLockedUntil = actual.getMessage().getLockedUntil(); try { @@ -607,7 +588,8 @@ void autoCompleteDisabledLockRenewNotClosed() { Assertions.assertEquals(LOCK_TOKEN_STRING, actual.getMessage().getLockToken()); Assertions.assertTrue(actual.getMessage().getLockedUntil().isAfter(previousLockedUntil)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); assertEquals(1, messageLockContainer.addOrUpdateInvocations.get(LOCK_TOKEN_STRING)); assertTrue(actualTokenRenewCalledTimes.get() >= renewedForAtLeast, diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxTraceTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxTraceTest.java new file mode 100644 index 000000000000..4a5822d949d8 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/FluxTraceTest.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.servicebus; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.tracing.SpanKind; +import com.azure.core.util.tracing.StartSpanOptions; +import com.azure.core.util.tracing.Tracer; +import com.azure.messaging.servicebus.implementation.instrumentation.ReceiverKind; +import com.azure.messaging.servicebus.implementation.instrumentation.ServiceBusReceiverInstrumentation; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; +import reactor.test.StepVerifier; +import reactor.test.publisher.TestPublisher; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class FluxTraceTest { + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); + private final ServiceBusReceivedMessage receivedMessage = new ServiceBusReceivedMessage(BinaryData.fromString("Some Data")); + private final ServiceBusMessageContext message = new ServiceBusMessageContext(receivedMessage); + private final TestPublisher messagesPublisher = TestPublisher.create(); + + @ParameterizedTest + @EnumSource(ReceiverKind.class) + public void testProcessSpans(ReceiverKind receiverKind) { + TestTracer tracer = new TestTracer(); + ServiceBusReceiverInstrumentation instrumentation = new ServiceBusReceiverInstrumentation(tracer, null, "fqdn", "entityPath", null, receiverKind); + FluxTrace fluxTrace = new FluxTrace(messagesPublisher.flux(), instrumentation); + + StepVerifier.create(fluxTrace) + .then(() -> messagesPublisher.next(message)) + .assertNext(m -> { + switch (receiverKind) { + case SYNC_RECEIVER: + assertEquals(0, tracer.getStartedSpans().size()); + break; + default: + assertEquals(1, tracer.getStartedSpans().size()); + assertEquals("ServiceBus.process", tracer.getStartedSpans().get(0)); + break; + } + }) + .thenCancel() + .verify(DEFAULT_TIMEOUT); + } + + @ParameterizedTest + @EnumSource(ReceiverKind.class) + public void nullMessage(ReceiverKind receiverKind) { + TestTracer tracer = new TestTracer(); + ServiceBusReceiverInstrumentation instrumentation = new ServiceBusReceiverInstrumentation(tracer, null, "fqdn", "entityPath", null, receiverKind); + FluxTrace fluxTrace = new FluxTrace(messagesPublisher.flux(), instrumentation); + + StepVerifier.create(fluxTrace) + .then(() -> messagesPublisher.next(new ServiceBusMessageContext("sessionId", new RuntimeException("foo")))) + .assertNext(m -> assertEquals(0, tracer.getStartedSpans().size())) + .thenCancel() + .verify(DEFAULT_TIMEOUT); + } + + private static class TestTracer implements Tracer { + private final List startedSpans = new ArrayList<>(); + @Override + public Context start(String methodName, StartSpanOptions options, Context context) { + startedSpans.add(methodName); + return context; + } + + @Override + public Context start(String methodName, Context context) { + return start(methodName, new StartSpanOptions(SpanKind.INTERNAL), context); + } + + @Override + public void end(String errorMessage, Throwable throwable, Context context) { + } + + @Override + public void setAttribute(String key, String value, Context context) { + } + + public List getStartedSpans() { + return startedSpans; + } + } +} diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java index 92a4ea669cde..09de7ee271de 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/IntegrationTestBase.java @@ -25,9 +25,7 @@ import com.azure.messaging.servicebus.implementation.DispositionStatus; import com.azure.messaging.servicebus.implementation.MessagingEntityType; import com.azure.messaging.servicebus.models.ServiceBusReceiveMode; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.params.provider.Arguments; @@ -35,7 +33,6 @@ import reactor.core.publisher.Mono; import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; -import reactor.test.StepVerifier; import java.io.Closeable; import java.lang.reflect.Method; @@ -92,28 +89,16 @@ public void setupTest(TestInfo testInfo) { assumeTrue(getTestMode() == TestMode.RECORD); - StepVerifier.setDefaultTimeout(TIMEOUT); toClose = new ArrayList<>(); optionsWithTracing = new ClientOptions().setTracingOptions(new LoggingTracerProvider.LoggingTracingOptions()); beforeTest(); } - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - // These are overridden because we don't use the Interceptor Manager. @Override @AfterEach public void teardownTest(TestInfo testInfo) { logger.info("========= TEARDOWN [{}] =========", testName); - StepVerifier.resetDefaultTimeout(); afterTest(); logger.info("Disposing of subscriptions, consumers and clients."); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxyReceiveTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxyReceiveTest.java index 482cf0c30c64..f35d3e10ded5 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxyReceiveTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxyReceiveTest.java @@ -41,8 +41,6 @@ public ProxyReceiveTest() { @BeforeEach public void setup() throws IOException { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - proxyServer = new SimpleProxy(PROXY_PORT); proxyServer.start(error -> logger.error("Exception occurred in proxy.", error)); @@ -64,8 +62,6 @@ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { @AfterEach() public void cleanup() throws Exception { - StepVerifier.resetDefaultTimeout(); - if (proxyServer != null) { proxyServer.stop(); } @@ -115,7 +111,8 @@ public void receiveMessage() { return sender.sendMessages(batch); })) - .verifyComplete(); + .expectComplete() + .verify(Duration.ofSeconds(30)); StepVerifier.create(receiver.receiveMessages().take(NUMBER_OF_EVENTS)) .expectNextCount(NUMBER_OF_EVENTS) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySelectorTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySelectorTest.java index 76f389d217d3..7047f8138369 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySelectorTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySelectorTest.java @@ -80,7 +80,7 @@ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { // This is a transient error from ExceptionUtil.java: line 67. System.out.println("Error: " + error); }) - .verify(); + .verify(TIMEOUT); final boolean awaited = countDownLatch.await(2, TimeUnit.SECONDS); Assertions.assertTrue(awaited); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySendTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySendTest.java index 4adb2842739a..78833565375c 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySendTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ProxySendTest.java @@ -38,8 +38,6 @@ public ProxySendTest() { @BeforeEach public void initialize() throws Exception { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - proxyServer = new SimpleProxy(PROXY_PORT); proxyServer.start(error -> logger.error("Exception occurred in proxy.", error)); @@ -59,8 +57,6 @@ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { @AfterEach public void cleanup() throws Exception { - StepVerifier.resetDefaultTimeout(); - ProxySelector.setDefault(defaultProxySelector); if (proxyServer != null) { @@ -99,6 +95,7 @@ public void sendEvents() { return sender.sendMessages(batch); })) - .verifyComplete(); + .expectComplete() + .verify(Duration.ofSeconds(30)); } } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumerTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumerTest.java index 9bd6eab57ee9..f4767f8868df 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumerTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusAsyncConsumerTest.java @@ -7,16 +7,13 @@ import com.azure.core.amqp.AmqpRetryPolicy; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.servicebus.implementation.LockContainer; import com.azure.messaging.servicebus.implementation.ServiceBusAmqpConnection; import com.azure.messaging.servicebus.implementation.ServiceBusReceiveLink; import com.azure.messaging.servicebus.implementation.ServiceBusReceiveLinkProcessor; import com.azure.messaging.servicebus.models.ServiceBusReceiveMode; import org.apache.qpid.proton.amqp.transport.DeliveryState; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -31,7 +28,6 @@ import java.time.Duration; import java.time.OffsetDateTime; import java.util.UUID; -import java.util.function.Function; import static com.azure.messaging.servicebus.ReceiverOptions.createNamedSessionOptions; import static org.mockito.ArgumentMatchers.any; @@ -48,6 +44,7 @@ class ServiceBusAsyncConsumerTest { private static final String LINK_NAME = "some-link"; private static final ClientLogger LOGGER = new ClientLogger(ServiceBusAsyncConsumer.class); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(20); private final TestPublisher linkPublisher = TestPublisher.create(); private final Flux linkFlux = linkPublisher.flux(); @@ -57,7 +54,6 @@ class ServiceBusAsyncConsumerTest { private final Flux endpointStateFlux = endpointPublisher.flux(); private ServiceBusReceiveLinkProcessor linkProcessor; - private Function> onRenewLock; @Mock private ServiceBusAmqpConnection connection; @@ -67,18 +63,6 @@ class ServiceBusAsyncConsumerTest { private AmqpRetryPolicy retryPolicy; @Mock private MessageSerializer serializer; - @Mock - LockContainer messageLockContainer; - - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(20)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } @BeforeEach void setup(TestInfo testInfo) { @@ -94,7 +78,6 @@ void setup(TestInfo testInfo) { when(connection.getEndpointStates()).thenReturn(Flux.create(sink -> sink.next(AmqpEndpointState.ACTIVE))); when(link.updateDisposition(anyString(), any(DeliveryState.class))).thenReturn(Mono.empty()); - onRenewLock = (lockToken) -> Mono.just(OffsetDateTime.now().plusSeconds(1)); } @AfterEach @@ -150,7 +133,7 @@ void receiveNoAutoComplete() { .then(() -> messagePublisher.next(message2)) .expectNext(receivedMessage2) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); verify(link, never()).updateDisposition(anyString(), any(DeliveryState.class)); } @@ -190,7 +173,8 @@ void canDispose() { linkPublisher.complete(); endpointPublisher.complete(); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(link, never()).updateDisposition(anyString(), any(DeliveryState.class)); } @@ -234,7 +218,8 @@ void onError() { linkPublisher.error(new Throwable("fake error")); endpointPublisher.complete(); }) - .verifyError(); + .expectError() + .verify(DEFAULT_TIMEOUT); verify(link, never()).updateDisposition(anyString(), any(DeliveryState.class)); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusClientBuilderTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusClientBuilderTest.java index 2a42735cce75..57e91cd71f69 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusClientBuilderTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusClientBuilderTest.java @@ -285,8 +285,9 @@ public void testBatchSendEventByAzureNameKeyCredential() { senderAsyncClient.createMessageBatch().flatMap(batch -> { assertTrue(batch.tryAddMessage(testData)); return senderAsyncClient.sendMessages(batch); - }) - ).verifyComplete(); + })) + .expectComplete() + .verify(TIMEOUT); } @Test @@ -309,8 +310,9 @@ public void testBatchSendEventByAzureSasCredential() { senderAsyncClient.createMessageBatch().flatMap(batch -> { assertTrue(batch.tryAddMessage(testData)); return senderAsyncClient.sendMessages(batch); - }) - ).verifyComplete(); + })) + .expectComplete() + .verify(TIMEOUT); } @Test diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMixClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMixClientIntegrationTest.java index 2b3e3b4d6164..0b46e7fb5473 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMixClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusMixClientIntegrationTest.java @@ -144,7 +144,9 @@ void crossEntityQueueTransaction(boolean isSessionEnabled) throws InterruptedExc } // Send messages - StepVerifier.create(senderAsyncA.sendMessages(messages)).verifyComplete(); + StepVerifier.create(senderAsyncA.sendMessages(messages)) + .expectComplete() + .verify(TIMEOUT); // Create an instance of the processor through the ServiceBusClientBuilder // Act @@ -171,7 +173,9 @@ void crossEntityQueueTransaction(boolean isSessionEnabled) throws InterruptedExc .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); - }).verifyComplete(); + }) + .expectComplete() + .verify(TIMEOUT); } } @@ -258,7 +262,9 @@ void crossEntitySubscriptionTransaction(boolean isSessionEnabled) throws Interru } // Send messages - StepVerifier.create(senderAsyncA.sendMessages(messages)).verifyComplete(); + StepVerifier.create(senderAsyncA.sendMessages(messages)) + .expectComplete() + .verify(TIMEOUT); // Create an instance of the processor through the ServiceBusClientBuilder // Act @@ -285,7 +291,9 @@ void crossEntitySubscriptionTransaction(boolean isSessionEnabled) throws Interru .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); - }).verifyComplete(); + }) + .expectComplete() + .verify(TIMEOUT); } } @@ -322,7 +330,9 @@ void crossEntityQueueTransactionWithReceiverSenderTest(boolean isSessionEnabled) final ServiceBusSenderClient senderSyncB = toClose(builder.sender().queueName(queueB).buildClient()); // Send messages - StepVerifier.create(senderAsyncA.sendMessages(messages)).verifyComplete(); + StepVerifier.create(senderAsyncA.sendMessages(messages)) + .expectComplete() + .verify(TIMEOUT); final ServiceBusReceiverAsyncClient receiverA; @@ -369,7 +379,9 @@ void crossEntityQueueTransactionWithReceiverSenderTest(boolean isSessionEnabled) .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); - }).verifyComplete(); + }) + .expectComplete() + .verify(TIMEOUT); } } @@ -407,7 +419,9 @@ void crossEntitySubscriptionTransactionWithReceiverSenderTest(boolean isSessionE // Send messages - StepVerifier.create(senderAsyncA.sendMessages(messages)).verifyComplete(); + StepVerifier.create(senderAsyncA.sendMessages(messages)) + .expectComplete() + .verify(TIMEOUT); final ServiceBusReceiverAsyncClient receiverA; @@ -450,7 +464,9 @@ void crossEntitySubscriptionTransactionWithReceiverSenderTest(boolean isSessionE .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); - }).verifyComplete(); + }) + .expectComplete() + .verify(TIMEOUT); } } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusProcessorClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusProcessorClientIntegrationTest.java index 4248933ce027..86b728fbf8b8 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusProcessorClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusProcessorClientIntegrationTest.java @@ -6,6 +6,7 @@ import com.azure.core.amqp.AmqpRetryOptions; import com.azure.core.amqp.AmqpTransportType; import com.azure.core.amqp.ProxyOptions; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.servicebus.implementation.MessagingEntityType; import org.junit.jupiter.params.ParameterizedTest; @@ -40,7 +41,7 @@ public class ServiceBusProcessorClientIntegrationTest extends IntegrationTestBas @Override protected void beforeTest() { - sessionId = UUID.randomUUID().toString(); + sessionId = CoreUtils.randomUuid().toString(); } @Override diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusProcessorTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusProcessorTest.java index 2798c4f250ff..84dafff31648 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusProcessorTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusProcessorTest.java @@ -39,6 +39,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; @@ -439,6 +440,37 @@ public void testProcessorWithTracingEnabled() throws InterruptedException { verify(tracer, atLeast(numberOfTimes - 1)).end(isNull(), isNull(), any()); } + @Test + @SuppressWarnings("unchecked") + public void testProcessorWithTracingEnabledAndNullMessage() throws InterruptedException { + final Tracer tracer = mock(Tracer.class); + final int numberOfTimes = 1; + + when(tracer.isEnabled()).thenReturn(true); + when(tracer.extractContext(any())).thenReturn(Context.NONE); + + when(tracer.start(eq("ServiceBus.process"), any(StartSpanOptions.class), any())).thenReturn(new Context(PARENT_TRACE_CONTEXT_KEY, "span")); + + Flux messageFlux = Flux.just(new ServiceBusMessageContext("sessionId", new RuntimeException("foo"))); + ServiceBusClientBuilder.ServiceBusReceiverClientBuilder receiverBuilder = getBuilder(messageFlux, tracer); + + CountDownLatch countDownLatch = new CountDownLatch(numberOfTimes); + ServiceBusProcessorClient serviceBusProcessorClient = new ServiceBusProcessorClient(receiverBuilder, ENTITY_NAME, + null, null, + messageContext -> fail("Should not have received a message"), + error -> { + assertEquals("foo", error.getException().getMessage()); + countDownLatch.countDown(); + }, + new ServiceBusProcessorClientOptions().setMaxConcurrentCalls(1)); + + serviceBusProcessorClient.start(); + assertTrue(countDownLatch.await(20, TimeUnit.SECONDS)); + serviceBusProcessorClient.close(); + + verify(tracer, never()).start(eq("ServiceBus.process"), any(StartSpanOptions.class), any(Context.class)); + } + @Test @SuppressWarnings("unchecked") public void testProcessorWithTracingDisabled() throws InterruptedException { diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientIntegrationTest.java index 978c09092475..ca1afaf6ff10 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientIntegrationTest.java @@ -11,6 +11,7 @@ import com.azure.core.amqp.models.AmqpMessageHeader; import com.azure.core.amqp.models.AmqpMessageId; import com.azure.core.amqp.models.AmqpMessageProperties; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.servicebus.implementation.DispositionStatus; import com.azure.messaging.servicebus.implementation.MessagingEntityType; @@ -110,11 +111,13 @@ void createMultipleTransactionTest() { // Assert & Act StepVerifier.create(receiver.createTransaction()) .assertNext(Assertions::assertNotNull) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(receiver.createTransaction()) .assertNext(Assertions::assertNotNull) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -140,7 +143,8 @@ void createTransactionAndRollbackMessagesTest(MessagingEntityType entityType) { transaction.set(txn); assertNotNull(transaction); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(receiver.receiveMessages() .flatMap(receivedMessage -> { @@ -149,10 +153,13 @@ void createTransactionAndRollbackMessagesTest(MessagingEntityType entityType) { .doOnSuccess(m -> logMessage(receivedMessage, receiver.getEntityPath(), "completed message")) .thenReturn(receivedMessage); }).take(1)) - .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)).verifyComplete(); + .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)) + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(receiver.rollbackTransaction(transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -180,7 +187,8 @@ void transactionSendReceiveAndCommit(DispositionStatus dispositionStatus) { transaction.set(txn); assertNotNull(transaction); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); assertNotNull(transaction.get()); // Assert & Act @@ -222,8 +230,8 @@ void transactionSendReceiveAndCommit(DispositionStatus dispositionStatus) { assertNotNull(message); StepVerifier.create(receiver.commitTransaction(transaction.get())) - .verifyComplete(); - + .expectComplete() + .verify(TIMEOUT); } /** @@ -255,7 +263,8 @@ void transactionReceiveCompleteCommitMixClient(MessagingEntityType entityType) { transaction.set(txn); assertNotNull(transaction); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); assertNotNull(transaction.get()); // Assert & Act @@ -263,10 +272,12 @@ void transactionReceiveCompleteCommitMixClient(MessagingEntityType entityType) { assertNotNull(receivedMessage); logMessage(receivedMessage, receiver.getEntityPath(), "received message"); StepVerifier.create(receiver.complete(receivedMessage, new CompleteOptions().setTransactionContext(transaction.get()))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(sender.commitTransaction(transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -307,7 +318,7 @@ void receiveTwoMessagesAutoComplete(MessagingEntityType entityType, boolean isSe .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)) .thenAwait(shortWait) // Give time for autoComplete to finish .thenCancel() - .verify(); + .verify(TIMEOUT); } /** @@ -323,10 +334,12 @@ void receiveMessageAutoComplete(MessagingEntityType entityType, boolean isSessio this.sender = toClose(getSenderBuilder(useCredentials, entityType, entityIndex, isSessionEnabled, shareConnection) .buildAsyncClient()); - final String messageId = UUID.randomUUID().toString(); + final String messageId = CoreUtils.randomUuid().toString(); final ServiceBusMessage message = getMessage(messageId, isSessionEnabled); - StepVerifier.create(sendMessage(message)).verifyComplete(); + StepVerifier.create(sendMessage(message)) + .expectComplete() + .verify(TIMEOUT); // Now create receiver if (isSessionEnabled) { @@ -348,7 +361,7 @@ void receiveMessageAutoComplete(MessagingEntityType entityType, boolean isSessio }) .expectNoEvent(Duration.ofSeconds(30)) .thenCancel() - .verify(); + .verify(TIMEOUT); } /** @@ -376,7 +389,8 @@ void peekMessage(MessagingEntityType entityType, boolean isSessionEnabled) { StepVerifier.create(peek .doOnNext(m -> logMessage(m, receiver.getEntityPath(), "peeked and filtered message"))) .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -393,7 +407,8 @@ void peekMessageEmptyEntity(MessagingEntityType entityType, boolean isSessionEna // Assert & Act StepVerifier.create(receiver.peekMessage(fromSequenceNumber) .doOnNext(m -> logMessage(m, receiver.getEntityPath(), "peeked message"))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -419,7 +434,9 @@ void sendScheduledMessageAndReceive(MessagingEntityType entityType, boolean isSe .filter(m -> messageId.equals(m.getMessageId())) .doOnNext(m -> logMessage(m, receiver.getEntityPath(), "received message")) .flatMap(receivedMessage -> receiver.complete(receivedMessage).thenReturn(receivedMessage)).next())) - .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)).verifyComplete(); + .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)) + .expectComplete() + .verify(TIMEOUT); } /** @@ -454,7 +471,7 @@ void cancelScheduledMessage(MessagingEntityType entityType, boolean isSessionEna .take(1)) .thenAwait(Duration.ofSeconds(5)) .thenCancel() - .verify(); + .verify(TIMEOUT); } /** @@ -497,7 +514,8 @@ void peekFromSequenceNumberMessage(MessagingEntityType entityType, boolean isSes assertEquals(sequenceNumber, m.getSequenceNumber()); assertMessageEquals(m, messageId, isSessionEnabled); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } finally { // Cleanup @@ -505,7 +523,8 @@ void peekFromSequenceNumberMessage(MessagingEntityType entityType, boolean isSes .doOnNext(m -> logMessage(m, receiver.getEntityPath(), "received message")) .flatMap(receivedMessage -> receiver.complete(receivedMessage).thenReturn(receivedMessage)).take(1)) .expectNextCount(1) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } } @@ -529,7 +548,8 @@ void peekMessages(MessagingEntityType entityType, boolean isSessionEnabled) thro StepVerifier.create(sender.sendMessages(messages) .doOnSuccess(aVoid -> logMessages(messages, sender.getEntityPath(), "sent"))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); setReceiver(entityType, USE_CASE_PEEK_BATCH_MESSAGES, isSessionEnabled); @@ -642,7 +662,8 @@ void peekMessagesFromSequenceEmptyEntity(MessagingEntityType entityType, boolean // Assert & Act StepVerifier.create(receiver.peekMessages(maxMessages, fromSequenceNumber)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -668,7 +689,7 @@ void deadLetterMessage(MessagingEntityType entityType, boolean isSessionEnabled) .flatMap(receivedMessage -> receiver.deadLetter(receivedMessage).thenReturn(receivedMessage)).take(1)) .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)) .thenCancel() - .verify(); + .verify(TIMEOUT); } @@ -733,13 +754,13 @@ void receiveMessageAmqpTypes(MessagingEntityType entityType, boolean isSessionEn }) .thenAwait(shortWait) // Give time for autoComplete to finish .thenCancel() - .verify(); + .verify(TIMEOUT); if (!isSessionEnabled) { StepVerifier.create(receiver.receiveMessages()) .thenAwait(shortWait) .thenCancel() - .verify(); + .verify(TIMEOUT); } } @@ -761,7 +782,9 @@ void receiveAndComplete(MessagingEntityType entityType, boolean isSessionEnabled .filter(receivedMessage -> messageId.equals(receivedMessage.getMessageId())) .doOnNext(receivedMessage -> logMessage(receivedMessage, receiver.getEntityPath(), "received and filtered")) .flatMap(receivedMessage -> receiver.complete(receivedMessage).thenReturn(receivedMessage)).take(1)) - .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)).verifyComplete(); + .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)) + .expectComplete() + .verify(TIMEOUT); } /** @@ -795,7 +818,8 @@ void receiveAndRenewLock(MessagingEntityType entityType) { .assertNext(lockedUntil -> assertTrue(lockedUntil.isAfter(initialLock), String.format("Updated lock is not after the initial Lock. updated: [%s]. initial:[%s]", lockedUntil, initialLock))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } finally { LOGGER.info("Completing message. Seq: {}.", receivedMessage.getSequenceNumber()); @@ -830,7 +854,8 @@ void receiveMessagesNoMessageSettlement(MessagingEntityType entityType, boolean // Assert & Act StepVerifier.create(receiver.receiveMessages().take(totalMessages)) .expectNextCount(totalMessages) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -864,7 +889,8 @@ void receiveMessagesLargeProcessingTime(MessagingEntityType entityType, boolean .map(receivedMessage -> Mono.delay(lockRenewTimeout.plusSeconds(2)) .then(receiver.complete(receivedMessage)).thenReturn(receivedMessage).block()).take(totalMessages)) .expectNextCount(totalMessages) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -903,9 +929,9 @@ void autoRenewLockOnReceiveMessage(MessagingEntityType entityType, boolean isSes } return receiver.complete(received).thenReturn(received); })) - .assertNext(received -> assertTrue(lockRenewCount.get() > 0)) - .thenCancel() - .verify(); + .assertNext(received -> assertTrue(lockRenewCount.get() > 0)) + .thenCancel() + .verify(TIMEOUT); } @MethodSource("com.azure.messaging.servicebus.IntegrationTestBase#messagingEntityWithSessions") @@ -923,7 +949,8 @@ void receiveAndAbandon(MessagingEntityType entityType, boolean isSessionEnabled) StepVerifier.create(receiver.receiveMessages() .flatMap(receivedMessage -> receiver.abandon(receivedMessage).thenReturn(receivedMessage)).take(1)) .assertNext(receivedMessage -> assertMessageEquals(receivedMessage, messageId, isSessionEnabled)) - .expectComplete(); + .expectComplete() + .verify(TIMEOUT); } @MethodSource("com.azure.messaging.servicebus.IntegrationTestBase#messagingEntityWithSessions") @@ -946,7 +973,9 @@ void receiveAndDefer(MessagingEntityType entityType, boolean isSessionEnabled) { .assertNext(m -> { received.set(m); assertMessageEquals(m, messageId, isSessionEnabled); - }).verifyComplete(); + }) + .expectComplete() + .verify(TIMEOUT); // TODO(Hemant): Identify if this is valid scenario (https://github.com/Azure/azure-sdk-for-java/issues/19673) /*receiver.receiveDeferredMessage(received.get().getSequenceNumber()) @@ -967,7 +996,9 @@ void receiveDeferredMessageBySequenceNumber(MessagingEntityType entityType, Disp final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, false); - StepVerifier.create(sendMessage(message)).verifyComplete(); + StepVerifier.create(sendMessage(message)) + .expectComplete() + .verify(TIMEOUT); StepVerifier.create( receiver.receiveMessages() @@ -1053,7 +1084,7 @@ void sendReceiveMessageWithVariousPropertyTypes(MessagingEntityType entityType) } }) .thenCancel() - .verify(); + .verify(TIMEOUT); } @MethodSource("com.azure.messaging.servicebus.IntegrationTestBase#messagingEntityProvider") @@ -1085,7 +1116,8 @@ void setAndGetSessionState(MessagingEntityType entityType) { LOGGER.info("State received: {}", new String(state, UTF_8)); assertArrayEquals(sessionState, state); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -1194,7 +1226,9 @@ private void testRenewLock(MessagingEntityType entityType, Duration lockRenewalD final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, false); - StepVerifier.create(sendMessage(message)).verifyComplete(); + StepVerifier.create(sendMessage(message)) + .expectComplete() + .verify(TIMEOUT); AtomicReference lockedUntil = new AtomicReference<>(null); @@ -1239,7 +1273,9 @@ void receiveTwice() { .expectComplete() .verify(OPERATION_TIMEOUT); - StepVerifier.create(sendMessage(message)).verifyComplete(); + StepVerifier.create(sendMessage(message)) + .expectComplete() + .verify(TIMEOUT); // cannot subscribe to the same receiver - there was a subscription that is disposed now StepVerifier.create(receiver.receiveMessages().take(1)) @@ -1253,7 +1289,9 @@ void receiveActiveSubscription() { final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, false); - StepVerifier.create(sendMessage(message)).verifyComplete(); + StepVerifier.create(sendMessage(message)) + .expectComplete() + .verify(TIMEOUT); toClose(receiver.receiveMessages().subscribe(m -> { })); // cannot subscribe to the same receiver - there is active subscription diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java index dcbcd295b820..d23575b0ae28 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceiverAsyncClientTest.java @@ -48,10 +48,8 @@ import org.apache.qpid.proton.amqp.transport.DeliveryState.DeliveryStateType; import org.apache.qpid.proton.engine.SslDomain; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -128,6 +126,7 @@ class ServiceBusReceiverAsyncClientTest { private static final String CLIENT_IDENTIFIER = "my-client-identifier"; private static final ClientLogger LOGGER = new ClientLogger(ServiceBusReceiverAsyncClientTest.class); private static final ServiceBusTracer NOOP_TRACER = new ServiceBusTracer(null, NAMESPACE, ENTITY_PATH); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(100); private final String messageTrackingUUID = UUID.randomUUID().toString(); private final ReplayProcessor endpointProcessor = ReplayProcessor.cacheLast(); private final FluxSink endpointSink = endpointProcessor.sink(FluxSink.OverflowStrategy.BUFFER); @@ -161,16 +160,6 @@ class ServiceBusReceiverAsyncClientTest { @Mock private Runnable onClientClose; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(100)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup(TestInfo testInfo) { LOGGER.info("[{}] Setting up.", testInfo.getDisplayName()); @@ -254,11 +243,13 @@ void peekTwoMessages() { // Act & Assert StepVerifier.create(receiver.peekMessage()) .expectNext(receivedMessage) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(receiver.peekMessage()) .expectNext(receivedMessage2) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(managementNode, times(2)).peek(captor.capture(), isNull(), isNull()); final List allValues = captor.getAllValues(); @@ -281,7 +272,8 @@ void peekEmptyEntity() { // Act & Assert StepVerifier.create(receiver.peekMessage()) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -298,7 +290,8 @@ void peekWithSequenceOneMessage() { // Act & Assert StepVerifier.create(receiver.peekMessage(fromSequenceNumber)) .expectNext(receivedMessage) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -323,7 +316,8 @@ void receivesNumberOfEvents() { StepVerifier.create(receiver.receiveMessages().take(numberOfEvents)) .then(() -> messages.forEach(m -> messageSink.next(m))) .expectNextCount(numberOfEvents) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Add credit for each time 'onNext' is called, plus once when publisher is subscribed. verify(amqpReceiveLink, atMost(numberOfEvents + 1)).addCredits(PREFETCH); @@ -367,7 +361,8 @@ void receivesMessageLockRenewSessionOnly() { StepVerifier.create(mySessionReceiver.receiveMessages().take(numberOfEvents)) .then(() -> messages.forEach(messageSink::next)) .expectNextCount(numberOfEvents) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Message onNext should not trigger `FluxAutoLockRenew` for each message because this is session entity. Assertions.assertEquals(0, mockedAutoLockRenew.constructed().size()); @@ -417,7 +412,7 @@ void settleWithNullTransactionId(DispositionStatus dispositionStatus) { StepVerifier.create(operation) .expectError(NullPointerException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); verify(managementNode, never()).updateDisposition(any(), eq(dispositionStatus), isNull(), isNull(), isNull(), isNull(), isNull(), isNull()); @@ -428,7 +423,7 @@ void settleWithNullTransactionId(DispositionStatus dispositionStatus) { */ @Test void completeNullMessage() { - StepVerifier.create(receiver.complete(null)).expectError(NullPointerException.class).verify(); + StepVerifier.create(receiver.complete(null)).expectError(NullPointerException.class).verify(DEFAULT_TIMEOUT); } /** @@ -448,7 +443,7 @@ void completeInReceiveAndDeleteMode() { try { StepVerifier.create(client.complete(receivedMessage)) .expectError(UnsupportedOperationException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } finally { client.close(); } @@ -466,7 +461,7 @@ void throwsExceptionAboutSettlingPeekedMessagesWithNullLockToken() { try { StepVerifier.create(client.complete(receivedMessage)) .expectError(UnsupportedOperationException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } finally { client.close(); } @@ -487,7 +482,8 @@ void peekMessages() { // Act & Assert StepVerifier.create(receiver.peekMessages(numberOfEvents)) .expectNextCount(numberOfEvents) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -503,7 +499,8 @@ void peekMessagesEmptyEntity() { // Act & Assert StepVerifier.create(receiver.peekMessages(numberOfEvents)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -521,7 +518,8 @@ void peekBatchWithSequenceNumberMessages() { // Act & Assert StepVerifier.create(receiver.peekMessages(numberOfEvents, fromSequenceNumber)) .expectNext(receivedMessage, receivedMessage2) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -556,7 +554,8 @@ void deadLetterWithDescription() { .flatMap(receivedMessage -> receiver.deadLetter(receivedMessage, deadLetterOptions))) .then(() -> messageSink.next(message)) .expectNext() - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(amqpReceiveLink).updateDisposition(eq(lockToken1), isA(Rejected.class)); } @@ -582,11 +581,12 @@ void errorSourceOnRenewMessageLock() { // Act & Assert StepVerifier.create(receiver2.renewMessageLock(receivedMessage, maxDuration)) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { Assertions.assertTrue(throwable instanceof ServiceBusException); final ServiceBusErrorSource actual = ((ServiceBusException) throwable).getErrorSource(); Assertions.assertEquals(ServiceBusErrorSource.RENEW_LOCK, actual); - }); + }) + .verify(DEFAULT_TIMEOUT); verify(managementNode, times(1)).renewMessageLock(lockToken, null); } @@ -605,11 +605,12 @@ void errorSourceOnSessionLock() { // Act & Assert StepVerifier.create(sessionReceiver2.renewSessionLock()) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { Assertions.assertTrue(throwable instanceof ServiceBusException); final ServiceBusErrorSource actual = ((ServiceBusException) throwable).getErrorSource(); Assertions.assertEquals(ServiceBusErrorSource.RENEW_LOCK, actual); - }); + }) + .verify(DEFAULT_TIMEOUT); } /** @@ -651,11 +652,12 @@ void errorSourceNoneOnSettlement(DispositionStatus dispositionStatus, DeliverySt ) .then(() -> messageSink.next(message)) .expectNext() - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { Assertions.assertTrue(throwable instanceof ServiceBusException); final ServiceBusErrorSource actual = ((ServiceBusException) throwable).getErrorSource(); Assertions.assertEquals(errorSource, actual); - }); + }) + .verify(DEFAULT_TIMEOUT); verify(amqpReceiveLink).updateDisposition(eq(lockToken1), any(DeliveryState.class)); } @@ -687,7 +689,7 @@ void errorSourceAutoCompleteMessage() { StepVerifier.create(receiver2.receiveMessages().take(numberOfEvents)) .then(() -> messages.forEach(m -> messageSink.next(m))) .expectNextCount(messagesToReceive) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { Assertions.assertTrue(throwable instanceof ServiceBusException); ServiceBusException serviceBusException = (ServiceBusException) throwable; @@ -695,7 +697,8 @@ void errorSourceAutoCompleteMessage() { Assertions.assertEquals(ServiceBusErrorSource.COMPLETE, actual); Assertions.assertEquals(ServiceBusFailureReason.MESSAGE_LOCK_LOST, serviceBusException.getReason()); - }); + }) + .verify(DEFAULT_TIMEOUT); } finally { receiver2.close(); } @@ -729,11 +732,12 @@ void errorSourceOnReceiveMessage() { // Act & Assert StepVerifier.create(receiver2.receiveMessages().take(1)) - .verifyErrorSatisfies(throwable -> { + .expectErrorSatisfies(throwable -> { Assertions.assertTrue(throwable instanceof ServiceBusException); final ServiceBusErrorSource actual = ((ServiceBusException) throwable).getErrorSource(); Assertions.assertEquals(ServiceBusErrorSource.RECEIVE, actual); - }); + }) + .verify(DEFAULT_TIMEOUT); verify(amqpReceiveLink, never()).updateDisposition(eq(lockToken), any(DeliveryState.class)); } @@ -789,7 +793,8 @@ void settleMessageOnManagement(DispositionStatus dispositionStatus) { // the lock map. StepVerifier.create(receiver.receiveDeferredMessages(Arrays.asList(sequenceNumber, sequenceNumber2))) .expectNext(receivedMessage, receivedMessage2) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Act and Assert final Mono operation; @@ -814,7 +819,8 @@ void settleMessageOnManagement(DispositionStatus dispositionStatus) { } StepVerifier.create(operation) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(managementNode).updateDisposition(lockToken1, dispositionStatus, null, null, null, null, null, null); verify(managementNode, never()).updateDisposition(lockToken2, dispositionStatus, null, null, null, null, null, null); @@ -834,7 +840,8 @@ void receiveDeferredWithSequenceOneMessage() { // Act & Assert StepVerifier.create(receiver.receiveDeferredMessage(fromSequenceNumber)) .expectNext(receivedMessage) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -853,7 +860,8 @@ void receiveDeferredBatchFromSequenceNumber() { StepVerifier.create(receiver.receiveDeferredMessages(Arrays.asList(fromSequenceNumber1, fromSequenceNumber2))) .expectNext(receivedMessage) .expectNext(receivedMessage2) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -971,7 +979,8 @@ void canPerformMultipleReceive() { StepVerifier.create(receiver.receiveMessages().take(numberOfEvents)) .then(() -> messages.forEach(m -> messageSink.next(m))) .expectNextCount(numberOfEvents) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // TODO: Yijun and Srikanta are thinking of using two links for two subscribers. // We may not want to support multiple subscribers by using publish and autoConnect. @@ -994,7 +1003,7 @@ void canPerformMultipleReceive() { void cannotPerformGetSessionState() { StepVerifier.create(receiver.getSessionState()) .expectError(IllegalStateException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -1009,7 +1018,7 @@ void cannotPerformSetSessionState() { // Act & Assert StepVerifier.create(receiver.setSessionState(sessionState)) .expectError(IllegalStateException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -1020,7 +1029,7 @@ void cannotPerformRenewSessionLock() { // Act & Assert StepVerifier.create(receiver.renewSessionLock()) .expectError(IllegalStateException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -1043,7 +1052,7 @@ void getSessionState() { StepVerifier.create(mySessionReceiver.getSessionState()) .expectNext(bytes) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -1059,7 +1068,7 @@ void setSessionState() { // Act & Assert StepVerifier.create(sessionReceiver.setSessionState(bytes)) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -1086,7 +1095,7 @@ void renewSessionLock() { StepVerifier.create(sessionReceiver.renewSessionLock()) .expectNext(expiry) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -1101,7 +1110,7 @@ void cannotRenewMessageLockInSession() { // Act & Assert StepVerifier.create(sessionReceiver.renewMessageLock(receivedMessage)) .expectError(IllegalStateException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -1151,7 +1160,7 @@ void autoRenewMessageLockErrorNull() { // Act & Assert StepVerifier.create(receiver.renewMessageLock(receivedMessage, maxDuration)) .expectError(NullPointerException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); verify(managementNode, never()).renewMessageLock(anyString(), isNull()); } @@ -1173,7 +1182,7 @@ void autoRenewMessageLockErrorEmptyString() { // Act & Assert StepVerifier.create(receiver.renewMessageLock(receivedMessage, maxDuration)) .expectError(IllegalArgumentException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); verify(managementNode, never()).renewMessageLock(anyString(), isNull()); } @@ -1212,7 +1221,7 @@ void autoRenewSessionLock() { void cannotRenewSessionLockForNonSessionReceiver() { StepVerifier.create(receiver.renewSessionLock()) .expectError(IllegalStateException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -1237,7 +1246,8 @@ void autoCompleteMessage() { StepVerifier.create(receiver2.receiveMessages().take(numberOfEvents)) .then(() -> messages.forEach(m -> messageSink.next(m))) .expectNextCount(numberOfEvents) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } finally { receiver2.close(); } @@ -1281,7 +1291,8 @@ void autoCompleteMessageSessionReceiver() { StepVerifier.create(sessionReceiver2.receiveMessages().take(numberOfEvents)) .then(() -> messages.forEach(m -> messageSink.next(m))) .expectNextCount(numberOfEvents) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } finally { sessionReceiver2.close(); } @@ -1312,7 +1323,8 @@ void receiveMessagesReportsMetricsAsyncInstr() { StepVerifier.create(receiver.receiveMessages().take(2)) .then(() -> messages.forEach(m -> messageSink.next(m))) .expectNextCount(2) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); TestHistogram receiverLag = meter.getHistograms().get("messaging.servicebus.receiver.lag"); assertNotNull(receiverLag); @@ -1372,7 +1384,9 @@ void settlementMessagesReportsMetrics(DispositionStatus status) { } } - StepVerifier.create(settle).verifyComplete(); + StepVerifier.create(settle) + .expectComplete() + .verify(DEFAULT_TIMEOUT); TestHistogram settlementDuration = meter.getHistograms().get("messaging.servicebus.settlement.request.duration"); assertNotNull(settlementDuration); @@ -1452,7 +1466,8 @@ void receiveWithTracesAndMetrics() { // Act & Assert StepVerifier.create(receiver.receiveMessages().take(2).flatMap(msg -> receiver.complete(msg))) .then(() -> messages.forEach(m -> messageSink.next(m))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); TestHistogram receiverLag = meter.getHistograms().get("messaging.servicebus.receiver.lag"); assertEquals(2, receiverLag.getMeasurements().size()); @@ -1490,7 +1505,8 @@ void receiveMessageNegativeLagReportsMetricsAsyncInstr() { StepVerifier.create(receiver.receiveMessages().take(1)) .then(() -> messages.forEach(m -> messageSink.next(m))) .expectNextCount(1) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); TestHistogram receiverLag = meter.getHistograms().get("messaging.servicebus.receiver.lag"); assertEquals(1, receiverLag.getMeasurements().size()); @@ -1522,7 +1538,8 @@ void receiveMessageNegativeLagReportsMetricsSyncInstr() { StepVerifier.create(receiver.receiveMessages().take(1)) .then(() -> messages.forEach(m -> messageSink.next(m))) .expectNextCount(1) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); TestHistogram receiverLag = meter.getHistograms().get("messaging.servicebus.receiver.lag"); assertEquals(1, receiverLag.getMeasurements().size()); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusRuleManagerAsyncClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusRuleManagerAsyncClientTest.java index 30506854f379..e6d615fc7c47 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusRuleManagerAsyncClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusRuleManagerAsyncClientTest.java @@ -20,9 +20,7 @@ import com.azure.messaging.servicebus.implementation.ServiceBusConstants; import com.azure.messaging.servicebus.implementation.ServiceBusManagementNode; import org.apache.qpid.proton.engine.SslDomain; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -46,6 +44,7 @@ public class ServiceBusRuleManagerAsyncClientTest { private static final String ENTITY_PATH = "topic-name/subscriptions/subscription-name"; private static final MessagingEntityType ENTITY_TYPE = MessagingEntityType.SUBSCRIPTION; private static final String RULE_NAME = "foo-bar"; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(100); private ServiceBusRuleManagerAsyncClient ruleManager; private ServiceBusConnectionProcessor connectionProcessor; @@ -74,16 +73,6 @@ public class ServiceBusRuleManagerAsyncClientTest { @Mock private RuleProperties ruleProperties2; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(100)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup(TestInfo testInfo) { LOGGER.info("[{}] Setting up.", testInfo.getDisplayName()); @@ -127,7 +116,8 @@ void createRuleWithOptions() { // Act & Assert StepVerifier.create(ruleManager.createRule(RULE_NAME, ruleOptions)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -136,7 +126,9 @@ void getRules() { when(managementNode.listRules()).thenReturn(Flux.fromArray(new RuleProperties[]{ruleProperties1, ruleProperties2})); // Act & Assert - StepVerifier.create(ruleManager.listRules()).expectNext(ruleProperties1, ruleProperties2).verifyComplete(); + StepVerifier.create(ruleManager.listRules()).expectNext(ruleProperties1, ruleProperties2) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -145,6 +137,8 @@ void deleteRule() { when(managementNode.deleteRule(RULE_NAME)).thenReturn(Mono.empty()); // Act & Assert - StepVerifier.create(ruleManager.deleteRule(RULE_NAME)).verifyComplete(); + StepVerifier.create(ruleManager.deleteRule(RULE_NAME)) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientIntegrationTest.java index 8105d119e911..2da9dc8d8788 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientIntegrationTest.java @@ -97,7 +97,8 @@ void nonSessionQueueSendMessage(MessagingEntityType entityType) { // Assert & Act StepVerifier.create(sender.sendMessage(message).doOnSuccess(aVoid -> messagesPending.incrementAndGet())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -113,12 +114,8 @@ void nonSessionEntitySendMessageList(MessagingEntityType entityType) { final List messages = TestUtils.getServiceBusMessages(count, UUID.randomUUID().toString(), CONTENTS_BYTES); // Assert & Act - StepVerifier.create( - sender.sendMessages(messages) - .doOnSuccess(aVoid -> - messages.forEach(serviceBusMessage -> messagesPending.incrementAndGet()) - ) - ) + StepVerifier.create(sender.sendMessages(messages) + .doOnSuccess(aVoid -> messages.forEach(serviceBusMessage -> messagesPending.incrementAndGet()))) .expectComplete() .verify(TIMEOUT); } @@ -145,7 +142,8 @@ void nonSessionMessageBatch(MessagingEntityType entityType) { return sender.sendMessages(batch).doOnSuccess(aVoid -> messagesPending.incrementAndGet()); })) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -189,19 +187,24 @@ void viaQueueMessageSendTest() { transaction.set(transactionContext); assertNotNull(transaction); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); assertNotNull(transaction.get()); StepVerifier.create(sender.sendMessages(messages, transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(destination1ViaSender.sendMessages(messages, transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(destination1ViaSender.sendMessages(messages, transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(destination1ViaSender.commitTransaction(transaction.get()) .delaySubscription(Duration.ofSeconds(1))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); // Assert // Verify message is received by final destination Entity @@ -214,7 +217,8 @@ void viaQueueMessageSendTest() { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); // Verify, intermediate-via queue has it delivered to intermediate Entity. StepVerifier.create(receiver.receiveMessages().take(total).timeout(shortTimeout)) @@ -222,7 +226,8 @@ void viaQueueMessageSendTest() { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } finally { destination1Receiver.close(); destination1ViaSender.close(); @@ -273,18 +278,23 @@ void viaTopicMessageSendTest() { transaction.set(transactionContext); assertNotNull(transaction); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); assertNotNull(transaction.get()); StepVerifier.create(intermediateSender.sendMessages(messages, transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(destination1ViaSender.sendMessages(messages, transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(destination1ViaSender.sendMessages(messages, transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(destination1ViaSender.commitTransaction(transaction.get()).delaySubscription(Duration.ofSeconds(1))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); // Assert // Verify message is received by final destination Entity @@ -297,7 +307,8 @@ void viaTopicMessageSendTest() { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); // Verify, intermediate-via topic has it delivered to intermediate Entity. StepVerifier.create(intermediateReceiver.receiveMessages().take(total).timeout(shortTimeout)) @@ -305,7 +316,8 @@ void viaTopicMessageSendTest() { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -332,15 +344,18 @@ void transactionMessageSendAndCompleteTransaction(MessagingEntityType entityType transaction.set(transactionContext); assertNotNull(transaction); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); assertNotNull(transaction.get()); // Assert & Act StepVerifier.create(sender.sendMessages(messages, transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); if (isCommit) { StepVerifier.create(sender.commitTransaction(transaction.get()).delaySubscription(Duration.ofSeconds(1))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(receiver.receiveMessages().take(total)) .assertNext(receivedMessage -> { System.out.println("1"); @@ -361,7 +376,8 @@ void transactionMessageSendAndCompleteTransaction(MessagingEntityType entityType .verify(shortTimeout); } else { StepVerifier.create(sender.rollbackTransaction(transaction.get()).delaySubscription(Duration.ofSeconds(1))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(receiver.receiveMessages().take(total)) .verifyTimeout(shortTimeout); } @@ -387,7 +403,7 @@ void sendWithCredentials(MessagingEntityType entityType) { return sender.sendMessages(batch).doOnSuccess(aVoid -> messagesPending.incrementAndGet()); })) .expectComplete() - .verify(); + .verify(TIMEOUT); } /** @@ -411,22 +427,26 @@ void transactionScheduleAndCommitTest(MessagingEntityType entityType) { transaction.set(transactionContext); assertNotNull(transaction); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(sender.scheduleMessage(message, OffsetDateTime.now().plusSeconds(5), transaction.get())) .assertNext(sequenceNumber -> { assertNotNull(sequenceNumber); assertTrue(sequenceNumber.intValue() > 0); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(sender.commitTransaction(transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(Mono.delay(scheduleDuration).then(receiver.receiveMessages().next())) .assertNext(receivedMessage -> { assertMessageEquals(receivedMessage, messageId, isSessionEnabled); messagesPending.decrementAndGet(); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } /** @@ -457,16 +477,19 @@ void transactionScheduleMessagesTest(MessagingEntityType entityType) { transaction.set(transactionContext); assertNotNull(transaction); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(sender.scheduleMessages(messages, OffsetDateTime.now().plus(scheduleDuration), transaction.get()).collectList()) .assertNext(longs -> { assertEquals(total, longs.size()); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(sender.commitTransaction(transaction.get())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(Mono.delay(scheduleDuration).thenMany(receiver.receiveMessages().take(total))) .assertNext(receivedMessage -> { @@ -479,7 +502,7 @@ void transactionScheduleMessagesTest(MessagingEntityType entityType) { }) .thenAwait(shortWait) .thenCancel() - .verify(); + .verify(TIMEOUT); } /** @@ -507,7 +530,8 @@ void cancelScheduledMessagesTest(MessagingEntityType entityType) { Assertions.assertEquals(total, seqNumbers.size()); StepVerifier.create(sender.cancelScheduledMessages(seqNumbers)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); // The messages should have been cancelled and we should not find any messages. StepVerifier.create(receiver.receiveMessages().take(total)) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientTest.java index fd50d9655ae4..c90be314b631 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderAsyncClientTest.java @@ -36,10 +36,8 @@ import org.apache.qpid.proton.amqp.transport.DeliveryState; import org.apache.qpid.proton.engine.SslDomain; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; @@ -104,6 +102,7 @@ class ServiceBusSenderAsyncClientTest { private static final String TXN_ID_STRING = "1"; private static final String CLIENT_IDENTIFIER = "my-client-identifier"; private static final ServiceBusSenderInstrumentation DEFAULT_INSTRUMENTATION = new ServiceBusSenderInstrumentation(null, null, NAMESPACE, ENTITY_NAME); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); @Mock private AmqpSendLink sendLink; @Mock @@ -147,16 +146,6 @@ class ServiceBusSenderAsyncClientTest { private ServiceBusConnectionProcessor connectionProcessor; private ConnectionOptions connectionOptions; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup() { MockitoAnnotations.initMocks(this); @@ -210,7 +199,8 @@ void verifyProperties() { @Test void createBatchNull() { StepVerifier.create(sender.createMessageBatch(null)) - .verifyErrorMatches(error -> error instanceof NullPointerException); + .expectErrorMatches(error -> error instanceof NullPointerException) + .verify(DEFAULT_TIMEOUT); } /** @@ -229,7 +219,8 @@ void createBatchDefault() { Assertions.assertEquals(MAX_MESSAGE_LENGTH_BYTES, batch.getMaxSizeInBytes()); Assertions.assertEquals(0, batch.getCount()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -253,7 +244,7 @@ void createBatchWhenSizeTooBig() { // Act & Assert StepVerifier.create(sender.createMessageBatch(options)) .expectError(ServiceBusException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -288,14 +279,16 @@ void createsMessageBatchWithSize() { Assertions.assertEquals(batchSize, batch.getMaxSizeInBytes()); Assertions.assertTrue(batch.tryAddMessage(event)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(sender.createMessageBatch(options)) .assertNext(batch -> { Assertions.assertEquals(batchSize, batch.getMaxSizeInBytes()); Assertions.assertFalse(batch.tryAddMessage(tooLargeEvent)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -316,7 +309,8 @@ void scheduleMessageSizeTooBig() { // Act & Assert StepVerifier.create(sender.scheduleMessages(messages, instant)) - .verifyError(ServiceBusException.class); + .expectError(ServiceBusException.class) + .verify(DEFAULT_TIMEOUT); verify(managementNode, never()).schedule(any(), eq(instant), anyInt(), eq(LINK_NAME), isNull()); } @@ -345,7 +339,8 @@ void sendMultipleMessagesWithTransaction() { // Act StepVerifier.create(sender.sendMessages(batch, transactionContext)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink).send(messagesCaptor.capture(), amqpDeliveryStateCaptor.capture()); @@ -382,7 +377,8 @@ void sendMultipleMessages() { when(sendLink.send(anyList())).thenReturn(Mono.empty()); // Act StepVerifier.create(sender.sendMessages(batch)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink).send(messagesCaptor.capture()); @@ -441,7 +437,8 @@ void sendMultipleMessagesTracesSpans() { // Act StepVerifier.create(sender.sendMessages(batch)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(tracer1, times(4)) @@ -549,7 +546,8 @@ void sendMessageReportsMetrics() { // Act StepVerifier.create(sender.sendMessage(new ServiceBusMessage(TEST_CONTENTS)) .then(sender.sendMessage(new ServiceBusMessage(TEST_CONTENTS)))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert TestCounter sentMessagesCounter = meter.getCounters().get("messaging.servicebus.messages.sent"); @@ -593,7 +591,8 @@ void sendMessageReportsMetricsAndTraces() { // Act StepVerifier.create(sender.sendMessage(new ServiceBusMessage(TEST_CONTENTS))) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert TestCounter sentMessagesCounter = meter.getCounters().get("messaging.servicebus.messages.sent"); @@ -626,7 +625,8 @@ void sendMessageBatchReportsMetrics() { // Act StepVerifier.create(sender.sendMessages(batch)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert TestCounter sentMessagesCounter = meter.getCounters().get("messaging.servicebus.messages.sent"); @@ -653,7 +653,7 @@ void failedSendMessageReportsMetrics() { // Act StepVerifier.create(sender.sendMessage(new ServiceBusMessage(TEST_CONTENTS))) .expectError() - .verify(); + .verify(DEFAULT_TIMEOUT); // Assert TestCounter sentMessagesCounter = meter.getCounters().get("messaging.servicebus.messages.sent"); @@ -681,7 +681,8 @@ void sendMessagesListWithTransaction() { // Act StepVerifier.create(sender.sendMessages(messages, transactionContext)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink).send(messagesCaptor.capture(), amqpDeliveryStateCaptor.capture()); @@ -712,7 +713,8 @@ void sendMessagesList() { // Act StepVerifier.create(sender.sendMessages(messages)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink).send(messagesCaptor.capture()); @@ -739,8 +741,9 @@ void sendMessagesListExceedSize() { // Act & Assert StepVerifier.create(sender.sendMessages(messages)) - .verifyErrorMatches(error -> error instanceof ServiceBusException - && ((ServiceBusException) error).getReason() == ServiceBusFailureReason.MESSAGE_SIZE_EXCEEDED); + .expectErrorMatches(error -> error instanceof ServiceBusException + && ((ServiceBusException) error).getReason() == ServiceBusFailureReason.MESSAGE_SIZE_EXCEEDED) + .verify(DEFAULT_TIMEOUT); verify(sendLink, never()).send(anyList()); } @@ -756,8 +759,9 @@ void sendSingleMessageThatExceedsSize() { // Act & Assert StepVerifier.create(sender.sendMessage(message)) - .verifyErrorMatches(error -> error instanceof ServiceBusException - && ((ServiceBusException) error).getReason() == ServiceBusFailureReason.MESSAGE_SIZE_EXCEEDED); + .expectErrorMatches(error -> error instanceof ServiceBusException + && ((ServiceBusException) error).getReason() == ServiceBusFailureReason.MESSAGE_SIZE_EXCEEDED) + .verify(DEFAULT_TIMEOUT); verify(sendLink, never()).send(anyList()); } @@ -778,7 +782,8 @@ void sendSingleMessageWithTransaction() { // Act StepVerifier.create(sender.sendMessage(testData, transactionContext)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink, times(1)).send(any(org.apache.qpid.proton.message.Message.class), any(DeliveryState.class)); @@ -812,7 +817,8 @@ void sendSingleMessage() { // Act StepVerifier.create(sender.sendMessage(testData)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink, times(1)).send(any(org.apache.qpid.proton.message.Message.class)); @@ -837,7 +843,8 @@ void scheduleMessage() { // Act & Assert StepVerifier.create(sender.scheduleMessage(message, instant)) .expectNext(sequenceNumberReturned) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(managementNode).schedule(sbMessagesCaptor.capture(), eq(instant), eq(MAX_MESSAGE_LENGTH_BYTES), eq(LINK_NAME), isNull()); List actualMessages = sbMessagesCaptor.getValue(); @@ -860,7 +867,8 @@ void scheduleMessageWithTransaction() { // Act & Assert StepVerifier.create(sender.scheduleMessage(message, instant, transactionContext)) .expectNext(sequenceNumberReturned) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(managementNode).schedule(sbMessagesCaptor.capture(), eq(instant), eq(MAX_MESSAGE_LENGTH_BYTES), eq(LINK_NAME), argThat(e -> e.getTransactionId().equals(transactionContext.getTransactionId()))); List actualMessages = sbMessagesCaptor.getValue(); @@ -877,7 +885,8 @@ void cancelScheduleMessage() { // Act & Assert StepVerifier.create(sender.cancelScheduledMessage(sequenceNumberReturned)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(managementNode).cancelScheduledMessages(sequenceNumberCaptor.capture(), isNull()); Iterable actualSequenceNumbers = sequenceNumberCaptor.getValue(); @@ -903,7 +912,8 @@ void cancelScheduleMessages() { // Act & Assert StepVerifier.create(sender.cancelScheduledMessages(sequenceNumbers)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); verify(managementNode).cancelScheduledMessages(sequenceNumberCaptor.capture(), isNull()); Iterable actualSequenceNumbers = sequenceNumberCaptor.getValue(); @@ -941,7 +951,8 @@ void verifyMessageOrdering() { // Act StepVerifier.create(sender.sendMessages(messages)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Assert verify(sendLink).send(messagesCaptor.capture()); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderClientTest.java index 0a544e42c96c..ee07c6d8f1a2 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSenderClientTest.java @@ -5,10 +5,8 @@ import com.azure.core.util.BinaryData; import com.azure.messaging.servicebus.models.CreateMessageBatchOptions; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; @@ -16,7 +14,6 @@ import org.mockito.MockitoAnnotations; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; import java.time.Duration; import java.time.OffsetDateTime; @@ -47,16 +44,6 @@ public class ServiceBusSenderClientTest { private static final String TEST_CONTENTS = "My message for service bus queue!"; private static final BinaryData TEST_CONTENTS_BINARY = BinaryData.fromString(TEST_CONTENTS); - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup() { MockitoAnnotations.initMocks(this); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java index a6cf5d47daa8..db1344bdef5b 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionManagerTest.java @@ -24,9 +24,7 @@ import org.apache.qpid.proton.amqp.messaging.Accepted; import org.apache.qpid.proton.engine.SslDomain; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -80,6 +78,7 @@ class ServiceBusSessionManagerTest { private static final Duration TIMEOUT = Duration.ofSeconds(10); private static final Duration MAX_LOCK_RENEWAL = Duration.ofSeconds(5); private static final Duration SESSION_IDLE_TIMEOUT = Duration.ofSeconds(20); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(60); private static final String NAMESPACE = "my-namespace-foo.net"; private static final String ENTITY_PATH = "queue-name"; private static final MessagingEntityType ENTITY_TYPE = MessagingEntityType.QUEUE; @@ -108,17 +107,6 @@ class ServiceBusSessionManagerTest { @Captor private ArgumentCaptor linkNameCaptor; - - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(60)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void beforeEach(TestInfo testInfo) { LOGGER.info("===== [{}] Setting up. =====", testInfo.getDisplayName()); @@ -194,7 +182,7 @@ void receiveNull() { // Act & Assert StepVerifier.create(sessionManager.receive()) .expectError(NullPointerException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -431,7 +419,7 @@ void multipleSessions() { }) .thenAwait(Duration.ofSeconds(15)) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } @@ -493,12 +481,12 @@ void multipleReceiveUnnamedSession() { StepVerifier.create(sessionManager.receive()) .thenAwait(Duration.ofSeconds(5)) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); StepVerifier.create(sessionManager.receive()) .thenAwait(Duration.ofSeconds(5)) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); verify(connection, times(2)).createReceiveLink(linkNameCaptor.capture(), eq(ENTITY_PATH), any( ServiceBusReceiveMode.class), isNull(), @@ -555,11 +543,11 @@ void singleUnnamedSessionCleanupAfterTimeout() { try { TimeUnit.SECONDS.sleep(TIMEOUT.getSeconds()); assertNull(sessionManager.getLinkName(sessionId)); - } catch (InterruptedException e) { } + } catch (InterruptedException ignored) { } }) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } private static void assertMessageEquals(String sessionId, ServiceBusReceivedMessage expected, diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClientTest.java index 39f695a41999..ac2a52b3ea8a 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusSessionReceiverAsyncClientTest.java @@ -25,9 +25,7 @@ import org.apache.qpid.proton.amqp.messaging.Accepted; import org.apache.qpid.proton.engine.SslDomain; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -65,6 +63,7 @@ class ServiceBusSessionReceiverAsyncClientTest { private static final String ENTITY_PATH = "queue-name"; private static final MessagingEntityType ENTITY_TYPE = MessagingEntityType.QUEUE; private static final String CLIENT_IDENTIFIER = "my-client-identifier"; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private static final ClientLogger LOGGER = new ClientLogger(ServiceBusReceiverAsyncClientTest.class); private final TestPublisher endpointProcessor = TestPublisher.createCold(); @@ -86,17 +85,6 @@ class ServiceBusSessionReceiverAsyncClientTest { @Mock private ServiceBusManagementNode managementNode; - - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void beforeEach(TestInfo testInfo) { LOGGER.info("===== [{}] Setting up. =====", testInfo.getDisplayName()); @@ -199,7 +187,8 @@ void acceptSession() { .assertNext(context -> assertMessageEquals(sessionId, receivedMessage, context)) .assertNext(context -> assertMessageEquals(sessionId, receivedMessage, context)) .assertNext(context -> assertMessageEquals(sessionId, receivedMessage, context)) - .thenCancel().verify(); + .thenCancel() + .verify(DEFAULT_TIMEOUT); } @Test @@ -289,22 +278,13 @@ void acceptNextSession() { messageProcessor.next(message); } }) - .assertNext(context -> { - assertMessageEquals(sessionId, receivedMessage, context); - }) - .assertNext(context -> { - assertMessageEquals(sessionId, receivedMessage, context); - }) - .assertNext(context -> { - assertMessageEquals(sessionId, receivedMessage, context); - }) - .assertNext(context -> { - assertMessageEquals(sessionId, receivedMessage, context); - }) - .assertNext(context -> { - assertMessageEquals(sessionId, receivedMessage, context); - }) - .thenAwait(Duration.ofSeconds(1)).thenCancel().verify(); + .assertNext(context -> assertMessageEquals(sessionId, receivedMessage, context)) + .assertNext(context -> assertMessageEquals(sessionId, receivedMessage, context)) + .assertNext(context -> assertMessageEquals(sessionId, receivedMessage, context)) + .assertNext(context -> assertMessageEquals(sessionId, receivedMessage, context)) + .assertNext(context -> assertMessageEquals(sessionId, receivedMessage, context)) + .thenAwait(Duration.ofSeconds(1)).thenCancel() + .verify(DEFAULT_TIMEOUT); StepVerifier.create(client.acceptNextSession() .flatMapMany(ServiceBusReceiverAsyncClient::receiveMessagesWithContext)) @@ -313,18 +293,12 @@ void acceptNextSession() { messagePublisher2.next(message2); } }) - .assertNext(context -> { - assertMessageEquals(sessionId2, receivedMessage2, context); - }) - .assertNext(context -> { - assertMessageEquals(sessionId2, receivedMessage2, context); - }) - .assertNext(context -> { - assertMessageEquals(sessionId2, receivedMessage2, context); - }) + .assertNext(context -> assertMessageEquals(sessionId2, receivedMessage2, context)) + .assertNext(context -> assertMessageEquals(sessionId2, receivedMessage2, context)) + .assertNext(context -> assertMessageEquals(sessionId2, receivedMessage2, context)) .thenAwait(Duration.ofSeconds(1)) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -382,7 +356,7 @@ void specificSessionReceive() { messageProcessor.complete(); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } finally { client.close(); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TracingIntegrationTests.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TracingIntegrationTests.java index f263cae6cde1..b95c5f470838 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TracingIntegrationTests.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TracingIntegrationTests.java @@ -99,8 +99,6 @@ protected void beforeTest() { .receiver() .queueName(getQueueName(0)) .buildClient()); - - StepVerifier.setDefaultTimeout(TIMEOUT); } @Override @@ -115,7 +113,8 @@ public void sendAndReceive() throws InterruptedException { ServiceBusMessage message2 = new ServiceBusMessage(CONTENTS_BYTES); List messages = Arrays.asList(message1, message2); StepVerifier.create(sender.sendMessages(messages)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); CountDownLatch processedFound = new CountDownLatch(2); spanProcessor.notifyIfCondition(processedFound, s -> s.getName().equals("ServiceBus.process")); @@ -161,7 +160,7 @@ public void sendAndReceive() throws InterruptedException { @Test public void receiveAndRenewLockWithDuration() throws InterruptedException { ServiceBusMessage message = new ServiceBusMessage(CONTENTS_BYTES); - StepVerifier.create(sender.sendMessage(message)).verifyComplete(); + StepVerifier.create(sender.sendMessage(message)).expectComplete().verify(TIMEOUT); CountDownLatch processedFound = new CountDownLatch(1); spanProcessor.notifyIfCondition(processedFound, s -> s.getName().equals("ServiceBus.process")); @@ -179,7 +178,8 @@ public void receiveAndRenewLockWithDuration() throws InterruptedException { List renewLock = findSpans(spans, "ServiceBus.renewMessageLock"); assertClientSpan(renewLock.get(0), Collections.singletonList(msg), "ServiceBus.renewMessageLock", null); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); assertTrue(processedFound.await(20, TimeUnit.SECONDS)); } @@ -205,7 +205,7 @@ public void receiveAndRenewSessionLockWithDuration() throws InterruptedException .queueName(getSessionQueueName(0)) .buildAsyncClient()); - StepVerifier.create(sender.sendMessage(message)).verifyComplete(); + StepVerifier.create(sender.sendMessage(message)).expectComplete().verify(TIMEOUT); CountDownLatch processedFound = new CountDownLatch(1); spanProcessor.notifyIfCondition(processedFound, s -> s.getName().equals("ServiceBus.process")); @@ -224,7 +224,8 @@ public void receiveAndRenewSessionLockWithDuration() throws InterruptedException .addKeyValue("sessionId", msg.getSessionId()) .log("message received"); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); assertTrue(processedFound.await(20, TimeUnit.SECONDS)); @@ -246,7 +247,8 @@ public void receiveCheckSubscribe() throws InterruptedException { ServiceBusMessage message2 = new ServiceBusMessage(CONTENTS_BYTES); List messages = Arrays.asList(message1, message2); StepVerifier.create(sender.sendMessages(messages)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); CountDownLatch processedFound = new CountDownLatch(2); spanProcessor.notifyIfCondition(processedFound, s -> s.getName().equals("ServiceBus.process")); @@ -284,7 +286,9 @@ public void sendAndReceiveParallelNoAutoCompleteAndLockRenewal() throws Interrup batch.tryAddMessage(new ServiceBusMessage(CONTENTS_BYTES)); } }) - .flatMap(batch -> sender.sendMessages(batch))).verifyComplete(); + .flatMap(batch -> sender.sendMessages(batch))) + .expectComplete() + .verify(TIMEOUT); CountDownLatch processedFound = new CountDownLatch(messageCount); spanProcessor.notifyIfCondition(processedFound, span -> span.getName().equals("ServiceBus.process")); @@ -314,7 +318,8 @@ public void sendAndReceiveParallelNoAutoCompleteAndLockRenewal() throws Interrup .parallel(messageCount, 1) .runOn(Schedulers.boundedElastic(), 1)) .expectNextCount(messageCount) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); assertTrue(processedFound.await(20, TimeUnit.SECONDS)); @@ -348,7 +353,9 @@ public void sendAndReceiveParallelAutoComplete() throws InterruptedException { batch.tryAddMessage(new ServiceBusMessage(CONTENTS_BYTES)); } }) - .flatMap(batch -> sender.sendMessages(batch))).verifyComplete(); + .flatMap(batch -> sender.sendMessages(batch))) + .expectComplete() + .verify(TIMEOUT); CountDownLatch processedFound = new CountDownLatch(messageCount); spanProcessor.notifyIfCondition(processedFound, span -> span.getName().equals("ServiceBus.process")); @@ -376,7 +383,8 @@ public void sendAndReceiveParallelAutoComplete() throws InterruptedException { .parallel(messageCount, 1) .runOn(Schedulers.boundedElastic(), 1)) .expectNextCount(messageCount) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); assertTrue(processedFound.await(20, TimeUnit.SECONDS)); @@ -399,7 +407,7 @@ public void sendReceiveRenewLockAndDefer() throws InterruptedException { AtomicReference receivedMessage = new AtomicReference<>(); message.getApplicationProperties().put("traceparent", traceparent); - StepVerifier.create(sender.sendMessage(message)).verifyComplete(); + StepVerifier.create(sender.sendMessage(message)).expectComplete().verify(TIMEOUT); CountDownLatch latch = new CountDownLatch(2); spanProcessor.notifyIfCondition(latch, s -> s.getName().equals("ServiceBus.process") && s.getSpanContext().getTraceId().equals(traceId)); @@ -442,7 +450,8 @@ public void sendReceiveRenewLockAndDefer() throws InterruptedException { @Test public void sendReceiveRenewLockAndDeferSync() { StepVerifier.create(sender.sendMessage(new ServiceBusMessage(CONTENTS_BYTES))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); ServiceBusReceivedMessage receivedMessage = receiverSync.receiveMessages(1, Duration.ofSeconds(10)).stream().findFirst().get(); @@ -472,7 +481,8 @@ public void syncReceive() { messages.add(new ServiceBusMessage(CONTENTS_BYTES)); StepVerifier.create(sender.sendMessages(messages)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); List receivedMessages = receiverSync.receiveMessages(2, Duration.ofSeconds(10)) .stream().collect(Collectors.toList()); @@ -507,7 +517,8 @@ public void syncReceiveTimeout() { @Test public void peekMessage() { StepVerifier.create(sender.sendMessage(new ServiceBusMessage(CONTENTS_BYTES))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); StepVerifier.create(receiver.peekMessage()) .assertNext(receivedMessage -> { @@ -524,13 +535,15 @@ public void peekMessage() { assertEquals("receive", received.getAttribute(AttributeKey.stringKey("messaging.operation"))); } }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } @Test public void peekNonExistingMessage() { StepVerifier.create(receiver.peekMessage(Long.MAX_VALUE - 1)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); List received = findSpans(spanProcessor.getEndedSpans(), "ServiceBus.peekMessage"); assertClientSpan(received.get(0), Collections.emptyList(), "ServiceBus.peekMessage", "receive"); @@ -543,7 +556,8 @@ public void sendAndProcessNoAutoComplete() throws InterruptedException { .setMessageId(messageId); StepVerifier.create(sender.sendMessage(message)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); String message1SpanId = message.getApplicationProperties().get("traceparent").toString().substring(36, 52); CountDownLatch processFound = new CountDownLatch(1); @@ -608,7 +622,8 @@ public void sendAndProcessParallel() throws InterruptedException { logMessages(batch.getMessages(), sender.getEntityPath(), "sending"); return sender.sendMessages(batch); })) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); CountDownLatch processedFound = new CountDownLatch(messageCount * 2); spanProcessor.notifyIfCondition(processedFound, span -> span.getName().equals("ServiceBus.process") || span.getName().equals("ServiceBus.complete")); @@ -655,7 +670,9 @@ public void sendAndProcessParallelNoAutoComplete() throws InterruptedException { batch.tryAddMessage(new ServiceBusMessage(CONTENTS_BYTES)); } }) - .flatMap(batch -> sender.sendMessages(batch))).verifyComplete(); + .flatMap(batch -> sender.sendMessages(batch))) + .expectComplete() + .verify(TIMEOUT); CountDownLatch processedFound = new CountDownLatch(messageCount); spanProcessor.notifyIfCondition(processedFound, span -> span.getName().equals("ServiceBus.process")); @@ -700,7 +717,8 @@ public void sendProcessAndFail() throws InterruptedException { .setMessageId(messageId); StepVerifier.create(sender.sendMessage(message)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); String message1SpanId = message.getApplicationProperties().get("traceparent").toString().substring(36, 52); @@ -749,7 +767,8 @@ public void scheduleAndCancelMessage() { StepVerifier.create( sender.scheduleMessage(message, OffsetDateTime.now().plusSeconds(100)) .flatMap(l -> sender.cancelScheduledMessage(l))) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); List spans = spanProcessor.getEndedSpans(); assertMessageSpan(spans.get(0), message); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClientIntegrationTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClientIntegrationTest.java index ed1ff5b21a65..f58899b1faf3 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClientIntegrationTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClientIntegrationTest.java @@ -40,8 +40,6 @@ import com.azure.messaging.servicebus.administration.models.TopicProperties; import com.azure.messaging.servicebus.administration.models.TopicRuntimeProperties; import com.azure.messaging.servicebus.administration.models.TrueRuleFilter; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -81,6 +79,7 @@ @Tag("integration") class ServiceBusAdministrationAsyncClientIntegrationTest extends TestProxyTestBase { private static final Duration TIMEOUT = Duration.ofSeconds(20); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(10); /** * Sanitizer to remove header values for ServiceBusDlqSupplementaryAuthorization and @@ -102,16 +101,6 @@ class ServiceBusAdministrationAsyncClientIntegrationTest extends TestProxyTestBa TEST_PROXY_REQUEST_MATCHERS = Collections.singletonList(customMatcher); } - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(10)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - static Stream createHttpClients() { return Stream.of( Arguments.of(new NettyAsyncHttpClientBuilder().build()) @@ -168,7 +157,8 @@ void azureIdentityCredentials(HttpClient httpClient) { assertEquals(expectedName, properties.getName()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -202,7 +192,7 @@ void azureSasCredentialsTest() { assertNotNull(np.getName()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } //region Create tests @@ -242,7 +232,8 @@ void createQueue(HttpClient httpClient) { assertEquals(0, runtimeProperties.getSizeInBytes()); assertNotNull(runtimeProperties.getCreatedAt()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -256,7 +247,7 @@ void createQueueExistingName(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.createQueue(queueName, options)) .expectError(ResourceExistsException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -284,7 +275,8 @@ void createQueueWithForwarding(HttpClient httpClient) { final QueueRuntimeProperties runtimeProperties = new QueueRuntimeProperties(actual); assertNotNull(runtimeProperties.getCreatedAt()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -333,7 +325,8 @@ void createQueueAuthorizationRules(HttpClient httpClient) { assertAuthorizationRules(expected.getAuthorizationRules(), actual.getAuthorizationRules()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -365,7 +358,8 @@ void createRule(HttpClient httpClient) { assertTrue(contents.getFilter() instanceof FalseRuleFilter); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -385,7 +379,8 @@ void createRuleDefaults(HttpClient httpClient) { assertTrue(contents.getFilter() instanceof TrueRuleFilter); assertTrue(contents.getAction() instanceof EmptyRuleAction); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -424,7 +419,8 @@ void createRuleResponse(HttpClient httpClient) { assertNotNull(contents.getAction()); assertTrue(contents.getAction() instanceof EmptyRuleAction); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -452,7 +448,8 @@ void createSubscription(HttpClient httpClient) { assertEquals(expected.isDeadLetteringOnMessageExpiration(), actual.isDeadLetteringOnMessageExpiration()); assertEquals(expected.isSessionRequired(), actual.isSessionRequired()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -466,7 +463,7 @@ void createSubscriptionExistingName(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.createSubscription(topicName, subscriptionName)) .expectError(ResourceExistsException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -530,7 +527,8 @@ void createTopicWithResponse(HttpClient httpClient) { assertEquals(0, runtimeProperties.getSizeInBytes()); assertNotNull(runtimeProperties.getCreatedAt()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -548,7 +546,7 @@ void createTopicExistingName(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.createTopicWithResponse(topicName, expected)) .expectError(ResourceExistsException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } //endregion @@ -568,7 +566,8 @@ void deleteQueue(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.deleteQueue(queueName)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -584,7 +583,8 @@ void deleteQueueDoesNotExist(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.deleteQueue(queueName)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -600,7 +600,8 @@ void deleteRule(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.deleteRule(topicName, subscriptionName, ruleName)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -631,7 +632,8 @@ void deleteSubscription(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.deleteSubscription(topicName, subscriptionName)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -662,7 +664,8 @@ void deleteTopic(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.deleteTopic(topicName)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -704,7 +707,8 @@ void getQueue(HttpClient httpClient) { assertTrue(nowUtc.isAfter(runtimeProperties.getCreatedAt())); assertNotNull(runtimeProperties.getAccessedAt()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -726,7 +730,8 @@ void getNamespace(HttpClient httpClient) { assertEquals(NamespaceType.MESSAGING, properties.getNamespaceType()); assertEquals(expectedName, properties.getName()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -739,7 +744,7 @@ void getQueueDoesNotExist(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.getQueue(queueName)) .expectError(ResourceNotFoundException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -752,7 +757,8 @@ void getQueueExists(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.getQueueExists(queueName)) .expectNext(true) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -765,7 +771,8 @@ void getQueueExistsFalse(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.getQueueExists(queueName)) .expectNext(false) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -785,7 +792,8 @@ void getQueueRuntimeProperties(HttpClient httpClient) { assertTrue(nowUtc.isAfter(RuntimeProperties.getCreatedAt())); assertNotNull(RuntimeProperties.getAccessedAt()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -814,7 +822,8 @@ void getRule(HttpClient httpClient) { assertNotNull(contents.getAction()); assertTrue(contents.getAction() instanceof EmptyRuleAction); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -856,7 +865,8 @@ void getSubscription(HttpClient httpClient) { assertTrue(nowUtc.isAfter(runtimeProperties.getCreatedAt())); assertNotNull(runtimeProperties.getAccessedAt()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -870,7 +880,7 @@ void getSubscriptionDoesNotExist(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.getSubscription(topicName, subscriptionName)) .expectError(ResourceNotFoundException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -884,7 +894,8 @@ void getSubscriptionExists(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.getSubscriptionExists(topicName, subscriptionName)) .expectNext(true) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -898,7 +909,8 @@ void getSubscriptionExistsFalse(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.getSubscriptionExists(topicName, subscriptionName)) .expectNext(false) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -926,7 +938,8 @@ void getSubscriptionRuntimeProperties(HttpClient httpClient) { assertTrue(nowUtc.isAfter(description.getCreatedAt())); assertNotNull(description.getAccessedAt()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -953,7 +966,8 @@ void getTopic(HttpClient httpClient) { assertTrue(nowUtc.isAfter(runtimeProperties.getCreatedAt())); assertNotNull(runtimeProperties.getAccessedAt()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -976,7 +990,7 @@ void getTopicDoesNotExist(HttpClient httpClient) { StepVerifier.create(response.getBody()) .verifyComplete(); }) - .verify(); + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -989,7 +1003,8 @@ void getTopicExists(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.getTopicExists(topicName)) .expectNext(true) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -1002,7 +1017,8 @@ void getTopicExistsFalse(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.getTopicExists(topicName)) .expectNext(false) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -1027,7 +1043,8 @@ void getTopicRuntimeProperties(HttpClient httpClient) { assertEquals(0, RuntimeProperties.getScheduledMessageCount()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -1061,7 +1078,8 @@ void getSubscriptionRuntimePropertiesUnauthorizedClient(HttpClient httpClient) { // Act & Assert StepVerifier.create(client.getSubscriptionRuntimeProperties(topicName, subscriptionName)) - .verifyErrorMatches(throwable -> throwable instanceof ClientAuthenticationException); + .expectErrorMatches(throwable -> throwable instanceof ClientAuthenticationException) + .verify(DEFAULT_TIMEOUT); } //endregion @@ -1090,7 +1108,7 @@ void listRules(HttpClient httpClient) { assertTrue(response.getAction() instanceof EmptyRuleAction); }) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -1109,7 +1127,7 @@ void listQueues(HttpClient httpClient) { }) .expectNextCount(9) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -1127,7 +1145,7 @@ void listSubscriptions(HttpClient httpClient) { }) .expectNextCount(1) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } @ParameterizedTest @@ -1145,7 +1163,7 @@ void listTopics(HttpClient httpClient) { }) .expectNextCount(2) .thenCancel() - .verify(); + .verify(DEFAULT_TIMEOUT); } //endregion @@ -1181,7 +1199,8 @@ void updateRuleResponse(HttpClient httpClient) { assertEquals(expectedAction.getSqlExpression(), ((SqlRuleAction) contents.getAction()).getSqlExpression()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } private ServiceBusAdministrationAsyncClient createClient(HttpClient httpClient) { diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClientTest.java index 5a1d82349542..282fff04aae4 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClientTest.java @@ -33,9 +33,7 @@ import com.azure.messaging.servicebus.administration.models.CreateQueueOptions; import com.azure.messaging.servicebus.administration.models.QueueProperties; import com.azure.messaging.servicebus.administration.models.QueueRuntimeProperties; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -86,6 +84,7 @@ class ServiceBusAdministrationAsyncClientTest { private static final int HTTP_UNAUTHORIZED = 401; private static final String FORWARD_TO_ENTITY = "https://endpoint.servicebus.foo/forward-to-entity"; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(5); @Mock private ServiceBusManagementClientImpl serviceClient; @@ -116,16 +115,6 @@ class ServiceBusAdministrationAsyncClientTest { } } - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(5)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void beforeEach() { mockClosable = MockitoAnnotations.openMocks(this); @@ -166,7 +155,8 @@ void createQueue() throws IOException { // Act & Assert StepVerifier.create(client.createQueue(queueName, description)) .assertNext(e -> assertEquals(updatedName, e.getName())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -191,7 +181,8 @@ void createQueueWithResponse() throws IOException { assertResponse(objectResponse, response); assertEquals(updatedName, response.getValue().getName()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -221,7 +212,8 @@ && verifyAdditionalAuthHeaderPresent(ctx, assertResponse(objectResponse, response); assertEquals(updatedName, response.getValue().getName()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -232,7 +224,8 @@ void deleteQueue() { // Act & Assert StepVerifier.create(client.deleteQueue(queueName)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -244,7 +237,8 @@ void deleteQueueWithResponse() { // Act & Assert StepVerifier.create(client.deleteQueueWithResponse(queueName)) .assertNext(response -> assertResponse(objectResponse, response)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -263,7 +257,8 @@ void getQueue() throws IOException { // Act & Assert StepVerifier.create(client.getQueue(queueName)) .assertNext(e -> assertEquals(queueName, e.getName())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -286,7 +281,8 @@ void getQueueWithResponse() throws IOException { assertResponse(objectResponse, response); assertEquals(updatedName, response.getValue().getName()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -330,7 +326,8 @@ void getQueueRuntimeProperties() throws IOException { assertEquals(expectedCount.getTransferMessageCount(), info.getTransferMessageCount()); assertEquals(expectedCount.getTransferDeadLetterMessageCount(), info.getTransferDeadLetterMessageCount()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -378,7 +375,8 @@ void getQueueRuntimePropertiesWithResponse() throws IOException { assertEquals(expectedCount.getTransferDeadLetterMessageCount(), info.getTransferDeadLetterMessageCount()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -398,8 +396,9 @@ void getSubscriptionRuntimePropertiesUnauthorised(String errorMessage, ServiceBu // Act & Assert StepVerifier.create(client.getSubscriptionRuntimeProperties(topicName, subscriptionName)) - .verifyErrorMatches(error -> error instanceof ClientAuthenticationException - && error.getMessage().equals(errorMessage)); + .expectErrorMatches(error -> error instanceof ClientAuthenticationException + && error.getMessage().equals(errorMessage)) + .verify(DEFAULT_TIMEOUT); } /** @@ -481,7 +480,8 @@ void listQueues() throws IOException { StepVerifier.create(client.listQueues()) .expectNextCount(firstEntries.size()) .expectNextCount(secondEntries.size()) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -515,7 +515,8 @@ void updateQueue() throws IOException { // Act & Assert StepVerifier.create(client.updateQueue(properties)) .assertNext(e -> assertEquals(updatedName, e.getName())) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } @Test @@ -559,7 +560,8 @@ void updateQueueWithResponse() throws IOException { assertResponse(objectResponse, response); assertEquals(updatedName, response.getValue().getName()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } static Stream getSubscriptionRuntimePropertiesUnauthorised() { diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationClientTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationClientTest.java index a5ff965d9f96..274941a9e9ae 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationClientTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationClientTest.java @@ -25,21 +25,17 @@ import com.azure.messaging.servicebus.administration.models.QueueProperties; import com.azure.messaging.servicebus.administration.models.QueueRuntimeProperties; import io.netty.handler.codec.http.HttpResponseStatus; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import reactor.test.StepVerifier; import java.io.IOException; import java.time.Duration; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -88,18 +84,6 @@ class ServiceBusAdministrationClientTest { private final String dummyEndpoint = "endpoint.servicebus.foo"; private AutoCloseable mockClosable; - private ServiceBusAdministrationAsyncClient asyncClient; - private HashMap map = new HashMap<>(); - - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(5)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } @BeforeEach void beforeEach() throws IOException { @@ -121,7 +105,6 @@ void beforeEach() throws IOException { when(objectResponse.getValue()).thenReturn(queueDescriptionEntry); when(entitys.putWithResponse(any(), any(), any(), any())).thenReturn(objectResponse); - asyncClient = new ServiceBusAdministrationAsyncClient(serviceClient, serializer); client = new ServiceBusAdministrationClient(serviceClient, serializer); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ManagementChannelTests.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ManagementChannelTests.java index 9b712904fcc5..1b6c72987f40 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ManagementChannelTests.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ManagementChannelTests.java @@ -9,7 +9,11 @@ import com.azure.core.amqp.implementation.TokenManager; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.servicebus.*; +import com.azure.messaging.servicebus.ServiceBusErrorSource; +import com.azure.messaging.servicebus.ServiceBusException; +import com.azure.messaging.servicebus.ServiceBusExceptionTestHelper; +import com.azure.messaging.servicebus.ServiceBusFailureReason; +import com.azure.messaging.servicebus.ServiceBusTransactionContext; import com.azure.messaging.servicebus.administration.models.CorrelationRuleFilter; import com.azure.messaging.servicebus.administration.models.CreateRuleOptions; import com.azure.messaging.servicebus.administration.models.SqlRuleFilter; @@ -23,10 +27,8 @@ import org.apache.qpid.proton.amqp.transaction.TransactionalState; import org.apache.qpid.proton.amqp.transport.DeliveryState; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -47,11 +49,11 @@ import java.time.Instant; import java.time.OffsetDateTime; import java.time.ZoneOffset; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.UUID; -import java.util.ArrayList; import java.util.stream.Stream; import static com.azure.messaging.servicebus.implementation.ManagementConstants.ASSOCIATED_LINK_NAME_KEY; @@ -129,16 +131,6 @@ class ManagementChannelTests { @Captor private ArgumentCaptor amqpDeliveryStateCaptor; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(TIMEOUT); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup(TestInfo testInfo) { LOGGER.info("[{}] Setting up.", testInfo.getDisplayName()); @@ -183,7 +175,7 @@ void setsSessionState(byte[] state) { // Act StepVerifier.create(managementChannel.setSessionState(sessionId, state, LINK_NAME)) .expectComplete() - .verify(); + .verify(TIMEOUT); // Assert verify(requestResponseChannel).sendWithAck(messageCaptor.capture(), isNull()); @@ -220,10 +212,12 @@ void setSessionStateNoSessionId() { // Act & Assert StepVerifier.create(managementChannel.setSessionState(null, sessionState, LINK_NAME)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(TIMEOUT); StepVerifier.create(managementChannel.setSessionState("", sessionState, LINK_NAME)) - .verifyError(IllegalArgumentException.class); + .expectError(IllegalArgumentException.class) + .verify(TIMEOUT); verifyNoInteractions(requestResponseChannel); } @@ -245,7 +239,8 @@ void getSessionState() { // Act & Assert StepVerifier.create(managementChannel.getSessionState(sessionId, LINK_NAME)) .expectNext(sessionState) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); verify(requestResponseChannel).sendWithAck(messageCaptor.capture(), isNull()); @@ -269,10 +264,12 @@ void getSessionState() { void getSessionStateNoSessionId() { // Act & Assert StepVerifier.create(managementChannel.getSessionState(null, LINK_NAME)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(TIMEOUT); StepVerifier.create(managementChannel.getSessionState("", LINK_NAME)) - .verifyError(IllegalArgumentException.class); + .expectError(IllegalArgumentException.class) + .verify(TIMEOUT); verifyNoInteractions(requestResponseChannel); } @@ -291,7 +288,8 @@ void getSessionStateNull() { // Act & Assert StepVerifier.create(managementChannel.getSessionState(sessionId, LINK_NAME)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); verify(requestResponseChannel).sendWithAck(messageCaptor.capture(), isNull()); @@ -325,7 +323,8 @@ void renewSessionLock() { // Act & Assert StepVerifier.create(managementChannel.renewSessionLock(sessionId, LINK_NAME)) .assertNext(expiration -> assertEquals(instant.atOffset(ZoneOffset.UTC), expiration)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); verify(requestResponseChannel).sendWithAck(messageCaptor.capture(), isNull()); @@ -349,10 +348,12 @@ void renewSessionLock() { void renewSessionLockNoSessionId() { // Act & Assert StepVerifier.create(managementChannel.renewSessionLock(null, LINK_NAME)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(TIMEOUT); StepVerifier.create(managementChannel.renewSessionLock("", LINK_NAME)) - .verifyError(IllegalArgumentException.class); + .expectError(IllegalArgumentException.class) + .verify(TIMEOUT); verifyNoInteractions(requestResponseChannel); } @@ -379,7 +380,8 @@ void updateDisposition(String sessionId, String associatedLinkName) { StepVerifier.create(managementChannel.updateDisposition(lockToken.toString(), DispositionStatus.SUSPENDED, options.getDeadLetterReason(), options.getDeadLetterErrorDescription(), options.getPropertiesToModify(), sessionId, associatedLinkName, null)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); // Verify the contents of our request to make sure the correct properties were given. verify(requestResponseChannel).sendWithAck(messageCaptor.capture(), isNull()); @@ -442,7 +444,8 @@ void updateDispositionWithTransaction() { StepVerifier.create(managementChannel.updateDisposition(lockToken.toString(), DispositionStatus.SUSPENDED, options.getDeadLetterReason(), options.getDeadLetterErrorDescription(), options.getPropertiesToModify(), null, associatedLinkName, mockTransaction)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); // Verify the contents of our request to make sure the correct properties were given. verify(requestResponseChannel).sendWithAck(any(Message.class), amqpDeliveryStateCaptor.capture()); @@ -470,7 +473,7 @@ void unauthorized() { assertEquals(ServiceBusFailureReason.UNAUTHORIZED, ((ServiceBusException) error).getReason()); assertFalse(((ServiceBusException) error).isTransient()); }) - .verify(); + .verify(TIMEOUT); StepVerifier.create(managementChannel.renewMessageLock(sessionId, LINK_NAME)) .expectErrorSatisfies(error -> { @@ -479,7 +482,7 @@ void unauthorized() { assertEquals(ServiceBusFailureReason.UNAUTHORIZED, ((ServiceBusException) error).getReason()); assertFalse(((ServiceBusException) error).isTransient()); }) - .verify(); + .verify(TIMEOUT); StepVerifier.create(managementChannel.renewMessageLock(sessionId, LINK_NAME)) .expectErrorSatisfies(error -> { @@ -488,7 +491,7 @@ void unauthorized() { assertEquals(ServiceBusFailureReason.UNAUTHORIZED, ((ServiceBusException) error).getReason()); assertFalse(((ServiceBusException) error).isTransient()); }) - .verify(); + .verify(TIMEOUT); StepVerifier.create(managementChannel.renewSessionLock(sessionId, LINK_NAME)) .expectErrorSatisfies(error -> { @@ -497,7 +500,7 @@ void unauthorized() { assertEquals(ServiceBusFailureReason.UNAUTHORIZED, ((ServiceBusException) error).getReason()); assertFalse(((ServiceBusException) error).isTransient()); }) - .verify(); + .verify(TIMEOUT); StepVerifier.create(managementChannel.setSessionState(sessionId, new byte[0], LINK_NAME)) .expectErrorSatisfies(error -> { @@ -506,7 +509,7 @@ void unauthorized() { assertEquals(ServiceBusFailureReason.UNAUTHORIZED, ((ServiceBusException) error).getReason()); assertFalse(((ServiceBusException) error).isTransient()); }) - .verify(); + .verify(TIMEOUT); StepVerifier.create(managementChannel.schedule(new ArrayList<>(), OffsetDateTime.now(), 1, LINK_NAME, null)) .expectErrorSatisfies(error -> { @@ -515,7 +518,7 @@ void unauthorized() { assertEquals(ServiceBusFailureReason.UNAUTHORIZED, ((ServiceBusException) error).getReason()); assertFalse(((ServiceBusException) error).isTransient()); }) - .verify(); + .verify(TIMEOUT); StepVerifier.create(managementChannel.updateDisposition(UUID.randomUUID().toString(), DispositionStatus.ABANDONED, "", "", @@ -526,28 +529,31 @@ void unauthorized() { assertEquals(ServiceBusFailureReason.UNAUTHORIZED, ((ServiceBusException) error).getReason()); assertFalse(((ServiceBusException) error).isTransient()); }) - .verify(); + .verify(TIMEOUT); } @Test void getDeferredMessagesWithEmptyArrayReturnsAnEmptyFlux() { // Arrange, act, assert StepVerifier.create(managementChannel.receiveDeferredMessages(ServiceBusReceiveMode.PEEK_LOCK, null, null, new ArrayList<>())) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } @Test void getDeferredMessagesWithNullThrows() { // Arrange, act, assert StepVerifier.create(managementChannel.receiveDeferredMessages(ServiceBusReceiveMode.PEEK_LOCK, null, null, null)) - .verifyError(NullPointerException.class); + .expectError(NullPointerException.class) + .verify(TIMEOUT); } @Test void cancelScheduledMessagesWithEmptyIterable() { // Arrange, act, assert StepVerifier.create(managementChannel.cancelScheduledMessages(new ArrayList<>(), null)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); } @Test @@ -558,7 +564,8 @@ void createRule() { // Act & Assert StepVerifier.create(managementChannel.createRule(ruleName, options)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); verify(requestResponseChannel).sendWithAck(messageCaptor.capture(), isNull()); @@ -602,7 +609,8 @@ void getRules() { assertEquals("new-sql-filter", ruleProperties.getName()); assertEquals(ruleProperties.getFilter(), new TrueRuleFilter()); }) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); verify(requestResponseChannel).sendWithAck(messageCaptor.capture(), isNull()); @@ -624,7 +632,8 @@ void deleteRule() { // Act & Assert StepVerifier.create(managementChannel.deleteRule(ruleName)) - .verifyComplete(); + .expectComplete() + .verify(TIMEOUT); verify(requestResponseChannel).sendWithAck(messageCaptor.capture(), isNull()); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusAdministrationClientImplIntegrationTests.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusAdministrationClientImplIntegrationTests.java index ed6e0ca7e4a5..b9dc6f7a2190 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusAdministrationClientImplIntegrationTests.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusAdministrationClientImplIntegrationTests.java @@ -29,8 +29,6 @@ import com.azure.messaging.servicebus.administration.implementation.models.QueueDescriptionFeedImpl; import com.azure.messaging.servicebus.administration.implementation.models.QueueDescriptionImpl; import com.azure.messaging.servicebus.administration.models.CreateQueueOptions; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import reactor.test.StepVerifier; @@ -51,19 +49,10 @@ */ class ServiceBusAdministrationClientImplIntegrationTests extends TestProxyTestBase { private static final ClientLogger LOGGER = new ClientLogger(ServiceBusAdministrationClientImplIntegrationTests.class); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private final ServiceBusManagementSerializer serializer = new ServiceBusManagementSerializer(); private final Duration timeout = Duration.ofSeconds(30); - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - /** * Verifies we can get queue information. */ @@ -86,7 +75,8 @@ void getQueueImplementation(HttpClient httpClient) { assertNotNull(properties); assertFalse(properties.getLockDuration().isZero()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -125,7 +115,8 @@ void createQueueImplementation(HttpClient httpClient) { assertNotNull(deserialize); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -160,7 +151,8 @@ void deleteQueueImplementation(HttpClient httpClient) { .assertNext(deletedResponse -> { assertEquals(200, deletedResponse.getStatusCode()); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -199,7 +191,9 @@ void editQueueImplementation(HttpClient httpClient) { .assertNext(update -> { final QueueDescriptionEntryImpl updatedProperties = deserialize(update, QueueDescriptionEntryImpl.class); assertNotNull(updatedProperties); - }).verifyComplete(); + }) + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -228,7 +222,8 @@ void listQueuesImplementation(HttpClient httpClient) { assertNotNull(deserialize.getEntry()); assertTrue(deserialize.getEntry().size() > 2); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } private ServiceBusManagementClientImpl createClient(HttpClient httpClient) { diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorReceiverTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorReceiverTest.java index a0dc8642726e..e9745cc3cb8d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorReceiverTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorReceiverTest.java @@ -18,9 +18,7 @@ import org.apache.qpid.proton.engine.Delivery; import org.apache.qpid.proton.engine.EndpointState; import org.apache.qpid.proton.engine.Receiver; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -54,13 +52,13 @@ class ServiceBusReactorReceiverTest { private static final String ENTITY_PATH = "queue-name"; private static final String LINK_NAME = "a-link-name"; private static final String CONNECTION_ID = "a-connection-id"; + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(60); private static final ClientLogger LOGGER = new ClientLogger(ServiceBusReactorReceiver.class); private final EmitterProcessor endpointStates = EmitterProcessor.create(); private final FluxSink endpointStatesSink = endpointStates.sink(); private final EmitterProcessor deliveryProcessor = EmitterProcessor.create(); - private final FluxSink deliverySink = deliveryProcessor.sink(); @Mock private Receiver receiver; @@ -79,16 +77,6 @@ class ServiceBusReactorReceiverTest { private ServiceBusReactorReceiver reactorReceiver; private AutoCloseable openMocks; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(60)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup(TestInfo testInfo) throws IOException { LOGGER.info("[{}] Setting up.", testInfo.getDisplayName()); @@ -146,7 +134,8 @@ void getsSessionId() { StepVerifier.create(reactorReceiver.getSessionId()) .then(() -> endpointStatesSink.next(EndpointState.ACTIVE)) .expectNext(actualSession) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -164,7 +153,8 @@ void sessionReceiverNoSessionId() { // Act & Assert StepVerifier.create(reactorReceiver.getSessionId()) .then(() -> endpointStatesSink.next(EndpointState.ACTIVE)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } /** @@ -187,6 +177,7 @@ void getSessionLockedUntil() { StepVerifier.create(reactorReceiver.getSessionLockedUntil()) .then(() -> endpointStatesSink.next(EndpointState.ACTIVE)) .expectNext(lockedUntil) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorSessionTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorSessionTest.java index 6cd68a6c5ddd..b1ecf3b0eaa1 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorSessionTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReactorSessionTest.java @@ -32,9 +32,7 @@ import org.apache.qpid.proton.engine.Session; import org.apache.qpid.proton.reactor.Reactor; import org.apache.qpid.proton.reactor.Selectable; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; @@ -125,16 +123,6 @@ public class ServiceBusReactorSessionTest { private ServiceBusReactorSession serviceBusReactorSession; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(60)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup(TestInfo testInfo) { LOGGER.info("[{}] Setting up.", testInfo.getDisplayName()); @@ -252,7 +240,8 @@ void createViaSenderLinkDestinationEntityAuthorizeFails() throws IOException { // Act StepVerifier.create(serviceBusReactorSession.createProducer(VIA_ENTITY_PATH_SENDER_LINK_NAME, VIA_ENTITY_PATH, retryOptions.getTryTimeout(), retryPolicy, ENTITY_PATH, CLIENT_IDENTIFIER)) - .verifyError(RuntimeException.class); + .expectError(RuntimeException.class) + .verify(Duration.ofSeconds(60)); // Assert verify(tokenManagerEntity).authorize(); diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessorTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessorTest.java index ea0dde297f4c..3f108c6b6678 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessorTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusReceiveLinkProcessorTest.java @@ -9,10 +9,8 @@ import com.azure.core.amqp.exception.AmqpException; import org.apache.qpid.proton.amqp.transport.DeliveryState; import org.apache.qpid.proton.message.Message; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -79,16 +77,6 @@ class ServiceBusReceiveLinkProcessorTest { private ServiceBusReceiveLinkProcessor linkProcessor; private ServiceBusReceiveLinkProcessor linkProcessorNoPrefetch; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(0)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @BeforeEach void setup() { MockitoAnnotations.initMocks(this); @@ -130,9 +118,7 @@ void createNewLink() throws InterruptedException { // Act & Assert StepVerifier.create(processor) - .then(() -> { - messagePublisher.next(message1, message2); - }) + .then(() -> messagePublisher.next(message1, message2)) .expectNext(message1) .expectNext(message2) .thenCancel() @@ -297,9 +283,8 @@ void newLinkOnRetryableError() { final ServiceBusReceiveLinkProcessor processor = createSink(connections).subscribeWith(linkProcessor); - when(link2.getEndpointStates()).thenReturn(Flux.defer(() -> Flux.create(e -> { - e.next(AmqpEndpointState.ACTIVE); - }))); + when(link2.getEndpointStates()).thenReturn(Flux.defer(() -> + Flux.create(e -> e.next(AmqpEndpointState.ACTIVE)))); when(link2.receive()).thenReturn(Flux.just(message2)); when(link2.addCredits(anyInt())).thenReturn(Mono.empty()); @@ -315,9 +300,7 @@ void newLinkOnRetryableError() { messagePublisher.next(message1); }) .expectNext(message1) - .then(() -> { - endpointProcessor.error(amqpException); - }) + .then(() -> endpointProcessor.error(amqpException)) .expectNext(message2) .thenCancel() .verify(); diff --git a/sdk/signalr/azure-resourcemanager-signalr/CHANGELOG.md b/sdk/signalr/azure-resourcemanager-signalr/CHANGELOG.md index 154399f73c2a..62fab5734588 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/CHANGELOG.md +++ b/sdk/signalr/azure-resourcemanager-signalr/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.7 (Unreleased) +## 1.0.0-beta.8 (Unreleased) ### Features Added @@ -10,6 +10,49 @@ ### Other Changes +## 1.0.0-beta.7 (2023-09-14) + +- Azure Resource Manager SignalR client library for Java. This package contains Microsoft Azure SDK for SignalR Management SDK. REST API for Azure SignalR Service. Package tag package-2023-06-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Breaking Changes + +#### `models.CustomDomain` was modified + +* `systemData()` was removed + +#### `models.SharedPrivateLinkResource` was modified + +* `systemData()` was removed + +#### `models.CustomCertificate` was modified + +* `systemData()` was removed + +### Features Added + +* `models.SignalRReplicas` was added + +* `models.Replica` was added + +* `models.Replica$Update` was added + +* `models.ReplicaList` was added + +* `models.Replica$DefinitionStages` was added + +* `models.Replica$UpdateStages` was added + +* `models.Replica$Definition` was added + +#### `models.SignalRs` was modified + +* `listReplicaSkusWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `listReplicaSkus(java.lang.String,java.lang.String,java.lang.String)` was added + +#### `SignalRManager` was modified + +* `signalRReplicas()` was added + ## 1.0.0-beta.6 (2023-03-20) - Azure Resource Manager SignalR client library for Java. This package contains Microsoft Azure SDK for SignalR Management SDK. REST API for Azure SignalR Service. Package tag package-2023-02-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/signalr/azure-resourcemanager-signalr/README.md b/sdk/signalr/azure-resourcemanager-signalr/README.md index b78bd3735cf8..4ca735173f6d 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/README.md +++ b/sdk/signalr/azure-resourcemanager-signalr/README.md @@ -2,7 +2,7 @@ Azure Resource Manager SignalR client library for Java. -This package contains Microsoft Azure SDK for SignalR Management SDK. REST API for Azure SignalR Service. Package tag package-2023-02-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for SignalR Management SDK. REST API for Azure SignalR Service. Package tag package-2023-06-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-signalr - 1.0.0-beta.6 + 1.0.0-beta.7 ``` [//]: # ({x-version-update-end}) @@ -103,3 +103,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fsignalr%2Fazure-resourcemanager-signalr%2FREADME.png) diff --git a/sdk/signalr/azure-resourcemanager-signalr/SAMPLE.md b/sdk/signalr/azure-resourcemanager-signalr/SAMPLE.md index d52c1b779236..61c54a1119aa 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/SAMPLE.md +++ b/sdk/signalr/azure-resourcemanager-signalr/SAMPLE.md @@ -14,6 +14,7 @@ - [List](#signalr_list) - [ListByResourceGroup](#signalr_listbyresourcegroup) - [ListKeys](#signalr_listkeys) +- [ListReplicaSkus](#signalr_listreplicaskus) - [ListSkus](#signalr_listskus) - [RegenerateKey](#signalr_regeneratekey) - [Restart](#signalr_restart) @@ -44,6 +45,15 @@ - [List](#signalrprivatelinkresources_list) +## SignalRReplicas + +- [CreateOrUpdate](#signalrreplicas_createorupdate) +- [Delete](#signalrreplicas_delete) +- [Get](#signalrreplicas_get) +- [List](#signalrreplicas_list) +- [Restart](#signalrreplicas_restart) +- [Update](#signalrreplicas_update) + ## SignalRSharedPrivateLinkResources - [CreateOrUpdate](#signalrsharedprivatelinkresources_createorupdate) @@ -60,7 +70,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Operations_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/Operations_List.json */ /** * Sample code: Operations_List. @@ -81,7 +91,7 @@ import com.azure.resourcemanager.signalr.models.NameAvailabilityParameters; /** Samples for SignalR CheckNameAvailability. */ public final class SignalRCheckNameAvailabilitySamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CheckNameAvailability.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_CheckNameAvailability.json */ /** * Sample code: SignalR_CheckNameAvailability. @@ -133,7 +143,7 @@ import java.util.Map; /** Samples for SignalR CreateOrUpdate. */ public final class SignalRCreateOrUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CreateOrUpdate.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_CreateOrUpdate.json */ /** * Sample code: SignalR_CreateOrUpdate. @@ -146,7 +156,7 @@ public final class SignalRCreateOrUpdateSamples { .define("mySignalRService") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") - .withTags(mapOf("key1", "value1")) + .withTags(mapOf("key1", "fakeTokenPlaceholder")) .withSku(new ResourceSku().withName("Premium_P1").withTier(SignalRSkuTier.PREMIUM).withCapacity(1)) .withKind(ServiceKind.SIGNALR) .withIdentity(new ManagedIdentity().withType(ManagedIdentityType.SYSTEM_ASSIGNED)) @@ -208,6 +218,7 @@ public final class SignalRCreateOrUpdateSamples { .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -227,7 +238,7 @@ public final class SignalRCreateOrUpdateSamples { /** Samples for SignalR Delete. */ public final class SignalRDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_Delete.json */ /** * Sample code: SignalR_Delete. @@ -246,7 +257,7 @@ public final class SignalRDeleteSamples { /** Samples for SignalR GetByResourceGroup. */ public final class SignalRGetByResourceGroupSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_Get.json */ /** * Sample code: SignalR_Get. @@ -267,7 +278,7 @@ public final class SignalRGetByResourceGroupSamples { /** Samples for SignalR List. */ public final class SignalRListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListBySubscription.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListBySubscription.json */ /** * Sample code: SignalR_ListBySubscription. @@ -286,7 +297,7 @@ public final class SignalRListSamples { /** Samples for SignalR ListByResourceGroup. */ public final class SignalRListByResourceGroupSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListByResourceGroup.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListByResourceGroup.json */ /** * Sample code: SignalR_ListByResourceGroup. @@ -305,7 +316,7 @@ public final class SignalRListByResourceGroupSamples { /** Samples for SignalR ListKeys. */ public final class SignalRListKeysSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListKeys.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListKeys.json */ /** * Sample code: SignalR_ListKeys. @@ -320,13 +331,35 @@ public final class SignalRListKeysSamples { } ``` +### SignalR_ListReplicaSkus + +```java +/** Samples for SignalR ListReplicaSkus. */ +public final class SignalRListReplicaSkusSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListReplicaSkus.json + */ + /** + * Sample code: SignalR_ListReplicaSkus. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRListReplicaSkus(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRs() + .listReplicaSkusWithResponse( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE); + } +} +``` + ### SignalR_ListSkus ```java /** Samples for SignalR ListSkus. */ public final class SignalRListSkusSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListSkus.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListSkus.json */ /** * Sample code: SignalR_ListSkus. @@ -350,7 +383,7 @@ import com.azure.resourcemanager.signalr.models.RegenerateKeyParameters; /** Samples for SignalR RegenerateKey. */ public final class SignalRRegenerateKeySamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_RegenerateKey.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_RegenerateKey.json */ /** * Sample code: SignalR_RegenerateKey. @@ -375,7 +408,7 @@ public final class SignalRRegenerateKeySamples { /** Samples for SignalR Restart. */ public final class SignalRRestartSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Restart.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_Restart.json */ /** * Sample code: SignalR_Restart. @@ -420,7 +453,7 @@ import java.util.Map; /** Samples for SignalR Update. */ public final class SignalRUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Update.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_Update.json */ /** * Sample code: SignalR_Update. @@ -435,7 +468,7 @@ public final class SignalRUpdateSamples { .getValue(); resource .update() - .withTags(mapOf("key1", "value1")) + .withTags(mapOf("key1", "fakeTokenPlaceholder")) .withSku(new ResourceSku().withName("Premium_P1").withTier(SignalRSkuTier.PREMIUM).withCapacity(1)) .withIdentity(new ManagedIdentity().withType(ManagedIdentityType.SYSTEM_ASSIGNED)) .withTls(new SignalRTlsSettings().withClientCertEnabled(false)) @@ -496,6 +529,7 @@ public final class SignalRUpdateSamples { .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -515,7 +549,7 @@ public final class SignalRUpdateSamples { /** Samples for SignalRCustomCertificates CreateOrUpdate. */ public final class SignalRCustomCertificatesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_CreateOrUpdate.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomCertificates_CreateOrUpdate.json */ /** * Sample code: SignalRCustomCertificates_CreateOrUpdate. @@ -542,7 +576,7 @@ public final class SignalRCustomCertificatesCreateOrUpdateSamples { /** Samples for SignalRCustomCertificates Delete. */ public final class SignalRCustomCertificatesDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomCertificates_Delete.json */ /** * Sample code: SignalRCustomCertificates_Delete. @@ -563,7 +597,7 @@ public final class SignalRCustomCertificatesDeleteSamples { /** Samples for SignalRCustomCertificates Get. */ public final class SignalRCustomCertificatesGetSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomCertificates_Get.json */ /** * Sample code: SignalRCustomCertificates_Get. @@ -584,7 +618,7 @@ public final class SignalRCustomCertificatesGetSamples { /** Samples for SignalRCustomCertificates List. */ public final class SignalRCustomCertificatesListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomCertificates_List.json */ /** * Sample code: SignalRCustomCertificates_List. @@ -607,7 +641,7 @@ import com.azure.resourcemanager.signalr.models.ResourceReference; /** Samples for SignalRCustomDomains CreateOrUpdate. */ public final class SignalRCustomDomainsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_CreateOrUpdate.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomDomains_CreateOrUpdate.json */ /** * Sample code: SignalRCustomDomains_CreateOrUpdate. @@ -635,7 +669,7 @@ public final class SignalRCustomDomainsCreateOrUpdateSamples { /** Samples for SignalRCustomDomains Delete. */ public final class SignalRCustomDomainsDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomDomains_Delete.json */ /** * Sample code: SignalRCustomDomains_Delete. @@ -656,7 +690,7 @@ public final class SignalRCustomDomainsDeleteSamples { /** Samples for SignalRCustomDomains Get. */ public final class SignalRCustomDomainsGetSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomDomains_Get.json */ /** * Sample code: SignalRCustomDomains_Get. @@ -677,7 +711,7 @@ public final class SignalRCustomDomainsGetSamples { /** Samples for SignalRCustomDomains List. */ public final class SignalRCustomDomainsListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomDomains_List.json */ /** * Sample code: SignalRCustomDomains_List. @@ -696,7 +730,7 @@ public final class SignalRCustomDomainsListSamples { /** Samples for SignalRPrivateEndpointConnections Delete. */ public final class SignalRPrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateEndpointConnections_Delete.json */ /** * Sample code: SignalRPrivateEndpointConnections_Delete. @@ -722,7 +756,7 @@ public final class SignalRPrivateEndpointConnectionsDeleteSamples { /** Samples for SignalRPrivateEndpointConnections Get. */ public final class SignalRPrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateEndpointConnections_Get.json */ /** * Sample code: SignalRPrivateEndpointConnections_Get. @@ -747,7 +781,7 @@ public final class SignalRPrivateEndpointConnectionsGetSamples { /** Samples for SignalRPrivateEndpointConnections List. */ public final class SignalRPrivateEndpointConnectionsListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateEndpointConnections_List.json */ /** * Sample code: SignalRPrivateEndpointConnections_List. @@ -773,7 +807,7 @@ import com.azure.resourcemanager.signalr.models.PrivateLinkServiceConnectionStat /** Samples for SignalRPrivateEndpointConnections Update. */ public final class SignalRPrivateEndpointConnectionsUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Update.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateEndpointConnections_Update.json */ /** * Sample code: SignalRPrivateEndpointConnections_Update. @@ -789,10 +823,7 @@ public final class SignalRPrivateEndpointConnectionsUpdateSamples { "myResourceGroup", "mySignalRService", new PrivateEndpointConnectionInner() - .withPrivateEndpoint( - new PrivateEndpoint() - .withId( - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint")) + .withPrivateEndpoint(new PrivateEndpoint()) .withPrivateLinkServiceConnectionState( new PrivateLinkServiceConnectionState() .withStatus(PrivateLinkServiceConnectionStatus.APPROVED) @@ -808,7 +839,7 @@ public final class SignalRPrivateEndpointConnectionsUpdateSamples { /** Samples for SignalRPrivateLinkResources List. */ public final class SignalRPrivateLinkResourcesListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateLinkResources_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateLinkResources_List.json */ /** * Sample code: SignalRPrivateLinkResources_List. @@ -823,13 +854,188 @@ public final class SignalRPrivateLinkResourcesListSamples { } ``` +### SignalRReplicas_CreateOrUpdate + +```java +import com.azure.resourcemanager.signalr.models.ResourceSku; +import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SignalRReplicas CreateOrUpdate. */ +public final class SignalRReplicasCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_CreateOrUpdate.json + */ + /** + * Sample code: SignalRReplicas_CreateOrUpdate. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasCreateOrUpdate(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRReplicas() + .define("mySignalRService-eastus") + .withRegion("eastus") + .withExistingSignalR("myResourceGroup", "mySignalRService") + .withTags(mapOf("key1", "fakeTokenPlaceholder")) + .withSku(new ResourceSku().withName("Premium_P1").withTier(SignalRSkuTier.PREMIUM).withCapacity(1)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SignalRReplicas_Delete + +```java +/** Samples for SignalRReplicas Delete. */ +public final class SignalRReplicasDeleteSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_Delete.json + */ + /** + * Sample code: SignalRReplicas_Delete. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasDelete(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRReplicas() + .deleteWithResponse( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE); + } +} +``` + +### SignalRReplicas_Get + +```java +/** Samples for SignalRReplicas Get. */ +public final class SignalRReplicasGetSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_Get.json + */ + /** + * Sample code: SignalRReplicas_Get. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasGet(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRReplicas() + .getWithResponse( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE); + } +} +``` + +### SignalRReplicas_List + +```java +/** Samples for SignalRReplicas List. */ +public final class SignalRReplicasListSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_List.json + */ + /** + * Sample code: SignalRReplicas_List. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasList(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager.signalRReplicas().list("myResourceGroup", "mySignalRService", com.azure.core.util.Context.NONE); + } +} +``` + +### SignalRReplicas_Restart + +```java +/** Samples for SignalRReplicas Restart. */ +public final class SignalRReplicasRestartSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_Restart.json + */ + /** + * Sample code: SignalRReplicas_Restart. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasRestart(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRReplicas() + .restart( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE); + } +} +``` + +### SignalRReplicas_Update + +```java +import com.azure.resourcemanager.signalr.models.Replica; +import com.azure.resourcemanager.signalr.models.ResourceSku; +import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SignalRReplicas Update. */ +public final class SignalRReplicasUpdateSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_Update.json + */ + /** + * Sample code: SignalRReplicas_Update. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasUpdate(com.azure.resourcemanager.signalr.SignalRManager manager) { + Replica resource = + manager + .signalRReplicas() + .getWithResponse( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key1", "fakeTokenPlaceholder")) + .withSku(new ResourceSku().withName("Premium_P1").withTier(SignalRSkuTier.PREMIUM).withCapacity(1)) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + ### SignalRSharedPrivateLinkResources_CreateOrUpdate ```java /** Samples for SignalRSharedPrivateLinkResources CreateOrUpdate. */ public final class SignalRSharedPrivateLinkResourcesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json */ /** * Sample code: SignalRSharedPrivateLinkResources_CreateOrUpdate. @@ -857,7 +1063,7 @@ public final class SignalRSharedPrivateLinkResourcesCreateOrUpdateSamples { /** Samples for SignalRSharedPrivateLinkResources Delete. */ public final class SignalRSharedPrivateLinkResourcesDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRSharedPrivateLinkResources_Delete.json */ /** * Sample code: SignalRSharedPrivateLinkResources_Delete. @@ -879,7 +1085,7 @@ public final class SignalRSharedPrivateLinkResourcesDeleteSamples { /** Samples for SignalRSharedPrivateLinkResources Get. */ public final class SignalRSharedPrivateLinkResourcesGetSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRSharedPrivateLinkResources_Get.json */ /** * Sample code: SignalRSharedPrivateLinkResources_Get. @@ -900,7 +1106,7 @@ public final class SignalRSharedPrivateLinkResourcesGetSamples { /** Samples for SignalRSharedPrivateLinkResources List. */ public final class SignalRSharedPrivateLinkResourcesListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRSharedPrivateLinkResources_List.json */ /** * Sample code: SignalRSharedPrivateLinkResources_List. @@ -921,7 +1127,7 @@ public final class SignalRSharedPrivateLinkResourcesListSamples { /** Samples for Usages List. */ public final class UsagesListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Usages_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/Usages_List.json */ /** * Sample code: Usages_List. diff --git a/sdk/signalr/azure-resourcemanager-signalr/pom.xml b/sdk/signalr/azure-resourcemanager-signalr/pom.xml index d4d1d3e04e23..64d5b1150f6c 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/pom.xml +++ b/sdk/signalr/azure-resourcemanager-signalr/pom.xml @@ -14,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-signalr - 1.0.0-beta.7 + 1.0.0-beta.8 jar Microsoft Azure SDK for SignalR Management - This package contains Microsoft Azure SDK for SignalR Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure SignalR Service. Package tag package-2023-02-01. + This package contains Microsoft Azure SDK for SignalR Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure SignalR Service. Package tag package-2023-06-01-preview. https://github.com/Azure/azure-sdk-for-java @@ -45,6 +45,7 @@ UTF-8 0 0 + true diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/SignalRManager.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/SignalRManager.java index fa74c1fd9e07..8f42eaec6054 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/SignalRManager.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/SignalRManager.java @@ -30,6 +30,7 @@ import com.azure.resourcemanager.signalr.implementation.SignalRManagementClientBuilder; import com.azure.resourcemanager.signalr.implementation.SignalRPrivateEndpointConnectionsImpl; import com.azure.resourcemanager.signalr.implementation.SignalRPrivateLinkResourcesImpl; +import com.azure.resourcemanager.signalr.implementation.SignalRReplicasImpl; import com.azure.resourcemanager.signalr.implementation.SignalRSharedPrivateLinkResourcesImpl; import com.azure.resourcemanager.signalr.implementation.SignalRsImpl; import com.azure.resourcemanager.signalr.implementation.UsagesImpl; @@ -38,6 +39,7 @@ import com.azure.resourcemanager.signalr.models.SignalRCustomDomains; import com.azure.resourcemanager.signalr.models.SignalRPrivateEndpointConnections; import com.azure.resourcemanager.signalr.models.SignalRPrivateLinkResources; +import com.azure.resourcemanager.signalr.models.SignalRReplicas; import com.azure.resourcemanager.signalr.models.SignalRSharedPrivateLinkResources; import com.azure.resourcemanager.signalr.models.SignalRs; import com.azure.resourcemanager.signalr.models.Usages; @@ -64,6 +66,8 @@ public final class SignalRManager { private SignalRPrivateLinkResources signalRPrivateLinkResources; + private SignalRReplicas signalRReplicas; + private SignalRSharedPrivateLinkResources signalRSharedPrivateLinkResources; private final SignalRManagementClient clientObject; @@ -231,7 +235,7 @@ public SignalRManager authenticate(TokenCredential credential, AzureProfile prof .append("-") .append("com.azure.resourcemanager.signalr") .append("/") - .append("1.0.0-beta.6"); + .append("1.0.0-beta.7"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -375,6 +379,18 @@ public SignalRPrivateLinkResources signalRPrivateLinkResources() { return signalRPrivateLinkResources; } + /** + * Gets the resource collection API of SignalRReplicas. It manages Replica. + * + * @return Resource collection API of SignalRReplicas. + */ + public SignalRReplicas signalRReplicas() { + if (this.signalRReplicas == null) { + this.signalRReplicas = new SignalRReplicasImpl(clientObject.getSignalRReplicas(), this); + } + return signalRReplicas; + } + /** * Gets the resource collection API of SignalRSharedPrivateLinkResources. It manages SharedPrivateLinkResource. * @@ -389,8 +405,10 @@ public SignalRSharedPrivateLinkResources signalRSharedPrivateLinkResources() { } /** - * @return Wrapped service client SignalRManagementClient providing direct access to the underlying auto-generated - * API implementation, based on Azure REST API. + * Gets wrapped service client SignalRManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client SignalRManagementClient. */ public SignalRManagementClient serviceClient() { return this.clientObject; diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRCustomCertificatesClient.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRCustomCertificatesClient.java index b0f0fdff2ec8..e6ce1f38ebab 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRCustomCertificatesClient.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRCustomCertificatesClient.java @@ -18,8 +18,7 @@ public interface SignalRCustomCertificatesClient { /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -32,8 +31,7 @@ public interface SignalRCustomCertificatesClient { /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -47,8 +45,7 @@ public interface SignalRCustomCertificatesClient { /** * Get a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param context The context to associate with this operation. @@ -64,8 +61,7 @@ Response getWithResponse( /** * Get a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -79,8 +75,7 @@ Response getWithResponse( /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -96,8 +91,7 @@ SyncPoller, CustomCertificateInner> beginCrea /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -118,8 +112,7 @@ SyncPoller, CustomCertificateInner> beginCrea /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -135,8 +128,7 @@ CustomCertificateInner createOrUpdate( /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -157,8 +149,7 @@ CustomCertificateInner createOrUpdate( /** * Delete a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param context The context to associate with this operation. @@ -174,8 +165,7 @@ Response deleteWithResponse( /** * Delete a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRCustomDomainsClient.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRCustomDomainsClient.java index beb788760f70..3c55fb7f05dd 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRCustomDomainsClient.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRCustomDomainsClient.java @@ -18,8 +18,7 @@ public interface SignalRCustomDomainsClient { /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -32,8 +31,7 @@ public interface SignalRCustomDomainsClient { /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -47,8 +45,7 @@ public interface SignalRCustomDomainsClient { /** * Get a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. @@ -64,8 +61,7 @@ Response getWithResponse( /** * Get a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -79,8 +75,7 @@ Response getWithResponse( /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -96,8 +91,7 @@ SyncPoller, CustomDomainInner> beginCreateOrUpdate /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -114,8 +108,7 @@ SyncPoller, CustomDomainInner> beginCreateOrUpdate /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -131,8 +124,7 @@ CustomDomainInner createOrUpdate( /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -149,8 +141,7 @@ CustomDomainInner createOrUpdate( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -164,8 +155,7 @@ CustomDomainInner createOrUpdate( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. @@ -181,8 +171,7 @@ SyncPoller, Void> beginDelete( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -195,8 +184,7 @@ SyncPoller, Void> beginDelete( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRManagementClient.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRManagementClient.java index 2000fcc6df6b..faa9060e3bf6 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRManagementClient.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRManagementClient.java @@ -10,8 +10,7 @@ /** The interface for SignalRManagementClient class. */ public interface SignalRManagementClient { /** - * Gets Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms - * part of the URI for every service call. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -94,6 +93,13 @@ public interface SignalRManagementClient { */ SignalRPrivateLinkResourcesClient getSignalRPrivateLinkResources(); + /** + * Gets the SignalRReplicasClient object to access its operations. + * + * @return the SignalRReplicasClient object. + */ + SignalRReplicasClient getSignalRReplicas(); + /** * Gets the SignalRSharedPrivateLinkResourcesClient object to access its operations. * diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRPrivateEndpointConnectionsClient.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRPrivateEndpointConnectionsClient.java index c946055af5e7..c0d48b62cf87 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRPrivateEndpointConnectionsClient.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRPrivateEndpointConnectionsClient.java @@ -20,8 +20,7 @@ public interface SignalRPrivateEndpointConnectionsClient { /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -34,8 +33,7 @@ public interface SignalRPrivateEndpointConnectionsClient { /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -49,9 +47,9 @@ public interface SignalRPrivateEndpointConnectionsClient { /** * Get the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -66,9 +64,9 @@ Response getWithResponse( /** * Get the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -82,9 +80,9 @@ PrivateEndpointConnectionInner get( /** * Update the state of specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The resource of private endpoint and its properties. * @param context The context to associate with this operation. @@ -104,9 +102,9 @@ Response updateWithResponse( /** * Update the state of specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The resource of private endpoint and its properties. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -124,9 +122,9 @@ PrivateEndpointConnectionInner update( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -140,9 +138,9 @@ SyncPoller, Void> beginDelete( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -157,9 +155,9 @@ SyncPoller, Void> beginDelete( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -171,9 +169,9 @@ SyncPoller, Void> beginDelete( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRPrivateLinkResourcesClient.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRPrivateLinkResourcesClient.java index cf37f7046317..5720aed2289a 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRPrivateLinkResourcesClient.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRPrivateLinkResourcesClient.java @@ -15,8 +15,7 @@ public interface SignalRPrivateLinkResourcesClient { /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -30,8 +29,7 @@ public interface SignalRPrivateLinkResourcesClient { /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRReplicasClient.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRReplicasClient.java new file mode 100644 index 000000000000..c5e89dac3f94 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRReplicasClient.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.signalr.fluent.models.ReplicaInner; + +/** An instance of this class provides access to all the operations defined in SignalRReplicasClient. */ +public interface SignalRReplicasClient { + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String resourceName); + + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String resourceName, Context context); + + /** + * Get the replica and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context); + + /** + * Get the replica and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicaInner get(String resourceGroupName, String resourceName, String replicaName); + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReplicaInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters); + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReplicaInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context); + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicaInner createOrUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters); + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicaInner createOrUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context); + + /** + * Operation to delete a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context); + + /** + * Operation to delete a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName, String replicaName); + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReplicaInner> beginUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters); + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReplicaInner> beginUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context); + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicaInner update(String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters); + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicaInner update( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context); + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String resourceName, String replicaName); + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String resourceGroupName, String resourceName, String replicaName, Context context); + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String resourceName, String replicaName); + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String resourceName, String replicaName, Context context); +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRSharedPrivateLinkResourcesClient.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRSharedPrivateLinkResourcesClient.java index 3d079df6ec35..c11bae9e0a0b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRSharedPrivateLinkResourcesClient.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRSharedPrivateLinkResourcesClient.java @@ -20,8 +20,7 @@ public interface SignalRSharedPrivateLinkResourcesClient { /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -34,8 +33,7 @@ public interface SignalRSharedPrivateLinkResourcesClient { /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -50,8 +48,7 @@ public interface SignalRSharedPrivateLinkResourcesClient { * Get the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -67,8 +64,7 @@ Response getWithResponse( * Get the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -83,8 +79,7 @@ SharedPrivateLinkResourceInner get( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -103,8 +98,7 @@ SyncPoller, SharedPrivateLinkResource * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @param context The context to associate with this operation. @@ -125,8 +119,7 @@ SyncPoller, SharedPrivateLinkResource * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -145,8 +138,7 @@ SharedPrivateLinkResourceInner createOrUpdate( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @param context The context to associate with this operation. @@ -167,8 +159,7 @@ SharedPrivateLinkResourceInner createOrUpdate( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -183,8 +174,7 @@ SyncPoller, Void> beginDelete( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -200,8 +190,7 @@ SyncPoller, Void> beginDelete( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -214,8 +203,7 @@ SyncPoller, Void> beginDelete( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRsClient.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRsClient.java index ce0e6b669839..b6556ca52c4c 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRsClient.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/SignalRsClient.java @@ -75,8 +75,7 @@ Response checkNameAvailabilityWithResponse( /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -89,8 +88,7 @@ Response checkNameAvailabilityWithResponse( /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -104,8 +102,7 @@ Response checkNameAvailabilityWithResponse( /** * Get the resource and its properties. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -120,8 +117,7 @@ Response getByResourceGroupWithResponse( /** * Get the resource and its properties. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -134,8 +130,7 @@ Response getByResourceGroupWithResponse( /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -150,8 +145,7 @@ SyncPoller, SignalRResourceInner> beginCreateOr /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @param context The context to associate with this operation. @@ -167,8 +161,7 @@ SyncPoller, SignalRResourceInner> beginCreateOr /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -182,8 +175,7 @@ SyncPoller, SignalRResourceInner> beginCreateOr /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @param context The context to associate with this operation. @@ -199,8 +191,7 @@ SignalRResourceInner createOrUpdate( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -213,8 +204,7 @@ SignalRResourceInner createOrUpdate( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -228,8 +218,7 @@ SignalRResourceInner createOrUpdate( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -241,8 +230,7 @@ SignalRResourceInner createOrUpdate( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -255,8 +243,7 @@ SignalRResourceInner createOrUpdate( /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -271,8 +258,7 @@ SyncPoller, SignalRResourceInner> beginUpdate( /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @param context The context to associate with this operation. @@ -288,8 +274,7 @@ SyncPoller, SignalRResourceInner> beginUpdate( /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -303,8 +288,7 @@ SyncPoller, SignalRResourceInner> beginUpdate( /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @param context The context to associate with this operation. @@ -320,8 +304,7 @@ SignalRResourceInner update( /** * Get the access keys of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -335,8 +318,7 @@ SignalRResourceInner update( /** * Get the access keys of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -349,8 +331,7 @@ SignalRResourceInner update( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -365,8 +346,7 @@ SyncPoller, SignalRKeysInner> beginRegenerateKey( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @param context The context to associate with this operation. @@ -382,8 +362,7 @@ SyncPoller, SignalRKeysInner> beginRegenerateKey( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -397,8 +376,7 @@ SyncPoller, SignalRKeysInner> beginRegenerateKey( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @param context The context to associate with this operation. @@ -411,11 +389,40 @@ SyncPoller, SignalRKeysInner> beginRegenerateKey( SignalRKeysInner regenerateKey( String resourceGroupName, String resourceName, RegenerateKeyParameters parameters, Context context); + /** + * List all available skus of the replica resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list skus operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listReplicaSkusWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context); + + /** + * List all available skus of the replica resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list skus operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SkuListInner listReplicaSkus(String resourceGroupName, String resourceName, String replicaName); + /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -428,8 +435,7 @@ SignalRKeysInner regenerateKey( /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -443,8 +449,7 @@ SignalRKeysInner regenerateKey( /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -456,8 +461,7 @@ SignalRKeysInner regenerateKey( /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -470,8 +474,7 @@ SignalRKeysInner regenerateKey( /** * List all available skus of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -485,8 +488,7 @@ SignalRKeysInner regenerateKey( /** * List all available skus of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/CustomCertificateInner.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/CustomCertificateInner.java index 1100397c6590..6267d56d50de 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/CustomCertificateInner.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/CustomCertificateInner.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.signalr.models.ProvisioningState; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,12 +13,6 @@ /** A custom certificate. */ @Fluent public final class CustomCertificateInner extends ProxyResource { - /* - * Metadata pertaining to creation and last modification of the resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /* * Custom certificate properties. */ @@ -30,15 +23,6 @@ public final class CustomCertificateInner extends ProxyResource { public CustomCertificateInner() { } - /** - * Get the systemData property: Metadata pertaining to creation and last modification of the resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the innerProperties property: Custom certificate properties. * diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/CustomDomainInner.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/CustomDomainInner.java index 18489b6ede61..8e004622959f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/CustomDomainInner.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/CustomDomainInner.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.signalr.models.ProvisioningState; import com.azure.resourcemanager.signalr.models.ResourceReference; @@ -15,12 +14,6 @@ /** A custom domain. */ @Fluent public final class CustomDomainInner extends ProxyResource { - /* - * Metadata pertaining to creation and last modification of the resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /* * Properties of a custom domain. */ @@ -31,15 +24,6 @@ public final class CustomDomainInner extends ProxyResource { public CustomDomainInner() { } - /** - * Get the systemData property: Metadata pertaining to creation and last modification of the resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the innerProperties property: Properties of a custom domain. * diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/PrivateEndpointConnectionInner.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/PrivateEndpointConnectionInner.java index 1e98cb6ee9d8..b3396e23b47b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/PrivateEndpointConnectionInner.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/PrivateEndpointConnectionInner.java @@ -16,38 +16,38 @@ /** A private endpoint connection to an azure resource. */ @Fluent public final class PrivateEndpointConnectionInner extends ProxyResource { - /* - * Metadata pertaining to creation and last modification of the resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /* * Private endpoint connection properties */ @JsonProperty(value = "properties") private PrivateEndpointConnectionProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + /** Creates an instance of PrivateEndpointConnectionInner class. */ public PrivateEndpointConnectionInner() { } /** - * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * Get the innerProperties property: Private endpoint connection properties. * - * @return the systemData value. + * @return the innerProperties value. */ - public SystemData systemData() { - return this.systemData; + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; } /** - * Get the innerProperties property: Private endpoint connection properties. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the innerProperties value. + * @return the systemData value. */ - private PrivateEndpointConnectionProperties innerProperties() { - return this.innerProperties; + public SystemData systemData() { + return this.systemData; } /** diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/ReplicaInner.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/ReplicaInner.java new file mode 100644 index 000000000000..b1a34640fe69 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/ReplicaInner.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.signalr.models.ProvisioningState; +import com.azure.resourcemanager.signalr.models.ResourceSku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A class represent a replica resource. */ +@Fluent +public final class ReplicaInner extends Resource { + /* + * The billing information of the resource. + */ + @JsonProperty(value = "sku") + private ResourceSku sku; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private ReplicaProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ReplicaInner class. */ + public ReplicaInner() { + } + + /** + * Get the sku property: The billing information of the resource. + * + * @return the sku value. + */ + public ResourceSku sku() { + return this.sku; + } + + /** + * Set the sku property: The billing information of the resource. + * + * @param sku the sku value to set. + * @return the ReplicaInner object itself. + */ + public ReplicaInner withSku(ResourceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private ReplicaProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public ReplicaInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ReplicaInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/ReplicaProperties.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/ReplicaProperties.java new file mode 100644 index 000000000000..ec8404e44968 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/ReplicaProperties.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.signalr.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ReplicaProperties model. */ +@Immutable +public final class ReplicaProperties { + /* + * Provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of ReplicaProperties class. */ + public ReplicaProperties() { + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/SharedPrivateLinkResourceInner.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/SharedPrivateLinkResourceInner.java index 860a5d370141..bf755af1db4e 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/SharedPrivateLinkResourceInner.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/SharedPrivateLinkResourceInner.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; import com.azure.resourcemanager.signalr.models.ProvisioningState; import com.azure.resourcemanager.signalr.models.SharedPrivateLinkResourceStatus; import com.fasterxml.jackson.annotation.JsonProperty; @@ -14,12 +13,6 @@ /** Describes a Shared Private Link Resource. */ @Fluent public final class SharedPrivateLinkResourceInner extends ProxyResource { - /* - * Metadata pertaining to creation and last modification of the resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /* * Describes the properties of an existing Shared Private Link Resource */ @@ -30,15 +23,6 @@ public final class SharedPrivateLinkResourceInner extends ProxyResource { public SharedPrivateLinkResourceInner() { } - /** - * Get the systemData property: Metadata pertaining to creation and last modification of the resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the innerProperties property: Describes the properties of an existing Shared Private Link Resource. * diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/SignalRResourceInner.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/SignalRResourceInner.java index e3f82f1fd4e0..818bd050ff9a 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/SignalRResourceInner.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/fluent/models/SignalRResourceInner.java @@ -39,7 +39,7 @@ public final class SignalRResourceInner extends Resource { private SignalRProperties innerProperties; /* - * The kind of the service, it can be SignalR or RawWebSockets + * The kind of the service */ @JsonProperty(value = "kind") private ServiceKind kind; @@ -51,7 +51,7 @@ public final class SignalRResourceInner extends Resource { private ManagedIdentity identity; /* - * Metadata pertaining to creation and last modification of the resource. + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; @@ -90,7 +90,7 @@ private SignalRProperties innerProperties() { } /** - * Get the kind property: The kind of the service, it can be SignalR or RawWebSockets. + * Get the kind property: The kind of the service. * * @return the kind value. */ @@ -99,7 +99,7 @@ public ServiceKind kind() { } /** - * Set the kind property: The kind of the service, it can be SignalR or RawWebSockets. + * Set the kind property: The kind of the service. * * @param kind the kind value to set. * @return the SignalRResourceInner object itself. @@ -130,7 +130,7 @@ public SignalRResourceInner withIdentity(ManagedIdentity identity) { } /** - * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/CustomCertificateImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/CustomCertificateImpl.java index b11cb015dd25..7da21e65c90f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/CustomCertificateImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/CustomCertificateImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.signalr.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.signalr.fluent.models.CustomCertificateInner; import com.azure.resourcemanager.signalr.models.CustomCertificate; @@ -28,10 +27,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public ProvisioningState provisioningState() { return this.innerModel().provisioningState(); } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/CustomDomainImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/CustomDomainImpl.java index 5ca7f62bdf1f..152752b7be82 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/CustomDomainImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/CustomDomainImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.signalr.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.signalr.fluent.models.CustomDomainInner; import com.azure.resourcemanager.signalr.models.CustomDomain; @@ -28,10 +27,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public ProvisioningState provisioningState() { return this.innerModel().provisioningState(); } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/ReplicaImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/ReplicaImpl.java new file mode 100644 index 000000000000..6b0d8bd8a79b --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/ReplicaImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.signalr.fluent.models.ReplicaInner; +import com.azure.resourcemanager.signalr.models.ProvisioningState; +import com.azure.resourcemanager.signalr.models.Replica; +import com.azure.resourcemanager.signalr.models.ResourceSku; +import java.util.Collections; +import java.util.Map; + +public final class ReplicaImpl implements Replica, Replica.Definition, Replica.Update { + private ReplicaInner innerObject; + + private final com.azure.resourcemanager.signalr.SignalRManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ResourceSku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ReplicaInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.signalr.SignalRManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private String replicaName; + + public ReplicaImpl withExistingSignalR(String resourceGroupName, String resourceName) { + this.resourceGroupName = resourceGroupName; + this.resourceName = resourceName; + return this; + } + + public Replica create() { + this.innerObject = + serviceManager + .serviceClient() + .getSignalRReplicas() + .createOrUpdate(resourceGroupName, resourceName, replicaName, this.innerModel(), Context.NONE); + return this; + } + + public Replica create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSignalRReplicas() + .createOrUpdate(resourceGroupName, resourceName, replicaName, this.innerModel(), context); + return this; + } + + ReplicaImpl(String name, com.azure.resourcemanager.signalr.SignalRManager serviceManager) { + this.innerObject = new ReplicaInner(); + this.serviceManager = serviceManager; + this.replicaName = name; + } + + public ReplicaImpl update() { + return this; + } + + public Replica apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSignalRReplicas() + .update(resourceGroupName, resourceName, replicaName, this.innerModel(), Context.NONE); + return this; + } + + public Replica apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSignalRReplicas() + .update(resourceGroupName, resourceName, replicaName, this.innerModel(), context); + return this; + } + + ReplicaImpl(ReplicaInner innerObject, com.azure.resourcemanager.signalr.SignalRManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "signalR"); + this.replicaName = Utils.getValueFromIdByName(innerObject.id(), "replicas"); + } + + public Replica refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSignalRReplicas() + .getWithResponse(resourceGroupName, resourceName, replicaName, Context.NONE) + .getValue(); + return this; + } + + public Replica refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSignalRReplicas() + .getWithResponse(resourceGroupName, resourceName, replicaName, context) + .getValue(); + return this; + } + + public void restart() { + serviceManager.signalRReplicas().restart(resourceGroupName, resourceName, replicaName); + } + + public void restart(Context context) { + serviceManager.signalRReplicas().restart(resourceGroupName, resourceName, replicaName, context); + } + + public ReplicaImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ReplicaImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ReplicaImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ReplicaImpl withSku(ResourceSku sku) { + this.innerModel().withSku(sku); + return this; + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SharedPrivateLinkResourceImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SharedPrivateLinkResourceImpl.java index 14ef1aec11bf..ac9bdfb40141 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SharedPrivateLinkResourceImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SharedPrivateLinkResourceImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.signalr.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.signalr.fluent.models.SharedPrivateLinkResourceInner; import com.azure.resourcemanager.signalr.models.ProvisioningState; @@ -29,10 +28,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String groupId() { return this.innerModel().groupId(); } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRCustomCertificatesClientImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRCustomCertificatesClientImpl.java index 951572af1721..9a55a6feaf61 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRCustomCertificatesClientImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRCustomCertificatesClientImpl.java @@ -140,8 +140,7 @@ Mono> listNext( /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -198,8 +197,7 @@ private Mono> listSinglePageAsync( /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -254,8 +252,7 @@ private Mono> listSinglePageAsync( /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -271,8 +268,7 @@ private PagedFlux listAsync(String resourceGroupName, St /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -291,8 +287,7 @@ private PagedFlux listAsync( /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -307,8 +302,7 @@ public PagedIterable list(String resourceGroupName, Stri /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -324,8 +318,7 @@ public PagedIterable list(String resourceGroupName, Stri /** * Get a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -379,8 +372,7 @@ private Mono> getWithResponseAsync( /** * Get a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param context The context to associate with this operation. @@ -432,8 +424,7 @@ private Mono> getWithResponseAsync( /** * Get a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -451,8 +442,7 @@ private Mono getAsync( /** * Get a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param context The context to associate with this operation. @@ -470,8 +460,7 @@ public Response getWithResponse( /** * Get a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -487,8 +476,7 @@ public CustomCertificateInner get(String resourceGroupName, String resourceName, /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -549,8 +537,7 @@ private Mono>> createOrUpdateWithResponseAsync( /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -613,8 +600,7 @@ private Mono>> createOrUpdateWithResponseAsync( /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -641,8 +627,7 @@ private PollerFlux, CustomCertificateInner> b /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -675,8 +660,7 @@ private PollerFlux, CustomCertificateInner> b /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -696,8 +680,7 @@ public SyncPoller, CustomCertificateInner> be /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -722,8 +705,7 @@ public SyncPoller, CustomCertificateInner> be /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -743,8 +725,7 @@ private Mono createOrUpdateAsync( /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -769,8 +750,7 @@ private Mono createOrUpdateAsync( /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -788,8 +768,7 @@ public CustomCertificateInner createOrUpdate( /** * Create or update a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param parameters A custom certificate. @@ -812,8 +791,7 @@ public CustomCertificateInner createOrUpdate( /** * Delete a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -867,8 +845,7 @@ private Mono> deleteWithResponseAsync( /** * Delete a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param context The context to associate with this operation. @@ -920,8 +897,7 @@ private Mono> deleteWithResponseAsync( /** * Delete a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -938,8 +914,7 @@ private Mono deleteAsync(String resourceGroupName, String resourceName, St /** * Delete a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param context The context to associate with this operation. @@ -957,8 +932,7 @@ public Response deleteWithResponse( /** * Delete a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRCustomDomainsClientImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRCustomDomainsClientImpl.java index 8fa70ba6faac..379d7d29547d 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRCustomDomainsClientImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRCustomDomainsClientImpl.java @@ -139,8 +139,7 @@ Mono> listNext( /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -196,8 +195,7 @@ private Mono> listSinglePageAsync(String resour /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -252,8 +250,7 @@ private Mono> listSinglePageAsync( /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -269,8 +266,7 @@ private PagedFlux listAsync(String resourceGroupName, String /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -288,8 +284,7 @@ private PagedFlux listAsync(String resourceGroupName, String /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -304,8 +299,7 @@ public PagedIterable list(String resourceGroupName, String re /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -321,8 +315,7 @@ public PagedIterable list(String resourceGroupName, String re /** * Get a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -375,8 +368,7 @@ private Mono> getWithResponseAsync( /** * Get a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. @@ -427,8 +419,7 @@ private Mono> getWithResponseAsync( /** * Get a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -445,8 +436,7 @@ private Mono getAsync(String resourceGroupName, String resour /** * Get a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. @@ -464,8 +454,7 @@ public Response getWithResponse( /** * Get a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -481,8 +470,7 @@ public CustomDomainInner get(String resourceGroupName, String resourceName, Stri /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -542,8 +530,7 @@ private Mono>> createOrUpdateWithResponseAsync( /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -601,8 +588,7 @@ private Mono>> createOrUpdateWithResponseAsync( /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -629,8 +615,7 @@ private PollerFlux, CustomDomainInner> beginCreate /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -655,8 +640,7 @@ private PollerFlux, CustomDomainInner> beginCreate /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -674,8 +658,7 @@ public SyncPoller, CustomDomainInner> beginCreateO /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -696,8 +679,7 @@ public SyncPoller, CustomDomainInner> beginCreateO /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -717,8 +699,7 @@ private Mono createOrUpdateAsync( /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -739,8 +720,7 @@ private Mono createOrUpdateAsync( /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -758,8 +738,7 @@ public CustomDomainInner createOrUpdate( /** * Create or update a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param parameters A custom domain. @@ -778,8 +757,7 @@ public CustomDomainInner createOrUpdate( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -832,8 +810,7 @@ private Mono>> deleteWithResponseAsync( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. @@ -884,8 +861,7 @@ private Mono>> deleteWithResponseAsync( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -906,8 +882,7 @@ private PollerFlux, Void> beginDeleteAsync( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. @@ -929,8 +904,7 @@ private PollerFlux, Void> beginDeleteAsync( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -946,8 +920,7 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. @@ -965,8 +938,7 @@ public SyncPoller, Void> beginDelete( /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -984,8 +956,7 @@ private Mono deleteAsync(String resourceGroupName, String resourceName, St /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. @@ -1004,8 +975,7 @@ private Mono deleteAsync(String resourceGroupName, String resourceName, St /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1020,8 +990,7 @@ public void delete(String resourceGroupName, String resourceName, String name) { /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRManagementClientBuilder.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRManagementClientBuilder.java index 103877513c87..ef42be73e473 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRManagementClientBuilder.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRManagementClientBuilder.java @@ -18,14 +18,12 @@ @ServiceClientBuilder(serviceClients = {SignalRManagementClientImpl.class}) public final class SignalRManagementClientBuilder { /* - * Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of - * the URI for every service call. + * The ID of the target subscription. The value must be an UUID. */ private String subscriptionId; /** - * Sets Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms - * part of the URI for every service call. + * Sets The ID of the target subscription. The value must be an UUID. * * @param subscriptionId the subscriptionId value. * @return the SignalRManagementClientBuilder. @@ -139,7 +137,7 @@ public SignalRManagementClientImpl buildClient() { localSerializerAdapter, localDefaultPollInterval, localEnvironment, - subscriptionId, + this.subscriptionId, localEndpoint); return client; } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRManagementClientImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRManagementClientImpl.java index 51642936f8d5..dedfcbeaf460 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRManagementClientImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRManagementClientImpl.java @@ -28,6 +28,7 @@ import com.azure.resourcemanager.signalr.fluent.SignalRManagementClient; import com.azure.resourcemanager.signalr.fluent.SignalRPrivateEndpointConnectionsClient; import com.azure.resourcemanager.signalr.fluent.SignalRPrivateLinkResourcesClient; +import com.azure.resourcemanager.signalr.fluent.SignalRReplicasClient; import com.azure.resourcemanager.signalr.fluent.SignalRSharedPrivateLinkResourcesClient; import com.azure.resourcemanager.signalr.fluent.SignalRsClient; import com.azure.resourcemanager.signalr.fluent.UsagesClient; @@ -43,15 +44,11 @@ /** Initializes a new instance of the SignalRManagementClientImpl type. */ @ServiceClient(builder = SignalRManagementClientBuilder.class) public final class SignalRManagementClientImpl implements SignalRManagementClient { - /** - * Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of - * the URI for every service call. - */ + /** The ID of the target subscription. The value must be an UUID. */ private final String subscriptionId; /** - * Gets Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms - * part of the URI for every service call. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -203,6 +200,18 @@ public SignalRPrivateLinkResourcesClient getSignalRPrivateLinkResources() { return this.signalRPrivateLinkResources; } + /** The SignalRReplicasClient object to access its operations. */ + private final SignalRReplicasClient signalRReplicas; + + /** + * Gets the SignalRReplicasClient object to access its operations. + * + * @return the SignalRReplicasClient object. + */ + public SignalRReplicasClient getSignalRReplicas() { + return this.signalRReplicas; + } + /** The SignalRSharedPrivateLinkResourcesClient object to access its operations. */ private final SignalRSharedPrivateLinkResourcesClient signalRSharedPrivateLinkResources; @@ -222,8 +231,7 @@ public SignalRSharedPrivateLinkResourcesClient getSignalRSharedPrivateLinkResour * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param subscriptionId Gets subscription Id which uniquely identify the Microsoft Azure subscription. The - * subscription ID forms part of the URI for every service call. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. * @param endpoint server parameter. */ SignalRManagementClientImpl( @@ -238,7 +246,7 @@ public SignalRSharedPrivateLinkResourcesClient getSignalRSharedPrivateLinkResour this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2023-02-01"; + this.apiVersion = "2023-06-01-preview"; this.operations = new OperationsClientImpl(this); this.signalRs = new SignalRsClientImpl(this); this.usages = new UsagesClientImpl(this); @@ -246,6 +254,7 @@ public SignalRSharedPrivateLinkResourcesClient getSignalRSharedPrivateLinkResour this.signalRCustomDomains = new SignalRCustomDomainsClientImpl(this); this.signalRPrivateEndpointConnections = new SignalRPrivateEndpointConnectionsClientImpl(this); this.signalRPrivateLinkResources = new SignalRPrivateLinkResourcesClientImpl(this); + this.signalRReplicas = new SignalRReplicasClientImpl(this); this.signalRSharedPrivateLinkResources = new SignalRSharedPrivateLinkResourcesClientImpl(this); } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRPrivateEndpointConnectionsClientImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRPrivateEndpointConnectionsClientImpl.java index 5913389ffa0d..aba9cb7cd87b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRPrivateEndpointConnectionsClientImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRPrivateEndpointConnectionsClientImpl.java @@ -144,8 +144,7 @@ Mono> listNext( /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -203,8 +202,7 @@ private Mono> listSinglePageAsync( /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -260,8 +258,7 @@ private Mono> listSinglePageAsync( /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -277,8 +274,7 @@ private PagedFlux listAsync(String resourceGroup /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -297,8 +293,7 @@ private PagedFlux listAsync( /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -313,8 +308,7 @@ public PagedIterable list(String resourceGroupNa /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -331,9 +325,9 @@ public PagedIterable list( /** * Get the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -389,9 +383,9 @@ private Mono> getWithResponseAsync( /** * Get the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -445,9 +439,9 @@ private Mono> getWithResponseAsync( /** * Get the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -464,9 +458,9 @@ private Mono getAsync( /** * Get the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -483,9 +477,9 @@ public Response getWithResponse( /** * Get the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -501,9 +495,9 @@ public PrivateEndpointConnectionInner get( /** * Update the state of specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The resource of private endpoint and its properties. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -569,9 +563,9 @@ private Mono> updateWithResponseAsync( /** * Update the state of specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The resource of private endpoint and its properties. * @param context The context to associate with this operation. @@ -636,9 +630,9 @@ private Mono> updateWithResponseAsync( /** * Update the state of specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The resource of private endpoint and its properties. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -659,9 +653,9 @@ private Mono updateAsync( /** * Update the state of specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The resource of private endpoint and its properties. * @param context The context to associate with this operation. @@ -685,9 +679,9 @@ public Response updateWithResponse( /** * Update the state of specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The resource of private endpoint and its properties. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -709,9 +703,9 @@ public PrivateEndpointConnectionInner update( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -766,9 +760,9 @@ private Mono>> deleteWithResponseAsync( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -821,9 +815,9 @@ private Mono>> deleteWithResponseAsync( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -844,9 +838,9 @@ private PollerFlux, Void> beginDeleteAsync( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -868,9 +862,9 @@ private PollerFlux, Void> beginDeleteAsync( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -886,9 +880,9 @@ public SyncPoller, Void> beginDelete( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -907,9 +901,9 @@ public SyncPoller, Void> beginDelete( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -927,9 +921,9 @@ private Mono deleteAsync( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -948,9 +942,9 @@ private Mono deleteAsync( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -964,9 +958,9 @@ public void delete(String privateEndpointConnectionName, String resourceGroupNam /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRPrivateLinkResourcesClientImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRPrivateLinkResourcesClientImpl.java index 59f963b38768..fb387f2e2603 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRPrivateLinkResourcesClientImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRPrivateLinkResourcesClientImpl.java @@ -86,8 +86,7 @@ Mono> listNext( /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -145,8 +144,7 @@ private Mono> listSinglePageAsync( /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -202,8 +200,7 @@ private Mono> listSinglePageAsync( /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -220,8 +217,7 @@ private PagedFlux listAsync(String resourceGroupName, /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -241,8 +237,7 @@ private PagedFlux listAsync( /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -258,8 +253,7 @@ public PagedIterable list(String resourceGroupName, St /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRReplicasClientImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRReplicasClientImpl.java new file mode 100644 index 000000000000..3b4c75c56599 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRReplicasClientImpl.java @@ -0,0 +1,1547 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.signalr.fluent.SignalRReplicasClient; +import com.azure.resourcemanager.signalr.fluent.models.ReplicaInner; +import com.azure.resourcemanager.signalr.models.ReplicaList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SignalRReplicasClient. */ +public final class SignalRReplicasClientImpl implements SignalRReplicasClient { + /** The proxy service used to perform REST calls. */ + private final SignalRReplicasService service; + + /** The service client containing this operation class. */ + private final SignalRManagementClientImpl client; + + /** + * Initializes an instance of SignalRReplicasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SignalRReplicasClientImpl(SignalRManagementClientImpl client) { + this.service = + RestProxy.create(SignalRReplicasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SignalRManagementClientSignalRReplicas to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SignalRManagementCli") + public interface SignalRReplicasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("replicaName") String replicaName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("replicaName") String replicaName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ReplicaInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("replicaName") String replicaName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("replicaName") String replicaName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ReplicaInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/restart") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("replicaName") String replicaName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String resourceName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, resourceName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String resourceName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, resourceName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String resourceName) { + return new PagedIterable<>(listAsync(resourceGroupName, resourceName)); + } + + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String resourceName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, resourceName, context)); + } + + /** + * Get the replica and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the replica and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the replica and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String resourceName, String replicaName) { + return getWithResponseAsync(resourceGroupName, resourceName, replicaName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the replica and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context) { + return getWithResponseAsync(resourceGroupName, resourceName, replicaName, context).block(); + } + + /** + * Get the replica and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicaInner get(String resourceGroupName, String resourceName, String replicaName) { + return getWithResponse(resourceGroupName, resourceName, replicaName, Context.NONE).getValue(); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReplicaInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, replicaName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ReplicaInner.class, ReplicaInner.class, this.client.getContext()); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReplicaInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, replicaName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ReplicaInner.class, ReplicaInner.class, context); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReplicaInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + return this.beginCreateOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters).getSyncPoller(); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReplicaInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context) + .getSyncPoller(); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicaInner createOrUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + return createOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters).block(); + } + + /** + * Create or update a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the create or update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicaInner createOrUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context).block(); + } + + /** + * Operation to delete a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Operation to delete a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Operation to delete a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName, String replicaName) { + return deleteWithResponseAsync(resourceGroupName, resourceName, replicaName).flatMap(ignored -> Mono.empty()); + } + + /** + * Operation to delete a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context) { + return deleteWithResponseAsync(resourceGroupName, resourceName, replicaName, context).block(); + } + + /** + * Operation to delete a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName, String replicaName) { + deleteWithResponse(resourceGroupName, resourceName, replicaName, Context.NONE); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReplicaInner> beginUpdateAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, resourceName, replicaName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ReplicaInner.class, ReplicaInner.class, this.client.getContext()); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReplicaInner> beginUpdateAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, resourceName, replicaName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ReplicaInner.class, ReplicaInner.class, context); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReplicaInner> beginUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + return this.beginUpdateAsync(resourceGroupName, resourceName, replicaName, parameters).getSyncPoller(); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReplicaInner> beginUpdate( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + return this.beginUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context).getSyncPoller(); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + return beginUpdateAsync(resourceGroupName, resourceName, replicaName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + return beginUpdateAsync(resourceGroupName, resourceName, replicaName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicaInner update( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters) { + return updateAsync(resourceGroupName, resourceName, replicaName, parameters).block(); + } + + /** + * Operation to update an exiting replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param parameters Parameters for the update operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class represent a replica resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicaInner update( + String resourceGroupName, String resourceName, String replicaName, ReplicaInner parameters, Context context) { + return updateAsync(resourceGroupName, resourceName, replicaName, parameters, context).block(); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String resourceName, String replicaName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, resourceName, replicaName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String resourceName, String replicaName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restartWithResponseAsync(resourceGroupName, resourceName, replicaName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String resourceName, String replicaName) { + return this.beginRestartAsync(resourceGroupName, resourceName, replicaName).getSyncPoller(); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String resourceName, String replicaName, Context context) { + return this.beginRestartAsync(resourceGroupName, resourceName, replicaName, context).getSyncPoller(); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String resourceName, String replicaName) { + return beginRestartAsync(resourceGroupName, resourceName, replicaName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync( + String resourceGroupName, String resourceName, String replicaName, Context context) { + return beginRestartAsync(resourceGroupName, resourceName, replicaName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String resourceName, String replicaName) { + restartAsync(resourceGroupName, resourceName, replicaName).block(); + } + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String resourceName, String replicaName, Context context) { + restartAsync(resourceGroupName, resourceName, replicaName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

    The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRReplicasImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRReplicasImpl.java new file mode 100644 index 000000000000..d67130303805 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRReplicasImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.signalr.fluent.SignalRReplicasClient; +import com.azure.resourcemanager.signalr.fluent.models.ReplicaInner; +import com.azure.resourcemanager.signalr.models.Replica; +import com.azure.resourcemanager.signalr.models.SignalRReplicas; + +public final class SignalRReplicasImpl implements SignalRReplicas { + private static final ClientLogger LOGGER = new ClientLogger(SignalRReplicasImpl.class); + + private final SignalRReplicasClient innerClient; + + private final com.azure.resourcemanager.signalr.SignalRManager serviceManager; + + public SignalRReplicasImpl( + SignalRReplicasClient innerClient, com.azure.resourcemanager.signalr.SignalRManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String resourceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, resourceName); + return Utils.mapPage(inner, inner1 -> new ReplicaImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String resourceName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, resourceName, context); + return Utils.mapPage(inner, inner1 -> new ReplicaImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, resourceName, replicaName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ReplicaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Replica get(String resourceGroupName, String resourceName, String replicaName) { + ReplicaInner inner = this.serviceClient().get(resourceGroupName, resourceName, replicaName); + if (inner != null) { + return new ReplicaImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, resourceName, replicaName, context); + } + + public void delete(String resourceGroupName, String resourceName, String replicaName) { + this.serviceClient().delete(resourceGroupName, resourceName, replicaName); + } + + public void restart(String resourceGroupName, String resourceName, String replicaName) { + this.serviceClient().restart(resourceGroupName, resourceName, replicaName); + } + + public void restart(String resourceGroupName, String resourceName, String replicaName, Context context) { + this.serviceClient().restart(resourceGroupName, resourceName, replicaName, context); + } + + public Replica getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "signalR"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'signalR'.", id))); + } + String replicaName = Utils.getValueFromIdByName(id, "replicas"); + if (replicaName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'replicas'.", id))); + } + return this.getWithResponse(resourceGroupName, resourceName, replicaName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "signalR"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'signalR'.", id))); + } + String replicaName = Utils.getValueFromIdByName(id, "replicas"); + if (replicaName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'replicas'.", id))); + } + return this.getWithResponse(resourceGroupName, resourceName, replicaName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "signalR"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'signalR'.", id))); + } + String replicaName = Utils.getValueFromIdByName(id, "replicas"); + if (replicaName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'replicas'.", id))); + } + this.deleteWithResponse(resourceGroupName, resourceName, replicaName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "signalR"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'signalR'.", id))); + } + String replicaName = Utils.getValueFromIdByName(id, "replicas"); + if (replicaName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'replicas'.", id))); + } + return this.deleteWithResponse(resourceGroupName, resourceName, replicaName, context); + } + + private SignalRReplicasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.signalr.SignalRManager manager() { + return this.serviceManager; + } + + public ReplicaImpl define(String name) { + return new ReplicaImpl(name, this.manager()); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRSharedPrivateLinkResourcesClientImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRSharedPrivateLinkResourcesClientImpl.java index 549fe1301e89..01dda9936c60 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRSharedPrivateLinkResourcesClientImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRSharedPrivateLinkResourcesClientImpl.java @@ -144,8 +144,7 @@ Mono> listNext( /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -203,8 +202,7 @@ private Mono> listSinglePageAsync( /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -260,8 +258,7 @@ private Mono> listSinglePageAsync( /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -277,8 +274,7 @@ private PagedFlux listAsync(String resourceGroup /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -297,8 +293,7 @@ private PagedFlux listAsync( /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -313,8 +308,7 @@ public PagedIterable list(String resourceGroupNa /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -332,8 +326,7 @@ public PagedIterable list( * Get the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -390,8 +383,7 @@ private Mono> getWithResponseAsync( * Get the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -446,8 +438,7 @@ private Mono> getWithResponseAsync( * Get the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -465,8 +456,7 @@ private Mono getAsync( * Get the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -484,8 +474,7 @@ public Response getWithResponse( * Get the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -502,8 +491,7 @@ public SharedPrivateLinkResourceInner get( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -570,8 +558,7 @@ private Mono>> createOrUpdateWithResponseAsync( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @param context The context to associate with this operation. @@ -637,8 +624,7 @@ private Mono>> createOrUpdateWithResponseAsync( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -669,8 +655,7 @@ private Mono>> createOrUpdateWithResponseAsync( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @param context The context to associate with this operation. @@ -705,8 +690,7 @@ private Mono>> createOrUpdateWithResponseAsync( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -729,8 +713,7 @@ public SyncPoller, SharedPrivateLinkR * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @param context The context to associate with this operation. @@ -756,8 +739,7 @@ public SyncPoller, SharedPrivateLinkR * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -780,8 +762,7 @@ private Mono createOrUpdateAsync( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @param context The context to associate with this operation. @@ -807,8 +788,7 @@ private Mono createOrUpdateAsync( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -829,8 +809,7 @@ public SharedPrivateLinkResourceInner createOrUpdate( * Create or update a shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The shared private link resource. * @param context The context to associate with this operation. @@ -854,8 +833,7 @@ public SharedPrivateLinkResourceInner createOrUpdate( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -911,8 +889,7 @@ private Mono>> deleteWithResponseAsync( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -966,8 +943,7 @@ private Mono>> deleteWithResponseAsync( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -989,8 +965,7 @@ private PollerFlux, Void> beginDeleteAsync( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1013,8 +988,7 @@ private PollerFlux, Void> beginDeleteAsync( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1031,8 +1005,7 @@ public SyncPoller, Void> beginDelete( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1052,8 +1025,7 @@ public SyncPoller, Void> beginDelete( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1072,8 +1044,7 @@ private Mono deleteAsync( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1093,8 +1064,7 @@ private Mono deleteAsync( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1109,8 +1079,7 @@ public void delete(String sharedPrivateLinkResourceName, String resourceGroupNam * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRsClientImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRsClientImpl.java index 2c95e54ae1e1..2b5e074b7f4f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRsClientImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRsClientImpl.java @@ -183,7 +183,7 @@ Mono> listKeys( @Headers({"Content-Type: application/json"}) @Post( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey") - @ExpectedResponses({202}) + @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> regenerateKey( @HostParam("$host") String endpoint, @@ -195,6 +195,21 @@ Mono>> regenerateKey( @HeaderParam("Accept") String accept, Context context); + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listReplicaSkus( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("replicaName") String replicaName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + @Headers({"Content-Type: application/json"}) @Post( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart") @@ -541,8 +556,7 @@ public PagedIterable list(Context context) { /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -594,8 +608,7 @@ private Mono> listByResourceGroupSinglePageA /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -646,8 +659,7 @@ private Mono> listByResourceGroupSinglePageA /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -664,8 +676,7 @@ private PagedFlux listByResourceGroupAsync(String resource /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -683,8 +694,7 @@ private PagedFlux listByResourceGroupAsync(String resource /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -699,8 +709,7 @@ public PagedIterable listByResourceGroup(String resourceGr /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -716,8 +725,7 @@ public PagedIterable listByResourceGroup(String resourceGr /** * Get the resource and its properties. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -765,8 +773,7 @@ private Mono> getByResourceGroupWithResponseAsync /** * Get the resource and its properties. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -812,8 +819,7 @@ private Mono> getByResourceGroupWithResponseAsync /** * Get the resource and its properties. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -829,8 +835,7 @@ private Mono getByResourceGroupAsync(String resourceGroupN /** * Get the resource and its properties. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -847,8 +852,7 @@ public Response getByResourceGroupWithResponse( /** * Get the resource and its properties. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -863,8 +867,7 @@ public SignalRResourceInner getByResourceGroup(String resourceGroupName, String /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -919,8 +922,7 @@ private Mono>> createOrUpdateWithResponseAsync( /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @param context The context to associate with this operation. @@ -973,8 +975,7 @@ private Mono>> createOrUpdateWithResponseAsync( /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1000,8 +1001,7 @@ private PollerFlux, SignalRResourceInner> begin /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @param context The context to associate with this operation. @@ -1025,8 +1025,7 @@ private PollerFlux, SignalRResourceInner> begin /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1043,8 +1042,7 @@ public SyncPoller, SignalRResourceInner> beginC /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @param context The context to associate with this operation. @@ -1062,8 +1060,7 @@ public SyncPoller, SignalRResourceInner> beginC /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1082,8 +1079,7 @@ private Mono createOrUpdateAsync( /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @param context The context to associate with this operation. @@ -1103,8 +1099,7 @@ private Mono createOrUpdateAsync( /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1121,8 +1116,7 @@ public SignalRResourceInner createOrUpdate( /** * Create or update a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the create or update operation. * @param context The context to associate with this operation. @@ -1140,8 +1134,7 @@ public SignalRResourceInner createOrUpdate( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1188,8 +1181,7 @@ private Mono>> deleteWithResponseAsync(String resource /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1235,8 +1227,7 @@ private Mono>> deleteWithResponseAsync( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1255,8 +1246,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1277,8 +1267,7 @@ private PollerFlux, Void> beginDeleteAsync( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1293,8 +1282,7 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1311,8 +1299,7 @@ public SyncPoller, Void> beginDelete( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1327,8 +1314,7 @@ private Mono deleteAsync(String resourceGroupName, String resourceName) { /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1346,8 +1332,7 @@ private Mono deleteAsync(String resourceGroupName, String resourceName, Co /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1361,8 +1346,7 @@ public void delete(String resourceGroupName, String resourceName) { /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1377,8 +1361,7 @@ public void delete(String resourceGroupName, String resourceName, Context contex /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1433,8 +1416,7 @@ private Mono>> updateWithResponseAsync( /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @param context The context to associate with this operation. @@ -1487,8 +1469,7 @@ private Mono>> updateWithResponseAsync( /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1513,8 +1494,7 @@ private PollerFlux, SignalRResourceInner> begin /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @param context The context to associate with this operation. @@ -1538,8 +1518,7 @@ private PollerFlux, SignalRResourceInner> begin /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1556,8 +1535,7 @@ public SyncPoller, SignalRResourceInner> beginU /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @param context The context to associate with this operation. @@ -1575,8 +1553,7 @@ public SyncPoller, SignalRResourceInner> beginU /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1595,8 +1572,7 @@ private Mono updateAsync( /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @param context The context to associate with this operation. @@ -1616,8 +1592,7 @@ private Mono updateAsync( /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1633,8 +1608,7 @@ public SignalRResourceInner update(String resourceGroupName, String resourceName /** * Operation to update an exiting resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameters for the update operation. * @param context The context to associate with this operation. @@ -1652,8 +1626,7 @@ public SignalRResourceInner update( /** * Get the access keys of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1700,8 +1673,7 @@ private Mono> listKeysWithResponseAsync(String resour /** * Get the access keys of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1747,8 +1719,7 @@ private Mono> listKeysWithResponseAsync( /** * Get the access keys of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1764,8 +1735,7 @@ private Mono listKeysAsync(String resourceGroupName, String re /** * Get the access keys of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1782,8 +1752,7 @@ public Response listKeysWithResponse( /** * Get the access keys of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1798,8 +1767,7 @@ public SignalRKeysInner listKeys(String resourceGroupName, String resourceName) /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1855,8 +1823,7 @@ private Mono>> regenerateKeyWithResponseAsync( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @param context The context to associate with this operation. @@ -1910,8 +1877,7 @@ private Mono>> regenerateKeyWithResponseAsync( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1937,8 +1903,7 @@ private PollerFlux, SignalRKeysInner> beginRegenera /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @param context The context to associate with this operation. @@ -1962,8 +1927,7 @@ private PollerFlux, SignalRKeysInner> beginRegenera /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1980,8 +1944,7 @@ public SyncPoller, SignalRKeysInner> beginRegenerat /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @param context The context to associate with this operation. @@ -1999,8 +1962,7 @@ public SyncPoller, SignalRKeysInner> beginRegenerat /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2019,8 +1981,7 @@ private Mono regenerateKeyAsync( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @param context The context to associate with this operation. @@ -2040,8 +2001,7 @@ private Mono regenerateKeyAsync( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2058,8 +2018,7 @@ public SignalRKeysInner regenerateKey( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @param context The context to associate with this operation. @@ -2074,11 +2033,165 @@ public SignalRKeysInner regenerateKey( return regenerateKeyAsync(resourceGroupName, resourceName, parameters, context).block(); } + /** + * List all available skus of the replica resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list skus operation response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listReplicaSkusWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listReplicaSkus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all available skus of the replica resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list skus operation response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listReplicaSkusWithResponseAsync( + String resourceGroupName, String resourceName, String replicaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (replicaName == null) { + return Mono.error(new IllegalArgumentException("Parameter replicaName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listReplicaSkus( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + replicaName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * List all available skus of the replica resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list skus operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listReplicaSkusAsync(String resourceGroupName, String resourceName, String replicaName) { + return listReplicaSkusWithResponseAsync(resourceGroupName, resourceName, replicaName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List all available skus of the replica resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list skus operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listReplicaSkusWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context) { + return listReplicaSkusWithResponseAsync(resourceGroupName, resourceName, replicaName, context).block(); + } + + /** + * List all available skus of the replica resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list skus operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SkuListInner listReplicaSkus(String resourceGroupName, String resourceName, String replicaName) { + return listReplicaSkusWithResponse(resourceGroupName, resourceName, replicaName, Context.NONE).getValue(); + } + /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2125,8 +2238,7 @@ private Mono>> restartWithResponseAsync(String resourc /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2172,8 +2284,7 @@ private Mono>> restartWithResponseAsync( /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2192,8 +2303,7 @@ private PollerFlux, Void> beginRestartAsync(String resourceGrou /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2214,8 +2324,7 @@ private PollerFlux, Void> beginRestartAsync( /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2230,8 +2339,7 @@ public SyncPoller, Void> beginRestart(String resourceGroupName, /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2248,8 +2356,7 @@ public SyncPoller, Void> beginRestart( /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2264,8 +2371,7 @@ private Mono restartAsync(String resourceGroupName, String resourceName) { /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2283,8 +2389,7 @@ private Mono restartAsync(String resourceGroupName, String resourceName, C /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2298,8 +2403,7 @@ public void restart(String resourceGroupName, String resourceName) { /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2314,8 +2418,7 @@ public void restart(String resourceGroupName, String resourceName, Context conte /** * List all available skus of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2362,8 +2465,7 @@ private Mono> listSkusWithResponseAsync(String resourceGr /** * List all available skus of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2409,8 +2511,7 @@ private Mono> listSkusWithResponseAsync( /** * List all available skus of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2426,8 +2527,7 @@ private Mono listSkusAsync(String resourceGroupName, String resour /** * List all available skus of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -2443,8 +2543,7 @@ public Response listSkusWithResponse(String resourceGroupName, Str /** * List all available skus of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRsImpl.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRsImpl.java index 269be3ff52d9..d8af8577dec4 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRsImpl.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/implementation/SignalRsImpl.java @@ -155,6 +155,30 @@ public SignalRKeys regenerateKey( } } + public Response listReplicaSkusWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context) { + Response inner = + this.serviceClient().listReplicaSkusWithResponse(resourceGroupName, resourceName, replicaName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SkuListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SkuList listReplicaSkus(String resourceGroupName, String resourceName, String replicaName) { + SkuListInner inner = this.serviceClient().listReplicaSkus(resourceGroupName, resourceName, replicaName); + if (inner != null) { + return new SkuListImpl(inner, this.manager()); + } else { + return null; + } + } + public void restart(String resourceGroupName, String resourceName) { this.serviceClient().restart(resourceGroupName, resourceName); } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/CustomCertificate.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/CustomCertificate.java index 0dd149dafd35..d51c2137ac8d 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/CustomCertificate.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/CustomCertificate.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.signalr.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.signalr.fluent.models.CustomCertificateInner; @@ -31,13 +30,6 @@ public interface CustomCertificate { */ String type(); - /** - * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the provisioningState property: Provisioning state of the resource. * @@ -88,23 +80,25 @@ interface Definition DefinitionStages.WithKeyVaultSecretName, DefinitionStages.WithCreate { } + /** The CustomCertificate definition stages. */ interface DefinitionStages { /** The first stage of the CustomCertificate definition. */ interface Blank extends WithParentResource { } + /** The stage of the CustomCertificate definition allowing to specify parent resource. */ interface WithParentResource { /** * Specifies resourceGroupName, resourceName. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this - * value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @return the next definition stage. */ WithKeyVaultBaseUri withExistingSignalR(String resourceGroupName, String resourceName); } + /** The stage of the CustomCertificate definition allowing to specify keyVaultBaseUri. */ interface WithKeyVaultBaseUri { /** @@ -115,6 +109,7 @@ interface WithKeyVaultBaseUri { */ WithKeyVaultSecretName withKeyVaultBaseUri(String keyVaultBaseUri); } + /** The stage of the CustomCertificate definition allowing to specify keyVaultSecretName. */ interface WithKeyVaultSecretName { /** @@ -125,6 +120,7 @@ interface WithKeyVaultSecretName { */ WithCreate withKeyVaultSecretName(String keyVaultSecretName); } + /** * The stage of the CustomCertificate definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -145,6 +141,7 @@ interface WithCreate extends DefinitionStages.WithKeyVaultSecretVersion { */ CustomCertificate create(Context context); } + /** The stage of the CustomCertificate definition allowing to specify keyVaultSecretVersion. */ interface WithKeyVaultSecretVersion { /** @@ -156,6 +153,7 @@ interface WithKeyVaultSecretVersion { WithCreate withKeyVaultSecretVersion(String keyVaultSecretVersion); } } + /** * Begins update for the CustomCertificate resource. * @@ -180,9 +178,11 @@ interface Update { */ CustomCertificate apply(Context context); } + /** The CustomCertificate update stages. */ interface UpdateStages { } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/CustomDomain.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/CustomDomain.java index 9f7b5c1138f1..069890b4b7a8 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/CustomDomain.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/CustomDomain.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.signalr.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.signalr.fluent.models.CustomDomainInner; @@ -31,13 +30,6 @@ public interface CustomDomain { */ String type(); - /** - * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the provisioningState property: Provisioning state of the resource. * @@ -81,23 +73,25 @@ interface Definition DefinitionStages.WithCustomCertificate, DefinitionStages.WithCreate { } + /** The CustomDomain definition stages. */ interface DefinitionStages { /** The first stage of the CustomDomain definition. */ interface Blank extends WithParentResource { } + /** The stage of the CustomDomain definition allowing to specify parent resource. */ interface WithParentResource { /** * Specifies resourceGroupName, resourceName. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this - * value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @return the next definition stage. */ WithDomainName withExistingSignalR(String resourceGroupName, String resourceName); } + /** The stage of the CustomDomain definition allowing to specify domainName. */ interface WithDomainName { /** @@ -108,6 +102,7 @@ interface WithDomainName { */ WithCustomCertificate withDomainName(String domainName); } + /** The stage of the CustomDomain definition allowing to specify customCertificate. */ interface WithCustomCertificate { /** @@ -118,6 +113,7 @@ interface WithCustomCertificate { */ WithCreate withCustomCertificate(ResourceReference customCertificate); } + /** * The stage of the CustomDomain definition which contains all the minimum required properties for the resource * to be created, but also allows for any other optional properties to be specified. @@ -139,6 +135,7 @@ interface WithCreate { CustomDomain create(Context context); } } + /** * Begins update for the CustomDomain resource. * @@ -163,6 +160,7 @@ interface Update extends UpdateStages.WithDomainName, UpdateStages.WithCustomCer */ CustomDomain apply(Context context); } + /** The CustomDomain update stages. */ interface UpdateStages { /** The stage of the CustomDomain update allowing to specify domainName. */ @@ -175,6 +173,7 @@ interface WithDomainName { */ Update withDomainName(String domainName); } + /** The stage of the CustomDomain update allowing to specify customCertificate. */ interface WithCustomCertificate { /** @@ -186,6 +185,7 @@ interface WithCustomCertificate { Update withCustomCertificate(ResourceReference customCertificate); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/NameAvailabilityParameters.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/NameAvailabilityParameters.java index a03f710f8bc9..e16e6c673821 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/NameAvailabilityParameters.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/NameAvailabilityParameters.java @@ -12,7 +12,8 @@ @Fluent public final class NameAvailabilityParameters { /* - * The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub" + * The resource type. Can be "Microsoft.SignalRService/SignalR", "Microsoft.SignalRService/WebPubSub", + * "Microsoft.SignalRService/SignalR/replicas" or "Microsoft.SignalRService/WebPubSub/replicas" */ @JsonProperty(value = "type", required = true) private String type; @@ -28,8 +29,9 @@ public NameAvailabilityParameters() { } /** - * Get the type property: The resource type. Can be "Microsoft.SignalRService/SignalR" or - * "Microsoft.SignalRService/webPubSub". + * Get the type property: The resource type. Can be "Microsoft.SignalRService/SignalR", + * "Microsoft.SignalRService/WebPubSub", "Microsoft.SignalRService/SignalR/replicas" or + * "Microsoft.SignalRService/WebPubSub/replicas". * * @return the type value. */ @@ -38,8 +40,9 @@ public String type() { } /** - * Set the type property: The resource type. Can be "Microsoft.SignalRService/SignalR" or - * "Microsoft.SignalRService/webPubSub". + * Set the type property: The resource type. Can be "Microsoft.SignalRService/SignalR", + * "Microsoft.SignalRService/WebPubSub", "Microsoft.SignalRService/SignalR/replicas" or + * "Microsoft.SignalRService/WebPubSub/replicas". * * @param type the type value to set. * @return the NameAvailabilityParameters object itself. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/PrivateEndpointConnection.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/PrivateEndpointConnection.java index 1b548248aca6..3d29dc0c645e 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/PrivateEndpointConnection.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/PrivateEndpointConnection.java @@ -32,7 +32,7 @@ public interface PrivateEndpointConnection { String type(); /** - * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/Replica.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/Replica.java new file mode 100644 index 000000000000..b49995058cc8 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/Replica.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.signalr.fluent.models.ReplicaInner; +import java.util.Map; + +/** An immutable client-side representation of Replica. */ +public interface Replica { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The billing information of the resource. + * + * @return the sku value. + */ + ResourceSku sku(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.signalr.fluent.models.ReplicaInner object. + * + * @return the inner object. + */ + ReplicaInner innerModel(); + + /** The entirety of the Replica definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + + /** The Replica definition stages. */ + interface DefinitionStages { + /** The first stage of the Replica definition. */ + interface Blank extends WithLocation { + } + + /** The stage of the Replica definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** The stage of the Replica definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, resourceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @return the next definition stage. + */ + WithCreate withExistingSignalR(String resourceGroupName, String resourceName); + } + + /** + * The stage of the Replica definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithSku { + /** + * Executes the create request. + * + * @return the created resource. + */ + Replica create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Replica create(Context context); + } + + /** The stage of the Replica definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** The stage of the Replica definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The billing information of the resource.. + * + * @param sku The billing information of the resource. + * @return the next definition stage. + */ + WithCreate withSku(ResourceSku sku); + } + } + + /** + * Begins update for the Replica resource. + * + * @return the stage of resource update. + */ + Replica.Update update(); + + /** The template for Replica update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Replica apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Replica apply(Context context); + } + + /** The Replica update stages. */ + interface UpdateStages { + /** The stage of the Replica update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** The stage of the Replica update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The billing information of the resource.. + * + * @param sku The billing information of the resource. + * @return the next definition stage. + */ + Update withSku(ResourceSku sku); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Replica refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Replica refresh(Context context); + + /** + * Operation to restart a replica. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(); + + /** + * Operation to restart a replica. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(Context context); +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/ReplicaList.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/ReplicaList.java new file mode 100644 index 000000000000..bd5f8e7fdc0b --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/ReplicaList.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.signalr.fluent.models.ReplicaInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ReplicaList model. */ +@Fluent +public final class ReplicaList { + /* + * List of the replica + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of ReplicaList class. */ + public ReplicaList() { + } + + /** + * Get the value property: List of the replica. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of the replica. + * + * @param value the value value to set. + * @return the ReplicaList object itself. + */ + public ReplicaList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL the client should use to fetch the next page (per server side paging). It's + * null for now, added for future use. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL the client should use to fetch the next page (per server side paging). It's + * null for now, added for future use. + * + * @param nextLink the nextLink value to set. + * @return the ReplicaList object itself. + */ + public ReplicaList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/ServiceKind.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/ServiceKind.java index 5b8297f30067..90c232283700 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/ServiceKind.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/ServiceKind.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** The kind of the service, it can be SignalR or RawWebSockets. */ +/** The kind of the service. */ public final class ServiceKind extends ExpandableStringEnum { /** Static value SignalR for ServiceKind. */ public static final ServiceKind SIGNALR = fromString("SignalR"); diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SharedPrivateLinkResource.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SharedPrivateLinkResource.java index 53ce0d562935..e3761ddde0bb 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SharedPrivateLinkResource.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SharedPrivateLinkResource.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.signalr.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.signalr.fluent.models.SharedPrivateLinkResourceInner; @@ -31,13 +30,6 @@ public interface SharedPrivateLinkResource { */ String type(); - /** - * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the groupId property: The group id from the provider of resource the shared private link resource is for. * @@ -92,23 +84,25 @@ public interface SharedPrivateLinkResource { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } + /** The SharedPrivateLinkResource definition stages. */ interface DefinitionStages { /** The first stage of the SharedPrivateLinkResource definition. */ interface Blank extends WithParentResource { } + /** The stage of the SharedPrivateLinkResource definition allowing to specify parent resource. */ interface WithParentResource { /** * Specifies resourceGroupName, resourceName. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this - * value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @return the next definition stage. */ WithCreate withExistingSignalR(String resourceGroupName, String resourceName); } + /** * The stage of the SharedPrivateLinkResource definition which contains all the minimum required properties for * the resource to be created, but also allows for any other optional properties to be specified. @@ -132,6 +126,7 @@ interface WithCreate */ SharedPrivateLinkResource create(Context context); } + /** The stage of the SharedPrivateLinkResource definition allowing to specify groupId. */ interface WithGroupId { /** @@ -143,6 +138,7 @@ interface WithGroupId { */ WithCreate withGroupId(String groupId); } + /** The stage of the SharedPrivateLinkResource definition allowing to specify privateLinkResourceId. */ interface WithPrivateLinkResourceId { /** @@ -154,6 +150,7 @@ interface WithPrivateLinkResourceId { */ WithCreate withPrivateLinkResourceId(String privateLinkResourceId); } + /** The stage of the SharedPrivateLinkResource definition allowing to specify requestMessage. */ interface WithRequestMessage { /** @@ -166,6 +163,7 @@ interface WithRequestMessage { WithCreate withRequestMessage(String requestMessage); } } + /** * Begins update for the SharedPrivateLinkResource resource. * @@ -191,6 +189,7 @@ interface Update */ SharedPrivateLinkResource apply(Context context); } + /** The SharedPrivateLinkResource update stages. */ interface UpdateStages { /** The stage of the SharedPrivateLinkResource update allowing to specify groupId. */ @@ -204,6 +203,7 @@ interface WithGroupId { */ Update withGroupId(String groupId); } + /** The stage of the SharedPrivateLinkResource update allowing to specify privateLinkResourceId. */ interface WithPrivateLinkResourceId { /** @@ -215,6 +215,7 @@ interface WithPrivateLinkResourceId { */ Update withPrivateLinkResourceId(String privateLinkResourceId); } + /** The stage of the SharedPrivateLinkResource update allowing to specify requestMessage. */ interface WithRequestMessage { /** @@ -227,6 +228,7 @@ interface WithRequestMessage { Update withRequestMessage(String requestMessage); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRCustomCertificates.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRCustomCertificates.java index 6fae61fd5904..7cd37c985908 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRCustomCertificates.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRCustomCertificates.java @@ -13,8 +13,7 @@ public interface SignalRCustomCertificates { /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -26,8 +25,7 @@ public interface SignalRCustomCertificates { /** * List all custom certificates. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -40,8 +38,7 @@ public interface SignalRCustomCertificates { /** * Get a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param context The context to associate with this operation. @@ -56,8 +53,7 @@ Response getWithResponse( /** * Get a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -70,8 +66,7 @@ Response getWithResponse( /** * Delete a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @param context The context to associate with this operation. @@ -86,8 +81,7 @@ Response deleteWithResponse( /** * Delete a custom certificate. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param certificateName Custom certificate name. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRCustomDomains.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRCustomDomains.java index f295e33b9212..505cda6614f3 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRCustomDomains.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRCustomDomains.java @@ -13,8 +13,7 @@ public interface SignalRCustomDomains { /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -26,8 +25,7 @@ public interface SignalRCustomDomains { /** * List all custom domains. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -40,8 +38,7 @@ public interface SignalRCustomDomains { /** * Get a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. @@ -55,8 +52,7 @@ public interface SignalRCustomDomains { /** * Get a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -69,8 +65,7 @@ public interface SignalRCustomDomains { /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -82,8 +77,7 @@ public interface SignalRCustomDomains { /** * Delete a custom domain. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param name Custom domain name. * @param context The context to associate with this operation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRPrivateEndpointConnections.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRPrivateEndpointConnections.java index 1191af2cef04..7522b3a47263 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRPrivateEndpointConnections.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRPrivateEndpointConnections.java @@ -14,8 +14,7 @@ public interface SignalRPrivateEndpointConnections { /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -27,8 +26,7 @@ public interface SignalRPrivateEndpointConnections { /** * List private endpoint connections. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -41,9 +39,9 @@ public interface SignalRPrivateEndpointConnections { /** * Get the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -57,9 +55,9 @@ Response getWithResponse( /** * Get the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -71,9 +69,9 @@ Response getWithResponse( /** * Update the state of specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The resource of private endpoint and its properties. * @param context The context to associate with this operation. @@ -92,9 +90,9 @@ Response updateWithResponse( /** * Update the state of specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters The resource of private endpoint and its properties. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -111,9 +109,9 @@ PrivateEndpointConnection update( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -124,9 +122,9 @@ PrivateEndpointConnection update( /** * Delete the specified private endpoint connection. * - * @param privateEndpointConnectionName The name of the private endpoint connection. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRPrivateLinkResources.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRPrivateLinkResources.java index f58670322d1d..c5eaed23b19e 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRPrivateLinkResources.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRPrivateLinkResources.java @@ -12,8 +12,7 @@ public interface SignalRPrivateLinkResources { /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -26,8 +25,7 @@ public interface SignalRPrivateLinkResources { /** * Get the private link resources that need to be created for a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRReplicas.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRReplicas.java new file mode 100644 index 000000000000..be0a3996d3e3 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRReplicas.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SignalRReplicas. */ +public interface SignalRReplicas { + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String resourceName); + + /** + * List all replicas belong to this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String resourceName, Context context); + + /** + * Get the replica and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context); + + /** + * Get the replica and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties. + */ + Replica get(String resourceGroupName, String resourceName, String replicaName); + + /** + * Operation to delete a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context); + + /** + * Operation to delete a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String resourceName, String replicaName); + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String resourceName, String replicaName); + + /** + * Operation to restart a replica. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String resourceName, String replicaName, Context context); + + /** + * Get the replica and its properties. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties along with {@link Response}. + */ + Replica getById(String id); + + /** + * Get the replica and its properties. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the replica and its properties along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Operation to delete a replica. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Operation to delete a replica. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Replica resource. + * + * @param name resource name. + * @return the first stage of the new Replica definition. + */ + Replica.DefinitionStages.Blank define(String name); +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRResource.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRResource.java index 14286c80d8e0..72e205497d1e 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRResource.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRResource.java @@ -57,7 +57,7 @@ public interface SignalRResource { ResourceSku sku(); /** - * Gets the kind property: The kind of the service, it can be SignalR or RawWebSockets. + * Gets the kind property: The kind of the service. * * @return the kind value. */ @@ -71,7 +71,7 @@ public interface SignalRResource { ManagedIdentity identity(); /** - * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ @@ -263,11 +263,13 @@ interface Definition DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { } + /** The SignalRResource definition stages. */ interface DefinitionStages { /** The first stage of the SignalRResource definition. */ interface Blank extends WithLocation { } + /** The stage of the SignalRResource definition allowing to specify location. */ interface WithLocation { /** @@ -286,17 +288,18 @@ interface WithLocation { */ WithResourceGroup withRegion(String location); } + /** The stage of the SignalRResource definition allowing to specify parent resource. */ interface WithResourceGroup { /** * Specifies resourceGroupName. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this - * value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. */ WithCreate withExistingResourceGroup(String resourceGroupName); } + /** * The stage of the SignalRResource definition which contains all the minimum required properties for the * resource to be created, but also allows for any other optional properties to be specified. @@ -332,6 +335,7 @@ interface WithCreate */ SignalRResource create(Context context); } + /** The stage of the SignalRResource definition allowing to specify tags. */ interface WithTags { /** @@ -342,6 +346,7 @@ interface WithTags { */ WithCreate withTags(Map tags); } + /** The stage of the SignalRResource definition allowing to specify sku. */ interface WithSku { /** @@ -352,16 +357,18 @@ interface WithSku { */ WithCreate withSku(ResourceSku sku); } + /** The stage of the SignalRResource definition allowing to specify kind. */ interface WithKind { /** - * Specifies the kind property: The kind of the service, it can be SignalR or RawWebSockets. + * Specifies the kind property: The kind of the service. * - * @param kind The kind of the service, it can be SignalR or RawWebSockets. + * @param kind The kind of the service. * @return the next definition stage. */ WithCreate withKind(ServiceKind kind); } + /** The stage of the SignalRResource definition allowing to specify identity. */ interface WithIdentity { /** @@ -372,6 +379,7 @@ interface WithIdentity { */ WithCreate withIdentity(ManagedIdentity identity); } + /** The stage of the SignalRResource definition allowing to specify tls. */ interface WithTls { /** @@ -382,6 +390,7 @@ interface WithTls { */ WithCreate withTls(SignalRTlsSettings tls); } + /** The stage of the SignalRResource definition allowing to specify features. */ interface WithFeatures { /** @@ -401,6 +410,7 @@ interface WithFeatures { */ WithCreate withFeatures(List features); } + /** The stage of the SignalRResource definition allowing to specify liveTraceConfiguration. */ interface WithLiveTraceConfiguration { /** @@ -412,6 +422,7 @@ interface WithLiveTraceConfiguration { */ WithCreate withLiveTraceConfiguration(LiveTraceConfiguration liveTraceConfiguration); } + /** The stage of the SignalRResource definition allowing to specify resourceLogConfiguration. */ interface WithResourceLogConfiguration { /** @@ -423,6 +434,7 @@ interface WithResourceLogConfiguration { */ WithCreate withResourceLogConfiguration(ResourceLogConfiguration resourceLogConfiguration); } + /** The stage of the SignalRResource definition allowing to specify cors. */ interface WithCors { /** @@ -433,6 +445,7 @@ interface WithCors { */ WithCreate withCors(SignalRCorsSettings cors); } + /** The stage of the SignalRResource definition allowing to specify serverless. */ interface WithServerless { /** @@ -443,6 +456,7 @@ interface WithServerless { */ WithCreate withServerless(ServerlessSettings serverless); } + /** The stage of the SignalRResource definition allowing to specify upstream. */ interface WithUpstream { /** @@ -453,6 +467,7 @@ interface WithUpstream { */ WithCreate withUpstream(ServerlessUpstreamSettings upstream); } + /** The stage of the SignalRResource definition allowing to specify networkACLs. */ interface WithNetworkACLs { /** @@ -463,6 +478,7 @@ interface WithNetworkACLs { */ WithCreate withNetworkACLs(SignalRNetworkACLs networkACLs); } + /** The stage of the SignalRResource definition allowing to specify publicNetworkAccess. */ interface WithPublicNetworkAccess { /** @@ -477,6 +493,7 @@ interface WithPublicNetworkAccess { */ WithCreate withPublicNetworkAccess(String publicNetworkAccess); } + /** The stage of the SignalRResource definition allowing to specify disableLocalAuth. */ interface WithDisableLocalAuth { /** @@ -489,6 +506,7 @@ interface WithDisableLocalAuth { */ WithCreate withDisableLocalAuth(Boolean disableLocalAuth); } + /** The stage of the SignalRResource definition allowing to specify disableAadAuth. */ interface WithDisableAadAuth { /** @@ -502,6 +520,7 @@ interface WithDisableAadAuth { WithCreate withDisableAadAuth(Boolean disableAadAuth); } } + /** * Begins update for the SignalRResource resource. * @@ -540,6 +559,7 @@ interface Update */ SignalRResource apply(Context context); } + /** The SignalRResource update stages. */ interface UpdateStages { /** The stage of the SignalRResource update allowing to specify tags. */ @@ -552,6 +572,7 @@ interface WithTags { */ Update withTags(Map tags); } + /** The stage of the SignalRResource update allowing to specify sku. */ interface WithSku { /** @@ -562,6 +583,7 @@ interface WithSku { */ Update withSku(ResourceSku sku); } + /** The stage of the SignalRResource update allowing to specify identity. */ interface WithIdentity { /** @@ -572,6 +594,7 @@ interface WithIdentity { */ Update withIdentity(ManagedIdentity identity); } + /** The stage of the SignalRResource update allowing to specify tls. */ interface WithTls { /** @@ -582,6 +605,7 @@ interface WithTls { */ Update withTls(SignalRTlsSettings tls); } + /** The stage of the SignalRResource update allowing to specify features. */ interface WithFeatures { /** @@ -601,6 +625,7 @@ interface WithFeatures { */ Update withFeatures(List features); } + /** The stage of the SignalRResource update allowing to specify liveTraceConfiguration. */ interface WithLiveTraceConfiguration { /** @@ -612,6 +637,7 @@ interface WithLiveTraceConfiguration { */ Update withLiveTraceConfiguration(LiveTraceConfiguration liveTraceConfiguration); } + /** The stage of the SignalRResource update allowing to specify resourceLogConfiguration. */ interface WithResourceLogConfiguration { /** @@ -623,6 +649,7 @@ interface WithResourceLogConfiguration { */ Update withResourceLogConfiguration(ResourceLogConfiguration resourceLogConfiguration); } + /** The stage of the SignalRResource update allowing to specify cors. */ interface WithCors { /** @@ -633,6 +660,7 @@ interface WithCors { */ Update withCors(SignalRCorsSettings cors); } + /** The stage of the SignalRResource update allowing to specify serverless. */ interface WithServerless { /** @@ -643,6 +671,7 @@ interface WithServerless { */ Update withServerless(ServerlessSettings serverless); } + /** The stage of the SignalRResource update allowing to specify upstream. */ interface WithUpstream { /** @@ -653,6 +682,7 @@ interface WithUpstream { */ Update withUpstream(ServerlessUpstreamSettings upstream); } + /** The stage of the SignalRResource update allowing to specify networkACLs. */ interface WithNetworkACLs { /** @@ -663,6 +693,7 @@ interface WithNetworkACLs { */ Update withNetworkACLs(SignalRNetworkACLs networkACLs); } + /** The stage of the SignalRResource update allowing to specify publicNetworkAccess. */ interface WithPublicNetworkAccess { /** @@ -677,6 +708,7 @@ interface WithPublicNetworkAccess { */ Update withPublicNetworkAccess(String publicNetworkAccess); } + /** The stage of the SignalRResource update allowing to specify disableLocalAuth. */ interface WithDisableLocalAuth { /** @@ -689,6 +721,7 @@ interface WithDisableLocalAuth { */ Update withDisableLocalAuth(Boolean disableLocalAuth); } + /** The stage of the SignalRResource update allowing to specify disableAadAuth. */ interface WithDisableAadAuth { /** @@ -702,6 +735,7 @@ interface WithDisableAadAuth { Update withDisableAadAuth(Boolean disableAadAuth); } } + /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRSharedPrivateLinkResources.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRSharedPrivateLinkResources.java index b25b525de105..c9aca909fdeb 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRSharedPrivateLinkResources.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRSharedPrivateLinkResources.java @@ -13,8 +13,7 @@ public interface SignalRSharedPrivateLinkResources { /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -26,8 +25,7 @@ public interface SignalRSharedPrivateLinkResources { /** * List shared private link resources. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -41,8 +39,7 @@ public interface SignalRSharedPrivateLinkResources { * Get the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -57,8 +54,7 @@ Response getWithResponse( * Get the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -71,8 +67,7 @@ Response getWithResponse( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -84,8 +79,7 @@ Response getWithResponse( * Delete the specified shared private link resource. * * @param sharedPrivateLinkResourceName The name of the shared private link resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRTlsSettings.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRTlsSettings.java index b23fcb518f21..3c5087502c0f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRTlsSettings.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRTlsSettings.java @@ -11,7 +11,8 @@ @Fluent public final class SignalRTlsSettings { /* - * Request client certificate during TLS handshake if enabled + * Request client certificate during TLS handshake if enabled. Not supported for free tier. Any input will be + * ignored for free tier. */ @JsonProperty(value = "clientCertEnabled") private Boolean clientCertEnabled; @@ -21,7 +22,8 @@ public SignalRTlsSettings() { } /** - * Get the clientCertEnabled property: Request client certificate during TLS handshake if enabled. + * Get the clientCertEnabled property: Request client certificate during TLS handshake if enabled. Not supported for + * free tier. Any input will be ignored for free tier. * * @return the clientCertEnabled value. */ @@ -30,7 +32,8 @@ public Boolean clientCertEnabled() { } /** - * Set the clientCertEnabled property: Request client certificate during TLS handshake if enabled. + * Set the clientCertEnabled property: Request client certificate during TLS handshake if enabled. Not supported for + * free tier. Any input will be ignored for free tier. * * @param clientCertEnabled the clientCertEnabled value to set. * @return the SignalRTlsSettings object itself. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRs.java b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRs.java index 6b7605c2b0ab..664146e0a393 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRs.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/main/java/com/azure/resourcemanager/signalr/models/SignalRs.java @@ -61,8 +61,7 @@ Response checkNameAvailabilityWithResponse( /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -74,8 +73,7 @@ Response checkNameAvailabilityWithResponse( /** * Handles requests to list all resources in a resource group. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -88,8 +86,7 @@ Response checkNameAvailabilityWithResponse( /** * Get the resource and its properties. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -103,8 +100,7 @@ Response getByResourceGroupWithResponse( /** * Get the resource and its properties. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -116,8 +112,7 @@ Response getByResourceGroupWithResponse( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -128,8 +123,7 @@ Response getByResourceGroupWithResponse( /** * Operation to delete a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -141,8 +135,7 @@ Response getByResourceGroupWithResponse( /** * Get the access keys of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -155,8 +148,7 @@ Response getByResourceGroupWithResponse( /** * Get the access keys of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -168,8 +160,7 @@ Response getByResourceGroupWithResponse( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -182,8 +173,7 @@ Response getByResourceGroupWithResponse( /** * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param parameters Parameter that describes the Regenerate Key Operation. * @param context The context to associate with this operation. @@ -195,11 +185,38 @@ Response getByResourceGroupWithResponse( SignalRKeys regenerateKey( String resourceGroupName, String resourceName, RegenerateKeyParameters parameters, Context context); + /** + * List all available skus of the replica resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list skus operation response along with {@link Response}. + */ + Response listReplicaSkusWithResponse( + String resourceGroupName, String resourceName, String replicaName, Context context); + + /** + * List all available skus of the replica resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param replicaName The name of the replica. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list skus operation response. + */ + SkuList listReplicaSkus(String resourceGroupName, String resourceName, String replicaName); + /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -210,8 +227,7 @@ SignalRKeys regenerateKey( /** * Operation to restart a resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -223,8 +239,7 @@ SignalRKeys regenerateKey( /** * List all available skus of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -237,8 +252,7 @@ SignalRKeys regenerateKey( /** * List all available skus of the resource. * - * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value - * from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/OperationsListSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/OperationsListSamples.java index 127a52b72fe9..0a66f768a998 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/OperationsListSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/OperationsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Operations_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/Operations_List.json */ /** * Sample code: Operations_List. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCheckNameAvailabilitySamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCheckNameAvailabilitySamples.java index 92b380d886f9..11ad5972d91a 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCheckNameAvailabilitySamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCheckNameAvailabilitySamples.java @@ -9,7 +9,7 @@ /** Samples for SignalR CheckNameAvailability. */ public final class SignalRCheckNameAvailabilitySamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CheckNameAvailability.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_CheckNameAvailability.json */ /** * Sample code: SignalR_CheckNameAvailability. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCreateOrUpdateSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCreateOrUpdateSamples.java index dd50a7e28537..81c84ac80585 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCreateOrUpdateSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCreateOrUpdateSamples.java @@ -33,7 +33,7 @@ /** Samples for SignalR CreateOrUpdate. */ public final class SignalRCreateOrUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CreateOrUpdate.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_CreateOrUpdate.json */ /** * Sample code: SignalR_CreateOrUpdate. @@ -46,7 +46,7 @@ public static void signalRCreateOrUpdate(com.azure.resourcemanager.signalr.Signa .define("mySignalRService") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") - .withTags(mapOf("key1", "value1")) + .withTags(mapOf("key1", "fakeTokenPlaceholder")) .withSku(new ResourceSku().withName("Premium_P1").withTier(SignalRSkuTier.PREMIUM).withCapacity(1)) .withKind(ServiceKind.SIGNALR) .withIdentity(new ManagedIdentity().withType(ManagedIdentityType.SYSTEM_ASSIGNED)) @@ -108,6 +108,7 @@ public static void signalRCreateOrUpdate(com.azure.resourcemanager.signalr.Signa .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesCreateOrUpdateSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesCreateOrUpdateSamples.java index 05c32fcdea6a..403d3037fe00 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesCreateOrUpdateSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesCreateOrUpdateSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRCustomCertificates CreateOrUpdate. */ public final class SignalRCustomCertificatesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_CreateOrUpdate.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomCertificates_CreateOrUpdate.json */ /** * Sample code: SignalRCustomCertificates_CreateOrUpdate. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesDeleteSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesDeleteSamples.java index a90f41e46544..bebfab507b17 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesDeleteSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRCustomCertificates Delete. */ public final class SignalRCustomCertificatesDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomCertificates_Delete.json */ /** * Sample code: SignalRCustomCertificates_Delete. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesGetSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesGetSamples.java index 9f417cb939a7..790b5a4c5744 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesGetSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRCustomCertificates Get. */ public final class SignalRCustomCertificatesGetSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomCertificates_Get.json */ /** * Sample code: SignalRCustomCertificates_Get. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesListSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesListSamples.java index 795b496ce371..3d4843a5e3db 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesListSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesListSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRCustomCertificates List. */ public final class SignalRCustomCertificatesListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomCertificates_List.json */ /** * Sample code: SignalRCustomCertificates_List. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsCreateOrUpdateSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsCreateOrUpdateSamples.java index c2def890ca3b..6a93fccfc188 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsCreateOrUpdateSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsCreateOrUpdateSamples.java @@ -9,7 +9,7 @@ /** Samples for SignalRCustomDomains CreateOrUpdate. */ public final class SignalRCustomDomainsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_CreateOrUpdate.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomDomains_CreateOrUpdate.json */ /** * Sample code: SignalRCustomDomains_CreateOrUpdate. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsDeleteSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsDeleteSamples.java index 63f0a538b3e3..7020d51501ca 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsDeleteSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRCustomDomains Delete. */ public final class SignalRCustomDomainsDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomDomains_Delete.json */ /** * Sample code: SignalRCustomDomains_Delete. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsGetSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsGetSamples.java index 993b78639a53..cf8a191f3cda 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsGetSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRCustomDomains Get. */ public final class SignalRCustomDomainsGetSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomDomains_Get.json */ /** * Sample code: SignalRCustomDomains_Get. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsListSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsListSamples.java index 7dff8ae7f8fa..21a8736362b0 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsListSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsListSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRCustomDomains List. */ public final class SignalRCustomDomainsListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRCustomDomains_List.json */ /** * Sample code: SignalRCustomDomains_List. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRDeleteSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRDeleteSamples.java index 96efc0c3fdba..14bb30affde6 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRDeleteSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalR Delete. */ public final class SignalRDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_Delete.json */ /** * Sample code: SignalR_Delete. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRGetByResourceGroupSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRGetByResourceGroupSamples.java index 867928921bae..97561ae75063 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRGetByResourceGroupSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRGetByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalR GetByResourceGroup. */ public final class SignalRGetByResourceGroupSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_Get.json */ /** * Sample code: SignalR_Get. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListByResourceGroupSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListByResourceGroupSamples.java index 639b21181e89..3b3d33ba35fe 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListByResourceGroupSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalR ListByResourceGroup. */ public final class SignalRListByResourceGroupSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListByResourceGroup.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListByResourceGroup.json */ /** * Sample code: SignalR_ListByResourceGroup. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListKeysSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListKeysSamples.java index e86295895a0c..5d75e19d77e8 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListKeysSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListKeysSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalR ListKeys. */ public final class SignalRListKeysSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListKeys.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListKeys.json */ /** * Sample code: SignalR_ListKeys. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListReplicaSkusSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListReplicaSkusSamples.java new file mode 100644 index 000000000000..b8560ebd6127 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListReplicaSkusSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +/** Samples for SignalR ListReplicaSkus. */ +public final class SignalRListReplicaSkusSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListReplicaSkus.json + */ + /** + * Sample code: SignalR_ListReplicaSkus. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRListReplicaSkus(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRs() + .listReplicaSkusWithResponse( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListSamples.java index afd39fb3c940..468c171d0ee8 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalR List. */ public final class SignalRListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListBySubscription.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListBySubscription.json */ /** * Sample code: SignalR_ListBySubscription. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListSkusSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListSkusSamples.java index c9c1087b3e23..c24061eb8aa1 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListSkusSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRListSkusSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalR ListSkus. */ public final class SignalRListSkusSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListSkus.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_ListSkus.json */ /** * Sample code: SignalR_ListSkus. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsDeleteSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsDeleteSamples.java index f2ca0e5d7171..f73e4075a853 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsDeleteSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRPrivateEndpointConnections Delete. */ public final class SignalRPrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateEndpointConnections_Delete.json */ /** * Sample code: SignalRPrivateEndpointConnections_Delete. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsGetSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsGetSamples.java index e329a14501de..f1a689f55488 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsGetSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsGetSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRPrivateEndpointConnections Get. */ public final class SignalRPrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateEndpointConnections_Get.json */ /** * Sample code: SignalRPrivateEndpointConnections_Get. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsListSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsListSamples.java index b4b76f675b2b..513f92c0c66f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsListSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsListSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRPrivateEndpointConnections List. */ public final class SignalRPrivateEndpointConnectionsListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateEndpointConnections_List.json */ /** * Sample code: SignalRPrivateEndpointConnections_List. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsUpdateSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsUpdateSamples.java index c5c0ba03ddfb..62b4cad05b1f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsUpdateSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsUpdateSamples.java @@ -12,7 +12,7 @@ /** Samples for SignalRPrivateEndpointConnections Update. */ public final class SignalRPrivateEndpointConnectionsUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Update.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateEndpointConnections_Update.json */ /** * Sample code: SignalRPrivateEndpointConnections_Update. @@ -28,10 +28,7 @@ public static void signalRPrivateEndpointConnectionsUpdate( "myResourceGroup", "mySignalRService", new PrivateEndpointConnectionInner() - .withPrivateEndpoint( - new PrivateEndpoint() - .withId( - "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint")) + .withPrivateEndpoint(new PrivateEndpoint()) .withPrivateLinkServiceConnectionState( new PrivateLinkServiceConnectionState() .withStatus(PrivateLinkServiceConnectionStatus.APPROVED) diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateLinkResourcesListSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateLinkResourcesListSamples.java index a8692d64f8da..b9c0b204305b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateLinkResourcesListSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateLinkResourcesListSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRPrivateLinkResources List. */ public final class SignalRPrivateLinkResourcesListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateLinkResources_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRPrivateLinkResources_List.json */ /** * Sample code: SignalRPrivateLinkResources_List. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRRegenerateKeySamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRRegenerateKeySamples.java index b4664fdd98fe..6409ec152aa3 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRRegenerateKeySamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRRegenerateKeySamples.java @@ -10,7 +10,7 @@ /** Samples for SignalR RegenerateKey. */ public final class SignalRRegenerateKeySamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_RegenerateKey.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_RegenerateKey.json */ /** * Sample code: SignalR_RegenerateKey. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasCreateOrUpdateSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasCreateOrUpdateSamples.java new file mode 100644 index 000000000000..79f1ed694594 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasCreateOrUpdateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.resourcemanager.signalr.models.ResourceSku; +import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SignalRReplicas CreateOrUpdate. */ +public final class SignalRReplicasCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_CreateOrUpdate.json + */ + /** + * Sample code: SignalRReplicas_CreateOrUpdate. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasCreateOrUpdate(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRReplicas() + .define("mySignalRService-eastus") + .withRegion("eastus") + .withExistingSignalR("myResourceGroup", "mySignalRService") + .withTags(mapOf("key1", "fakeTokenPlaceholder")) + .withSku(new ResourceSku().withName("Premium_P1").withTier(SignalRSkuTier.PREMIUM).withCapacity(1)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasDeleteSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasDeleteSamples.java new file mode 100644 index 000000000000..dd32621ff0ea --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +/** Samples for SignalRReplicas Delete. */ +public final class SignalRReplicasDeleteSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_Delete.json + */ + /** + * Sample code: SignalRReplicas_Delete. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasDelete(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRReplicas() + .deleteWithResponse( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasGetSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasGetSamples.java new file mode 100644 index 000000000000..5bc1d6e50031 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +/** Samples for SignalRReplicas Get. */ +public final class SignalRReplicasGetSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_Get.json + */ + /** + * Sample code: SignalRReplicas_Get. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasGet(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRReplicas() + .getWithResponse( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasListSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasListSamples.java new file mode 100644 index 000000000000..0ea9d03bf37a --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +/** Samples for SignalRReplicas List. */ +public final class SignalRReplicasListSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_List.json + */ + /** + * Sample code: SignalRReplicas_List. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasList(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager.signalRReplicas().list("myResourceGroup", "mySignalRService", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasRestartSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasRestartSamples.java new file mode 100644 index 000000000000..55823db31312 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasRestartSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +/** Samples for SignalRReplicas Restart. */ +public final class SignalRReplicasRestartSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_Restart.json + */ + /** + * Sample code: SignalRReplicas_Restart. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasRestart(com.azure.resourcemanager.signalr.SignalRManager manager) { + manager + .signalRReplicas() + .restart( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasUpdateSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasUpdateSamples.java new file mode 100644 index 000000000000..a34c0b499aa3 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.resourcemanager.signalr.models.Replica; +import com.azure.resourcemanager.signalr.models.ResourceSku; +import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SignalRReplicas Update. */ +public final class SignalRReplicasUpdateSamples { + /* + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRReplicas_Update.json + */ + /** + * Sample code: SignalRReplicas_Update. + * + * @param manager Entry point to SignalRManager. + */ + public static void signalRReplicasUpdate(com.azure.resourcemanager.signalr.SignalRManager manager) { + Replica resource = + manager + .signalRReplicas() + .getWithResponse( + "myResourceGroup", "mySignalRService", "mySignalRService-eastus", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key1", "fakeTokenPlaceholder")) + .withSku(new ResourceSku().withName("Premium_P1").withTier(SignalRSkuTier.PREMIUM).withCapacity(1)) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRRestartSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRRestartSamples.java index c7ab6778c55c..a99466e9a4a8 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRRestartSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRRestartSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalR Restart. */ public final class SignalRRestartSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Restart.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_Restart.json */ /** * Sample code: SignalR_Restart. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesCreateOrUpdateSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesCreateOrUpdateSamples.java index 6d26ca934b98..fe0714bcdd2c 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesCreateOrUpdateSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesCreateOrUpdateSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRSharedPrivateLinkResources CreateOrUpdate. */ public final class SignalRSharedPrivateLinkResourcesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json */ /** * Sample code: SignalRSharedPrivateLinkResources_CreateOrUpdate. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesDeleteSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesDeleteSamples.java index 93c37ce83654..720def6a4c19 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesDeleteSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesDeleteSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRSharedPrivateLinkResources Delete. */ public final class SignalRSharedPrivateLinkResourcesDeleteSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Delete.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRSharedPrivateLinkResources_Delete.json */ /** * Sample code: SignalRSharedPrivateLinkResources_Delete. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesGetSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesGetSamples.java index 7ea856945382..d421330656d3 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesGetSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesGetSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRSharedPrivateLinkResources Get. */ public final class SignalRSharedPrivateLinkResourcesGetSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Get.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRSharedPrivateLinkResources_Get.json */ /** * Sample code: SignalRSharedPrivateLinkResources_Get. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesListSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesListSamples.java index 38833ee67d22..d0ec6b98b769 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesListSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesListSamples.java @@ -7,7 +7,7 @@ /** Samples for SignalRSharedPrivateLinkResources List. */ public final class SignalRSharedPrivateLinkResourcesListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalRSharedPrivateLinkResources_List.json */ /** * Sample code: SignalRSharedPrivateLinkResources_List. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRUpdateSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRUpdateSamples.java index 1bc84fc7c5e4..5445c6158535 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRUpdateSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/SignalRUpdateSamples.java @@ -33,7 +33,7 @@ /** Samples for SignalR Update. */ public final class SignalRUpdateSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Update.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/SignalR_Update.json */ /** * Sample code: SignalR_Update. @@ -48,7 +48,7 @@ public static void signalRUpdate(com.azure.resourcemanager.signalr.SignalRManage .getValue(); resource .update() - .withTags(mapOf("key1", "value1")) + .withTags(mapOf("key1", "fakeTokenPlaceholder")) .withSku(new ResourceSku().withName("Premium_P1").withTier(SignalRSkuTier.PREMIUM).withCapacity(1)) .withIdentity(new ManagedIdentity().withType(ManagedIdentityType.SYSTEM_ASSIGNED)) .withTls(new SignalRTlsSettings().withClientCertEnabled(false)) @@ -109,6 +109,7 @@ public static void signalRUpdate(com.azure.resourcemanager.signalr.SignalRManage .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/UsagesListSamples.java b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/UsagesListSamples.java index 6cd94f155f50..cd6e3a9b31e9 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/UsagesListSamples.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/samples/java/com/azure/resourcemanager/signalr/generated/UsagesListSamples.java @@ -7,7 +7,7 @@ /** Samples for Usages List. */ public final class UsagesListSamples { /* - * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Usages_List.json + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/Usages_List.json */ /** * Sample code: Usages_List. diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainInnerTests.java index bd9ebf289823..5d25053f1840 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainInnerTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainInnerTests.java @@ -15,20 +15,20 @@ public void testDeserialize() throws Exception { CustomDomainInner model = BinaryData .fromString( - "{\"properties\":{\"provisioningState\":\"Deleting\",\"domainName\":\"mygtdssls\",\"customCertificate\":{\"id\":\"mweriofzpy\"}},\"id\":\"semwabnet\",\"name\":\"hhszh\",\"type\":\"d\"}") + "{\"properties\":{\"provisioningState\":\"Failed\",\"domainName\":\"wdsh\",\"customCertificate\":{\"id\":\"snrbgyefrymsgao\"}},\"id\":\"fmwncotmrfh\",\"name\":\"rctym\",\"type\":\"xoftpipiwyczu\"}") .toObject(CustomDomainInner.class); - Assertions.assertEquals("mygtdssls", model.domainName()); - Assertions.assertEquals("mweriofzpy", model.customCertificate().id()); + Assertions.assertEquals("wdsh", model.domainName()); + Assertions.assertEquals("snrbgyefrymsgao", model.customCertificate().id()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CustomDomainInner model = new CustomDomainInner() - .withDomainName("mygtdssls") - .withCustomCertificate(new ResourceReference().withId("mweriofzpy")); + .withDomainName("wdsh") + .withCustomCertificate(new ResourceReference().withId("snrbgyefrymsgao")); model = BinaryData.fromObject(model).toObject(CustomDomainInner.class); - Assertions.assertEquals("mygtdssls", model.domainName()); - Assertions.assertEquals("mweriofzpy", model.customCertificate().id()); + Assertions.assertEquals("wdsh", model.domainName()); + Assertions.assertEquals("snrbgyefrymsgao", model.customCertificate().id()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainListTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainListTests.java index 7e0160610d2f..254352f25b01 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainListTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainListTests.java @@ -7,6 +7,7 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.signalr.fluent.models.CustomDomainInner; import com.azure.resourcemanager.signalr.models.CustomDomainList; +import com.azure.resourcemanager.signalr.models.ResourceReference; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -16,10 +17,11 @@ public void testDeserialize() throws Exception { CustomDomainList model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"domainName\":\"gynduha\"},\"id\":\"hqlkthumaqo\",\"name\":\"bgycduiertgccym\",\"type\":\"aolps\"},{\"properties\":{\"provisioningState\":\"Creating\",\"domainName\":\"fmmdnbbg\"},\"id\":\"zpswiydmc\",\"name\":\"yhz\",\"type\":\"xssadbzmnvdf\"},{\"properties\":{\"provisioningState\":\"Moving\",\"domainName\":\"ao\"},\"id\":\"vxzbncb\",\"name\":\"ylpstdbhhxsrzdz\",\"type\":\"cers\"}],\"nextLink\":\"ntnev\"}") + "{\"value\":[{\"properties\":{\"provisioningState\":\"Moving\",\"domainName\":\"f\",\"customCertificate\":{\"id\":\"esgogc\"}},\"id\":\"honnxkrlgnyhmos\",\"name\":\"xkk\",\"type\":\"thrrgh\"},{\"properties\":{\"provisioningState\":\"Deleting\",\"domainName\":\"dhqxvcx\",\"customCertificate\":{\"id\":\"rpdsof\"}},\"id\":\"shrnsvbuswdvz\",\"name\":\"ybycnunvj\",\"type\":\"rtkfawnopq\"},{\"properties\":{\"provisioningState\":\"Running\",\"domainName\":\"yzirtxdyuxzejn\",\"customCertificate\":{\"id\":\"sewgioilqukr\"}},\"id\":\"dxtqmieoxo\",\"name\":\"ggufhyaomtb\",\"type\":\"hhavgrvkffovjz\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"domainName\":\"bibgjmfxumv\",\"customCertificate\":{\"id\":\"luyovwxnbkfezzx\"}},\"id\":\"cy\",\"name\":\"wzdgirujbzbo\",\"type\":\"vzzbtdcq\"}],\"nextLink\":\"niyujv\"}") .toObject(CustomDomainList.class); - Assertions.assertEquals("gynduha", model.value().get(0).domainName()); - Assertions.assertEquals("ntnev", model.nextLink()); + Assertions.assertEquals("f", model.value().get(0).domainName()); + Assertions.assertEquals("esgogc", model.value().get(0).customCertificate().id()); + Assertions.assertEquals("niyujv", model.nextLink()); } @org.junit.jupiter.api.Test @@ -29,12 +31,22 @@ public void testSerialize() throws Exception { .withValue( Arrays .asList( - new CustomDomainInner().withDomainName("gynduha"), - new CustomDomainInner().withDomainName("fmmdnbbg"), - new CustomDomainInner().withDomainName("ao"))) - .withNextLink("ntnev"); + new CustomDomainInner() + .withDomainName("f") + .withCustomCertificate(new ResourceReference().withId("esgogc")), + new CustomDomainInner() + .withDomainName("dhqxvcx") + .withCustomCertificate(new ResourceReference().withId("rpdsof")), + new CustomDomainInner() + .withDomainName("yzirtxdyuxzejn") + .withCustomCertificate(new ResourceReference().withId("sewgioilqukr")), + new CustomDomainInner() + .withDomainName("bibgjmfxumv") + .withCustomCertificate(new ResourceReference().withId("luyovwxnbkfezzx")))) + .withNextLink("niyujv"); model = BinaryData.fromObject(model).toObject(CustomDomainList.class); - Assertions.assertEquals("gynduha", model.value().get(0).domainName()); - Assertions.assertEquals("ntnev", model.nextLink()); + Assertions.assertEquals("f", model.value().get(0).domainName()); + Assertions.assertEquals("esgogc", model.value().get(0).customCertificate().id()); + Assertions.assertEquals("niyujv", model.nextLink()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainPropertiesTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainPropertiesTests.java index 19dffb76f027..bc9d797d284b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainPropertiesTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/CustomDomainPropertiesTests.java @@ -15,20 +15,20 @@ public void testDeserialize() throws Exception { CustomDomainProperties model = BinaryData .fromString( - "{\"provisioningState\":\"Failed\",\"domainName\":\"wiwubm\",\"customCertificate\":{\"id\":\"besldnkwwtppjflc\"}}") + "{\"provisioningState\":\"Unknown\",\"domainName\":\"cpqjlihhyu\",\"customCertificate\":{\"id\":\"skasdvlmfwdgzxu\"}}") .toObject(CustomDomainProperties.class); - Assertions.assertEquals("wiwubm", model.domainName()); - Assertions.assertEquals("besldnkwwtppjflc", model.customCertificate().id()); + Assertions.assertEquals("cpqjlihhyu", model.domainName()); + Assertions.assertEquals("skasdvlmfwdgzxu", model.customCertificate().id()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CustomDomainProperties model = new CustomDomainProperties() - .withDomainName("wiwubm") - .withCustomCertificate(new ResourceReference().withId("besldnkwwtppjflc")); + .withDomainName("cpqjlihhyu") + .withCustomCertificate(new ResourceReference().withId("skasdvlmfwdgzxu")); model = BinaryData.fromObject(model).toObject(CustomDomainProperties.class); - Assertions.assertEquals("wiwubm", model.domainName()); - Assertions.assertEquals("besldnkwwtppjflc", model.customCertificate().id()); + Assertions.assertEquals("cpqjlihhyu", model.domainName()); + Assertions.assertEquals("skasdvlmfwdgzxu", model.customCertificate().id()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/DimensionTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/DimensionTests.java index 83f8f1cf3cf0..3d85ebe7614a 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/DimensionTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/DimensionTests.java @@ -14,11 +14,11 @@ public void testDeserialize() throws Exception { Dimension model = BinaryData .fromString( - "{\"name\":\"gsntnbybkzgcwr\",\"displayName\":\"lxxwrljdouskc\",\"internalName\":\"kocrcjdkwtnhx\",\"toBeExportedForShoebox\":true}") + "{\"name\":\"alhbx\",\"displayName\":\"e\",\"internalName\":\"zzvdudgwds\",\"toBeExportedForShoebox\":true}") .toObject(Dimension.class); - Assertions.assertEquals("gsntnbybkzgcwr", model.name()); - Assertions.assertEquals("lxxwrljdouskc", model.displayName()); - Assertions.assertEquals("kocrcjdkwtnhx", model.internalName()); + Assertions.assertEquals("alhbx", model.name()); + Assertions.assertEquals("e", model.displayName()); + Assertions.assertEquals("zzvdudgwds", model.internalName()); Assertions.assertEquals(true, model.toBeExportedForShoebox()); } @@ -26,14 +26,14 @@ public void testDeserialize() throws Exception { public void testSerialize() throws Exception { Dimension model = new Dimension() - .withName("gsntnbybkzgcwr") - .withDisplayName("lxxwrljdouskc") - .withInternalName("kocrcjdkwtnhx") + .withName("alhbx") + .withDisplayName("e") + .withInternalName("zzvdudgwds") .withToBeExportedForShoebox(true); model = BinaryData.fromObject(model).toObject(Dimension.class); - Assertions.assertEquals("gsntnbybkzgcwr", model.name()); - Assertions.assertEquals("lxxwrljdouskc", model.displayName()); - Assertions.assertEquals("kocrcjdkwtnhx", model.internalName()); + Assertions.assertEquals("alhbx", model.name()); + Assertions.assertEquals("e", model.displayName()); + Assertions.assertEquals("zzvdudgwds", model.internalName()); Assertions.assertEquals(true, model.toBeExportedForShoebox()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LiveTraceCategoryTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LiveTraceCategoryTests.java index 4aa100ec4b70..963d389283df 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LiveTraceCategoryTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LiveTraceCategoryTests.java @@ -12,18 +12,16 @@ public final class LiveTraceCategoryTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { LiveTraceCategory model = - BinaryData - .fromString("{\"name\":\"plrbpbewtghf\",\"enabled\":\"lcgwxzvlvqh\"}") - .toObject(LiveTraceCategory.class); - Assertions.assertEquals("plrbpbewtghf", model.name()); - Assertions.assertEquals("lcgwxzvlvqh", model.enabled()); + BinaryData.fromString("{\"name\":\"dkow\",\"enabled\":\"bqpc\"}").toObject(LiveTraceCategory.class); + Assertions.assertEquals("dkow", model.name()); + Assertions.assertEquals("bqpc", model.enabled()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - LiveTraceCategory model = new LiveTraceCategory().withName("plrbpbewtghf").withEnabled("lcgwxzvlvqh"); + LiveTraceCategory model = new LiveTraceCategory().withName("dkow").withEnabled("bqpc"); model = BinaryData.fromObject(model).toObject(LiveTraceCategory.class); - Assertions.assertEquals("plrbpbewtghf", model.name()); - Assertions.assertEquals("lcgwxzvlvqh", model.enabled()); + Assertions.assertEquals("dkow", model.name()); + Assertions.assertEquals("bqpc", model.enabled()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LiveTraceConfigurationTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LiveTraceConfigurationTests.java index 7a4bc64d0927..652c6f4fad4a 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LiveTraceConfigurationTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LiveTraceConfigurationTests.java @@ -16,28 +16,26 @@ public void testDeserialize() throws Exception { LiveTraceConfiguration model = BinaryData .fromString( - "{\"enabled\":\"wgxhn\",\"categories\":[{\"name\":\"fbkp\",\"enabled\":\"gklwn\"},{\"name\":\"hjdauwhvylwz\",\"enabled\":\"dhxujznbmpo\"},{\"name\":\"wpr\",\"enabled\":\"lve\"},{\"name\":\"lupj\",\"enabled\":\"hfxobbcswsrtj\"}]}") + "{\"enabled\":\"emdwzrmuhapfc\",\"categories\":[{\"name\":\"qxqvpsvuoymgc\",\"enabled\":\"lvez\"},{\"name\":\"pqlmfe\",\"enabled\":\"erqwkyhkobopg\"}]}") .toObject(LiveTraceConfiguration.class); - Assertions.assertEquals("wgxhn", model.enabled()); - Assertions.assertEquals("fbkp", model.categories().get(0).name()); - Assertions.assertEquals("gklwn", model.categories().get(0).enabled()); + Assertions.assertEquals("emdwzrmuhapfc", model.enabled()); + Assertions.assertEquals("qxqvpsvuoymgc", model.categories().get(0).name()); + Assertions.assertEquals("lvez", model.categories().get(0).enabled()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { LiveTraceConfiguration model = new LiveTraceConfiguration() - .withEnabled("wgxhn") + .withEnabled("emdwzrmuhapfc") .withCategories( Arrays .asList( - new LiveTraceCategory().withName("fbkp").withEnabled("gklwn"), - new LiveTraceCategory().withName("hjdauwhvylwz").withEnabled("dhxujznbmpo"), - new LiveTraceCategory().withName("wpr").withEnabled("lve"), - new LiveTraceCategory().withName("lupj").withEnabled("hfxobbcswsrtj"))); + new LiveTraceCategory().withName("qxqvpsvuoymgc").withEnabled("lvez"), + new LiveTraceCategory().withName("pqlmfe").withEnabled("erqwkyhkobopg"))); model = BinaryData.fromObject(model).toObject(LiveTraceConfiguration.class); - Assertions.assertEquals("wgxhn", model.enabled()); - Assertions.assertEquals("fbkp", model.categories().get(0).name()); - Assertions.assertEquals("gklwn", model.categories().get(0).enabled()); + Assertions.assertEquals("emdwzrmuhapfc", model.enabled()); + Assertions.assertEquals("qxqvpsvuoymgc", model.categories().get(0).name()); + Assertions.assertEquals("lvez", model.categories().get(0).enabled()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LogSpecificationTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LogSpecificationTests.java index 6958be3dbd3a..e4a2e40dd3ab 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LogSpecificationTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/LogSpecificationTests.java @@ -13,17 +13,17 @@ public final class LogSpecificationTests { public void testDeserialize() throws Exception { LogSpecification model = BinaryData - .fromString("{\"name\":\"iksqr\",\"displayName\":\"ssainqpjwnzll\"}") + .fromString("{\"name\":\"twmcynpwlb\",\"displayName\":\"pgacftadehxnlty\"}") .toObject(LogSpecification.class); - Assertions.assertEquals("iksqr", model.name()); - Assertions.assertEquals("ssainqpjwnzll", model.displayName()); + Assertions.assertEquals("twmcynpwlb", model.name()); + Assertions.assertEquals("pgacftadehxnlty", model.displayName()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - LogSpecification model = new LogSpecification().withName("iksqr").withDisplayName("ssainqpjwnzll"); + LogSpecification model = new LogSpecification().withName("twmcynpwlb").withDisplayName("pgacftadehxnlty"); model = BinaryData.fromObject(model).toObject(LogSpecification.class); - Assertions.assertEquals("iksqr", model.name()); - Assertions.assertEquals("ssainqpjwnzll", model.displayName()); + Assertions.assertEquals("twmcynpwlb", model.name()); + Assertions.assertEquals("pgacftadehxnlty", model.displayName()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ManagedIdentitySettingsTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ManagedIdentitySettingsTests.java index 90d667c3f4ae..dc91b7963456 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ManagedIdentitySettingsTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ManagedIdentitySettingsTests.java @@ -12,14 +12,14 @@ public final class ManagedIdentitySettingsTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ManagedIdentitySettings model = - BinaryData.fromString("{\"resource\":\"zfq\"}").toObject(ManagedIdentitySettings.class); - Assertions.assertEquals("zfq", model.resource()); + BinaryData.fromString("{\"resource\":\"ysjkixqtnqttez\"}").toObject(ManagedIdentitySettings.class); + Assertions.assertEquals("ysjkixqtnqttez", model.resource()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ManagedIdentitySettings model = new ManagedIdentitySettings().withResource("zfq"); + ManagedIdentitySettings model = new ManagedIdentitySettings().withResource("ysjkixqtnqttez"); model = BinaryData.fromObject(model).toObject(ManagedIdentitySettings.class); - Assertions.assertEquals("zfq", model.resource()); + Assertions.assertEquals("ysjkixqtnqttez", model.resource()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ManagedIdentityTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ManagedIdentityTests.java index 6a7dec533fc7..7a4727b8b107 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ManagedIdentityTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ManagedIdentityTests.java @@ -18,28 +18,29 @@ public void testDeserialize() throws Exception { ManagedIdentity model = BinaryData .fromString( - "{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"bhsfxob\":{\"principalId\":\"cqaqtdoqmcbx\",\"clientId\":\"vxysl\"},\"shqjohxcrsbf\":{\"principalId\":\"tkblmpewww\",\"clientId\":\"krvrns\"},\"ybsrfbjfdtwss\":{\"principalId\":\"asrru\",\"clientId\":\"bhsqfsubcgjbirxb\"}},\"principalId\":\"ftpvjzbexil\",\"tenantId\":\"nfqqnvwp\"}") + "{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"ttpkiwkkbnujrywv\":{\"principalId\":\"hixbjxyfwnyl\",\"clientId\":\"ool\"},\"cbihwqk\":{\"principalId\":\"lbfpncurd\",\"clientId\":\"wiithtywub\"},\"ctondz\":{\"principalId\":\"dntwjchrdgo\",\"clientId\":\"xum\"}},\"principalId\":\"uu\",\"tenantId\":\"dlwggytsbwtovv\"}") .toObject(ManagedIdentity.class); - Assertions.assertEquals(ManagedIdentityType.USER_ASSIGNED, model.type()); + Assertions.assertEquals(ManagedIdentityType.SYSTEM_ASSIGNED, model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ManagedIdentity model = new ManagedIdentity() - .withType(ManagedIdentityType.USER_ASSIGNED) + .withType(ManagedIdentityType.SYSTEM_ASSIGNED) .withUserAssignedIdentities( mapOf( - "bhsfxob", + "ttpkiwkkbnujrywv", new UserAssignedIdentityProperty(), - "shqjohxcrsbf", + "cbihwqk", new UserAssignedIdentityProperty(), - "ybsrfbjfdtwss", + "ctondz", new UserAssignedIdentityProperty())); model = BinaryData.fromObject(model).toObject(ManagedIdentity.class); - Assertions.assertEquals(ManagedIdentityType.USER_ASSIGNED, model.type()); + Assertions.assertEquals(ManagedIdentityType.SYSTEM_ASSIGNED, model.type()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/MetricSpecificationTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/MetricSpecificationTests.java index 273468052e78..5e5082898bf9 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/MetricSpecificationTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/MetricSpecificationTests.java @@ -16,18 +16,18 @@ public void testDeserialize() throws Exception { MetricSpecification model = BinaryData .fromString( - "{\"name\":\"fpdvhpfxxypi\",\"displayName\":\"nmayhuybb\",\"displayDescription\":\"odepoogin\",\"unit\":\"amiheognarxz\",\"aggregationType\":\"heotusiv\",\"fillGapWithZero\":\"v\",\"category\":\"iqihn\",\"dimensions\":[{\"name\":\"bwjzr\",\"displayName\":\"ygxgispemvtz\",\"internalName\":\"ufubl\",\"toBeExportedForShoebox\":false},{\"name\":\"qeof\",\"displayName\":\"e\",\"internalName\":\"hqjbasvmsmj\",\"toBeExportedForShoebox\":true}]}") + "{\"name\":\"cgyncocpecf\",\"displayName\":\"mcoo\",\"displayDescription\":\"xlzevgbmqjqabcy\",\"unit\":\"ivkwlzuvccfwnfnb\",\"aggregationType\":\"fionl\",\"fillGapWithZero\":\"x\",\"category\":\"qgtz\",\"dimensions\":[{\"name\":\"qbqqwxr\",\"displayName\":\"eallnwsubisnj\",\"internalName\":\"pmng\",\"toBeExportedForShoebox\":false},{\"name\":\"xaqwoochcbonqv\",\"displayName\":\"vlrxnjeaseiph\",\"internalName\":\"f\",\"toBeExportedForShoebox\":false},{\"name\":\"yyien\",\"displayName\":\"dlwtgrhpdj\",\"internalName\":\"umasxazjpq\",\"toBeExportedForShoebox\":false}]}") .toObject(MetricSpecification.class); - Assertions.assertEquals("fpdvhpfxxypi", model.name()); - Assertions.assertEquals("nmayhuybb", model.displayName()); - Assertions.assertEquals("odepoogin", model.displayDescription()); - Assertions.assertEquals("amiheognarxz", model.unit()); - Assertions.assertEquals("heotusiv", model.aggregationType()); - Assertions.assertEquals("v", model.fillGapWithZero()); - Assertions.assertEquals("iqihn", model.category()); - Assertions.assertEquals("bwjzr", model.dimensions().get(0).name()); - Assertions.assertEquals("ygxgispemvtz", model.dimensions().get(0).displayName()); - Assertions.assertEquals("ufubl", model.dimensions().get(0).internalName()); + Assertions.assertEquals("cgyncocpecf", model.name()); + Assertions.assertEquals("mcoo", model.displayName()); + Assertions.assertEquals("xlzevgbmqjqabcy", model.displayDescription()); + Assertions.assertEquals("ivkwlzuvccfwnfnb", model.unit()); + Assertions.assertEquals("fionl", model.aggregationType()); + Assertions.assertEquals("x", model.fillGapWithZero()); + Assertions.assertEquals("qgtz", model.category()); + Assertions.assertEquals("qbqqwxr", model.dimensions().get(0).name()); + Assertions.assertEquals("eallnwsubisnj", model.dimensions().get(0).displayName()); + Assertions.assertEquals("pmng", model.dimensions().get(0).internalName()); Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForShoebox()); } @@ -35,37 +35,42 @@ public void testDeserialize() throws Exception { public void testSerialize() throws Exception { MetricSpecification model = new MetricSpecification() - .withName("fpdvhpfxxypi") - .withDisplayName("nmayhuybb") - .withDisplayDescription("odepoogin") - .withUnit("amiheognarxz") - .withAggregationType("heotusiv") - .withFillGapWithZero("v") - .withCategory("iqihn") + .withName("cgyncocpecf") + .withDisplayName("mcoo") + .withDisplayDescription("xlzevgbmqjqabcy") + .withUnit("ivkwlzuvccfwnfnb") + .withAggregationType("fionl") + .withFillGapWithZero("x") + .withCategory("qgtz") .withDimensions( Arrays .asList( new Dimension() - .withName("bwjzr") - .withDisplayName("ygxgispemvtz") - .withInternalName("ufubl") + .withName("qbqqwxr") + .withDisplayName("eallnwsubisnj") + .withInternalName("pmng") .withToBeExportedForShoebox(false), new Dimension() - .withName("qeof") - .withDisplayName("e") - .withInternalName("hqjbasvmsmj") - .withToBeExportedForShoebox(true))); + .withName("xaqwoochcbonqv") + .withDisplayName("vlrxnjeaseiph") + .withInternalName("f") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("yyien") + .withDisplayName("dlwtgrhpdj") + .withInternalName("umasxazjpq") + .withToBeExportedForShoebox(false))); model = BinaryData.fromObject(model).toObject(MetricSpecification.class); - Assertions.assertEquals("fpdvhpfxxypi", model.name()); - Assertions.assertEquals("nmayhuybb", model.displayName()); - Assertions.assertEquals("odepoogin", model.displayDescription()); - Assertions.assertEquals("amiheognarxz", model.unit()); - Assertions.assertEquals("heotusiv", model.aggregationType()); - Assertions.assertEquals("v", model.fillGapWithZero()); - Assertions.assertEquals("iqihn", model.category()); - Assertions.assertEquals("bwjzr", model.dimensions().get(0).name()); - Assertions.assertEquals("ygxgispemvtz", model.dimensions().get(0).displayName()); - Assertions.assertEquals("ufubl", model.dimensions().get(0).internalName()); + Assertions.assertEquals("cgyncocpecf", model.name()); + Assertions.assertEquals("mcoo", model.displayName()); + Assertions.assertEquals("xlzevgbmqjqabcy", model.displayDescription()); + Assertions.assertEquals("ivkwlzuvccfwnfnb", model.unit()); + Assertions.assertEquals("fionl", model.aggregationType()); + Assertions.assertEquals("x", model.fillGapWithZero()); + Assertions.assertEquals("qgtz", model.category()); + Assertions.assertEquals("qbqqwxr", model.dimensions().get(0).name()); + Assertions.assertEquals("eallnwsubisnj", model.dimensions().get(0).displayName()); + Assertions.assertEquals("pmng", model.dimensions().get(0).internalName()); Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForShoebox()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NameAvailabilityInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NameAvailabilityInnerTests.java index eb2bda63ad6c..7bf221e2a6af 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NameAvailabilityInnerTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NameAvailabilityInnerTests.java @@ -13,20 +13,20 @@ public final class NameAvailabilityInnerTests { public void testDeserialize() throws Exception { NameAvailabilityInner model = BinaryData - .fromString("{\"nameAvailable\":true,\"reason\":\"zdzevndh\",\"message\":\"wpdappdsbdkv\"}") + .fromString("{\"nameAvailable\":true,\"reason\":\"dejbavo\",\"message\":\"zdmohctbqvu\"}") .toObject(NameAvailabilityInner.class); Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals("zdzevndh", model.reason()); - Assertions.assertEquals("wpdappdsbdkv", model.message()); + Assertions.assertEquals("dejbavo", model.reason()); + Assertions.assertEquals("zdmohctbqvu", model.message()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { NameAvailabilityInner model = - new NameAvailabilityInner().withNameAvailable(true).withReason("zdzevndh").withMessage("wpdappdsbdkv"); + new NameAvailabilityInner().withNameAvailable(true).withReason("dejbavo").withMessage("zdmohctbqvu"); model = BinaryData.fromObject(model).toObject(NameAvailabilityInner.class); Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals("zdzevndh", model.reason()); - Assertions.assertEquals("wpdappdsbdkv", model.message()); + Assertions.assertEquals("dejbavo", model.reason()); + Assertions.assertEquals("zdmohctbqvu", model.message()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NameAvailabilityParametersTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NameAvailabilityParametersTests.java index 5165ebb59a6e..af06f600fb5a 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NameAvailabilityParametersTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NameAvailabilityParametersTests.java @@ -12,19 +12,16 @@ public final class NameAvailabilityParametersTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { NameAvailabilityParameters model = - BinaryData - .fromString("{\"type\":\"fmppe\",\"name\":\"bvmgxsabkyqduuji\"}") - .toObject(NameAvailabilityParameters.class); - Assertions.assertEquals("fmppe", model.type()); - Assertions.assertEquals("bvmgxsabkyqduuji", model.name()); + BinaryData.fromString("{\"type\":\"sop\",\"name\":\"usue\"}").toObject(NameAvailabilityParameters.class); + Assertions.assertEquals("sop", model.type()); + Assertions.assertEquals("usue", model.name()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - NameAvailabilityParameters model = - new NameAvailabilityParameters().withType("fmppe").withName("bvmgxsabkyqduuji"); + NameAvailabilityParameters model = new NameAvailabilityParameters().withType("sop").withName("usue"); model = BinaryData.fromObject(model).toObject(NameAvailabilityParameters.class); - Assertions.assertEquals("fmppe", model.type()); - Assertions.assertEquals("bvmgxsabkyqduuji", model.name()); + Assertions.assertEquals("sop", model.type()); + Assertions.assertEquals("usue", model.name()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NetworkAclTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NetworkAclTests.java index 551c9087bc78..fc67b976b0c0 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NetworkAclTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/NetworkAclTests.java @@ -16,25 +16,25 @@ public void testDeserialize() throws Exception { NetworkAcl model = BinaryData .fromString( - "{\"allow\":[\"ClientConnection\"],\"deny\":[\"ClientConnection\",\"RESTAPI\",\"ServerConnection\"]}") + "{\"allow\":[\"ServerConnection\"],\"deny\":[\"ServerConnection\",\"ClientConnection\",\"ServerConnection\"]}") .toObject(NetworkAcl.class); - Assertions.assertEquals(SignalRRequestType.CLIENT_CONNECTION, model.allow().get(0)); - Assertions.assertEquals(SignalRRequestType.CLIENT_CONNECTION, model.deny().get(0)); + Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.allow().get(0)); + Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.deny().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { NetworkAcl model = new NetworkAcl() - .withAllow(Arrays.asList(SignalRRequestType.CLIENT_CONNECTION)) + .withAllow(Arrays.asList(SignalRRequestType.SERVER_CONNECTION)) .withDeny( Arrays .asList( + SignalRRequestType.SERVER_CONNECTION, SignalRRequestType.CLIENT_CONNECTION, - SignalRRequestType.RESTAPI, SignalRRequestType.SERVER_CONNECTION)); model = BinaryData.fromObject(model).toObject(NetworkAcl.class); - Assertions.assertEquals(SignalRRequestType.CLIENT_CONNECTION, model.allow().get(0)); - Assertions.assertEquals(SignalRRequestType.CLIENT_CONNECTION, model.deny().get(0)); + Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.allow().get(0)); + Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.deny().get(0)); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationDisplayTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationDisplayTests.java index acbf9fe0d9a3..4c1736bb8110 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationDisplayTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationDisplayTests.java @@ -14,26 +14,26 @@ public void testDeserialize() throws Exception { OperationDisplay model = BinaryData .fromString( - "{\"provider\":\"tihfx\",\"resource\":\"jbpzvgnwzsymg\",\"operation\":\"uf\",\"description\":\"zk\"}") + "{\"provider\":\"ozkrwfndiodjpslw\",\"resource\":\"dpvwryoqpsoaccta\",\"operation\":\"kljla\",\"description\":\"cr\"}") .toObject(OperationDisplay.class); - Assertions.assertEquals("tihfx", model.provider()); - Assertions.assertEquals("jbpzvgnwzsymg", model.resource()); - Assertions.assertEquals("uf", model.operation()); - Assertions.assertEquals("zk", model.description()); + Assertions.assertEquals("ozkrwfndiodjpslw", model.provider()); + Assertions.assertEquals("dpvwryoqpsoaccta", model.resource()); + Assertions.assertEquals("kljla", model.operation()); + Assertions.assertEquals("cr", model.description()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { OperationDisplay model = new OperationDisplay() - .withProvider("tihfx") - .withResource("jbpzvgnwzsymg") - .withOperation("uf") - .withDescription("zk"); + .withProvider("ozkrwfndiodjpslw") + .withResource("dpvwryoqpsoaccta") + .withOperation("kljla") + .withDescription("cr"); model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("tihfx", model.provider()); - Assertions.assertEquals("jbpzvgnwzsymg", model.resource()); - Assertions.assertEquals("uf", model.operation()); - Assertions.assertEquals("zk", model.description()); + Assertions.assertEquals("ozkrwfndiodjpslw", model.provider()); + Assertions.assertEquals("dpvwryoqpsoaccta", model.resource()); + Assertions.assertEquals("kljla", model.operation()); + Assertions.assertEquals("cr", model.description()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationInnerTests.java index fdaec2061805..84e62316fcbb 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationInnerTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationInnerTests.java @@ -6,6 +6,9 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.signalr.fluent.models.OperationInner; +import com.azure.resourcemanager.signalr.models.Dimension; +import com.azure.resourcemanager.signalr.models.LogSpecification; +import com.azure.resourcemanager.signalr.models.MetricSpecification; import com.azure.resourcemanager.signalr.models.OperationDisplay; import com.azure.resourcemanager.signalr.models.OperationProperties; import com.azure.resourcemanager.signalr.models.ServiceSpecification; @@ -18,43 +21,120 @@ public void testDeserialize() throws Exception { OperationInner model = BinaryData .fromString( - "{\"name\":\"rh\",\"isDataAction\":true,\"display\":{\"provider\":\"hs\",\"resource\":\"urkdtmlx\",\"operation\":\"kuksjtxukcdm\",\"description\":\"rcryuanzwuxzdxta\"},\"origin\":\"lhmwhfpmrqobm\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[],\"logSpecifications\":[]}}}") + "{\"name\":\"fcqhsmyurkd\",\"isDataAction\":false,\"display\":{\"provider\":\"ekuksjtx\",\"resource\":\"cdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"kknryrtihf\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"zvgnwzs\",\"displayName\":\"glzufc\",\"displayDescription\":\"kohdbiha\",\"unit\":\"fhfcb\",\"aggregationType\":\"s\",\"fillGapWithZero\":\"ithxqhabifpi\",\"category\":\"wczbys\",\"dimensions\":[{}]},{\"name\":\"x\",\"displayName\":\"ivyqniwbybrkxvd\",\"displayDescription\":\"jgrtfwvukxga\",\"unit\":\"ccsnhsjc\",\"aggregationType\":\"ejhkry\",\"fillGapWithZero\":\"napczwlokjy\",\"category\":\"kkvnipjox\",\"dimensions\":[{},{}]}],\"logSpecifications\":[{\"name\":\"ejspodmail\",\"displayName\":\"deh\"},{\"name\":\"wyahuxinpmqnja\",\"displayName\":\"ixjsprozvcputeg\"},{\"name\":\"wmfdatscmdvpjhul\",\"displayName\":\"uvm\"}]}}}") .toObject(OperationInner.class); - Assertions.assertEquals("rh", model.name()); - Assertions.assertEquals(true, model.isDataAction()); - Assertions.assertEquals("hs", model.display().provider()); - Assertions.assertEquals("urkdtmlx", model.display().resource()); - Assertions.assertEquals("kuksjtxukcdm", model.display().operation()); - Assertions.assertEquals("rcryuanzwuxzdxta", model.display().description()); - Assertions.assertEquals("lhmwhfpmrqobm", model.origin()); + Assertions.assertEquals("fcqhsmyurkd", model.name()); + Assertions.assertEquals(false, model.isDataAction()); + Assertions.assertEquals("ekuksjtx", model.display().provider()); + Assertions.assertEquals("cdm", model.display().resource()); + Assertions.assertEquals("rcryuanzwuxzdxta", model.display().operation()); + Assertions.assertEquals("lhmwhfpmrqobm", model.display().description()); + Assertions.assertEquals("kknryrtihf", model.origin()); + Assertions + .assertEquals("zvgnwzs", model.properties().serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals( + "glzufc", model.properties().serviceSpecification().metricSpecifications().get(0).displayName()); + Assertions + .assertEquals( + "kohdbiha", + model.properties().serviceSpecification().metricSpecifications().get(0).displayDescription()); + Assertions + .assertEquals("fhfcb", model.properties().serviceSpecification().metricSpecifications().get(0).unit()); + Assertions + .assertEquals( + "s", model.properties().serviceSpecification().metricSpecifications().get(0).aggregationType()); + Assertions + .assertEquals( + "ithxqhabifpi", + model.properties().serviceSpecification().metricSpecifications().get(0).fillGapWithZero()); + Assertions + .assertEquals("wczbys", model.properties().serviceSpecification().metricSpecifications().get(0).category()); + Assertions + .assertEquals("ejspodmail", model.properties().serviceSpecification().logSpecifications().get(0).name()); + Assertions + .assertEquals("deh", model.properties().serviceSpecification().logSpecifications().get(0).displayName()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { OperationInner model = new OperationInner() - .withName("rh") - .withIsDataAction(true) + .withName("fcqhsmyurkd") + .withIsDataAction(false) .withDisplay( new OperationDisplay() - .withProvider("hs") - .withResource("urkdtmlx") - .withOperation("kuksjtxukcdm") - .withDescription("rcryuanzwuxzdxta")) - .withOrigin("lhmwhfpmrqobm") + .withProvider("ekuksjtx") + .withResource("cdm") + .withOperation("rcryuanzwuxzdxta") + .withDescription("lhmwhfpmrqobm")) + .withOrigin("kknryrtihf") .withProperties( new OperationProperties() .withServiceSpecification( new ServiceSpecification() - .withMetricSpecifications(Arrays.asList()) - .withLogSpecifications(Arrays.asList()))); + .withMetricSpecifications( + Arrays + .asList( + new MetricSpecification() + .withName("zvgnwzs") + .withDisplayName("glzufc") + .withDisplayDescription("kohdbiha") + .withUnit("fhfcb") + .withAggregationType("s") + .withFillGapWithZero("ithxqhabifpi") + .withCategory("wczbys") + .withDimensions(Arrays.asList(new Dimension())), + new MetricSpecification() + .withName("x") + .withDisplayName("ivyqniwbybrkxvd") + .withDisplayDescription("jgrtfwvukxga") + .withUnit("ccsnhsjc") + .withAggregationType("ejhkry") + .withFillGapWithZero("napczwlokjy") + .withCategory("kkvnipjox") + .withDimensions(Arrays.asList(new Dimension(), new Dimension())))) + .withLogSpecifications( + Arrays + .asList( + new LogSpecification().withName("ejspodmail").withDisplayName("deh"), + new LogSpecification() + .withName("wyahuxinpmqnja") + .withDisplayName("ixjsprozvcputeg"), + new LogSpecification() + .withName("wmfdatscmdvpjhul") + .withDisplayName("uvm"))))); model = BinaryData.fromObject(model).toObject(OperationInner.class); - Assertions.assertEquals("rh", model.name()); - Assertions.assertEquals(true, model.isDataAction()); - Assertions.assertEquals("hs", model.display().provider()); - Assertions.assertEquals("urkdtmlx", model.display().resource()); - Assertions.assertEquals("kuksjtxukcdm", model.display().operation()); - Assertions.assertEquals("rcryuanzwuxzdxta", model.display().description()); - Assertions.assertEquals("lhmwhfpmrqobm", model.origin()); + Assertions.assertEquals("fcqhsmyurkd", model.name()); + Assertions.assertEquals(false, model.isDataAction()); + Assertions.assertEquals("ekuksjtx", model.display().provider()); + Assertions.assertEquals("cdm", model.display().resource()); + Assertions.assertEquals("rcryuanzwuxzdxta", model.display().operation()); + Assertions.assertEquals("lhmwhfpmrqobm", model.display().description()); + Assertions.assertEquals("kknryrtihf", model.origin()); + Assertions + .assertEquals("zvgnwzs", model.properties().serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals( + "glzufc", model.properties().serviceSpecification().metricSpecifications().get(0).displayName()); + Assertions + .assertEquals( + "kohdbiha", + model.properties().serviceSpecification().metricSpecifications().get(0).displayDescription()); + Assertions + .assertEquals("fhfcb", model.properties().serviceSpecification().metricSpecifications().get(0).unit()); + Assertions + .assertEquals( + "s", model.properties().serviceSpecification().metricSpecifications().get(0).aggregationType()); + Assertions + .assertEquals( + "ithxqhabifpi", + model.properties().serviceSpecification().metricSpecifications().get(0).fillGapWithZero()); + Assertions + .assertEquals("wczbys", model.properties().serviceSpecification().metricSpecifications().get(0).category()); + Assertions + .assertEquals("ejspodmail", model.properties().serviceSpecification().logSpecifications().get(0).name()); + Assertions + .assertEquals("deh", model.properties().serviceSpecification().logSpecifications().get(0).displayName()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationListTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationListTests.java index 13c9b7cea57c..7629096a9531 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationListTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationListTests.java @@ -6,9 +6,12 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.signalr.fluent.models.OperationInner; +import com.azure.resourcemanager.signalr.models.LogSpecification; +import com.azure.resourcemanager.signalr.models.MetricSpecification; import com.azure.resourcemanager.signalr.models.OperationDisplay; import com.azure.resourcemanager.signalr.models.OperationList; import com.azure.resourcemanager.signalr.models.OperationProperties; +import com.azure.resourcemanager.signalr.models.ServiceSpecification; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -18,7 +21,7 @@ public void testDeserialize() throws Exception { OperationList model = BinaryData .fromString( - "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"ownoizhw\",\"properties\":{}},{\"name\":\"bqsoqijg\",\"isDataAction\":true,\"display\":{\"provider\":\"azlobcufpdznrbt\",\"resource\":\"qjnqglhqgnufoooj\",\"operation\":\"ifsqesaagdfmg\",\"description\":\"lhjxr\"},\"origin\":\"kwm\",\"properties\":{}},{\"name\":\"siznto\",\"isDataAction\":false,\"display\":{\"provider\":\"uajpsquc\",\"resource\":\"o\",\"operation\":\"dkfo\",\"description\":\"nygj\"},\"origin\":\"jddeqsrdeupewnw\",\"properties\":{}}],\"nextLink\":\"jzyflu\"}") + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"ownoizhw\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[{},{}],\"logSpecifications\":[{},{}]}}},{\"name\":\"qijgkd\",\"isDataAction\":true,\"display\":{\"provider\":\"lobcufpdznrbtcq\",\"resource\":\"nq\",\"operation\":\"hqgnufooojywif\",\"description\":\"esaagdfm\"},\"origin\":\"zlhjxrifkwmrvkt\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[{}],\"logSpecifications\":[{},{}]}}},{\"name\":\"pa\",\"isDataAction\":false,\"display\":{\"provider\":\"s\",\"resource\":\"cmpoyfdkfogkny\",\"operation\":\"ofjdde\",\"description\":\"rd\"},\"origin\":\"pewnw\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[{},{}],\"logSpecifications\":[{},{},{}]}}}],\"nextLink\":\"lusarh\"}") .toObject(OperationList.class); Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); Assertions.assertEquals(true, model.value().get(0).isDataAction()); @@ -27,7 +30,7 @@ public void testDeserialize() throws Exception { Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); Assertions.assertEquals("zehtbmu", model.value().get(0).display().description()); Assertions.assertEquals("ownoizhw", model.value().get(0).origin()); - Assertions.assertEquals("jzyflu", model.nextLink()); + Assertions.assertEquals("lusarh", model.nextLink()); } @org.junit.jupiter.api.Test @@ -47,30 +50,54 @@ public void testSerialize() throws Exception { .withOperation("hdxbmtqio") .withDescription("zehtbmu")) .withOrigin("ownoizhw") - .withProperties(new OperationProperties()), + .withProperties( + new OperationProperties() + .withServiceSpecification( + new ServiceSpecification() + .withMetricSpecifications( + Arrays.asList(new MetricSpecification(), new MetricSpecification())) + .withLogSpecifications( + Arrays.asList(new LogSpecification(), new LogSpecification())))), new OperationInner() - .withName("bqsoqijg") + .withName("qijgkd") .withIsDataAction(true) .withDisplay( new OperationDisplay() - .withProvider("azlobcufpdznrbt") - .withResource("qjnqglhqgnufoooj") - .withOperation("ifsqesaagdfmg") - .withDescription("lhjxr")) - .withOrigin("kwm") - .withProperties(new OperationProperties()), + .withProvider("lobcufpdznrbtcq") + .withResource("nq") + .withOperation("hqgnufooojywif") + .withDescription("esaagdfm")) + .withOrigin("zlhjxrifkwmrvkt") + .withProperties( + new OperationProperties() + .withServiceSpecification( + new ServiceSpecification() + .withMetricSpecifications(Arrays.asList(new MetricSpecification())) + .withLogSpecifications( + Arrays.asList(new LogSpecification(), new LogSpecification())))), new OperationInner() - .withName("siznto") + .withName("pa") .withIsDataAction(false) .withDisplay( new OperationDisplay() - .withProvider("uajpsquc") - .withResource("o") - .withOperation("dkfo") - .withDescription("nygj")) - .withOrigin("jddeqsrdeupewnw") - .withProperties(new OperationProperties()))) - .withNextLink("jzyflu"); + .withProvider("s") + .withResource("cmpoyfdkfogkny") + .withOperation("ofjdde") + .withDescription("rd")) + .withOrigin("pewnw") + .withProperties( + new OperationProperties() + .withServiceSpecification( + new ServiceSpecification() + .withMetricSpecifications( + Arrays.asList(new MetricSpecification(), new MetricSpecification())) + .withLogSpecifications( + Arrays + .asList( + new LogSpecification(), + new LogSpecification(), + new LogSpecification())))))) + .withNextLink("lusarh"); model = BinaryData.fromObject(model).toObject(OperationList.class); Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); Assertions.assertEquals(true, model.value().get(0).isDataAction()); @@ -79,6 +106,6 @@ public void testSerialize() throws Exception { Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); Assertions.assertEquals("zehtbmu", model.value().get(0).display().description()); Assertions.assertEquals("ownoizhw", model.value().get(0).origin()); - Assertions.assertEquals("jzyflu", model.nextLink()); + Assertions.assertEquals("lusarh", model.nextLink()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationPropertiesTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationPropertiesTests.java index 066ad973b0f4..4c5f7311a534 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationPropertiesTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationPropertiesTests.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.signalr.generated; import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.signalr.models.Dimension; import com.azure.resourcemanager.signalr.models.LogSpecification; import com.azure.resourcemanager.signalr.models.MetricSpecification; import com.azure.resourcemanager.signalr.models.OperationProperties; @@ -18,18 +19,44 @@ public void testDeserialize() throws Exception { OperationProperties model = BinaryData .fromString( - "{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"hanufhfcbjysagi\",\"displayName\":\"xqhabi\",\"displayDescription\":\"ikxwc\",\"unit\":\"yscnpqxu\",\"aggregationType\":\"vyq\",\"fillGapWithZero\":\"wby\",\"category\":\"k\",\"dimensions\":[]},{\"name\":\"umjgrtfwvuk\",\"displayName\":\"audccsnhs\",\"displayDescription\":\"nyejhkryhtnap\",\"unit\":\"wlokjyem\",\"aggregationType\":\"vnipjox\",\"fillGapWithZero\":\"nchgej\",\"category\":\"odmailzyd\",\"dimensions\":[]}],\"logSpecifications\":[{\"name\":\"yahux\",\"displayName\":\"pmqnja\"},{\"name\":\"ixjsprozvcputeg\",\"displayName\":\"wmfdatscmdvpjhul\"},{\"name\":\"uvm\",\"displayName\":\"ozkrwfndiodjpslw\"},{\"name\":\"dpvwryoqpsoaccta\",\"displayName\":\"kljla\"}]}}") + "{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"dosyg\",\"displayName\":\"paojakhmsbzjh\",\"displayDescription\":\"zevdphlx\",\"unit\":\"lthqtrgqjbp\",\"aggregationType\":\"fsinzgvfcjrwzoxx\",\"fillGapWithZero\":\"felluwfzitonpe\",\"category\":\"pjkjlxofpdv\",\"dimensions\":[{\"name\":\"xypininmayhuybbk\",\"displayName\":\"depoog\",\"internalName\":\"uvamiheognarxzxt\",\"toBeExportedForShoebox\":false},{\"name\":\"usivye\",\"displayName\":\"ciqihnhung\",\"internalName\":\"jzrnf\",\"toBeExportedForShoebox\":true},{\"name\":\"ispe\",\"displayName\":\"tzfkufubl\",\"internalName\":\"fxqeof\",\"toBeExportedForShoebox\":false},{\"name\":\"jhqjbasvmsmjqul\",\"displayName\":\"sntnbybkzgcw\",\"internalName\":\"clxxwrljdo\",\"toBeExportedForShoebox\":true}]},{\"name\":\"qvkoc\",\"displayName\":\"jdkwtnhxbnjb\",\"displayDescription\":\"sqrglssainq\",\"unit\":\"wnzlljfmppeeb\",\"aggregationType\":\"gxsabkyq\",\"fillGapWithZero\":\"ujitcjcz\",\"category\":\"evndh\",\"dimensions\":[{\"name\":\"d\",\"displayName\":\"p\",\"internalName\":\"bdkvwrwjf\",\"toBeExportedForShoebox\":false},{\"name\":\"hutje\",\"displayName\":\"mrldhu\",\"internalName\":\"zzd\",\"toBeExportedForShoebox\":true},{\"name\":\"hocdgeab\",\"displayName\":\"phut\",\"internalName\":\"ndv\",\"toBeExportedForShoebox\":true}]},{\"name\":\"wyiftyhxhur\",\"displayName\":\"ftyxolniw\",\"displayDescription\":\"cukjf\",\"unit\":\"iawxklry\",\"aggregationType\":\"wckbasyypnd\",\"fillGapWithZero\":\"sgcbac\",\"category\":\"ejk\",\"dimensions\":[{\"name\":\"qgoulznd\",\"displayName\":\"kwy\",\"internalName\":\"gfgibm\",\"toBeExportedForShoebox\":false},{\"name\":\"keqsrxybzqqedq\",\"displayName\":\"bciqfouflm\",\"internalName\":\"kzsmodm\",\"toBeExportedForShoebox\":false},{\"name\":\"gpbkwtmut\",\"displayName\":\"qktapspwgcuert\",\"internalName\":\"kdosvqw\",\"toBeExportedForShoebox\":true},{\"name\":\"gbbjfddgmbmbe\",\"displayName\":\"pbhtqqrolfpfpsa\",\"internalName\":\"bquxigjy\",\"toBeExportedForShoebox\":true}]}],\"logSpecifications\":[{\"name\":\"yfhrtxilnerkujy\",\"displayName\":\"l\"},{\"name\":\"uvfqawrlyxwj\",\"displayName\":\"prbnwbxgjvtbv\"},{\"name\":\"sszdnru\",\"displayName\":\"guhmuouqfpr\"},{\"name\":\"wbnguitnwui\",\"displayName\":\"a\"}]}}") .toObject(OperationProperties.class); - Assertions.assertEquals("hanufhfcbjysagi", model.serviceSpecification().metricSpecifications().get(0).name()); - Assertions.assertEquals("xqhabi", model.serviceSpecification().metricSpecifications().get(0).displayName()); - Assertions - .assertEquals("ikxwc", model.serviceSpecification().metricSpecifications().get(0).displayDescription()); - Assertions.assertEquals("yscnpqxu", model.serviceSpecification().metricSpecifications().get(0).unit()); - Assertions.assertEquals("vyq", model.serviceSpecification().metricSpecifications().get(0).aggregationType()); - Assertions.assertEquals("wby", model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero()); - Assertions.assertEquals("k", model.serviceSpecification().metricSpecifications().get(0).category()); - Assertions.assertEquals("yahux", model.serviceSpecification().logSpecifications().get(0).name()); - Assertions.assertEquals("pmqnja", model.serviceSpecification().logSpecifications().get(0).displayName()); + Assertions.assertEquals("dosyg", model.serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals("paojakhmsbzjh", model.serviceSpecification().metricSpecifications().get(0).displayName()); + Assertions + .assertEquals("zevdphlx", model.serviceSpecification().metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("lthqtrgqjbp", model.serviceSpecification().metricSpecifications().get(0).unit()); + Assertions + .assertEquals( + "fsinzgvfcjrwzoxx", model.serviceSpecification().metricSpecifications().get(0).aggregationType()); + Assertions + .assertEquals( + "felluwfzitonpe", model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero()); + Assertions.assertEquals("pjkjlxofpdv", model.serviceSpecification().metricSpecifications().get(0).category()); + Assertions + .assertEquals( + "xypininmayhuybbk", + model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).name()); + Assertions + .assertEquals( + "depoog", model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).displayName()); + Assertions + .assertEquals( + "uvamiheognarxzxt", + model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).internalName()); + Assertions + .assertEquals( + false, + model + .serviceSpecification() + .metricSpecifications() + .get(0) + .dimensions() + .get(0) + .toBeExportedForShoebox()); + Assertions.assertEquals("yfhrtxilnerkujy", model.serviceSpecification().logSpecifications().get(0).name()); + Assertions.assertEquals("l", model.serviceSpecification().logSpecifications().get(0).displayName()); } @org.junit.jupiter.api.Test @@ -42,42 +69,136 @@ public void testSerialize() throws Exception { Arrays .asList( new MetricSpecification() - .withName("hanufhfcbjysagi") - .withDisplayName("xqhabi") - .withDisplayDescription("ikxwc") - .withUnit("yscnpqxu") - .withAggregationType("vyq") - .withFillGapWithZero("wby") - .withCategory("k") - .withDimensions(Arrays.asList()), + .withName("dosyg") + .withDisplayName("paojakhmsbzjh") + .withDisplayDescription("zevdphlx") + .withUnit("lthqtrgqjbp") + .withAggregationType("fsinzgvfcjrwzoxx") + .withFillGapWithZero("felluwfzitonpe") + .withCategory("pjkjlxofpdv") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("xypininmayhuybbk") + .withDisplayName("depoog") + .withInternalName("uvamiheognarxzxt") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("usivye") + .withDisplayName("ciqihnhung") + .withInternalName("jzrnf") + .withToBeExportedForShoebox(true), + new Dimension() + .withName("ispe") + .withDisplayName("tzfkufubl") + .withInternalName("fxqeof") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("jhqjbasvmsmjqul") + .withDisplayName("sntnbybkzgcw") + .withInternalName("clxxwrljdo") + .withToBeExportedForShoebox(true))), + new MetricSpecification() + .withName("qvkoc") + .withDisplayName("jdkwtnhxbnjb") + .withDisplayDescription("sqrglssainq") + .withUnit("wnzlljfmppeeb") + .withAggregationType("gxsabkyq") + .withFillGapWithZero("ujitcjcz") + .withCategory("evndh") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("d") + .withDisplayName("p") + .withInternalName("bdkvwrwjf") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("hutje") + .withDisplayName("mrldhu") + .withInternalName("zzd") + .withToBeExportedForShoebox(true), + new Dimension() + .withName("hocdgeab") + .withDisplayName("phut") + .withInternalName("ndv") + .withToBeExportedForShoebox(true))), new MetricSpecification() - .withName("umjgrtfwvuk") - .withDisplayName("audccsnhs") - .withDisplayDescription("nyejhkryhtnap") - .withUnit("wlokjyem") - .withAggregationType("vnipjox") - .withFillGapWithZero("nchgej") - .withCategory("odmailzyd") - .withDimensions(Arrays.asList()))) + .withName("wyiftyhxhur") + .withDisplayName("ftyxolniw") + .withDisplayDescription("cukjf") + .withUnit("iawxklry") + .withAggregationType("wckbasyypnd") + .withFillGapWithZero("sgcbac") + .withCategory("ejk") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("qgoulznd") + .withDisplayName("kwy") + .withInternalName("gfgibm") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("keqsrxybzqqedq") + .withDisplayName("bciqfouflm") + .withInternalName("kzsmodm") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("gpbkwtmut") + .withDisplayName("qktapspwgcuert") + .withInternalName("kdosvqw") + .withToBeExportedForShoebox(true), + new Dimension() + .withName("gbbjfddgmbmbe") + .withDisplayName("pbhtqqrolfpfpsa") + .withInternalName("bquxigjy") + .withToBeExportedForShoebox(true))))) .withLogSpecifications( Arrays .asList( - new LogSpecification().withName("yahux").withDisplayName("pmqnja"), - new LogSpecification() - .withName("ixjsprozvcputeg") - .withDisplayName("wmfdatscmdvpjhul"), - new LogSpecification().withName("uvm").withDisplayName("ozkrwfndiodjpslw"), - new LogSpecification().withName("dpvwryoqpsoaccta").withDisplayName("kljla")))); + new LogSpecification().withName("yfhrtxilnerkujy").withDisplayName("l"), + new LogSpecification().withName("uvfqawrlyxwj").withDisplayName("prbnwbxgjvtbv"), + new LogSpecification().withName("sszdnru").withDisplayName("guhmuouqfpr"), + new LogSpecification().withName("wbnguitnwui").withDisplayName("a")))); model = BinaryData.fromObject(model).toObject(OperationProperties.class); - Assertions.assertEquals("hanufhfcbjysagi", model.serviceSpecification().metricSpecifications().get(0).name()); - Assertions.assertEquals("xqhabi", model.serviceSpecification().metricSpecifications().get(0).displayName()); - Assertions - .assertEquals("ikxwc", model.serviceSpecification().metricSpecifications().get(0).displayDescription()); - Assertions.assertEquals("yscnpqxu", model.serviceSpecification().metricSpecifications().get(0).unit()); - Assertions.assertEquals("vyq", model.serviceSpecification().metricSpecifications().get(0).aggregationType()); - Assertions.assertEquals("wby", model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero()); - Assertions.assertEquals("k", model.serviceSpecification().metricSpecifications().get(0).category()); - Assertions.assertEquals("yahux", model.serviceSpecification().logSpecifications().get(0).name()); - Assertions.assertEquals("pmqnja", model.serviceSpecification().logSpecifications().get(0).displayName()); + Assertions.assertEquals("dosyg", model.serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals("paojakhmsbzjh", model.serviceSpecification().metricSpecifications().get(0).displayName()); + Assertions + .assertEquals("zevdphlx", model.serviceSpecification().metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("lthqtrgqjbp", model.serviceSpecification().metricSpecifications().get(0).unit()); + Assertions + .assertEquals( + "fsinzgvfcjrwzoxx", model.serviceSpecification().metricSpecifications().get(0).aggregationType()); + Assertions + .assertEquals( + "felluwfzitonpe", model.serviceSpecification().metricSpecifications().get(0).fillGapWithZero()); + Assertions.assertEquals("pjkjlxofpdv", model.serviceSpecification().metricSpecifications().get(0).category()); + Assertions + .assertEquals( + "xypininmayhuybbk", + model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).name()); + Assertions + .assertEquals( + "depoog", model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).displayName()); + Assertions + .assertEquals( + "uvamiheognarxzxt", + model.serviceSpecification().metricSpecifications().get(0).dimensions().get(0).internalName()); + Assertions + .assertEquals( + false, + model + .serviceSpecification() + .metricSpecifications() + .get(0) + .dimensions() + .get(0) + .toBeExportedForShoebox()); + Assertions.assertEquals("yfhrtxilnerkujy", model.serviceSpecification().logSpecifications().get(0).name()); + Assertions.assertEquals("l", model.serviceSpecification().logSpecifications().get(0).displayName()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationsListMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationsListMockTests.java index b1b77efdd50b..86a20267d631 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationsListMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/OperationsListMockTests.java @@ -32,7 +32,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"name\":\"kotl\",\"isDataAction\":false,\"display\":{\"provider\":\"gsyocogj\",\"resource\":\"dtbnnha\",\"operation\":\"ocrkvcikh\",\"description\":\"p\"},\"origin\":\"qgxqquezikyw\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[],\"logSpecifications\":[]}}}]}"; + "{\"value\":[{\"name\":\"zysdzh\",\"isDataAction\":true,\"display\":{\"provider\":\"aiqyuvvfo\",\"resource\":\"p\",\"operation\":\"qyikvy\",\"description\":\"uyav\"},\"origin\":\"wmn\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"fybvpoek\",\"displayName\":\"gsgbdhuzq\",\"displayDescription\":\"j\",\"unit\":\"kynscliqhzv\",\"aggregationType\":\"nk\",\"fillGapWithZero\":\"tkubotppn\",\"category\":\"xz\",\"dimensions\":[{},{},{}]}],\"logSpecifications\":[{\"name\":\"bbc\",\"displayName\":\"qagt\"},{\"name\":\"dhlfkqojpykvgt\",\"displayName\":\"cnifm\"}]}}}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,12 +62,90 @@ public void testList() throws Exception { PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("kotl", response.iterator().next().name()); - Assertions.assertEquals(false, response.iterator().next().isDataAction()); - Assertions.assertEquals("gsyocogj", response.iterator().next().display().provider()); - Assertions.assertEquals("dtbnnha", response.iterator().next().display().resource()); - Assertions.assertEquals("ocrkvcikh", response.iterator().next().display().operation()); - Assertions.assertEquals("p", response.iterator().next().display().description()); - Assertions.assertEquals("qgxqquezikyw", response.iterator().next().origin()); + Assertions.assertEquals("zysdzh", response.iterator().next().name()); + Assertions.assertEquals(true, response.iterator().next().isDataAction()); + Assertions.assertEquals("aiqyuvvfo", response.iterator().next().display().provider()); + Assertions.assertEquals("p", response.iterator().next().display().resource()); + Assertions.assertEquals("qyikvy", response.iterator().next().display().operation()); + Assertions.assertEquals("uyav", response.iterator().next().display().description()); + Assertions.assertEquals("wmn", response.iterator().next().origin()); + Assertions + .assertEquals( + "fybvpoek", + response.iterator().next().properties().serviceSpecification().metricSpecifications().get(0).name()); + Assertions + .assertEquals( + "gsgbdhuzq", + response + .iterator() + .next() + .properties() + .serviceSpecification() + .metricSpecifications() + .get(0) + .displayName()); + Assertions + .assertEquals( + "j", + response + .iterator() + .next() + .properties() + .serviceSpecification() + .metricSpecifications() + .get(0) + .displayDescription()); + Assertions + .assertEquals( + "kynscliqhzv", + response.iterator().next().properties().serviceSpecification().metricSpecifications().get(0).unit()); + Assertions + .assertEquals( + "nk", + response + .iterator() + .next() + .properties() + .serviceSpecification() + .metricSpecifications() + .get(0) + .aggregationType()); + Assertions + .assertEquals( + "tkubotppn", + response + .iterator() + .next() + .properties() + .serviceSpecification() + .metricSpecifications() + .get(0) + .fillGapWithZero()); + Assertions + .assertEquals( + "xz", + response + .iterator() + .next() + .properties() + .serviceSpecification() + .metricSpecifications() + .get(0) + .category()); + Assertions + .assertEquals( + "bbc", + response.iterator().next().properties().serviceSpecification().logSpecifications().get(0).name()); + Assertions + .assertEquals( + "qagt", + response + .iterator() + .next() + .properties() + .serviceSpecification() + .logSpecifications() + .get(0) + .displayName()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointAclTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointAclTests.java index 17a8d25c1721..a2830121be27 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointAclTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointAclTests.java @@ -16,11 +16,11 @@ public void testDeserialize() throws Exception { PrivateEndpointAcl model = BinaryData .fromString( - "{\"name\":\"zvszj\",\"allow\":[\"ServerConnection\",\"ClientConnection\",\"Trace\"],\"deny\":[\"ServerConnection\",\"ServerConnection\"]}") + "{\"name\":\"evzhfsto\",\"allow\":[\"ServerConnection\",\"Trace\",\"Trace\",\"ServerConnection\"],\"deny\":[\"Trace\",\"Trace\"]}") .toObject(PrivateEndpointAcl.class); Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.allow().get(0)); - Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.deny().get(0)); - Assertions.assertEquals("zvszj", model.name()); + Assertions.assertEquals(SignalRRequestType.TRACE, model.deny().get(0)); + Assertions.assertEquals("evzhfsto", model.name()); } @org.junit.jupiter.api.Test @@ -31,13 +31,14 @@ public void testSerialize() throws Exception { Arrays .asList( SignalRRequestType.SERVER_CONNECTION, - SignalRRequestType.CLIENT_CONNECTION, - SignalRRequestType.TRACE)) - .withDeny(Arrays.asList(SignalRRequestType.SERVER_CONNECTION, SignalRRequestType.SERVER_CONNECTION)) - .withName("zvszj"); + SignalRRequestType.TRACE, + SignalRRequestType.TRACE, + SignalRRequestType.SERVER_CONNECTION)) + .withDeny(Arrays.asList(SignalRRequestType.TRACE, SignalRRequestType.TRACE)) + .withName("evzhfsto"); model = BinaryData.fromObject(model).toObject(PrivateEndpointAcl.class); Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.allow().get(0)); - Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.deny().get(0)); - Assertions.assertEquals("zvszj", model.name()); + Assertions.assertEquals(SignalRRequestType.TRACE, model.deny().get(0)); + Assertions.assertEquals("evzhfsto", model.name()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionInnerTests.java index ad1af7d18f41..93797e7a547b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionInnerTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionInnerTests.java @@ -17,32 +17,32 @@ public void testDeserialize() throws Exception { PrivateEndpointConnectionInner model = BinaryData .fromString( - "{\"properties\":{\"provisioningState\":\"Creating\",\"privateEndpoint\":{\"id\":\"nxdhbt\"},\"groupIds\":[\"h\",\"wpn\"],\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"nermcl\",\"actionsRequired\":\"lphox\"}},\"id\":\"scrpabgyepsbjt\",\"name\":\"zq\",\"type\":\"gxywpmue\"}") + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"privateEndpoint\":{\"id\":\"fzeeyebizik\"},\"groupIds\":[\"hqlbjbsybbq\",\"r\",\"t\",\"dgmfpgvmpipasl\"],\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"x\",\"actionsRequired\":\"mwutwbdsre\"}},\"id\":\"drhneuyow\",\"name\":\"kdw\",\"type\":\"t\"}") .toObject(PrivateEndpointConnectionInner.class); - Assertions.assertEquals("nxdhbt", model.privateEndpoint().id()); + Assertions.assertEquals("fzeeyebizik", model.privateEndpoint().id()); Assertions .assertEquals( PrivateLinkServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("nermcl", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("lphox", model.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("x", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("mwutwbdsre", model.privateLinkServiceConnectionState().actionsRequired()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PrivateEndpointConnectionInner model = new PrivateEndpointConnectionInner() - .withPrivateEndpoint(new PrivateEndpoint().withId("nxdhbt")) + .withPrivateEndpoint(new PrivateEndpoint().withId("fzeeyebizik")) .withPrivateLinkServiceConnectionState( new PrivateLinkServiceConnectionState() .withStatus(PrivateLinkServiceConnectionStatus.REJECTED) - .withDescription("nermcl") - .withActionsRequired("lphox")); + .withDescription("x") + .withActionsRequired("mwutwbdsre")); model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionInner.class); - Assertions.assertEquals("nxdhbt", model.privateEndpoint().id()); + Assertions.assertEquals("fzeeyebizik", model.privateEndpoint().id()); Assertions .assertEquals( PrivateLinkServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("nermcl", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("lphox", model.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("x", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("mwutwbdsre", model.privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionListTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionListTests.java index 8a4b0574206a..460906360b42 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionListTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionListTests.java @@ -6,7 +6,10 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.signalr.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.signalr.models.PrivateEndpoint; import com.azure.resourcemanager.signalr.models.PrivateEndpointConnectionList; +import com.azure.resourcemanager.signalr.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.signalr.models.PrivateLinkServiceConnectionStatus; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -16,18 +19,48 @@ public void testDeserialize() throws Exception { PrivateEndpointConnectionList model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Updating\",\"groupIds\":[]},\"id\":\"kwobdagxtibq\",\"name\":\"xbxwa\",\"type\":\"bogqxndlkzgxhu\"}],\"nextLink\":\"plbpodxun\"}") + "{\"value\":[{\"properties\":{\"provisioningState\":\"Updating\",\"privateEndpoint\":{\"id\":\"zgxmr\"},\"groupIds\":[\"lw\",\"cesutrgjupauut\",\"woqhihe\"],\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"pnfqntcyp\",\"actionsRequired\":\"jv\"}},\"id\":\"imwkslircizj\",\"name\":\"vydfceacvlhvygdy\",\"type\":\"t\"},{\"properties\":{\"provisioningState\":\"Succeeded\",\"privateEndpoint\":{\"id\":\"awjs\"},\"groupIds\":[\"wkojgcyztsfmzn\"],\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"hchqnrnrpx\",\"actionsRequired\":\"uwrykqgaifmvikl\"}},\"id\":\"dvk\",\"name\":\"bejdznxcv\",\"type\":\"srhnjivo\"}],\"nextLink\":\"tnovqfzgemjdftul\"}") .toObject(PrivateEndpointConnectionList.class); - Assertions.assertEquals("plbpodxun", model.nextLink()); + Assertions.assertEquals("zgxmr", model.value().get(0).privateEndpoint().id()); + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.PENDING, + model.value().get(0).privateLinkServiceConnectionState().status()); + Assertions.assertEquals("pnfqntcyp", model.value().get(0).privateLinkServiceConnectionState().description()); + Assertions.assertEquals("jv", model.value().get(0).privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("tnovqfzgemjdftul", model.nextLink()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PrivateEndpointConnectionList model = new PrivateEndpointConnectionList() - .withValue(Arrays.asList(new PrivateEndpointConnectionInner())) - .withNextLink("plbpodxun"); + .withValue( + Arrays + .asList( + new PrivateEndpointConnectionInner() + .withPrivateEndpoint(new PrivateEndpoint().withId("zgxmr")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateLinkServiceConnectionStatus.PENDING) + .withDescription("pnfqntcyp") + .withActionsRequired("jv")), + new PrivateEndpointConnectionInner() + .withPrivateEndpoint(new PrivateEndpoint().withId("awjs")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateLinkServiceConnectionStatus.DISCONNECTED) + .withDescription("hchqnrnrpx") + .withActionsRequired("uwrykqgaifmvikl")))) + .withNextLink("tnovqfzgemjdftul"); model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionList.class); - Assertions.assertEquals("plbpodxun", model.nextLink()); + Assertions.assertEquals("zgxmr", model.value().get(0).privateEndpoint().id()); + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.PENDING, + model.value().get(0).privateLinkServiceConnectionState().status()); + Assertions.assertEquals("pnfqntcyp", model.value().get(0).privateLinkServiceConnectionState().description()); + Assertions.assertEquals("jv", model.value().get(0).privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("tnovqfzgemjdftul", model.nextLink()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionPropertiesTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionPropertiesTests.java index e617027a28f2..30af2e663400 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionPropertiesTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointConnectionPropertiesTests.java @@ -17,32 +17,32 @@ public void testDeserialize() throws Exception { PrivateEndpointConnectionProperties model = BinaryData .fromString( - "{\"provisioningState\":\"Unknown\",\"privateEndpoint\":{\"id\":\"fqkquj\"},\"groupIds\":[\"uyonobglaoc\",\"xtccmg\",\"udxytlmoyrx\",\"wfudwpzntxhdzhl\"],\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"ck\",\"actionsRequired\":\"lhrxsbkyvpyc\"}}") + "{\"provisioningState\":\"Updating\",\"privateEndpoint\":{\"id\":\"rcgp\"},\"groupIds\":[\"zimejzanlfzx\",\"av\",\"mbzonokix\",\"jq\"],\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"pfrlazsz\",\"actionsRequired\":\"woiindf\"}}") .toObject(PrivateEndpointConnectionProperties.class); - Assertions.assertEquals("fqkquj", model.privateEndpoint().id()); + Assertions.assertEquals("rcgp", model.privateEndpoint().id()); Assertions .assertEquals( - PrivateLinkServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("ck", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("lhrxsbkyvpyc", model.privateLinkServiceConnectionState().actionsRequired()); + PrivateLinkServiceConnectionStatus.APPROVED, model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("pfrlazsz", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("woiindf", model.privateLinkServiceConnectionState().actionsRequired()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PrivateEndpointConnectionProperties model = new PrivateEndpointConnectionProperties() - .withPrivateEndpoint(new PrivateEndpoint().withId("fqkquj")) + .withPrivateEndpoint(new PrivateEndpoint().withId("rcgp")) .withPrivateLinkServiceConnectionState( new PrivateLinkServiceConnectionState() - .withStatus(PrivateLinkServiceConnectionStatus.PENDING) - .withDescription("ck") - .withActionsRequired("lhrxsbkyvpyc")); + .withStatus(PrivateLinkServiceConnectionStatus.APPROVED) + .withDescription("pfrlazsz") + .withActionsRequired("woiindf")); model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class); - Assertions.assertEquals("fqkquj", model.privateEndpoint().id()); + Assertions.assertEquals("rcgp", model.privateEndpoint().id()); Assertions .assertEquals( - PrivateLinkServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("ck", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("lhrxsbkyvpyc", model.privateLinkServiceConnectionState().actionsRequired()); + PrivateLinkServiceConnectionStatus.APPROVED, model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("pfrlazsz", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("woiindf", model.privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointTests.java index 556f0654d0c1..8dc97ee79c08 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateEndpointTests.java @@ -11,14 +11,14 @@ public final class PrivateEndpointTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - PrivateEndpoint model = BinaryData.fromString("{\"id\":\"uzbpzkafku\"}").toObject(PrivateEndpoint.class); - Assertions.assertEquals("uzbpzkafku", model.id()); + PrivateEndpoint model = BinaryData.fromString("{\"id\":\"pj\"}").toObject(PrivateEndpoint.class); + Assertions.assertEquals("pj", model.id()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - PrivateEndpoint model = new PrivateEndpoint().withId("uzbpzkafku"); + PrivateEndpoint model = new PrivateEndpoint().withId("pj"); model = BinaryData.fromObject(model).toObject(PrivateEndpoint.class); - Assertions.assertEquals("uzbpzkafku", model.id()); + Assertions.assertEquals("pj", model.id()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourceInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourceInnerTests.java index c8100826bd66..9c5a20a108a2 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourceInnerTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourceInnerTests.java @@ -6,6 +6,7 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.signalr.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.signalr.models.ShareablePrivateLinkResourceProperties; import com.azure.resourcemanager.signalr.models.ShareablePrivateLinkResourceType; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -16,30 +17,62 @@ public void testDeserialize() throws Exception { PrivateLinkResourceInner model = BinaryData .fromString( - "{\"properties\":{\"groupId\":\"zzewkfvhqcrai\",\"requiredMembers\":[\"n\",\"pfuflrw\"],\"requiredZoneNames\":[\"dlxyjrxs\",\"gafcnihgwqapnedg\",\"bcvkcvqvpkeq\",\"cvdrhvoodsot\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"dopcjwvnh\"},{\"name\":\"wmgxcxrsl\"}]},\"id\":\"utwu\",\"name\":\"egrpkhj\",\"type\":\"niyqslui\"}") + "{\"properties\":{\"groupId\":\"luiqtqzfavyvnqq\",\"requiredMembers\":[\"ryeu\",\"yjkqabqgzslesjcb\"],\"requiredZoneNames\":[\"n\",\"tiewdj\",\"vbquwr\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"agohbuff\",\"properties\":{\"description\":\"qem\",\"groupId\":\"hmxtdr\",\"type\":\"utacoe\"}},{\"name\":\"vewzcj\",\"properties\":{\"description\":\"wcpmguaadraufac\",\"groupId\":\"ahzovajjziuxxp\",\"type\":\"neekulfg\"}},{\"name\":\"qubkw\",\"properties\":{\"description\":\"nrdsutujbazpjuoh\",\"groupId\":\"nyfln\",\"type\":\"wmd\"}},{\"name\":\"wpklvxw\",\"properties\":{\"description\":\"dxpgpqchiszepnnb\",\"groupId\":\"rxgibbd\",\"type\":\"confozauors\"}}]},\"id\":\"kokwbqplhlvnu\",\"name\":\"epzl\",\"type\":\"phwzsoldweyuqdu\"}") .toObject(PrivateLinkResourceInner.class); - Assertions.assertEquals("zzewkfvhqcrai", model.groupId()); - Assertions.assertEquals("n", model.requiredMembers().get(0)); - Assertions.assertEquals("dlxyjrxs", model.requiredZoneNames().get(0)); - Assertions.assertEquals("dopcjwvnh", model.shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("luiqtqzfavyvnqq", model.groupId()); + Assertions.assertEquals("ryeu", model.requiredMembers().get(0)); + Assertions.assertEquals("n", model.requiredZoneNames().get(0)); + Assertions.assertEquals("agohbuff", model.shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("qem", model.shareablePrivateLinkResourceTypes().get(0).properties().description()); + Assertions.assertEquals("hmxtdr", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId()); + Assertions.assertEquals("utacoe", model.shareablePrivateLinkResourceTypes().get(0).properties().type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PrivateLinkResourceInner model = new PrivateLinkResourceInner() - .withGroupId("zzewkfvhqcrai") - .withRequiredMembers(Arrays.asList("n", "pfuflrw")) - .withRequiredZoneNames(Arrays.asList("dlxyjrxs", "gafcnihgwqapnedg", "bcvkcvqvpkeq", "cvdrhvoodsot")) + .withGroupId("luiqtqzfavyvnqq") + .withRequiredMembers(Arrays.asList("ryeu", "yjkqabqgzslesjcb")) + .withRequiredZoneNames(Arrays.asList("n", "tiewdj", "vbquwr")) .withShareablePrivateLinkResourceTypes( Arrays .asList( - new ShareablePrivateLinkResourceType().withName("dopcjwvnh"), - new ShareablePrivateLinkResourceType().withName("wmgxcxrsl"))); + new ShareablePrivateLinkResourceType() + .withName("agohbuff") + .withProperties( + new ShareablePrivateLinkResourceProperties() + .withDescription("qem") + .withGroupId("hmxtdr") + .withType("utacoe")), + new ShareablePrivateLinkResourceType() + .withName("vewzcj") + .withProperties( + new ShareablePrivateLinkResourceProperties() + .withDescription("wcpmguaadraufac") + .withGroupId("ahzovajjziuxxp") + .withType("neekulfg")), + new ShareablePrivateLinkResourceType() + .withName("qubkw") + .withProperties( + new ShareablePrivateLinkResourceProperties() + .withDescription("nrdsutujbazpjuoh") + .withGroupId("nyfln") + .withType("wmd")), + new ShareablePrivateLinkResourceType() + .withName("wpklvxw") + .withProperties( + new ShareablePrivateLinkResourceProperties() + .withDescription("dxpgpqchiszepnnb") + .withGroupId("rxgibbd") + .withType("confozauors")))); model = BinaryData.fromObject(model).toObject(PrivateLinkResourceInner.class); - Assertions.assertEquals("zzewkfvhqcrai", model.groupId()); - Assertions.assertEquals("n", model.requiredMembers().get(0)); - Assertions.assertEquals("dlxyjrxs", model.requiredZoneNames().get(0)); - Assertions.assertEquals("dopcjwvnh", model.shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("luiqtqzfavyvnqq", model.groupId()); + Assertions.assertEquals("ryeu", model.requiredMembers().get(0)); + Assertions.assertEquals("n", model.requiredZoneNames().get(0)); + Assertions.assertEquals("agohbuff", model.shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("qem", model.shareablePrivateLinkResourceTypes().get(0).properties().description()); + Assertions.assertEquals("hmxtdr", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId()); + Assertions.assertEquals("utacoe", model.shareablePrivateLinkResourceTypes().get(0).properties().type()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourceListTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourceListTests.java index 0a32fbd244fd..6ebb79b7bbd1 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourceListTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourceListTests.java @@ -7,6 +7,8 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.signalr.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.signalr.models.PrivateLinkResourceList; +import com.azure.resourcemanager.signalr.models.ShareablePrivateLinkResourceProperties; +import com.azure.resourcemanager.signalr.models.ShareablePrivateLinkResourceType; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -16,10 +18,13 @@ public void testDeserialize() throws Exception { PrivateLinkResourceList model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"groupId\":\"mubyynt\",\"requiredMembers\":[],\"requiredZoneNames\":[],\"shareablePrivateLinkResourceTypes\":[]},\"id\":\"qtkoievs\",\"name\":\"otgqrlltmu\",\"type\":\"lauwzizxbmpgcjef\"},{\"properties\":{\"groupId\":\"uvpb\",\"requiredMembers\":[],\"requiredZoneNames\":[],\"shareablePrivateLinkResourceTypes\":[]},\"id\":\"morppxebmnzbtbh\",\"name\":\"pglkf\",\"type\":\"ohdneuel\"},{\"properties\":{\"groupId\":\"sdyhtozfikdowwq\",\"requiredMembers\":[],\"requiredZoneNames\":[],\"shareablePrivateLinkResourceTypes\":[]},\"id\":\"zx\",\"name\":\"lvithhqzonosgg\",\"type\":\"hcohfwdsjnk\"}],\"nextLink\":\"jutiiswacff\"}") + "{\"value\":[{\"properties\":{\"groupId\":\"ceamtm\",\"requiredMembers\":[\"o\"],\"requiredZoneNames\":[\"wcw\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"knssxmojm\",\"properties\":{}},{\"name\":\"kjprvk\",\"properties\":{}},{\"name\":\"zqljyxgtczh\",\"properties\":{}}]},\"id\":\"dbsdshm\",\"name\":\"xmaehvbbxu\",\"type\":\"iplt\"},{\"properties\":{\"groupId\":\"tbaxk\",\"requiredMembers\":[\"wrck\",\"yklyhpluodpvruud\"],\"requiredZoneNames\":[\"ibthostgktstvd\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"zedqbcvhzlhplo\",\"properties\":{}},{\"name\":\"dlwwqfbumlkxt\",\"properties\":{}},{\"name\":\"fsmlmbtxhwgfw\",\"properties\":{}}]},\"id\":\"tawc\",\"name\":\"ezbrhubskh\",\"type\":\"dyg\"}],\"nextLink\":\"okkqfqjbvleo\"}") .toObject(PrivateLinkResourceList.class); - Assertions.assertEquals("mubyynt", model.value().get(0).groupId()); - Assertions.assertEquals("jutiiswacff", model.nextLink()); + Assertions.assertEquals("ceamtm", model.value().get(0).groupId()); + Assertions.assertEquals("o", model.value().get(0).requiredMembers().get(0)); + Assertions.assertEquals("wcw", model.value().get(0).requiredZoneNames().get(0)); + Assertions.assertEquals("knssxmojm", model.value().get(0).shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("okkqfqjbvleo", model.nextLink()); } @org.junit.jupiter.api.Test @@ -30,23 +35,43 @@ public void testSerialize() throws Exception { Arrays .asList( new PrivateLinkResourceInner() - .withGroupId("mubyynt") - .withRequiredMembers(Arrays.asList()) - .withRequiredZoneNames(Arrays.asList()) - .withShareablePrivateLinkResourceTypes(Arrays.asList()), + .withGroupId("ceamtm") + .withRequiredMembers(Arrays.asList("o")) + .withRequiredZoneNames(Arrays.asList("wcw")) + .withShareablePrivateLinkResourceTypes( + Arrays + .asList( + new ShareablePrivateLinkResourceType() + .withName("knssxmojm") + .withProperties(new ShareablePrivateLinkResourceProperties()), + new ShareablePrivateLinkResourceType() + .withName("kjprvk") + .withProperties(new ShareablePrivateLinkResourceProperties()), + new ShareablePrivateLinkResourceType() + .withName("zqljyxgtczh") + .withProperties(new ShareablePrivateLinkResourceProperties()))), new PrivateLinkResourceInner() - .withGroupId("uvpb") - .withRequiredMembers(Arrays.asList()) - .withRequiredZoneNames(Arrays.asList()) - .withShareablePrivateLinkResourceTypes(Arrays.asList()), - new PrivateLinkResourceInner() - .withGroupId("sdyhtozfikdowwq") - .withRequiredMembers(Arrays.asList()) - .withRequiredZoneNames(Arrays.asList()) - .withShareablePrivateLinkResourceTypes(Arrays.asList()))) - .withNextLink("jutiiswacff"); + .withGroupId("tbaxk") + .withRequiredMembers(Arrays.asList("wrck", "yklyhpluodpvruud")) + .withRequiredZoneNames(Arrays.asList("ibthostgktstvd")) + .withShareablePrivateLinkResourceTypes( + Arrays + .asList( + new ShareablePrivateLinkResourceType() + .withName("zedqbcvhzlhplo") + .withProperties(new ShareablePrivateLinkResourceProperties()), + new ShareablePrivateLinkResourceType() + .withName("dlwwqfbumlkxt") + .withProperties(new ShareablePrivateLinkResourceProperties()), + new ShareablePrivateLinkResourceType() + .withName("fsmlmbtxhwgfw") + .withProperties(new ShareablePrivateLinkResourceProperties()))))) + .withNextLink("okkqfqjbvleo"); model = BinaryData.fromObject(model).toObject(PrivateLinkResourceList.class); - Assertions.assertEquals("mubyynt", model.value().get(0).groupId()); - Assertions.assertEquals("jutiiswacff", model.nextLink()); + Assertions.assertEquals("ceamtm", model.value().get(0).groupId()); + Assertions.assertEquals("o", model.value().get(0).requiredMembers().get(0)); + Assertions.assertEquals("wcw", model.value().get(0).requiredZoneNames().get(0)); + Assertions.assertEquals("knssxmojm", model.value().get(0).shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("okkqfqjbvleo", model.nextLink()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourcePropertiesTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourcePropertiesTests.java index 81f5dd9e8dac..a442086705fd 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourcePropertiesTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkResourcePropertiesTests.java @@ -17,43 +17,50 @@ public void testDeserialize() throws Exception { PrivateLinkResourceProperties model = BinaryData .fromString( - "{\"groupId\":\"dggkzzlvmbmpa\",\"requiredMembers\":[\"dfvue\",\"yw\",\"bpfvm\"],\"requiredZoneNames\":[\"rfouyftaakcpw\",\"yzvqt\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"exkpzksmondjmq\",\"properties\":{\"description\":\"ypomgkopkwho\",\"groupId\":\"pajqgxysm\",\"type\":\"mbqfqvmk\"}}]}") + "{\"groupId\":\"mnnrwr\",\"requiredMembers\":[\"rk\"],\"requiredZoneNames\":[\"ywjhhgdnhx\",\"sivfomilo\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"ufiqndieuzaof\",\"properties\":{\"description\":\"vcyy\",\"groupId\":\"fgdo\",\"type\":\"ubiipuipwoqonma\"}},{\"name\":\"ekni\",\"properties\":{\"description\":\"qvci\",\"groupId\":\"ev\",\"type\":\"mblrrilbywd\"}}]}") .toObject(PrivateLinkResourceProperties.class); - Assertions.assertEquals("dggkzzlvmbmpa", model.groupId()); - Assertions.assertEquals("dfvue", model.requiredMembers().get(0)); - Assertions.assertEquals("rfouyftaakcpw", model.requiredZoneNames().get(0)); - Assertions.assertEquals("exkpzksmondjmq", model.shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("mnnrwr", model.groupId()); + Assertions.assertEquals("rk", model.requiredMembers().get(0)); + Assertions.assertEquals("ywjhhgdnhx", model.requiredZoneNames().get(0)); + Assertions.assertEquals("ufiqndieuzaof", model.shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("vcyy", model.shareablePrivateLinkResourceTypes().get(0).properties().description()); + Assertions.assertEquals("fgdo", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId()); Assertions - .assertEquals("ypomgkopkwho", model.shareablePrivateLinkResourceTypes().get(0).properties().description()); - Assertions.assertEquals("pajqgxysm", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId()); - Assertions.assertEquals("mbqfqvmk", model.shareablePrivateLinkResourceTypes().get(0).properties().type()); + .assertEquals("ubiipuipwoqonma", model.shareablePrivateLinkResourceTypes().get(0).properties().type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PrivateLinkResourceProperties model = new PrivateLinkResourceProperties() - .withGroupId("dggkzzlvmbmpa") - .withRequiredMembers(Arrays.asList("dfvue", "yw", "bpfvm")) - .withRequiredZoneNames(Arrays.asList("rfouyftaakcpw", "yzvqt")) + .withGroupId("mnnrwr") + .withRequiredMembers(Arrays.asList("rk")) + .withRequiredZoneNames(Arrays.asList("ywjhhgdnhx", "sivfomilo")) .withShareablePrivateLinkResourceTypes( Arrays .asList( new ShareablePrivateLinkResourceType() - .withName("exkpzksmondjmq") + .withName("ufiqndieuzaof") .withProperties( new ShareablePrivateLinkResourceProperties() - .withDescription("ypomgkopkwho") - .withGroupId("pajqgxysm") - .withType("mbqfqvmk")))); + .withDescription("vcyy") + .withGroupId("fgdo") + .withType("ubiipuipwoqonma")), + new ShareablePrivateLinkResourceType() + .withName("ekni") + .withProperties( + new ShareablePrivateLinkResourceProperties() + .withDescription("qvci") + .withGroupId("ev") + .withType("mblrrilbywd")))); model = BinaryData.fromObject(model).toObject(PrivateLinkResourceProperties.class); - Assertions.assertEquals("dggkzzlvmbmpa", model.groupId()); - Assertions.assertEquals("dfvue", model.requiredMembers().get(0)); - Assertions.assertEquals("rfouyftaakcpw", model.requiredZoneNames().get(0)); - Assertions.assertEquals("exkpzksmondjmq", model.shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("mnnrwr", model.groupId()); + Assertions.assertEquals("rk", model.requiredMembers().get(0)); + Assertions.assertEquals("ywjhhgdnhx", model.requiredZoneNames().get(0)); + Assertions.assertEquals("ufiqndieuzaof", model.shareablePrivateLinkResourceTypes().get(0).name()); + Assertions.assertEquals("vcyy", model.shareablePrivateLinkResourceTypes().get(0).properties().description()); + Assertions.assertEquals("fgdo", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId()); Assertions - .assertEquals("ypomgkopkwho", model.shareablePrivateLinkResourceTypes().get(0).properties().description()); - Assertions.assertEquals("pajqgxysm", model.shareablePrivateLinkResourceTypes().get(0).properties().groupId()); - Assertions.assertEquals("mbqfqvmk", model.shareablePrivateLinkResourceTypes().get(0).properties().type()); + .assertEquals("ubiipuipwoqonma", model.shareablePrivateLinkResourceTypes().get(0).properties().type()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkServiceConnectionStateTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkServiceConnectionStateTests.java index 88aefd45c022..26e70961ab88 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkServiceConnectionStateTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/PrivateLinkServiceConnectionStateTests.java @@ -15,23 +15,23 @@ public void testDeserialize() throws Exception { PrivateLinkServiceConnectionState model = BinaryData .fromString( - "{\"status\":\"Approved\",\"description\":\"nwbmeh\",\"actionsRequired\":\"eyvjusrtslhspkde\"}") + "{\"status\":\"Rejected\",\"description\":\"tlhflsjcdhszf\",\"actionsRequired\":\"fbgofeljagrqmqh\"}") .toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateLinkServiceConnectionStatus.APPROVED, model.status()); - Assertions.assertEquals("nwbmeh", model.description()); - Assertions.assertEquals("eyvjusrtslhspkde", model.actionsRequired()); + Assertions.assertEquals(PrivateLinkServiceConnectionStatus.REJECTED, model.status()); + Assertions.assertEquals("tlhflsjcdhszf", model.description()); + Assertions.assertEquals("fbgofeljagrqmqh", model.actionsRequired()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { PrivateLinkServiceConnectionState model = new PrivateLinkServiceConnectionState() - .withStatus(PrivateLinkServiceConnectionStatus.APPROVED) - .withDescription("nwbmeh") - .withActionsRequired("eyvjusrtslhspkde"); + .withStatus(PrivateLinkServiceConnectionStatus.REJECTED) + .withDescription("tlhflsjcdhszf") + .withActionsRequired("fbgofeljagrqmqh"); model = BinaryData.fromObject(model).toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateLinkServiceConnectionStatus.APPROVED, model.status()); - Assertions.assertEquals("nwbmeh", model.description()); - Assertions.assertEquals("eyvjusrtslhspkde", model.actionsRequired()); + Assertions.assertEquals(PrivateLinkServiceConnectionStatus.REJECTED, model.status()); + Assertions.assertEquals("tlhflsjcdhszf", model.description()); + Assertions.assertEquals("fbgofeljagrqmqh", model.actionsRequired()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ReplicaInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ReplicaInnerTests.java new file mode 100644 index 000000000000..a67264e28440 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ReplicaInnerTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.signalr.fluent.models.ReplicaInner; +import com.azure.resourcemanager.signalr.models.ResourceSku; +import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ReplicaInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicaInner model = + BinaryData + .fromString( + "{\"sku\":{\"name\":\"pfkyrkdbdgiogsj\",\"tier\":\"Basic\",\"size\":\"qjnobaiyhddviac\",\"family\":\"fnmntfpmvmemfn\",\"capacity\":1456475383},\"properties\":{\"provisioningState\":\"Unknown\"},\"location\":\"alxlllchp\",\"tags\":{\"jcswsmys\":\"zevwrdnhfukuv\",\"lerchpq\":\"uluqypfc\"},\"id\":\"mfpjbabw\",\"name\":\"dfc\",\"type\":\"sspuunnoxyhkx\"}") + .toObject(ReplicaInner.class); + Assertions.assertEquals("alxlllchp", model.location()); + Assertions.assertEquals("zevwrdnhfukuv", model.tags().get("jcswsmys")); + Assertions.assertEquals("pfkyrkdbdgiogsj", model.sku().name()); + Assertions.assertEquals(SignalRSkuTier.BASIC, model.sku().tier()); + Assertions.assertEquals(1456475383, model.sku().capacity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicaInner model = + new ReplicaInner() + .withLocation("alxlllchp") + .withTags(mapOf("jcswsmys", "zevwrdnhfukuv", "lerchpq", "uluqypfc")) + .withSku( + new ResourceSku() + .withName("pfkyrkdbdgiogsj") + .withTier(SignalRSkuTier.BASIC) + .withCapacity(1456475383)); + model = BinaryData.fromObject(model).toObject(ReplicaInner.class); + Assertions.assertEquals("alxlllchp", model.location()); + Assertions.assertEquals("zevwrdnhfukuv", model.tags().get("jcswsmys")); + Assertions.assertEquals("pfkyrkdbdgiogsj", model.sku().name()); + Assertions.assertEquals(SignalRSkuTier.BASIC, model.sku().tier()); + Assertions.assertEquals(1456475383, model.sku().capacity()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ReplicaListTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ReplicaListTests.java new file mode 100644 index 000000000000..81df1f8b6307 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ReplicaListTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.signalr.fluent.models.ReplicaInner; +import com.azure.resourcemanager.signalr.models.ReplicaList; +import com.azure.resourcemanager.signalr.models.ResourceSku; +import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ReplicaListTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicaList model = + BinaryData + .fromString( + "{\"value\":[{\"sku\":{\"name\":\"zdwlvwlyoupfgfb\",\"tier\":\"Basic\",\"size\":\"dyhgkfminsg\",\"family\":\"zfttsttktlahb\",\"capacity\":520028629},\"properties\":{\"provisioningState\":\"Failed\"},\"location\":\"zukxitmmqtgqq\",\"tags\":{\"isavok\":\"rnxrxcpj\",\"azivjlfrqttbajl\":\"dzf\"},\"id\":\"atnwxyiopi\",\"name\":\"kqqfk\",\"type\":\"vscx\"},{\"sku\":{\"name\":\"mligov\",\"tier\":\"Premium\",\"size\":\"kpmloa\",\"family\":\"ruocbgo\",\"capacity\":1644940787},\"properties\":{\"provisioningState\":\"Canceled\"},\"location\":\"bfhjxakvvjgsl\",\"tags\":{\"yw\":\"il\",\"gkxnyedabg\":\"t\"},\"id\":\"vudtjuewbcihx\",\"name\":\"uwhcjyxccybv\",\"type\":\"ayakkudzpx\"}],\"nextLink\":\"jplmagstcy\"}") + .toObject(ReplicaList.class); + Assertions.assertEquals("zukxitmmqtgqq", model.value().get(0).location()); + Assertions.assertEquals("rnxrxcpj", model.value().get(0).tags().get("isavok")); + Assertions.assertEquals("zdwlvwlyoupfgfb", model.value().get(0).sku().name()); + Assertions.assertEquals(SignalRSkuTier.BASIC, model.value().get(0).sku().tier()); + Assertions.assertEquals(520028629, model.value().get(0).sku().capacity()); + Assertions.assertEquals("jplmagstcy", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicaList model = + new ReplicaList() + .withValue( + Arrays + .asList( + new ReplicaInner() + .withLocation("zukxitmmqtgqq") + .withTags(mapOf("isavok", "rnxrxcpj", "azivjlfrqttbajl", "dzf")) + .withSku( + new ResourceSku() + .withName("zdwlvwlyoupfgfb") + .withTier(SignalRSkuTier.BASIC) + .withCapacity(520028629)), + new ReplicaInner() + .withLocation("bfhjxakvvjgsl") + .withTags(mapOf("yw", "il", "gkxnyedabg", "t")) + .withSku( + new ResourceSku() + .withName("mligov") + .withTier(SignalRSkuTier.PREMIUM) + .withCapacity(1644940787)))) + .withNextLink("jplmagstcy"); + model = BinaryData.fromObject(model).toObject(ReplicaList.class); + Assertions.assertEquals("zukxitmmqtgqq", model.value().get(0).location()); + Assertions.assertEquals("rnxrxcpj", model.value().get(0).tags().get("isavok")); + Assertions.assertEquals("zdwlvwlyoupfgfb", model.value().get(0).sku().name()); + Assertions.assertEquals(SignalRSkuTier.BASIC, model.value().get(0).sku().tier()); + Assertions.assertEquals(520028629, model.value().get(0).sku().capacity()); + Assertions.assertEquals("jplmagstcy", model.nextLink()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ReplicaPropertiesTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ReplicaPropertiesTests.java new file mode 100644 index 000000000000..e7d0f3cb08ba --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ReplicaPropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.signalr.fluent.models.ReplicaProperties; + +public final class ReplicaPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ReplicaProperties model = + BinaryData.fromString("{\"provisioningState\":\"Succeeded\"}").toObject(ReplicaProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ReplicaProperties model = new ReplicaProperties(); + model = BinaryData.fromObject(model).toObject(ReplicaProperties.class); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceLogCategoryTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceLogCategoryTests.java index 718253602cd9..2ec60f885e68 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceLogCategoryTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceLogCategoryTests.java @@ -12,16 +12,18 @@ public final class ResourceLogCategoryTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ResourceLogCategory model = - BinaryData.fromString("{\"name\":\"ibycno\",\"enabled\":\"knme\"}").toObject(ResourceLogCategory.class); - Assertions.assertEquals("ibycno", model.name()); - Assertions.assertEquals("knme", model.enabled()); + BinaryData + .fromString("{\"name\":\"uzhlhkjoqrv\",\"enabled\":\"aatjinrvgoupmfi\"}") + .toObject(ResourceLogCategory.class); + Assertions.assertEquals("uzhlhkjoqrv", model.name()); + Assertions.assertEquals("aatjinrvgoupmfi", model.enabled()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ResourceLogCategory model = new ResourceLogCategory().withName("ibycno").withEnabled("knme"); + ResourceLogCategory model = new ResourceLogCategory().withName("uzhlhkjoqrv").withEnabled("aatjinrvgoupmfi"); model = BinaryData.fromObject(model).toObject(ResourceLogCategory.class); - Assertions.assertEquals("ibycno", model.name()); - Assertions.assertEquals("knme", model.enabled()); + Assertions.assertEquals("uzhlhkjoqrv", model.name()); + Assertions.assertEquals("aatjinrvgoupmfi", model.enabled()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceLogConfigurationTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceLogConfigurationTests.java index c7abe42808f9..5ae0a8bb4507 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceLogConfigurationTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceLogConfigurationTests.java @@ -16,10 +16,10 @@ public void testDeserialize() throws Exception { ResourceLogConfiguration model = BinaryData .fromString( - "{\"categories\":[{\"name\":\"gibtnm\",\"enabled\":\"ebwwaloayqc\"},{\"name\":\"rtzju\",\"enabled\":\"wyzmhtxon\"},{\"name\":\"ts\",\"enabled\":\"jcbpwxqpsrknft\"},{\"name\":\"vriuhprwmdyvx\",\"enabled\":\"ayriwwroyqbexrm\"}]}") + "{\"categories\":[{\"name\":\"wccsnjvcdwxlpqek\",\"enabled\":\"nkhtjsyingw\"},{\"name\":\"atmtdhtmdvy\",\"enabled\":\"ikdgszywkbir\"}]}") .toObject(ResourceLogConfiguration.class); - Assertions.assertEquals("gibtnm", model.categories().get(0).name()); - Assertions.assertEquals("ebwwaloayqc", model.categories().get(0).enabled()); + Assertions.assertEquals("wccsnjvcdwxlpqek", model.categories().get(0).name()); + Assertions.assertEquals("nkhtjsyingw", model.categories().get(0).enabled()); } @org.junit.jupiter.api.Test @@ -29,12 +29,10 @@ public void testSerialize() throws Exception { .withCategories( Arrays .asList( - new ResourceLogCategory().withName("gibtnm").withEnabled("ebwwaloayqc"), - new ResourceLogCategory().withName("rtzju").withEnabled("wyzmhtxon"), - new ResourceLogCategory().withName("ts").withEnabled("jcbpwxqpsrknft"), - new ResourceLogCategory().withName("vriuhprwmdyvx").withEnabled("ayriwwroyqbexrm"))); + new ResourceLogCategory().withName("wccsnjvcdwxlpqek").withEnabled("nkhtjsyingw"), + new ResourceLogCategory().withName("atmtdhtmdvy").withEnabled("ikdgszywkbir"))); model = BinaryData.fromObject(model).toObject(ResourceLogConfiguration.class); - Assertions.assertEquals("gibtnm", model.categories().get(0).name()); - Assertions.assertEquals("ebwwaloayqc", model.categories().get(0).enabled()); + Assertions.assertEquals("wccsnjvcdwxlpqek", model.categories().get(0).name()); + Assertions.assertEquals("nkhtjsyingw", model.categories().get(0).enabled()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceReferenceTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceReferenceTests.java index fbe1c27debef..743dcae7846d 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceReferenceTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceReferenceTests.java @@ -11,14 +11,14 @@ public final class ResourceReferenceTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ResourceReference model = BinaryData.fromString("{\"id\":\"gaokonzmnsikv\"}").toObject(ResourceReference.class); - Assertions.assertEquals("gaokonzmnsikv", model.id()); + ResourceReference model = BinaryData.fromString("{\"id\":\"cvpa\"}").toObject(ResourceReference.class); + Assertions.assertEquals("cvpa", model.id()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ResourceReference model = new ResourceReference().withId("gaokonzmnsikv"); + ResourceReference model = new ResourceReference().withId("cvpa"); model = BinaryData.fromObject(model).toObject(ResourceReference.class); - Assertions.assertEquals("gaokonzmnsikv", model.id()); + Assertions.assertEquals("cvpa", model.id()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceSkuTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceSkuTests.java index 9a94a0362734..4de058c4c9e4 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceSkuTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ResourceSkuTests.java @@ -15,20 +15,20 @@ public void testDeserialize() throws Exception { ResourceSku model = BinaryData .fromString( - "{\"name\":\"burvjxxjnspy\",\"tier\":\"Free\",\"size\":\"oenkouknvudwti\",\"family\":\"bldngkpoc\",\"capacity\":523665642}") + "{\"name\":\"ofncckwyfzqwhxxb\",\"tier\":\"Free\",\"size\":\"xzfe\",\"family\":\"tpp\",\"capacity\":80294620}") .toObject(ResourceSku.class); - Assertions.assertEquals("burvjxxjnspy", model.name()); + Assertions.assertEquals("ofncckwyfzqwhxxb", model.name()); Assertions.assertEquals(SignalRSkuTier.FREE, model.tier()); - Assertions.assertEquals(523665642, model.capacity()); + Assertions.assertEquals(80294620, model.capacity()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ResourceSku model = - new ResourceSku().withName("burvjxxjnspy").withTier(SignalRSkuTier.FREE).withCapacity(523665642); + new ResourceSku().withName("ofncckwyfzqwhxxb").withTier(SignalRSkuTier.FREE).withCapacity(80294620); model = BinaryData.fromObject(model).toObject(ResourceSku.class); - Assertions.assertEquals("burvjxxjnspy", model.name()); + Assertions.assertEquals("ofncckwyfzqwhxxb", model.name()); Assertions.assertEquals(SignalRSkuTier.FREE, model.tier()); - Assertions.assertEquals(523665642, model.capacity()); + Assertions.assertEquals(80294620, model.capacity()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServerlessSettingsTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServerlessSettingsTests.java index 72091d4189b4..fa15f309ba2d 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServerlessSettingsTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServerlessSettingsTests.java @@ -12,14 +12,14 @@ public final class ServerlessSettingsTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ServerlessSettings model = - BinaryData.fromString("{\"connectionTimeoutInSeconds\":1596436522}").toObject(ServerlessSettings.class); - Assertions.assertEquals(1596436522, model.connectionTimeoutInSeconds()); + BinaryData.fromString("{\"connectionTimeoutInSeconds\":46928565}").toObject(ServerlessSettings.class); + Assertions.assertEquals(46928565, model.connectionTimeoutInSeconds()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ServerlessSettings model = new ServerlessSettings().withConnectionTimeoutInSeconds(1596436522); + ServerlessSettings model = new ServerlessSettings().withConnectionTimeoutInSeconds(46928565); model = BinaryData.fromObject(model).toObject(ServerlessSettings.class); - Assertions.assertEquals(1596436522, model.connectionTimeoutInSeconds()); + Assertions.assertEquals(46928565, model.connectionTimeoutInSeconds()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServerlessUpstreamSettingsTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServerlessUpstreamSettingsTests.java index 2705dc078b27..54c71dd0d1c8 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServerlessUpstreamSettingsTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServerlessUpstreamSettingsTests.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.signalr.generated; import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.signalr.models.ManagedIdentitySettings; import com.azure.resourcemanager.signalr.models.ServerlessUpstreamSettings; import com.azure.resourcemanager.signalr.models.UpstreamAuthSettings; import com.azure.resourcemanager.signalr.models.UpstreamAuthType; @@ -18,13 +19,14 @@ public void testDeserialize() throws Exception { ServerlessUpstreamSettings model = BinaryData .fromString( - "{\"templates\":[{\"hubPattern\":\"zunlu\",\"eventPattern\":\"nnprn\",\"categoryPattern\":\"peilpjzuaejxdu\",\"urlTemplate\":\"tskzbbtdzumveek\",\"auth\":{\"type\":\"None\"}},{\"hubPattern\":\"hkfpbs\",\"eventPattern\":\"ofd\",\"categoryPattern\":\"uusdttouwa\",\"urlTemplate\":\"oekqvk\",\"auth\":{\"type\":\"None\"}},{\"hubPattern\":\"bxwyjsflhhcaa\",\"eventPattern\":\"jixisxyawjoyaqcs\",\"categoryPattern\":\"jpkiidzyexznelix\",\"urlTemplate\":\"nr\",\"auth\":{\"type\":\"None\"}}]}") + "{\"templates\":[{\"hubPattern\":\"qwjygvja\",\"eventPattern\":\"blmhvkzuhb\",\"categoryPattern\":\"vyhgs\",\"urlTemplate\":\"pbyrqufegxu\",\"auth\":{\"type\":\"None\",\"managedIdentity\":{\"resource\":\"hlmctlpdngitvgb\"}}},{\"hubPattern\":\"rixkwmyijejve\",\"eventPattern\":\"hbpnaixexccbd\",\"categoryPattern\":\"ax\",\"urlTemplate\":\"cexdrrvqa\",\"auth\":{\"type\":\"None\",\"managedIdentity\":{\"resource\":\"pwijnhy\"}}},{\"hubPattern\":\"vfycxzb\",\"eventPattern\":\"oowvrv\",\"categoryPattern\":\"gjqppy\",\"urlTemplate\":\"s\",\"auth\":{\"type\":\"None\",\"managedIdentity\":{\"resource\":\"yhgfipnsx\"}}},{\"hubPattern\":\"cwaekrrjre\",\"eventPattern\":\"xt\",\"categoryPattern\":\"umh\",\"urlTemplate\":\"glikkxwslolb\",\"auth\":{\"type\":\"None\",\"managedIdentity\":{\"resource\":\"m\"}}}]}") .toObject(ServerlessUpstreamSettings.class); - Assertions.assertEquals("zunlu", model.templates().get(0).hubPattern()); - Assertions.assertEquals("nnprn", model.templates().get(0).eventPattern()); - Assertions.assertEquals("peilpjzuaejxdu", model.templates().get(0).categoryPattern()); - Assertions.assertEquals("tskzbbtdzumveek", model.templates().get(0).urlTemplate()); + Assertions.assertEquals("qwjygvja", model.templates().get(0).hubPattern()); + Assertions.assertEquals("blmhvkzuhb", model.templates().get(0).eventPattern()); + Assertions.assertEquals("vyhgs", model.templates().get(0).categoryPattern()); + Assertions.assertEquals("pbyrqufegxu", model.templates().get(0).urlTemplate()); Assertions.assertEquals(UpstreamAuthType.NONE, model.templates().get(0).auth().type()); + Assertions.assertEquals("hlmctlpdngitvgb", model.templates().get(0).auth().managedIdentity().resource()); } @org.junit.jupiter.api.Test @@ -35,28 +37,48 @@ public void testSerialize() throws Exception { Arrays .asList( new UpstreamTemplate() - .withHubPattern("zunlu") - .withEventPattern("nnprn") - .withCategoryPattern("peilpjzuaejxdu") - .withUrlTemplate("tskzbbtdzumveek") - .withAuth(new UpstreamAuthSettings().withType(UpstreamAuthType.NONE)), + .withHubPattern("qwjygvja") + .withEventPattern("blmhvkzuhb") + .withCategoryPattern("vyhgs") + .withUrlTemplate("pbyrqufegxu") + .withAuth( + new UpstreamAuthSettings() + .withType(UpstreamAuthType.NONE) + .withManagedIdentity( + new ManagedIdentitySettings().withResource("hlmctlpdngitvgb"))), new UpstreamTemplate() - .withHubPattern("hkfpbs") - .withEventPattern("ofd") - .withCategoryPattern("uusdttouwa") - .withUrlTemplate("oekqvk") - .withAuth(new UpstreamAuthSettings().withType(UpstreamAuthType.NONE)), + .withHubPattern("rixkwmyijejve") + .withEventPattern("hbpnaixexccbd") + .withCategoryPattern("ax") + .withUrlTemplate("cexdrrvqa") + .withAuth( + new UpstreamAuthSettings() + .withType(UpstreamAuthType.NONE) + .withManagedIdentity(new ManagedIdentitySettings().withResource("pwijnhy"))), new UpstreamTemplate() - .withHubPattern("bxwyjsflhhcaa") - .withEventPattern("jixisxyawjoyaqcs") - .withCategoryPattern("jpkiidzyexznelix") - .withUrlTemplate("nr") - .withAuth(new UpstreamAuthSettings().withType(UpstreamAuthType.NONE)))); + .withHubPattern("vfycxzb") + .withEventPattern("oowvrv") + .withCategoryPattern("gjqppy") + .withUrlTemplate("s") + .withAuth( + new UpstreamAuthSettings() + .withType(UpstreamAuthType.NONE) + .withManagedIdentity(new ManagedIdentitySettings().withResource("yhgfipnsx"))), + new UpstreamTemplate() + .withHubPattern("cwaekrrjre") + .withEventPattern("xt") + .withCategoryPattern("umh") + .withUrlTemplate("glikkxwslolb") + .withAuth( + new UpstreamAuthSettings() + .withType(UpstreamAuthType.NONE) + .withManagedIdentity(new ManagedIdentitySettings().withResource("m"))))); model = BinaryData.fromObject(model).toObject(ServerlessUpstreamSettings.class); - Assertions.assertEquals("zunlu", model.templates().get(0).hubPattern()); - Assertions.assertEquals("nnprn", model.templates().get(0).eventPattern()); - Assertions.assertEquals("peilpjzuaejxdu", model.templates().get(0).categoryPattern()); - Assertions.assertEquals("tskzbbtdzumveek", model.templates().get(0).urlTemplate()); + Assertions.assertEquals("qwjygvja", model.templates().get(0).hubPattern()); + Assertions.assertEquals("blmhvkzuhb", model.templates().get(0).eventPattern()); + Assertions.assertEquals("vyhgs", model.templates().get(0).categoryPattern()); + Assertions.assertEquals("pbyrqufegxu", model.templates().get(0).urlTemplate()); Assertions.assertEquals(UpstreamAuthType.NONE, model.templates().get(0).auth().type()); + Assertions.assertEquals("hlmctlpdngitvgb", model.templates().get(0).auth().managedIdentity().resource()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServiceSpecificationTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServiceSpecificationTests.java index b4856316ea43..406903314f1e 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServiceSpecificationTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ServiceSpecificationTests.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.signalr.generated; import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.signalr.models.Dimension; import com.azure.resourcemanager.signalr.models.LogSpecification; import com.azure.resourcemanager.signalr.models.MetricSpecification; import com.azure.resourcemanager.signalr.models.ServiceSpecification; @@ -17,17 +18,21 @@ public void testDeserialize() throws Exception { ServiceSpecification model = BinaryData .fromString( - "{\"metricSpecifications\":[{\"name\":\"yffdfdos\",\"displayName\":\"expa\",\"displayDescription\":\"akhmsbzjhcrz\",\"unit\":\"dphlxaolt\",\"aggregationType\":\"trg\",\"fillGapWithZero\":\"bpf\",\"category\":\"s\",\"dimensions\":[]}],\"logSpecifications\":[{\"name\":\"cjrwzoxxjtfellu\",\"displayName\":\"zitonpeqfpjkjl\"}]}") + "{\"metricSpecifications\":[{\"name\":\"izuckyfihrfidfvz\",\"displayName\":\"zuhtymwisdkfthwx\",\"displayDescription\":\"t\",\"unit\":\"waopvkmijcmmxd\",\"aggregationType\":\"fufsrpymzi\",\"fillGapWithZero\":\"sezcxtb\",\"category\":\"gfycc\",\"dimensions\":[{\"name\":\"mdwzjeiachboo\",\"displayName\":\"lnrosfqp\",\"internalName\":\"ehzzvypyqrim\",\"toBeExportedForShoebox\":true},{\"name\":\"vswjdk\",\"displayName\":\"soodqxhcrmnoh\",\"internalName\":\"ckwhds\",\"toBeExportedForShoebox\":true}]},{\"name\":\"yip\",\"displayName\":\"sqwpgrjb\",\"displayDescription\":\"orcjxvsnby\",\"unit\":\"abnmocpcyshu\",\"aggregationType\":\"afbljjgpbtoqcjmk\",\"fillGapWithZero\":\"a\",\"category\":\"qidtqajzyu\",\"dimensions\":[{\"name\":\"dj\",\"displayName\":\"lkhbz\",\"internalName\":\"epgzgqexz\",\"toBeExportedForShoebox\":false},{\"name\":\"scpai\",\"displayName\":\"hhbcsglummajtjao\",\"internalName\":\"obnbdxkqpxokaj\",\"toBeExportedForShoebox\":false},{\"name\":\"imexgstxgcpodgma\",\"displayName\":\"r\",\"internalName\":\"djwzrlov\",\"toBeExportedForShoebox\":true}]},{\"name\":\"hijco\",\"displayName\":\"ctbzaq\",\"displayDescription\":\"sycbkbfk\",\"unit\":\"kdkexxp\",\"aggregationType\":\"fmxa\",\"fillGapWithZero\":\"fjpgddtocjjxhvp\",\"category\":\"uexhdzx\",\"dimensions\":[{\"name\":\"ojnxqbzvdd\",\"displayName\":\"wndeicbtwnp\",\"internalName\":\"oqvuhr\",\"toBeExportedForShoebox\":false},{\"name\":\"cyddglmjthjqk\",\"displayName\":\"yeicxmqciwqvhk\",\"internalName\":\"xuigdtopbobj\",\"toBeExportedForShoebox\":false},{\"name\":\"e\",\"displayName\":\"a\",\"internalName\":\"uhrzayvvt\",\"toBeExportedForShoebox\":false},{\"name\":\"f\",\"displayName\":\"otkftutqxlngx\",\"internalName\":\"fgugnxkrxdqmid\",\"toBeExportedForShoebox\":false}]}],\"logSpecifications\":[{\"name\":\"qdrabhjybigehoqf\",\"displayName\":\"wska\"},{\"name\":\"ktzlcuiywg\",\"displayName\":\"wgndrvynhzgpp\"}]}") .toObject(ServiceSpecification.class); - Assertions.assertEquals("yffdfdos", model.metricSpecifications().get(0).name()); - Assertions.assertEquals("expa", model.metricSpecifications().get(0).displayName()); - Assertions.assertEquals("akhmsbzjhcrz", model.metricSpecifications().get(0).displayDescription()); - Assertions.assertEquals("dphlxaolt", model.metricSpecifications().get(0).unit()); - Assertions.assertEquals("trg", model.metricSpecifications().get(0).aggregationType()); - Assertions.assertEquals("bpf", model.metricSpecifications().get(0).fillGapWithZero()); - Assertions.assertEquals("s", model.metricSpecifications().get(0).category()); - Assertions.assertEquals("cjrwzoxxjtfellu", model.logSpecifications().get(0).name()); - Assertions.assertEquals("zitonpeqfpjkjl", model.logSpecifications().get(0).displayName()); + Assertions.assertEquals("izuckyfihrfidfvz", model.metricSpecifications().get(0).name()); + Assertions.assertEquals("zuhtymwisdkfthwx", model.metricSpecifications().get(0).displayName()); + Assertions.assertEquals("t", model.metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("waopvkmijcmmxd", model.metricSpecifications().get(0).unit()); + Assertions.assertEquals("fufsrpymzi", model.metricSpecifications().get(0).aggregationType()); + Assertions.assertEquals("sezcxtb", model.metricSpecifications().get(0).fillGapWithZero()); + Assertions.assertEquals("gfycc", model.metricSpecifications().get(0).category()); + Assertions.assertEquals("mdwzjeiachboo", model.metricSpecifications().get(0).dimensions().get(0).name()); + Assertions.assertEquals("lnrosfqp", model.metricSpecifications().get(0).dimensions().get(0).displayName()); + Assertions.assertEquals("ehzzvypyqrim", model.metricSpecifications().get(0).dimensions().get(0).internalName()); + Assertions.assertEquals(true, model.metricSpecifications().get(0).dimensions().get(0).toBeExportedForShoebox()); + Assertions.assertEquals("qdrabhjybigehoqf", model.logSpecifications().get(0).name()); + Assertions.assertEquals("wska", model.logSpecifications().get(0).displayName()); } @org.junit.jupiter.api.Test @@ -38,26 +43,101 @@ public void testSerialize() throws Exception { Arrays .asList( new MetricSpecification() - .withName("yffdfdos") - .withDisplayName("expa") - .withDisplayDescription("akhmsbzjhcrz") - .withUnit("dphlxaolt") - .withAggregationType("trg") - .withFillGapWithZero("bpf") - .withCategory("s") - .withDimensions(Arrays.asList()))) + .withName("izuckyfihrfidfvz") + .withDisplayName("zuhtymwisdkfthwx") + .withDisplayDescription("t") + .withUnit("waopvkmijcmmxd") + .withAggregationType("fufsrpymzi") + .withFillGapWithZero("sezcxtb") + .withCategory("gfycc") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("mdwzjeiachboo") + .withDisplayName("lnrosfqp") + .withInternalName("ehzzvypyqrim") + .withToBeExportedForShoebox(true), + new Dimension() + .withName("vswjdk") + .withDisplayName("soodqxhcrmnoh") + .withInternalName("ckwhds") + .withToBeExportedForShoebox(true))), + new MetricSpecification() + .withName("yip") + .withDisplayName("sqwpgrjb") + .withDisplayDescription("orcjxvsnby") + .withUnit("abnmocpcyshu") + .withAggregationType("afbljjgpbtoqcjmk") + .withFillGapWithZero("a") + .withCategory("qidtqajzyu") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("dj") + .withDisplayName("lkhbz") + .withInternalName("epgzgqexz") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("scpai") + .withDisplayName("hhbcsglummajtjao") + .withInternalName("obnbdxkqpxokaj") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("imexgstxgcpodgma") + .withDisplayName("r") + .withInternalName("djwzrlov") + .withToBeExportedForShoebox(true))), + new MetricSpecification() + .withName("hijco") + .withDisplayName("ctbzaq") + .withDisplayDescription("sycbkbfk") + .withUnit("kdkexxp") + .withAggregationType("fmxa") + .withFillGapWithZero("fjpgddtocjjxhvp") + .withCategory("uexhdzx") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("ojnxqbzvdd") + .withDisplayName("wndeicbtwnp") + .withInternalName("oqvuhr") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("cyddglmjthjqk") + .withDisplayName("yeicxmqciwqvhk") + .withInternalName("xuigdtopbobj") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("e") + .withDisplayName("a") + .withInternalName("uhrzayvvt") + .withToBeExportedForShoebox(false), + new Dimension() + .withName("f") + .withDisplayName("otkftutqxlngx") + .withInternalName("fgugnxkrxdqmid") + .withToBeExportedForShoebox(false))))) .withLogSpecifications( Arrays - .asList(new LogSpecification().withName("cjrwzoxxjtfellu").withDisplayName("zitonpeqfpjkjl"))); + .asList( + new LogSpecification().withName("qdrabhjybigehoqf").withDisplayName("wska"), + new LogSpecification().withName("ktzlcuiywg").withDisplayName("wgndrvynhzgpp"))); model = BinaryData.fromObject(model).toObject(ServiceSpecification.class); - Assertions.assertEquals("yffdfdos", model.metricSpecifications().get(0).name()); - Assertions.assertEquals("expa", model.metricSpecifications().get(0).displayName()); - Assertions.assertEquals("akhmsbzjhcrz", model.metricSpecifications().get(0).displayDescription()); - Assertions.assertEquals("dphlxaolt", model.metricSpecifications().get(0).unit()); - Assertions.assertEquals("trg", model.metricSpecifications().get(0).aggregationType()); - Assertions.assertEquals("bpf", model.metricSpecifications().get(0).fillGapWithZero()); - Assertions.assertEquals("s", model.metricSpecifications().get(0).category()); - Assertions.assertEquals("cjrwzoxxjtfellu", model.logSpecifications().get(0).name()); - Assertions.assertEquals("zitonpeqfpjkjl", model.logSpecifications().get(0).displayName()); + Assertions.assertEquals("izuckyfihrfidfvz", model.metricSpecifications().get(0).name()); + Assertions.assertEquals("zuhtymwisdkfthwx", model.metricSpecifications().get(0).displayName()); + Assertions.assertEquals("t", model.metricSpecifications().get(0).displayDescription()); + Assertions.assertEquals("waopvkmijcmmxd", model.metricSpecifications().get(0).unit()); + Assertions.assertEquals("fufsrpymzi", model.metricSpecifications().get(0).aggregationType()); + Assertions.assertEquals("sezcxtb", model.metricSpecifications().get(0).fillGapWithZero()); + Assertions.assertEquals("gfycc", model.metricSpecifications().get(0).category()); + Assertions.assertEquals("mdwzjeiachboo", model.metricSpecifications().get(0).dimensions().get(0).name()); + Assertions.assertEquals("lnrosfqp", model.metricSpecifications().get(0).dimensions().get(0).displayName()); + Assertions.assertEquals("ehzzvypyqrim", model.metricSpecifications().get(0).dimensions().get(0).internalName()); + Assertions.assertEquals(true, model.metricSpecifications().get(0).dimensions().get(0).toBeExportedForShoebox()); + Assertions.assertEquals("qdrabhjybigehoqf", model.logSpecifications().get(0).name()); + Assertions.assertEquals("wska", model.logSpecifications().get(0).displayName()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ShareablePrivateLinkResourcePropertiesTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ShareablePrivateLinkResourcePropertiesTests.java index 6d999c003b1f..4b29b9dffd45 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ShareablePrivateLinkResourcePropertiesTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ShareablePrivateLinkResourcePropertiesTests.java @@ -13,23 +13,23 @@ public final class ShareablePrivateLinkResourcePropertiesTests { public void testDeserialize() throws Exception { ShareablePrivateLinkResourceProperties model = BinaryData - .fromString("{\"description\":\"qrhzoymibmrqyib\",\"groupId\":\"wfluszdt\",\"type\":\"rkwofyyvoqa\"}") + .fromString("{\"description\":\"joxoism\",\"groupId\":\"sbpimlq\",\"type\":\"jxkcgxxlxsff\"}") .toObject(ShareablePrivateLinkResourceProperties.class); - Assertions.assertEquals("qrhzoymibmrqyib", model.description()); - Assertions.assertEquals("wfluszdt", model.groupId()); - Assertions.assertEquals("rkwofyyvoqa", model.type()); + Assertions.assertEquals("joxoism", model.description()); + Assertions.assertEquals("sbpimlq", model.groupId()); + Assertions.assertEquals("jxkcgxxlxsff", model.type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ShareablePrivateLinkResourceProperties model = new ShareablePrivateLinkResourceProperties() - .withDescription("qrhzoymibmrqyib") - .withGroupId("wfluszdt") - .withType("rkwofyyvoqa"); + .withDescription("joxoism") + .withGroupId("sbpimlq") + .withType("jxkcgxxlxsff"); model = BinaryData.fromObject(model).toObject(ShareablePrivateLinkResourceProperties.class); - Assertions.assertEquals("qrhzoymibmrqyib", model.description()); - Assertions.assertEquals("wfluszdt", model.groupId()); - Assertions.assertEquals("rkwofyyvoqa", model.type()); + Assertions.assertEquals("joxoism", model.description()); + Assertions.assertEquals("sbpimlq", model.groupId()); + Assertions.assertEquals("jxkcgxxlxsff", model.type()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ShareablePrivateLinkResourceTypeTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ShareablePrivateLinkResourceTypeTests.java index ec9c6dd54ceb..f6f59c8152c4 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ShareablePrivateLinkResourceTypeTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/ShareablePrivateLinkResourceTypeTests.java @@ -15,28 +15,28 @@ public void testDeserialize() throws Exception { ShareablePrivateLinkResourceType model = BinaryData .fromString( - "{\"name\":\"oz\",\"properties\":{\"description\":\"helxprglya\",\"groupId\":\"dckcbc\",\"type\":\"jrjxgciqibrhosx\"}}") + "{\"name\":\"miccwrwfscjfnyn\",\"properties\":{\"description\":\"ujiz\",\"groupId\":\"oqytibyowbblgy\",\"type\":\"utp\"}}") .toObject(ShareablePrivateLinkResourceType.class); - Assertions.assertEquals("oz", model.name()); - Assertions.assertEquals("helxprglya", model.properties().description()); - Assertions.assertEquals("dckcbc", model.properties().groupId()); - Assertions.assertEquals("jrjxgciqibrhosx", model.properties().type()); + Assertions.assertEquals("miccwrwfscjfnyn", model.name()); + Assertions.assertEquals("ujiz", model.properties().description()); + Assertions.assertEquals("oqytibyowbblgy", model.properties().groupId()); + Assertions.assertEquals("utp", model.properties().type()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { ShareablePrivateLinkResourceType model = new ShareablePrivateLinkResourceType() - .withName("oz") + .withName("miccwrwfscjfnyn") .withProperties( new ShareablePrivateLinkResourceProperties() - .withDescription("helxprglya") - .withGroupId("dckcbc") - .withType("jrjxgciqibrhosx")); + .withDescription("ujiz") + .withGroupId("oqytibyowbblgy") + .withType("utp")); model = BinaryData.fromObject(model).toObject(ShareablePrivateLinkResourceType.class); - Assertions.assertEquals("oz", model.name()); - Assertions.assertEquals("helxprglya", model.properties().description()); - Assertions.assertEquals("dckcbc", model.properties().groupId()); - Assertions.assertEquals("jrjxgciqibrhosx", model.properties().type()); + Assertions.assertEquals("miccwrwfscjfnyn", model.name()); + Assertions.assertEquals("ujiz", model.properties().description()); + Assertions.assertEquals("oqytibyowbblgy", model.properties().groupId()); + Assertions.assertEquals("utp", model.properties().type()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourceInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourceInnerTests.java index 705c698dab44..1426aa121e8f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourceInnerTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourceInnerTests.java @@ -14,23 +14,23 @@ public void testDeserialize() throws Exception { SharedPrivateLinkResourceInner model = BinaryData .fromString( - "{\"properties\":{\"groupId\":\"ofmxagkvtmelmqkr\",\"privateLinkResourceId\":\"ahvljuaha\",\"provisioningState\":\"Creating\",\"requestMessage\":\"dhmdua\",\"status\":\"Disconnected\"},\"id\":\"xqpvfadmw\",\"name\":\"rcrgvx\",\"type\":\"vgomz\"}") + "{\"properties\":{\"groupId\":\"vriiio\",\"privateLinkResourceId\":\"nalghfkvtvsexso\",\"provisioningState\":\"Updating\",\"requestMessage\":\"uqhhahhxvrh\",\"status\":\"Disconnected\"},\"id\":\"wpjgwws\",\"name\":\"ughftqsx\",\"type\":\"qxujxukndxd\"}") .toObject(SharedPrivateLinkResourceInner.class); - Assertions.assertEquals("ofmxagkvtmelmqkr", model.groupId()); - Assertions.assertEquals("ahvljuaha", model.privateLinkResourceId()); - Assertions.assertEquals("dhmdua", model.requestMessage()); + Assertions.assertEquals("vriiio", model.groupId()); + Assertions.assertEquals("nalghfkvtvsexso", model.privateLinkResourceId()); + Assertions.assertEquals("uqhhahhxvrh", model.requestMessage()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { SharedPrivateLinkResourceInner model = new SharedPrivateLinkResourceInner() - .withGroupId("ofmxagkvtmelmqkr") - .withPrivateLinkResourceId("ahvljuaha") - .withRequestMessage("dhmdua"); + .withGroupId("vriiio") + .withPrivateLinkResourceId("nalghfkvtvsexso") + .withRequestMessage("uqhhahhxvrh"); model = BinaryData.fromObject(model).toObject(SharedPrivateLinkResourceInner.class); - Assertions.assertEquals("ofmxagkvtmelmqkr", model.groupId()); - Assertions.assertEquals("ahvljuaha", model.privateLinkResourceId()); - Assertions.assertEquals("dhmdua", model.requestMessage()); + Assertions.assertEquals("vriiio", model.groupId()); + Assertions.assertEquals("nalghfkvtvsexso", model.privateLinkResourceId()); + Assertions.assertEquals("uqhhahhxvrh", model.requestMessage()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourceListTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourceListTests.java index 976fcbf15b13..e59f04fe1948 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourceListTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourceListTests.java @@ -16,12 +16,12 @@ public void testDeserialize() throws Exception { SharedPrivateLinkResourceList model = BinaryData .fromString( - "{\"value\":[{\"properties\":{\"groupId\":\"tg\",\"privateLinkResourceId\":\"wbwo\",\"provisioningState\":\"Canceled\",\"requestMessage\":\"shrtdtkcnqxwb\",\"status\":\"Approved\"},\"id\":\"ulpiuj\",\"name\":\"aasipqi\",\"type\":\"obyu\"},{\"properties\":{\"groupId\":\"pqlpq\",\"privateLinkResourceId\":\"cciuqgbdbutau\",\"provisioningState\":\"Running\",\"requestMessage\":\"kuwhh\",\"status\":\"Approved\"},\"id\":\"k\",\"name\":\"joxafnndlpi\",\"type\":\"hkoymkcdyhbp\"},{\"properties\":{\"groupId\":\"wdreqnovvqfovl\",\"privateLinkResourceId\":\"xywsuws\",\"provisioningState\":\"Running\",\"requestMessage\":\"dsytgadgvr\",\"status\":\"Pending\"},\"id\":\"en\",\"name\":\"qnzarrwl\",\"type\":\"uu\"}],\"nextLink\":\"fqka\"}") + "{\"value\":[{\"properties\":{\"groupId\":\"eewchpxlktw\",\"privateLinkResourceId\":\"uziycsl\",\"provisioningState\":\"Moving\",\"requestMessage\":\"uztcktyhjtqed\",\"status\":\"Pending\"},\"id\":\"ulwm\",\"name\":\"rqzz\",\"type\":\"rjvpglydzgkrvqee\"},{\"properties\":{\"groupId\":\"oepry\",\"privateLinkResourceId\":\"t\",\"provisioningState\":\"Deleting\",\"requestMessage\":\"pzdm\",\"status\":\"Rejected\"},\"id\":\"vf\",\"name\":\"aawzqadfl\",\"type\":\"z\"},{\"properties\":{\"groupId\":\"iglaecx\",\"privateLinkResourceId\":\"dticokpvzml\",\"provisioningState\":\"Moving\",\"requestMessage\":\"dgxobfircl\",\"status\":\"Approved\"},\"id\":\"ciayzriykhya\",\"name\":\"fvjlboxqvkjlmx\",\"type\":\"omdynhdwdigum\"}],\"nextLink\":\"raauzzpt\"}") .toObject(SharedPrivateLinkResourceList.class); - Assertions.assertEquals("tg", model.value().get(0).groupId()); - Assertions.assertEquals("wbwo", model.value().get(0).privateLinkResourceId()); - Assertions.assertEquals("shrtdtkcnqxwb", model.value().get(0).requestMessage()); - Assertions.assertEquals("fqka", model.nextLink()); + Assertions.assertEquals("eewchpxlktw", model.value().get(0).groupId()); + Assertions.assertEquals("uziycsl", model.value().get(0).privateLinkResourceId()); + Assertions.assertEquals("uztcktyhjtqed", model.value().get(0).requestMessage()); + Assertions.assertEquals("raauzzpt", model.nextLink()); } @org.junit.jupiter.api.Test @@ -32,22 +32,22 @@ public void testSerialize() throws Exception { Arrays .asList( new SharedPrivateLinkResourceInner() - .withGroupId("tg") - .withPrivateLinkResourceId("wbwo") - .withRequestMessage("shrtdtkcnqxwb"), + .withGroupId("eewchpxlktw") + .withPrivateLinkResourceId("uziycsl") + .withRequestMessage("uztcktyhjtqed"), new SharedPrivateLinkResourceInner() - .withGroupId("pqlpq") - .withPrivateLinkResourceId("cciuqgbdbutau") - .withRequestMessage("kuwhh"), + .withGroupId("oepry") + .withPrivateLinkResourceId("t") + .withRequestMessage("pzdm"), new SharedPrivateLinkResourceInner() - .withGroupId("wdreqnovvqfovl") - .withPrivateLinkResourceId("xywsuws") - .withRequestMessage("dsytgadgvr"))) - .withNextLink("fqka"); + .withGroupId("iglaecx") + .withPrivateLinkResourceId("dticokpvzml") + .withRequestMessage("dgxobfircl"))) + .withNextLink("raauzzpt"); model = BinaryData.fromObject(model).toObject(SharedPrivateLinkResourceList.class); - Assertions.assertEquals("tg", model.value().get(0).groupId()); - Assertions.assertEquals("wbwo", model.value().get(0).privateLinkResourceId()); - Assertions.assertEquals("shrtdtkcnqxwb", model.value().get(0).requestMessage()); - Assertions.assertEquals("fqka", model.nextLink()); + Assertions.assertEquals("eewchpxlktw", model.value().get(0).groupId()); + Assertions.assertEquals("uziycsl", model.value().get(0).privateLinkResourceId()); + Assertions.assertEquals("uztcktyhjtqed", model.value().get(0).requestMessage()); + Assertions.assertEquals("raauzzpt", model.nextLink()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourcePropertiesTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourcePropertiesTests.java index daf5117292ce..d9af1d9f949f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourcePropertiesTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SharedPrivateLinkResourcePropertiesTests.java @@ -14,23 +14,23 @@ public void testDeserialize() throws Exception { SharedPrivateLinkResourceProperties model = BinaryData .fromString( - "{\"groupId\":\"fmisg\",\"privateLinkResourceId\":\"bnbbeldawkz\",\"provisioningState\":\"Running\",\"requestMessage\":\"ourqhakau\",\"status\":\"Approved\"}") + "{\"groupId\":\"grjguufzd\",\"privateLinkResourceId\":\"syqtfi\",\"provisioningState\":\"Failed\",\"requestMessage\":\"otzi\",\"status\":\"Timeout\"}") .toObject(SharedPrivateLinkResourceProperties.class); - Assertions.assertEquals("fmisg", model.groupId()); - Assertions.assertEquals("bnbbeldawkz", model.privateLinkResourceId()); - Assertions.assertEquals("ourqhakau", model.requestMessage()); + Assertions.assertEquals("grjguufzd", model.groupId()); + Assertions.assertEquals("syqtfi", model.privateLinkResourceId()); + Assertions.assertEquals("otzi", model.requestMessage()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { SharedPrivateLinkResourceProperties model = new SharedPrivateLinkResourceProperties() - .withGroupId("fmisg") - .withPrivateLinkResourceId("bnbbeldawkz") - .withRequestMessage("ourqhakau"); + .withGroupId("grjguufzd") + .withPrivateLinkResourceId("syqtfi") + .withRequestMessage("otzi"); model = BinaryData.fromObject(model).toObject(SharedPrivateLinkResourceProperties.class); - Assertions.assertEquals("fmisg", model.groupId()); - Assertions.assertEquals("bnbbeldawkz", model.privateLinkResourceId()); - Assertions.assertEquals("ourqhakau", model.requestMessage()); + Assertions.assertEquals("grjguufzd", model.groupId()); + Assertions.assertEquals("syqtfi", model.privateLinkResourceId()); + Assertions.assertEquals("otzi", model.requestMessage()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCorsSettingsTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCorsSettingsTests.java index fc7da94510a2..304ec7261e99 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCorsSettingsTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCorsSettingsTests.java @@ -14,17 +14,15 @@ public final class SignalRCorsSettingsTests { public void testDeserialize() throws Exception { SignalRCorsSettings model = BinaryData - .fromString("{\"allowedOrigins\":[\"gzva\",\"apj\",\"zhpvgqzcjrvxd\",\"zlmwlxkvugfhz\"]}") + .fromString("{\"allowedOrigins\":[\"ggjioolvr\",\"x\",\"v\"]}") .toObject(SignalRCorsSettings.class); - Assertions.assertEquals("gzva", model.allowedOrigins().get(0)); + Assertions.assertEquals("ggjioolvr", model.allowedOrigins().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - SignalRCorsSettings model = - new SignalRCorsSettings() - .withAllowedOrigins(Arrays.asList("gzva", "apj", "zhpvgqzcjrvxd", "zlmwlxkvugfhz")); + SignalRCorsSettings model = new SignalRCorsSettings().withAllowedOrigins(Arrays.asList("ggjioolvr", "x", "v")); model = BinaryData.fromObject(model).toObject(SignalRCorsSettings.class); - Assertions.assertEquals("gzva", model.allowedOrigins().get(0)); + Assertions.assertEquals("ggjioolvr", model.allowedOrigins().get(0)); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesDeleteWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesDeleteWithResponseMockTests.java index c364b0ea6562..b4855fe2fc6f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesDeleteWithResponseMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomCertificatesDeleteWithResponseMockTests.java @@ -58,6 +58,6 @@ public void testDeleteWithResponse() throws Exception { manager .signalRCustomCertificates() - .deleteWithResponse("ffhmouwqlgzr", "zeeyebi", "ikayuhqlbjbsybb", com.azure.core.util.Context.NONE); + .deleteWithResponse("dxxewuninv", "db", "h", com.azure.core.util.Context.NONE); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsDeleteMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsDeleteMockTests.java index cf0f175047ea..8373c2aa59a9 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsDeleteMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsDeleteMockTests.java @@ -56,6 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.signalRCustomDomains().delete("ughftqsx", "qxujxukndxd", "grjguufzd", com.azure.core.util.Context.NONE); + manager.signalRCustomDomains().delete("aimmoiroqb", "shbraga", "yyrmfsvbp", com.azure.core.util.Context.NONE); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsGetWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsGetWithResponseMockTests.java index 056c2de4674a..85122b704a0b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsGetWithResponseMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsGetWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Failed\",\"domainName\":\"feljagrqm\",\"customCertificate\":{\"id\":\"ldvriiiojnalghfk\"}},\"id\":\"tvsexsowuel\",\"name\":\"qhhahhxvrhmzkwpj\",\"type\":\"wws\"}"; + "{\"properties\":{\"provisioningState\":\"Unknown\",\"domainName\":\"yuicdhzbdy\",\"customCertificate\":{\"id\":\"wgbdvibidmhmwffp\"}},\"id\":\"fmuvapckccr\",\"name\":\"vwe\",\"type\":\"oxoyyukp\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,10 +62,10 @@ public void testGetWithResponse() throws Exception { CustomDomain response = manager .signalRCustomDomains() - .getWithResponse("zszrnwoiindfpw", "jylwbtlhflsj", "dhszfjv", com.azure.core.util.Context.NONE) + .getWithResponse("d", "dtfgxqbawpcbb", "zqcyknap", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("feljagrqm", response.domainName()); - Assertions.assertEquals("ldvriiiojnalghfk", response.customCertificate().id()); + Assertions.assertEquals("yuicdhzbdy", response.domainName()); + Assertions.assertEquals("wgbdvibidmhmwffp", response.customCertificate().id()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsListMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsListMockTests.java index 3d2c4e7311a3..1f9a148a00ec 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsListMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRCustomDomainsListMockTests.java @@ -32,7 +32,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Unknown\",\"domainName\":\"kpzi\",\"customCertificate\":{\"id\":\"j\"}},\"id\":\"anlfzxiavrmbz\",\"name\":\"nokixrjqcirgz\",\"type\":\"frl\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"Unknown\",\"domainName\":\"izrxklob\",\"customCertificate\":{\"id\":\"nazpmk\"}},\"id\":\"lmv\",\"name\":\"vfxzopjh\",\"type\":\"zxlioh\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,9 +61,9 @@ public void testList() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.signalRCustomDomains().list("pdrhne", "yowqkdwytisibir", com.azure.core.util.Context.NONE); + manager.signalRCustomDomains().list("wnwvroevytlyokr", "rouuxvnsasbcry", com.azure.core.util.Context.NONE); - Assertions.assertEquals("kpzi", response.iterator().next().domainName()); - Assertions.assertEquals("j", response.iterator().next().customCertificate().id()); + Assertions.assertEquals("izrxklob", response.iterator().next().domainName()); + Assertions.assertEquals("nazpmk", response.iterator().next().customCertificate().id()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRFeatureTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRFeatureTests.java index a7e24d9bd40b..b2777cefcdac 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRFeatureTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRFeatureTests.java @@ -17,26 +17,29 @@ public void testDeserialize() throws Exception { SignalRFeature model = BinaryData .fromString( - "{\"flag\":\"EnableMessagingLogs\",\"value\":\"wxosowzxcug\",\"properties\":{\"wfvovbv\":\"ooxdjebwpuc\",\"jrwjueiotwm\":\"euecivyhzceuoj\",\"rjaw\":\"dytdxwitx\"}}") + "{\"flag\":\"ServiceMode\",\"value\":\"phoszqz\",\"properties\":{\"ynwcvtbv\":\"hqamvdkf\",\"pcnp\":\"ayhmtnvyqiatkz\",\"jguq\":\"zcjaesgvvsccy\",\"lvdnkfx\":\"hwyg\"}}") .toObject(SignalRFeature.class); - Assertions.assertEquals(FeatureFlags.ENABLE_MESSAGING_LOGS, model.flag()); - Assertions.assertEquals("wxosowzxcug", model.value()); - Assertions.assertEquals("ooxdjebwpuc", model.properties().get("wfvovbv")); + Assertions.assertEquals(FeatureFlags.SERVICE_MODE, model.flag()); + Assertions.assertEquals("phoszqz", model.value()); + Assertions.assertEquals("hqamvdkf", model.properties().get("ynwcvtbv")); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { SignalRFeature model = new SignalRFeature() - .withFlag(FeatureFlags.ENABLE_MESSAGING_LOGS) - .withValue("wxosowzxcug") - .withProperties(mapOf("wfvovbv", "ooxdjebwpuc", "jrwjueiotwm", "euecivyhzceuoj", "rjaw", "dytdxwitx")); + .withFlag(FeatureFlags.SERVICE_MODE) + .withValue("phoszqz") + .withProperties( + mapOf( + "ynwcvtbv", "hqamvdkf", "pcnp", "ayhmtnvyqiatkz", "jguq", "zcjaesgvvsccy", "lvdnkfx", "hwyg")); model = BinaryData.fromObject(model).toObject(SignalRFeature.class); - Assertions.assertEquals(FeatureFlags.ENABLE_MESSAGING_LOGS, model.flag()); - Assertions.assertEquals("wxosowzxcug", model.value()); - Assertions.assertEquals("ooxdjebwpuc", model.properties().get("wfvovbv")); + Assertions.assertEquals(FeatureFlags.SERVICE_MODE, model.flag()); + Assertions.assertEquals("phoszqz", model.value()); + Assertions.assertEquals("hqamvdkf", model.properties().get("ynwcvtbv")); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRNetworkACLsTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRNetworkACLsTests.java index 58da35543c9e..a7f9c85bbe03 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRNetworkACLsTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRNetworkACLsTests.java @@ -19,14 +19,14 @@ public void testDeserialize() throws Exception { SignalRNetworkACLs model = BinaryData .fromString( - "{\"defaultAction\":\"Allow\",\"publicNetwork\":{\"allow\":[\"RESTAPI\",\"RESTAPI\"],\"deny\":[\"ServerConnection\"]},\"privateEndpoints\":[{\"name\":\"xolzdahzx\",\"allow\":[\"Trace\",\"RESTAPI\",\"ServerConnection\"],\"deny\":[\"ServerConnection\",\"Trace\",\"ServerConnection\"]},{\"name\":\"zpostmgrcfbu\",\"allow\":[\"Trace\",\"RESTAPI\",\"ServerConnection\"],\"deny\":[\"ServerConnection\",\"RESTAPI\"]},{\"name\":\"bpvjymjhx\",\"allow\":[\"ClientConnection\",\"Trace\"],\"deny\":[\"ServerConnection\",\"ClientConnection\"]}]}") + "{\"defaultAction\":\"Allow\",\"publicNetwork\":{\"allow\":[\"Trace\"],\"deny\":[\"ServerConnection\",\"ServerConnection\",\"RESTAPI\",\"ClientConnection\"]},\"privateEndpoints\":[{\"name\":\"edltmmjihyeozp\",\"allow\":[\"RESTAPI\"],\"deny\":[\"RESTAPI\"]},{\"name\":\"ncyg\",\"allow\":[\"Trace\"],\"deny\":[\"RESTAPI\"]}]}") .toObject(SignalRNetworkACLs.class); Assertions.assertEquals(AclAction.ALLOW, model.defaultAction()); - Assertions.assertEquals(SignalRRequestType.RESTAPI, model.publicNetwork().allow().get(0)); + Assertions.assertEquals(SignalRRequestType.TRACE, model.publicNetwork().allow().get(0)); Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.publicNetwork().deny().get(0)); - Assertions.assertEquals(SignalRRequestType.TRACE, model.privateEndpoints().get(0).allow().get(0)); - Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.privateEndpoints().get(0).deny().get(0)); - Assertions.assertEquals("xolzdahzx", model.privateEndpoints().get(0).name()); + Assertions.assertEquals(SignalRRequestType.RESTAPI, model.privateEndpoints().get(0).allow().get(0)); + Assertions.assertEquals(SignalRRequestType.RESTAPI, model.privateEndpoints().get(0).deny().get(0)); + Assertions.assertEquals("edltmmjihyeozp", model.privateEndpoints().get(0).name()); } @org.junit.jupiter.api.Test @@ -36,49 +36,31 @@ public void testSerialize() throws Exception { .withDefaultAction(AclAction.ALLOW) .withPublicNetwork( new NetworkAcl() - .withAllow(Arrays.asList(SignalRRequestType.RESTAPI, SignalRRequestType.RESTAPI)) - .withDeny(Arrays.asList(SignalRRequestType.SERVER_CONNECTION))) + .withAllow(Arrays.asList(SignalRRequestType.TRACE)) + .withDeny( + Arrays + .asList( + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.RESTAPI, + SignalRRequestType.CLIENT_CONNECTION))) .withPrivateEndpoints( Arrays .asList( new PrivateEndpointAcl() - .withAllow( - Arrays - .asList( - SignalRRequestType.TRACE, - SignalRRequestType.RESTAPI, - SignalRRequestType.SERVER_CONNECTION)) - .withDeny( - Arrays - .asList( - SignalRRequestType.SERVER_CONNECTION, - SignalRRequestType.TRACE, - SignalRRequestType.SERVER_CONNECTION)) - .withName("xolzdahzx"), + .withAllow(Arrays.asList(SignalRRequestType.RESTAPI)) + .withDeny(Arrays.asList(SignalRRequestType.RESTAPI)) + .withName("edltmmjihyeozp"), new PrivateEndpointAcl() - .withAllow( - Arrays - .asList( - SignalRRequestType.TRACE, - SignalRRequestType.RESTAPI, - SignalRRequestType.SERVER_CONNECTION)) - .withDeny( - Arrays.asList(SignalRRequestType.SERVER_CONNECTION, SignalRRequestType.RESTAPI)) - .withName("zpostmgrcfbu"), - new PrivateEndpointAcl() - .withAllow( - Arrays.asList(SignalRRequestType.CLIENT_CONNECTION, SignalRRequestType.TRACE)) - .withDeny( - Arrays - .asList( - SignalRRequestType.SERVER_CONNECTION, SignalRRequestType.CLIENT_CONNECTION)) - .withName("bpvjymjhx"))); + .withAllow(Arrays.asList(SignalRRequestType.TRACE)) + .withDeny(Arrays.asList(SignalRRequestType.RESTAPI)) + .withName("ncyg"))); model = BinaryData.fromObject(model).toObject(SignalRNetworkACLs.class); Assertions.assertEquals(AclAction.ALLOW, model.defaultAction()); - Assertions.assertEquals(SignalRRequestType.RESTAPI, model.publicNetwork().allow().get(0)); + Assertions.assertEquals(SignalRRequestType.TRACE, model.publicNetwork().allow().get(0)); Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.publicNetwork().deny().get(0)); - Assertions.assertEquals(SignalRRequestType.TRACE, model.privateEndpoints().get(0).allow().get(0)); - Assertions.assertEquals(SignalRRequestType.SERVER_CONNECTION, model.privateEndpoints().get(0).deny().get(0)); - Assertions.assertEquals("xolzdahzx", model.privateEndpoints().get(0).name()); + Assertions.assertEquals(SignalRRequestType.RESTAPI, model.privateEndpoints().get(0).allow().get(0)); + Assertions.assertEquals(SignalRRequestType.RESTAPI, model.privateEndpoints().get(0).deny().get(0)); + Assertions.assertEquals("edltmmjihyeozp", model.privateEndpoints().get(0).name()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsDeleteMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsDeleteMockTests.java index 79d832997725..029c5d841bfe 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsDeleteMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsDeleteMockTests.java @@ -56,8 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager - .signalRPrivateEndpointConnections() - .delete("jjoqkagf", "sxtta", "gzxnfaazpxdtnk", com.azure.core.util.Context.NONE); + manager.signalRPrivateEndpointConnections().delete("ggcvk", "y", "izrzb", com.azure.core.util.Context.NONE); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsGetWithResponseMockTests.java index 454980d8560d..4db49ab4727a 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsGetWithResponseMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsGetWithResponseMockTests.java @@ -32,7 +32,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Failed\",\"privateEndpoint\":{\"id\":\"owepbqpcrfkb\"},\"groupIds\":[\"snjvcdwxlpqekftn\",\"htjsying\",\"fq\",\"tmtdhtmdvypgik\"],\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"w\",\"actionsRequired\":\"irryuzhlh\"}},\"id\":\"joqrvqqaatj\",\"name\":\"nrvgoupmfiibfgg\",\"type\":\"ioolvrwxkvtkkgll\"}"; + "{\"properties\":{\"provisioningState\":\"Unknown\",\"privateEndpoint\":{\"id\":\"afclu\"},\"groupIds\":[\"xmycjimryvwgcw\",\"pbmz\",\"w\"],\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"xwefohecbvopwndy\",\"actionsRequired\":\"eallklmtkhlo\"}},\"id\":\"x\",\"name\":\"pvbrdfjmzsyz\",\"type\":\"hotlhikcyychunsj\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,14 +63,14 @@ public void testGetWithResponse() throws Exception { PrivateEndpointConnection response = manager .signalRPrivateEndpointConnections() - .getWithResponse("mfe", "kerqwkyh", "ob", com.azure.core.util.Context.NONE) + .getWithResponse("owlkjxnqpv", "gf", "tmhqykiz", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("owepbqpcrfkb", response.privateEndpoint().id()); + Assertions.assertEquals("afclu", response.privateEndpoint().id()); Assertions .assertEquals( PrivateLinkServiceConnectionStatus.APPROVED, response.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("w", response.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("irryuzhlh", response.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("xwefohecbvopwndy", response.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("eallklmtkhlo", response.privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsListMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsListMockTests.java index 926aaf776371..ba9d7602b290 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsListMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsListMockTests.java @@ -33,7 +33,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"privateEndpoint\":{\"id\":\"zudphqamvdkfw\"},\"groupIds\":[\"cvtbv\",\"ayhmtnvyqiatkz\",\"pcnp\",\"zcjaesgvvsccy\"],\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"fhwygzlvdnkfxus\",\"actionsRequired\":\"dwzrmuh\"}},\"id\":\"pfcqdp\",\"name\":\"qxqvpsvuoymgc\",\"type\":\"elvezrypq\"}]}"; + "{\"value\":[{\"properties\":{\"provisioningState\":\"Unknown\",\"privateEndpoint\":{\"id\":\"pugmehqe\"},\"groupIds\":[\"fhbzehewhoqhn\"],\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"ldxea\",\"actionsRequired\":\"gschorimkrsrr\"}},\"id\":\"ucsofldpuviyf\",\"name\":\"aabeolhbhlvbmxuq\",\"type\":\"bsxtkcudfbsfarfs\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -64,17 +64,16 @@ public void testList() throws Exception { PagedIterable response = manager .signalRPrivateEndpointConnections() - .list("syqtfi", "whbotzingamv", com.azure.core.util.Context.NONE); + .list("vbopfppdbwnu", "gahxkumasjcaa", com.azure.core.util.Context.NONE); - Assertions.assertEquals("zudphqamvdkfw", response.iterator().next().privateEndpoint().id()); + Assertions.assertEquals("pugmehqe", response.iterator().next().privateEndpoint().id()); Assertions .assertEquals( - PrivateLinkServiceConnectionStatus.PENDING, + PrivateLinkServiceConnectionStatus.DISCONNECTED, response.iterator().next().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("ldxea", response.iterator().next().privateLinkServiceConnectionState().description()); Assertions .assertEquals( - "fhwygzlvdnkfxus", response.iterator().next().privateLinkServiceConnectionState().description()); - Assertions - .assertEquals("dwzrmuh", response.iterator().next().privateLinkServiceConnectionState().actionsRequired()); + "gschorimkrsrr", response.iterator().next().privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsUpdateWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsUpdateWithResponseMockTests.java index dd3c72cca26f..d39682c88d8e 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsUpdateWithResponseMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateEndpointConnectionsUpdateWithResponseMockTests.java @@ -35,7 +35,7 @@ public void testUpdateWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"provisioningState\":\"Moving\",\"privateEndpoint\":{\"id\":\"kxw\"},\"groupIds\":[\"lbqpvuzlmvfelf\"],\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"crpw\",\"actionsRequired\":\"eznoig\"}},\"id\":\"rnjwmw\",\"name\":\"pn\",\"type\":\"saz\"}"; + "{\"properties\":{\"provisioningState\":\"Moving\",\"privateEndpoint\":{\"id\":\"wlpxuzzjg\"},\"groupIds\":[\"fqyhqoto\",\"hiqakydiwfbrk\",\"pzdqtvhcspod\",\"qaxsipietgbebjf\"],\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"ichdlpn\",\"actionsRequired\":\"ubntnbatzviqsow\"}},\"id\":\"aelcat\",\"name\":\"cjuhplrvkm\",\"type\":\"cwmjvlg\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -67,24 +67,24 @@ public void testUpdateWithResponse() throws Exception { manager .signalRPrivateEndpointConnections() .updateWithResponse( - "wjygvjayvblmhvk", - "uhbxvvy", - "gsopbyrqufegxu", + "pjrtws", + "hv", + "uic", new PrivateEndpointConnectionInner() - .withPrivateEndpoint(new PrivateEndpoint().withId("lmctlpd")) + .withPrivateEndpoint(new PrivateEndpoint().withId("mhwrb")) .withPrivateLinkServiceConnectionState( new PrivateLinkServiceConnectionState() - .withStatus(PrivateLinkServiceConnectionStatus.APPROVED) - .withDescription("ijnhyjsvfycxzbf") - .withActionsRequired("owvrvmtgjqppyos")), + .withStatus(PrivateLinkServiceConnectionStatus.PENDING) + .withDescription("hhmemhooclutnp") + .withActionsRequired("emc")), com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("kxw", response.privateEndpoint().id()); + Assertions.assertEquals("wlpxuzzjg", response.privateEndpoint().id()); Assertions .assertEquals( PrivateLinkServiceConnectionStatus.DISCONNECTED, response.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("crpw", response.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("eznoig", response.privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("ichdlpn", response.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("ubntnbatzviqsow", response.privateLinkServiceConnectionState().actionsRequired()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateLinkResourcesListMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateLinkResourcesListMockTests.java index 61d99bd16ece..f8a234ddea6d 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateLinkResourcesListMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPrivateLinkResourcesListMockTests.java @@ -32,7 +32,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"groupId\":\"ou\",\"requiredMembers\":[\"rebqaaysjk\"],\"requiredZoneNames\":[\"tnqttezlwfffiak\",\"jpqqmted\"],\"shareablePrivateLinkResourceTypes\":[]},\"id\":\"mjihyeozphv\",\"name\":\"auyqncygupkv\",\"type\":\"p\"}]}"; + "{\"value\":[{\"properties\":{\"groupId\":\"oveofizrvjfnmj\",\"requiredMembers\":[\"wyzgiblkuj\",\"llfojuidjp\"],\"requiredZoneNames\":[\"jucejikzoeovvtz\",\"je\",\"jklntikyj\"],\"shareablePrivateLinkResourceTypes\":[{\"name\":\"bqzolxr\",\"properties\":{\"description\":\"qjwt\",\"groupId\":\"tgvgzp\",\"type\":\"rkolawjm\"}}]},\"id\":\"smwr\",\"name\":\"kcdxfzzzw\",\"type\":\"jafi\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,10 +61,22 @@ public void testList() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.signalRPrivateLinkResources().list("mkqjj", "wuenvr", com.azure.core.util.Context.NONE); + manager.signalRPrivateLinkResources().list("psfxsf", "ztlvtmvagbwidqlv", com.azure.core.util.Context.NONE); - Assertions.assertEquals("ou", response.iterator().next().groupId()); - Assertions.assertEquals("rebqaaysjk", response.iterator().next().requiredMembers().get(0)); - Assertions.assertEquals("tnqttezlwfffiak", response.iterator().next().requiredZoneNames().get(0)); + Assertions.assertEquals("oveofizrvjfnmj", response.iterator().next().groupId()); + Assertions.assertEquals("wyzgiblkuj", response.iterator().next().requiredMembers().get(0)); + Assertions.assertEquals("jucejikzoeovvtz", response.iterator().next().requiredZoneNames().get(0)); + Assertions + .assertEquals("bqzolxr", response.iterator().next().shareablePrivateLinkResourceTypes().get(0).name()); + Assertions + .assertEquals( + "qjwt", + response.iterator().next().shareablePrivateLinkResourceTypes().get(0).properties().description()); + Assertions + .assertEquals( + "tgvgzp", response.iterator().next().shareablePrivateLinkResourceTypes().get(0).properties().groupId()); + Assertions + .assertEquals( + "rkolawjm", response.iterator().next().shareablePrivateLinkResourceTypes().get(0).properties().type()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPropertiesTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPropertiesTests.java index 90f72c351d97..71c176b91a59 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPropertiesTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRPropertiesTests.java @@ -10,6 +10,7 @@ import com.azure.resourcemanager.signalr.models.FeatureFlags; import com.azure.resourcemanager.signalr.models.LiveTraceCategory; import com.azure.resourcemanager.signalr.models.LiveTraceConfiguration; +import com.azure.resourcemanager.signalr.models.ManagedIdentitySettings; import com.azure.resourcemanager.signalr.models.NetworkAcl; import com.azure.resourcemanager.signalr.models.PrivateEndpointAcl; import com.azure.resourcemanager.signalr.models.ResourceLogCategory; @@ -21,6 +22,8 @@ import com.azure.resourcemanager.signalr.models.SignalRNetworkACLs; import com.azure.resourcemanager.signalr.models.SignalRRequestType; import com.azure.resourcemanager.signalr.models.SignalRTlsSettings; +import com.azure.resourcemanager.signalr.models.UpstreamAuthSettings; +import com.azure.resourcemanager.signalr.models.UpstreamAuthType; import com.azure.resourcemanager.signalr.models.UpstreamTemplate; import java.util.Arrays; import java.util.HashMap; @@ -33,29 +36,35 @@ public void testDeserialize() throws Exception { SignalRProperties model = BinaryData .fromString( - "{\"provisioningState\":\"Running\",\"externalIP\":\"o\",\"hostName\":\"ukgjnpiucgygevq\",\"publicPort\":2000803950,\"serverPort\":561322525,\"version\":\"rbpizc\",\"privateEndpointConnections\":[{\"properties\":{\"provisioningState\":\"Creating\",\"groupIds\":[]},\"id\":\"fyhxde\",\"name\":\"ejzicwifsjtt\",\"type\":\"zfbishcbkhaj\"},{\"properties\":{\"provisioningState\":\"Updating\",\"groupIds\":[]},\"id\":\"hagalpbuxwgipwh\",\"name\":\"nowkgshw\",\"type\":\"nkixzbinj\"},{\"properties\":{\"provisioningState\":\"Running\",\"groupIds\":[]},\"id\":\"wnuzoqftiyqzrnkc\",\"name\":\"vyxlwhzlsicohoqq\",\"type\":\"wvl\"},{\"properties\":{\"provisioningState\":\"Moving\",\"groupIds\":[]},\"id\":\"unmmq\",\"name\":\"gyxzk\",\"type\":\"noc\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"yaxuconuqszfkb\",\"privateLinkResourceId\":\"ypewrmjmwvvjekt\",\"provisioningState\":\"Succeeded\",\"requestMessage\":\"nhwlrsffrzpwvl\",\"status\":\"Approved\"},\"id\":\"gbiqylihkaet\",\"name\":\"kt\",\"type\":\"fcivfsnkym\"},{\"properties\":{\"groupId\":\"qhjfbebr\",\"privateLinkResourceId\":\"cxerf\",\"provisioningState\":\"Updating\",\"requestMessage\":\"ttxfvjr\",\"status\":\"Pending\"},\"id\":\"phxepcyvahf\",\"name\":\"ljkyqxjvuuj\",\"type\":\"gidokgjljyoxgvcl\"},{\"properties\":{\"groupId\":\"sncghkjeszz\",\"privateLinkResourceId\":\"bijhtxfvgxbf\",\"provisioningState\":\"Succeeded\",\"requestMessage\":\"eh\",\"status\":\"Pending\"},\"id\":\"ec\",\"name\":\"godebfqkkrbmpu\",\"type\":\"gr\"}],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"lfbxzpuzycisp\",\"features\":[{\"flag\":\"EnableConnectivityLogs\",\"value\":\"hmgkbrpyy\",\"properties\":{\"drgvtqagn\":\"bnuqqkpik\",\"mebf\":\"uynhijg\",\"zmhjrunmp\":\"iarbutrcvpna\"}},{\"flag\":\"EnableMessagingLogs\",\"value\":\"tdbhrbnla\",\"properties\":{\"ny\":\"myskpbhenbtkcxy\",\"nlqidybyxczf\":\"nrs\"}},{\"flag\":\"EnableMessagingLogs\",\"value\":\"haaxdbabphl\",\"properties\":{\"cocmnyyaztt\":\"lfktsths\",\"edckzywbiexzfey\":\"twwrqp\",\"ujwb\":\"eaxib\"}},{\"flag\":\"EnableLiveTrace\",\"value\":\"walm\",\"properties\":{\"zjancuxr\":\"oxaepd\"}}],\"liveTraceConfiguration\":{\"enabled\":\"bavxbniwdjswzt\",\"categories\":[{\"name\":\"gnxytxhpzxbz\",\"enabled\":\"zabglcuhxwt\"}]},\"resourceLogConfiguration\":{\"categories\":[{\"name\":\"klbb\",\"enabled\":\"plwzbhvgyugu\"}]},\"cors\":{\"allowedOrigins\":[\"kfssxqukkf\",\"l\",\"mg\",\"xnkjzkdesl\"]},\"serverless\":{\"connectionTimeoutInSeconds\":909915522},\"upstream\":{\"templates\":[{\"hubPattern\":\"ighxpk\",\"eventPattern\":\"zb\",\"categoryPattern\":\"uebbaumnyqup\",\"urlTemplate\":\"deoj\"}]},\"networkACLs\":{\"defaultAction\":\"Deny\",\"publicNetwork\":{\"allow\":[\"ClientConnection\",\"Trace\",\"RESTAPI\"],\"deny\":[\"RESTAPI\"]},\"privateEndpoints\":[{\"name\":\"fhvpesaps\",\"allow\":[],\"deny\":[]},{\"name\":\"qmhjjdhtld\",\"allow\":[],\"deny\":[]},{\"name\":\"zxuutkncwscwsvl\",\"allow\":[],\"deny\":[]},{\"name\":\"ogtwrupqsxvnmi\",\"allow\":[],\"deny\":[]}]},\"publicNetworkAccess\":\"ceoveilovno\",\"disableLocalAuth\":false,\"disableAadAuth\":false}") + "{\"provisioningState\":\"Failed\",\"externalIP\":\"rjaltolmncw\",\"hostName\":\"bqwcsdbnwdcf\",\"publicPort\":1857074792,\"serverPort\":1491398356,\"version\":\"fuvglsbjjca\",\"privateEndpointConnections\":[{\"properties\":{\"provisioningState\":\"Failed\",\"privateEndpoint\":{\"id\":\"dut\"},\"groupIds\":[\"rmrlxqtvcof\",\"dflvkg\",\"u\",\"gdknnqv\"],\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"n\",\"actionsRequired\":\"rudsg\"}},\"id\":\"hmk\",\"name\":\"c\",\"type\":\"rauwjuetaebu\"},{\"properties\":{\"provisioningState\":\"Creating\",\"privateEndpoint\":{\"id\":\"vsmzlxwab\"},\"groupIds\":[\"efkifr\",\"tpuqujmq\"],\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"tndoaongbjc\",\"actionsRequired\":\"ujitcjedftww\"}},\"id\":\"zkoj\",\"name\":\"dcpzfoqo\",\"type\":\"i\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"arz\",\"privateLinkResourceId\":\"szufoxciqopidoa\",\"provisioningState\":\"Deleting\",\"requestMessage\":\"dhkha\",\"status\":\"Timeout\"},\"id\":\"hnzbonl\",\"name\":\"ntoe\",\"type\":\"okdwb\"},{\"properties\":{\"groupId\":\"kszzcmrvexztv\",\"privateLinkResourceId\":\"t\",\"provisioningState\":\"Moving\",\"requestMessage\":\"ra\",\"status\":\"Approved\"},\"id\":\"koowtl\",\"name\":\"nguxawqaldsy\",\"type\":\"uximerqfobw\"},{\"properties\":{\"groupId\":\"nkbykutwpfhp\",\"privateLinkResourceId\":\"gmhrskdsnfdsdoak\",\"provisioningState\":\"Creating\",\"requestMessage\":\"mkkzevdlhe\",\"status\":\"Timeout\"},\"id\":\"sdsttwvog\",\"name\":\"bbejdcngqqm\",\"type\":\"akufgmjz\"},{\"properties\":{\"groupId\":\"rdgrtw\",\"privateLinkResourceId\":\"enuuzkopbm\",\"provisioningState\":\"Succeeded\",\"requestMessage\":\"dwoyuhhziuiefoz\",\"status\":\"Timeout\"},\"id\":\"msmlmzq\",\"name\":\"oftrmaequia\",\"type\":\"xicslfao\"}],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"ylhalnswhcc\",\"features\":[{\"flag\":\"EnableConnectivityLogs\",\"value\":\"aivwitqscywu\",\"properties\":{\"i\":\"oluhczbwemh\",\"wmsweypqwd\":\"sbrgz\",\"mkttlstvlzywem\":\"ggicccnxqhue\",\"lusiy\":\"zrncsdt\"}}],\"liveTraceConfiguration\":{\"enabled\":\"fgytguslfeadcyg\",\"categories\":[{\"name\":\"hejhzisx\",\"enabled\":\"pelol\"},{\"name\":\"vk\",\"enabled\":\"pqvujzraehtwdwrf\"},{\"name\":\"wib\",\"enabled\":\"cdl\"}]},\"resourceLogConfiguration\":{\"categories\":[{\"name\":\"wpracstwitykhev\",\"enabled\":\"cedcpnmdy\"},{\"name\":\"nwzxltjcv\",\"enabled\":\"ltiugcxnavv\"},{\"name\":\"qiby\",\"enabled\":\"nyowxwlmdjrkvfg\"}]},\"cors\":{\"allowedOrigins\":[\"p\",\"bodacizsjq\",\"hkr\"]},\"serverless\":{\"connectionTimeoutInSeconds\":1873747723},\"upstream\":{\"templates\":[{\"hubPattern\":\"ipqkghvxndzwm\",\"eventPattern\":\"efajpj\",\"categoryPattern\":\"wkqnyhg\",\"urlTemplate\":\"ij\",\"auth\":{\"type\":\"None\",\"managedIdentity\":{\"resource\":\"zs\"}}}]},\"networkACLs\":{\"defaultAction\":\"Deny\",\"publicNetwork\":{\"allow\":[\"RESTAPI\",\"RESTAPI\",\"Trace\",\"RESTAPI\"],\"deny\":[\"Trace\",\"Trace\"]},\"privateEndpoints\":[{\"name\":\"kvpbjxbkzbz\",\"allow\":[\"ClientConnection\",\"Trace\",\"Trace\"],\"deny\":[\"RESTAPI\",\"RESTAPI\",\"Trace\"]}]},\"publicNetworkAccess\":\"gkakmokzhjjklff\",\"disableLocalAuth\":false,\"disableAadAuth\":false}") .toObject(SignalRProperties.class); Assertions.assertEquals(true, model.tls().clientCertEnabled()); Assertions.assertEquals(FeatureFlags.ENABLE_CONNECTIVITY_LOGS, model.features().get(0).flag()); - Assertions.assertEquals("hmgkbrpyy", model.features().get(0).value()); - Assertions.assertEquals("bnuqqkpik", model.features().get(0).properties().get("drgvtqagn")); - Assertions.assertEquals("bavxbniwdjswzt", model.liveTraceConfiguration().enabled()); - Assertions.assertEquals("gnxytxhpzxbz", model.liveTraceConfiguration().categories().get(0).name()); - Assertions.assertEquals("zabglcuhxwt", model.liveTraceConfiguration().categories().get(0).enabled()); - Assertions.assertEquals("klbb", model.resourceLogConfiguration().categories().get(0).name()); - Assertions.assertEquals("plwzbhvgyugu", model.resourceLogConfiguration().categories().get(0).enabled()); - Assertions.assertEquals("kfssxqukkf", model.cors().allowedOrigins().get(0)); - Assertions.assertEquals(909915522, model.serverless().connectionTimeoutInSeconds()); - Assertions.assertEquals("ighxpk", model.upstream().templates().get(0).hubPattern()); - Assertions.assertEquals("zb", model.upstream().templates().get(0).eventPattern()); - Assertions.assertEquals("uebbaumnyqup", model.upstream().templates().get(0).categoryPattern()); - Assertions.assertEquals("deoj", model.upstream().templates().get(0).urlTemplate()); + Assertions.assertEquals("aivwitqscywu", model.features().get(0).value()); + Assertions.assertEquals("oluhczbwemh", model.features().get(0).properties().get("i")); + Assertions.assertEquals("fgytguslfeadcyg", model.liveTraceConfiguration().enabled()); + Assertions.assertEquals("hejhzisx", model.liveTraceConfiguration().categories().get(0).name()); + Assertions.assertEquals("pelol", model.liveTraceConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("wpracstwitykhev", model.resourceLogConfiguration().categories().get(0).name()); + Assertions.assertEquals("cedcpnmdy", model.resourceLogConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("p", model.cors().allowedOrigins().get(0)); + Assertions.assertEquals(1873747723, model.serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("ipqkghvxndzwm", model.upstream().templates().get(0).hubPattern()); + Assertions.assertEquals("efajpj", model.upstream().templates().get(0).eventPattern()); + Assertions.assertEquals("wkqnyhg", model.upstream().templates().get(0).categoryPattern()); + Assertions.assertEquals("ij", model.upstream().templates().get(0).urlTemplate()); + Assertions.assertEquals(UpstreamAuthType.NONE, model.upstream().templates().get(0).auth().type()); + Assertions.assertEquals("zs", model.upstream().templates().get(0).auth().managedIdentity().resource()); Assertions.assertEquals(AclAction.DENY, model.networkACLs().defaultAction()); + Assertions.assertEquals(SignalRRequestType.RESTAPI, model.networkACLs().publicNetwork().allow().get(0)); + Assertions.assertEquals(SignalRRequestType.TRACE, model.networkACLs().publicNetwork().deny().get(0)); Assertions - .assertEquals(SignalRRequestType.CLIENT_CONNECTION, model.networkACLs().publicNetwork().allow().get(0)); - Assertions.assertEquals(SignalRRequestType.RESTAPI, model.networkACLs().publicNetwork().deny().get(0)); - Assertions.assertEquals("fhvpesaps", model.networkACLs().privateEndpoints().get(0).name()); - Assertions.assertEquals("ceoveilovno", model.publicNetworkAccess()); + .assertEquals( + SignalRRequestType.CLIENT_CONNECTION, model.networkACLs().privateEndpoints().get(0).allow().get(0)); + Assertions + .assertEquals(SignalRRequestType.RESTAPI, model.networkACLs().privateEndpoints().get(0).deny().get(0)); + Assertions.assertEquals("kvpbjxbkzbz", model.networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("gkakmokzhjjklff", model.publicNetworkAccess()); Assertions.assertEquals(false, model.disableLocalAuth()); Assertions.assertEquals(false, model.disableAadAuth()); } @@ -70,44 +79,51 @@ public void testSerialize() throws Exception { .asList( new SignalRFeature() .withFlag(FeatureFlags.ENABLE_CONNECTIVITY_LOGS) - .withValue("hmgkbrpyy") - .withProperties( - mapOf("drgvtqagn", "bnuqqkpik", "mebf", "uynhijg", "zmhjrunmp", "iarbutrcvpna")), - new SignalRFeature() - .withFlag(FeatureFlags.ENABLE_MESSAGING_LOGS) - .withValue("tdbhrbnla") - .withProperties(mapOf("ny", "myskpbhenbtkcxy", "nlqidybyxczf", "nrs")), - new SignalRFeature() - .withFlag(FeatureFlags.ENABLE_MESSAGING_LOGS) - .withValue("haaxdbabphl") + .withValue("aivwitqscywu") .withProperties( - mapOf("cocmnyyaztt", "lfktsths", "edckzywbiexzfey", "twwrqp", "ujwb", "eaxib")), - new SignalRFeature() - .withFlag(FeatureFlags.ENABLE_LIVE_TRACE) - .withValue("walm") - .withProperties(mapOf("zjancuxr", "oxaepd")))) + mapOf( + "i", + "oluhczbwemh", + "wmsweypqwd", + "sbrgz", + "mkttlstvlzywem", + "ggicccnxqhue", + "lusiy", + "zrncsdt")))) .withLiveTraceConfiguration( new LiveTraceConfiguration() - .withEnabled("bavxbniwdjswzt") + .withEnabled("fgytguslfeadcyg") .withCategories( - Arrays.asList(new LiveTraceCategory().withName("gnxytxhpzxbz").withEnabled("zabglcuhxwt")))) + Arrays + .asList( + new LiveTraceCategory().withName("hejhzisx").withEnabled("pelol"), + new LiveTraceCategory().withName("vk").withEnabled("pqvujzraehtwdwrf"), + new LiveTraceCategory().withName("wib").withEnabled("cdl")))) .withResourceLogConfiguration( new ResourceLogConfiguration() .withCategories( - Arrays.asList(new ResourceLogCategory().withName("klbb").withEnabled("plwzbhvgyugu")))) - .withCors( - new SignalRCorsSettings().withAllowedOrigins(Arrays.asList("kfssxqukkf", "l", "mg", "xnkjzkdesl"))) - .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(909915522)) + Arrays + .asList( + new ResourceLogCategory().withName("wpracstwitykhev").withEnabled("cedcpnmdy"), + new ResourceLogCategory().withName("nwzxltjcv").withEnabled("ltiugcxnavv"), + new ResourceLogCategory().withName("qiby").withEnabled("nyowxwlmdjrkvfg")))) + .withCors(new SignalRCorsSettings().withAllowedOrigins(Arrays.asList("p", "bodacizsjq", "hkr"))) + .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(1873747723)) .withUpstream( new ServerlessUpstreamSettings() .withTemplates( Arrays .asList( new UpstreamTemplate() - .withHubPattern("ighxpk") - .withEventPattern("zb") - .withCategoryPattern("uebbaumnyqup") - .withUrlTemplate("deoj")))) + .withHubPattern("ipqkghvxndzwm") + .withEventPattern("efajpj") + .withCategoryPattern("wkqnyhg") + .withUrlTemplate("ij") + .withAuth( + new UpstreamAuthSettings() + .withType(UpstreamAuthType.NONE) + .withManagedIdentity( + new ManagedIdentitySettings().withResource("zs")))))) .withNetworkACLs( new SignalRNetworkACLs() .withDefaultAction(AclAction.DENY) @@ -116,58 +132,64 @@ public void testSerialize() throws Exception { .withAllow( Arrays .asList( - SignalRRequestType.CLIENT_CONNECTION, + SignalRRequestType.RESTAPI, + SignalRRequestType.RESTAPI, SignalRRequestType.TRACE, SignalRRequestType.RESTAPI)) - .withDeny(Arrays.asList(SignalRRequestType.RESTAPI))) + .withDeny(Arrays.asList(SignalRRequestType.TRACE, SignalRRequestType.TRACE))) .withPrivateEndpoints( Arrays .asList( new PrivateEndpointAcl() - .withAllow(Arrays.asList()) - .withDeny(Arrays.asList()) - .withName("fhvpesaps"), - new PrivateEndpointAcl() - .withAllow(Arrays.asList()) - .withDeny(Arrays.asList()) - .withName("qmhjjdhtld"), - new PrivateEndpointAcl() - .withAllow(Arrays.asList()) - .withDeny(Arrays.asList()) - .withName("zxuutkncwscwsvl"), - new PrivateEndpointAcl() - .withAllow(Arrays.asList()) - .withDeny(Arrays.asList()) - .withName("ogtwrupqsxvnmi")))) - .withPublicNetworkAccess("ceoveilovno") + .withAllow( + Arrays + .asList( + SignalRRequestType.CLIENT_CONNECTION, + SignalRRequestType.TRACE, + SignalRRequestType.TRACE)) + .withDeny( + Arrays + .asList( + SignalRRequestType.RESTAPI, + SignalRRequestType.RESTAPI, + SignalRRequestType.TRACE)) + .withName("kvpbjxbkzbz")))) + .withPublicNetworkAccess("gkakmokzhjjklff") .withDisableLocalAuth(false) .withDisableAadAuth(false); model = BinaryData.fromObject(model).toObject(SignalRProperties.class); Assertions.assertEquals(true, model.tls().clientCertEnabled()); Assertions.assertEquals(FeatureFlags.ENABLE_CONNECTIVITY_LOGS, model.features().get(0).flag()); - Assertions.assertEquals("hmgkbrpyy", model.features().get(0).value()); - Assertions.assertEquals("bnuqqkpik", model.features().get(0).properties().get("drgvtqagn")); - Assertions.assertEquals("bavxbniwdjswzt", model.liveTraceConfiguration().enabled()); - Assertions.assertEquals("gnxytxhpzxbz", model.liveTraceConfiguration().categories().get(0).name()); - Assertions.assertEquals("zabglcuhxwt", model.liveTraceConfiguration().categories().get(0).enabled()); - Assertions.assertEquals("klbb", model.resourceLogConfiguration().categories().get(0).name()); - Assertions.assertEquals("plwzbhvgyugu", model.resourceLogConfiguration().categories().get(0).enabled()); - Assertions.assertEquals("kfssxqukkf", model.cors().allowedOrigins().get(0)); - Assertions.assertEquals(909915522, model.serverless().connectionTimeoutInSeconds()); - Assertions.assertEquals("ighxpk", model.upstream().templates().get(0).hubPattern()); - Assertions.assertEquals("zb", model.upstream().templates().get(0).eventPattern()); - Assertions.assertEquals("uebbaumnyqup", model.upstream().templates().get(0).categoryPattern()); - Assertions.assertEquals("deoj", model.upstream().templates().get(0).urlTemplate()); + Assertions.assertEquals("aivwitqscywu", model.features().get(0).value()); + Assertions.assertEquals("oluhczbwemh", model.features().get(0).properties().get("i")); + Assertions.assertEquals("fgytguslfeadcyg", model.liveTraceConfiguration().enabled()); + Assertions.assertEquals("hejhzisx", model.liveTraceConfiguration().categories().get(0).name()); + Assertions.assertEquals("pelol", model.liveTraceConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("wpracstwitykhev", model.resourceLogConfiguration().categories().get(0).name()); + Assertions.assertEquals("cedcpnmdy", model.resourceLogConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("p", model.cors().allowedOrigins().get(0)); + Assertions.assertEquals(1873747723, model.serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("ipqkghvxndzwm", model.upstream().templates().get(0).hubPattern()); + Assertions.assertEquals("efajpj", model.upstream().templates().get(0).eventPattern()); + Assertions.assertEquals("wkqnyhg", model.upstream().templates().get(0).categoryPattern()); + Assertions.assertEquals("ij", model.upstream().templates().get(0).urlTemplate()); + Assertions.assertEquals(UpstreamAuthType.NONE, model.upstream().templates().get(0).auth().type()); + Assertions.assertEquals("zs", model.upstream().templates().get(0).auth().managedIdentity().resource()); Assertions.assertEquals(AclAction.DENY, model.networkACLs().defaultAction()); + Assertions.assertEquals(SignalRRequestType.RESTAPI, model.networkACLs().publicNetwork().allow().get(0)); + Assertions.assertEquals(SignalRRequestType.TRACE, model.networkACLs().publicNetwork().deny().get(0)); + Assertions + .assertEquals( + SignalRRequestType.CLIENT_CONNECTION, model.networkACLs().privateEndpoints().get(0).allow().get(0)); Assertions - .assertEquals(SignalRRequestType.CLIENT_CONNECTION, model.networkACLs().publicNetwork().allow().get(0)); - Assertions.assertEquals(SignalRRequestType.RESTAPI, model.networkACLs().publicNetwork().deny().get(0)); - Assertions.assertEquals("fhvpesaps", model.networkACLs().privateEndpoints().get(0).name()); - Assertions.assertEquals("ceoveilovno", model.publicNetworkAccess()); + .assertEquals(SignalRRequestType.RESTAPI, model.networkACLs().privateEndpoints().get(0).deny().get(0)); + Assertions.assertEquals("kvpbjxbkzbz", model.networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("gkakmokzhjjklff", model.publicNetworkAccess()); Assertions.assertEquals(false, model.disableLocalAuth()); Assertions.assertEquals(false, model.disableAadAuth()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasCreateOrUpdateMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..8a1f0583a2fc --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasCreateOrUpdateMockTests.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.signalr.SignalRManager; +import com.azure.resourcemanager.signalr.models.Replica; +import com.azure.resourcemanager.signalr.models.ResourceSku; +import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class SignalRReplicasCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"sku\":{\"name\":\"ejyfdvlvhbwrnfx\",\"tier\":\"Basic\",\"size\":\"pqthehnmnaoya\",\"family\":\"coeqswankltytm\",\"capacity\":1217879659},\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"hdrlktg\",\"tags\":{\"eeczgfbu\":\"gguxhemlwyw\",\"ycsxzu\":\"klelssxb\"},\"id\":\"ksrl\",\"name\":\"mdesqp\",\"type\":\"pvmjcdoewbid\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SignalRManager manager = + SignalRManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Replica response = + manager + .signalRReplicas() + .define("crse") + .withRegion("omkxf") + .withExistingSignalR("hcecybmrqbr", "bbmpxdlvykfre") + .withTags(mapOf("pwpgddei", "bhdyir", "muikjcjcaztbws", "awzovgkk")) + .withSku(new ResourceSku().withName("jksghudg").withTier(SignalRSkuTier.FREE).withCapacity(1760793907)) + .create(); + + Assertions.assertEquals("hdrlktg", response.location()); + Assertions.assertEquals("gguxhemlwyw", response.tags().get("eeczgfbu")); + Assertions.assertEquals("ejyfdvlvhbwrnfx", response.sku().name()); + Assertions.assertEquals(SignalRSkuTier.BASIC, response.sku().tier()); + Assertions.assertEquals(1217879659, response.sku().capacity()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasDeleteWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..e6e4587ebbcf --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasDeleteWithResponseMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.signalr.SignalRManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class SignalRReplicasDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SignalRManager manager = + SignalRManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .signalRReplicas() + .deleteWithResponse("josovyrrl", "a", "sinuqtljqobbpih", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasGetWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasGetWithResponseMockTests.java new file mode 100644 index 000000000000..b4ae51d099ef --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasGetWithResponseMockTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.signalr.SignalRManager; +import com.azure.resourcemanager.signalr.models.Replica; +import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class SignalRReplicasGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"sku\":{\"name\":\"lbyulidwcwvmze\",\"tier\":\"Free\",\"size\":\"fhjirwgdnqzbrfk\",\"family\":\"zhzmtksjci\",\"capacity\":966916791},\"properties\":{\"provisioningState\":\"Canceled\"},\"location\":\"dglj\",\"tags\":{\"ytswfp\":\"euachtomfl\",\"skw\":\"mdgycxn\",\"shhkvpedw\":\"qjjyslurl\"},\"id\":\"slsrhmpq\",\"name\":\"wwsko\",\"type\":\"dcbrwimuvq\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SignalRManager manager = + SignalRManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Replica response = + manager + .signalRReplicas() + .getWithResponse("n", "pxy", "afiqgeaarbgjekg", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dglj", response.location()); + Assertions.assertEquals("euachtomfl", response.tags().get("ytswfp")); + Assertions.assertEquals("lbyulidwcwvmze", response.sku().name()); + Assertions.assertEquals(SignalRSkuTier.FREE, response.sku().tier()); + Assertions.assertEquals(966916791, response.sku().capacity()); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasListMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasListMockTests.java new file mode 100644 index 000000000000..e2c9f40c62b0 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRReplicasListMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.signalr.SignalRManager; +import com.azure.resourcemanager.signalr.models.Replica; +import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class SignalRReplicasListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"sku\":{\"name\":\"ltxdwhmozu\",\"tier\":\"Standard\",\"size\":\"ln\",\"family\":\"nj\",\"capacity\":1586632226},\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"pymwamxqzragp\",\"tags\":{\"vl\":\"htvdula\",\"rupdwvnphcnzq\":\"jchcsrlzknmzla\"},\"id\":\"pjhmqrhvthl\",\"name\":\"iwdcxsmlzzhzd\",\"type\":\"xetlgydlhqv\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SignalRManager manager = + SignalRManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.signalRReplicas().list("lhguyn", "chl", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("pymwamxqzragp", response.iterator().next().location()); + Assertions.assertEquals("htvdula", response.iterator().next().tags().get("vl")); + Assertions.assertEquals("ltxdwhmozu", response.iterator().next().sku().name()); + Assertions.assertEquals(SignalRSkuTier.STANDARD, response.iterator().next().sku().tier()); + Assertions.assertEquals(1586632226, response.iterator().next().sku().capacity()); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRResourceInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRResourceInnerTests.java index 03ea8c193239..e21c7f18deea 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRResourceInnerTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRResourceInnerTests.java @@ -8,9 +8,14 @@ import com.azure.resourcemanager.signalr.fluent.models.SignalRResourceInner; import com.azure.resourcemanager.signalr.models.AclAction; import com.azure.resourcemanager.signalr.models.FeatureFlags; +import com.azure.resourcemanager.signalr.models.LiveTraceCategory; import com.azure.resourcemanager.signalr.models.LiveTraceConfiguration; import com.azure.resourcemanager.signalr.models.ManagedIdentity; +import com.azure.resourcemanager.signalr.models.ManagedIdentitySettings; import com.azure.resourcemanager.signalr.models.ManagedIdentityType; +import com.azure.resourcemanager.signalr.models.NetworkAcl; +import com.azure.resourcemanager.signalr.models.PrivateEndpointAcl; +import com.azure.resourcemanager.signalr.models.ResourceLogCategory; import com.azure.resourcemanager.signalr.models.ResourceLogConfiguration; import com.azure.resourcemanager.signalr.models.ResourceSku; import com.azure.resourcemanager.signalr.models.ServerlessSettings; @@ -19,8 +24,12 @@ import com.azure.resourcemanager.signalr.models.SignalRCorsSettings; import com.azure.resourcemanager.signalr.models.SignalRFeature; import com.azure.resourcemanager.signalr.models.SignalRNetworkACLs; +import com.azure.resourcemanager.signalr.models.SignalRRequestType; import com.azure.resourcemanager.signalr.models.SignalRSkuTier; import com.azure.resourcemanager.signalr.models.SignalRTlsSettings; +import com.azure.resourcemanager.signalr.models.UpstreamAuthSettings; +import com.azure.resourcemanager.signalr.models.UpstreamAuthType; +import com.azure.resourcemanager.signalr.models.UpstreamTemplate; import com.azure.resourcemanager.signalr.models.UserAssignedIdentityProperty; import java.util.Arrays; import java.util.HashMap; @@ -33,24 +42,42 @@ public void testDeserialize() throws Exception { SignalRResourceInner model = BinaryData .fromString( - "{\"sku\":{\"name\":\"e\",\"tier\":\"Standard\",\"size\":\"v\",\"family\":\"dgwdslfhot\",\"capacity\":470013493},\"properties\":{\"provisioningState\":\"Succeeded\",\"externalIP\":\"lbjnpgacftadehx\",\"hostName\":\"tyfsoppusuesn\",\"publicPort\":1828932864,\"serverPort\":317621756,\"version\":\"avo\",\"privateEndpointConnections\":[{\"id\":\"ohctbqvudwx\",\"name\":\"ndnvo\",\"type\":\"gujjugwdkcglh\"},{\"id\":\"zj\",\"name\":\"yggdtjixh\",\"type\":\"kuofqweykhme\"},{\"id\":\"fyexfwhy\",\"name\":\"cibvyvdcsitynn\",\"type\":\"amdecte\"}],\"sharedPrivateLinkResources\":[{\"id\":\"cj\",\"name\":\"ypvhezrkg\",\"type\":\"hcjrefovgmk\"},{\"id\":\"eyyvxyqjpkcat\",\"name\":\"pngjcrcczsqpjhvm\",\"type\":\"ajvnysounqe\"},{\"id\":\"oaeupfhyhltrpmo\",\"name\":\"jmcmatuokthfu\",\"type\":\"uaodsfcpk\"}],\"tls\":{\"clientCertEnabled\":false},\"hostNamePrefix\":\"uozmyzydagfua\",\"features\":[{\"flag\":\"EnableConnectivityLogs\",\"value\":\"yiuokktwh\",\"properties\":{}},{\"flag\":\"ServiceMode\",\"value\":\"wz\",\"properties\":{}},{\"flag\":\"ServiceMode\",\"value\":\"sm\",\"properties\":{}},{\"flag\":\"EnableLiveTrace\",\"value\":\"reximoryocfs\",\"properties\":{}}],\"liveTraceConfiguration\":{\"enabled\":\"mddystkiiux\",\"categories\":[]},\"resourceLogConfiguration\":{\"categories\":[]},\"cors\":{\"allowedOrigins\":[\"qn\"]},\"serverless\":{\"connectionTimeoutInSeconds\":1747091504},\"upstream\":{\"templates\":[]},\"networkACLs\":{\"defaultAction\":\"Allow\",\"privateEndpoints\":[]},\"publicNetworkAccess\":\"vjsllrmvvdfw\",\"disableLocalAuth\":true,\"disableAadAuth\":false},\"kind\":\"RawWebSockets\",\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"lhzdobp\":{\"principalId\":\"zwtruwiqzbqjvsov\",\"clientId\":\"okacspk\"}},\"principalId\":\"mflbv\",\"tenantId\":\"chrkcciwwzjuqk\"},\"location\":\"sa\",\"tags\":{\"foskghsauuimj\":\"ku\",\"rfbyaosvexcso\":\"vxieduugidyj\",\"vleggzfbuhfmvfax\":\"pclhocohslk\",\"hl\":\"ffeii\"},\"id\":\"m\",\"name\":\"zy\",\"type\":\"shxmzsbbzoggigrx\"}") + "{\"sku\":{\"name\":\"o\",\"tier\":\"Free\",\"size\":\"m\",\"family\":\"yiba\",\"capacity\":2064087160},\"properties\":{\"provisioningState\":\"Moving\",\"externalIP\":\"dtmhrkwofyyvoqa\",\"hostName\":\"iexpbtgiwbwo\",\"publicPort\":1119495390,\"serverPort\":1338594793,\"version\":\"rtdtkcnqxw\",\"privateEndpointConnections\":[{\"properties\":{\"provisioningState\":\"Unknown\",\"privateEndpoint\":{\"id\":\"ujw\"},\"groupIds\":[\"ipqiiobyuqerpq\",\"pqwcciuqgbdbutau\"],\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"uwhhmhykojoxafn\",\"actionsRequired\":\"lpichk\"}},\"id\":\"mkcdyhbpkkpwdre\",\"name\":\"novvqfovljxy\",\"type\":\"suwsyrsnds\"},{\"properties\":{\"provisioningState\":\"Creating\",\"privateEndpoint\":{\"id\":\"vraeaeneq\"},\"groupIds\":[\"rrwlquuijfqkace\",\"iipfpubj\"],\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"f\",\"actionsRequired\":\"hqkvpuvksgplsak\"}},\"id\":\"n\",\"name\":\"synljphuopxodl\",\"type\":\"iyntorzihle\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"privateEndpoint\":{\"id\":\"rmslyzrpzbchckqq\"},\"groupIds\":[\"ox\",\"ysuiizynkedya\",\"rwyhqmibzyhwitsm\"],\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"pcdpumnz\",\"actionsRequired\":\"wznm\"}},\"id\":\"iknsorgjh\",\"name\":\"bldtlww\",\"type\":\"lkdmtncvokotllxd\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"y\",\"privateLinkResourceId\":\"cogjltdtbn\",\"provisioningState\":\"Failed\",\"requestMessage\":\"oocrkvcikhnv\",\"status\":\"Approved\"},\"id\":\"qgxqquezikyw\",\"name\":\"gxk\",\"type\":\"lla\"},{\"properties\":{\"groupId\":\"elwuipi\",\"privateLinkResourceId\":\"cjzkzivgvvcna\",\"provisioningState\":\"Updating\",\"requestMessage\":\"rnxxmueed\",\"status\":\"Approved\"},\"id\":\"dvstkw\",\"name\":\"qtc\",\"type\":\"ealmfmtdaaygdvwv\"}],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"g\",\"features\":[{\"flag\":\"EnableConnectivityLogs\",\"value\":\"fudxepxgyqagvrv\",\"properties\":{\"kghimdblxgwimfnj\":\"k\",\"kfoqreyfkzikfj\":\"fjxwmsz\"}},{\"flag\":\"EnableConnectivityLogs\",\"value\":\"n\",\"properties\":{\"elpcirelsfeaenwa\":\"vxwc\"}},{\"flag\":\"EnableConnectivityLogs\",\"value\":\"atklddxbjhwuaa\",\"properties\":{\"hyoulpjr\":\"jos\",\"vimjwos\":\"xagl\"}}],\"liveTraceConfiguration\":{\"enabled\":\"itc\",\"categories\":[{\"name\":\"k\",\"enabled\":\"umiekkezzi\"},{\"name\":\"ly\",\"enabled\":\"hdgqggeb\"},{\"name\":\"nyga\",\"enabled\":\"idb\"}]},\"resourceLogConfiguration\":{\"categories\":[{\"name\":\"xllrxcyjm\",\"enabled\":\"dsuvarmywdmjsjqb\"}]},\"cors\":{\"allowedOrigins\":[\"x\",\"rw\",\"yc\"]},\"serverless\":{\"connectionTimeoutInSeconds\":381030924},\"upstream\":{\"templates\":[{\"hubPattern\":\"gymare\",\"eventPattern\":\"ajxq\",\"categoryPattern\":\"jhkycub\",\"urlTemplate\":\"ddg\",\"auth\":{\"type\":\"ManagedIdentity\",\"managedIdentity\":{}}},{\"hubPattern\":\"mzqa\",\"eventPattern\":\"rmnjijpx\",\"categoryPattern\":\"q\",\"urlTemplate\":\"udfnbyxba\",\"auth\":{\"type\":\"ManagedIdentity\",\"managedIdentity\":{}}},{\"hubPattern\":\"ayffim\",\"eventPattern\":\"rtuzqogs\",\"categoryPattern\":\"nevfdnw\",\"urlTemplate\":\"wmewzsyy\",\"auth\":{\"type\":\"ManagedIdentity\",\"managedIdentity\":{}}},{\"hubPattern\":\"i\",\"eventPattern\":\"ud\",\"categoryPattern\":\"rx\",\"urlTemplate\":\"rthzvaytdwkqbrqu\",\"auth\":{\"type\":\"ManagedIdentity\",\"managedIdentity\":{}}}]},\"networkACLs\":{\"defaultAction\":\"Deny\",\"publicNetwork\":{\"allow\":[\"Trace\",\"ServerConnection\"],\"deny\":[\"ServerConnection\",\"ServerConnection\",\"ClientConnection\"]},\"privateEndpoints\":[{\"name\":\"d\",\"allow\":[\"Trace\",\"Trace\",\"ClientConnection\"],\"deny\":[\"ServerConnection\"]},{\"name\":\"gsquyfxrxxlept\",\"allow\":[\"ClientConnection\",\"ServerConnection\"],\"deny\":[\"RESTAPI\"]},{\"name\":\"lwnwxuqlcvydyp\",\"allow\":[\"Trace\",\"ClientConnection\",\"RESTAPI\",\"ServerConnection\"],\"deny\":[\"RESTAPI\",\"Trace\"]},{\"name\":\"odko\",\"allow\":[\"Trace\"],\"deny\":[\"ServerConnection\",\"ServerConnection\",\"RESTAPI\",\"Trace\"]}]},\"publicNetworkAccess\":\"sbvdkcrodtjinfw\",\"disableLocalAuth\":false,\"disableAadAuth\":false},\"kind\":\"SignalR\",\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"pulpqblylsyxk\":{\"principalId\":\"dlfoakggkfp\",\"clientId\":\"ao\"}},\"principalId\":\"nsj\",\"tenantId\":\"vti\"},\"location\":\"xsdszuempsb\",\"tags\":{\"eyvpnqicvinvkj\":\"z\"},\"id\":\"xdxr\",\"name\":\"uukzclewyhmlw\",\"type\":\"aztz\"}") .toObject(SignalRResourceInner.class); - Assertions.assertEquals("sa", model.location()); - Assertions.assertEquals("ku", model.tags().get("foskghsauuimj")); - Assertions.assertEquals("e", model.sku().name()); - Assertions.assertEquals(SignalRSkuTier.STANDARD, model.sku().tier()); - Assertions.assertEquals(470013493, model.sku().capacity()); - Assertions.assertEquals(ServiceKind.RAW_WEB_SOCKETS, model.kind()); - Assertions.assertEquals(ManagedIdentityType.USER_ASSIGNED, model.identity().type()); - Assertions.assertEquals(false, model.tls().clientCertEnabled()); + Assertions.assertEquals("xsdszuempsb", model.location()); + Assertions.assertEquals("z", model.tags().get("eyvpnqicvinvkj")); + Assertions.assertEquals("o", model.sku().name()); + Assertions.assertEquals(SignalRSkuTier.FREE, model.sku().tier()); + Assertions.assertEquals(2064087160, model.sku().capacity()); + Assertions.assertEquals(ServiceKind.SIGNALR, model.kind()); + Assertions.assertEquals(ManagedIdentityType.NONE, model.identity().type()); + Assertions.assertEquals(true, model.tls().clientCertEnabled()); Assertions.assertEquals(FeatureFlags.ENABLE_CONNECTIVITY_LOGS, model.features().get(0).flag()); - Assertions.assertEquals("yiuokktwh", model.features().get(0).value()); - Assertions.assertEquals("mddystkiiux", model.liveTraceConfiguration().enabled()); - Assertions.assertEquals("qn", model.cors().allowedOrigins().get(0)); - Assertions.assertEquals(1747091504, model.serverless().connectionTimeoutInSeconds()); - Assertions.assertEquals(AclAction.ALLOW, model.networkACLs().defaultAction()); - Assertions.assertEquals("vjsllrmvvdfw", model.publicNetworkAccess()); - Assertions.assertEquals(true, model.disableLocalAuth()); + Assertions.assertEquals("fudxepxgyqagvrv", model.features().get(0).value()); + Assertions.assertEquals("k", model.features().get(0).properties().get("kghimdblxgwimfnj")); + Assertions.assertEquals("itc", model.liveTraceConfiguration().enabled()); + Assertions.assertEquals("k", model.liveTraceConfiguration().categories().get(0).name()); + Assertions.assertEquals("umiekkezzi", model.liveTraceConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("xllrxcyjm", model.resourceLogConfiguration().categories().get(0).name()); + Assertions.assertEquals("dsuvarmywdmjsjqb", model.resourceLogConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("x", model.cors().allowedOrigins().get(0)); + Assertions.assertEquals(381030924, model.serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("gymare", model.upstream().templates().get(0).hubPattern()); + Assertions.assertEquals("ajxq", model.upstream().templates().get(0).eventPattern()); + Assertions.assertEquals("jhkycub", model.upstream().templates().get(0).categoryPattern()); + Assertions.assertEquals("ddg", model.upstream().templates().get(0).urlTemplate()); + Assertions.assertEquals(UpstreamAuthType.MANAGED_IDENTITY, model.upstream().templates().get(0).auth().type()); + Assertions.assertEquals(AclAction.DENY, model.networkACLs().defaultAction()); + Assertions.assertEquals(SignalRRequestType.TRACE, model.networkACLs().publicNetwork().allow().get(0)); + Assertions + .assertEquals(SignalRRequestType.SERVER_CONNECTION, model.networkACLs().publicNetwork().deny().get(0)); + Assertions.assertEquals(SignalRRequestType.TRACE, model.networkACLs().privateEndpoints().get(0).allow().get(0)); + Assertions + .assertEquals( + SignalRRequestType.SERVER_CONNECTION, model.networkACLs().privateEndpoints().get(0).deny().get(0)); + Assertions.assertEquals("d", model.networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("sbvdkcrodtjinfw", model.publicNetworkAccess()); + Assertions.assertEquals(false, model.disableLocalAuth()); Assertions.assertEquals(false, model.disableAadAuth()); } @@ -58,74 +85,183 @@ public void testDeserialize() throws Exception { public void testSerialize() throws Exception { SignalRResourceInner model = new SignalRResourceInner() - .withLocation("sa") - .withTags( - mapOf( - "foskghsauuimj", - "ku", - "rfbyaosvexcso", - "vxieduugidyj", - "vleggzfbuhfmvfax", - "pclhocohslk", - "hl", - "ffeii")) - .withSku(new ResourceSku().withName("e").withTier(SignalRSkuTier.STANDARD).withCapacity(470013493)) - .withKind(ServiceKind.RAW_WEB_SOCKETS) + .withLocation("xsdszuempsb") + .withTags(mapOf("eyvpnqicvinvkj", "z")) + .withSku(new ResourceSku().withName("o").withTier(SignalRSkuTier.FREE).withCapacity(2064087160)) + .withKind(ServiceKind.SIGNALR) .withIdentity( new ManagedIdentity() - .withType(ManagedIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities(mapOf("lhzdobp", new UserAssignedIdentityProperty()))) - .withTls(new SignalRTlsSettings().withClientCertEnabled(false)) + .withType(ManagedIdentityType.NONE) + .withUserAssignedIdentities(mapOf("pulpqblylsyxk", new UserAssignedIdentityProperty()))) + .withTls(new SignalRTlsSettings().withClientCertEnabled(true)) .withFeatures( Arrays .asList( new SignalRFeature() .withFlag(FeatureFlags.ENABLE_CONNECTIVITY_LOGS) - .withValue("yiuokktwh") - .withProperties(mapOf()), + .withValue("fudxepxgyqagvrv") + .withProperties(mapOf("kghimdblxgwimfnj", "k", "kfoqreyfkzikfj", "fjxwmsz")), new SignalRFeature() - .withFlag(FeatureFlags.SERVICE_MODE) - .withValue("wz") - .withProperties(mapOf()), - new SignalRFeature() - .withFlag(FeatureFlags.SERVICE_MODE) - .withValue("sm") - .withProperties(mapOf()), + .withFlag(FeatureFlags.ENABLE_CONNECTIVITY_LOGS) + .withValue("n") + .withProperties(mapOf("elpcirelsfeaenwa", "vxwc")), new SignalRFeature() - .withFlag(FeatureFlags.ENABLE_LIVE_TRACE) - .withValue("reximoryocfs") - .withProperties(mapOf()))) + .withFlag(FeatureFlags.ENABLE_CONNECTIVITY_LOGS) + .withValue("atklddxbjhwuaa") + .withProperties(mapOf("hyoulpjr", "jos", "vimjwos", "xagl")))) .withLiveTraceConfiguration( - new LiveTraceConfiguration().withEnabled("mddystkiiux").withCategories(Arrays.asList())) - .withResourceLogConfiguration(new ResourceLogConfiguration().withCategories(Arrays.asList())) - .withCors(new SignalRCorsSettings().withAllowedOrigins(Arrays.asList("qn"))) - .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(1747091504)) - .withUpstream(new ServerlessUpstreamSettings().withTemplates(Arrays.asList())) + new LiveTraceConfiguration() + .withEnabled("itc") + .withCategories( + Arrays + .asList( + new LiveTraceCategory().withName("k").withEnabled("umiekkezzi"), + new LiveTraceCategory().withName("ly").withEnabled("hdgqggeb"), + new LiveTraceCategory().withName("nyga").withEnabled("idb")))) + .withResourceLogConfiguration( + new ResourceLogConfiguration() + .withCategories( + Arrays + .asList( + new ResourceLogCategory().withName("xllrxcyjm").withEnabled("dsuvarmywdmjsjqb")))) + .withCors(new SignalRCorsSettings().withAllowedOrigins(Arrays.asList("x", "rw", "yc"))) + .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(381030924)) + .withUpstream( + new ServerlessUpstreamSettings() + .withTemplates( + Arrays + .asList( + new UpstreamTemplate() + .withHubPattern("gymare") + .withEventPattern("ajxq") + .withCategoryPattern("jhkycub") + .withUrlTemplate("ddg") + .withAuth( + new UpstreamAuthSettings() + .withType(UpstreamAuthType.MANAGED_IDENTITY) + .withManagedIdentity(new ManagedIdentitySettings())), + new UpstreamTemplate() + .withHubPattern("mzqa") + .withEventPattern("rmnjijpx") + .withCategoryPattern("q") + .withUrlTemplate("udfnbyxba") + .withAuth( + new UpstreamAuthSettings() + .withType(UpstreamAuthType.MANAGED_IDENTITY) + .withManagedIdentity(new ManagedIdentitySettings())), + new UpstreamTemplate() + .withHubPattern("ayffim") + .withEventPattern("rtuzqogs") + .withCategoryPattern("nevfdnw") + .withUrlTemplate("wmewzsyy") + .withAuth( + new UpstreamAuthSettings() + .withType(UpstreamAuthType.MANAGED_IDENTITY) + .withManagedIdentity(new ManagedIdentitySettings())), + new UpstreamTemplate() + .withHubPattern("i") + .withEventPattern("ud") + .withCategoryPattern("rx") + .withUrlTemplate("rthzvaytdwkqbrqu") + .withAuth( + new UpstreamAuthSettings() + .withType(UpstreamAuthType.MANAGED_IDENTITY) + .withManagedIdentity(new ManagedIdentitySettings()))))) .withNetworkACLs( - new SignalRNetworkACLs().withDefaultAction(AclAction.ALLOW).withPrivateEndpoints(Arrays.asList())) - .withPublicNetworkAccess("vjsllrmvvdfw") - .withDisableLocalAuth(true) + new SignalRNetworkACLs() + .withDefaultAction(AclAction.DENY) + .withPublicNetwork( + new NetworkAcl() + .withAllow( + Arrays.asList(SignalRRequestType.TRACE, SignalRRequestType.SERVER_CONNECTION)) + .withDeny( + Arrays + .asList( + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.CLIENT_CONNECTION))) + .withPrivateEndpoints( + Arrays + .asList( + new PrivateEndpointAcl() + .withAllow( + Arrays + .asList( + SignalRRequestType.TRACE, + SignalRRequestType.TRACE, + SignalRRequestType.CLIENT_CONNECTION)) + .withDeny(Arrays.asList(SignalRRequestType.SERVER_CONNECTION)) + .withName("d"), + new PrivateEndpointAcl() + .withAllow( + Arrays + .asList( + SignalRRequestType.CLIENT_CONNECTION, + SignalRRequestType.SERVER_CONNECTION)) + .withDeny(Arrays.asList(SignalRRequestType.RESTAPI)) + .withName("gsquyfxrxxlept"), + new PrivateEndpointAcl() + .withAllow( + Arrays + .asList( + SignalRRequestType.TRACE, + SignalRRequestType.CLIENT_CONNECTION, + SignalRRequestType.RESTAPI, + SignalRRequestType.SERVER_CONNECTION)) + .withDeny(Arrays.asList(SignalRRequestType.RESTAPI, SignalRRequestType.TRACE)) + .withName("lwnwxuqlcvydyp"), + new PrivateEndpointAcl() + .withAllow(Arrays.asList(SignalRRequestType.TRACE)) + .withDeny( + Arrays + .asList( + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.RESTAPI, + SignalRRequestType.TRACE)) + .withName("odko")))) + .withPublicNetworkAccess("sbvdkcrodtjinfw") + .withDisableLocalAuth(false) .withDisableAadAuth(false); model = BinaryData.fromObject(model).toObject(SignalRResourceInner.class); - Assertions.assertEquals("sa", model.location()); - Assertions.assertEquals("ku", model.tags().get("foskghsauuimj")); - Assertions.assertEquals("e", model.sku().name()); - Assertions.assertEquals(SignalRSkuTier.STANDARD, model.sku().tier()); - Assertions.assertEquals(470013493, model.sku().capacity()); - Assertions.assertEquals(ServiceKind.RAW_WEB_SOCKETS, model.kind()); - Assertions.assertEquals(ManagedIdentityType.USER_ASSIGNED, model.identity().type()); - Assertions.assertEquals(false, model.tls().clientCertEnabled()); + Assertions.assertEquals("xsdszuempsb", model.location()); + Assertions.assertEquals("z", model.tags().get("eyvpnqicvinvkj")); + Assertions.assertEquals("o", model.sku().name()); + Assertions.assertEquals(SignalRSkuTier.FREE, model.sku().tier()); + Assertions.assertEquals(2064087160, model.sku().capacity()); + Assertions.assertEquals(ServiceKind.SIGNALR, model.kind()); + Assertions.assertEquals(ManagedIdentityType.NONE, model.identity().type()); + Assertions.assertEquals(true, model.tls().clientCertEnabled()); Assertions.assertEquals(FeatureFlags.ENABLE_CONNECTIVITY_LOGS, model.features().get(0).flag()); - Assertions.assertEquals("yiuokktwh", model.features().get(0).value()); - Assertions.assertEquals("mddystkiiux", model.liveTraceConfiguration().enabled()); - Assertions.assertEquals("qn", model.cors().allowedOrigins().get(0)); - Assertions.assertEquals(1747091504, model.serverless().connectionTimeoutInSeconds()); - Assertions.assertEquals(AclAction.ALLOW, model.networkACLs().defaultAction()); - Assertions.assertEquals("vjsllrmvvdfw", model.publicNetworkAccess()); - Assertions.assertEquals(true, model.disableLocalAuth()); + Assertions.assertEquals("fudxepxgyqagvrv", model.features().get(0).value()); + Assertions.assertEquals("k", model.features().get(0).properties().get("kghimdblxgwimfnj")); + Assertions.assertEquals("itc", model.liveTraceConfiguration().enabled()); + Assertions.assertEquals("k", model.liveTraceConfiguration().categories().get(0).name()); + Assertions.assertEquals("umiekkezzi", model.liveTraceConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("xllrxcyjm", model.resourceLogConfiguration().categories().get(0).name()); + Assertions.assertEquals("dsuvarmywdmjsjqb", model.resourceLogConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("x", model.cors().allowedOrigins().get(0)); + Assertions.assertEquals(381030924, model.serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("gymare", model.upstream().templates().get(0).hubPattern()); + Assertions.assertEquals("ajxq", model.upstream().templates().get(0).eventPattern()); + Assertions.assertEquals("jhkycub", model.upstream().templates().get(0).categoryPattern()); + Assertions.assertEquals("ddg", model.upstream().templates().get(0).urlTemplate()); + Assertions.assertEquals(UpstreamAuthType.MANAGED_IDENTITY, model.upstream().templates().get(0).auth().type()); + Assertions.assertEquals(AclAction.DENY, model.networkACLs().defaultAction()); + Assertions.assertEquals(SignalRRequestType.TRACE, model.networkACLs().publicNetwork().allow().get(0)); + Assertions + .assertEquals(SignalRRequestType.SERVER_CONNECTION, model.networkACLs().publicNetwork().deny().get(0)); + Assertions.assertEquals(SignalRRequestType.TRACE, model.networkACLs().privateEndpoints().get(0).allow().get(0)); + Assertions + .assertEquals( + SignalRRequestType.SERVER_CONNECTION, model.networkACLs().privateEndpoints().get(0).deny().get(0)); + Assertions.assertEquals("d", model.networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("sbvdkcrodtjinfw", model.publicNetworkAccess()); + Assertions.assertEquals(false, model.disableLocalAuth()); Assertions.assertEquals(false, model.disableAadAuth()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRResourceListTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRResourceListTests.java index 01ff79cb03a4..9d0c141fd409 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRResourceListTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRResourceListTests.java @@ -6,12 +6,29 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.signalr.fluent.models.SignalRResourceInner; +import com.azure.resourcemanager.signalr.models.AclAction; +import com.azure.resourcemanager.signalr.models.FeatureFlags; +import com.azure.resourcemanager.signalr.models.LiveTraceCategory; +import com.azure.resourcemanager.signalr.models.LiveTraceConfiguration; import com.azure.resourcemanager.signalr.models.ManagedIdentity; import com.azure.resourcemanager.signalr.models.ManagedIdentityType; +import com.azure.resourcemanager.signalr.models.NetworkAcl; +import com.azure.resourcemanager.signalr.models.PrivateEndpointAcl; +import com.azure.resourcemanager.signalr.models.ResourceLogCategory; +import com.azure.resourcemanager.signalr.models.ResourceLogConfiguration; import com.azure.resourcemanager.signalr.models.ResourceSku; +import com.azure.resourcemanager.signalr.models.ServerlessSettings; +import com.azure.resourcemanager.signalr.models.ServerlessUpstreamSettings; import com.azure.resourcemanager.signalr.models.ServiceKind; +import com.azure.resourcemanager.signalr.models.SignalRCorsSettings; +import com.azure.resourcemanager.signalr.models.SignalRFeature; +import com.azure.resourcemanager.signalr.models.SignalRNetworkACLs; +import com.azure.resourcemanager.signalr.models.SignalRRequestType; import com.azure.resourcemanager.signalr.models.SignalRResourceList; import com.azure.resourcemanager.signalr.models.SignalRSkuTier; +import com.azure.resourcemanager.signalr.models.SignalRTlsSettings; +import com.azure.resourcemanager.signalr.models.UpstreamTemplate; +import com.azure.resourcemanager.signalr.models.UserAssignedIdentityProperty; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -23,19 +40,34 @@ public void testDeserialize() throws Exception { SignalRResourceList model = BinaryData .fromString( - "{\"value\":[{\"sku\":{\"name\":\"jaoyfhrtx\",\"tier\":\"Free\",\"size\":\"rkujy\",\"family\":\"l\",\"capacity\":867367638},\"properties\":{\"provisioningState\":\"Canceled\",\"externalIP\":\"wrlyxwjkcprb\",\"hostName\":\"b\",\"publicPort\":19976049,\"serverPort\":1017472579,\"version\":\"vpys\",\"privateEndpointConnections\":[],\"sharedPrivateLinkResources\":[],\"hostNamePrefix\":\"uj\",\"features\":[],\"publicNetworkAccess\":\"f\",\"disableLocalAuth\":true,\"disableAadAuth\":true},\"kind\":\"RawWebSockets\",\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{},\"principalId\":\"wu\",\"tenantId\":\"gazxuf\"},\"location\":\"uckyf\",\"tags\":{\"zuhtymwisdkfthwx\":\"fidfvzw\",\"mijcmmxdcufufs\":\"nteiwaopv\",\"fycc\":\"pymzidnsezcxtbzs\"},\"id\":\"newmdwzjeiachbo\",\"name\":\"sflnrosfqp\",\"type\":\"eeh\"},{\"sku\":{\"name\":\"vypyqrimzinpv\",\"tier\":\"Standard\",\"size\":\"kirsoodqxhc\",\"family\":\"nohjt\",\"capacity\":683362936},\"properties\":{\"provisioningState\":\"Running\",\"externalIP\":\"ifiyipjxsqwpgrj\",\"hostName\":\"norcjxvsnbyxqab\",\"publicPort\":1299140464,\"serverPort\":1412724720,\"version\":\"ysh\",\"privateEndpointConnections\":[],\"sharedPrivateLinkResources\":[],\"hostNamePrefix\":\"bl\",\"features\":[],\"publicNetworkAccess\":\"jmkljavbqidtqajz\",\"disableLocalAuth\":false,\"disableAadAuth\":true},\"kind\":\"SignalR\",\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{},\"principalId\":\"hbzhfepg\",\"tenantId\":\"qex\"},\"location\":\"ocxscpaierhhbcs\",\"tags\":{\"bnbdxkqpxokajion\":\"mmajtjaodx\",\"jrmvdjwzrlo\":\"imexgstxgcpodgma\",\"hijco\":\"mcl\"},\"id\":\"jctbza\",\"name\":\"s\",\"type\":\"sycbkbfk\"},{\"sku\":{\"name\":\"kdkexxp\",\"tier\":\"Free\",\"size\":\"xaxcfjpgddtocjjx\",\"family\":\"pmouexhdz\",\"capacity\":738311617},\"properties\":{\"provisioningState\":\"Creating\",\"externalIP\":\"nxqbzvddn\",\"hostName\":\"ndei\",\"publicPort\":1638817627,\"serverPort\":1604770276,\"version\":\"zao\",\"privateEndpointConnections\":[],\"sharedPrivateLinkResources\":[],\"hostNamePrefix\":\"hcffcyddglmjthjq\",\"features\":[],\"publicNetworkAccess\":\"qciwqvhkhixuigdt\",\"disableLocalAuth\":false,\"disableAadAuth\":true},\"kind\":\"SignalR\",\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{},\"principalId\":\"u\",\"tenantId\":\"a\"},\"location\":\"rzayv\",\"tags\":{\"ln\":\"gvdfgiotkftutq\",\"qmi\":\"xlefgugnxkrx\"},\"id\":\"tthzrvqd\",\"name\":\"abhjybi\",\"type\":\"ehoqfbowskan\"},{\"sku\":{\"name\":\"tzlcuiywgqywgn\",\"tier\":\"Standard\",\"size\":\"nhzgpphrcgyn\",\"family\":\"cpecfvmmcoofs\",\"capacity\":1165207027},\"properties\":{\"provisioningState\":\"Moving\",\"externalIP\":\"m\",\"hostName\":\"qabcypm\",\"publicPort\":1275704162,\"serverPort\":699585009,\"version\":\"uvcc\",\"privateEndpointConnections\":[],\"sharedPrivateLinkResources\":[],\"hostNamePrefix\":\"bacfionlebxetq\",\"features\":[],\"publicNetworkAccess\":\"qqwx\",\"disableLocalAuth\":true,\"disableAadAuth\":false},\"kind\":\"RawWebSockets\",\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{},\"principalId\":\"isnjampmngnz\",\"tenantId\":\"xaqwoochcbonqv\"},\"location\":\"vlrxnjeaseiph\",\"tags\":{\"enjbdlwtgrhp\":\"lokeyy\"},\"id\":\"jp\",\"name\":\"umasxazjpq\",\"type\":\"e\"}],\"nextLink\":\"alhbx\"}") + "{\"value\":[{\"sku\":{\"name\":\"tpngjcrcczsqpjh\",\"tier\":\"Free\",\"size\":\"jvnysounqe\",\"family\":\"noae\",\"capacity\":1901274446},\"properties\":{\"provisioningState\":\"Deleting\",\"externalIP\":\"trpmo\",\"hostName\":\"mcmatuokthfuiu\",\"publicPort\":1445775245,\"serverPort\":680550088,\"version\":\"pk\",\"privateEndpointConnections\":[{\"properties\":{},\"id\":\"uozmyzydagfua\",\"name\":\"bezy\",\"type\":\"uokktwhrdxwz\"},{\"properties\":{},\"id\":\"sm\",\"name\":\"surex\",\"type\":\"moryocfsfksym\"},{\"properties\":{},\"id\":\"stkiiuxhqyud\",\"name\":\"o\",\"type\":\"rq\"},{\"properties\":{},\"id\":\"oczvy\",\"name\":\"fqrvkdvjsllrmvvd\",\"type\":\"watkpnpulexxb\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"ruwiqzbqjvsov\",\"privateLinkResourceId\":\"yokacspkw\"},\"id\":\"hzdobpxjmflbvvnc\",\"name\":\"rkcciwwzjuqk\",\"type\":\"rsa\"},{\"properties\":{\"groupId\":\"wkuofoskghsauu\",\"privateLinkResourceId\":\"mjmvxieduugidyjr\"},\"id\":\"f\",\"name\":\"y\",\"type\":\"osvexcsonpclhoc\"},{\"properties\":{\"groupId\":\"slkevle\",\"privateLinkResourceId\":\"gz\"},\"id\":\"buhfmvfaxkffeiit\",\"name\":\"lvmezyvshxmzsbbz\",\"type\":\"ggi\"},{\"properties\":{\"groupId\":\"xwburvjxxjns\",\"privateLinkResourceId\":\"ydptkoen\"},\"id\":\"ou\",\"name\":\"nvudwtiukb\",\"type\":\"dng\"}],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"pazyxoegukg\",\"features\":[{\"flag\":\"EnableMessagingLogs\",\"value\":\"ucgygevqz\",\"properties\":{\"p\":\"pmr\"}}],\"liveTraceConfiguration\":{\"enabled\":\"drqjsdpy\",\"categories\":[{},{}]},\"resourceLogConfiguration\":{\"categories\":[{},{},{}]},\"cors\":{\"allowedOrigins\":[\"ejzicwifsjtt\",\"zfbishcbkhaj\"]},\"serverless\":{\"connectionTimeoutInSeconds\":1232407744},\"upstream\":{\"templates\":[{\"urlTemplate\":\"p\"},{\"urlTemplate\":\"agalpbuxwgipwhon\"},{\"urlTemplate\":\"wkgshwa\"},{\"urlTemplate\":\"kix\"}]},\"networkACLs\":{\"defaultAction\":\"Deny\",\"publicNetwork\":{\"allow\":[\"Trace\"],\"deny\":[\"ClientConnection\",\"ClientConnection\"]},\"privateEndpoints\":[{\"name\":\"nuzo\"},{\"name\":\"ftiyqzrnkcq\"},{\"name\":\"yx\"},{\"name\":\"whzlsicohoq\"}]},\"publicNetworkAccess\":\"wvl\",\"disableLocalAuth\":true,\"disableAadAuth\":false},\"kind\":\"SignalR\",\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"zf\":{\"principalId\":\"hgyxzkonoc\",\"clientId\":\"oklyaxuconuq\"},\"senhwlrs\":{\"principalId\":\"eyp\",\"clientId\":\"rmjmwvvjektc\"},\"vf\":{\"principalId\":\"rzpwvlqdqgbiq\",\"clientId\":\"ihkaetcktvfc\"},\"wutttxfvjrbi\":{\"principalId\":\"kymuctqhjfbebr\",\"clientId\":\"xerf\"}},\"principalId\":\"hxepcyvahfnlj\",\"tenantId\":\"qxj\"},\"location\":\"ujqgidok\",\"tags\":{\"gsncghkjeszz\":\"jyoxgvclt\",\"mxnehmp\":\"bijhtxfvgxbf\",\"godebfqkkrbmpu\":\"ec\"},\"id\":\"gr\",\"name\":\"wflzlfbxzpuzy\",\"type\":\"ispnqzahmgkbrp\"},{\"sku\":{\"name\":\"dhibnuq\",\"tier\":\"Basic\",\"size\":\"kadrgvt\",\"family\":\"gnbuy\",\"capacity\":850338934},\"properties\":{\"provisioningState\":\"Succeeded\",\"externalIP\":\"ebf\",\"hostName\":\"arbu\",\"publicPort\":2136509867,\"serverPort\":1477198207,\"version\":\"azzmhjrunmpxt\",\"privateEndpointConnections\":[{\"properties\":{},\"id\":\"bnlankxmyskpb\",\"name\":\"enbtkcxywny\",\"type\":\"nrs\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"idybyxczf\",\"privateLinkResourceId\":\"lhaaxdbabp\"},\"id\":\"lwrq\",\"name\":\"fkts\",\"type\":\"hsucoc\"},{\"properties\":{\"groupId\":\"yyazttbt\",\"privateLinkResourceId\":\"wrqpue\"},\"id\":\"ckzywbiexzfeyue\",\"name\":\"xibxujwbhqwalm\",\"type\":\"zyoxaepdkzjan\"}],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"d\",\"features\":[{\"flag\":\"ServiceMode\",\"value\":\"xbniwdjs\",\"properties\":{\"bpg\":\"s\",\"fzab\":\"xytxhpzxbz\"}},{\"flag\":\"EnableLiveTrace\",\"value\":\"cuh\",\"properties\":{\"bbovplwzbhvgyugu\":\"ctyqik\"}},{\"flag\":\"EnableMessagingLogs\",\"value\":\"vmkfssxqu\",\"properties\":{\"zkd\":\"plgmgsxnk\"}},{\"flag\":\"EnableConnectivityLogs\",\"value\":\"lpvlopw\",\"properties\":{\"baiuebbaumny\":\"ghxpkdw\",\"txp\":\"upedeojnabckhs\"}}],\"liveTraceConfiguration\":{\"enabled\":\"btfhvpesaps\",\"categories\":[{}]},\"resourceLogConfiguration\":{\"categories\":[{},{},{},{}]},\"cors\":{\"allowedOrigins\":[\"htldwk\",\"zxuutkncwscwsvl\",\"otogtwrupqs\"]},\"serverless\":{\"connectionTimeoutInSeconds\":1364621442},\"upstream\":{\"templates\":[{\"urlTemplate\":\"kvceoveilovnotyf\"},{\"urlTemplate\":\"fcnj\"},{\"urlTemplate\":\"k\"}]},\"networkACLs\":{\"defaultAction\":\"Allow\",\"publicNetwork\":{\"allow\":[\"Trace\",\"RESTAPI\",\"ServerConnection\",\"ClientConnection\"],\"deny\":[\"Trace\"]},\"privateEndpoints\":[{\"name\":\"jtoqne\"},{\"name\":\"mclfplphoxuscr\"},{\"name\":\"abgy\"},{\"name\":\"psbjta\"}]},\"publicNetworkAccess\":\"ugxywpmueef\",\"disableLocalAuth\":false,\"disableAadAuth\":true},\"kind\":\"SignalR\",\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"tcc\":{\"principalId\":\"yonobgl\",\"clientId\":\"cq\"},\"hl\":{\"principalId\":\"yudxytlmoy\",\"clientId\":\"vwfudwpzntxhd\"},\"ca\":{\"principalId\":\"jbhckfrlhr\",\"clientId\":\"bkyvp\"},\"kuwbcrnwb\":{\"principalId\":\"z\",\"clientId\":\"zka\"}},\"principalId\":\"hhseyv\",\"tenantId\":\"srtslhspkdeem\"},\"location\":\"fm\",\"tags\":{\"melmqkrha\":\"kv\",\"aquhcdhm\":\"vljua\",\"rcrgvx\":\"ualaexqpvfadmw\",\"fmisg\":\"vgomz\"},\"id\":\"bnbbeldawkz\",\"name\":\"ali\",\"type\":\"urqhaka\"},{\"sku\":{\"name\":\"ashsfwxos\",\"tier\":\"Free\",\"size\":\"cugicjoox\",\"family\":\"ebwpucwwfvo\",\"capacity\":1748456219},\"properties\":{\"provisioningState\":\"Canceled\",\"externalIP\":\"civyhzceuo\",\"hostName\":\"jrwjueiotwm\",\"publicPort\":1848522994,\"serverPort\":1561651714,\"version\":\"wit\",\"privateEndpointConnections\":[{\"properties\":{},\"id\":\"wgqwgxhn\",\"name\":\"skxfbk\",\"type\":\"y\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"wndnhj\",\"privateLinkResourceId\":\"auwhvylwzbtdhx\"},\"id\":\"jznb\",\"name\":\"pow\",\"type\":\"wpr\"},{\"properties\":{\"groupId\":\"lve\",\"privateLinkResourceId\":\"alupjm\"},\"id\":\"hfxobbcswsrtj\",\"name\":\"iplrbpbewtghfgb\",\"type\":\"c\"},{\"properties\":{\"groupId\":\"xzvlvqhjkbegib\",\"privateLinkResourceId\":\"nmxiebwwaloayqc\"},\"id\":\"wrtz\",\"name\":\"uzgwyzmhtx\",\"type\":\"ngmtsavjcb\"},{\"properties\":{\"groupId\":\"xqpsrknftguv\",\"privateLinkResourceId\":\"iuhprwmdyvxqta\"},\"id\":\"riwwroy\",\"name\":\"bexrmcq\",\"type\":\"bycnojvkn\"}],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"gzva\",\"features\":[{\"flag\":\"EnableConnectivityLogs\",\"value\":\"y\",\"properties\":{\"zlmwlxkvugfhz\":\"vgqzcjrvxd\",\"hnnpr\":\"vawjvzunlu\",\"ultskzbbtdz\":\"xipeilpjzuaejx\",\"ekg\":\"mv\"}},{\"flag\":\"EnableConnectivityLogs\",\"value\":\"ozuhkfp\",\"properties\":{\"luu\":\"yofd\",\"smv\":\"dttouwaboekqvkel\",\"aln\":\"xwyjsflhhc\",\"qcslyjpkiid\":\"ixisxyawjoy\"}}],\"liveTraceConfiguration\":{\"enabled\":\"xznelixhnrztf\",\"categories\":[{}]},\"resourceLogConfiguration\":{\"categories\":[{},{},{}]},\"cors\":{\"allowedOrigins\":[\"laulppg\",\"dtpnapnyiropuhp\",\"gvpgy\",\"gqgitxmedjvcsl\"]},\"serverless\":{\"connectionTimeoutInSeconds\":598877873},\"upstream\":{\"templates\":[{\"urlTemplate\":\"wzz\"},{\"urlTemplate\":\"xgk\"},{\"urlTemplate\":\"rmgucnap\"}]},\"networkACLs\":{\"defaultAction\":\"Allow\",\"publicNetwork\":{\"allow\":[\"ServerConnection\",\"ClientConnection\"],\"deny\":[\"ClientConnection\",\"ServerConnection\",\"RESTAPI\",\"RESTAPI\"]},\"privateEndpoints\":[{\"name\":\"b\"},{\"name\":\"ac\"},{\"name\":\"op\"}]},\"publicNetworkAccess\":\"qrhhu\",\"disableLocalAuth\":true,\"disableAadAuth\":false},\"kind\":\"SignalR\",\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"cfbu\":{\"principalId\":\"dahzxctobg\",\"clientId\":\"dmoizpostmg\"},\"swbxqz\":{\"principalId\":\"mfqjhhkxbp\",\"clientId\":\"ymjhxxjyngudivkr\"},\"ivetvtcq\":{\"principalId\":\"zjf\",\"clientId\":\"vjfdx\"},\"fxoblytkb\":{\"principalId\":\"tdo\",\"clientId\":\"cbxvwvxyslqbh\"}},\"principalId\":\"pe\",\"tenantId\":\"wfbkrvrns\"},\"location\":\"hqjohxcrsbfova\",\"tags\":{\"bcgjbirxbp\":\"uvwbhsqfs\"},\"id\":\"bsrfbj\",\"name\":\"dtws\",\"type\":\"otftpvjzbexilz\"},{\"sku\":{\"name\":\"fqqnvwpmqtaruo\",\"tier\":\"Premium\",\"size\":\"cjhwq\",\"family\":\"jrybnwjewgdrjer\",\"capacity\":604177419},\"properties\":{\"provisioningState\":\"Failed\",\"externalIP\":\"eh\",\"hostName\":\"doy\",\"publicPort\":1553722584,\"serverPort\":1126761283,\"version\":\"nzdndslgna\",\"privateEndpointConnections\":[{\"properties\":{},\"id\":\"nduhavhqlkthum\",\"name\":\"qolbgyc\",\"type\":\"uie\"},{\"properties\":{},\"id\":\"ccymvaolpsslql\",\"name\":\"mmdnbbglzps\",\"type\":\"iydmcwyhzdxs\"},{\"properties\":{},\"id\":\"bzmnvdfznud\",\"name\":\"od\",\"type\":\"xzb\"},{\"properties\":{},\"id\":\"lylpstdb\",\"name\":\"hxsrzdzucersc\",\"type\":\"ntnev\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"mygtdssls\",\"privateLinkResourceId\":\"tmweriofzpyq\"},\"id\":\"emwabnet\",\"name\":\"hhszh\",\"type\":\"d\"}],\"tls\":{\"clientCertEnabled\":false},\"hostNamePrefix\":\"wubmwmbesldn\",\"features\":[{\"flag\":\"EnableConnectivityLogs\",\"value\":\"pp\",\"properties\":{\"sikvmkqzeqqkdlt\":\"cxogaokonzm\",\"eodkwobda\":\"zxmhhvhgu\"}},{\"flag\":\"EnableLiveTrace\",\"value\":\"tibqdxbxwakb\",\"properties\":{\"iplbpodxunkbebxm\":\"xndlkzgxhu\"}},{\"flag\":\"EnableMessagingLogs\",\"value\":\"yyntwl\",\"properties\":{\"l\":\"tkoievseotgq\",\"xbmp\":\"tmuwlauwzi\"}},{\"flag\":\"EnableConnectivityLogs\",\"value\":\"jefuzmuvpbttdumo\",\"properties\":{\"mnzb\":\"xe\",\"el\":\"bhjpglkfgohdne\",\"fikdowwqu\":\"phsdyhto\"}}],\"liveTraceConfiguration\":{\"enabled\":\"zx\",\"categories\":[{},{}]},\"resourceLogConfiguration\":{\"categories\":[{},{},{}]},\"cors\":{\"allowedOrigins\":[\"o\",\"osggbhc\"]},\"serverless\":{\"connectionTimeoutInSeconds\":481884715},\"upstream\":{\"templates\":[{\"urlTemplate\":\"n\"},{\"urlTemplate\":\"aljutiiswac\"},{\"urlTemplate\":\"fgdkzzew\"},{\"urlTemplate\":\"fvhqc\"}]},\"networkACLs\":{\"defaultAction\":\"Allow\",\"publicNetwork\":{\"allow\":[\"ServerConnection\"],\"deny\":[\"ServerConnection\",\"ServerConnection\",\"RESTAPI\"]},\"privateEndpoints\":[{\"name\":\"dmhdlxyjr\"},{\"name\":\"sag\"},{\"name\":\"fcnihgwq\"}]},\"publicNetworkAccess\":\"nedgfbc\",\"disableLocalAuth\":true,\"disableAadAuth\":false},\"kind\":\"RawWebSockets\",\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"ld\":{\"principalId\":\"drhvoodsotbo\",\"clientId\":\"dopcjwvnh\"},\"pkhjwni\":{\"principalId\":\"gx\",\"clientId\":\"rslpmutwuoeg\"},\"sbpfvmwyhr\":{\"principalId\":\"sluicpdggkzz\",\"clientId\":\"mbmpaxmodfvuefy\"}},\"principalId\":\"uyfta\",\"tenantId\":\"cpwi\"},\"location\":\"vqtmnub\",\"tags\":{\"mond\":\"pzk\",\"gkopkwhojvpajqgx\":\"mquxvypo\",\"qvmkcxo\":\"smocmbq\"},\"id\":\"apvhelxprgly\",\"name\":\"tddckcb\",\"type\":\"uejrjxgc\"}],\"nextLink\":\"ibrhosxsdqr\"}") .toObject(SignalRResourceList.class); - Assertions.assertEquals("uckyf", model.value().get(0).location()); - Assertions.assertEquals("fidfvzw", model.value().get(0).tags().get("zuhtymwisdkfthwx")); - Assertions.assertEquals("jaoyfhrtx", model.value().get(0).sku().name()); + Assertions.assertEquals("ujqgidok", model.value().get(0).location()); + Assertions.assertEquals("jyoxgvclt", model.value().get(0).tags().get("gsncghkjeszz")); + Assertions.assertEquals("tpngjcrcczsqpjh", model.value().get(0).sku().name()); Assertions.assertEquals(SignalRSkuTier.FREE, model.value().get(0).sku().tier()); - Assertions.assertEquals(867367638, model.value().get(0).sku().capacity()); - Assertions.assertEquals(ServiceKind.RAW_WEB_SOCKETS, model.value().get(0).kind()); - Assertions.assertEquals(ManagedIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); - Assertions.assertEquals("f", model.value().get(0).publicNetworkAccess()); + Assertions.assertEquals(1901274446, model.value().get(0).sku().capacity()); + Assertions.assertEquals(ServiceKind.SIGNALR, model.value().get(0).kind()); + Assertions.assertEquals(ManagedIdentityType.NONE, model.value().get(0).identity().type()); + Assertions.assertEquals(true, model.value().get(0).tls().clientCertEnabled()); + Assertions.assertEquals(FeatureFlags.ENABLE_MESSAGING_LOGS, model.value().get(0).features().get(0).flag()); + Assertions.assertEquals("ucgygevqz", model.value().get(0).features().get(0).value()); + Assertions.assertEquals("pmr", model.value().get(0).features().get(0).properties().get("p")); + Assertions.assertEquals("drqjsdpy", model.value().get(0).liveTraceConfiguration().enabled()); + Assertions.assertEquals("ejzicwifsjtt", model.value().get(0).cors().allowedOrigins().get(0)); + Assertions.assertEquals(1232407744, model.value().get(0).serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("p", model.value().get(0).upstream().templates().get(0).urlTemplate()); + Assertions.assertEquals(AclAction.DENY, model.value().get(0).networkACLs().defaultAction()); + Assertions + .assertEquals(SignalRRequestType.TRACE, model.value().get(0).networkACLs().publicNetwork().allow().get(0)); + Assertions + .assertEquals( + SignalRRequestType.CLIENT_CONNECTION, model.value().get(0).networkACLs().publicNetwork().deny().get(0)); + Assertions.assertEquals("nuzo", model.value().get(0).networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("wvl", model.value().get(0).publicNetworkAccess()); Assertions.assertEquals(true, model.value().get(0).disableLocalAuth()); - Assertions.assertEquals(true, model.value().get(0).disableAadAuth()); - Assertions.assertEquals("alhbx", model.nextLink()); + Assertions.assertEquals(false, model.value().get(0).disableAadAuth()); + Assertions.assertEquals("ibrhosxsdqr", model.nextLink()); } @org.junit.jupiter.api.Test @@ -46,102 +78,411 @@ public void testSerialize() throws Exception { Arrays .asList( new SignalRResourceInner() - .withLocation("uckyf") + .withLocation("ujqgidok") .withTags( mapOf( - "zuhtymwisdkfthwx", - "fidfvzw", - "mijcmmxdcufufs", - "nteiwaopv", - "fycc", - "pymzidnsezcxtbzs")) + "gsncghkjeszz", "jyoxgvclt", "mxnehmp", "bijhtxfvgxbf", "godebfqkkrbmpu", "ec")) .withSku( new ResourceSku() - .withName("jaoyfhrtx") + .withName("tpngjcrcczsqpjh") .withTier(SignalRSkuTier.FREE) - .withCapacity(867367638)) - .withKind(ServiceKind.RAW_WEB_SOCKETS) + .withCapacity(1901274446)) + .withKind(ServiceKind.SIGNALR) .withIdentity( new ManagedIdentity() - .withType(ManagedIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities(mapOf())) - .withFeatures(Arrays.asList()) - .withPublicNetworkAccess("f") + .withType(ManagedIdentityType.NONE) + .withUserAssignedIdentities( + mapOf( + "zf", + new UserAssignedIdentityProperty(), + "senhwlrs", + new UserAssignedIdentityProperty(), + "vf", + new UserAssignedIdentityProperty(), + "wutttxfvjrbi", + new UserAssignedIdentityProperty()))) + .withTls(new SignalRTlsSettings().withClientCertEnabled(true)) + .withFeatures( + Arrays + .asList( + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_MESSAGING_LOGS) + .withValue("ucgygevqz") + .withProperties(mapOf("p", "pmr")))) + .withLiveTraceConfiguration( + new LiveTraceConfiguration() + .withEnabled("drqjsdpy") + .withCategories( + Arrays.asList(new LiveTraceCategory(), new LiveTraceCategory()))) + .withResourceLogConfiguration( + new ResourceLogConfiguration() + .withCategories( + Arrays + .asList( + new ResourceLogCategory(), + new ResourceLogCategory(), + new ResourceLogCategory()))) + .withCors( + new SignalRCorsSettings() + .withAllowedOrigins(Arrays.asList("ejzicwifsjtt", "zfbishcbkhaj"))) + .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(1232407744)) + .withUpstream( + new ServerlessUpstreamSettings() + .withTemplates( + Arrays + .asList( + new UpstreamTemplate().withUrlTemplate("p"), + new UpstreamTemplate().withUrlTemplate("agalpbuxwgipwhon"), + new UpstreamTemplate().withUrlTemplate("wkgshwa"), + new UpstreamTemplate().withUrlTemplate("kix")))) + .withNetworkACLs( + new SignalRNetworkACLs() + .withDefaultAction(AclAction.DENY) + .withPublicNetwork( + new NetworkAcl() + .withAllow(Arrays.asList(SignalRRequestType.TRACE)) + .withDeny( + Arrays + .asList( + SignalRRequestType.CLIENT_CONNECTION, + SignalRRequestType.CLIENT_CONNECTION))) + .withPrivateEndpoints( + Arrays + .asList( + new PrivateEndpointAcl().withName("nuzo"), + new PrivateEndpointAcl().withName("ftiyqzrnkcq"), + new PrivateEndpointAcl().withName("yx"), + new PrivateEndpointAcl().withName("whzlsicohoq")))) + .withPublicNetworkAccess("wvl") .withDisableLocalAuth(true) - .withDisableAadAuth(true), + .withDisableAadAuth(false), new SignalRResourceInner() - .withLocation("ocxscpaierhhbcs") + .withLocation("fm") .withTags( mapOf( - "bnbdxkqpxokajion", - "mmajtjaodx", - "jrmvdjwzrlo", - "imexgstxgcpodgma", - "hijco", - "mcl")) + "melmqkrha", + "kv", + "aquhcdhm", + "vljua", + "rcrgvx", + "ualaexqpvfadmw", + "fmisg", + "vgomz")) .withSku( new ResourceSku() - .withName("vypyqrimzinpv") - .withTier(SignalRSkuTier.STANDARD) - .withCapacity(683362936)) + .withName("dhibnuq") + .withTier(SignalRSkuTier.BASIC) + .withCapacity(850338934)) .withKind(ServiceKind.SIGNALR) .withIdentity( new ManagedIdentity() .withType(ManagedIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities(mapOf())) - .withFeatures(Arrays.asList()) - .withPublicNetworkAccess("jmkljavbqidtqajz") + .withUserAssignedIdentities( + mapOf( + "tcc", + new UserAssignedIdentityProperty(), + "hl", + new UserAssignedIdentityProperty(), + "ca", + new UserAssignedIdentityProperty(), + "kuwbcrnwb", + new UserAssignedIdentityProperty()))) + .withTls(new SignalRTlsSettings().withClientCertEnabled(true)) + .withFeatures( + Arrays + .asList( + new SignalRFeature() + .withFlag(FeatureFlags.SERVICE_MODE) + .withValue("xbniwdjs") + .withProperties(mapOf("bpg", "s", "fzab", "xytxhpzxbz")), + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_LIVE_TRACE) + .withValue("cuh") + .withProperties(mapOf("bbovplwzbhvgyugu", "ctyqik")), + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_MESSAGING_LOGS) + .withValue("vmkfssxqu") + .withProperties(mapOf("zkd", "plgmgsxnk")), + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_CONNECTIVITY_LOGS) + .withValue("lpvlopw") + .withProperties( + mapOf("baiuebbaumny", "ghxpkdw", "txp", "upedeojnabckhs")))) + .withLiveTraceConfiguration( + new LiveTraceConfiguration() + .withEnabled("btfhvpesaps") + .withCategories(Arrays.asList(new LiveTraceCategory()))) + .withResourceLogConfiguration( + new ResourceLogConfiguration() + .withCategories( + Arrays + .asList( + new ResourceLogCategory(), + new ResourceLogCategory(), + new ResourceLogCategory(), + new ResourceLogCategory()))) + .withCors( + new SignalRCorsSettings() + .withAllowedOrigins(Arrays.asList("htldwk", "zxuutkncwscwsvl", "otogtwrupqs"))) + .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(1364621442)) + .withUpstream( + new ServerlessUpstreamSettings() + .withTemplates( + Arrays + .asList( + new UpstreamTemplate().withUrlTemplate("kvceoveilovnotyf"), + new UpstreamTemplate().withUrlTemplate("fcnj"), + new UpstreamTemplate().withUrlTemplate("k")))) + .withNetworkACLs( + new SignalRNetworkACLs() + .withDefaultAction(AclAction.ALLOW) + .withPublicNetwork( + new NetworkAcl() + .withAllow( + Arrays + .asList( + SignalRRequestType.TRACE, + SignalRRequestType.RESTAPI, + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.CLIENT_CONNECTION)) + .withDeny(Arrays.asList(SignalRRequestType.TRACE))) + .withPrivateEndpoints( + Arrays + .asList( + new PrivateEndpointAcl().withName("jtoqne"), + new PrivateEndpointAcl().withName("mclfplphoxuscr"), + new PrivateEndpointAcl().withName("abgy"), + new PrivateEndpointAcl().withName("psbjta")))) + .withPublicNetworkAccess("ugxywpmueef") .withDisableLocalAuth(false) .withDisableAadAuth(true), new SignalRResourceInner() - .withLocation("rzayv") - .withTags(mapOf("ln", "gvdfgiotkftutq", "qmi", "xlefgugnxkrx")) + .withLocation("hqjohxcrsbfova") + .withTags(mapOf("bcgjbirxbp", "uvwbhsqfs")) .withSku( new ResourceSku() - .withName("kdkexxp") + .withName("ashsfwxos") .withTier(SignalRSkuTier.FREE) - .withCapacity(738311617)) + .withCapacity(1748456219)) .withKind(ServiceKind.SIGNALR) .withIdentity( new ManagedIdentity() - .withType(ManagedIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities(mapOf())) - .withFeatures(Arrays.asList()) - .withPublicNetworkAccess("qciwqvhkhixuigdt") - .withDisableLocalAuth(false) - .withDisableAadAuth(true), + .withType(ManagedIdentityType.NONE) + .withUserAssignedIdentities( + mapOf( + "cfbu", + new UserAssignedIdentityProperty(), + "swbxqz", + new UserAssignedIdentityProperty(), + "ivetvtcq", + new UserAssignedIdentityProperty(), + "fxoblytkb", + new UserAssignedIdentityProperty()))) + .withTls(new SignalRTlsSettings().withClientCertEnabled(true)) + .withFeatures( + Arrays + .asList( + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_CONNECTIVITY_LOGS) + .withValue("y") + .withProperties( + mapOf( + "zlmwlxkvugfhz", + "vgqzcjrvxd", + "hnnpr", + "vawjvzunlu", + "ultskzbbtdz", + "xipeilpjzuaejx", + "ekg", + "mv")), + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_CONNECTIVITY_LOGS) + .withValue("ozuhkfp") + .withProperties( + mapOf( + "luu", + "yofd", + "smv", + "dttouwaboekqvkel", + "aln", + "xwyjsflhhc", + "qcslyjpkiid", + "ixisxyawjoy")))) + .withLiveTraceConfiguration( + new LiveTraceConfiguration() + .withEnabled("xznelixhnrztf") + .withCategories(Arrays.asList(new LiveTraceCategory()))) + .withResourceLogConfiguration( + new ResourceLogConfiguration() + .withCategories( + Arrays + .asList( + new ResourceLogCategory(), + new ResourceLogCategory(), + new ResourceLogCategory()))) + .withCors( + new SignalRCorsSettings() + .withAllowedOrigins( + Arrays.asList("laulppg", "dtpnapnyiropuhp", "gvpgy", "gqgitxmedjvcsl"))) + .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(598877873)) + .withUpstream( + new ServerlessUpstreamSettings() + .withTemplates( + Arrays + .asList( + new UpstreamTemplate().withUrlTemplate("wzz"), + new UpstreamTemplate().withUrlTemplate("xgk"), + new UpstreamTemplate().withUrlTemplate("rmgucnap")))) + .withNetworkACLs( + new SignalRNetworkACLs() + .withDefaultAction(AclAction.ALLOW) + .withPublicNetwork( + new NetworkAcl() + .withAllow( + Arrays + .asList( + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.CLIENT_CONNECTION)) + .withDeny( + Arrays + .asList( + SignalRRequestType.CLIENT_CONNECTION, + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.RESTAPI, + SignalRRequestType.RESTAPI))) + .withPrivateEndpoints( + Arrays + .asList( + new PrivateEndpointAcl().withName("b"), + new PrivateEndpointAcl().withName("ac"), + new PrivateEndpointAcl().withName("op")))) + .withPublicNetworkAccess("qrhhu") + .withDisableLocalAuth(true) + .withDisableAadAuth(false), new SignalRResourceInner() - .withLocation("vlrxnjeaseiph") - .withTags(mapOf("enjbdlwtgrhp", "lokeyy")) + .withLocation("vqtmnub") + .withTags(mapOf("mond", "pzk", "gkopkwhojvpajqgx", "mquxvypo", "qvmkcxo", "smocmbq")) .withSku( new ResourceSku() - .withName("tzlcuiywgqywgn") - .withTier(SignalRSkuTier.STANDARD) - .withCapacity(1165207027)) + .withName("fqqnvwpmqtaruo") + .withTier(SignalRSkuTier.PREMIUM) + .withCapacity(604177419)) .withKind(ServiceKind.RAW_WEB_SOCKETS) .withIdentity( new ManagedIdentity() - .withType(ManagedIdentityType.NONE) - .withUserAssignedIdentities(mapOf())) - .withFeatures(Arrays.asList()) - .withPublicNetworkAccess("qqwx") + .withType(ManagedIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "ld", + new UserAssignedIdentityProperty(), + "pkhjwni", + new UserAssignedIdentityProperty(), + "sbpfvmwyhr", + new UserAssignedIdentityProperty()))) + .withTls(new SignalRTlsSettings().withClientCertEnabled(false)) + .withFeatures( + Arrays + .asList( + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_CONNECTIVITY_LOGS) + .withValue("pp") + .withProperties( + mapOf("sikvmkqzeqqkdlt", "cxogaokonzm", "eodkwobda", "zxmhhvhgu")), + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_LIVE_TRACE) + .withValue("tibqdxbxwakb") + .withProperties(mapOf("iplbpodxunkbebxm", "xndlkzgxhu")), + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_MESSAGING_LOGS) + .withValue("yyntwl") + .withProperties(mapOf("l", "tkoievseotgq", "xbmp", "tmuwlauwzi")), + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_CONNECTIVITY_LOGS) + .withValue("jefuzmuvpbttdumo") + .withProperties( + mapOf( + "mnzb", + "xe", + "el", + "bhjpglkfgohdne", + "fikdowwqu", + "phsdyhto")))) + .withLiveTraceConfiguration( + new LiveTraceConfiguration() + .withEnabled("zx") + .withCategories( + Arrays.asList(new LiveTraceCategory(), new LiveTraceCategory()))) + .withResourceLogConfiguration( + new ResourceLogConfiguration() + .withCategories( + Arrays + .asList( + new ResourceLogCategory(), + new ResourceLogCategory(), + new ResourceLogCategory()))) + .withCors(new SignalRCorsSettings().withAllowedOrigins(Arrays.asList("o", "osggbhc"))) + .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(481884715)) + .withUpstream( + new ServerlessUpstreamSettings() + .withTemplates( + Arrays + .asList( + new UpstreamTemplate().withUrlTemplate("n"), + new UpstreamTemplate().withUrlTemplate("aljutiiswac"), + new UpstreamTemplate().withUrlTemplate("fgdkzzew"), + new UpstreamTemplate().withUrlTemplate("fvhqc")))) + .withNetworkACLs( + new SignalRNetworkACLs() + .withDefaultAction(AclAction.ALLOW) + .withPublicNetwork( + new NetworkAcl() + .withAllow(Arrays.asList(SignalRRequestType.SERVER_CONNECTION)) + .withDeny( + Arrays + .asList( + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.SERVER_CONNECTION, + SignalRRequestType.RESTAPI))) + .withPrivateEndpoints( + Arrays + .asList( + new PrivateEndpointAcl().withName("dmhdlxyjr"), + new PrivateEndpointAcl().withName("sag"), + new PrivateEndpointAcl().withName("fcnihgwq")))) + .withPublicNetworkAccess("nedgfbc") .withDisableLocalAuth(true) .withDisableAadAuth(false))) - .withNextLink("alhbx"); + .withNextLink("ibrhosxsdqr"); model = BinaryData.fromObject(model).toObject(SignalRResourceList.class); - Assertions.assertEquals("uckyf", model.value().get(0).location()); - Assertions.assertEquals("fidfvzw", model.value().get(0).tags().get("zuhtymwisdkfthwx")); - Assertions.assertEquals("jaoyfhrtx", model.value().get(0).sku().name()); + Assertions.assertEquals("ujqgidok", model.value().get(0).location()); + Assertions.assertEquals("jyoxgvclt", model.value().get(0).tags().get("gsncghkjeszz")); + Assertions.assertEquals("tpngjcrcczsqpjh", model.value().get(0).sku().name()); Assertions.assertEquals(SignalRSkuTier.FREE, model.value().get(0).sku().tier()); - Assertions.assertEquals(867367638, model.value().get(0).sku().capacity()); - Assertions.assertEquals(ServiceKind.RAW_WEB_SOCKETS, model.value().get(0).kind()); - Assertions.assertEquals(ManagedIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); - Assertions.assertEquals("f", model.value().get(0).publicNetworkAccess()); + Assertions.assertEquals(1901274446, model.value().get(0).sku().capacity()); + Assertions.assertEquals(ServiceKind.SIGNALR, model.value().get(0).kind()); + Assertions.assertEquals(ManagedIdentityType.NONE, model.value().get(0).identity().type()); + Assertions.assertEquals(true, model.value().get(0).tls().clientCertEnabled()); + Assertions.assertEquals(FeatureFlags.ENABLE_MESSAGING_LOGS, model.value().get(0).features().get(0).flag()); + Assertions.assertEquals("ucgygevqz", model.value().get(0).features().get(0).value()); + Assertions.assertEquals("pmr", model.value().get(0).features().get(0).properties().get("p")); + Assertions.assertEquals("drqjsdpy", model.value().get(0).liveTraceConfiguration().enabled()); + Assertions.assertEquals("ejzicwifsjtt", model.value().get(0).cors().allowedOrigins().get(0)); + Assertions.assertEquals(1232407744, model.value().get(0).serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("p", model.value().get(0).upstream().templates().get(0).urlTemplate()); + Assertions.assertEquals(AclAction.DENY, model.value().get(0).networkACLs().defaultAction()); + Assertions + .assertEquals(SignalRRequestType.TRACE, model.value().get(0).networkACLs().publicNetwork().allow().get(0)); + Assertions + .assertEquals( + SignalRRequestType.CLIENT_CONNECTION, model.value().get(0).networkACLs().publicNetwork().deny().get(0)); + Assertions.assertEquals("nuzo", model.value().get(0).networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("wvl", model.value().get(0).publicNetworkAccess()); Assertions.assertEquals(true, model.value().get(0).disableLocalAuth()); - Assertions.assertEquals(true, model.value().get(0).disableAadAuth()); - Assertions.assertEquals("alhbx", model.nextLink()); + Assertions.assertEquals(false, model.value().get(0).disableAadAuth()); + Assertions.assertEquals("ibrhosxsdqr", model.nextLink()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesCreateOrUpdateMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesCreateOrUpdateMockTests.java index 0a9491a43025..188874484d9b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesCreateOrUpdateMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesCreateOrUpdateMockTests.java @@ -31,7 +31,7 @@ public void testCreateOrUpdate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"groupId\":\"zejntps\",\"privateLinkResourceId\":\"wgioilqukry\",\"provisioningState\":\"Succeeded\",\"requestMessage\":\"mieoxorgguf\",\"status\":\"Pending\"},\"id\":\"omtbghhavgrvkff\",\"name\":\"vjzhpjbib\",\"type\":\"jmfxumvf\"}"; + "{\"properties\":{\"groupId\":\"cxmjpbyephmg\",\"privateLinkResourceId\":\"vljvrc\",\"provisioningState\":\"Succeeded\",\"requestMessage\":\"i\",\"status\":\"Timeout\"},\"id\":\"hnp\",\"name\":\"myqwcab\",\"type\":\"nuilee\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,15 +62,15 @@ public void testCreateOrUpdate() throws Exception { SharedPrivateLinkResource response = manager .signalRSharedPrivateLinkResources() - .define("tw") - .withExistingSignalR("sgogczhonnxk", "lgnyhmo") - .withGroupId("kkgthr") - .withPrivateLinkResourceId("gh") - .withRequestMessage("hqxvcxgfrpdsofbs") + .define("z") + .withExistingSignalR("ufypiv", "sbbjpmcu") + .withGroupId("mifoxxkub") + .withPrivateLinkResourceId("phavpmhbrb") + .withRequestMessage("ovpbbttefjoknssq") .create(); - Assertions.assertEquals("zejntps", response.groupId()); - Assertions.assertEquals("wgioilqukry", response.privateLinkResourceId()); - Assertions.assertEquals("mieoxorgguf", response.requestMessage()); + Assertions.assertEquals("cxmjpbyephmg", response.groupId()); + Assertions.assertEquals("vljvrc", response.privateLinkResourceId()); + Assertions.assertEquals("i", response.requestMessage()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesDeleteMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesDeleteMockTests.java index 30b1b7cc1a05..1f9b62d11e6d 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesDeleteMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesDeleteMockTests.java @@ -56,6 +56,8 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.signalRSharedPrivateLinkResources().delete("zronasxift", "zq", "zh", com.azure.core.util.Context.NONE); + manager + .signalRSharedPrivateLinkResources() + .delete("wphqlkccuzgygqw", "hoi", "lwgniiprglvawu", com.azure.core.util.Context.NONE); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesGetWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesGetWithResponseMockTests.java index 527f8dc0cd1a..4d949d1e6640 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesGetWithResponseMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesGetWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testGetWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"properties\":{\"groupId\":\"dfdlwggyts\",\"privateLinkResourceId\":\"wtovvtgsein\",\"provisioningState\":\"Moving\",\"requestMessage\":\"fxqknpirgneptt\",\"status\":\"Timeout\"},\"id\":\"sniffc\",\"name\":\"mqnrojlpijnkr\",\"type\":\"frddhcrati\"}"; + "{\"properties\":{\"groupId\":\"kflrmymy\",\"privateLinkResourceId\":\"nc\",\"provisioningState\":\"Deleting\",\"requestMessage\":\"isws\",\"status\":\"Timeout\"},\"id\":\"iiovgqcgxu\",\"name\":\"gqkctotiowlxte\",\"type\":\"dptjgwdtgukranb\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -62,11 +62,11 @@ public void testGetWithResponse() throws Exception { SharedPrivateLinkResource response = manager .signalRSharedPrivateLinkResources() - .getWithResponse("knfd", "twjchrdg", "ihxumwctondzj", com.azure.core.util.Context.NONE) + .getWithResponse("pphkixkykxds", "j", "emmucfxh", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("dfdlwggyts", response.groupId()); - Assertions.assertEquals("wtovvtgsein", response.privateLinkResourceId()); - Assertions.assertEquals("fxqknpirgneptt", response.requestMessage()); + Assertions.assertEquals("kflrmymy", response.groupId()); + Assertions.assertEquals("nc", response.privateLinkResourceId()); + Assertions.assertEquals("isws", response.requestMessage()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesListMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesListMockTests.java index e96700851231..f2c27ba18c92 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesListMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRSharedPrivateLinkResourcesListMockTests.java @@ -32,7 +32,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"properties\":{\"groupId\":\"lmcuvhixb\",\"privateLinkResourceId\":\"xyfwnylrcool\",\"provisioningState\":\"Deleting\",\"requestMessage\":\"kiwkkbnujr\",\"status\":\"Rejected\"},\"id\":\"tylbfpncurdoiw\",\"name\":\"ithtywu\",\"type\":\"xcbihw\"}]}"; + "{\"value\":[{\"properties\":{\"groupId\":\"fsxzecp\",\"privateLinkResourceId\":\"xw\",\"provisioningState\":\"Failed\",\"requestMessage\":\"khvuhxepmrutz\",\"status\":\"Pending\"},\"id\":\"aobn\",\"name\":\"lujdjltymkmv\",\"type\":\"uihywart\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -61,12 +61,10 @@ public void testList() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager - .signalRSharedPrivateLinkResources() - .list("dscwxqupevzhf", "totxhojujb", com.azure.core.util.Context.NONE); + manager.signalRSharedPrivateLinkResources().list("vteo", "xvgpiude", com.azure.core.util.Context.NONE); - Assertions.assertEquals("lmcuvhixb", response.iterator().next().groupId()); - Assertions.assertEquals("xyfwnylrcool", response.iterator().next().privateLinkResourceId()); - Assertions.assertEquals("kiwkkbnujr", response.iterator().next().requestMessage()); + Assertions.assertEquals("fsxzecp", response.iterator().next().groupId()); + Assertions.assertEquals("xw", response.iterator().next().privateLinkResourceId()); + Assertions.assertEquals("khvuhxepmrutz", response.iterator().next().requestMessage()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRTlsSettingsTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRTlsSettingsTests.java index 313c8a7ea7d9..e6201ba709d6 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRTlsSettingsTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRTlsSettingsTests.java @@ -12,14 +12,14 @@ public final class SignalRTlsSettingsTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SignalRTlsSettings model = - BinaryData.fromString("{\"clientCertEnabled\":true}").toObject(SignalRTlsSettings.class); - Assertions.assertEquals(true, model.clientCertEnabled()); + BinaryData.fromString("{\"clientCertEnabled\":false}").toObject(SignalRTlsSettings.class); + Assertions.assertEquals(false, model.clientCertEnabled()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - SignalRTlsSettings model = new SignalRTlsSettings().withClientCertEnabled(true); + SignalRTlsSettings model = new SignalRTlsSettings().withClientCertEnabled(false); model = BinaryData.fromObject(model).toObject(SignalRTlsSettings.class); - Assertions.assertEquals(true, model.clientCertEnabled()); + Assertions.assertEquals(false, model.clientCertEnabled()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageInnerTests.java index 7907062a716e..afd3bc6e283f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageInnerTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageInnerTests.java @@ -15,31 +15,31 @@ public void testDeserialize() throws Exception { SignalRUsageInner model = BinaryData .fromString( - "{\"id\":\"qktapspwgcuert\",\"currentValue\":7020809285560485144,\"limit\":6338655194328976084,\"name\":{\"value\":\"hbmdgbbjfdd\",\"localizedValue\":\"bmbexppbhtqqro\"},\"unit\":\"p\"}") + "{\"id\":\"vyvdcs\",\"currentValue\":6235593202680912824,\"limit\":7516654710743281273,\"name\":{\"value\":\"ectehf\",\"localizedValue\":\"scjeypv\"},\"unit\":\"zrkgqhcjrefovg\"}") .toObject(SignalRUsageInner.class); - Assertions.assertEquals("qktapspwgcuert", model.id()); - Assertions.assertEquals(7020809285560485144L, model.currentValue()); - Assertions.assertEquals(6338655194328976084L, model.limit()); - Assertions.assertEquals("hbmdgbbjfdd", model.name().value()); - Assertions.assertEquals("bmbexppbhtqqro", model.name().localizedValue()); - Assertions.assertEquals("p", model.unit()); + Assertions.assertEquals("vyvdcs", model.id()); + Assertions.assertEquals(6235593202680912824L, model.currentValue()); + Assertions.assertEquals(7516654710743281273L, model.limit()); + Assertions.assertEquals("ectehf", model.name().value()); + Assertions.assertEquals("scjeypv", model.name().localizedValue()); + Assertions.assertEquals("zrkgqhcjrefovg", model.unit()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { SignalRUsageInner model = new SignalRUsageInner() - .withId("qktapspwgcuert") - .withCurrentValue(7020809285560485144L) - .withLimit(6338655194328976084L) - .withName(new SignalRUsageName().withValue("hbmdgbbjfdd").withLocalizedValue("bmbexppbhtqqro")) - .withUnit("p"); + .withId("vyvdcs") + .withCurrentValue(6235593202680912824L) + .withLimit(7516654710743281273L) + .withName(new SignalRUsageName().withValue("ectehf").withLocalizedValue("scjeypv")) + .withUnit("zrkgqhcjrefovg"); model = BinaryData.fromObject(model).toObject(SignalRUsageInner.class); - Assertions.assertEquals("qktapspwgcuert", model.id()); - Assertions.assertEquals(7020809285560485144L, model.currentValue()); - Assertions.assertEquals(6338655194328976084L, model.limit()); - Assertions.assertEquals("hbmdgbbjfdd", model.name().value()); - Assertions.assertEquals("bmbexppbhtqqro", model.name().localizedValue()); - Assertions.assertEquals("p", model.unit()); + Assertions.assertEquals("vyvdcs", model.id()); + Assertions.assertEquals(6235593202680912824L, model.currentValue()); + Assertions.assertEquals(7516654710743281273L, model.limit()); + Assertions.assertEquals("ectehf", model.name().value()); + Assertions.assertEquals("scjeypv", model.name().localizedValue()); + Assertions.assertEquals("zrkgqhcjrefovg", model.unit()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageListTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageListTests.java index 8f03aec34033..8fcd9550fc5b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageListTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageListTests.java @@ -17,15 +17,15 @@ public void testDeserialize() throws Exception { SignalRUsageList model = BinaryData .fromString( - "{\"value\":[{\"id\":\"feusnhut\",\"currentValue\":7488631932267615574,\"limit\":1681358719295999682,\"name\":{\"value\":\"ugjzzdatqxhocdge\",\"localizedValue\":\"lgphu\"},\"unit\":\"cndvkaozwyiftyhx\"},{\"id\":\"rokft\",\"currentValue\":3868150209180294588,\"limit\":8023201833032933577,\"name\":{\"value\":\"cukjf\",\"localizedValue\":\"iawxklry\"},\"unit\":\"wckbasyypnd\"},{\"id\":\"sgcbac\",\"currentValue\":3223006673254134056,\"limit\":1592886583482291968,\"name\":{\"value\":\"qgoulznd\",\"localizedValue\":\"kwy\"},\"unit\":\"gfgibm\"},{\"id\":\"gakeqsr\",\"currentValue\":4764420434211011454,\"limit\":7229748892246039848,\"name\":{\"value\":\"ytb\",\"localizedValue\":\"qfou\"},\"unit\":\"mmnkzsmodmgl\"}],\"nextLink\":\"gpbkwtmut\"}") + "{\"value\":[{\"id\":\"ndnvo\",\"currentValue\":4292877192766299113,\"limit\":3293446474919179561,\"name\":{\"value\":\"kcglhslaz\",\"localizedValue\":\"yggdtjixh\"},\"unit\":\"uofqwe\"}],\"nextLink\":\"hmenevfyexfwhybc\"}") .toObject(SignalRUsageList.class); - Assertions.assertEquals("feusnhut", model.value().get(0).id()); - Assertions.assertEquals(7488631932267615574L, model.value().get(0).currentValue()); - Assertions.assertEquals(1681358719295999682L, model.value().get(0).limit()); - Assertions.assertEquals("ugjzzdatqxhocdge", model.value().get(0).name().value()); - Assertions.assertEquals("lgphu", model.value().get(0).name().localizedValue()); - Assertions.assertEquals("cndvkaozwyiftyhx", model.value().get(0).unit()); - Assertions.assertEquals("gpbkwtmut", model.nextLink()); + Assertions.assertEquals("ndnvo", model.value().get(0).id()); + Assertions.assertEquals(4292877192766299113L, model.value().get(0).currentValue()); + Assertions.assertEquals(3293446474919179561L, model.value().get(0).limit()); + Assertions.assertEquals("kcglhslaz", model.value().get(0).name().value()); + Assertions.assertEquals("yggdtjixh", model.value().get(0).name().localizedValue()); + Assertions.assertEquals("uofqwe", model.value().get(0).unit()); + Assertions.assertEquals("hmenevfyexfwhybc", model.nextLink()); } @org.junit.jupiter.api.Test @@ -36,38 +36,19 @@ public void testSerialize() throws Exception { Arrays .asList( new SignalRUsageInner() - .withId("feusnhut") - .withCurrentValue(7488631932267615574L) - .withLimit(1681358719295999682L) - .withName( - new SignalRUsageName().withValue("ugjzzdatqxhocdge").withLocalizedValue("lgphu")) - .withUnit("cndvkaozwyiftyhx"), - new SignalRUsageInner() - .withId("rokft") - .withCurrentValue(3868150209180294588L) - .withLimit(8023201833032933577L) - .withName(new SignalRUsageName().withValue("cukjf").withLocalizedValue("iawxklry")) - .withUnit("wckbasyypnd"), - new SignalRUsageInner() - .withId("sgcbac") - .withCurrentValue(3223006673254134056L) - .withLimit(1592886583482291968L) - .withName(new SignalRUsageName().withValue("qgoulznd").withLocalizedValue("kwy")) - .withUnit("gfgibm"), - new SignalRUsageInner() - .withId("gakeqsr") - .withCurrentValue(4764420434211011454L) - .withLimit(7229748892246039848L) - .withName(new SignalRUsageName().withValue("ytb").withLocalizedValue("qfou")) - .withUnit("mmnkzsmodmgl"))) - .withNextLink("gpbkwtmut"); + .withId("ndnvo") + .withCurrentValue(4292877192766299113L) + .withLimit(3293446474919179561L) + .withName(new SignalRUsageName().withValue("kcglhslaz").withLocalizedValue("yggdtjixh")) + .withUnit("uofqwe"))) + .withNextLink("hmenevfyexfwhybc"); model = BinaryData.fromObject(model).toObject(SignalRUsageList.class); - Assertions.assertEquals("feusnhut", model.value().get(0).id()); - Assertions.assertEquals(7488631932267615574L, model.value().get(0).currentValue()); - Assertions.assertEquals(1681358719295999682L, model.value().get(0).limit()); - Assertions.assertEquals("ugjzzdatqxhocdge", model.value().get(0).name().value()); - Assertions.assertEquals("lgphu", model.value().get(0).name().localizedValue()); - Assertions.assertEquals("cndvkaozwyiftyhx", model.value().get(0).unit()); - Assertions.assertEquals("gpbkwtmut", model.nextLink()); + Assertions.assertEquals("ndnvo", model.value().get(0).id()); + Assertions.assertEquals(4292877192766299113L, model.value().get(0).currentValue()); + Assertions.assertEquals(3293446474919179561L, model.value().get(0).limit()); + Assertions.assertEquals("kcglhslaz", model.value().get(0).name().value()); + Assertions.assertEquals("yggdtjixh", model.value().get(0).name().localizedValue()); + Assertions.assertEquals("uofqwe", model.value().get(0).unit()); + Assertions.assertEquals("hmenevfyexfwhybc", model.nextLink()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageNameTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageNameTests.java index 60d7249151bf..97864f35bce5 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageNameTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRUsageNameTests.java @@ -12,16 +12,18 @@ public final class SignalRUsageNameTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SignalRUsageName model = - BinaryData.fromString("{\"value\":\"s\",\"localizedValue\":\"gbquxigj\"}").toObject(SignalRUsageName.class); - Assertions.assertEquals("s", model.value()); - Assertions.assertEquals("gbquxigj", model.localizedValue()); + BinaryData + .fromString("{\"value\":\"qsl\",\"localizedValue\":\"yvxyqjp\"}") + .toObject(SignalRUsageName.class); + Assertions.assertEquals("qsl", model.value()); + Assertions.assertEquals("yvxyqjp", model.localizedValue()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - SignalRUsageName model = new SignalRUsageName().withValue("s").withLocalizedValue("gbquxigj"); + SignalRUsageName model = new SignalRUsageName().withValue("qsl").withLocalizedValue("yvxyqjp"); model = BinaryData.fromObject(model).toObject(SignalRUsageName.class); - Assertions.assertEquals("s", model.value()); - Assertions.assertEquals("gbquxigj", model.localizedValue()); + Assertions.assertEquals("qsl", model.value()); + Assertions.assertEquals("yvxyqjp", model.localizedValue()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsCheckNameAvailabilityWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsCheckNameAvailabilityWithResponseMockTests.java index 9d18a6b34964..fe07e0e4b4e2 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsCheckNameAvailabilityWithResponseMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsCheckNameAvailabilityWithResponseMockTests.java @@ -31,7 +31,7 @@ public void testCheckNameAvailabilityWithResponse() throws Exception { HttpResponse httpResponse = Mockito.mock(HttpResponse.class); ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"nameAvailable\":true,\"reason\":\"vc\",\"message\":\"y\"}"; + String responseStr = "{\"nameAvailable\":true,\"reason\":\"spave\",\"message\":\"r\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -63,13 +63,13 @@ public void testCheckNameAvailabilityWithResponse() throws Exception { manager .signalRs() .checkNameAvailabilityWithResponse( - "lla", - new NameAvailabilityParameters().withType("melwuipiccjz").withName("z"), + "zsdymbrnysuxmpra", + new NameAvailabilityParameters().withType("wgck").withName("ocxvdfffwafqr"), com.azure.core.util.Context.NONE) .getValue(); Assertions.assertEquals(true, response.nameAvailable()); - Assertions.assertEquals("vc", response.reason()); - Assertions.assertEquals("y", response.message()); + Assertions.assertEquals("spave", response.reason()); + Assertions.assertEquals("r", response.message()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsCreateOrUpdateMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsCreateOrUpdateMockTests.java index e3a481df7252..f2fea552a82c 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsCreateOrUpdateMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsCreateOrUpdateMockTests.java @@ -13,19 +13,29 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.signalr.SignalRManager; import com.azure.resourcemanager.signalr.models.AclAction; +import com.azure.resourcemanager.signalr.models.FeatureFlags; +import com.azure.resourcemanager.signalr.models.LiveTraceCategory; import com.azure.resourcemanager.signalr.models.LiveTraceConfiguration; import com.azure.resourcemanager.signalr.models.ManagedIdentity; import com.azure.resourcemanager.signalr.models.ManagedIdentityType; +import com.azure.resourcemanager.signalr.models.NetworkAcl; +import com.azure.resourcemanager.signalr.models.PrivateEndpointAcl; +import com.azure.resourcemanager.signalr.models.ResourceLogCategory; import com.azure.resourcemanager.signalr.models.ResourceLogConfiguration; import com.azure.resourcemanager.signalr.models.ResourceSku; import com.azure.resourcemanager.signalr.models.ServerlessSettings; import com.azure.resourcemanager.signalr.models.ServerlessUpstreamSettings; import com.azure.resourcemanager.signalr.models.ServiceKind; import com.azure.resourcemanager.signalr.models.SignalRCorsSettings; +import com.azure.resourcemanager.signalr.models.SignalRFeature; import com.azure.resourcemanager.signalr.models.SignalRNetworkACLs; +import com.azure.resourcemanager.signalr.models.SignalRRequestType; import com.azure.resourcemanager.signalr.models.SignalRResource; import com.azure.resourcemanager.signalr.models.SignalRSkuTier; import com.azure.resourcemanager.signalr.models.SignalRTlsSettings; +import com.azure.resourcemanager.signalr.models.UpstreamAuthSettings; +import com.azure.resourcemanager.signalr.models.UpstreamTemplate; +import com.azure.resourcemanager.signalr.models.UserAssignedIdentityProperty; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; @@ -47,7 +57,7 @@ public void testCreateOrUpdate() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"sku\":{\"name\":\"mzqhoftrmaequi\",\"tier\":\"Basic\",\"size\":\"cslfaoqzpiyylha\",\"family\":\"swhccsphk\",\"capacity\":185919180},\"properties\":{\"provisioningState\":\"Succeeded\",\"externalIP\":\"scywuggwoluhc\",\"hostName\":\"wem\",\"publicPort\":19957652,\"serverPort\":1127329459,\"version\":\"rgzdwmsweyp\",\"privateEndpointConnections\":[],\"sharedPrivateLinkResources\":[],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"cnxqhuexmkttlst\",\"features\":[],\"liveTraceConfiguration\":{\"enabled\":\"emhzrncsdtc\",\"categories\":[]},\"resourceLogConfiguration\":{\"categories\":[]},\"cors\":{\"allowedOrigins\":[]},\"serverless\":{\"connectionTimeoutInSeconds\":1674447280},\"upstream\":{\"templates\":[]},\"networkACLs\":{\"defaultAction\":\"Allow\",\"privateEndpoints\":[]},\"publicNetworkAccess\":\"eadcygqukyhejhz\",\"disableLocalAuth\":true,\"disableAadAuth\":false},\"kind\":\"RawWebSockets\",\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{},\"principalId\":\"ksrpqv\",\"tenantId\":\"zraehtwd\"},\"location\":\"ftswibyrcdlbhsh\",\"tags\":{\"hevxcced\":\"racstwity\"},\"id\":\"pnmdyodnwzxltjcv\",\"name\":\"hlt\",\"type\":\"ugcxnavvwxq\"}"; + "{\"sku\":{\"name\":\"mmkjsvthnwpztek\",\"tier\":\"Basic\",\"size\":\"ibiattg\",\"family\":\"ucfotangcf\",\"capacity\":821874250},\"properties\":{\"provisioningState\":\"Succeeded\",\"externalIP\":\"gswvxwlmzqwm\",\"hostName\":\"xnjmxm\",\"publicPort\":84697617,\"serverPort\":1533392836,\"version\":\"cvclxynpdk\",\"privateEndpointConnections\":[{\"properties\":{\"provisioningState\":\"Unknown\",\"privateEndpoint\":{},\"groupIds\":[\"ibuz\",\"hdugneiknpg\",\"xgjiuqh\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"ozipqwjedmurrxx\",\"name\":\"ewpktvqy\",\"type\":\"kmqp\"},{\"properties\":{\"provisioningState\":\"Moving\",\"privateEndpoint\":{},\"groupIds\":[\"cgwgcloxoebqinji\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"jfujq\",\"name\":\"afcba\",\"type\":\"hpzpo\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"privateEndpoint\":{},\"groupIds\":[\"filkmkkholv\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"viauogphua\",\"name\":\"tvt\",\"type\":\"ukyefchnmnahmnxh\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"irwrwe\",\"privateLinkResourceId\":\"oxffif\",\"provisioningState\":\"Running\",\"requestMessage\":\"snewmozqvbub\",\"status\":\"Approved\"},\"id\":\"m\",\"name\":\"sycxhxzgaz\",\"type\":\"taboidvmf\"},{\"properties\":{\"groupId\":\"ppu\",\"privateLinkResourceId\":\"owsepdfgkmtdhern\",\"provisioningState\":\"Canceled\",\"requestMessage\":\"juahokqto\",\"status\":\"Rejected\"},\"id\":\"uxofshfphwpnulai\",\"name\":\"wzejywhslw\",\"type\":\"ojpllndnpdwrpqaf\"}],\"tls\":{\"clientCertEnabled\":false},\"hostNamePrefix\":\"nnfhyetefypo\",\"features\":[{\"flag\":\"EnableConnectivityLogs\",\"value\":\"fjgtixrjvzuy\",\"properties\":{\"au\":\"mlmuowol\",\"onwpnga\":\"ropions\"}},{\"flag\":\"EnableLiveTrace\",\"value\":\"n\",\"properties\":{\"xlzhcoxovnekh\":\"jawrtmjfjmyc\",\"jxtxrdc\":\"nlusfnrd\"}},{\"flag\":\"EnableConnectivityLogs\",\"value\":\"jvidttge\",\"properties\":{\"zies\":\"lvyjtcvuwkas\",\"uhxu\":\"uughtuqfecjxeyg\",\"hwpusxj\":\"cbuewmrswnjlxuz\",\"dohzjq\":\"aqehg\"}}],\"liveTraceConfiguration\":{\"enabled\":\"coi\",\"categories\":[{\"name\":\"ncnwfepbnwgf\",\"enabled\":\"jgcgbjbgdlfgtdys\"},{\"name\":\"quflqbctq\",\"enabled\":\"mzjr\"},{\"name\":\"kqzeqyjleziunjx\",\"enabled\":\"zantkwceg\"}]},\"resourceLogConfiguration\":{\"categories\":[{\"name\":\"nseqacjjvp\",\"enabled\":\"guooqjagmdit\"},{\"name\":\"eiookjbsah\",\"enabled\":\"dt\"}]},\"cors\":{\"allowedOrigins\":[\"qacsl\"]},\"serverless\":{\"connectionTimeoutInSeconds\":818366731},\"upstream\":{\"templates\":[{\"hubPattern\":\"xofvcjk\",\"eventPattern\":\"irazftxejwabmd\",\"categoryPattern\":\"tmvcop\",\"urlTemplate\":\"xcmjurbu\",\"auth\":{}},{\"hubPattern\":\"kyqltqsrogt\",\"eventPattern\":\"kffdjktsys\",\"categoryPattern\":\"fvcl\",\"urlTemplate\":\"lxnfuijtkbusqogs\",\"auth\":{}}]},\"networkACLs\":{\"defaultAction\":\"Allow\",\"publicNetwork\":{\"allow\":[\"ServerConnection\",\"ClientConnection\",\"ServerConnection\",\"Trace\"],\"deny\":[\"ClientConnection\",\"ClientConnection\"]},\"privateEndpoints\":[{\"name\":\"xfz\",\"allow\":[\"ServerConnection\"],\"deny\":[\"Trace\",\"Trace\"]},{\"name\":\"pqhjpenuygbqeqq\",\"allow\":[\"ClientConnection\",\"ServerConnection\",\"ClientConnection\"],\"deny\":[\"ServerConnection\",\"Trace\"]},{\"name\":\"lguaucm\",\"allow\":[\"ServerConnection\",\"Trace\"],\"deny\":[\"ServerConnection\",\"ClientConnection\",\"ClientConnection\",\"ServerConnection\"]}]},\"publicNetworkAccess\":\"qikczvvita\",\"disableLocalAuth\":true,\"disableAadAuth\":true},\"kind\":\"RawWebSockets\",\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"sxypruuu\":{\"principalId\":\"vs\",\"clientId\":\"hlwntsjgq\"}},\"principalId\":\"nchrszizoyu\",\"tenantId\":\"yetnd\"},\"location\":\"fqyggagflnlgmtr\",\"tags\":{\"pigqfusuckzmkw\":\"zjmucftbyrplroh\",\"jnhgwydyyn\":\"lsnoxaxmqeqalh\",\"ta\":\"svkhgbv\"},\"id\":\"arfdlpukhpyrnei\",\"name\":\"jcpeogkhnmg\",\"type\":\"ro\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -78,47 +88,136 @@ public void testCreateOrUpdate() throws Exception { SignalRResource response = manager .signalRs() - .define("zkoj") - .withRegion("ogvbbejdcngq") - .withExistingResourceGroup("wwa") - .withTags(mapOf("wr", "akufgmjz", "u", "grtwae")) - .withSku(new ResourceSku().withName("c").withTier(SignalRSkuTier.STANDARD).withCapacity(1660457179)) - .withKind(ServiceKind.RAW_WEB_SOCKETS) + .define("hkbffmbm") + .withRegion("qpswokmvkhlggdhb") + .withExistingResourceGroup("eqvhpsylkk") + .withTags( + mapOf("jfpgpicrmn", "qkzszuwiwtglxxh", "mqgjsxvpq", "hr", "bakclacjfrnxous", "bfrmbodthsqqgvri")) + .withSku( + new ResourceSku().withName("jrgywwpgjxsn").withTier(SignalRSkuTier.FREE).withCapacity(1448697041)) + .withKind(ServiceKind.SIGNALR) .withIdentity( new ManagedIdentity() - .withType(ManagedIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities(mapOf())) + .withType(ManagedIdentityType.NONE) + .withUserAssignedIdentities(mapOf("jrmzvupor", new UserAssignedIdentityProperty()))) .withTls(new SignalRTlsSettings().withClientCertEnabled(false)) - .withFeatures(Arrays.asList()) + .withFeatures( + Arrays + .asList( + new SignalRFeature() + .withFlag(FeatureFlags.ENABLE_MESSAGING_LOGS) + .withValue("tu") + .withProperties(mapOf("hsyrqunj", "fjkwrusnkq", "akdkifmjnnawtqab", "hdenxaulk")))) .withLiveTraceConfiguration( - new LiveTraceConfiguration().withEnabled("uximerqfobw").withCategories(Arrays.asList())) - .withResourceLogConfiguration(new ResourceLogConfiguration().withCategories(Arrays.asList())) - .withCors(new SignalRCorsSettings().withAllowedOrigins(Arrays.asList())) - .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(189482477)) - .withUpstream(new ServerlessUpstreamSettings().withTemplates(Arrays.asList())) + new LiveTraceConfiguration() + .withEnabled("ckpggqoweyird") + .withCategories( + Arrays + .asList( + new LiveTraceCategory().withName("ngwflqqmpizruwn").withEnabled("xpxiwfcngjs"), + new LiveTraceCategory().withName("sii").withEnabled("mkzjvkviir"), + new LiveTraceCategory().withName("fgrwsdpgratzvz").withEnabled("lbyvictctbrxkjzw"), + new LiveTraceCategory().withName("xff").withEnabled("hkwfbkgozxwop")))) + .withResourceLogConfiguration( + new ResourceLogConfiguration() + .withCategories( + Arrays + .asList( + new ResourceLogCategory().withName("izqaclnapxbiyg").withEnabled("gjkn"), + new ResourceLogCategory().withName("mfcttux").withEnabled("yilflqoiquvrehmr")))) + .withCors( + new SignalRCorsSettings() + .withAllowedOrigins(Arrays.asList("sujz", "czytqjtwhauunfpr", "jletlxsmrpddo", "ifamowazi"))) + .withServerless(new ServerlessSettings().withConnectionTimeoutInSeconds(885106452)) + .withUpstream( + new ServerlessUpstreamSettings() + .withTemplates( + Arrays + .asList( + new UpstreamTemplate() + .withHubPattern("dvpiwh") + .withEventPattern("szdtmaajquh") + .withCategoryPattern("ylr") + .withUrlTemplate("vmtygj") + .withAuth(new UpstreamAuthSettings()), + new UpstreamTemplate() + .withHubPattern("yospspshc") + .withEventPattern("kyjpmspbps") + .withCategoryPattern("fppyogtieyujtvcz") + .withUrlTemplate("cnyxrxmunjd") + .withAuth(new UpstreamAuthSettings())))) .withNetworkACLs( - new SignalRNetworkACLs().withDefaultAction(AclAction.DENY).withPrivateEndpoints(Arrays.asList())) - .withPublicNetworkAccess("hrskdsnfd") + new SignalRNetworkACLs() + .withDefaultAction(AclAction.DENY) + .withPublicNetwork( + new NetworkAcl() + .withAllow(Arrays.asList(SignalRRequestType.TRACE)) + .withDeny( + Arrays + .asList( + SignalRRequestType.TRACE, + SignalRRequestType.RESTAPI, + SignalRRequestType.RESTAPI))) + .withPrivateEndpoints( + Arrays + .asList( + new PrivateEndpointAcl() + .withAllow(Arrays.asList(SignalRRequestType.CLIENT_CONNECTION)) + .withDeny(Arrays.asList(SignalRRequestType.TRACE, SignalRRequestType.RESTAPI)) + .withName("vbgkcvkhpzv"), + new PrivateEndpointAcl() + .withAllow( + Arrays + .asList( + SignalRRequestType.RESTAPI, + SignalRRequestType.CLIENT_CONNECTION, + SignalRRequestType.CLIENT_CONNECTION)) + .withDeny(Arrays.asList(SignalRRequestType.TRACE)) + .withName("iypfp")))) + .withPublicNetworkAccess("vhjknidi") .withDisableLocalAuth(true) - .withDisableAadAuth(true) + .withDisableAadAuth(false) .create(); - Assertions.assertEquals("ftswibyrcdlbhsh", response.location()); - Assertions.assertEquals("racstwity", response.tags().get("hevxcced")); - Assertions.assertEquals("mzqhoftrmaequi", response.sku().name()); + Assertions.assertEquals("fqyggagflnlgmtr", response.location()); + Assertions.assertEquals("zjmucftbyrplroh", response.tags().get("pigqfusuckzmkw")); + Assertions.assertEquals("mmkjsvthnwpztek", response.sku().name()); Assertions.assertEquals(SignalRSkuTier.BASIC, response.sku().tier()); - Assertions.assertEquals(185919180, response.sku().capacity()); + Assertions.assertEquals(821874250, response.sku().capacity()); Assertions.assertEquals(ServiceKind.RAW_WEB_SOCKETS, response.kind()); - Assertions.assertEquals(ManagedIdentityType.NONE, response.identity().type()); - Assertions.assertEquals(true, response.tls().clientCertEnabled()); - Assertions.assertEquals("emhzrncsdtc", response.liveTraceConfiguration().enabled()); - Assertions.assertEquals(1674447280, response.serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals(ManagedIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + Assertions.assertEquals(false, response.tls().clientCertEnabled()); + Assertions.assertEquals(FeatureFlags.ENABLE_CONNECTIVITY_LOGS, response.features().get(0).flag()); + Assertions.assertEquals("fjgtixrjvzuy", response.features().get(0).value()); + Assertions.assertEquals("mlmuowol", response.features().get(0).properties().get("au")); + Assertions.assertEquals("coi", response.liveTraceConfiguration().enabled()); + Assertions.assertEquals("ncnwfepbnwgf", response.liveTraceConfiguration().categories().get(0).name()); + Assertions.assertEquals("jgcgbjbgdlfgtdys", response.liveTraceConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("nseqacjjvp", response.resourceLogConfiguration().categories().get(0).name()); + Assertions.assertEquals("guooqjagmdit", response.resourceLogConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("qacsl", response.cors().allowedOrigins().get(0)); + Assertions.assertEquals(818366731, response.serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("xofvcjk", response.upstream().templates().get(0).hubPattern()); + Assertions.assertEquals("irazftxejwabmd", response.upstream().templates().get(0).eventPattern()); + Assertions.assertEquals("tmvcop", response.upstream().templates().get(0).categoryPattern()); + Assertions.assertEquals("xcmjurbu", response.upstream().templates().get(0).urlTemplate()); Assertions.assertEquals(AclAction.ALLOW, response.networkACLs().defaultAction()); - Assertions.assertEquals("eadcygqukyhejhz", response.publicNetworkAccess()); + Assertions + .assertEquals(SignalRRequestType.SERVER_CONNECTION, response.networkACLs().publicNetwork().allow().get(0)); + Assertions + .assertEquals(SignalRRequestType.CLIENT_CONNECTION, response.networkACLs().publicNetwork().deny().get(0)); + Assertions + .assertEquals( + SignalRRequestType.SERVER_CONNECTION, response.networkACLs().privateEndpoints().get(0).allow().get(0)); + Assertions + .assertEquals(SignalRRequestType.TRACE, response.networkACLs().privateEndpoints().get(0).deny().get(0)); + Assertions.assertEquals("xfz", response.networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("qikczvvita", response.publicNetworkAccess()); Assertions.assertEquals(true, response.disableLocalAuth()); - Assertions.assertEquals(false, response.disableAadAuth()); + Assertions.assertEquals(true, response.disableAadAuth()); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsDeleteMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsDeleteMockTests.java index bdf66b138611..eb3eb4eb9004 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsDeleteMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsDeleteMockTests.java @@ -56,6 +56,6 @@ public void testDelete() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - manager.signalRs().delete("aznqntoru", "sgsahmkycgr", com.azure.core.util.Context.NONE); + manager.signalRs().delete("f", "kqscazuawxtzx", com.azure.core.util.Context.NONE); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsGetByResourceGroupWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsGetByResourceGroupWithResponseMockTests.java index 0fbae1f9b498..7bb2852da831 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsGetByResourceGroupWithResponseMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsGetByResourceGroupWithResponseMockTests.java @@ -13,8 +13,10 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.signalr.SignalRManager; import com.azure.resourcemanager.signalr.models.AclAction; +import com.azure.resourcemanager.signalr.models.FeatureFlags; import com.azure.resourcemanager.signalr.models.ManagedIdentityType; import com.azure.resourcemanager.signalr.models.ServiceKind; +import com.azure.resourcemanager.signalr.models.SignalRRequestType; import com.azure.resourcemanager.signalr.models.SignalRResource; import com.azure.resourcemanager.signalr.models.SignalRSkuTier; import java.nio.ByteBuffer; @@ -35,7 +37,7 @@ public void testGetByResourceGroupWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"sku\":{\"name\":\"wj\",\"tier\":\"Free\",\"size\":\"kacjvefkdlfo\",\"family\":\"ggkfpagaowpul\",\"capacity\":1177485669},\"properties\":{\"provisioningState\":\"Updating\",\"externalIP\":\"yxkqjnsjer\",\"hostName\":\"iagxsdszuempsbz\",\"publicPort\":71389459,\"serverPort\":1389741266,\"version\":\"v\",\"privateEndpointConnections\":[],\"sharedPrivateLinkResources\":[],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"kjj\",\"features\":[],\"liveTraceConfiguration\":{\"enabled\":\"uukzclewyhmlw\",\"categories\":[]},\"resourceLogConfiguration\":{\"categories\":[]},\"cors\":{\"allowedOrigins\":[]},\"serverless\":{\"connectionTimeoutInSeconds\":1158924531},\"upstream\":{\"templates\":[]},\"networkACLs\":{\"defaultAction\":\"Deny\",\"privateEndpoints\":[]},\"publicNetworkAccess\":\"whxxbuyqax\",\"disableLocalAuth\":false,\"disableAadAuth\":true},\"kind\":\"SignalR\",\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{},\"principalId\":\"or\",\"tenantId\":\"lt\"},\"location\":\"mncwsobqwcsdb\",\"tags\":{\"ucqdpfuvglsb\":\"cf\",\"cormr\":\"jcanvxbvtvudut\",\"f\":\"xqtvcofu\"},\"id\":\"vkg\",\"name\":\"u\",\"type\":\"gdknnqv\"}"; + "{\"sku\":{\"name\":\"dvruzslzojhpctf\",\"tier\":\"Basic\",\"size\":\"otngfdgu\",\"family\":\"yzihgrkyuizabsn\",\"capacity\":1225103578},\"properties\":{\"provisioningState\":\"Succeeded\",\"externalIP\":\"eevy\",\"hostName\":\"hsgz\",\"publicPort\":296401749,\"serverPort\":396816762,\"version\":\"mfg\",\"privateEndpointConnections\":[{\"properties\":{\"provisioningState\":\"Deleting\",\"privateEndpoint\":{},\"groupIds\":[\"hibetnluankrr\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"eebtijvacvb\",\"name\":\"qzbqqxlajrnwxa\",\"type\":\"evehjkuyxoaf\"},{\"properties\":{\"provisioningState\":\"Moving\",\"privateEndpoint\":{},\"groupIds\":[\"aeylinm\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"xirpghriy\",\"name\":\"oqeyhlqhykprl\",\"type\":\"yznuciqd\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"iitdfuxt\",\"privateLinkResourceId\":\"asiibmiybnnust\",\"provisioningState\":\"Updating\",\"requestMessage\":\"hnmgixhcm\",\"status\":\"Approved\"},\"id\":\"qfoudorhcgyy\",\"name\":\"rotwypundmbxhugc\",\"type\":\"jkavl\"}],\"tls\":{\"clientCertEnabled\":false},\"hostNamePrefix\":\"ftpmdtzfjltfv\",\"features\":[{\"flag\":\"ServiceMode\",\"value\":\"jtotpvopvpbd\",\"properties\":{\"mkyi\":\"gqqihedsvqwt\",\"qcwdhoh\":\"cysihs\",\"sufco\":\"dtmcd\",\"vhdbevwqqxey\":\"dxbzlmcmuap\"}},{\"flag\":\"ServiceMode\",\"value\":\"onqzinkfkbgbzbow\",\"properties\":{\"ljmygvkzqkjjeokb\":\"o\"}},{\"flag\":\"EnableLiveTrace\",\"value\":\"fezrx\",\"properties\":{\"wvz\":\"urtleipqxb\",\"noda\":\"nzvdfbzdixzmq\",\"sbostzel\":\"opqhewjptmc\",\"tmzlbiojlv\":\"dlat\"}}],\"liveTraceConfiguration\":{\"enabled\":\"bbpneqvcwwy\",\"categories\":[{\"name\":\"ochpprpr\",\"enabled\":\"mo\"}]},\"resourceLogConfiguration\":{\"categories\":[{\"name\":\"jnhlbkpbzpcpiljh\",\"enabled\":\"zv\"},{\"name\":\"h\",\"enabled\":\"bnwieholew\"}]},\"cors\":{\"allowedOrigins\":[\"ubwefqs\"]},\"serverless\":{\"connectionTimeoutInSeconds\":1697750371},\"upstream\":{\"templates\":[{\"hubPattern\":\"rrqwexjk\",\"eventPattern\":\"xap\",\"categoryPattern\":\"og\",\"urlTemplate\":\"qnobp\",\"auth\":{}}]},\"networkACLs\":{\"defaultAction\":\"Deny\",\"publicNetwork\":{\"allow\":[\"ServerConnection\",\"ServerConnection\",\"RESTAPI\",\"RESTAPI\"],\"deny\":[\"Trace\",\"Trace\",\"Trace\"]},\"privateEndpoints\":[{\"name\":\"bucljgkyexaogu\",\"allow\":[\"ClientConnection\"],\"deny\":[\"RESTAPI\",\"Trace\",\"ClientConnection\",\"RESTAPI\"]},{\"name\":\"ltxijjumfqwazln\",\"allow\":[\"Trace\"],\"deny\":[\"RESTAPI\"]},{\"name\":\"zqdqxt\",\"allow\":[\"ClientConnection\",\"Trace\",\"ClientConnection\",\"Trace\"],\"deny\":[\"RESTAPI\"]},{\"name\":\"zsvtuikzhajqgl\",\"allow\":[\"RESTAPI\"],\"deny\":[\"ServerConnection\",\"RESTAPI\",\"ServerConnection\"]}]},\"publicNetworkAccess\":\"y\",\"disableLocalAuth\":true,\"disableAadAuth\":false},\"kind\":\"SignalR\",\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"vntjlrigjk\":{\"principalId\":\"nptgoeiybba\",\"clientId\":\"fhvfsl\"},\"xwaabzmifrygznmm\":{\"principalId\":\"yrio\",\"clientId\":\"zid\"},\"opxlhslnelxieixy\":{\"principalId\":\"ri\",\"clientId\":\"zob\"}},\"principalId\":\"lxecwcrojphslh\",\"tenantId\":\"wjutifdwfmv\"},\"location\":\"orq\",\"tags\":{\"aglkafhon\":\"tzh\",\"ickpz\":\"juj\"},\"id\":\"cpopmxel\",\"name\":\"wcltyjede\",\"type\":\"xm\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -66,22 +68,43 @@ public void testGetByResourceGroupWithResponse() throws Exception { SignalRResource response = manager .signalRs() - .getByResourceGroupWithResponse("emmsbvdkc", "odtji", com.azure.core.util.Context.NONE) + .getByResourceGroupWithResponse("rzpasccbiuimzdly", "dfqwmkyoq", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("mncwsobqwcsdb", response.location()); - Assertions.assertEquals("cf", response.tags().get("ucqdpfuvglsb")); - Assertions.assertEquals("wj", response.sku().name()); - Assertions.assertEquals(SignalRSkuTier.FREE, response.sku().tier()); - Assertions.assertEquals(1177485669, response.sku().capacity()); + Assertions.assertEquals("orq", response.location()); + Assertions.assertEquals("tzh", response.tags().get("aglkafhon")); + Assertions.assertEquals("dvruzslzojhpctf", response.sku().name()); + Assertions.assertEquals(SignalRSkuTier.BASIC, response.sku().tier()); + Assertions.assertEquals(1225103578, response.sku().capacity()); Assertions.assertEquals(ServiceKind.SIGNALR, response.kind()); - Assertions.assertEquals(ManagedIdentityType.SYSTEM_ASSIGNED, response.identity().type()); - Assertions.assertEquals(true, response.tls().clientCertEnabled()); - Assertions.assertEquals("uukzclewyhmlw", response.liveTraceConfiguration().enabled()); - Assertions.assertEquals(1158924531, response.serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals(ManagedIdentityType.NONE, response.identity().type()); + Assertions.assertEquals(false, response.tls().clientCertEnabled()); + Assertions.assertEquals(FeatureFlags.SERVICE_MODE, response.features().get(0).flag()); + Assertions.assertEquals("jtotpvopvpbd", response.features().get(0).value()); + Assertions.assertEquals("gqqihedsvqwt", response.features().get(0).properties().get("mkyi")); + Assertions.assertEquals("bbpneqvcwwy", response.liveTraceConfiguration().enabled()); + Assertions.assertEquals("ochpprpr", response.liveTraceConfiguration().categories().get(0).name()); + Assertions.assertEquals("mo", response.liveTraceConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("jnhlbkpbzpcpiljh", response.resourceLogConfiguration().categories().get(0).name()); + Assertions.assertEquals("zv", response.resourceLogConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("ubwefqs", response.cors().allowedOrigins().get(0)); + Assertions.assertEquals(1697750371, response.serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("rrqwexjk", response.upstream().templates().get(0).hubPattern()); + Assertions.assertEquals("xap", response.upstream().templates().get(0).eventPattern()); + Assertions.assertEquals("og", response.upstream().templates().get(0).categoryPattern()); + Assertions.assertEquals("qnobp", response.upstream().templates().get(0).urlTemplate()); Assertions.assertEquals(AclAction.DENY, response.networkACLs().defaultAction()); - Assertions.assertEquals("whxxbuyqax", response.publicNetworkAccess()); - Assertions.assertEquals(false, response.disableLocalAuth()); - Assertions.assertEquals(true, response.disableAadAuth()); + Assertions + .assertEquals(SignalRRequestType.SERVER_CONNECTION, response.networkACLs().publicNetwork().allow().get(0)); + Assertions.assertEquals(SignalRRequestType.TRACE, response.networkACLs().publicNetwork().deny().get(0)); + Assertions + .assertEquals( + SignalRRequestType.CLIENT_CONNECTION, response.networkACLs().privateEndpoints().get(0).allow().get(0)); + Assertions + .assertEquals(SignalRRequestType.RESTAPI, response.networkACLs().privateEndpoints().get(0).deny().get(0)); + Assertions.assertEquals("bucljgkyexaogu", response.networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("y", response.publicNetworkAccess()); + Assertions.assertEquals(true, response.disableLocalAuth()); + Assertions.assertEquals(false, response.disableAadAuth()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListByResourceGroupMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListByResourceGroupMockTests.java index b2aa61e1d708..119f789f83ea 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListByResourceGroupMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListByResourceGroupMockTests.java @@ -14,8 +14,10 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.signalr.SignalRManager; import com.azure.resourcemanager.signalr.models.AclAction; +import com.azure.resourcemanager.signalr.models.FeatureFlags; import com.azure.resourcemanager.signalr.models.ManagedIdentityType; import com.azure.resourcemanager.signalr.models.ServiceKind; +import com.azure.resourcemanager.signalr.models.SignalRRequestType; import com.azure.resourcemanager.signalr.models.SignalRResource; import com.azure.resourcemanager.signalr.models.SignalRSkuTier; import java.nio.ByteBuffer; @@ -36,7 +38,7 @@ public void testListByResourceGroup() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"sku\":{\"name\":\"r\",\"tier\":\"Premium\",\"size\":\"mjsjqb\",\"family\":\"hyxxrwlycoduhpk\",\"capacity\":1440361385},\"properties\":{\"provisioningState\":\"Moving\",\"externalIP\":\"eqnajxqugjhkycu\",\"hostName\":\"ddg\",\"publicPort\":947899145,\"serverPort\":583924547,\"version\":\"mzqa\",\"privateEndpointConnections\":[],\"sharedPrivateLinkResources\":[],\"tls\":{\"clientCertEnabled\":false},\"hostNamePrefix\":\"xacqqudfnbyx\",\"features\":[],\"liveTraceConfiguration\":{\"enabled\":\"jyvayffimrzrtuz\",\"categories\":[]},\"resourceLogConfiguration\":{\"categories\":[]},\"cors\":{\"allowedOrigins\":[]},\"serverless\":{\"connectionTimeoutInSeconds\":2124595132},\"upstream\":{\"templates\":[]},\"networkACLs\":{\"defaultAction\":\"Allow\",\"privateEndpoints\":[]},\"publicNetworkAccess\":\"wzsyyceuzs\",\"disableLocalAuth\":true,\"disableAadAuth\":false},\"kind\":\"RawWebSockets\",\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{},\"principalId\":\"hzv\",\"tenantId\":\"tdwkqbrq\"},\"location\":\"paxh\",\"tags\":{\"ivpdtiir\":\"i\",\"yfxrx\":\"tdqoaxoruzfgsq\",\"ptramxj\":\"l\",\"nwxuqlcvydyp\":\"zwl\"},\"id\":\"tdooaoj\",\"name\":\"niodkooeb\",\"type\":\"nuj\"}]}"; + "{\"value\":[{\"sku\":{\"name\":\"tpiymerteea\",\"tier\":\"Premium\",\"size\":\"iekkkzddrtkgdojb\",\"family\":\"vavrefdees\",\"capacity\":1645748788},\"properties\":{\"provisioningState\":\"Succeeded\",\"externalIP\":\"xtxsuwprtujw\",\"hostName\":\"wddji\",\"publicPort\":708427980,\"serverPort\":695573054,\"version\":\"titvtzeexavox\",\"privateEndpointConnections\":[{\"properties\":{\"provisioningState\":\"Failed\",\"privateEndpoint\":{},\"groupIds\":[\"qbw\",\"ypq\",\"gsfjac\",\"slhhxudbxv\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"tnsi\",\"name\":\"ud\",\"type\":\"z\"},{\"properties\":{\"provisioningState\":\"Creating\",\"privateEndpoint\":{},\"groupIds\":[\"lpagzrcx\",\"a\",\"lc\",\"xwmdboxd\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"ft\",\"name\":\"fqob\",\"type\":\"jln\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"privateEndpoint\":{},\"groupIds\":[\"nhxk\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"ytnrzvuljraae\",\"name\":\"anokqgu\",\"type\":\"kjq\"},{\"properties\":{\"provisioningState\":\"Updating\",\"privateEndpoint\":{},\"groupIds\":[\"a\",\"xulcdisdos\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"jsvg\",\"name\":\"rwhryvycytd\",\"type\":\"lxgccknfnwmbtm\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"jdhttzaefedxi\",\"privateLinkResourceId\":\"ch\",\"provisioningState\":\"Canceled\",\"requestMessage\":\"m\",\"status\":\"Disconnected\"},\"id\":\"dqns\",\"name\":\"fzpbgtgkyl\",\"type\":\"dgh\"},{\"properties\":{\"groupId\":\"euutlwxezwzh\",\"privateLinkResourceId\":\"kvbwnhhtqlgeh\",\"provisioningState\":\"Moving\",\"requestMessage\":\"pifhpfeoajvgcxtx\",\"status\":\"Pending\"},\"id\":\"heafidlt\",\"name\":\"gsresmkssj\",\"type\":\"oiftxfkfwegprh\"},{\"properties\":{\"groupId\":\"ill\",\"privateLinkResourceId\":\"cbiqtgdqoh\",\"provisioningState\":\"Updating\",\"requestMessage\":\"ldrizetpwbra\",\"status\":\"Rejected\"},\"id\":\"ibph\",\"name\":\"qzmiza\",\"type\":\"a\"}],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"p\",\"features\":[{\"flag\":\"EnableLiveTrace\",\"value\":\"ha\",\"properties\":{\"opteecj\":\"lhjlmuoyxprimr\",\"zaum\":\"eislstvasylwx\"}},{\"flag\":\"EnableLiveTrace\",\"value\":\"oohgu\",\"properties\":{\"olbaemwmdx\":\"zboyjathwt\",\"f\":\"ebwjscjpahlxvea\",\"qcttadijaeukmrsi\":\"xnmwmqtibxyijddt\"}}],\"liveTraceConfiguration\":{\"enabled\":\"pndzaapmudqmeq\",\"categories\":[{\"name\":\"ibudqwy\",\"enabled\":\"beybpmzznrtffyaq\"}]},\"resourceLogConfiguration\":{\"categories\":[{\"name\":\"eioqaqhvse\",\"enabled\":\"uqyrxpdl\"},{\"name\":\"qlsismjqfrddg\",\"enabled\":\"quhiosrsjuivf\"},{\"name\":\"is\",\"enabled\":\"rnxzh\"},{\"name\":\"exrxzbujrtrhq\",\"enabled\":\"revkhgnlnzo\"}]},\"cors\":{\"allowedOrigins\":[\"piqywnc\",\"jtszcof\",\"zehtdhgb\"]},\"serverless\":{\"connectionTimeoutInSeconds\":255159443},\"upstream\":{\"templates\":[{\"hubPattern\":\"amurvzmlovuan\",\"eventPattern\":\"hcxlpm\",\"categoryPattern\":\"rbdkelvidiz\",\"urlTemplate\":\"zsdbccxjmon\",\"auth\":{}},{\"hubPattern\":\"nwncypuuw\",\"eventPattern\":\"tvuqjctzenkeifzz\",\"categoryPattern\":\"kdasvflyhbxcudch\",\"urlTemplate\":\"gsrboldforobw\",\"auth\":{}}]},\"networkACLs\":{\"defaultAction\":\"Deny\",\"publicNetwork\":{\"allow\":[\"Trace\",\"RESTAPI\",\"ServerConnection\"],\"deny\":[\"ServerConnection\",\"RESTAPI\",\"ClientConnection\",\"Trace\"]},\"privateEndpoints\":[{\"name\":\"odxeszabbela\",\"allow\":[\"ClientConnection\",\"ServerConnection\"],\"deny\":[\"RESTAPI\",\"ServerConnection\",\"RESTAPI\"]},{\"name\":\"rrwoycqucwyhahn\",\"allow\":[\"RESTAPI\",\"RESTAPI\",\"RESTAPI\"],\"deny\":[\"ServerConnection\"]}]},\"publicNetworkAccess\":\"svfuurutlwexxwl\",\"disableLocalAuth\":true,\"disableAadAuth\":false},\"kind\":\"RawWebSockets\",\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"q\":{\"principalId\":\"pqtybb\",\"clientId\":\"pgdakchzyvli\"},\"mysu\":{\"principalId\":\"kcxk\",\"clientId\":\"bn\"},\"pwcyyufmhr\":{\"principalId\":\"wq\",\"clientId\":\"tvlwijpsttexoq\"}},\"principalId\":\"cuwmqsp\",\"tenantId\":\"dqzh\"},\"location\":\"tddunqnd\",\"tags\":{\"jjrcgegydc\":\"chrqb\",\"olihrra\":\"boxjumvq\"},\"id\":\"ouau\",\"name\":\"rjtloq\",\"type\":\"fuojrngif\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -65,20 +67,58 @@ public void testListByResourceGroup() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); PagedIterable response = - manager.signalRs().listByResourceGroup("su", com.azure.core.util.Context.NONE); + manager.signalRs().listByResourceGroup("ffeycx", com.azure.core.util.Context.NONE); - Assertions.assertEquals("paxh", response.iterator().next().location()); - Assertions.assertEquals("i", response.iterator().next().tags().get("ivpdtiir")); - Assertions.assertEquals("r", response.iterator().next().sku().name()); + Assertions.assertEquals("tddunqnd", response.iterator().next().location()); + Assertions.assertEquals("chrqb", response.iterator().next().tags().get("jjrcgegydc")); + Assertions.assertEquals("tpiymerteea", response.iterator().next().sku().name()); Assertions.assertEquals(SignalRSkuTier.PREMIUM, response.iterator().next().sku().tier()); - Assertions.assertEquals(1440361385, response.iterator().next().sku().capacity()); + Assertions.assertEquals(1645748788, response.iterator().next().sku().capacity()); Assertions.assertEquals(ServiceKind.RAW_WEB_SOCKETS, response.iterator().next().kind()); Assertions.assertEquals(ManagedIdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type()); - Assertions.assertEquals(false, response.iterator().next().tls().clientCertEnabled()); - Assertions.assertEquals("jyvayffimrzrtuz", response.iterator().next().liveTraceConfiguration().enabled()); - Assertions.assertEquals(2124595132, response.iterator().next().serverless().connectionTimeoutInSeconds()); - Assertions.assertEquals(AclAction.ALLOW, response.iterator().next().networkACLs().defaultAction()); - Assertions.assertEquals("wzsyyceuzs", response.iterator().next().publicNetworkAccess()); + Assertions.assertEquals(true, response.iterator().next().tls().clientCertEnabled()); + Assertions.assertEquals(FeatureFlags.ENABLE_LIVE_TRACE, response.iterator().next().features().get(0).flag()); + Assertions.assertEquals("ha", response.iterator().next().features().get(0).value()); + Assertions + .assertEquals("lhjlmuoyxprimr", response.iterator().next().features().get(0).properties().get("opteecj")); + Assertions.assertEquals("pndzaapmudqmeq", response.iterator().next().liveTraceConfiguration().enabled()); + Assertions + .assertEquals("ibudqwy", response.iterator().next().liveTraceConfiguration().categories().get(0).name()); + Assertions + .assertEquals( + "beybpmzznrtffyaq", response.iterator().next().liveTraceConfiguration().categories().get(0).enabled()); + Assertions + .assertEquals( + "eioqaqhvse", response.iterator().next().resourceLogConfiguration().categories().get(0).name()); + Assertions + .assertEquals( + "uqyrxpdl", response.iterator().next().resourceLogConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("piqywnc", response.iterator().next().cors().allowedOrigins().get(0)); + Assertions.assertEquals(255159443, response.iterator().next().serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("amurvzmlovuan", response.iterator().next().upstream().templates().get(0).hubPattern()); + Assertions.assertEquals("hcxlpm", response.iterator().next().upstream().templates().get(0).eventPattern()); + Assertions + .assertEquals("rbdkelvidiz", response.iterator().next().upstream().templates().get(0).categoryPattern()); + Assertions.assertEquals("zsdbccxjmon", response.iterator().next().upstream().templates().get(0).urlTemplate()); + Assertions.assertEquals(AclAction.DENY, response.iterator().next().networkACLs().defaultAction()); + Assertions + .assertEquals( + SignalRRequestType.TRACE, response.iterator().next().networkACLs().publicNetwork().allow().get(0)); + Assertions + .assertEquals( + SignalRRequestType.SERVER_CONNECTION, + response.iterator().next().networkACLs().publicNetwork().deny().get(0)); + Assertions + .assertEquals( + SignalRRequestType.CLIENT_CONNECTION, + response.iterator().next().networkACLs().privateEndpoints().get(0).allow().get(0)); + Assertions + .assertEquals( + SignalRRequestType.RESTAPI, + response.iterator().next().networkACLs().privateEndpoints().get(0).deny().get(0)); + Assertions + .assertEquals("odxeszabbela", response.iterator().next().networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("svfuurutlwexxwl", response.iterator().next().publicNetworkAccess()); Assertions.assertEquals(true, response.iterator().next().disableLocalAuth()); Assertions.assertEquals(false, response.iterator().next().disableAadAuth()); } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListMockTests.java index eb3aab60cf16..4a32bd508ed4 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListMockTests.java @@ -14,8 +14,10 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.resourcemanager.signalr.SignalRManager; import com.azure.resourcemanager.signalr.models.AclAction; +import com.azure.resourcemanager.signalr.models.FeatureFlags; import com.azure.resourcemanager.signalr.models.ManagedIdentityType; import com.azure.resourcemanager.signalr.models.ServiceKind; +import com.azure.resourcemanager.signalr.models.SignalRRequestType; import com.azure.resourcemanager.signalr.models.SignalRResource; import com.azure.resourcemanager.signalr.models.SignalRSkuTier; import java.nio.ByteBuffer; @@ -36,7 +38,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"sku\":{\"name\":\"yrnxxmueedn\",\"tier\":\"Basic\",\"size\":\"stkwqqtch\",\"family\":\"lmfmtdaay\",\"capacity\":76843266},\"properties\":{\"provisioningState\":\"Moving\",\"externalIP\":\"iohgwxrtfud\",\"hostName\":\"pxgy\",\"publicPort\":581712977,\"serverPort\":1910249555,\"version\":\"mnpkukghimdblxg\",\"privateEndpointConnections\":[],\"sharedPrivateLinkResources\":[],\"tls\":{\"clientCertEnabled\":false},\"hostNamePrefix\":\"xw\",\"features\":[],\"liveTraceConfiguration\":{\"enabled\":\"foqreyfkzik\",\"categories\":[]},\"resourceLogConfiguration\":{\"categories\":[]},\"cors\":{\"allowedOrigins\":[]},\"serverless\":{\"connectionTimeoutInSeconds\":841259449},\"upstream\":{\"templates\":[]},\"networkACLs\":{\"defaultAction\":\"Deny\",\"privateEndpoints\":[]},\"publicNetworkAccess\":\"irels\",\"disableLocalAuth\":false,\"disableAadAuth\":true},\"kind\":\"SignalR\",\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{},\"principalId\":\"ddxbjhwuaanoz\",\"tenantId\":\"sphyoulpjrvxa\"},\"location\":\"rvimjwosytxitcsk\",\"tags\":{\"miekkezzikhlyfjh\":\"tq\"},\"id\":\"gqggebdunygae\",\"name\":\"idb\",\"type\":\"fatpxllrxcyjmoa\"}]}"; + "{\"value\":[{\"sku\":{\"name\":\"bunzozudh\",\"tier\":\"Premium\",\"size\":\"moy\",\"family\":\"dyuib\",\"capacity\":595382657},\"properties\":{\"provisioningState\":\"Creating\",\"externalIP\":\"ydvfvfcjnae\",\"hostName\":\"srvhmgorffuki\",\"publicPort\":1917370345,\"serverPort\":1204565564,\"version\":\"hwplefaxvx\",\"privateEndpointConnections\":[{\"properties\":{\"provisioningState\":\"Creating\",\"privateEndpoint\":{},\"groupIds\":[\"zeyqxtjjfzqlqhyc\",\"vodggxdbee\",\"mieknlraria\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"uagydwqfbylyrf\",\"name\":\"iagtc\",\"type\":\"jocqwogfnzjvusf\"},{\"properties\":{\"provisioningState\":\"Running\",\"privateEndpoint\":{},\"groupIds\":[\"xylfsb\",\"kadpysown\",\"tgkbugrjqctojc\",\"isofieypefojyqd\"],\"privateLinkServiceConnectionState\":{}},\"id\":\"plcplcwkhi\",\"name\":\"ihlhzdsqtzb\",\"type\":\"rgnowcjhfgm\"}],\"sharedPrivateLinkResources\":[{\"properties\":{\"groupId\":\"ctxmwoteyowcluq\",\"privateLinkResourceId\":\"vekqvgqo\",\"provisioningState\":\"Running\",\"requestMessage\":\"zmpjwyiv\",\"status\":\"Approved\"},\"id\":\"f\",\"name\":\"cvhrfsp\",\"type\":\"uagrttikteusqc\"}],\"tls\":{\"clientCertEnabled\":true},\"hostNamePrefix\":\"lxubyj\",\"features\":[{\"flag\":\"EnableLiveTrace\",\"value\":\"mfblcqcuubg\",\"properties\":{\"t\":\"rtalmet\"}},{\"flag\":\"EnableLiveTrace\",\"value\":\"dslqxihhrmooizqs\",\"properties\":{\"pzhyr\":\"xiutcx\",\"joxslhvnhla\":\"etoge\"}},{\"flag\":\"EnableMessagingLogs\",\"value\":\"q\",\"properties\":{\"aehvvibrxjjstoq\":\"zjcjbtr\",\"bklftidgfcwqmpim\":\"eitpkxztmo\",\"yhohujswtwkozzwc\":\"qxzhem\"}}],\"liveTraceConfiguration\":{\"enabled\":\"bawpfajnjwltlwt\",\"categories\":[{\"name\":\"ktalhsnvkcdmxz\",\"enabled\":\"oaimlnw\"}]},\"resourceLogConfiguration\":{\"categories\":[{\"name\":\"ylweazulc\",\"enabled\":\"thwwn\"},{\"name\":\"hlf\",\"enabled\":\"wpchwahf\"}]},\"cors\":{\"allowedOrigins\":[\"nfepgf\",\"wetwlyxgncxykxh\",\"jhlimmbcxfhbcpo\",\"xvxcjzhq\"]},\"serverless\":{\"connectionTimeoutInSeconds\":1212582847},\"upstream\":{\"templates\":[{\"hubPattern\":\"qscjavftjuh\",\"eventPattern\":\"azkmtgguwp\",\"categoryPattern\":\"r\",\"urlTemplate\":\"jcivmmg\",\"auth\":{}},{\"hubPattern\":\"fiwrxgkn\",\"eventPattern\":\"vyi\",\"categoryPattern\":\"qodfvp\",\"urlTemplate\":\"shoxgsgb\",\"auth\":{}},{\"hubPattern\":\"zdjtxvzflbqv\",\"eventPattern\":\"qvlgafcqusrdvetn\",\"categoryPattern\":\"dtutnwldu\",\"urlTemplate\":\"cvuzhyrmewipmve\",\"auth\":{}},{\"hubPattern\":\"ukuqgsj\",\"eventPattern\":\"undxgketw\",\"categoryPattern\":\"hzjhf\",\"urlTemplate\":\"mhv\",\"auth\":{}}]},\"networkACLs\":{\"defaultAction\":\"Deny\",\"publicNetwork\":{\"allow\":[\"ServerConnection\",\"ClientConnection\",\"ServerConnection\"],\"deny\":[\"ServerConnection\",\"ServerConnection\"]},\"privateEndpoints\":[{\"name\":\"buzjyih\",\"allow\":[\"ClientConnection\",\"Trace\"],\"deny\":[\"ClientConnection\"]},{\"name\":\"pohyuemslynsqyr\",\"allow\":[\"ServerConnection\",\"Trace\",\"Trace\"],\"deny\":[\"ClientConnection\",\"ClientConnection\"]},{\"name\":\"msjnygqdnfw\",\"allow\":[\"ServerConnection\",\"ServerConnection\"],\"deny\":[\"ClientConnection\",\"ServerConnection\"]}]},\"publicNetworkAccess\":\"hnfhqlyvijouwi\",\"disableLocalAuth\":true,\"disableAadAuth\":true},\"kind\":\"SignalR\",\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"lrcivtsoxfrke\":{\"principalId\":\"ti\",\"clientId\":\"cpwpg\"},\"lkzmegnitgvkxl\":{\"principalId\":\"pmyyefrpmpdnqq\",\"clientId\":\"awaoqvmmbnpqfrt\"},\"lwigdivbkbx\":{\"principalId\":\"qdrfegcealzxwhc\",\"clientId\":\"symoyq\"},\"e\":{\"principalId\":\"mf\",\"clientId\":\"uwasqvd\"}},\"principalId\":\"guxak\",\"tenantId\":\"qzhzbezkgimsi\"},\"location\":\"asi\",\"tags\":{\"wa\":\"yvvjskgfmo\",\"tjeaahhvjhh\":\"pqg\",\"bbjjidjksyxk\":\"akz\",\"euaulxu\":\"xvxevblbjednljla\"},\"id\":\"smjbnkppxyn\",\"name\":\"nlsvxeiz\",\"type\":\"gwklnsr\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -66,19 +68,54 @@ public void testList() throws Exception { PagedIterable response = manager.signalRs().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("rvimjwosytxitcsk", response.iterator().next().location()); - Assertions.assertEquals("tq", response.iterator().next().tags().get("miekkezzikhlyfjh")); - Assertions.assertEquals("yrnxxmueedn", response.iterator().next().sku().name()); - Assertions.assertEquals(SignalRSkuTier.BASIC, response.iterator().next().sku().tier()); - Assertions.assertEquals(76843266, response.iterator().next().sku().capacity()); + Assertions.assertEquals("asi", response.iterator().next().location()); + Assertions.assertEquals("yvvjskgfmo", response.iterator().next().tags().get("wa")); + Assertions.assertEquals("bunzozudh", response.iterator().next().sku().name()); + Assertions.assertEquals(SignalRSkuTier.PREMIUM, response.iterator().next().sku().tier()); + Assertions.assertEquals(595382657, response.iterator().next().sku().capacity()); Assertions.assertEquals(ServiceKind.SIGNALR, response.iterator().next().kind()); - Assertions.assertEquals(ManagedIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); - Assertions.assertEquals(false, response.iterator().next().tls().clientCertEnabled()); - Assertions.assertEquals("foqreyfkzik", response.iterator().next().liveTraceConfiguration().enabled()); - Assertions.assertEquals(841259449, response.iterator().next().serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals(ManagedIdentityType.NONE, response.iterator().next().identity().type()); + Assertions.assertEquals(true, response.iterator().next().tls().clientCertEnabled()); + Assertions.assertEquals(FeatureFlags.ENABLE_LIVE_TRACE, response.iterator().next().features().get(0).flag()); + Assertions.assertEquals("mfblcqcuubg", response.iterator().next().features().get(0).value()); + Assertions.assertEquals("rtalmet", response.iterator().next().features().get(0).properties().get("t")); + Assertions.assertEquals("bawpfajnjwltlwt", response.iterator().next().liveTraceConfiguration().enabled()); + Assertions + .assertEquals( + "ktalhsnvkcdmxz", response.iterator().next().liveTraceConfiguration().categories().get(0).name()); + Assertions + .assertEquals("oaimlnw", response.iterator().next().liveTraceConfiguration().categories().get(0).enabled()); + Assertions + .assertEquals( + "ylweazulc", response.iterator().next().resourceLogConfiguration().categories().get(0).name()); + Assertions + .assertEquals("thwwn", response.iterator().next().resourceLogConfiguration().categories().get(0).enabled()); + Assertions.assertEquals("nfepgf", response.iterator().next().cors().allowedOrigins().get(0)); + Assertions.assertEquals(1212582847, response.iterator().next().serverless().connectionTimeoutInSeconds()); + Assertions.assertEquals("qscjavftjuh", response.iterator().next().upstream().templates().get(0).hubPattern()); + Assertions.assertEquals("azkmtgguwp", response.iterator().next().upstream().templates().get(0).eventPattern()); + Assertions.assertEquals("r", response.iterator().next().upstream().templates().get(0).categoryPattern()); + Assertions.assertEquals("jcivmmg", response.iterator().next().upstream().templates().get(0).urlTemplate()); Assertions.assertEquals(AclAction.DENY, response.iterator().next().networkACLs().defaultAction()); - Assertions.assertEquals("irels", response.iterator().next().publicNetworkAccess()); - Assertions.assertEquals(false, response.iterator().next().disableLocalAuth()); + Assertions + .assertEquals( + SignalRRequestType.SERVER_CONNECTION, + response.iterator().next().networkACLs().publicNetwork().allow().get(0)); + Assertions + .assertEquals( + SignalRRequestType.SERVER_CONNECTION, + response.iterator().next().networkACLs().publicNetwork().deny().get(0)); + Assertions + .assertEquals( + SignalRRequestType.CLIENT_CONNECTION, + response.iterator().next().networkACLs().privateEndpoints().get(0).allow().get(0)); + Assertions + .assertEquals( + SignalRRequestType.CLIENT_CONNECTION, + response.iterator().next().networkACLs().privateEndpoints().get(0).deny().get(0)); + Assertions.assertEquals("buzjyih", response.iterator().next().networkACLs().privateEndpoints().get(0).name()); + Assertions.assertEquals("hnfhqlyvijouwi", response.iterator().next().publicNetworkAccess()); + Assertions.assertEquals(true, response.iterator().next().disableLocalAuth()); Assertions.assertEquals(true, response.iterator().next().disableAadAuth()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListReplicaSkusWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListReplicaSkusWithResponseMockTests.java new file mode 100644 index 000000000000..54cc6f74ed88 --- /dev/null +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListReplicaSkusWithResponseMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.signalr.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.signalr.SignalRManager; +import com.azure.resourcemanager.signalr.models.SkuList; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class SignalRsListReplicaSkusWithResponseMockTests { + @Test + public void testListReplicaSkusWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"resourceType\":\"wfgtayxonsup\",\"sku\":{\"name\":\"jlzqnhc\",\"tier\":\"Free\",\"size\":\"tnzoibgsxgnxfy\",\"family\":\"nmpqoxwdofdb\",\"capacity\":1852240045},\"capacity\":{\"minimum\":1307662729,\"maximum\":540908229,\"default\":941412266,\"allowedValues\":[1213641430,1466569067],\"scaleType\":\"Automatic\"}}],\"nextLink\":\"nhe\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SignalRManager manager = + SignalRManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + SkuList response = + manager + .signalRs() + .listReplicaSkusWithResponse("blmljh", "nymzotqyr", "uzcbmqq", com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListSkusWithResponseMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListSkusWithResponseMockTests.java index ef822b81f255..6c20f2459519 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListSkusWithResponseMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SignalRsListSkusWithResponseMockTests.java @@ -30,7 +30,7 @@ public void testListSkusWithResponse() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"resourceType\":\"puqujmqlgkfbtn\"},{\"resourceType\":\"n\"},{\"resourceType\":\"ntuji\"}],\"nextLink\":\"df\"}"; + "{\"value\":[{\"resourceType\":\"mbnkb\",\"sku\":{\"name\":\"qvxkd\",\"tier\":\"Basic\",\"size\":\"heb\",\"family\":\"swbzuwfmdurage\",\"capacity\":1912120593},\"capacity\":{\"minimum\":2034109305,\"maximum\":2073266063,\"default\":1132204031,\"allowedValues\":[1329122271],\"scaleType\":\"None\"}},{\"resourceType\":\"gbqi\",\"sku\":{\"name\":\"xkbsazgakgac\",\"tier\":\"Standard\",\"size\":\"jdmspofapvuhryln\",\"family\":\"frzgbzjed\",\"capacity\":1946171356},\"capacity\":{\"minimum\":247999147,\"maximum\":162758827,\"default\":1553181859,\"allowedValues\":[444730016,917017780,663058389,2051570067],\"scaleType\":\"Automatic\"}},{\"resourceType\":\"f\",\"sku\":{\"name\":\"snvpdibmi\",\"tier\":\"Free\",\"size\":\"bzbkiw\",\"family\":\"qnyophzfyls\",\"capacity\":362710224},\"capacity\":{\"minimum\":652938143,\"maximum\":734228564,\"default\":1369473795,\"allowedValues\":[691935711,262075273,12099501],\"scaleType\":\"Manual\"}},{\"resourceType\":\"w\",\"sku\":{\"name\":\"wl\",\"tier\":\"Standard\",\"size\":\"etnpsihcl\",\"family\":\"zvaylptrsqqw\",\"capacity\":794270999},\"capacity\":{\"minimum\":544384144,\"maximum\":899185817,\"default\":96806467,\"allowedValues\":[1038627609,719164524,816573779],\"scaleType\":\"Automatic\"}}],\"nextLink\":\"jkjexf\"}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -59,6 +59,6 @@ public void testListSkusWithResponse() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); SkuList response = - manager.signalRs().listSkusWithResponse("wabm", "oefki", com.azure.core.util.Context.NONE).getValue(); + manager.signalRs().listSkusWithResponse("f", "pofvwb", com.azure.core.util.Context.NONE).getValue(); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuCapacityTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuCapacityTests.java index 99f6f404bede..386134d76ccb 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuCapacityTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuCapacityTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { SkuCapacity model = BinaryData .fromString( - "{\"minimum\":1807196723,\"maximum\":706339919,\"default\":1505312764,\"allowedValues\":[1202446824,49969250,1940246801,1488672187],\"scaleType\":\"Automatic\"}") + "{\"minimum\":922777,\"maximum\":1941406807,\"default\":337262867,\"allowedValues\":[598557579,1811256055],\"scaleType\":\"Automatic\"}") .toObject(SkuCapacity.class); } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuListInnerTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuListInnerTests.java index 732e11e43276..64063b24221e 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuListInnerTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuListInnerTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { SkuListInner model = BinaryData .fromString( - "{\"value\":[{\"resourceType\":\"ipfpubji\",\"sku\":{\"name\":\"wifto\",\"tier\":\"Premium\",\"size\":\"puvks\",\"family\":\"lsa\",\"capacity\":931393503},\"capacity\":{\"minimum\":1486406311,\"maximum\":10368328,\"default\":962840058,\"allowedValues\":[],\"scaleType\":\"Automatic\"}},{\"resourceType\":\"pxodlqiyntorzih\",\"sku\":{\"name\":\"osjswsr\",\"tier\":\"Premium\",\"size\":\"zrpzb\",\"family\":\"ckqqzqioxiysui\",\"capacity\":2121235922},\"capacity\":{\"minimum\":2066516032,\"maximum\":1368967398,\"default\":2903501,\"allowedValues\":[],\"scaleType\":\"Manual\"}}],\"nextLink\":\"q\"}") + "{\"value\":[{\"resourceType\":\"hp\",\"sku\":{\"name\":\"oqcaaewdaomdj\",\"tier\":\"Basic\",\"size\":\"x\",\"family\":\"zb\",\"capacity\":2006830876},\"capacity\":{\"minimum\":1225406633,\"maximum\":1985792970,\"default\":542957889,\"allowedValues\":[1299849927,941654553],\"scaleType\":\"Automatic\"}},{\"resourceType\":\"dxonbzoggculap\",\"sku\":{\"name\":\"y\",\"tier\":\"Premium\",\"size\":\"gtqxep\",\"family\":\"lbfu\",\"capacity\":998565327},\"capacity\":{\"minimum\":1430433647,\"maximum\":21548435,\"default\":1326013393,\"allowedValues\":[746925062,811442311,1407902982,541182731],\"scaleType\":\"Automatic\"}}],\"nextLink\":\"fmo\"}") .toObject(SkuListInner.class); } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuTests.java index f1e4970e5e10..e2b79d380953 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/SkuTests.java @@ -13,7 +13,7 @@ public void testDeserialize() throws Exception { Sku model = BinaryData .fromString( - "{\"resourceType\":\"bzyh\",\"sku\":{\"name\":\"tsmypyynpcdp\",\"tier\":\"Standard\",\"size\":\"g\",\"family\":\"z\",\"capacity\":1417683929},\"capacity\":{\"minimum\":859745448,\"maximum\":1095888431,\"default\":1347586165,\"allowedValues\":[1287311603,1807799282],\"scaleType\":\"Automatic\"}}") + "{\"resourceType\":\"xrkjpvdw\",\"sku\":{\"name\":\"zwiivwzjbhyzs\",\"tier\":\"Basic\",\"size\":\"ambtrnegvm\",\"family\":\"uqeqv\",\"capacity\":1032256402},\"capacity\":{\"minimum\":312186085,\"maximum\":1828448975,\"default\":1481750195,\"allowedValues\":[1616776415,1749479057],\"scaleType\":\"Automatic\"}}") .toObject(Sku.class); } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UpstreamAuthSettingsTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UpstreamAuthSettingsTests.java index 18ba5497b317..f489121b7177 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UpstreamAuthSettingsTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UpstreamAuthSettingsTests.java @@ -15,10 +15,10 @@ public final class UpstreamAuthSettingsTests { public void testDeserialize() throws Exception { UpstreamAuthSettings model = BinaryData - .fromString("{\"type\":\"ManagedIdentity\",\"managedIdentity\":{\"resource\":\"gpfqbuace\"}}") + .fromString("{\"type\":\"ManagedIdentity\",\"managedIdentity\":{\"resource\":\"envrkpyouaibrebq\"}}") .toObject(UpstreamAuthSettings.class); Assertions.assertEquals(UpstreamAuthType.MANAGED_IDENTITY, model.type()); - Assertions.assertEquals("gpfqbuace", model.managedIdentity().resource()); + Assertions.assertEquals("envrkpyouaibrebq", model.managedIdentity().resource()); } @org.junit.jupiter.api.Test @@ -26,9 +26,9 @@ public void testSerialize() throws Exception { UpstreamAuthSettings model = new UpstreamAuthSettings() .withType(UpstreamAuthType.MANAGED_IDENTITY) - .withManagedIdentity(new ManagedIdentitySettings().withResource("gpfqbuace")); + .withManagedIdentity(new ManagedIdentitySettings().withResource("envrkpyouaibrebq")); model = BinaryData.fromObject(model).toObject(UpstreamAuthSettings.class); Assertions.assertEquals(UpstreamAuthType.MANAGED_IDENTITY, model.type()); - Assertions.assertEquals("gpfqbuace", model.managedIdentity().resource()); + Assertions.assertEquals("envrkpyouaibrebq", model.managedIdentity().resource()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UpstreamTemplateTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UpstreamTemplateTests.java index 571690ce7c81..b26786c0742b 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UpstreamTemplateTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UpstreamTemplateTests.java @@ -17,34 +17,34 @@ public void testDeserialize() throws Exception { UpstreamTemplate model = BinaryData .fromString( - "{\"hubPattern\":\"bnxknalaulppg\",\"eventPattern\":\"tpnapnyiropuhpig\",\"categoryPattern\":\"gylgqgitxmedjvcs\",\"urlTemplate\":\"ynqwwncwzzhxgk\",\"auth\":{\"type\":\"ManagedIdentity\",\"managedIdentity\":{\"resource\":\"napkteoellw\"}}}") + "{\"hubPattern\":\"elfk\",\"eventPattern\":\"plcrpwjxeznoig\",\"categoryPattern\":\"njwmwkpnbsazejj\",\"urlTemplate\":\"qkagfhsxt\",\"auth\":{\"type\":\"ManagedIdentity\",\"managedIdentity\":{\"resource\":\"nfaazpxdtnkdmkq\"}}}") .toObject(UpstreamTemplate.class); - Assertions.assertEquals("bnxknalaulppg", model.hubPattern()); - Assertions.assertEquals("tpnapnyiropuhpig", model.eventPattern()); - Assertions.assertEquals("gylgqgitxmedjvcs", model.categoryPattern()); - Assertions.assertEquals("ynqwwncwzzhxgk", model.urlTemplate()); + Assertions.assertEquals("elfk", model.hubPattern()); + Assertions.assertEquals("plcrpwjxeznoig", model.eventPattern()); + Assertions.assertEquals("njwmwkpnbsazejj", model.categoryPattern()); + Assertions.assertEquals("qkagfhsxt", model.urlTemplate()); Assertions.assertEquals(UpstreamAuthType.MANAGED_IDENTITY, model.auth().type()); - Assertions.assertEquals("napkteoellw", model.auth().managedIdentity().resource()); + Assertions.assertEquals("nfaazpxdtnkdmkq", model.auth().managedIdentity().resource()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { UpstreamTemplate model = new UpstreamTemplate() - .withHubPattern("bnxknalaulppg") - .withEventPattern("tpnapnyiropuhpig") - .withCategoryPattern("gylgqgitxmedjvcs") - .withUrlTemplate("ynqwwncwzzhxgk") + .withHubPattern("elfk") + .withEventPattern("plcrpwjxeznoig") + .withCategoryPattern("njwmwkpnbsazejj") + .withUrlTemplate("qkagfhsxt") .withAuth( new UpstreamAuthSettings() .withType(UpstreamAuthType.MANAGED_IDENTITY) - .withManagedIdentity(new ManagedIdentitySettings().withResource("napkteoellw"))); + .withManagedIdentity(new ManagedIdentitySettings().withResource("nfaazpxdtnkdmkq"))); model = BinaryData.fromObject(model).toObject(UpstreamTemplate.class); - Assertions.assertEquals("bnxknalaulppg", model.hubPattern()); - Assertions.assertEquals("tpnapnyiropuhpig", model.eventPattern()); - Assertions.assertEquals("gylgqgitxmedjvcs", model.categoryPattern()); - Assertions.assertEquals("ynqwwncwzzhxgk", model.urlTemplate()); + Assertions.assertEquals("elfk", model.hubPattern()); + Assertions.assertEquals("plcrpwjxeznoig", model.eventPattern()); + Assertions.assertEquals("njwmwkpnbsazejj", model.categoryPattern()); + Assertions.assertEquals("qkagfhsxt", model.urlTemplate()); Assertions.assertEquals(UpstreamAuthType.MANAGED_IDENTITY, model.auth().type()); - Assertions.assertEquals("napkteoellw", model.auth().managedIdentity().resource()); + Assertions.assertEquals("nfaazpxdtnkdmkq", model.auth().managedIdentity().resource()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UsagesListMockTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UsagesListMockTests.java index 3e019b5ad678..f4b87595318f 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UsagesListMockTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UsagesListMockTests.java @@ -32,7 +32,7 @@ public void testList() throws Exception { ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); String responseStr = - "{\"value\":[{\"id\":\"lmdjrkvfgbvfvpdb\",\"currentValue\":4035946330951713229,\"limit\":6841124205934226974,\"name\":{\"value\":\"lhkrribdeibqipqk\",\"localizedValue\":\"vxndz\"},\"unit\":\"krefajpjo\"}]}"; + "{\"value\":[{\"id\":\"oywjxhpdulont\",\"currentValue\":1352739998410853218,\"limit\":877103691312415497,\"name\":{\"value\":\"tuevrh\",\"localizedValue\":\"jyoogwxh\"},\"unit\":\"duugwbsre\"}]}"; Mockito.when(httpResponse.getStatusCode()).thenReturn(200); Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); @@ -60,13 +60,13 @@ public void testList() throws Exception { tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); - PagedIterable response = manager.usages().list("byqunyow", com.azure.core.util.Context.NONE); + PagedIterable response = manager.usages().list("xddbhfhpfpaz", com.azure.core.util.Context.NONE); - Assertions.assertEquals("lmdjrkvfgbvfvpdb", response.iterator().next().id()); - Assertions.assertEquals(4035946330951713229L, response.iterator().next().currentValue()); - Assertions.assertEquals(6841124205934226974L, response.iterator().next().limit()); - Assertions.assertEquals("lhkrribdeibqipqk", response.iterator().next().name().value()); - Assertions.assertEquals("vxndz", response.iterator().next().name().localizedValue()); - Assertions.assertEquals("krefajpjo", response.iterator().next().unit()); + Assertions.assertEquals("oywjxhpdulont", response.iterator().next().id()); + Assertions.assertEquals(1352739998410853218L, response.iterator().next().currentValue()); + Assertions.assertEquals(877103691312415497L, response.iterator().next().limit()); + Assertions.assertEquals("tuevrh", response.iterator().next().name().value()); + Assertions.assertEquals("jyoogwxh", response.iterator().next().name().localizedValue()); + Assertions.assertEquals("duugwbsre", response.iterator().next().unit()); } } diff --git a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UserAssignedIdentityPropertyTests.java b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UserAssignedIdentityPropertyTests.java index ab1de4361ca1..c6036d9e4e64 100644 --- a/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UserAssignedIdentityPropertyTests.java +++ b/sdk/signalr/azure-resourcemanager-signalr/src/test/java/com/azure/resourcemanager/signalr/generated/UserAssignedIdentityPropertyTests.java @@ -12,7 +12,7 @@ public final class UserAssignedIdentityPropertyTests { public void testDeserialize() throws Exception { UserAssignedIdentityProperty model = BinaryData - .fromString("{\"principalId\":\"taruoujmkcj\",\"clientId\":\"qytjrybnwjewgd\"}") + .fromString("{\"principalId\":\"seinqfiuf\",\"clientId\":\"knpirgnepttwq\"}") .toObject(UserAssignedIdentityProperty.class); } diff --git a/sdk/spring/CHANGELOG.md b/sdk/spring/CHANGELOG.md index b9008439d595..08d908654713 100644 --- a/sdk/spring/CHANGELOG.md +++ b/sdk/spring/CHANGELOG.md @@ -8,6 +8,18 @@ This section includes changes in `spring-cloud-azure-autoconfigure` module. #### Bugs Fixed - Fix the issue that prevented the `disableChallengeResourceVerification` property of the AKV `SecretClient` to be configured [#36628](https://github.com/Azure/azure-sdk-for-java/pull/36628). +### Spring Integration Azure Event Hubs +This section includes changes in the `spring-integration-azure-eventhubs` module. + +#### Bugs Fixed +- Fix NPE in the error handler of `EventHubsInboundChannelAdapter` when `instrumentationManager` or `instrumentationId` is null [#36927](https://github.com/Azure/azure-sdk-for-java/pull/36927). + +### Spring Integration Azure Service Bus +This section includes changes in the `spring-integration-azure-servicebus` module. + +#### Bugs Fixed +- Fix NPE in the error handler of `ServiceBusInboundChannelAdapter` when `instrumentationManager` or `instrumentationId` is null [#36927](https://github.com/Azure/azure-sdk-for-java/pull/36927). + ## 5.5.0 (2023-08-28) - This release is compatible with Spring Boot 3.0.0-3.1.2. (Note: 3.1.x (x>2) should be supported, but they aren't tested with this release.) - This release is compatible with Spring Cloud 2022.0.0-2022.0.4. (Note: 2022.0.x (x>4) should be supported, but they aren't tested with this release.) diff --git a/sdk/spring/azure-spring-data-cosmos/pom.xml b/sdk/spring/azure-spring-data-cosmos/pom.xml index 942d0f67e690..2bc16fa22622 100644 --- a/sdk/spring/azure-spring-data-cosmos/pom.xml +++ b/sdk/spring/azure-spring-data-cosmos/pom.xml @@ -98,7 +98,7 @@ com.azure azure-cosmos - 4.49.0 + 4.50.0 com.fasterxml.jackson.module diff --git a/sdk/spring/pipeline/spring-cloud-azure-supported-spring.json b/sdk/spring/pipeline/spring-cloud-azure-supported-spring.json index 79f773d21ab8..ba6e648c496d 100644 --- a/sdk/spring/pipeline/spring-cloud-azure-supported-spring.json +++ b/sdk/spring/pipeline/spring-cloud-azure-supported-spring.json @@ -12,6 +12,14 @@ "releaseStatus" : "PRERELEASE", "snapshot" : false, "supportStatus" : "TODO", + "spring-boot-version" : "3.2.0-M3", + "spring-cloud-version" : "2023.0.0-M1" + }, + { + "current" : false, + "releaseStatus" : "PRERELEASE", + "snapshot" : false, + "supportStatus" : "END_OF_LIFE", "spring-boot-version" : "3.2.0-M2", "spring-cloud-version" : "2023.0.0-M1" }, @@ -28,7 +36,7 @@ "releaseStatus" : "SNAPSHOT", "snapshot" : true, "supportStatus" : "TODO", - "spring-boot-version" : "3.1.4-SNAPSHOT", + "spring-boot-version" : "3.1.5-SNAPSHOT", "spring-cloud-version" : "2022.0.4" }, { @@ -36,6 +44,22 @@ "releaseStatus" : "GENERAL_AVAILABILITY", "snapshot" : false, "supportStatus" : "SUPPORTED", + "spring-boot-version" : "3.1.4", + "spring-cloud-version" : "2022.0.4" + }, + { + "current" : false, + "releaseStatus" : "SNAPSHOT", + "snapshot" : true, + "supportStatus" : "END_OF_LIFE", + "spring-boot-version" : "3.1.4-SNAPSHOT", + "spring-cloud-version" : "2022.0.4" + }, + { + "current" : false, + "releaseStatus" : "GENERAL_AVAILABILITY", + "snapshot" : false, + "supportStatus" : "END_OF_LIFE", "spring-boot-version" : "3.1.3", "spring-cloud-version" : "2022.0.4" }, @@ -108,7 +132,7 @@ "releaseStatus" : "SNAPSHOT", "snapshot" : true, "supportStatus" : "TODO", - "spring-boot-version" : "3.0.11-SNAPSHOT", + "spring-boot-version" : "3.0.12-SNAPSHOT", "spring-cloud-version" : "2022.0.4" }, { @@ -116,6 +140,22 @@ "releaseStatus" : "GENERAL_AVAILABILITY", "snapshot" : false, "supportStatus" : "SUPPORTED", + "spring-boot-version" : "3.0.11", + "spring-cloud-version" : "2022.0.4" + }, + { + "current" : false, + "releaseStatus" : "SNAPSHOT", + "snapshot" : true, + "supportStatus" : "END_OF_LIFE", + "spring-boot-version" : "3.0.11-SNAPSHOT", + "spring-cloud-version" : "2022.0.4" + }, + { + "current" : false, + "releaseStatus" : "GENERAL_AVAILABILITY", + "snapshot" : false, + "supportStatus" : "END_OF_LIFE", "spring-boot-version" : "3.0.10", "spring-cloud-version" : "2022.0.4" }, @@ -284,7 +324,7 @@ "releaseStatus" : "SNAPSHOT", "snapshot" : true, "supportStatus" : "TODO", - "spring-boot-version" : "2.7.16-SNAPSHOT", + "spring-boot-version" : "2.7.17-SNAPSHOT", "spring-cloud-version" : "2021.0.8" }, { @@ -292,6 +332,22 @@ "releaseStatus" : "GENERAL_AVAILABILITY", "snapshot" : false, "supportStatus" : "SUPPORTED", + "spring-boot-version" : "2.7.16", + "spring-cloud-version" : "2021.0.8" + }, + { + "current" : false, + "releaseStatus" : "SNAPSHOT", + "snapshot" : true, + "supportStatus" : "END_OF_LIFE", + "spring-boot-version" : "2.7.16-SNAPSHOT", + "spring-cloud-version" : "2021.0.8" + }, + { + "current" : false, + "releaseStatus" : "GENERAL_AVAILABILITY", + "snapshot" : false, + "supportStatus" : "END_OF_LIFE", "spring-boot-version" : "2.7.15", "spring-cloud-version" : "2021.0.8" }, diff --git a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml index ded55b4e0dee..da2d69d62b58 100644 --- a/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml +++ b/sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml @@ -69,49 +69,49 @@ com.azure azure-cosmos - 4.49.0 + 4.50.0 true com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 true com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 true com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 true com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 true com.azure azure-storage-blob - 12.23.1 + 12.24.0 true com.azure azure-storage-file-share - 12.19.1 + 12.20.0 true com.azure azure-storage-queue - 12.18.1 + 12.19.0 true diff --git a/sdk/spring/spring-cloud-azure-actuator/pom.xml b/sdk/spring/spring-cloud-azure-actuator/pom.xml index dd50efb8978d..fccd07d7b181 100644 --- a/sdk/spring/spring-cloud-azure-actuator/pom.xml +++ b/sdk/spring/spring-cloud-azure-actuator/pom.xml @@ -57,49 +57,49 @@ com.azure azure-cosmos - 4.49.0 + 4.50.0 true com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 true com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 true com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 true com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 true com.azure azure-storage-blob - 12.23.1 + 12.24.0 true com.azure azure-storage-file-share - 12.19.1 + 12.20.0 true com.azure azure-storage-queue - 12.18.1 + 12.19.0 true diff --git a/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml b/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml index 24f7f4624558..7232463df9f9 100644 --- a/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml +++ b/sdk/spring/spring-cloud-azure-appconfiguration-config/pom.xml @@ -48,7 +48,7 @@ com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 com.azure @@ -58,7 +58,7 @@ com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 com.azure.spring diff --git a/sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationPropertySourceLocatorTest.java b/sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationPropertySourceLocatorTest.java index f36b392d699d..e5860131de86 100644 --- a/sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationPropertySourceLocatorTest.java +++ b/sdk/spring/spring-cloud-azure-appconfiguration-config/src/test/java/com/azure/spring/cloud/appconfiguration/config/implementation/AppConfigurationPropertySourceLocatorTest.java @@ -351,7 +351,7 @@ public void storeCreatedWithFeatureFlags() { List featureList = new ArrayList<>(); FeatureFlagConfigurationSetting featureFlag = new FeatureFlagConfigurationSetting("Alpha", false); - featureFlag.setValue("{}"); + featureFlag.setValue(""); featureList.add(featureFlag); when(configStoreMock.getFeatureFlags()).thenReturn(featureFlagStore); @@ -416,7 +416,7 @@ public void storeCreatedWithFeatureFlagsRequireAll() { Feature alpha = (Feature) propertySources[0]; assertEquals("All", alpha.getRequirementType()); assertArrayEquals((Object[]) expectedSourceNames, sources.stream().map(PropertySource::getName).toArray()); - + } } @@ -430,7 +430,7 @@ public void storeCreatedWithFeatureFlagsWithMonitoring() { List featureList = new ArrayList<>(); FeatureFlagConfigurationSetting featureFlag = new FeatureFlagConfigurationSetting("Alpha", false); - featureFlag.setValue("{}"); + featureFlag.setValue(""); featureList.add(featureFlag); when(configStoreMock.getFeatureFlags()).thenReturn(featureFlagStore); diff --git a/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml b/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml index d6fa639881ba..83f4c1219ef1 100644 --- a/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml +++ b/sdk/spring/spring-cloud-azure-autoconfigure/pom.xml @@ -65,7 +65,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.16.9 + 1.17.0 true @@ -153,61 +153,61 @@ com.azure azure-cosmos - 4.49.0 + 4.50.0 true com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 true com.azure azure-messaging-servicebus - 7.14.3 + 7.14.4 true com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 true com.azure azure-messaging-eventgrid - 4.17.2 + 4.18.0 true com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 true com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 true com.azure azure-storage-blob - 12.23.1 + 12.24.0 true com.azure azure-storage-file-share - 12.19.1 + 12.20.0 true com.azure azure-storage-queue - 12.18.1 + 12.19.0 true @@ -294,7 +294,7 @@ com.azure azure-identity-extensions - 1.1.7 + 1.1.8 true diff --git a/sdk/spring/spring-cloud-azure-core/pom.xml b/sdk/spring/spring-cloud-azure-core/pom.xml index 9a7a54b95e25..0cae615d095f 100644 --- a/sdk/spring/spring-cloud-azure-core/pom.xml +++ b/sdk/spring/spring-cloud-azure-core/pom.xml @@ -62,14 +62,14 @@ com.azure azure-identity-extensions - 1.1.7 + 1.1.8 true com.azure azure-storage-blob - 12.23.1 + 12.24.0 true @@ -81,7 +81,7 @@ com.azure azure-storage-file-share - 12.19.1 + 12.20.0 true diff --git a/sdk/spring/spring-cloud-azure-service/pom.xml b/sdk/spring/spring-cloud-azure-service/pom.xml index a1e6744e43b4..dca771381180 100644 --- a/sdk/spring/spring-cloud-azure-service/pom.xml +++ b/sdk/spring/spring-cloud-azure-service/pom.xml @@ -44,61 +44,61 @@ com.azure azure-cosmos - 4.49.0 + 4.50.0 true com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 true com.azure azure-messaging-servicebus - 7.14.3 + 7.14.4 true com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 true com.azure azure-messaging-eventgrid - 4.17.2 + 4.18.0 true com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 true com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 true com.azure azure-storage-blob - 12.23.1 + 12.24.0 true com.azure azure-storage-file-share - 12.19.1 + 12.20.0 true com.azure azure-storage-queue - 12.18.1 + 12.19.0 true @@ -114,7 +114,7 @@ com.azure azure-identity-extensions - 1.1.7 + 1.1.8 true diff --git a/sdk/spring/spring-cloud-azure-starter-appconfiguration/pom.xml b/sdk/spring/spring-cloud-azure-starter-appconfiguration/pom.xml index 22aeefeb0731..c21d8788f4f0 100644 --- a/sdk/spring/spring-cloud-azure-starter-appconfiguration/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-appconfiguration/pom.xml @@ -93,7 +93,7 @@ com.azure azure-data-appconfiguration - 1.4.8 + 1.4.9 diff --git a/sdk/spring/spring-cloud-azure-starter-cosmos/pom.xml b/sdk/spring/spring-cloud-azure-starter-cosmos/pom.xml index ce852cd66bcb..62e688794768 100644 --- a/sdk/spring/spring-cloud-azure-starter-cosmos/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-cosmos/pom.xml @@ -93,7 +93,7 @@ com.azure azure-cosmos - 4.49.0 + 4.50.0 diff --git a/sdk/spring/spring-cloud-azure-starter-eventgrid/pom.xml b/sdk/spring/spring-cloud-azure-starter-eventgrid/pom.xml index 2ea32627440d..76866b8f5fc5 100644 --- a/sdk/spring/spring-cloud-azure-starter-eventgrid/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-eventgrid/pom.xml @@ -93,7 +93,7 @@ com.azure azure-messaging-eventgrid - 4.17.2 + 4.18.0 diff --git a/sdk/spring/spring-cloud-azure-starter-eventhubs/pom.xml b/sdk/spring/spring-cloud-azure-starter-eventhubs/pom.xml index 495ffb32a247..c0a80580ef6d 100644 --- a/sdk/spring/spring-cloud-azure-starter-eventhubs/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-eventhubs/pom.xml @@ -93,13 +93,13 @@ com.azure azure-messaging-eventhubs - 5.15.8 + 5.16.0 com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.16.9 + 1.17.0 diff --git a/sdk/spring/spring-cloud-azure-starter-jdbc-mysql/pom.xml b/sdk/spring/spring-cloud-azure-starter-jdbc-mysql/pom.xml index a3c76826bf65..c61822dc8c27 100644 --- a/sdk/spring/spring-cloud-azure-starter-jdbc-mysql/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-jdbc-mysql/pom.xml @@ -94,7 +94,7 @@ com.azure azure-identity-extensions - 1.1.7 + 1.1.8 diff --git a/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql/pom.xml b/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql/pom.xml index 4a26f0cbf71d..3ca0822375f9 100644 --- a/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-jdbc-postgresql/pom.xml @@ -94,7 +94,7 @@ com.azure azure-identity-extensions - 1.1.7 + 1.1.8 diff --git a/sdk/spring/spring-cloud-azure-starter-keyvault-certificates/pom.xml b/sdk/spring/spring-cloud-azure-starter-keyvault-certificates/pom.xml index fbc952c4df48..8d7ef9f7db22 100644 --- a/sdk/spring/spring-cloud-azure-starter-keyvault-certificates/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-keyvault-certificates/pom.xml @@ -93,7 +93,7 @@ com.azure azure-security-keyvault-certificates - 4.5.5 + 4.5.6 diff --git a/sdk/spring/spring-cloud-azure-starter-keyvault-secrets/pom.xml b/sdk/spring/spring-cloud-azure-starter-keyvault-secrets/pom.xml index 4dea8571edf8..566c09c1ce18 100644 --- a/sdk/spring/spring-cloud-azure-starter-keyvault-secrets/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-keyvault-secrets/pom.xml @@ -93,7 +93,7 @@ com.azure azure-security-keyvault-secrets - 4.6.5 + 4.7.0 diff --git a/sdk/spring/spring-cloud-azure-starter-monitor-test/pom.xml b/sdk/spring/spring-cloud-azure-starter-monitor-test/pom.xml index 871d73f349ea..e9a2281a49d1 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor-test/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-monitor-test/pom.xml @@ -30,7 +30,7 @@ com.azure.spring spring-cloud-azure-starter-monitor - 1.0.0-beta.1 + 1.0.0-beta.2 diff --git a/sdk/spring/spring-cloud-azure-starter-monitor-test/src/main/resources/logback.xml b/sdk/spring/spring-cloud-azure-starter-monitor-test/src/main/resources/logback.xml index 9a719b2d72c9..0ea6255f34df 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor-test/src/main/resources/logback.xml +++ b/sdk/spring/spring-cloud-azure-starter-monitor-test/src/main/resources/logback.xml @@ -1,11 +1,20 @@ + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + diff --git a/sdk/spring/spring-cloud-azure-starter-monitor-test/src/test/java/com/azure/CustomValidationPolicy.java b/sdk/spring/spring-cloud-azure-starter-monitor-test/src/test/java/com/azure/CustomValidationPolicy.java index 77280bb9f98f..549b1bef76eb 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor-test/src/test/java/com/azure/CustomValidationPolicy.java +++ b/sdk/spring/spring-cloud-azure-starter-monitor-test/src/test/java/com/azure/CustomValidationPolicy.java @@ -18,15 +18,19 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.ConcurrentSkipListSet; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.zip.GZIPInputStream; class CustomValidationPolicy implements HttpPipelinePolicy { + private final ObjectMapper objectMapper = createObjectMapper(); private final CountDownLatch countDown; volatile URL url; - final List actualTelemetryItems = new CopyOnWriteArrayList<>(); + final Queue actualTelemetryItems = new ConcurrentLinkedQueue<>(); CustomValidationPolicy(CountDownLatch countDown) { this.countDown = countDown; @@ -35,18 +39,15 @@ class CustomValidationPolicy implements HttpPipelinePolicy { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { url = context.getHttpRequest().getUrl(); - Mono asyncBytes = FluxUtil.collectBytesInByteBufferStream(context.getHttpRequest().getBody()).map(CustomValidationPolicy::ungzip); - asyncBytes.subscribe(value -> { - ObjectMapper objectMapper = createObjectMapper(); - try (MappingIterator i = objectMapper.readerFor(TelemetryItem.class).readValues(value)) { - while (i.hasNext()) { - actualTelemetryItems.add(i.next()); + FluxUtil.collectBytesInByteBufferStream(context.getHttpRequest().getBody()).map(CustomValidationPolicy::ungzip) + .subscribe(value -> { + try (MappingIterator i = objectMapper.readerFor(TelemetryItem.class).readValues(value)) { + i.forEachRemaining(actualTelemetryItems::add); + countDown.countDown(); + } catch (Exception e) { + throw new RuntimeException(e); } - countDown.countDown(); - } catch (Exception e) { - throw new RuntimeException(e); - } - }); + }); return next.process(); } diff --git a/sdk/spring/spring-cloud-azure-starter-monitor-test/src/test/java/com/azure/SpringMonitorTest.java b/sdk/spring/spring-cloud-azure-starter-monitor-test/src/test/java/com/azure/SpringMonitorTest.java index e6a10630901b..615a41ef74a9 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor-test/src/test/java/com/azure/SpringMonitorTest.java +++ b/sdk/spring/spring-cloud-azure-starter-monitor-test/src/test/java/com/azure/SpringMonitorTest.java @@ -2,39 +2,51 @@ // Licensed under the MIT License. package com.azure; -import static java.util.concurrent.TimeUnit.SECONDS; -import static org.assertj.core.api.Assertions.*; - -import com.azure.core.http.*; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.monitor.applicationinsights.spring.OpenTelemetryVersionCheckRunner; -import com.azure.monitor.opentelemetry.exporter.implementation.models.*; +import com.azure.monitor.applicationinsights.spring.selfdiagnostics.SelfDiagnosticsLevel; +import com.azure.monitor.opentelemetry.exporter.implementation.models.MessageData; +import com.azure.monitor.opentelemetry.exporter.implementation.models.MonitorDomain; +import com.azure.monitor.opentelemetry.exporter.implementation.models.RemoteDependencyData; +import com.azure.monitor.opentelemetry.exporter.implementation.models.RequestData; +import com.azure.monitor.opentelemetry.exporter.implementation.models.SeverityLevel; +import com.azure.monitor.opentelemetry.exporter.implementation.models.TelemetryItem; import io.opentelemetry.sdk.logs.export.LogRecordExporter; import io.opentelemetry.sdk.metrics.export.MetricExporter; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.export.SpanExporter; import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.stream.Collectors; +import org.assertj.core.api.Condition; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; import reactor.util.annotation.Nullable; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.Queue; +import java.util.concurrent.CountDownLatch; +import java.util.stream.Collectors; + +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.assertj.core.api.Assertions.assertThat; + @SpringBootTest( - classes = {Application.class, SpringMonitorTest.TestConfiguration.class}, + classes = {Application.class, SpringMonitorTest.TestConfig.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = { "applicationinsights.connection.string=InstrumentationKey=00000000-0000-0000-0000-0FEEDDADBEEF;IngestionEndpoint=https://test.in.applicationinsights.azure.com/;LiveEndpoint=https://test.livediagnostics.monitor.azure.com/" }) -public class SpringMonitorTest { +class SpringMonitorTest { private static CountDownLatch countDownLatch; @@ -53,8 +65,8 @@ public class SpringMonitorTest { @Autowired private Resource otelResource; - @Configuration(proxyBeanMethods = false) - static class TestConfiguration { + @TestConfiguration + static class TestConfig { @Bean HttpPipeline httpPipeline() { @@ -69,10 +81,15 @@ HttpPipeline getHttpPipeline(@Nullable HttpPipelinePolicy policy) { .policies(policy) .build(); } + @Bean + @Primary + SelfDiagnosticsLevel testSelfDiagnosticsLevel() { + return SelfDiagnosticsLevel.DEBUG; + } } @Test - public void applicationContextShouldOnlyContainTheAzureSpanExporter() { + void applicationContextShouldOnlyContainTheAzureSpanExporter() { List spanExporters = otelSpanExportersProvider.getIfAvailable(); assertThat(spanExporters).hasSize(1); @@ -84,7 +101,7 @@ public void applicationContextShouldOnlyContainTheAzureSpanExporter() { } @Test - public void applicationContextShouldOnlyContainTheAzureLogRecordExporter() { + void applicationContextShouldOnlyContainTheAzureLogRecordExporter() { List logRecordExporters = otelLoggerExportersProvider.getIfAvailable(); assertThat(logRecordExporters).hasSize(1); @@ -96,7 +113,7 @@ public void applicationContextShouldOnlyContainTheAzureLogRecordExporter() { } @Test - public void applicationContextShouldOnlyContainTheAzureMetricExporter() { + void applicationContextShouldOnlyContainTheAzureMetricExporter() { List metricExporters = otelMetricExportersProvider.getIfAvailable(); assertThat(metricExporters).hasSize(1); @@ -122,10 +139,13 @@ public void shouldMonitor() throws InterruptedException, MalformedURLException { assertThat(customValidationPolicy.url) .isEqualTo(new URL("https://test.in.applicationinsights.azure.com/v2.1/track")); - List telemetryItems = customValidationPolicy.actualTelemetryItems; - List telemetryTypes = - telemetryItems.stream().map(telemetry -> telemetry.getName()).collect(Collectors.toList()); - assertThat(telemetryItems.size()).as("Telemetry: " + telemetryTypes).isEqualTo(5); + Queue telemetryItems = customValidationPolicy.actualTelemetryItems; + List telemetryTypes = telemetryItems.stream().map(TelemetryItem::getName).collect(Collectors.toList()); + + // TODO (alzimmer): In some test runs there ends up being 4 telemetry items, in others 5. + // This needs to be investigated on why this is happening, it always ends up being the 'Request' telemetry item. + assertThat(telemetryItems.size()).as("Telemetry: " + telemetryTypes) + .is(new Condition<>(size -> size == 4 || size == 5, "size == 4 || size == 5")); // Log telemetry List logs = @@ -160,17 +180,22 @@ public void shouldMonitor() throws InterruptedException, MalformedURLException { telemetryItems.stream() .filter(telemetry -> telemetry.getName().equals("Request")) .collect(Collectors.toList()); - TelemetryItem request = requests.get(0); - MonitorDomain requestBaseData = request.getData().getBaseData(); - RequestData requestData = (RequestData) requestBaseData; - assertThat(requestData.getUrl()).contains(Controller.URL); - assertThat(requestData.isSuccess()).isTrue(); - assertThat(requestData.getResponseCode()).isEqualTo("200"); - assertThat(requestData.getName()).isEqualTo("GET /controller-url"); + + // TODO (alzimmer): In some test runs the 'Request' telemetry item is missing. + if (requests.size() >= 1) { + assertThat(requests).hasSize(1); + TelemetryItem request = requests.get(0); + MonitorDomain requestBaseData = request.getData().getBaseData(); + RequestData requestData = (RequestData) requestBaseData; + assertThat(requestData.getUrl()).contains(Controller.URL); + assertThat(requestData.isSuccess()).isTrue(); + assertThat(requestData.getResponseCode()).isEqualTo("200"); + assertThat(requestData.getName()).isEqualTo("GET /controller-url"); + } } @Test - public void verifyOpenTelemetryVersion() { + void verifyOpenTelemetryVersion() { String currentOTelVersion = otelResource.getAttribute(ResourceAttributes.TELEMETRY_SDK_VERSION); assertThat(OpenTelemetryVersionCheckRunner.STARTER_OTEL_VERSION) .as( diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/CHANGELOG.md b/sdk/spring/spring-cloud-azure-starter-monitor/CHANGELOG.md index 13dd08af78ab..853055152180 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor/CHANGELOG.md +++ b/sdk/spring/spring-cloud-azure-starter-monitor/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.0.0-beta.1 (Unreleased) ### Features Added diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/README.md b/sdk/spring/spring-cloud-azure-starter-monitor/README.md index 1c8ac4be9234..735b77b2f481 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor/README.md +++ b/sdk/spring/spring-cloud-azure-starter-monitor/README.md @@ -2,9 +2,9 @@ This Spring Boot starter provides telemetry data to Azure Monitor for Spring Boot applications and GraalVM native images. -_For a Spring Boot application running on a JVM (not with a GraalVM native image), we recommend using the [Application Insights Java agent][application_insights_java_agent_spring_boot]. +For a Spring Boot application running on a JVM (not with a GraalVM native image), we recommend using the [Application Insights Java agent][application_insights_java_agent_spring_boot]. -[Source code][source_code] | (Package yet to release) | [API reference documentation][api_reference_doc] | [Product Documentation][product_documentation] +[Source code][source_code] | [Package (Maven)][package_mvn] | [API reference documentation][api_reference_doc] | [Product Documentation][product_documentation] ## Getting started @@ -15,8 +15,9 @@ _For a Spring Boot application running on a JVM (not with a GraalVM native image For more information, please read [introduction to Application Insights][application_insights_intro]. -### Include the dependency +### Build update +#### Add monitoring dependency [//]: # ({x-version-update-start;com.azure:azure-monitor-azure-monitor-spring-native;current}) ```xml @@ -27,6 +28,43 @@ For more information, please read [introduction to Application Insights][applica ``` [//]: # ({x-version-update-end}) +#### Disable the JAR signature verification for the native image generation + +You have to disable the JAR signature verification to be able to generate a native image ([see](https://github.com/Azure/azure-sdk-for-java/issues/30320 +)). + +You can do this in the following way for GraalVM Native Build Tools: + +* Maven +```xml + + org.graalvm.buildtools + native-maven-plugin + + + -Djava.security.properties=src/main/resources/custom.security + + + +``` + +* Gradle: +```groovy +graalvmNative { + binaries { + main { + buildArgs('-Djava.security.properties=' + file("$rootDir/custom.security").absolutePath) + } + } +} +``` + +You have to create a `custom.security file` in `src/main/resources` with the following content: +``` +jdk.jar.disabledAlgorithms=MD2, MD5, RSA, DSA +``` + +#### OpenTelemetry version adjustment You may have to align the OpenTelemetry versions of Spring Boot 3 and `spring-cloud-azure-starter-monitor`. If this is the case, you will notice a WARN message during the application start-up: ``` WARN c.a.m.a.s.OpenTelemetryVersionCheckRunner - The OpenTelemetry version is not compatible with the spring-cloud-azure-starter-monitor dependency. The OpenTelemetry version should be @@ -83,19 +121,119 @@ You can then configure the connection string in two different ways: * With the `APPLICATIONINSIGHTS_CONNECTION_STRING` environment variable * With the `applicationinsights.connection.string` system property. You can use `-Dapplicationinsights.connection.string` or add the property to your `application.properties` file. -### Additional instrumentations -You can configure additional instrumentations with [OpenTelemetry instrumentations libraries](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks). -### Build your Spring native application -At this step, you can build your application as a native image and start the native image. +### Configure the instrumentation + +The Spring starter will capture HTTP requests by default. You can also configure additional instrumentation. + +#### Configure the database instrumentation + +First, add the `opentelemetry-jdbc` library: + +```xml + + + io.opentelemetry.instrumentation + opentelemetry-jdbc + {version} + + +``` -An example: +Then wrap your `DataSource` bean in an `io.opentelemetry.instrumentation.jdbc.datasource.OpenTelemetryDataSource`, e.g. + +```java +import org.apache.commons.dbcp2.BasicDataSource; +import org.springframework.context.annotation.Configuration; +import io.opentelemetry.instrumentation.jdbc.datasource.OpenTelemetryDataSource; + +@Configuration +public class DataSourceConfig { + + @Bean + public DataSource dataSource() { + BasicDataSource dataSource = new BasicDataSource(); + // Other data source configurations + return new OpenTelemetryDataSource(dataSource); + } + +} +``` + +#### Configure the Logback instrumentation + +First, add the following OpenTelemetry library: + +```xml + + + io.opentelemetry.instrumentation + opentelemetry-logback-appender-1.0 + {version} + runtime + + +``` + +Then configure the OpenTelemetry Logback appender, e.g. in your `logback.xml` file: + +```xml + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + +``` + +You can find additional settings of the OpenTelemetry Logback appender [here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/logback/logback-appender-1.0/library/README.md#settings-for-the-logback-appender). + +#### Additional instrumentations + +You can configure additional instrumentations with [OpenTelemetry instrumentations libraries](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks). + +### Build your Spring native application +At this step, you can build your application as a native image and start the native image: ``` mvn -Pnative spring-boot:build-image docker run -e APPLICATIONINSIGHTS_CONNECTION_STRING="{CONNECTION_STRING}" {image-name} ``` -where you have to replace `{CONNECTION_STRING}` and `{image-name}` by your connection string and the image name. +where you have to replace `{CONNECTION_STRING}` and `{image-name}` by your connection string and the native image name. + +### Debug + +If something does not work as expected, you can enable self-diagnostics features at DEBUG level to get some insights. + +You can configure the self-diagnostics level by using the APPLICATIONINSIGHTS_SELF_DIAGNOSTICS_LEVEL environment variable. You can configure the level with ERROR, WARN, INFO, DEBUG, or TRACE. + +_The APPLICATIONINSIGHTS_SELF_DIAGNOSTICS_LEVEL environment variable only works for Logback today._ + +The following line shows you how to add self-diagnostics at the DEBUG level when running a docker container: +``` +docker run -e APPLICATIONINSIGHTS_SELF_DIAGNOSTICS_LEVEL=DEBUG {image-name} +``` + +You have to replace `{image-name}` by your docker image name. + +### Disable the monitoring + +You can disable the monitoring by setting the `otel.sdk.disabled` property or the `OTEL_SDK_DISABLED` environment variable to true. ## Contributing @@ -112,7 +250,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [source_code]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/spring-cloud-azure-starter-monitor/src - +[package_mvn]: https://central.sonatype.com/artifact/com.azure.spring/spring-cloud-azure-starter-monitor [api_reference_doc]: https://docs.microsoft.com/azure/azure-monitor/overview [product_documentation]: https://docs.microsoft.com/azure/azure-monitor/overview [azure_subscription]: https://azure.microsoft.com/free/ diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/pom.xml b/sdk/spring/spring-cloud-azure-starter-monitor/pom.xml index a364033a7bcf..099e0e8a5f42 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-monitor/pom.xml @@ -19,11 +19,12 @@ ${jdk.version} ${jdk-test.version} ${jdk-test.version} + true com.azure.spring spring-cloud-azure-starter-monitor - 1.0.0-beta.1 + 1.0.0-beta.2 Azure Monitor OpenTelemetry Distro / Application Insights in Spring native Java application Spring Boot starter providing telemetry data to Azure Monitor for Spring Boot applications and GraalVM native images. diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorActivation.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorActivation.java deleted file mode 100644 index e6c7dd2fe55f..000000000000 --- a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorActivation.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.monitor.applicationinsights.spring; - -/** - * Azure Azure Spring Monitor activation - */ -public final class AzureSpringMonitorActivation { - - /** a flag to indicate if Azure Spring Monitor is activated or not. */ - private final boolean activated; - - /** - * Creates an instance of {@link AzureSpringMonitorActivation}. - */ - public AzureSpringMonitorActivation() { - this.activated = true; // We leave the AzureTelemetryActivation class because it could be used to provide the ability - // to disable the starter features - } - - /** - * @return true if it's activated. - */ - public boolean isTrue() { - return activated; - } - -} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorActivationConfig.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorActivationConfig.java deleted file mode 100644 index 5698340ec63b..000000000000 --- a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorActivationConfig.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.monitor.applicationinsights.spring; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Config for AzureSpringMonitorActivation - */ -@Configuration(proxyBeanMethods = false) -public class AzureSpringMonitorActivationConfig { - - /** - * Declare an AzureSpringMonitorActivation bean - * @return AzureSpringMonitorActivation - */ - @Bean - public AzureSpringMonitorActivation azureSpringMonitorActivation() { - return new AzureSpringMonitorActivation(); - } - - -} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorAutoConfig.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorAutoConfig.java index 09b465dc81b4..a7e76611e45f 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorAutoConfig.java +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorAutoConfig.java @@ -3,16 +3,119 @@ package com.azure.monitor.applicationinsights.spring; +import com.azure.core.http.HttpPipeline; +import com.azure.core.util.logging.ClientLogger; +import com.azure.monitor.opentelemetry.exporter.AzureMonitorExporterBuilder; import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import io.opentelemetry.sdk.logs.export.LogRecordExporter; +import io.opentelemetry.sdk.metrics.export.MetricExporter; +import io.opentelemetry.sdk.resources.Resource; +import io.opentelemetry.sdk.trace.export.SpanExporter; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.AutoConfigureBefore; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; + +import java.util.Optional; /** * Auto config for Azure Spring Monitor */ @Configuration(proxyBeanMethods = false) @AutoConfigureBefore(OpenTelemetryAutoConfiguration.class) -@Import({AzureSpringMonitorConfig.class, AzureSpringMonitorActivationConfig.class}) +@ConditionalOnProperty(name = "otel.sdk.disabled", havingValue = "false", matchIfMissing = true) public class AzureSpringMonitorAutoConfig { + + private static final ClientLogger LOGGER = new ClientLogger(AzureSpringMonitorAutoConfig.class); + + private static final String CONNECTION_STRING_ERROR_MESSAGE = "Unable to find the Application Insights connection string."; + + private final Optional azureMonitorExporterBuilderOpt; + + /** + * Create an instance of AzureSpringMonitorConfig + * @param connectionStringSysProp connection string system property + * @param httpPipeline an instance of HttpPipeline + */ + public AzureSpringMonitorAutoConfig(@Value("${applicationinsights.connection.string:}") String connectionStringSysProp, ObjectProvider httpPipeline) { + this.azureMonitorExporterBuilderOpt = createAzureMonitorExporterBuilder(connectionStringSysProp, httpPipeline); + if (!isNativeRuntimeExecution()) { + LOGGER.warning("You are using Application Insights for Spring in a non-native GraalVM runtime environment. We recommend using the Application Insights Java agent."); + } + } + + private static boolean isNativeRuntimeExecution() { + String imageCode = System.getProperty("org.graalvm.nativeimage.imagecode"); + return imageCode != null; + } + + private Optional createAzureMonitorExporterBuilder(String connectionStringSysProp, ObjectProvider httpPipeline) { + Optional connectionString = ConnectionStringRetriever.retrieveConnectionString(connectionStringSysProp); + if (connectionString.isPresent()) { + try { + AzureMonitorExporterBuilder azureMonitorExporterBuilder = new AzureMonitorExporterBuilder().connectionString(connectionString.get()); + HttpPipeline providedHttpPipeline = httpPipeline.getIfAvailable(); + if (providedHttpPipeline != null) { + azureMonitorExporterBuilder = azureMonitorExporterBuilder.httpPipeline(providedHttpPipeline); + } + return Optional.of(azureMonitorExporterBuilder); + } catch (IllegalArgumentException illegalArgumentException) { + String errorMessage = illegalArgumentException.getMessage(); + if (errorMessage.contains("InstrumentationKey")) { + LOGGER.warning(CONNECTION_STRING_ERROR_MESSAGE + " Please check you have not used an instrumentation key instead of a connection string"); + } + } + } else { + LOGGER.warning(CONNECTION_STRING_ERROR_MESSAGE); + } + return Optional.empty(); + } + + /** + * Declare a MetricExporter bean + * @return MetricExporter + */ + @Bean + public MetricExporter azureSpringMonitorMetricExporter() { + if (!azureMonitorExporterBuilderOpt.isPresent()) { + return null; + } + return azureMonitorExporterBuilderOpt.get().buildMetricExporter(); + } + + /** + * Declare a SpanExporter bean + * @return SpanExporter + */ + @Bean + public SpanExporter azureSpringMonitorSpanExporter() { + if (!azureMonitorExporterBuilderOpt.isPresent()) { + return null; + } + return azureMonitorExporterBuilderOpt.get().buildTraceExporter(); + } + + /** + * Declare a LogRecordExporter bean + * @return LogRecordExporter + */ + @Bean + public LogRecordExporter azureSpringMonitorLogRecordExporter() { + if (!azureMonitorExporterBuilderOpt.isPresent()) { + return null; + } + return azureMonitorExporterBuilderOpt.get().buildLogRecordExporter(); + } + + /** + * Declare OpenTelemetryVersionCheckRunner bean to check the OpenTelemetry version + * @param resource An OpenTelemetry resource + * @return OpenTelemetryVersionCheckRunner + */ + @Bean + public OpenTelemetryVersionCheckRunner openTelemetryVersionCheckRunner(Resource resource) { + return new OpenTelemetryVersionCheckRunner(resource); + } } diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorConfig.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorConfig.java deleted file mode 100644 index a56090a2bad7..000000000000 --- a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/AzureSpringMonitorConfig.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.monitor.applicationinsights.spring; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.logging.ClientLogger; -import com.azure.monitor.opentelemetry.exporter.AzureMonitorExporterBuilder; -import io.opentelemetry.sdk.logs.export.LogRecordExporter; -import io.opentelemetry.sdk.metrics.export.MetricExporter; -import io.opentelemetry.sdk.trace.export.SpanExporter; -import java.util.Optional; -import org.springframework.beans.factory.ObjectProvider; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Config for Azure Telemetry - */ -@Configuration(proxyBeanMethods = false) -public class AzureSpringMonitorConfig { - - private static final ClientLogger LOGGER = new ClientLogger(AzureSpringMonitorConfig.class); - - private static final String CONNECTION_STRING_ERROR_MESSAGE = "Unable to find the Application Insights connection string."; - - private final Optional azureMonitorExporterBuilderOpt; - - /** - * Create an instance of AzureSpringMonitorConfig - * @param connectionStringSysProp connection string system property - * @param azureSpringMonitorActivation a instance of AzureTelemetryActivation - * @param httpPipeline an instance of HttpPipeline - */ - public AzureSpringMonitorConfig(@Value("${applicationinsights.connection.string:}") String connectionStringSysProp, AzureSpringMonitorActivation azureSpringMonitorActivation, ObjectProvider httpPipeline) { - if (azureSpringMonitorActivation.isTrue()) { - this.azureMonitorExporterBuilderOpt = createAzureMonitorExporterBuilder(connectionStringSysProp, httpPipeline); - if (!isNativeRuntimeExecution()) { - LOGGER.warning("You are using Application Insights for Spring in a non-native GraalVM runtime environment. We recommend using the Application Insights Java agent."); - } - } else { - azureMonitorExporterBuilderOpt = Optional.empty(); - } - - } - - private static boolean isNativeRuntimeExecution() { - String imageCode = System.getProperty("org.graalvm.nativeimage.imagecode"); - return imageCode != null; - } - - private Optional createAzureMonitorExporterBuilder(String connectionStringSysProp, ObjectProvider httpPipeline) { - Optional connectionString = ConnectionStringRetriever.retrieveConnectionString(connectionStringSysProp); - if (connectionString.isPresent()) { - try { - AzureMonitorExporterBuilder azureMonitorExporterBuilder = new AzureMonitorExporterBuilder().connectionString(connectionString.get()); - HttpPipeline providedHttpPipeline = httpPipeline.getIfAvailable(); - if (providedHttpPipeline != null) { - azureMonitorExporterBuilder = azureMonitorExporterBuilder.httpPipeline(providedHttpPipeline); - } - return Optional.of(azureMonitorExporterBuilder); - } catch (IllegalArgumentException illegalArgumentException) { - String errorMessage = illegalArgumentException.getMessage(); - if (errorMessage.contains("InstrumentationKey")) { - LOGGER.warning(CONNECTION_STRING_ERROR_MESSAGE + " Please check you have not used an instrumentation key instead of a connection string"); - } - } - } else { - LOGGER.warning(CONNECTION_STRING_ERROR_MESSAGE); - } - return Optional.empty(); - } - - /** - * Declare a MetricExporter bean - * @return MetricExporter - */ - @Bean - public MetricExporter azureSpringMonitorMetricExporter() { - if (!azureMonitorExporterBuilderOpt.isPresent()) { - return null; - } - return azureMonitorExporterBuilderOpt.get().buildMetricExporter(); - } - - /** - * Declare a SpanExporter bean - * @return SpanExporter - */ - @Bean - public SpanExporter azureSpringMonitorSpanExporter() { - if (!azureMonitorExporterBuilderOpt.isPresent()) { - return null; - } - return azureMonitorExporterBuilderOpt.get().buildTraceExporter(); - } - - /** - * Declare a LogRecordExporter bean - * @return LogRecordExporter - */ - @Bean - public LogRecordExporter azureSpringMonitorLogRecordExporter() { - if (!azureMonitorExporterBuilderOpt.isPresent()) { - return null; - } - return azureMonitorExporterBuilderOpt.get().buildLogRecordExporter(); - } - - -} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/JvmMetricsPostProcessor.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/JvmMetricsPostProcessor.java deleted file mode 100644 index 1e224456cca4..000000000000 --- a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/JvmMetricsPostProcessor.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.monitor.applicationinsights.spring; - -import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.instrumentation.runtimemetrics.java8.BufferPools; -import io.opentelemetry.instrumentation.runtimemetrics.java8.Classes; -import io.opentelemetry.instrumentation.runtimemetrics.java8.Cpu; -import io.opentelemetry.instrumentation.runtimemetrics.java8.GarbageCollector; -import io.opentelemetry.instrumentation.runtimemetrics.java8.MemoryPools; -import io.opentelemetry.instrumentation.runtimemetrics.java8.Threads; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.core.Ordered; - -/** - * A bean post processor for JVM metrics - */ -// See https://github.com/Azure/azure-sdk-for-java/issues/35725 -public class JvmMetricsPostProcessor implements BeanPostProcessor, Ordered { - - private final AzureSpringMonitorActivation azureSpringMonitorActivation; - - /** - * Create an instance of JvmMetricsPostProcessor - * @param azureSpringMonitorActivation the azure telemetry activation - */ - public JvmMetricsPostProcessor(AzureSpringMonitorActivation azureSpringMonitorActivation) { - this.azureSpringMonitorActivation = azureSpringMonitorActivation; - } - - /** - * Post process after initialization - * @param bean a bean - * @param beanName name of the bean - * @return a bean - * @throws BeansException a bean exception - */ - @Override - public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { - if (azureSpringMonitorActivation.isTrue() && bean instanceof OpenTelemetry) { - OpenTelemetry openTelemetry = (OpenTelemetry) bean; - BufferPools.registerObservers(openTelemetry); - Classes.registerObservers(openTelemetry); - Cpu.registerObservers(openTelemetry); - MemoryPools.registerObservers(openTelemetry); - Threads.registerObservers(openTelemetry); - GarbageCollector.registerObservers(openTelemetry); - } - return bean; - } - - /** - * @return the order - */ - @Override - public int getOrder() { - return Ordered.LOWEST_PRECEDENCE - 1; - } - -} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/OTelVersion.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/OTelVersion.java index 62235a3416ca..f6c6858e2485 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/OTelVersion.java +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/OTelVersion.java @@ -2,15 +2,31 @@ // Licensed under the MIT License. package com.azure.monitor.applicationinsights.spring; +import java.util.Comparator; + class OTelVersion { - private final String otelVersionAsString; - private final int majorVersion; + private static final Comparator VERSION_COMPARATOR = Comparator.comparingInt(OTelVersion::getMajorVersion) + .thenComparing(OTelVersion::getMinorVersion) + .thenComparing(OTelVersion::getPatchVersion); + final int majorVersion; private final int minorVersion; private final int patchVersion; + + private int getMajorVersion() { + return majorVersion; + } + + private int getMinorVersion() { + return minorVersion; + } + + private int getPatchVersion() { + return patchVersion; + } + OTelVersion(String otelVersionAsString) { - this.otelVersionAsString = otelVersionAsString; String[] versionComponents = otelVersionAsString.split("\\."); this.majorVersion = Integer.parseInt(versionComponents[0]); this.minorVersion = Integer.parseInt(versionComponents[1]); @@ -18,26 +34,11 @@ class OTelVersion { } boolean isLessThan(OTelVersion oTelVersion) { - if (this.otelVersionAsString.equals(oTelVersion.otelVersionAsString)) { - return false; - } - return !isGreaterThan(oTelVersion); + return VERSION_COMPARATOR.compare(this, oTelVersion) < 0; } boolean isGreaterThan(OTelVersion oTelVersion) { - if (this.otelVersionAsString.equals(oTelVersion.otelVersionAsString)) { - return false; - } - if (this.majorVersion > oTelVersion.majorVersion) { - return true; - } - if (this.minorVersion > oTelVersion.minorVersion) { - return true; - } - if (this.patchVersion > oTelVersion.patchVersion) { - return true; - } - return false; + return VERSION_COMPARATOR.compare(this, oTelVersion) > 0; } boolean hasSameMajorVersionAs(OTelVersion oTelVersion) { diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/OpenTelemetryVersionCheckRunner.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/OpenTelemetryVersionCheckRunner.java index 60d8503c0cb5..682d1f58e87a 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/OpenTelemetryVersionCheckRunner.java +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/OpenTelemetryVersionCheckRunner.java @@ -4,16 +4,14 @@ import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; -import org.springframework.boot.CommandLineRunner; -import org.springframework.stereotype.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.CommandLineRunner; /** * This component alerts the user to the fact that the OpenTelemetry version used is not compatible * with the starter. One use case is Spring Boot 3 using OpenTelemetry. */ -@Component public class OpenTelemetryVersionCheckRunner implements CommandLineRunner { private static final Logger LOG = LoggerFactory.getLogger(OpenTelemetryVersionCheckRunner.class); @@ -55,15 +53,21 @@ public void run(String... args) { private static void checkOpenTelemetryVersion( OTelVersion currentOTelVersion, OTelVersion starterOTelVersion) { - if (!currentOTelVersion.hasSameMajorVersionAs(starterOTelVersion) && currentOTelVersion.isLessThan(starterOTelVersion)) { + if (!currentOTelVersion.hasSameMajorVersionAs(starterOTelVersion)) { + LOG.warn( + "Spring Boot and the spring-cloud-azure-starter-monitor dependency have different OpenTelemetry major versions (respectively " + + currentOTelVersion.majorVersion + + " and " + + starterOTelVersion.majorVersion + + ") . This will likely cause unexpected behaviors."); + } else if (currentOTelVersion.isLessThan(starterOTelVersion)) { LOG.warn( "The OpenTelemetry version is not compatible with the spring-cloud-azure-starter-monitor dependency. The OpenTelemetry version should be " + STARTER_OTEL_VERSION - + ". " + + " or later. " + "Please look at the spring-cloud-azure-starter-monitor documentation to fix this."); } else if (currentOTelVersion.isGreaterThan(starterOTelVersion)) { - LOG.info( - "A new version of spring-cloud-azure-starter-monitor dependency may be available."); + LOG.debug("A new version of spring-cloud-azure-starter-monitor dependency may be available."); } } } diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/DefaultLogConfig.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/DefaultLogConfig.java new file mode 100644 index 000000000000..3ba74d957748 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/DefaultLogConfig.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.applicationinsights.spring.selfdiagnostics; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Default self-diagnostics features for logging when Logback is not found. + */ +@Configuration(proxyBeanMethods = false) +@ConditionalOnMissingClass({"ch.qos.logback.classic.LoggerContext"}) +public class DefaultLogConfig { + + /** + * To define a logger for self-diagnostics. + * + * @return A logger for self-diagnostics + */ + @Bean + public Logger selfDiagnosticsLogger() { + Logger logger = LoggerFactory.getLogger(SelfDiagnostics.class); + String selfDiagLevelDefinedByUser = System.getenv(SelfDiagAutoConfig.SELF_DIAGNOSTICS_LEVEL_ENV_VAR); + if (selfDiagLevelDefinedByUser != null) { + String loggerLevel = findLevel(logger); + logger.warn("You have defined a self-diagnostics level at " + selfDiagLevelDefinedByUser + ". The self-diagnostics level was not set to this value because Logback is not used. The self-diagnostics level is " + loggerLevel + "."); + } + return logger; + } + + private static String findLevel(Logger logger) { + if (logger.isErrorEnabled()) { + return "ERROR"; + } + if (logger.isWarnEnabled()) { + return "WARN"; + } + if (logger.isInfoEnabled()) { + return "INFO"; + } + if (logger.isDebugEnabled()) { + return "DEBUG"; + } + if (logger.isTraceEnabled()) { + return "TRACE"; + } + return "UNKNOWN"; + } +} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/ExecutionEnvSelfDiag.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/ExecutionEnvSelfDiag.java new file mode 100644 index 000000000000..ab0b02be4372 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/ExecutionEnvSelfDiag.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.applicationinsights.spring.selfdiagnostics; + +import org.slf4j.Logger; +import org.springframework.boot.CommandLineRunner; + +class ExecutionEnvSelfDiag implements CommandLineRunner { + private final Logger selfDiagnosticsLogger; + + ExecutionEnvSelfDiag(Logger selfDiagnosticsLogger) { + this.selfDiagnosticsLogger = selfDiagnosticsLogger; + } + + @Override + public void run(String... args) { + try { + executeExecutionEnvSelfDiagnostics(); + } catch (Exception e) { + selfDiagnosticsLogger.warn("An unexpected issue has happened during execution env self-diagnostics.", e); + } + } + + private void executeExecutionEnvSelfDiagnostics() { + if (selfDiagnosticsLogger.isDebugEnabled()) { + boolean nativeRuntimeExecution = isNativeRuntimeExecution(); + selfDiagnosticsLogger.debug("GraalVM native: " + nativeRuntimeExecution); + } + if (selfDiagnosticsLogger.isTraceEnabled()) { + selfDiagnosticsLogger.trace("OS: " + System.getProperty("os.name")); + selfDiagnosticsLogger.trace("Env: " + System.getenv()); + selfDiagnosticsLogger.trace("System properties: " + System.getProperties()); + } + } + + private static boolean isNativeRuntimeExecution() { + String imageCode = System.getProperty("org.graalvm.nativeimage.imagecode"); + return imageCode != null; + } +} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/JdbcSelfDiagConfig.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/JdbcSelfDiagConfig.java new file mode 100644 index 000000000000..028a74d6ce41 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/JdbcSelfDiagConfig.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.applicationinsights.spring.selfdiagnostics; + +import java.sql.Driver; +import java.sql.DriverManager; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import javax.sql.DataSource; + +import org.slf4j.Logger; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * JDBC self-diagnostics features. + */ +@Configuration(proxyBeanMethods = false) +@ConditionalOnClass({DataSource.class}) +public class JdbcSelfDiagConfig { + private static final class JdbcSelfDiagnostics implements CommandLineRunner { + + private static final String OPEN_TELEMETRY_DATA_SOURCE_CLASS_NAME = "io.opentelemetry.instrumentation.jdbc.datasource.OpenTelemetryDataSource"; + private final ObjectProvider> dataSources; + private final Logger selfDiagnosticsLogger; + + private JdbcSelfDiagnostics(ObjectProvider> dataSources, Logger selfDiagnosticsLogger) { + this.dataSources = dataSources; + this.selfDiagnosticsLogger = selfDiagnosticsLogger; + } + + + /** + * To execute the JDBC self-diagnostics. + * @param args Incoming main method arguments + */ + @Override + public void run(String... args) { + try { + applyJdbcSelfDiagnostics(); + } catch (Exception e) { + selfDiagnosticsLogger.warn("An unexpected issue has happened during JDBC self-diagnostics.", e); + } + } + + private void applyJdbcSelfDiagnostics() { + + if (selfDiagnosticsLogger.isDebugEnabled()) { + + try { + Class.forName(OPEN_TELEMETRY_DATA_SOURCE_CLASS_NAME); + } catch (ClassNotFoundException e) { + selfDiagnosticsLogger.debug("You need the io.opentelemetry.instrumentation:opentelemetry-jdbc dependency for JDBC instrumentation."); + return; + } + + Predicate otelDatasourcePredicate = dataSource -> !dataSource.getClass().getName().equals(OPEN_TELEMETRY_DATA_SOURCE_CLASS_NAME); + List notOtelDatasources = dataSources.getIfAvailable(Collections::emptyList).stream().filter(otelDatasourcePredicate).collect(Collectors.toList()); + if (!notOtelDatasources.isEmpty()) { + selfDiagnosticsLogger.debug("Data source configuration type - Not OpenTelemetry data sources: " + notOtelDatasources); + } + + Enumeration drivers = DriverManager.getDrivers(); + Collection driverClassNames = findDriverClassNames(drivers); + String driverClassNamesAsString = String.join(", ", driverClassNames); + selfDiagnosticsLogger.debug("JDBC driver configuration type - Available JDBC drivers: " + driverClassNamesAsString); + } + } + + } + + private static Collection findDriverClassNames(Enumeration drivers) { + List driverClassNames = new ArrayList<>(); + while (drivers.hasMoreElements()) { + Driver driver = drivers.nextElement(); + driverClassNames.add(driver.getClass().getName()); + } + return driverClassNames; + } + + /** + * A bean execute the JDBC self-diagnostics + * + * @param dataSources Potential SQL datasources + * @param selfDiagnosticsLogger The self-diagnostics logger + * @return A CommandLineRunner bean to execute the JDBC self-diagnostics + */ + @Bean + public CommandLineRunner jdbcSelfDiagnostics(ObjectProvider> dataSources, Logger selfDiagnosticsLogger) { + return new JdbcSelfDiagnostics(dataSources, selfDiagnosticsLogger); + } +} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/LogbackSelfDiag.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/LogbackSelfDiag.java new file mode 100644 index 000000000000..e3debe81c2f3 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/LogbackSelfDiag.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.applicationinsights.spring.selfdiagnostics; + +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.Appender; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import org.slf4j.ILoggerFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.CommandLineRunner; + +class LogbackSelfDiag implements CommandLineRunner { + + private final Logger selfDiagnosticsLogger; + + LogbackSelfDiag(Logger selfDiagnosticsLogger) { + this.selfDiagnosticsLogger = selfDiagnosticsLogger; + } + + @Override + public void run(String... args) { + try { + applyLogbackSelfDiagnostics(); + } catch (Exception e) { + selfDiagnosticsLogger.warn("An unexpected issue has happened during Logback self-diagnostics.", e); + } + } + + private void applyLogbackSelfDiagnostics() { + if (selfDiagnosticsLogger.isDebugEnabled()) { + ILoggerFactory loggerFactorySpi = LoggerFactory.getILoggerFactory(); + if (loggerFactorySpi instanceof LoggerContext) { + List> logAppenders = findLogAppenders((LoggerContext) loggerFactorySpi); + if (!hasOtelAppender(logAppenders)) { + selfDiagnosticsLogger.debug("To enable the logging instrumentation, add the OpenTelemetryAppender Logback appender."); + } + logAppendersAtTraceLevel(logAppenders); + } + } + } + + private static List> findLogAppenders(LoggerContext loggerFactorySpi) { + List> appenders = new ArrayList<>(); + for (ch.qos.logback.classic.Logger logger : loggerFactorySpi.getLoggerList()) { + logger + .iteratorForAppenders() + .forEachRemaining( + appenders::add); + } + return appenders; + } + + private static boolean hasOtelAppender(List> logAppenders) { + return logAppenders.stream().anyMatch(appender -> appender.getClass().getName().equals("io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender")); + } + + private void logAppendersAtTraceLevel(List> logAppenders) { + if (selfDiagnosticsLogger.isTraceEnabled()) { + String logAppendersAsString = logAppenders.stream().map(Object::toString).collect(Collectors.joining(", ")); + selfDiagnosticsLogger.trace("Logback appenders: " + logAppendersAsString); + } + } +} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/LogbackSelfDiagConfig.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/LogbackSelfDiagConfig.java new file mode 100644 index 000000000000..845c484cf3e8 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/LogbackSelfDiagConfig.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.applicationinsights.spring.selfdiagnostics; + +import ch.qos.logback.classic.Level; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Logback self-diagnostics features. + */ +@Configuration(proxyBeanMethods = false) +@ConditionalOnClass(ch.qos.logback.classic.LoggerContext.class) +public class LogbackSelfDiagConfig { + + + /** + * To define a logger for self-diagnostics. + * @param selfDiagnosticsLevel The self-diagnostics level + * @return A logger for self-diagnostics + */ + @Bean + public Logger selfDiagnosticsLogger(SelfDiagnosticsLevel selfDiagnosticsLevel) { + Logger slf4jLog = LoggerFactory.getLogger(SelfDiagnostics.class); + ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) slf4jLog; + Level logbackLevel = findLogbackLevelFrom(selfDiagnosticsLevel, slf4jLog); + logbackLogger.setLevel(logbackLevel); + return logbackLogger; + } + + private static Level findLogbackLevelFrom(SelfDiagnosticsLevel selfDiagnosticsLevel, Logger slf4jLog) { + try { + return Level.valueOf(selfDiagnosticsLevel.name()); + } catch (IllegalArgumentException e) { + slf4jLog.warn("Unable to find Logback " + selfDiagnosticsLevel.name() + " level.", e); + return Level.INFO; + } + } + + /** + * A bean execute the Logback self-diagnostics + * @param selfDiagnosticsLogger The self-diagnostics logger + * @return A CommandLineRunner bean execute the Logback self-diagnostics + */ + @Bean + public CommandLineRunner logbackSelfDiagnostics(Logger selfDiagnosticsLogger) { + return new LogbackSelfDiag(selfDiagnosticsLogger); + } +} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/OtelSelfDiag.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/OtelSelfDiag.java new file mode 100644 index 000000000000..d3f04a12a20f --- /dev/null +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/OtelSelfDiag.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.applicationinsights.spring.selfdiagnostics; + +import io.opentelemetry.api.OpenTelemetry; +import io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration; +import io.opentelemetry.sdk.logs.SdkLoggerProvider; +import io.opentelemetry.sdk.metrics.SdkMeterProvider; +import io.opentelemetry.sdk.resources.Resource; +import io.opentelemetry.sdk.trace.SdkTracerProvider; +import org.slf4j.Logger; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.boot.CommandLineRunner; +import org.springframework.context.ApplicationContext; + +class OtelSelfDiag implements CommandLineRunner { + + private final ApplicationContext applicationContext; + private final Logger selfDiagnosticsLogger; + + OtelSelfDiag(ApplicationContext applicationContext, Logger selfDiagnosticsLogger) { + this.applicationContext = applicationContext; + this.selfDiagnosticsLogger = selfDiagnosticsLogger; + } + + @Override + public void run(String... args) { + try { + executeOtelSelfDiagnostics(); + } catch (Exception e) { + selfDiagnosticsLogger.warn("An unexpected issue has happened during OpenTelemetry self-diagnostics.", e); + } + } + + private void executeOtelSelfDiagnostics() { + if (!selfDiagnosticsLogger.isDebugEnabled()) { + return; + } + if (applicationContext instanceof BeanDefinitionRegistry) { + BeanDefinitionRegistry beanDefinitionRegistry = (BeanDefinitionRegistry) applicationContext; + checkBeanComesFromOtelJavaInstrumentationConfig(beanDefinitionRegistry, OpenTelemetry.class); + checkBeanComesFromOtelJavaInstrumentationConfig(beanDefinitionRegistry, Resource.class); + checkBeanComesFromOtelJavaInstrumentationConfig(beanDefinitionRegistry, SdkTracerProvider.class); + checkBeanComesFromOtelJavaInstrumentationConfig(beanDefinitionRegistry, SdkLoggerProvider.class); + checkBeanComesFromOtelJavaInstrumentationConfig(beanDefinitionRegistry, SdkMeterProvider.class); + } + if (isOpenTelemetryNoop()) { + selfDiagnosticsLogger.debug("NOOP OpenTelemetry"); + } + } + + private void checkBeanComesFromOtelJavaInstrumentationConfig(BeanDefinitionRegistry beanDefinitionRegistry, Class clazz) { + String[] beanNames = applicationContext.getBeanNamesForType(clazz); + String beanName = beanNames[0]; + BeanDefinition beanDefinition = beanDefinitionRegistry.getBeanDefinition(beanName); + String factoryBeanName = beanDefinition.getFactoryBeanName(); + if (factoryBeanName != null) { + boolean isOtelFactoryBean = factoryBeanName.startsWith(OpenTelemetryAutoConfiguration.class.getName()); + if (!isOtelFactoryBean) { + selfDiagnosticsLogger.debug("We do not recommend to define a bean of type " + clazz + ". "); + } + } + } + + private boolean isOpenTelemetryNoop() { + OpenTelemetry openTelemetry = applicationContext.getBean(OpenTelemetry.class); + return openTelemetry.equals(OpenTelemetry.noop()); + } +} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/SelfDiagAutoConfig.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/SelfDiagAutoConfig.java new file mode 100644 index 000000000000..99287b0b9dc1 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/SelfDiagAutoConfig.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.applicationinsights.spring.selfdiagnostics; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +import java.util.Locale; + +/** + Main configuration entry point of the self-diagnostics + **/ +@Configuration(proxyBeanMethods = false) +@ConditionalOnProperty(name = "otel.sdk.disabled", havingValue = "false", matchIfMissing = true) +@Import({DefaultLogConfig.class, LogbackSelfDiagConfig.class, JdbcSelfDiagConfig.class}) +public class SelfDiagAutoConfig { + private static final Logger LOG = LoggerFactory.getLogger(SelfDiagAutoConfig.class); + static final String SELF_DIAGNOSTICS_LEVEL_ENV_VAR = "APPLICATIONINSIGHTS_SELF_DIAGNOSTICS_LEVEL"; + + @Bean + SelfDiagnosticsLevel selfDiagnosticsLevel() { + String selfDiagLevelEnvVar = System.getenv(SELF_DIAGNOSTICS_LEVEL_ENV_VAR); + if (selfDiagLevelEnvVar == null) { + return SelfDiagnosticsLevel.INFO; + } + try { + String upperCaseLevel = selfDiagLevelEnvVar.toUpperCase(Locale.ROOT); + return SelfDiagnosticsLevel.valueOf(upperCaseLevel); + } catch (IllegalArgumentException e) { + LOG.warn("Unable to find the self-diagnostics level related to " + selfDiagLevelEnvVar + "defined with " + SELF_DIAGNOSTICS_LEVEL_ENV_VAR + " environment variable.", e); + return SelfDiagnosticsLevel.INFO; + } + } + @Bean + OtelSelfDiag otelSelfDiag(ApplicationContext applicationContext, Logger selfDiagnosticsLogger) { + return new OtelSelfDiag(applicationContext, selfDiagnosticsLogger); + } + + @Bean + ExecutionEnvSelfDiag executionEnvSelfDiag(Logger selfDiagnosticsLogger) { + return new ExecutionEnvSelfDiag(selfDiagnosticsLogger); + } + +} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/SelfDiagnostics.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/SelfDiagnostics.java new file mode 100644 index 000000000000..3b6b9acc43a5 --- /dev/null +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/SelfDiagnostics.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.applicationinsights.spring.selfdiagnostics; + +// Class used for logging +final class SelfDiagnostics { + + private SelfDiagnostics() { + } +} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/SelfDiagnosticsLevel.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/SelfDiagnosticsLevel.java new file mode 100644 index 000000000000..b1d7bcf9033a --- /dev/null +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/java/com/azure/monitor/applicationinsights/spring/selfdiagnostics/SelfDiagnosticsLevel.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.monitor.applicationinsights.spring.selfdiagnostics; + +/** This enum allows you to define a self-diagnostics level. */ +public enum SelfDiagnosticsLevel { + + /** Error self-diagnostics level */ + ERROR, + /** Warn self-diagnostics level */ + WARN, + /** Info self-diagnostics level */ + INFO, + + /** Debug self-diagnostics level */ + DEBUG, + + /** Trace self-diagnostics level */ + TRACE +} diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index c7af598f9e75..0b989951e7bc 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1 +1,2 @@ com.azure.monitor.applicationinsights.spring.AzureSpringMonitorAutoConfig +com.azure.monitor.applicationinsights.spring.selfdiagnostics.SelfDiagAutoConfig diff --git a/sdk/spring/spring-cloud-azure-starter-monitor/src/test/java/com/azure/monitor/applicationinsights/spring/SpringContextTest.java b/sdk/spring/spring-cloud-azure-starter-monitor/src/test/java/com/azure/monitor/applicationinsights/spring/SpringContextTest.java index 933017d8cf78..d336837edf4b 100644 --- a/sdk/spring/spring-cloud-azure-starter-monitor/src/test/java/com/azure/monitor/applicationinsights/spring/SpringContextTest.java +++ b/sdk/spring/spring-cloud-azure-starter-monitor/src/test/java/com/azure/monitor/applicationinsights/spring/SpringContextTest.java @@ -2,18 +2,19 @@ // Licensed under the MIT License. package com.azure.monitor.applicationinsights.spring; +import com.azure.monitor.applicationinsights.spring.selfdiagnostics.SelfDiagAutoConfig; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; -public class SpringContextTest { +class SpringContextTest { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); // The tests of the Spring Monitor features are done in the spring-cloud-azure-starter-monitor-test Maven module @Test void loadContext() { - this.contextRunner.withConfiguration(AutoConfigurations.of(AzureSpringMonitorAutoConfig.class)).run(context -> { + this.contextRunner.withConfiguration(AutoConfigurations.of(AzureSpringMonitorAutoConfig.class, SelfDiagAutoConfig.class)).run(context -> { }); } diff --git a/sdk/spring/spring-cloud-azure-starter-redis/pom.xml b/sdk/spring/spring-cloud-azure-starter-redis/pom.xml index c56e7bfa3203..ebe457f7f84c 100644 --- a/sdk/spring/spring-cloud-azure-starter-redis/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-redis/pom.xml @@ -106,7 +106,7 @@ com.azure azure-identity-extensions - 1.1.7 + 1.1.8 diff --git a/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml b/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml index cb0c924f87f2..59cb68fa157d 100644 --- a/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml @@ -146,7 +146,7 @@ com.azure azure-identity-extensions - 1.1.7 + 1.1.8 diff --git a/sdk/spring/spring-cloud-azure-starter-servicebus/pom.xml b/sdk/spring/spring-cloud-azure-starter-servicebus/pom.xml index 9538f52122ab..bdfd43f30f44 100644 --- a/sdk/spring/spring-cloud-azure-starter-servicebus/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-servicebus/pom.xml @@ -94,7 +94,7 @@ com.azure azure-messaging-servicebus - 7.14.3 + 7.14.4 diff --git a/sdk/spring/spring-cloud-azure-starter-storage-blob/pom.xml b/sdk/spring/spring-cloud-azure-starter-storage-blob/pom.xml index ec455a168f5e..c982b2b566ba 100644 --- a/sdk/spring/spring-cloud-azure-starter-storage-blob/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-storage-blob/pom.xml @@ -94,7 +94,7 @@ com.azure azure-storage-blob - 12.23.1 + 12.24.0 diff --git a/sdk/spring/spring-cloud-azure-starter-storage-file-share/pom.xml b/sdk/spring/spring-cloud-azure-starter-storage-file-share/pom.xml index 31d0ecfab39a..090b76e78493 100644 --- a/sdk/spring/spring-cloud-azure-starter-storage-file-share/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-storage-file-share/pom.xml @@ -94,7 +94,7 @@ com.azure azure-storage-file-share - 12.19.1 + 12.20.0 diff --git a/sdk/spring/spring-cloud-azure-starter-storage-queue/pom.xml b/sdk/spring/spring-cloud-azure-starter-storage-queue/pom.xml index 55829b17ff90..4e372b5e97b2 100644 --- a/sdk/spring/spring-cloud-azure-starter-storage-queue/pom.xml +++ b/sdk/spring/spring-cloud-azure-starter-storage-queue/pom.xml @@ -97,7 +97,7 @@ com.azure azure-storage-queue - 12.18.1 + 12.19.0 diff --git a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml index 7e16adce39a2..c7700514c598 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml +++ b/sdk/spring/spring-cloud-azure-stream-binder-eventhubs/pom.xml @@ -48,7 +48,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.16.9 + 1.17.0 org.springframework.boot diff --git a/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/pom.xml b/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/pom.xml index 601326958b53..117af77c8700 100644 --- a/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/pom.xml +++ b/sdk/spring/spring-cloud-azure-stream-binder-servicebus-core/pom.xml @@ -48,7 +48,7 @@ com.azure azure-messaging-servicebus - 7.14.3 + 7.14.4 org.springframework.boot diff --git a/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml b/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml index eb173b4f8ba6..ffa3e36152e7 100644 --- a/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml +++ b/sdk/spring/spring-cloud-azure-trace-sleuth/pom.xml @@ -76,7 +76,7 @@ com.azure azure-storage-blob - 12.23.1 + 12.24.0 test diff --git a/sdk/spring/spring-integration-azure-eventhubs/pom.xml b/sdk/spring/spring-integration-azure-eventhubs/pom.xml index 2441a82cd3e2..d5de0aeb9d81 100644 --- a/sdk/spring/spring-integration-azure-eventhubs/pom.xml +++ b/sdk/spring/spring-integration-azure-eventhubs/pom.xml @@ -55,7 +55,7 @@ com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.16.9 + 1.17.0 + 5.16.0 com.azure azure-messaging-eventhubs-checkpointstore-blob - 1.16.9 + 1.17.0 true diff --git a/sdk/spring/spring-messaging-azure-servicebus/pom.xml b/sdk/spring/spring-messaging-azure-servicebus/pom.xml index e5537281fd29..65f9b2570592 100644 --- a/sdk/spring/spring-messaging-azure-servicebus/pom.xml +++ b/sdk/spring/spring-messaging-azure-servicebus/pom.xml @@ -50,7 +50,7 @@ com.azure azure-messaging-servicebus - 7.14.3 + 7.14.4 org.springframework diff --git a/sdk/spring/spring-messaging-azure-storage-queue/pom.xml b/sdk/spring/spring-messaging-azure-storage-queue/pom.xml index 1de2e7532a9d..52a2295deeeb 100644 --- a/sdk/spring/spring-messaging-azure-storage-queue/pom.xml +++ b/sdk/spring/spring-messaging-azure-storage-queue/pom.xml @@ -49,7 +49,7 @@ com.azure azure-storage-queue - 12.18.1 + 12.19.0 diff --git a/sdk/storage/azure-storage-blob-batch/CHANGELOG.md b/sdk/storage/azure-storage-blob-batch/CHANGELOG.md index 97b62b2d8ad7..6e0bc751f04c 100644 --- a/sdk/storage/azure-storage-blob-batch/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob-batch/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 12.21.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 12.20.0 (2023-09-12) ### Features Added diff --git a/sdk/storage/azure-storage-blob-batch/pom.xml b/sdk/storage/azure-storage-blob-batch/pom.xml index ea2c384cc9d8..7ddf823d81f6 100644 --- a/sdk/storage/azure-storage-blob-batch/pom.xml +++ b/sdk/storage/azure-storage-blob-batch/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-blob-batch - 12.20.0 + 12.21.0-beta.1 Microsoft Azure client library for Blob Storage batching This module contains client library for Microsoft Azure Blob Storage batching. @@ -60,7 +60,7 @@ com.azure azure-storage-blob - 12.24.0 + 12.25.0-beta.1 @@ -82,7 +82,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 tests test-jar test diff --git a/sdk/storage/azure-storage-blob-changefeed/pom.xml b/sdk/storage/azure-storage-blob-changefeed/pom.xml index 9e454e550138..a09d2b404583 100644 --- a/sdk/storage/azure-storage-blob-changefeed/pom.xml +++ b/sdk/storage/azure-storage-blob-changefeed/pom.xml @@ -67,7 +67,7 @@ com.azure azure-storage-blob - 12.24.0 + 12.25.0-beta.1 @@ -89,7 +89,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 tests test-jar test diff --git a/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md b/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md index b94ef704579a..9b84d4958255 100644 --- a/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 12.24.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 12.23.0 (2023-09-12) ### Features Added diff --git a/sdk/storage/azure-storage-blob-cryptography/pom.xml b/sdk/storage/azure-storage-blob-cryptography/pom.xml index 21a3e762cc22..c7a2ac0a2ca2 100644 --- a/sdk/storage/azure-storage-blob-cryptography/pom.xml +++ b/sdk/storage/azure-storage-blob-cryptography/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-blob-cryptography - 12.23.0 + 12.24.0-beta.1 Microsoft Azure client library for Blob Storage cryptography This module contains client library for Microsoft Azure Blob Storage cryptography. @@ -59,7 +59,7 @@ com.azure azure-storage-blob - 12.24.0 + 12.25.0-beta.1 @@ -71,7 +71,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 tests test-jar test @@ -125,7 +125,7 @@ com.azure azure-security-keyvault-keys - 4.6.5 + 4.7.0 test diff --git a/sdk/storage/azure-storage-blob-nio/pom.xml b/sdk/storage/azure-storage-blob-nio/pom.xml index ca9c899c3634..2a6a620f12bf 100644 --- a/sdk/storage/azure-storage-blob-nio/pom.xml +++ b/sdk/storage/azure-storage-blob-nio/pom.xml @@ -58,7 +58,7 @@ com.azure azure-storage-blob - 12.24.0 + 12.25.0-beta.1 @@ -70,7 +70,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 tests test-jar test diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index 555dbe782ce3..62d65dc033e9 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 12.25.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 12.24.0 (2023-09-12) ### Features Added diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index 48b1ab44b0eb..6a570e60066b 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-blob - 12.24.0 + 12.25.0-beta.1 Microsoft Azure client library for Blob Storage This module contains client library for Microsoft Azure Blob Storage. @@ -73,12 +73,12 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 com.azure azure-storage-internal-avro - 12.9.0 + 12.10.0-beta.1 @@ -99,7 +99,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 tests test-jar test diff --git a/sdk/storage/azure-storage-common/CHANGELOG.md b/sdk/storage/azure-storage-common/CHANGELOG.md index 5fced104ee2e..9fc2169ad04c 100644 --- a/sdk/storage/azure-storage-common/CHANGELOG.md +++ b/sdk/storage/azure-storage-common/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 12.24.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 12.23.0 (2023-09-12) ### Features Added diff --git a/sdk/storage/azure-storage-common/pom.xml b/sdk/storage/azure-storage-common/pom.xml index 211d7593cd16..500b5ac8b6fb 100644 --- a/sdk/storage/azure-storage-common/pom.xml +++ b/sdk/storage/azure-storage-common/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 Microsoft Azure common module for Storage This module contains common code based for all Microsoft Azure Storage client libraries. diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index 49206e4a0700..beafdcc1ed9a 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 12.18.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 12.17.0 (2023-09-12) ### Features Added diff --git a/sdk/storage/azure-storage-file-datalake/assets.json b/sdk/storage/azure-storage-file-datalake/assets.json index be2609126029..e5e2a25f5158 100644 --- a/sdk/storage/azure-storage-file-datalake/assets.json +++ b/sdk/storage/azure-storage-file-datalake/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-file-datalake", - "Tag": "java/storage/azure-storage-file-datalake_ed7708ef7d" + "Tag": "java/storage/azure-storage-file-datalake_f8b8ec7b50" } diff --git a/sdk/storage/azure-storage-file-datalake/pom.xml b/sdk/storage/azure-storage-file-datalake/pom.xml index 78dda19c572d..b6502e65b821 100644 --- a/sdk/storage/azure-storage-file-datalake/pom.xml +++ b/sdk/storage/azure-storage-file-datalake/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-file-datalake - 12.17.0 + 12.18.0-beta.1 Microsoft Azure client library for File Storage Data Lake This module contains client library for Microsoft Azure File Storage Data Lake. @@ -71,7 +71,7 @@ com.azure azure-storage-blob - 12.24.0 + 12.25.0-beta.1 @@ -93,7 +93,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 tests test-jar test diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java index b2c5a14f1d5b..8999d4f5cf20 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeFileAsyncClient.java @@ -1162,6 +1162,11 @@ public Mono> appendWithResponse(BinaryData data, long fileOffset, Mono> appendWithResponse(Flux data, long fileOffset, long length, DataLakeFileAppendOptions appendOptions, Context context) { + + if (data == null) { + return Mono.error(new NullPointerException("'data' cannot be null.")); + } + appendOptions = appendOptions == null ? new DataLakeFileAppendOptions() : appendOptions; LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().setLeaseId(appendOptions.getLeaseId()); PathHttpHeaders headers = new PathHttpHeaders().setTransactionalContentHash(appendOptions.getContentMd5()); diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DataLakeTestBase.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DataLakeTestBase.java index ade37133d650..27d3431f6cb0 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DataLakeTestBase.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DataLakeTestBase.java @@ -28,6 +28,7 @@ import com.azure.core.util.CoreUtils; import com.azure.identity.ClientSecretCredentialBuilder; import com.azure.identity.EnvironmentCredentialBuilder; +import com.azure.storage.blob.models.BlobErrorCode; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.policy.RequestRetryOptions; @@ -35,6 +36,7 @@ import com.azure.storage.common.test.shared.TestAccount; import com.azure.storage.common.test.shared.TestDataFactory; import com.azure.storage.common.test.shared.TestEnvironment; +import com.azure.storage.file.datalake.models.DataLakeStorageException; import com.azure.storage.file.datalake.models.FileSystemItem; import com.azure.storage.file.datalake.models.LeaseStateType; import com.azure.storage.file.datalake.models.ListFileSystemsOptions; @@ -45,6 +47,7 @@ import com.azure.storage.file.datalake.specialized.DataLakeLeaseClientBuilder; import okhttp3.ConnectionPool; import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; import java.io.ByteArrayOutputStream; import java.io.File; @@ -72,6 +75,7 @@ import static com.azure.core.test.utils.TestUtils.assertArraysEqual; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.fail; @@ -370,6 +374,12 @@ protected DataLakeFileAsyncClient getFileAsyncClient(StorageSharedKeyCredential .buildFileAsyncClient(); } + protected DataLakeFileAsyncClient getFileAsyncClient(String sasToken, String endpoint, String pathName) { + return instrument(new DataLakePathClientBuilder().endpoint(endpoint).pathName(pathName)) + .sasToken(sasToken) + .buildFileAsyncClient(); + } + protected DataLakeFileClient getFileClient(StorageSharedKeyCredential credential, String endpoint, String pathName) { DataLakePathClientBuilder builder = new DataLakePathClientBuilder().endpoint(endpoint).pathName(pathName); @@ -767,6 +777,19 @@ protected String getFileSystemUrl() { return dataLakeFileSystemClient.getFileSystemUrl(); } + protected static void assertExceptionStatusCodeAndMessage(Throwable throwable, int expectedStatusCode, + BlobErrorCode errMessage) { + DataLakeStorageException exception = assertInstanceOf(DataLakeStorageException.class, throwable); + assertEquals(expectedStatusCode, exception.getStatusCode()); + assertEquals(errMessage.toString(), exception.getErrorCode()); + } + + protected static void assertAsyncResponseStatusCode(Mono> response, int expectedStatusCode) { + StepVerifier.create(response) + .assertNext(r -> assertEquals(expectedStatusCode, r.getStatusCode())) + .verifyComplete(); + } + public static byte[] convertInputStreamToByteArray(InputStream inputStream, int expectedSize) throws IOException { int b; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(expectedSize); diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java index e7dd0b50ad25..dea61d7381d1 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java @@ -5,13 +5,11 @@ import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; -import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.rest.Response; import com.azure.core.test.utils.TestUtils; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; -import com.azure.core.util.FluxUtil; import com.azure.core.util.ProgressListener; import com.azure.identity.DefaultAzureCredentialBuilder; import com.azure.storage.blob.BlobUrlParts; @@ -72,11 +70,6 @@ import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; -import reactor.core.Exceptions; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Hooks; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -109,9 +102,7 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; -import java.util.stream.Collectors; import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -1567,42 +1558,6 @@ public void downloadFileSyncBufferCopy(int fileSize) { assertEquals(fileSize, properties.getFileSize()); } - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("downloadFileSupplier") - public void downloadFileAsyncBufferCopy(int fileSize) { - String fileSystemName = generateFileSystemName(); - DataLakeServiceAsyncClient datalakeServiceAsyncClient = new DataLakeServiceClientBuilder() - .endpoint(ENVIRONMENT.getDataLakeAccount().getDataLakeEndpoint()) - .credential(getDataLakeCredential()) - .buildAsyncClient(); - - DataLakeFileAsyncClient fileAsyncClient = datalakeServiceAsyncClient.createFileSystem(fileSystemName) - .blockOptional() - .orElseThrow(() -> new IllegalStateException("Expected file system to be created.")) - .getFileAsyncClient(generatePathName()); - - File file = getRandomFile(fileSize); - file.deleteOnExit(); - createdFiles.add(file); - - fileAsyncClient.uploadFromFile(file.toPath().toString(), true).block(); - File outFile = new File(testResourceNamer.randomName("", 60) + ".txt"); - outFile.deleteOnExit(); - createdFiles.add(outFile); - - if (outFile.exists()) { - assertTrue(outFile.delete()); - } - - StepVerifier.create(fileAsyncClient.readToFileWithResponse(outFile.toPath().toString(), null, - new ParallelTransferOptions().setBlockSizeLong(4L * 1024 * 1024), null, null, false, null) - .map(Response::getValue)) - .assertNext(properties -> assertEquals(fileSize, properties.getFileSize())) - .verifyComplete(); - - compareFiles(file, outFile, 0, fileSize); - } @ParameterizedTest @MethodSource("downloadFileRangeSupplier") public void downloadFileRange(FileRange range) { @@ -1739,77 +1694,7 @@ public void downloadFileACFail(OffsetDateTime modified, OffsetDateTime unmodifie assertTrue(Objects.equals(e.getErrorCode(), "ConditionNotMet") || Objects.equals(e.getErrorCode(), "LeaseIdMismatchWithBlobOperation")); } - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @Test - public void downloadFileEtagLock() throws IOException { - File file = getRandomFile(Constants.MB); - file.deleteOnExit(); - createdFiles.add(file); - - fc.uploadFromFile(file.toPath().toString(), true); - - File outFile = new File(prefix); - Files.deleteIfExists(outFile.toPath()); - outFile.deleteOnExit(); - createdFiles.add(outFile); - - AtomicInteger counter = new AtomicInteger(); - - DataLakeFileAsyncClient facUploading = instrument(new DataLakePathClientBuilder() - .endpoint(fc.getPathUrl()) - .credential(getDataLakeCredential())) - .buildFileAsyncClient(); - - HttpPipelinePolicy policy = (context, next) -> next.process().flatMap(response -> { - if (counter.incrementAndGet() == 1) { - // When the download begins trigger an upload to overwrite the downloading blob so that the download is - // able to get an ETag before it is changed. - return facUploading.upload(DATA.getDefaultFlux(), null, true).thenReturn(response); - } - return Mono.just(response); - }); - - DataLakeFileAsyncClient facDownloading = instrument(new DataLakePathClientBuilder() - .addPolicy(policy) - .endpoint(fc.getPathUrl()) - .credential(getDataLakeCredential())) - .buildFileAsyncClient(); - - // Set up the download to happen in small chunks so many requests need to be sent, this will give the upload - // time to change the ETag therefore failing the download. - ParallelTransferOptions options = new ParallelTransferOptions().setBlockSizeLong((long) Constants.KB); - - // This is done to prevent onErrorDropped exceptions from being logged at the error level. If no hook is - // registered for onErrorDropped the error is logged at the ERROR level. - // - // onErrorDropped is triggered once the reactive stream has emitted one element, after that exceptions are - // dropped. - Hooks.onErrorDropped(ignored -> { /* do nothing with it */ }); - - StepVerifier.create(facDownloading.readToFileWithResponse(outFile.toPath().toString(), null, options, null, null, false, null)) - .verifyErrorSatisfies(ex -> { - // If an operation is running on multiple threads and multiple return an exception Reactor will combine - // them into a CompositeException which needs to be unwrapped. If there is only a single exception - // 'Exceptions.unwrapMultiple' will return a singleton list of the exception it was passed. - // - // These exceptions may be wrapped exceptions where the exception we are expecting is contained within - // ReactiveException that needs to be unwrapped. If the passed exception isn't a 'ReactiveException' it - // will be returned unmodified by 'Exceptions.unwrap'. - assertTrue(Exceptions.unwrapMultiple(ex).stream() - .anyMatch(ex2 -> { - Throwable unwrapped = Exceptions.unwrap(ex2); - if (unwrapped instanceof DataLakeStorageException) { - return ((DataLakeStorageException) unwrapped).getStatusCode() == 412; - } - return false; - })); - }); - - // Give the file a chance to be deleted by the download operation before verifying its deletion - sleepIfRunningAgainstService(500); - assertFalse(outFile.exists()); - } @SuppressWarnings("deprecation") @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") @@ -2427,44 +2312,6 @@ public void builderBearerTokenValidation() { .buildFileClient()); } - // "No overwrite interrupted" tests were not ported over for datalake. This is because the access condition check - // occurs on the create method, so simple access conditions tests suffice. - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") // Test uploads large amount of data - @ParameterizedTest - @MethodSource("uploadFromFileSupplier") - public void uploadFromFile(int fileSize, Long blockSize) throws IOException { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - File file = getRandomFile(fileSize); - file.deleteOnExit(); - createdFiles.add(file); - - // Block length will be ignored for single shot. - StepVerifier.create(fac.uploadFromFile(file.getPath(), - new ParallelTransferOptions().setBlockSizeLong(blockSize), null, null, null)) - .verifyComplete(); - - File outFile = new File(file.getPath() + "result"); - assertTrue(outFile.createNewFile()); - outFile.deleteOnExit(); - createdFiles.add(outFile); - - StepVerifier.create(fac.readToFile(outFile.getPath(), true)) - .expectNextCount(1) - .verifyComplete(); - - compareFiles(file, outFile, 0, fileSize); - } - - private static Stream uploadFromFileSupplier() { - return Stream.of( - // fileSize | blockSize - Arguments.of(10, null), // Size is too small to trigger block uploading - Arguments.of(10 * Constants.KB, null), // Size is too small to trigger block uploading - Arguments.of(50 * Constants.MB, null), // Size is too small to trigger block uploading - Arguments.of(101 * Constants.MB, 4L * 1024 * 1024) // Size is too small to trigger block uploading - ); - } - @Test public void uploadFromFileWithMetadata() throws IOException { Map metadata = Collections.singletonMap("metadata", "value"); @@ -2482,36 +2329,6 @@ public void uploadFromFileWithMetadata() throws IOException { TestUtils.assertArraysEqual(Files.readAllBytes(file.toPath()), outStream.toByteArray()); } - @Test - public void uploadFromFileDefaultNoOverwrite() { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() - .orElseThrow(() -> new RuntimeException("File was not created")); - - File file = getRandomFile(50); - file.deleteOnExit(); - createdFiles.add(file); - - assertThrows(DataLakeStorageException.class, () -> fc.uploadFromFile(file.toPath().toString())); - - StepVerifier.create(fac.uploadFromFile(getRandomFile(50).toPath().toString())) - .verifyError(DataLakeStorageException.class); - } - - @Test - public void uploadFromFileOverwrite() { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() - .orElseThrow(() -> new RuntimeException("File was not created")); - - File file = getRandomFile(50); - file.deleteOnExit(); - createdFiles.add(file); - - assertDoesNotThrow(() -> fc.uploadFromFile(file.toPath().toString(), true)); - - StepVerifier.create(fac.uploadFromFile(getRandomFile(50).toPath().toString(), true)) - .verifyComplete(); - } - /* * Reports the number of bytes sent when uploading a file. This is different from other reporters which track the * number of reports as upload from file hooks into the loading data from disk data stream which is a hard-coded @@ -2531,75 +2348,6 @@ long getReportedByteCount() { } } - private static final class FileUploadListener implements ProgressListener { - private long reportedByteCount; - - @Override - public void handleProgress(long bytesTransferred) { - this.reportedByteCount = bytesTransferred; - } - - long getReportedByteCount() { - return this.reportedByteCount; - } - } - - @SuppressWarnings("deprecation") - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("uploadFromFileWithProgressSupplier") - public void uploadFromFileReporter(int size, long blockSize, int bufferCount) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - FileUploadReporter uploadReporter = new FileUploadReporter(); - - File file = getRandomFile(size); - file.deleteOnExit(); - createdFiles.add(file); - - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) - .setMaxConcurrency(bufferCount) - .setProgressReceiver(uploadReporter) - .setMaxSingleUploadSizeLong(blockSize - 1); - - - StepVerifier.create(fac.uploadFromFile(file.toPath().toString(), parallelTransferOptions, null, null, null)) - .verifyComplete(); - - assertEquals(size, uploadReporter.getReportedByteCount()); - } - - private static Stream uploadFromFileWithProgressSupplier() { - return Stream.of( - // size | blockSize | bufferCount - Arguments.of(10 * Constants.MB, 10L * Constants.MB, 8), - Arguments.of(20 * Constants.MB, (long) Constants.MB, 5), - Arguments.of(10 * Constants.MB, 5L * Constants.MB, 2), - Arguments.of(10 * Constants.MB, 10L * Constants.KB, 100) - ); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("uploadFromFileWithProgressSupplier") - public void uploadFromFileListener(int size, long blockSize, int bufferCount) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - FileUploadListener uploadListener = new FileUploadListener(); - - File file = getRandomFile(size); - file.deleteOnExit(); - createdFiles.add(file); - - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) - .setMaxConcurrency(bufferCount) - .setProgressListener(uploadListener) - .setMaxSingleUploadSizeLong(blockSize - 1); - - StepVerifier.create(fac.uploadFromFile(file.toPath().toString(), parallelTransferOptions, null, null, null)) - .verifyComplete(); - - assertEquals(size, uploadListener.getReportedByteCount()); - } - @ParameterizedTest @MethodSource("uploadFromFileOptionsSupplier") public void uploadFromFileOptions(int dataSize, long singleUploadSize, Long blockSize) { @@ -2638,85 +2386,6 @@ public void uploadFromFileWithResponse(int dataSize, long singleUploadSize, Long assertEquals(dataSize, fc.getProperties().getFileSize()); } - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @Test - public void asyncBufferedUploadEmpty() { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - - StepVerifier.create(fac.upload(Flux.just(ByteBuffer.wrap(new byte[0])), null)) - .verifyError(DataLakeStorageException.class); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("asyncBufferedUploadEmptyBuffersSupplier") - public void asyncBufferedUploadEmptyBuffers(ByteBuffer buffer1, ByteBuffer buffer2, ByteBuffer buffer3, - byte[] expectedDownload) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - - StepVerifier.create(fac.upload(Flux.fromIterable(Arrays.asList(buffer1, buffer2, buffer3)), null, true)) - .assertNext(pathInfo -> assertNotNull(pathInfo.getETag())) - .verifyComplete(); - - StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fac.read())) - .assertNext(bytes -> TestUtils.assertArraysEqual(expectedDownload, bytes)) - .verifyComplete(); - } - - private static Stream asyncBufferedUploadEmptyBuffersSupplier() { - ByteBuffer emptyBuffer = ByteBuffer.allocate(0); - byte[] helloBytes = "Hello".getBytes(StandardCharsets.UTF_8); - byte[] worldBytes = "world!".getBytes(StandardCharsets.UTF_8); - - return Stream.of( - // buffer1 | buffer2 | buffer3 || expectedDownload - Arguments.of(ByteBuffer.wrap(helloBytes), ByteBuffer.wrap(" ".getBytes(StandardCharsets.UTF_8)), ByteBuffer.wrap(worldBytes), "Hello world!".getBytes(StandardCharsets.UTF_8)), - Arguments.of(ByteBuffer.wrap(helloBytes), ByteBuffer.wrap(" ".getBytes(StandardCharsets.UTF_8)), emptyBuffer, "Hello ".getBytes(StandardCharsets.UTF_8)), - Arguments.of(ByteBuffer.wrap(helloBytes), emptyBuffer, ByteBuffer.wrap(worldBytes), "Helloworld!".getBytes(StandardCharsets.UTF_8)), - Arguments.of(emptyBuffer, ByteBuffer.wrap(" ".getBytes(StandardCharsets.UTF_8)), ByteBuffer.wrap(worldBytes), " world!".getBytes(StandardCharsets.UTF_8)) - ); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") // Test uploads large amount of data - @ParameterizedTest - @MethodSource("asyncBufferedUploadSupplier") - public void asyncBufferedUpload(int dataSize, long bufferSize, int numBuffs) { - DataLakeFileAsyncClient facWrite = getPrimaryServiceClientForWrites(bufferSize) - .getFileSystemAsyncClient(dataLakeFileSystemAsyncClient.getFileSystemName()) - .createFile(generatePathName()).blockOptional() - .orElseThrow(() -> new RuntimeException("File was not created")); - DataLakeFileAsyncClient facRead = dataLakeFileSystemAsyncClient.getFileAsyncClient(facWrite.getFileName()); - - byte[] data = getRandomByteArray(dataSize); - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() - .setBlockSizeLong(bufferSize) - .setMaxConcurrency(numBuffs) - .setMaxSingleUploadSizeLong(4L * Constants.MB); - - facWrite.upload(Flux.just(ByteBuffer.wrap(data)), parallelTransferOptions, true).block(); - - // Due to memory issues, this check only runs on small to medium-sized data sets. - if (dataSize < 100 * 1024 * 1024) { - StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(facRead.read(), dataSize)) - .assertNext(bytes -> TestUtils.assertArraysEqual(data, bytes)) - .verifyComplete(); - } - } - - private static Stream asyncBufferedUploadSupplier() { - return Stream.of( - // dataSize | bufferSize | numBuffs || blockCount - Arguments.of(35 * Constants.MB, 5L * Constants.MB, 2), // Requires cycling through the same buffers multiple times. - Arguments.of(35 * Constants.MB, 5L * Constants.MB, 5), // Most buffers may only be used once. - Arguments.of(100 * Constants.MB, 10L * Constants.MB, 2), // Larger data set. - Arguments.of(100 * Constants.MB, 10L * Constants.MB, 5), // Larger number of Buffs. - Arguments.of(10 * Constants.MB, (long) Constants.MB, 10), // Exactly enough buffer space to hold all the data. - Arguments.of(50 * Constants.MB, 10L * Constants.MB, 2), // Larger data. - Arguments.of(10 * Constants.MB, 2L * Constants.MB, 4), - Arguments.of(10 * Constants.MB, 3L * Constants.MB, 3) // Data does not squarely fit in buffers. - ); - } - private static void compareListToBuffer(List buffers, ByteBuffer result) { result.position(0); for (ByteBuffer buffer : buffers) { @@ -2749,177 +2418,6 @@ public void reportProgress(long bytesTransferred) { } } - private static final class Listener implements ProgressListener { - private final long blockSize; - private long reportingCount; - - Listener(long blockSize) { - this.blockSize = blockSize; - } - - @Override - public void handleProgress(long bytesTransferred) { - assert bytesTransferred % blockSize == 0; - this.reportingCount += 1; - } - } - - @SuppressWarnings("deprecation") - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("bufferedUploadWithProgressSupplier") - public void bufferedUploadWithReporter(int size, long blockSize, int bufferCount) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - Reporter uploadReporter = new Reporter(blockSize); - - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) - .setMaxConcurrency(bufferCount) - .setProgressReceiver(uploadReporter) - .setMaxSingleUploadSizeLong(4L * Constants.MB); - - - StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(size)), parallelTransferOptions, null, null, null)) - .assertNext(response -> { - assertEquals(200, response.getStatusCode()); - // Verify that the reporting count is equal or greater than the size divided by block size in the case - // that operations need to be retried. Retry attempts will increment the reporting count. - assertTrue(uploadReporter.reportingCount >= (size / blockSize)); - }) - .verifyComplete(); - } - - private static Stream bufferedUploadWithProgressSupplier() { - return Stream.of( - // size | blockSize | bufferCount - Arguments.of(10 * Constants.MB, 10L * Constants.MB, 8), - Arguments.of(20 * Constants.MB, (long) Constants.MB, 5), - Arguments.of(10 * Constants.MB, 5L * Constants.MB, 2), - Arguments.of(10 * Constants.MB, 512L * Constants.KB, 20) - ); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("bufferedUploadWithProgressSupplier") - public void bufferedUploadWithListener(int size, long blockSize, int bufferCount) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - Listener uploadListener = new Listener(blockSize); - - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) - .setMaxConcurrency(bufferCount) - .setProgressListener(uploadListener) - .setMaxSingleUploadSizeLong(4L * Constants.MB); - - StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(size)), parallelTransferOptions, null, null, null)) - .assertNext(response -> { - assertEquals(200, response.getStatusCode()); - // Verify that the reporting count is equal or greater than the size divided by block size in the case - // that operations need to be retried. Retry attempts will increment the reporting count. - assertTrue(uploadListener.reportingCount >= (size / blockSize)); - }) - .verifyComplete(); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") // Test uploads large amount of data - @ParameterizedTest - @MethodSource("bufferedUploadChunkedSourceSupplier") - public void bufferedUploadChunkedSource(List dataSizeList, long bufferSize, int numBuffers) { - DataLakeFileAsyncClient facWrite = getPrimaryServiceClientForWrites(bufferSize) - .getFileSystemAsyncClient(dataLakeFileSystemAsyncClient.getFileSystemName()) - .createFile(generatePathName()).blockOptional() - .orElseThrow(() -> new RuntimeException("File was not created.")); - DataLakeFileAsyncClient facRead = dataLakeFileSystemAsyncClient.getFileAsyncClient(facWrite.getFileName()); - - // This test should validate that the upload should work regardless of what format the passed data is in because - // it will be chunked appropriately. - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() - .setBlockSizeLong(bufferSize * Constants.MB) - .setMaxConcurrency(numBuffers) - .setMaxSingleUploadSizeLong(4L * Constants.MB); - List dataList = dataSizeList.stream() - .map(size -> getRandomData(size * Constants.MB)) - .collect(Collectors.toList()); - - Mono uploadOperation = facWrite.upload(Flux.fromIterable(dataList), parallelTransferOptions, true) - .then(FluxUtil.collectBytesInByteBufferStream(facRead.read())); - - StepVerifier.create(uploadOperation) - .assertNext(bytes -> compareListToBuffer(dataList, ByteBuffer.wrap(bytes))) - .verifyComplete(); - } - - private static Stream bufferedUploadChunkedSourceSupplier() { - return Stream.of( - // dataSizeList | bufferSize | numBuffers - Arguments.of(Arrays.asList(7, 7), 10L, 2), // First item fits entirely in the buffer, next item spans two buffers - Arguments.of(Arrays.asList(3, 3, 3, 3, 3, 3, 3), 10L, 2), // Multiple items fit non-exactly in one buffer. - Arguments.of(Arrays.asList(10, 10), 10L, 2), // Data fits exactly and does not need chunking. - Arguments.of(Arrays.asList(50, 51, 49), 10L, 2) // Data needs chunking and does not fit neatly in buffers. Requires waiting for buffers to be released. - ); - } - - // These two tests are to test optimizations in buffered upload for small files. - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("bufferedUploadHandlePathingSupplier") - public void bufferedUploadHandlePathing(List dataSizeList) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - List dataList = dataSizeList.stream().map(this::getRandomData).collect(Collectors.toList()); - - Mono uploadOperation = fac.upload(Flux.fromIterable(dataList), - new ParallelTransferOptions().setMaxSingleUploadSizeLong(4L * Constants.MB), true) - .then(FluxUtil.collectBytesInByteBufferStream(fac.read())); - - StepVerifier.create(uploadOperation) - .assertNext(bytes -> compareListToBuffer(dataList, ByteBuffer.wrap(bytes))) - .verifyComplete(); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("bufferedUploadHandlePathingSupplier") - public void bufferedUploadHandlePathingHotFlux(List dataSizeList) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - List dataList = dataSizeList.stream().map(this::getRandomData).collect(Collectors.toList()); - - Mono uploadOperation = fac.upload(Flux.fromIterable(dataList).publish().autoConnect(), - new ParallelTransferOptions().setMaxSingleUploadSizeLong(4L * Constants.MB), true) - .then(FluxUtil.collectBytesInByteBufferStream(fac.read())); - - StepVerifier.create(uploadOperation) - .assertNext(bytes -> compareListToBuffer(dataList, ByteBuffer.wrap(bytes))) - .verifyComplete(); - } - - private static Stream> bufferedUploadHandlePathingSupplier() { - return Stream.of(Arrays.asList(10, 100, 1000, 10000), Arrays.asList(4 * Constants.MB + 1, 10), - Arrays.asList(4 * Constants.MB, 4 * Constants.MB), Collections.singletonList(4 * Constants.MB)); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("bufferedUploadHandlePathingHotFluxWithTransientFailureSupplier") - public void bufferedUploadHandlePathingHotFluxWithTransientFailure(List dataSizeList) { - DataLakeFileAsyncClient clientWithFailure = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl(), - new TransientFailureInjectingHttpPipelinePolicy()); - List dataList = dataSizeList.stream().map(this::getRandomData).collect(Collectors.toList()); - - DataLakeFileAsyncClient fcAsync = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl()); - - Mono uploadOperation = clientWithFailure.upload(Flux.fromIterable(dataList).publish().autoConnect(), - new ParallelTransferOptions().setMaxSingleUploadSizeLong(4L * Constants.MB), true) - .then(FluxUtil.collectBytesInByteBufferStream(fcAsync.read())); - - StepVerifier.create(uploadOperation) - .assertNext(bytes -> compareListToBuffer(dataList, ByteBuffer.wrap(bytes))) - .verifyComplete(); - } - - private static Stream> bufferedUploadHandlePathingHotFluxWithTransientFailureSupplier() { - return Stream.of(Arrays.asList(10, 100, 1000, 10000), Arrays.asList(4 * Constants.MB + 1, 10), - Arrays.asList(4 * Constants.MB, 4 * Constants.MB)); - } - @SuppressWarnings("deprecation") @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") @ParameterizedTest @@ -2941,296 +2439,6 @@ public void bufferedUploadSyncHandlePathingWithTransientFailure(int dataSize) { TestUtils.assertArraysEqual(data, os.toByteArray()); } - @Test - public void bufferedUploadIllegalArgumentsNull() { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() - .orElseThrow(() -> new RuntimeException("Cannot create file.")); - - StepVerifier.create(fac.upload((Flux) null, - new ParallelTransferOptions().setBlockSizeLong(4L).setMaxConcurrency(4), true)) - .verifyError(NullPointerException.class); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("bufferedUploadHeadersSupplier") - public void bufferedUploadHeaders(int dataSize, String cacheControl, String contentDisposition, - String contentEncoding, String contentLanguage, boolean validateContentMD5, String contentType) - throws NoSuchAlgorithmException { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - - byte[] randomData = getRandomByteArray(dataSize); - byte[] contentMD5 = validateContentMD5 ? MessageDigest.getInstance("MD5").digest(randomData) : null; - Mono> uploadOperation = fac - .uploadWithResponse(Flux.just(ByteBuffer.wrap(randomData)), new ParallelTransferOptions().setMaxSingleUploadSizeLong(4L * Constants.MB), new PathHttpHeaders() - .setCacheControl(cacheControl) - .setContentDisposition(contentDisposition) - .setContentEncoding(contentEncoding) - .setContentLanguage(contentLanguage) - .setContentMd5(contentMD5) - .setContentType(contentType), null, null) - .then(fac.getPropertiesWithResponse(null)); - - StepVerifier.create(uploadOperation) - .assertNext(response -> validatePathProperties(response, cacheControl, contentDisposition, contentEncoding, - contentLanguage, contentMD5, contentType == null ? "application/octet-stream" : contentType)) - .verifyComplete(); - } - - private static Stream bufferedUploadHeadersSupplier() { - return Stream.of( - // dataSize | cacheControl | contentDisposition | contentEncoding | contentLanguage | validateContentMD5 | contentType - Arguments.of(DATA.getDefaultDataSize(), null, null, null, null, true, null), - Arguments.of(DATA.getDefaultDataSize(), "control", "disposition", "encoding", "language", true, "type"), - Arguments.of(6 * Constants.MB, null, null, null, null, false, null), - Arguments.of(6 * Constants.MB, "control", "disposition", "encoding", "language", true, "type") - ); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @CsvSource(value = {"null,null,null,null", "foo,bar,fizz,buzz"}, nullValues = "null") - public void bufferedIploadMetadata(String key1, String value1, String key2, String value2) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - Map metadata = new HashMap<>(); - if (key1 != null) { - metadata.put(key1, value1); - } - if (key2 != null) { - metadata.put(key2, value2); - } - - - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(10L) - .setMaxConcurrency(10); - Mono> uploadOperation = fac.uploadWithResponse(Flux.just(getRandomData(10)), - parallelTransferOptions, null, metadata, null) - .then(fac.getPropertiesWithResponse(null)); - - StepVerifier.create(uploadOperation) - .assertNext(response -> { - assertEquals(200, response.getStatusCode()); - assertEquals(metadata, response.getValue().getMetadata()); - }) - .verifyComplete(); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("uploadNumberOfAppendsSupplier") - public void bufferedUploadOptions(int dataSize, Long singleUploadSize, Long blockSize, int numAppends) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - AtomicInteger appendCount = new AtomicInteger(0); - DataLakeFileAsyncClient spyClient = new DataLakeFileAsyncClient(fac) { - @Override - Mono> appendWithResponse(Flux data, long fileOffset, long length, - DataLakeFileAppendOptions appendOptions, Context context) { - appendCount.incrementAndGet(); - return super.appendWithResponse(data, fileOffset, length, appendOptions, context); - } - }; - - StepVerifier.create(spyClient.uploadWithResponse(Flux.just(getRandomData(dataSize)), - new ParallelTransferOptions().setBlockSizeLong(blockSize).setMaxSingleUploadSizeLong(singleUploadSize), null, null, null)) - .expectNextCount(1) - .verifyComplete(); - - StepVerifier.create(fac.getProperties()) - .assertNext(properties -> assertEquals(dataSize, properties.getFileSize())) - .verifyComplete(); - - assertEquals(numAppends, appendCount.get()); - } - - @Test - public void bufferedUploadPermissionsAndUmask() { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - - Mono> uploadOperation = fac.uploadWithResponse( - new FileParallelUploadOptions(Flux.just(getRandomData(10))).setPermissions("0777").setUmask("0057")) - .then(fac.getPropertiesWithResponse(null)); - - StepVerifier.create(uploadOperation) - .assertNext(response -> { - assertEquals(200, response.getStatusCode()); - assertEquals(10, response.getValue().getFileSize()); - }) - .verifyComplete(); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("modifiedMatchAndLeaseIdSupplier") - public void bufferedUploadAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, - String leaseID) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() - .orElseThrow(() -> new RuntimeException("Could not create file")); - - DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() - .setLeaseId(setupPathLeaseCondition(fac, leaseID)) - .setIfMatch(setupPathMatchCondition(fac, match)) - .setIfNoneMatch(noneMatch) - .setIfModifiedSince(modified) - .setIfUnmodifiedSince(unmodified); - - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(10L); - - StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(10)), - parallelTransferOptions, null, null, requestConditions)) - .assertNext(response -> assertEquals(200, response.getStatusCode())) - .verifyComplete(); - } - - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") - public void bufferedUploadACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, - String leaseID) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() - .orElseThrow(() -> new RuntimeException("Could not create file")); - DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() - .setLeaseId(setupPathLeaseCondition(fac, leaseID)) - .setIfMatch(match) - .setIfNoneMatch(setupPathMatchCondition(fac, noneMatch)) - .setIfModifiedSince(modified) - .setIfUnmodifiedSince(unmodified); - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(10L); - - StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(10)), - parallelTransferOptions, null, null, requestConditions)) - .verifyErrorSatisfies(ex -> { - DataLakeStorageException exception = assertInstanceOf(DataLakeStorageException.class, ex); - assertEquals(412, exception.getStatusCode()); - }); - } - - // UploadBufferPool used to lock when the number of failed stageblocks exceeded the maximum number of buffers - // (discovered when a leaseId was invalid) - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @ParameterizedTest - @CsvSource({"7,2", "5,2"}) - public void uploadBufferPoolLockThreeOrMoreBuffers(long blockSize, int numBuffers) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() - .orElseThrow(() -> new RuntimeException("Could not create file")); - DataLakeRequestConditions requestConditions = new DataLakeRequestConditions(). - setLeaseId(setupPathLeaseCondition(fac, GARBAGE_LEASE_ID)); - - ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) - .setMaxConcurrency(numBuffers); - - - StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(10)), - parallelTransferOptions, null, null, requestConditions)) - .verifyError(DataLakeStorageException.class); - } - -// /*def "Upload NRF progress"() { -// -// def data = getRandomData(BlockBlobURL.MAX_UPLOAD_BLOB_BYTES + 1) -// def numBlocks = data.remaining() / BlockBlobURL.MAX_STAGE_BLOCK_BYTES -// long prevCount = 0 -// def mockReceiver = Mock(IProgressReceiver) -// -// -// -// TransferManager.uploadFromNonReplayableFlowable(Flowable.just(data), bu, BlockBlobURL.MAX_STAGE_BLOCK_BYTES, 10, -// new TransferManagerUploadToBlockBlobOptions(mockReceiver, null, null, null, 20)).blockingGet() -// data.position(0) -// -// -// // We should receive exactly one notification of the completed progress. -// 1 * mockReceiver.reportProgress(data.remaining()) */ -// -// /* -// We should receive at least one notification reporting an intermediary value per block, but possibly more -// notifications will be received depending on the implementation. We specify numBlocks - 1 because the last block -// will be the total size as above. Finally, we assert that the number reported monotonically increases. -// */ -// /*(numBlocks - 1.._) * mockReceiver.reportProgress(!data.remaining()) >> { long bytesTransferred -> -// if (!(bytesTransferred > prevCount)) { -// throw new IllegalArgumentException("Reported progress should monotonically increase") -// } else { -// prevCount = bytesTransferred -// } -// } -// -// // We should receive no notifications that report more progress than the size of the file. -// 0 * mockReceiver.reportProgress({ it > data.remaining() }) -// notThrown(IllegalArgumentException) -//}*/ -// - -// public void bufferedUploadNetworkError() { -// -// DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()) -// -// /* -// This test uses a Flowable that does not allow multiple subscriptions and therefore ensures that we are -// buffering properly to allow for retries even given this source behavior. -// */ -// fac.upload(Flux.just(defaultData), defaultDataSize, null, true).block() -// -// // Mock a response that will always be retried. -// def mockHttpResponse = getStubResponse(500, new HttpRequest(HttpMethod.PUT, new URL("https://www.fake.com"))) -// -// // Mock a policy that will always then check that the data is still the same and return a retryable error. -// def mockPolicy = { HttpPipelineCallContext context, HttpPipelineNextPolicy next -> -// return context.getHttpRequest().getBody() == null ? next.process() : -// collectBytesInBuffer(context.getHttpRequest().getBody()) -// .map({ it == defaultData }) -// .flatMap({ it ? Mono.just(mockHttpResponse) : Mono.error(new IllegalArgumentException()) }) -// } -// -// // Build the pipeline -// DataLakeServiceClientBuilder fileAsyncClient = new DataLakeServiceClientBuilder() -// .credential(primaryCredential) -// .endpoint(String.format(defaultEndpointTemplate, primaryCredential.getAccountName())) -// .httpClient(getHttpClient()) -// .retryOptions(new RequestRetryOptions(null, 3, null, 500, 1500, null)) -// .addPolicy(mockPolicy).buildAsyncClient() -// .getFileSystemAsyncClient(fac.getFileSystemName()) -// .getFileAsyncClient(generatePathName()) -// -// -// // Try to upload the flowable, which will hit a retry. A normal upload would throw, but buffering prevents that. -// ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions(1024, 4, null, null) -// // TODO: It could be that duplicates aren't getting made in the retry policy? Or before the retry policy? -// -// -// // A second subscription to a download stream will -// StepVerifier.create(fileAsyncClient.upload(fac.read(), defaultDataSize, parallelTransferOptions)) -// .verifyErrorSatisfies({ -// assert it instanceof DataLakeStorageException -// assert assertEquals(500, it.getStatusCode()); -// }) -// } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @Test - public void bufferedUploadDefaultNoOverwrite() { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - fac.upload(DATA.getDefaultFlux(), null).block(); - - StepVerifier.create(fac.upload(DATA.getDefaultFlux(), null)) - .verifyError(IllegalArgumentException.class); - } - - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") - @Test - public void bufferedUploadOverwrite() { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - - File file = getRandomFile(50); - file.deleteOnExit(); - createdFiles.add(file); - - assertDoesNotThrow(() -> fc.uploadFromFile(file.toPath().toString(), true)); - - StepVerifier.create(fac.uploadFromFile(getRandomFile(50).toPath().toString(), true)) - .verifyComplete(); - } - @Test public void bufferedUploadNonMarkableStream() throws FileNotFoundException { File file = getRandomFile(10); @@ -4112,48 +3320,6 @@ public void uploadIncorrectSize() { () -> fc.upload(DATA.getDefaultInputStream(), DATA.getDefaultDataSizeLong() + 1, true)); } - @SuppressWarnings("deprecation") - @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") /* Flaky in playback. */ - @ParameterizedTest - @MethodSource("uploadNumberOfAppendsSupplier") - public void uploadNumAppends(int dataSize, Long singleUploadSize, Long blockSize, int numAppends) { - DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - AtomicInteger numAppendsCounter = new AtomicInteger(0); - DataLakeFileAsyncClient spyClient = new DataLakeFileAsyncClient(fac) { - @Override - Mono> appendWithResponse(Flux data, long fileOffset, long length, - DataLakeFileAppendOptions appendOptions, Context context) { - numAppendsCounter.incrementAndGet(); - return super.appendWithResponse(data, fileOffset, length, appendOptions, context); - } - }; - ByteArrayInputStream input = new ByteArrayInputStream(getRandomByteArray(dataSize)); - - ParallelTransferOptions pto = new ParallelTransferOptions().setBlockSizeLong(blockSize) - .setMaxSingleUploadSizeLong(singleUploadSize); - - StepVerifier.create(spyClient.uploadWithResponse(new FileParallelUploadOptions(input, dataSize) - .setParallelTransferOptions(pto))) - .expectNextCount(1) - .verifyComplete(); - - StepVerifier.create(fac.getProperties()) - .assertNext(properties -> assertEquals(dataSize, properties.getFileSize())) - .verifyComplete(); - assertEquals(numAppends, numAppendsCounter.get()); - } - - private static Stream uploadNumberOfAppendsSupplier() { - return Stream.of( - // dataSize | singleUploadSize | blockSize | numAppends - Arguments.of((100 * Constants.MB) - 1, null, null, 1), - Arguments.of((100 * Constants.MB) + 1, null, null, (int) Math.ceil(((double) (100 * Constants.MB) + 1) / (double) (4 * Constants.MB))), - Arguments.of(100, 50L, null, 1), - Arguments.of(100, 50L, 20L, 5) - ); - } - - @SuppressWarnings("deprecation") @Test public void uploadReturnValue() { diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAsyncApiTests.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAsyncApiTests.java index de3809d7ecb3..f1c1a3c7f58a 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAsyncApiTests.java @@ -2,10 +2,41 @@ // Licensed under the MIT License. package com.azure.storage.file.datalake; +import com.azure.core.exception.UnexpectedLengthException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.rest.Response; +import com.azure.core.test.utils.TestUtils; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.ProgressListener; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.storage.blob.BlobUrlParts; +import com.azure.storage.blob.models.BlobErrorCode; +import com.azure.storage.common.ParallelTransferOptions; +import com.azure.storage.common.ProgressReceiver; +import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.test.shared.policy.MockFailureResponsePolicy; +import com.azure.storage.common.test.shared.policy.MockRetryRangeResponsePolicy; +import com.azure.storage.file.datalake.models.AccessTier; import com.azure.storage.file.datalake.models.DataLakeRequestConditions; import com.azure.storage.file.datalake.models.DataLakeStorageException; +import com.azure.storage.file.datalake.models.DownloadRetryOptions; +import com.azure.storage.file.datalake.models.FileExpirationOffset; +import com.azure.storage.file.datalake.models.FileQueryArrowField; +import com.azure.storage.file.datalake.models.FileQueryArrowFieldType; +import com.azure.storage.file.datalake.models.FileQueryArrowSerialization; +import com.azure.storage.file.datalake.models.FileQueryDelimitedSerialization; +import com.azure.storage.file.datalake.models.FileQueryError; +import com.azure.storage.file.datalake.models.FileQueryJsonSerialization; +import com.azure.storage.file.datalake.models.FileQueryParquetSerialization; +import com.azure.storage.file.datalake.models.FileQueryProgress; +import com.azure.storage.file.datalake.models.FileQuerySerialization; +import com.azure.storage.file.datalake.models.FileRange; +import com.azure.storage.file.datalake.models.LeaseAction; import com.azure.storage.file.datalake.models.LeaseDurationType; import com.azure.storage.file.datalake.models.LeaseStateType; import com.azure.storage.file.datalake.models.LeaseStatusType; @@ -13,34 +44,92 @@ import com.azure.storage.file.datalake.models.PathAccessControlEntry; import com.azure.storage.file.datalake.models.PathHttpHeaders; import com.azure.storage.file.datalake.models.PathPermissions; +import com.azure.storage.file.datalake.models.PathProperties; +import com.azure.storage.file.datalake.models.PathRemoveAccessControlEntry; +import com.azure.storage.file.datalake.models.RolePermissions; +import com.azure.storage.file.datalake.options.DataLakeFileAppendOptions; import com.azure.storage.file.datalake.options.DataLakePathCreateOptions; +import com.azure.storage.file.datalake.options.DataLakePathDeleteOptions; import com.azure.storage.file.datalake.options.DataLakePathScheduleDeletionOptions; +import com.azure.storage.file.datalake.options.FileParallelUploadOptions; +import com.azure.storage.file.datalake.options.FileQueryOptions; +import com.azure.storage.file.datalake.options.FileScheduleDeletionOptions; +import com.azure.storage.file.datalake.sas.DataLakeServiceSasSignatureValues; +import com.azure.storage.file.datalake.sas.FileSystemSasPermission; +import com.azure.storage.file.datalake.specialized.DataLakeLeaseAsyncClient; import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledIf; +import org.junit.jupiter.api.condition.EnabledIf; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; +import reactor.core.Exceptions; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Hooks; +import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.nio.ByteBuffer; +import java.nio.channels.AsynchronousFileChannel; +import java.nio.charset.StandardCharsets; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.Files; +import java.nio.file.OpenOption; +import java.nio.file.StandardOpenOption; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.time.Duration; import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Base64; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; +import java.util.stream.Collectors; import java.util.stream.Stream; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; public class FileAsyncApiTests extends DataLakeTestBase { private DataLakeFileAsyncClient fc; private final List createdFiles = new ArrayList<>(); + private static final PathPermissions PERMISSIONS = new PathPermissions() + .setOwner(new RolePermissions().setReadPermission(true).setWritePermission(true).setExecutePermission(true)) + .setGroup(new RolePermissions().setReadPermission(true).setExecutePermission(true)) + .setOther(new RolePermissions().setReadPermission(true)); + private static final String GROUP = null; + private static final String OWNER = null; + private static final List PATH_ACCESS_CONTROL_ENTRIES = + PathAccessControlEntry.parseList("user::rwx,group::r--,other::---,mask::rwx"); + @BeforeEach public void setup() { @@ -67,8 +156,12 @@ public void createMin() { public void createDefaults() { fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - StepVerifier.create(fc.createWithResponse(null, null, null, null, null)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) + StepVerifier.create(fc.createWithResponse( + null, null, null, null, null)) + .assertNext(r -> { + assertEquals(201, r.getStatusCode()); + validateBasicHeaders(r.getHeaders()); + }) .verifyComplete(); } @@ -76,7 +169,8 @@ public void createDefaults() { public void createError() { fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - StepVerifier.create(fc.createWithResponse(null, null, null, null, new DataLakeRequestConditions().setIfMatch("garbage"))) + StepVerifier.create(fc.createWithResponse( + null, null, null, null, new DataLakeRequestConditions().setIfMatch("garbage"))) .verifyError(DataLakeStorageException.class); } @@ -125,11 +219,8 @@ public void createHeaders(String cacheControl, String contentDisposition, String String finalContentType = contentType; StepVerifier.create(fc.getPropertiesWithResponse(null)) .assertNext(r -> { - assertEquals(cacheControl, r.getValue().getCacheControl()); - assertEquals(contentDisposition, r.getValue().getContentDisposition()); - assertEquals(contentEncoding, r.getValue().getContentEncoding()); - assertEquals(contentLanguage, r.getValue().getContentLanguage()); - assertEquals(finalContentType, r.getValue().getContentType()); + validatePathProperties(r, cacheControl, contentDisposition, contentEncoding, contentLanguage, + null, finalContentType); }) .verifyComplete(); } @@ -173,7 +264,8 @@ public void createEncryptionContext() { .verifyComplete(); StepVerifier.create(fc.readWithResponse(null, null, null, false)) - .assertNext(r -> assertEquals(encryptionContext, r.getDeserializedHeaders().getEncryptionContext())); + .assertNext(r -> assertEquals(encryptionContext, r.getDeserializedHeaders().getEncryptionContext())) + .verifyComplete(); // testing encryption context with listPaths() StepVerifier.create(dataLakeFileSystemAsyncClient.listPaths(new ListPathsOptions().setRecursive(true))) @@ -193,9 +285,7 @@ public void createAC(OffsetDateTime modified, OffsetDateTime unmodified, String .setIfModifiedSince(modified) .setIfUnmodifiedSince(unmodified); - StepVerifier.create(fc.createWithResponse(null, null, null, null, drc)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) - .verifyComplete(); + assertAsyncResponseStatusCode(fc.createWithResponse(null, null, null, null, drc), 201); } private static Stream modifiedMatchAndLeaseIdSupplier() { @@ -239,9 +329,8 @@ private static Stream invalidModifiedMatchAndLeaseIdSupplier() { @Test public void createPermissionsAndUmask() { - StepVerifier.create(fc.createWithResponse("0777", "0057", null, null, null)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) - .verifyComplete(); + assertAsyncResponseStatusCode(fc.createWithResponse( + "0777", "0057", null, null, null), 201); } private static boolean olderThan20201206ServiceVersion() { @@ -307,9 +396,7 @@ public void createOptionsWithPathHttpHeaders(String cacheControl, String content .setContentType(contentType); DataLakePathCreateOptions options = new DataLakePathCreateOptions().setPathHttpHeaders(putHeaders); - StepVerifier.create(fc.createWithResponse(options, null)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) - .verifyComplete(); + assertAsyncResponseStatusCode(fc.createWithResponse(options, null), 201); } @ParameterizedTest @@ -324,9 +411,7 @@ public void createOptionsWithMetadata(String key1, String value1, String key2, S } DataLakePathCreateOptions options = new DataLakePathCreateOptions().setMetadata(metadata); - StepVerifier.create(fc.createWithResponse(options, null)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) - .verifyComplete(); + assertAsyncResponseStatusCode(fc.createWithResponse(options, null), 201); StepVerifier.create(fc.getProperties()) .assertNext(r -> { @@ -344,21 +429,10 @@ public void createOptionsWithPermissionsAndUmask() { fc.createWithResponse(options, null).block(); - StepVerifier.create(fc.getAccessControlWithResponse(true, null, null)) - .assertNext(r -> assertEquals(PathPermissions.parseSymbolic("rwx-w----").toString(), r.getValue().getPermissions().toString())) - .verifyComplete(); - } - - @DisabledIf("olderThan20201206ServiceVersion") - @Test - public void createIfNotExistsOptionsWithLeaseId() { - fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); - - String leaseId = CoreUtils.randomUuid().toString(); - DataLakePathCreateOptions options = new DataLakePathCreateOptions().setProposedLeaseId(leaseId).setLeaseDuration(15); - - StepVerifier.create(fc.createIfNotExistsWithResponse(options, null)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) + StepVerifier.create(fc.getAccessControlWithResponse( + true, null, null)) + .assertNext(r -> assertEquals(PathPermissions.parseSymbolic("rwx-w----").toString(), + r.getValue().getPermissions().toString())) .verifyComplete(); } @@ -368,9 +442,7 @@ public void createOptionsWithLeaseId() { String leaseId = CoreUtils.randomUuid().toString(); DataLakePathCreateOptions options = new DataLakePathCreateOptions().setProposedLeaseId(leaseId).setLeaseDuration(15); - StepVerifier.create(fc.createWithResponse(options, null)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) - .verifyComplete(); + assertAsyncResponseStatusCode(fc.createWithResponse(options, null), 201); } @Test @@ -389,9 +461,7 @@ public void createOptionsWithLeaseDuration() { String leaseId = CoreUtils.randomUuid().toString(); DataLakePathCreateOptions options = new DataLakePathCreateOptions().setLeaseDuration(15).setProposedLeaseId(leaseId); - StepVerifier.create(fc.createWithResponse(options, null)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) - .verifyComplete(); + assertAsyncResponseStatusCode(fc.createWithResponse(options, null), 201); StepVerifier.create(fc.getProperties()) .assertNext(r -> { @@ -408,9 +478,7 @@ public void createOptionsWithLeaseDuration() { public void createOptionsWithTimeExpiresOn(DataLakePathScheduleDeletionOptions deletionOptions) { DataLakePathCreateOptions options = new DataLakePathCreateOptions().setScheduleDeletionOptions(deletionOptions); - StepVerifier.create(fc.createWithResponse(options, null)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) - .verifyComplete(); + assertAsyncResponseStatusCode(fc.createWithResponse(options, null), 201); } private static Stream timeExpiresOnOptionsSupplier() { @@ -424,12 +492,3650 @@ public void createOptionsWithTimeToExpireRelativeToNow() { DataLakePathCreateOptions options = new DataLakePathCreateOptions() .setScheduleDeletionOptions(deletionOptions); - StepVerifier.create(fc.createWithResponse(options, null)) - .assertNext(r -> assertEquals(201, r.getStatusCode())) - .verifyComplete(); + assertAsyncResponseStatusCode(fc.createWithResponse(options, null), 201); StepVerifier.create(fc.getProperties()) .assertNext(r -> compareDatesWithPrecision(r.getExpiresOn(), r.getCreationTime().plusDays(6))) .verifyComplete(); } -} + + @Test + public void createIfNotExistsMin() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + fc.createIfNotExists().block(); + + StepVerifier.create(fc.exists()) + .expectNext(true) + .verifyComplete(); + } + + @Test + public void createIfNotExistsDefaults() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fc.createIfNotExistsWithResponse(new DataLakePathCreateOptions(), null)) + .assertNext(r -> { + assertEquals(201, r.getStatusCode()); + validateBasicHeaders(r.getHeaders()); + }) + .verifyComplete(); + } + + @Test + public void createIfNotExistsOverwrite() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + assertAsyncResponseStatusCode(fc.createIfNotExistsWithResponse(new DataLakePathCreateOptions(), null), + 201); + + StepVerifier.create(fc.exists()) + .expectNext(true) + .verifyComplete(); + + assertAsyncResponseStatusCode(fc.createIfNotExistsWithResponse(new DataLakePathCreateOptions(), null), + 409); + } + + @Test + public void createIfNotExistsExists() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + fc.createIfNotExists().block(); + + assertTrue(fc.exists().block()); + } + + @ParameterizedTest + @CsvSource(value = {"null,null,null,null,null", "control, disposition, encoding, language, type"}) + public void createIfNotExistsHeaders(String cacheControl, String contentDisposition, String contentEncoding, + String contentLanguage, String contentType) { + PathHttpHeaders headers = new PathHttpHeaders().setCacheControl(cacheControl) + .setContentDisposition(contentDisposition) + .setContentEncoding(contentEncoding) + .setContentLanguage(contentLanguage) + .setContentType(contentType); + + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + contentType = (contentType == null) ? "application/octet-stream" : contentType; + fc.createIfNotExistsWithResponse(new DataLakePathCreateOptions().setPathHttpHeaders(headers), null).block(); + + String finalContentType = contentType; + StepVerifier.create(fc.getPropertiesWithResponse(null)) + .assertNext(r -> validatePathProperties(r, cacheControl, contentDisposition, contentEncoding, + contentLanguage, null, finalContentType)) + .verifyComplete(); + } + + @ParameterizedTest + @CsvSource(value = {"null,null,null,null", "foo,bar,fizz,buzz"}, nullValues = "null") + public void createIfNotExistsMetadata(String key1, String value1, String key2, String value2) { + Map metadata = new HashMap<>(); + if (key1 != null) { + metadata.put(key1, value1); + } + if (key2 != null) { + metadata.put(key2, value2); + } + + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + fc.createIfNotExistsWithResponse(new DataLakePathCreateOptions().setMetadata(metadata), Context.NONE).block(); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> assertEquals(metadata, r.getMetadata())) + .verifyComplete(); + } + + @Test + public void createIfNotExistsPermissionsAndUmask() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + assertAsyncResponseStatusCode(fc.createIfNotExistsWithResponse(new DataLakePathCreateOptions() + .setPermissions("0777").setUmask("0057"), Context.NONE), 201); + } + + @DisabledIf("olderThan20210410ServiceVersion") + @Test + public void createIfNotExistsEncryptionContext() { + dataLakeFileSystemAsyncClient = primaryDataLakeServiceAsyncClient.getFileSystemAsyncClient(generateFileSystemName()); + dataLakeFileSystemAsyncClient.create().block(); + dataLakeFileSystemAsyncClient.getDirectoryAsyncClient(generatePathName()).create().block(); + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + String encryptionContext = "encryptionContext"; + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setEncryptionContext(encryptionContext); + fc.createIfNotExistsWithResponse(options, Context.NONE).block(); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> assertEquals(encryptionContext, r.getEncryptionContext())) + .verifyComplete(); + + StepVerifier.create(fc.readWithResponse(null, null, null, false)) + .assertNext(r -> assertEquals(encryptionContext, r.getDeserializedHeaders().getEncryptionContext())) + .verifyComplete(); + + StepVerifier.create(dataLakeFileSystemAsyncClient.listPaths(new ListPathsOptions().setRecursive(true))) + .expectNextCount(1) + .assertNext(r -> assertEquals(encryptionContext, r.getEncryptionContext())) + .verifyComplete(); + } + + @DisabledIf("olderThan20201206ServiceVersion") + @Test + public void createIfNotExistsOptionsWithACL() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + List pathAccessControlEntries = PathAccessControlEntry.parseList("user::rwx,group::r--,other::---,mask::rwx"); + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setAccessControlList(pathAccessControlEntries); + + fc.createIfNotExistsWithResponse(options, null).block(); + + StepVerifier.create(fc.getAccessControl()) + .assertNext(r -> { + assertEquals(pathAccessControlEntries.get(0), r.getAccessControlList().get(0)); + assertEquals(pathAccessControlEntries.get(1), r.getAccessControlList().get(1)); + }) + .verifyComplete(); + } + + @DisabledIf("olderThan20201206ServiceVersion") + @Test + public void createIfNotExistsOptionsWithOwnerAndGroup() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + String ownerName = testResourceNamer.randomUuid(); + String groupName = testResourceNamer.randomUuid(); + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setOwner(ownerName).setGroup(groupName); + + fc.createIfNotExistsWithResponse(options, null).block(); + + StepVerifier.create(fc.getAccessControl()) + .assertNext(r -> { + assertEquals(ownerName, r.getOwner()); + assertEquals(groupName, r.getGroup()); + }) + .verifyComplete(); + } + + @Test + public void createIfNotExistsOptionsWithNullOwnerAndGroup() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setOwner(null).setGroup(null); + + fc.createIfNotExistsWithResponse(options, null).block(); + + StepVerifier.create(fc.getAccessControl()) + .assertNext(r -> { + assertEquals("$superuser", r.getOwner()); + assertEquals("$superuser", r.getGroup()); + }) + .verifyComplete(); + } + + @ParameterizedTest + @CsvSource(value = {"null,null,null,null,null,application/octet-stream", "control,disposition,encoding,language,null,type"}, + nullValues = "null") + public void createIfNotExistsOptionsWithPathHttpHeaders(String cacheControl, String contentDisposition, + String contentEncoding, String contentLanguage, byte[] contentMD5, String contentType) { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + PathHttpHeaders putHeaders = new PathHttpHeaders() + .setCacheControl(cacheControl) + .setContentDisposition(contentDisposition) + .setContentEncoding(contentEncoding) + .setContentLanguage(contentLanguage) + .setContentMd5(contentMD5) + .setContentType(contentType); + + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setPathHttpHeaders(putHeaders); + + assertAsyncResponseStatusCode(fc.createIfNotExistsWithResponse(options, null), 201); + } + + @ParameterizedTest + @CsvSource(value = {"null,null,null,null", "foo,bar,fizz,buzz"}, nullValues = "null") + public void createIfNotExistsOptionsWithMetadata(String key1, String value1, String key2, String value2) { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + Map metadata = new HashMap<>(); + if (key1 != null && value1 != null) { + metadata.put(key1, value1); + } + if (key2 != null && value2 != null) { + metadata.put(key2, value2); + } + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setMetadata(metadata); + + assertAsyncResponseStatusCode(fc.createIfNotExistsWithResponse(options, null), 201); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> { + for (String k : metadata.keySet()) { + assertTrue(r.getMetadata().containsKey(k)); + assertEquals(metadata.get(k), r.getMetadata().get(k)); + } + }) + .verifyComplete(); + } + + @Test + public void createIfNotExistsOptionsWithPermissionsAndUmask() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setPermissions("0777").setUmask("0057"); + fc.createIfNotExistsWithResponse(options, null).block(); + + StepVerifier.create(fc.getAccessControlWithResponse( + true, null, null)) + .assertNext(r -> assertEquals(PathPermissions.parseSymbolic("rwx-w----").toString(), + r.getValue().getPermissions().toString())) + .verifyComplete(); + } + + @DisabledIf("olderThan20201206ServiceVersion") + @Test + public void createIfNotExistsOptionsWithLeaseId() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + String leaseId = testResourceNamer.randomUuid(); + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setProposedLeaseId(leaseId).setLeaseDuration(15); + + assertAsyncResponseStatusCode(fc.createIfNotExistsWithResponse(options, null), 201); + } + + @Test + public void createIfNotExistsOptionsWithLeaseIdError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + String leaseId = CoreUtils.randomUuid().toString(); + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setProposedLeaseId(leaseId); + + StepVerifier.create(fc.createIfNotExistsWithResponse(options, null)) + .verifyError(DataLakeStorageException.class); + } + + @DisabledIf("olderThan20201206ServiceVersion") + @Test + public void createIfNotExistsOptionsWithLeaseDuration() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + String leaseId = CoreUtils.randomUuid().toString(); + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setLeaseDuration(15).setProposedLeaseId(leaseId); + + assertAsyncResponseStatusCode(fc.createIfNotExistsWithResponse(options, null), 201); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> { + assertEquals(LeaseStatusType.LOCKED, r.getLeaseStatus()); + assertEquals(LeaseStateType.LEASED, r.getLeaseState()); + assertEquals(LeaseDurationType.FIXED, r.getLeaseDuration()); + }) + .verifyComplete(); + } + + @DisabledIf("olderThan20201206ServiceVersion") + @ParameterizedTest + @MethodSource("timeExpiresOnOptionsSupplier") + public void createIfNotExistsOptionsWithTimeExpiresOn(DataLakePathScheduleDeletionOptions deletionOptions) { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + DataLakePathCreateOptions options = new DataLakePathCreateOptions().setScheduleDeletionOptions(deletionOptions); + + assertAsyncResponseStatusCode(fc.createIfNotExistsWithResponse(options, null), 201); + } + + @DisabledIf("olderThan20201206ServiceVersion") + @Test + public void createIfNotExistsOptionsWithTimeToExpireRelativeToNow() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + DataLakePathScheduleDeletionOptions deletionOptions = new DataLakePathScheduleDeletionOptions(Duration.ofDays(6)); + DataLakePathCreateOptions options = new DataLakePathCreateOptions() + .setScheduleDeletionOptions(deletionOptions); + + assertAsyncResponseStatusCode(fc.createIfNotExistsWithResponse(options, null), 201); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> compareDatesWithPrecision(r.getExpiresOn(), r.getCreationTime().plusDays(6))) + .verifyComplete(); + } + @Test + public void deleteMin() { + assertAsyncResponseStatusCode(fc.deleteWithResponse( + null, null, null), 200); + } + + @Test + public void deleteFileDoesNotExistAnymore() { + fc.deleteWithResponse(null, null, null).block(); + + StepVerifier.create(fc.getPropertiesWithResponse(null)) + .verifyErrorSatisfies(r -> DataLakeTestBase.assertExceptionStatusCodeAndMessage(r, 404, + BlobErrorCode.BLOB_NOT_FOUND)); + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void deleteAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.deleteWithResponse(drc), 200); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void deleteACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.deleteWithResponse(drc)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void deleteIfExists() { + StepVerifier.create(fc.deleteIfExists()) + .expectNext(true) + .verifyComplete(); + } + + @Test + public void deleteIfExistsMin() { + assertAsyncResponseStatusCode(fc.deleteIfExistsWithResponse(null, null), 200); + } + + @Test + public void deleteIfExistsFileDoesNotExistAnymore() { + assertAsyncResponseStatusCode(fc.deleteIfExistsWithResponse(null, null), 200); + StepVerifier.create(fc.getPropertiesWithResponse(null)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void deleteIfExistsFileThatDoesNotExist() { + assertAsyncResponseStatusCode(fc.deleteIfExistsWithResponse(null, null), 200); + assertAsyncResponseStatusCode(fc.deleteIfExistsWithResponse(null, null), 404); + + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void deleteIfExistsAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setIsRecursive(false).setRequestConditions(drc); + + assertAsyncResponseStatusCode(fc.deleteIfExistsWithResponse(options, null), 200); + + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void deleteIfExistsACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + DataLakePathDeleteOptions options = new DataLakePathDeleteOptions().setRequestConditions(drc); + + StepVerifier.create(fc.deleteIfExistsWithResponse(options, null)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void setPermissionsMin() { + StepVerifier.create(fc.setPermissions(PERMISSIONS, GROUP, OWNER)) + .assertNext(r -> { + assertNotNull(r.getETag()); + assertNotNull(r.getLastModified()); + }) + .verifyComplete(); + } + + @Test + public void setPermissionsWithResponse() { + assertAsyncResponseStatusCode(fc.setPermissionsWithResponse(PERMISSIONS, GROUP, OWNER, null), + 200); + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void setPermissionsAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.setPermissionsWithResponse(PERMISSIONS, GROUP, OWNER, drc), 200); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void setPermissionsACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.setPermissionsWithResponse(PERMISSIONS, GROUP, OWNER, drc)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void setPermissionsError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fc.setPermissionsWithResponse(PERMISSIONS, GROUP, OWNER, null)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void setACLMin() { + StepVerifier.create(fc.setAccessControlList(PATH_ACCESS_CONTROL_ENTRIES, GROUP, OWNER)) + .assertNext(r -> { + assertNotNull(r.getETag()); + assertNotNull(r.getLastModified()); + }) + .verifyComplete(); + } + + @Test + public void setACLWithResponse() { + assertAsyncResponseStatusCode(fc.setAccessControlListWithResponse( + PATH_ACCESS_CONTROL_ENTRIES, GROUP, OWNER, null), 200); + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void setAclAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.setAccessControlListWithResponse(PATH_ACCESS_CONTROL_ENTRIES, GROUP, OWNER, drc), + 200); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void setAclACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.setAccessControlListWithResponse(PATH_ACCESS_CONTROL_ENTRIES, GROUP, OWNER, drc)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void setACLError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fc.setAccessControlList(PATH_ACCESS_CONTROL_ENTRIES, GROUP, OWNER)) + .verifyError(DataLakeStorageException.class); + } + + private static boolean olderThan20200210ServiceVersion() { + return olderThan(DataLakeServiceVersion.V2020_02_10); + } + + @DisabledIf("olderThan20200210ServiceVersion") + @Test + public void setACLRecursive() { + StepVerifier.create(fc.setAccessControlRecursive(PATH_ACCESS_CONTROL_ENTRIES)) + .assertNext(r -> { + assertEquals(0L, r.getCounters().getChangedDirectoriesCount()); + assertEquals(1L, r.getCounters().getChangedFilesCount()); + assertEquals(0L, r.getCounters().getFailedChangesCount()); + }) + .verifyComplete(); + } + + @DisabledIf("olderThan20200210ServiceVersion") + @Test + public void updateACLRecursive() { + StepVerifier.create(fc.updateAccessControlRecursive(PATH_ACCESS_CONTROL_ENTRIES)) + .assertNext(r -> { + assertEquals(0L, r.getCounters().getChangedDirectoriesCount()); + assertEquals(1L, r.getCounters().getChangedFilesCount()); + assertEquals(0L, r.getCounters().getFailedChangesCount()); + }) + .verifyComplete(); + } + + @DisabledIf("olderThan20200210ServiceVersion") + @Test + public void removeACLRecursive() { + List removeAccessControlEntries = PathRemoveAccessControlEntry.parseList( + "mask,default:user,default:group,user:ec3595d6-2c17-4696-8caa-7e139758d24a," + + "group:ec3595d6-2c17-4696-8caa-7e139758d24a,default:user:ec3595d6-2c17-4696-8caa-7e139758d24a," + + "default:group:ec3595d6-2c17-4696-8caa-7e139758d24a"); + + StepVerifier.create(fc.removeAccessControlRecursive(removeAccessControlEntries)) + .assertNext(r -> { + assertEquals(0L, r.getCounters().getChangedDirectoriesCount()); + assertEquals(1L, r.getCounters().getChangedFilesCount()); + assertEquals(0L, r.getCounters().getFailedChangesCount()); + }) + .verifyComplete(); + } + + @Test + public void getAccessControlMin() { + StepVerifier.create(fc.getAccessControl()) + .assertNext(r -> { + assertNotNull(r.getAccessControlList()); + assertNotNull(r.getPermissions()); + assertNotNull(r.getOwner()); + assertNotNull(r.getGroup()); + }) + .verifyComplete(); + } + + @Test + public void getAccessControlWithResponse() { + assertAsyncResponseStatusCode(fc.getAccessControlWithResponse( + false, null, null), 200); + } + + @Test + public void getAccessControlReturnUpn() { + assertAsyncResponseStatusCode(fc.getAccessControlWithResponse( + true, null, null), 200); + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void getAccessControlAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.getAccessControlWithResponse( + false, drc, null), 200); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void getAccessControlACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, + String noneMatch, String leaseID) { + if (GARBAGE_LEASE_ID.equals(leaseID)) { + return; // known bug in DFS endpoint + } + + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.getAccessControlWithResponse(false, drc, null)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void getPropertiesDefault() { + StepVerifier.create(fc.getPropertiesWithResponse(null)) + .assertNext(r -> { + HttpHeaders headers = r.getHeaders(); + PathProperties properties = r.getValue(); + + validateBasicHeaders(headers); + assertEquals("bytes", headers.getValue(HttpHeaderName.ACCEPT_RANGES)); + assertNotNull(properties.getCreationTime()); + assertNotNull(properties.getLastModified()); + assertNotNull(properties.getETag()); + assertTrue(properties.getFileSize() >= 0); + assertNotNull(properties.getContentType()); + assertNull(properties.getContentMd5()); // tested in "set HTTP headers" + assertNull(properties.getContentEncoding()); // tested in "set HTTP headers" + assertNull(properties.getContentDisposition()); // tested in "set HTTP headers" + assertNull(properties.getContentLanguage()); // tested in "set HTTP headers" + assertNull(properties.getCacheControl()); // tested in "set HTTP headers" + assertEquals(LeaseStatusType.UNLOCKED, properties.getLeaseStatus()); + assertEquals(LeaseStateType.AVAILABLE, properties.getLeaseState()); + assertNull(properties.getLeaseDuration()); // tested in "acquire lease" + assertNull(properties.getCopyId()); // tested in "abort copy" + assertNull(properties.getCopyStatus()); // tested in "copy" + assertNull(properties.getCopySource()); // tested in "copy" + assertNull(properties.getCopyProgress()); // tested in "copy" + assertNull(properties.getCopyCompletionTime()); // tested in "copy" + assertNull(properties.getCopyStatusDescription()); // only returned when the service has errors; cannot validate. + assertTrue(properties.isServerEncrypted()); + assertFalse(properties.isIncrementalCopy() != null && properties.isIncrementalCopy()); // tested in PageBlob."start incremental copy" + assertEquals(AccessTier.HOT, properties.getAccessTier()); + assertNull(properties.getArchiveStatus()); + assertTrue(CoreUtils.isNullOrEmpty(properties.getMetadata())); // new file does not have default metadata associated + assertNull(properties.getAccessTierChangeTime()); + assertNull(properties.getEncryptionKeySha256()); + assertFalse(properties.isDirectory()); + }) + .verifyComplete(); + } + + @Test + public void getPropertiesMin() { + assertAsyncResponseStatusCode(fc.getPropertiesWithResponse(null), 200); + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void getPropertiesAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.getPropertiesWithResponse(drc), 200); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void getPropertiesACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.getPropertiesWithResponse(drc)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void getPropertiesError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fc.getProperties()) + .verifyErrorSatisfies(r -> { + DataLakeStorageException ex = assertInstanceOf(DataLakeStorageException.class, r); + assertTrue(ex.getMessage().contains("BlobNotFound")); + }); + } + + @Test + public void setHTTPHeadersNull() { + StepVerifier.create(fc.setHttpHeadersWithResponse(null, null)) + .assertNext(r -> { + assertEquals(200, r.getStatusCode()); + validateBasicHeaders(r.getHeaders()); + }) + .verifyComplete(); + } + + @Test + public void setHTTPHeadersMin() throws NoSuchAlgorithmException { + PathProperties properties = fc.getProperties().block(); + PathHttpHeaders headers = new PathHttpHeaders() + .setContentEncoding(properties.getContentEncoding()) + .setContentDisposition(properties.getContentDisposition()) + .setContentType("type") + .setCacheControl(properties.getCacheControl()) + .setContentLanguage(properties.getContentLanguage()) + .setContentMd5(Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(DATA.getDefaultBytes()))); + + fc.setHttpHeaders(headers).block(); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> assertEquals("type", r.getContentType())) + .verifyComplete(); + } + @ParameterizedTest + @MethodSource("setHTTPHeadersHeadersSupplier") + public void setHTTPHeadersHeaders(String cacheControl, String contentDisposition, String contentEncoding, + String contentLanguage, byte[] contentMD5, String contentType) { + + fc.append(DATA.getDefaultBinaryData(), 0); + fc.flush(DATA.getDefaultDataSizeLong(), true); + PathHttpHeaders putHeaders = new PathHttpHeaders() + .setCacheControl(cacheControl) + .setContentDisposition(contentDisposition) + .setContentEncoding(contentEncoding) + .setContentLanguage(contentLanguage) + .setContentMd5(contentMD5) + .setContentType(contentType); + + fc.setHttpHeaders(putHeaders).block(); + + StepVerifier.create(fc.getPropertiesWithResponse(null)) + .assertNext(r -> validatePathProperties(r, cacheControl, contentDisposition, contentEncoding, contentLanguage, + contentMD5, contentType)) + .verifyComplete(); + } + + private static Stream setHTTPHeadersHeadersSupplier() throws NoSuchAlgorithmException { + return Stream.of( + // cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType + Arguments.of(null, null, null, null, null, null), + Arguments.of("control", "disposition", "encoding", "language", + Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(DATA.getDefaultBytes())), "type") + ); + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void setHttpHeadersAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.setHttpHeadersWithResponse(null, drc), 200); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void setHttpHeadersACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.setHttpHeadersWithResponse(null, drc)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void setHTTPHeadersError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fc.setHttpHeaders(null)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void setMetadataMin() { + Map metadata = Collections.singletonMap("foo", "bar"); + fc.setMetadata(metadata).block(); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> assertEquals(metadata, r.getMetadata())) + .verifyComplete(); + } + + @ParameterizedTest + @CsvSource(value = {"null,null,null,null,200", "foo,bar,fizz,buzz,200"}, nullValues = "null") + public void setMetadataMetadata(String key1, String value1, String key2, String value2, int statusCode) { + Map metadata = new HashMap<>(); + if (key1 != null && value1 != null) { + metadata.put(key1, value1); + } + if (key2 != null && value2 != null) { + metadata.put(key2, value2); + } + + assertAsyncResponseStatusCode(fc.setMetadataWithResponse(metadata, null), statusCode); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> assertEquals(metadata, r.getMetadata())) + .verifyComplete(); + } + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void setMetadataAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.setMetadataWithResponse(null, drc), 200); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void setMetadataACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.setMetadataWithResponse(null, drc)) + .verifyError(DataLakeStorageException.class); + } + @Test + public void setMetadataError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fc.setMetadata(null)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void readAllNull() { + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + + StepVerifier.create(fc.readWithResponse(null, null, null, false) + .flatMap(r -> { + HttpHeaders headers = r.getHeaders(); + + assertFalse(headers.stream().anyMatch(h -> h.getName().startsWith("x-ms-meta-"))); + assertNotNull(headers.getValue(HttpHeaderName.CONTENT_LENGTH)); + assertNotNull(headers.getValue(HttpHeaderName.CONTENT_TYPE)); + assertNull(headers.getValue(HttpHeaderName.CONTENT_RANGE)); + assertNull(headers.getValue(HttpHeaderName.CONTENT_ENCODING)); + assertNull(headers.getValue(HttpHeaderName.CACHE_CONTROL)); + assertNull(headers.getValue(HttpHeaderName.CONTENT_DISPOSITION)); + assertNull(headers.getValue(HttpHeaderName.CONTENT_LANGUAGE)); + assertNull(headers.getValue(X_MS_BLOB_SEQUENCE_NUMBER)); + assertNull(headers.getValue(X_MS_COPY_COMPLETION_TIME)); + assertNull(headers.getValue(X_MS_COPY_STATUS_DESCRIPTION)); + assertNull(headers.getValue(X_MS_COPY_ID)); + assertNull(headers.getValue(X_MS_COPY_PROGRESS)); + assertNull(headers.getValue(X_MS_COPY_SOURCE)); + assertNull(headers.getValue(X_MS_COPY_STATUS)); + assertNull(headers.getValue(X_MS_LEASE_DURATION)); + assertEquals(LeaseStateType.AVAILABLE.toString(), headers.getValue(X_MS_LEASE_STATE)); + assertEquals(LeaseStatusType.UNLOCKED.toString(), headers.getValue(X_MS_LEASE_STATUS)); + assertEquals("bytes", headers.getValue(HttpHeaderName.ACCEPT_RANGES)); + assertNull(headers.getValue(X_MS_BLOB_COMMITTED_BLOCK_COUNT)); + assertNotNull(headers.getValue(X_MS_SERVER_ENCRYPTED)); + assertNull(headers.getValue(X_MS_BLOB_CONTENT_MD5)); + assertNotNull(headers.getValue(X_MS_CREATION_TIME)); + assertNotNull(r.getDeserializedHeaders().getCreationTime()); + return FluxUtil.collectBytesInByteBufferStream(r.getValue()); + })) + .assertNext(bytes -> TestUtils.assertArraysEqual(DATA.getDefaultBytes(), bytes)) + .verifyComplete(); + } + + @Test + public void readEmptyFile() { + fc = dataLakeFileSystemAsyncClient.createFile("emptyFile").block(); + + StepVerifier.create(fc.read()) + .assertNext(r -> assertEquals(0, r.array().length)) + .verifyComplete(); + + } + + // This is to test the appropriate integration of DownloadResponse, including setting the correct range values on + // HttpGetterInfo. + @Test + public void readWithRetryRange() { + // We are going to make a request for some range on a blob. The Flux returned will throw an exception, forcing + // a retry per the DownloadRetryOptions. The next request should have the same range header, which was generated + // from the count and offset values in HttpGetterInfo that was constructed on the initial call to download. We + // don't need to check the data here, but we want to ensure that the correct range is set each time. This will + // test the correction of a bug that was found which caused HttpGetterInfo to have an incorrect offset when it + // was constructed in BlobClient.download(). + DataLakeFileAsyncClient fileAsyncClient = getFileAsyncClient(getDataLakeCredential(), fc.getPathUrl(), + new MockRetryRangeResponsePolicy("bytes=2-6")); + + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + // Because the dummy Flux always throws an error. This will also validate that an IllegalArgumentException is + // NOT thrown because the types would not match. + + StepVerifier.create(fileAsyncClient.readWithResponse(new FileRange(2, 5L), + new DownloadRetryOptions().setMaxRetryRequests(3), null, false) + .flatMap(r -> FluxUtil.collectBytesInByteBufferStream(r.getValue()))) + .verifyError(IOException.class); + } + + @Test + public void readMin() { + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fc.read())) + .assertNext(r -> TestUtils.assertArraysEqual(DATA.getDefaultBytes(), r)) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("readRangeSupplier") + public void readRange(long offset, Long count, String expectedData) { + FileRange range = (count == null) ? new FileRange(offset) : new FileRange(offset, count); + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + ByteArrayOutputStream readData = new ByteArrayOutputStream(); + + StepVerifier.create(fc.readWithResponse(range, null, null, false) + .flatMap(r -> FluxUtil.collectBytesInByteBufferStream(r.getValue()))) + .assertNext(bytes -> assertArrayEquals(expectedData.getBytes(), bytes)) + .verifyComplete(); + } + + private static Stream readRangeSupplier() { + return Stream.of( + // offset | count || expectedData + Arguments.of(0L, null, DATA.getDefaultText()), + Arguments.of(0L, 5L, DATA.getDefaultText().substring(0, 5)), + Arguments.of(3L, 2L, DATA.getDefaultText().substring(3, 3 + 2)) + ); + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") //hang + public void readAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.readWithResponse(null, null, drc, false)) + .assertNext(r -> assertEquals(200, r.getStatusCode())) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void readACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + + StepVerifier.create(fc.readWithResponse(null, null, drc, false)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void readMd5() throws NoSuchAlgorithmException { + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + StepVerifier.create(fc.readWithResponse(new FileRange(0, 3L), + null, null, true)) + .assertNext(r -> { + byte[] contentMD5 = r.getHeaders().getValue(HttpHeaderName.CONTENT_MD5).getBytes(); + try { + TestUtils.assertArraysEqual( + Base64.getEncoder().encode( + MessageDigest.getInstance("MD5").digest(DATA.getDefaultText().substring(0, 3).getBytes())), + contentMD5); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + }) + .verifyComplete(); + } + + @Test + public void readRetryDefault() { + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + DataLakeFileAsyncClient failureFileAsyncClient = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl(), + new MockFailureResponsePolicy(5)); + + ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(failureFileAsyncClient.read())) + .assertNext(r -> TestUtils.assertArraysEqual(DATA.getDefaultBytes(), r)) + .verifyComplete(); + } + + @Test + public void downloadFileExists() throws IOException { + File testFile = new File(prefix + ".txt"); + testFile.deleteOnExit(); + createdFiles.add(testFile); + + if (!testFile.exists()) { + assertTrue(testFile.createNewFile()); + } + + fc.append(DATA.getDefaultBinaryData(), 0); + fc.flush(DATA.getDefaultDataSizeLong(), true); + + // Default overwrite is false so this should fail + StepVerifier.create(fc.readToFile(testFile.getPath())) + .verifyErrorSatisfies(r -> { + UncheckedIOException ex = assertInstanceOf(UncheckedIOException.class, r); + assertInstanceOf(FileAlreadyExistsException.class, ex.getCause()); + }); + } + + @Test + public void downloadFileExistsSucceeds() throws IOException { + File testFile = new File(prefix + ".txt"); + testFile.deleteOnExit(); + createdFiles.add(testFile); + + if (!testFile.exists()) { + assertTrue(testFile.createNewFile()); + } + + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + StepVerifier.create(fc.readToFile(testFile.getPath(), true)) + .assertNext(Assertions::assertNotNull) + .verifyComplete(); + + assertEquals(DATA.getDefaultText(), new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8)); + + } + + @Test + public void downloadFileDoesNotExist() throws IOException { + File testFile = new File(prefix + ".txt"); + testFile.deleteOnExit(); + createdFiles.add(testFile); + + if (testFile.exists()) { + assertTrue(testFile.delete()); + } + + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + StepVerifier.create(fc.readToFile(testFile.getPath(), true)) + .assertNext(Assertions::assertNotNull) + .verifyComplete(); + + assertEquals(DATA.getDefaultText(), new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8)); + + } + + @Test + public void downloadFileDoesNotExistOpenOptions() throws IOException { + File testFile = new File(prefix + ".txt"); + testFile.deleteOnExit(); + createdFiles.add(testFile); + + if (!testFile.exists()) { + assertTrue(testFile.createNewFile()); + } + + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + Set openOptions = new HashSet<>(Arrays.asList( + StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE)); + + StepVerifier.create(fc.readToFileWithResponse(testFile.getPath(), null, null, + null, null, false, openOptions)) + .assertNext(r -> { + try { + assertEquals(DATA.getDefaultText(), new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8)); + } catch (IOException e) { + throw new RuntimeException(e); + } + }) + .verifyComplete(); + } + + @Test + public void downloadFileExistOpenOptions() throws IOException { + File testFile = new File(prefix + ".txt"); + testFile.deleteOnExit(); + createdFiles.add(testFile); + + if (!testFile.exists()) { + assertTrue(testFile.createNewFile()); + } + + fc.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + Set openOptions = new HashSet<>(Arrays.asList(StandardOpenOption.CREATE, + StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.READ, StandardOpenOption.WRITE)); + + StepVerifier.create(fc.readToFileWithResponse(testFile.getPath(), null, null, + null, null, false, openOptions)) + .assertNext(r -> { + try { + assertEquals(DATA.getDefaultText(), new String(Files.readAllBytes(testFile.toPath()), StandardCharsets.UTF_8)); + } catch (IOException e) { + throw new RuntimeException(e); + } + }) + .verifyComplete(); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("downloadFileSupplier") + public void downloadFile(int fileSize) { + File file = getRandomFile(fileSize); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.toPath().toString(), true).block(); + File outFile = new File(testResourceNamer.randomName("", 60) + ".txt"); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + if (outFile.exists()) { + assertTrue(outFile.delete()); + } + + StepVerifier.create(fc.readToFileWithResponse(outFile.toPath().toString(), null, + new ParallelTransferOptions().setBlockSizeLong(4L * 1024 * 1024), + null, null, false, null)) + .assertNext(r -> { + assertEquals(fileSize, r.getValue().getFileSize()); + }) + .verifyComplete(); + + compareFiles(file, outFile, 0, fileSize); + + } + + private static Stream downloadFileSupplier() { + return Stream.of( + // fileSize + 20, // small file + 16 * 1024 * 1024, // medium file in several chunks + 8 * 1026 * 1024 + 10, // medium file not aligned to block + 50 * Constants.MB // large file requiring multiple requests + ); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("downloadFileSupplier") + public void downloadFileAsyncBufferCopy(int fileSize) { + String fileSystemName = generateFileSystemName(); + DataLakeServiceAsyncClient datalakeServiceAsyncClient = new DataLakeServiceClientBuilder() + .endpoint(ENVIRONMENT.getDataLakeAccount().getDataLakeEndpoint()) + .credential(getDataLakeCredential()) + .buildAsyncClient(); + + DataLakeFileAsyncClient fileAsyncClient = datalakeServiceAsyncClient.createFileSystem(fileSystemName) + .blockOptional() + .orElseThrow(() -> new IllegalStateException("Expected file system to be created.")) + .getFileAsyncClient(generatePathName()); + + File file = getRandomFile(fileSize); + file.deleteOnExit(); + createdFiles.add(file); + + fileAsyncClient.uploadFromFile(file.toPath().toString(), true).block(); + File outFile = new File(testResourceNamer.randomName("", 60) + ".txt"); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + if (outFile.exists()) { + assertTrue(outFile.delete()); + } + + StepVerifier.create(fileAsyncClient.readToFileWithResponse(outFile.toPath().toString(), null, + new ParallelTransferOptions().setBlockSizeLong(4L * 1024 * 1024), + null, null, false, null) + .map(Response::getValue)) + .assertNext(properties -> assertEquals(fileSize, properties.getFileSize())) + .verifyComplete(); + + compareFiles(file, outFile, 0, fileSize); + } + + @ParameterizedTest + @MethodSource("downloadFileRangeSupplier") + public void downloadFileRange(FileRange range) { + File file = getRandomFile(DATA.getDefaultDataSize()); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.toPath().toString(), true).block(); + + File outFile = new File(testResourceNamer.randomName("", 60)); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + if (outFile.exists()) { + assertTrue(outFile.delete()); + } + + StepVerifier.create(fc.readToFileWithResponse(outFile.toPath().toString(), range, null, + null, null, false, null)) + .assertNext(r -> compareFiles(file, outFile, range.getOffset(), range.getCount())) + .verifyComplete(); + } + + private static Stream downloadFileRangeSupplier() { + // The last case is to test a range much larger than the size of the file to ensure we don't accidentally + // send off parallel requests with invalid ranges. + return Stream.of( + new FileRange(0, DATA.getDefaultDataSizeLong()), // Exact count + new FileRange(1, DATA.getDefaultDataSizeLong() - 1), // Offset and exact count + new FileRange(3, 2L), // Narrow range in middle + new FileRange(0, DATA.getDefaultDataSizeLong() - 1), // Count that is less than total + new FileRange(0, 10 * 1024L) // Count much larger than remaining data + ); + } + + @Test + public void downloadFileRangeFail() { + File file = getRandomFile(DATA.getDefaultDataSize()); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.toPath().toString(), true).block(); + + File outFile = new File(prefix); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + if (outFile.exists()) { + assertTrue(outFile.delete()); + } + + StepVerifier.create(fc.readToFileWithResponse(outFile.toPath().toString(), + new FileRange(DATA.getDefaultDataSizeLong() + 1), null, null, + null, false, null)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void downloadFileCountNull() { + File file = getRandomFile(DATA.getDefaultDataSize()); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.toPath().toString(), true).block(); + + File outFile = new File(prefix); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + if (outFile.exists()) { + assertTrue(outFile.delete()); + } + + StepVerifier.create(fc.readToFileWithResponse(outFile.toPath().toString(), new FileRange(0), + null, null, null, false, null)) + .assertNext(r -> compareFiles(file, outFile, 0, DATA.getDefaultDataSizeLong())) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void downloadFileAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + File file = getRandomFile(DATA.getDefaultDataSize()); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.toPath().toString(), true).block(); + + File outFile = new File(testResourceNamer.randomName("", 60)); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + if (outFile.exists()) { + assertTrue(outFile.delete()); + } + + DataLakeRequestConditions bro = new DataLakeRequestConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setLeaseId(setupPathLeaseCondition(fc, leaseID)); + + assertDoesNotThrow(() -> fc.readToFileWithResponse(outFile.toPath().toString(), null, + null, null, bro, false, null).block()); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void downloadFileACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + File file = getRandomFile(DATA.getDefaultDataSize()); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.toPath().toString(), true).block(); + + File outFile = new File(prefix); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + if (outFile.exists()) { + assertTrue(outFile.delete()); + } + + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions bro = new DataLakeRequestConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setLeaseId(leaseID); + + StepVerifier.create(fc.readToFileWithResponse(outFile.toPath().toString(), null, null, + null, bro, false, null)) + .verifyErrorSatisfies(r -> { + DataLakeStorageException e = assertInstanceOf(DataLakeStorageException.class, r); + assertTrue(Objects.equals(e.getErrorCode(), "ConditionNotMet") || Objects.equals(e.getErrorCode(), + "LeaseIdMismatchWithBlobOperation")); + }); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @Test + public void downloadFileEtagLock() throws IOException { + File file = getRandomFile(Constants.MB); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.toPath().toString(), true).block(); + + File outFile = new File(prefix); + Files.deleteIfExists(outFile.toPath()); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + AtomicInteger counter = new AtomicInteger(); + + DataLakeFileAsyncClient facUploading = instrument(new DataLakePathClientBuilder() + .endpoint(fc.getPathUrl()) + .credential(getDataLakeCredential())) + .buildFileAsyncClient(); + + HttpPipelinePolicy policy = (context, next) -> next.process().flatMap(response -> { + if (counter.incrementAndGet() == 1) { + // When the download begins trigger an upload to overwrite the downloading blob so that the download is + // able to get an ETag before it is changed. + return facUploading.upload(DATA.getDefaultFlux(), null, true).thenReturn(response); + } + + return Mono.just(response); + }); + + DataLakeFileAsyncClient facDownloading = instrument(new DataLakePathClientBuilder() + .addPolicy(policy) + .endpoint(fc.getPathUrl()) + .credential(getDataLakeCredential())) + .buildFileAsyncClient(); + + // Set up the download to happen in small chunks so many requests need to be sent, this will give the upload + // time to change the ETag therefore failing the download. + ParallelTransferOptions options = new ParallelTransferOptions().setBlockSizeLong((long) Constants.KB); + + // This is done to prevent onErrorDropped exceptions from being logged at the error level. If no hook is + // registered for onErrorDropped the error is logged at the ERROR level. + // + // onErrorDropped is triggered once the reactive stream has emitted one element, after that exceptions are + // dropped. + Hooks.onErrorDropped(ignored -> { /* do nothing with it */ }); + + StepVerifier.create(facDownloading.readToFileWithResponse(outFile.toPath().toString(), null, options, + null, null, false, null)) + .verifyErrorSatisfies(ex -> { + // If an operation is running on multiple threads and multiple return an exception Reactor will combine + // them into a CompositeException which needs to be unwrapped. If there is only a single exception + // 'Exceptions.unwrapMultiple' will return a singleton list of the exception it was passed. + // + // These exceptions may be wrapped exceptions where the exception we are expecting is contained within + // ReactiveException that needs to be unwrapped. If the passed exception isn't a 'ReactiveException' it + // will be returned unmodified by 'Exceptions.unwrap'. + assertTrue(Exceptions.unwrapMultiple(ex).stream() + .anyMatch(ex2 -> { + Throwable unwrapped = Exceptions.unwrap(ex2); + if (unwrapped instanceof DataLakeStorageException) { + return ((DataLakeStorageException) unwrapped).getStatusCode() == 412; + } + return false; + })); + }); + + // Give the file a chance to be deleted by the download operation before verifying its deletion + sleepIfRunningAgainstService(500); + assertFalse(outFile.exists()); + } + + @SuppressWarnings("deprecation") + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @ValueSource(ints = {100, 8 * 1026 * 1024 + 10}) + public void downloadFileProgressReceiver(int fileSize) { + File file = getRandomFile(fileSize); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.toPath().toString(), true).block(); + + File outFile = new File(prefix); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + if (outFile.exists()) { + assertTrue(outFile.delete()); + } + + MockReceiver mockReceiver = new MockReceiver(); + + fc.readToFileWithResponse(outFile.toPath().toString(), null, + new ParallelTransferOptions().setProgressReceiver(mockReceiver), + new DownloadRetryOptions().setMaxRetryRequests(3), null, false, null).block(); + + // Should receive at least one notification indicating completed progress, multiple notifications may be + // received if there are empty buffers in the stream. + assertTrue(mockReceiver.progresses.stream().anyMatch(progress -> progress == fileSize)); + + // There should be NO notification with a larger than expected size. + assertFalse(mockReceiver.progresses.stream().anyMatch(progress -> progress > fileSize)); + + // We should receive at least one notification reporting an intermediary value per block, but possibly more + // notifications will be received depending on the implementation. We specify numBlocks - 1 because the last + // block will be the total size as above. Finally, we assert that the number reported monotonically increases. + long prevCount = -1; + for (long progress : mockReceiver.progresses) { + assertTrue(progress >= prevCount, "Reported progress should monotonically increase"); + prevCount = progress; + } + } + + @SuppressWarnings("deprecation") + private static final class MockReceiver implements ProgressReceiver { + List progresses = new ArrayList<>(); + + @Override + public void reportProgress(long bytesTransferred) { + progresses.add(bytesTransferred); + } + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @ValueSource(ints = {100, 8 * 1026 * 1024 + 10}) + public void downloadFileProgressListener(int fileSize) { + File file = getRandomFile(fileSize); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.toPath().toString(), true).block(); + + File outFile = new File(prefix); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + if (outFile.exists()) { + assertTrue(outFile.delete()); + } + + MockProgressListener mockListener = new MockProgressListener(); + + fc.readToFileWithResponse(outFile.toPath().toString(), null, + new ParallelTransferOptions().setProgressListener(mockListener), + new DownloadRetryOptions().setMaxRetryRequests(3), null, false, null).block(); + + // Should receive at least one notification indicating completed progress, multiple notifications may be + // received if there are empty buffers in the stream. + assertTrue(mockListener.progresses.stream().anyMatch(progress -> progress == fileSize)); + + // There should be NO notification with a larger than expected size. + assertFalse(mockListener.progresses.stream().anyMatch(progress -> progress > fileSize)); + + // We should receive at least one notification reporting an intermediary value per block, but possibly more + // notifications will be received depending on the implementation. We specify numBlocks - 1 because the last + // block will be the total size as above. Finally, we assert that the number reported monotonically increases. + long prevCount = -1; + for (long progress : mockListener.progresses) { + assertTrue(progress >= prevCount, "Reported progress should monotonically increase"); + prevCount = progress; + } + } + + private static final class MockProgressListener implements ProgressListener { + List progresses = new ArrayList<>(); + + @Override + public void handleProgress(long progress) { + progresses.add(progress); + } + } + + @Test + public void renameMin() { + assertAsyncResponseStatusCode(fc.renameWithResponse(null, generatePathName(), + null, null, null), 201); + } + + @Test + public void renameWithResponse() { + StepVerifier.create(fc.renameWithResponse(null, generatePathName(), + null, null, null) + .flatMap(r -> r.getValue().getPropertiesWithResponse(null))) + .assertNext(piece -> assertEquals(200, piece.getStatusCode())) + .verifyComplete(); + + StepVerifier.create(fc.getProperties()) + .verifyErrorSatisfies(r -> { + assertInstanceOf(DataLakeStorageException.class, r); + }); + } + + @Test + public void renameFilesystemWithResponse() { + DataLakeFileSystemAsyncClient newFileSystem = primaryDataLakeServiceAsyncClient.createFileSystem(generateFileSystemName()).block(); + + StepVerifier.create(fc.renameWithResponse(newFileSystem.getFileSystemName(), generatePathName(), + null, null, null) + .flatMap(r -> r.getValue().getPropertiesWithResponse(null))) + .assertNext(p -> assertEquals(p.getStatusCode(), 200)) + .verifyComplete(); + + StepVerifier.create(fc.getProperties()) + .verifyErrorSatisfies(r -> { + assertInstanceOf(DataLakeStorageException.class, r); + }); + } + + @Test + public void renameError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fc.renameWithResponse(null, generatePathName(), null, + null, null)) + .verifyError(DataLakeStorageException.class); + } + + @ParameterizedTest + @CsvSource({",", "%20%25,%20%25", "%20%25,", ",%20%25"}) + public void renameUrlEncoded(String source, String destination) { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName() + source); + fc.create().block(); + + StepVerifier.create(fc.renameWithResponse(null, generatePathName() + destination, null, null, null) + .flatMap(r -> { + assertEquals(201, r.getStatusCode()); + return r.getValue().getPropertiesWithResponse(null); + })) + .assertNext(piece -> assertEquals(200, piece.getStatusCode())) + .verifyComplete(); + + + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void renameSourceAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.renameWithResponse(null, generatePathName(), drc, + null, null), 201); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void renameSourceACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + fc = dataLakeFileSystemAsyncClient.createFile(generatePathName()).block(); + + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.renameWithResponse(null, generatePathName(), drc, + null, null)) + .verifyError(DataLakeStorageException.class); + } + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void renameDestAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + String pathName = generatePathName(); + DataLakeFileAsyncClient destFile = dataLakeFileSystemAsyncClient.createFile(pathName).block(); + + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(destFile, leaseID)) + .setIfMatch(setupPathMatchCondition(destFile, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.renameWithResponse(null, pathName, null, + drc, null), 201); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void renameDestACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + String pathName = generatePathName(); + DataLakeFileAsyncClient destFile = dataLakeFileSystemAsyncClient.createFile(pathName).block(); + + setupPathLeaseCondition(destFile, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(destFile, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.renameWithResponse(null, pathName, null, drc, null)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void renameSasToken() { + FileSystemSasPermission permissions = new FileSystemSasPermission() + .setReadPermission(true) + .setMovePermission(true) + .setWritePermission(true) + .setCreatePermission(true) + .setAddPermission(true) + .setDeletePermission(true); + + String sas = dataLakeFileSystemAsyncClient.generateSas(new DataLakeServiceSasSignatureValues(testResourceNamer.now().plusDays(1), permissions)); + DataLakeFileAsyncClient client = getFileAsyncClient(sas, dataLakeFileSystemAsyncClient.getFileSystemUrl(), fc.getFilePath()); + + DataLakeFileAsyncClient destClient = client.rename(dataLakeFileSystemAsyncClient.getFileSystemName(), generatePathName()).block(); + + StepVerifier.create(destClient.getPropertiesWithResponse(null)) + .assertNext(r -> assertEquals(r.getStatusCode(), 200)) + .verifyComplete(); + } + + @Test + public void renameSasTokenWithLeadingQuestionMark() { + FileSystemSasPermission permissions = new FileSystemSasPermission() + .setReadPermission(true) + .setMovePermission(true) + .setWritePermission(true) + .setCreatePermission(true) + .setAddPermission(true) + .setDeletePermission(true); + + String sas = "?" + dataLakeFileSystemAsyncClient.generateSas(new DataLakeServiceSasSignatureValues(testResourceNamer.now().plusDays(1), permissions)); + DataLakeFileAsyncClient client = getFileAsyncClient(sas, dataLakeFileSystemAsyncClient.getFileSystemUrl(), fc.getFilePath()); + + DataLakeFileAsyncClient destClient = client.rename(dataLakeFileSystemAsyncClient.getFileSystemName(), generatePathName()).block(); + + StepVerifier.create(destClient.getPropertiesWithResponse(null)) + .assertNext(r -> assertEquals(r.getStatusCode(), 200)) + .verifyComplete(); + } + + @Test + public void appendDataMin() { + assertDoesNotThrow(() -> fc.append(DATA.getDefaultBinaryData(), 0).block()); + } + + @Test + public void appendData() { + StepVerifier.create(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, null, null)) + .assertNext(r -> { + HttpHeaders headers = r.getHeaders(); + assertEquals(202, r.getStatusCode()); + assertNotNull(headers.getValue(X_MS_REQUEST_ID)); + assertNotNull(headers.getValue(X_MS_VERSION)); + assertNotNull(headers.getValue(HttpHeaderName.DATE)); + assertTrue(Boolean.parseBoolean(headers.getValue(X_MS_REQUEST_SERVER_ENCRYPTED))); + }) + .verifyComplete(); + } + + @Test + public void appendDataMd5() throws NoSuchAlgorithmException { + fc = dataLakeFileSystemAsyncClient.createFile(generatePathName()).block(); + byte[] md5 = MessageDigest.getInstance("MD5").digest(DATA.getDefaultText().getBytes()); + + StepVerifier.create(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, md5, null)) + .assertNext(r -> { + HttpHeaders headers = r.getHeaders(); + assertEquals(202, r.getStatusCode()); + assertNotNull(headers.getValue(X_MS_REQUEST_ID)); + assertNotNull(headers.getValue(X_MS_VERSION)); + assertNotNull(headers.getValue(HttpHeaderName.DATE)); + assertTrue(Boolean.parseBoolean(headers.getValue(X_MS_REQUEST_SERVER_ENCRYPTED))); + }) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("appendDataIllegalArgumentsSupplier") + public void appendDataIllegalArguments(Flux is, long dataSize, Class exceptionType) { + StepVerifier.create(fc.append(is, 0, dataSize)) + .verifyError(exceptionType); + } + + private static Stream appendDataIllegalArgumentsSupplier() { + return Stream.of( + // is | dataSize || exceptionType + Arguments.of(null, DATA.getDefaultDataSizeLong(), NullPointerException.class), + Arguments.of(DATA.getDefaultFlux(), DATA.getDefaultDataSizeLong() + 1, UnexpectedLengthException.class), + Arguments.of(DATA.getDefaultFlux(), DATA.getDefaultDataSizeLong() - 1, UnexpectedLengthException.class) + ); + } + + @Test + public void appendDataEmptyBody() { + fc = dataLakeFileSystemAsyncClient.createFile(generatePathName()).block(); + + StepVerifier.create(fc.append(BinaryData.fromBytes(new byte[0]), 0)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void appendDataNullBody() { + fc = dataLakeFileSystemAsyncClient.createFile(generatePathName()).block(); + + StepVerifier.create(fc.append(null, 0, 0)) + .verifyError(NullPointerException.class); + } + + @Test + public void appendDataLease() { + assertAsyncResponseStatusCode(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, + null, setupPathLeaseCondition(fc, RECEIVED_LEASE_ID)), 202); + } + + @Test + public void appendDataLeaseFail() { + setupPathLeaseCondition(fc, RECEIVED_LEASE_ID); + + StepVerifier.create(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, null, GARBAGE_LEASE_ID)) + .verifyErrorSatisfies(r -> { + DataLakeStorageException e = assertInstanceOf(DataLakeStorageException.class, r); + assertEquals(412, e.getResponse().getStatusCode()); + }); + } + + private static boolean olderThan20200804ServiceVersion() { + return olderThan(DataLakeServiceVersion.V2020_08_04); + } + + @DisabledIf("olderThan20200804ServiceVersion") + @Test + public void appendDataLeaseAcquire() { + fc = dataLakeFileSystemAsyncClient.createFileIfNotExists(generatePathName()).block(); + + DataLakeFileAppendOptions appendOptions = new DataLakeFileAppendOptions() + .setLeaseAction(LeaseAction.ACQUIRE) + .setProposedLeaseId(CoreUtils.randomUuid().toString()) + .setLeaseDuration(15); + + assertAsyncResponseStatusCode(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, appendOptions), + 202); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> { + assertEquals(LeaseStatusType.LOCKED, r.getLeaseStatus()); + assertEquals(LeaseStateType.LEASED, r.getLeaseState()); + assertEquals(LeaseDurationType.FIXED, r.getLeaseDuration()); + }) + .verifyComplete(); + } + + @DisabledIf("olderThan20200804ServiceVersion") + @Test + public void appendDataLeaseAutoRenew() { + fc = dataLakeFileSystemAsyncClient.createFileIfNotExists(generatePathName()).block(); + String leaseId = CoreUtils.randomUuid().toString(); + + DataLakeLeaseAsyncClient leaseClient = createLeaseAsyncClient(fc, leaseId); + leaseClient.acquireLease(15).block(); + + DataLakeFileAppendOptions appendOptions = new DataLakeFileAppendOptions() + .setLeaseAction(LeaseAction.AUTO_RENEW) + .setLeaseId(leaseId); + + assertAsyncResponseStatusCode(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, appendOptions), + 202); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> { + assertEquals(LeaseStatusType.LOCKED, r.getLeaseStatus()); + assertEquals(LeaseStateType.LEASED, r.getLeaseState()); + assertEquals(LeaseDurationType.FIXED, r.getLeaseDuration()); + }) + .verifyComplete(); + } + + @Test + public void appendDataLeaseRelease() { + fc = dataLakeFileSystemAsyncClient.createFileIfNotExists(generatePathName()).block(); + String leaseId = CoreUtils.randomUuid().toString(); + + DataLakeLeaseAsyncClient leaseClient = createLeaseAsyncClient(fc, leaseId); + leaseClient.acquireLease(15).block(); + + DataLakeFileAppendOptions appendOptions = new DataLakeFileAppendOptions() + .setLeaseAction(LeaseAction.RELEASE) + .setLeaseId(leaseId) + .setFlush(true); + + assertAsyncResponseStatusCode(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, appendOptions), + 202); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> { + assertEquals(LeaseStatusType.UNLOCKED, r.getLeaseStatus()); + assertEquals(LeaseStateType.AVAILABLE, r.getLeaseState()); + }) + .verifyComplete(); + } + + @DisabledIf("olderThan20200804ServiceVersion") + @Test + public void appendDataLeaseAcquireRelease() { + fc = dataLakeFileSystemAsyncClient.createFileIfNotExists(generatePathName()).block(); + + DataLakeFileAppendOptions appendOptions = new DataLakeFileAppendOptions() + .setLeaseAction(LeaseAction.ACQUIRE_RELEASE) + .setProposedLeaseId(CoreUtils.randomUuid().toString()) + .setLeaseDuration(15) + .setFlush(true); + + assertAsyncResponseStatusCode(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, appendOptions), + 202); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> { + assertEquals(LeaseStatusType.UNLOCKED, r.getLeaseStatus()); + assertEquals(LeaseStateType.AVAILABLE, r.getLeaseState()); + }) + .verifyComplete(); + } + + @Test + public void appendDataError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, null)) + .verifyErrorSatisfies(r -> { + DataLakeStorageException e = assertInstanceOf(DataLakeStorageException.class, r); + assertEquals(404, e.getResponse().getStatusCode()); + }); + } + + @Test + public void appendDataRetryOnTransientFailure() { + DataLakeFileAsyncClient clientWithFailure = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl(), + new TransientFailureInjectingHttpPipelinePolicy()); + + clientWithFailure.append(DATA.getDefaultBinaryData(), 0).block(); + fc.flush(DATA.getDefaultDataSizeLong(), true).block(); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fc.read())) + .assertNext(r -> TestUtils.assertArraysEqual(DATA.getDefaultBytes(), r)) + .verifyComplete(); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void appendDataFlush() { + DataLakeFileAppendOptions appendOptions = new DataLakeFileAppendOptions().setFlush(true); + + StepVerifier.create(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, appendOptions)) + .assertNext(r -> { + HttpHeaders headers = r.getHeaders(); + + assertEquals(202, r.getStatusCode()); + assertNotNull(headers.getValue(X_MS_REQUEST_ID)); + assertNotNull(headers.getValue(X_MS_VERSION)); + assertNotNull(headers.getValue(HttpHeaderName.DATE)); + assertTrue(Boolean.parseBoolean(headers.getValue(X_MS_REQUEST_SERVER_ENCRYPTED))); + }) + .verifyComplete(); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fc.read())) + .assertNext(r -> TestUtils.assertArraysEqual(DATA.getDefaultBytes(), r)) + .verifyComplete(); + } + @Test + public void appendBinaryDataMin() { + assertDoesNotThrow(() -> fc.append(DATA.getDefaultBinaryData(), 0).block()); + } + + @Test + public void appendBinaryData() { + StepVerifier.create(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, null)) + .assertNext(r -> { + HttpHeaders headers = r.getHeaders(); + assertEquals(202, r.getStatusCode()); + assertNotNull(headers.getValue(X_MS_REQUEST_ID)); + assertNotNull(headers.getValue(X_MS_VERSION)); + assertNotNull(headers.getValue(HttpHeaderName.DATE)); + assertTrue(Boolean.parseBoolean(headers.getValue(X_MS_REQUEST_SERVER_ENCRYPTED))); + }) + .verifyComplete(); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void appendBinaryDataFlush() { + DataLakeFileAppendOptions appendOptions = new DataLakeFileAppendOptions().setFlush(true); + + StepVerifier.create(fc.appendWithResponse(DATA.getDefaultBinaryData(), 0, appendOptions)) + .assertNext(r -> { + HttpHeaders headers = r.getHeaders(); + assertEquals(202, r.getStatusCode()); + assertNotNull(headers.getValue(X_MS_REQUEST_ID)); + assertNotNull(headers.getValue(X_MS_VERSION)); + assertNotNull(headers.getValue(HttpHeaderName.DATE)); + assertTrue(Boolean.parseBoolean(headers.getValue(X_MS_REQUEST_SERVER_ENCRYPTED))); + }) + .verifyComplete(); + } + + @Test + public void flushDataMin() { + fc.append(DATA.getDefaultBinaryData(), 0).block(); + + assertDoesNotThrow(() -> fc.flush(DATA.getDefaultDataSizeLong(), true).block()); + } + + @Test + public void flushClose() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + fc.create().block(); + fc.append(DATA.getDefaultBinaryData(), 0).block(); + + assertDoesNotThrow(() -> fc.flushWithResponse(DATA.getDefaultDataSizeLong(), false, + true, null, null).block()); + } + + @Test + public void flushRetainUncommittedData() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + fc.create().block(); + fc.append(DATA.getDefaultBinaryData(), 0).block(); + + assertDoesNotThrow(() -> fc.flushWithResponse(DATA.getDefaultDataSizeLong(), true, + false, null, null).block()); + } + + @Test + public void flushIA() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + fc.create().block(); + fc.append(DATA.getDefaultBinaryData(), 0).block(); + + + StepVerifier.create(fc.flushWithResponse(4, false, false, null, + null)) + .verifyError(DataLakeStorageException.class); + } + + @ParameterizedTest + @CsvSource(value = {"null,null,null,null,null", "control,disposition,encoding,language,type"}) + public void flushHeaders(String cacheControl, String contentDisposition, String contentEncoding, + String contentLanguage, String contentType) { + fc = dataLakeFileSystemAsyncClient.createFile(generatePathName()).block(); + fc.append(DATA.getDefaultBinaryData(), 0).block(); + + PathHttpHeaders headers = new PathHttpHeaders().setCacheControl(cacheControl) + .setContentDisposition(contentDisposition) + .setContentEncoding(contentEncoding) + .setContentLanguage(contentLanguage) + .setContentType(contentType); + + fc.flushWithResponse(DATA.getDefaultDataSizeLong(), false, false, headers, null).block(); + + contentType = (contentType == null) ? "application/octet-stream" : contentType; + + String finalContentType = contentType; + StepVerifier.create(fc.getPropertiesWithResponse(null)) + .assertNext(r -> validatePathProperties(r, cacheControl, contentDisposition, contentEncoding, contentLanguage, + null, finalContentType)) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void flushAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + fc = dataLakeFileSystemAsyncClient.createFile(generatePathName()).block(); + fc.append(DATA.getDefaultBinaryData(), 0).block(); + + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + assertAsyncResponseStatusCode(fc.flushWithResponse(DATA.getDefaultDataSizeLong(), false, + false, null, drc), 200); + } + + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void flushACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + fc = dataLakeFileSystemAsyncClient.createFile(generatePathName()).block(); + fc.append(DATA.getDefaultBinaryData(), 0).block(); + + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions drc = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + StepVerifier.create(fc.flushWithResponse(DATA.getDefaultDataSize(), false, false, + null, drc)) + .verifyError(DataLakeStorageException.class); + + } + + @Test + public void flushError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fc.flush(1, true)) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void flushDataOverwrite() { + fc.append(DATA.getDefaultBinaryData(), 0).block(); + assertDoesNotThrow(() -> fc.flush(DATA.getDefaultDataSizeLong(), true).block()); + + fc.append(DATA.getDefaultBinaryData(), 0).block(); + + // Attempt to write data without overwrite enabled + StepVerifier.create(fc.flush(DATA.getDefaultDataSizeLong(), false)) + .verifyError(DataLakeStorageException.class); + } + + @ParameterizedTest + @CsvSource({"file,file", "path/to]a file,path/to]a file", "path%2Fto%5Da%20file,path/to]a file", "斑點,斑點", + "%E6%96%91%E9%BB%9E,斑點"}) + public void getFileNameAndBuildClient(String originalFileName, String finalFileName) { + DataLakeFileAsyncClient client = dataLakeFileSystemAsyncClient.getFileAsyncClient(originalFileName); + + // Note : Here I use Path because there is a test that tests the use of a / + assertEquals(finalFileName, client.getFilePath()); + } + + @Test + public void builderBearerTokenValidation() { + // Technically no additional checks need to be added to datalake builder since the corresponding blob builder fails + String endpoint = BlobUrlParts.parse(fc.getFileUrl()).setScheme("http").toUrl().toString(); + + assertThrows(IllegalArgumentException.class, () -> new DataLakePathClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(endpoint) + .buildFileAsyncClient()); + } + + // "No overwrite interrupted" tests were not ported over for datalake. This is because the access condition check + // occurs on the create method, so simple access conditions tests suffice. + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") // Test uploads large amount of data + @ParameterizedTest + @MethodSource("uploadFromFileSupplier") + public void uploadFromFile(int fileSize, Long blockSize) throws IOException { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + File file = getRandomFile(fileSize); + file.deleteOnExit(); + createdFiles.add(file); + + // Block length will be ignored for single shot. + StepVerifier.create(fac.uploadFromFile(file.getPath(), + new ParallelTransferOptions().setBlockSizeLong(blockSize), null, null, null)) + .verifyComplete(); + + File outFile = new File(file.getPath() + "result"); + assertTrue(outFile.createNewFile()); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + StepVerifier.create(fac.readToFile(outFile.getPath(), true)) + .expectNextCount(1) + .verifyComplete(); + + compareFiles(file, outFile, 0, fileSize); + } + + private static Stream uploadFromFileSupplier() { + return Stream.of( + // fileSize | blockSize + Arguments.of(10, null), // Size is too small to trigger block uploading + Arguments.of(10 * Constants.KB, null), // Size is too small to trigger block uploading + Arguments.of(50 * Constants.MB, null), // Size is too small to trigger block uploading + Arguments.of(101 * Constants.MB, 4L * 1024 * 1024) // Size is too small to trigger block uploading + ); + } + + @Test + public void uploadFromFileWithMetadata() throws IOException { + Map metadata = Collections.singletonMap("metadata", "value"); + File file = getRandomFile(Constants.KB); + file.deleteOnExit(); + createdFiles.add(file); + + fc.uploadFromFile(file.getPath(), null, null, metadata, null).block(); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> assertEquals(metadata, r.getMetadata())) + .verifyComplete(); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fc.read())) + .assertNext(r -> { + try { + TestUtils.assertArraysEqual(Files.readAllBytes(file.toPath()), r); + } catch (IOException e) { + throw new RuntimeException(e); + } + }) + .verifyComplete(); + } + + @Test + public void uploadFromFileDefaultNoOverwrite() { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() + .orElseThrow(() -> new RuntimeException("File was not created")); + + File file = getRandomFile(50); + file.deleteOnExit(); + createdFiles.add(file); + + StepVerifier.create(fc.uploadFromFile(file.toPath().toString())) + .verifyError(DataLakeStorageException.class); + + StepVerifier.create(fac.uploadFromFile(getRandomFile(50).toPath().toString())) + .verifyError(DataLakeStorageException.class); + } + + @Test + public void uploadFromFileOverwrite() { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() + .orElseThrow(() -> new RuntimeException("File was not created")); + + File file = getRandomFile(50); + file.deleteOnExit(); + createdFiles.add(file); + + assertDoesNotThrow(() -> fc.uploadFromFile(file.toPath().toString(), true).block()); + + StepVerifier.create(fac.uploadFromFile(getRandomFile(50).toPath().toString(), true)) + .verifyComplete(); + } + + /* + * Reports the number of bytes sent when uploading a file. This is different from other reporters which track the + * number of reports as upload from file hooks into the loading data from disk data stream which is a hard-coded + * read size. + */ + @SuppressWarnings("deprecation") + private static final class FileUploadReporter implements ProgressReceiver { + private long reportedByteCount; + + @Override + public void reportProgress(long bytesTransferred) { + this.reportedByteCount = bytesTransferred; + } + + long getReportedByteCount() { + return this.reportedByteCount; + } + } + + private static final class FileUploadListener implements ProgressListener { + private long reportedByteCount; + + @Override + public void handleProgress(long bytesTransferred) { + this.reportedByteCount = bytesTransferred; + } + + long getReportedByteCount() { + return this.reportedByteCount; + } + } + + @SuppressWarnings("deprecation") + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("uploadFromFileWithProgressSupplier") + public void uploadFromFileReporter(int size, long blockSize, int bufferCount) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + FileAsyncApiTests.FileUploadReporter uploadReporter = new FileAsyncApiTests.FileUploadReporter(); + + File file = getRandomFile(size); + file.deleteOnExit(); + createdFiles.add(file); + + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) + .setMaxConcurrency(bufferCount) + .setProgressReceiver(uploadReporter) + .setMaxSingleUploadSizeLong(blockSize - 1); + + StepVerifier.create(fac.uploadFromFile(file.toPath().toString(), parallelTransferOptions, null, + null, null)) + .verifyComplete(); + + assertEquals(size, uploadReporter.getReportedByteCount()); + } + + private static Stream uploadFromFileWithProgressSupplier() { + return Stream.of( + // size | blockSize | bufferCount + Arguments.of(10 * Constants.MB, 10L * Constants.MB, 8), + Arguments.of(20 * Constants.MB, (long) Constants.MB, 5), + Arguments.of(10 * Constants.MB, 5L * Constants.MB, 2), + Arguments.of(10 * Constants.MB, 10L * Constants.KB, 100) + ); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("uploadFromFileWithProgressSupplier") + public void uploadFromFileListener(int size, long blockSize, int bufferCount) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + FileAsyncApiTests.FileUploadListener uploadListener = new FileAsyncApiTests.FileUploadListener(); + + File file = getRandomFile(size); + file.deleteOnExit(); + createdFiles.add(file); + + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) + .setMaxConcurrency(bufferCount) + .setProgressListener(uploadListener) + .setMaxSingleUploadSizeLong(blockSize - 1); + + StepVerifier.create(fac.uploadFromFile(file.toPath().toString(), parallelTransferOptions, null, + null, null)) + .verifyComplete(); + + assertEquals(size, uploadListener.getReportedByteCount()); + } + + @ParameterizedTest + @MethodSource("uploadFromFileOptionsSupplier") + public void uploadFromFileOptions(int dataSize, long singleUploadSize, Long blockSize) { + File file = getRandomFile(dataSize); + file.deleteOnExit(); + createdFiles.add(file); + + + fc.uploadFromFile(file.toPath().toString(), + new ParallelTransferOptions().setBlockSizeLong(blockSize).setMaxSingleUploadSizeLong(singleUploadSize), + null, null, null).block(); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> assertEquals(dataSize, r.getFileSize())) + .verifyComplete(); + } + + private static Stream uploadFromFileOptionsSupplier() { + return Stream.of( + // dataSize | singleUploadSize | blockSize + Arguments.of(100, 50L, null), // Test that singleUploadSize is respected + Arguments.of(100, 50L, 20L) // Test that blockSize is respected + ); + } + + @ParameterizedTest + @MethodSource("uploadFromFileOptionsSupplier") + public void uploadFromFileWithResponse(int dataSize, long singleUploadSize, Long blockSize) { + File file = getRandomFile(dataSize); + file.deleteOnExit(); + createdFiles.add(file); + + StepVerifier.create(fc.uploadFromFileWithResponse(file.toPath().toString(), + new ParallelTransferOptions().setBlockSizeLong(blockSize).setMaxSingleUploadSizeLong(singleUploadSize), + null, null, null)) + .assertNext(r -> { + assertEquals(200, r.getStatusCode()); + assertNotNull(r.getValue().getETag()); + assertNotNull(r.getValue().getLastModified()); + }) + .verifyComplete(); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> assertEquals(dataSize, r.getFileSize())) + .verifyComplete(); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @Test + public void asyncBufferedUploadEmpty() { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fac.upload(Flux.just(ByteBuffer.wrap(new byte[0])), null)) + .verifyError(DataLakeStorageException.class); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("asyncBufferedUploadEmptyBuffersSupplier") + public void asyncBufferedUploadEmptyBuffers(ByteBuffer buffer1, ByteBuffer buffer2, ByteBuffer buffer3, + byte[] expectedDownload) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fac.upload(Flux.fromIterable(Arrays.asList(buffer1, buffer2, buffer3)), + null, true)) + .assertNext(pathInfo -> assertNotNull(pathInfo.getETag())) + .verifyComplete(); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fac.read())) + .assertNext(bytes -> TestUtils.assertArraysEqual(expectedDownload, bytes)) + .verifyComplete(); + } + + private static Stream asyncBufferedUploadEmptyBuffersSupplier() { + ByteBuffer emptyBuffer = ByteBuffer.allocate(0); + byte[] helloBytes = "Hello".getBytes(StandardCharsets.UTF_8); + byte[] worldBytes = "world!".getBytes(StandardCharsets.UTF_8); + + return Stream.of( + // buffer1 | buffer2 | buffer3 || expectedDownload + Arguments.of(ByteBuffer.wrap(helloBytes), ByteBuffer.wrap(" ".getBytes(StandardCharsets.UTF_8)), ByteBuffer.wrap(worldBytes), "Hello world!".getBytes(StandardCharsets.UTF_8)), + Arguments.of(ByteBuffer.wrap(helloBytes), ByteBuffer.wrap(" ".getBytes(StandardCharsets.UTF_8)), emptyBuffer, "Hello ".getBytes(StandardCharsets.UTF_8)), + Arguments.of(ByteBuffer.wrap(helloBytes), emptyBuffer, ByteBuffer.wrap(worldBytes), "Helloworld!".getBytes(StandardCharsets.UTF_8)), + Arguments.of(emptyBuffer, ByteBuffer.wrap(" ".getBytes(StandardCharsets.UTF_8)), ByteBuffer.wrap(worldBytes), " world!".getBytes(StandardCharsets.UTF_8)) + ); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") // Test uploads large amount of data + @ParameterizedTest + @MethodSource("asyncBufferedUploadSupplier") + public void asyncBufferedUpload(int dataSize, long bufferSize, int numBuffs) { + DataLakeFileAsyncClient facWrite = getPrimaryServiceClientForWrites(bufferSize) + .getFileSystemAsyncClient(dataLakeFileSystemAsyncClient.getFileSystemName()) + .createFile(generatePathName()).blockOptional() + .orElseThrow(() -> new RuntimeException("File was not created")); + DataLakeFileAsyncClient facRead = dataLakeFileSystemAsyncClient.getFileAsyncClient(facWrite.getFileName()); + + byte[] data = getRandomByteArray(dataSize); + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() + .setBlockSizeLong(bufferSize) + .setMaxConcurrency(numBuffs) + .setMaxSingleUploadSizeLong(4L * Constants.MB); + + facWrite.upload(Flux.just(ByteBuffer.wrap(data)), parallelTransferOptions, true).block(); + + // Due to memory issues, this check only runs on small to medium-sized data sets. + if (dataSize < 100 * 1024 * 1024) { + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(facRead.read(), dataSize)) + .assertNext(bytes -> TestUtils.assertArraysEqual(data, bytes)) + .verifyComplete(); + } + } + + private static Stream asyncBufferedUploadSupplier() { + return Stream.of( + // dataSize | bufferSize | numBuffs || blockCount + Arguments.of(35 * Constants.MB, 5L * Constants.MB, 2), // Requires cycling through the same buffers multiple times. + Arguments.of(35 * Constants.MB, 5L * Constants.MB, 5), // Most buffers may only be used once. + Arguments.of(100 * Constants.MB, 10L * Constants.MB, 2), // Larger data set. + Arguments.of(100 * Constants.MB, 10L * Constants.MB, 5), // Larger number of Buffs. + Arguments.of(10 * Constants.MB, (long) Constants.MB, 10), // Exactly enough buffer space to hold all the data. + Arguments.of(50 * Constants.MB, 10L * Constants.MB, 2), // Larger data. + Arguments.of(10 * Constants.MB, 2L * Constants.MB, 4), + Arguments.of(10 * Constants.MB, 3L * Constants.MB, 3) // Data does not squarely fit in buffers. + ); + } + + private static void compareListToBuffer(List buffers, ByteBuffer result) { + result.position(0); + for (ByteBuffer buffer : buffers) { + buffer.position(0); + result.limit(result.position() + buffer.remaining()); + + TestUtils.assertByteBuffersEqual(buffer, result); + + result.position(result.position() + buffer.remaining()); + } + + assertEquals(0, result.remaining()); + } + + // Reporter for testing Progress Receiver + // Will count the number of reports that are triggered + @SuppressWarnings("deprecation") + private static final class Reporter implements ProgressReceiver { + private final long blockSize; + private long reportingCount; + + Reporter(long blockSize) { + this.blockSize = blockSize; + } + + @Override + public void reportProgress(long bytesTransferred) { + assert bytesTransferred % blockSize == 0; + this.reportingCount += 1; + } + } + + private static final class Listener implements ProgressListener { + private final long blockSize; + private long reportingCount; + + Listener(long blockSize) { + this.blockSize = blockSize; + } + + @Override + public void handleProgress(long bytesTransferred) { + assert bytesTransferred % blockSize == 0; + this.reportingCount += 1; + } + } + + @SuppressWarnings("deprecation") + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("bufferedUploadWithProgressSupplier") + public void bufferedUploadWithReporter(int size, long blockSize, int bufferCount) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + FileAsyncApiTests.Reporter uploadReporter = new FileAsyncApiTests.Reporter(blockSize); + + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) + .setMaxConcurrency(bufferCount) + .setProgressReceiver(uploadReporter) + .setMaxSingleUploadSizeLong(4L * Constants.MB); + + + StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(size)), parallelTransferOptions, null, + null, null)) + .assertNext(response -> { + assertEquals(200, response.getStatusCode()); + // Verify that the reporting count is equal or greater than the size divided by block size in the case + // that operations need to be retried. Retry attempts will increment the reporting count. + assertTrue(uploadReporter.reportingCount >= (size / blockSize)); + }) + .verifyComplete(); + } + + private static Stream bufferedUploadWithProgressSupplier() { + return Stream.of( + // size | blockSize | bufferCount + Arguments.of(10 * Constants.MB, 10L * Constants.MB, 8), + Arguments.of(20 * Constants.MB, (long) Constants.MB, 5), + Arguments.of(10 * Constants.MB, 5L * Constants.MB, 2), + Arguments.of(10 * Constants.MB, 512L * Constants.KB, 20) + ); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("bufferedUploadWithProgressSupplier") + public void bufferedUploadWithListener(int size, long blockSize, int bufferCount) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + FileAsyncApiTests.Listener uploadListener = new FileAsyncApiTests.Listener(blockSize); + + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) + .setMaxConcurrency(bufferCount) + .setProgressListener(uploadListener) + .setMaxSingleUploadSizeLong(4L * Constants.MB); + + StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(size)), parallelTransferOptions, null, + null, null)) + .assertNext(response -> { + assertEquals(200, response.getStatusCode()); + // Verify that the reporting count is equal or greater than the size divided by block size in the case + // that operations need to be retried. Retry attempts will increment the reporting count. + assertTrue(uploadListener.reportingCount >= (size / blockSize)); + }) + .verifyComplete(); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") // Test uploads large amount of data + @ParameterizedTest + @MethodSource("bufferedUploadChunkedSourceSupplier") + public void bufferedUploadChunkedSource(List dataSizeList, long bufferSize, int numBuffers) { + DataLakeFileAsyncClient facWrite = getPrimaryServiceClientForWrites(bufferSize) + .getFileSystemAsyncClient(dataLakeFileSystemAsyncClient.getFileSystemName()) + .createFile(generatePathName()).blockOptional() + .orElseThrow(() -> new RuntimeException("File was not created.")); + DataLakeFileAsyncClient facRead = dataLakeFileSystemAsyncClient.getFileAsyncClient(facWrite.getFileName()); + + // This test should validate that the upload should work regardless of what format the passed data is in because + // it will be chunked appropriately. + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() + .setBlockSizeLong(bufferSize * Constants.MB) + .setMaxConcurrency(numBuffers) + .setMaxSingleUploadSizeLong(4L * Constants.MB); + List dataList = dataSizeList.stream() + .map(size -> getRandomData(size * Constants.MB)) + .collect(Collectors.toList()); + + Mono uploadOperation = facWrite.upload(Flux.fromIterable(dataList), parallelTransferOptions, true) + .then(FluxUtil.collectBytesInByteBufferStream(facRead.read())); + + StepVerifier.create(uploadOperation) + .assertNext(bytes -> compareListToBuffer(dataList, ByteBuffer.wrap(bytes))) + .verifyComplete(); + } + + private static Stream bufferedUploadChunkedSourceSupplier() { + return Stream.of( + // dataSizeList | bufferSize | numBuffers + Arguments.of(Arrays.asList(7, 7), 10L, 2), // First item fits entirely in the buffer, next item spans two buffers + Arguments.of(Arrays.asList(3, 3, 3, 3, 3, 3, 3), 10L, 2), // Multiple items fit non-exactly in one buffer. + Arguments.of(Arrays.asList(10, 10), 10L, 2), // Data fits exactly and does not need chunking. + Arguments.of(Arrays.asList(50, 51, 49), 10L, 2) // Data needs chunking and does not fit neatly in buffers. Requires waiting for buffers to be released. + ); + } + + // These two tests are to test optimizations in buffered upload for small files. + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("bufferedUploadHandlePathingSupplier") + public void bufferedUploadHandlePathing(List dataSizeList) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + List dataList = dataSizeList.stream().map(this::getRandomData).collect(Collectors.toList()); + + Mono uploadOperation = fac.upload(Flux.fromIterable(dataList), + new ParallelTransferOptions().setMaxSingleUploadSizeLong(4L * Constants.MB), true) + .then(FluxUtil.collectBytesInByteBufferStream(fac.read())); + + StepVerifier.create(uploadOperation) + .assertNext(bytes -> compareListToBuffer(dataList, ByteBuffer.wrap(bytes))) + .verifyComplete(); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("bufferedUploadHandlePathingSupplier") + public void bufferedUploadHandlePathingHotFlux(List dataSizeList) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + List dataList = dataSizeList.stream().map(this::getRandomData).collect(Collectors.toList()); + + Mono uploadOperation = fac.upload(Flux.fromIterable(dataList).publish().autoConnect(), + new ParallelTransferOptions().setMaxSingleUploadSizeLong(4L * Constants.MB), true) + .then(FluxUtil.collectBytesInByteBufferStream(fac.read())); + + StepVerifier.create(uploadOperation) + .assertNext(bytes -> compareListToBuffer(dataList, ByteBuffer.wrap(bytes))) + .verifyComplete(); + } + + private static Stream> bufferedUploadHandlePathingSupplier() { + return Stream.of(Arrays.asList(10, 100, 1000, 10000), Arrays.asList(4 * Constants.MB + 1, 10), + Arrays.asList(4 * Constants.MB, 4 * Constants.MB), Collections.singletonList(4 * Constants.MB)); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("bufferedUploadHandlePathingHotFluxWithTransientFailureSupplier") + public void bufferedUploadHandlePathingHotFluxWithTransientFailure(List dataSizeList) { + DataLakeFileAsyncClient clientWithFailure = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl(), + new TransientFailureInjectingHttpPipelinePolicy()); + List dataList = dataSizeList.stream().map(this::getRandomData).collect(Collectors.toList()); + + DataLakeFileAsyncClient fcAsync = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl()); + + Mono uploadOperation = clientWithFailure.upload(Flux.fromIterable(dataList).publish().autoConnect(), + new ParallelTransferOptions().setMaxSingleUploadSizeLong(4L * Constants.MB), true) + .then(FluxUtil.collectBytesInByteBufferStream(fcAsync.read())); + + StepVerifier.create(uploadOperation) + .assertNext(bytes -> compareListToBuffer(dataList, ByteBuffer.wrap(bytes))) + .verifyComplete(); + } + + private static Stream> bufferedUploadHandlePathingHotFluxWithTransientFailureSupplier() { + return Stream.of(Arrays.asList(10, 100, 1000, 10000), Arrays.asList(4 * Constants.MB + 1, 10), + Arrays.asList(4 * Constants.MB, 4 * Constants.MB)); + } + + @SuppressWarnings("deprecation") + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @ValueSource(ints = {11110, 2 * Constants.MB + 11}) + public void bufferedUploadAsyncHandlePathingWithTransientFailure(int dataSize) { + // This test ensures that although we no longer mark and reset the source stream for buffered upload, it still + // supports retries in all cases for the sync client. + DataLakeFileAsyncClient clientWithFailure = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl(), + new TransientFailureInjectingHttpPipelinePolicy()); + + byte[] data = getRandomByteArray(dataSize); + clientWithFailure.uploadWithResponse(new FileParallelUploadOptions(new ByteArrayInputStream(data), dataSize) + .setParallelTransferOptions(new ParallelTransferOptions().setMaxSingleUploadSizeLong(2L * Constants.MB) + .setBlockSizeLong(2L * Constants.MB))).block(); + + byte[] readArray = FluxUtil.collectBytesInByteBufferStream(fc.read()).block(); + TestUtils.assertArraysEqual(data, readArray); + } + + @Test + public void bufferedUploadIllegalArgumentsNull() { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() + .orElseThrow(() -> new RuntimeException("Cannot create file.")); + + StepVerifier.create(fac.upload((Flux) null, + new ParallelTransferOptions().setBlockSizeLong(4L).setMaxConcurrency(4), true)) + .verifyError(NullPointerException.class); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("bufferedUploadHeadersSupplier") + public void bufferedUploadHeaders(int dataSize, String cacheControl, String contentDisposition, + String contentEncoding, String contentLanguage, boolean validateContentMD5, String contentType) + throws NoSuchAlgorithmException { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + byte[] randomData = getRandomByteArray(dataSize); + byte[] contentMD5 = validateContentMD5 ? MessageDigest.getInstance("MD5").digest(randomData) : null; + Mono> uploadOperation = fac + .uploadWithResponse(Flux.just(ByteBuffer.wrap(randomData)), + new ParallelTransferOptions().setMaxSingleUploadSizeLong(4L * Constants.MB), + new PathHttpHeaders() + .setCacheControl(cacheControl) + .setContentDisposition(contentDisposition) + .setContentEncoding(contentEncoding) + .setContentLanguage(contentLanguage) + .setContentMd5(contentMD5) + .setContentType(contentType), null, null) + .then(fac.getPropertiesWithResponse(null)); + + StepVerifier.create(uploadOperation) + .assertNext(response -> validatePathProperties(response, cacheControl, contentDisposition, contentEncoding, + contentLanguage, contentMD5, contentType == null ? "application/octet-stream" : contentType)) + .verifyComplete(); + } + + private static Stream bufferedUploadHeadersSupplier() { + return Stream.of( + // dataSize | cacheControl | contentDisposition | contentEncoding | contentLanguage | validateContentMD5 | contentType + Arguments.of(DATA.getDefaultDataSize(), null, null, null, null, true, null), + Arguments.of(DATA.getDefaultDataSize(), "control", "disposition", "encoding", "language", true, "type"), + Arguments.of(6 * Constants.MB, null, null, null, null, false, null), + Arguments.of(6 * Constants.MB, "control", "disposition", "encoding", "language", true, "type") + ); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @CsvSource(value = {"null,null,null,null", "foo,bar,fizz,buzz"}, nullValues = "null") + public void bufferedUploadMetadata(String key1, String value1, String key2, String value2) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + Map metadata = new HashMap<>(); + if (key1 != null) { + metadata.put(key1, value1); + } + if (key2 != null) { + metadata.put(key2, value2); + } + + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(10L) + .setMaxConcurrency(10); + Mono> uploadOperation = fac.uploadWithResponse(Flux.just(getRandomData(10)), + parallelTransferOptions, null, metadata, null) + .then(fac.getPropertiesWithResponse(null)); + + StepVerifier.create(uploadOperation) + .assertNext(response -> { + assertEquals(200, response.getStatusCode()); + assertEquals(metadata, response.getValue().getMetadata()); + }) + .verifyComplete(); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("uploadNumberOfAppendsSupplier") + public void bufferedUploadOptions(int dataSize, Long singleUploadSize, Long blockSize, int numAppends) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + AtomicInteger appendCount = new AtomicInteger(0); + DataLakeFileAsyncClient spyClient = new DataLakeFileAsyncClient(fac) { + @Override + Mono> appendWithResponse(Flux data, long fileOffset, long length, + DataLakeFileAppendOptions appendOptions, Context context) { + appendCount.incrementAndGet(); + return super.appendWithResponse(data, fileOffset, length, appendOptions, context); + } + }; + + StepVerifier.create(spyClient.uploadWithResponse(Flux.just(getRandomData(dataSize)), + new ParallelTransferOptions().setBlockSizeLong(blockSize).setMaxSingleUploadSizeLong(singleUploadSize), + null, null, null)) + .expectNextCount(1) + .verifyComplete(); + + StepVerifier.create(fac.getProperties()) + .assertNext(properties -> assertEquals(dataSize, properties.getFileSize())) + .verifyComplete(); + + assertEquals(numAppends, appendCount.get()); + } + + @Test + public void bufferedUploadPermissionsAndUmask() { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + Mono> uploadOperation = fac.uploadWithResponse( + new FileParallelUploadOptions(Flux.just(getRandomData(10))).setPermissions("0777").setUmask("0057")) + .then(fac.getPropertiesWithResponse(null)); + + StepVerifier.create(uploadOperation) + .assertNext(response -> { + assertEquals(200, response.getStatusCode()); + assertEquals(10, response.getValue().getFileSize()); + }) + .verifyComplete(); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void bufferedUploadAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() + .orElseThrow(() -> new RuntimeException("Could not create file")); + + DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fac, leaseID)) + .setIfMatch(setupPathMatchCondition(fac, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(10L); + + StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(10)), + parallelTransferOptions, null, null, requestConditions)) + .assertNext(response -> assertEquals(200, response.getStatusCode())) + .verifyComplete(); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void bufferedUploadACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() + .orElseThrow(() -> new RuntimeException("Could not create file")); + DataLakeRequestConditions requestConditions = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fac, leaseID)) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fac, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(10L); + + StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(10)), + parallelTransferOptions, null, null, requestConditions)) + .verifyErrorSatisfies(ex -> { + DataLakeStorageException exception = assertInstanceOf(DataLakeStorageException.class, ex); + assertEquals(412, exception.getStatusCode()); + }); + } + + // UploadBufferPool used to lock when the number of failed stageblocks exceeded the maximum number of buffers + // (discovered when a leaseId was invalid) + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @ParameterizedTest + @CsvSource({"7,2", "5,2"}) + public void uploadBufferPoolLockThreeOrMoreBuffers(long blockSize, int numBuffers) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.createFile(generatePathName()).blockOptional() + .orElseThrow(() -> new RuntimeException("Could not create file")); + DataLakeRequestConditions requestConditions = new DataLakeRequestConditions(). + setLeaseId(setupPathLeaseCondition(fac, GARBAGE_LEASE_ID)); + + ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize) + .setMaxConcurrency(numBuffers); + + + StepVerifier.create(fac.uploadWithResponse(Flux.just(getRandomData(10)), + parallelTransferOptions, null, null, requestConditions)) + .verifyError(DataLakeStorageException.class); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @Test + public void bufferedUploadDefaultNoOverwrite() { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + fac.upload(DATA.getDefaultFlux(), null).block(); + + StepVerifier.create(fac.upload(DATA.getDefaultFlux(), null)) + .verifyError(IllegalArgumentException.class); + } + + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") + @Test + public void bufferedUploadOverwrite() { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + File file = getRandomFile(50); + file.deleteOnExit(); + createdFiles.add(file); + + assertDoesNotThrow(() -> fc.uploadFromFile(file.toPath().toString(), true)); + + StepVerifier.create(fac.uploadFromFile(getRandomFile(50).toPath().toString(), true)) + .verifyComplete(); + } + + @Test + public void bufferedUploadNonMarkableStream() throws IOException { + File file = getRandomFile(10); + file.deleteOnExit(); + createdFiles.add(file); + + File outFile = getRandomFile(10); + outFile.deleteOnExit(); + createdFiles.add(outFile); + + Flux stream = FluxUtil.readFile(AsynchronousFileChannel.open(file.toPath()), 0, file.length()); + + fc.upload(stream, null, true).block(); + + fc.readToFile(outFile.toPath().toString(), true).block(); + compareFiles(file, outFile, 0, file.length()); + } + + @Test + public void uploadInputStreamNoLength() { + assertDoesNotThrow(() -> + fc.uploadWithResponse(new FileParallelUploadOptions(DATA.getDefaultInputStream())).block()); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fc.read())) + .assertNext(r -> TestUtils.assertArraysEqual(DATA.getDefaultBytes(), r)) + .verifyComplete(); + } + + @SuppressWarnings("deprecation") + @ParameterizedTest + @MethodSource("uploadInputStreamBadLengthSupplier") + public void uploadInputStreamBadLength(long length) { + assertThrows(Exception.class, () -> fc.uploadWithResponse( + new FileParallelUploadOptions(DATA.getDefaultInputStream(), length)).block()); + } + + private static Stream uploadInputStreamBadLengthSupplier() { + return Stream.of(0L, -100L, DATA.getDefaultDataSizeLong() - 1, DATA.getDefaultDataSizeLong() + 1); + } + + @Test + public void uploadSuccessfulRetry() { + DataLakeFileAsyncClient clientWithFailure = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl(), + new TransientFailureInjectingHttpPipelinePolicy()); + + assertDoesNotThrow(() -> clientWithFailure.uploadWithResponse( + new FileParallelUploadOptions(DATA.getDefaultInputStream())).block()); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fc.read())) + .assertNext(r -> TestUtils.assertArraysEqual(DATA.getDefaultBytes(), r)) + .verifyComplete(); + } + + @Test + public void uploadBinaryData() { + DataLakeFileAsyncClient client = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl()); + + assertDoesNotThrow( + () -> client.uploadWithResponse(new FileParallelUploadOptions(DATA.getDefaultBinaryData())).block()); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fc.read())) + .assertNext(r -> TestUtils.assertArraysEqual(DATA.getDefaultBytes(), r)) + .verifyComplete(); + } + + @Test + public void uploadBinaryDataOverwrite() { + DataLakeFileAsyncClient client = getFileAsyncClient(getDataLakeCredential(), fc.getFileUrl()); + + assertDoesNotThrow(() -> client.upload(DATA.getDefaultBinaryData(), null, true).block()); + + StepVerifier.create(FluxUtil.collectBytesInByteBufferStream(fc.read())) + .assertNext(r -> TestUtils.assertArraysEqual(DATA.getDefaultBytes(), r)) + .verifyComplete(); + } + + @DisabledIf("olderThan20210410ServiceVersion") + @Test + public void uploadEncryptionContext() { + String encryptionContext = "encryptionContext"; + FileParallelUploadOptions options = new FileParallelUploadOptions(DATA.getDefaultInputStream()) + .setEncryptionContext(encryptionContext); + + fc.uploadWithResponse(options).block(); + + StepVerifier.create(fc.getProperties()) + .assertNext(r -> assertEquals(encryptionContext, r.getEncryptionContext())) + .verifyComplete(); + } + + /* Quick Query Tests. */ + + // Generates and uploads a CSV file + private void uploadCsv(FileQueryDelimitedSerialization s, int numCopies) { + String columnSeparator = Character.toString(s.getColumnSeparator()); + String header = "rn1" + columnSeparator + "rn2" + columnSeparator + "rn3" + columnSeparator + "rn4" + + s.getRecordSeparator(); + byte[] headers = header.getBytes(); + + String csv = "100" + columnSeparator + "200" + columnSeparator + "300" + columnSeparator + "400" + + s.getRecordSeparator() + "300" + columnSeparator + "400" + columnSeparator + "500" + columnSeparator + + "600" + s.getRecordSeparator(); + + byte[] csvData = csv.getBytes(); + + int headerLength = s.isHeadersPresent() ? headers.length : 0; + byte[] data = new byte[headerLength + csvData.length * numCopies]; + if (s.isHeadersPresent()) { + System.arraycopy(headers, 0, data, 0, headers.length); + } + + for (int i = 0; i < numCopies; i++) { + int o = i * csvData.length + headerLength; + System.arraycopy(csvData, 0, data, o, csvData.length); + } + + fc.create(true).block(); + fc.append(BinaryData.fromBytes(data), 0).block(); + fc.flush(data.length, true).block(); + } + + private void uploadSmallJson(int numCopies) { + StringBuilder b = new StringBuilder(); + b.append("{\n"); + for (int i = 0; i < numCopies; i++) { + b.append(String.format("\t\"name%d\": \"owner%d\",\n", i, i)); + } + b.append('}'); + + fc.create(true).block(); + fc.append(BinaryData.fromString(b.toString()), 0).block(); + fc.flush(b.length(), true).block(); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @ParameterizedTest + @ValueSource(ints = { + 1, // 32 bytes + 32, // 1 KB + 256, // 8 KB + 400, // 12 ish KB + 4000 // 125 KB + }) + public void queryMin(int numCopies) { + FileQueryDelimitedSerialization ser = new FileQueryDelimitedSerialization() + .setRecordSeparator('\n') + .setColumnSeparator(',') + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(false); + uploadCsv(ser, numCopies); + String expression = "SELECT * from BlobStorage"; + + byte[] readArray = FluxUtil.collectBytesInByteBufferStream(fc.read()).block(); + + liveTestScenarioWithRetry(() -> { + + ByteArrayOutputStream queryData = fc.query(expression).reduce(new ByteArrayOutputStream(), (outputStream, piece) -> { + try { + outputStream.write(piece.array()); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + return outputStream; + }).block(); + byte[] queryArray = queryData.toByteArray(); + + TestUtils.assertArraysEqual(readArray, queryArray); + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @ParameterizedTest + @MethodSource("queryCsvSerializationSeparatorSupplier") + public void queryCsvSerializationSeparator(char recordSeparator, char columnSeparator, boolean headersPresentIn, + boolean headersPresentOut) { + FileQueryDelimitedSerialization serIn = new FileQueryDelimitedSerialization() + .setRecordSeparator(recordSeparator) + .setColumnSeparator(columnSeparator) + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(headersPresentIn); + FileQueryDelimitedSerialization serOut = new FileQueryDelimitedSerialization() + .setRecordSeparator(recordSeparator) + .setColumnSeparator(columnSeparator) + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(headersPresentOut); + uploadCsv(serIn, 32); + String expression = "SELECT * from BlobStorage"; + + byte[] readArray = FluxUtil.collectBytesInByteBufferStream(fc.read()).block(); + + liveTestScenarioWithRetry(() -> { + ByteArrayOutputStream queryData = new ByteArrayOutputStream(); + + byte[] queryArray = fc.queryWithResponse(new FileQueryOptions(expression, queryData) + .setInputSerialization(serIn).setOutputSerialization(serOut)) + .flatMap(piece -> FluxUtil.collectBytesInByteBufferStream(piece.getValue())).block(); + + if (headersPresentIn && !headersPresentOut) { + assertEquals(readArray.length - 16, queryArray.length); + + /* Account for 16 bytes of header. */ + TestUtils.assertArraysEqual(readArray, 16, queryArray, 0, readArray.length - 16); + } else { + TestUtils.assertArraysEqual(readArray, queryArray); + } + }); + } + + private static Stream queryCsvSerializationSeparatorSupplier() { + return Stream.of( + // recordSeparator | columnSeparator | headersPresentIn | headersPresentOut + Arguments.of('\n', ',', false, false), // Default. + Arguments.of('\n', ',', true, true), // Headers. + Arguments.of('\n', ',', true, false), // Headers. + Arguments.of('\t', ',', false, false), // Record separator. + Arguments.of('\r', ',', false, false), + Arguments.of('<', ',', false, false), + Arguments.of('>', ',', false, false), + Arguments.of('&', ',', false, false), + Arguments.of('\\', ',', false, false), + Arguments.of(',', '.', false, false), // Column separator. +// Arguments.of(',', '\n', false, false), // Keep getting a qq error: Field delimiter and record delimiter must be different characters. + Arguments.of(',', ';', false, false), + Arguments.of('\n', '\t', false, false), +// Arguments.of('\n', '\r', false, false), // Keep getting a qq error: Field delimiter and record delimiter must be different characters. + Arguments.of('\n', '<', false, false), + Arguments.of('\n', '>', false, false), + Arguments.of('\n', '&', false, false), + Arguments.of('\n', '\\', false, false) + ); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void queryCsvSerializationEscapeAndFieldQuote() { + FileQueryDelimitedSerialization ser = new FileQueryDelimitedSerialization() + .setRecordSeparator('\n') + .setColumnSeparator(',') + .setEscapeChar('\\') /* Escape set here. */ + .setFieldQuote('"') /* Field quote set here*/ + .setHeadersPresent(false); + uploadCsv(ser, 32); + + String expression = "SELECT * from BlobStorage"; + + byte[] readArray = FluxUtil.collectBytesInByteBufferStream(fc.read()).block(); + + liveTestScenarioWithRetry(() -> { + ByteArrayOutputStream queryData = new ByteArrayOutputStream(); + + byte[] queryArray = fc.queryWithResponse(new FileQueryOptions(expression, queryData) + .setInputSerialization(ser).setOutputSerialization(ser)) + .flatMap(piece -> FluxUtil.collectBytesInByteBufferStream(piece.getValue())).block(); + + TestUtils.assertArraysEqual(readArray, queryArray); + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @ParameterizedTest + @MethodSource("queryInputJsonSupplier") + public void queryInputJson(int numCopies, char recordSeparator) { + FileQueryJsonSerialization ser = new FileQueryJsonSerialization() + .setRecordSeparator(recordSeparator); + uploadSmallJson(numCopies); + String expression = "SELECT * from BlobStorage"; + + ByteArrayOutputStream readData = new ByteArrayOutputStream(); + FluxUtil.writeToOutputStream(fc.read(), readData).block(); + readData.write(10); + byte[] readArray = readData.toByteArray(); + + liveTestScenarioWithRetry(() -> { + ByteArrayOutputStream queryData = new ByteArrayOutputStream(); + FileQueryOptions optionsOs = new FileQueryOptions(expression, queryData) + .setInputSerialization(ser).setOutputSerialization(ser); + + byte[] queryArray = fc.queryWithResponse(optionsOs) + .flatMap(piece -> FluxUtil.collectBytesInByteBufferStream(piece.getValue())).block(); + + TestUtils.assertArraysEqual(readArray, queryArray); + }); + } + + private static Stream queryInputJsonSupplier() { + return Stream.of( + // numCopies | recordSeparator + Arguments.of(0, '\n'), + Arguments.of(10, '\n'), + Arguments.of(100, '\n'), + Arguments.of(1000, '\n') + ); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void queryInputCsvOutputJson() { + liveTestScenarioWithRetry(() -> { + FileQueryDelimitedSerialization inSer = new FileQueryDelimitedSerialization() + .setRecordSeparator('\n') + .setColumnSeparator(',') + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(false); + uploadCsv(inSer, 1); + FileQueryJsonSerialization outSer = new FileQueryJsonSerialization().setRecordSeparator('\n'); + String expression = "SELECT * from BlobStorage"; + byte[] expectedData = "{\"_1\":\"100\",\"_2\":\"200\",\"_3\":\"300\",\"_4\":\"400\"}".getBytes(); + + ByteArrayOutputStream queryData = new ByteArrayOutputStream(); + FileQueryOptions optionsOs = new FileQueryOptions(expression, queryData).setInputSerialization(inSer) + .setOutputSerialization(outSer); + + byte[] queryArray = fc.queryWithResponse(optionsOs) + .flatMap(piece -> FluxUtil.collectBytesInByteBufferStream(piece.getValue())).block(); + + TestUtils.assertArraysEqual(expectedData, 0, queryArray, 0, expectedData.length); + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void queryInputJsonOutputCsv() { + liveTestScenarioWithRetry(() -> { + FileQueryJsonSerialization inSer = new FileQueryJsonSerialization().setRecordSeparator('\n'); + uploadSmallJson(2); + + FileQueryDelimitedSerialization outSer = new FileQueryDelimitedSerialization() + .setRecordSeparator('\n') + .setColumnSeparator(',') + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(false); + String expression = "SELECT * from BlobStorage"; + byte[] expectedData = "owner0,owner1\n".getBytes(); + + ByteArrayOutputStream queryData = new ByteArrayOutputStream(); + FileQueryOptions optionsOs = new FileQueryOptions(expression, queryData).setInputSerialization(inSer) + .setOutputSerialization(outSer); + + byte[] queryArray = fc.queryWithResponse(optionsOs) + .flatMap(piece -> FluxUtil.collectBytesInByteBufferStream(piece.getValue())).block(); + + TestUtils.assertArraysEqual(expectedData, queryArray); + }); + } + + @SuppressWarnings("resource") + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void queryInputCsvOutputArrow() { + FileQueryDelimitedSerialization inSer = new FileQueryDelimitedSerialization() + .setRecordSeparator('\n') + .setColumnSeparator(',') + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(false); + uploadCsv(inSer, 32); + List schema = Collections.singletonList( + new FileQueryArrowField(FileQueryArrowFieldType.DECIMAL).setName("Name").setPrecision(4).setScale(2)); + FileQueryArrowSerialization outSer = new FileQueryArrowSerialization().setSchema(schema); + String expression = "SELECT _2 from BlobStorage WHERE _1 > 250;"; + + liveTestScenarioWithRetry(() -> { + OutputStream queryData = new ByteArrayOutputStream(); + FileQueryOptions options = new FileQueryOptions(expression, queryData).setOutputSerialization(outSer); + + assertDoesNotThrow(() -> fc.queryWithResponse(options).block()); + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void queryNonFatalError() { + FileQueryDelimitedSerialization base = new FileQueryDelimitedSerialization() + .setRecordSeparator('\n') + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(false); + uploadCsv(base.setColumnSeparator('.'), 32); + String expression = "SELECT _1 from BlobStorage WHERE _2 > 250"; + + liveTestScenarioWithRetry(() -> { + MockErrorReceiver receiver2 = new FileAsyncApiTests.MockErrorReceiver("InvalidColumnOrdinal"); + + assertDoesNotThrow(() -> fc.queryWithResponse(new FileQueryOptions(expression, new ByteArrayOutputStream()) + .setInputSerialization(base.setColumnSeparator(',')) + .setOutputSerialization(base.setColumnSeparator(',')) + .setErrorConsumer(receiver2)).block().getValue().blockLast()); + assertTrue(receiver2.numErrors > 0); + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void queryFatalError() { + FileQueryDelimitedSerialization base = new FileQueryDelimitedSerialization() + .setRecordSeparator('\n') + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(true); + uploadCsv(base.setColumnSeparator('.'), 32); + String expression = "SELECT * from BlobStorage"; + + liveTestScenarioWithRetry(() -> { + StepVerifier.create(fc.queryWithResponse(new FileQueryOptions(expression, + new ByteArrayOutputStream()).setInputSerialization(new FileQueryJsonSerialization()))) + .assertNext(r -> { + assertThrows(RuntimeException.class, () -> r.getValue().blockLast()); + }) + .verifyComplete(); + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void queryProgressReceiver() { + FileQueryDelimitedSerialization base = new FileQueryDelimitedSerialization() + .setRecordSeparator('\n') + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(false); + + uploadCsv(base.setColumnSeparator('.'), 32); + + long sizeofBlobToRead = fc.getProperties().block().getFileSize(); + String expression = "SELECT * from BlobStorage"; + + liveTestScenarioWithRetry(() -> { + MockProgressReceiver mockReceiver = new com.azure.storage.file.datalake.FileAsyncApiTests.MockProgressReceiver(); + FileQueryOptions options = new FileQueryOptions(expression, new ByteArrayOutputStream()).setProgressConsumer(mockReceiver); + // The Avro stream has the following pattern + // (data record -> progress record) -> end record + // + // 1KB of data will only come back as a single data record. + // + // Pretend to read more data because the input stream will not parse records following the data record if it + // doesn't need to. + fc.queryWithResponse(options).block().getValue().blockLast(); + + // At least the size of blob to read will be in the progress list + assertTrue(mockReceiver.progressList.contains(sizeofBlobToRead)); + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") // Large amount of data. + @Test + public void queryMultipleRecordsWithProgressReceiver() { + FileQueryDelimitedSerialization ser = new FileQueryDelimitedSerialization() + .setRecordSeparator('\n') + .setColumnSeparator(',') + .setEscapeChar('\0') + .setFieldQuote('\0') + .setHeadersPresent(false); + String expression = "SELECT * from BlobStorage"; + + uploadCsv(ser, 512000); + + liveTestScenarioWithRetry(() -> { + MockProgressReceiver mockReceiver = new com.azure.storage.file.datalake.FileAsyncApiTests.MockProgressReceiver(); + long temp = 0; + FileQueryOptions options = new FileQueryOptions(expression, new ByteArrayOutputStream()).setProgressConsumer(mockReceiver); + fc.queryWithResponse(options).block().getValue().blockLast(); + + // Make sure they're all increasingly bigger + for (long progress : mockReceiver.progressList) { + assertTrue(progress >= temp, "Expected progress to be greater than or equal to previous progress."); + temp = progress; + } + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @ParameterizedTest + @CsvSource(value = {"true,false", "false,true"}) + public void queryInputOutputIA(boolean input, boolean output) { + /* Mock random impl of QQ Serialization*/ + FileQuerySerialization ser = new RandomOtherSerialization(); + + FileQuerySerialization inSer = input ? ser : null; + FileQuerySerialization outSer = output ? ser : null; + String expression = "SELECT * from BlobStorage"; + + liveTestScenarioWithRetry(() -> { + assertThrows(IllegalArgumentException.class, () -> fc.queryWithResponse( + new FileQueryOptions(expression, new ByteArrayOutputStream()) + .setInputSerialization(inSer) + .setOutputSerialization(outSer)).block()); + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void queryArrowInputIA() { + FileQueryArrowSerialization inSer = new FileQueryArrowSerialization(); + String expression = "SELECT * from BlobStorage"; + + liveTestScenarioWithRetry(() -> { + StepVerifier.create(fc.queryWithResponse( + new FileQueryOptions(expression, new ByteArrayOutputStream()).setInputSerialization(inSer))) + .verifyError(IllegalArgumentException.class); + + }); + } + + private static boolean olderThan20201002ServiceVersion() { + return olderThan(DataLakeServiceVersion.V2020_10_02); + } + + @DisabledIf("olderThan20201002ServiceVersion") + @Test + public void queryParquetOutputIA() { + FileQueryParquetSerialization outSer = new FileQueryParquetSerialization(); + String expression = "SELECT * from BlobStorage"; + + liveTestScenarioWithRetry(() -> { + StepVerifier.create(fc.queryWithResponse( + new FileQueryOptions(expression, new ByteArrayOutputStream()).setOutputSerialization(outSer))) + .verifyError(IllegalArgumentException.class); + }); + } + + @SuppressWarnings("resource") + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void queryError() { + fc = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + liveTestScenarioWithRetry(() -> { + StepVerifier.create(fc.query("SELECT * from BlobStorage")) + .verifyError(DataLakeStorageException.class); + }); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @ParameterizedTest + @MethodSource("modifiedMatchAndLeaseIdSupplier") + public void queryAC(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + DataLakeRequestConditions bac = new DataLakeRequestConditions() + .setLeaseId(setupPathLeaseCondition(fc, leaseID)) + .setIfMatch(setupPathMatchCondition(fc, match)) + .setIfNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + String expression = "SELECT * from BlobStorage"; + + liveTestScenarioWithRetry(() -> { + assertDoesNotThrow(() -> fc.queryWithResponse(new FileQueryOptions(expression, new ByteArrayOutputStream()) + .setRequestConditions(bac)).block()); + }); + } + + private void liveTestScenarioWithRetry(Runnable runnable) { + if (!interceptorManager.isLiveMode()) { + runnable.run(); + return; + } + + int retry = 0; + while (retry < 5) { + try { + runnable.run(); + break; + } catch (Exception ex) { + retry++; + sleepIfRunningAgainstService(5000); + } + } + } + + @DisabledIf("olderThan20191212ServiceVersion") + @ParameterizedTest + @MethodSource("invalidModifiedMatchAndLeaseIdSupplier") + public void queryACFail(OffsetDateTime modified, OffsetDateTime unmodified, String match, String noneMatch, + String leaseID) { + setupPathLeaseCondition(fc, leaseID); + DataLakeRequestConditions bac = new DataLakeRequestConditions() + .setLeaseId(leaseID) + .setIfMatch(match) + .setIfNoneMatch(setupPathMatchCondition(fc, noneMatch)) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified); + String expression = "SELECT * from BlobStorage"; + + StepVerifier.create(fc.queryWithResponse( + new FileQueryOptions(expression, new ByteArrayOutputStream()).setRequestConditions(bac))) + .verifyError(DataLakeStorageException.class); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @ParameterizedTest + @MethodSource("scheduleDeletionSupplier") + public void scheduleDeletion(FileScheduleDeletionOptions fileScheduleDeletionOptions, boolean hasExpiry) { + DataLakeFileAsyncClient fileAsyncClient = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + fileAsyncClient.create().block(); + + fileAsyncClient.scheduleDeletionWithResponse(fileScheduleDeletionOptions).block(); + + assertEquals(hasExpiry, fileAsyncClient.getProperties().block().getExpiresOn() != null); + } + + private static Stream scheduleDeletionSupplier() { + return Stream.of( + // fileScheduleDeletionOptions | hasExpiry + Arguments.of(new FileScheduleDeletionOptions(Duration.ofDays(1), FileExpirationOffset.CREATION_TIME), true), + Arguments.of(new FileScheduleDeletionOptions(Duration.ofDays(1), FileExpirationOffset.NOW), true), + Arguments.of(new FileScheduleDeletionOptions(), false), + Arguments.of(null, false) + ); + } + + private static boolean olderThan20191212ServiceVersion() { + return olderThan(DataLakeServiceVersion.V2019_12_12); + } + + @DisabledIf("olderThan20191212ServiceVersion") + @Test + public void scheduleDeletionTime() { + OffsetDateTime now = testResourceNamer.now(); + FileScheduleDeletionOptions fileScheduleDeletionOptions = new FileScheduleDeletionOptions(now.plusDays(1)); + DataLakeFileAsyncClient fileAsyncClient = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + fileAsyncClient.create().block(); + + fileAsyncClient.scheduleDeletionWithResponse(fileScheduleDeletionOptions).block(); + + assertEquals(now.plusDays(1).truncatedTo(ChronoUnit.SECONDS), fileAsyncClient.getProperties().block().getExpiresOn()); + } + + @Test + public void scheduleDeletionError() { + FileScheduleDeletionOptions fileScheduleDeletionOptions = new FileScheduleDeletionOptions(testResourceNamer.now().plusDays(1)); + DataLakeFileAsyncClient fileAsyncClient = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + + StepVerifier.create(fileAsyncClient.scheduleDeletionWithResponse(fileScheduleDeletionOptions)) + .verifyError(DataLakeStorageException.class); + } + + static class MockProgressReceiver implements Consumer { + List progressList = new ArrayList<>(); + + @Override + public void accept(FileQueryProgress progress) { + progressList.add(progress.getBytesScanned()); + } + } + + static class MockErrorReceiver implements Consumer { + String expectedType; + int numErrors; + + MockErrorReceiver(String expectedType) { + this.expectedType = expectedType; + this.numErrors = 0; + } + + @Override + public void accept(FileQueryError error) { + assertFalse(error.isFatal()); + assertEquals(expectedType, error.getName()); + numErrors++; + } + } + + private static final class RandomOtherSerialization implements FileQuerySerialization { + } + + @Test + public void uploadInputStreamOverwriteFails() { + StepVerifier.create(fc.upload(DATA.getDefaultBinaryData(), null)) + .verifyError(IllegalArgumentException.class); + } + + @Test + public void uploadInputStreamOverwrite() { + fc.upload(DATA.getDefaultBinaryData(), null, true).block(); + + byte[] readArray = FluxUtil.collectBytesInByteBufferStream(fc.read()).block(); + + TestUtils.assertArraysEqual(DATA.getDefaultBytes(), readArray); + } + + @SuppressWarnings("deprecation") + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") /* Flaky in playback. */ + @Test + public void uploadInputStreamLargeData() { + ByteArrayInputStream input = new ByteArrayInputStream(getRandomByteArray(20 * Constants.MB)); + ParallelTransferOptions pto = new ParallelTransferOptions().setMaxSingleUploadSizeLong((long) Constants.MB); + + // Uses blob output stream under the hood. + assertDoesNotThrow(() -> fc.uploadWithResponse(new FileParallelUploadOptions(input, 20 * Constants.MB) + .setParallelTransferOptions(pto)).block()); + } + + @SuppressWarnings("deprecation") + @EnabledIf("com.azure.storage.file.datalake.DataLakeTestBase#isLiveMode") /* Flaky in playback. */ + @ParameterizedTest + @MethodSource("uploadNumberOfAppendsSupplier") + public void uploadNumAppends(int dataSize, Long singleUploadSize, Long blockSize, int numAppends) { + DataLakeFileAsyncClient fac = dataLakeFileSystemAsyncClient.getFileAsyncClient(generatePathName()); + AtomicInteger numAppendsCounter = new AtomicInteger(0); + DataLakeFileAsyncClient spyClient = new DataLakeFileAsyncClient(fac) { + @Override + Mono> appendWithResponse(Flux data, long fileOffset, long length, + DataLakeFileAppendOptions appendOptions, Context context) { + numAppendsCounter.incrementAndGet(); + return super.appendWithResponse(data, fileOffset, length, appendOptions, context); + } + }; + ByteArrayInputStream input = new ByteArrayInputStream(getRandomByteArray(dataSize)); + + ParallelTransferOptions pto = new ParallelTransferOptions().setBlockSizeLong(blockSize) + .setMaxSingleUploadSizeLong(singleUploadSize); + + StepVerifier.create(spyClient.uploadWithResponse(new FileParallelUploadOptions(input, dataSize) + .setParallelTransferOptions(pto))) + .expectNextCount(1) + .verifyComplete(); + + StepVerifier.create(fac.getProperties()) + .assertNext(properties -> assertEquals(dataSize, properties.getFileSize())) + .verifyComplete(); + assertEquals(numAppends, numAppendsCounter.get()); + } + + private static Stream uploadNumberOfAppendsSupplier() { + return Stream.of( + // dataSize | singleUploadSize | blockSize | numAppends + Arguments.of((100 * Constants.MB) - 1, null, null, 1), + Arguments.of((100 * Constants.MB) + 1, null, null, (int) Math.ceil(((double) (100 * Constants.MB) + 1) / (double) (4 * Constants.MB))), + Arguments.of(100, 50L, null, 1), + Arguments.of(100, 50L, 20L, 5) + ); + } + + @SuppressWarnings("deprecation") + @Test + public void uploadReturnValue() { + assertNotNull(fc.uploadWithResponse( + new FileParallelUploadOptions(DATA.getDefaultInputStream(), DATA.getDefaultDataSizeLong())).block() + .getValue().getETag()); + } + + // This tests the policy is in the right place because if it were added per retry, it would be after the credentials + // and auth would fail because we changed a signed header. + @Test + public void perCallPolicy() { + DataLakeFileAsyncClient fileAsyncClient = getPathClientBuilder(getDataLakeCredential(), fc.getFileUrl()) + .addPolicy(getPerCallVersionPolicy()) + .buildFileAsyncClient(); + + // blob endpoint + assertEquals("2019-02-02", fileAsyncClient.getPropertiesWithResponse(null).block().getHeaders() + .getValue(X_MS_VERSION)); + + // dfs endpoint + assertEquals("2019-02-02", fileAsyncClient.getAccessControlWithResponse(false, null).block().getHeaders() + .getValue(X_MS_VERSION)); + } + + +} + diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index 03928cd8e869..4c178a8e20e9 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 12.21.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 12.20.0 (2023-09-12) ### Features Added diff --git a/sdk/storage/azure-storage-file-share/pom.xml b/sdk/storage/azure-storage-file-share/pom.xml index 6fd3e2bbcec3..11b810756caa 100644 --- a/sdk/storage/azure-storage-file-share/pom.xml +++ b/sdk/storage/azure-storage-file-share/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-file-share - 12.20.0 + 12.21.0-beta.1 Microsoft Azure client library for File Share Storage This module contains client library for Microsoft Azure File Share Storage. @@ -67,7 +67,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 @@ -79,7 +79,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 tests test-jar test @@ -134,7 +134,7 @@ com.azure azure-storage-blob - 12.24.0 + 12.25.0-beta.1 test diff --git a/sdk/storage/azure-storage-internal-avro/CHANGELOG.md b/sdk/storage/azure-storage-internal-avro/CHANGELOG.md index 9f019c551358..334944af0be6 100644 --- a/sdk/storage/azure-storage-internal-avro/CHANGELOG.md +++ b/sdk/storage/azure-storage-internal-avro/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 12.10.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 12.9.0 (2023-09-12) ### Features Added diff --git a/sdk/storage/azure-storage-internal-avro/pom.xml b/sdk/storage/azure-storage-internal-avro/pom.xml index b93f012ac121..37ee2838521f 100644 --- a/sdk/storage/azure-storage-internal-avro/pom.xml +++ b/sdk/storage/azure-storage-internal-avro/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-internal-avro - 12.9.0 + 12.10.0-beta.1 Microsoft Azure internal Avro module for Storage This module contains internal use only avro parser code based for Microsoft Azure Storage client libraries. @@ -53,7 +53,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 @@ -95,7 +95,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 tests test-jar test diff --git a/sdk/storage/azure-storage-perf/pom.xml b/sdk/storage/azure-storage-perf/pom.xml index d869f2077bb9..0d7612323739 100644 --- a/sdk/storage/azure-storage-perf/pom.xml +++ b/sdk/storage/azure-storage-perf/pom.xml @@ -25,25 +25,25 @@ com.azure azure-storage-blob - 12.24.0 + 12.25.0-beta.1 com.azure azure-storage-blob-cryptography - 12.23.0 + 12.24.0-beta.1 com.azure azure-storage-file-datalake - 12.17.0 + 12.18.0-beta.1 com.azure azure-storage-file-share - 12.20.0 + 12.21.0-beta.1 @@ -66,7 +66,7 @@ com.azure azure-security-keyvault-keys - 4.6.5 + 4.7.0 diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index 59c2705f0fb4..20e570742582 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 12.20.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 12.19.0 (2023-09-12) ### Features Added diff --git a/sdk/storage/azure-storage-queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml index 88ef63e0d236..1cee8bd6d2b9 100644 --- a/sdk/storage/azure-storage-queue/pom.xml +++ b/sdk/storage/azure-storage-queue/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-queue - 12.19.0 + 12.20.0-beta.1 Microsoft Azure client library for Queue Storage This module contains client library for Microsoft Azure Queue Storage. @@ -63,7 +63,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 @@ -75,7 +75,7 @@ com.azure azure-storage-common - 12.23.0 + 12.24.0-beta.1 tests test-jar test diff --git a/sdk/storage/microsoft-azure-storage-blob/pom.xml b/sdk/storage/microsoft-azure-storage-blob/pom.xml index 6091529e6c3e..bd04e57b7f5d 100644 --- a/sdk/storage/microsoft-azure-storage-blob/pom.xml +++ b/sdk/storage/microsoft-azure-storage-blob/pom.xml @@ -83,7 +83,7 @@ com.azure azure-storage-common - 12.22.1 + 12.23.0 tests test-jar test diff --git a/sdk/tables/azure-data-tables/CHANGELOG.md b/sdk/tables/azure-data-tables/CHANGELOG.md index 96ad92d1ad24..f5e784230a15 100644 --- a/sdk/tables/azure-data-tables/CHANGELOG.md +++ b/sdk/tables/azure-data-tables/CHANGELOG.md @@ -8,9 +8,22 @@ ### Bugs Fixed +### Other Changes + +## 12.3.15 (2023-09-18) + +### Bugs Fixed +- Fixed the issue with `TableClient` and `TableAsyncClient` where `deleteEntity` did not work on entities with empty primary keys.[(33390)](https://github.com/Azure/azure-sdk-for-java/issues/36690) +- Fixed the issue with `TableClient` and `TableAsyncClient` where `getEntity` did not work on entities with empty primary keys. + ### Other Changes - Migrate test recordings to assets repo +#### Dependency Updates + +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. + ## 12.3.14 (2023-08-18) ### Other Changes diff --git a/sdk/tables/azure-data-tables/README.md b/sdk/tables/azure-data-tables/README.md index b4f3b9c1ae02..4af218cb6fa5 100644 --- a/sdk/tables/azure-data-tables/README.md +++ b/sdk/tables/azure-data-tables/README.md @@ -46,7 +46,7 @@ add the direct dependency to your project as follows. com.azure azure-data-tables - 12.3.13 + 12.3.15 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/tables/azure-data-tables/assets.json b/sdk/tables/azure-data-tables/assets.json index 9992ddc261f7..7a3d464b0cd2 100644 --- a/sdk/tables/azure-data-tables/assets.json +++ b/sdk/tables/azure-data-tables/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/tables/azure-data-tables", - "Tag": "java/tables/azure-data-tables_a3e59c4ede" + "Tag": "java/tables/azure-data-tables_e29aeeefbf" } diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/BuilderHelper.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/BuilderHelper.java index 1945504cb7ca..9162e1726759 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/BuilderHelper.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/BuilderHelper.java @@ -47,6 +47,7 @@ final class BuilderHelper { private static final String CLIENT_NAME = PROPERTIES.getOrDefault("name", "UnknownName"); private static final String CLIENT_VERSION = PROPERTIES.getOrDefault("version", "UnknownVersion"); private static final String COSMOS_ENDPOINT_SUFFIX = "cosmos.azure.com"; + public static final ClientOptions DEFAULT_CLIENT_OPTIONS = new ClientOptions(); static HttpPipeline buildPipeline(AzureNamedKeyCredential azureNamedKeyCredential, AzureSasCredential azureSasCredential, TokenCredential tokenCredential, @@ -77,18 +78,18 @@ static HttpPipeline buildPipeline(AzureNamedKeyCredential azureNamedKeyCredentia policies.add(new CosmosPatchTransformPolicy()); } + ClientOptions localClientOptions = clientOptions != null ? clientOptions : DEFAULT_CLIENT_OPTIONS; + policies.add(new UserAgentPolicy( - CoreUtils.getApplicationId(clientOptions, logOptions), CLIENT_NAME, CLIENT_VERSION, configuration)); + CoreUtils.getApplicationId(localClientOptions, logOptions), CLIENT_NAME, CLIENT_VERSION, configuration)); policies.add(new RequestIdPolicy()); - if (clientOptions != null) { - List httpHeaderList = new ArrayList<>(); + List httpHeaderList = new ArrayList<>(); - clientOptions.getHeaders().forEach(header -> - httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); + localClientOptions.getHeaders().forEach(header -> + httpHeaderList.add(new HttpHeader(header.getName(), header.getValue()))); - policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); - } + policies.add(new AddHeadersPolicy(new HttpHeaders(httpHeaderList))); // Add per call additional policies. policies.addAll(perCallAdditionalPolicies); @@ -128,6 +129,7 @@ static HttpPipeline buildPipeline(AzureNamedKeyCredential azureNamedKeyCredentia return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) + .clientOptions(localClientOptions) .build(); } diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java index 7b87571f5f7f..494fe18cda66 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java @@ -65,7 +65,6 @@ import java.util.Map; import java.util.stream.Collectors; -import static com.azure.core.util.CoreUtils.isNullOrEmpty; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; import static com.azure.data.tables.implementation.TableUtils.applyOptionalTimeout; @@ -828,6 +827,7 @@ public Mono deleteEntity(TableEntity entity) { * @return A {@link Mono} containing the {@link Response HTTP response}. * * @throws TableServiceException If the request is rejected by the service. + * @throws IllegalArgumentException If 'partitionKey' or 'rowKey' is null. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> deleteEntityWithResponse(TableEntity entity, boolean ifUnchanged) { @@ -840,7 +840,7 @@ Mono> deleteEntityWithResponse(String partitionKey, String rowKey context = TableUtils.setContext(context); eTag = ifUnchanged ? eTag : "*"; - if (isNullOrEmpty(partitionKey) || isNullOrEmpty(rowKey)) { + if (partitionKey == null || rowKey == null) { return monoError(logger, new IllegalArgumentException("'partitionKey' and 'rowKey' cannot be null.")); } @@ -1076,8 +1076,8 @@ public Mono getEntity(String partitionKey, String rowKey) { * @return A {@link Mono} containing the {@link Response HTTP response} that in turn contains the * {@link TableEntity entity}. * - * @throws IllegalArgumentException If the provided {@code partitionKey} or {@code rowKey} are {@code null} or - * empty, or if the {@code select} OData query option is malformed. + * @throws IllegalArgumentException If the provided {@code partitionKey} or {@code rowKey} are {@code null} + * or if the {@code select} OData query option is malformed. * @throws TableServiceException If no {@link TableEntity entity} with the provided {@code partitionKey} and * {@code rowKey} exists within the table. */ @@ -1096,7 +1096,7 @@ Mono> getEntityWithResponse(String partition queryOptions.setSelect(String.join(",", select)); } - if (isNullOrEmpty(partitionKey) || isNullOrEmpty(rowKey)) { + if (partitionKey == null || rowKey == null) { return monoError(logger, new IllegalArgumentException("'partitionKey' and 'rowKey' cannot be null.")); } diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java index dbd1bc779aa6..490c4ddd54d1 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableClient.java @@ -71,7 +71,6 @@ import java.util.function.BiConsumer; import java.util.stream.Collectors; -import static com.azure.core.util.CoreUtils.isNullOrEmpty; import static com.azure.data.tables.implementation.TableUtils.mapThrowableToTableServiceException; import static com.azure.data.tables.implementation.TableUtils.toTableServiceError; @@ -754,6 +753,7 @@ public Response updateEntityWithResponse(TableEntity entity, TableEntityUp * @throws IllegalArgumentException If the provided {@code partitionKey} or {@code rowKey} are {@code null} or * empty. * @throws TableServiceException If the request is rejected by the service. + * @throws IllegalArgumentException If 'partitionKey' or 'rowKey' is null. */ @ServiceMethod(returns = ReturnType.SINGLE) public void deleteEntity(String partitionKey, String rowKey) { @@ -822,6 +822,7 @@ public void deleteEntity(TableEntity entity) { * @return The {@link Response HTTP response}. * * @throws TableServiceException If the request is rejected by the service. + * @throws IllegalArgumentException If the entity has null 'partitionKey' or 'rowKey'. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteEntityWithResponse(TableEntity entity, boolean ifUnchanged, Duration timeout, @@ -837,7 +838,7 @@ private Response deleteEntityWithResponse(String partitionKey, String rowK String finalETag = ifUnchanged ? eTag : "*"; - if (isNullOrEmpty(partitionKey) || isNullOrEmpty(rowKey)) { + if (partitionKey == null || rowKey == null) { throw logger.logExceptionAsError(new IllegalArgumentException("'partitionKey' and 'rowKey' cannot be null")); } @@ -1079,8 +1080,8 @@ public TableEntity getEntity(String partitionKey, String rowKey) { * * @return The {@link Response HTTP response} containing the {@link TableEntity entity}. * - * @throws IllegalArgumentException If the provided {@code partitionKey} or {@code rowKey} are {@code null} or - * empty, or if the {@code select} OData query option is malformed. + * @throws IllegalArgumentException If the provided {@code partitionKey} or {@code rowKey} are {@code null} + * or if the {@code select} OData query option is malformed. * @throws TableServiceException If no {@link TableEntity entity} with the provided {@code partitionKey} and * {@code rowKey} exists within the table. */ @@ -1097,7 +1098,7 @@ public Response getEntityWithResponse(String partitionKey, String r queryOptions.setSelect(String.join(",", select)); } - if (isNullOrEmpty(partitionKey) || isNullOrEmpty(rowKey)) { + if (partitionKey == null || rowKey == null) { throw logger.logExceptionAsError( new IllegalArgumentException("'partitionKey' and 'rowKey' cannot be null.")); } diff --git a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java index 09709c992c00..bc202f6c8337 100644 --- a/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java +++ b/sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableServiceClient.java @@ -605,7 +605,11 @@ Response getPropertiesWithResponse(Context context) { * TableServiceProperties properties = new TableServiceProperties() * .setHourMetrics(new TableServiceMetrics() * .setVersion("1.0") - * .setEnabled(true)) + * .setEnabled(true) + * .setIncludeApis(true) + * .setRetentionPolicy(new TableServiceRetentionPolicy() + * .setEnabled(true) + * .setDaysToRetain(5))) * .setLogging(new TableServiceLogging() * .setAnalyticsVersion("1.0") * .setReadLogged(true) @@ -642,7 +646,11 @@ public void setProperties(TableServiceProperties tableServiceProperties) { * TableServiceProperties myProperties = new TableServiceProperties() * .setHourMetrics(new TableServiceMetrics() * .setVersion("1.0") - * .setEnabled(true)) + * .setEnabled(true) + * .setIncludeApis(true) + * .setRetentionPolicy(new TableServiceRetentionPolicy() + * .setEnabled(true) + * .setDaysToRetain(5))) * .setLogging(new TableServiceLogging() * .setAnalyticsVersion("1.0") * .setReadLogged(true) diff --git a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientJavaDocCodeSnippets.java b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientJavaDocCodeSnippets.java index a7e185926c92..a140b743bf39 100644 --- a/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientJavaDocCodeSnippets.java +++ b/sdk/tables/azure-data-tables/src/samples/java/com/azure/data/tables/codesnippets/TableServiceClientJavaDocCodeSnippets.java @@ -167,7 +167,11 @@ public void setProperties() { TableServiceProperties properties = new TableServiceProperties() .setHourMetrics(new TableServiceMetrics() .setVersion("1.0") - .setEnabled(true)) + .setEnabled(true) + .setIncludeApis(true) + .setRetentionPolicy(new TableServiceRetentionPolicy() + .setEnabled(true) + .setDaysToRetain(5))) .setLogging(new TableServiceLogging() .setAnalyticsVersion("1.0") .setReadLogged(true) @@ -184,7 +188,11 @@ public void setProperties() { TableServiceProperties myProperties = new TableServiceProperties() .setHourMetrics(new TableServiceMetrics() .setVersion("1.0") - .setEnabled(true)) + .setEnabled(true) + .setIncludeApis(true) + .setRetentionPolicy(new TableServiceRetentionPolicy() + .setEnabled(true) + .setDaysToRetain(5))) .setLogging(new TableServiceLogging() .setAnalyticsVersion("1.0") .setReadLogged(true) diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableAsyncClientTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableAsyncClientTest.java index fd4ff8bda07c..0c9583932908 100644 --- a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableAsyncClientTest.java +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableAsyncClientTest.java @@ -30,10 +30,8 @@ import com.azure.data.tables.sas.TableSasProtocol; import com.azure.data.tables.sas.TableSasSignatureValues; import com.azure.identity.ClientSecretCredentialBuilder; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assumptions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; @@ -56,7 +54,7 @@ * Tests {@link TableAsyncClient}. */ public class TableAsyncClientTest extends TableClientTestBase { - private static final Duration TIMEOUT = Duration.ofSeconds(100); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(100); private TableAsyncClient tableClient; @@ -67,22 +65,12 @@ protected HttpClient buildAssertingClient(HttpClient httpClient) { .build(); } - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(TIMEOUT); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - protected void beforeTest() { final String tableName = testResourceNamer.randomName("tableName", 20); final String connectionString = TestUtils.getConnectionString(interceptorManager.isPlaybackMode()); tableClient = getClientBuilder(tableName, connectionString).buildAsyncClient(); - tableClient.createTable().block(TIMEOUT); + tableClient.createTable().block(DEFAULT_TIMEOUT); } @Test @@ -96,7 +84,7 @@ public void createTable() { StepVerifier.create(tableClient2.createTable()) .assertNext(Assertions::assertNotNull) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -135,7 +123,7 @@ public void createTableWithMultipleTenants() { StepVerifier.create(tableClient2.createTable()) .assertNext(Assertions::assertNotNull) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); final String partitionKeyValue = testResourceNamer.randomName("partitionKey", 20); final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); @@ -144,7 +132,7 @@ public void createTableWithMultipleTenants() { // All other requests will also use the tenant ID obtained from the auth challenge. StepVerifier.create(tableClient2.createEntity(tableEntity)) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -161,7 +149,7 @@ public void createTableWithResponse() { assertEquals(expectedStatusCode, response.getStatusCode()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -188,7 +176,7 @@ private void createEntityImpl(String partitionKeyPrefix, String rowKeyPrefix) { // Act & Assert StepVerifier.create(tableClient.createEntity(tableEntity)) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -203,7 +191,7 @@ public void createEntityWithResponse() { StepVerifier.create(tableClient.createEntityWithResponse(entity)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -233,7 +221,7 @@ public void createEntityWithAllSupportedDataTypes() { tableEntity.addProperty("Int64TypeProperty", int64Value); tableEntity.addProperty("StringTypeProperty", stringValue); - tableClient.createEntity(tableEntity).block(TIMEOUT); + tableClient.createEntity(tableEntity).block(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(tableClient.getEntityWithResponse(partitionKeyValue, rowKeyValue, null)) @@ -251,7 +239,7 @@ public void createEntityWithAllSupportedDataTypes() { assertTrue(properties.get("StringTypeProperty") instanceof String); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } // Support for subclassing TableEntity was removed for the time being, although having it back is not 100% @@ -299,7 +287,7 @@ public void createEntitySubclass() { assertEquals(entity.getProperties().get("EnumField"), color.name()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); }*/ @Test @@ -307,7 +295,7 @@ public void deleteTable() { // Act & Assert StepVerifier.create(tableClient.deleteTable()) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -317,7 +305,7 @@ public void deleteNonExistingTable() { StepVerifier.create(tableClient.deleteTable()) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -331,7 +319,7 @@ public void deleteTableWithResponse() { assertEquals(expectedStatusCode, response.getStatusCode()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -345,7 +333,7 @@ public void deleteNonExistingTableWithResponse() { StepVerifier.create(tableClient.deleteTableWithResponse()) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -369,15 +357,15 @@ private void deleteEntityImpl(String partitionKeyPrefix, String rowKeyPrefix) { final String rowKeyValue = testResourceNamer.randomName(rowKeyPrefix, 20); final TableEntity tableEntity = new TableEntity(partitionKeyValue, rowKeyValue); - tableClient.createEntity(tableEntity).block(TIMEOUT); - final TableEntity createdEntity = tableClient.getEntity(partitionKeyValue, rowKeyValue).block(TIMEOUT); + tableClient.createEntity(tableEntity).block(DEFAULT_TIMEOUT); + final TableEntity createdEntity = tableClient.getEntity(partitionKeyValue, rowKeyValue).block(DEFAULT_TIMEOUT); assertNotNull(createdEntity, "'createdEntity' should not be null."); assertNotNull(createdEntity.getETag(), "'eTag' should not be null."); // Act & Assert StepVerifier.create(tableClient.deleteEntity(partitionKeyValue, rowKeyValue)) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -389,7 +377,7 @@ public void deleteNonExistingEntity() { // Act & Assert StepVerifier.create(tableClient.deleteEntity(partitionKeyValue, rowKeyValue)) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -400,8 +388,8 @@ public void deleteEntityWithResponse() { final TableEntity tableEntity = new TableEntity(partitionKeyValue, rowKeyValue); final int expectedStatusCode = 204; - tableClient.createEntity(tableEntity).block(TIMEOUT); - final TableEntity createdEntity = tableClient.getEntity(partitionKeyValue, rowKeyValue).block(TIMEOUT); + tableClient.createEntity(tableEntity).block(DEFAULT_TIMEOUT); + final TableEntity createdEntity = tableClient.getEntity(partitionKeyValue, rowKeyValue).block(DEFAULT_TIMEOUT); assertNotNull(createdEntity, "'createdEntity' should not be null."); assertNotNull(createdEntity.getETag(), "'eTag' should not be null."); @@ -409,7 +397,7 @@ public void deleteEntityWithResponse() { StepVerifier.create(tableClient.deleteEntityWithResponse(createdEntity, false)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -424,7 +412,7 @@ public void deleteNonExistingEntityWithResponse() { StepVerifier.create(tableClient.deleteEntityWithResponse(entity, false)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -435,8 +423,8 @@ public void deleteEntityWithResponseMatchETag() { final TableEntity tableEntity = new TableEntity(partitionKeyValue, rowKeyValue); final int expectedStatusCode = 204; - tableClient.createEntity(tableEntity).block(TIMEOUT); - final TableEntity createdEntity = tableClient.getEntity(partitionKeyValue, rowKeyValue).block(TIMEOUT); + tableClient.createEntity(tableEntity).block(DEFAULT_TIMEOUT); + final TableEntity createdEntity = tableClient.getEntity(partitionKeyValue, rowKeyValue).block(DEFAULT_TIMEOUT); assertNotNull(createdEntity, "'createdEntity' should not be null."); assertNotNull(createdEntity.getETag(), "'eTag' should not be null."); @@ -444,7 +432,7 @@ public void deleteEntityWithResponseMatchETag() { StepVerifier.create(tableClient.deleteEntityWithResponse(createdEntity, true)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -469,7 +457,7 @@ static void getEntityWithResponseAsyncImpl(TableAsyncClient tableClient, TestRes final String rowKeyValue = testResourceNamer.randomName(rowKeyPrefix, 20); final TableEntity tableEntity = new TableEntity(partitionKeyValue, rowKeyValue); final int expectedStatusCode = 200; - tableClient.createEntity(tableEntity).block(TIMEOUT); + tableClient.createEntity(tableEntity).block(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(tableClient.getEntityWithResponse(partitionKeyValue, rowKeyValue, null)) @@ -486,7 +474,7 @@ static void getEntityWithResponseAsyncImpl(TableAsyncClient tableClient, TestRes assertNotNull(entity.getProperties()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -497,7 +485,7 @@ public void getEntityWithResponseWithSelect() { final TableEntity tableEntity = new TableEntity(partitionKeyValue, rowKeyValue); tableEntity.addProperty("Test", "Value"); final int expectedStatusCode = 200; - tableClient.createEntity(tableEntity).block(TIMEOUT); + tableClient.createEntity(tableEntity).block(DEFAULT_TIMEOUT); List propertyList = new ArrayList<>(); propertyList.add("Test"); @@ -515,7 +503,7 @@ public void getEntityWithResponseWithSelect() { assertEquals(entity.getProperties().get("Test"), "Value"); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -586,7 +574,7 @@ public void getEntityWithResponseSubclass() { assertEquals(color, entity.getEnumField()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); }*/ @Test @@ -614,8 +602,8 @@ void updateEntityWithResponseAsync(TableEntityUpdateMode mode, String partitionK final TableEntity tableEntity = new TableEntity(partitionKeyValue, rowKeyValue) .addProperty(oldPropertyKey, "valueA"); - tableClient.createEntity(tableEntity).block(TIMEOUT); - final TableEntity createdEntity = tableClient.getEntity(partitionKeyValue, rowKeyValue).block(TIMEOUT); + tableClient.createEntity(tableEntity).block(DEFAULT_TIMEOUT); + final TableEntity createdEntity = tableClient.getEntity(partitionKeyValue, rowKeyValue).block(DEFAULT_TIMEOUT); assertNotNull(createdEntity, "'createdEntity' should not be null."); assertNotNull(createdEntity.getETag(), "'eTag' should not be null."); @@ -626,7 +614,7 @@ void updateEntityWithResponseAsync(TableEntityUpdateMode mode, String partitionK StepVerifier.create(tableClient.updateEntityWithResponse(createdEntity, mode, true)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); // Assert and verify that the new properties are in there. StepVerifier.create(tableClient.getEntity(partitionKeyValue, rowKeyValue)) @@ -635,7 +623,8 @@ void updateEntityWithResponseAsync(TableEntityUpdateMode mode, String partitionK assertTrue(properties.containsKey(newPropertyKey)); assertEquals(expectOldProperty, properties.containsKey(oldPropertyKey)); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); } // Support for subclassing TableEntity was removed for the time being, although having it back is not 100% @@ -656,7 +645,7 @@ public void updateEntityWithResponseSubclass() { StepVerifier.create(tableClient.updateEntityWithResponse(tableEntity, TableEntityUpdateMode.REPLACE, true)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); StepVerifier.create(tableClient.getEntity(partitionKeyValue, rowKeyValue)) .assertNext(entity -> { @@ -664,7 +653,8 @@ public void updateEntityWithResponseSubclass() { assertTrue(properties.containsKey("SubclassProperty")); assertEquals("UpdatedValue", properties.get("SubclassProperty")); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }*/ @Test @@ -687,15 +677,15 @@ private void listEntitiesImpl(String partitionKeyPrefix, String rowKeyPrefix) { final String partitionKeyValue = testResourceNamer.randomName(partitionKeyPrefix, 20); final String rowKeyValue = testResourceNamer.randomName(rowKeyPrefix, 20); final String rowKeyValue2 = testResourceNamer.randomName(rowKeyPrefix, 20); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)).block(TIMEOUT); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue2)).block(TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)).block(DEFAULT_TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue2)).block(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(tableClient.listEntities()) .expectNextCount(2) .thenConsumeWhile(x -> true) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -705,8 +695,8 @@ public void listEntitiesWithFilter() { final String rowKeyValue = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue2 = testResourceNamer.randomName("rowKey", 20); ListEntitiesOptions options = new ListEntitiesOptions().setFilter("RowKey eq '" + rowKeyValue + "'"); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)).block(TIMEOUT); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue2)).block(TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)).block(DEFAULT_TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue2)).block(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(tableClient.listEntities(options)) @@ -717,7 +707,7 @@ public void listEntitiesWithFilter() { .expectNextCount(0) .thenConsumeWhile(x -> true) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -732,7 +722,7 @@ public void listEntitiesWithSelect() { propertyList.add("propertyC"); ListEntitiesOptions options = new ListEntitiesOptions() .setSelect(propertyList); - tableClient.createEntity(entity).block(TIMEOUT); + tableClient.createEntity(entity).block(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(tableClient.listEntities(options)) @@ -743,7 +733,7 @@ public void listEntitiesWithSelect() { assertNull(returnEntity.getProperties().get("propertyD")); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -754,16 +744,16 @@ public void listEntitiesWithTop() { final String rowKeyValue2 = testResourceNamer.randomName("rowKey", 20); final String rowKeyValue3 = testResourceNamer.randomName("rowKey", 20); ListEntitiesOptions options = new ListEntitiesOptions().setTop(2); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)).block(TIMEOUT); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue2)).block(TIMEOUT); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue3)).block(TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue)).block(DEFAULT_TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue2)).block(DEFAULT_TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValue3)).block(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(tableClient.listEntities(options)) .expectNextCount(2) .thenConsumeWhile(x -> true) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } // Support for subclassing TableEntity was removed for the time being, although having it back is not 100% @@ -782,7 +772,7 @@ public void listEntitiesSubclass() { .expectNextCount(2) .thenConsumeWhile(x -> true) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); }*/ @Test @@ -801,7 +791,7 @@ public void submitTransaction() { // Act & Assert final Response result = - tableClient.submitTransactionWithResponse(transactionalBatch).block(TIMEOUT); + tableClient.submitTransactionWithResponse(transactionalBatch).block(DEFAULT_TIMEOUT); assertNotNull(result); assertEquals(expectedBatchStatusCode, result.getStatusCode()); @@ -823,7 +813,7 @@ public void submitTransaction() { assertNotNull(entity.getProperties()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -854,11 +844,11 @@ private void submitTransactionAllActionsImpl(String partitionKeyPrefix, String r int expectedBatchStatusCode = 202; int expectedOperationStatusCode = 204; - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueUpsertMerge)).block(TIMEOUT); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueUpsertReplace)).block(TIMEOUT); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueUpdateMerge)).block(TIMEOUT); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueUpdateReplace)).block(TIMEOUT); - tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueDelete)).block(TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueUpsertMerge)).block(DEFAULT_TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueUpsertReplace)).block(DEFAULT_TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueUpdateMerge)).block(DEFAULT_TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueUpdateReplace)).block(DEFAULT_TIMEOUT); + tableClient.createEntity(new TableEntity(partitionKeyValue, rowKeyValueDelete)).block(DEFAULT_TIMEOUT); TableEntity toUpsertMerge = new TableEntity(partitionKeyValue, rowKeyValueUpsertMerge); toUpsertMerge.addProperty("Test", "MergedValue"); @@ -896,7 +886,7 @@ private void submitTransactionAllActionsImpl(String partitionKeyPrefix, String r } }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -919,7 +909,7 @@ public void submitTransactionWithFailingAction() { && e.getMessage().contains("DeleteEntity") && e.getMessage().contains("partitionKey='" + partitionKeyValue) && e.getMessage().contains("rowKey='" + rowKeyValue2)) - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -941,7 +931,7 @@ public void submitTransactionWithSameRowKeys() { && e.getMessage().contains("InvalidDuplicateRow") && e.getMessage().contains("The batch request contains multiple changes with same row key.") && e.getMessage().contains("An entity can appear only once in a batch request.")) - .verify(); + .verify(DEFAULT_TIMEOUT); } else { StepVerifier.create(tableClient.submitTransactionWithResponse(transactionalBatch)) .expectErrorMatches(e -> e instanceof TableTransactionFailedException @@ -950,7 +940,7 @@ public void submitTransactionWithSameRowKeys() { && e.getMessage().contains("CreateEntity") && e.getMessage().contains("partitionKey='" + partitionKeyValue) && e.getMessage().contains("rowKey='" + rowKeyValue)) - .verify(); + .verify(DEFAULT_TIMEOUT); } } @@ -979,7 +969,7 @@ public void submitTransactionWithDifferentPartitionKeys() { && e.getMessage().contains("CreateEntity") && e.getMessage().contains("partitionKey='" + partitionKeyValue) && e.getMessage().contains("rowKey='" + rowKeyValue)) - .verify(); + .verify(DEFAULT_TIMEOUT); } else { StepVerifier.create(tableClient.submitTransactionWithResponse(transactionalBatch)) .expectErrorMatches(e -> e instanceof TableTransactionFailedException @@ -988,7 +978,7 @@ public void submitTransactionWithDifferentPartitionKeys() { && e.getMessage().contains("CreateEntity") && e.getMessage().contains("partitionKey='" + partitionKeyValue2) && e.getMessage().contains("rowKey='" + rowKeyValue2)) - .verify(); + .verify(DEFAULT_TIMEOUT); } } @@ -1109,7 +1099,7 @@ public void canUseSasTokenToCreateValidTableClient() { StepVerifier.create(tableAsyncClient.createEntityWithResponse(entity)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -1130,7 +1120,7 @@ public void setAndListAccessPolicies() { StepVerifier.create(tableClient.setAccessPoliciesWithResponse(Collections.singletonList(tableSignedIdentifier))) .assertNext(response -> assertEquals(204, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); StepVerifier.create(tableClient.getAccessPolicies()) .assertNext(tableAccessPolicies -> { @@ -1150,7 +1140,7 @@ public void setAndListAccessPolicies() { assertEquals(id, signedIdentifier.getId()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -1174,7 +1164,7 @@ public void setAndListMultipleAccessPolicies() { StepVerifier.create(tableClient.setAccessPoliciesWithResponse(tableSignedIdentifiers)) .assertNext(response -> assertEquals(204, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); StepVerifier.create(tableClient.getAccessPolicies()) .assertNext(tableAccessPolicies -> { @@ -1197,7 +1187,7 @@ public void setAndListMultipleAccessPolicies() { } }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -1210,7 +1200,7 @@ public void allowsCreationOfEntityWithEmptyStringPrimaryKey() { StepVerifier.create(tableClient.createEntityWithResponse(entity)) .assertNext(response -> assertEquals(204, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -1227,6 +1217,22 @@ public void allowListEntitiesWithEmptyPrimaryKey() { .assertNext(en -> assertEquals(entityName, en.getProperties().get("Name"))) .expectNextCount(0) .expectComplete() + .verify(DEFAULT_TIMEOUT); + } + + // tests that you can delete a table entity with an empty string partition key and empty string row key + @Test + public void allowDeleteEntityWithEmptyPrimaryKey() { + Assumptions.assumeFalse(IS_COSMOS_TEST, + "Empty row or partition keys are not supported on Cosmos endpoints."); + TableEntity entity = new TableEntity("", ""); + String entityName = testResourceNamer.randomName("name", 10); + entity.addProperty("Name", entityName); + tableClient.createEntity(entity).block(); + StepVerifier.create(tableClient.deleteEntityWithResponse("", "", "*", false, null)) + .assertNext(response -> assertEquals(204, response.getStatusCode())) + .expectComplete() .verify(); } + } diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableClientTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableClientTest.java index d5d94b5754dc..27e79bd8f426 100644 --- a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableClientTest.java +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableClientTest.java @@ -73,7 +73,7 @@ protected void beforeTest() { final String tableName = testResourceNamer.randomName("tableName", 20); final String connectionString = TestUtils.getConnectionString(interceptorManager.isPlaybackMode()); tableClient = getClientBuilder(tableName, connectionString).buildClient(); - tableClient.createTable(); + tableClient.createTable(); } protected void afterTest() { @@ -99,7 +99,7 @@ public void createTable() { public void createTableWithMultipleTenants() { // This feature works only in Storage endpoints with service version 2020_12_06. Assumptions.assumeTrue(tableClient.getTableEndpoint().contains("core.windows.net") - && tableClient.getServiceVersion() == TableServiceVersion.V2020_12_06); + && tableClient.getServiceVersion() == TableServiceVersion.V2020_12_06); // Arrange final String tableName2 = testResourceNamer.randomName("tableName", 20); @@ -1182,4 +1182,18 @@ public void allowListEntitiesWithEmptyPrimaryKey() { assertEquals(1, responseArray.size()); assertEquals(entityName, responseArray.get(0).getProperty("Name")); } + + // tests that you can delete a table entity with an empty string partition key and empty string row key + @Test + public void allowDeleteEntityWithEmptyPrimaryKey() { + Assumptions.assumeFalse(IS_COSMOS_TEST, + "Empty row or partition keys are not supported on Cosmos endpoints."); + TableEntity entity = new TableEntity("", ""); + String entityName = testResourceNamer.randomName("name", 10); + entity.addProperty("Name", entityName); + tableClient.createEntity(entity); + tableClient.deleteEntity(entity); + } + + } diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceAsyncClientTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceAsyncClientTest.java index efd8c819c089..a158b69e5a92 100644 --- a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceAsyncClientTest.java +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/TableServiceAsyncClientTest.java @@ -27,10 +27,8 @@ import com.azure.data.tables.sas.TableSasIpRange; import com.azure.data.tables.sas.TableSasProtocol; import com.azure.identity.ClientSecretCredentialBuilder; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assumptions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; @@ -53,7 +51,7 @@ * Tests methods for {@link TableServiceAsyncClient}. */ public class TableServiceAsyncClientTest extends TableServiceClientTestBase { - private static final Duration TIMEOUT = Duration.ofSeconds(100); + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(100); private static final HttpClient DEFAULT_HTTP_CLIENT = HttpClient.createDefault(); private static final boolean IS_COSMOS_TEST = TestUtils.isCosmosTest(); @@ -66,16 +64,6 @@ protected HttpClient buildAssertingClient(HttpClient httpClient) { .build(); } - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(TIMEOUT); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @Override protected void beforeTest() { final String connectionString = TestUtils.getConnectionString(interceptorManager.isPlaybackMode()); @@ -91,7 +79,7 @@ public void serviceCreateTable() { StepVerifier.create(serviceClient.createTable(tableName)) .assertNext(Assertions::assertNotNull) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } /** @@ -129,7 +117,7 @@ public void serviceCreateTableWithMultipleTenants() { StepVerifier.create(tableServiceAsyncClient.createTable(tableName)) .assertNext(Assertions::assertNotNull) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); tableName = testResourceNamer.randomName("tableName", 20); @@ -137,7 +125,7 @@ public void serviceCreateTableWithMultipleTenants() { StepVerifier.create(tableServiceAsyncClient.createTable(tableName)) .assertNext(Assertions::assertNotNull) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -153,20 +141,20 @@ public void serviceCreateTableWithResponse() { assertNotNull(response.getValue()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test public void serviceCreateTableFailsIfExists() { // Arrange String tableName = testResourceNamer.randomName("test", 20); - serviceClient.createTable(tableName).block(TIMEOUT); + serviceClient.createTable(tableName).block(DEFAULT_TIMEOUT); //Act & Assert StepVerifier.create(serviceClient.createTable(tableName)) .expectErrorMatches(e -> e instanceof TableServiceException && ((TableServiceException) e).getResponse().getStatusCode() == 409) - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -178,19 +166,19 @@ public void serviceCreateTableIfNotExists() { StepVerifier.create(serviceClient.createTableIfNotExists(tableName)) .assertNext(Assertions::assertNotNull) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test public void serviceCreateTableIfNotExistsSucceedsIfExists() { // Arrange String tableName = testResourceNamer.randomName("test", 20); - serviceClient.createTable(tableName).block(TIMEOUT); + serviceClient.createTable(tableName).block(DEFAULT_TIMEOUT); //Act & Assert StepVerifier.create(serviceClient.createTableIfNotExists(tableName)) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -206,7 +194,7 @@ public void serviceCreateTableIfNotExistsWithResponse() { assertNotNull(response.getValue()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -214,7 +202,7 @@ public void serviceCreateTableIfNotExistsWithResponseSucceedsIfExists() { // Arrange String tableName = testResourceNamer.randomName("test", 20); int expectedStatusCode = 409; - serviceClient.createTable(tableName).block(TIMEOUT); + serviceClient.createTable(tableName).block(DEFAULT_TIMEOUT); //Act & Assert StepVerifier.create(serviceClient.createTableIfNotExistsWithResponse(tableName)) @@ -223,19 +211,19 @@ public void serviceCreateTableIfNotExistsWithResponseSucceedsIfExists() { assertNull(response.getValue()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test public void serviceDeleteTable() { // Arrange final String tableName = testResourceNamer.randomName("test", 20); - serviceClient.createTable(tableName).block(TIMEOUT); + serviceClient.createTable(tableName).block(DEFAULT_TIMEOUT); //Act & Assert StepVerifier.create(serviceClient.deleteTable(tableName)) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -246,7 +234,7 @@ public void serviceDeleteNonExistingTable() { //Act & Assert StepVerifier.create(serviceClient.deleteTable(tableName)) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -260,7 +248,7 @@ public void serviceDeleteTableWithResponse() { StepVerifier.create(serviceClient.deleteTableWithResponse(tableName)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -273,7 +261,7 @@ public void serviceDeleteNonExistingTableWithResponse() { StepVerifier.create(serviceClient.deleteTableWithResponse(tableName)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -281,15 +269,15 @@ public void serviceListTables() { // Arrange final String tableName = testResourceNamer.randomName("test", 20); final String tableName2 = testResourceNamer.randomName("test", 20); - serviceClient.createTable(tableName).block(TIMEOUT); - serviceClient.createTable(tableName2).block(TIMEOUT); + serviceClient.createTable(tableName).block(DEFAULT_TIMEOUT); + serviceClient.createTable(tableName2).block(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(serviceClient.listTables()) .expectNextCount(2) .thenConsumeWhile(x -> true) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -298,8 +286,8 @@ public void serviceListTablesWithFilter() { final String tableName = testResourceNamer.randomName("test", 20); final String tableName2 = testResourceNamer.randomName("test", 20); ListTablesOptions options = new ListTablesOptions().setFilter("TableName eq '" + tableName + "'"); - serviceClient.createTable(tableName).block(TIMEOUT); - serviceClient.createTable(tableName2).block(TIMEOUT); + serviceClient.createTable(tableName).block(DEFAULT_TIMEOUT); + serviceClient.createTable(tableName2).block(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(serviceClient.listTables(options)) @@ -307,7 +295,7 @@ public void serviceListTablesWithFilter() { .expectNextCount(0) .thenConsumeWhile(x -> true) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -317,23 +305,23 @@ public void serviceListTablesWithTop() { final String tableName2 = testResourceNamer.randomName("test", 20); final String tableName3 = testResourceNamer.randomName("test", 20); ListTablesOptions options = new ListTablesOptions().setTop(2); - serviceClient.createTable(tableName).block(TIMEOUT); - serviceClient.createTable(tableName2).block(TIMEOUT); - serviceClient.createTable(tableName3).block(TIMEOUT); + serviceClient.createTable(tableName).block(DEFAULT_TIMEOUT); + serviceClient.createTable(tableName2).block(DEFAULT_TIMEOUT); + serviceClient.createTable(tableName3).block(DEFAULT_TIMEOUT); // Act & Assert StepVerifier.create(serviceClient.listTables(options)) .expectNextCount(2) .thenConsumeWhile(x -> true) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test public void serviceGetTableClient() { // Arrange final String tableName = testResourceNamer.randomName("test", 20); - serviceClient.createTable(tableName).block(TIMEOUT); + serviceClient.createTable(tableName).block(DEFAULT_TIMEOUT); TableAsyncClient tableClient = serviceClient.getTableClient(tableName); @@ -422,7 +410,7 @@ public void canUseSasTokenToCreateValidTableClient() { final String sas = serviceClient.generateAccountSas(sasSignatureValues); final String tableName = testResourceNamer.randomName("test", 20); - serviceClient.createTable(tableName).block(TIMEOUT); + serviceClient.createTable(tableName).block(DEFAULT_TIMEOUT); final TableClientBuilder tableClientBuilder = new TableClientBuilder() .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) @@ -454,7 +442,7 @@ public void canUseSasTokenToCreateValidTableClient() { StepVerifier.create(tableAsyncClient.createEntityWithResponse(entity)) .assertNext(response -> assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -503,7 +491,7 @@ public void setGetProperties() { assertNotNull(response.getHeaders().getValue("x-ms-version")); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); // Service properties may take up to 30s to take effect. If they weren't already in place, wait. sleepIfRunningAgainstService(30000); @@ -511,7 +499,7 @@ public void setGetProperties() { StepVerifier.create(serviceClient.getProperties()) .assertNext(retrievedProperties -> assertPropertiesEquals(sentProperties, retrievedProperties)) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -543,6 +531,6 @@ public void getStatistics() throws URISyntaxException { assertNotNull(statistics.getGeoReplication().getLastSyncTime()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/implementation/AzureTableImplTest.java b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/implementation/AzureTableImplTest.java index a5f46280ca56..6308998e786c 100644 --- a/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/implementation/AzureTableImplTest.java +++ b/sdk/tables/azure-data-tables/src/test/java/com/azure/data/tables/implementation/AzureTableImplTest.java @@ -30,9 +30,7 @@ import com.azure.data.tables.implementation.models.TableQueryResponse; import com.azure.data.tables.implementation.models.TableResponseProperties; import com.azure.data.tables.implementation.models.TableServiceErrorException; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; @@ -52,6 +50,7 @@ */ public class AzureTableImplTest extends TestProxyTestBase { private static final int TIMEOUT_IN_MS = 100_000; + private static final Duration DEFAULT_TIMEOUT = Duration.ofMillis(TIMEOUT_IN_MS); private final QueryOptions defaultQueryOptions = new QueryOptions() .setFormat(OdataMetadataFormat.APPLICATION_JSON_ODATA_FULLMETADATA); @@ -59,16 +58,6 @@ public class AzureTableImplTest extends TestProxyTestBase { private final ClientLogger logger = new ClientLogger(AzureTableImplTest.class); private AzureTableImpl azureTable; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofMillis(TIMEOUT_IN_MS)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - @Override protected void beforeTest() { TestUtils.addTestProxyTestSanitizersAndMatchers(interceptorManager); @@ -159,7 +148,7 @@ void createTableImpl() { Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -181,7 +170,7 @@ void createTableDuplicateNameImpl() { assertTrue(exception.getMessage().contains(expectedErrorCode)); }) - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -198,7 +187,7 @@ void deleteTableImpl() { Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -210,7 +199,7 @@ void deleteNonExistentTableImpl() { // Act & Assert StepVerifier.create(azureTable.getTables().deleteWithResponseAsync(tableName, requestId, Context.NONE)) .expectError(com.azure.data.tables.implementation.models.TableServiceErrorException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -236,7 +225,7 @@ void queryTableImpl() { assertTrue(results.stream().anyMatch(p -> tableB.equals(p.getTableName()))); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -263,7 +252,7 @@ void queryTableWithFilterImpl() { Assertions.assertEquals(tableA, response.getValue().getValue().get(0).getTableName()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -293,7 +282,7 @@ void queryTableWithTopImpl() { Assertions.assertTrue(tableA.equals(tableName) || tableB.equals(tableName)); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -316,7 +305,7 @@ void insertNoETagImpl() { Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -340,15 +329,13 @@ void mergeEntityImpl() { StepVerifier.create(azureTable.getTables().mergeEntityWithResponseAsync(tableName, partitionKeyValue, rowKeyValue, TIMEOUT_IN_MS, requestId, "*", properties, null, Context.NONE)) .expectError(com.azure.data.tables.implementation.models.TableServiceErrorException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } else { StepVerifier.create(azureTable.getTables().mergeEntityWithResponseAsync(tableName, partitionKeyValue, rowKeyValue, TIMEOUT_IN_MS, requestId, "*", properties, null, Context.NONE)) - .assertNext(response -> { - Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); - }) + .assertNext(response -> Assertions.assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } } @@ -366,7 +353,7 @@ void mergeNonExistentEntityImpl() { StepVerifier.create(azureTable.getTables().mergeEntityWithResponseAsync(tableName, partitionKeyValue, rowKeyValue, TIMEOUT_IN_MS, requestId, "*", properties, null, Context.NONE)) .expectError(com.azure.data.tables.implementation.models.TableServiceErrorException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -387,11 +374,9 @@ void updateEntityImpl() { // Act & Assert StepVerifier.create(azureTable.getTables().updateEntityWithResponseAsync(tableName, partitionKeyValue, rowKeyValue, TIMEOUT_IN_MS, requestId, "*", properties, null, Context.NONE)) - .assertNext(response -> { - Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); - }) + .assertNext(response -> Assertions.assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -408,7 +393,7 @@ void updateNonExistentEntityImpl() { StepVerifier.create(azureTable.getTables().updateEntityWithResponseAsync(tableName, partitionKeyValue, rowKeyValue, TIMEOUT_IN_MS, requestId, "*", properties, null, Context.NONE)) .expectError(com.azure.data.tables.implementation.models.TableServiceErrorException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -428,11 +413,9 @@ void deleteEntityImpl() { // Act & Assert StepVerifier.create(azureTable.getTables().deleteEntityWithResponseAsync(tableName, partitionKeyValue, rowKeyValue, "*", TIMEOUT_IN_MS, requestId, null, Context.NONE)) - .assertNext(response -> { - Assertions.assertEquals(expectedStatusCode, response.getStatusCode()); - }) + .assertNext(response -> Assertions.assertEquals(expectedStatusCode, response.getStatusCode())) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -448,7 +431,7 @@ void deleteNonExistentEntityImpl() { StepVerifier.create(azureTable.getTables().deleteEntityWithResponseAsync(tableName, partitionKeyValue, rowKeyValue, "*", TIMEOUT_IN_MS, requestId, null, Context.NONE)) .expectError(com.azure.data.tables.implementation.models.TableServiceErrorException.class) - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -483,7 +466,7 @@ void queryEntityImpl() { assertTrue(results.stream().anyMatch(p -> p.containsValue(partitionKeyEntityB))); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -526,7 +509,7 @@ void queryEntityImplWithSelect() { assertTrue(results.stream().anyMatch(p -> p.containsValue(rowKeyEntityB))); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -566,7 +549,7 @@ void queryEntityImplWithFilter() { assertTrue(response.getValue().getValue().get(0).containsValue(partitionKeyEntityA)); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } @Test @@ -610,6 +593,6 @@ void queryEntityImplWithTop() { || properties.containsValue(partitionKeyEntityB)); }) .expectComplete() - .verify(); + .verify(DEFAULT_TIMEOUT); } } diff --git a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md index cfc19c8ed6af..55bb192b4497 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md +++ b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 5.3.3 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. + ## 5.3.2 (2023-08-18) ### Other Changes diff --git a/sdk/textanalytics/azure-ai-textanalytics/README.md b/sdk/textanalytics/azure-ai-textanalytics/README.md index 65baed8cd180..652cd5904747 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/README.md +++ b/sdk/textanalytics/azure-ai-textanalytics/README.md @@ -141,7 +141,7 @@ Authentication with AAD requires some initial setup: com.azure azure-identity - 1.10.0 + 1.10.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java index c3bbd978f92b..8a10536b994e 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java @@ -43,9 +43,7 @@ import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.SyncPoller; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; @@ -114,18 +112,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class TextAnalyticsAsyncClientTest extends TextAnalyticsClientTestBase { + private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30); private TextAnalyticsAsyncClient client; - @BeforeAll - static void beforeAll() { - StepVerifier.setDefaultTimeout(Duration.ofSeconds(30)); - } - - @AfterAll - static void afterAll() { - StepVerifier.resetDefaultTimeout(); - } - private HttpClient buildAsyncAssertingClient(HttpClient httpClient) { return new AssertingHttpClientBuilder(httpClient) .assertAsync() @@ -155,7 +144,8 @@ public void detectLanguagesBatchInputShowStatistics(HttpClient httpClient, TextA .assertNext(response -> validateDetectLanguageResultCollectionWithResponse(true, getExpectedBatchDetectedLanguages(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -170,7 +160,8 @@ public void detectLanguagesBatchInput(HttpClient httpClient, TextAnalyticsServic .assertNext(response -> validateDetectLanguageResultCollectionWithResponse(false, getExpectedBatchDetectedLanguages(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -184,7 +175,8 @@ public void detectLanguagesBatchListCountryHint(HttpClient httpClient, TextAnaly StepVerifier.create(client.detectLanguageBatch(inputs, countryHint, null)) .assertNext(actualResults -> validateDetectLanguageResultCollection(false, getExpectedBatchDetectedLanguages(), actualResults)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -197,7 +189,8 @@ public void detectLanguagesBatchListCountryHintWithOptions(HttpClient httpClient detectLanguagesBatchListCountryHintWithOptionsRunner((inputs, options) -> StepVerifier.create(client.detectLanguageBatch(inputs, null, options)) .assertNext(response -> validateDetectLanguageResultCollection(true, getExpectedBatchDetectedLanguages(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -210,7 +203,8 @@ public void detectLanguagesBatchStringInput(HttpClient httpClient, TextAnalytics detectLanguageStringInputRunner((inputs) -> StepVerifier.create(client.detectLanguageBatch(inputs, null, null)) .assertNext(response -> validateDetectLanguageResultCollection(false, getExpectedBatchDetectedLanguages(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -223,7 +217,8 @@ public void detectSingleTextLanguage(HttpClient httpClient, TextAnalyticsService detectSingleTextLanguageRunner(input -> StepVerifier.create(client.detectLanguage(input)) .assertNext(response -> validatePrimaryLanguage(getDetectedLanguageEnglish(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -237,7 +232,7 @@ public void detectLanguageInvalidCountryHint(HttpClient httpClient, TextAnalytic StepVerifier.create(client.detectLanguage(input, countryHint)) .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException && INVALID_COUNTRY_HINT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); + .verify(DEFAULT_TIMEOUT)); } /** @@ -251,7 +246,7 @@ public void detectLanguageEmptyText(HttpClient httpClient, TextAnalyticsServiceV StepVerifier.create(client.detectLanguage(input)) .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); + .verify(DEFAULT_TIMEOUT)); } /** @@ -263,7 +258,8 @@ public void detectLanguageDuplicateIdInput(HttpClient httpClient, TextAnalyticsS client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); detectLanguageDuplicateIdRunner((inputs, options) -> StepVerifier.create(client.detectLanguageBatchWithResponse(inputs, options)) - .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); + .expectErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())) + .verify(DEFAULT_TIMEOUT)); } /** @@ -275,12 +271,13 @@ public void detectLanguageEmptyIdInput(HttpClient httpClient, TextAnalyticsServi client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); detectLanguageInputEmptyIdRunner(inputs -> StepVerifier.create(client.detectLanguageBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } /** @@ -293,7 +290,8 @@ public void detectLanguageEmptyCountryHint(HttpClient httpClient, TextAnalyticsS detectLanguageEmptyCountryHintRunner((input, countryHint) -> StepVerifier.create(client.detectLanguage(input, countryHint)) .assertNext(response -> validatePrimaryLanguage(getDetectedLanguageSpanish(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -306,7 +304,8 @@ public void detectLanguageNoneCountryHint(HttpClient httpClient, TextAnalyticsSe detectLanguageNoneCountryHintRunner((input, countryHint) -> StepVerifier.create(client.detectLanguage(input, countryHint)) .assertNext(response -> validatePrimaryLanguage(getDetectedLanguageSpanish(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } // Entities @@ -317,7 +316,8 @@ public void recognizeEntitiesForTextInput(HttpClient httpClient, TextAnalyticsSe recognizeCategorizedEntitiesForSingleTextInputRunner(input -> StepVerifier.create(client.recognizeEntities(input)) .assertNext(response -> validateCategorizedEntities(response.stream().collect(Collectors.toList()))) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -328,7 +328,7 @@ public void recognizeEntitiesForEmptyText(HttpClient httpClient, TextAnalyticsSe StepVerifier.create(client.recognizeEntities(input)) .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify() + .verify(DEFAULT_TIMEOUT) ); } @@ -338,7 +338,8 @@ public void recognizeEntitiesDuplicateIdInput(HttpClient httpClient, TextAnalyti client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); duplicateIdRunner(inputs -> StepVerifier.create(client.recognizeEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); + .expectErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -347,12 +348,13 @@ public void recognizeEntitiesEmptyIdInput(HttpClient httpClient, TextAnalyticsSe client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); emptyDocumentIdRunner(inputs -> StepVerifier.create(client.recognizeEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -364,7 +366,9 @@ public void recognizeEntitiesBatchInputSingleError(HttpClient httpClient, TextAn .assertNext(resultCollection -> resultCollection.getValue().forEach(recognizeEntitiesResult -> { Exception exception = assertThrows(TextAnalyticsException.class, recognizeEntitiesResult::getEntities); assertEquals(String.format(BATCH_ERROR_EXCEPTION_MESSAGE, "RecognizeEntitiesResult"), exception.getMessage()); - })).verifyComplete()); + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -384,7 +388,8 @@ public void recognizeEntitiesForBatchInputShowStatistics(HttpClient httpClient, recognizeBatchCategorizedEntitiesShowStatsRunner((inputs, options) -> StepVerifier.create(client.recognizeEntitiesBatchWithResponse(inputs, options)) .assertNext(response -> validateCategorizedEntitiesResultCollectionWithResponse(true, getExpectedBatchCategorizedEntities(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -394,7 +399,8 @@ public void recognizeEntitiesForBatchStringInput(HttpClient httpClient, TextAnal recognizeCategorizedEntityStringInputRunner((inputs) -> StepVerifier.create(client.recognizeEntitiesBatch(inputs, null, null)) .assertNext(response -> validateCategorizedEntitiesResultCollection(false, getExpectedBatchCategorizedEntities(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -404,7 +410,8 @@ public void recognizeEntitiesForListLanguageHint(HttpClient httpClient, TextAnal recognizeCategorizedEntitiesLanguageHintRunner((inputs, language) -> StepVerifier.create(client.recognizeEntitiesBatch(inputs, language, null)) .assertNext(response -> validateCategorizedEntitiesResultCollection(false, getExpectedBatchCategorizedEntities(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -414,7 +421,8 @@ public void recognizeEntitiesForListWithOptions(HttpClient httpClient, TextAnaly recognizeStringBatchCategorizedEntitiesShowStatsRunner((inputs, options) -> StepVerifier.create(client.recognizeEntitiesBatch(inputs, null, options)) .assertNext(response -> validateCategorizedEntitiesResultCollection(true, getExpectedBatchCategorizedEntities(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -423,12 +431,13 @@ public void recognizeEntitiesBatchTooManyDocuments(HttpClient httpClient, TextAn client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); tooManyDocumentsRunner(inputs -> StepVerifier.create(client.recognizeEntitiesBatch(inputs, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -440,7 +449,9 @@ public void recognizeEntitiesEmoji(HttpClient httpClient, TextAnalyticsServiceVe .assertNext(result -> result.forEach(categorizedEntity -> { assertEquals(9, categorizedEntity.getLength()); assertEquals(13, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), CATEGORIZED_ENTITY_INPUTS.get(1) ); } @@ -473,7 +484,9 @@ public void recognizeEntitiesEmojiWithSkinToneModifier(HttpClient httpClient, .assertNext(result -> result.forEach(categorizedEntity -> { assertEquals(9, categorizedEntity.getLength()); assertEquals(15, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), CATEGORIZED_ENTITY_INPUTS.get(1) ); } @@ -500,7 +513,9 @@ public void recognizeEntitiesEmojiFamilyWIthSkinToneModifier(HttpClient httpClie .assertNext(result -> result.forEach(categorizedEntity -> { assertEquals(9, categorizedEntity.getLength()); assertEquals(30, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), CATEGORIZED_ENTITY_INPUTS.get(1) ); } @@ -513,7 +528,9 @@ public void recognizeEntitiesDiacriticsNfc(HttpClient httpClient, TextAnalyticsS .assertNext(result -> result.forEach(categorizedEntity -> { assertEquals(9, categorizedEntity.getLength()); assertEquals(14, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), CATEGORIZED_ENTITY_INPUTS.get(1) ); } @@ -526,7 +543,9 @@ public void recognizeEntitiesDiacriticsNfd(HttpClient httpClient, TextAnalyticsS .assertNext(result -> result.forEach(categorizedEntity -> { assertEquals(9, categorizedEntity.getLength()); assertEquals(15, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), CATEGORIZED_ENTITY_INPUTS.get(1) ); } @@ -539,7 +558,9 @@ public void recognizeEntitiesKoreanNfc(HttpClient httpClient, TextAnalyticsServi .assertNext(result -> result.forEach(categorizedEntity -> { assertEquals(9, categorizedEntity.getLength()); assertEquals(13, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), CATEGORIZED_ENTITY_INPUTS.get(1) ); } @@ -552,7 +573,9 @@ public void recognizeEntitiesKoreanNfd(HttpClient httpClient, TextAnalyticsServi .assertNext(result -> result.forEach(categorizedEntity -> { assertEquals(9, categorizedEntity.getLength()); assertEquals(13, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), CATEGORIZED_ENTITY_INPUTS.get(1) ); } @@ -565,7 +588,9 @@ public void recognizeEntitiesZalgoText(HttpClient httpClient, TextAnalyticsServi .assertNext(result -> result.forEach(categorizedEntity -> { assertEquals(9, categorizedEntity.getLength()); assertEquals(126, categorizedEntity.getOffset()); - })).verifyComplete(), CATEGORIZED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), CATEGORIZED_ENTITY_INPUTS.get(1) ); } @@ -578,7 +603,8 @@ public void recognizePiiEntitiesForTextInput(HttpClient httpClient, TextAnalytic recognizePiiSingleDocumentRunner(document -> StepVerifier.create(client.recognizePiiEntities(document)) .assertNext(response -> validatePiiEntities(getPiiEntitiesList1(), response.stream().collect(Collectors.toList()))) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -588,7 +614,7 @@ public void recognizePiiEntitiesForEmptyText(HttpClient httpClient, TextAnalytic emptyTextRunner(document -> StepVerifier.create(client.recognizePiiEntities(document)) .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -597,7 +623,8 @@ public void recognizePiiEntitiesDuplicateIdInput(HttpClient httpClient, TextAnal client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); duplicateIdRunner(inputs -> StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); + .expectErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -606,12 +633,13 @@ public void recognizePiiEntitiesEmptyIdInput(HttpClient httpClient, TextAnalytic client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); emptyDocumentIdRunner(inputs -> StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -623,7 +651,9 @@ public void recognizePiiEntitiesBatchInputSingleError(HttpClient httpClient, Tex .assertNext(resultCollection -> resultCollection.getValue().forEach(recognizePiiEntitiesResult -> { Exception exception = assertThrows(TextAnalyticsException.class, recognizePiiEntitiesResult::getEntities); assertEquals(String.format(BATCH_ERROR_EXCEPTION_MESSAGE, "RecognizePiiEntitiesResult"), exception.getMessage()); - })).verifyComplete()); + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @Disabled("https://github.com/Azure/azure-sdk-for-java/issues/35642") @@ -634,7 +664,8 @@ public void recognizePiiEntitiesForBatchInput(HttpClient httpClient, TextAnalyti recognizeBatchPiiEntitiesRunner((inputs) -> StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, null)) .assertNext(response -> validatePiiEntitiesResultCollectionWithResponse(false, getExpectedBatchPiiEntities(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @Disabled("https://github.com/Azure/azure-sdk-for-java/issues/35642") @@ -645,7 +676,8 @@ public void recognizePiiEntitiesForBatchInputShowStatistics(HttpClient httpClien recognizeBatchPiiEntitiesShowStatsRunner((inputs, options) -> StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, options)) .assertNext(response -> validatePiiEntitiesResultCollectionWithResponse(true, getExpectedBatchPiiEntities(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @Disabled("https://github.com/Azure/azure-sdk-for-java/issues/35642") @@ -656,7 +688,8 @@ public void recognizePiiEntitiesForListLanguageHint(HttpClient httpClient, TextA recognizePiiLanguageHintRunner((inputs, language) -> StepVerifier.create(client.recognizePiiEntitiesBatch(inputs, language, null)) .assertNext(response -> validatePiiEntitiesResultCollection(false, getExpectedBatchPiiEntities(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @Disabled("https://github.com/Azure/azure-sdk-for-java/issues/35642") @@ -667,7 +700,8 @@ public void recognizePiiEntitiesForListStringWithOptions(HttpClient httpClient, recognizeStringBatchPiiEntitiesShowStatsRunner((inputs, options) -> StepVerifier.create(client.recognizePiiEntitiesBatch(inputs, null, options)) .assertNext(response -> validatePiiEntitiesResultCollection(true, getExpectedBatchPiiEntities(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -676,12 +710,13 @@ public void recognizePiiEntitiesBatchTooManyDocuments(HttpClient httpClient, Tex client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); tooManyDocumentsRunner(inputs -> StepVerifier.create(client.recognizePiiEntitiesBatch(inputs, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -693,7 +728,9 @@ public void recognizePiiEntitiesEmoji(HttpClient httpClient, TextAnalyticsServic .assertNext(result -> result.forEach(piiEntity -> { assertEquals(11, piiEntity.getLength()); assertEquals(8, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), PII_ENTITY_OFFSET_INPUT ); } @@ -707,7 +744,9 @@ public void recognizePiiEntitiesEmojiWithSkinToneModifier(HttpClient httpClient, .assertNext(result -> result.forEach(piiEntity -> { assertEquals(11, piiEntity.getLength()); assertEquals(10, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), PII_ENTITY_OFFSET_INPUT ); } @@ -720,7 +759,9 @@ public void recognizePiiEntitiesEmojiFamily(HttpClient httpClient, TextAnalytics .assertNext(result -> result.forEach(piiEntity -> { assertEquals(11, piiEntity.getLength()); assertEquals(17, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), PII_ENTITY_OFFSET_INPUT ); } @@ -734,7 +775,9 @@ public void recognizePiiEntitiesEmojiFamilyWIthSkinToneModifier(HttpClient httpC .assertNext(result -> result.forEach(piiEntity -> { assertEquals(11, piiEntity.getLength()); assertEquals(25, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), PII_ENTITY_OFFSET_INPUT ); } @@ -747,7 +790,9 @@ public void recognizePiiEntitiesDiacriticsNfc(HttpClient httpClient, TextAnalyti .assertNext(result -> result.forEach(piiEntity -> { assertEquals(11, piiEntity.getLength()); assertEquals(9, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), PII_ENTITY_OFFSET_INPUT ); } @@ -760,7 +805,9 @@ public void recognizePiiEntitiesDiacriticsNfd(HttpClient httpClient, TextAnalyti .assertNext(result -> result.forEach(piiEntity -> { assertEquals(11, piiEntity.getLength()); assertEquals(10, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), PII_ENTITY_OFFSET_INPUT ); } @@ -773,7 +820,9 @@ public void recognizePiiEntitiesKoreanNfc(HttpClient httpClient, TextAnalyticsSe .assertNext(result -> result.forEach(piiEntity -> { assertEquals(11, piiEntity.getLength()); assertEquals(8, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), PII_ENTITY_OFFSET_INPUT ); } @@ -786,7 +835,9 @@ public void recognizePiiEntitiesKoreanNfd(HttpClient httpClient, TextAnalyticsSe .assertNext(result -> result.forEach(piiEntity -> { assertEquals(11, piiEntity.getLength()); assertEquals(8, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), PII_ENTITY_OFFSET_INPUT ); } @@ -799,7 +850,9 @@ public void recognizePiiEntitiesZalgoText(HttpClient httpClient, TextAnalyticsSe .assertNext(result -> result.forEach(piiEntity -> { assertEquals(11, piiEntity.getLength()); assertEquals(121, piiEntity.getOffset()); - })).verifyComplete(), PII_ENTITY_OFFSET_INPUT + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), PII_ENTITY_OFFSET_INPUT ); } @@ -812,7 +865,8 @@ public void recognizePiiEntitiesForDomainFilter(HttpClient httpClient, TextAnaly StepVerifier.create(client.recognizePiiEntities(document, "en", options)) .assertNext(response -> validatePiiEntities(getPiiEntitiesList1ForDomainFilter(), response.stream().collect(Collectors.toList()))) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @Disabled("https://github.com/Azure/azure-sdk-for-java/issues/35642") @@ -824,7 +878,8 @@ public void recognizePiiEntitiesForBatchInputStringForDomainFilter(HttpClient ht StepVerifier.create(client.recognizePiiEntitiesBatch(inputs, language, new RecognizePiiEntitiesOptions().setDomainFilter(PiiEntityDomain.PROTECTED_HEALTH_INFORMATION))) .assertNext(response -> validatePiiEntitiesResultCollection(false, getExpectedBatchPiiEntitiesForDomainFilter(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @Disabled("https://github.com/Azure/azure-sdk-for-java/issues/35642") @@ -836,7 +891,8 @@ public void recognizePiiEntitiesForBatchInputForDomainFilter(HttpClient httpClie StepVerifier.create(client.recognizePiiEntitiesBatchWithResponse(inputs, new RecognizePiiEntitiesOptions().setDomainFilter(PiiEntityDomain.PROTECTED_HEALTH_INFORMATION))) .assertNext(response -> validatePiiEntitiesResultCollectionWithResponse(false, getExpectedBatchPiiEntitiesForDomainFilter(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -850,7 +906,8 @@ public void recognizePiiEntitiesForBatchInputForCategoriesFilter(HttpClient http .assertNext( resultCollection -> validatePiiEntitiesResultCollection(false, getExpectedBatchPiiEntitiesForCategoriesFilter(), resultCollection)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -874,7 +931,8 @@ public void recognizePiiEntityWithCategoriesFilterFromOtherResult(HttpClient htt validatePiiEntitiesResultCollection(false, getExpectedBatchPiiEntitiesForCategoriesFilter(), resultCollection); }) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); // Override whatever the categoriesFiler has currently final PiiEntityCategory[] piiEntityCategories = categories.toArray(new PiiEntityCategory[categories.size()]); @@ -885,7 +943,8 @@ public void recognizePiiEntityWithCategoriesFilterFromOtherResult(HttpClient htt .assertNext( resultCollection -> validatePiiEntitiesResultCollection(false, getExpectedBatchPiiEntitiesForCategoriesFilter(), resultCollection)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }); } @@ -897,7 +956,8 @@ public void recognizeLinkedEntitiesForTextInput(HttpClient httpClient, TextAnaly recognizeLinkedEntitiesForSingleTextInputRunner(input -> StepVerifier.create(client.recognizeLinkedEntities(input)) .assertNext(response -> validateLinkedEntity(getLinkedEntitiesList1().get(0), response.iterator().next())) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -908,7 +968,7 @@ public void recognizeLinkedEntitiesForEmptyText(HttpClient httpClient, TextAnaly StepVerifier.create(client.recognizeLinkedEntities(input)) .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -917,7 +977,8 @@ public void recognizeLinkedEntitiesDuplicateIdInput(HttpClient httpClient, TextA client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); duplicateIdRunner(inputs -> StepVerifier.create(client.recognizeLinkedEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); + .expectErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -926,12 +987,13 @@ public void recognizeLinkedEntitiesEmptyIdInput(HttpClient httpClient, TextAnaly client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); emptyDocumentIdRunner(inputs -> StepVerifier.create(client.recognizeLinkedEntitiesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -942,7 +1004,8 @@ public void recognizeLinkedEntitiesForBatchInput(HttpClient httpClient, TextAnal StepVerifier.create(client.recognizeLinkedEntitiesBatchWithResponse(inputs, null)) .assertNext(response -> validateLinkedEntitiesResultCollectionWithResponse(false, getExpectedBatchLinkedEntities(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -952,7 +1015,8 @@ public void recognizeLinkedEntitiesForBatchInputShowStatistics(HttpClient httpCl recognizeBatchLinkedEntitiesShowStatsRunner((inputs, options) -> StepVerifier.create(client.recognizeLinkedEntitiesBatchWithResponse(inputs, options)) .assertNext(response -> validateLinkedEntitiesResultCollectionWithResponse(true, getExpectedBatchLinkedEntities(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -962,7 +1026,8 @@ public void recognizeLinkedEntitiesForBatchStringInput(HttpClient httpClient, Te recognizeLinkedStringInputRunner((inputs) -> StepVerifier.create(client.recognizeLinkedEntitiesBatch(inputs, null, null)) .assertNext(response -> validateLinkedEntitiesResultCollection(false, getExpectedBatchLinkedEntities(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -972,7 +1037,8 @@ public void recognizeLinkedEntitiesForListLanguageHint(HttpClient httpClient, Te recognizeLinkedLanguageHintRunner((inputs, language) -> StepVerifier.create(client.recognizeLinkedEntitiesBatch(inputs, language, null)) .assertNext(response -> validateLinkedEntitiesResultCollection(false, getExpectedBatchLinkedEntities(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -982,7 +1048,8 @@ public void recognizeLinkedEntitiesForListStringWithOptions(HttpClient httpClien recognizeBatchStringLinkedEntitiesShowStatsRunner((inputs, options) -> StepVerifier.create(client.recognizeLinkedEntitiesBatch(inputs, null, options)) .assertNext(response -> validateLinkedEntitiesResultCollection(true, getExpectedBatchLinkedEntities(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -991,12 +1058,13 @@ public void recognizeLinkedEntitiesBatchTooManyDocuments(HttpClient httpClient, client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); tooManyDocumentsRunner(inputs -> StepVerifier.create(client.recognizeLinkedEntitiesBatch(inputs, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1010,7 +1078,9 @@ public void recognizeLinkedEntitiesEmoji(HttpClient httpClient, TextAnalyticsSer assertEquals(9, linkedEntityMatch.getLength()); assertEquals(13, linkedEntityMatch.getOffset()); }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), LINKED_ENTITY_INPUTS.get(1) ); } @@ -1026,7 +1096,9 @@ public void recognizeLinkedEntitiesEmojiWithSkinToneModifier(HttpClient httpClie assertEquals(9, linkedEntityMatch.getLength()); assertEquals(15, linkedEntityMatch.getOffset()); }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), LINKED_ENTITY_INPUTS.get(1) ); } @@ -1041,7 +1113,9 @@ public void recognizeLinkedEntitiesEmojiFamily(HttpClient httpClient, TextAnalyt assertEquals(9, linkedEntityMatch.getLength()); assertEquals(22, linkedEntityMatch.getOffset()); }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), LINKED_ENTITY_INPUTS.get(1) ); } @@ -1057,7 +1131,9 @@ public void recognizeLinkedEntitiesEmojiFamilyWIthSkinToneModifier(HttpClient ht assertEquals(9, linkedEntityMatch.getLength()); assertEquals(30, linkedEntityMatch.getOffset()); }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), LINKED_ENTITY_INPUTS.get(1) ); } @@ -1072,7 +1148,9 @@ public void recognizeLinkedEntitiesDiacriticsNfc(HttpClient httpClient, TextAnal assertEquals(9, linkedEntityMatch.getLength()); assertEquals(14, linkedEntityMatch.getOffset()); }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), LINKED_ENTITY_INPUTS.get(1) ); } @@ -1087,7 +1165,9 @@ public void recognizeLinkedEntitiesDiacriticsNfd(HttpClient httpClient, TextAnal assertEquals(9, linkedEntityMatch.getLength()); assertEquals(15, linkedEntityMatch.getOffset()); }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), LINKED_ENTITY_INPUTS.get(1) ); } @@ -1102,7 +1182,9 @@ public void recognizeLinkedEntitiesKoreanNfc(HttpClient httpClient, TextAnalytic assertEquals(9, linkedEntityMatch.getLength()); assertEquals(13, linkedEntityMatch.getOffset()); }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), LINKED_ENTITY_INPUTS.get(1) ); } @@ -1117,7 +1199,9 @@ public void recognizeLinkedEntitiesKoreanNfd(HttpClient httpClient, TextAnalytic assertEquals(9, linkedEntityMatch.getLength()); assertEquals(13, linkedEntityMatch.getOffset()); }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), LINKED_ENTITY_INPUTS.get(1) ); } @@ -1132,7 +1216,9 @@ public void recognizeLinkedEntitiesZalgoText(HttpClient httpClient, TextAnalytic assertEquals(9, linkedEntityMatch.getLength()); assertEquals(126, linkedEntityMatch.getOffset()); }); - })).verifyComplete(), LINKED_ENTITY_INPUTS.get(1) + })) + .expectComplete() + .verify(DEFAULT_TIMEOUT), LINKED_ENTITY_INPUTS.get(1) ); } @@ -1145,7 +1231,8 @@ public void extractKeyPhrasesForTextInput(HttpClient httpClient, TextAnalyticsSe StepVerifier.create(client.extractKeyPhrases(input)) .assertNext(keyPhrasesCollection -> validateKeyPhrases(asList("monde"), keyPhrasesCollection.stream().collect(Collectors.toList()))) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1156,7 +1243,7 @@ public void extractKeyPhrasesForEmptyText(HttpClient httpClient, TextAnalyticsSe StepVerifier.create(client.extractKeyPhrases(input)) .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify()); + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1165,7 +1252,8 @@ public void extractKeyPhrasesDuplicateIdInput(HttpClient httpClient, TextAnalyti client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); duplicateIdRunner(inputs -> StepVerifier.create(client.extractKeyPhrasesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); + .expectErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1174,12 +1262,13 @@ public void extractKeyPhrasesEmptyIdInput(HttpClient httpClient, TextAnalyticsSe client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); emptyDocumentIdRunner(inputs -> StepVerifier.create(client.extractKeyPhrasesBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1189,7 +1278,8 @@ public void extractKeyPhrasesForBatchInput(HttpClient httpClient, TextAnalyticsS extractBatchKeyPhrasesRunner((inputs) -> StepVerifier.create(client.extractKeyPhrasesBatchWithResponse(inputs, null)) .assertNext(response -> validateExtractKeyPhrasesResultCollectionWithResponse(false, getExpectedBatchKeyPhrases(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @@ -1200,7 +1290,8 @@ public void extractKeyPhrasesForBatchInputShowStatistics(HttpClient httpClient, extractBatchKeyPhrasesShowStatsRunner((inputs, options) -> StepVerifier.create(client.extractKeyPhrasesBatchWithResponse(inputs, options)) .assertNext(response -> validateExtractKeyPhrasesResultCollectionWithResponse(true, getExpectedBatchKeyPhrases(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1210,7 +1301,8 @@ public void extractKeyPhrasesForBatchStringInput(HttpClient httpClient, TextAnal extractKeyPhrasesStringInputRunner((inputs) -> StepVerifier.create(client.extractKeyPhrasesBatch(inputs, null, null)) .assertNext(response -> validateExtractKeyPhrasesResultCollection(false, getExpectedBatchKeyPhrases(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1220,7 +1312,8 @@ public void extractKeyPhrasesForListLanguageHint(HttpClient httpClient, TextAnal extractKeyPhrasesLanguageHintRunner((inputs, language) -> StepVerifier.create(client.extractKeyPhrasesBatch(inputs, language, null)) .assertNext(response -> validateExtractKeyPhrasesResultCollection(false, getExpectedBatchKeyPhrases(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1230,7 +1323,8 @@ public void extractKeyPhrasesForListStringWithOptions(HttpClient httpClient, Tex extractBatchStringKeyPhrasesShowStatsRunner((inputs, options) -> StepVerifier.create(client.extractKeyPhrasesBatch(inputs, null, options)) .assertNext(response -> validateExtractKeyPhrasesResultCollection(true, getExpectedBatchKeyPhrases(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -1239,12 +1333,13 @@ public void extractKeyPhrasesBatchTooManyDocuments(HttpClient httpClient, TextAn client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); tooManyDocumentsRunner(inputs -> StepVerifier.create(client.extractKeyPhrasesBatch(inputs, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } // Sentiment @@ -1259,7 +1354,8 @@ public void analyzeSentimentForTextInput(HttpClient httpClient, TextAnalyticsSer analyzeSentimentForSingleTextInputRunner(input -> StepVerifier.create(client.analyzeSentiment(input)) .assertNext(response -> validateDocumentSentiment(false, getExpectedDocumentSentiment(), response)) - .verifyComplete() + .expectComplete() + .verify(DEFAULT_TIMEOUT) ); } @@ -1273,7 +1369,8 @@ public void analyzeSentimentForTextInputWithDefaultLanguageHint(HttpClient httpC analyzeSentimentForSingleTextInputRunner(input -> StepVerifier.create(client.analyzeSentiment(input, null)) .assertNext(response -> validateDocumentSentiment(false, getExpectedDocumentSentiment(), response)) - .verifyComplete() + .expectComplete() + .verify(DEFAULT_TIMEOUT) ); } @@ -1287,7 +1384,8 @@ public void analyzeSentimentForTextInputWithOpinionMining(HttpClient httpClient, analyzeSentimentForTextInputWithOpinionMiningRunner((input, options) -> StepVerifier.create(client.analyzeSentiment(input, "en", options)) .assertNext(response -> validateDocumentSentiment(true, getExpectedDocumentSentiment(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1301,7 +1399,7 @@ public void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsSer StepVerifier.create(client.analyzeSentiment(document)) .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException && INVALID_DOCUMENT.equals(((TextAnalyticsException) throwable).getErrorCode())) - .verify() + .verify(DEFAULT_TIMEOUT) ); } @@ -1314,7 +1412,8 @@ public void analyzeSentimentDuplicateIdInput(HttpClient httpClient, TextAnalytic client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); duplicateIdRunner(inputs -> StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, new TextAnalyticsRequestOptions())) - .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass()))); + .expectErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())) + .verify(DEFAULT_TIMEOUT)); } /** @@ -1326,12 +1425,13 @@ public void analyzeSentimentEmptyIdInput(HttpClient httpClient, TextAnalyticsSer client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); emptyDocumentIdRunner(inputs -> StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } /** @@ -1350,7 +1450,8 @@ public void analyzeSentimentForBatchStringInput(HttpClient httpClient, TextAnaly StepVerifier.create(client.analyzeSentimentBatch(inputs, null, new TextAnalyticsRequestOptions())) .assertNext(response -> validateAnalyzeSentimentResultCollection(false, false, getExpectedBatchTextSentiment(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1367,7 +1468,8 @@ public void analyzeSentimentForListStringWithLanguageHint(HttpClient httpClient, analyzeSentimentLanguageHintRunner((inputs, language) -> StepVerifier.create(client.analyzeSentimentBatch(inputs, language, new TextAnalyticsRequestOptions())) .assertNext(response -> validateAnalyzeSentimentResultCollection(false, false, getExpectedBatchTextSentiment(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1384,7 +1486,8 @@ public void analyzeSentimentForListStringShowStatisticsExcludeOpinionMining(Http analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> StepVerifier.create(client.analyzeSentimentBatch(inputs, null, options.setIncludeOpinionMining(false))) .assertNext(response -> validateAnalyzeSentimentResultCollection(true, false, getExpectedBatchTextSentiment(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1402,7 +1505,8 @@ public void analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMinin options.setIncludeStatistics(false); StepVerifier.create(client.analyzeSentimentBatch(inputs, null, options)) .assertNext(response -> validateAnalyzeSentimentResultCollection(false, true, getExpectedBatchTextSentiment(), response)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }); } @@ -1420,7 +1524,8 @@ public void analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining(H analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> StepVerifier.create(client.analyzeSentimentBatch(inputs, null, options)) .assertNext(response -> validateAnalyzeSentimentResultCollection(true, true, getExpectedBatchTextSentiment(), response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1437,7 +1542,8 @@ public void analyzeSentimentForBatchInputWithNullRequestOptions(HttpClient httpC analyzeBatchSentimentRunner(inputs -> StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, (TextAnalyticsRequestOptions) null)) .assertNext(response -> validateAnalyzeSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1454,7 +1560,8 @@ public void analyzeSentimentForBatchInputShowStatistics(HttpClient httpClient, T analyzeBatchSentimentShowStatsRunner((inputs, requestOptions) -> StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, requestOptions)) .assertNext(response -> validateAnalyzeSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1471,7 +1578,8 @@ public void analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions(HttpCli analyzeBatchSentimentOpinionMining((inputs, options) -> StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, (AnalyzeSentimentOptions) null)) .assertNext(response -> validateAnalyzeSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1488,7 +1596,8 @@ public void analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining(Http analyzeBatchSentimentOpinionMining((inputs, options) -> StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, options.setIncludeOpinionMining(false))) .assertNext(response -> validateAnalyzeSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1507,7 +1616,8 @@ public void analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMinin StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, options)) .assertNext(response -> validateAnalyzeSentimentResultCollectionWithResponse(false, true, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete(); + .expectComplete() + .verify(DEFAULT_TIMEOUT); }); } @@ -1525,7 +1635,8 @@ public void analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining(H analyzeBatchSentimentOpinionMining((inputs, options) -> StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, options)) .assertNext(response -> validateAnalyzeSentimentResultCollectionWithResponse(true, true, getExpectedBatchTextSentiment(), 200, response)) - .verifyComplete()); + .expectComplete() + .verify(DEFAULT_TIMEOUT)); } /** @@ -1537,12 +1648,13 @@ public void analyzeSentimentBatchTooManyDocuments(HttpClient httpClient, TextAna client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); tooManyDocumentsRunner(inputs -> StepVerifier.create(client.analyzeSentimentBatch(inputs, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - })); + }) + .verify(DEFAULT_TIMEOUT)); } @Disabled("https://dev.azure.com/msazure/Cognitive%20Services/_workitems/edit/14262098") @@ -1567,7 +1679,8 @@ public void analyzeSentimentEmoji(HttpClient httpClient, TextAnalyticsServiceVer assertEquals(7, targetSentiment.getOffset()); }); })) - .verifyComplete(), + .expectComplete() + .verify(DEFAULT_TIMEOUT), SENTIMENT_OFFSET_INPUT ); } @@ -1594,7 +1707,8 @@ public void analyzeSentimentEmojiWithSkinToneModifier(HttpClient httpClient, Tex assertEquals(9, targetSentiment.getOffset()); }); })) - .verifyComplete(), + .expectComplete() + .verify(DEFAULT_TIMEOUT), SENTIMENT_OFFSET_INPUT ); } @@ -1624,7 +1738,8 @@ public void analyzeSentimentEmojiFamily(HttpClient httpClient, TextAnalyticsServ }); }) ) - .verifyComplete(), + .expectComplete() + .verify(DEFAULT_TIMEOUT), SENTIMENT_OFFSET_INPUT ); } @@ -1654,7 +1769,8 @@ public void analyzeSentimentEmojiFamilyWithSkinToneModifier(HttpClient httpClien assertEquals(24, targetSentiment.getOffset()); }); })) - .verifyComplete(), + .expectComplete() + .verify(DEFAULT_TIMEOUT), SENTIMENT_OFFSET_INPUT ); } @@ -1680,7 +1796,8 @@ public void analyzeSentimentDiacriticsNfc(HttpClient httpClient, TextAnalyticsSe assertEquals(8, targetSentiment.getOffset()); }); })) - .verifyComplete(), + .expectComplete() + .verify(DEFAULT_TIMEOUT), SENTIMENT_OFFSET_INPUT ); } @@ -1708,7 +1825,8 @@ public void analyzeSentimentDiacriticsNfd(HttpClient httpClient, TextAnalyticsSe assertEquals(9, targetSentiment.getOffset()); }); })) - .verifyComplete(), + .expectComplete() + .verify(DEFAULT_TIMEOUT), SENTIMENT_OFFSET_INPUT ); } @@ -1734,7 +1852,8 @@ public void analyzeSentimentKoreanNfc(HttpClient httpClient, TextAnalyticsServic assertEquals(7, targetSentiment.getOffset()); }); })) - .verifyComplete(), + .expectComplete() + .verify(DEFAULT_TIMEOUT), SENTIMENT_OFFSET_INPUT ); } @@ -1760,7 +1879,8 @@ public void analyzeSentimentKoreanNfd(HttpClient httpClient, TextAnalyticsServic assertEquals(7, targetSentiment.getOffset()); }); })) - .verifyComplete(), + .expectComplete() + .verify(DEFAULT_TIMEOUT), SENTIMENT_OFFSET_INPUT ); } @@ -1786,7 +1906,8 @@ public void analyzeSentimentZalgoText(HttpClient httpClient, TextAnalyticsServic assertEquals(120, targetSentiment.getOffset()); }); })) - .verifyComplete(), + .expectComplete() + .verify(DEFAULT_TIMEOUT), SENTIMENT_OFFSET_INPUT ); } @@ -1883,7 +2004,7 @@ public void healthcareLroEmptyInput(HttpClient httpClient, TextAnalyticsServiceV StepVerifier.create(client.beginAnalyzeHealthcareEntities(documents, null)) .expectErrorMatches(throwable -> throwable instanceof IllegalArgumentException && errorMessage.equals(throwable.getMessage())) - .verify(); + .verify(DEFAULT_TIMEOUT); }); } @@ -2304,7 +2425,7 @@ public void analyzeActionsEmptyInput(HttpClient httpClient, TextAnalyticsService .setRecognizeEntitiesActions(new RecognizeEntitiesAction()), null)) .expectErrorMatches(throwable -> throwable instanceof IllegalArgumentException && errorMessage.equals(throwable.getMessage())) - .verify()); + .verify(DEFAULT_TIMEOUT)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -2864,7 +2985,8 @@ public void beginAbstractSummaryDuplicateIdInput(HttpClient httpClient, client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); duplicateIdRunner(inputs -> { StepVerifier.create(client.beginAbstractSummary(inputs, null)) - .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())); + .expectErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())) + .verify(DEFAULT_TIMEOUT); }); } @@ -2875,12 +2997,13 @@ public void beginAbstractSummaryEmptyIdInput(HttpClient httpClient, TextAnalytic client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); emptyDocumentIdRunner(inputs -> { StepVerifier.create(client.beginAbstractSummary(inputs, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT, textAnalyticsError.getErrorCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); }); } @@ -2892,12 +3015,13 @@ public void beginAbstractSummaryTooManyDocuments(HttpClient httpClient, client = getTextAnalyticsAsyncClient(httpClient, serviceVersion, false); tooManyDocumentsRunner(inputs -> { StepVerifier.create(client.beginAbstractSummary(inputs, null, null)) - .verifyErrorSatisfies(ex -> { + .expectErrorSatisfies(ex -> { final HttpResponseException httpResponseException = (HttpResponseException) ex; assertEquals(400, httpResponseException.getResponse().getStatusCode()); final TextAnalyticsError textAnalyticsError = (TextAnalyticsError) httpResponseException.getValue(); assertEquals(INVALID_DOCUMENT_BATCH, textAnalyticsError.getErrorCode()); - }); + }) + .verify(DEFAULT_TIMEOUT); }); } diff --git a/sdk/webpubsub/azure-messaging-webpubsub-client/pom.xml b/sdk/webpubsub/azure-messaging-webpubsub-client/pom.xml index 19038dd253ea..ce90d7db24cf 100644 --- a/sdk/webpubsub/azure-messaging-webpubsub-client/pom.xml +++ b/sdk/webpubsub/azure-messaging-webpubsub-client/pom.xml @@ -86,7 +86,7 @@ com.azure azure-messaging-webpubsub - 1.2.7 + 1.2.8 test diff --git a/sdk/webpubsub/azure-messaging-webpubsub/CHANGELOG.md b/sdk/webpubsub/azure-messaging-webpubsub/CHANGELOG.md index 5732d144bb02..1d017ecefc99 100644 --- a/sdk/webpubsub/azure-messaging-webpubsub/CHANGELOG.md +++ b/sdk/webpubsub/azure-messaging-webpubsub/CHANGELOG.md @@ -10,6 +10,15 @@ ### Other Changes +## 1.2.8 (2023-09-22) + +### Other Changes + +#### Dependency Updates + +- Upgraded `azure-core-http-netty` from `1.13.6` to version `1.13.7`. +- Upgraded `azure-core` from `1.42.0` to version `1.43.0`. + ## 1.2.7 (2023-08-18) ### Other Changes diff --git a/sdk/webpubsub/azure-messaging-webpubsub/swagger/README.md b/sdk/webpubsub/azure-messaging-webpubsub/swagger/README.md index b2df1f898d93..b0a18b143405 100644 --- a/sdk/webpubsub/azure-messaging-webpubsub/swagger/README.md +++ b/sdk/webpubsub/azure-messaging-webpubsub/swagger/README.md @@ -19,6 +19,9 @@ data-plane: true generate-sync-async-clients: true service-name: WebPubSubService generate-builder-per-client: false +use-key-credential: false +partial-update: true +disable-client-builder: true service-versions: - '2021-10-01' - '2022-11-01'